/**
  * Validates an option.
  * 
  * @param	string		$key		option name
  * @param	array		$option		option data
  */
 protected function validateOption($key, $option)
 {
     parent::validateOption($key, $option);
     if ($option['required'] && empty($this->activeOptions[$key]['optionValue'])) {
         throw new UserInputException($option['optionName']);
     }
 }
 /**
  * @see Page::show()
  */
 public function show()
 {
     // set active menu item
     WCFACP::getMenu()->setActiveMenuItem($this->menuItemName);
     // check permission
     WCF::getUser()->checkPermission($this->permission);
     // get user options and categories from cache
     $this->readCache();
     // show form
     parent::show();
 }
 /**
  * @see DynamicOptionListForm::readCache()
  */
 protected function readCache()
 {
     parent::readCache();
     WCF::getCache()->addResource('admin_tools_functions-' . PACKAGE_ID, WCF_DIR . 'cache/cache.admin_tools_functions-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderAdminToolsFunction.class.php');
     $this->functions = WCF::getCache()->get('admin_tools_functions-' . PACKAGE_ID);
 }
Esempio n. 4
0
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // store search result in database
     $data = serialize(array('matches' => $this->matches));
     $sql = "INSERT INTO wcf" . WCF_N . "_search\n\t\t\t\t(userID, searchData,\n\t\t\t\t searchDate, searchType)\n\t\t\t\tVALUES\n\t\t\t\t(" . WCF::getUser()->userID . ", '" . escapeString($data) . "',\n\t\t\t\t " . TIME_NOW . ", 'fleets')";
     unset($data);
     // save memory
     WCF::getDB()->sendQuery($sql);
     unset($sql);
     // save memory
     // get new search id
     $this->searchID = WCF::getDB()->getInsertID();
     $this->saved();
     // forward to result page
     header('Location: index.php?page=FleetList&searchID=' . $this->searchID . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * @see DynamicOptionListForm::checkOption()
  */
 protected function checkOption($optionName)
 {
     if (!DynamicOptionListForm::checkOption($optionName)) {
         return false;
     }
     $option = $this->cachedOptions[$optionName];
     // show options visible for and editable by user
     return $option['editable'] <= 1 && !$option['disabled'];
 }
 /**
  * @see Page::show()	 
  */
 public function show()
 {
     WCFACP::getMenu()->setActiveMenuItem($this->activeMenuItem);
     $this->readCache();
     //WCF::getUser()->checkPermission('admin.headermenu.canAddItem');
     parent::show();
 }
Esempio n. 7
0
 /**
  * @see DynamicOptionListForm::checkOption()
  */
 protected function checkOption($optionName)
 {
     if (!parent::checkOption($optionName)) {
         return false;
     }
     $option = $this->cachedOptions[$optionName];
     return $option['hidden'] != 1;
 }