/**
  * Get characteristics
  */
 static function _getCharacteristics($a_style_id)
 {
     $st_chars = ilPCParagraphGUI::_getStandardCharacteristics();
     $chars = ilPCParagraphGUI::_getStandardCharacteristics();
     if ($a_style_id > 0 && ilObject::_lookupType($a_style_id) == "sty") {
         include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
         $style = new ilObjStyleSheet($a_style_id);
         $types = array("text_block", "heading1", "heading2", "heading3");
         $chars = array();
         foreach ($types as $t) {
             $chars = array_merge($chars, $style->getCharacteristics($t));
         }
         $new_chars = array();
         foreach ($chars as $char) {
             if ($st_chars[$char] != "") {
                 $new_chars[$char] = $st_chars[$char];
             } else {
                 $new_chars[$char] = $char;
             }
             asort($new_chars);
         }
         $chars = $new_chars;
     }
     return $chars;
 }
 /**
  * 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"]);
 }
 /**
  * Parse object data
  * @return 
  * @param object $a_ids
  */
 public function parseObjectIds($a_ids)
 {
     foreach ($a_ids as $object_id) {
         $row = array();
         $type = ilObject::_lookupType($object_id);
         $row['title'] = ilObject::_lookupTitle($object_id);
         $row['desc'] = ilObject::_lookupDescription($object_id);
         $row['id'] = $object_id;
         switch ($type) {
             case 'crs':
             case 'grp':
                 include_once './Services/Membership/classes/class.ilParticipants.php';
                 if (ilParticipants::hasParticipantListAccess($object_id)) {
                     $row['member'] = count(ilParticipants::getInstanceByObjId($object_id)->getParticipants());
                 } else {
                     $row['member'] = 0;
                 }
                 break;
             case 'role':
                 global $rbacreview;
                 include_once './Services/User/classes/class.ilUserFilter.php';
                 $row['member'] = count(ilUserFilter::getInstance()->filter($rbacreview->assignedUsers($object_id)));
                 break;
         }
         $data[] = $row;
     }
     $this->setData($data ? $data : array());
 }
Ejemplo n.º 4
0
 /**
  * Get head dependencies
  *
  * @param		string		entity
  * @param		string		target release
  * @param		array		ids
  * @return		array		array of array with keys "component", entity", "ids"
  */
 function getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
 {
     if ($a_entity == "pg") {
         // get all media objects and files of the page
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Modules/File/classes/class.ilObjFile.php";
         $mob_ids = array();
         $file_ids = array();
         foreach ($a_ids as $pg_id) {
             $pg_id = explode(":", $pg_id);
             // get media objects
             $mids = ilObjMediaObject::_getMobsOfObject($pg_id[0] . ":pg", $pg_id[1]);
             foreach ($mids as $mid) {
                 if (ilObject::_lookupType($mid) == "mob") {
                     $mob_ids[] = $mid;
                 }
             }
             // get files
             $files = ilObjFile::_getFilesOfObject($pg_id[0] . ":pg", $pg_id[1]);
             foreach ($files as $file) {
                 if (ilObject::_lookupType($file) == "file") {
                     $file_ids[] = $file;
                 }
             }
         }
         return array(array("component" => "Services/MediaObjects", "entity" => "mob", "ids" => $mob_ids), array("component" => "Modules/File", "entity" => "file", "ids" => $file_ids));
     }
     return array();
 }
 protected function initItems($a_data)
 {
     global $ilAccess, $lng, $tree;
     $data = array();
     if (!$this->user_id) {
         $is_admin = $ilAccess->checkAccess("visible", "", SYSTEM_FOLDER_ID);
     }
     foreach ($a_data as $id => $item) {
         // workspace objects won't have references
         $refs = ilObject::_getAllReferences($id);
         if ($refs) {
             foreach ($refs as $idx => $ref_id) {
                 // objects in trash are hidden
                 if (!$tree->isDeleted($ref_id)) {
                     if ($this->user_id) {
                         $readable = $ilAccess->checkAccessOfUser($this->user_id, "read", "", $ref_id, $a_type);
                     } else {
                         $readable = $is_admin;
                     }
                     $data[$ref_id] = array("obj_id" => $id, "ref_id" => $ref_id, "type" => ilObject::_lookupType($id), "title" => $item, "path" => $this->buildPath($ref_id), "readable" => $readable);
                 }
             }
         }
     }
     $this->setData($data);
 }
