/**
  * Parse object data
  * @return 
  * @param object $a_ids
  */
 public function parseObjectIds($a_ids)
 {
     foreach ($a_ids as $object_id) {
         $row = array();
         $type = ilObject::_lookupType($object_id);
         $row['title'] = ilObject::_lookupTitle($object_id);
         $row['desc'] = ilObject::_lookupDescription($object_id);
         $row['id'] = $object_id;
         switch ($type) {
             case 'crs':
             case 'grp':
                 include_once './Services/Membership/classes/class.ilParticipants.php';
                 if (ilParticipants::hasParticipantListAccess($object_id)) {
                     $row['member'] = count(ilParticipants::getInstanceByObjId($object_id)->getParticipants());
                 } else {
                     $row['member'] = 0;
                 }
                 break;
             case 'role':
                 global $rbacreview;
                 include_once './Services/User/classes/class.ilUserFilter.php';
                 $row['member'] = count(ilUserFilter::getInstance()->filter($rbacreview->assignedUsers($object_id)));
                 break;
         }
         $data[] = $row;
     }
     $this->setData($data ? $data : array());
 }
Ejemplo n.º 2
0
 public function getSinglePool($CourseID, $PoolID)
 {
     global $ilUser, $ilObjDataCache;
     $retval = array();
     $items = ilParticipants::_getMembershipByType($ilUser->getId(), 'crs');
     // $items = ilParticipants::_getMembershipByType(12855, 'crs');
     $itemId = array_search($CourseID, $items);
     if ($itemId !== FALSE && $itemId >= 0) {
         $obj_id = $items[$itemId];
         $item_references = ilObject::_getAllReferences($obj_id);
         reset($item_references);
         if (strcmp($this->iliasVersion, "4.2") === 0) {
             require_once 'Modules/Course/classes/class.ilCourseItems.php';
             foreach ($item_references as $ref_id) {
                 // Antique Ilias
                 $courseItems = new ilCourseItems($ref_id, 0, $ilUser->getId());
                 $courseItemList = $courseItems->getAllItems();
                 $retval = $this->mapItems($courseItemList, $PoolID);
                 $retval = $retval[0];
             }
         } else {
             // Modern Ilias
             $crs = new ilObjCourse($item_references, true);
             $courseItemList = $crs->getSubItems();
             $retval = $this->mapItems($courseItemList["_all"], $PoolID);
             $retval = $retval[0];
         }
     }
     return $retval;
 }
Ejemplo n.º 3
0
 public function getUserCourse($courseId)
 {
     global $ilUser, $ilObjDataCache;
     $this->log($courseId);
     $items = ilParticipants::_getMembershipByType($ilUser->getId(), 'crs');
     foreach ($items as $obj_id) {
         $this->log($obj_id . " :: " . $courseId);
         if ($obj_id == $courseId) {
             $crs = new ilObjCourse($obj_id, false);
             $crs->read();
             $title = $crs->getTitle();
             $description = $crs->getDescription();
             // $this->log($crs->getOfflineStatus());
             if ($crs->getOfflineStatus() == 1) {
                 // skip offline courses
                 continue;
             }
             $course = array("id" => $obj_id, "title" => $title, "description" => $description);
             // 2 get course objects
             $item_references = ilObject::_getAllReferences($obj_id);
             reset($item_references);
             if (strcmp($this->iliasVersion, "4.2") === 0) {
                 foreach ($item_references as $ref_id => $x) {
                     // Antique Ilias
                     // For some strange reason remains the $crs->getRefId() remains empty
                     $crs = new ilObjCourse($ref_id);
                     // TODO: Verify that the course is online
                     // TODO: If the course is offline, check if the user is admin.
                     // TODO: skip offline student courses
                     require_once 'Modules/Course/classes/class.ilCourseItems.php';
                     $courseItems = new ilCourseItems($crs->getRefId(), 0, $ilUser->getId());
                     $courseItemList = $courseItems->getAllItems();
                     $course["content-type"] = $this->mapItemTypes($courseItemList, false);
                     break;
                 }
             } else {
                 // Modern Ilias
                 foreach ($item_references as $ref_id => $x) {
                     $crs = new ilObjCourse($ref_id);
                     // TODO: Verify that the course is online
                     // TODO: If the course is offline, check if the user is admin.
                     // TODO: skip offline student courses
                     $courseItemList = $crs->getSubItems();
                     // TODO check with Ilias 4.4 and 4.3
                     //                    $this->log(">>> IL >>> " . json_encode($courseItemList["_all"]));
                     $course["content-type"] = $this->mapItemTypes($courseItemList, true);
                 }
             }
             return $course;
         }
     }
     return null;
 }
Ejemplo n.º 4
0
 /**
  *  
  * @param
  * @return
  */
 public function testSubscription()
 {
     include_once './Services/Membership/classes/class.ilParticipants.php';
     include_once './Modules/Course/classes/class.ilCourseParticipants.php';
     $part = ilCourseParticipants::_getInstanceByObjId(999999);
     $part->addSubscriber(111111);
     $part->updateSubscriptionTime(111111, time());
     $part->updateSubject(111111, 'hallo');
     $is = $part->isSubscriber(111111);
     $this->assertEquals($is, true);
     $is = ilParticipants::_isSubscriber(999999, 111111);
     $this->assertEquals($is, true);
     $part->deleteSubscriber(111111);
     $is = $part->isSubscriber(111111);
     $this->assertEquals($is, false);
 }
 /**
  * Singleton constructor
  *
  * @access protected
  * @param int obj_id of container
  */
 public function __construct($a_obj_id)
 {
     $this->type = 'crs';
     $this->NOTIFY_DISMISS_SUBSCRIBER = 1;
     $this->NOTIFY_ACCEPT_SUBSCRIBER = 2;
     $this->NOTIFY_DISMISS_MEMBER = 3;
     $this->NOTIFY_BLOCK_MEMBER = 4;
     $this->NOTIFY_UNBLOCK_MEMBER = 5;
     $this->NOTIFY_ACCEPT_USER = 6;
     $this->NOTIFY_ADMINS = 7;
     $this->NOTIFY_STATUS_CHANGED = 8;
     $this->NOTIFY_SUBSCRIPTION_REQUEST = 9;
     $this->NOTIFY_REGISTERED = 10;
     $this->NOTIFY_UNSUBSCRIBE = 11;
     $this->NOTIFY_WAITING_LIST = 12;
     parent::__construct($a_obj_id);
 }
Ejemplo n.º 6
0
 function _checkGoto($a_target)
 {
     global $objDefinition, $ilPluginAdmin, $ilUser;
     if (is_object($ilPluginAdmin)) {
         // get user interface plugins
         $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
         // search
         foreach ($pl_names as $pl) {
             $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
             $gui_class = $ui_plugin->getUIClassInstance();
             $resp = $gui_class->checkGotoHook($a_target);
             if ($resp["target"] !== false) {
                 $a_target = $resp["target"];
                 break;
             }
         }
     }
     if ($a_target == "") {
         return false;
     }
     $t_arr = explode("_", $a_target);
     $type = $t_arr[0];
     if ($type == "git") {
         $type = "glo";
     }
     if ($type == "pg" | $type == "st") {
         $type = "lm";
     }
     $class = $objDefinition->getClassName($type);
     if ($class == "") {
         return false;
     }
     $location = $objDefinition->getLocation($type);
     $full_class = "ilObj" . $class . "Access";
     include_once $location . "/class." . $full_class . ".php";
     $ret = call_user_func(array($full_class, "_checkGoto"), $a_target);
     // if no access and repository object => check for parent course/group
     if (!$ret && !stristr($a_target, "_wsp") && $ilUser->getId() != ANONYMOUS_USER_ID && !$objDefinition->isAdministrationObject($type) && $objDefinition->isRBACObject($type) && $t_arr[1]) {
         global $tree, $rbacsystem, $ilAccess;
         // original type "pg" => pg_<page_id>[_<ref_id>]
         if ($t_arr[0] == "pg") {
             if (isset($t_arr[2])) {
                 $ref_id = $t_arr[2];
             } else {
                 $lm_id = ilLMObject::_lookupContObjID($t_arr[1]);
                 $ref_id = ilObject::_getAllReferences($lm_id);
                 if ($ref_id) {
                     $ref_id = array_shift($ref_id);
                 }
             }
         } else {
             $ref_id = $t_arr[1];
         }
         include_once "Services/Membership/classes/class.ilParticipants.php";
         $block_obj = array();
         // walk path to find parent container
         $path = $tree->getPathId($ref_id);
         array_pop($path);
         foreach ($path as $path_ref_id) {
             $redirect_infopage = false;
             $add_member_role = false;
             $ptype = ilObject::_lookupType($path_ref_id, true);
             $pobj_id = ilObject::_lookupObjId($path_ref_id);
             // core checks: timings/object-specific
             if (!$ilAccess->doActivationCheck("read", "", $path_ref_id, $ilUser->getId(), $pobj_id, $ptype) || !$ilAccess->doStatusCheck("read", "", $path_ref_id, $ilUser->getId(), $pobj_id, $ptype)) {
                 // object in path is inaccessible - aborting
                 return false;
             } else {
                 if ($ptype == "crs") {
                     // check if already participant
                     include_once "Modules/Course/classes/class.ilCourseParticipant.php";
                     $participants = new ilCourseParticipant($pobj_id, $ilUser->getId());
                     if (!$participants->isAssigned()) {
                         // subscription currently possible?
                         include_once "Modules/Course/classes/class.ilObjCourse.php";
                         if (ilObjCourse::_isActivated($pobj_id) && ilObjCourse::_registrationEnabled($pobj_id)) {
                             $block_obj[] = $path_ref_id;
                             $add_member_role = true;
                         } else {
                             $redirect_infopage = true;
                         }
                     }
                 } else {
                     if ($ptype == "grp") {
                         // check if already participant
                         include_once "Modules/Group/classes/class.ilGroupParticipants.php";
                         if (!ilGroupParticipants::_isParticipant($path_ref_id, $ilUser->getId())) {
                             // subscription currently possible?
                             include_once "Modules/Group/classes/class.ilObjGroup.php";
                             $group_obj = new ilObjGroup($path_ref_id);
                             if ($group_obj->isRegistrationEnabled()) {
                                 $block_obj[] = $path_ref_id;
                                 $add_member_role = true;
                             } else {
                                 $redirect_infopage = true;
                             }
                         }
                     }
                 }
             }
             // add members roles for all "blocking" objects
             if ($add_member_role) {
                 // cannot join? goto will never work, so redirect to current object
                 $rbacsystem->resetPACache($ilUser->getId(), $path_ref_id);
                 if (!$rbacsystem->checkAccess("join", $path_ref_id)) {
                     $redirect_infopage = true;
                 } else {
                     $rbacsystem->addTemporaryRole($ilUser->getId(), ilParticipants::getDefaultMemberRole($path_ref_id));
                 }
             }
             // redirect to infopage of 1st blocking object in path
             if ($redirect_infopage) {
                 if ($rbacsystem->checkAccess("visible", $path_ref_id)) {
                     ilUtil::redirect("ilias.php?baseClass=ilRepositoryGUI" . "&ref_id=" . $path_ref_id . "&cmd=infoScreen");
                 } else {
                     return false;
                 }
             }
         }
         // check if access will be possible with all (possible) member roles added
         $rbacsystem->resetPACache($ilUser->getId(), $ref_id);
         if ($rbacsystem->checkAccess("read", $ref_id) && sizeof($block_obj)) {
             // this won't work with lm-pages (see above)
             // include_once "Services/Link/classes/class.ilLink.php";
             // $_SESSION["pending_goto"] = ilLink::_getStaticLink($ref_id, $type);
             // keep original target
             $_SESSION["pending_goto"] = "goto.php?target=" . $a_target;
             // redirect to 1st non-member object in path
             ilUtil::redirect("ilias.php?baseClass=ilRepositoryGUI" . "&ref_id=" . array_shift($block_obj));
         }
     }
     return $ret;
 }
