QuotePage->recursive = 0; $this->set('quotePages', $this->paginate()); } function view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid QuotePage.', true)); $this->redirect(array('action'=>'index')); } $this->set('quotePage', $this->QuotePage->read(null, $id)); } function add($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid Quote ID', true)); $this->redirect(array('controller' => 'quotes', 'action'=>'index')); } if (!empty($this->data)) { $this->QuotePage->create(); if ($this->QuotePage->save($this->data)) { $this->Session->setFlash(__('The Quote Page has been saved', true)); $this->redirect(array('controller'=>'quotes', 'action'=>'view/'.$this->data['QuotePage']['quote_id'])); } else { $this->Session->setFlash(__('The Quote Page could not be saved. Please, try again.', true)); } } $quotes = $this->QuotePage->Quote->find('list'); $this->set(compact('quotes')); $this->set('quoteid', $id); $number_of_pages = $this->QuotePage->find('count', array('conditions' => array('QuotePage.quote_id'=>$id))); $number_of_pages++; $this->set('pagenumber', $number_of_pages); } function edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid QuotePage', true)); $this->redirect(array('action'=>'index')); } if (!empty($this->data)) { if ($this->QuotePage->save($this->data)) { $this->Session->setFlash(__('The QuotePage has been saved', true)); $id = $this->data['QuotePage']['quote_id']; $this->redirect(array('controller' => 'quotes', 'action'=>'view/'.$id)); } else { $this->Session->setFlash(__('The QuotePage could not be saved. Please, try again.', true)); } } if (empty($this->data)) { $this->data = $this->QuotePage->read(null, $id); $this->set('content', $this->data['QuotePage']['content']); } $quotes = $this->QuotePage->Quote->find('list'); $this->set(compact('quotes')); } function delete($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid id for QuotePage', true)); $this->redirect(array('action'=>'index')); } $quotepage = $this->QuotePage->findById($id); $quoteid = $quotepage['QuotePage']['quote_id']; if ($this->QuotePage->del($id)) { $this->Session->setFlash(__('Quote Page deleted', true)); $this->redirect(array('controller' => 'quotes' , 'action'=>'view', $quoteid)); } } function show($id = null) { $this->layout = 'ajax'; $this->set('quotePage', $this->QuotePage->read(null, $id)); } function frame($id = null) { $this->layout = 'ajax'; $this->set('id', $id); } } ?>