本文整理汇总了PHP中Participant::get_iterated方法的典型用法代码示例。如果您正苦于以下问题:PHP Participant::get_iterated方法的具体用法?PHP Participant::get_iterated怎么用?PHP Participant::get_iterated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Participant
的用法示例。
在下文中一共展示了Participant::get_iterated方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mail_to_course
public function mail_to_course($course_id)
{
$course = new Course();
$course->include_related('period', 'name');
$course->get_by_id((int) $course_id);
if ($course->exists()) {
$groups = new Group();
$groups->where_related_course('id', $course->id);
$groups->order_by_with_constant('name', 'asc');
$groups->get_iterated();
$groups_students = array();
foreach ($groups as $group) {
$groups_students[$group->id] = array('name' => $group->name, 'students' => array());
}
$groups_students[0] = array('name' => 'lang:admin_courses_mail_to_course_group_name_unassigned_students', 'students' => array());
$participants = new Participant();
$participants->where('allowed', 1);
$participants->include_related('student');
$participants->where_related_course('id', $course->id);
$participants->order_by_related_as_fullname('student', 'fullname', 'asc');
$participants->get_iterated();
foreach ($participants as $participant) {
$groups_students[(int) $participant->group_id]['students'][(int) $participant->student_id] = array('fullname' => $participant->student_fullname, 'email' => $participant->student_email);
}
$this->parser->assign('groups_students', $groups_students);
}
$this->_add_tinymce4();
$this->parser->add_js_file('admin_courses/mail_form.js');
$this->parser->add_css_file('admin_courses.css');
$this->parser->parse('backend/courses/mail_to_course.tpl', array('course' => $course));
}
示例2: 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;
}
}