本文整理汇总了PHP中Horde_Form::renderActive方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Form::renderActive方法的具体用法?PHP Horde_Form::renderActive怎么用?PHP Horde_Form::renderActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Form
的用法示例。
在下文中一共展示了Horde_Form::renderActive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderActive
/**
* Renders the form for editing.
*
* @param Horde_Form_Renderer $renderer A renderer instance, optional
* since Horde 3.2.
* @param Variables $vars A Variables instance, optional
* since Horde 3.2.
* @param string $action The form action (url).
* @param string $method The form method, usually either
* 'get' or 'post'.
* @param string $enctype The form encoding type. Determined
* automatically if null.
* @param boolean $focus Focus the first form field?
*/
public function renderActive($renderer, $vars, $action, $method = 'get', $enctype = null, $focus = true)
{
if ($vars->get('old_datatype') === null) {
$this->_addParameters($vars);
}
parent::renderActive($renderer, $vars, $action, $method, $enctype, $focus);
}
示例2: renderActive
public function renderActive()
{
$url = Horde::url('list.php');
if ($this->_vars->get('smart_id')) {
// Editing an existing smartlist.
$url->add(array('actionID' => 'smart', 'list' => $this->_vars->get('smart_id'), 'tab_name' => $this->_vars->get('smart_id')));
}
return parent::renderActive($this->getRenderer(array('varrenderer_driver' => array('nag', 'nag'))), $this->_vars, $url->setRaw(true), 'post');
}
示例3: run
/**
* Expects:
* $vars
* $registry
* $notification
*/
public function run()
{
extract($this->_params, EXTR_REFS);
/* Set up the form variables and the form. */
$form_submit = $vars->get('submitbutton');
$channel_id = $vars->get('channel_id');
try {
$channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($channel_id);
} catch (Exception $e) {
Horde::log($e, 'ERR');
$notification->push(_("Invalid channel specified for deletion."), 'horde.message');
Horde::url('channels')->redirect();
exit;
}
/* If not yet submitted set up the form vars from the fetched channel. */
if (empty($form_submit)) {
$vars = new Horde_Variables($channel);
}
/* Check permissions and deny if not allowed. */
if (!Jonah::checkPermissions(Jonah::typeToPermName($channel['channel_type']), Horde_Perms::DELETE, $channel_id)) {
$notification->push(_("You are not authorised for this action."), 'horde.warning');
throw new Horde_Exception_AuthenticationFailure();
}
$title = sprintf(_("Delete News Channel \"%s\"?"), $vars->get('channel_name'));
$form = new Horde_Form($vars, $title);
$form->setButtons(array(_("Delete"), _("Do not delete")));
$form->addHidden('', 'channel_id', 'int', true, true);
$msg = _("Really delete this News Channel? All stories created in this channel will be lost!");
$form->addVariable($msg, 'confirm', 'description', false);
if ($form_submit == _("Delete")) {
if ($form->validate($vars)) {
$form->getInfo($vars, $info);
try {
$delete = $GLOBALS['injector']->getInstance('Jonah_Driver')->deleteChannel($info);
$notification->push(_("The channel has been deleted."), 'horde.success');
Horde::url('channels')->redirect();
exit;
} catch (Exception $e) {
$notification->push(sprintf(_("There was an error deleting the channel: %s"), $e->getMessage()), 'horde.error');
}
}
} elseif (!empty($form_submit)) {
$notification->push(_("Channel has not been deleted."), 'horde.message');
Horde::url('channels')->redirect();
exit;
}
$GLOBALS['page_output']->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
$form->renderActive(null, $vars, Horde::selfUrl(), 'post');
$GLOBALS['page_output']->footer();
}
示例4: while
$notification->push(_("Password changed."), 'horde.success');
// reset credentials so user is not forced to relogin
if ($registry->getAuthCredential('password') == $info['old']) {
$registry->setAuthCredential('password', $info['new']);
}
} while (false);
// update password reminder prefs
if (Horde_Util::getPost('formname') == 'security') {
if ($prefs->getValue('security_question') != Horde_Util::getPost('security_question')) {
$prefs->setValue('security_question', Horde_Util::getPost('security_question'));
}
if ($prefs->getValue('security_answer') != Horde_Util::getPost('security_answer')) {
$prefs->setValue('security_answer', Horde_Util::getPost('security_answer'));
}
$notification->push(_("Your securiy questions was updated."), 'horde.success');
}
$form_security = new Horde_Form($vars, _("Security question used when reseting password"), 'security');
$form_security->setButtons(_("Continue"), _("Reset"));
if (!$prefs->isLocked('security_question')) {
$v = $form_security->addVariable(_("Security question"), 'security_question', 'text', true);
$v->setDefault($prefs->getValue('security_question'));
}
$v = $form_security->addVariable(_("Security answer"), 'security_answer', 'text', true);
$v->setDefault($prefs->getValue('security_answer'));
$page_output->header(array('title' => $title));
require FOLKS_TEMPLATES . '/menu.inc';
echo $tabs->render('password');
$form->renderActive(null, null, null, 'post');
echo '<br />';
$form_security->renderActive(null, null, null, 'post');
$page_output->footer();
示例5: catch
$viewform->addVariable(_("Action"), 'form_action', 'email', false);
$delform->setButtons(array(_("Delete"), _("Do not delete")));
$delform->addHidden('', 'form_id', 'int', true);
if ($form_submit == _("Delete")) {
$delform->validate($delvars);
if ($delform->isValid()) {
$delform->getInfo($delvars, $info);
try {
$deleteform = $ulaform_driver->deleteForm($info['form_id']);
$notification->push(_("Form deleted."), 'horde.success');
Horde::url('forms.php', true)->redirect();
} catch (Ulaform_Exception $e) {
$notification->push(sprintf(_("Error deleting form. %s."), $e->getMessage()), 'horde.error');
}
}
} elseif (!empty($form_submit)) {
$notification->push(_("Form has not been deleted."), 'horde.message');
Horde::url('forms.php', true)->redirect();
}
/* Render the form. */
$renderer = new Horde_Form_Renderer();
Horde::startBuffer();
$delform->renderActive($renderer, $delvars, Horde::url('delete.php'), 'post');
$viewform->renderInactive($renderer, $viewvars);
$main = Horde::endBuffer();
$view = new Horde_View(array('templatePath' => ULAFORM_TEMPLATES));
$view->main = $main;
$page_output->header();
$notification->notify(array('listeners' => 'status'));
echo $view->render('main');
$page_output->footer();
示例6: renderActive
public function renderActive()
{
global $conf;
return parent::renderActive($this->getRenderer(array('varrenderer_driver' => array('nag', 'nag'))), $this->_vars, Horde::url($conf['urls']['pretty'] == 'rewrite' ? 't/save' : 'task/save.php'), 'post');
}
示例7: array
$channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($channel_id);
if (empty($channel['channel_story_url'])) {
$story_url = Horde::url('stories/view.php', true)->add(array('channel_id' => '%c', 'id' => '%s'));
} else {
$story_url = $channel['channel_story_url'];
}
$story_url = str_replace(array('%25c', '%25s'), array('%c', '%s'), $story_url);
$story_url = str_replace(array('%c', '%s', '&'), array($channel_id, $story['id'], '&'), $story_url);
if ($info['include'] == 0) {
require_once 'Horde/MIME/Part.php';
/* TODO: Create a "URL link" MIME part instead. */
$message_part = new MIME_Part('text/plain');
$message_part->setContents($message_part->replaceEOL($story_url));
$message_part->setDescription(_("Story Link"));
} else {
$message_part = Jonah::getStoryAsMessage($story);
}
$result = _mail($message_part, $info['from'], $info['recipients'], $info['subject'], $info['message']);
if (is_a($result, 'PEAR_Error')) {
$notification->push(sprintf(_("Unable to send story: %s"), $result->getMessage()), 'horde.error');
} else {
$notification->push(_("The story was sent successfully."), 'horde.success');
header('Location: ' . $story_url);
exit;
}
}
$page_output->topbar = $page_output->sidebar = false;
$page_output->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
$form->renderActive(null, $vars, Horde::url('stories/share.php'), 'post');
$page_output->footer();
示例8: renderActive
public function renderActive()
{
return parent::renderActive($this->getRenderer(array('varrenderer_driver' => array('kronolith', 'kronolith'))), $this->_vars);
}
示例9:
<?php
/**
* Copyright 2005-2015 Horde LLC (http://www.horde.org/)
*
* See the enclosed file LICENSE for license information (BSD). If you
* did not receive this file, see http://www.horde.org/licenses/bsdl.php.
*
* @author Chuck Hagenbuch <chuck@horde.org>
* @author Jan Schneider <jan@horde.org>
*/
require_once __DIR__ . '/lib/Application.php';
$hermes = Horde_Registry::appInit('hermes');
$vars = Horde_Variables::getDefaultVariables();
$form = new Horde_Form($vars, _("Stop Watch"));
$form->addVariable(_("Stop watch description"), 'description', 'text', true);
if ($form->validate($vars)) {
Hermes::newTimer($vars->get('description'));
echo Horde::wrapInlineScript(array('var t = ' . Horde_Serialize::serialize(sprintf(_("The stop watch \"%s\" has been started and will appear in the menu at the next refresh."), $vars->get('description')), Horde_Serialize::JSON) . ';', 'alert(t);', 'window.close();'));
exit;
}
$page_output->topbar = $page_output->sidebar = false;
$page_output->header(array('title' => _("Stop Watch")));
$form->renderActive(new Horde_Form_Renderer(), $vars, Horde::url('start.php'), 'post');
$page_output->footer();
示例10: array
$form->setButtons(array(_("Move"), _("Cancel")));
$form->addHidden('', 'agora', 'text', false);
$form->addHidden('', 'scope', 'text', false);
$forums_list = Agora::formatCategoryTree($messages->getForums(0, false));
$v =& $form->addVariable(_("Forum"), 'new_forum_id', 'enum', true, false, null, array($forums_list));
$v->setDefault($forum_id);
/* Validate the form. */
if ($form->validate()) {
$form->getInfo($vars, $info);
if ($vars->get('submitbutton') == _("Move")) {
$move = $messages->moveThread($message_id, $info['new_forum_id']);
if ($move instanceof PEAR_Error) {
$notification->push($move->getMessage(), 'horde.error');
} else {
$notification->push(sprintf(_("Thread %s moved to from forum %s to %s."), $message_id, $forum_id, $info['new_forum_id']), 'horde.success');
header('Location: ' . Agora::setAgoraId($info['new_forum_id'], $message_id, Horde::url('messages/index.php', true), $scope));
exit;
}
}
}
/* Template object. */
$view = new Agora_View();
Horde::startBuffer();
$form->renderActive(null, $vars, Horde::url('messages/move.php'), 'post');
$view->formbox = Horde::endBuffer();
$view->message_subject = $message['message_subject'];
$view->message_author = $message['message_author'];
$view->message_body = Agora_Driver::formatBody($message['body']);
$page_output->header();
echo $view->render('messages/edit');
$page_output->footer();
示例11: array
$parent .= '|' . $name;
}
}
break;
case 'search':
/* Create Form */
$searchForm = new Horde_Form($vars, null, 'search');
$searchForm->setButtons(_("Search"));
$searchForm->addHidden('sidebar', 'show', 'text', false);
$searchForm->addHidden('', 'module', 'text', false);
$searchForm->addHidden('', 'side_show', 'text', false);
$searchForm->addVariable(_("Keyword"), 'keyword', 'text', false, false, null, array(null, 20));
$renderer = new Horde_Form_Renderer();
$renderer->setAttrColumnWidth('50%');
Horde::startBuffer();
$searchForm->renderActive($renderer, $vars, $sidebar_url->copy()->setRaw(true), 'post');
$contents = Horde::endBuffer() . '<br />';
$keywords = $vars->get('keyword');
if (!empty($keywords)) {
$results = $help->search($keywords);
foreach ($results as $id => $title) {
if (empty($title)) {
continue;
}
$contents .= Horde::link($base_url->copy()->add(array('show' => 'entry', 'topic' => $id)), null, null, 'help_main') . htmlspecialchars($title) . "</a><br />\n";
}
}
break;
}
require HORDE_TEMPLATES . '/help/sidebar.inc';
break;
示例12: header
}
$url = Agora::setAgoraId($forum_id, null, Horde::url('ban.php', true), $scope);
header('Location: ' . $url);
exit;
}
/* Get the list of banned users. */
$delete = Horde::url('ban.php')->add(array('action' => 'delete', 'scope' => $scope, 'forum_id' => $forum_id));
$banned = $forums->getBanned();
foreach ($banned as $user => $level) {
$banned[$user] = Horde::link($delete->add('user', $user), _("Delete")) . $user . '</a>';
}
$title = _("Ban");
$vars = Horde_Variables::getDefaultVariables();
$form = new Horde_Form($vars, $title);
$form->addHidden('', 'scope', 'text', false);
$form->addHidden('', 'agora', 'text', false);
$form->addHidden('', 'action', 'text', false);
$vars->set('action', 'add');
$form->addVariable(_("User"), 'user', 'text', true);
$view = new Agora_View();
Horde::startBuffer();
$form->renderActive(null, null, Horde::url('ban.php'), 'post');
$view->formbox = Horde::endBuffer();
Horde::startBuffer();
$notification->notify(array('listeners' => 'status'));
$view->notify = Horde::endBuffer();
$view->banned = $banned;
$view->forum = $forums->getForum();
$page_output->header(array('title' => $title));
echo $view->render('ban');
$page_output->footer();
示例13: sprintf
$form->addHidden('', 'virtual_id', 'int', false);
$form->addHidden('', 'domain', 'text', false);
$form->addVariable(_("Virtual Email"), 'stripped_email', 'text', true, false, sprintf(_("Enter a virtual email address @%s and then indicate below where mail sent to that address is to be delivered. The address must begin with an alphanumerical character, it must contain only alphanumerical and '._-' characters, and must end with an alphanumerical character."), $domain), array('~^[a-zA-Z0-9]{1,1}[a-zA-Z0-9._-]*[a-zA-Z0-9]$~'));
$var =& $form->addVariable(_("Destination type"), 'destination_type', 'enum', true, false, null, array(array('local' => _("Local user"), 'remote' => _("Remote address"))));
$var->setAction(Horde_Form_Action::factory('reload'));
if ($vars->destination_type == 'remote') {
$form->addVariable(_("Remote e-mail address"), 'virtual_destination', 'email', true, false);
} else {
$form->addVariable(_("Destination"), 'virtual_destination', 'enum', true, false, null, array($user_list, true));
}
if ($form->validate($vars)) {
$form->getInfo($vars, $info);
$info['stripped_email'] = Horde_String::lower($info['stripped_email']);
if ($info['destination_type'] == 'remote') {
$info['virtual_destination'] = Horde_String::lower($info['virtual_destination']);
}
try {
$virtual_id = $vilma->driver->saveVirtual($info, $domain);
$notification->push(_("Virtual email saved."), 'horde.success');
Horde::url('virtuals/index.php', true)->add('user', $info['virtual_destination'])->redirect();
} catch (Exception $e) {
Horde::log($e);
$notification->push(sprintf(_("Error saving virtual email. %s."), $e->getMessage()), 'horde.error');
}
}
/* Render the form. */
$renderer = new Horde_Form_Renderer();
$page_output->header();
$notification->notify(array('listeners' => 'status'));
$form->renderActive($renderer, $vars, Horde::url('virtuals/edit.php'), 'post');
$page_output->footer();
示例14: run
public function run()
{
extract($this->_params, EXTR_REFS);
$form_submit = $vars->get('submitbutton');
$channel_id = $vars->get('channel_id');
$story_id = $vars->get('id');
/* Driver */
$driver = $GLOBALS['injector']->getInstance('Jonah_Driver');
/* Fetch the channel details, needed for later and to check if valid
* channel has been requested. */
try {
$channel = $driver->getChannel($channel_id);
} catch (Exception $e) {
$notification->push(sprintf(_("Story editing failed: %s"), $e->getMessage()), 'horde.error');
Horde::url('channels/index.php', true)->redirect();
exit;
}
/* Check permissions. */
if (!Jonah::checkPermissions(Jonah::typeToPermName($channel['channel_type']), Horde_Perms::DELETE, $channel_id)) {
$notification->push(_("You are not authorised for this action."), 'horde.warning');
throw new Horde_Exception_AuthenticationFailure();
}
try {
$story = $driver->getStory($channel_id, $story_id);
} catch (Exception $e) {
$notification->push(_("No valid story requested for deletion."), 'horde.message');
Horde::url('channels/index.php', true)->redirect();
exit;
}
/* If not yet submitted set up the form vars from the fetched story. */
if (empty($form_submit)) {
$vars = new Horde_Variables($story);
}
$title = sprintf(_("Delete News Story \"%s\"?"), $vars->get('title'));
$form = new Horde_Form($vars, $title);
$form->setButtons(array(_("Delete"), _("Do not delete")));
$form->addHidden('', 'channel_id', 'int', true, true);
$form->addHidden('', 'id', 'int', true, true);
$form->addVariable(_("Really delete this News Story?"), 'confirm', 'description', false);
if ($form_submit == _("Delete")) {
if ($form->validate($vars)) {
$form->getInfo($vars, $info);
try {
$delete = $driver->deleteStory($info['channel_id'], $info['id']);
$notification->push(_("The story has been deleted."), 'horde.success');
Horde::url('stories/index.php', true)->add('channel_id', $channel_id)->setRaw(true)->redirect();
exit;
} catch (Exception $e) {
$notification->push(sprintf(_("There was an error deleting the story: %s"), $e->getMessage()), 'horde.error');
}
}
} elseif (!empty($form_submit)) {
$notification->push(_("Story has not been deleted."), 'horde.message');
$url = Horde::url('stories/index.php', true)->add('channel_id', $channel_id)->setRaw(true);
Horde::url('stories/index.php', true)->add('channel_id', $channel_id)->setRaw(true)->redirect();
exit;
}
$GLOBALS['page_output']->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
$form->renderActive(null, $vars, Horde::url('stories/delete.php'), 'post');
$GLOBALS['page_output']->footer();
}
示例15: array
$form->addHidden('', 'fax_id', 'int', false);
$form->addVariable(_("Fax destination"), 'fax_number', 'text', true, false, null, array('/^\\d+$/'));
if ($form->validate($vars)) {
$form->getInfo($vars, $info);
$send = $hylax->storage->send($info['fax_id'], $info['fax_number']);
if (is_a($send, 'PEAR_Error')) {
$notification->push(sprintf(_("Could not send fax ID \"%s\". %s"), $info['fax_id'], $send->getMessage()), 'horde.error');
} else {
$notification->push(sprintf(_("Fax ID \"%s\" submitted successfully."), $info['fax_id']), 'horde.success');
}
Horde::url($url, true)->redirect();
}
/* Get the preview pages. */
$pages = Hylax::getPages($fax_id, $fax['fax_pages']);
/* Render the form. */
require_once 'Horde/Form/Renderer.php';
$renderer = new Horde_Form_Renderer();
Horde::startBuffer();
$form->renderActive($renderer, $vars, Horde::url('send.php'), 'post');
$send_form = Horde::endBuffer();
/* Set up template. */
$template = $injector->createInstance('Horde_Template');
$template->set('form', $send_form);
$template->set('pages', $pages);
$template->set('menu', $menu->getMenu());
Horde::startBuffer();
$notification->notify(array('listeners' => 'status'));
$template->set('notify', Horde::endBuffer());
$page_output->header(array('title' => $title));
echo $template->fetch(HYLAX_TEMPLATES . '/fax/fax.html');
$page_output->footer();