Ejemplo n.º 7
0
 protected function getCoursesOfUser($a_user_id, $a_add_path = false)
 {
     global $tree;
     // see ilPDSelectedItemsBlockGUI
     include_once 'Modules/Course/classes/class.ilObjCourseAccess.php';
     include_once 'Services/Membership/classes/class.ilParticipants.php';
     $items = ilParticipants::_getMembershipByType($a_user_id, 'crs');
     $repo_title = $tree->getNodeData(ROOT_FOLDER_ID);
     $repo_title = $repo_title["title"];
     if ($repo_title == "ILIAS") {
         $repo_title = $this->lng->txt("repository");
     }
     $references = $lp_obj_refs = array();
     foreach ($items as $obj_id) {
         $ref_id = ilObject::_getAllReferences($obj_id);
         if (is_array($ref_id) && count($ref_id)) {
             $ref_id = array_pop($ref_id);
             if (!$tree->isDeleted($ref_id)) {
                 $visible = false;
                 $active = ilObjCourseAccess::_isActivated($obj_id, $visible, false);
                 if ($active && $visible) {
                     $references[$ref_id] = array('ref_id' => $ref_id, 'obj_id' => $obj_id, 'title' => ilObject::_lookupTitle($obj_id));
                     if ($a_add_path) {
                         $path = array();
                         foreach ($tree->getPathFull($ref_id) as $item) {
                             $path[] = $item["title"];
                         }
                         // top level comes first
                         if (sizeof($path) == 2) {
                             $path[0] = 0;
                         } else {
                             $path[0] = 1;
                         }
                         $references[$ref_id]["path_sort"] = implode("__", $path);
                         array_shift($path);
                         array_pop($path);
                         if (!sizeof($path)) {
                             array_unshift($path, $repo_title);
                         }
                         $references[$ref_id]["path"] = implode(" &rsaquo; ", $path);
                     }
                     $lp_obj_refs[$obj_id] = $ref_id;
                 }
             }
         }
     }
     // get lp data for valid courses
     if (sizeof($lp_obj_refs)) {
         // listing the objectives should NOT depend on any LP status / setting
         include_once 'Modules/Course/classes/class.ilObjCourse.php';
         foreach ($lp_obj_refs as $obj_id => $ref_id) {
             // only if set in DB (default mode is not relevant
             if (ilObjCourse::_lookupViewMode($obj_id) == IL_CRS_VIEW_OBJECTIVE) {
                 $references[$ref_id]["objectives"] = $this->parseObjectives($obj_id, $a_user_id);
             }
         }
         // LP must be active, personal and not anonymized
         include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
         if (ilObjUserTracking::_enabledLearningProgress() && ilObjUserTracking::_enabledUserRelatedData() && ilObjUserTracking::_hasLearningProgressLearner()) {
             // see ilLPProgressTableGUI
             include_once "Services/Tracking/classes/class.ilTrQuery.php";
             include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
             $lp_data = ilTrQuery::getObjectsStatusForUser($a_user_id, $lp_obj_refs);
             foreach ($lp_data as $item) {
                 $ref_id = $item["ref_ids"];
                 $references[$ref_id]["lp_status"] = $item["status"];
             }
         }
     }
     return $references;
 }
 /**
  * List users of course/group/roles
  * @return 
  */
 protected function listUsers()
 {
     // get parameter is used e.g. in exercises to provide
     // "add members of course" link
     if ($_GET["list_obj"] != "" && !is_array($_POST['obj'])) {
         $_POST['obj'][0] = $_GET["list_obj"];
     }
     if (!is_array($_POST['obj']) or !$_POST['obj']) {
         ilUtil::sendFailure($this->lng->txt('select_one'));
         $this->showSearchResults();
         return false;
     }
     $_SESSION['rep_search']['objs'] = $_POST['obj'];
     // Get all members
     $members = array();
     foreach ($_POST['obj'] as $obj_id) {
         $type = ilObject::_lookupType($obj_id);
         switch ($type) {
             case 'crs':
             case 'grp':
                 include_once './Services/Membership/classes/class.ilParticipants.php';
                 if (ilParticipants::hasParticipantListAccess($obj_id)) {
                     $members = array_merge((array) $members, ilParticipants::getInstanceByObjId($obj_id)->getParticipants());
                 }
                 break;
             case 'role':
                 global $rbacreview;
                 include_once './Services/User/classes/class.ilUserFilter.php';
                 $members = array_merge($members, ilUserFilter::getInstance()->filter($rbacreview->assignedUsers($obj_id)));
                 break;
         }
     }
     $members = array_unique((array) $members);
     $this->__appendToStoredResults($members);
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.rep_search_result.html', 'Services/Search');
     $this->addNewSearchButton();
     $this->showSearchUserTable($_SESSION['rep_search']['usr'], 'storedUserList');
     return true;
 }
