public function initialize(Zikula_Form_View $view) { if (!SecurityUtil::checkPermission('Mailer::', '::', ACCESS_ADMIN)) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } // assign the module mail agent types $view->assign('mailertypeItems', array( array('value' => 1, 'text' => DataUtil::formatForDisplay($this->__("Internal PHP `mail()` function"))), array('value' => 2, 'text' => DataUtil::formatForDisplay($this->__('Sendmail message transfer agent'))), array('value' => 3, 'text' => DataUtil::formatForDisplay($this->__('QMail message transfer agent'))), array('value' => 4, 'text' => DataUtil::formatForDisplay($this->__('SMTP mail transfer protocol'))), array('value' => 5, 'text' => DataUtil::formatForDisplay($this->__('Development/debug mode (Redirect e-mails to LogUtil)'))) )); $view->assign('encodingItems', array( array('value' => '8bit', 'text' => '8bit'), array('value' => '7bit', 'text' => '7bit'), array('value' => 'binary', 'text' => 'binary'), array('value' => 'base64', 'text' => 'base64'), array('value' => 'quoted-printable', 'text' => 'quoted-printable') )); $view->assign('smtpsecuremethodItems', array( array('value' => '', 'text' => 'None'), array('value' => 'ssl', 'text' => 'SSL'), array('value' => 'tls', 'text' => 'TLS') )); // assign all module vars $this->view->assign($this->getVars()); return true; }
/** * Setup form. * * @param Zikula_Form_View $view Current Zikula_Form_View instance. * * @return boolean */ public function initialize(Zikula_Form_View $view) { // load and assign registred categories $categories = CategoryRegistryUtil::getRegisteredModuleCategories('ExampleDoctrine', 'User', 'id'); $view->assign('registries', $categories); $id = FormUtil::getPassedValue('id', null, "GET", FILTER_SANITIZE_NUMBER_INT); if ($id) { // load user with id $user = $this->entityManager->find('ExampleDoctrine_Entity_User', $id); if ($user) { // switch to edit mode $this->_id = $id; } else { return LogUtil::registerError($this->__f('User with id %s not found', $id)); } } else { $user = new ExampleDoctrine_Entity_User(); } $userData = $user->toArray(); // overwrite attributes array entry with a form compitable format $field1 = $user->getAttributes()->get('field1') ? $user->getAttributes()->get('field1')->getValue() : ''; $field2 = $user->getAttributes()->get('field2') ? $user->getAttributes()->get('field2')->getValue() : ''; $userData['attributes'] = array('field1' => $field1, 'field2' => $field2); // assign current values to form fields $view->assign('user', $user)->assign('meta', $user->getMetadata() != null ? $user->getMetadata()->toArray() : array())->assign($userData); $this->_user = $user; return true; }
function initialize(Zikula_Form_View $view) { $this->id = (int) FormUtil::getPassedValue('id', -1, 'GETPOST'); $objectid = FormUtil::getPassedValue('objectid', '', 'GETPOST'); $redirect = base64_decode(FormUtil::getPassedValue('redirect', '', 'GETPOST')); $view->caching = false; $comment = ModUtil::apiFunc('EZComments', 'user', 'get', array('id' => $this->id)); if ($comment == false || !is_array($comment)) { return LogUtil::registerError($this->__('No such comment found.'), ModUtil::url('EZComments', 'user', 'main')); } // check if user is allowed to modify this content $modifyowntime = (int) ModUtil::getVar('EZComments', 'modifyowntime'); $ts = strtotime($comment['date']); if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_ADMIN)) { // user has no admin permissions. Only commenting user should be able to modify if ($comment['uid'] != UserUtil::getVar('uid')) { // foreign content and no admin permissions $view->assign('nomodify', 1); $this->nomodify = 1; } else { if ($modifyowntime > 0 && $ts + $modifyowntime * 60 * 60 < time()) { $view->assign('nomodify', 1); $this->nomodify = 1; } } } else { $view->assign('nomodify', 0); $this->nomodify = 0; } $view->assign('redirect', isset($redirect) && !empty($redirect) ? true : false); // finally asign the comment information $view->assign($comment); return true; }
function initialize(Zikula_Form_View $view) { $view->caching = false; $view->add_core_data(); $view->assign('avatarpath', ModUtil::getVar('Users', 'avatarpath')); $view->assign('avatarpath_writable', is_writable(ModUtil::getVar('Users', 'avatarpath'))); $view->assign('pnphpbb_installed', ModUtil::available('pnphpbb')); $view->assign('forumdir_writable', is_writable(ModUtil::getVar('Avatar', 'forumdir'))); return true; }
function initialize(Zikula_Form_View $view) { $view->addPluginDir('system/Admin/Resources/views/plugins'); // for Core 1.3.6+ $view->addPluginDir('system/Admin/templates/plugins'); // for Core 1.3.5 $this->editor = $view->getPluginName(); $classname = 'ModulePlugin_Scribite_' . $this->editor . '_Plugin'; if (method_exists($classname, 'getOptions')) { $options = $classname::getOptions(); if (!empty($options)) { $view->assign($options); } } $view->assign(ModUtil::getVar("moduleplugin.scribite." . strtolower($this->editor))); return true; }
/** * Context menu reference * * This plugin creates a context menu reference. * * @param array $params Parameters passed in the block tag. * @param Zikula_Form_View $view Reference to Form render object. * * @return string The rendered output. */ function smarty_function_formcontextmenureference($params, $view) { $output = $view->registerPlugin('Zikula_Form_Plugin_ContextMenu_Reference', $params); if (array_key_exists('assign', $params)) { $view->assign($params['assign'], $output); } else { return $output; } }
function initialize(Zikula_Form_View $view) { $this->id = (int) FormUtil::getPassedValue('id', -1, 'GETPOST'); $objectid = FormUtil::getPassedValue('objectid', '', 'GETPOST'); $redirect = base64_decode(FormUtil::getPassedValue('redirect', '', 'GETPOST')); $view->caching = false; $comment = ModUtil::apiFunc('EZComments', 'user', 'get', array('id' => $this->id)); if ($comment == false || !is_array($comment)) { return LogUtil::registerError($this->__('No such comment found.'), ModUtil::url('EZComments', 'admin', 'main')); } // assign the status flags $statuslevels = array(array('text' => $this->__('Approved'), 'value' => 0), array('text' => $this->__('Pending'), 'value' => 1), array('text' => $this->__('Rejected'), 'value' => 2)); $view->assign('statuslevels', $statuslevels); $view->assign('redirect', isset($redirect) && !empty($redirect) ? true : false); // finally asign the comment information $view->assign($comment); return true; }
function initialize(Zikula_Form_View $view) { $view->caching = false; $templates = array(); $rawtemplates = ModUtil::apiFunc('EZComments', 'user', 'gettemplates'); if (is_array($rawtemplates) && count($rawtemplates) != 0) { foreach ($rawtemplates as $rawtemplate) { $templates[] = array('text' => $rawtemplate, 'value' => $rawtemplate); } } $view->assign('templates', $templates); // is the akismet module available $view->assign('akismetavailable', ModUtil::available('Akismet')); $statuslevels = array(array('text' => $this->__('Approved'), 'value' => 0), array('text' => $this->__('Pending'), 'value' => 1), array('text' => $this->__('Rejected'), 'value' => 2)); $view->assign('statuslevels', $statuslevels); $feeds = array(array('text' => $this->__('Atom 0.3'), 'value' => 'atom'), array('text' => $this->__('RSS 2.0'), 'value' => 'rss')); $view->assign('feeds', $feeds); return true; }
/** * The muboardSelectorTemplates plugin provides items for a dropdown selector. * * Available parameters: * - assign: If set, the results are assigned to the corresponding variable instead of printed out. * * @param array $params All attributes passed to this function from the template. * @param Zikula_Form_View $view Reference to the view object. * * @return string The output of the plugin. */ function smarty_function_muboardGetLastPost($params, $view) { $where = 'tbl.'; ModUtil::apiFunc('MUBoard', 'selection', 'getEntities'); if (array_key_exists('assign', $params)) { $view->assign($params['assign'], $result); return; } return $result; }
/** * The muboardSelectorTemplates plugin provides items for a dropdown selector. * * Available parameters: * - assign: If set, the results are assigned to the corresponding variable instead of printed out. * * @param array $params All attributes passed to this function from the template. * @param Zikula_Form_View $view Reference to the view object. * * @return string The output of the plugin. */ function smarty_function_muboardSelectorTemplates($params, $view) { $result = array(); $result[] = array('text' => $view->__('Only item titles'), 'value' => 'itemlist_display.tpl'); $result[] = array('text' => $view->__('With description'), 'value' => 'itemlist_display_description.tpl'); if (array_key_exists('assign', $params)) { $view->assign($params['assign'], $result); return; } return $result; }
/** * The reviewsObjectTypeSelector plugin provides items for a dropdown selector. * * Available parameters: * - assign: If set, the results are assigned to the corresponding variable instead of printed out. * * @param array $params All attributes passed to this function from the template. * @param Zikula_Form_View $view Reference to the view object. * * @return string The output of the plugin. */ function smarty_function_reviewsObjectTypeSelector($params, $view) { $dom = ZLanguage::getModuleDomain('Reviews'); $result = array(); $result[] = array('text' => __('Reviews', $dom), 'value' => 'review'); if (array_key_exists('assign', $params)) { $view->assign($params['assign'], $result); return; } return $result; }
function initialize(Zikula_Form_View $view) { if (!SecurityUtil::checkPermission('Scribite::', '::', ACCESS_ADMIN)) { return LogUtil::registerPermissionError(); } // get all editors $editorList = ModUtil::apiFunc('Scribite', 'admin', 'getEditors', array('format' => 'formdropdownlist')); $view->assign('editor_list', $editorList); $vars = $this->getVars(); $view->assign($vars); $paramsString = ''; if (isset($vars['defaultparameters'])) { foreach ($vars['defaultparameters'] as $param => $value) { $paramsString .= "{$param}:{$value},"; } } // overwrites previous assignment... $view->assign('defaultparameters', rtrim($paramsString, ",")); return true; }
/** * The zikularoutesmoduleObjectTypeSelector plugin provides items for a dropdown selector. * * Available parameters: * - assign: If set, the results are assigned to the corresponding variable instead of printed out. * * @param array $params All attributes passed to this function from the template. * @param Zikula_Form_View $view Reference to the view object. * * @return string The output of the plugin. */ function smarty_function_zikularoutesmoduleObjectTypeSelector($params, $view) { $dom = \ZLanguage::getModuleDomain('ZikulaRoutesModule'); $result = array(); $result[] = array('text' => __('Routes', $dom), 'value' => 'route'); if (array_key_exists('assign', $params)) { $view->assign($params['assign'], $result); return; } return $result; }
/** * The muboardSelectorObjectTypes plugin provides items for a dropdown selector. * * Available parameters: * - assign: If set, the results are assigned to the corresponding variable instead of printed out. * * @param array $params All attributes passed to this function from the template. * @param Zikula_Form_View $view Reference to the view object. * * @return string The output of the plugin. */ function smarty_function_muboardSelectorObjectTypes($params, $view) { $result = array(); $result[] = array('text' => $view->__('Categories'), 'value' => 'category'); $result[] = array('text' => $view->__('Forums'), 'value' => 'forum'); $result[] = array('text' => $view->__('Postings'), 'value' => 'posting'); if (array_key_exists('assign', $params)) { $view->assign($params['assign'], $result); return; } return $result; }
/** * The muvideoObjectTypeSelector plugin provides items for a dropdown selector. * * Available parameters: * - assign: If set, the results are assigned to the corresponding variable instead of printed out. * * @param array $params All attributes passed to this function from the template. * @param Zikula_Form_View $view Reference to the view object. * * @return string The output of the plugin. */ function smarty_function_muvideoObjectTypeSelector($params, $view) { $dom = ZLanguage::getModuleDomain('MUVideo'); $result = array(); $result[] = array('text' => __('Collections', $dom), 'value' => 'collection'); $result[] = array('text' => __('Movies', $dom), 'value' => 'movie'); if (array_key_exists('assign', $params)) { $view->assign($params['assign'], $result); return; } return $result; }
/** * The muvideoTemplateSelector plugin provides items for a dropdown selector. * * Available parameters: * - assign: If set, the results are assigned to the corresponding variable instead of printed out. * * @param array $params All attributes passed to this function from the template. * @param Zikula_Form_View $view Reference to the view object. * * @return string The output of the plugin. */ function smarty_function_muvideoTemplateSelector($params, $view) { $dom = ZLanguage::getModuleDomain('MUVideo'); $result = array(); $result[] = array('text' => __('Only item titles', $dom), 'value' => 'itemlist_display.tpl'); $result[] = array('text' => __('With description', $dom), 'value' => 'itemlist_display_description.tpl'); $result[] = array('text' => __('Custom template', $dom), 'value' => 'custom'); if (array_key_exists('assign', $params)) { $view->assign($params['assign'], $result); return; } return $result; }
public function initialize(Zikula_Form_View $view) { if (!SecurityUtil::checkPermission('Mailer::', '::', ACCESS_ADMIN)) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } $msgtype = $this->getVar('html') ? 'html' : 'text'; $view->assign('msgtype', $msgtype); // assign all module vars $this->view->assign($this->getVars()); return true; }
/** * Pre-process relationship identifiers. * * @param Zikula_Form_View $view Reference to Zikula_Form_View object. * @param array &$params Parameters passed from the Smarty plugin function. * * @return void */ protected function preprocessIdentifiers(Zikula_Form_View $view, &$params) { $entityData = isset($params['linkingItem']) ? $params['linkingItem'] : $view->get_template_vars('linkingItem'); $alias = $this->id; $itemIds = array(); $many = $this->selectionMode == 'multiple'; if (isset($entityData[$alias])) { $relatedItems = $entityData[$alias]; if (is_array($relatedItems) || is_object($relatedItems)) { if ($many) { foreach ($relatedItems as $relatedItem) { $itemIds[] = $this->createItemIdentifier($relatedItem); } } else { $itemIds[] = $this->createItemIdentifier($relatedItems); } } $this->preselectedItems = $relatedItems; } if (count($itemIds) > 0) { if ($this->selectionMode != 'multiple') { $entityData[$alias] = ModUtil::apiFunc($this->name, 'selection', 'getEntity', array('ot' => $alias, 'id' => $itemIds[0])); } else { $entityData[$alias] = ModUtil::apiFunc($this->name, 'selection', 'getEntities', array('ot' => $alias, 'idList' => $itemIds)); } } $view->assign('linkingItem', $entityData); }
/** * The muvideoValidationError plugin returns appropriate (and multilingual) * error messages for different client-side validation error types. * * Available parameters: * - id: Optional id of element as part of unique error message element. * - class: Treated validation class. * - assign: If set, the results are assigned to the corresponding variable instead of printed out. * * @param array $params All attributes passed to this function from the template. * @param Zikula_Form_View $view Reference to the view object. * * @return string The output of the plugin. */ function smarty_function_muvideoValidationError($params, $view) { $id = $params['id']; $class = $params['class']; $message = ''; switch ($class) { // default rules case 'required': $message = $view->__('This is a required field.'); break; case 'validate-number': $message = $view->__('Please enter a valid number in this field.'); break; case 'validate-digits': $message = $view->__('Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.'); break; case 'validate-alpha': $message = $view->__('Please use letters only (a-z) in this field.'); break; case 'validate-alphanum': $message = $view->__('Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.'); break; case 'validate-date': $message = $view->__('Please enter a valid date.'); break; case 'validate-email': $message = $view->__('Please enter a valid email address. For example yourname@example.com .'); break; case 'validate-url': $message = $view->__('Please enter a valid URL.'); break; case 'validate-date-au': $message = $view->__('Please use this date format: dd/mm/yyyy. For example 17/03/2010 for the 17th of March, 2010.'); break; case 'validate-currency-dollar': $message = $view->__('Please enter a valid $ amount. For example $100.00 .'); break; case 'validate-selection': $message = $view->__('Please make a selection.'); break; case 'validate-one-required': $message = $view->__('Please select one of the above options.'); break; // additional rules // additional rules case 'validate-nospace': $message = $view->__('This value must not contain spaces.'); break; case 'validate-upload': $message = $view->__('Please select an allowed file type.'); break; case 'validate-datetime-past': $message = $view->__('Please select a value in the past.'); break; case 'validate-datetime-future': $message = $view->__('Please select a value in the future.'); break; case 'validate-date-past': $message = $view->__('Please select a value in the past.'); break; case 'validate-date-future': $message = $view->__('Please select a value in the future.'); break; case 'validate-time-past': $message = $view->__('Please select a value in the past.'); break; case 'validate-time-future': $message = $view->__('Please select a value in the future.'); break; case 'validate-unique': $message = $view->__('This value is already assigned, but must be unique. Please change it.'); break; } $message = '<span id="advice-' . $class . '-' . $id . '" class="validation-advice z-formnote" style="display: none">' . $message . '</span>'; if (array_key_exists('assign', $params)) { $view->assign($params['assign'], $message); return; } return $message; }