本文整理汇总了PHP中Zikula_Form_View类的典型用法代码示例。如果您正苦于以下问题:PHP Zikula_Form_View类的具体用法?PHP Zikula_Form_View怎么用?PHP Zikula_Form_View使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zikula_Form_View类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleCommand
/**
* Handle form submission.
*
* @param Zikula_Form_View $view Current Zikula_Form_View instance.
* @param array &$args Args.
*
* @return boolean
*/
public function handleCommand(Zikula_Form_View $view, &$args)
{
// check for valid form
if (!$view->isValid()) {
return false;
}
// load form values
$data = $view->getValues();
$user = $this->_user;
// merge attributes
foreach ($data['attributes'] as $name => $value) {
$user->setAttribute($name, $value);
}
// merge metadata
$metadata = $user->getMetadata();
if ($metadata == null) {
$metadata = new ExampleDoctrine_Entity_UserMetadata($user);
$user->setMetadata($metadata);
}
$metadata->merge($data['meta']);
unset($data['attributes'], $data['meta']);
// merge user and save everything
$user->merge($data);
$this->entityManager->persist($user);
$this->entityManager->flush();
return $view->redirect(ModUtil::url('ExampleDoctrine', 'user', 'view'));
}
示例2: handleCommand
function handleCommand(Zikula_Form_View $view, &$args)
{
if ($args['commandName'] == 'cancel') {
$url = ModUtil::url('Scribite', 'admin', 'main');
return $view->redirect($url);
} else {
if ($args['commandName'] == 'restore') {
$classname = 'ModulePlugin_Scribite_' . $this->editor . '_Plugin';
if (method_exists($classname, 'getDefaults')) {
$defaults = $classname::getDefaults();
if (!empty($defaults)) {
ModUtil::setVars("moduleplugin.scribite." . strtolower($this->editor), $defaults);
LogUtil::registerStatus('Defaults succesfully restored.');
}
}
return true;
}
}
// check for valid form
if (!$view->isValid()) {
return false;
}
$data = $view->getValues();
ModUtil::setVars("moduleplugin.scribite." . strtolower($this->editor), $data);
LogUtil::registerStatus($this->__('Done! Module configuration updated.'));
return true;
}
示例3: initialize
/**
* 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;
}
示例4: render
/**
* Render event handler.
*
* @param Zikula_Form_View $view Reference to Form render object.
*
* @return string The rendered output
*/
function render(Zikula_Form_View $view)
{
$imageURL = $this->imageURL == null ? 'images/icons/extrasmall/tab_right.png' : $this->imageURL;
$menuPlugin = $view->getPluginById($this->menuId);
$menuId = $menuPlugin->id;
$html = "<img src=\"{$imageURL}\" alt=\"\" class=\"contextMenu\" onclick=\"Form.contextMenu.showMenu(event, '{$menuId}', '{$this->commandArgument}')\" />";
return $html;
}
示例5: smarty_function_formcontextmenureference
/**
* 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;
}
}
示例6: smarty_function_muboardGetLastPost
/**
* 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;
}
示例7: smarty_block_reviewsFormFrame
/**
* The reviewsFormFrame plugin adds styling <div> elements and a validation summary.
*
* 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 string $content The content of the block.
* @param Zikula_Form_View $view Reference to the view object.
*
* @return string The output of the plugin.
*/
function smarty_block_reviewsFormFrame($params, $content, $view)
{
// As with all Forms plugins, we must remember to register our plugin.
// In this case we also register a validation summary so we don't have to
// do that explicitively in the templates.
// We need to concatenate the output of boths plugins.
$result = $view->registerPlugin('\\Zikula_Form_Plugin_ValidationSummary', $params);
$result .= $view->registerBlock('Reviews_Form_Plugin_FormFrame', $params, $content);
return $result;
}
示例8: load
function load(Zikula_Form_View $view, &$params)
{
if (!$view->isPostBack()) {
$classes = ModUtil::apiFunc('Content', 'Admin', 'getStyleClasses');
$empty = array(array('text' => '', 'value' => ''));
$classes = array_merge($empty, $classes);
$this->setItems($classes);
}
parent::load($view, $params);
}
示例9: smarty_function_reviewsObjectTypeSelector
/**
* 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;
}
示例10: smarty_function_zikularoutesmoduleObjectTypeSelector
/**
* 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;
}
示例11: smarty_function_muboardSelectorTemplates
/**
* 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;
}
示例12: handleCommand
public function handleCommand(Zikula_Form_View $view, &$args)
{
switch($args['commandName']) {
case 'cancel':
break;
case 'save':
if (!$view->isValid()) {
return false;
}
$formValues = $view->getValues();
$toname = (string)$formValues['toname'];
$toaddress = (string)$formValues['toaddress'];
$subject = (string)$formValues['subject'];
$msgtype = (string)$formValues['msgtype'];
$textBody = (string)$formValues['mailer_textbody'];
$htmlBody = (string)$formValues['mailer_body'];
$html = in_array($msgtype, array('html', 'multipart')) ? true : false;
if ($html) {
$msgBody = $htmlBody;
$altBody = $textBody;
} else {
$msgBody = $textBody;
$altBody = '';
}
// set the email
$result = ModUtil::apiFunc('Mailer', 'user', 'sendmessage', array(
'toname' => $toname,
'toaddress' => $toaddress,
'subject' => $subject,
'body' => $msgBody,
'altbody' => $altBody,
'html' => $html)
);
// check our result and return the correct error code
if ($result === true) {
// Success
LogUtil::registerStatus($this->__('Done! Message sent.'));
} elseif ($result === false) {
// Failiure
LogUtil::registerError($this->__f('Error! Could not send message. %s', ''));
} else {
// Failiure with error
LogUtil::registerError($this->__f('Error! Could not send message. %s', $result));
}
break;
}
return $view->redirect(ModUtil::url('Mailer', 'admin', 'testconfig'));
}
示例13: smarty_function_muvideoObjectTypeSelector
/**
* 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;
}
示例14: smarty_function_muboardSelectorObjectTypes
/**
* 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;
}
示例15: smarty_function_muvideoTemplateSelector
/**
* 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;
}