private function setModel($row) { $model = new Application_Model_Book(); $model->setId($row->id)->setTitle($row->title)->setIsbn($row->isbn)->setAuthor($row->author)->setDescription($row->description)->setPublisher($row->publisher)->setAddedon($row->addedon)->setUpdatedon($row->updatedon); return $model; }
public function historyAction() { $bookId = $this->_getParam("id"); $model = new Application_Model_Book(); $book = $model->find($bookId); if (false === $book) { exit("Operation failed!"); } $this->view->book = $book; $model = new Application_Model_BookUser(); $table = $model->getMapper()->getDbTable(); $select = $table->select()->setIntegrityCheck(false)->from(array("bu" => 'book_user'))->join(array('u' => 'user'), ' bu.user_id = u.id ', array("first_name" => "first_name", "last_name" => "last_name", "employee_code" => "employee_code", "email" => "email", "profile_picture" => "profile_picture"))->order("issue_date asc")->where("book_id='{$bookId}'"); //$this->view->bookUser=$bookUser=$table->fetchAll($select); $this->view->page_size = $page_size = $this->_getParam('page_size', 25); $page = $this->_getParam('page', 1); $paginator = Base_Paginator::factory($select); $paginator->setItemCountPerPage($page_size); $paginator->setCurrentPageNumber($page); $this->view->totalItems = $paginator->getTotalItemCount(); $this->view->paginator = $paginator; }