/**
  * Get type icon path path
  * Return image path for icon_xxx.pngs
  * Or (if enabled) path to custom icon
  *
  * @access public
  * @param string obj_type
  * @param int obj_id
  * @param string size 'tiny','small' or 'big'
  * @static 
  *
  */
 public static function getTypeIconPath($a_type, $a_obj_id, $a_size = 'small')
 {
     global $ilSetting;
     if ($ilSetting->get("custom_icons")) {
         switch ($a_type) {
             case 'cat':
             case 'crs':
             case 'grp':
                 include_once './Services/Container/classes/class.ilContainer.php';
                 if (strlen($path = ilContainer::_lookupIconPath($a_obj_id, $a_size))) {
                     return $path;
                 }
         }
     }
     switch ($a_size) {
         case 'tiny':
             $postfix = '_s.png';
             break;
         case 'big':
             $postfix = '_b.png';
             break;
         default:
             $postfix = '.png';
             break;
     }
     return ilUtil::getImagePath('icon_' . $a_type . $postfix);
 }
Example #2
0
 /**
  * Get selectable taxonomies for current object
  * 
  * @return array
  */
 protected function getSelectableTaxonomies()
 {
     global $objDefinition, $tree;
     if ($objDefinition->isRBACObject($this->md_obj_type)) {
         $res = array();
         // see ilTaxonomyBlockGUI::getActiveTaxonomies()
         // get all active taxonomies of parent objects
         foreach ($tree->getPathFull((int) $_REQUEST["ref_id"]) as $node) {
             // currently only active for categories
             if ($node["type"] == "cat") {
                 include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
                 include_once "Services/Container/classes/class.ilContainer.php";
                 if (ilContainer::_lookupContainerSetting($node["obj_id"], ilObjectServiceSettingsGUI::TAXONOMIES, false)) {
                     include_once "Services/Taxonomy/classes/class.ilObjTaxonomy.php";
                     $tax_ids = ilObjTaxonomy::getUsageOfObject($node["obj_id"]);
                     if (sizeof($tax_ids)) {
                         $res = array_merge($res, $tax_ids);
                     }
                 }
             }
         }
         if (sizeof($res)) {
             return $res;
         }
     }
 }
