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(), ""); }
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(); }
/** * Save container settings * @return */ protected function saveSettings() { global $ilTabs; $this->checkPermission('write'); $ilTabs->activateTab('id_settings'); $this->initFormSettings(); if ($this->form->checkInput()) { $this->object->setTitle($this->form->getInput('tit')); $this->object->setDescription($this->form->getInput('des')); $this->object->update(); include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sort = new ilContainerSortingSettings($this->object->getId()); $sort->setSortMode($this->form->getInput('sor')); $sort->update(); ilUtil::sendSuccess($this->lng->txt('settings_saved'), true); $this->ctrl->redirect($this, 'settings'); } $this->form->setValuesByPost(); ilUtil::sendFailure($this->lng->txt('err_check_input')); $this->tpl->setContent($this->form->getHTML()); }
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(); }
/** * 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; } }
/** * 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(); }
/** * Clone container settings * * @access public * @param int target ref_id * @param int copy id * @return object new object */ public function cloneObject($a_target_id, $a_copy_id = 0) { global $ilLog; $new_obj = parent::cloneObject($a_target_id, $a_copy_id); include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sorting = new ilContainerSortingSettings($new_obj->getId()); $sorting->setSortMode($this->getOrderType()); $sorting->update(); // copy content page // $ilLog->write("copy container, lookup page"); include_once "./Services/Container/classes/class.ilContainerPage.php"; if (ilContainerPage::_exists("cont", $this->getId())) { //$ilLog->write("...page found"); $orig_page = new ilContainerPage($this->getId()); $orig_page->copy($new_obj->getId(), "cont", $new_obj->getId()); /*$new_page_object = new ilContainerPage(); $new_page_object->setParentId($new_obj->getId()); $new_page_object->setId($new_obj->getId()); $new_page_object->createFromXML(); $new_page_object->setXMLContent($orig_page->getXMLContent()); $new_page_object->buildDom(true); $new_page_object->update();*/ //$ilLog->write("...copy ml"); // copy (page) multilang settings /*include_once("./Services/COPage/classes/class.ilPageMultiLang.php"); $ml = new ilPageMultiLang("cont", $this->getId()); $ml->copy("cont", $new_obj->getId());*/ } return $new_obj; }
/** * 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()); } }
/** * Clone container settings * * @access public * @param int target ref_id * @param int copy id * @return object new object */ public function cloneObject($a_target_id, $a_copy_id = 0) { $new_obj = parent::cloneObject($a_target_id, $a_copy_id); include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sorting = new ilContainerSortingSettings($new_obj->getId()); $sorting->setSortMode($this->getOrderType()); $sorting->update(); // copy content page include_once "./Services/COPage/classes/class.ilPageObject.php"; if (ilPageObject::_exists($this->getType(), $this->getId())) { $orig_page = new ilPageObject($this->getType(), $this->getId()); $new_page_object = new ilPageObject($this->getType()); $new_page_object->setParentId($new_obj->getId()); $new_page_object->setId($new_obj->getId()); $new_page_object->createFromXML(); $new_page_object->setXMLContent($orig_page->getXMLContent()); $new_page_object->buildDom(); $new_page_object->update(); } return $new_obj; }
/** * Clone container settings * * @access public * @param int target ref_id * @param int copy id * @return object new object */ public function cloneObject($a_target_id, $a_copy_id = 0) { global $ilLog; $new_obj = parent::cloneObject($a_target_id, $a_copy_id); include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sorting = new ilContainerSortingSettings($new_obj->getId()); $sorting->setSortMode($this->getOrderType()); $sorting->update(); // copy content page include_once "./Services/Container/classes/class.ilContainerPage.php"; if (ilContainerPage::_exists("cont", $this->getId())) { $orig_page = new ilContainerPage($this->getId()); $orig_page->copy($new_obj->getId(), "cont", $new_obj->getId()); } // #10271 - copy start objects page include_once "./Services/Container/classes/class.ilContainerStartObjectsPage.php"; if (ilContainerStartObjectsPage::_exists("cstr", $this->getId())) { $orig_page = new ilContainerStartObjectsPage($this->getId()); $orig_page->copy($new_obj->getId(), "cstr", $new_obj->getId()); } // #10271 foreach (self::_getContainerSettings($this->getId()) as $keyword => $value) { self::_writeContainerSetting($new_obj->getId(), $keyword, $value); // copy custom icons if ($keyword == "icon_custom" && $value) { // see saveIcons() $new_obj->createContainerDirectory(); $tgt_dir = $new_obj->getContainerDirectory(); $src_dir = $this->getContainerDirectory(); $file = "icon_custom.svg"; $src_file = $src_dir . "/" . $file; if (file_exists($src_file)) { copy($src_file, $tgt_dir . "/" . $file); } } } return $new_obj; }
/** * update GroupObject * @param bool update group type * @access public */ public function updateObject() { global $ilErr; $this->checkPermission('write'); $this->initForm(); $this->form->checkInput(); $old_type = $this->object->getGroupType(); $this->load(); $ilErr->setMessage(''); if (!$this->object->validate()) { $err = $this->lng->txt('err_check_input'); ilUtil::sendFailure($err); $err = $ilErr->getMessage(); ilUtil::sendInfo($err); $this->editObject(); return true; } $modified = false; if ($this->object->isGroupTypeModified($old_type) and !$update_group_type) { $modified = true; $this->object->setGroupType($old_type); } $this->object->update(); include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php'; ilObjectServiceSettingsGUI::updateServiceSettingsForm($this->object->getId(), $this->form, array(ilObjectServiceSettingsGUI::CALENDAR_VISIBILITY, ilObjectServiceSettingsGUI::NEWS_VISIBILITY)); // Save sorting include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sort = new ilContainerSortingSettings($this->object->getId()); $sort->setSortMode((int) $_POST['sor']); $sort->update(); // BEGIN ChangeEvents: Record update Object. require_once 'Services/Tracking/classes/class.ilChangeEvent.php'; global $ilUser; ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update'); ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId()); // END PATCH ChangeEvents: Record update Object. // Update ecs export settings include_once 'Modules/Group/classes/class.ilECSGroupSettings.php'; $ecs = new ilECSGroupSettings($this->object); $ecs->handleSettingsUpdate(); if ($modified) { include_once './Services/Utilities/classes/class.ilConfirmationGUI.php'; ilUtil::sendQuestion($this->lng->txt('grp_warn_grp_type_changed')); $confirm = new ilConfirmationGUI(); $confirm->setFormAction($this->ctrl->getFormAction($this)); $confirm->addItem('grp_type', $this->object->getGroupType(), $this->lng->txt('grp_info_new_grp_type') . ': ' . ($this->object->getGroupType() == GRP_TYPE_CLOSED ? $this->lng->txt('il_grp_status_open') : $this->lng->txt('il_grp_status_closed'))); $confirm->addButton($this->lng->txt('grp_change_type'), 'updateGroupType'); $confirm->setCancel($this->lng->txt('cancel'), 'edit'); $this->tpl->setContent($confirm->getHTML()); return true; } else { ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->ctrl->redirect($this, 'edit'); return true; } }
/** * save object * * @global ilTree * @access public * @return */ public function saveObject() { global $ilErr, $ilUser, $tree; $this->object = new ilObjGroup(); // we reduced the form, only 3 values left // $this->load(); $grp_type = ilUtil::stripSlashes($_POST['grp_type']); switch ($grp_type) { case GRP_TYPE_PUBLIC: $this->object->setRegistrationType(GRP_REGISTRATION_DIRECT); break; default: $this->object->setRegistrationType(GRP_REGISTRATION_DEACTIVATED); break; } $this->object->setTitle(ilUtil::stripSlashes($_POST['title'])); $this->object->setDescription(ilUtil::stripSlashes($_POST['desc'])); $this->object->setGroupType(ilUtil::stripSlashes($_POST['grp_type'])); $this->object->setViewMode(ilContainer::VIEW_INHERIT); $ilErr->setMessage(''); if (!$this->object->validate()) { $err = $this->lng->txt('err_check_input'); ilUtil::sendFailure($err); $err = $ilErr->getMessage(); ilUtil::sendInfo($err); $this->createObject(); return true; } $this->object->create(); $this->putObjectInTree($this->object, $_GET["ref_id"]); $this->object->initGroupStatus($this->object->getGroupType()); // check for parent group or course => SORT_INHERIT $sort_mode = ilContainer::SORT_TITLE; if ($GLOBALS['tree']->checkForParentType($this->object->getRefId(), 'crs') || $GLOBALS['tree']->checkForParentType($this->object->getRefId(), 'grp')) { $sort_mode = ilContainer::SORT_INHERIT; } // Save sorting include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sort = new ilContainerSortingSettings($this->object->getId()); $sort->setSortMode($sort_mode); $sort->update(); // Add user as admin and enable notification include_once './Modules/Group/classes/class.ilGroupParticipants.php'; $members_obj = ilGroupParticipants::_getInstanceByObjId($this->object->getId()); $members_obj->add($ilUser->getId(), IL_GRP_ADMIN); $members_obj->updateNotification($ilUser->getId(), 1); ilUtil::sendSuccess($this->lng->txt("grp_added"), true); $this->ctrl->setParameter($this, 'ref_id', $this->object->getRefId()); $this->ctrl->redirect($this, "edit"); }
/** * 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_tiny_icon")->getDeletionFlag()) { $this->object->removeTinyIcon(); } $this->object->saveIcons($_FILES["cont_big_icon"]['tmp_name'], null, $_FILES["cont_tiny_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()); } }