Ejemplo n.º 6
0
 /**
  * Import XML
  *
  * @param
  * @return
  */
 function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
 {
     include_once './Modules/Category/classes/class.ilObjCategory.php';
     if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
         $refs = ilObject::_getAllReferences($new_id);
         $this->category = ilObjectFactory::getInstanceByRefId(end($refs), false);
     } elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) {
         $this->category = ilObjectFactory::getInstanceByRefId($new_id, false);
     } elseif (!$this->category instanceof ilObjCategory) {
         $this->category = new ilObjCategory();
         $this->category->create(true);
     }
     include_once './Modules/Category/classes/class.ilCategoryXmlParser.php';
     try {
         $parser = new ilCategoryXmlParser($a_xml, 0);
         $parser->setCategory($this->category);
         $parser->setMode(ilCategoryXmlParser::MODE_UPDATE);
         $parser->startParsing();
         $a_mapping->addMapping('Modules/Category', 'cat', $a_id, $this->category->getId());
     } catch (ilSaxParserException $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
     } catch (Excpetion $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
     }
     foreach ($a_mapping->getMappingsOfEntity('Services/Container', 'objs') as $old => $new) {
         $type = ilObject::_lookupType($new);
         // see ilGlossaryImporter::importXmlRepresentation()
         // see ilTaxonomyDataSet::importRecord()
         $a_mapping->addMapping("Services/Taxonomy", "tax_item", $type . ":obj:" . $old, $new);
         // this is since 4.3 does not export these ids but 4.4 tax node assignment needs it
         $a_mapping->addMapping("Services/Taxonomy", "tax_item_obj_id", $type . ":obj:" . $old, $new);
     }
 }
 /**
  * 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"]);
 }
Ejemplo n.º 8
0
 /**
  * Show member view switch
  * @return 
  * @param int $a_ref_id
  */
 public static function showMemberViewSwitch($a_ref_id)
 {
     global $ilAccess, $ilCtrl;
     $settings = ilMemberViewSettings::getInstance();
     if (!$settings->isEnabled()) {
         return false;
     }
     global $tpl, $tree, $lng, $ilTabs;
     // No course or group in path => aborting
     if (!$tree->checkForParentType($a_ref_id, 'crs') and !$tree->checkForParentType($a_ref_id, 'grp')) {
         return false;
     }
     // TODO: check edit_permission
     $active = $settings->isActive();
     $type = ilObject::_lookupType(ilObject::_lookupObjId($a_ref_id));
     if (($type == 'crs' or $type == 'grp') and $ilAccess->checkAccess('write', '', $a_ref_id)) {
         $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $a_ref_id);
         $ilCtrl->setParameterByClass("ilrepositorygui", "mv", "1");
         $ilCtrl->setParameterByClass("ilrepositorygui", "set_mode", "flat");
         $ilTabs->addNonTabbedLink("members_view", $lng->txt('mem_view_activate'), $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset"));
         $ilCtrl->clearParametersByClass("ilrepositorygui");
         return true;
     }
     return true;
 }