Ejemplo n.º 9
0
 public function showResults()
 {
     global $lng, $ilUser, $rbacreview, $ilObjDataCache;
     $form = $this->initSearchForm();
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_search.html", "Services/Contact");
     $this->tpl->setVariable("ACTION", $this->ctrl->getFormAction($this));
     $this->tpl->setTitle($this->lng->txt("mail"));
     $this->tpl->setVariable('SEARCHFORM', $form->getHtml());
     // #14109
     if (strlen($_SESSION['mail_search_search']) < 3) {
         if ($_GET["ref"] != "wsp") {
             $this->tpl->show();
         }
         return;
     }
     $abook = new ilAddressbook($ilUser->getId());
     $entries = $abook->searchUsers(addslashes(urldecode($_SESSION['mail_search_search'])));
     // remove all contacts who are not registered users for personal workspace
     if ($_GET["ref"] == "wsp") {
         foreach ($entries as $idx => $entry) {
             if (!$entry["login"]) {
                 unset($entries[$idx]);
             }
         }
     }
     if (count($entries)) {
         $tbl_addr = new ilTable2GUI($this);
         $tbl_addr->setTitle($lng->txt('mail_addressbook'));
         $tbl_addr->setRowTemplate('tpl.mail_search_addr_row.html', 'Services/Contact');
         $result = array();
         $counter = 0;
         foreach ($entries as $entry) {
             if ($_GET["ref"] != "wsp") {
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_addr[]', $entry['login'] ? $entry['login'] : $entry['email']) . ilUtil::formCheckbox(0, 'search_name_cc[]', $entry['login'] ? $entry['login'] : $entry['email']) . ilUtil::formCheckbox(0, 'search_name_bcc[]', $entry['login'] ? $entry['login'] : $entry['email']);
             } else {
                 $user_id = ilObjUser::_loginExists($entry["login"]);
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_addr[]', $user_id);
             }
             $result[$counter]['login'] = $entry['login'];
             $result[$counter]['firstname'] = $entry['firstname'];
             $result[$counter]['lastname'] = $entry['lastname'];
             $id = ilObjUser::_lookupId($entry['login']);
             if (ilObjUser::_lookupPref($id, 'public_email') == 'y' || !$entry['login']) {
                 $has_mail_addr = true;
                 $result[$counter]['email'] = $entry['email'];
             }
             ++$counter;
         }
         if ($_GET["ref"] != "wsp") {
             $tbl_addr->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
         } else {
             $tbl_addr->addColumn("", "", "1%");
         }
         $tbl_addr->addColumn($this->lng->txt('login'), 'login', "15%");
         $tbl_addr->addColumn($this->lng->txt('firstname'), 'firstname', "15%");
         $tbl_addr->addColumn($this->lng->txt('lastname'), 'lastname', "15%");
         if ($has_mail_addr) {
             foreach ($result as $key => $val) {
                 if ($val['email'] == '') {
                     $result[$key]['email'] = '&nbsp;';
                 }
             }
             $tbl_addr->addColumn($this->lng->txt('email'), 'email', "15%");
         }
         $tbl_addr->setData($result);
         $tbl_addr->setDefaultOrderField('login');
         $tbl_addr->setPrefix('addr_');
         $tbl_addr->enable('select_all');
         $tbl_addr->setSelectAllCheckbox('search_name_to_addr');
         $tbl_addr->setFormName('recipients');
         $this->tpl->setVariable('TABLE_ADDR', $tbl_addr->getHTML());
     }
     include_once 'Services/Search/classes/class.ilQueryParser.php';
     include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
     include_once 'Services/Search/classes/class.ilSearchResult.php';
     $all_results = new ilSearchResult();
     $query_parser = new ilQueryParser(addcslashes($_SESSION['mail_search_search'], '%_'));
     $query_parser->setCombination(QP_COMBINATION_AND);
     $query_parser->setMinWordLength(3);
     $query_parser->parse();
     $user_search =& ilObjectSearchFactory::_getUserSearchInstance($query_parser);
     $user_search->enableActiveCheck(true);
     $user_search->setFields(array('login'));
     $result_obj = $user_search->performSearch();
     $all_results->mergeEntries($result_obj);
     $user_search->setFields(array('firstname'));
     $result_obj = $user_search->performSearch();
     $all_results->mergeEntries($result_obj);
     $user_search->setFields(array('lastname'));
     $result_obj = $user_search->performSearch();
     $all_results->mergeEntries($result_obj);
     $all_results->setMaxHits(100000);
     $all_results->preventOverwritingMaxhits(true);
     $all_results->filter(ROOT_FOLDER_ID, true);
     // Filter users (depends on setting in user accounts)
     include_once 'Services/User/classes/class.ilUserFilter.php';
     $users = ilUserFilter::getInstance()->filter($all_results->getResultIds());
     if (count($users)) {
         $tbl_users = new ilTable2GUI($this);
         $tbl_users->setTitle($lng->txt('system') . ': ' . $lng->txt('persons'));
         $tbl_users->setRowTemplate('tpl.mail_search_users_row.html', 'Services/Contact');
         $result = array();
         $counter = 0;
         foreach ($users as $user) {
             $login = ilObjUser::_lookupLogin($user);
             if ($_GET["ref"] != "wsp") {
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_usr[]', $login) . ilUtil::formCheckbox(0, 'search_name_cc[]', $login) . ilUtil::formCheckbox(0, 'search_name_bcc[]', $login);
             } else {
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_usr[]', $user);
             }
             $result[$counter]['login'] = $login;
             if (in_array(ilObjUser::_lookupPref($user, 'public_profile'), array('y', "g"))) {
                 $name = ilObjUser::_lookupName($user);
                 $result[$counter]['firstname'] = $name['firstname'];
                 $result[$counter]['lastname'] = $name['lastname'];
             } else {
                 $result[$counter]['firstname'] = '';
                 $result[$counter]['lastname'] = '';
             }
             if (ilObjUser::_lookupPref($user, 'public_email') == 'y') {
                 $has_mail_usr = true;
                 $result[$counter]['email'] = ilObjUser::_lookupEmail($user);
             }
             ++$counter;
         }
         if ($_GET["ref"] != "wsp") {
             $tbl_users->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
         } else {
             $tbl_users->addColumn("", "", "1%");
         }
         $tbl_users->addColumn($this->lng->txt('login'), 'login', '15%');
         $tbl_users->addColumn($this->lng->txt('firstname'), 'firstname', '15%');
         $tbl_users->addColumn($this->lng->txt('lastname'), 'lastname', '15%');
         if ($has_mail_usr == true) {
             foreach ($result as $key => $val) {
                 if ($val['email'] == '') {
                     $result[$key]['email'] = '&nbsp;';
                 }
             }
             $tbl_users->addColumn($this->lng->txt('email'), 'email', '15%');
         }
         $tbl_users->setData($result);
         $tbl_users->setDefaultOrderField('login');
         $tbl_users->setPrefix('usr_');
         $tbl_users->enable('select_all');
         $tbl_users->setSelectAllCheckbox('search_name_to_usr');
         $tbl_users->setFormName('recipients');
         $this->tpl->setVariable('TABLE_USERS', $tbl_users->getHTML());
     }
     include_once 'Services/Search/classes/class.ilQueryParser.php';
     include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
     include_once 'Services/Search/classes/class.ilSearchResult.php';
     include_once 'Services/Membership/classes/class.ilParticipants.php';
     $group_results = new ilSearchResult();
     $query_parser = new ilQueryParser(addcslashes($_SESSION['mail_search_search'], '%_'));
     $query_parser->setCombination(QP_COMBINATION_AND);
     $query_parser->setMinWordLength(3);
     $query_parser->parse();
     $search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
     $search->setFilter(array('grp'));
     $result = $search->performSearch();
     $group_results->mergeEntries($result);
     $group_results->setMaxHits(PHP_INT_MAX);
     $group_results->preventOverwritingMaxhits(true);
     $group_results->setRequiredPermission('read');
     $group_results->filter(ROOT_FOLDER_ID, true);
     $visible_groups = array();
     if ($group_results->getResults()) {
         $tbl_grp = new ilTable2GUI($this);
         $tbl_grp->setTitle($lng->txt('system') . ': ' . $lng->txt('groups'));
         $tbl_grp->setRowTemplate('tpl.mail_search_groups_row.html', 'Services/Contact');
         $result = array();
         $counter = 0;
         $ilObjDataCache->preloadReferenceCache(array_keys($group_results->getResults()));
         $groups = $group_results->getResults();
         foreach ($groups as $grp) {
             if (!ilParticipants::hasParticipantListAccess($grp['obj_id'])) {
                 continue;
             }
             if ($_GET["ref"] != "wsp") {
                 $members = array();
                 $roles = $rbacreview->getAssignableChildRoles($grp['ref_id']);
                 foreach ($roles as $role) {
                     if (substr($role['title'], 0, 14) == 'il_grp_member_' || substr($role['title'], 0, 13) == 'il_grp_admin_') {
                         // does not work if Pear is enabled and Mailbox Address contain special chars!!
                         //array_push($members, $rbacreview->getRoleMailboxAddress($role['obj_id']));
                         // FIX for Mantis: 7523
                         array_push($members, '#' . $role['title']);
                     }
                 }
                 $str_members = implode(',', $members);
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_grp[]', $str_members) . ilUtil::formCheckbox(0, 'search_name_cc[]', $str_members) . ilUtil::formCheckbox(0, 'search_name_bcc[]', $str_members);
             } else {
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_grp[]', $grp['obj_id']);
             }
             $result[$counter]['title'] = $ilObjDataCache->lookupTitle($grp['obj_id']);
             $result[$counter]['description'] = $ilObjDataCache->lookupDescription($grp['obj_id']);
             ++$counter;
             $visible_groups[] = $grp;
         }
         if ($visible_groups) {
             $tbl_grp->setData($result);
             if ($_GET["ref"] != "wsp") {
                 $tbl_grp->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
             } else {
                 $tbl_grp->addColumn("", "", "1%");
             }
             $tbl_grp->addColumn($this->lng->txt('title'), 'title', '15%');
             $tbl_grp->addColumn($this->lng->txt('description'), 'description', '15%');
             $tbl_grp->setDefaultOrderField('title');
             $tbl_grp->setPrefix('grp_');
             $tbl_grp->enable('select_all');
             $tbl_grp->setSelectAllCheckbox('search_name_to_grp');
             $tbl_grp->setFormName('recipients');
             $this->tpl->setVariable('TABLE_GRP', $tbl_grp->getHTML());
         }
     }
     if (count($users) || count($visible_groups) || count($entries)) {
         $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
         $this->tpl->setVariable("ALT_ARROW", '');
         if ($_GET["ref"] != "wsp") {
             $this->tpl->setVariable('BUTTON_ADOPT', $this->lng->txt('adopt'));
         } else {
             $this->tpl->setVariable('BUTTON_ADOPT', $this->lng->txt('wsp_share_with_users'));
         }
     } else {
         $this->lng->loadLanguageModule('search');
         ilUtil::sendInfo($this->lng->txt('search_no_match'));
     }
     if ($_GET["ref"] != "wsp") {
         $this->tpl->show();
     }
 }
Ejemplo n.º 10
0
 /**
  * Read categories of user
  *
  * @access protected
  * @param
  * @return void
  */
 protected function readPDCalendars()
 {
     global $rbacsystem;
     $this->readPublicCalendars();
     $this->readPrivateCalendars();
     $this->readConsultationHoursCalendar();
     $this->readBookingCalendar();
     include_once './Services/Membership/classes/class.ilParticipants.php';
     $this->readSelectedCategories(ilParticipants::_getMembershipByType($this->user_id, 'crs'));
     $this->readSelectedCategories(ilParticipants::_getMembershipByType($this->user_id, 'grp'));
     $this->addSubitemCalendars();
 }
