/** * Event listener * @param XCube_ActionForm $actionForm */ public function inject(XCube_ActionForm $actionForm) { if ($this->_profileExists($actionForm->get('uid'))) { return; } $defaultValues = $this->_getDefaultValues(); /** @var XCube_AbstractProperty[] $properties */ $properties = $actionForm->getFormProperties(); foreach ($defaultValues as $name => $value) { if (isset($properties[$name])) { $properties[$name]->set($value); } } }
function validate() { parent::validate(); if (!count($this->mQueries)) { $this->addErrorMessage(_MD_LEGACY_ERROR_SEARCH_QUERY_REQUIRED); } }
function validate() { parent::validate(); if (!$this->get('is_pm') && !$this->get('is_mail')) { $this->addErrorMessage(_AD_USER_ERROR_MAILJOB_SEND_MEANS); } }
function fetch() { parent::fetch(); if (is_object($this->mState)) { $this->mState->fetch($this); } }
/** * validate uploaded image file. size, extension, etc. * * @param XCube_ActionForm &$result * @param string $path * * @return void */ public static function validateImage(&$actionForm, $path) { if (is_null($actionForm)) { $actionForm = new XCube_ActionForm(); } //check file exists if (!is_uploaded_file($path)) { $actionForm->addErrorMessage(_MD_LEIMG_ERROR_NO_UPLOADED_FILE); } //check extension $info = getimagesize($uploadedFile); if (!in_array($info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPG, IMAGETYPE_PNG))) { $actionForm->addErrorMessage(_MD_LEIMG_ERROR_EXTENSION); } //check max file size $chandler = xoops_gethandler('config'); $conf = $chandler->getConfigsByDirname(LEGACY_IMAGE_DIRNAME); if ($conf['max_size'] > 0 && filesize($path) > $conf['max_size']) { $actionForm->addErrorMessage(sprintf(_MD_LEIMG_ERROR_MAX_SIZE_OVER, $conf['max_size'])); } }
/** * execute. * * @return Enum */ public function execute() { if ($this->mObject == null) { return $this->_getFrameViewStatus('ERROR'); } if ($this->mRoot->mContext->mRequest->getRequest('_form_control_cancel') != null) { return $this->_getFrameViewStatus('CANCEL'); } $this->mActionForm->load($this->mObject); $this->mActionForm->fetch(); $this->mActionForm->validate(); if ($this->mActionForm->hasError()) { return $this->_getFrameViewStatus('INPUT'); } $this->mActionForm->update($this->mObject); return $this->_doExecute(); }
function validate() { parent::validate(); // // If htmlbanner is clicked, htmlbanner is requreid. // if ($this->get('htmlbanner')) { if (strlen($this->get('htmlcode')) == 0) { $this->addErrorMessage(XCube_Utils::formatString(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_HTMLCODE)); } } else { if (strlen($this->get('imageurl')) == 0) { $this->addErrorMessage(XCube_Utils::formatString(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_IMAGEURL)); } if (strlen($this->get('clickurl')) == 0) { $this->addErrorMessage(XCube_Utils::formatString(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_CLICKURL)); } } }
function fetch() { parent::fetch(); $root =& XCube_Root::getSingleton(); $t_arr = $root->mContext->mRequest->getRequest('del_not'); if (!is_array($t_arr)) { $this->addErrorMessage(_MD_LEGACY_LANG_ERROR); $this->mFatalError = true; return; } foreach ($t_arr as $t_modid => $t_idArr) { if (!is_array($t_idArr)) { $this->addErrorMessage(_MD_LEGACY_LANG_ERROR); $this->mFatalError = true; return; } foreach ($t_idArr as $t_id) { $this->mNotifiyIds[] = array('modid' => intval($t_modid), 'id' => intval($t_id)); } } }
function User_AbstractUserEditForm($userConfig) { parent::XCube_ActionForm(); $this->mConfig = $userConfig; }
function fetch() { parent::fetch(); $this->set('keywords', trim($this->get('keywords'))); }
/** * load Profile ActionForm * * @param XCube_ActionForm &$actionForm User_EditUserForm * * @return void */ public static function loadActionForm(XCube_ActionForm $actionForm) { $defHandler = Legacy_Utils::getModuleHandler('definitions', 'profile'); $definitions = $defHandler->getFields4DataEdit(); $dataHandler = Legacy_Utils::getModuleHandler('data', 'profile'); $profile = $dataHandler->get($actionForm->get('uid')); if (!$profile) { $profile = $dataHandler->create(); } foreach ($definitions as $def) { $actionForm->set($def->get('field_name'), $profile->showField($def->get('field_name'), Profile_ActionType::EDIT)); } }
/** * @public * @brief Constructor. */ function Legacy_ActionForm() { parent::XCube_ActionForm(); }
function validate() { parent::validate(); $handler =& xoops_getmodulehandler('imagecategory', 'legacy'); $category =& $handler->get($this->get('imgcat_id')); $formFile = $this->get('image_name'); if ($formFile != null && is_object($category)) { // // Imagefile width & height check. // if ($formFile->getWidth() > $category->get('imgcat_maxwidth') || $formFile->getHeight() > $category->get('imgcat_maxheight')) { $this->addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_IMG_SIZE, $category->get('imgcat_maxwidth'), $category->get('imgcat_maxheight'))); } // // Check file size // if ($formFile->getFilesize() > $category->get('imgcat_maxsize')) { $this->addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_IMG_FILESIZE, $category->get('imgcat_maxsize'))); } } }
function Legacy_PreferenceEditForm(&$category) { parent::XCube_ActionForm(); $this->mKeyValue = $category->get('confcat_id'); }
public function __construct() { parent::XCube_ActionForm(); }
/** * Validate input data. * * @param void * * @return void **/ public function validate() { parent::validate(); /** * Xcck.Event.ValidateRegisterForm * * @param &Xcck_PageEditForm **/ XCube_DelegateUtils::call('Module.' . $this->mDirname . '.ValidateRegisterForm', $this); }