当前位置: 首页>>代码示例>>PHP>>正文


PHP Participant::where_related_course方法代码示例

本文整理汇总了PHP中Participant::where_related_course方法的典型用法代码示例。如果您正苦于以下问题:PHP Participant::where_related_course方法的具体用法?PHP Participant::where_related_course怎么用?PHP Participant::where_related_course使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Participant的用法示例。


在下文中一共展示了Participant::where_related_course方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:31,代码来源:courses.php

示例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;
     }
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:56,代码来源:solutions.php

示例3: signup_to_course

 public function signup_to_course($course_id)
 {
     $this->output->set_content_type('application/json');
     $output = new stdClass();
     $output->status = FALSE;
     $output->message = '';
     $output->content = '';
     $this->_transaction_isolation();
     $this->db->trans_begin();
     $student = new Student();
     $student->get_by_id($this->usermanager->get_student_id());
     $course = new Course();
     $course->where('hide_in_lists', 0);
     $course->get_by_id($course_id);
     if ($course->exists()) {
         if ($course->is_subscription_allowed()) {
             if ($student->participant->where_related($course)->count() == 0) {
                 if ($course->auto_accept_students == 1) {
                     $participants = new Participant();
                     $participants->where_related_course($course);
                     $participants->where('allowed', 1);
                     $participants_count = $participants->count();
                     if ($participants_count >= (int) $course->capacity) {
                         $output->message = $this->lang->line('courses_message_course_is_full');
                         $output->status = FALSE;
                         $this->db->trans_rollback();
                     } else {
                         $participant = new Participant();
                         $participant->allowed = 1;
                         $participant->save(array($student, $course));
                         $this->db->trans_commit();
                         $output->message = sprintf($this->lang->line('courses_message_signed_up_for_course_approved'), $this->lang->text($course->name));
                         $this->parser->assign('course', $course);
                         $output->content = $this->parser->parse('frontend/courses/single_course.tpl', array(), TRUE);
                         $output->status = TRUE;
                         $this->_action_success();
                     }
                 } else {
                     $participant = new Participant();
                     $participant->allowed = 0;
                     $participant->save(array($student, $course));
                     $this->db->trans_commit();
                     $output->message = sprintf($this->lang->line('courses_message_signed_up_for_course'), $this->lang->text($course->name));
                     $this->parser->assign('course', $course);
                     $output->content = $this->parser->parse('frontend/courses/single_course.tpl', array(), TRUE);
                     $output->status = TRUE;
                     $this->_action_success();
                 }
             } else {
                 $output->message = $this->lang->line('courses_message_already_in_course_or_waiting_for_approwal');
                 $this->db->trans_rollback();
             }
         } else {
             $output->message = $this->lang->line('courses_message_subscription_disallowed');
             $this->db->trans_rollback();
         }
     } else {
         $output->message = $this->lang->line('courses_message_course_not_found');
         $this->db->trans_rollback();
     }
     $this->output->set_output(json_encode($output));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:62,代码来源:courses.php

示例4: select_project

 public function select_project($task_set_id, $task_id, $student_id)
 {
     $output = new stdClass();
     $output->message = '';
     $output->status = FALSE;
     $this->_transaction_isolation();
     $this->db->trans_begin();
     $task_set = new Task_set();
     $task_set->where('content_type', 'project');
     $task_set->get_by_id((int) $task_set_id);
     $task = new Task();
     $task->get_by_id((int) $task_id);
     $student = new Student();
     $student->get_by_id((int) $student_id);
     $course = new Course();
     $course->where_related_task_set($task_set);
     $course->get();
     $participant = new Participant();
     $participant->where_related_course($course);
     $participant->where_related($student);
     $participant->where('allowed', 1);
     $participant->get();
     $project_selection = new Project_selection();
     $project_selection->where_related_student($student);
     $project_selection->where_related_task_set($task_set);
     $project_selection->get();
     if ($task_set->exists() && $task->exists() && $task_set->is_related_to($task) && $student->exists() && $course->exists() && $participant->exists()) {
         if ($task_set->get_student_files_count($student->id) == 0) {
             $all_project_selections = new Project_selection();
             $all_project_selections->where_related_task_set($task_set);
             $all_project_selections->where_related_task($task);
             $currently_selected = $all_project_selections->count();
             $jf_task = $task_set->task->include_join_fields()->get_by_id($task_id);
             $maximum_selections = (int) $jf_task->join_max_projects_selections;
             if ($project_selection->exists()) {
                 if (!$project_selection->is_related_to($task)) {
                     if ($currently_selected < $maximum_selections) {
                         $project_selection->save($task);
                         $output->status = TRUE;
                         $output->message = $this->lang->line('admin_task_sets_project_selection_success');
                     } else {
                         $output->message = $this->lang->line('admin_task_sets_project_selection_no_room');
                     }
                 } else {
                     $output->message = $this->lang->line('admin_task_sets_project_selection_already_selected');
                 }
             } else {
                 if ($currently_selected < $maximum_selections) {
                     $project_selection->save(array('student' => $student, 'task_set' => $task_set, 'task' => $task));
                     $output->status = TRUE;
                     $output->message = $this->lang->line('admin_task_sets_project_selection_success');
                 } else {
                     $output->message = $this->lang->line('admin_task_sets_project_selection_no_room');
                 }
             }
         } else {
             $output->message = $this->lang->line('admin_task_sets_project_selection_already_submited_solutions');
         }
     } else {
         $output->message = $this->lang->line('admin_task_sets_project_selection_cant_find_data');
     }
     if ($output->status) {
         $this->db->trans_commit();
         $this->_action_success();
     } else {
         $this->db->trans_rollback();
     }
     $this->output->set_content_type('application/json');
     $this->output->set_output(json_encode($output));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:70,代码来源:task_sets.php


注:本文中的Participant::where_related_course方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。