当前位置: 首页>>代码示例>>PHP>>正文


PHP Horde_Form::setButtons方法代码示例

本文整理汇总了PHP中Horde_Form::setButtons方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Form::setButtons方法的具体用法?PHP Horde_Form::setButtons怎么用?PHP Horde_Form::setButtons使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Horde_Form的用法示例。


在下文中一共展示了Horde_Form::setButtons方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
 }
开发者ID:horde,项目名称:horde,代码行数:14,代码来源:Ui.php

示例2: prepareImportForm

function prepareImportForm($p_variables, &$p_statement_file_variable)
{
    $v_form = new Horde_Form($p_variables, 'Import Statement', 'import_statement');
    $p_statement_file_variable = $v_form->addVariable('Statement File (CSV)', 'statement_file', 'file', TRUE);
    $v_file_description = '<p>The file must conform to the CSV standard and contain only ' . 'printable, UTF-8 characters.</p>' . '<p>Fields are:</p>' . '<ul><li>Item ID (unique)</li><li>Account Name</li>' . '<li>Item Type (O: opening balance, E: event, C: closing balance)</li>' . '<li>Description</li><li>Amount</li></ul>';
    $v_file_description_variable = $v_form->addVariable('', 'description', 'html', FALSE, TRUE);
    $v_file_description_variable->setDefault($v_file_description);
    $v_form->setButtons('import');
    return $v_form;
}
开发者ID:psagi,项目名称:cloudbank,代码行数:10,代码来源:statement.php

示例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();
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:57,代码来源:ChannelDelete.php