Ejemplo n.º 11
0
 /**
  * Get trigger completion
  *
  * @param
  * @return
  */
 static function getCompletionDateForTriggerRefId($a_user_id, $a_ref_id = null, $a_self_eval = 0)
 {
     global $ilDB;
     die("ilBasicSkill::getCompletionDateForTriggerRefId is deprecated.");
     if ($a_ref_id == "") {
         $a_ref_id = null;
     } else {
         if (!is_array($a_ref_id)) {
             $a_ref_id = array($a_ref_id);
         }
     }
     if (!is_array($a_user_id)) {
         $a_user_id = array($a_user_id);
     }
     if ($a_ref_id != null) {
         if (!is_array($a_ref_id)) {
             $a_ref_id = array($a_ref_id);
         }
         $set = $ilDB->query($q = "SELECT user_id, status_date, trigger_ref_id FROM skl_user_has_level WHERE " . $ilDB->in("user_id", $a_user_id, false, "integer") . " AND " . $ilDB->in("trigger_ref_id", $a_ref_id, false, "integer"));
         $completion = array();
         while ($rec = $ilDB->fetchAssoc($set)) {
             if (!isset($completion[$rec["user_id"]][$rec["trigger_ref_id"]])) {
                 $completion[$rec["user_id"]][$rec["trigger_ref_id"]] = $rec["status_date"];
             } else {
                 if ($rec["status_date"] < $completion[$rec["user_id"]][$rec["trigger_ref_id"]]) {
                     $completion[$rec["user_id"]][$rec["trigger_ref_id"]] = $rec["status_date"];
                 }
             }
         }
         foreach ($a_ref_id as $ref_id) {
             foreach ($a_user_id as $user_id) {
                 if (!isset($completion[$user_id][$ref_id])) {
                     $completion[$user_id][$ref_id] = false;
                 }
             }
         }
     } else {
         $completion = array();
         foreach ($a_user_id as $user_id) {
             include_once 'Services/Membership/classes/class.ilParticipants.php';
             $a_ref_id = ilParticipants::_getMembershipByType($user_id, 'crs', true);
             $set = $ilDB->query($q = "SELECT user_id, status_date, trigger_ref_id FROM skl_user_has_level WHERE " . "user_id = " . $ilDB->quote($user_id, "integer") . " AND " . $ilDB->in("trigger_ref_id", $a_ref_id, false, "integer"));
             while ($rec = $ilDB->fetchAssoc($set)) {
                 if (!isset($completion[$user_id][$rec["trigger_ref_id"]])) {
                     $completion[$user_id][$rec["trigger_ref_id"]] = $rec["status_date"];
                 } else {
                     if ($rec["status_date"] < $completion[$user_id][$rec["trigger_ref_id"]]) {
                         $completion[$user_id][$rec["trigger_ref_id"]] = $rec["status_date"];
                     }
                 }
             }
             foreach ($a_ref_id as $ref_id) {
                 if (!isset($completion[$user_id][$ref_id])) {
                     $completion[$user_id][$ref_id] = false;
                 }
             }
         }
     }
     return $completion;
 }
Ejemplo n.º 12
0
 /**
  * refuse subscribers
  *
  * @access public
  * @return
  */
 public function refuseSubscribersObject()
 {
     global $lng;
     $this->checkPermission('write');
     if (!count($_POST['subscribers'])) {
         ilUtil::sendFailure($this->lng->txt('no_checkbox'));
         $this->membersObject();
         return false;
     }
     include_once './Services/Membership/classes/class.ilParticipants.php';
     $part = ilParticipants::getInstanceByObjId($this->object->getId());
     foreach ($_POST['subscribers'] as $usr_id) {
         $part->deleteSubscriber($usr_id);
         include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
         $noti = new ilSessionMembershipMailNotification();
         $noti->setRefId($this->object->getRefId());
         $noti->setRecipients(array($usr_id));
         $noti->setType(ilSessionMembershipMailNotification::TYPE_REFUSED_SUBSCRIPTION_MEMBER);
         $noti->send();
     }
     ilUtil::sendSuccess($this->lng->txt("sess_msg_applicants_removed"));
     $this->membersObject();
     return true;
 }
Ejemplo n.º 13
0
 public function addSubscriber($a_usr_id)
 {
     global $ilAppEventHandler, $ilLog;
     parent::addSubscriber($a_usr_id);
     $ilLog->write(__METHOD__ . ': Raise new event: Modules/Group addSubscriber');
     $ilAppEventHandler->raise("Modules/Group", 'addSubscriber', array('obj_id' => $this->getObjId(), 'usr_id' => $a_usr_id));
 }
 /**
  * add user 
  *
  * @access protected
  * @param
  * @return
  */
 protected function add()
 {
     global $ilUser, $tree, $ilCtrl;
     // TODO: language vars
     // set aggreement accepted
     $this->setAccepted(true);
     include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
     $free = max(0, $this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
     $waiting_list = new ilCourseWaitingList($this->container->getId());
     if ($this->container->isSubscriptionMembershipLimited() and $this->container->enabledWaitingList() and (!$free or $waiting_list->getCountUsers())) {
         $waiting_list->addToList($ilUser->getId());
         $info = sprintf($this->lng->txt('crs_added_to_list'), $waiting_list->getPosition($ilUser->getId()));
         ilUtil::sendSuccess($info, true);
         $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST, $ilUser->getId());
         $this->participants->sendNotification($this->participants->NOTIFY_WAITING_LIST, $ilUser->getId());
         $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $tree->getParentId($this->container->getRefId()));
         $ilCtrl->redirectByClass("ilrepositorygui", "");
     }
     switch ($this->container->getSubscriptionType()) {
         case IL_CRS_SUBSCRIPTION_CONFIRMATION:
             $this->participants->addSubscriber($ilUser->getId());
             $this->participants->updateSubscriptionTime($ilUser->getId(), time());
             $this->participants->updateSubject($ilUser->getId(), ilUtil::stripSlashes($_POST['subject']));
             $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST, $ilUser->getId());
             ilUtil::sendSuccess($this->lng->txt("application_completed"), true);
             $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $tree->getParentId($this->container->getRefId()));
             $ilCtrl->redirectByClass("ilrepositorygui", "");
             break;
         default:
             if ($this->container->isSubscriptionMembershipLimited() && $this->container->getSubscriptionMaxMembers()) {
                 $success = $GLOBALS['rbacadmin']->assignUserLimited(ilParticipants::getDefaultMemberRole($this->container->getRefId()), $ilUser->getId(), $this->container->getSubscriptionMaxMembers(), array(ilParticipants::getDefaultMemberRole($this->container->getRefId())));
                 if (!$success) {
                     ilUtil::sendFailure($this->lng->txt('crs_subscription_failed_limit'));
                     $this->show();
                     return FALSE;
                 }
             }
             $this->participants->add($ilUser->getId(), IL_CRS_MEMBER);
             $this->participants->sendNotification($this->participants->NOTIFY_ADMINS, $ilUser->getId());
             $this->participants->sendNotification($this->participants->NOTIFY_REGISTERED, $ilUser->getId());
             include_once './Modules/Forum/classes/class.ilForumNotification.php';
             ilForumNotification::checkForumsExistsInsert($this->container->getRefId(), $ilUser->getId());
             if ($this->container->getType() == "crs") {
                 $this->container->checkLPStatusSync($ilUser->getId());
             }
             if (!$_SESSION["pending_goto"]) {
                 ilUtil::sendSuccess($this->lng->txt("crs_subscription_successful"), true);
                 $this->ctrl->returnToParent($this);
             } else {
                 $tgt = $_SESSION["pending_goto"];
                 unset($_SESSION["pending_goto"]);
                 ilUtil::redirect($tgt);
             }
             break;
     }
 }
