/** * 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())); }
protected function initSorting() { $this->link_sort_mode = ilContainerSortingSettings::_lookupSortMode($this->getParentObject()->object->getId()); }
/** * Read group */ function read() { global $ilDB; parent::read(); $query = "SELECT * FROM grp_settings " . "WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer'); $res = $ilDB->query($query); while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $this->setInformation($row->information); $this->setGroupType($row->grp_type); $this->setRegistrationType($row->registration_type); $this->enableUnlimitedRegistration($row->registration_unlimited); $this->setRegistrationStart(new ilDateTime($row->registration_start, IL_CAL_DATETIME)); $this->setRegistrationEnd(new ilDateTime($row->registration_end, IL_CAL_DATETIME)); $this->setPassword($row->registration_password); $this->enableMembershipLimitation((bool) $row->registration_mem_limit); $this->setMaxMembers($row->registration_max_members); $this->enableWaitingList($row->waiting_list); $this->setLatitude($row->latitude); $this->setLongitude($row->longitude); $this->setLocationZoom($row->location_zoom); $this->setEnableGroupMap($row->enablemap); $this->enableRegistrationAccessCode($row->reg_ac_enabled); $this->setRegistrationAccessCode($row->reg_ac); $this->setViewMode($row->view_mode); $this->setMailToMembersType($row->mail_members_type); } $this->initParticipants(); // Inherit order type from parent course (if exists) include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $this->setOrderType(ilContainerSortingSettings::_lookupSortMode($this->getId())); }
/** * Check if item ordering is enabled * @return bool */ public function isActiveItemOrdering() { if ($this->isActiveOrdering()) { return ilContainerSortingSettings::_lookupSortMode($this->object->getId()) == ilContainer::SORT_MANUAL; } return false; }
/** * Activate tab and subtabs * @param string $a_active_tab * @param string $a_active_subtab [optional] * @return */ protected function activateTabs($a_active_tab, $a_active_subtab = '') { global $ilCtrl, $ilTabs, $lng; switch ($a_active_tab) { case 'content': if ($this->checkPermissionBool('write')) { $this->lng->loadLanguageModule('cntr'); $this->ctrl->setParameter($this, 'switch_mode', self::VIEW_MODE_VIEW); $ilTabs->addSubTab('id_content_view', $lng->txt('view'), $this->ctrl->getLinkTarget($this, 'switchViewMode')); $this->ctrl->setParameter($this, 'switch_mode', self::VIEW_MODE_MANAGE); $ilTabs->addSubTab('id_content_manage', $lng->txt('cntr_manage'), $this->ctrl->getLinkTarget($this, 'switchViewMode')); include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php'; include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; include_once './Services/Container/classes/class.ilContainer.php'; if (ilLinkResourceItems::lookupNumberOfLinks($this->object->getId()) > 1 and ilContainerSortingSettings::_lookupSortMode($this->object->getId()) == ilContainer::SORT_MANUAL) { $this->ctrl->setParameter($this, 'switch_mode', self::VIEW_MODE_SORT); $ilTabs->addSubTab('id_content_ordering', $this->lng->txt('cntr_ordering'), $this->ctrl->getLinkTarget($this, 'switchViewMode')); } $ilCtrl->clearParameters($this); $ilTabs->activateSubTab($a_active_subtab); } } $ilTabs->activateTab('id_content'); }
/** * Write webresource xml * @param ilXmlWriter $writer * @return */ public function toXML(ilXmlWriter $writer) { $attribs = array("obj_id" => "il_" . IL_INST_ID . "_webr_" . $this->getId()); $writer->xmlStartTag('WebLinks', $attribs); // LOM MetaData include_once 'Services/MetaData/classes/class.ilMD2XML.php'; $md2xml = new ilMD2XML($this->getId(), $this->getId(), 'webr'); $md2xml->startExport(); $writer->appendXML($md2xml->getXML()); // Sorting include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; switch (ilContainerSortingSettings::_lookupSortMode($this->getId())) { case ilContainer::SORT_MANUAL: $writer->xmlElement('Sorting', array('type' => 'Manual')); break; case ilContainer::SORT_TITLE: default: $writer->xmlElement('Sorting', array('type' => 'Title')); break; } // All links include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php'; $links = new ilLinkResourceItems($this->getId()); $links->toXML($writer); $writer->xmlEndTag('WebLinks'); return true; }
/** * read * * @access public * @param * @return */ public function read() { parent::read(); include_once "./Services/Container/classes/class.ilContainerSortingSettings.php"; $this->setOrderType(ilContainerSortingSettings::_lookupSortMode($this->getId())); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $this->setStyleSheetId((int) ilObjStyleSheet::lookupObjectStyle($this->getId())); }
/** * Sort items (sorting mode depends on sorting setting) * @param object $a_items * @return */ public function sortItems($a_items) { include_once './Services/Container/classes/class.ilContainer.php'; include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $mode = ilContainerSortingSettings::_lookupSortMode($this->getLinkResourceId()); if ($mode == ilContainer::SORT_TITLE) { $a_items = ilUtil::sortArray($a_items, 'title', 'asc', false, true); return $a_items; } if ($mode == ilContainer::SORT_MANUAL) { include_once './Services/Container/classes/class.ilContainerSorting.php'; $pos = ilContainerSorting::lookupPositions($this->getLinkResourceId()); foreach ($a_items as $link_id => $item) { if (isset($pos[$link_id])) { $sorted[$link_id] = $item; $sorted[$link_id]['position'] = $pos[$link_id]; } else { $unsorted[$link_id] = $item; } } $sorted = ilUtil::sortArray((array) $sorted, 'position', 'asc', true, true); $unsorted = ilUtil::sortArray((array) $unsorted, 'title', 'asc', false, true); $a_items = (array) $sorted + (array) $unsorted; return $a_items; } return $a_items; }
/** * Read * * @access private * */ private function read() { if (!$this->obj_id) { return true; } include_once 'Services/Container/classes/class.ilContainerSortingSettings.php'; $this->manual_sort_enabled = ilContainerSortingSettings::_isManualSortingEnabled($this->obj_id); $this->sorting_mode = ilContainerSortingSettings::_lookupSortMode($this->obj_id); $query = "SELECT * FROM container_sorting " . "WHERE obj_id = " . $this->db->quote($this->obj_id, 'integer') . " ORDER BY position"; $res = $this->db->query($query); while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { if ($row->parent_id) { $this->sorting[$row->parent_type][$row->parent_id][$row->child_id] = $row->position; } else { $this->sorting['all'][$row->child_id] = $row->position; } } return true; }
/** * 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 = "") { $this->cur_row_type = $this->cur_row_type == "row_type_1" ? "row_type_2" : "row_type_1"; $a_tpl->touchBlock($this->cur_row_type); $nbsp = true; if ($this->ilias->getSetting("icon_position_in_lists") == "item_rows") { $icon = ilUtil::getImagePath("icon_" . $a_image_type . ".png"); $alt = $this->lng->txt("obj_" . $a_image_type); // custom icon if ($this->ilias->getSetting("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", $alt); $a_tpl->parseCurrentBlock(); $nbsp = false; } if ($this->isActiveAdministrationPanel()) { $a_tpl->setCurrentBlock("block_row_check"); $a_tpl->setVariable("ITEM_ID", $a_item_ref_id); $a_tpl->parseCurrentBlock(); $nbsp = false; } include_once 'Services/Container/classes/class.ilContainerSortingSettings.php'; if ($this->isActiveAdministrationPanel() && ilContainerSortingSettings::_lookupSortMode($this->object->getId()) == ilContainer::SORT_MANUAL) { $a_tpl->setCurrentBlock('block_position'); $a_tpl->setVariable('POS_TYPE', $a_image_type); $a_tpl->setVariable('POS_ID', $a_item_ref_id); $a_tpl->setVariable('POSITION', sprintf('%.1f', $this->current_position++)); $a_tpl->parseCurrentBlock(); } if ($nbsp) { $a_tpl->setVariable("ROW_NBSP", " "); } $a_tpl->setCurrentBlock("container_standard_row"); $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html); $a_tpl->parseCurrentBlock(); $a_tpl->touchBlock("container_row"); }