本文整理汇总了PHP中Activity::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Activity::select方法的具体用法?PHP Activity::select怎么用?PHP Activity::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity::select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: graphData
private function graphData($type, $from, $to, $distinct = false)
{
if ($distinct) {
return Activity::select(DB::raw('distinct `ip_address` '))->whereBetween('created_at', array($from, $to))->where('content_type', '=', $type)->count();
} else {
return Activity::whereBetween('created_at', array($from, $to))->where('content_type', '=', $type)->count();
}
}
示例2: index
function index()
{
$students = new Student();
$activities = new Activity();
$result = array();
$info = $this->loadModel()->selectAll();
foreach ($info as $key => $item) {
extract($item["Activities_student"]);
$st = $students->select($student_id);
$st2 = array_shift($st);
$ac = $activities->select($activity_id);
$ac2 = array_shift($ac);
$arr = array('student_id' => $st2['first_name'] . " " . $st2['last_name'], 'f_number' => $st2['f_number'], 'activity_id' => $ac2['name'], 'point' => $ac2['point'], 'created_at' => $created_at);
array_push($result, $arr);
}
$this->set('students', $result);
}
示例3: ActivityInstance
function handler_ajax_modify($page, $type)
{
$json = json_decode(Env::v('json'));
if ($type == 'instance') {
$id = $json->admin_id;
$ai = new ActivityInstance($id);
$ai->select(ActivityInstanceSelect::base());
if (!S::user()->hasRights($ai->target()->group(), Rights::admin())) {
throw new Exception("Invalid credentials");
}
S::assert_xsrf_token();
try {
$begin = new FrankizDateTime($json->begin);
$end = new FrankizDateTime($json->end);
if ($ai->regular()) {
$ai->comment($json->activity_comment);
$ai->begin($begin);
$ai->end($end);
} else {
$ai->begin($begin);
$ai->end($end);
$a = $ai->activity();
$a->title($json->title);
$a->description($json->activity_description);
}
$page->jsonAssign('success', true);
} catch (Exception $e) {
$page->jsonAssign('success', false);
}
} else {
if ($type == 'regular') {
$id = $json->aid;
$a = new Activity($id);
$a->select(ActivitySelect::base());
if (!S::user()->hasRights($a->target()->group(), Rights::admin())) {
throw new Exception("Invalid credentials");
}
S::assert_xsrf_token();
if (preg_match('`^\\d{2}:\\d{2}:\\d{2}$`', $json->begin) && strtotime($json->begin) !== false && preg_match('`^\\d{2}:\\d{2}:\\d{2}$`', $json->end) && strtotime($json->end) !== false) {
$a->title($json->title);
$a->description($json->activity_description);
$key = 'days[]';
$days = unflatten($json->{$key});
$a->days(implode(',', $days));
$a->default_begin($json->begin);
$a->default_end($json->end);
$page->jsonAssign('success', true);
} else {
$page->jsonAssign('success', false);
}
}
}
return PL_JSON;
}