Example #3
0
 /**
  * Get type icon path path
  * Return image path for icon_xxx.pngs
  * Or (if enabled) path to custom icon
  *
  * @access public
  * @param string obj_type
  * @param int obj_id
  * @param string size 'tiny','small' or 'big'
  * @static 
  *
  */
 public static function getTypeIconPath($a_type, $a_obj_id, $a_size = 'small')
 {
     global $ilSetting, $objDefinition;
     if ($ilSetting->get("custom_icons")) {
         switch ($a_type) {
             case 'cat':
             case 'crs':
             case 'grp':
                 include_once './Services/Container/classes/class.ilContainer.php';
                 if (strlen($path = ilContainer::_lookupIconPath($a_obj_id, $a_size))) {
                     return $path;
                 }
         }
     }
     if ($objDefinition->isPluginTypeName($a_type)) {
         $class_name = "il" . $objDefinition->getClassName($a_type) . 'Plugin';
         $location = $objDefinition->getLocation($a_type);
         include_once $location . "/class." . $class_name . ".php";
         return call_user_func(array($class_name, "_getIcon"), $a_type, $a_size, $a_obj_id);
     }
     switch ($a_size) {
         case 'tiny':
             $postfix = '_s.png';
             break;
         case 'big':
             $postfix = '_b.png';
             break;
         default:
             $postfix = '.png';
             break;
     }
     return ilUtil::getImagePath('icon_' . $a_type . $postfix);
 }
 /**
  *
  * @param bool
  * @return bool
  */
 function getInfoScreenStatus()
 {
     include_once "./Services/Container/classes/class.ilContainer.php";
     include_once "./Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
     if (ilContainer::_lookupContainerSetting($this->obj_id, ilObjectServiceSettingsGUI::INFO_TAB_VISIBILITY, true)) {
         return $this->info_screen_enabled;
     }
     return false;
 }
 /**
  * delete rootfolder and all related data
  *
  * @access	public
  * @return	boolean	true if all object data were removed; false if only a references were removed
  */
 function delete()
 {
     // delete is disabled
     $message = get_class($this) . "::delete(): Can't delete root folder!";
     $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
     return false;
     // always call parent delete function first!!
     if (!parent::delete()) {
         return false;
     }
     // put here rootfolder specific stuff
     return true;
 }
 public static function isActive($a_parent_ref_id, $a_parent_obj_id, $a_parent_obj_type)
 {
     global $ilUser;
     // we currently only check for the parent object setting
     // might change later on (parent containers)
     include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
     $valid = ilContainer::_lookupContainerSetting($a_parent_obj_id, ilObjectServiceSettingsGUI::TAG_CLOUD, false);
     if ($valid) {
         $tags_set = new ilSetting("tags");
         if (!$tags_set->get("enable_all_users", false) && $ilUser->getId() == ANONYMOUS_USER_ID) {
             $valid = false;
         }
     }
     return $valid;
 }
 /**
  * Constructor
  * @access public
  */
 function ilObjCategoryGUI($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
 {
     //global $ilCtrl;
     // CONTROL OPTIONS
     //$this->ctrl =& $ilCtrl;
     //$this->ctrl->saveParameter($this,array("ref_id","cmdClass"));
     $GLOBALS['lng']->loadLanguageModule('cat');
     $this->type = "cat";
     $this->ilContainerGUI($a_data, (int) $a_id, $a_call_by_reference, false);
     if (is_object($this->object)) {
         include_once "./Services/Container/classes/class.ilContainer.php";
         include_once "./Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
         $this->info_screen_enabled = ilContainer::_lookupContainerSetting($this->object->getId(), ilObjectServiceSettingsGUI::INFO_TAB_VISIBILITY, true);
     }
 }
 /**
  * Start wrting xml
  */
 public function export($a_with_header = true)
 {
     if ($this->getMode() == self::MODE_EXPORT) {
         if ($a_with_header) {
             $this->buildHeader();
         }
         $this->buildCategory();
         $this->buildTranslations();
         include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
         ilContainerSortingSettings::_exportContainerSortingSettings($this, $this->getCategory()->getId());
         include_once './Services/Container/classes/class.ilContainer.php';
         ilContainer::_exportContainerSettings($this, $this->category->getId());
         $this->buildFooter();
     }
 }
 protected static function getActiveTaxonomiesForParentRefId($a_parent_ref_id)
 {
     global $tree;
     if (!isset(self::$valid_tax_map[$a_parent_ref_id])) {
         include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
         include_once "Services/Taxonomy/classes/class.ilObjTaxonomy.php";
         include_once "Modules/Category/classes/class.ilObjCategoryGUI.php";
         $prefix = ilObjCategoryGUI::CONTAINER_SETTING_TAXBLOCK;
         $all_valid = array();
         foreach ($tree->getPathFull($a_parent_ref_id) as $node) {
             if ($node["type"] == "cat") {
                 $node_valid = array();
                 if (ilContainer::_lookupContainerSetting($node["obj_id"], ilObjectServiceSettingsGUI::TAXONOMIES, false)) {
                     $all_valid = array_merge($all_valid, ilObjTaxonomy::getUsageOfObject($node["obj_id"]));
                     $active = array();
                     foreach (ilContainer::_getContainerSettings($node["obj_id"]) as $keyword => $value) {
                         if (substr($keyword, 0, strlen($prefix)) == $prefix && (bool) $value) {
                             $active[] = substr($keyword, strlen($prefix));
                         }
                     }
                     $node_valid = array_intersect($all_valid, $active);
                 }
                 if (sizeof($node_valid)) {
                     foreach ($node_valid as $idx => $node_id) {
                         // #15268 - deleted taxonomy?
                         if (ilObject::_lookupType($node_id) != "tax") {
                             unset($node_valid[$idx]);
                         }
                     }
                 }
                 self::$valid_tax_map[$node["ref_id"]] = $node_valid;
             }
         }
     }
     return sizeof(self::$valid_tax_map[$a_parent_ref_id]);
 }
 /**
  * Get icon for repository item.
  *
  * @param	int			object id
  * @param	string		size (big, small, tiny)
  * @param	string		object type
  * @param	boolean		true: offline, false: online
  */
 public static function _getIcon($a_obj_id = "", $a_size = "big", $a_type = "", $a_offline = false)
 {
     global $ilSetting, $objDefinition;
     if ($a_obj_id == "" && $a_type == "") {
         return "";
     }
     if ($a_type == "") {
         $a_type = ilObject::_lookupType($a_obj_id);
     }
     if ($a_size == "") {
         $a_size = "big";
     }
     if ($ilSetting->get("custom_icons") && in_array($a_type, array("cat", "grp", "crs", "root"))) {
         require_once "./Services/Container/classes/class.ilContainer.php";
         if (ilContainer::_lookupContainerSetting($a_obj_id, "icon_" . $a_size)) {
             $cont_dir = ilContainer::_getContainerDirectory($a_obj_id);
             // png version? (introduced with ILIAS 4.3)
             $file_name = $cont_dir . "/icon_" . $a_size . ".png";
             if (is_file($file_name)) {
                 return $file_name;
             }
             // gif version? (prior to ILIAS 4.3)
             $file_name = $cont_dir . "/icon_" . $a_size . ".gif";
             if (is_file($file_name)) {
                 return $file_name;
             }
         }
     }
     switch ($a_size) {
         case "small":
             $suff = "";
             break;
         case "tiny":
             $suff = "_s";
             break;
         default:
             $suff = "_b";
             break;
     }
     if (!$a_offline) {
         if ($objDefinition->isPluginTypeName($a_type)) {
             include_once "./Services/Repository/classes/class.ilRepositoryObjectPlugin.php";
             return ilRepositoryObjectPlugin::_getIcon($a_type, $a_size);
         }
         return ilUtil::getImagePath("icon_" . $a_type . $suff . ".png");
     } else {
         return "./images/icon_" . $a_type . $suff . ".png";
     }
 }
 /**
  * get image path
  */
 function getImage($a_name, $a_type = "", $a_obj_id = "")
 {
     if ($a_type != "") {
         // custom icons
         if ($this->ilias->getSetting("custom_icons") && in_array($a_type, array("cat", "grp", "crs"))) {
             require_once "./Services/Container/classes/class.ilContainer.php";
             if (($path = ilContainer::_lookupIconPath($a_obj_id, "tiny")) != "") {
                 return $path;
             }
         }
     }
     return parent::getImage($a_name);
 }
 function handlerEndTag($a_xml_parser, $a_name)
 {
     switch ($a_name) {
         case "title":
             $this->group_data["title"] = trim($this->cdata);
             break;
         case "description":
             $this->group_data["description"] = trim($this->cdata);
             break;
         case 'information':
             $this->group_data['information'] = trim($this->cdata);
             break;
         case 'password':
             $this->group_data['password'] = trim($this->cdata);
             break;
         case 'maxMembers':
             $this->group_data['max_members'] = trim($this->cdata);
             break;
         case 'expiration':
             $this->group_data['expiration_end'] = trim($this->cdata);
             break;
         case 'start':
             $this->group_data['expiration_start'] = trim($this->cdata);
             break;
         case 'end':
             $this->group_data['expiration_end'] = trim($this->cdata);
             break;
         case "folder":
             $this->__popParentId();
             break;
         case "folderTitle":
             $this->folder = trim($this->cdata);
             $this->__saveFolder();
             break;
         case "group":
             // NOW SAVE THE NEW OBJECT (if it hasn't been imported)
             $this->__save();
             break;
         case 'ContainerSetting':
             if ($this->current_container_setting) {
                 // #17357
                 if (!$this->group_obj instanceof ilObjGroup) {
                     $this->__initGroupObject();
                 }
                 ilContainer::_writeContainerSetting($this->group_obj->getId(), $this->current_container_setting, $this->cdata);
             }
             break;
     }
     $this->cdata = '';
 }
 function start()
 {
     if ($this->getMode() == self::MODE_SOAP) {
         $this->__buildHeader();
         $this->__buildCourseStart();
         $this->__buildMetaData();
         $this->__buildAdvancedMetaData();
         if ($this->attach_users) {
             $this->__buildAdmin();
             $this->__buildTutor();
             $this->__buildMember();
         }
         $this->__buildSubscriber();
         $this->__buildWaitingList();
         $this->__buildSetting();
         include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
         ilContainerSortingSettings::_exportContainerSortingSettings($this, $this->course_obj->getId());
         ilContainer::_exportContainerSettings($this, $this->course_obj->getId());
         $this->__buildFooter();
     } elseif ($this->getMode() == self::MODE_EXPORT) {
         $this->__buildCourseStart();
         $this->__buildMetaData();
         $this->__buildAdvancedMetaData();
         $this->__buildSetting();
         include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
         ilContainerSortingSettings::_exportContainerSortingSettings($this, $this->course_obj->getId());
         ilContainer::_exportContainerSettings($this, $this->course_obj->getId());
         $this->__buildFooter();
     }
 }
Example #14
0
 /**
  * Init style properties form
  */
 function initStylePropertiesForm()
 {
     global $ilCtrl, $lng, $ilTabs, $ilSetting, $tpl;
     $tpl->setTreeFlatIcon("", "");
     $ilTabs->clearTargets();
     $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(), "xhtml_page");
     if ($xpage_id > 0) {
         $ilTabs->setBackTarget($lng->txt("cntr_back_to_old_editor"), $ilCtrl->getLinkTarget($this, "switchToOldEditor"), "_top");
     } else {
         $ilTabs->setBackTarget($lng->txt("back"), "./goto.php?target=" . $this->object->getType() . "_" . $this->object->getRefId(), "_top");
     }
     include_once "./Services/Container/classes/class.ilContainerPageGUI.php";
     $page_gui = new ilContainerPageGUI($this->object->getId());
     $style_id = $this->object->getStyleSheetId();
     if (ilObject::_lookupType($style_id) == "sty") {
         $page_gui->setStyleId($style_id);
     } else {
         $style_id = 0;
     }
     $page_gui->setTabHook($this, "addPageTabs");
     $ilCtrl->getHTML($page_gui);
     $ilTabs->setTabActive("obj_sty");
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $lng->loadLanguageModule("style");
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $fixed_style = $ilSetting->get("fixed_content_style_id");
     //		$style_id = $this->object->getStyleSheetId();
     if ($fixed_style > 0) {
         $st = new ilNonEditableValueGUI($lng->txt("wiki_current_style"));
         $st->setValue(ilObject::_lookupTitle($fixed_style) . " (" . $this->lng->txt("global_fixed") . ")");
         $this->form->addItem($st);
     } else {
         $st_styles = ilObjStyleSheet::_getStandardStyles(true, false, $_GET["ref_id"]);
         $st_styles[0] = $this->lng->txt("default");
         ksort($st_styles);
         if ($style_id > 0) {
             // individual style
             if (!ilObjStyleSheet::_lookupStandard($style_id)) {
                 $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
                 $st->setValue(ilObject::_lookupTitle($style_id));
                 $this->form->addItem($st);
                 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
                 // delete command
                 $this->form->addCommandButton("editStyle", $lng->txt("style_edit_style"));
                 $this->form->addCommandButton("deleteStyle", $lng->txt("style_delete_style"));
                 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
             }
         }
         if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id)) {
             $style_sel = ilUtil::formSelect($style_id, "style_id", $st_styles, false, true);
             $style_sel = new ilSelectInputGUI($lng->txt("style_current_style"), "style_id");
             $style_sel->setOptions($st_styles);
             $style_sel->setValue($style_id);
             $this->form->addItem($style_sel);
             //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
             $this->form->addCommandButton("saveStyleSettings", $lng->txt("save"));
             $this->form->addCommandButton("createStyle", $lng->txt("sty_create_ind_style"));
         }
     }
     $this->form->setTitle($lng->txt("obj_sty"));
     $this->form->setFormAction($ilCtrl->getFormAction($this));
 }
