本文整理汇总了PHP中Zikula_Form_View::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Zikula_Form_View::redirect方法的具体用法?PHP Zikula_Form_View::redirect怎么用?PHP Zikula_Form_View::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zikula_Form_View
的用法示例。
在下文中一共展示了Zikula_Form_View::redirect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: handleCommand
function handleCommand(Zikula_Form_View $view, &$args)
{
$url = ModUtil::url('Scribite', 'admin', 'main');
if ($args['commandName'] == 'cancel') {
return $view->redirect($url);
}
// check for valid form
if (!$view->isValid()) {
return false;
}
// get passed args and store to array
$data = $view->getValues();
$this->setVars($data);
LogUtil::registerStatus($this->__('Done! Module configuration updated.'));
return $view->redirect($url);
}
示例3: 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'));
}
示例4: handleCommand
function handleCommand(Zikula_Form_View $view, &$args)
{
if ($args['commandName'] == 'cancel') {
$url = ModUtil::url('BBSmile', 'admin', 'main');
return $view->redirect($url);
}
// Security check
if (!SecurityUtil::checkPermission('BBSmile::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError(ModUtil::url('BBSmile', 'admin', 'main'));
}
// check for valid form
if (!$view->isValid()) {
return false;
}
$ok = true;
$data = $view->getValues();
$ossmiliepath = DataUtil::formatForOS($data['smiliepath']);
if (!file_exists($ossmiliepath) || !is_readable($ossmiliepath)) {
$ifield = $this->view->getPluginById('smiliepath');
$ifield->setError(DataUtil::formatForDisplay($this->__('The path does not exists or the system cannot read it.')));
$ok = false;
}
$osautosmiliepath = DataUtil::formatForOS($data['smiliepath_auto']);
if (!file_exists($osautosmiliepath) || !is_readable($osautosmiliepath)) {
$ifield = $this->view->getPluginById('smiliepath_auto');
$ifield->setError(DataUtil::formatForDisplay($this->__('The path does not exists or the system cannot read it.')));
$ok = false;
}
if ($ok == false) {
return false;
}
$this->setVar('smiliepath', $data['smiliepath']);
$this->setVar('smiliepath_auto', $data['smiliepath_auto']);
$this->setVar('activate_auto', $data['activate_auto']);
$this->setVar('remove_inactive', $data['remove_inactive']);
LogUtil::registerStatus($this->__('BBSmile configuration updated'));
return true;
}
示例5: handleCommand
public function handleCommand(Zikula_Form_View $view, &$args)
{
switch($args['commandName']) {
case 'cancel':
break;
case 'save':
if (!$view->isValid()) {
return false;
}
$this->formValues = $view->getValues();
// set our new module variable values
$vars = array();
$vars['mailertype'] = (int)$this->getFormValue('mailertype', 1);
$vars['charset'] = (string)$this->getFormValue('charset', ZLanguage::getEncoding());
$vars['encoding'] = (string)$this->getFormValue('encoding', '8bit');
$vars['html'] = (bool)$this->getFormValue('html', false);
$vars['wordwrap'] = (int)$this->getFormValue('wordwrap', 50);
$vars['msmailheaders'] = (bool)$this->getFormValue('msmailheaders', false);
$vars['sendmailpath'] = (string)$this->getFormValue('sendmailpath', '/usr/sbin/sendmail');
$vars['smtpauth'] = (bool)$this->getFormValue('smtpauth', false);
$vars['smtpserver'] = (string)$this->getFormValue('smtpserver', 'localhost');
$vars['smtpport'] = (int)$this->getFormValue('smtpport', 25);
$vars['smtptimeout'] = (int)$this->getFormValue('smtptimeout', 10);
$vars['smtpusername'] = (string)$this->getFormValue('smtpusername', '');
$vars['smtppassword'] = (string)$this->getFormValue('smtppassword', '');
$vars['smtpsecuremethod'] = (string)$this->getFormValue('smtpsecuremethod', '');
$this->setVars($vars);
// the module configuration has been updated successfuly
LogUtil::registerStatus($this->__('Done! Saved module configuration.'));
break;
}
return $view->redirect(ModUtil::url('Mailer', 'admin', 'modifyconfig'));
}
示例6: 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'));
}