Ejemplo n.º 15
0
 /**
  *
  */
 public function detachModeratorRole()
 {
     if (!isset($_POST['usr_id']) || !is_array($_POST['usr_id'])) {
         ilUtil::sendFailure($this->lng->txt('frm_moderators_select_at_least_one'));
         return $this->showModerators();
     }
     $entries = $this->oForumModerators->getCurrentModerators();
     if (count($_POST['usr_id']) == count($entries)) {
         ilUtil::sendFailure($this->lng->txt('frm_at_least_one_moderator'));
         return $this->showModerators();
     }
     include_once "Modules/Forum/classes/class.ilForumNotification.php";
     $isCrsGrp = ilForumNotification::_isParentNodeGrpCrs($this->ref_id);
     if ($isCrsGrp) {
         global $tree;
         $parent_ref_id = $tree->getParentId($this->ref_id);
         include_once "Services/Membership/classes/class.ilParticipants.php";
     }
     include_once "Modules/Forum/classes/class.ilForumProperties.php";
     $objFrmProps = ilForumProperties::getInstance(ilObject::_lookupObjId($this->ref_id));
     $frm_noti_type = $objFrmProps->getNotificationType();
     foreach ($_POST['usr_id'] as $usr_id) {
         $this->oForumModerators->detachModeratorRole((int) $usr_id);
         if ($isCrsGrp && $frm_noti_type != 'default') {
             if (!ilParticipants::_isParticipant($this->ref_id, $usr_id)) {
                 $tmp_frm_noti = new ilForumNotification($this->ref_id);
                 $tmp_frm_noti->setUserId((int) $usr_id);
                 $tmp_frm_noti->setForumId(ilObject::_lookupObjId($this->ref_id));
                 $tmp_frm_noti->deleteAdminForce();
             }
         }
     }
     ilUtil::sendSuccess($this->lng->txt('frm_moderators_detached_role_successfully'), true);
     $this->ctrl->redirect($this, 'showModerators');
 }
 public static function getPossibleSharedTargets()
 {
     global $ilUser, $ilSetting;
     include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
     include_once "Services/Membership/classes/class.ilParticipants.php";
     $grp_ids = ilParticipants::_getMembershipByType($ilUser->getId(), "grp");
     $crs_ids = ilParticipants::_getMembershipByType($ilUser->getId(), "crs");
     $obj_ids = array_merge($grp_ids, $crs_ids);
     $obj_ids[] = $ilUser->getId();
     $obj_ids[] = ilWorkspaceAccessGUI::PERMISSION_REGISTERED;
     if ($ilSetting->get("enable_global_profiles")) {
         $obj_ids[] = ilWorkspaceAccessGUI::PERMISSION_ALL;
         $obj_ids[] = ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD;
     }
     return $obj_ids;
 }
 public function findSharedObjects(array $a_filter = null, array $a_crs_ids = null, array $a_grp_ids = null)
 {
     global $ilDB, $ilUser;
     if (!$a_filter["acl_type"]) {
         $obj_ids = $this->getPossibleSharedTargets();
     } else {
         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
         switch ($a_filter["acl_type"]) {
             case "all":
                 $obj_ids = array(ilWorkspaceAccessGUI::PERMISSION_ALL);
                 break;
             case "password":
                 $obj_ids = array(ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD);
                 break;
             case "registered":
                 $obj_ids = array(ilWorkspaceAccessGUI::PERMISSION_REGISTERED);
                 break;
             case "course":
                 $obj_ids = $a_crs_ids;
                 break;
             case "group":
                 $obj_ids = $a_grp_ids;
                 break;
             case "user":
                 $obj_ids = array($ilUser->getId());
                 break;
         }
     }
     $res = array();
     $sql = "SELECT ref.wsp_id,obj.obj_id,obj.type,obj.title,obj.owner," . "acl.object_id acl_type, acl.tstamp acl_date" . " FROM object_data obj" . " JOIN object_reference_ws ref ON (obj.obj_id = ref.obj_id)" . " JOIN tree_workspace tree ON (tree.child = ref.wsp_id)" . " JOIN acl_ws acl ON (acl.node_id = tree.child)" . " WHERE " . $ilDB->in("acl.object_id", $obj_ids, "", "integer") . " AND obj.owner <> " . $ilDB->quote($ilUser->getId(), "integer");
     if ($a_filter["obj_type"]) {
         $sql .= " AND obj.type = " . $ilDB->quote($a_filter["obj_type"], "text");
     }
     if ($a_filter["title"] && strlen($a_filter["title"]) >= 3) {
         $sql .= " AND " . $ilDB->like("obj.title", "text", "%" . $a_filter["title"] . "%");
     }
     if ($a_filter["user"] && strlen($a_filter["user"]) >= 3) {
         $usr_ids = array();
         $set = $ilDB->query("SELECT usr_id FROM usr_data" . " WHERE (" . $ilDB->like("login", "text", "%" . $a_filter["user"] . "%") . " " . "OR " . $ilDB->like("firstname", "text", "%" . $a_filter["user"] . "%") . " " . "OR " . $ilDB->like("lastname", "text", "%" . $a_filter["user"] . "%") . " " . "OR " . $ilDB->like("email", "text", "%" . $a_filter["user"] . "%") . ")");
         while ($row = $ilDB->fetchAssoc($set)) {
             $usr_ids[] = $row["usr_id"];
         }
         if (!sizeof($usr_ids)) {
             return;
         }
         $sql .= " AND " . $ilDB->in("obj.owner", $usr_ids, "", "integer");
     }
     if ($a_filter["acl_date"]) {
         $dt = $a_filter["acl_date"]->get(IL_CAL_DATE);
         $dt = new ilDateTime($dt . " 00:00:00", IL_CAL_DATETIME);
         $sql .= " AND acl.tstamp > " . $ilDB->quote($dt->get(IL_CAL_UNIX), "integer");
     }
     if ($a_filter["crsgrp"]) {
         include_once "Services/Membership/classes/class.ilParticipants.php";
         $part = ilParticipants::getInstanceByObjId($a_filter['crsgrp']);
         $part = $part->getParticipants();
         if (!sizeof($part)) {
             return;
         }
         $sql .= " AND " . $ilDB->in("obj.owner", $part, "", "integer");
     }
     // we use the oldest share date
     $sql .= " ORDER BY acl.tstamp";
     $set = $ilDB->query($sql);
     while ($row = $ilDB->fetchAssoc($set)) {
         if (!isset($res[$row["wsp_id"]])) {
             $row["acl_type"] = array($row["acl_type"]);
             $res[$row["wsp_id"]] = $row;
         } else {
             $res[$row["wsp_id"]]["acl_type"][] = $row["acl_type"];
         }
     }
     return $res;
 }
 /**
  * Constructor
  *
  * @access protected
  * @param int obj_id of container
  */
 public function __construct($a_obj_id)
 {
     $this->type = 'grp';
     parent::__construct($a_obj_id);
 }
 /**
  * read data
  *
  * @access protected
  * @param
  * @return
  */
 public function readSubscriberData()
 {
     include_once './Services/Membership/classes/class.ilParticipants.php';
     $sub_data = ilParticipants::lookupSubscribersData($this->getParentObject()->object->getId());
     $sub_ids = array();
     foreach ($sub_data as $usr_id => $usr_data) {
         $sub_ids[] = $usr_id;
     }
     $this->determineOffsetAndOrder();
     include_once './Services/User/classes/class.ilUserQuery.php';
     $additional_fields = $this->getSelectedColumns();
     unset($additional_fields["firstname"]);
     unset($additional_fields["lastname"]);
     unset($additional_fields["last_login"]);
     unset($additional_fields["access_until"]);
     $udf_ids = $usr_data_fields = $odf_ids = array();
     foreach ($additional_fields as $field) {
         if (substr($field, 0, 3) == 'udf') {
             $udf_ids[] = substr($field, 4);
             continue;
         }
         if (substr($field, 0, 3) == 'odf') {
             $odf_ids[] = substr($field, 4);
             continue;
         }
         $usr_data_fields[] = $field;
     }
     $usr_data = ilUserQuery::getUserListData($this->getOrderField(), $this->getOrderDirection(), $this->getOffset(), $this->getLimit(), '', '', null, false, false, 0, 0, null, $usr_data_fields, $sub_ids);
     foreach ((array) $usr_data['set'] as $user) {
         $usr_ids[] = $user['usr_id'];
     }
     // merge course data
     $course_user_data = $this->getParentObject()->readMemberData($usr_ids, $this->type == 'admin');
     $a_user_data = array();
     foreach ((array) $usr_data['set'] as $ud) {
         $a_user_data[$ud['usr_id']] = array_merge($ud, (array) $course_user_data[$ud['usr_id']]);
     }
     // Custom user data fields
     if ($udf_ids) {
         include_once './Services/User/classes/class.ilUserDefinedData.php';
         $data = ilUserDefinedData::lookupData($usr_ids, $udf_ids);
         foreach ($data as $usr_id => $fields) {
             if (!$this->checkAcceptance($usr_id)) {
                 continue;
             }
             foreach ($fields as $field_id => $value) {
                 $a_user_data[$usr_id]['udf_' . $field_id] = $value;
             }
         }
     }
     // Object specific user data fields
     if ($odf_ids) {
         include_once './Modules/Course/classes/Export/class.ilCourseUserData.php';
         $data = ilCourseUserData::_getValuesByObjId($this->getParentObject()->object->getId());
         foreach ($data as $usr_id => $fields) {
             // #7264: as we get data for all course members filter against user data
             if (!$this->checkAcceptance($usr_id) || !in_array($usr_id, $usr_ids)) {
                 continue;
             }
             foreach ($fields as $field_id => $value) {
                 $a_user_data[$usr_id]['odf_' . $field_id] = $value;
             }
         }
         // add last edit date
         include_once './Services/Membership/classes/class.ilObjectCustomUserFieldHistory.php';
         foreach (ilObjectCustomUserFieldHistory::lookupEntriesByObjectId($this->getParentObject()->object->getId()) as $usr_id => $edit_info) {
             if (!isset($a_user_data[$usr_id])) {
                 continue;
             }
             include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
             if ($usr_id == $edit_info['update_user']) {
                 $a_user_data[$usr_id]['odf_last_update'] = '';
                 $a_user_data[$usr_id]['odf_info_txt'] = $GLOBALS['lng']->txt('cdf_edited_by_self');
                 if (ilPrivacySettings::_getInstance()->enabledAccessTimesByType($this->getParentObject()->object->getType())) {
                     $a_user_data[$usr_id]['odf_last_update'] .= '_' . $edit_info['editing_time']->get(IL_CAL_UNIX);
                     $a_user_data[$usr_id]['odf_info_txt'] .= ', ' . ilDatePresentation::formatDate($edit_info['editing_time']);
                 }
             } else {
                 $a_user_data[$usr_id]['odf_last_update'] = $edit_info['update_user'];
                 $a_user_data[$usr_id]['odf_last_update'] .= '_' . $edit_info['editing_time']->get(IL_CAL_UNIX);
                 $name = ilObjUser::_lookupName($edit_info['update_user']);
                 $a_user_data[$usr_id]['odf_info_txt'] = $name['firstname'] . ' ' . $name['lastname'] . ', ' . ilDatePresentation::formatDate($edit_info['editing_time']);
             }
         }
     }
     foreach ($usr_data['set'] as $user) {
         // Check acceptance
         if (!$this->checkAcceptance($user['usr_id'])) {
             continue;
         }
         // DONE: accepted
         foreach ($usr_data_fields as $field) {
             $a_user_data[$user['usr_id']][$field] = $user[$field] ? $user[$field] : '';
         }
     }
     // Waiting list subscription
     foreach ($sub_data as $usr_id => $usr_data) {
         if (!in_array($usr_id, $usr_ids)) {
             continue;
         }
         $a_user_data[$usr_id]['sub_time'] = $usr_data['time'];
         $a_user_data[$usr_id]['subject'] = $usr_data['subject'];
     }
     $this->setMaxCount(count($sub_ids));
     return $this->setData($a_user_data);
 }