Example #15
0
 /**
  * Get subitems of container
  * 
  * @param bool administration panel enabled
  * @param bool side blocks enabled
  *
  * @return	array
  */
 function getSubItems($a_admin_panel_enabled = false, $a_include_side_block = false, $a_get_single = 0)
 {
     global $objDefinition, $ilBench, $tree, $ilObjDataCache, $ilUser, $rbacsystem, $ilSetting;
     // Caching
     if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]) && !$a_get_single) {
         return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
     }
     $type_grps = $this->getGroupedObjTypes();
     $objects = $tree->getChilds($this->getRefId(), "title");
     // using long descriptions?
     $short_desc = $ilSetting->get("rep_shorten_description");
     $short_desc_max_length = $ilSetting->get("rep_shorten_description_length");
     if (!$short_desc || $short_desc_max_length != ilObject::TITLE_LENGTH) {
         // using (part of) shortened description
         if ($short_desc && $short_desc_max_length && $short_desc_max_length < ilObject::TITLE_LENGTH) {
             foreach ($objects as $key => $object) {
                 $objects[$key]["description"] = ilUtil::shortenText($object["description"], $short_desc_max_length, true);
             }
         } else {
             $obj_ids = array();
             foreach ($objects as $key => $object) {
                 $obj_ids[] = $object["obj_id"];
             }
             if (sizeof($obj_ids)) {
                 $long_desc = ilObject::getLongDescriptions($obj_ids);
                 foreach ($objects as $key => $object) {
                     // #12166 - keep translation, ignore long description
                     if ($ilObjDataCache->isTranslatedDescription($object["obj_id"])) {
                         $long_desc[$object["obj_id"]] = $object["description"];
                     }
                     if ($short_desc && $short_desc_max_length) {
                         $long_desc[$object["obj_id"]] = ilUtil::shortenText($long_desc[$object["obj_id"]], $short_desc_max_length, true);
                     }
                     $objects[$key]["description"] = $long_desc[$object["obj_id"]];
                 }
             }
         }
     }
     $found = false;
     $all_ref_ids = array();
     if (!self::$data_preloaded) {
         include_once "./Services/Object/classes/class.ilObjectListGUIPreloader.php";
         $preloader = new ilObjectListGUIPreloader(ilObjectListGUI::CONTEXT_REPOSITORY);
     }
     include_once 'Services/Container/classes/class.ilContainerSorting.php';
     $sort = ilContainerSorting::_getInstance($this->getId());
     // TODO: check this
     // get items attached to a session
     include_once './Modules/Session/classes/class.ilEventItems.php';
     $event_items = ilEventItems::_getItemsOfContainer($this->getRefId());
     foreach ($objects as $key => $object) {
         if ($a_get_single > 0 && $object["child"] != $a_get_single) {
             continue;
         }
         // hide object types in devmode
         if ($objDefinition->getDevMode($object["type"]) || $object["type"] == "adm" || $object["type"] == "rolf") {
             continue;
         }
         // remove inactive plugins
         if ($objDefinition->isInactivePlugin($object["type"])) {
             continue;
         }
         // BEGIN WebDAV: Don't display hidden Files, Folders and Categories
         if (in_array($object['type'], array('file', 'fold', 'cat'))) {
             include_once 'Modules/File/classes/class.ilObjFileAccess.php';
             if (ilObjFileAccess::_isFileHidden($object['title'])) {
                 $this->setHiddenFilesFound(true);
                 if (!$a_admin_panel_enabled) {
                     continue;
                 }
             }
         }
         // END WebDAV: Don't display hidden Files, Folders and Categories
         // including event items!
         if (!self::$data_preloaded) {
             $preloader->addItem($object["obj_id"], $object["type"], $object["child"]);
         }
         // filter out items that are attached to an event
         if (in_array($object['ref_id'], $event_items)) {
             continue;
         }
         // filter side block items
         if (!$a_include_side_block && $objDefinition->isSideBlock($object['type'])) {
             continue;
         }
         $all_ref_ids[] = $object["child"];
     }
     // data preloader
     if (!self::$data_preloaded) {
         $preloader->preload();
         unset($preloader);
         self::$data_preloaded = true;
     }
     foreach ($objects as $key => $object) {
         // see above, objects were filtered
         if (!in_array($object["child"], $all_ref_ids)) {
             continue;
         }
         // group object type groups together (e.g. learning resources)
         $type = $objDefinition->getGroupOfObj($object["type"]);
         if ($type == "") {
             $type = $object["type"];
         }
         // this will add activation properties
         $this->addAdditionalSubItemInformation($object);
         $this->items[$type][$key] = $object;
         $this->items["_all"][$key] = $object;
         if ($object["type"] != "sess") {
             $this->items["_non_sess"][$key] = $object;
         }
     }
     $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block] = $sort->sortItems($this->items);
     return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
 }
 /**
  * adds a standard row to a block template
  *
  * @param	object		$a_tpl		block template
  * @param	string		$a_html		html code
  * @access	private
  */
 function addStandardRow(&$a_tpl, $a_html, $a_item_ref_id = "", $a_item_obj_id = "", $a_image_type = "", $a_related_header = "")
 {
     global $ilSetting;
     $this->cur_row_type = $this->cur_row_type == "row_type_1" ? "row_type_2" : "row_type_1";
     $a_tpl->touchBlock($this->cur_row_type);
     if ($a_image_type != "") {
         if (!is_array($a_image_type) && !in_array($a_image_type, array("lm", "dbk", "htlm", "sahs"))) {
             $icon = ilUtil::getImagePath("icon_" . $a_image_type . ".png");
             $title = $this->lng->txt("obj_" . $a_image_type);
         } else {
             $icon = ilUtil::getImagePath("icon_lm.png");
             $title = $this->lng->txt("learning_resource");
         }
         // custom icon
         if ($ilSetting->get("custom_icons") && in_array($a_image_type, array("cat", "grp", "crs"))) {
             require_once "./Services/Container/classes/class.ilContainer.php";
             if (($path = ilContainer::_lookupIconPath($a_item_obj_id, "small")) != "") {
                 $icon = $path;
             }
         }
         $a_tpl->setCurrentBlock("block_row_image");
         $a_tpl->setVariable("ROW_IMG", $icon);
         $a_tpl->setVariable("ROW_ALT", $title);
         $a_tpl->parseCurrentBlock();
     } else {
         $a_tpl->setVariable("ROW_NBSP", "&nbsp;");
     }
     $a_tpl->setCurrentBlock("container_standard_row");
     $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
     $rel_headers = $a_related_header != "" ? "th_selected_items " . $a_related_header : "th_selected_items";
     $a_tpl->setVariable("BLOCK_ROW_HEADERS", $rel_headers);
     $a_tpl->parseCurrentBlock();
     $a_tpl->touchBlock("container_row");
 }
 /**
  * Check whether a block type is globally activated
  */
 protected function isGloballyActivated($a_type)
 {
     global $ilSetting;
     if (isset($this->check_global_activation[$a_type]) && $this->check_global_activation[$a_type]) {
         if ($a_type == 'pdbookm') {
             if (!$ilSetting->get("disable_bookmarks")) {
                 return true;
             }
             return false;
         } else {
             if ($a_type == 'pdnotes') {
                 if (!$ilSetting->get("disable_notes")) {
                     return true;
                 }
                 return false;
             } elseif ($a_type == 'news') {
                 include_once 'Services/Container/classes/class.ilContainer.php';
                 return $ilSetting->get('block_activated_news') && ilContainer::_lookupContainerSetting($GLOBALS['ilCtrl']->getContextObjId(), 'cont_show_news', true);
             } else {
                 if ($ilSetting->get("block_activated_" . $a_type)) {
                     return true;
                 } elseif ($a_type == 'cal') {
                     include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
                     return ilCalendarSettings::lookupCalendarActivated($GLOBALS['ilCtrl']->getContextObjId());
                 } elseif ($a_type == 'pdcal') {
                     include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
                     return ilCalendarSettings::_getInstance()->isEnabled();
                 }
             }
         }
         return false;
     }
     return true;
 }