Ejemplo n.º 9
0
 /**
  * Import using simplexml
  * @param SimpleXMLElement $role
  */
 public function importSimpleXml(SimpleXMLElement $role)
 {
     global $rbacadmin, $rbacreview, $lng;
     $import_id = (string) $role['id'];
     $GLOBALS['ilLog']->write(__METHOD__ . ' Importing role with import id ' . $import_id);
     if (!$this->initRole($import_id)) {
         return 0;
     }
     $this->getRole()->setTitle(trim((string) $role->title));
     $this->getRole()->setDescription(trim((string) $role->description));
     $type = ilObject::_lookupType($this->getRoleFolderId(), true);
     $exp = explode("_", $this->getRole()->getTitle());
     if (count($exp) > 0 && $exp[0] === "il") {
         if (count($exp) > 1 && $exp[1] !== $type) {
             throw new ilRoleImporterException(sprintf($lng->txt("rbac_cant_import_role_wrong_type"), $lng->txt('obj_' . $exp[1]), $lng->txt('obj_' . $type)));
         }
         $exp[3] = $this->getRoleFolderId();
         $id = ilObjRole::_getIdsForTitle(implode("_", $exp));
         if ($id[0]) {
             $GLOBALS['ilLog']->write(__METHOD__ . ': Overwrite role ' . implode("_", $exp));
             $this->getRole()->setId($id[0]);
             $this->getRole()->read();
         }
     }
     // Create or update
     if ($this->getRole()->getId()) {
         $rbacadmin->deleteRolePermission($this->getRole()->getId(), $this->getRoleFolderId());
         $this->getRole()->update();
     } else {
         $this->getRole()->create();
     }
     $this->assignToRoleFolder();
     $protected = (string) $role['protected'];
     if ($protected) {
         $rbacadmin->setProtected(0, $this->getRole()->getId(), 'y');
     }
     // Add operations
     $ops = $rbacreview->getOperations();
     $operations = array();
     foreach ($ops as $ope) {
         $operations[$ope['operation']] = $ope['ops_id'];
     }
     foreach ($role->operations as $sxml_operations) {
         foreach ($sxml_operations as $sxml_op) {
             $ops_group = (string) $sxml_op['group'];
             $ops_id = (int) $operations[trim((string) $sxml_op)];
             $ops = trim((string) $sxml_op);
             if ($ops_group and $ops_id) {
                 $rbacadmin->setRolePermission($this->getRole()->getId(), $ops_group, array($ops_id), $this->getRoleFolderId());
             } else {
                 $GLOBALS['ilLog']->write(__METHOD__ . ': Cannot create operation for...');
                 $GLOBALS['ilLog']->write(__METHOD__ . ': New operation for group ' . $ops_group);
                 $GLOBALS['ilLog']->write(__METHOD__ . ': New operation ' . $ops);
                 $GLOBALS['ilLog']->write(__METHOD__ . ': New operation ' . $ops_id);
             }
         }
     }
     return $this->getRole()->getId();
 }
 /**
  * Handle an event in a listener.
  *
  * @param	string	$a_component	component, e.g. "Modules/Forum" or "Services/User"
  * @param	string	$a_event		event e.g. "createUser", "updateUser", "deleteUser", ...
  * @param	array	$a_parameter	parameter array (assoc), array("name" => ..., "phone_office" => ...)
  */
 static function handleEvent($a_component, $a_event, $a_parameter)
 {
     global $ilUser;
     if ($a_component == "Services/Tracking" && $a_event == "updateStatus") {
         // #13905
         include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
         if (!ilObjUserTracking::_enabledLearningProgress()) {
             return;
         }
         $obj_id = $a_parameter["obj_id"];
         $user_id = $a_parameter["usr_id"];
         $status = $a_parameter["status"];
         if ($obj_id && $user_id) {
             if (ilObject::_lookupType($obj_id) != "crs") {
                 return;
             }
             // determine couse setting only once
             if (!isset(self::$course_mode[$obj_id])) {
                 include_once "./Modules/Course/classes/class.ilObjCourse.php";
                 $crs = new ilObjCourse($obj_id, false);
                 if ($crs->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
                     include_once './Services/Object/classes/class.ilObjectLP.php';
                     $olp = ilObjectLP::getInstance($obj_id);
                     $mode = $olp->getCurrentMode();
                 } else {
                     $mode = false;
                 }
                 self::$course_mode[$obj_id] = $mode;
             }
             $is_completed = $status == ilLPStatus::LP_STATUS_COMPLETED_NUM;
             // we are NOT using the members object because of performance issues
             switch (self::$course_mode[$obj_id]) {
                 case ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR:
                     // #11600
                     include_once "Modules/Course/classes/class.ilCourseParticipants.php";
                     ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed, true);
                     break;
                 case ilLPObjSettings::LP_MODE_COLLECTION:
                 case ilLPObjSettings::LP_MODE_OBJECTIVES:
                     // overwrites course passed status if it was set automatically (full sync)
                     // or toggle manually set passed status to completed (1-way-sync)
                     $do_update = $is_completed;
                     include_once "Modules/Course/classes/class.ilCourseParticipants.php";
                     if (!$do_update) {
                         $part = new ilCourseParticipants($obj_id);
                         $passed = $part->getPassedInfo($user_id);
                         if (!is_array($passed) || $passed["user_id"] == -1) {
                             $do_update = true;
                         }
                     }
                     if ($do_update) {
                         ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed);
                     }
                     break;
             }
         }
     }
 }
 /**
  * Check in the certificate type if this setting is editable in the current context (crs, tst...)
  *
  * @return bool
  */
 public function isEditable()
 {
     /** @var srCertificateDefinition $definition */
     $definition = srCertificateDefinition::find($this->getDefinitionId());
     $type = $definition->getType();
     $setting = $type->getCustomSettingByIdentifier($this->getIdentifier());
     $ref_id = $definition->getRefId();
     $object_type = $this->pl->isCourseTemplate($ref_id) ? 'crs-tpl' : ilObject::_lookupType($ref_id, true);
     return in_array($object_type, $setting->getEditableIn());
 }
