public function view($page = 1) { $this->authority(50); $doc_table = new DocumentTable(); $count = $doc_table->count(); $page = Util::calculate_page($count, 10, $page); $docs = $doc_table->select_ten($page['start_num']); $view_data = array('docs' => $docs, 'page' => $page); $this->my_render('view', $view_data); }
public function executeDeleteFromTransaction(sfWebRequest $request) { $request->checkCSRFProtection(); $this->forward404Unless($document = DocumentTable::getInstance()->find(array($request->getParameter('id'))), sprintf('Object document does not exist (%s).', $request->getParameter('id'))); $this->checkAuthorisation($document->getAsso()); $transaction = $document->getTransaction(); $document->deleteAndUnlink(); $this->redirect('transaction_show', $transaction); }
public function executeShow(sfWebRequest $request) { $this->transaction = $this->getRoute()->getObject(); $this->checkAuthorisation($this->transaction->getAsso()); $this->documents = DocumentTable::getInstance()->getAllForTransaction($this->transaction)->execute(); $document = new Document(); $document->asso_id = $this->transaction->getAssoId(); $document->transaction_id = $this->transaction->getPrimaryKey(); $this->form = new DocumentForm($document); $this->getResponse()->setSlot('current_asso', $this->transaction->getAsso()); }
public function getAllForTransaction($transaction) { $q = DocumentTable::getInstance()->createQuery('q')->where('q.transaction_id = ?', $transaction->getPrimaryKey()); return $q; }