Example #18
0
 /**
  * We need a static version of this, e.g. in folders of the course
  */
 static function _modifyItemGUI($a_item_list_gui, $a_cmd_class, $a_item_data, $a_show_path, $a_abo_status, $a_course_ref_id, $a_course_obj_id, $a_parent_ref_id = 0)
 {
     global $lng, $ilAccess;
     // this is set for folders within the course
     if ($a_parent_ref_id == 0) {
         $a_parent_ref_id = $a_course_ref_id;
     }
     // Special handling for tests in courses with learning objectives
     if ($a_item_data['type'] == 'tst' and ilObjCourse::_lookupViewMode($a_course_obj_id) == ilContainer::VIEW_OBJECTIVE) {
         $a_item_list_gui->addCommandLinkParameter(array('crs_show_result' => $a_course_ref_id));
     }
     $a_item_list_gui->enableSubscribe($a_abo_status);
     $is_tutor = $ilAccess->checkAccess('write', '', $a_course_ref_id, 'crs', $a_course_obj_id);
     if ($a_show_path and $is_tutor) {
         $a_item_list_gui->addCustomProperty($lng->txt('path'), ilContainer::_buildPath($a_item_data['ref_id'], $a_course_ref_id), false, true);
     }
 }
 /**
  * updates object entry in object_data
  *
  * @access	public
  */
 function updateObject()
 {
     global $ilSetting;
     if (!$this->checkPermissionBool("write")) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilias->error_obj->MESSAGE);
     } else {
         $form = $this->initEditForm();
         if ($form->checkInput()) {
             $this->saveSortingSettings($form);
             // save custom icons
             //save custom icons
             if ($ilSetting->get("custom_icons")) {
                 if ($_POST["cont_icon_delete"]) {
                     $this->object->removeCustomIcon();
                 }
                 $this->object->saveIcons($_FILES["cont_icon"]['tmp_name']);
             }
             // hide icon/title
             ilContainer::_writeContainerSetting($this->object->getId(), "hide_header_icon_and_title", $form->getInput("hide_header_icon_and_title"));
             // BEGIN ChangeEvent: Record update
             global $ilUser;
             require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
             ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
             ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
             // END ChangeEvent: Record update
             ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
             $this->ctrl->redirect($this, "edit");
         }
         // display form to correct errors
         $this->setEditTabs();
         $form->setValuesByPost();
         $this->tpl->setContent($form->getHTML());
     }
 }
 /**
  * Clone course (no member data)
  *
  * @access public
  * @param int target ref_id
  * @param int copy id
  * 
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilDB, $ilUser;
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     /*	 done in class.ilContainer	
     	 	include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
     	 	ilContainerSortingSettings::_cloneSettings($this->getId(),$new_obj->getId());
     	 	*/
     $first = true;
     $translations = $this->getTranslations();
     if (is_array($translations['Fobject'])) {
         foreach ($translations['Fobject'] as $num => $translation) {
             $new_obj->addTranslation($translation['title'], $translation['desc'], $translation['lang'], $first);
             if ($first) {
                 $first = false;
             }
         }
     }
     // clone icons
     $new_obj->saveIcons($this->getBigIconPath(), $this->getSmallIconPath(), $this->getTinyIconPath());
     return $new_obj;
 }
