/** * handler for begin of element * * @param resource $a_xml_parser xml parser * @param string $a_name element name * @param array $a_attribs element attributes array */ public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs) { global $ilErr; switch ($a_name) { case 'Folder': break; case 'Sorting': include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sort = new ilContainerSortingSettings($this->getFolder()->getId()); $sort->delete(); switch ($a_attribs['type']) { case 'Manual': $sort->setSortMode(ilContainer::SORT_MANUAL); break; case 'Title': default: $sort->setSortMode(ilContainer::SORT_TITLE); } $sort->save(); break; case 'Title': case 'Description': break; } }
/** * Write XML * @return * @throws UnexpectedValueException Thrown if obj_id is not of type webr or no obj_id is given */ public function write() { $this->init(); if ($this->add_header) { $this->buildHeader(); } $this->xmlStartTag('Folder', array('Id' => $this->folder->getId())); $this->xmlElement('Title', array(), $this->folder->getTitle()); $this->xmlElement('Description', array(), $this->folder->getDescription()); include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; ilContainerSortingSettings::_exportContainerSortingSettings($this, $this->obj_id); $this->xmlEndTag('Folder'); }
/** * 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(); } }
/** * handler for begin of element * * @param resource $a_xml_parser xml parser * @param string $a_name element name * @param array $a_attribs element attributes array */ public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs) { global $ilErr; switch ($a_name) { case 'Folder': break; case 'Sorting': case 'Sort': include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; ilContainerSortingSettings::_importContainerSortingSettings($a_attribs, $this->getFolder()->getId()); break; case 'Title': case 'Description': break; } }
/** * 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'); }
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(); } }
function __initContainerSorting($a_attribs, $a_group_id) { include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; ilContainerSortingSettings::_importContainerSortingSettings($a_attribs, $a_group_id); }
/** * 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"); }
/** * handler for begin of element */ function handlerBeginTag($a_xml_parser, $a_name, $a_attribs) { global $ilErr; switch ($a_name) { // GROUP DATA case "group": #if($a_attribs["exportVersion"] < EXPORT_VERSION) #{ # $ilErr->raiseError("!!! This export Version isn't supported, update your ILIAS 2 installation" # ,$ilErr->WARNING); #} // DEFAULT $this->group_data["admin"] = array(); $this->group_data["member"] = array(); $this->group_data["type"] = $a_attribs["type"]; $this->group_data["id"] = $a_attribs["id"]; break; case 'title': break; case "owner": $this->group_data["owner"] = $a_attribs["id"]; break; case 'registration': $this->group_data['registration_type'] = $a_attribs['type']; $this->group_data['waiting_list_enabled'] = $a_attribs['waitingList'] == 'Yes' ? true : false; break; case 'maxMembers': $this->group_data['max_members_enabled'] = $a_attribs['enabled'] == 'Yes' ? true : false; break; case "admin": if (!isset($a_attribs['action']) || $a_attribs['action'] == "Attach") { $this->group_data["admin"]["attach"][] = $a_attribs["id"]; } elseif (isset($a_attribs['action']) || $a_attribs['action'] == "Detach") { $this->group_data["admin"]["detach"][] = $a_attribs["id"]; } if (isset($a_attribs['notification']) and $a_attribs['notification'] == 'Yes') { $this->group_data['notifications'][] = $a_attribs['id']; } break; case "member": if (!isset($a_attribs['action']) || $a_attribs['action'] == "Attach") { $GLOBALS['ilLog']->write(__METHOD__ . ': new member with id ' . $a_attribs['id']); $this->group_data["member"]["attach"][] = $a_attribs["id"]; } elseif (isset($a_attribs['action']) || $a_attribs['action'] == "Detach") { $GLOBALS['ilLog']->write(__METHOD__ . ': deprecated member with id ' . $a_attribs['id']); $this->group_data["member"]["detach"][] = $a_attribs["id"]; } break; case "folder": // NOW SAVE THE NEW OBJECT (if it hasn't been imported) $this->__save(); break; case "file": // NOW SAVE THE NEW OBJECT (if it hasn't been imported) $this->__save(); $this->file["fileName"] = $a_attribs["fileName"]; $this->file["id"] = $a_attribs["id"]; // SAVE IT $this->__saveFile(); break; case 'ContainerSetting': $this->current_container_setting = $a_attribs['id']; break; case 'Sort': // NOW SAVE THE NEW OBJECT (if it hasn't been imported) $this->__save(); include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; ilContainerSortingSettings::_importContainerSortingSettings($a_attribs, $this->group_obj->getId()); break; } }
/** * init create/edit form * * @access protected * @param string edit or create * @return */ protected function initForm($a_mode = 'edit') { global $ilUser, $tpl, $tree; if (is_object($this->form)) { return true; } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); switch ($a_mode) { case 'edit': $this->form->setFormAction($this->ctrl->getFormAction($this, 'update')); break; default: $this->form->setTableWidth('600px'); $this->form->setFormAction($this->ctrl->getFormAction($this, 'save')); break; } // title $title = new ilTextInputGUI($this->lng->txt('title'), 'title'); $title->setSubmitFormOnEnter(true); $title->setValue($this->object->getTitle()); $title->setSize(40); $title->setMaxLength(128); $title->setRequired(true); $this->form->addItem($title); // desc $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc'); $desc->setValue($this->object->getLongDescription()); $desc->setRows(2); $desc->setCols(40); $this->form->addItem($desc); // Group type $grp_type = new ilRadioGroupInputGUI($this->lng->txt('grp_typ'), 'grp_type'); if ($a_mode == 'edit') { $type = $this->object->getGroupType() ? $this->object->getGroupType() : $this->object->readGroupStatus(); } else { $type = $this->object->getGroupType() ? $this->object->getGroupType() : GRP_TYPE_PUBLIC; } $grp_type->setValue($type); $grp_type->setRequired(true); // PUBLIC GROUP $opt_public = new ilRadioOption($this->lng->txt('grp_public'), GRP_TYPE_PUBLIC, $this->lng->txt('grp_public_info')); $grp_type->addOption($opt_public); // CLOSED GROUP $opt_closed = new ilRadioOption($this->lng->txt('grp_closed'), GRP_TYPE_CLOSED, $this->lng->txt('grp_closed_info')); $grp_type->addOption($opt_closed); if ($a_mode == 'update_group_type') { $grp_type->setAlert($this->lng->txt('grp_type_changed_info')); } $this->form->addItem($grp_type); if ($a_mode == 'edit') { // Group registration ############################################################ $pres = new ilFormSectionHeaderGUI(); $pres->setTitle($this->lng->txt('grp_setting_header_registration')); $this->form->addItem($pres); // Registration type $reg_type = new ilRadioGroupInputGUI($this->lng->txt('group_registration_mode'), 'registration_type'); $reg_type->setValue($this->object->getRegistrationType()); $opt_dir = new ilRadioOption($this->lng->txt('grp_reg_direct'), GRP_REGISTRATION_DIRECT); #$this->lng->txt('grp_reg_direct_info')); $reg_type->addOption($opt_dir); $opt_pass = new ilRadioOption($this->lng->txt('grp_pass_request'), GRP_REGISTRATION_PASSWORD); $pass = new ilTextInputGUI('', 'password'); $pass->setInfo($this->lng->txt('grp_reg_password_info')); $pass->setValue($this->object->getPassword()); $pass->setSize(10); $pass->setMaxLength(32); $opt_pass->addSubItem($pass); $reg_type->addOption($opt_pass); $opt_req = new ilRadioOption($this->lng->txt('grp_reg_request'), GRP_REGISTRATION_REQUEST, $this->lng->txt('grp_reg_request_info')); $reg_type->addOption($opt_req); $opt_deact = new ilRadioOption($this->lng->txt('grp_reg_disabled'), GRP_REGISTRATION_DEACTIVATED, $this->lng->txt('grp_reg_disabled_info')); $reg_type->addOption($opt_deact); // Registration codes $reg_code = new ilCheckboxInputGUI($this->lng->txt('grp_reg_code'), 'reg_code_enabled'); $reg_code->setChecked($this->object->isRegistrationAccessCodeEnabled()); $reg_code->setValue(1); $reg_code->setInfo($this->lng->txt('grp_reg_code_enabled_info')); $this->form->addItem($reg_type); // time limit $time_limit = new ilCheckboxInputGUI($this->lng->txt('grp_reg_limited'), 'reg_limit_time'); $time_limit->setOptionTitle($this->lng->txt('grp_reg_limit_time')); $time_limit->setChecked($this->object->isRegistrationUnlimited() ? false : true); $this->lng->loadLanguageModule('dateplaner'); include_once './Services/Form/classes/class.ilDateDurationInputGUI.php'; $tpl->addJavaScript('./Services/Form/js/date_duration.js'); $dur = new ilDateDurationInputGUI($this->lng->txt('grp_reg_period'), 'reg'); $dur->setStartText($this->lng->txt('cal_start')); $dur->setEndText($this->lng->txt('cal_end')); $dur->setMinuteStepSize(5); $dur->setShowDate(true); $dur->setShowTime(true); $dur->setStart($this->object->getRegistrationStart()); $dur->setEnd($this->object->getRegistrationEnd()); $time_limit->addSubItem($dur); $this->form->addItem($time_limit); // max member $lim = new ilCheckboxInputGUI($this->lng->txt('reg_grp_max_members_short'), 'registration_membership_limited'); $lim->setValue(1); $lim->setOptionTitle($this->lng->txt('reg_grp_max_members')); $lim->setChecked($this->object->isMembershipLimited()); $max = new ilTextInputGUI('', 'registration_max_members'); $max->setValue($this->object->getMaxMembers() ? $this->object->getMaxMembers() : ''); $max->setTitle($this->lng->txt('members') . ':'); $max->setSize(3); $max->setMaxLength(4); $max->setInfo($this->lng->txt('grp_reg_max_members_info')); $lim->addSubItem($max); $wait = new ilCheckboxInputGUI('', 'waiting_list'); $wait->setValue(1); $wait->setOptionTitle($this->lng->txt('grp_waiting_list')); $wait->setInfo($this->lng->txt('grp_waiting_list_info')); $wait->setChecked($this->object->isWaitingListEnabled() ? true : false); $lim->addSubItem($wait); $this->form->addItem($lim); // Registration codes if (!$this->object->getRegistrationAccessCode()) { include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php'; $this->object->setRegistrationAccessCode(ilMembershipRegistrationCodeUtils::generateCode()); } $reg_link = new ilHiddenInputGUI('reg_code'); $reg_link->setValue($this->object->getRegistrationAccessCode()); $this->form->addItem($reg_link); $link = new ilCustomInputGUI($this->lng->txt('grp_reg_code_link')); include_once './Services/Link/classes/class.ilLink.php'; $val = ilLink::_getLink($this->object->getRefId(), $this->object->getType(), array(), '_rcode' . $this->object->getRegistrationAccessCode()); $link->setHTML('<font class="small">' . $val . '</font>'); $reg_code->addSubItem($link); $this->form->addItem($reg_code); // Group presentation $hasParentCourse = $tree->checkForParentType($this->object->getRefId(), 'crs'); $pres = new ilFormSectionHeaderGUI(); $pres->setTitle($this->lng->txt('grp_setting_header_presentation')); $this->form->addItem($pres); // presentation type $view_type = new ilRadioGroupInputGUI($this->lng->txt('grp_presentation_type'), 'view_mode'); if ($hasParentCourse) { switch ($this->object->getViewMode()) { case ilContainer::VIEW_SESSIONS: $course_view_mode = ' (' . $this->lng->txt('cntr_view_sessions') . ')'; break; case ilContainer::VIEW_SIMPLE: $course_view_mode = ' (' . $this->lng->txt('cntr_view_simple') . ')'; break; case ilContainer::VIEW_BY_TYPE: $course_view_mode = ' (' . $this->lng->txt('cntr_view_by_type') . ')'; break; } $opt = new ilRadioOption($this->lng->txt('grp_view_inherit') . $course_view_mode, ilContainer::VIEW_INHERIT); $opt->setInfo($this->lng->txt('grp_view_inherit_info')); $view_type->addOption($opt); } if ($hasParentCourse && $this->object->getViewMode(false) == ilContainer::VIEW_INHERIT) { $view_type->setValue(ilContainer::VIEW_INHERIT); } else { $view_type->setValue($this->object->getViewMode(true)); } $opt = new ilRadioOption($this->lng->txt('cntr_view_simple'), ilContainer::VIEW_SIMPLE); $opt->setInfo($this->lng->txt('grp_view_info_simple')); $view_type->addOption($opt); $opt = new ilRadioOption($this->lng->txt('cntr_view_by_type'), ilContainer::VIEW_BY_TYPE); $opt->setInfo($this->lng->txt('grp_view_info_by_type')); $view_type->addOption($opt); $this->form->addItem($view_type); $sog = new ilRadioGroupInputGUI($this->lng->txt('sorting_header'), 'sor'); $sog->setRequired(true); if ($a_mode == 'edit') { $sog->setValue(ilContainerSortingSettings::_readSortMode(ilObject::_lookupObjId($this->object->getRefId()))); } elseif ($hasParentCourse) { $sog->setValue(ilContainer::SORT_INHERIT); } else { $sog->setValue(ilContainer::SORT_TITLE); } if ($hasParentCourse) { $sde = new ilRadioOption(); $sde->setValue(ilContainer::SORT_INHERIT); $title = $this->lng->txt('sort_inherit_prefix'); $title .= ' (' . ilContainerSortingSettings::sortModeToString(ilContainerSortingSettings::lookupSortModeFromParentContainer(ilObject::_lookupObjectId($ref_id))) . ') '; $sde->setTitle($title); $sde->setInfo($this->lng->txt('sorting_info_inherit')); $sog->addOption($sde); } $sma = new ilRadioOption(); $sma->setValue(ilContainer::SORT_TITLE); $sma->setTitle($this->lng->txt('sorting_title_header')); $sma->setInfo($this->lng->txt('sorting_info_title')); $sog->addOption($sma); $sti = new ilRadioOption(); $sti->setValue(ilContainer::SORT_MANUAL); $sti->setTitle($this->lng->txt('sorting_manual_header')); $sti->setInfo($this->lng->txt('sorting_info_manual')); $sog->addOption($sti); $this->form->addItem($sog); include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php'; ilObjectServiceSettingsGUI::initServiceSettingsForm($this->object->getId(), $this->form, array(ilObjectServiceSettingsGUI::CALENDAR_VISIBILITY, ilObjectServiceSettingsGUI::NEWS_VISIBILITY)); } switch ($a_mode) { case 'create': $this->form->setTitle($this->lng->txt('grp_new')); $this->form->setTitleIcon(ilUtil::getImagePath('icon_grp.png')); $this->form->addCommandButton('save', $this->lng->txt('grp_new')); $this->form->addCommandButton('cancel', $this->lng->txt('cancel')); return true; case 'edit': $this->form->setTitle($this->lng->txt('grp_edit')); $this->form->setTitleIcon(ilUtil::getImagePath('icon_grp.png')); // Edit ecs export settings include_once 'Modules/Group/classes/class.ilECSGroupSettings.php'; $ecs = new ilECSGroupSettings($this->object); $ecs->addSettingsToForm($this->form, 'grp'); $this->form->addCommandButton('update', $this->lng->txt('save')); $this->form->addCommandButton('cancel', $this->lng->txt('cancel')); return true; case 'update_group_type': $grp_type->setValue($type == GRP_TYPE_PUBLIC ? GRP_TYPE_CLOSED : GRP_TYPE_PUBLIC); $this->form->setTitle($this->lng->txt('grp_edit')); $this->form->setTitleIcon(ilUtil::getImagePath('icon_grp.png')); return true; } return true; }
/** * Read * * @access private * */ private function read() { global $tree; if (!$this->obj_id) { $this->sorting_settings = new ilContainerSortingSettings(); return true; } $this->sorting_settings = ilContainerSortingSettings::getInstanceByObjId($this->obj_id); if ($this->getSortingSettings()->getSortMode() == ilContainer::SORT_INHERIT) { // lookup settings of parent course $ref_ids = ilObject::_getAllReferences($this->obj_id); $ref_id = end($ref_ids); $crs_ref_id = $tree->checkForParentType($ref_id, 'crs'); $crs_obj_id = ilObject::_lookupObjId($crs_ref_id); $crs_settings = ilContainerSortingSettings::getInstanceByObjId($crs_obj_id); $this->sorting_settings = clone $crs_settings; } $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; }
/** * 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())); }
/** * 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; }
/** * Add sorting */ protected function buildSorting() { include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; include_once './Services/Container/classes/class.ilContainer.php'; $sorting = new ilContainerSortingSettings($this->getCategory()->getId()); switch ($sorting->getSortMode()) { case ilContainer::SORT_MANUAL: $type = 'Manual'; break; default: $type = 'Title'; break; } $this->xmlElement('Sorting', array('type' => $type)); }
/** * 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; }
/** * handler for begin of element * * @param resource $a_xml_parser xml parser * @param string $a_name element name * @param array $a_attribs element attributes array */ function handlerBeginTag($a_xml_parser, $a_name, $a_attribs) { if ($this->in_meta_data) { parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs); return; } switch ($a_name) { case 'Course': if (strlen($a_attribs['importId'])) { $this->log->write("CourseXMLParser: importId = " . $a_attribs['importId']); $this->course_obj->setImportId($a_attribs['importId']); ilObject::_writeImportId($this->course_obj->getId(), $a_attribs['importId']); } if (strlen($a_attribs['showMembers'])) { $this->course_obj->setShowMembers($a_attribs['showMembers'] == 'Yes' ? true : false); } break; case 'Admin': if ($id_data = $this->__parseId($a_attribs['id'])) { if ($id_data['local'] or $id_data['imported']) { $this->handleAdmin($a_attribs, $id_data); } } break; case 'Tutor': if ($id_data = $this->__parseId($a_attribs['id'])) { if ($id_data['local'] or $id_data['imported']) { $this->handleTutor($a_attribs, $id_data); } } break; case 'Member': if ($id_data = $this->__parseId($a_attribs['id'])) { if ($id_data['local'] or $id_data['imported']) { $this->handleMember($a_attribs, $id_data); } } break; case 'Subscriber': if ($id_data = $this->__parseId($a_attribs['id'])) { if ($id_data['local'] or $id_data['imported']) { $this->handleSubscriber($a_attribs, $id_data); } } break; case 'WaitingList': if ($id_data = $this->__parseId($a_attribs['id'])) { if ($id_data['local'] or $id_data['imported']) { $this->handleWaitingList($a_attribs, $id_data); } } break; case 'Owner': if ($id_data = $this->__parseId($a_attribs['id'])) { if ($id_data['local'] or $id_data['imported']) { $this->course_obj->setOwner($id_data['usr_id']); $this->course_obj->updateOwner(); } } break; case 'Settings': $this->in_settings = true; break; case 'Availability': $this->in_availability = true; break; case 'NotAvailable': if ($this->in_availability) { $this->course_obj->setActivationType(IL_CRS_ACTIVATION_OFFLINE); } elseif ($this->in_registration) { $this->course_obj->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_DEACTIVATED); } break; case 'Unlimited': if ($this->in_availability) { $this->course_obj->setOfflineStatus(false); $this->course_obj->setActivationType(IL_CRS_ACTIVATION_UNLIMITED); } elseif ($this->in_registration) { $this->course_obj->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_UNLIMITED); } break; case 'TemporarilyAvailable': if ($this->in_availability) { $this->course_obj->setOfflineStatus(false); $this->course_obj->setActivationType(IL_CRS_ACTIVATION_LIMITED); } elseif ($this->in_registration) { $this->course_obj->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_LIMITED); } break; case 'Start': break; case 'End': break; case 'Syllabus': break; case 'Contact': break; case 'Name': case 'Responsibility': case 'Phone': case 'Email': case 'Consultation': break; case 'Registration': $this->in_registration = true; switch ($a_attribs['registrationType']) { case 'Confirmation': $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_CONFIRMATION); break; case 'Direct': $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_DIRECT); break; case 'Password': $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_PASSWORD); break; } $this->course_obj->setSubscriptionMaxMembers((int) $a_attribs['maxMembers']); $this->course_obj->enableSubscriptionMembershipLimitation($this->course_obj->getSubscriptionMaxMembers() > 0); $this->course_obj->setSubscriptionNotify($a_attribs['notification'] == 'Yes' ? true : false); $this->course_obj->enableWaitingList($a_attribs['waitingList'] == 'Yes' ? true : false); break; case 'Sort': include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; ilContainerSortingSettings::_importContainerSortingSettings($a_attribs, $this->course_obj->getId()); break; case 'Archive': $this->in_archive = true; switch ($a_attribs['Access']) { case 'Disabled': $this->course_obj->setArchiveType(IL_CRS_ARCHIVE_NONE); break; case 'Read': $this->course_obj->setArchiveType(IL_CRS_ARCHIVE_NONE); #$this->course_obj->setViewMode(IL_CRS_VIEW_ARCHIVE); break; case 'Download': #$this->course_obj->setViewMode(IL_CRS_VIEW_ARCHIVE); $this->course_obj->setArchiveType(IL_CRS_ARCHIVE_DOWNLOAD); break; } break; case 'Disabled': $this->course_obj->getSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_DEACTIVATED); break; case "MetaData": $this->in_meta_data = true; parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs); break; case 'ContainerSetting': $this->current_container_setting = $a_attribs['id']; break; } }
protected function initSorting() { $this->link_sort_mode = ilContainerSortingSettings::_lookupSortMode($this->getParentObject()->object->getId()); }
/** * 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 afterSave(ilObject $a_new_object) { global $ilUser, $tree; // add default translation $a_new_object->addTranslation($a_new_object->getTitle(), $a_new_object->getDescription(), $ilUser->getPref("language"), true); // default: sort by title include_once 'Services/Container/classes/class.ilContainerSortingSettings.php'; $settings = new ilContainerSortingSettings($a_new_object->getId()); $settings->setSortMode(ilContainer::SORT_TITLE); $settings->save(); // inherit parents content style, if not individual $parent_ref_id = $tree->getParentId($a_new_object->getRefId()); $parent_id = ilObject::_lookupObjId($parent_ref_id); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $style_id = ilObjStyleSheet::lookupObjectStyle($parent_id); if ($style_id > 0) { if (ilObjStyleSheet::_lookupStandard($style_id)) { ilObjStyleSheet::writeStyleUsage($a_new_object->getId(), $style_id); } } // always send a message ilUtil::sendSuccess($this->lng->txt("cat_added"), true); $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId()); $this->redirectToRefId($a_new_object->getRefId(), ""); }
function start() { if ($this->getMode() == self::MODE_SOAP) { $this->__buildHeader(); $this->__buildGroup(); $this->__buildTitleDescription(); $this->__buildRegistration(); if ($this->attach_users) { $this->__buildAdmin(); $this->__buildMember(); } include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; ilContainerSortingSettings::_exportContainerSortingSettings($this, $this->group_obj->getId()); ilContainer::_exportContainerSettings($this, $this->group_obj->getId()); $this->__buildFooter(); } elseif ($this->getMode() == self::MODE_EXPORT) { $this->__buildGroup(); $this->__buildTitleDescription(); $this->__buildRegistration(); include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; ilContainerSortingSettings::_exportContainerSortingSettings($this, $this->group_obj->getId()); ilContainer::_exportContainerSettings($this, $this->group_obj->getId()); $this->__buildFooter(); } }
protected function updateCustom(ilPropertyFormGUI $a_form) { // Save sorting include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sort = new ilContainerSortingSettings($this->object->getId()); $sort->setSortMode($a_form->getInput('sor')); $sort->update(); }
/** * updates object entry in object_data * * @access public */ function updateObject() { 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()) { include_once 'Services/Container/classes/class.ilContainerSortingSettings.php'; $settings = new ilContainerSortingSettings($this->object->getId()); $settings->setSortMode($form->getInput("sorting")); $settings->update(); // save custom icons if ($this->ilias->getSetting("custom_icons")) { if ($form->getItemByPostVar("cont_big_icon")->getDeletionFlag()) { $this->object->removeBigIcon(); } if ($form->getItemByPostVar("cont_small_icon")->getDeletionFlag()) { $this->object->removeSmallIcon(); } if ($form->getItemByPostVar("cont_tiny_icon")->getDeletionFlag()) { $this->object->removeTinyIcon(); } $this->object->saveIcons($_FILES["cont_big_icon"]['tmp_name'], $_FILES["cont_small_icon"]['tmp_name'], $_FILES["cont_tiny_icon"]['tmp_name']); } // 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 // Update ecs export settings include_once 'Modules/Category/classes/class.ilECSCategorySettings.php'; $ecs = new ilECSCategorySettings($this->object); if ($ecs->handleSettingsUpdate()) { return $this->afterUpdate(); } } // display form to correct errors $this->setEditTabs(); $form->setValuesByPost(); $this->tpl->setContent($form->getHTML()); } }
/** * handler for begin of element * * @param resource $a_xml_parser xml parser * @param string $a_name element name * @param array $a_attribs element attributes array */ public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs) { global $ilErr; if ($this->in_metadata) { parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs); return; } switch ($a_name) { case "MetaData": $this->in_metadata = true; // Delete old meta data $md = new ilMD($this->getWebLink()->getId(), 0, 'webr'); $md->deleteAll(); parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs); break; case 'WebLink': $this->current_link_update = false; $this->current_link_delete = false; $this->current_parameters = array(); if ($this->getMode() == self::MODE_CREATE or isset($a_attribs['action']) and $a_attribs['action'] == 'Create') { // New weblink $this->current_link = new ilLinkResourceItems($this->getWebLink()->getId()); } elseif ($this->getMode() == self::MODE_UPDATE and $a_attribs['action'] == 'Delete') { $this->current_link_delete = true; $this->current_link = new ilLinkResourceItems($this->getWebLink()->getId()); $this->current_link->delete($a_attribs['id']); break; } elseif ($this->getMode() == self::MODE_UPDATE and ($a_attribs['action'] == 'Update' or !isset($a_attribs['action']))) { $this->current_link = new ilLinkResourceItems($this->getWebLink()->getId()); $this->current_link->readItem($a_attribs['id']); $this->current_link_update = true; // Delete all dynamic parameter include_once './Modules/WebResource/classes/class.ilParameterAppender.php'; foreach (ilParameterAppender::getParameterIds($this->getWebLink()->getId(), $a_attribs['id']) as $param_id) { $param = new ilParameterAppender($this->getWebLink()->getId()); $param->delete($param_id); } } else { throw new ilWebLinkXmlParserException('Invalid action given for element "Weblink"'); } // Active $this->current_link->setActiveStatus($a_attribs['active'] ? 1 : 0); // Valid if (!isset($a_attribs['valid'])) { $valid = 1; } else { $valid = $a_attribs['valid'] ? 1 : 0; } $this->current_link->setValidStatus($valid); // Disable check $this->current_link->setDisableCheckStatus($a_attribs['disableValidation'] ? 1 : 0); break; case 'Sorting': include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sort = new ilContainerSortingSettings($this->getWebLink()->getId()); $sort->delete(); switch ($a_attribs['type']) { case 'Manual': $sort->setSortMode(ilContainer::SORT_MANUAL); break; case 'Title': default: $sort->setSortMode(ilContainer::SORT_TITLE); } $sort->save(); break; case 'WebLinks': case 'Title': case 'Description': case 'Target': // Nothing to do break; case 'DynamicParameter': $param = new ilParameterAppender($this->getWebLink()->getId()); $param->setName($a_attribs['name']); switch ($a_attribs['type']) { case 'userName': # $GLOBALS['ilLog']->write("VALUE: ".LINKS_LOGIN); $param->setValue(LINKS_LOGIN); break; case 'userId': # $GLOBALS['ilLog']->write("VALUE: ".LINKS_USER_ID); $param->setValue(LINKS_USER_ID); break; case 'matriculation': # $GLOBALS['ilLog']->write("VALUE: ".LINKS_MATRICULATION); $param->setValue(LINKS_MATRICULATION); break; default: throw new ilWebLinkXmlParserException('Invalid attribute "type" given for element "Dynamic parameter". Aborting'); break; } $this->current_parameters[] = $param; break; } }
/** * handler for begin of element */ public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs) { global $ilErr; switch ($a_name) { case "Category": break; case 'Translations': $this->getCategory()->removeTranslations(); break; case 'Translation': $this->current_translation = array(); $this->current_translation['default'] = $a_attribs['default'] ? 1 : 0; $this->current_translation['lang'] = $a_attribs['language']; break; case 'Sorting': include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sort = new ilContainerSortingSettings($this->getCategory()->getId()); switch ($a_attribs['type']) { case 'Manual': $sort->setSortMode(ilContainer::SORT_MANUAL); break; default: $sort->setSortMode(ilContainer::SORT_TITLE); break; } $sort->update(); break; } }
protected function afterSave(ilObject $a_new_object) { include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sort = new ilContainerSortingSettings($a_new_object->getId()); $sort->setSortMode(ilContainer::SORT_INHERIT); $sort->update(); // always send a message ilUtil::sendSuccess($this->lng->txt("fold_added"), true); $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId()); $this->redirectToRefId($a_new_object->getRefId(), ""); }
/** * Save sorting settings * @param ilPropertyFormGUI $form */ protected function saveSortingSettings(ilPropertyFormGUI $form) { include_once 'Services/Container/classes/class.ilContainerSortingSettings.php'; $settings = new ilContainerSortingSettings($this->object->getId()); $settings->setSortMode($form->getInput("sorting")); switch ($form->getInput('sorting')) { case ilContainer::SORT_TITLE: $settings->setSortDirection($form->getInput('title_sorting_direction')); break; case ilContainer::SORT_ACTIVATION: $settings->setSortDirection($form->getInput('activation_sorting_direction')); break; case ilContainer::SORT_CREATION: $settings->setSortDirection($form->getInput('creation_sorting_direction')); break; case ilContainer::SORT_MANUAL: $settings->setSortNewItemsPosition($form->getInput('manual_new_items_position')); $settings->setSortNewItemsOrder($form->getInput('manual_new_items_order')); $settings->setSortDirection($form->getInput('manual_sorting_direction')); break; } $settings->update(); }
function __createDefaultSettings() { global $ilDB; include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php'; $this->setRegistrationAccessCode(ilMembershipRegistrationCodeUtils::generateCode()); $query = "INSERT INTO crs_settings (obj_id,syllabus,contact_name,contact_responsibility," . "contact_phone,contact_email,contact_consultation,activation_type,activation_start," . "activation_end,sub_limitation_type,sub_start,sub_end,sub_type,sub_password,sub_mem_limit," . "sub_max_members,sub_notify,view_mode,archive_start,archive_end,archive_type,abo," . "latitude,longitude,location_zoom,enable_course_map,waiting_list,show_members, " . "session_limit,session_prev,session_next, reg_ac_enabled, reg_ac, auto_notification, status_dt,mail_members_type) " . "VALUES( " . $ilDB->quote($this->getId(), 'integer') . ", " . $ilDB->quote($this->getSyllabus(), 'text') . ", " . $ilDB->quote($this->getContactName(), 'text') . ", " . $ilDB->quote($this->getContactResponsibility(), 'text') . ", " . $ilDB->quote($this->getContactPhone(), 'text') . ", " . $ilDB->quote($this->getContactEmail(), 'text') . ", " . $ilDB->quote($this->getContactConsultation(), 'text') . ", " . $ilDB->quote(0, 'integer') . ", " . $ilDB->quote($this->getActivationStart(), 'integer') . ", " . $ilDB->quote($this->getActivationEnd(), 'integer') . ", " . $ilDB->quote(IL_CRS_SUBSCRIPTION_DEACTIVATED, 'integer') . ", " . $ilDB->quote($this->getSubscriptionStart(), 'integer') . ", " . $ilDB->quote($this->getSubscriptionEnd(), 'integer') . ", " . $ilDB->quote(IL_CRS_SUBSCRIPTION_DIRECT, 'integer') . ", " . $ilDB->quote($this->getSubscriptionPassword(), 'text') . ", " . "0, " . $ilDB->quote($this->getSubscriptionMaxMembers(), 'integer') . ", " . "1, " . "0, " . $ilDB->quote($this->getArchiveStart(), 'integer') . ", " . $ilDB->quote($this->getArchiveEnd(), 'integer') . ", " . $ilDB->quote(IL_CRS_ARCHIVE_NONE, 'integer') . ", " . $ilDB->quote($this->ABO_ENABLED, 'integer') . ", " . $ilDB->quote($this->getLatitude(), 'text') . ", " . $ilDB->quote($this->getLongitude(), 'text') . ", " . $ilDB->quote($this->getLocationZoom(), 'integer') . ", " . $ilDB->quote($this->getEnableCourseMap(), 'integer') . ", " . "1, " . "1," . $ilDB->quote($this->isSessionLimitEnabled(), 'integer') . ', ' . $ilDB->quote($this->getNumberOfPreviousSessions(), 'integer') . ', ' . $ilDB->quote($this->getNumberOfPreviousSessions(), 'integer') . ', ' . $ilDB->quote($this->isRegistrationAccessCodeEnabled(), 'integer') . ', ' . $ilDB->quote($this->getRegistrationAccessCode(), 'text') . ', ' . $ilDB->quote((int) $this->getAutoNotification(), 'integer') . ', ' . $ilDB->quote((int) $this->getStatusDetermination(), 'integer') . ', ' . $ilDB->quote((int) $this->getMailToMembersType(), 'integer') . ' ' . ")"; $res = $ilDB->manipulate($query); $this->__readSettings(); include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sorting = new ilContainerSortingSettings($this->getId()); $sorting->setSortMode(ilContainer::SORT_MANUAL); $sorting->update(); }
/** * handler for begin of element */ public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs) { global $ilErr; switch ($a_name) { case "Category": break; case 'Translations': $this->getCategory()->removeTranslations(); break; case 'Translation': $this->current_translation = array(); $this->current_translation['default'] = $a_attribs['default'] ? 1 : 0; $this->current_translation['lang'] = $a_attribs['language']; break; case 'Sorting': case 'Sort': include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; ilContainerSortingSettings::_importContainerSortingSettings($a_attribs, $this->getCategory()->getId()); break; case 'ContainerSetting': $this->current_container_setting = $a_attribs['id']; break; } }