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


PHP EfrontLesson::getUsersCompleted方法代码示例

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


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

示例1: getRecipients

 public function getRecipients()
 {
     $recipients_list = array();
     if (isset($this->notification['send_conditions'])) {
         //echo $this -> notification['send_conditions'];
         if ($this->notification['send_conditions'] == "N;") {
             $recipients = eF_getTableData("users", "*", "active=1 and archive=0");
             //sending_queue_msgs[$key]['recipients'] = _ALLUSERS;
             foreach ($recipients as $recipient) {
                 $recipients_list[$recipient['login']] = $recipient;
             }
         } else {
             // the send_conditions field contains the information which identify the recipients
             // it is defined in ....
             //digests.php during the definition of the event notification
             $this->notification['send_conditions'] = unserialize($this->notification['send_conditions']);
             if ($this->notification['send_conditions'] == "supervisors") {
                 if (G_VERSIONTYPE == 'enterprise') {
                     #cpp#ifdef ENTERPRISE
                     $recipients = eF_getTableData("module_hcd_employee_works_at_branch as meb, users as u", "u.*", "meb.users_login=u.login and u.active=1 and u.archive=0 and meb.supervisor=1");
                     foreach ($recipients as $recipient) {
                         $recipients_list[$recipient['login']] = $recipient;
                     }
                 }
                 #cpp#endif
             } elseif (is_array($this->notification['send_conditions'])) {
                 $this->recipients = $this->notification['send_conditions'];
                 // The recipients array definitely exists, due to constructor checks
                 if (isset($this->recipients["lessons_ID"]) && $this->recipients["lessons_ID"]) {
                     $lesson = new EfrontLesson($this->recipients["lessons_ID"]);
                     if (isset($this->recipients["user_type"])) {
                         // return lesson users of specific type
                         $recipients = array();
                         foreach ($lesson->getUsers($this->recipients["user_type"]) as $value) {
                             if ($value['active']) {
                                 $recipients[] = $value;
                             }
                         }
                     } else {
                         if (isset($this->recipients["completed"])) {
                             // return lesson students according to whether they have completed the lesson or not
                             $recipients = array();
                             foreach ($lesson->getUsersCompleted($this->recipients["completed"]) as $value) {
                                 if ($value['active']) {
                                     $recipients[] = $value;
                                 }
                             }
                         } else {
                             // return all users
                             $recipients = array();
                             foreach ($lesson->getUsers() as $value) {
                                 if ($value['active']) {
                                     $recipients[] = $value;
                                 }
                             }
                         }
                     }
                 } else {
                     if (isset($this->recipients["courses_ID"])) {
                         $entity_parts = explode("_", $this->notification['id_type_entity']);
                         $notification_type = $entity_parts[1];
                         if ($this->recipients['user_type'] == "professor") {
                             $completed_condition = " AND uc.user_type = 'professor'";
                         } else {
                             if ($this->recipients['completed'] == "1") {
                                 $completed_condition = " AND completed = '1'";
                             } else {
                                 if ($this->recipients['completed'] == "2" || $notification_type == EfrontEvent::COURSE_PROGRAMMED_EXPIRY) {
                                     $completed_condition = " AND completed = '0' and uc.user_type in ('" . implode("','", array_keys(EfrontLessonUser::getStudentRoles())) . "')";
                                 } else {
                                     $completed_condition = "";
                                 }
                             }
                         }
                         if ($this->recipients['supervisor']) {
                             if ($this->recipients['users_login']) {
                                 $editedUser = EfrontUserFactory::factory($this->recipients['users_login']);
                                 //new EfrontUser();
                                 $editedEmployee = $editedUser->aspects['hcd'];
                                 $supervisors = $editedEmployee->getSupervisors();
                                 $recipients = array();
                                 foreach ($supervisors as $supervisor) {
                                     $recipients[$supervisor] = array("login" => $supervisor);
                                 }
                             } else {
                                 $query = "select distinct u.login, u.name, u.surname, u.email, u.user_type as basic_user_type, u.active, u.user_types_ID from module_hcd_employee_works_at_branch ewb join users u on u.login=ewb.users_login where supervisor=1 and u.active=1 and u.archive=0 and branch_ID in (select branch_ID from module_hcd_employee_works_at_branch ewb, users_to_courses uc where uc.users_LOGIN=ewb.users_login and uc.courses_ID=" . $this->recipients["courses_ID"] . " and uc.archive=0)";
                                 //get course users' supervisors
                                 $result = eF_executeNew($query);
                                 $recipients = $result->getAll();
                             }
                         } elseif ($this->recipients['immediate_supervisor']) {
                             if ($this->recipients['users_login']) {
                                 $result = eF_getTableDataFlat("module_hcd_employee_works_at_branch", "users_LOGIN", "supervisor=1 and assigned=1 and branch_ID IN (select branch_ID from module_hcd_employee_works_at_branch where assigned=1 and supervisor=0 and users_login='" . $this->recipients['users_login'] . "')");
                                 $recipients = array();
                                 foreach ($result['users_LOGIN'] as $supervisor) {
                                     $recipients[$supervisor] = array("login" => $supervisor);
                                 }
                                 $filtered_recipients = array();
                                 if (!empty($recipients)) {
                                     $active_recipients = eF_getTableDataFlat("users", "login", "active=1 and archive=0 and login IN ('" . implode("','", array_keys($recipients)) . "')");
//.........这里部分代码省略.........
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:101,代码来源:notification.class.php


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