Ejemplo n.º 12
0
 /**
  * set ref id of target object
  *
  * @param $a_ref_id
  */
 function setRefId($a_ref_id)
 {
     global $tree;
     $this->ref_id = $a_ref_id;
     //can target object be highlighted?
     $target_type = ilObject::_lookupType($a_ref_id, true);
     if (!in_array($target_type, $this->getTypeWhiteList())) {
         $this->highlighted_parent = $tree->getParentId($a_ref_id);
     }
 }
 public function __construct()
 {
     global $lng;
     parent::__construct();
     $this->parent_ref_id = (int) $_GET["ref_id"];
     $this->parent_obj_id = ilObject::_lookupObjId($this->parent_ref_id);
     $this->parent_obj_type = ilObject::_lookupType($this->parent_obj_id);
     $lng->loadLanguageModule("classification");
     $this->setTitle($lng->txt("clsfct_block_title"));
     $this->setFooterInfo($lng->txt("clsfct_block_info"));
 }
Ejemplo n.º 14
0
 /**
  * Singleton Constructor
  *
  * @access protected
  * @param int obj_id of container
  */
 protected function __construct($a_obj_id, $a_usr_id)
 {
     global $ilDB, $lng;
     $this->obj_id = $a_obj_id;
     $this->usr_id = $a_usr_id;
     $this->type = ilObject::_lookupType($a_obj_id);
     $ref_ids = ilObject::_getAllReferences($this->obj_id);
     $this->ref_id = current($ref_ids);
     $this->readParticipant();
     $this->readParticipantStatus();
 }
 public function isValidPath(array $a_path)
 {
     if (parent::isValidPath($a_path)) {
         // portfolio (not in repository)?
         if (ilObject::_lookupType($this->object_id) == "prtf") {
             $this->prtf_id = $this->object_id;
             $this->object_id = null;
             // force custom check
         }
         return true;
     }
 }
 protected function verifyObject($a_ref_id)
 {
     global $ilAccess;
     $this->ref_id = $a_ref_id;
     $this->obj_id = ilObject::_lookupObjId($this->ref_id);
     if (ilObject::_lookupType($this->obj_id) != "xxco") {
         $this->sendError("Wrong object given!");
     }
     if (!$ilAccess->checkAccessOfUser($this->user_id, 'read', '', $this->ref_id)) {
         $this->sendError("No access!");
     }
 }
 /**
  * Handle target parameter
  * @param object $a_target
  * @return 
  */
 public static function handleCode($a_ref_id, $a_type, $a_code)
 {
     include_once './Services/Link/classes/class.ilLink.php';
     try {
         self::useCode($a_code, $a_ref_id);
         ilUtil::redirect(ilLink::_getLink($a_ref_id, ilObject::_lookupType(ilObject::_lookupObjId($a_ref_id))));
     } catch (Exception $e) {
         $GLOBALS['ilLog']->logStack();
         $GLOBALS['ilLog']->write($e->getMessage());
         ilUtil::redirect(ilLink::_getLink($e->getCode(), ilObject::_lookupType(ilObject::_lookupObjId($e->getCode()))));
     }
 }
 function ilHistoryGUI($a_obj_id, $a_obj_type = "")
 {
     global $lng, $ilCtrl;
     $this->obj_id = $a_obj_id;
     if ($a_obj_type == "") {
         $this->obj_type = ilObject::_lookupType($a_obj_id);
     } else {
         $this->obj_type = $a_obj_type;
     }
     $this->lng =& $lng;
     $this->ctrl =& $ilCtrl;
 }
 /**
  * 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();
     }
 }
 /**
  * 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();
 }
 /**
  * Constructor
  *
  * @access public
  * @param
  * 
  */
 public function __construct($a_ref_id)
 {
     global $ilCtrl, $tpl, $lng, $ilUser, $ilObjDataCache;
     $this->ctrl = $ilCtrl;
     $this->tpl = $tpl;
     $this->lng = $lng;
     $this->lng->loadLanguageModule('ps');
     $this->ref_id = $a_ref_id;
     $this->obj_id = $ilObjDataCache->lookupObjId($this->ref_id);
     $this->type = ilObject::_lookupType($this->obj_id);
     $this->fields_info = ilExportFieldsInfo::_getInstanceByType(ilObject::_lookupType($this->obj_id));
     $this->initFileSystemStorage();
 }
 /**
  *  Constructor
  *
  * @access public
  * @param
  * 
  */
 public function __construct($a_obj_id)
 {
     global $lng, $tpl, $ilCtrl, $ilTabs;
     $this->lng = $lng;
     $this->lng->loadLanguageModule('ps');
     $this->lng->loadLanguageModule(ilObject::_lookupType($a_obj_id));
     $this->tpl = $tpl;
     $this->ctrl = $ilCtrl;
     $this->tabs_gui = $ilTabs;
     $this->obj_id = $a_obj_id;
     // Currently only supported for container objects
     $refs = ilObject::_getAllReferences($this->obj_id);
     $this->ref_id = end($refs);
 }
