예제 #1
0
 function updateObject()
 {
     $form = $this->initEditForm();
     $form->checkInput();
     $this->object->setTitle(ilUtil::stripSlashes($_POST['title']));
     $this->object->setDescription(ilUtil::stripSlashes($_POST['desc']));
     /*
     $archive_start = $this->loadDate('archive_start');
     $archive_end = $this->loadDate('archive_end');				 
     */
     $period = $form->getItemByPostVar("access_period");
     $sub_period = $form->getItemByPostVar("subscription_period");
     if ((int) $_POST['activation_type']) {
         $this->object->setActivationType(IL_CRS_ACTIVATION_LIMITED);
     } else {
         $this->object->setActivationType(IL_CRS_ACTIVATION_UNLIMITED);
     }
     $this->object->setOfflineStatus(!(bool) $_POST['activation_online']);
     $this->object->setActivationStart($period->getStart()->get(IL_CAL_UNIX));
     $this->object->setActivationEnd($period->getEnd()->get(IL_CAL_UNIX));
     $this->object->setActivationVisibility((int) $_POST['activation_visibility']);
     $sub_type = (int) $_POST['subscription_type'];
     if ($sub_type != IL_CRS_SUBSCRIPTION_DEACTIVATED) {
         $this->object->setSubscriptionType($sub_type);
         if ((int) $_POST['subscription_limitation_type']) {
             $this->object->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_LIMITED);
         } else {
             $this->object->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_UNLIMITED);
         }
     } else {
         $this->object->setSubscriptionType(IL_CRS_SUBSCRIPTION_DIRECT);
         // see ilObjCourse::__createDefaultSettings()
         $this->object->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_DEACTIVATED);
     }
     // save subitems anyways
     $this->object->setSubscriptionPassword(ilUtil::stripSlashes($_POST['subscription_password']));
     $this->object->setSubscriptionStart($sub_period->getStart()->get(IL_CAL_UNIX));
     $this->object->setSubscriptionEnd($sub_period->getEnd()->get(IL_CAL_UNIX));
     $this->object->enableSubscriptionMembershipLimitation((int) $_POST['subscription_membership_limitation']);
     $this->object->setSubscriptionMaxMembers((int) $_POST['subscription_max']);
     $this->object->enableRegistrationAccessCode((int) $_POST['reg_code_enabled']);
     $this->object->setRegistrationAccessCode(ilUtil::stripSlashes($_POST['reg_code']));
     $this->object->enableWaitingList((int) $_POST['waiting_list']);
     #$this->object->setSubscriptionNotify((int) $_POST['subscription_notification']);
     $this->object->setViewMode((int) $_POST['view_mode']);
     if ($this->object->getViewMode() == IL_CRS_VIEW_TIMING) {
         $this->object->setOrderType(ilContainer::SORT_ACTIVATION);
     } else {
         $this->object->setOrderType($form->getInput('sorting'));
     }
     $this->saveSortingSettings($form);
     /*
     		$this->object->setArchiveStart($archive_start->get(IL_CAL_UNIX));
     		$this->object->setArchiveEnd($archive_end->get(IL_CAL_UNIX));		
     		$this->object->setArchiveType($_POST['archive_type']);
     */
     $this->object->setAboStatus((int) $_POST['abo']);
     $this->object->setShowMembers((int) $_POST['show_members']);
     $this->object->setMailToMembersType((int) $_POST['mail_type']);
     $this->object->enableSessionLimit((int) $_POST['sl']);
     $this->object->setNumberOfPreviousSessions(is_numeric($_POST['sp']) ? (int) $_POST['sp'] : -1);
     $this->object->setNumberOfnextSessions(is_numeric($_POST['sn']) ? (int) $_POST['sn'] : -1);
     $this->object->setAutoNotification($_POST['auto_notification'] == 1 ? true : false);
     $show_lp_sync_confirmation = false;
     // could be hidden in form
     if (isset($_POST['status_dt'])) {
         if ($this->object->getStatusDetermination() != ilObjCourse::STATUS_DETERMINATION_LP && (int) $_POST['status_dt'] == ilObjCourse::STATUS_DETERMINATION_LP) {
             $show_lp_sync_confirmation = true;
         } else {
             $this->object->setStatusDetermination((int) $_POST['status_dt']);
         }
     }
     if ($this->object->validate()) {
         $this->object->update();
         // BEGIN ChangeEvent: Record write event
         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 ChangeEvent: Record write event
         include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
         ilObjectServiceSettingsGUI::updateServiceSettingsForm($this->object->getId(), $form, array(ilObjectServiceSettingsGUI::CALENDAR_VISIBILITY, ilObjectServiceSettingsGUI::NEWS_VISIBILITY, ilObjectServiceSettingsGUI::AUTO_RATING_NEW_OBJECTS, ilObjectServiceSettingsGUI::TAG_CLOUD));
         // Update ecs export settings
         include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
         $ecs = new ilECSCourseSettings($this->object);
         if (!$ecs->handleSettingsUpdate()) {
             $this->editObject();
             return false;
         }
         if ($show_lp_sync_confirmation) {
             return $this->confirmLPSync();
         }
         return $this->afterUpdate();
     } else {
         ilUtil::sendFailure($this->object->getMessage());
         $this->editObject();
         return false;
     }
 }
예제 #2
0
 /**
  * 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()) {
             $title = $form->getInput("title");
             $desc = $form->getInput("desc");
             $lang = $this->object->getTranslations();
             $lang = $lang["Fobject"][0]["lang"];
             $this->object->deleteTranslation($lang);
             $this->object->addTranslation($title, $desc, $lang, true);
             $this->object->setTitle($title);
             $this->object->setDescription($desc);
             $this->object->update();
             $this->saveSortingSettings($form);
             // 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
             // services
             include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
             ilObjectServiceSettingsGUI::updateServiceSettingsForm($this->object->getId(), $form, array(ilObjectServiceSettingsGUI::INFO_TAB_VISIBILITY, ilObjectServiceSettingsGUI::NEWS_VISIBILITY, ilObjectServiceSettingsGUI::TAXONOMIES));
             // 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());
     }
 }
 /**
  * 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;
     }
 }