Ejemplo n.º 20
0
 protected function getCoursesOfUser($a_user_id)
 {
     global $tree;
     // see ilPDSelectedItemsBlockGUI
     include_once 'Modules/Course/classes/class.ilObjCourseAccess.php';
     include_once 'Services/Membership/classes/class.ilParticipants.php';
     $items = ilParticipants::_getMembershipByType($a_user_id, 'crs');
     $references = $lp_obj_refs = array();
     foreach ($items as $obj_id) {
         $ref_id = ilObject::_getAllReferences($obj_id);
         if (is_array($ref_id) && count($ref_id)) {
             $ref_id = array_pop($ref_id);
             if (!$tree->isDeleted($ref_id)) {
                 $visible = false;
                 $active = ilObjCourseAccess::_isActivated($obj_id, $visible, false);
                 if ($active && $visible) {
                     $references[$ref_id] = array('ref_id' => $ref_id, 'obj_id' => $obj_id, 'title' => ilObject::_lookupTitle($obj_id));
                     $lp_obj_refs[$obj_id] = $ref_id;
                 }
             }
         }
     }
     // get lp data for valid courses
     if (sizeof($lp_obj_refs)) {
         // lp must be active, personal and not anonymized
         include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
         if (ilObjUserTracking::_enabledLearningProgress() && ilObjUserTracking::_enabledUserRelatedData() && ilObjUserTracking::_hasLearningProgressLearner()) {
             // see ilLPProgressTableGUI
             include_once "Services/Tracking/classes/class.ilTrQuery.php";
             include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
             $lp_data = ilTrQuery::getObjectsStatusForUser($a_user_id, $lp_obj_refs);
             foreach ($lp_data as $item) {
                 $ref_id = $item["ref_ids"];
                 $references[$ref_id]["lp_status"] = $item["status"];
                 // add objectives
                 if ($item["u_mode"] == ilLPObjSettings::LP_MODE_OBJECTIVES) {
                     // we need the collection for the correct order
                     include_once "Services/Tracking/classes/collection/class.ilLPCollectionOfObjectives.php";
                     $coll_objtv = new ilLPCollectionOfObjectives($item["obj_id"], $item["u_mode"]);
                     $coll_objtv = $coll_objtv->getItems();
                     if ($coll_objtv) {
                         // #13373
                         $lo_results = $this->parseLOUserResults($item["obj_id"], $a_user_id);
                         $tmp = array();
                         include_once "Modules/Course/classes/class.ilCourseObjective.php";
                         foreach ($coll_objtv as $objective_id) {
                             $tmp[$objective_id] = array("id" => $objective_id, "title" => ilCourseObjective::lookupObjectiveTitle($objective_id));
                             if (array_key_exists($objective_id, $lo_results)) {
                                 $lo_result = $lo_results[$objective_id];
                                 $tmp[$objective_id]["result_perc"] = $lo_result["result_perc"];
                                 $tmp[$objective_id]["limit_perc"] = $lo_result["limit_perc"];
                                 $tmp[$objective_id]["status"] = $lo_result["status"];
                                 $tmp[$objective_id]["type"] = $lo_result["type"];
                             }
                         }
                         // order
                         foreach ($coll_objtv as $objtv_id) {
                             $references[$ref_id]["objectives"][] = $tmp[$objtv_id];
                         }
                     }
                 }
             }
         }
     }
     $references = ilUtil::sortArray($references, "title", "ASC");
     return $references;
 }
Ejemplo n.º 21
0
 /**
  * Get all news items for a user.
  */
 static function _getNewsItemsOfUser($a_user_id, $a_only_public = false, $a_prevent_aggregation = false, $a_per = 0, &$a_cnt = NULL)
 {
     global $ilAccess;
     $news_item = new ilNewsItem();
     $news_set = new ilSetting("news");
     $per = $a_per;
     include_once "./Services/News/classes/class.ilNewsSubscription.php";
     include_once "./Services/Block/classes/class.ilBlockSetting.php";
     // this is currently not used
     $ref_ids = ilNewsSubscription::_getSubscriptionsOfUser($a_user_id);
     if (ilObjUser::_lookupPref($a_user_id, "pd_items_news") != "n") {
         // get all items of the personal desktop
         $pd_items = ilObjUser::_lookupDesktopItems($a_user_id);
         foreach ($pd_items as $item) {
             if (!in_array($item["ref_id"], $ref_ids)) {
                 $ref_ids[] = $item["ref_id"];
             }
         }
         // get all memberships
         include_once 'Services/Membership/classes/class.ilParticipants.php';
         $crs_mbs = ilParticipants::_getMembershipByType($a_user_id, 'crs');
         $grp_mbs = ilParticipants::_getMembershipByType($a_user_id, 'grp');
         $items = array_merge($crs_mbs, $grp_mbs);
         foreach ($items as $i) {
             $item_references = ilObject::_getAllReferences($i);
             if (is_array($item_references) && count($item_references)) {
                 foreach ($item_references as $ref_id) {
                     if (!in_array($ref_id, $ref_ids)) {
                         $ref_ids[] = $ref_id;
                     }
                 }
             }
         }
     }
     $data = array();
     foreach ($ref_ids as $ref_id) {
         if (!$a_only_public) {
             // this loop should not cost too much performance
             $acc = $ilAccess->checkAccessOfUser($a_user_id, "read", "", $ref_id);
             if (!$acc) {
                 continue;
             }
         }
         if (ilNewsItem::getPrivateFeedId() != false) {
             global $rbacsystem;
             $acc = $rbacsystem->checkAccessOfUser(ilNewsItem::getPrivateFeedId(), "read", $ref_id);
             if (!$acc) {
                 continue;
             }
         }
         $obj_id = ilObject::_lookupObjId($ref_id);
         $obj_type = ilObject::_lookupType($obj_id);
         $news = $news_item->getNewsForRefId($ref_id, $a_only_public, false, $per, $a_prevent_aggregation, false, false, false, $a_user_id);
         // counter
         if (!is_null($a_cnt)) {
             $a_cnt[$ref_id] = count($news);
         }
         $data = ilNewsItem::mergeNews($data, $news);
     }
     $data = ilUtil::sortArray($data, "creation_date", "desc", false, true);
     return $data;
 }
