コード例 #1
0
 public function deleteAction()
 {
     $user = $this->session->get('auth');
     $id = $this->dispatcher->getParam('id');
     $fit = Model\Fit::findFirst(array('id = :fid:', 'bind' => array('fid' => $id)));
     $cid = $fit->character_id;
     if ($fit && $user->isOwner($fit)) {
         foreach ($fit->parts as $part) {
             $part->delete();
         }
         $fit->delete();
         $this->flashSession->success('Fit Deleted');
     }
     return $this->response->redirect("character/fits/{$cid}");
 }
コード例 #2
0
 public function fitsAction()
 {
     $user = $this->session->get('auth');
     $id = $this->dispatcher->getParam('id');
     $char = Model\Character::findFirst(array('id = :cid:', 'bind' => array('cid' => $id)));
     //pull all the relevant data for sorting the results out of the url
     $meta = new PaginationMeta($this->dispatcher, array('fid' => 'id', 'type' => 'type_id', 'name' => 'name', 'date' => 'date_created'), array('order_by' => 'id', 'order' => 0, 'limit' => 10));
     $meta->baseLink = "character/fits/{$id}";
     //make the paginator
     $paginator = new Paginator\Adapter\Model(array('data' => Model\Fit::find(array("character_id = :cid:", "order" => $meta->query, "bind" => array('cid' => $char->id))), 'limit' => $meta->limit, 'page' => $meta->page));
     //set the data
     $this->view->user = $user;
     $this->view->char = $char;
     $this->view->page = $paginator->getPaginate();
     $this->view->page->meta = $meta;
     $this->view->site = 'user';
     $this->view->title = $char->name . "'s Fits";
 }