Example #21
0
 /**
  * Clone object dependencies (crs items, preconditions)
  *
  * @access public
  * @param int target ref id of new course
  * @param int copy id
  *
  */
 public function cloneDependencies($a_target_id, $a_copy_id)
 {
     global $tree;
     parent::cloneDependencies($a_target_id, $a_copy_id);
     include_once 'Services/Object/classes/class.ilObjectActivation.php';
     ilObjectActivation::cloneDependencies($this->getRefId(), $a_target_id, $a_copy_id);
     return true;
 }
    /**
     * delete object and all related data	
     *
     * @access	public
     * @return	boolean	true if all object data were removed; false if only a references were removed
     */
    function delete()
    {
        global $ilDB;
        // always call parent delete function first!!
        if (!parent::delete()) {
            return false;
        }
        //put here your module specific stuff
        $statement = $ilDB->manipulateF('
			DELETE FROM ilinc_data WHERE course_id = %s', array('integer'), array($this->getiLincId()));
        // TODO: delete data in ilinc_registration table
        /*
         * not tested yet
         */
        /*		$statement = $ilDB->manipulateF('
        			DELETE FROM ilinc_registration 
        			WHERE  obj_id = %s',
        			array('integer'), array($this->getId()));
        		
        */
        // remove course from ilinc server
        $this->ilincAPI->removeCourse($this->getiLincId());
        $response = $this->ilincAPI->sendRequest();
        return true;
    }
Example #23
0
 /**
  * delete category and all related data
  *
  * @access    public
  * @return    boolean    true if all object data were removed; false if only a references were removed
  */
 function delete()
 {
     global $ilDB, $ilAppEventHandler;
     // always call parent delete function first!!
     if (!parent::delete()) {
         return false;
     }
     // put here category specific stuff
     include_once './Services/User/classes/class.ilObjUserFolder.php';
     ilObjUserFolder::_updateUserFolderAssignment($this->ref_id, USER_FOLDER_ID);
     $query = "DELETE FROM object_translation WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer');
     $res = $ilDB->manipulate($query);
     $ilAppEventHandler->raise('Modules/OrgUnit', 'delete', array('object' => $this, 'obj_id' => $this->getId()));
     $sql = 'DELETE FROM ' . self::TABLE_NAME . ' WHERE orgu_id = ' . $ilDB->quote($this->getId(), 'integer');
     $ilDB->manipulate($sql);
     return true;
 }
 /**
  * Get subitems of container
  * 
  * @param bool administration panel enabled
  * @param bool side blocks enabled
  *
  * @return	array
  */
 function getSubItems($a_admin_panel_enabled = false, $a_include_side_block = false, $a_get_single = 0)
 {
     global $objDefinition, $ilBench, $tree, $ilObjDataCache, $ilUser, $rbacsystem, $ilSetting;
     // Caching
     if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]) && !$a_get_single) {
         return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
     }
     $type_grps = $this->getGroupedObjTypes();
     $objects = $tree->getChilds($this->getRefId(), "title");
     // using long descriptions?
     $short_desc = $ilSetting->get("rep_shorten_description");
     $short_desc_max_length = $ilSetting->get("rep_shorten_description_length");
     if (!$short_desc || $short_desc_max_length != ilObject::TITLE_LENGTH) {
         // using (part of) shortened description
         if ($short_desc && $short_desc_max_length && $short_desc_max_length < ilObject::TITLE_LENGTH) {
             foreach ($objects as $key => $object) {
                 $objects[$key]["description"] = ilUtil::shortenText($object["description"], $short_desc_max_length, true);
             }
         } else {
             $obj_ids = array();
             foreach ($objects as $key => $object) {
                 $obj_ids[] = $object["obj_id"];
             }
             if (sizeof($obj_ids)) {
                 $long_desc = ilObject::getLongDescriptions($obj_ids);
                 foreach ($objects as $key => $object) {
                     if ($short_desc && $short_desc_max_length) {
                         $long_desc[$object["obj_id"]] = ilUtil::shortenText($long_desc[$object["obj_id"]], $short_desc_max_length, true);
                     }
                     $objects[$key]["description"] = $long_desc[$object["obj_id"]];
                 }
             }
         }
     }
     $found = false;
     $all_obj_types = array();
     $all_ref_ids = array();
     $all_obj_ids = array();
     include_once 'Services/Container/classes/class.ilContainerSorting.php';
     $sort = ilContainerSorting::_getInstance($this->getId());
     // TODO: check this
     // get items attached to a session
     include_once './Modules/Session/classes/class.ilEventItems.php';
     $event_items = ilEventItems::_getItemsOfContainer($this->getRefId());
     foreach ($objects as $key => $object) {
         if ($a_get_single > 0 && $object["child"] != $a_get_single) {
             continue;
         }
         // hide object types in devmode
         if ($objDefinition->getDevMode($object["type"]) || $object["type"] == "adm" || $object["type"] == "rolf") {
             continue;
         }
         // remove inactive plugins
         if ($objDefinition->isInactivePlugin($object["type"])) {
             continue;
         }
         // BEGIN WebDAV: Don't display hidden Files, Folders and Categories
         if (in_array($object['type'], array('file', 'fold', 'cat'))) {
             include_once 'Modules/File/classes/class.ilObjFileAccess.php';
             if (ilObjFileAccess::_isFileHidden($object['title'])) {
                 $this->setHiddenFilesFound(true);
                 if (!$a_admin_panel_enabled) {
                     continue;
                 }
             }
         }
         // END WebDAV: Don't display hidden Files, Folders and Categories
         // filter out items that are attached to an event
         if (in_array($object['ref_id'], $event_items)) {
             continue;
         }
         // filter side block items
         if (!$a_include_side_block && $objDefinition->isSideBlock($object['type'])) {
             continue;
         }
         $all_obj_types[$object["type"]] = $object["type"];
         $obj_ids_of_type[$object["type"]][] = $object["obj_id"];
         $ref_ids_of_type[$object["type"]][] = $object["child"];
         $all_ref_ids[] = $object["child"];
         $all_obj_ids[] = $object["obj_id"];
     }
     // data preloader
     if (!self::$data_preloaded && sizeof($all_ref_ids)) {
         // type specific preloads
         foreach ($all_obj_types as $t) {
             // condition handler: preload conditions
             include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
             ilConditionHandler::preloadConditionsForTargetRecords($t, $obj_ids_of_type[$t]);
             $class = $objDefinition->getClassName($t);
             $location = $objDefinition->getLocation($t);
             $full_class = "ilObj" . $class . "Access";
             include_once $location . "/class." . $full_class . ".php";
             call_user_func(array($full_class, "_preloadData"), $obj_ids_of_type[$t], $ref_ids_of_type[$t]);
         }
         // general preloads
         $tree->preloadDeleted($all_ref_ids);
         $tree->preloadDepthParent($all_ref_ids);
         $ilObjDataCache->preloadReferenceCache($all_ref_ids, false);
         ilObjUser::preloadIsDesktopItem($ilUser->getId(), $all_ref_ids);
         $rbacsystem->preloadRbacPaCache($all_ref_ids, $ilUser->getId());
         include_once "./Services/Object/classes/class.ilObjectListGUI.php";
         ilObjectListGUI::preloadCommonProperties($all_obj_ids);
         include_once "./Services/Object/classes/class.ilObjectActivation.php";
         ilObjectActivation::preloadData($all_ref_ids);
         self::$data_preloaded = true;
     }
     foreach ($objects as $key => $object) {
         // see above, objects were filtered
         if (!in_array($object["child"], $all_ref_ids)) {
             continue;
         }
         // group object type groups together (e.g. learning resources)
         $type = $objDefinition->getGroupOfObj($object["type"]);
         if ($type == "") {
             $type = $object["type"];
         }
         // this will add activation properties (ilObjActivation)
         $this->addAdditionalSubItemInformation($object);
         $this->items[$type][$key] = $object;
         $this->items["_all"][$key] = $object;
         if ($object["type"] != "sess") {
             $this->items["_non_sess"][$key] = $object;
         }
     }
     $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block] = $sort->sortItems($this->items);
     return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
 }
