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); }
/** * 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()); }
/** * Parse Search entries * * @access public * @param array array of search entries * */ public function parse($entries) { global $rbacreview; include_once './Services/AccessControl/classes/class.ilObjRole.php'; foreach ($entries as $entry) { $tmp_arr['id'] = $entry['obj_id']; $tmp_arr['title'] = ilObjRole::_getTranslation(ilObject::_lookupTitle($entry['obj_id'])); $tmp_arr['description'] = ilObject::_lookupDescription($entry['obj_id']); $tmp_arr['context'] = ilObject::_lookupTitle($rbacreview->getObjectOfRole($entry['obj_id'])); $records_arr[] = $tmp_arr; } $this->setData($records_arr ? $records_arr : array()); }
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); }
/** * Set and parse conditions * @param array $a_conditions */ public function setConditions($a_conditions) { foreach ((array) $a_conditions as $condition) { if ($condition['trigger_type'] == 'crsg') { continue; } $row['id'] = $condition['condition_id']; $row['ref_id'] = $condition['trigger_ref_id']; $row['type'] = $condition['trigger_type']; $row['title'] = ilObject::_lookupTitle($condition['trigger_obj_id']); $row['description'] = ilObject::_lookupDescription($condition['trigger_obj_id']); $row['icon'] = ilObject::_getIcon($condition['trigger_obj_id']); $row['icon_alt'] = $this->lng->txt('obj_' . $condition['trigger_type']); $row['condition'] = $this->lng->txt('condition_' . $condition['operator']); $row['obligatory'] = $condition['obligatory']; $rows[] = $row; } $this->setData($rows); }
/** * Apply action */ public function apply() { global $rbacreview, $rbacadmin; $source = $this->initSourceObject(); // Check if role folder already exists // Create role include_once './Services/AccessControl/classes/class.ilObjRole.php'; $role = new ilObjRole(); $role->setTitle(ilObject::_lookupTitle($this->getRoleTemplateId())); $role->setDescription(ilObject::_lookupDescription($this->getRoleTemplateId())); $role->create(); $rbacadmin->assignRoleToFolder($role->getId(), $source->getRefId(), "y"); $GLOBALS['ilLog']->write(__METHOD__ . ': Using rolt: ' . $this->getRoleTemplateId() . ' with title "' . ilObject::_lookupTitle($this->getRoleTemplateId() . '". ')); // Copy template permissions $rbacadmin->copyRoleTemplatePermissions($this->getRoleTemplateId(), ROLE_FOLDER_ID, $source->getRefId(), $role->getId(), true); // Set permissions $ops = $rbacreview->getOperationsOfRole($role->getId(), $source->getType(), $source->getRefId()); $rbacadmin->grantPermission($role->getId(), $ops, $source->getRefId()); return true; }
/** * Apply action */ public function apply() { global $rbacreview, $rbacadmin; $source = $this->initSourceObject(); // Check if role folder already exists $rolf_id = $rbacreview->getRoleFolderIdOfObject($source->getRefId()); if (!$rolf_id) { $source->createRoleFolder(); } $rolf_id = $rbacreview->getRoleFolderIdOfObject($source->getRefId()); $GLOBALS['ilLog']->write(__METHOD__ . ': Current role folder id is: ' . $rolf_id); // Create role $rolf = ilObjectFactory::getInstanceByRefId($rolf_id, false); $role = $rolf->createRole(ilObject::_lookupTitle($this->getRoleTemplateId()), ilObject::_lookupDescription($this->getRoleTemplateId())); $GLOBALS['ilLog']->write(__METHOD__ . ': Using rolt: ' . $this->getRoleTemplateId() . ' with title "' . ilObject::_lookupTitle($this->getRoleTemplateId() . '". ')); // Copy template permissions $rbacadmin->copyRoleTemplatePermissions($this->getRoleTemplateId(), ROLE_FOLDER_ID, $rolf->getRefId(), $role->getId(), true); // Set permissions $ops = $rbacreview->getOperationsOfRole($role->getId(), $source->getType(), $rolf->getRefId()); $rbacadmin->grantPermission($role->getId(), $ops, $source->getRefId()); return true; }
function &getRoleData($ids) { if (!is_array($ids) || count($ids) == 0) { return array(); } $result = array(); foreach ($ids as $obj_id) { $result[$obj_id] = array("obj_id" => $obj_id, "title" => ilObject::_lookupTitle($obj_id), "description" => ilObject::_lookupDescription($obj_id)); } return $result; }
function _getStatusInfo($a_obj_id) { global $tree; include_once './Modules/Session/classes/class.ilEventParticipants.php'; include_once './Modules/Session/classes/class.ilObjSession.php'; include_once './Modules/Session/classes/class.ilSessionAppointment.php'; $references = ilObject::_getAllReferences($a_obj_id); $ref_id = end($references); $course_ref_id = $tree->checkForParentType($ref_id, 'crs'); $course_obj_id = ilObject::_lookupObjId($course_ref_id); $status_info = array(); $status_info['crs_id'] = $course_obj_id; $status_info['registration'] = ilObjSession::_lookupRegistrationEnabled($a_obj_id); $status_info['title'] = ilObject::_lookupTitle($a_obj_id); $status_info['description'] = ilObject::_lookupDescription($a_obj_id); $time_info = ilSessionAppointment::_lookupAppointment($a_obj_id); $status_info['starting_time'] = $time_info['start']; $status_info['ending_time'] = $time_info['end']; $status_info['fullday'] = $time_info['fullday']; $status_info['registered_users'] = ilEventParticipants::_getRegistered($a_obj_id); $status_info['participated_users'] = ilEventParticipants::_getParticipated($a_obj_id); return $status_info; }
/** * Parse search results * @param ilObject[] $a_res * @return array */ private function parseSearchResults($a_res) { foreach ($a_res as $obj_id => $references) { $r['title'] = ilObject::_lookupTitle($obj_id); $r['desc'] = ilObject::_lookupDescription($obj_id); $r['obj_id'] = $obj_id; $r['refs'] = $references; $rows[] = $r; } return $rows ? $rows : array(); }
public function testSetGetLookup() { global $ilUser; $obj = new ilObject(); $obj->setType(""); // otherwise type check will fail $obj->setTitle("TestObject"); $obj->setDescription("TestDescription"); $obj->setImportId("imp_44"); $obj->create(); $obj->createReference(); $id = $obj->getId(); $ref_id = $obj->getRefId(); $obj = new ilObject($id, false); if ($obj->getType() == "") { $value .= "sg1-"; } if ($obj->getTitle() == "TestObject") { $value .= "sg2-"; } if ($obj->getDescription() == "TestDescription") { $value .= "sg3-"; } if ($obj->getImportId() == "imp_44") { $value .= "sg4-"; } if ($obj->getOwner() == $ilUser->getId()) { $value .= "sg5-"; } $obj = new ilObject($ref_id); if ($obj->getTitle() == "TestObject") { $value .= "sg6-"; } if ($obj->getCreateDate() == ($lu = $obj->getLastUpdateDate())) { $value .= "sg7-"; } $obj->setTitle("TestObject2"); sleep(2); // we want a different date here... $obj->update(); $obj = new ilObject($ref_id); if ($lu != ($lu2 = $obj->getLastUpdateDate())) { $value .= "up1-"; } if ($obj->getTitle() == "TestObject2") { $value .= "up2-"; } if ($id == ilObject::_lookupObjIdByImportId("imp_44")) { $value .= "lu1-"; } if ($ilUser->getFullname() == ilObject::_lookupOwnerName(ilObject::_lookupOwner($id))) { $value .= "lu2-"; } if (ilObject::_lookupTitle($id) == "TestObject2") { $value .= "lu3-"; } if (ilObject::_lookupDescription($id) == "TestDescription") { $value .= "lu4-"; } if (ilObject::_lookupLastUpdate($id) == $lu2) { $value .= "lu5-"; } if (ilObject::_lookupObjId($ref_id) == $id) { $value .= "lu6-"; } if (ilObject::_lookupType($id) == "") { $value .= "lu7-"; } if (ilObject::_lookupObjectId($ref_id) == $id) { $value .= "lu8-"; } $ar = ilObject::_getAllReferences($id); if (is_array($ar) && count($ar) == 1 && $ar[$ref_id] == $ref_id) { $value .= "lu9-"; } $ids = ilObject::_getIdsForTitle("TestObject2"); foreach ($ids as $i) { if ($i == $id) { $value .= "lu10-"; } } $obs = ilObject::_getObjectsByType("usr"); foreach ($obs as $ob) { if ($ob["obj_id"] == $ilUser->getId()) { $value .= "lu11-"; } } $d1 = ilObject::_lookupDeletedDate($ref_id); ilObject::_setDeletedDate($ref_id); $d2 = ilObject::_lookupDeletedDate($ref_id); ilObject::_resetDeletedDate($ref_id); $d3 = ilObject::_lookupDeletedDate($ref_id); if ($d1 != $d2 && $d1 == $d3 && $d3 == null) { $value .= "dd1-"; } $obj->delete(); $this->assertEquals("sg1-sg2-sg3-sg4-sg5-sg6-sg7-up1-up2-" . "lu1-lu2-lu3-lu4-lu5-lu6-lu7-lu8-lu9-lu10-lu11-dd1-", $value); }
public function getResultsForPresentation() { global $lng; $results = array(); $offset_counter = 0; $counter = 0; $objects_with_topics = array(); $objects_with_no_topcis = array(); foreach ($this->getResults() as $result) { if ($this->getMaxHits() * ($this->getResultPageNumber() - 1) > $offset_counter) { ++$offset_counter; continue; } $results[] = $result; ++$counter; if ($counter >= $this->getMaxHits()) { break; } } foreach ($this->getTopics() as $oTopic) { foreach ($results as $result) { $topic_id = ilPaymentObject::_lookupTopicId($result['ref_id']); if (!(int) $topic_id && !array_key_exists($result['ref_id'], $objects_with_no_topcis)) { $objects_with_no_topcis[$result['ref_id']] = $result; continue; } if ((int) $topic_id != $oTopic->getId()) { continue; } if (!array_key_exists($result['ref_id'], $objects_with_topics)) { $objects_with_topics[$result['ref_id']] = $result; } switch ($result['type']) { // learning material case "sahs": case "lm": case "dbk": case "htlm": $type = "lres"; break; default: $type = $result['type']; break; } $title = ilObject::_lookupTitle($result['obj_id']); $description = ilObject::_lookupDescription($result['obj_id']); $subtype = ''; if ($result['type'] == 'exc') { $check_sub = ilPaymentObject::_checkExcSubtype($result['ref_id']); $subtype = ' (' . $lng->txt($check_sub[0]) . ')'; } $presentation_results[$oTopic->getId()][$type][] = array('ref_id' => $result['ref_id'], 'title' => $title . ' ' . $subtype, 'description' => $description, 'type' => $result['type'], 'obj_id' => $result['obj_id'], 'topic_id' => $topic_id, 'child' => $result['child']); $this->addPresentationResult($presentation_results[$oTopic->getId()][$type][count($presentation_results[$oTopic->getId()][$type]) - 1]); } } foreach ($results as $result) { if (!array_key_exists($result['ref_id'], $objects_with_topics) && !array_key_exists($result['ref_id'], $objects_with_no_topcis)) { $objects_with_no_topcis[$result['ref_id']] = $result; } } foreach ($objects_with_no_topcis as $result) { switch ($result['type']) { // learning material case "sahs": case "lm": case "dbk": case "htlm": $type = "lres"; break; default: $type = $result['type']; break; } $title = ilObject::_lookupTitle($result['obj_id']); $description = ilObject::_lookupDescription($result['obj_id']); $presentation_results[0][$type][] = array('ref_id' => $result['ref_id'], 'title' => $title, 'description' => $description, 'type' => $result['type'], 'obj_id' => $result['obj_id'], 'child' => $result['child']); $this->addPresentationResult($presentation_results[0][$type][count($presentation_results[0][$type]) - 1]); } return $presentation_results ? $presentation_results : array(); }
/** * Write xml presentation of one role * @param int $a_role_id * @param int $a_rolf */ private function writeRole($a_role_id, $a_rolf) { global $rbacreview; $attributes = array('type' => ilObject::_lookupType($a_role_id), 'id' => 'il_' . IL_INST_ID . '_' . ilObject::_lookupType($a_role_id) . '_' . $a_role_id); $this->xmlStartTag('role', $attributes); $this->xmlElement('title', array(), ilObject::_lookupTitle($a_role_id)); $this->xmlElement('description', array(), ilObject::_lookupDescription($a_role_id)); $this->xmlStartTag('operations'); foreach ($rbacreview->getAllOperationsOfRole($a_role_id, $a_rolf) as $obj_group => $operations) { foreach ($operations as $ops_id) { $this->xmlElement('operation', array('group' => $obj_group), trim($this->operations[$ops_id])); } } $this->xmlEndTag('operations'); $this->xmlEndTag('role'); return true; }
/** * Show test config form * @return \ilPropertyFormGUI */ protected function initTestForm() { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->addCommandButton('saveTest', $this->lng->txt('save')); switch ($this->getTestType()) { case self::TEST_TYPE_IT: $form->setTitle($this->lng->txt('crs_loc_settings_itest_tbl')); break; case self::TEST_TYPE_QT: $form->setTitle($this->lng->txt('crs_loc_settings_qtest_tbl')); break; } $assignable = $this->getAssignableTests(); $cr_mode = new ilRadioGroupInputGUI($this->lng->txt('crs_loc_form_assign_it'), 'mode'); $cr_mode->setRequired(true); $cr_mode->setValue(self::TEST_NEW); $new = new ilRadioOption($this->lng->txt('crs_loc_form_tst_new'), self::TEST_NEW); switch ($this->getTestType()) { case ilLOSettings::TYPE_TEST_INITIAL: $new->setInfo($this->lng->txt("crs_loc_form_tst_new_initial_info")); break; case ilLOSettings::TYPE_TEST_QUALIFIED: $new->setInfo($this->lng->txt("crs_loc_form_tst_new_qualified_info")); break; } // title $ti = new ilTextInputGUI($this->lng->txt("title"), "title"); $ti->setValue(ilObject::_lookupTitle(ilObject::_lookupObjId($this->getSettings()->getTestByType($this->getTestType())))); $ti->setMaxLength(128); $ti->setSize(40); $ti->setRequired(true); $new->addSubItem($ti); // description $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc"); $ta->setValue(ilObject::_lookupDescription(ilObject::_lookupObjId($this->getSettings()->getTestByType($this->getTestType())))); $ta->setCols(40); $ta->setRows(2); $new->addSubItem($ta); // Question assignment type include_once './Modules/Test/classes/class.ilObjTest.php'; $this->lng->loadLanguageModule('assessment'); $qst = new ilRadioGroupInputGUI($this->lng->txt('tst_question_set_type'), 'qtype'); $qst->setRequired(true); $qst->setValue($this->getSettings()->isRandomTestType($this->getTestType()) ? ilObjTest::QUESTION_SET_TYPE_RANDOM : ilObjTest::QUESTION_SET_TYPE_FIXED); $random = new ilRadioOption($this->lng->txt('tst_question_set_type_random'), ilObjTest::QUESTION_SET_TYPE_RANDOM); $qst->addOption($random); $fixed = new ilRadioOption($this->lng->txt('tst_question_set_type_fixed'), ilObjTest::QUESTION_SET_TYPE_FIXED); $qst->addOption($fixed); $new->addSubItem($qst); $cr_mode->addOption($new); // assign existing $existing = new ilRadioOption($this->lng->txt('crs_loc_form_assign'), self::TEST_ASSIGN); switch ($this->getTestType()) { case ilLOSettings::TYPE_TEST_INITIAL: $existing->setInfo($this->lng->txt("crs_loc_form_assign_initial_info")); break; case ilLOSettings::TYPE_TEST_QUALIFIED: $existing->setInfo($this->lng->txt("crs_loc_form_assign_qualified_info")); break; } if (!$assignable) { $existing->setDisabled(true); } $cr_mode->addOption($existing); $options = array(); $options[0] = $this->lng->txt('select_one'); foreach ((array) $assignable as $tst_ref_id) { $tst_obj_id = ilObject::_lookupObjId($tst_ref_id); $options[$tst_ref_id] = ilObject::_lookupTitle($tst_obj_id); } $selectable = new ilSelectInputGUI($this->lng->txt('crs_loc_form_available_tsts'), 'tst'); $selectable->setRequired(true); $selectable->setOptions($options); $existing->addSubItem($selectable); $form->addItem($cr_mode); return $form; }
/** * get all desktop items of user and specified type * * note: the implementation of this method is not good style (directly * reading tables object_data and object_reference), must be revised someday... */ static function _lookupDesktopItems($user_id, $a_types = "") { global $ilUser, $rbacsystem, $tree, $ilDB; if ($a_types == "") { $item_set = $ilDB->queryF("SELECT obj.obj_id, obj.description, oref.ref_id, obj.title, obj.type " . " FROM desktop_item it, object_reference oref " . ", object_data obj" . " WHERE " . "it.item_id = oref.ref_id AND " . "oref.obj_id = obj.obj_id AND " . "it.user_id = %s", array("integer"), array($user_id)); $items = array(); while ($item_rec = $ilDB->fetchAssoc($item_set)) { if ($tree->isInTree($item_rec["ref_id"]) && $item_rec["type"] != "rolf" && $item_rec["type"] != "itgr") { $parent_ref = $tree->getParentId($item_rec["ref_id"]); $par_left = $tree->getLeftValue($parent_ref); $par_left = sprintf("%010d", $par_left); $title = ilObject::_lookupTitle($item_rec["obj_id"]); $desc = ilObject::_lookupDescription($item_rec["obj_id"]); $items[$par_left . $title . $item_rec["ref_id"]] = array("ref_id" => $item_rec["ref_id"], "obj_id" => $item_rec["obj_id"], "type" => $item_rec["type"], "title" => $title, "description" => $desc, "parent_ref" => $parent_ref); } } ksort($items); } else { // due to bug 11508 if (!is_array($a_types)) { $a_types = array($a_types); } $items = array(); $foundsurveys = array(); foreach ($a_types as $a_type) { if ($a_type == "itgr") { continue; } $item_set = $ilDB->queryF("SELECT obj.obj_id, obj.description, oref.ref_id, obj.title FROM desktop_item it, object_reference oref " . ", object_data obj WHERE " . "it.item_id = oref.ref_id AND " . "oref.obj_id = obj.obj_id AND " . "it.type = %s AND " . "it.user_id = %s " . "ORDER BY title", array("text", "integer"), array($a_type, $user_id)); while ($item_rec = $ilDB->fetchAssoc($item_set)) { $title = ilObject::_lookupTitle($item_rec["obj_id"]); $desc = ilObject::_lookupDescription($item_rec["obj_id"]); $items[$title . $a_type . $item_rec["ref_id"]] = array("ref_id" => $item_rec["ref_id"], "obj_id" => $item_rec["obj_id"], "type" => $a_type, "title" => $title, "description" => $desc); } } ksort($items); } return $items; }
/** * parse * * @access public * @return */ public function parse() { global $rbacreview; $users = array(); foreach ($this->role_ids as $id) { $tmp_data['title'] = ilObject::_lookupTitle($id); $tmp_data['description'] = ilObject::_lookupDescription($id); $tmp_data['id'] = $id; $tmp_data['num'] = count($rbacreview->assignedUsers($id)); $roles[] = $tmp_data; } $this->setData($roles ? $roles : array()); }
/** * parse * * @access public * @param array array of objective id's */ public function parse($a_objective_ids) { include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php'; $objectives = array(); foreach ($a_objective_ids as $objective_id) { $objective = new ilCourseObjective($this->course_obj, $objective_id); // Self assessment tests $question_obj = new ilCourseObjectiveQuestion($objective_id); $tests = array(); foreach ($question_obj->getSelfAssessmentTests() as $tmp_test) { if (isset($_POST['self'][$objective_id])) { $objective_data['self_limit'] = $_POST['self'][$objective_id]; } else { $objective_data['self_limit'] = $tmp_test['limit']; } $questions = array(); foreach ($question_obj->getQuestionsOfTest($tmp_test['obj_id']) as $tmp_question) { $qst['title'] = $tmp_question['title']; $qst['description'] = $tmp_question['description']; $qst['points'] = $tmp_question['points']; $questions[] = $qst; } $tst['questions'] = $questions; $tst['title'] = ilObject::_lookupTitle($tmp_test['obj_id']); $tst['description'] = ilObject::_lookupDescription($tmp_test['obj_id']); $tests[] = $tst; } $objective_data['self_tests'] = $tests; $objective_data['self_max_points'] = $question_obj->getSelfAssessmentPoints(); // Final tests $tests = array(); foreach ($question_obj->getFinalTests() as $tmp_test) { if (isset($_POST['final'][$objective_id])) { $objective_data['final_limit'] = $_POST['final'][$objective_id]; } else { $objective_data['final_limit'] = $tmp_test['limit']; } $questions = array(); foreach ($question_obj->getQuestionsOfTest($tmp_test['obj_id']) as $tmp_question) { $qst['title'] = $tmp_question['title']; $qst['description'] = $tmp_question['description']; $qst['points'] = $tmp_question['points']; $questions[] = $qst; } $tst['questions'] = $questions; $tst['title'] = ilObject::_lookupTitle($tmp_test['obj_id']); $tst['description'] = ilObject::_lookupDescription($tmp_test['obj_id']); $tests[] = $tst; } $objective_data['final_tests'] = $tests; $objective_data['final_max_points'] = $question_obj->getFinalTestPoints(); $objective_data['id'] = $objective_id; $objective_data['title'] = $objective->getTitle(); $objective_data['description'] = $objective->getDescription(); $objectives[] = $objective_data; } $this->setData($objectives ? $objectives : array()); }
static final function _lookupDescription($a_id) { return parent::_lookupDescription($a_id); }
/** * init limit form * * @access protected * @param string mode selfAssessment or final * @return */ protected function initFormLimits($a_mode) { if (!is_object($this->form)) { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); } $this->form->setFormAction($this->ctrl->getFormAction($this)); $this->form->setTableWidth('100%'); $this->form->setTitleIcon(ilUtil::getImagePath('icon_lobj.png'), $this->lng->txt('crs_objective')); switch ($a_mode) { case 'selfAssessment': $this->form->setTitle($this->lng->txt('crs_objective_wiz_self_limit')); $this->form->addCommandButton('updateSelfAssessmentLimits', $this->lng->txt('crs_wiz_next')); $this->form->addCommandButton('selfAssessmentAssignment', $this->lng->txt('crs_wiz_back')); $tests = $this->objectives_qst_obj->getSelfAssessmentTests(); $max_points = $this->objectives_qst_obj->getSelfAssessmentPoints(); break; case 'final': $this->form->setTitle($this->lng->txt('crs_objective_wiz_final_limit')); $this->form->addCommandButton('updateFinalTestLimits', $this->lng->txt('crs_wiz_next')); $this->form->addCommandButton('finalTestAssignment', $this->lng->txt('crs_wiz_back')); $tests = $this->objectives_qst_obj->getFinalTests(); $max_points = $this->objectives_qst_obj->getFinalTestPoints(); break; } $over = new ilCustomInputGUI($this->lng->txt('crs_objective_qst_summary'), ''); $tpl = new ilTemplate('tpl.crs_objective_qst_summary.html', true, true, 'Modules/Course'); $limit = 0; foreach ($tests as $test) { $limit = $test['limit']; foreach ($this->objectives_qst_obj->getQuestionsOfTest($test['obj_id']) as $question) { $tpl->setCurrentBlock('qst'); $tpl->setVariable('QST_TITLE', $question['title']); if (strlen($question['description'])) { $tpl->setVariable('QST_DESCRIPTION', $question['description']); } $tpl->setVariable('QST_POINTS', $question['points'] . ' ' . $this->lng->txt('crs_objective_points')); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock('tst'); $tpl->setVariable('TST_TITLE', ilObject::_lookupTitle($test['obj_id'])); if ($desc = ilObject::_lookupDescription($test['obj_id'])) { $tpl->setVariable('TST_DESC', $desc); } $tpl->setVariable('TST_TYPE_IMG', ilUtil::getTypeIconPath('tst', $test['obj_id'], 'tiny')); $tpl->setVariable('TST_ALT_IMG', $this->lng->txt('obj_tst')); $tpl->parseCurrentBlock(); } $tpl->setVariable('TXT_ALL_POINTS', $this->lng->txt('crs_objective_all_points')); $tpl->setVariable('TXT_POINTS', $this->lng->txt('crs_objective_points')); $tpl->setVariable('POINTS', $max_points); $over->setHtml($tpl->get()); $this->form->addItem($over); $req = new ilTextInputGUI($this->lng->txt('crs_obj_required_points'), 'limit'); $req->setValue($limit); $req->setMaxLength(5); $req->setSize(3); $req->setRequired(true); switch ($a_mode) { case 'selfAssessment': $req->setInfo($this->lng->txt('crs_obj_initial_req_info')); break; case 'final': $req->setInfo($this->lng->txt('crs_obj_final_req_info')); break; } $this->form->addItem($req); }
public function showContainerContent() { global $ilUser, $rbacreview, $ilToolbar, $tpl; if ($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) { $ilToolbar->addButton($this->lng->txt('edit_page'), $this->ctrl->getLinkTargetByClass(array('ilshoppagegui'), 'edit')); } include_once './Services/Payment/classes/class.ilPaymentObject.php'; $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.shop_content.html', 'Services/Payment'); $this->tpl->setVariable('PAGE_CONTENT', $this->getPageHTML()); $is_buyable = ilPaymentObject::_isBuyable($this->cur_ref_id); if ($is_buyable) { $pobjects = ilPaymentObject::_getObjectData(ilPaymentObject::_lookupPobjectId($this->cur_ref_id)); $obj_id = ilObject::_lookupObjId($this->cur_ref_id); $title = ilObject::_lookupTitle($obj_id); $description = ilObject::_lookupDescription($obj_id); $type = ilObject::_lookupType($obj_id); $presentation_results[$pobjects['pt_topic_fk']][$type][] = array('ref_id' => $pobjects['ref_id'], 'title' => $title, 'description' => $description, 'type' => $type, 'obj_id' => $obj_id, 'topic_id' => $pobjects['pt_topic_fk'], 'child' => $pobjects['child']); } else { $pobjects = ilPaymentObject::_getContainerObjects($this->cur_ref_id); if (count($pobjects) >= 1) { foreach ($pobjects as $result) { $obj_id = $result['obj_id']; $title = $result['title']; $description = $result['description']; $type = $result['type']; $presentation_results[$result['pt_topic_fk']][$type][] = array('ref_id' => $result['ref_id'], 'title' => $title, 'description' => $description, 'type' => $type, 'obj_id' => $obj_id, 'topic_id' => $result['pt_topic_fk'], 'child' => $result['child']); } } } include_once 'Services/Payment/classes/class.ilShopResultPresentationGUI.php'; $search_result_presentation = new ilShopResultPresentationGUI($presentation_results); $search_result_presentation->setSortField(strtolower(trim($this->getSortField()))); $search_result_presentation->setSortDirection(trim($this->getSortDirection())); if (!$presentation_results) { $this->tpl->setVariable('RESULTS', $this->lng->txt('payment_shop_not_objects_found')); } else { $html = $search_result_presentation->showSpecials(); $this->tpl->setVariable('RESULTS', $html); } $this->showFilters(); }
/** * Parse one item * @param array $item */ protected function parseCollectionItem($item) { $tmp['ref_id'] = $item; $tmp['id'] = $item; $tmp['obj_id'] = ilObject::_lookupObjId($item); $tmp['type'] = ilObject::_lookupType($tmp['obj_id']); $tmp['title'] = ilObject::_lookupTitle($tmp['obj_id']); $tmp['description'] = ilObject::_lookupDescription($tmp['obj_id']); // mode to text (sorting) $tmp["mode_id"] = ilLPObjSettings::_lookupMode($tmp['obj_id']); $tmp["mode"] = ilLPObjSettings::_mode2Text($tmp["mode_id"]); // status (sorting) $tmp["status"] = $this->getCollection()->isAssigned($item); return $tmp; }
/** * inititialize new item * Course reference inits the course item * * @param int $a_ref_id reference id * @param int $a_obj_id object id * @param string $a_title title * @param string $a_description description */ function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "") { global $ilBench, $ilAccess, $tree; $this->reference_ref_id = $a_ref_id; $this->reference_obj_id = $a_obj_id; include_once './Services/ContainerReference/classes/class.ilContainerReference.php'; $target_obj_id = ilContainerReference::_lookupTargetId($a_obj_id); $target_ref_ids = ilObject::_getAllReferences($target_obj_id); $target_ref_id = current($target_ref_ids); $target_title = ilContainerReference::_lookupTitle($a_obj_id); $target_description = ilObject::_lookupDescription($target_obj_id); $this->deleted = $tree->isDeleted($target_ref_id); $ilBench->start("ilObjCourseListGUI", "1000_checkAllConditions"); $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($target_ref_id, $target_obj_id); $ilBench->stop("ilObjCourseListGUI", "1000_checkAllConditions"); parent::initItem($target_ref_id, $target_obj_id, $target_title, $target_description); // general commands array include_once './Modules/CourseReference/classes/class.ilObjCourseReferenceAccess.php'; $this->commands = ilObjCourseReferenceAccess::_getCommands($this->reference_ref_id); if ($ilAccess->checkAccess('write', '', $this->reference_ref_id) or $this->deleted) { $this->info_screen_enabled = false; } else { $this->info_screen_enabled = true; } }
/** * Read data * * @param * @return */ function readData($a_entity, $a_version, $a_ids, $a_field = "") { global $ilDB; if (!is_array($a_ids)) { $a_ids = array($a_ids); } // mob if ($a_entity == "mob") { $this->data = array(); foreach ($a_ids as $mob_id) { if (ilObject::_lookupType($mob_id) == "mob") { $this->data[] = array("Id" => $mob_id, "Title" => ilObject::_lookupTitle($mob_id), "Description" => ilObject::_lookupDescription($mob_id)); } } } // media item if ($a_entity == "mob_media_item") { switch ($a_version) { case "4.1.0": $this->getDirectDataFromQuery("SELECT id, mob_id, width, height, halign," . "caption, nr, purpose, location, location_type, format, text_representation" . " FROM media_item WHERE " . $ilDB->in("mob_id", $a_ids, false, "integer")); break; case "4.3.0": $this->getDirectDataFromQuery("SELECT id, mob_id, width, height, halign," . "caption, nr, purpose, location, location_type, format, text_representation" . " FROM media_item WHERE " . $ilDB->in("mob_id", $a_ids, false, "integer")); break; } } // media item map area if ($a_entity == "mob_mi_map_area") { switch ($a_version) { case "4.1.0": case "4.3.0": $this->getDirectDataFromQuery("SELECT item_id mi_id, nr" . " ,shape, coords, link_type, title, href, target, type, target_frame, " . " highlight_mode, highlight_class" . " FROM map_area " . " WHERE " . $ilDB->in("item_id", $a_ids, false, "integer") . " ORDER BY nr"); break; } } // media item parameter if ($a_entity == "mob_mi_parameter") { switch ($a_version) { case "4.1.0": case "4.3.0": $this->getDirectDataFromQuery("SELECT med_item_id mi_id, name, value" . " FROM mob_parameter " . " WHERE " . $ilDB->in("med_item_id", $a_ids, false, "integer")); break; } } }
/** * parse * * @access public * @return */ public function parse() { $this->shared_obj = new ilCalendarShared($this->calendar_id); $items = array(); foreach ($this->shared_obj->getShared() as $item) { switch ($item['obj_type']) { case ilCalendarShared::TYPE_USR: $data['type'] = 'usr'; $name = ilObjUser::_lookupName($item['obj_id']); $data['title'] = $name['lastname'] . ', ' . $name['firstname']; $data['description'] = ''; break; case ilCalendarShared::TYPE_ROLE: $data['type'] = 'role'; $data['title'] = ilObject::_lookupTitle($item['obj_id']); $data['description'] = ilObject::_lookupDescription($item['obj_id']); break; } $data['obj_id'] = $item['obj_id']; $data['create_date'] = $item['create_date']; $data['writable'] = $item['writable']; $items[] = $data; } $this->setData($items ? $items : array()); return true; }
/** * * @param * @return */ public function lookupDescription($a_obj_id, $a_sub_id) { if ($this->getMode() != self::MODE_LUCENE or !is_object($this->searcher->getHighlighter())) { return ilObject::_lookupDescription($a_obj_id); } if (strlen($title = $this->searcher->getHighlighter()->getDescription($a_obj_id, $a_sub_id))) { return $title; } return ilObject::_lookupDescription($a_obj_id); }
/** * export released * * @access protected * @return */ protected function exportReleased() { global $ilObjDataCache; include_once './Services/WebServices/ECS/classes/class.ilECSExport.php'; $exported = ilECSExport::getExportedIds(); $ilObjDataCache->preloadObjectCache($exported); include_once 'Services/Utilities/classes/class.ilCSVWriter.php'; $writer = new ilCSVWriter(); $writer->addColumn($this->lng->txt('title')); $writer->addColumn($this->lng->txt('description')); $writer->addColumn($this->lng->txt('ecs_field_courseID')); $writer->addColumn($this->lng->txt('ecs_field_term')); $writer->addColumn($this->lng->txt('ecs_field_lecturer')); $writer->addColumn($this->lng->txt('ecs_field_courseType')); $writer->addColumn($this->lng->txt('ecs_field_semester_hours')); $writer->addColumn($this->lng->txt('ecs_field_credits')); $writer->addColumn($this->lng->txt('ecs_field_room')); $writer->addColumn($this->lng->txt('ecs_field_cycle')); $writer->addColumn($this->lng->txt('ecs_field_begin')); $writer->addColumn($this->lng->txt('ecs_field_end')); $writer->addColumn($this->lng->txt('last_update')); include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php'; $settings = ilECSDataMappingSettings::_getInstance(); foreach ($exported as $obj_id) { include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php'; $values = ilAdvancedMDValues::_getValuesByObjId($obj_id); $writer->addRow(); $writer->addColumn(ilObject::_lookupTitle($obj_id)); $writer->addColumn(ilObject::_lookupDescription($obj_id)); $field = $settings->getMappingByECSName('courseID'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('term'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('lecturer'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('courseType'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('semester_hours'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('credits'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('room'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('cycle'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('begin'); $writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field], true) : ''); $field = $settings->getMappingByECSName('end'); $writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field], true) : ''); $writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id)); } ilUtil::deliverData($writer->getCSVString(), date("Y_m_d") . "_ecs_export.csv", "text/csv"); }
/** * List resources for tag */ function showResourcesForTag() { global $lng, $ilCtrl, $ilUser, $objDefinition; $_GET["tag"] = str_replace("-->", "", $_GET["tag"]); $tpl = new ilTemplate("tpl.resources_for_tag.html", true, true, "Services/Tagging"); include_once "./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php"; $content_block = new ilPDContentBlockGUI(); $content_block->setColSpan(2); $content_block->setTitle(sprintf($lng->txt("tagging_resources_for_tag"), "<i>" . $_GET["tag"] . "</i>")); $content_block->setImage(ilUtil::getImagePath("icon_tag.svg")); $content_block->addHeaderCommand($ilCtrl->getParentReturn($this), $lng->txt("selected_items_back")); // get resources include_once "./Services/Tagging/classes/class.ilTagging.php"; $objs = ilTagging::getObjectsForTagAndUser($ilUser->getId(), $_GET["tag"]); $unaccessible = false; foreach ($objs as $key => $obj) { $ref_ids = ilObject::_getAllReferences($obj["obj_id"]); foreach ($ref_ids as $ref_id) { $type = $obj["obj_type"]; if ($type == "") { $unaccessible = true; continue; } // get list gui class for each object type if (empty($this->item_list_gui[$type])) { $class = $objDefinition->getClassName($type); $location = $objDefinition->getLocation($type); $full_class = "ilObj" . $class . "ListGUI"; include_once $location . "/class." . $full_class . ".php"; $this->item_list_gui[$type] = new $full_class(); $this->item_list_gui[$type]->enableDelete(false); $this->item_list_gui[$type]->enablePath(true); $this->item_list_gui[$type]->enableCut(false); $this->item_list_gui[$type]->enableCopy(false); $this->item_list_gui[$type]->enableSubscribe(false); $this->item_list_gui[$type]->enablePayment(false); $this->item_list_gui[$type]->enableLink(false); $this->item_list_gui[$type]->enableIcon(true); } $html = $this->item_list_gui[$type]->getListItemHTML($ref_id, $obj["obj_id"], ilObject::_lookupTitle($obj["obj_id"]), ilObject::_lookupDescription($obj["obj_id"])); if ($html != "") { $css = $css != "tblrow1" ? "tblrow1" : "tblrow2"; $tpl->setCurrentBlock("res_row"); $tpl->setVariable("ROWCLASS", $css); $tpl->setVariable("RESOURCE_HTML", $html); $tpl->setVariable("ALT_TYPE", $lng->txt("obj_" . $type)); $tpl->setVariable("IMG_TYPE", ilUtil::getImagePath("icon_" . $type . ".svg")); $tpl->parseCurrentBlock(); } else { $unaccessible = true; } } } if ($unaccessible) { $tpl->setCurrentBlock("no_access"); $tpl->setVariable("SOME_OBJ_WITHOUT_ACCESS", $lng->txt("tag_some_obj_tagged_without_access")); $ilCtrl->saveParameter($this, "tag"); $tpl->setVariable("HREF_REMOVE_TAGS", $ilCtrl->getLinkTarget($this, "removeTagsWithoutAccess")); $tpl->setVariable("REMOVE_TAGS", $lng->txt("tag_remove_tags_of_obj_without_access")); $tpl->parseCurrentBlock(); } $content_block->setContent($tpl->get()); //$content_block->setContent("test"); return $content_block->getHTML(); }
/** * Parse search results * @param object $a_res * @return */ public function parseSearchResults($a_res) { foreach ($a_res as $obj_id => $references) { $r['title'] = ilObject::_lookupTitle($obj_id); $r['desc'] = ilObject::_lookupDescription($obj_id); $r['obj_id'] = $obj_id; $r['refs'] = $references; $rows[] = $r; } $this->setData($rows ? $rows : array()); }
public function showContainerContent() { global $ilUser, $rbacreview, $ilToolbar; if ($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) { $ilToolbar->addButton($this->lng->txt('edit_page'), $this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'edit')); } include_once './Services/Payment/classes/class.ilPaymentObject.php'; $is_buyable = ilPaymentObject::_isBuyable($this->cur_ref_id); if ($is_buyable) { $pobjects = ilPaymentObject::_getObjectData(ilPaymentObject::_lookupPobjectId($this->cur_ref_id)); $obj_id = ilObject::_lookupObjId($this->cur_ref_id); $title = ilObject::_lookupTitle($obj_id); $description = ilObject::_lookupDescription($obj_id); $type = ilObject::_lookupType($obj_id); $presentation_results[$pobjects['pt_topic_fk']][$type][] = array('ref_id' => $pobjects['ref_id'], 'title' => $title, 'description' => $description, 'type' => $type, 'obj_id' => $obj_id, 'topic_id' => $pobjects['pt_topic_fk'], 'child' => $pobjects['child']); } else { $pobjects = ilPaymentObject::_getContainerObjects($this->cur_ref_id); if (count($pobjects) >= 1) { foreach ($pobjects as $result) { $obj_id = $result['obj_id']; $title = $result['title']; $description = $result['description']; $type = $result['type']; $presentation_results[$result['pt_topic_fk']][$type][] = array('ref_id' => $result['ref_id'], 'title' => $title, 'description' => $description, 'type' => $type, 'obj_id' => $obj_id, 'topic_id' => $result['pt_topic_fk'], 'child' => $result['child']); } } } $shop_content_tpl = new ilTemplate('tpl.shop_content.html', true, true, 'Services/Payment'); $shop_content_tpl->setVariable('PAGE_CONTENT', $this->getPageHTML()); include_once 'Services/Payment/classes/class.ilShopResultPresentationGUI.php'; $search_result_presentation = new ilShopResultPresentationGUI($presentation_results); $search_result_presentation->setSortField(strtolower(trim($this->getSortField()))); $search_result_presentation->setSortDirection(trim($this->getSortDirection())); $html = $search_result_presentation->showSpecials(); $shop_content_tpl->setVariable('RESULTS', $html); $show_general_filter = $this->oGeneralSettings->get('show_general_filter'); $show_topics_filter = $this->oGeneralSettings->get('show_topics_filter'); $show_shop_explorer = $this->oGeneralSettings->get('show_shop_explorer'); if ($show_general_filter) { $g_filter_html = $this->showGeneralFilter(count($search_result_presentation)); $shop_content_tpl->setVariable('FORM', $g_filter_html); } if ($show_topics_filter) { $this->showTopicsFilter(count($search_result_presentation)); } if ($show_shop_explorer) { $this->showShopExplorer(); } global $tpl; $tpl->setContent($shop_content_tpl->parse()); }