示例4: catch

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');
        } catch (Ansel_Exception $e) {
            $notification->push(_("Face name was not reported.") . ' ' . $e->getMessage(), 'horde.error');
开发者ID:horde,项目名称:horde,代码行数:31,代码来源:claim.php

示例5: catch

try {
    $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($vars->get('gallery'));
} catch (Ansel_Exception $e) {
    $notification->push($gallery->getMessage());
    Horde::url('view.php?view=List', true)->redirect();
    exit;
}
$url = $vars->get('url');
$form = new Horde_Form($vars, _("Content Disclaimer"), 'disclamer');
$form->addVariable($gallery->get('name'), 'name', 'description', false);
$form->addVariable($gallery->get('desc'), 'desc', 'description', false);
$form->addHidden('', 'url', 'text', true);
$form->addHidden('', 'gallery', 'int', true);
$msg = sprintf(_("Photo content may be offensive. You must be over %d to continue."), $gallery->get('age'));
$form->addVariable($msg, 'warning', 'description', false);
$form->setButtons(array(sprintf(_("Continue - I'm over %d"), $gallery->get('age')), _("Cancel")));
if ($form->isSubmitted()) {
    if (Horde_Util::getFormData('submitbutton') == _("Cancel")) {
        $notification->push("You are not authorised to view this photo.", 'horde.warning');
        Horde::url('view.php?view=List', true)->redirect();
        exit;
    } else {
        $session->set('ansel', 'user_age', (int) $gallery->get('age'));
        $url->redirect();
        exit;
    }
}
$page_output->header();
$notification->notify(array('listeners' => 'status'));
$form->renderActive(null, null, null, 'post');
$page_output->footer();
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:disclamer.php

示例6: header

if ($message instanceof PEAR_Error) {
    $notification->push(sprintf(_("Could not open the message. %s"), $message->getMessage()), 'horde.warning');
    Horde::url('forums.php', true)->redirect();
}
/* Check delete permissions */
if (!$messages->hasPermission(Horde_Perms::DELETE)) {
    $notification->push(sprintf(_("You don't have permission to delete messages in forum %s."), $forum_id), 'horde.warning');
    $url = Agora::setAgoraId($forum_id, $message_id, Horde::url('messages/index.php', true), $scope);
    header('Location: ' . $url);
    exit;
}
/* Get the form object. */
$vars = Horde_Variables::getDefaultVariables();
$form = new Horde_Form($vars, sprintf(_("Split \"%s\""), $message['message_subject']));
// TODO Cancel button doesn't work currently, because it has no condition set
$form->setButtons(array(_("Split"), _("Cancel")));
$form->addHidden('', 'agora', 'text', false);
$form->addHidden('', 'scope', 'text', false);
/* Validate the form. */
if ($form->validate()) {
    $form->getInfo($vars, $info);
    if ($vars->get('submitbutton') == _("Split")) {
        $split = $messages->splitThread($message_id);
        if ($split instanceof PEAR_Error) {
            $notification->push($split->getMessage(), 'horde.error');
        } else {
            $notification->push(sprintf(_("Thread splitted by message %s."), $message_id), 'horde.error');
            header('Location: ' . Agora::setAgoraId($forum_id, $message_id, Horde::url('messages/index.php', true), $scope));
            exit;
        }
    }
开发者ID:raz0rsdge,项目名称:horde,代码行数:31,代码来源:split.php

示例7: catch

try {
    $gallery = $injector->getInstance('Ansel_Storage')->getGallery($gallery_id);
} catch (Ansel_Exception $e) {
    $notification->push($e->getMessage());
    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;
开发者ID:raz0rsdge,项目名称:horde,代码行数:31,代码来源:report.php

示例8: array

 * did not receive this file, see http://www.horde.org/licenses/lgpl.
 *
 * @author   Chuck Hagenbuch <chuck@horde.org>
 * @category Horde
 * @license  http://www.horde.org/licenses/lgpl LGPL-2
 * @package  Horde
 */
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('horde', array('permission' => array('horde:administration:users')));
$auth = $injector->getInstance('Horde_Core_Factory_Auth')->create();
$vars = $injector->getInstance('Horde_Variables');
if ($conf['signup']['allow'] && $conf['signup']['approve']) {
    $signup = $injector->getInstance('Horde_Core_Auth_Signup');
}
$addForm = new Horde_Form($vars, _("Add a new user:"), 'adduser');
$addForm->setButtons(_("Add user"), _("Reset"));
$addForm->addHidden('', 'form', 'text', true, true);
/* Use hooks get any extra fields for new accounts. */
try {
    $extra = $injector->getInstance('Horde_Core_Hooks')->callHook('signup_getextra', 'horde');
    if (!empty($extra)) {
        if (!isset($extra['user_name'])) {
            $addForm->addVariable(_("Username"), 'user_name', 'text', true);
        }
        if (!isset($extra['password'])) {
            $addForm->addVariable(_("Password"), 'password', 'passwordconfirm', false, false, _("type the password twice to confirm"));
        }
        foreach ($extra as $field_name => $field) {
            $readonly = isset($field['readonly']) ? $field['readonly'] : null;
            $desc = isset($field['desc']) ? $field['desc'] : null;
            $field_params = isset($field['params']) ? $field['params'] : array();
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:31,代码来源:user.php

示例9: array

             $idx .= '|' . $name;
             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;
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:index.php

示例10: 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();
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:62,代码来源:StoryDelete.php

示例11: array

if ($virtual_id && !$formname) {
    $vars = new Horde_Variables($vilma->driver->getVirtual($virtual_id));
    $editing = true;
}
if (empty($domain)) {
    $domain = Vilma::stripDomain($vars->virtual_destination);
}
$users = $vilma->driver->getUsers($domain);
$user_list = array();
foreach ($users as $user) {
    $virtual_destination = substr($user['user_name'], 0, strpos($user['user_name'], '@'));
    $user_list[$user['user_name']] = $virtual_destination;
}
$form = new Horde_Form($vars, $editing ? _("Edit Virtual Email Address") : _("New Virtual Email Address"));
/* Set up the form. */
$form->setButtons(true, true);
$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']);
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:edit.php

示例12: array

 * @category Horde
 * @license  http://www.horde.org/licenses/lgpl LGPL-2
 * @package  Horde
 */
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('horde', array('nologintasks' => true));
// Make sure auth backend allows passwords to be reset.
$auth = $injector->getInstance('Horde_Core_Factory_Auth')->create();
if (!$auth->hasCapability('update')) {
    $notification->push(_("Changing your password is not supported with the current configuration.  Contact your administrator."), 'horde.error');
    $registry->getServiceLink('login')->add('url', Horde_Util::getFormData('url'))->redirect();
}
$vars = $injector->getInstance('Horde_Variables');
$title = _("Change Your Password");
$form = new Horde_Form($vars, $title);
$form->setButtons(_("Continue"));
$form->addVariable(_("Old password"), 'old_password', 'password', true);
$form->addVariable(_("New password"), 'password_1', 'password', true);
$form->addVariable(_("Retype new password"), 'password_2', 'password', true);
if ($form->validate($vars)) {
    $form->getInfo($vars, $info);
    if ($registry->getAuthCredential('password') != $info['old_password']) {
        $notification->push(_("Old password is not correct."), 'horde.error');
    } elseif ($info['password_1'] != $info['password_2']) {
        $notification->push(_("New passwords don't match."), 'horde.error');
    } elseif ($info['old_password'] == $info['password_1']) {
        $notification->push(_("Old and new passwords must be different."), 'horde.error');
    } else {
        try {
            $auth->updateUser($registry->getAuth(), $registry->getAuth(), array('password' => $info['password_1']));
            $notification->push(_("Password changed successfully."), 'horde.success');
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:changepassword.php

示例13: header

if ($message instanceof PEAR_Error) {
    $notification->push(sprintf(_("Could not open the message. %s"), $message->getMessage()), 'horde.warning');
    Horde::url('forums.php', true)->redirect();
}
/* We have any moderators? */
$forum = $messages->getForum();
if (!isset($forum['moderators'])) {
    $notification->push(_("No moderators are associated with this forum."), 'horde.warning');
    $url = Agora::setAgoraId($forum_id, $message_id, Horde::url('messages/index.php', true), $scope);
    header('Location: ' . $url);
    exit;
}
/* Get the form object. */
$vars = Horde_Variables::getDefaultVariables();
$form = new Horde_Form($vars, _("Report as abuse"));
$form->setButtons(array(_("Report as abuse"), _("Cancel")));
$form->addHidden('', 'agora', 'text', false);
$form->addHidden('', 'scope', 'text', false);
if ($form->validate()) {
    $url = Agora::setAgoraId($forum_id, $message_id, Horde::url('messages/index.php', true), $scope);
    if ($vars->get('submitbutton') == _("Cancel")) {
        header('Location: ' . $url);
        exit;
    }
    /* Collect moderators emails, and send them the notify */
    $emails = array();
    foreach ($forum['moderators'] as $moderator) {
        $identity = $injector->getInstance('Horde_Core_Factory_Identity')->create($moderator);
        $address = $identity->getValue('from_addr');
        if (!empty($address)) {
            $emails[] = $address;
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:abuse.php

示例14: header

$message = $messages->getMessage($message_id);
if ($message instanceof PEAR_Error) {
    $notification->push(sprintf(_("Could not open the message. %s"), $message->getMessage()), 'horde.warning');
    Horde::url('forums.php', true)->redirect();
}
/* Check delete permissions */
if (!$messages->hasPermission(Horde_Perms::DELETE)) {
    $notification->push(sprintf(_("You don't have permission to delete messages in forum %s."), $forum_id), 'horde.warning');
    $url = Agora::setAgoraId($forum_id, $message_id, Horde::url('messages/index.php', true), $scope);
    header('Location: ' . $url);
    exit;
}
/* Get the form object. */
$vars = Horde_Variables::getDefaultVariables();
$form = new Horde_Form($vars, sprintf(_("Locking thread \"%s\""), $message['message_subject']));
$form->setButtons(_("Update"), true);
$form->addHidden('', 'agora', 'text', false);
$v = $form->addVariable(_("Allow replies in this thread"), 'message_lock', 'radio', true, false, null, array(array('0' => _("Yes, allow replies"), '1' => _("No, do not allow replies"))));
$v->setDefault('0');
if ($form->validate()) {
    $form->getInfo($vars, $info);
    /* Try and delete this message. */
    $result = $messages->setThreadLock($message_id, $info['message_lock']);
    if ($result instanceof PEAR_Error) {
        $notification->push(sprintf(_("Could not lock the thread. %s"), $result->getMessage()), 'horde.error');
    } else {
        if ($info['message_lock']) {
            $notification->push(_("Thread locked."), 'horde.success');
        } else {
            $notification->push(_("Thread unlocked."), 'horde.success');
        }
开发者ID:horde,项目名称:horde,代码行数:31,代码来源:lock.php

示例15:

/**
 * Process an single image (to be called by ajax)
 *
 * Copyright 2008-2014 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author Duck <duck@obala.net>
 */
require_once 'tabs.php';
/* Search from */
$form = new Horde_Form($vars);
$form->addVariable(_("Face name to search"), 'face_name', 'text', true);
$form->setButtons(_("Search"));
$page = Horde_Util::getFormData('page', 0);
$perpage = $prefs->getValue('facesperpage');
$name = Horde_Util::getFormData('face_name');
if (!empty($name)) {
    $page = Horde_Util::getFormData('page', 0);
    $perpage = $prefs->getValue('faceperpage');
    $count = $faces->countSearchFaces($name);
    if ($count) {
        $results = $faces->searchFaces($name, $page * $perpage, $perpage);
    }
} else {
    $page = 0;
    $perpage = 0;
    $count = 0;
}
开发者ID:jubinpatel,项目名称:horde,代码行数:30,代码来源:name.php


注:本文中的Horde_Form::setButtons方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。