/** * Constructor * * @access public * @param object parent gui object * @return void */ public function __construct($a_parent_obj) { global $lng, $ilCtrl; $this->lng = $lng; $this->lng->loadLanguageModule('grp'); $this->ctrl = $ilCtrl; $this->container = $a_parent_obj; include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $this->privacy = ilPrivacySettings::_getInstance(); $this->participants = ilGroupParticipants::_getInstanceByObjId($a_parent_obj->object->getId()); parent::__construct($a_parent_obj, 'editMembers'); $this->setFormName('participants'); $this->setFormAction($this->ctrl->getFormAction($a_parent_obj)); $this->addColumn($this->lng->txt('name'), 'name', '20%'); $this->addColumn($this->lng->txt('login'), 'login', '25%'); if ($this->privacy->enabledGroupAccessTimes()) { $this->addColumn($this->lng->txt('last_access'), 'access_time'); } $this->addColumn($this->lng->txt('grp_notification'), 'notification'); $this->addColumn($this->lng->txt('objs_role'), 'roles'); $this->addCommandButton('updateMembers', $this->lng->txt('save')); $this->addCommandButton('members', $this->lng->txt('cancel')); $this->setRowTemplate("tpl.edit_participants_row.html", "Modules/Group"); $this->disable('sort'); $this->enable('header'); $this->enable('numinfo'); $this->disable('select_all'); }
/** * Get instance of ilPrivacySettings * * @access public * @return \ilPrivacySettings */ public static function _getInstance() { if (is_object(self::$instance)) { return self::$instance; } return self::$instance = new ilPrivacySettings(); }
/** * Parse table content */ public function parse() { $this->initTable(); // @TODO add filter $users = $this->getParentObject()->object->getTrackedUsers($this->filter['lastname']); $attempts = $this->getParentObject()->object->getAttemptsForUsers(); $versions = $this->getParentObject()->object->getModuleVersionForUsers(); include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); $allowExportPrivacy = $privacy->enabledExportSCORM(); $data = array(); foreach ($users as $user) { $tmp = array(); $tmp['user'] = $user['user_id']; if ($allowExportPrivacy == true) { $tmp['name'] = $user['lastname'] . ', ' . $user['firstname']; } else { $tmp['name'] = $user['user_id']; } $dt = new ilDateTime($user['last_access'], IL_CAL_DATETIME); $tmp['last_access'] = $dt->get(IL_CAL_UNIX); $tmp['attempts'] = (int) $attempts[$user['user_id']]; $tmp['version'] = (int) $versions[$user['user_id']]; $data[] = $tmp; } $this->setData($data); }
/** * Constructor */ public function __construct($a_obj_id, $a_parent_obj, $a_parent_cmd, $a_userSelected, $a_scosSelected, $a_report) { global $ilCtrl, $lng, $ilAccess, $lng, $rbacsystem; $lng->loadLanguageModule("scormtrac"); $this->obj_id = $a_obj_id; $this->report = $a_report; $this->scosSelected = $a_scosSelected; $this->userSelected = $a_userSelected; if ($a_parent_cmd == "showTrackingItemsBySco") { $this->bySCO = true; } $this->lmTitle = $a_parent_obj->object->getTitle(); $this->setId('2004' . $this->report); parent::__construct($a_parent_obj, $a_parent_cmd); $this->setLimit(9999); include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); $this->allowExportPrivacy = $privacy->enabledExportSCORM(); // if($a_print_view) // { // $this->setPrintMode(true); // } foreach ($this->getSelectedColumns() as $c) { $l = $c; if (in_array($l, array("status", "time", "score"))) { $l = "cont_" . $l; // } else { // $l = } $s = $this->lng->txt($l); if (substr($l, 0, 14) == "interaction_id") { $s = $this->lng->txt(substr($l, 0, 14)) . ' ' . substr($l, 14); } if (substr($l, 0, 17) == "interaction_value") { $s = sprintf($this->lng->txt(substr($l, 0, 17)), substr($l, 17, strpos($l, ' ') - 17)) . substr($l, strpos($l, ' ')); } if (substr($l, 0, 23) == "interaction_description") { $s = $this->lng->txt(substr($l, 0, 23)) . ' ' . substr($l, 23); } $this->addColumn($s, $c); } $this->setRowTemplate('tpl.scorm2004_tracking_items.html', 'Modules/Scorm2004'); $this->setFormAction($ilCtrl->getFormAction($this->getParentObject())); $this->setExternalSorting(true); // $this->setExternalSegmentation(true); $this->setEnableHeader(true); $this->setEnableTitle(true); // $this->setDefaultOrderField("cp_node_id, user_id"); $this->setDefaultOrderField(""); $this->setDefaultOrderDirection("asc"); $this->setShowTemplates(true); $this->setExportFormats(array(self::EXPORT_CSV, self::EXPORT_EXCEL)); // $this->initFilter(); $this->getItems(); }
/** * Constructor * * @access public * @param int usr_id * @param int obj_id */ public function __construct($a_usr_id, $a_obj_id) { global $ilDB; $this->db = $ilDB; $this->user_id = $a_usr_id; $this->obj_id = $a_obj_id; $this->type = ilObject::_lookupType($this->obj_id); $this->privacy = ilPrivacySettings::_getInstance(); if ($this->privacy->confirmationRequired($this->type) or ilCourseDefinedFieldDefinition::_hasFields($this->obj_id)) { $this->read(); } }
/** * Init acceptance * @return */ protected function initSettings() { if (self::$accepted_ids !== NULL) { return true; } self::$export_allowed = ilPrivacySettings::_getInstance()->checkExportAccess($this->getParentObject()->object->getRefId()); self::$confirmation_required = ilPrivacySettings::_getInstance()->groupConfirmationRequired(); include_once 'Services/Membership/classes/class.ilMemberAgreement.php'; self::$accepted_ids = ilMemberAgreement::lookupAcceptedAgreements($this->getParentObject()->object->getId()); include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php'; self::$has_odf_definitions = ilCourseDefinedFieldDefinition::_hasFields($this->getParentObject()->object->getId()); }
/** * Constructor * * @access public * */ public function __construct($a_ref_id) { global $ilDB, $ilCtrl, $lng, $tpl, $ilUser, $ilObjDataCache; $this->ref_id = $a_ref_id; $this->obj_id = $ilObjDataCache->lookupObjId($this->ref_id); $this->type = ilObject::_lookupType($this->obj_id); $this->ctrl = $ilCtrl; $this->tpl = $tpl; $this->lng = $lng; $this->lng->loadLanguageModule('ps'); $this->privacy = ilPrivacySettings::_getInstance(); $this->agreement = new ilMemberAgreement($ilUser->getId(), $this->obj_id); $this->init(); }
/** * Constructor * * @access public * @param object Course or Group object * @return */ public function __construct($a_container) { global $lng, $ilCtrl, $tpl; $this->lng = $lng; $this->lng->loadLanguageModule('crs'); $this->lng->loadLanguageModule('grp'); $this->lng->loadLanguageModule('ps'); $this->ctrl = $ilCtrl; $this->tpl = $tpl; $this->container = $a_container; $this->ref_id = $this->container->getRefId(); $this->obj_id = ilObject::_lookupObjId($this->ref_id); $this->type = ilObject::_lookupType($this->obj_id); // Init participants $this->initParticipants(); // Init waiting list $this->initWaitingList(); $this->privacy = ilPrivacySettings::_getInstance(); }
/** * Execute Command * * @access public * @param * */ public function executeCommand() { global $ilAccess, $rbacsystem; include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; if (!ilPrivacySettings::_getInstance()->checkExportAccess($this->ref_id)) { ilUtil::sendFailure($this->lng->txt('permission_denied'), true); $this->ctrl->returnToParent($this); } $next_class = $this->ctrl->getNextClass($this); $cmd = $this->ctrl->getCmd(); switch ($next_class) { default: if (!$cmd) { $cmd = 'show'; } $this->{$cmd}(); break; } }
public function parse($userSelected, $report, $reports) { global $ilCtrl, $lng; $lng->loadLanguageModule("scormtrac"); $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($ilCtrl->getFormAction($this->parent_obj)); $options = array("all" => $lng->txt("all")); include_once "Services/Tracking/classes/class.ilTrQuery.php"; $users = ilTrQuery::getParticipantsForObject($this->parent_obj->object->ref_id); include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); $allowExportPrivacy = $privacy->enabledExportSCORM(); //$users = $this->parent_obj->object->getTrackedUsers(""); foreach ($users as $user) { if (ilObject::_exists($user) && ilObject::_lookUpType($user) == 'usr') { if ($allowExportPrivacy == true) { $e_user = new ilObjUser($user); $options[$user] = $e_user->getLastname() . ", " . $e_user->getFirstname(); } else { $options[$user] = 'User Id: ' . $user; } } } $si = new ilSelectInputGUI($lng->txt("user"), "userSelected"); $si->setOptions($options); $si->setValue($userSelected); $this->form->addItem($si); $options = array("choose" => $lng->txt("please_choose")); for ($i = 0; $i < count($reports); $i++) { $options[$reports[$i]] = $lng->txt(strtolower($reports[$i])); } $si = new ilSelectInputGUI($lng->txt("report"), "report"); $si->setOptions($options); $si->setValue($report); $this->form->addItem($si); $this->form->addCommandButton($this->parent_cmd, $lng->txt("apply_filter")); }
/** * Constructor * * @access public * @param object parent gui object * @return void */ public function __construct($a_parent_obj) { global $lng, $ilCtrl; $this->lng = $lng; $this->lng->loadLanguageModule('crs'); $this->ctrl = $ilCtrl; $this->container = $a_parent_obj; include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $this->privacy = ilPrivacySettings::_getInstance(); $this->participants = ilCourseParticipants::_getInstanceByObjId($a_parent_obj->object->getId()); parent::__construct($a_parent_obj, 'editMembers'); $this->setFormName('participants'); $this->setFormAction($this->ctrl->getFormAction($a_parent_obj)); $this->addColumn($this->lng->txt('lastname'), 'lastname', '20%'); $this->addColumn($this->lng->txt('login'), 'login', '25%'); if ($this->privacy->enabledCourseAccessTimes()) { $this->addColumn($this->lng->txt('last_access'), 'access_time'); } $this->addColumn($this->lng->txt('crs_passed'), 'passed'); $this->addColumn($this->lng->txt('crs_blocked'), 'blocked'); $this->addColumn($this->lng->txt('crs_notification'), 'notification'); $this->addColumn($this->lng->txt('objs_role'), 'roles'); $this->addCommandButton('updateMembers', $this->lng->txt('save')); $this->addCommandButton('members', $this->lng->txt('cancel')); $this->setRowTemplate("tpl.edit_participants_row.html", "Modules/Course"); $this->disable('sort'); $this->enable('header'); $this->enable('numinfo'); $this->disable('select_all'); // Performance improvement: We read the local course roles // only once, instead of reading them for each row in method fillRow(). $this->localCourseRoles = array(); foreach ($this->container->object->getLocalCourseRoles(false) as $title => $role_id) { $this->localCourseRoles[ilObjRole::_getTranslation($title)] = array('role_id' => $role_id, 'title' => $title); } }
/** * show tracking data */ function showTrackingItems() { include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); if (!$privacy->enabledSahsProtocolData()) { $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE); } include_once "./Services/Table/classes/class.ilTableGUI.php"; //set search if ($_POST["search_string"] != "") { $_SESSION["scorm_search_string"] = trim($_POST["search_string"]); } else { if (isset($_POST["search_string"]) && $_POST["search_string"] == "") { unset($_SESSION["scorm_search_string"]); } } // load template for search additions $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl_scorm_track_items_search.html", "Modules/ScormAicc"); // load template for table $this->tpl->addBlockfile("USR_TABLE", "usr_table", "tpl.table.html"); // load template for table content data $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.scorm_track_items.html", "Modules/ScormAicc"); $num = 5; $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); // create table $tbl = new ilTableGUI(); // title & header columns if (isset($_SESSION["scorm_search_string"])) { $tbl->setTitle($this->lng->txt("cont_tracking_items") . ' - Aktive Suche: "' . $_SESSION["scorm_search_string"] . '"'); } else { $tbl->setTitle($this->lng->txt("cont_tracking_items")); } $tbl->setHeaderNames(array("", $this->lng->txt("name"), $this->lng->txt("last_access"), $this->lng->txt("attempts"), $this->lng->txt("version"))); $header_params = $this->ctrl->getParameterArray($this, "showTrackingItems"); $tbl->setColumnWidth(array("1%", "50%", "29%", "10%", "10%")); $cols = array("user_id", "username", "last_access", "attempts", "version"); $tbl->setHeaderVars($cols, $header_params); //set defaults $_GET["sort_order"] = $_GET["sort_order"] ? $_GET["sort_order"] : "asc"; $_GET["sort_by"] = $_GET["sort_by"] ? $_GET["sort_by"] : "username"; // control $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount($this->maxcount); $this->tpl->setVariable("COLUMN_COUNTS", 5); // delete button $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png")); $this->tpl->setCurrentBlock("tbl_action_btn"); $this->tpl->setVariable("BTN_NAME", "deleteTrackingForUser"); $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete")); $this->tpl->parseCurrentBlock(); // decrease attempts $this->tpl->setCurrentBlock("tbl_action_btn"); $this->tpl->setVariable("BTN_NAME", "decreaseAttempts"); $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("decrease_attempts")); $this->tpl->parseCurrentBlock(); // export aggregated data for selected users $this->tpl->setCurrentBlock("tbl_action_btn"); $this->tpl->setVariable("BTN_NAME", "exportSelected"); $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("export")); $this->tpl->parseCurrentBlock(); // add search and export all // export aggregated data for all users $this->tpl->setVariable("EXPORT_ACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("EXPORT_ALL_VALUE", $this->lng->txt('cont_export_all')); $this->tpl->setVariable("EXPORT_ALL_NAME", "exportAll"); $this->tpl->setVariable("IMPORT_VALUE", $this->lng->txt('import')); $this->tpl->setVariable("IMPORT_NAME", "Import"); $this->tpl->setVariable("SEARCH_TXT_SEARCH", $this->lng->txt('search')); $this->tpl->setVariable("SEARCH_ACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("SEARCH_NAME", 'showTrackingItems'); if (isset($_SESSION["scorm_search_string"])) { $this->tpl->setVariable("STYLE", 'display:inline;'); } else { $this->tpl->setVariable("STYLE", 'display:none;'); } $this->tpl->setVariable("SEARCH_VAL", $_SESSION["scorm_search_string"]); $this->tpl->setVariable("SEARCH_VALUE", $this->lng->txt('search_users')); $this->tpl->parseCurrentBlock(); // footer $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); $items = $this->object->getTrackedUsers($_SESSION["scorm_search_string"]); $tbl->setMaxCount(count($items)); $items = ilUtil::sortArray($items, $_GET["sort_by"], $_GET["sort_order"]); $items = array_slice($items, $_GET["offset"], $_GET["limit"]); $tbl->render(); if (count($items) > 0) { foreach ($items as $item) { if (ilObject::_exists($item["user_id"]) && ilObject::_lookUpType($item["user_id"]) == "usr") { $user = new ilObjUser($item["user_id"]); $this->tpl->setCurrentBlock("tbl_content"); $this->tpl->setVariable("VAL_USERNAME", $item["username"]); $this->tpl->setVariable("VAL_LAST", ilDatePresentation::formatDate(new ilDateTime($item["last_access"], IL_CAL_DATETIME))); $this->tpl->setVariable("VAL_ATTEMPT", $item["attempts"]); $this->tpl->setVariable("VAL_VERSION", $item['version']); $this->ctrl->setParameter($this, "user_id", $item["user_id"]); $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]); $this->tpl->setVariable("LINK_ITEM", $this->ctrl->getLinkTarget($this, "showTrackingItem")); $this->tpl->setVariable("CHECKBOX_ID", $item["user_id"]); $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2"); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->parseCurrentBlock(); } } $this->tpl->setCurrentBlock("selectall"); $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all")); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("notfound"); $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found")); $this->tpl->setVariable("NUM_COLS", $num); $this->tpl->parseCurrentBlock(); } }
function saveGlobalUserSettingsObject($action = "") { include_once 'Services/Search/classes/class.ilUserSearchOptions.php'; include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; global $ilias, $ilSetting; // see ilUserFieldSettingsTableGUI include_once "./Services/User/classes/class.ilUserProfile.php"; $up = new ilUserProfile(); $up->skipField("username"); $field_properties = $up->getStandardFields(); $profile_fields = array_keys($field_properties); $valid = true; foreach ($profile_fields as $field) { if ($_POST["chb"]["required_" . $field] && !(int) $_POST['chb']['visib_reg_' . $field]) { $valid = false; break; } } if (!$valid) { global $lng; ilUtil::sendFailure($lng->txt('invalid_visible_required_options_selected')); $this->confirm_change = 1; $this->settingsObject(); return; } // For the following fields, the required state can not be changed $fixed_required_fields = array("firstname" => 1, "lastname" => 1, "upload" => 0, "password" => 0, "language" => 0, "skin_style" => 0, "hits_per_page" => 0, "show_users_online" => 0, "hide_own_online_status" => 0); // check if a course export state of any field has been added $privacy = ilPrivacySettings::_getInstance(); if ($privacy->enabledCourseExport() == true && $privacy->courseConfirmationRequired() == true && $action != "save") { foreach ($profile_fields as $field) { if (!$ilias->getSetting("usr_settings_course_export_" . $field) && $_POST["chb"]["course_export_" . $field] == "1") { #ilUtil::sendQuestion($this->lng->txt('confirm_message_course_export')); #$this->confirm_change = 1; #$this->settingsObject(); #return; } } } // Reset user confirmation if ($action == 'save') { include_once 'Services/Membership/classes/class.ilMemberAgreement.php'; ilMemberAgreement::_reset(); } foreach ($profile_fields as $field) { // Enable disable searchable if (ilUserSearchOptions::_isSearchable($field)) { ilUserSearchOptions::_saveStatus($field, (bool) $_POST['chb']['searchable_' . $field]); } if (!$_POST["chb"]["visible_" . $field] && !$field_properties[$field]["visible_hide"]) { $ilias->setSetting("usr_settings_hide_" . $field, "1"); } else { $ilias->deleteSetting("usr_settings_hide_" . $field); } if (!$_POST["chb"]["changeable_" . $field] && !$field_properties[$field]["changeable_hide"]) { $ilias->setSetting("usr_settings_disable_" . $field, "1"); } else { $ilias->deleteSetting("usr_settings_disable_" . $field); } // registration visible if ((int) $_POST['chb']['visib_reg_' . $field] && !$field_properties[$field]["visib_reg_hide"]) { $ilSetting->set('usr_settings_visib_reg_' . $field, '1'); } else { $ilSetting->set('usr_settings_visib_reg_' . $field, '0'); } if ((int) $_POST['chb']['visib_lua_' . $field]) { $ilSetting->set('usr_settings_visib_lua_' . $field, '1'); } else { $ilSetting->set('usr_settings_visib_lua_' . $field, '0'); } if ((int) $_POST['chb']['changeable_lua_' . $field]) { $ilSetting->set('usr_settings_changeable_lua_' . $field, '1'); } else { $ilSetting->set('usr_settings_changeable_lua_' . $field, '0'); } if ($_POST["chb"]["export_" . $field] && !$field_properties[$field]["export_hide"]) { $ilias->setSetting("usr_settings_export_" . $field, "1"); } else { $ilias->deleteSetting("usr_settings_export_" . $field); } // Course export/visibility if ($_POST["chb"]["course_export_" . $field] && !$field_properties[$field]["course_export_hide"]) { $ilias->setSetting("usr_settings_course_export_" . $field, "1"); } else { $ilias->deleteSetting("usr_settings_course_export_" . $field); } // Group export/visibility if ($_POST["chb"]["group_export_" . $field] && !$field_properties[$field]["group_export_hide"]) { $ilias->setSetting("usr_settings_group_export_" . $field, "1"); } else { $ilias->deleteSetting("usr_settings_group_export_" . $field); } $is_fixed = array_key_exists($field, $fixed_required_fields); if ($is_fixed && $fixed_required_fields[$field] || !$is_fixed && $_POST["chb"]["required_" . $field]) { $ilias->setSetting("require_" . $field, "1"); } else { $ilias->deleteSetting("require_" . $field); } } if ($_POST["select"]["default_hits_per_page"]) { $ilias->setSetting("hits_per_page", $_POST["select"]["default_hits_per_page"]); } if ($_POST["select"]["default_show_users_online"]) { $ilias->setSetting("show_users_online", $_POST["select"]["default_show_users_online"]); } if ($_POST["chb"]["export_preferences"]) { $ilias->setSetting("usr_settings_export_preferences", $_POST["chb"]["export_preferences"]); } else { $ilias->deleteSetting("usr_settings_export_preferences"); } $ilias->setSetting('mail_incoming_mail', (int) $_POST['select']['default_mail_incoming_mail']); ilUtil::sendSuccess($this->lng->txt("usr_settings_saved")); $this->settingsObject(); }
protected function getSelectableUserColumns($a_in_course = false, $a_in_group = false) { global $lng, $ilSetting; $cols = $privacy_fields = array(); include_once "./Services/User/classes/class.ilUserProfile.php"; $up = new ilUserProfile(); $up->skipGroup("preferences"); $up->skipGroup("settings"); $up->skipGroup("interests"); $ufs = $up->getStandardFields(); // default fields $cols["login"] = array("txt" => $lng->txt("login"), "default" => true); if (!$this->anonymized) { $cols["firstname"] = array("txt" => $lng->txt("firstname"), "default" => true); $cols["lastname"] = array("txt" => $lng->txt("lastname"), "default" => true); } // show only if extended data was activated in lp settings include_once 'Services/Tracking/classes/class.ilObjUserTracking.php'; $tracking = new ilObjUserTracking(); if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_LAST_ACCESS)) { $cols["first_access"] = array("txt" => $lng->txt("trac_first_access"), "default" => true); $cols["last_access"] = array("txt" => $lng->txt("trac_last_access"), "default" => true); } if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_READ_COUNT)) { $cols["read_count"] = array("txt" => $lng->txt("trac_read_count"), "default" => true); } if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_SPENT_SECONDS)) { $cols["spent_seconds"] = array("txt" => $lng->txt("trac_spent_seconds"), "default" => true); } if ($this->isPercentageAvailable($this->obj_id)) { $cols["percentage"] = array("txt" => $lng->txt("trac_percentage"), "default" => true); } // do not show status if learning progress is deactivated $olp = ilObjectLP::getInstance($this->obj_id); if ($olp->isActive()) { $cols["status"] = array("txt" => $lng->txt("trac_status"), "default" => true); $cols['status_changed'] = array('txt' => $lng->txt('trac_status_changed'), 'default' => false); } if ($this->type != "lm") { $cols["mark"] = array("txt" => $lng->txt("trac_mark"), "default" => true); } $cols["u_comment"] = array("txt" => $lng->txt("trac_comment"), "default" => false); $cols["create_date"] = array("txt" => $lng->txt("create_date"), "default" => false); $cols["language"] = array("txt" => $lng->txt("language"), "default" => false); // add user data only if object is [part of] course if (!$this->anonymized && ($a_in_course || $a_in_group)) { // only show if export permission is granted include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; if (ilPrivacySettings::_getInstance()->checkExportAccess($this->ref_id)) { // other user profile fields foreach ($ufs as $f => $fd) { if (!isset($cols[$f]) && $f != "username" && !$fd["lists_hide"]) { if ($a_in_course && !($fd["course_export_fix_value"] || $ilSetting->get("usr_settings_course_export_" . $f))) { continue; } if ($a_in_group && !($fd["group_export_fix_value"] || $ilSetting->get("usr_settings_group_export_" . $f))) { continue; } $cols[$f] = array("txt" => $lng->txt($f), "default" => false); $privacy_fields[] = $f; } } // additional defined user data fields include_once './Services/User/classes/class.ilUserDefinedFields.php'; $user_defined_fields = ilUserDefinedFields::_getInstance(); if ($a_in_course) { $user_defined_fields = $user_defined_fields->getCourseExportableFields(); } else { $user_defined_fields = $user_defined_fields->getGroupExportableFields(); } foreach ($user_defined_fields as $definition) { if ($definition["field_type"] != UDF_TYPE_WYSIWYG) { $f = "udf_" . $definition["field_id"]; $cols[$f] = array("txt" => $definition["field_name"], "default" => false); $privacy_fields[] = $f; } } } } return array($cols, $privacy_fields); }
/** * 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); }
function getItems(array $a_user_fields, array $a_privary_fields = null) { include_once "./Services/Tracking/classes/class.ilTrQuery.php"; $collection = ilTrQuery::getObjectIds($this->obj_id, $this->ref_id, true); if ($collection["object_ids"]) { // we need these for the timing warnings $this->ref_ids = $collection["ref_ids"]; // only if object is [part of] course/group $check_agreement = false; if ($this->in_course) { // privacy (if course agreement is activated) include_once "Services/PrivacySecurity/classes/class.ilPrivacySettings.php"; $privacy = ilPrivacySettings::_getInstance(); if ($privacy->courseConfirmationRequired()) { $check_agreement = $this->in_course; } } else { if ($this->in_group) { // privacy (if group agreement is activated) include_once "Services/PrivacySecurity/classes/class.ilPrivacySettings.php"; $privacy = ilPrivacySettings::_getInstance(); if ($privacy->groupConfirmationRequired()) { $check_agreement = $this->in_group; } } } $data = ilTrQuery::getUserObjectMatrix($this->ref_id, $collection["object_ids"], $this->filter["name"], $a_user_fields, $a_privary_fields, $check_agreement); if ($collection["objectives_parent_id"] && $data["users"]) { // sub-items: learning objectives $objectives = ilTrQuery::getUserObjectiveMatrix($collection["objectives_parent_id"], $data["users"]); $this->objective_ids = array(); foreach ($objectives as $user_id => $objectives) { if (isset($data["set"][$user_id])) { foreach ($objectives as $objective_id => $status) { $obj_id = "objtv_" . $objective_id; $data["set"][$user_id][$obj_id] = $status; if (!in_array($obj_id, $this->objective_ids)) { $this->objective_ids[$objective_id] = ilCourseObjective::lookupObjectiveTitle($objective_id); } } } } } // sub-items: SCOs if ($collection["scorm"] && $data["set"]) { $this->sco_ids = array(); foreach (array_keys($data["set"]) as $user_id) { foreach ($collection["scorm"]["scos"] as $sco) { if (!in_array($sco, $this->sco_ids)) { $this->sco_ids[$sco] = $collection["scorm"]["scos_title"][$sco]; } // alex, 5 Nov 2011: we got users being in failed and in // completed status, I changed the setting in: first check failed // then check completed since failed should superseed completed // (before completed has been checked before failed) $status = ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM; if (in_array($user_id, $collection["scorm"]["failed"][$sco])) { $status = ilLPStatus::LP_STATUS_FAILED_NUM; } else { if (in_array($user_id, $collection["scorm"]["completed"][$sco])) { $status = ilLPStatus::LP_STATUS_COMPLETED_NUM; } else { if (in_array($user_id, $collection["scorm"]["in_progress"][$sco])) { $status = ilLPStatus::LP_STATUS_IN_PROGRESS_NUM; } } } $obj_id = "objsco_" . $sco; $data["set"][$user_id][$obj_id] = $status; } } } // sub-items: generic, e.g. lm chapter if ($collection["subitems"] && $data["set"]) { foreach (array_keys($data["set"]) as $user_id) { foreach ($collection["subitems"]["items"] as $item_id) { $this->subitem_ids[$item_id] = $collection["subitems"]["item_titles"][$item_id]; $status = ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM; if (in_array($user_id, $collection["subitems"]["completed"][$item_id])) { $status = ilLPStatus::LP_STATUS_COMPLETED_NUM; } else { if (is_array($collection["subitems"]["in_progress"]) && in_array($user_id, $collection["subitems"]["in_progress"][$item_id])) { $status = ilLPStatus::LP_STATUS_IN_PROGRESS_NUM; } } $obj_id = "objsub_" . $item_id; $data["set"][$user_id][$obj_id] = $status; } } } // percentage export if ($data["set"]) { $this->perc_map = array(); foreach ($data["set"] as $row) { foreach ($row as $column => $value) { if (substr($column, -5) == "_perc") { if ((int) $value > 0) { $obj_id = explode("_", $column); $obj_id = (int) $obj_id[1]; $this->perc_map[$obj_id] = true; } } } } } $this->setMaxCount($data["cnt"]); $this->setData($data["set"]); return $collection["object_ids"]; } return false; }
/** * Show tracking table * @global ilTabs $ilTabs * $global ilToolbar $ilToolbar */ protected function showTrackingItems() { include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); if (!$privacy->enabledSahsProtocolData()) { $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE); } global $ilTabs, $ilToolbar; include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php'; $ilToolbar->addButton($this->lng->txt('import'), $this->ctrl->getLinkTarget($this, 'importForm')); $ilToolbar->addButton($this->lng->txt('cont_export_all'), $this->ctrl->getLinkTarget($this, 'exportSelectionAll')); $this->setSubTabs(); $ilTabs->setTabActive('cont_tracking_data'); $ilTabs->setSubTabActive('cont_tracking_byuser'); include_once './Modules/ScormAicc/classes/class.ilSCORMTrackingUsersTableGUI.php'; $tbl = new ilSCORMTrackingUsersTableGUI($this->object->getId(), $this, 'showtrackingItems'); $tbl->parse(); $this->tpl->setContent($tbl->getHTML()); }
/** * Get user items */ function getItems() { global $lng; $this->determineOffsetAndOrder(); include_once "./Services/Tracking/classes/class.ilTrQuery.php"; $additional_fields = $this->getSelectedColumns(); // only if object is [part of] course/group $check_agreement = false; if ($this->in_course) { // privacy (if course agreement is activated) include_once "Services/PrivacySecurity/classes/class.ilPrivacySettings.php"; $privacy = ilPrivacySettings::_getInstance(); if ($privacy->courseConfirmationRequired()) { $check_agreement = $this->in_course; } } else { if ($this->in_group) { // privacy (if group agreement is activated) include_once "Services/PrivacySecurity/classes/class.ilPrivacySettings.php"; $privacy = ilPrivacySettings::_getInstance(); if ($privacy->groupConfirmationRequired()) { $check_agreement = $this->in_group; } } } $tr_data = ilTrQuery::getUserDataForObject($this->ref_id, ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $this->getCurrentFilter(), $additional_fields, $check_agreement, $this->user_fields); if (count($tr_data["set"]) == 0 && $this->getOffset() > 0) { $this->resetOffset(); $tr_data = ilTrQuery::getUserDataForObject($this->ref_id, ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $this->getCurrentFilter(), $additional_fields, $check_agreement, $this->user_fields); } $this->setMaxCount($tr_data["cnt"]); $this->setData($tr_data["set"]); }
static function garbageCollection() { global $ilDB; include_once "Services/PrivacySecurity/classes/class.ilPrivacySettings.php"; $settings = ilPrivacySettings::_getInstance(); $max = $settings->getRbacLogAge(); $ilDB->query("DELETE FROM rbac_log WHERE created < " . $ilDB->quote(strtotime("-" . $max . "months"), "integer")); }
/** * adds tabs to tab gui object * * @param object $tabs_gui ilTabsGUI object */ function getTabs(&$tabs_gui) { global $rbacsystem, $ilUser, $ilCtrl, $ilHelp; if ($this->ctrl->getCmd() == "delete") { return; } switch ($this->object->getSubType()) { case "scorm2004": $ilHelp->setScreenIdComponent("sahs13"); break; case "scorm": $ilHelp->setScreenIdComponent("sahs12"); break; } // file system gui tabs // properties $ilCtrl->setParameterByClass("ilfilesystemgui", "resetoffset", 1); $tabs_gui->addTarget("cont_list_files", $this->ctrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"), "", "ilfilesystemgui"); $ilCtrl->setParameterByClass("ilfilesystemgui", "resetoffset", ""); // info screen $force_active = $this->ctrl->getNextClass() == "ilinfoscreengui" ? true : false; $tabs_gui->addTarget("info_short", $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"), "", "ilinfoscreengui", "", $force_active); // properties $tabs_gui->addTarget("settings", $this->ctrl->getLinkTarget($this, "properties"), array("", "properties"), get_class($this)); // learning progress include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php'; if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) { $tabs_gui->addTarget('learning_progress', $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), ''), '', array('illplistofobjectsgui', 'illplistofsettingsgui', 'illearningprogressgui', 'illplistofprogressgui')); } include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); if ($privacy->enabledSahsProtocolData()) { // tracking data $tabs_gui->addTarget("cont_tracking_data", $this->ctrl->getLinkTarget($this, "showTrackingItems"), "showTrackingItems", get_class($this)); } // certificate subtab include_once "Services/Certificate/classes/class.ilCertificate.php"; if (ilCertificate::isActive()) { // create and insert object in objecttree switch ($this->object->getSubType()) { case "scorm2004": case "scorm": // certificate $tabs_gui->addTarget("certificate", $this->ctrl->getLinkTarget($this, "certificate"), array("certificate", "certificateEditor", "certificateRemoveBackground", "certificateSave", "certificatePreview", "certificateDelete", "certificateUpload", "certificateImport")); break; } } include_once "Services/License/classes/class.ilLicenseAccess.php"; if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId()) and ilLicenseAccess::_isEnabled()) { $tabs_gui->addTarget("license", $this->ctrl->getLinkTargetByClass('illicensegui', ''), "", "illicensegui"); } // edit meta $tabs_gui->addTarget("meta_data", $this->ctrl->getLinkTargetByClass('ilmdeditorgui', ''), "", "ilmdeditorgui"); // perm if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) { $tabs_gui->addTarget("perm_settings", $this->ctrl->getLinkTargetByClass(array(get_class($this), 'ilpermissiongui'), "perm"), array("perm", "info", "owner"), 'ilpermissiongui'); } }
/** * Init acceptance * @return */ public function initAcceptedAgreements() { if (self::$accepted_ids !== NULL) { return true; } self::$export_allowed = ilPrivacySettings::_getInstance()->checkExportAccess($this->getParentObject()->object->getRefId()); self::$confirmation_required = ilPrivacySettings::_getInstance()->courseConfirmationRequired(); include_once 'Services/Membership/classes/class.ilMemberAgreement.php'; self::$accepted_ids = ilMemberAgreement::lookupAcceptedAgreements($this->getParentObject()->object->getId()); }
/** * Check agreement and redirect if it is not accepted * * @access private * */ private function checkAgreement() { global $ilUser, $ilAccess; if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) { return true; } // Disable aggrement if is not member of course if (!$this->object->getMemberObject()->isAssigned()) { return true; } include_once './Services/Container/classes/class.ilMemberViewSettings.php'; if (ilMemberViewSettings::getInstance()->isActive()) { return true; } include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; include_once 'Services/Membership/classes/class.ilMemberAgreement.php'; $privacy = ilPrivacySettings::_getInstance(); // Check agreement if (($privacy->courseConfirmationRequired() or ilCourseDefinedFieldDefinition::_hasFields($this->object->getId())) and !ilMemberAgreement::_hasAccepted($ilUser->getId(), $this->object->getId())) { $GLOBALS['ilLog']->write(__METHOD__ . ': Missing course confirmation.'); return false; } // Check required fields include_once 'Modules/Course/classes/Export/class.ilCourseUserData.php'; if (!ilCourseUserData::_checkRequired($ilUser->getId(), $this->object->getId())) { $GLOBALS['ilLog']->write(__METHOD__ . ': Missing required fields'); return false; } return true; }
/** * Export selected user tracking data * @global ilDB $ilDB * @global ilObjUser $ilUser * @param bool $a_all * @param array $a_users */ public function exportSelected($a_all, $a_users = array()) { global $ilDB, $ilUser; include_once './Modules/ScormAicc/classes/class.ilSCORMTrackingItems.php'; include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php"; include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); $allowExportPrivacy = $privacy->enabledExportSCORM(); $csv = ""; $query = 'SELECT * FROM sahs_user WHERE obj_id = %s'; if (count($a_users) > 0) { $query .= ' AND ' . $ilDB->in('user_id', $a_users, false, 'integer'); } $res = $ilDB->queryF($query, array('integer'), array($this->getId())); while ($data = $ilDB->fetchAssoc($res)) { $csv = $csv . $data["obj_id"] . ";\"" . $this->getTitle() . "\"" . ";" . $data["module_version"] . ";\"" . implode("\";\"", ilSCORMTrackingItems::userDataArrayForExport($data["user_id"], $allowExportPrivacy)) . "\"" . ";\"" . $data["last_access"] . "\"" . ";\"" . ilLearningProgressBaseGUI::__readStatus($data["obj_id"], $data["user_id"]) . "\"" . ";" . $data["package_attempts"] . ";" . $data["percentage_completed"] . ";" . $data["sco_total_time_sec"] . "\n"; } $udh = ilSCORMTrackingItems::userDataHeaderForExport(); $header = "LearningModuleId;LearningModuleTitle;LearningModuleVersion;" . str_replace(',', ';', $udh["cols"]) . ";" . "LastAccess;Status;Attempts;percentageCompletedSCOs;SumTotal_timeSeconds\n"; $this->sendExportFile($header, $csv); }
/** * Get ordered enabled fields * * @access public * @param * */ protected function getOrderedExportableFields() { include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; include_once 'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php'; include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php'; include_once 'Services/User/classes/class.ilUserDefinedFields.php'; $field_info = ilExportFieldsInfo::_getInstanceByType(ilObject::_lookupType($this->obj_id)); $fields[] = 'role'; // Append agreement info $privacy = ilPrivacySettings::_getInstance(); if ($privacy->courseConfirmationRequired() or ilCourseDefinedFieldDefinition::_hasFields($this->obj_id)) { $fields[] = 'agreement'; } foreach ($field_info->getExportableFields() as $field) { if ($this->settings->enabled($field)) { $fields[] = $field; } } $udf = ilUserDefinedFields::_getInstance(); foreach ($udf->getCourseExportableFields() as $field_id => $udf_data) { $fields[] = 'udf_' . $field_id; } // Add course specific fields foreach (ilCourseDefinedFieldDefinition::_getFields($this->obj_id) as $field_obj) { if ($this->settings->enabled('cdf_' . $field_obj->getId())) { $fields[] = 'cdf_' . $field_obj->getId(); } } return $fields ? $fields : array(); }
/** * Parse data * @return * * @global ilRbacReview $rbacreview */ public function parse() { global $rbacreview; $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"]); unset($additional_fields['consultation_hour']); unset($additional_fields['prtf']); $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, $this->getRoleId(), null, $usr_data_fields, $part); 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', $this->getSelectedColumns()); $a_user_data = array(); foreach ((array) $usr_data['set'] as $ud) { $a_user_data[$ud['usr_id']] = array_merge($ud, $course_user_data[$ud['usr_id']]); if ($this->show_lp_status_sync) { // #9912 / #13208 $passed_info = ""; if ($a_user_data[$ud['usr_id']]["passed_info"]) { $pinfo = $a_user_data[$ud['usr_id']]["passed_info"]; if ($pinfo["user_id"]) { if ($pinfo["user_id"] < 0) { $passed_info = $this->lng->txt("crs_passed_status_system"); } else { if ($pinfo["user_id"] > 0) { $name = ilObjUser::_lookupName($pinfo["user_id"]); $passed_info = $this->lng->txt("crs_passed_status_manual_by") . ": " . $name["login"]; } } } if ($pinfo["timestamp"]) { $passed_info .= "<br />" . ilDatePresentation::formatDate($pinfo["timestamp"]); } } $a_user_data[$ud['usr_id']]["passed_info"] = $passed_info; } } // 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] : ''; } } // consultation hours if ($this->isColumnSelected('consultation_hour')) { include_once './Services/Booking/classes/class.ilBookingEntry.php'; foreach (ilBookingEntry::lookupManagedBookingsForObject($this->getParentObject()->object->getId(), $GLOBALS['ilUser']->getId()) as $buser => $booking) { if (isset($a_user_data[$buser])) { $a_user_data[$buser]['consultation_hour'] = $booking[0]['dt']; $a_user_data[$buser]['consultation_hour_end'] = $booking[0]['dtend']; $a_user_data[$buser]['consultation_hours'] = $booking; } } } $this->setMaxCount($usr_data['cnt'] ? $usr_data['cnt'] : 0); return $this->setData($a_user_data); }
/** * show tracking data */ function showTrackingItems() { include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); if (!$privacy->enabledSahsProtocolData()) { $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE); } include_once "./Services/Table/classes/class.ilTableGUI.php"; // load template for table $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html"); // load template for table content data $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.scorm_track_items.html", "Modules/ScormAicc"); $num = 1; $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=" . $this->ref_id . "{$obj_str}&cmd=gateway"); // create table $tbl = new ilTableGUI(); // title & header columns $tbl->setTitle($this->lng->txt("cont_tracking_items")); $tbl->setHeaderNames(array($this->lng->txt("title"))); $header_params = array("ref_id" => $this->ref_id, "cmd" => $_GET["cmd"], "cmdClass" => get_class($this)); $cols = array("title"); $tbl->setHeaderVars($cols, $header_params); $tbl->setColumnWidth(array("100%")); // control $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount($this->maxcount); //$this->tpl->setVariable("COLUMN_COUNTS",count($this->data["cols"])); //$this->showActions(true); // footer $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); #$tbl->disable("footer"); //$items = $this->object->getTrackingItems(); $items = $this->object->getTrackedItems(); //$objs = ilUtil::sortArray($objs, $_GET["sort_by"], $_GET["sort_order"]); $tbl->setMaxCount(count($items)); $items = array_slice($items, $_GET["offset"], $_GET["limit"]); $tbl->render(); if (count($items) > 0) { foreach ($items as $item) { $this->tpl->setCurrentBlock("tbl_content"); $this->tpl->setVariable("TXT_ITEM_TITLE", $item->getTitle()); $this->ctrl->setParameter($this, "obj_id", $item->getId()); $this->tpl->setVariable("LINK_ITEM", $this->ctrl->getLinkTarget($this, "showTrackingItem")); $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2"); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->parseCurrentBlock(); } } else { $this->tpl->setCurrentBlock("notfound"); $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found")); $this->tpl->setVariable("NUM_COLS", $num); $this->tpl->parseCurrentBlock(); } }
/** * Save privacy settings * * @access public * */ public function save_privacy() { global $ilErr, $ilAccess, $ilSetting; if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) { $ilErr->raiseError($this->lng->txt('no_permission'), $ilErr->WARNING); } if ((int) $_POST['rbac_log_age'] > 24) { $_POST['rbac_log_age'] = 24; } else { if ((int) $_POST['rbac_log_age'] < 1) { $_POST['rbac_log_age'] = 1; } } $_POST['profile_protection'] = isset($_POST['profile_protection']) ? $_POST['profile_protection'] : array(); $privacy = ilPrivacySettings::_getInstance(); $privacy->enableCourseExport((int) in_array('export_course', $_POST['profile_protection'])); $privacy->enableGroupExport((int) in_array('export_group', $_POST['profile_protection'])); $privacy->setCourseConfirmationRequired((int) in_array('export_confirm_course', $_POST['profile_protection'])); $privacy->setGroupConfirmationRequired((int) in_array('export_confirm_group', $_POST['profile_protection'])); $privacy->showGroupAccessTimes((int) in_array('grp_access_times', $_POST['profile_protection'])); $privacy->showCourseAccessTimes((int) in_array('crs_access_times', $_POST['profile_protection'])); $privacy->enableForaStatistics((int) $_POST['fora_statistics']); $privacy->enableAnonymousFora((int) $_POST['anonymous_fora']); $privacy->enableRbacLog((int) $_POST['rbac_log']); $privacy->setRbacLogAge((int) $_POST['rbac_log_age']); $privacy->enableSahsProtocolData((int) $_POST['enable_sahs_pd']); // validate settings $code = $privacy->validate(); // if error code != 0, display error and do not save if ($code != 0) { $msg = $this->getErrorMessage($code); ilUtil::sendFailure($msg); } else { $privacy->save(); include_once 'Services/Membership/classes/class.ilMemberAgreement.php'; ilMemberAgreement::_reset(); ilUtil::sendSuccess($this->lng->txt('settings_saved')); } $this->showPrivacy(); }
/** * @return list of users of a specific role, following dtd users_3_7 */ function getUserForRole($sid, $role_id, $attachRoles, $active) { $this->initAuth($sid); $this->initIlias(); if (!$this->__checkSession($sid)) { return $this->__raiseError($this->__getMessage(), $this->__getMessageCode()); } include_once './Services/AccessControl/classes/class.ilObjRole.php'; global $ilDB, $rbacreview, $rbacsystem, $tree, $ilUser; $global_roles = $rbacreview->getGlobalRoles(); if (in_array($role_id, $global_roles)) { if ($role_id == SYSTEM_ROLE_ID && !in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) { return $this->__raiseError("Role access not permitted. ({$role_id})", "Server"); } } else { $rolf = $rbacreview->getFoldersAssignedToRole($role_id, true); if ($rbacreview->isDeleted($rolf[0]) || !$rbacsystem->checkAccess('write', $tree->getParentId($rolf[0]))) { return $this->__raiseError("Role access not permitted. ({$role_id})", "Server"); } include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); if (!$rbacsystem->checkAccess('read', SYSTEM_USER_ID) and !$rbacsystem->checkAccess('export_member_data', $privacy->getPrivacySettingsRefId())) { return $this->__raiseError("Export of local role members not permitted. ({$role_id})", "Server"); } } $data = ilObjUser::_getUsersForRole($role_id, $active); include_once './Services/User/classes/class.ilUserXMLWriter.php'; $xmlWriter = new ilUserXMLWriter(); $xmlWriter->setAttachRoles($attachRoles); $xmlWriter->setObjects($data); if ($xmlWriter->start()) { return $xmlWriter->getXML(); } return $this->__raiseError('Error in getUsersForRole', 'Server'); }
public function userDataHeaderForExport() { include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); $allowExportPrivacy = $privacy->enabledExportSCORM(); $returnData = array(); if ($allowExportPrivacy == true) { $returnData["cols"] = 'login,user,email,department'; } else { $returnData["cols"] = 'user'; } $returnData["default"] = 'user'; return $returnData; }
/** * adds tabs to tab gui object * * @param object $tabs_gui ilTabsGUI object */ function getTabs(&$tabs_gui) { global $rbacsystem, $ilUser, $ilCtrl, $ilHelp; if ($this->ctrl->getCmd() == "delete") { return; } switch ($this->object->getSubType()) { case "scorm2004": $ilHelp->setScreenIdComponent("sahs13"); break; case "scorm": $ilHelp->setScreenIdComponent("sahs12"); break; } // file system gui tabs // properties $ilCtrl->setParameterByClass("ilfilesystemgui", "resetoffset", 1); $tabs_gui->addTarget("cont_list_files", $this->ctrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"), "", "ilfilesystemgui"); $ilCtrl->setParameterByClass("ilfilesystemgui", "resetoffset", ""); // info screen $force_active = $this->ctrl->getNextClass() == "ilinfoscreengui" ? true : false; $tabs_gui->addTarget("info_short", $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"), "", "ilinfoscreengui", "", $force_active); // properties $tabs_gui->addTarget("settings", $this->ctrl->getLinkTarget($this, "properties"), array("", "properties"), get_class($this)); // learning progress and offline mode include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php'; if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) { //if scorm && offline_mode activated if ($this->object->getSubType() == "scorm2004" || $this->object->getSubType() == "scorm") { if ($this->object->getOfflineMode() == true) { $tabs_gui->addTarget("offline_mode_manager", $this->ctrl->getLinkTarget($this, "offlineModeManager"), "offlineModeManager", "ilobjscormlearningmodulegui"); } } $tabs_gui->addTarget('learning_progress', $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), ''), '', array('illplistofobjectsgui', 'illplistofsettingsgui', 'illearningprogressgui', 'illplistofprogressgui')); } // tracking data if ($rbacsystem->checkAccess("read_learning_progress", $this->object->getRefId()) || $rbacsystem->checkAccess("edit_learning_progress", $this->object->getRefId())) { if ($this->object->getSubType() == "scorm2004" || $this->object->getSubType() == "scorm") { include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); if ($privacy->enabledSahsProtocolData()) { $tabs_gui->addTarget("cont_tracking_data", $this->ctrl->getLinkTarget($this, "showTrackingItems"), "showTrackingItems", get_class($this)); } } } include_once "Services/License/classes/class.ilLicenseAccess.php"; if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId()) and ilLicenseAccess::_isEnabled()) { $tabs_gui->addTarget("license", $this->ctrl->getLinkTargetByClass('illicensegui', ''), "", "illicensegui"); } // edit meta $tabs_gui->addTarget("meta_data", $this->ctrl->getLinkTargetByClass('ilmdeditorgui', ''), "", "ilmdeditorgui"); // perm if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) { $tabs_gui->addTarget("perm_settings", $this->ctrl->getLinkTargetByClass(array(get_class($this), 'ilpermissiongui'), "perm"), array("perm", "info", "owner"), 'ilpermissiongui'); } }