/** * Initialize form handler. * * This method takes care of all necessary initialisation of our data and form states. * * @return boolean False in case of initialization errors, otherwise true. */ public function initialize(Zikula_Form_View $view) { // permission check if (!SecurityUtil::checkPermission('MUBoard::', '::', ACCESS_ADMIN)) { return $view->registerError(LogUtil::registerPermissionError()); } // retrieve module vars $modVars = ModUtil::getVar('MUBoard'); // initialise list entries for the 'number images' setting $modVars['numberImagesItems'] = array(array('value' => '1', 'text' => '1'), array('value' => '2', 'text' => '2'), array('value' => '3', 'text' => '3')); // initialise list entries for the 'number files' setting $modVars['numberFilesItems'] = array(array('value' => '1', 'text' => '1'), array('value' => '2', 'text' => '2'), array('value' => '3', 'text' => '3')); // initialise list entries for the 'sorting postings' setting $modVars['sortingPostingsItems'] = array(array('value' => 'descending', 'text' => 'Descending'), array('value' => 'ascending', 'text' => 'Ascending')); // initialise list entries for the 'icon set' setting $modVars['iconSetItems'] = array(array('value' => '1', 'text' => '1'), array('value' => '2', 'text' => '2'), array('value' => '3', 'text' => '3')); // initialise list entries for the 'template' setting $modVars['templateItems'] = array(array('value' => 'normal', 'text' => 'Normal'), array('value' => 'jquery', 'text' => 'JQuery')); // assign all module vars $this->view->assign('config', $modVars); // custom initialisation aspects $this->initializeAdditions(); // everything okay, no initialization errors occured return true; }
/** * Initialize form handler. * * This method takes care of all necessary initialisation of our data and form states. * * @param Zikula_Form_View $view The form view instance. * * @return boolean False in case of initialization errors, otherwise true. */ public function initialize(Zikula_Form_View $view) { // permission check if (!SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN)) { return $view->registerError(LogUtil::registerPermissionError()); } // retrieve module vars $modVars = $this->getVars(); // assign all module vars $this->view->assign('config', $modVars); // custom initialisation aspects $this->initializeAdditions(); // everything okay, no initialization errors occured return true; }
/** * Initialize form handler. * * This method takes care of all necessary initialisation of our data and form states. * * @return boolean False in case of initialization errors, otherwise true. */ public function initialize(Zikula_Form_View $view) { // permission check if (!SecurityUtil::checkPermission('MUBoard::', '::', ACCESS_ADMIN)) { return $view->registerError(LogUtil::registerPermissionError()); } $dom = ZLanguage::getModuleDomain('MUBoard'); // initialise list entries for the 'number images' setting $vars['dizkustableItems'] = array(array('value' => '1', 'text' => __('All', $dom)), array('value' => '2', 'text' => __('Categories', $dom) . ' ' . __('and', $dom) . ' ' . __('Forums', $dom)), array('value' => '3', 'text' => __('Topics', $dom) . ' ' . __('and', $dom) . ' ' . __('Answers', $dom)), array('value' => '4', 'text' => __('Ranks', $dom) . ' ' . __('and', $dom) . ' ' . __('Users', $dom))); // assign all module vars $this->view->assign('import', $vars); // custom initialisation aspects $this->initializeAdditions(); // everything okay, no initialization errors occured return true; }
/** * Initialize form handler. * * This method takes care of all necessary initialisation of our data and form states. * * @return boolean False in case of initialization errors, otherwise true. */ public function initialize(Zikula_Form_View $view) { // we get forumid for edit form to answer to an issue // we get func $func = $this->request->query->filter('func', 'main', FILTER_SANITIZE_STRING); // we get forum for edit form to create a new issue $forum = $this->request->query->filter('forum', 0, FILTER_SANITIZE_NUMBER_INT); // we get parentid for edit form to answer to an issue $parentid = $this->request->query->filter('id', 0, FILTER_SANITIZE_NUMBER_INT); if (!SecurityUtil::checkPermission('MUBoard:Forum:', 'ForumID::1', ACCESS_ADD)) { return $view->registerError(LogUtil::registerPermissionError()); } parent::initialize($view); // build posting repository $repository = MUBoard_Util_Model::getPostingRepository(); if ($func == 'display') { // we get forumid for edit form to answer to an issue if ($parentid > 0) { $entity = $repository->selectById($parentid); $forumOfEntity = $entity->getForum(); $forumid = $forumOfEntity['id']; } else { $forumid = 0; } } else { $id = $this->request->query->filter('id', 0, FILTER_SANITIZE_NUMBER_INT); if ($id > 0) { $entity = $repository->selectById($id); $parent = $entity->getParent(); if ($parent) { $parentid = $parent->getId(); } else { $parentid = 0; } } } // set mode to create if we want to answer if ($func == 'display') { // set mode to create $this->mode = 'create'; } else { // if we func is not display // if id > 0 set mode to edit if ($id > 0) { // set mode to edit $this->mode = 'edit'; } } // rule of token TODO with this we get problems with the edit // because e get always an error messahe nor permissions /* if ($this->mode == 'edit') { $token = $this->request->query->filter('token'); if (SecurityUtil::validateCsrfToken($token)){ // nothing to do } else { if($parentid > 0) { $url = ModUtil::url($this->name, 'user', 'display', array('ot' => 'posting', 'id' => $parentid)); } else { $url = ModUtil::url($this->name, 'user', 'display', array('ot' => 'forum', 'id' => $forum)); } return LogUtil::registerPermissionError($url); } }*/ // get text for the picture upload fields $maxSize = MUBoard_Util_Controller::maxSize(); // get modvars $uploadImages = ModUtil::getVar('MUBoard', 'uploadImages'); $uploadFiles = ModUtil::getVar('MUBoard', 'uploadFiles'); $numberImages = ModUtil::getVar('MUBoard', 'numberImages'); $numberFiles = ModUtil::getVar('MUBoard', 'numberFiles'); // we assign to template $this->view->assign('uploadImages', $uploadImages)->assign('maxSize', $maxSize)->assign('uploadFiles', $uploadFiles)->assign('numberImages', $numberImages)->assign('numberFiles', $numberFiles)->assign('mode', $this->mode)->assign('forum', $forum)->assign('forumid', $forumid)->assign('parentid', $parentid); // everything okay, no initialization errors occured return true; }