Example #25
0
 public function cloneDependencies($a_target_id, $a_copy_id)
 {
     parent::cloneDependencies($a_target_id, $a_copy_id);
     // clone taxonomies
     include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
     $all_tax = ilObjTaxonomy::getUsageOfObject($this->getId());
     if (sizeof($all_tax)) {
         include_once "./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php";
         $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
         $mappings = $cwo->getMappings();
         foreach ($all_tax as $old_tax_id) {
             if ($old_tax_id) {
                 // clone it
                 $old_tax = new ilObjTaxonomy($old_tax_id);
                 $new_tax = $old_tax->cloneObject(0, 0, true);
                 $tax_map = $old_tax->getNodeMapping();
                 // assign new taxonomy to new category
                 ilObjTaxonomy::saveUsage($new_tax->getId(), ilObject::_lookupObjId($a_target_id));
                 // clone assignments (for all sub-items)
                 foreach ($mappings as $old_ref_id => $new_ref_id) {
                     if ($old_ref_id != $new_ref_id) {
                         $old_obj_id = ilObject::_lookupObjId($old_ref_id);
                         $new_obj_id = ilObject::_lookupObjId($new_ref_id);
                         $obj_type = ilObject::_lookupType($old_obj_id);
                         $tax_ass = new ilTaxNodeAssignment($obj_type, $old_obj_id, "obj", $old_tax_id);
                         $assignmts = $tax_ass->getAssignmentsOfItem($old_obj_id);
                         if (sizeof($assignmts)) {
                             $new_tax_ass = new ilTaxNodeAssignment($obj_type, $new_obj_id, "obj", $new_tax->getId());
                             foreach ($assignmts as $a) {
                                 if ($tax_map[$a["node_id"]]) {
                                     $new_tax_ass->addAssignment($tax_map[$a["node_id"]], $new_obj_id);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #26
0
 protected function updateTaxonomySettingsObject()
 {
     $taxonomies = $this->getTaxonomiesForRefId();
     if (sizeof($taxonomies)) {
         $form = $this->initTaxonomyForm($taxonomies);
         if ($form->checkInput()) {
             $sblock = $form->getInput("sblock");
             $prefix = self::CONTAINER_SETTING_TAXBLOCK;
             ilContainer::_deleteContainerSettings($this->object->getId(), $prefix . "%", true);
             if (is_array($sblock)) {
                 foreach ($sblock as $tax_id) {
                     ilContainer::_writeContainerSetting($this->object->getId(), $prefix . $tax_id, 1);
                 }
             }
             ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
         }
     }
     $this->ctrl->redirect($this, "editTaxonomySettings");
 }
Example #27
0
 /**
  * Overwritten read method
  *
  * @access public
  * @param
  * @return
  */
 public function read()
 {
     global $tree;
     parent::read();
     // Inherit order type from parent course (if exists)
     include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
     $this->setOrderType(ilContainerSortingSettings::_lookupSortMode($this->getId()));
 }
Example #28
0
 /**
  * Check if auto rating is active for parent group/course
  * 
  * @param string $a_type
  * @param int $a_ref_id
  * @return bool
  */
 public static function hasAutoRating($a_type, $a_ref_id)
 {
     global $tree;
     if (!$a_ref_id || !in_array($a_type, array("file", "lm", "wiki"))) {
         return false;
     }
     // find parent container
     $parent_ref_id = $tree->checkForParentType($a_ref_id, "grp");
     if (!$parent_ref_id) {
         $parent_ref_id = $tree->checkForParentType($a_ref_id, "crs");
     }
     if ($parent_ref_id) {
         include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
         // get auto rate setting
         $parent_obj_id = ilObject::_lookupObjId($parent_ref_id);
         return ilContainer::_lookupContainerSetting($parent_obj_id, ilObjectServiceSettingsGUI::AUTO_RATING_NEW_OBJECTS, false);
     }
     return false;
 }
Example #29
0
 function getOrderType()
 {
     if ($this->enabledObjectiveView()) {
         return ilContainer::SORT_MANUAL;
     }
     return parent::getOrderType();
 }
 /**
  * Overwriten Metadata update listener for ECS functionalities
  *
  * @access public
  * 
  */
 public function MDUpdateListener($a_element)
 {
     global $ilLog;
     parent::MDUpdateListener($a_element);
     switch ($a_element) {
         case 'General':
             // Update ecs content
             include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
             $ecs = new ilECSCourseSettings($this);
             $ecs->handleContentUpdate();
             break;
         default:
             return true;
     }
 }