Ejemplo n.º 23
0
 /**
  * Get xml representation
  *
  * @param	string		entity
  * @param	string		target release
  * @param	string		id
  * @return	string		xml string
  */
 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
 {
     $xml = '';
     include_once 'Modules/Forum/classes/class.ilForumXMLWriter.php';
     if (ilObject::_lookupType($a_id) == 'frm') {
         $writer = new ilForumXMLWriter();
         $writer->setForumId($a_id);
         ilUtil::makeDirParents($this->getAbsoluteExportDirectory());
         $writer->setFileTargetDirectories($this->getRelativeExportDirectory(), $this->getAbsoluteExportDirectory());
         $writer->start();
         $xml .= $writer->getXml();
     }
     return $xml;
 }
 /**
  * Forward command to plugin
  */
 function forward()
 {
     global $ilCtrl;
     $type = ilObject::_lookupType($_GET["ref_id"], true);
     if ($type != "") {
         include_once "./Services/Component/classes/class.ilPlugin.php";
         $pl_name = ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $type);
         if ($pl_name != "") {
             $gui_cn = "ilObj" . $pl_name . "GUI";
             $ilCtrl->setParameterByClass($gui_cn, "ref_id", $_GET["ref_id"]);
             $ilCtrl->redirectByClass($gui_cn, $_GET["forwardCmd"]);
         }
     }
 }
