示例#1
0
 protected function updateCustom(ilPropertyFormGUI $a_form)
 {
     /**
      * @var $ilSetting ilSetting
      */
     global $ilSetting;
     $view = (int) $_POST['default_view'];
     if ($view == ilForumProperties::VIEW_DATE) {
         $view = ilForumProperties::VIEW_DATE_ASC;
         if ((int) $_POST['default_view_sort_dir'] == ilForumProperties::VIEW_DATE_DESC) {
             $view = ilForumProperties::VIEW_DATE_DESC;
         }
     }
     $this->objProperties->setDefaultView($view);
     // BUGFIX FOR 11271
     if (isset($_SESSION['viewmode'])) {
         $_SESSION['viewmode'] = $view;
     }
     if ($ilSetting->get('enable_anonymous_fora') || $this->objProperties->isAnonymized()) {
         $this->objProperties->setAnonymisation((int) $a_form->getInput('anonymized'));
     }
     if ($ilSetting->get('enable_fora_statistics', false)) {
         $this->objProperties->setStatisticsStatus((int) $a_form->getInput('statistics_enabled'));
     }
     $this->objProperties->setPostActivation((int) $a_form->getInput('post_activation'));
     $this->objProperties->setSubjectSetting($a_form->getInput('subject_setting'));
     $this->objProperties->setMarkModeratorPosts((int) $a_form->getInput('mark_mod_posts'));
     $this->objProperties->setThreadSorting((int) $a_form->getInput('thread_sorting'));
     $this->objProperties->setIsThreadRatingEnabled((bool) $a_form->getInput('thread_rating'));
     $this->objProperties->update();
 }
 protected function afterSave(ilObjForum $forumObj)
 {
     /**
      * @var $rbacadmin ilRbacAdmin
      */
     global $rbacadmin;
     // save settings
     $this->objProperties->setObjId($forumObj->getId());
     $this->objProperties->setDefaultView(1);
     $this->objProperties->setAnonymisation(0);
     $this->objProperties->setStatisticsStatus(0);
     $this->objProperties->setPostActivation(0);
     $this->objProperties->setThreadSorting(0);
     $this->objProperties->insert();
     $forumObj->createSettings();
     // ...finally assign moderator role to creator of forum object
     $roles = array();
     $roles[0] = ilObjForum::_lookupModeratorRole($forumObj->getRefId());
     $rbacadmin->assignUser($roles[0], $forumObj->getOwner(), 'n');
     // insert new forum as new topic into frm_data
     $forumObj->saveData($roles);
     // always send a message
     ilUtil::sendSuccess($this->lng->txt('frm_added'), true);
     $this->ctrl->setParameter($this, 'ref_id', $forumObj->getRefId());
     ilUtil::redirect($this->ctrl->getLinkTarget($this, 'createThread', '', false, false));
 }