Exemplo n.º 1
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::create()
  */
 public function create()
 {
     $showOrder = 0;
     if (isset($this->parameters['data']['showOrder'])) {
         $showOrder = $this->parameters['data']['showOrder'];
         unset($this->parameters['data']['showOrder']);
     }
     $notice = parent::create();
     $noticeEditor = new NoticeEditor($notice);
     $noticeEditor->setShowOrder($showOrder);
     return new Notice($notice->noticeID);
 }
Exemplo n.º 2
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     $this->objectAction = new NoticeAction(array(), 'create', array('data' => array_merge($this->additionalFields, array('cssClassName' => $this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName, 'isDisabled' => $this->isDisabled, 'isDismissible' => $this->isDismissible, 'notice' => I18nHandler::getInstance()->isPlainValue('notice') ? I18nHandler::getInstance()->getValue('notice') : '', 'noticeName' => $this->noticeName, 'noticeUseHtml' => $this->noticeUseHtml, 'showOrder' => $this->showOrder))));
     $returnValues = $this->objectAction->executeAction();
     if (!I18nHandler::getInstance()->isPlainValue('notice')) {
         I18nHandler::getInstance()->save('notice', 'wcf.notice.notice.notice' . $returnValues['returnValues']->noticeID, 'wcf.notice', 1);
         // update notice name
         $noticeEditor = new NoticeEditor($returnValues['returnValues']);
         $noticeEditor->update(array('notice' => 'wcf.notice.notice.notice' . $returnValues['returnValues']->noticeID));
     }
     // transform conditions array into one-dimensional array
     $conditions = array();
     foreach ($this->groupedConditionObjectTypes as $groupedObjectTypes) {
         foreach ($groupedObjectTypes as $objectTypes) {
             if (is_array($objectTypes)) {
                 $conditions = array_merge($conditions, $objectTypes);
             } else {
                 $conditions[] = $objectTypes;
             }
         }
     }
     ConditionHandler::getInstance()->createConditions($returnValues['returnValues']->noticeID, $conditions);
     $this->saved();
     // reset values
     $this->cssClassName = '';
     $this->customCssClassName = '';
     $this->isDisabled = 0;
     $this->isDismissible = 0;
     $this->noticeName = '';
     $this->noticeUseHtml = 0;
     $this->showOrder = 0;
     I18nHandler::getInstance()->reset();
     foreach ($conditions as $condition) {
         $condition->getProcessor()->reset();
     }
     WCF::getTPL()->assign('success', true);
 }