예제 #1
0
 function fetchPrintMemberData($a_members)
 {
     global $ilAccess, $lng;
     $lng->loadLanguageModule('trac');
     #$is_admin = (bool) $ilAccess->checkAccess("write",'',$this->object->getRefId());
     $is_admin = true;
     include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
     $privacy = ilPrivacySettings::_getInstance();
     if ($privacy->enabledCourseAccessTimes()) {
         include_once './Services/Tracking/classes/class.ilLearningProgress.php';
         $progress = ilLearningProgress::_lookupProgressByObjId($this->object->getId());
     }
     if ($this->show_tracking) {
         include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
         $completed = ilLPStatusWrapper::_lookupCompletedForObject($this->object->getId());
         $in_progress = ilLPStatusWrapper::_lookupInProgressForObject($this->object->getId());
         $failed = ilLPStatusWrapper::_lookupFailedForObject($this->object->getId());
     }
     foreach ($a_members as $member_id) {
         // GET USER OBJ
         if ($tmp_obj = ilObjectFactory::getInstanceByObjId($member_id, false)) {
             $print_member[$member_id]['login'] = $tmp_obj->getLogin();
             $print_member[$member_id]['name'] = $tmp_obj->getLastname() . ', ' . $tmp_obj->getFirstname();
             if ($this->object->getMembersObject()->isAdmin($member_id)) {
                 $print_member[$member_id]['role'] = $this->lng->txt("il_crs_admin");
             } elseif ($this->object->getMembersObject()->isTutor($member_id)) {
                 $print_member[$member_id]['role'] = $this->lng->txt("il_crs_tutor");
             } elseif ($this->object->getMembersObject()->isMember($member_id)) {
                 $print_member[$member_id]['role'] = $this->lng->txt("il_crs_member");
             }
             if ($this->object->getMembersObject()->isAdmin($member_id) or $this->object->getMembersObject()->isTutor($member_id)) {
                 if ($this->object->getMembersObject()->isNotificationEnabled($member_id)) {
                     $print_member[$member_id]['status'] = $this->lng->txt("crs_notify");
                 } else {
                     $print_member[$member_id]['status'] = $this->lng->txt("crs_no_notify");
                 }
             } else {
                 if ($this->object->getMembersObject()->isBlocked($member_id)) {
                     $print_member[$member_id]['status'] = $this->lng->txt("crs_blocked");
                 } else {
                     $print_member[$member_id]['status'] = $this->lng->txt("crs_unblocked");
                 }
             }
             if ($is_admin) {
                 $print_member[$member_id]['passed'] = $this->object->getMembersObject()->hasPassed($member_id) ? $this->lng->txt('crs_member_passed') : $this->lng->txt('crs_member_not_passed');
             }
             if ($privacy->enabledCourseAccessTimes()) {
                 if (isset($progress[$member_id]['ts']) and $progress[$member_id]['ts']) {
                     ilDatePresentation::setUseRelativeDates(false);
                     $print_member[$member_id]['access'] = ilDatePresentation::formatDate(new ilDateTime($progress[$member_id]['ts'], IL_CAL_UNIX));
                     ilDatePresentation::setUseRelativeDates(true);
                 } else {
                     $print_member[$member_id]['access'] = $this->lng->txt('no_date');
                 }
             }
             if ($this->show_tracking) {
                 if (in_array($member_id, $completed)) {
                     $print_member[$member_id]['progress'] = $this->lng->txt(ilLPStatus::LP_STATUS_COMPLETED);
                 } elseif (in_array($member_id, $in_progress)) {
                     $print_member[$member_id]['progress'] = $this->lng->txt(ilLPStatus::LP_STATUS_IN_PROGRESS);
                 } elseif (in_array($member_id, $failed)) {
                     $print_member[$member_id]['progress'] = $this->lng->txt(ilLPStatus::LP_STATUS_FAILED);
                 } else {
                     $print_member[$member_id]['progress'] = $this->lng->txt(ilLPStatus::LP_STATUS_NOT_ATTEMPTED);
                 }
             }
         }
     }
     switch ($_SESSION['crs_print_sort']) {
         case 'progress':
             return ilUtil::sortArray($print_member, 'progress', $_SESSION['crs_print_order'], false, true);
         case 'access_time':
             return ilUtil::sortArray($print_member, 'access', $_SESSION['crs_print_order'], false, true);
         case 'lastname':
             return ilUtil::sortArray($print_member, 'name', $_SESSION['crs_print_order'], false, true);
         case 'login':
             return ilUtil::sortArray($print_member, 'login', $_SESSION['crs_print_order'], false, true);
         case 'passed':
             return ilUtil::sortArray($print_member, 'passed', $_SESSION['crs_print_order'], false, true);
         case 'blocked':
         case 'notification':
             return ilUtil::sortArray($print_member, 'status', $_SESSION['crs_print_order'], false, true);
         default:
             return ilUtil::sortArray($print_member, 'name', $_SESSION['crs_print_order'], false, true);
     }
 }
 protected function readMemberData($ids, $role = 'admin')
 {
     include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
     $privacy = ilPrivacySettings::_getInstance();
     if ($this->show_tracking) {
         include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
         $completed = ilLPStatusWrapper::_lookupCompletedForObject($this->object->getId());
         $in_progress = ilLPStatusWrapper::_lookupInProgressForObject($this->object->getId());
         $failed = ilLPStatusWrapper::_lookupFailedForObject($this->object->getId());
     }
     if ($privacy->enabledGroupAccessTimes()) {
         include_once './Services/Tracking/classes/class.ilLearningProgress.php';
         $progress = ilLearningProgress::_lookupProgressByObjId($this->object->getId());
     }
     foreach ($ids as $usr_id) {
         $name = ilObjUser::_lookupName($usr_id);
         $tmp_data['firstname'] = $name['firstname'];
         $tmp_data['lastname'] = $name['lastname'];
         $tmp_data['login'] = ilObjUser::_lookupLogin($usr_id);
         $tmp_data['notification'] = $this->object->members_obj->isNotificationEnabled($usr_id) ? 1 : 0;
         $tmp_data['usr_id'] = $usr_id;
         $tmp_data['login'] = ilObjUser::_lookupLogin($usr_id);
         if ($this->show_tracking) {
             if (in_array($usr_id, $completed)) {
                 $tmp_data['progress'] = LP_STATUS_COMPLETED;
             } elseif (in_array($usr_id, $in_progress)) {
                 $tmp_data['progress'] = LP_STATUS_IN_PROGRESS;
             } elseif (in_array($usr_id, $failed)) {
                 $tmp_data['progress'] = LP_STATUS_FAILED;
             } else {
                 $tmp_data['progress'] = LP_STATUS_NOT_ATTEMPTED;
             }
         }
         if ($privacy->enabledGroupAccessTimes()) {
             if (isset($progress[$usr_id]['ts']) and $progress[$usr_id]['ts']) {
                 $tmp_data['access_time'] = ilDatePresentation::formatDate($tmp_date = new ilDateTime($progress[$usr_id]['ts'], IL_CAL_UNIX));
                 $tmp_data['access_time_unix'] = $tmp_date->get(IL_CAL_UNIX);
             } else {
                 $tmp_data['access_time'] = $this->lng->txt('no_date');
                 $tmp_data['access_time_unix'] = 0;
             }
         }
         $members[$usr_id] = $tmp_data;
     }
     return $members ? $members : array();
 }