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


PHP Participant::include_related方法代码示例

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


在下文中一共展示了Participant::include_related方法的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));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:31,代码来源:courses.php

示例2: change_group

 public function change_group($participant_id)
 {
     $group_id = $this->input->post('group_id');
     $this->_transaction_isolation();
     $this->db->trans_begin();
     $participant = new Participant();
     $participant->get_by_id($participant_id);
     $group = new Group();
     $group->get_by_id($group_id);
     $course = $participant->course->get();
     if ($group->exists()) {
         if ($group->is_related_to($course)) {
             $participant->save($group);
         }
     } else {
         $current_group = $participant->group->get();
         $participant->delete($current_group);
     }
     $is_ok = TRUE;
     if ($group->exists()) {
         if ($participant->allowed == 1) {
             $group_for_test = new Group();
             $rooms = $group_for_test->room;
             $rooms->select_min('capacity');
             $rooms->where('group_id', '${parent}.id', FALSE);
             $group_for_test->select_subquery($rooms, 'group_capacity');
             $group_for_test->include_related_count('participant');
             $group_for_test->where_related_participant('allowed', 1);
             $group_for_test->get_by_id(intval($participant->group_id));
             if ($group_for_test->exists()) {
                 if (intval($group_for_test->participant_count) > intval($group_for_test->group_capacity)) {
                     $is_ok = FALSE;
                 }
             }
         }
     }
     if ($is_ok && $this->db->trans_status()) {
         $this->db->trans_commit();
         $this->_action_success();
         $this->output->set_internal_value('student_id', $participant->student_id);
         $this->output->set_internal_value('course_id', $participant->course_id);
     } else {
         $this->db->trans_rollback();
     }
     $participant->include_related('group', 'name');
     $participant->get_by_id($participant_id);
     $this->parser->parse('backend/participants/group_column.tpl', array('participant' => $participant));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:48,代码来源:participants.php


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