本文整理汇总了PHP中Horde_Form::addHidden方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Form::addHidden方法的具体用法?PHP Horde_Form::addHidden怎么用?PHP Horde_Form::addHidden使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Form
的用法示例。
在下文中一共展示了Horde_Form::addHidden方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Display form
*
* @param integer $form_id Form id dispaly
* @param string $target_url Target url to link form to
*/
public function display($form_id, $target_url = null)
{
/* Get the stored form information from the backend. */
try {
$form_info = $GLOBALS['injector']->getInstance('Ulaform_Factory_Driver')->create()->getForm($form_id, Horde_Perms::READ);
} catch (Horde_Exception $e) {
throw new Ulaform_Exception($e->getMessage());
}
if (!empty($form_info['form_params']['language'])) {
Horde_Nls::setLanguageEnvironment($form_info['form_params']['language']);
}
$vars = Horde_Variables::getDefaultVariables();
$vars->set('form_id', $form_id);
$form = new Horde_Form($vars);
$form->addHidden('', 'form_id', 'int', false);
$form->addHidden('', 'user_uid', 'text', false);
$form->addHidden('', 'email', 'email', false);
$vars->set('user_uid', $GLOBALS['registry']->getAuth());
$vars->set('email', $GLOBALS['prefs']->getValue('from_addr'));
try {
$fields = $GLOBALS['injector']->getInstance('Ulaform_Factory_Driver')->create()->getFields($form_id);
} catch (Ulaform_Exception $e) {
throw new Ulaform_Exception($e->getMessage());
}
foreach ($fields as $field) {
/* In case of these types get array from stringlist. */
if ($field['field_type'] == 'link' || $field['field_type'] == 'enum' || $field['field_type'] == 'multienum' || $field['field_type'] == 'mlenum' || $field['field_type'] == 'radio' || $field['field_type'] == 'set' || $field['field_type'] == 'sorter') {
$field['field_params']['values'] = Ulaform::getStringlistArray($field['field_params']['values']);
}
/* Setup the field with all the parameters. */
$form->addVariable($field['field_label'], $field['field_name'], $field['field_type'], $field['field_required'], $field['field_readonly'], $field['field_desc'], $field['field_params']);
}
/* Check if submitted and validate. */
$result = array('title' => $form_info['form_name']);
if ($form->validate()) {
$form->getInfo(null, $info);
try {
$GLOBALS['ulaform_driver']->submitForm($info);
return true;
} catch (Horde_Exception $e) {
throw new Ulaform_Exception(sprintf(_("Error submitting form. %s."), $e->getMessage()));
}
}
if (is_null($target_url)) {
$target_url = Horde::selfUrl(true);
}
Horde::startBuffer();
$form->renderActive(null, null, $target_url, 'post', 'multipart/form-data');
return array('title' => $form_info['form_name'], 'form' => Horde::endBuffer());
}
示例2: setupDeleteForm
/**
* Create a permission deleting form.
*
* @param Horde_Perms_Permission $permission A permissions object.
*/
public function setupDeleteForm($permission)
{
/* Initialise form if required. */
$this->_formInit();
$this->_form->setTitle(sprintf(Horde_Core_Translation::t("Delete permissions for \"%s\""), $this->_corePerms->getTitle($permission->getName())));
$this->_form->setButtons(array(array('class' => 'horde-delete', 'value' => Horde_Core_Translation::t("Delete")), array('class' => 'horde-cancel', 'value' => Horde_Core_Translation::t("Do not delete"))));
$this->_form->addHidden('', 'perm_id', 'text', false);
$this->_form->addVariable(sprintf(Horde_Core_Translation::t("Delete permissions for \"%s\" and any sub-permissions?"), $this->_corePerms->getTitle($permission->getName())), 'prompt', 'description', false);
}
示例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: prepareForm
function prepareForm($p_variables)
{
$v_account_name = $p_variables->get('account_name');
$v_form = new Horde_Form($p_variables, $v_account_name . '::Event', 'event');
$v_form->addVariable('Date', 'date', 'date', true);
$v_form->addVariable('Description', 'description', 'text', true);
$v_form->addHidden('', 'account_id', 'text', false);
$v_form->addHidden('', 'account_name', 'text', false);
$v_form->addVariable('Is it income?', 'is_income', 'boolean', true);
$v_accountsAndCategories = Book::Singleton()->getAccountsAndCategories();
$v_form->addVariable('To/From', 'other_account_id', 'enum', true, false, '', array($v_accountsAndCategories, true));
$v_form->addVariable('Amount', 'amount', 'text', true);
$v_form->addVariable('Is it cleared?', 'is_cleared', 'boolean', true);
$v_form->addVariable('Statement reference', 'statement_item_id', 'text', false);
$v_form->addHidden('', 'event_id', 'text', false);
$v_form->addHidden('', 'old_date', 'date', false);
$v_form->addHidden('', 'old_description', 'text', false);
$v_form->addHidden('', 'old_is_income', 'boolean', false);
$v_form->addHidden('', 'old_other_account_id', 'text', false);
$v_form->addHidden('', 'old_amount', 'text', false);
$v_form->addHidden('', 'old_is_cleared', 'boolean', false);
$v_form->addHidden('', 'old_statement_item_id', 'text', false);
return $v_form;
}
示例5: array
* @author Marko Djukic <marko@oblo.com>
*/
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('ulaform', array('admin' => true));
$delvars = Horde_Variables::getDefaultVariables();
$form_id = $delvars->get('form_id');
$form_submit = $delvars->get('submitbutton');
/* Set up the forms. */
$ulaform_driver = $injector->getInstance('Ulaform_Factory_Driver')->create();
$viewvars = new Horde_Variables($ulaform_driver->getForm($form_id));
$viewform = new Horde_Form($viewvars, _("Form Details"));
$delform = new Horde_Form($delvars, _("Delete this form?"));
$viewform->addVariable(_("Name"), 'form_name', 'text', false);
$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();
示例6: catch
*/
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('ansel');
$faces = $GLOBALS['injector']->getInstance('Ansel_Faces');
$face_id = Horde_Util::getFormData('face');
try {
$face = $faces->getFaceById($face_id);
} catch (Ansel_Exception $e) {
$notification->push($e->getMessage());
Horde::url('faces/search/all.php')->redirect();
exit;
}
$title = _("Tell us who is in this photo");
$vars = Horde_Variables::getDefaultVariables();
$form = new Horde_Form($vars, $title);
$form->addHidden('', 'face', 'int', true);
$form->addVariable(_("Person"), 'person', 'text', true);
$form->setButtons($title);
if ($form->validate()) {
if (Horde_Util::getFormData('submitbutton') == _("Cancel")) {
$notification->push(_("Action was cancelled."), 'horde.warning');
} else {
$report = Ansel_Report::factory();
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($face['gallery_id']);
$face_link = Horde::url('faces/custom.php', true)->add(array('name' => $vars->get('person'), 'face' => $face_id, 'image' => $face['image_id']))->setRaw(true);
$title = _("I know who is on one of your photos");
$body = _("Gallery Name") . ': ' . $gallery->get('name') . "\n" . _("Gallery Description") . ': ' . $gallery->get('desc') . "\n\n" . $title . "\n" . _("Person") . ': ' . $vars->get('person') . "\n" . _("Face") . ': ' . $face_link;
$report->setTitle($title);
try {
$result = $report->report($body, $gallery->get('owner'));
$notification->push(_("The owner of the photo, who will delegate the face name, was notified."), 'horde.success');
示例7: asort
$new_name = Horde_Util::getFormData('new_name');
$result = $friends->renameGroup($g, $new_name);
if ($result instanceof PEAR_Error) {
$notification->push($result);
} else {
$notification->push(sprintf(_("Group \"%s\" has been renamed to \"%s\"."), $groups[$g], $new_name), 'horde.success');
Horde::url('edit/groups.php')->redirect();
}
}
break;
default:
// Manage adding groups
$form = new Horde_Form($vars, _("Add group"), 'addgroup');
$translated = Horde::loadConfiguration('groups.php', 'groups', 'folks');
asort($translated);
$form->addHidden('action', 'action', 'text', 'add');
$form->addVariable(_("Name"), 'translated_name', 'radio', false, false, null, array($translated, true));
$form->addVariable(_("Name"), 'custom_name', 'text', false, false, _("Enter custom name"));
if ($form->validate()) {
$form->getInfo(null, $info);
if (empty($info['custom_name'])) {
$name = $info['translated_name'];
} else {
$name = $info['custom_name'];
}
$result = $friends->addGroup($name);
if ($result instanceof PEAR_Error) {
$notification->push($result);
} else {
if (empty($info['custom_name'])) {
$name = $translated[$info['translated_name']];
示例8: array
Horde::url('view.php?view=List', true)->redirect();
exit;
}
if (($image_id = Horde_Util::getFormData('image')) !== null) {
$title = _("Do you really want to report this photo?");
$return_url = Ansel::getUrlFor('view', array('view' => 'Image', 'image' => $image_id, 'gallery' => $gallery_id), true);
} else {
$return_url = Ansel::getUrlFor('view', array('gallery' => $gallery_id, 'view' => 'Gallery'), true);
}
$vars = Horde_Variables::getDefaultVariables();
$form = new Horde_Form($vars, $title);
$form->setButtons(array(array('class' => 'horde-default', 'value' => _("Report")), array('class' => 'horde-cancel', 'value' => _("Cancel"))));
$enum = array('advertisement' => _("Advertisement content"), 'terms' => _("Terms and conditions infringement"), 'offensive' => _("Offensive content"), 'copyright' => _("Copyright infringement"));
$form->addVariable($gallery->get('name'), 'name', 'description', false);
$form->addVariable($gallery->get('desc'), 'desc', 'description', false);
$form->addHidden('', 'gallery', 'text', true, true);
$vars->set('gallery', $gallery_id);
$form->addVariable(_("Report type"), 'type', 'radio', true, false, null, array($enum));
$form->addVariable(_("Report reason"), 'reason', 'longtext', true);
$gallery_id = Horde_Util::getFormData('id');
if ($vars->get('submitbutton') == _("Cancel")) {
Horde::url('', true)->redirect();
}
if ($form->validate()) {
if (Horde_Util::getFormData('submitbutton') == _("Report")) {
$report = Ansel_Report::factory();
$body = _("Gallery Name") . ': ' . $gallery->get('name') . "\n" . _("Gallery Description") . ': ' . $gallery->get('desc') . "\n" . _("Gallery Id") . ': ' . $gallery->id . "\n" . _("Report type") . ': ' . $enum[$vars->get('type')] . "\n" . _("Report reason") . ': ' . $vars->get('reason') . "\n" . $return_url;
try {
$result = $report->report($body);
$notification->push(_("Gallery was reported."), 'horde.success');
} catch (Horde_Exception $e) {
示例9: array
* @package Horde
*/
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('horde', array('authentication' => 'none'));
$vars = $injector->getInstance('Horde_Variables');
// Make sure auth backend allows passwords to be reset.
$auth = $injector->getInstance('Horde_Core_Factory_Auth')->create();
if (empty($conf['auth']['resetpassword']) || !$auth->hasCapability('resetpassword')) {
$notification->push(_("Cannot reset password automatically, contact your administrator."), 'horde.error');
$registry->getServiceLink('login')->add('url', $vars->url)->redirect();
}
$title = _("Reset your password");
$form = new Horde_Form($vars, $title);
$form->setButtons(_("Continue"));
/* Set up the fields for the username and alternate email. */
$form->addHidden('', 'url', 'text', false);
$v =& $form->addVariable(_("Username"), 'username', 'text', true);
$v->setOption('trackchange', true);
$form->addVariable(_("Alternate email address"), 'email', 'email', true);
$can_validate = false;
/* If a username has been supplied try fetching the prefs stored info. */
if ($username = $vars->get('username')) {
$username = $registry->convertUsername($username, true);
$prefs = $injector->getInstance('Horde_Core_Factory_Prefs')->create('horde', array('cache' => false, 'user' => $username));
$email = $prefs->getValue('alternate_email');
/* Does the alternate email stored in prefs match the one submitted? */
if ($vars->get('email') == $email) {
$can_validate = true;
$form->setButtons(_("Reset Password"));
$question = $prefs->getValue('security_question');
$form->addVariable($question, 'question', 'description', false);
示例10: array
if (empty($added_nodes[$idx])) {
if ($key == $lcount) {
$node_params['url'] = $base_url->copy()->setRaw(true)->add(array('show' => 'entry', 'topic' => $id));
$added_nodes[$idx] = true;
}
$tree->addNode(array('id' => $idx, 'parent' => $parent, 'label' => $name, 'expanded' => false, 'params' => $node_params));
}
$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;
}
示例11: array
if (!$conf['sharing']['allow']) {
Horde::url('stories/view.php', true)->add(array('story_id' => $story_id, 'channel_id' => $channel_id))->redirect();
exit;
}
$story = $GLOBALS['injector']->getInstance('Jonah_Driver')->getStory($channel_id, $story_id);
if (is_a($story, 'PEAR_Error')) {
$notification->push(sprintf(_("Error fetching story: %s"), $story->getMessage()), 'horde.warning');
$story = '';
}
$vars->set('subject', $story['title']);
/* Set up the form. */
$form = new Horde_Form($vars);
$title = _("Share Story");
$form->setTitle($title);
$form->setButtons(_("Send"));
$form->addHidden('', 'channel_id', 'int', false);
$form->addHidden('', 'id', 'int', false);
$v =& $form->addVariable(_("From"), 'from', 'email', true, false);
if ($GLOBALS['registry']->getAuth()) {
$v->setDefault($injector->getInstance('Horde_Core_Factory_Identity')->create()->getValue('from_addr'));
}
$form->addVariable(_("To"), 'recipients', 'email', true, false, _("Separate multiple email addresses with commas."), true);
$form->addVariable(_("Subject"), 'subject', 'text', true);
$form->addVariable(_("Include"), 'include', 'enum', true, false, null, array(array(_("A link to the story"), _("The complete text of the story"))));
$form->addVariable(_("Message"), 'message', 'longtext', false, false, null, array(4, 40));
if ($form->validate($vars)) {
$form->getInfo($vars, $info);
$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 {
示例12: array
/* Get details for this action. */
$actions = Ulaform_Action::getDrivers();
/* Check if user changed action. */
if ($form_action != $old_form_action && $formname) {
$changed_action = true;
$notification->push(_("Changed action driver."), 'horde.message');
}
/* Selected a action so get the info and parameters for this action. */
if ($form_action) {
$action_info = Ulaform::getActionInfo($form_action);
$action_params = Ulaform::getActionParams($form_action);
}
/* Set up the form. */
$form = new Horde_Form($vars, _("Form Details"));
$form->setButtons(empty($form_id) ? _("Create") : _("Modify"), true);
$form->addHidden('', 'form_id', 'int', false);
$form->addHidden('', 'old_form_action', 'text', false);
$form->addVariable(_("Name"), 'form_name', 'text', true);
/* Selectable action drivers and update form based on selection. */
$v = $form->addVariable(_("Action"), 'form_action', 'enum', true, false, null, array(array('' => _("-- select --")) + $actions));
$v->setAction(Horde_Form_Action::factory('submit'));
$v->setHelp('form-action');
if (!empty($action_params)) {
foreach ($action_params as $id => $param) {
$param['required'] = isset($param['required']) ? $param['required'] : true;
$param['readonly'] = isset($param['readonly']) ? $param['readonly'] : false;
$param['desc'] = isset($param['desc']) ? $param['desc'] : null;
$param['params'] = isset($param['params']) ? $param['params'] : null;
$form->addVariable($param['label'], 'form_params[' . $id . ']', $param['type'], $param['required'], $param['readonly'], $param['desc'], $param['params']);
}
}
示例13: 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();
}
示例14: elseif
$vars = Horde_Variables::getDefaultVariables();
$fax_id = $vars->get('fax_id');
$url = $vars->get('url', 'folder.php');
$fax = $hylax->storage->getFax($fax_id);
if (is_a($fax, 'PEAR_Error')) {
$notification->push(sprintf(_("Could not open fax ID \"%s\". %s"), $fax_id, $fax->getMessage()), 'horde.error');
Horde::url($url, true)->redirect();
} elseif (!empty($fax['fax_number'])) {
$notification->push(sprintf(_("Fax ID \"%s\" already has a fax number set."), $fax_id), 'horde.error');
Horde::url($url, true)->redirect();
}
$title = _("Send Fax");
/* Set up the form. */
$form = new Horde_Form($vars, $title);
$form->setButtons(_("Send"), true);
$form->addHidden('', 'url', 'text', false);
$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. */
示例15: catch
/* Get some variables. */
$vars = Horde_Variables::getDefaultVariables();
$formname = $vars->get('formname');
if (is_null($formname)) {
if ($vars->exists('field_id')) {
$vars = $ulaform_driver->getField($vars->get('form_id'), $vars->get('field_id'));
$vars = new Horde_Variables($vars);
} else {
$notification->push(_("No field specified."), 'horde.warning');
Horde::url('fields.php', true)->add('form_id', $vars->get('form_id'))->redirect();
}
}
/* Set up the form. */
$fieldform = new Horde_Form($vars, _("Delete Field"));
$fieldform->setButtons(array(_("Delete"), _("Do not delete")));
$fieldform->addHidden('', 'field_id', 'int', true);
$fieldform->addHidden('', 'form_id', 'int', true);
$fieldform->addHidden('', 'field_name', 'text', false);
$fieldform->addVariable(_("Delete this field?"), 'field_name', 'text', false, true);
if ($vars->get('submitbutton') == _("Delete")) {
$fieldform->validate($vars);
if ($fieldform->isValid()) {
$fieldform->getInfo($vars, $info);
try {
$del_field = $injector->getInstance('Ulaform_Factory_Driver')->create()->deleteField($info['field_id']);
$notification->push(sprintf(_("Field \"%s\" deleted."), $info['field_name']), 'horde.success');
Horde::url('fields.php', true)->add('form_id', $info['form_id'])->redirect();
} catch (Ulaform_Exception $e) {
$notification->push(sprintf(_("Error deleting field. %s."), $e->getMessage()), 'horde.error');
}
}