/** * Get list of roles assigned to an object * @return * @param object $result */ public static function getListByObject($a_str) { global $rbacreview, $ilDB; include_once './Services/JSON/classes/class.ilJsonUtil.php'; $result = array(); if (strpos($a_str, '@') !== 0) { return ilJsonUtil::encode($result); } $a_str = substr($a_str, 1); $ilDB->setLimit(100); $query = "SELECT ref_id, title FROM object_data ode " . "JOIN object_reference ore ON ode.obj_id = ore.obj_id " . "WHERE " . $ilDB->like('title', 'text', $a_str . '%') . ' ' . 'ORDER BY title'; $res = $ilDB->query($query); $counter = 0; while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $rolf = $rbacreview->getRoleFolderIdOfObject($row->ref_id); if ($rolf) { foreach ($rbacreview->getRolesOfRoleFolder($rolf, false) as $rol_id) { $role = ilObject::_lookupTitle($rol_id); $result[$counter] = new stdClass(); $result[$counter]->value = $role; $result[$counter]->label = $role . " (" . $row->title . ")"; ++$counter; } } } return ilJsonUtil::encode($result); }
/** * Fill table row */ protected function fillRow($a_set) { global $lng; $this->tpl->setVariable("REF_ID", $a_set["ref_id"]); $this->tpl->setVariable("SUBSTYLE", $a_set["substyle"]); $this->tpl->setVariable("CATEGORY", ilObject::_lookupTitle(ilObject::_lookupObjId($a_set["ref_id"]))); }
/** * Handle target parameter * @param object $a_target * @return */ public static function handleCode($a_ref_id, $a_type, $a_code) { global $lng, $tree, $ilUser; include_once './Services/Link/classes/class.ilLink.php'; $lng->loadLanguageModule($a_type); try { self::useCode($a_code, $a_ref_id); $title = ilObject::_lookupTitle(ilObject::_lookupObjectId($a_ref_id)); ilUtil::sendSuccess(sprintf($lng->txt($a_type . "_admission_link_success_registration"), $title), true); ilUtil::redirect(ilLink::_getLink($a_ref_id)); } catch (ilMembershipRegistrationException $e) { switch ($e->getCode()) { case 124: //added to waiting list ilUtil::sendSuccess($e->getMessage(), true); break; case 123: //object is full ilUtil::sendFailure($lng->txt($a_type . "_admission_link_failure_membership_limited"), true); break; case 789: //out of registration period ilUtil::sendFailure($lng->txt($a_type . "_admission_link_failure_registration_period"), true); break; default: ilUtil::sendFailure($e->getMessage(), true); break; } $GLOBALS['ilLog']->logStack(); $GLOBALS['ilLog']->write($e->getCode() . ': ' . $e->getMessage()); $parent_id = $tree->getParentId($a_ref_id); ilUtil::redirect(ilLink::_getLink($parent_id)); } }
/** * Constructor * * @access public * @param * @return */ public function __construct($a_parent_obj, $a_parent_cmd, $a_pool_ref_id) { global $lng, $ilCtrl; $this->setId("cont_qpl"); $this->pool_ref_id = $a_pool_ref_id; $this->pool_obj_id = ilObject::_lookupObjId($a_pool_ref_id); parent::__construct($a_parent_obj, $a_parent_cmd); $this->setTitle(ilObject::_lookupTitle($this->pool_obj_id)); // $qplSetting = new ilSetting("qpl"); $this->setFormName('sa_quest_browser'); // $this->addColumn('','f','1%'); $this->addColumn($this->lng->txt("title"), 'title', ''); $this->addColumn($this->lng->txt("cont_question_type"), 'ttype', ''); $this->addColumn($this->lng->txt("actions"), '', ''); // $this->setPrefix('q_id'); // $this->setSelectAllCheckbox('q_id'); $this->setRowTemplate("tpl.copy_sa_quest_row.html", "Services/COPage"); $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd)); $this->setDefaultOrderField("title"); $this->setDefaultOrderDirection("asc"); // $this->setFilterCommand('filterQuestionBrowser'); // $this->setResetCommand('resetQuestionBrowser'); $this->initFilter(); $this->getQuestions(); }
/** * 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()); }
/** * Fill table row */ protected function fillRow($a_set) { global $lng, $ilCtrl, $ilUser; include_once "./Services/Skill/classes/class.ilPersonalSkill.php"; $mat = ilPersonalSkill::getAssignedMaterial($ilUser->getId(), $this->tref_id, $a_set["id"]); $ilCtrl->setParameter($this->parent_obj, "level_id", $a_set["id"]); foreach ($mat as $m) { $this->tpl->setCurrentBlock("mat"); $obj_id = $this->ws_tree->lookupObjectId($m["wsp_id"]); $this->tpl->setVariable("MAT_TITLE", ilObject::_lookupTitle($obj_id)); $this->tpl->setVariable("MAT_IMG", ilUtil::img(ilUtil::getImagePath("icon_" . ilObject::_lookupType($obj_id) . ".svg"))); $this->tpl->setVariable("TXT_REMOVE", $lng->txt("remove")); $ilCtrl->setParameter($this->parent_obj, "wsp_id", $m["wsp_id"]); $this->tpl->setVariable("HREF_REMOVE", $ilCtrl->getLinkTarget($this->parent_obj, "removeMaterial")); $obj_id = $this->ws_tree->lookupObjectId($m["wsp_id"]); $url = $this->ws_access->getGotoLink($m["wsp_id"], $obj_id); $this->tpl->setVariable("HREF_MAT", $url); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("cmd"); $this->tpl->setVariable("HREF_CMD", $ilCtrl->getLinkTarget($this->parent_obj, "assignMaterial")); $this->tpl->setVariable("TXT_CMD", $lng->txt("skmg_assign_materials")); $this->tpl->parseCurrentBlock(); $ilCtrl->setParameter($this->parent_obj, "level_id", ""); $this->tpl->setVariable("LEVEL_ID", $a_set["id"]); $this->tpl->setVariable("SKILL_ID", $this->basic_skill_id); $this->tpl->setVariable("TXT_SKILL", $a_set["title"]); $this->tpl->setVariable("TXT_SKILL_DESC", $a_set["description"]); }
protected function getItems($a_content_obj, $a_group_obj) { global $ilUser, $tree; $counter = 0; $items = ilUtil::_getObjectsByOperations($this->type, 'write', $ilUser->getId(), -1); $items_obj_id = array(); $items_ids = array(); foreach ($items as $ref_id) { $obj_id = ilObject::_lookupObjId($ref_id); $items_ids[$obj_id] = $ref_id; $items_obj_id[] = $obj_id; } $items_obj_id = ilUtil::_sortIds($items_obj_id, 'object_data', 'title', 'obj_id'); $assigned_ids = array(); $assigned = $a_group_obj->getAssignedItems(); if ($assigned) { foreach ($assigned as $item) { $assigned_ids[] = $item['target_ref_id']; } } $data = array(); foreach ($items_obj_id as $obj_id) { $item_id = $items_ids[$obj_id]; if ($tree->checkForParentType($item_id, 'adm')) { continue; } $obj_id = ilObject::_lookupObjId($item_id); $data[] = array('id' => $item_id, 'title' => ilObject::_lookupTitle($obj_id), 'description' => ilObject::_lookupDescription($obj_id), 'path' => $this->__formatPath($tree->getPathFull($item_id)), 'assigned' => in_array($item_id, $assigned_ids)); } $this->setData($data); }
/** * Fill table row */ protected function fillRow($a_set) { global $lng; $this->tpl->setVariable("TXT_DEP_OBJ", $lng->txt("obj_" . ilObject::_lookupType($a_set["dep_obj"])) . ": " . ilObject::_lookupTitle($a_set["dep_obj"])); $this->tpl->setVariable("TXT_DEL_OBJ", $lng->txt("obj_" . ilObject::_lookupType($a_set["del_obj"])) . ": " . ilObject::_lookupTitle($a_set["del_obj"])); $this->tpl->setVariable("TXT_MESS", $a_set["message"]); }
/** * Performs better than standard like search on huge installations */ public static function getLuceneList($a_str) { include_once './Services/Search/classes/Lucene/class.ilLuceneQueryParser.php'; $qp = new ilLuceneQueryParser('title:' . $a_str . '*'); $qp->parse(); include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php'; $searcher = ilLuceneSearcher::getInstance($qp); $searcher->setType(ilLuceneSearcher::TYPE_STANDARD); $searcher->search(); $res = $searcher->getResult()->getCandidates(); $max_entries = ilSearchSettings::getInstance()->getAutoCompleteLength() ? ilSearchSettings::getInstance()->getAutoCompleteLength() : 10; $list = array(); $num_entries = 0; foreach ($res as $res_obj_id) { if (self::checkObjectPermission($res_obj_id)) { $list[] = ilObject::_lookupTitle($res_obj_id, true); $num_entries++; } if ($num_entries >= $max_entries) { break; } } $i = 0; $result = array(); foreach ($list as $entry) { $result[$i] = new stdClass(); $result[$i]->value = '"' . $entry . '"'; $i++; } include_once './Services/JSON/classes/class.ilJsonUtil.php'; return ilJsonUtil::encode($result); }
public function __construct($a_parent_obj, $a_parent_cmd, array &$a_data, $a_view, $a_by_location = false) { global $ilCtrl, $tree, $ilUser; $this->setId("pdmng"); parent::__construct($a_parent_obj, $a_parent_cmd); $this->addColumn('', '', '5%'); $this->addColumn($this->lng->txt("type"), 'type_caption', '1%'); $this->addColumn($this->lng->txt("title"), 'title', '44%'); $this->addColumn($this->lng->txt("container"), 'container', '50%'); $this->setDefaultOrderField("title"); $this->setRowTemplate("tpl.pd_manage_row.html", "Services/PersonalDesktop"); $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd)); if ($a_view == ilPDSelectedItemsBlockGUI::VIEW_MY_OFFERS) { $this->setTitle($this->lng->txt("pd_my_offers")); $this->addMultiCommand('confirmRemove', $this->lng->txt('unsubscribe')); } else { $this->setTitle($this->lng->txt("pd_my_memberships")); $this->addMultiCommand('confirmRemove', $this->lng->txt('crs_unsubscribe')); } $this->addCommandButton("getHTML", $this->lng->txt("cancel")); // root node caption $root = $tree->getNodeData(ROOT_FOLDER_ID); $root = $root["title"]; if ($root == "ILIAS") { $root = $this->lng->txt("repository"); } foreach ($a_data as $idx => $item) { if (!$item["parent_ref"]) { unset($a_data[$idx]); continue; } if ($a_view == ilPDSelectedItemsBlockGUI::VIEW_MY_MEMBERSHIPS) { $a_data[$idx]["last_admin"] = false; switch ($item["type"]) { case "crs": // see ilObjCourseGUI:performUnsubscribeObject() include_once "Modules/Course/classes/class.ilCourseParticipants.php"; $members = new ilCourseParticipants($item["obj_id"]); break; case "grp": include_once "Modules/Group/classes/class.ilGroupParticipants.php"; $members = new ilGroupParticipants($item["obj_id"]); break; default: // do nothing? continue; } $a_data[$idx]["last_admin"] = $members->isLastAdmin($ilUser->getId()); } $a_data[$idx]["type_caption"] = $this->lng->txt("obj_" . $item["type"]); // parent if ($tree->getRootId() != $item["parent_ref"]) { $a_data[$idx]["container"] = ilObject::_lookupTitle(ilObject::_lookupObjId($item["parent_ref"])); } else { $a_data[$idx]["container"] = $root; } } $this->setData($a_data); }
/** * Write container manifest * @return */ protected function manifestWriterBegin($a_type, $a_id, $a_target_release) { $GLOBALS['ilLog']->write(__METHOD__ . ': wrinting manifest'); include_once "./Services/Xml/classes/class.ilXmlWriter.php"; $this->cont_manifest_writer = new ilXmlWriter(); $this->cont_manifest_writer->xmlHeader(); $this->cont_manifest_writer->xmlStartTag('Manifest', array("MainEntity" => $a_type, "Title" => ilObject::_lookupTitle($a_id), "TargetRelease" => $a_target_release, "InstallationId" => IL_INST_ID, "InstallationUrl" => ILIAS_HTTP_PATH)); }
/** * Get content of node * * @param * @return */ function getNodeContent($a_node) { $rn = $this->getRootNode(); if ($rn["child"] == $a_node["child"]) { return ilObject::_lookupTitle($this->tax_tree->getTreeId()); } else { return $a_node["title"]; } }
/** * Fill table row */ protected function fillRow($a_set) { global $lng, $ilCtrl; $ilCtrl->setParameter($this->parent_obj, "glo_id", $a_set["glo_id"]); $this->tpl->setCurrentBlock("cmd"); $this->tpl->setVariable("CMD_HREF", $ilCtrl->getLinkTarget($this->parent_obj, "removeLMGlossary")); $this->tpl->setVariable("CMD_TXT", $lng->txt("remove")); $this->tpl->parseCurrentBlock(); $this->tpl->setVariable("TITLE", ilObject::_lookupTitle($a_set["glo_id"])); }
/** * Standard Version of Fill Row. Most likely to * be overwritten by derived class. */ protected function fillRow($a_set) { global $lng, $ilCtrl, $ilAccess; $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); // user if ($a_set["user_id"] > 0) { $this->tpl->setCurrentBlock("user_info"); $user_obj = new ilObjUser($a_set["user_id"]); $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin()); $this->tpl->setVariable("TXT_AUTHOR", $lng->txt("author")); $this->tpl->parseCurrentBlock(); } // access if ($enable_internal_rss) { $this->tpl->setCurrentBlock("access"); $this->tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility")); if ($a_set["visibility"] == NEWS_PUBLIC || $a_set["priority"] == 0 && ilBlockSetting::_lookup("news", "public_notifications", 0, $a_set["context_obj_id"])) { $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public")); } else { $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users")); } $this->tpl->parseCurrentBlock(); } // last update if ($a_set["creation_date"] != $a_set["update_date"]) { $this->tpl->setCurrentBlock("ni_update"); $this->tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update")); $this->tpl->setVariable("VAL_LAST_UPDATE", ilDatePresentation::formatDate(new ilDateTime($a_set["update_date"], IL_CAL_DATETIME))); $this->tpl->parseCurrentBlock(); } // creation date $this->tpl->setVariable("VAL_CREATION_DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["creation_date"], IL_CAL_DATETIME))); $this->tpl->setVariable("TXT_CREATED", $lng->txt("created")); // title $this->tpl->setVariable("VAL_TITLE", $a_set["title"]); // content if ($a_set["content"] != "") { $this->tpl->setCurrentBlock("content"); $this->tpl->setVariable("VAL_CONTENT", ilUtil::shortenText($a_set["content"], 80, true, true), true); $this->tpl->parseCurrentBlock(); } $perm_ref_id = $this->perm_ref_id > 0 ? $this->perm_ref_id : $a_set["ref_id"]; if ($ilAccess->checkAccess("write", "", $perm_ref_id)) { $this->tpl->setCurrentBlock("edit"); $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit")); $ilCtrl->setParameterByClass("ilnewsitemgui", "news_item_id", $a_set["id"]); $this->tpl->setVariable("CMD_EDIT", $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "editNewsItem")); $this->tpl->parseCurrentBlock(); } // context $this->tpl->setVariable("CONTEXT", $lng->txt("obj_" . $a_set["context_obj_type"]) . ":<br />" . ilObject::_lookupTitle($a_set["context_obj_id"])); $this->tpl->setVariable("VAL_ID", $a_set["id"]); }
public function getLinkHTML($link_name = NULL) { $value = $this->getValue(); $link = ilLink::_getStaticLink($value); $id = ilObject::_lookupObjId($value); if ($link_name) { $html = "<a href='" . $link . "'>" . $link_name . "</a>"; } else { $html = "<a href='" . $link . "'>" . ilObject::_lookupTitle($id) . "</a>"; } return $html; }
/** * get html * @return */ public function getHTML() { global $lng, $ilUser; include_once 'Modules/LearningModule/classes/class.ilLMObject.php'; foreach ($this->getSubItemIds(true) as $sub_item) { if (is_object($this->getHighlighter()) and strlen($this->getHighlighter()->getContent($this->getObjId(), $sub_item))) { $this->tpl->setCurrentBlock('sea_fragment'); $this->tpl->setVariable('TXT_FRAGMENT', $this->getHighlighter()->getContent($this->getObjId(), $sub_item)); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock('subitem'); $this->tpl->setVariable('SEPERATOR', ':'); switch (ilLMObject::_lookupType($sub_item, $this->getObjId())) { case 'pg': $this->getItemListGUI()->setChildId($sub_item); $this->tpl->setVariable("SUBITEM_TYPE", $lng->txt('obj_pg')); $link = $this->getItemListGUI()->getCommandLink('page'); include_once './Services/Search/classes/class.ilUserSearchCache.php'; $link .= '&srcstring=1'; $this->tpl->setVariable('LINK', $link); $this->tpl->setVariable('TARGET', $this->getItemListGUI()->getCommandFrame('page')); $this->tpl->setVariable('TITLE', ilLMObject::_lookupTitle($sub_item)); break; case 'st': $this->getItemListGUI()->setChildId($sub_item); $this->tpl->setVariable("SUBITEM_TYPE", $lng->txt('obj_st')); $link = $this->getItemListGUI()->getCommandLink('page'); include_once './Services/Search/classes/class.ilUserSearchCache.php'; $link .= '&srcstring=1'; $this->tpl->setVariable('LINK', $link); $this->tpl->setVariable('TARGET', $this->getItemListGUI()->getCommandFrame('page')); $this->tpl->setVariable('TITLE', ilLMObject::_lookupTitle($sub_item)); break; default: if (ilObject::_lookupType($sub_item) != 'file') { return ''; } $this->getItemListGUI()->setChildId('il__file_' . $sub_item); $this->tpl->setVariable('SUBITEM_TYPE', $lng->txt('obj_file')); $link = $this->getItemListGUI()->getCommandLink('downloadFile'); $this->tpl->setVariable('LINK', $link); $this->tpl->setVariable('TITLE', ilObject::_lookupTitle($sub_item)); break; } if (count($this->getSubItemIds(true)) > 1) { $this->parseRelevance($sub_item); } $this->tpl->parseCurrentBlock(); } $this->showDetailsLink(); return $this->tpl->get(); }
/** * Get all completed tests */ protected function getItems() { global $ilUser, $tree; $data = array(); include_once "Services/Certificate/classes/class.ilCertificate.php"; if (ilCertificate::isActive()) { $obj_ids = array(); $root = $tree->getNodeData($tree->getRootId()); foreach ($tree->getSubTree($root, true, "sahs") as $node) { $obj_ids[] = $node["obj_id"]; } if ($obj_ids) { include_once "./Services/Tracking/classes/class.ilObjUserTracking.php"; include_once "./Services/Tracking/classes/class.ilLPStatus.php"; include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php"; include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php"; include_once "./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php"; $lp_active = ilObjUserTracking::_enabledLearningProgress(); foreach (ilCertificate::areObjectsActive($obj_ids) as $obj_id => $active) { if ($active) { $type = ilObjSAHSLearningModule::_lookupSubType($obj_id); if ($type == "scorm") { $lm = new ilObjSCORMLearningModule($obj_id, false); } else { $lm = new ilObjSCORM2004LearningModule($obj_id, false); } $adapter = new ilSCORMCertificateAdapter($lm); if (ilCertificate::_isComplete($adapter)) { $lpdata = $completed = false; if ($lp_active) { $completed = ilLPStatus::_hasUserCompleted($obj_id, $ilUser->getId()); $lpdata = true; } if (!$lpdata) { switch ($type) { case "scorm": $completed = ilObjSCORMLearningModule::_getCourseCompletionForUser($obj_id, $ilUser->getId()); break; case "scorm2004": $completed = ilObjSCORM2004LearningModule::_getCourseCompletionForUser($obj_id, $ilUser->getId()); break; } } $data[] = array("id" => $obj_id, "title" => ilObject::_lookupTitle($obj_id), "passed" => (bool) $completed); } } } } } $this->setData($data); }
/** * read style folder data */ function read() { global $ilDB; parent::read(); // get styles of style folder $q = "SELECT * FROM style_folder_styles, style_data WHERE folder_id = " . $ilDB->quote($this->getId(), "integer") . " AND style_id = style_data.id"; $style_set = $ilDB->query($q); $this->styles = array(); while ($style_rec = $ilDB->fetchAssoc($style_set)) { $this->styles[$style_rec["style_id"]] = array("id" => $style_rec["style_id"], "title" => ilObject::_lookupTitle($style_rec["style_id"]), "category" => $style_rec["category"]); } $this->styles = ilUtil::sortArray($this->styles, "title", "asc", false, true); }
public function getSingleHTML(array $options = array()) { $value = $this->getValue(); if (!$value) { return ''; } $id = ilObject::_lookupObjId($value); $title = ilObject::_lookupTitle($id); if ($this->properties[ilDataCollectionField::PROPERTYID_ILIAS_REFERENCE_LINK]) { return $this->getLinkHTML($title); } return $title; }
public function setValueByArray($value) { parent::setValueByArray($value); include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $reference = $value[$this->getPostVar()]; if ($reference) { $pathString = $path->getPath(ROOT_FOLDER_ID, $reference); $id = ilObject::_lookupObjId($reference); $this->title_input->setValue($pathString . " > " . ilObject::_lookupTitle($id)); $this->hidden_input->setValue($reference); } }
/** * check whether goto script will succeed */ public function _checkGoto($a_target) { global $ilAccess, $lng; $t_arr = explode("_", $a_target); if ($t_arr[0] != "bibl" || (int) $t_arr[1] <= 0) { return false; } if ($ilAccess->checkAccess("visible", "", $t_arr[1])) { return true; } $object_title = ilObject::_lookupTitle(ilObject::_lookupObjId($t_arr[1])); ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"), $object_title), true); return false; }
function view() { global $ilUser, $lng, $tpl, $ilCtrl; $ref_ids = array(); $obj_ids = array(); $pd_items = $ilUser->getDesktopItems(); foreach ($pd_items as $item) { $ref_ids[] = $item["ref_id"]; $obj_ids[] = $item["obj_id"]; } $sel_ref_id = $_GET["news_ref_id"] > 0 ? $_GET["news_ref_id"] : $ilUser->getPref("news_sel_ref_id"); include_once "./Services/News/classes/class.ilNewsItem.php"; $per = $_SESSION["news_pd_news_per"] != "" ? $_SESSION["news_pd_news_per"] : ilNewsItem::_lookupUserPDPeriod($ilUser->getId()); $news_obj_ids = ilNewsItem::filterObjIdsPerNews($obj_ids, $per); // related objects (contexts) of news $contexts[0] = $lng->txt("news_all_items"); $conts = array(); $sel_has_news = false; foreach ($ref_ids as $ref_id) { $obj_id = ilObject::_lookupObjId($ref_id); $title = ilObject::_lookupTitle($obj_id); $conts[$ref_id] = $title; if ($sel_ref_id == $ref_id) { $sel_has_news = true; } } $cnt = array(); $nitem = new ilNewsItem(); $news_items = $nitem->_getNewsItemsOfUser($ilUser->getId(), false, true, $per, $cnt); // reset selected news ref id, if no news are given for id if (!$sel_has_news) { $sel_ref_id = ""; } asort($conts); foreach ($conts as $ref_id => $title) { $contexts[$ref_id] = $title . " (" . (int) $cnt[$ref_id] . ")"; } if ($sel_ref_id > 0) { $obj_id = ilObject::_lookupObjId($sel_ref_id); $obj_type = ilObject::_lookupType($obj_id); $nitem->setContextObjId($obj_id); $nitem->setContextObjType($obj_type); $news_items = $nitem->getNewsForRefId($sel_ref_id, false, false, $per, true); } include_once "./Services/News/classes/class.ilPDNewsTableGUI.php"; $pd_news_table = new ilPDNewsTableGUI($this, "view", $contexts, $sel_ref_id); $pd_news_table->setData($news_items); $pd_news_table->setNoEntriesText($lng->txt("news_no_news_items")); $tpl->setContent($pd_news_table->getHTML()); }
/** * Standard Version of Fill Row. Most likely to * be overwritten by derived class. */ protected function fillRow($a_set) { global $lng, $ilCtrl; if ($this->getParentObject()->checkStyleSelection()) { $this->tpl->setCurrentBlock("class_sel"); $sel = $a_set["class"] == "" ? "FileListItem" : $a_set["class"]; $this->tpl->setVariable("CLASS_SEL", ilUtil::formSelect($sel, "class[" . $a_set["hier_id"] . ":" . $a_set["pc_id"] . "]", $this->getParentObject()->getCharacteristics(), false, true)); $this->tpl->parseCurrentBlock(); } $this->pos += 10; $this->tpl->setVariable("POS", $this->pos); $this->tpl->setVariable("FID", $a_set["hier_id"] . ":" . $a_set["pc_id"]); $this->tpl->setVariable("TXT_FILE", ilObject::_lookupTitle($a_set["id"])); }
function il2sop() { global $ilUser, $ilias; $this->setOfflineMode("il2sop"); header('Content-Type: text/javascript; charset=UTF-8'); include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $ob = new ilObjSAHSLearningModule($this->id); $module_version = $ob->getModuleVersion(); $sahs_user = $this->il2sopSahsUser(); $support_mail = ""; //TODO $scorm_version = "1.2"; if ($this->type == "scorm2004") { $scorm_version = "2004"; } $tree = ""; $learning_progress_enabled = 1; include_once './Services/Object/classes/class.ilObjectLP.php'; $olp = ilObjectLP::getInstance($this->obj_id); if ($olp->getCurrentMode() == 0) { $learning_progress_enabled = 0; } $certificate_enabled = 0; $adlact_data = null; $ilias_version = $ilias->getSetting("ilias_version"); if ($this->type == 'scorm2004') { include_once "./Modules/Scorm2004/classes/ilSCORM13Player.php"; $ob2004 = new ilSCORM13Player(); $init_data = $ob2004->getConfigForPlayer(); $resources = json_decode($ob2004->getCPDataInit()); $cmi = $ob2004->getCMIData($ilUser->getID(), $this->obj_id); $max_attempt = $ob2004->get_max_attempts(); $adlact_data = json_decode($ob2004->getADLActDataInit()); //$globalobj_data = $ob2004->readGObjectiveInit(); } else { include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php"; $slm_obj =& new ilObjSCORMLearningModule($_GET["ref_id"]); $init_data = ilObjSCORMInitData::getIliasScormVars($slm_obj); $resources = json_decode(ilObjSCORMInitData::getIliasScormResources($this->obj_id)); $tree = json_decode(ilObjSCORMInitData::getIliasScormTree($this->obj_id)); $cmi = json_decode(ilObjSCORMInitData::getIliasScormData($this->obj_id)); $max_attempt = ilObjSCORMInitData::get_max_attempts($this->obj_id); } if ($max_attempt == null) { $max_attempt = 0; } $result = array('client_data' => array($support_mail), 'user_data' => $this->il2sopUserData(), 'lm' => array(ilObject::_lookupTitle($this->obj_id), ilObject::_lookupDescription($this->obj_id), $scorm_version, 1, $init_data, $resources, $tree, $module_version, "", $learning_progress_enabled, $certificate_enabled, $max_attempt, $adlact_data, $ilias_version), 'sahs_user' => $sahs_user, 'cmi' => $cmi); print json_encode($result); }
/** * Get all completed tests */ protected function getItems() { global $ilUser; include_once "Modules/Test/classes/class.ilObjTest.php"; $data = array(); foreach (ilObjTest::_lookupFinishedUserTests($ilUser->getId()) as $test_id => $passed) { // #11210 - only available certificates! $test = new ilObjTest($test_id, false); $active_id = $test->getActiveIdOfUser($ilUser->getId()); if ($test->canShowCertificate($ilUser->getId(), $active_id)) { $data[] = array("id" => $test_id, "title" => ilObject::_lookupTitle($test_id), "passed" => $passed); } } $this->setData($data); }
/** * Import data from DB * * @param int $a_user_id */ protected function importData($a_user_id) { global $ilUser; $data = array(); $objects = $this->handler->getSharedObjects($a_user_id); if ($objects) { foreach ($objects as $wsp_id => $obj_id) { // #9848: flag if current share access is password-protected $perms = ilWorkspaceAccessHandler::getPermissions($wsp_id); $is_password = !in_array($ilUser->getId(), $perms) && !in_array(ilWorkspaceAccessGUI::PERMISSION_REGISTERED, $perms) && !in_array(ilWorkspaceAccessGUI::PERMISSION_ALL, $perms) && in_array(ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD, $perms); $data[] = array("wsp_id" => $wsp_id, "obj_id" => $obj_id, "type" => ilObject::_lookupType($obj_id), "title" => ilObject::_lookupTitle($obj_id), "password" => $is_password); } } $this->setData($data); }
/** * Write tree childs * Recursive method * @param object $a_ref_id * @return */ protected function writeSubitems($a_ref_id) { global $tree; $mode = $this->exp_options->getOptionByRefId($a_ref_id, ilExportOptions::KEY_ITEM_MODE); if ($mode == NULL or $mode == ilExportOptions::EXPORT_OMIT) { return false; } $obj_id = ilObject::_lookupObjId($a_ref_id); $this->xmlStartTag('Item', array('RefId' => $a_ref_id, 'Id' => $obj_id, 'Title' => ilObject::_lookupTitle($obj_id), 'Type' => ilObject::_lookupType($obj_id))); $this->writeCourseItemInformation($a_ref_id); foreach ($tree->getChilds($a_ref_id) as $node) { $this->writeSubitems($node['child']); } $this->xmlEndTag('Item'); return true; }
/** * Get member roles (not auto generated) * @param int $a_ref_id */ public static function getMemberRoles($a_ref_id) { global $rbacreview; $lrol = $rbacreview->getRolesOfRoleFolder($a_ref_id, false); $roles = array(); foreach ($lrol as $role) { $title = ilObject::_lookupTitle($role); switch (substr($title, 0, 8)) { case 'il_grp_a': case 'il_grp_m': continue; default: $roles[$role] = $role; } } return $roles; }
/** * Fill table row */ protected function fillRow($a_set) { global $lng, $tree; $ref_id = $a_set["rep_ref_id"]; $obj_id = ilObject::_lookupObjId($ref_id); $this->tpl->setVariable("TITLE", ilObject::_lookupTitle($obj_id)); $this->tpl->setVariable("IMG", ilUtil::img(ilObject::_getIcon($obj_id, "tiny"))); $this->tpl->setVariable("ID", $ref_id); $path = $tree->getPathFull($ref_id); $path_items = array(); foreach ($path as $p) { if ($p["type"] != "root" && $p["child"] != $ref_id) { $path_items[] = $p["title"]; } } $this->tpl->setVariable("PATH", implode($path_items, " > ")); }
/** * Parse objects */ public function parse() { $counter = 0; $set = array(); foreach ($this->getObjects() as $ref_id) { $type = ilObject::_lookupType(ilObject::_lookupObjId($ref_id)); if ($type == 'rolf') { continue; } $set[$counter]['ref_id'] = $ref_id; $set[$counter]['obj_id'] = ilObject::_lookupObjId($ref_id); $set[$counter]['type'] = ilObject::_lookupType(ilObject::_lookupObjId($ref_id)); $set[$counter]['title'] = ilObject::_lookupTitle(ilObject::_lookupObjId($ref_id)); $counter++; } $this->setData($set); }