Beispiel #1
0
 public function index()
 {
     $this->cache_control('private', 5);
     if ($pid = fRequest::get('id', 'integer')) {
         Util::redirect('/problem/' . $pid);
     }
     $view_any = User::can('view-any-problem');
     $this->page = fRequest::get('page', 'integer', 1);
     $this->title = trim(fRequest::get('title', 'string'));
     $this->author = trim(fRequest::get('author', 'string'));
     $this->problems = Problem::find($view_any, $this->page, $this->title, $this->author);
     $this->page_url = SITE_BASE . '/problems?';
     if (!empty($this->title)) {
         $this->page_url .= 'title=' . fHTML::encode($this->title) . '&';
     }
     if (!empty($this->author)) {
         $this->page_url .= 'author=' . fHTML::encode($this->author) . '&';
     }
     $this->page_url .= 'page=';
     $this->page_records = $this->problems;
     $this->nav_class = 'problems';
     $this->render('problem/index');
 }
 /**
  * Return HTML buttons for flagging problem status
  * @return string
  */
 public function getButtons()
 {
     if (!isAdmin()) {
         return "Log in ด้วยสิทธิ Admin เพื่อเปลี่ยนสถานะของปัญหา";
     }
     $problem = Problem::find(intval(Input::get('id')));
     $type = $problem->problem_type;
     $status = $problem->status;
     $html = '';
     // 'Error' Button
     if ($type != 'HM' && $type != 'MP') {
         $html .= $this->getErrorButton($problem->id, 'true', $status, 'btn btn-default');
     }
     //$html .= '   ';
     // 'Not Error' Button
     $html .= $this->getErrorButton($problem->id, 'false', $status, 'btn btn-default');
     $html .= $this->getErrorButton($problem->id, 'undefined', $status, 'btn btn-default');
     return $html;
     // return Response::json($output);
 }