Ejemplo n.º 25
0
 /**
  * Constructor
  *
  * @param
  * @return
  */
 function __construct($a_manifest_dom, $a_obj_id)
 {
     $this->manifest_dom = $a_manifest_dom;
     $path = new DOMXpath($a_manifest_dom);
     $path->registerNamespace("ims", "http://www.imsproject.org/xsd/imscp_rootv1p1p2");
     $items = $path->query("//ims:manifest/ims:metadata");
     if ($items->length == 1) {
         foreach ($items as $i) {
             //echo htmlentities($a_manifest_dom->saveXML($i)); exit;
             parent::__construct($a_manifest_dom->saveXML($i), $a_obj_id, $a_obj_id, ilObject::_lookupType($a_obj_id));
             $this->metadata_found = true;
         }
     }
 }
 /**
  * Constructor
  */
 function __construct($a_parent_obj, $a_parent_cmd, $a_obj_id, $a_ref_id, $a_print_view = false)
 {
     global $ilCtrl, $lng, $tree, $rbacsystem;
     $this->setId("troup");
     $this->obj_id = $a_obj_id;
     $this->ref_id = $a_ref_id;
     $this->type = ilObject::_lookupType($a_obj_id);
     $this->in_group = $tree->checkForParentType($this->ref_id, "grp");
     if ($this->in_group) {
         $this->in_group = ilObject::_lookupObjId($this->in_group);
     } else {
         $this->in_course = $tree->checkForParentType($this->ref_id, "crs");
         if ($this->in_course) {
             $this->in_course = ilObject::_lookupObjId($this->in_course);
         }
     }
     parent::__construct($a_parent_obj, $a_parent_cmd);
     $this->parseTitle($a_obj_id, "trac_participants");
     if ($a_print_view) {
         $this->setPrintMode(true);
     }
     $labels = $this->getSelectableColumns();
     foreach ($this->getSelectedColumns() as $c) {
         $first = $c;
         // list cannot be sorted by udf fields (separate query)
         // because of pagination only core fields can be sorted
         $sort_id = substr($c, 0, 4) == "udf_" ? "" : $c;
         $this->addColumn($labels[$c]["txt"], $sort_id);
     }
     if (!$this->getPrintMode()) {
         $this->addColumn($this->lng->txt("actions"), "");
     }
     $this->setExternalSorting(true);
     $this->setExternalSegmentation(true);
     $this->setEnableHeader(true);
     $this->setFormAction($ilCtrl->getFormActionByClass(get_class($this)));
     $this->setRowTemplate("tpl.object_users_props_row.html", "Services/Tracking");
     $this->setEnableTitle(true);
     $this->setShowTemplates(true);
     $this->setExportFormats(array(self::EXPORT_CSV, self::EXPORT_EXCEL));
     if ($first) {
         $this->setDefaultOrderField($first);
         $this->setDefaultOrderDirection("asc");
     }
     $this->initFilter();
     $this->getItems();
     // #13807
     $this->has_edit = $rbacsystem->checkAccess('edit_learning_progress', $this->ref_id);
 }
Ejemplo n.º 27
0
 /**
  * Remove item from personal desktop
  * @access public
  */
 public static function removeFromDesktop()
 {
     global $ilUser;
     if ($_GET["item_ref_id"] and $_GET["type"]) {
         ilObjUser::_dropDesktopItem($ilUser->getId(), (int) $_GET['item_ref_id'], $_GET['type']);
     } else {
         if ($_POST["items"]) {
             foreach ($_POST["items"] as $item) {
                 $type = ilObject::_lookupType($item, true);
                 ilObjUser::_dropDesktopItem($ilUser->getId(), $item, $type);
             }
         }
     }
     return true;
 }
 /**
  * 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);
 }
Ejemplo n.º 29
0
 protected function initPlugin()
 {
     // active plugin?
     include_once 'Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php';
     if (ilRepositoryObjectPluginSlot::isTypePluginWithLP(ilObject::_lookupType($this->obj_id))) {
         $obj = ilObjectFactory::getInstanceByObjId($this->obj_id);
         if ($obj && $obj instanceof ilLPStatusPluginInterface) {
             $this->status = $obj;
         }
     } else {
         if (ilRepositoryObjectPluginSlot::isTypePluginWithLP(ilObject::_lookupType($this->obj_id), false)) {
             $this->status = self::INACTIVE_PLUGIN;
         }
     }
 }
 /**
  * Get xml of object values
  *
  * @access public
  * @static
  * @param object instance of ilXmlWriter
  * @param int $a_obj_id
  */
 public static function _appendXMLByObjId(ilXmlWriter $xml_writer, $a_obj_id)
 {
     global $ilDB;
     $type = ilObject::_lookupType($a_obj_id);
     // Get active field_definitions
     $query = "SELECT field_id FROM adv_md_record amr " . "JOIN adv_md_record_objs amro ON amr.record_id = amro.record_id " . "JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id " . "WHERE active = 1 " . "AND obj_type = " . $ilDB->quote($type, 'text') . " ";
     $xml_writer->xmlStartTag('AdvancedMetaData');
     $res = $ilDB->query($query);
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php';
         $value = ilAdvancedMDValue::_getInstance($a_obj_id, $row->field_id);
         $value->appendXML($xml_writer);
     }
     $xml_writer->xmlEndTag('AdvancedMetaData');
 }