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


PHP Teacher::where_related方法代码示例

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


在下文中一共展示了Teacher::where_related方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: selected_teachers

 public function selected_teachers()
 {
     if (!is_null($this->id)) {
         $teachers = new Teacher();
         $teachers->where_related($this);
         $teachers->get_iterated();
         $output = array();
         foreach ($teachers as $teacher) {
             $output[$teacher->id] = $teacher->id;
         }
         return $output;
     }
     return array();
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:14,代码来源:room.php

示例2: inject_task_set_authors

 private function inject_task_set_authors($task_set_id)
 {
     $teachers = new Teacher();
     $teachers->where_related('task/task_set', 'id', (int) $task_set_id);
     $teachers->order_by_as_fullname('fullname');
     $teachers->get_iterated();
     $authors = array();
     foreach ($teachers as $teacher) {
         $authors[$teacher->id] = $teacher->fullname;
     }
     $this->parser->assign('authors', $authors);
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:12,代码来源:solutions.php

示例3: create_comment

 private function create_comment()
 {
     $post_data = $this->input->post('comment');
     if (array_key_exists('text', $post_data) && array_key_exists('task_set_id', $post_data) && array_key_exists('reply_at_id', $post_data)) {
         $task_set = new Task_set();
         $task_set->get_by_id(intval($post_data['task_set_id']));
         $student = new Student();
         $student->get_by_id($this->usermanager->get_student_id());
         if ($task_set->exists() && $student->exists() && (bool) $task_set->comments_enabled) {
             if (trim(strip_tags($post_data['text'])) != '') {
                 $text = strip_tags($post_data['text'], '<a><strong><em><span>');
                 $comment = new Comment();
                 $comment->text = $text;
                 $comment->approved = (bool) $task_set->comments_moderated ? 0 : 1;
                 $comment->reply_at_id = empty($post_data['reply_at_id']) ? NULL : intval($post_data['reply_at_id']);
                 $this->_transaction_isolation();
                 $this->db->trans_begin();
                 if ($comment->save(array($task_set, $student))) {
                     $this->db->trans_commit();
                     $this->messages->add_message('lang:tasks_comments_message_comment_post_success_save', Messages::MESSAGE_TYPE_SUCCESS);
                     if ((bool) $comment->approved) {
                         $all_students = $task_set->comment_subscriber_student;
                         $all_students->where('id !=', $this->usermanager->get_student_id());
                         $all_students->get();
                         $this->_send_multiple_emails($all_students, 'lang:tasks_comments_email_subject_new_post', 'file:emails/frontend/comments/new_comment_student.tpl', array('task_set' => $task_set, 'student' => $student, 'comment' => $comment));
                         $task_set_related_teachers = new Teacher();
                         if (!is_null($task_set->group_id)) {
                             $task_set_related_teachers->where_related('room/group', 'id', $task_set->group_id);
                         } else {
                             $task_set_related_teachers->where_related('room/group/course', 'id', $task_set->course_id);
                         }
                         $task_set_related_teachers->group_by('id');
                         $all_teachers = new Teacher();
                         $all_teachers->where_related('comment_subscription', 'id', $task_set->id);
                         $all_teachers->union($task_set_related_teachers, FALSE, '', NULL, NULL, 'id');
                         $all_teachers->check_last_query();
                         $this->_send_multiple_emails($all_teachers, 'lang:tasks_comments_email_subject_new_post', 'file:emails/frontend/comments/new_comment_teacher.tpl', array('task_set' => $task_set, 'student' => $student, 'comment' => $comment));
                     }
                     return TRUE;
                 } else {
                     $this->db->trans_rollback();
                     $this->messages->add_message('lang:tasks_comments_message_comment_post_error_save', Messages::MESSAGE_TYPE_ERROR);
                     return FALSE;
                 }
             } else {
                 $this->messages->add_message('lang:tasks_comments_message_comment_post_error_empty', Messages::MESSAGE_TYPE_ERROR);
                 return FALSE;
             }
         } else {
             $this->messages->add_message('lang:tasks_comments_message_not_found_or_disabled', Messages::MESSAGE_TYPE_ERROR);
             return FALSE;
         }
     } else {
         $this->messages->add_message('lang:tasks_comments_message_comment_post_error_data', Messages::MESSAGE_TYPE_ERROR);
         return FALSE;
     }
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:57,代码来源:tasks.php


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