本文整理汇总了PHP中Participant::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Participant::select方法的具体用法?PHP Participant::select怎么用?PHP Participant::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Participant
的用法示例。
在下文中一共展示了Participant::select方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove_points_iteration
private function remove_points_iteration($task_set, $points_to_remove, $task_set_id, $task_set_course_id, $task_set_group_id, &$error_code = 0, &$students = NULL)
{
$this->_transaction_isolation();
$this->db->trans_begin();
if (!is_null($task_set->upload_end_time)) {
$timestamp_end = strtotime($task_set->upload_end_time);
if (time() > $timestamp_end) {
$participants = new Participant();
$participants->select('*');
$participants->select_subquery('(SELECT `solutions`.`id` FROM `solutions` WHERE `solutions`.`task_set_id` = ' . $task_set_id . ' AND `solutions`.`student_id` = `${parent}`.`student_id`)', 'solution_id');
$participants->where_related_course('id', $task_set_course_id);
if ($task_set->group->exists() && !is_null($task_set_group_id)) {
$participants->where_related_group('id', $task_set_group_id);
}
$participants->where('allowed', 1);
$participants->get_iterated();
$notify_students = array(0);
foreach ($participants as $participant) {
if (is_null($participant->solution_id) && !is_null($participant->student_id)) {
$solution = new Solution();
$solution->task_set_id = $task_set_id;
$solution->student_id = $participant->student_id;
$solution->teacher_id = $this->usermanager->get_teacher_id();
$solution->points = -$points_to_remove;
$solution->revalidate = 0;
if ($solution->save()) {
$notify_students[] = $participant->student_id;
}
}
}
if ($this->db->trans_status()) {
$this->db->trans_commit();
$students = new Student();
$students->where_in('id', $notify_students);
$students->get();
//$result->mail_sent = $this->_send_multiple_emails($students, 'lang:admin_solutions_remove_points_notification_subject', 'file:emails/backend/solutions/remove_points_notify.tpl', array('task_set' => $task_set, 'points_to_remove' => $points_to_remove));
return TRUE;
} else {
$this->db->trans_rollback();
//$result->message = $this->lang->line('admin_solutions_remove_points_error_unknown');
$error_code = 1;
return FALSE;
}
} else {
$this->db->trans_rollback();
//$result->message = $this->lang->line('admin_solutions_remove_points_error_task_set_upload_limit_not_reached');
$error_code = 2;
return FALSE;
}
} else {
$this->db->trans_rollback();
//$result->message = $this->lang->line('admin_solutions_remove_points_error_task_set_upload_not_limited');
$error_code = 3;
return FALSE;
}
}