Ejemplo n.º 22
0
 /**
  * show information screen
  */
 function infoScreen()
 {
     global $ilErr, $ilAccess, $ilUser, $ilSetting;
     $this->checkPermission('visible');
     // Fill meta header tags
     include_once 'Services/MetaData/classes/class.ilMDUtils.php';
     ilMDUtils::_fillHTMLMetaTags($this->object->getId(), $this->object->getId(), 'crs');
     $this->tabs_gui->setTabActive('info_short');
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     include_once 'Modules/Course/classes/class.ilCourseFile.php';
     $files =& ilCourseFile::_readFilesByCourse($this->object->getId());
     $info = new ilInfoScreenGUI($this);
     $info->enablePrivateNotes();
     $info->enableFeedback();
     $info->enableNews();
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $info->enableNewsEditing();
     }
     if (strlen($this->object->getImportantInformation()) or strlen($this->object->getSyllabus()) or count($files)) {
         $info->addSection($this->lng->txt('crs_general_informations'));
     }
     if (strlen($this->object->getImportantInformation())) {
         $info->addProperty($this->lng->txt('crs_important_info'), "<strong>" . nl2br(ilUtil::makeClickable($this->object->getImportantInformation(), true) . "</strong>"));
     }
     if (strlen($this->object->getSyllabus())) {
         $info->addProperty($this->lng->txt('crs_syllabus'), nl2br(ilUtil::makeClickable($this->object->getSyllabus(), true)));
     }
     // files
     if (count($files)) {
         $tpl = new ilTemplate('tpl.event_info_file.html', true, true, 'Modules/Course');
         foreach ($files as $file) {
             $tpl->setCurrentBlock("files");
             $this->ctrl->setParameter($this, 'file_id', $file->getFileId());
             $tpl->setVariable("DOWN_LINK", $this->ctrl->getLinkTarget($this, 'sendfile'));
             $tpl->setVariable("DOWN_NAME", $file->getFileName());
             $tpl->setVariable("DOWN_INFO_TXT", $this->lng->txt('crs_file_size_info'));
             $tpl->setVariable("DOWN_SIZE", $file->getFileSize());
             $tpl->setVariable("TXT_BYTES", $this->lng->txt('bytes'));
             $tpl->parseCurrentBlock();
         }
         $info->addProperty($this->lng->txt('crs_file_download'), $tpl->get());
     }
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php';
     $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'crs', $this->object->getId());
     $record_gui->setInfoObject($info);
     $record_gui->parse();
     // meta data
     $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
     // contact
     if ($this->object->hasContactData()) {
         $info->addSection($this->lng->txt("crs_contact"));
     }
     if (strlen($this->object->getContactName())) {
         $info->addProperty($this->lng->txt("crs_contact_name"), $this->object->getContactName());
     }
     if (strlen($this->object->getContactResponsibility())) {
         $info->addProperty($this->lng->txt("crs_contact_responsibility"), $this->object->getContactResponsibility());
     }
     if (strlen($this->object->getContactPhone())) {
         $info->addProperty($this->lng->txt("crs_contact_phone"), $this->object->getContactPhone());
     }
     if ($this->object->getContactEmail()) {
         require_once 'Services/Mail/classes/class.ilMailFormCall.php';
         $emails = split(",", $this->object->getContactEmail());
         foreach ($emails as $email) {
             $email = trim($email);
             $etpl = new ilTemplate("tpl.crs_contact_email.html", true, true, 'Modules/Course');
             $etpl->setVariable("EMAIL_LINK", ilMailFormCall::getLinkTarget($info, 'showSummary', array(), array('type' => 'new', 'rcp_to' => $email, 'sig' => $this->createMailSignature())));
             $etpl->setVariable("CONTACT_EMAIL", $email);
             $mailString .= $etpl->get() . "<br />";
         }
         $info->addProperty($this->lng->txt("crs_contact_email"), $mailString);
     }
     if (strlen($this->object->getContactConsultation())) {
         $info->addProperty($this->lng->txt("crs_contact_consultation"), nl2br($this->object->getContactConsultation()));
     }
     //
     // access
     //
     // #10360
     $this->lng->loadLanguageModule("rep");
     $info->addSection($this->lng->txt("rep_activation_availability"));
     $info->showLDAPRoleGroupMappingInfo();
     // activation
     if ($this->object->getActivationUnlimitedStatus()) {
         $info->addProperty($this->lng->txt("rep_activation_access"), $this->lng->txt('crs_visibility_limitless'));
     } else {
         $info->addProperty($this->lng->txt('rep_activation_access'), ilDatePresentation::formatPeriod(new ilDateTime($this->object->getActivationStart(), IL_CAL_UNIX), new ilDateTime($this->object->getActivationEnd(), IL_CAL_UNIX)));
     }
     switch ($this->object->getSubscriptionLimitationType()) {
         case IL_CRS_SUBSCRIPTION_DEACTIVATED:
             $txt = $this->lng->txt("crs_info_reg_deactivated");
             break;
         default:
             switch ($this->object->getSubscriptionType()) {
                 case IL_CRS_SUBSCRIPTION_CONFIRMATION:
                     $txt = $this->lng->txt("crs_info_reg_confirmation");
                     break;
                 case IL_CRS_SUBSCRIPTION_DIRECT:
                     $txt = $this->lng->txt("crs_info_reg_direct");
                     break;
                 case IL_CRS_SUBSCRIPTION_PASSWORD:
                     $txt = $this->lng->txt("crs_info_reg_password");
                     break;
             }
     }
     // subscription
     $info->addProperty($this->lng->txt("crs_info_reg"), $txt);
     if ($this->object->getSubscriptionLimitationType() != IL_CRS_SUBSCRIPTION_DEACTIVATED) {
         if ($this->object->getSubscriptionUnlimitedStatus()) {
             $info->addProperty($this->lng->txt("crs_reg_until"), $this->lng->txt('crs_unlimited'));
         } elseif ($this->object->getSubscriptionStart() < time()) {
             $info->addProperty($this->lng->txt("crs_reg_until"), $this->lng->txt('crs_to') . ' ' . ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionEnd(), IL_CAL_UNIX)));
         } elseif ($this->object->getSubscriptionStart() > time()) {
             $info->addProperty($this->lng->txt("crs_reg_until"), $this->lng->txt('crs_from') . ' ' . ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionStart(), IL_CAL_UNIX)));
         }
         if ($this->object->isSubscriptionMembershipLimited()) {
             include_once './Services/Membership/classes/class.ilParticipants.php';
             $info->addProperty($this->lng->txt("mem_free_places"), max(0, $this->object->getSubscriptionMaxMembers() - ilParticipants::lookupNumberOfMembers($this->object->getRefId())));
         }
     }
     // archive
     if ($this->object->getViewMode() == IL_CRS_VIEW_ARCHIVE) {
         if ($this->object->getArchiveType() != IL_CRS_ARCHIVE_NONE) {
             $info->addProperty($this->lng->txt("crs_archive"), ilDatePresentation::formatPeriod(new ilDateTime($this->object->getArchiveStart(), IL_CAL_UNIX), new ilDateTime($this->object->getArchiveStart(), IL_CAL_UNIX)));
         }
     }
     // Confirmation
     include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
     $privacy = ilPrivacySettings::_getInstance();
     include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php';
     if ($privacy->courseConfirmationRequired() or ilCourseDefinedFieldDefinition::_getFields($this->object->getId()) or $privacy->enabledCourseExport()) {
         include_once 'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php';
         $field_info = ilExportFieldsInfo::_getInstanceByType($this->object->getType());
         $this->lng->loadLanguageModule('ps');
         $info->addSection($this->lng->txt('crs_user_agreement_info'));
         $info->addProperty($this->lng->txt('ps_export_data'), $field_info->exportableFieldsToInfoString());
         if ($fields = ilCourseDefinedFieldDefinition::_fieldsToInfoString($this->object->getId())) {
             $info->addProperty($this->lng->txt('ps_crs_user_fields'), $fields);
         }
     }
     $info->enableLearningProgress(true);
     // forward the command
     $this->ctrl->forwardCommand($info);
 }
 public function initFilter()
 {
     global $lng, $ilSetting, $ilUser;
     include_once "Services/Membership/classes/class.ilParticipants.php";
     $this->crs_ids = ilParticipants::_getMembershipByType($ilUser->getId(), "crs");
     $this->grp_ids = ilParticipants::_getMembershipByType($ilUser->getId(), "grp");
     $lng->loadLanguageModule("search");
     $item = $this->addFilterItemByMetaType("user", self::FILTER_TEXT, false, $lng->txt("wsp_shared_user_filter"));
     $this->filter["user"] = $item->getValue();
     // incoming back link (shared)
     if ((int) $_REQUEST["shr_id"] && !$this->filter["user"]) {
         $this->filter["user"] = ilObjUser::_lookupName((int) $_REQUEST["shr_id"]);
         $this->filter["user"] = $this->filter["user"]["login"];
         $item->setValue($this->filter["user"]);
     }
     $item = $this->addFilterItemByMetaType("title", self::FILTER_TEXT, false, $lng->txt("wsp_shared_title"));
     $this->filter["title"] = $item->getValue();
     $item = $this->addFilterItemByMetaType("acl_date", self::FILTER_DATE, false, $lng->txt("wsp_shared_date_filter"));
     $this->filter["acl_date"] = $item->getDate();
     if (!$this->portfolio_mode) {
         // see ilPersonalWorkspaceGUI::renderToolbar
         $options = array("" => $lng->txt("search_any"));
         $settings_map = array("blog" => "blogs", "file" => "files");
         // see ilObjWorkspaceFolderTableGUI
         foreach (array("file", "blog") as $type) {
             if (isset($settings_map[$type]) && $ilSetting->get("disable_wsp_" . $settings_map[$type])) {
                 continue;
             }
             $options[$type] = $lng->txt("wsp_type_" . $type);
         }
     } else {
         $options = array("prtf" => $lng->txt("obj_prtf"));
     }
     if (sizeof($options)) {
         asort($options);
         $item = $this->addFilterItemByMetaType("obj_type", self::FILTER_SELECT, false, $lng->txt("wsp_shared_object_type"));
         $item->setOptions($options);
         $this->filter["obj_type"] = $item->getValue();
     }
     // see ilWorkspaceAccessGUI::share
     $options = array();
     $options["user"] = $lng->txt("wsp_set_permission_single_user");
     if (sizeof($this->grp_ids)) {
         $options["group"] = $lng->txt("wsp_set_permission_group");
     }
     if (sizeof($this->crs_ids)) {
         $options["course"] = $lng->txt("wsp_set_permission_course");
     }
     if (!$this->handler->hasRegisteredPermission($this->parent_node_id)) {
         $options["registered"] = $lng->txt("wsp_set_permission_registered");
     }
     if ($ilSetting->get("enable_global_profiles")) {
         if (!$this->handler->hasGlobalPasswordPermission($this->parent_node_id)) {
             $options["password"] = $this->lng->txt("wsp_set_permission_all_password");
         }
         if (!$this->handler->hasGlobalPermission($this->parent_node_id)) {
             $options["all"] = $this->lng->txt("wsp_set_permission_all");
         }
     }
     if (sizeof($options)) {
         // asort($options);
         $item = $this->addFilterItemByMetaType("acl_type", self::FILTER_SELECT, false, $lng->txt("wsp_shared_type"));
         $item->setOptions(array("" => $lng->txt("search_any")) + $options);
         $this->filter["acl_type"] = $item->getValue();
     }
     if (sizeof($this->crs_ids) || sizeof($this->grp_ids)) {
         $options = array();
         foreach ($this->crs_ids as $crs_id) {
             $options[$crs_id] = $lng->txt("obj_crs") . " " . ilObject::_lookupTitle($crs_id);
         }
         foreach ($this->grp_ids as $grp_id) {
             $options[$grp_id] = $lng->txt("obj_grp") . " " . ilObject::_lookupTitle($grp_id);
         }
         asort($options);
         $item = $this->addFilterItemByMetaType("crsgrp", self::FILTER_SELECT, false, $lng->txt("wsp_shared_member_filter"));
         $item->setOptions(array("" => $lng->txt("search_any")) + $options);
         $this->filter["crsgrp"] = $item->getValue();
     }
 }
 /**
  * Assign mmissing course/groups to new user accounts
  * @param ilObjUser $user
  */
 protected static function handleMembership(ilObjUser $user)
 {
     $GLOBALS['ilLog']->write(__METHOD__ . ': Handling ECS assignments ');
     include_once './Services/WebServices/ECS/classes/class.ilECSSetting.php';
     if ($user->getAuthMode() != ilECSSetting::lookupAuthMode()) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Not user with authmode ' . ilECSSetting::lookupAuthMode());
         return TRUE;
     }
     include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseMemberAssignment.php';
     $assignment_ids = ilECSCourseMemberAssignment::lookupMissingAssignmentsOfUser($user->getExternalAccount());
     foreach ($assignment_ids as $obj_id) {
         include_once './Services/Membership/classes/class.ilParticipants.php';
         $part = ilParticipants::getInstanceByObjId($obj_id);
         $part->add($user->getId(), IL_CRS_MEMBER);
     }
 }
 /**
  * Init member view
  * @return 
  */
 public function initMemberView()
 {
     include_once './Services/Container/classes/class.ilMemberViewSettings.php';
     $settings = ilMemberViewSettings::getInstance();
     if ($settings->isEnabled() and isset($_GET['mv'])) {
         $settings->toggleActivation((int) $_GET['ref_id'], (int) $_GET['mv']);
     }
     if (!$settings->isActive()) {
         $this->mem_view['active'] = false;
         $this->mem_view['items'] = array();
         $this->mem_view['role'] = 0;
     } else {
         global $tree;
         $this->mem_view['active'] = true;
         $this->mem_view['items'] = $tree->getSubTreeIds($settings->getContainer());
         $this->mem_view['items'] = array_merge($this->mem_view['items'], array($settings->getContainer()));
         include_once './Services/Membership/classes/class.ilParticipants.php';
         $this->mem_view['role'] = ilParticipants::getDefaultMemberRole($settings->getContainer());
     }
     return true;
 }
 /**
  * Constructor
  *
  * @access protected
  * @param int obj_id of container
  */
 public function __construct($a_obj_id)
 {
     $this->type = 'sess';
     $this->event_part = new ilEventParticipants($a_obj_id);
     parent::__construct(self::COMPONENT_NAME, $a_obj_id);
 }
 /**
  * Gets all objects the current user is member of
  *
  * @access protected
  * @return Array $items array of objects
  */
 protected function getObjectsByMembership($types = array())
 {
     global $tree, $ilUser, $ilObjDataCache;
     include_once 'Services/Membership/classes/class.ilParticipants.php';
     $items = array();
     if (is_array($types) && count($types)) {
         foreach ($types as $type) {
             switch ($type) {
                 case 'grp':
                     $items = array_merge(ilParticipants::_getMembershipByType($ilUser->getId(), 'grp'), $items);
                     break;
                 case 'crs':
                     $items = array_merge(ilParticipants::_getMembershipByType($ilUser->getId(), 'crs'), $items);
                     break;
                 default:
                     break;
             }
         }
     } else {
         $crs_mbs = ilParticipants::_getMembershipByType($ilUser->getId(), 'crs');
         $grp_mbs = ilParticipants::_getMembershipByType($ilUser->getId(), 'grp');
         $items = array_merge($crs_mbs, $grp_mbs);
     }
     $references = array();
     foreach ($items as $key => $obj_id) {
         $item_references = ilObject::_getAllReferences($obj_id);
         if (is_array($item_references) && count($item_references)) {
             foreach ($item_references as $ref_id) {
                 $title = $ilObjDataCache->lookupTitle($obj_id);
                 $type = $ilObjDataCache->lookupType($obj_id);
                 $references[$title . $ref_id] = array('ref_id' => $ref_id, 'obj_id' => $obj_id, 'type' => $type, 'title' => $title, 'description' => $ilObjDataCache->lookupDescription($obj_id), 'parent_ref' => $tree->getParentId($ref_id));
             }
         }
     }
     ksort($references);
     return is_array($references) ? $references : array();
 }
 function getItems()
 {
     $obj_ids = $this->obj_ids;
     if (!$obj_ids && !$this->details) {
         // restrict courses/groups to objects where current user is member
         $membership_ids = null;
         if ($this->filter["type"] == "crs" || $this->filter["type"] == "grp") {
             include_once "Services/Membership/classes/class.ilParticipants.php";
             $membership_ids = ilParticipants::_getMembershipByType($this->tracked_user->getId(), $this->filter["type"]);
         }
         if ($membership_ids === null || sizeof($membership_ids)) {
             $obj_ids = $this->searchObjects($this->getCurrentFilter(true), "read", $membership_ids);
         }
     }
     if ($obj_ids) {
         include_once "./Services/Tracking/classes/class.ilTrQuery.php";
         switch ($this->mode) {
             case LP_MODE_SCORM:
                 $data = ilTrQuery::getSCOsStatusForUser($this->tracked_user->getId(), $this->parent_obj_id, $obj_ids);
                 break;
             case LP_MODE_OBJECTIVES:
                 $data = ilTrQuery::getObjectivesStatusForUser($this->tracked_user->getId(), $obj_ids);
                 break;
             default:
                 $data = ilTrQuery::getObjectsStatusForUser($this->tracked_user->getId(), $obj_ids);
                 foreach ($data as $idx => $item) {
                     if (!$item["status"] && !$this->filter["status"]) {
                         unset($data[$idx]);
                     } else {
                         $data[$idx]["offline"] = ilLearningProgressBaseGUI::isObjectOffline($item["obj_id"], $item["type"]);
                     }
                 }
                 break;
         }
         $this->setData($data);
     }
 }
 /**
  * read data
  *
  * @access protected
  * @param
  * @return
  */
 public function readSubscriberData()
 {
     include_once './Services/Membership/classes/class.ilParticipants.php';
     $sub_data = ilParticipants::lookupSubscribersData($this->getParentObject()->object->getId());
     foreach ($sub_data as $usr_id => $data) {
         $tmp_arr['id'] = $usr_id;
         $tmp_arr['sub_time'] = $data['time'];
         $tmp_arr['subject'] = $data['subject'];
         $name = ilObjUser::_lookupName($usr_id);
         $tmp_arr['name'] = $name['lastname'] . ', ' . $name['firstname'];
         $tmp_arr['login'] = '' . ilObjUser::_lookupLogin($usr_id) . '';
         $subscribers[] = $tmp_arr;
     }
     $this->setData($subscribers ? $subscribers : array());
 }
