本文整理汇总了PHP中Problem::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Problem::find方法的具体用法?PHP Problem::find怎么用?PHP Problem::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Problem
的用法示例。
在下文中一共展示了Problem::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
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');
}
示例2: getButtons
/**
* 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);
}