Ejemplo n.º 30
0
 function getParticipants()
 {
     if (count($this->arrFilter)) {
         $filteredParticipants = array();
         $courseids = array();
         $groupids = array();
         global $ilDB;
         if (array_key_exists('group', $this->arrFilter)) {
             $ids = ilObject::_getIdsForTitle($this->arrFilter['group'], 'grp', true);
             $groupids = array_merge($groupids, $ids);
         }
         if (array_key_exists('course', $this->arrFilter)) {
             $ids = ilObject::_getIdsForTitle($this->arrFilter['course'], 'crs', true);
             $courseids = array_merge($courseids, $ids);
         }
         foreach ($this->participants as $active_id => $participant) {
             $remove = FALSE;
             if (array_key_exists('name', $this->arrFilter)) {
                 if (!(strpos(strtolower($participant->getName()), strtolower($this->arrFilter['name'])) !== FALSE)) {
                     $remove = TRUE;
                 }
             }
             if (!$remove) {
                 if (array_key_exists('group', $this->arrFilter)) {
                     include_once "./Services/Membership/classes/class.ilParticipants.php";
                     $groups = ilParticipants::_getMembershipByType($participant->getUserID(), "grp");
                     $foundfilter = FALSE;
                     if (count(array_intersect($groupids, $groups))) {
                         $foundfilter = TRUE;
                     }
                     if (!$foundfilter) {
                         $remove = TRUE;
                     }
                 }
             }
             if (!$remove) {
                 if (array_key_exists('course', $this->arrFilter)) {
                     include_once "./Services/Membership/classes/class.ilParticipants.php";
                     $courses = ilParticipants::_getMembershipByType($participant->getUserID(), "crs");
                     $foundfilter = FALSE;
                     if (count(array_intersect($courseids, $courses))) {
                         $foundfilter = TRUE;
                     }
                     if (!$foundfilter) {
                         $remove = TRUE;
                     }
                 }
             }
             if (!$remove) {
                 if (array_key_exists('active_id', $this->arrFilter)) {
                     if ($active_id != $this->arrFilter['active_id']) {
                         $remove = TRUE;
                     }
                 }
             }
             if (!$remove) {
                 $filteredParticipants[$active_id] = $participant;
             }
         }
         return $filteredParticipants;
     } else {
         return $this->participants;
     }
 }