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


PHP Horde_Variables::set方法代码示例

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


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

示例1: html

 public function html($active = true)
 {
     global $browser, $conf, $registry;
     if (!$this->contact || !$this->contact->hasPermission(Horde_Perms::READ)) {
         echo '<h3>' . _("The requested contact was not found.") . '</h3>';
         return;
     }
     $vars = new Horde_Variables();
     $form = new Turba_Form_Contact($vars, $this->contact);
     $form->setOpenSection(Horde_Util::getFormData('section', 0));
     /* Get the contact's history. */
     $history = $this->contact->getHistory();
     foreach ($history as $what => $when) {
         $v = $form->addVariable($what == 'created' ? _("Created") : _("Last Modified"), 'object[__' . $what . ']', 'text', false, false);
         $v->disable();
         $vars->set('object[__' . $what . ']', $when);
     }
     echo '<div id="Contact"' . ($active ? '' : ' style="display:none"') . '>';
     $form->renderInactive($form->getRenderer(), $vars);
     /* Comments. */
     if (!empty($conf['comments']['allow']) && $registry->hasMethod('forums/doComments')) {
         try {
             $comments = $registry->call('forums/doComments', array('turba', $this->contact->driver->getName() . '.' . $this->contact->getValue('__key'), 'commentCallback'));
         } catch (Horde_Exception $e) {
             Horde::log($e, 'DEBUG');
             $comments = array();
         }
     }
     if (!empty($comments['threads'])) {
         echo '<br />' . $comments['threads'];
     }
     if (!empty($comments['comments'])) {
         echo '<br />' . $comments['comments'];
     }
     echo '</div>';
     if ($active && $browser->hasFeature('dom')) {
         if ($this->contact->hasPermission(Horde_Perms::EDIT)) {
             $edit = new Turba_View_EditContact($this->contact);
             $edit->html(false);
         }
         if ($this->contact->hasPermission(Horde_Perms::DELETE)) {
             $delete = new Turba_View_DeleteContact($this->contact);
             $delete->html(false);
         }
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:46,代码来源:Contact.php

示例2: array

$fieldform->addVariable(_("Description"), 'field_desc', 'longtext', false, false, '', array(3, 40));
/* Check if the submitted field type has extra parameters and set them up. */
$field_type = $vars->get('field_type');
$available_params = Ulaform::getFieldParams($field_type);
if (!is_null($vars->get('formname')) && $vars->get($v->getVarName()) != $vars->get('__old_' . $v->getVarName()) && !empty($available_params)) {
    $notification->push(_("This field type has extra parameters."), 'horde.message');
}
foreach ($available_params as $name => $param) {
    $field_id = 'field_params[' . $name . ']';
    $param['required'] = isset($param['required']) ? $param['required'] : null;
    $param['readonly'] = isset($param['readonly']) ? $param['readonly'] : null;
    $param['desc'] = isset($param['desc']) ? $param['desc'] : null;
    $fieldform->addVariable($param['label'], $field_id, $param['type'], $param['required'], $param['readonly'], $param['desc']);
}
/* Set the current field type to the old field type var. */
$vars->set('old_field_type', $field_type);
if ($fieldform->validate($vars)) {
    /* Save field if valid and the current and old field type match. */
    $fieldform->getInfo($vars, $info);
    try {
        $save_field = $injector->getInstance('Ulaform_Factory_Driver')->create()->saveField($info);
        $notification->push(_("Field saved."), 'horde.success');
        Horde::url('fields.php', true)->add('form_id', $info['form_id'])->redirect();
    } catch (Horde_Exception $e) {
        $notification->push(sprintf(_("Error saving field. %s."), $e->getMessage()), 'horde.error');
    }
}
/* Get a field list. */
try {
    $fields_list = $ulaform_driver->getFieldsList($form_id);
    if (empty($fields_list)) {
开发者ID:raz0rsdge,项目名称:horde,代码行数:31,代码来源:fields.php

示例3: foreach

    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']);
    }
}
/* Set default language for the form. */
$v = $form->addVariable(_("Default language"), 'form_params[language]', 'enum', false, false, null, array($registry->nlsconfig->languages, _("-- default configured --")));
$v->setOption('htmlchars', true);
/* TODO: set up Ulaform to insert any javascript saved here into the form. */
$v = $form->addVariable(_("Javascript to execute on form \"submit\":"), 'form_onsubmit', 'longtext', false, false, null, array(3, 40));
$v->setHelp('on-submit');
/* Set up the action choice fields. */
$vars->set('old_form_action', $form_action);
if ($formname && !$changed_action) {
    $form->validate($vars);
    if ($form->isValid()) {
        $form->getInfo($vars, $info);
        try {
            $form_id = $ulaform_driver->saveForm($info);
            $notification->push(_("Form details saved."), 'horde.success');
            Horde::url('forms.php', true)->redirect();
        } catch (Ulaform_Exception $e) {
            $notification->push(sprintf(_("Error saving form. %s."), $e->getMessage()), 'horde.error');
        }
    }
}
/* Render the form. */
$view = new Horde_View(array('templatePath' => ULAFORM_TEMPLATES));
开发者ID:raz0rsdge,项目名称:horde,代码行数:31,代码来源:edit.php

示例4: header

    $notification->push(_("Could not post the message: ") . $messages->getMessage(), 'horde.warning');
    Horde::url('forums.php', true)->redirect();
}
/* Check edit permissions */
if (!$messages->hasPermission(Horde_Perms::EDIT)) {
    $notification->push(sprintf(_("You don't have permission to post 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;
}
/* Check if a message is being edited. */
if ($message_id) {
    $message = $messages->getMessage($message_id);
    if (!$formname) {
        $vars = new Horde_Variables($message);
        $vars->set('message_subject', $message['message_subject']);
        $vars->set('message_body', $message['body']);
    }
    if ($message['attachments']) {
        $attachment_link = $messages->getAttachmentLink($message_id);
        if ($attachment_link) {
            $vars->set('attachment_preview', $attachment_link);
        }
    }
} else {
    $vars->set('forum_id', $forum_id);
    $vars->set('message_id', $message_id);
}
/* Get the forum details. */
$forum_name = $messages->_forum['forum_name'];
/* Set the title. */
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:edit.php

示例5: array

$beatnik = Horde_Registry::appInit('beatnik');
require_once BEATNIK_BASE . '/lib/Forms/EditRecord.php';
$domains = array();
if (Horde_Util::getGet('domain') == 'current') {
    $url = Horde::url('viewzone.php');
    $domains[] = $_SESSION['beatnik']['curdomain'];
} elseif (Horde_Util::getGet('domain') == 'all') {
    $url = Horde::url('listzones.php');
    foreach (Beatnik::needCommit() as $domain) {
        $domains[] = $beatnik->driver->getDomain($domain);
    }
}
foreach ($domains as $domain) {
    $_SESSION['beatnik']['curdomain'] = $domain;
    $vars = new Horde_Variables();
    $vars->set('rectype', 'soa');
    foreach ($domain as $field => $value) {
        $vars->set($field, $value);
    }
    $vars->set('serial', Beatnik::incrementSerial($domain['serial']));
    $form = new EditRecord($vars);
    $form->useToken(false);
    $form->setSubmitted(true);
    if ($form->validate($vars)) {
        $form->getInfo($vars, $info);
        try {
            $result = $beatnik->driver->saveRecord($info);
        } catch (Exception $e) {
            $notification->push($e->getMessage(), 'horde.error');
        }
        $notification->push(sprintf(_('Zone serial for %s incremented.'), $domain['zonename']), 'horde.success');
开发者ID:raz0rsdge,项目名称:horde,代码行数:31,代码来源:commit.php

示例6: setDetails

 /**
  * Sets all properties of the ticket necessary to display the
  * TicketDetailsForm.
  *
  * @param Horde_Variables $vars  The form variables object to set info in.
  * @param bool $split_owners     This has to be set if you want to use the
  *                               $vars var for saving later or otherwise
  *                               $form->validate() will fail
  */
 public function setDetails(Horde_Variables $vars, $split_owners = false)
 {
     $vars->set('id', $this->getId());
     foreach ($this->getDetails() as $varname => $value) {
         if ($varname == 'owners') {
             $owners = $gowners = array();
             foreach ($value as $owner) {
                 if (strpos($owner, 'user:') !== false) {
                     $owners[] = $owner;
                 } else {
                     $gowners[] = $owner;
                 }
             }
             $vars->add('owners', $owners);
             $vars->add('group_owners', $gowners);
         }
         $vars->add($varname, $value);
     }
     /* User formatting. */
     $vars->set('user_id_requester', Whups::formatUser($this->get('user_id_requester')));
     $vars->set('user_id_owner', Whups::getOwners($this->_id));
 }
开发者ID:horde,项目名称:horde,代码行数:31,代码来源:Ticket.php

示例7: catch

 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author Marko Djukic <marko@oblo.com>
 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('agora');
/* Set up the forums object. */
$forums = $injector->getInstance('Agora_Factory_Driver')->create();
list($forum_id, , $scope) = Agora::getAgoraId();
$scope = Horde_Util::getGet('scope', 'agora');
$vars = Horde_Variables::getDefaultVariables();
/* Check if a forum is being edited. */
if (isset($forum_id) && !$vars->get('forum_name')) {
    try {
        $vars = new Horde_Variables($forums->getForum($forum_id));
        $vars->set('forum_id', $forum_id);
    } catch (Horde_Exception $e) {
        $notification->push($e->getMessage());
        unset($forum_id);
    }
}
$title = isset($forum_id) ? _("Edit Forum") : _("New Forum");
/* Check permissions */
if (isset($forum_id) && !$registry->isAdmin(array('permission' => 'agora:admin'))) {
    $notification->push(sprintf(_("You don't have permissions to edit forum %s"), $registry->get('name', $scope)), 'horde.warning');
    Horde::url('forums.php', true)->redirect();
}
if (!$registry->isAdmin(array('permission' => 'agora:admin'))) {
    $notification->push(sprintf(_("You don't have permissions to create a new forum in %s"), $registry->get('name', $scope)), 'horde.warning');
    Horde::url('forums.php', true)->redirect();
}
开发者ID:horde,项目名称:horde,代码行数:31,代码来源:editforum.php

示例8: _doSearch

 /**
  * Performs a Task search. self::_tasks is populated with the results.
  *
  * @throws Nag_Exception
  */
 protected function _doSearch()
 {
     // Clear the tag browser in case we have an active browse set.
     $this->_browser->clearSearch();
     // Don't show the tag browser.
     $this->_showTagBrowser = false;
     $form = new Nag_Form_Search($this->_vars);
     if ($form->validate($this->_vars, true)) {
         $form->getInfo($this->_vars, $info);
     } else {
         throw new Nag_Exception(current($form->getErrors()));
     }
     // Text filter
     $search_pattern = $this->_vars->search_pattern;
     $search_in = empty($this->_vars->search_in) ? array() : $this->_vars->search_in;
     $search_name = in_array('search_name', $search_in) ? Nag_Search::MASK_NAME : 0;
     $search_desc = in_array('search_desc', $search_in) ? Nag_Search::MASK_DESC : 0;
     $search_tags = !empty($this->_vars->search_tags) ? Nag_Search::MASK_TAGS : 0;
     $search_completed = $this->_vars->search_completed;
     $this->_vars->set('show_completed', $search_completed);
     $mask = $search_name | $search_desc | $search_tags;
     // Date filter
     $date = $info['due_date'];
     if (empty($date)) {
         $date = array();
     }
     // Prepare the search
     $search = new Nag_Search($search_pattern, $mask, array('completed' => $search_completed, 'due' => $date, 'tags' => empty($this->_vars->search_tags) ? array() : $GLOBALS['injector']->getInstance('Nag_Tagger')->split($this->_vars->search_tags)));
     try {
         $tasks = $search->getSlice();
     } catch (Nag_Exception $e) {
         $GLOBALS['notification']->push($tasks, 'horde.error');
         $tasks = new Nag_Task();
     }
     // Save as a smart list?
     if ($id = $this->_vars->get('smart_id')) {
         // Existing list.
         $smartlist = $GLOBALS['nag_shares']->getShare($id);
         Nag::updateTasklist($smartlist, array('name' => $this->_vars->get('smartlist_name'), 'search' => serialize($search)));
         $this->_title = $smartlist->get('name');
         $this->_smartShare = $smartlist;
     } elseif ($this->_vars->get('save_smartlist')) {
         $this->_smartShare = Nag::addTasklist(array('name' => $this->_vars->get('smartlist_name'), 'search' => serialize($search)), false);
         $this->_title = $this->_vars->get('smartlist_name');
     } else {
         // Build a page title based on criteria.
         $this->_title = sprintf(_("Search: Results for"));
         $have_title = false;
         if (!empty($search_pattern)) {
             $have_title = true;
             $this->_title .= ' "' . $search_pattern . '" ';
         } else {
             $this->_title .= ' ' . _("tasks") . ' ';
         }
         if (!empty($date)) {
             if ($have_title) {
                 $this->_title .= _("and") . ' ';
             } else {
                 $this->_title .= _("with") . ' ';
                 $have_title = true;
             }
             $this->_title .= sprintf(_("due date within %d days of %s"), $date[0], $date[1]) . ' ';
         }
         if (!empty($search_tags)) {
             if ($have_title) {
                 $this->_title .= _("and") . ' ';
             } else {
                 $this->_title .= _("with") . ' ';
             }
             $this->_title .= sprintf(_("and tagged with %s"), $this->_vars->search_tags);
         }
     }
     $GLOBALS['session']->set('nag', 'search', $search, Horde_Session::TYPE_OBJECT);
     $this->_haveSearch = true;
     $this->_tasks = $tasks;
 }
开发者ID:horde,项目名称:horde,代码行数:81,代码来源:List.php

示例9: postMessage

 /**
  * Allows other Horde apps to post messages.
  *
  * The forum name is constructed by just the $forum_name variable under the
  * data root 'agora.forums.<app>'. It is up to the apps themselves to make
  * sure that the forum name is unique.
  *
  * If the forum does not exist, it will be automatically created by Agora.
  *
  * @access private
  *
  * @param string $scope       The application which is posting this message.
  * @param string $forum_name  The unique name for the forum.
  * @param string $callback    A callback method of the specified application
  *                            that gets called to make sure that posting to
  *                            this forum is allowed.
  * @param array $params       Any parameters for the forum message posting.
  * <pre>
  * message_id        - An existing message to edit
  * message_parent_id - The ID of the parent message
  * title             - Posting title
  * </pre>
  * @param string $url         If specified, the form gets submitted to this URL
  *                            instead of the current page.
  * @param array $variables    A hash with all variables of a submitted form
  *                            generated by this method.
  *
  * @return mixed  Returns either the rendered Horde_Form for posting a message
  *                or PEAR_Error object on error, or true in case of a
  *                successful post.
  */
 public function postMessage($scope, $forum_name, $callback, $params = array(), $url = null, $variables = null)
 {
     global $registry;
     /* Check if posting messages is allowed. */
     $check = $registry->callByPackage($scope, $callback, array($forum_name));
     if ($check instanceof PEAR_Error || !$check) {
         return '';
     }
     /* Create a separate notification queue. */
     $queue = Horde_Notification::singleton('agoraPostMessage');
     $queue->attach('status');
     /* Set up the forums object. */
     $forums = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create($scope);
     /* Set up form variables. */
     $vars = Horde_Variables::getDefaultVariables();
     if (is_array($variables)) {
         foreach ($variables as $varname => $value) {
             $vars->add($varname, $value);
         }
     }
     $formname = $vars->get('formname');
     /* Check if the forum exists and fetch the ID. */
     $params['forum_id'] = $forums->getForumId($forum_name);
     if ($params['forum_id'] === null) {
         $vars->set('new_forum', $forum_name);
     } else {
         $vars->set('forum_id', $params['forum_id']);
     }
     /* Set up the messages control object. */
     $messages = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create($scope, $params['forum_id']);
     if ($messages instanceof PEAR_Error) {
         $queue->push(_("Could not post the message: ") . $messages->getMessage(), 'horde.error');
         Horde::startBuffer();
         $queue->notify(array('listeners' => 'status'));
         return Horde::endBuffer();
     }
     /* Check post permissions. */
     if (!$messages->hasPermission(Horde_Perms::EDIT)) {
         Horde::permissionDeniedError('agora', null);
         return PEAR::raiseError(sprintf(_("You don't have permission to post messages in forum %s."), $params['forum_id']));
     }
     if (isset($params['message_id'])) {
         $message = $messages->getMessage($params['message_id']);
         if (!$formname) {
             $vars = new Horde_Variables($message);
             $vars->set('message_subject', $message['message_subject']);
             $vars->set('message_body', $message['body']);
         }
         $editing = true;
     } else {
         $editing = false;
         $params['message_id'] = null;
     }
     /* Set a default title if one not specified. */
     if (!isset($params['title'])) {
         $params['title'] = $editing ? _("Edit Message") : _("Post a New Message");
     }
     /* Get the form object. */
     $form = $messages->getForm($vars, $params['title'], $editing, is_null($params['forum_id']));
     /* Validate the form. */
     if ($form->validate($vars)) {
         $form->getInfo($vars, $info);
         if (isset($info['new_forum'])) {
             $forum_info = $this->prepareFormData($scope, false, array('forum_name' => $info['new_forum']), $callback);
             if ($forum_info instanceof PEAR_Error) {
                 return $forum_info;
             }
             $info['forum_id'] = $m_params['forum_id'] = $forums->saveForum($forum_info);
             $result = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create($scope, $info['forum_id']);
//.........这里部分代码省略.........
开发者ID:horde,项目名称:horde,代码行数:101,代码来源:Api.php

示例10: setDetails

 /**
  * Sets all properties of the ticket necessary to display the
  * TicketDetailsForm.
  *
  * @param Horde_Variables $vars  The form variables object to set info in.
  */
 public function setDetails(Horde_Variables $vars)
 {
     $vars->set('id', $this->getId());
     foreach ($this->getDetails() as $varname => $value) {
         $vars->set($varname, $value);
     }
     /* User formatting. */
     $vars->set('user_id_requester', Whups::formatUser($this->get('user_id_requester')));
     $vars->set('user_id_owner', Whups::getOwners($this->_id));
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:16,代码来源:Ticket.php

示例11: catch

 } catch (Horde_Share_Exception $e) {
     $notification->push(sprintf(_("Access denied editing task: %s"), $e->getMessage()), 'horde.error');
 }
 if (!$share->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
     $notification->push(_("Access denied editing task."), 'horde.error');
 } else {
     $task = Nag::getTask($tasklist_id, $task_id);
     if (!isset($task) || !isset($task->id)) {
         $notification->push(_("Task not found."), 'horde.error');
     } elseif ($task->private && $task->owner != $registry->getAuth()) {
         $notification->push(_("Access denied editing task."), 'horde.error');
     } else {
         $h = $task->toHash();
         $h['tags'] = implode(',', $h['tags']);
         $vars = new Horde_Variables($h);
         $vars->set('old_tasklist', $task->tasklist);
         $vars->set('url', Horde_Util::getFormData('url'));
         if ($sl = Horde_Util::getFormData('list')) {
             $vars->set('list', $sl);
         }
         if ($tn = Horde_Util::getFormData('tab_name')) {
             $vars->set('tab_name', $tn);
         }
         $form = new Nag_Form_Task($vars, sprintf(_("Edit: %s"), $task->name));
         if (!$task->completed) {
             $task->loadChildren();
             $form->setTask($task);
         }
         break;
     }
 }
开发者ID:horde,项目名称:horde,代码行数:31,代码来源:task.php

示例12: getVars

 /**
  * Populate a Horde_Variables instance with the search values for this
  * search.
  *
  * @param Horde_Variables $vars  The Horde_Variables object.
  */
 public function getVars(Horde_Variables &$vars)
 {
     $vars->set('search_pattern', $this->_search);
     $vars->set('search_tags', implode(',', $this->_tags));
     $vars->set('search_completed', $this->_completed);
     $vars->set('due_within', $this->_due[0]);
     $vars->set('due_of', $this->_due[1]);
     $mask = array();
     if ($this->_mask & self::MASK_NAME) {
         $mask[] = 'search_name';
     }
     if ($this->_mask & self::MASK_DESC) {
         $mask[] = 'search_desc';
     }
     if (!empty($mask)) {
         $vars->set('search_in', $mask);
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:24,代码来源:Search.php

示例13: pathToForm

 /**
  * Path to form
  *
  * @param Horde_Variables $vars
  *
  * @return string
  * @throws Whups_Exception
  */
 public function pathToForm(&$vars)
 {
     $path = Whups_Query::stringToPath($vars->get('path'));
     $parent = null;
     $qobj = $this->query;
     for ($i = 0, $c = count($path); $i < $c; $i++) {
         $parent = $qobj;
         $qobj = $qobj['children'][$path[$i]];
     }
     if ($qobj['type'] != Whups_Query::TYPE_CRITERION) {
         // Search for any criteria that have been combined automatically
         // with an AND or OR.
         switch ($qobj['type']) {
             case Whups_Query::TYPE_OR:
                 // Search for multiple ids.
                 $criteria = array();
                 foreach ($qobj['children'] as $child) {
                     if ($child['type'] != Whups_Query::TYPE_CRITERION || $child['criterion'] != Whups_Query::CRITERION_ID) {
                         $criteria = false;
                         break;
                     }
                     $criteria[] = $child['value'];
                 }
                 if ($criteria) {
                     $vars->set('id', implode(',', $criteria));
                     return 'props';
                 }
                 // Search for user criteria.
                 $criteria = array();
                 $operator = $value = null;
                 foreach ($qobj['children'] as $child) {
                     if ($child['type'] != Whups_Query::TYPE_CRITERION || $child['criterion'] != Whups_Query::CRITERION_OWNERS && $child['criterion'] != Whups_Query::CRITERION_REQUESTER && $child['criterion'] != Whups_Query::CRITERION_ADDED_COMMENT || isset($operator) && $operator != $child['operator'] || isset($value) && $value != $child['value']) {
                         $criteria = false;
                         break;
                     }
                     $criteria[] = $child['criterion'];
                     $operator = $child['operator'];
                     $value = $child['value'];
                 }
                 if ($criteria) {
                     $vars->set('user', $value);
                     $vars->set('operator', $operator);
                     foreach ($criteria as $criterion) {
                         switch ($criterion) {
                             case Whups_Query::CRITERION_OWNERS:
                                 $vars->set('owners', true);
                                 break;
                             case Whups_Query::CRITERION_REQUESTER:
                                 $vars->set('requester', true);
                                 break;
                             case Whups_Query::CRITERION_ADDED_COMMENT:
                                 $vars->set('comments', true);
                                 break;
                         }
                     }
                     return 'user';
                 }
                 // Search for text criteria.
                 $criteria = array();
                 $operator = $value = null;
                 foreach ($qobj['children'] as $child) {
                     if ($child['type'] != Whups_Query::TYPE_CRITERION || $child['criterion'] != Whups_Query::CRITERION_COMMENT && $child['criterion'] != Whups_Query::CRITERION_SUMMARY || isset($operator) && $operator != $child['operator'] || isset($value) && $value != $child['value']) {
                         $criteria = false;
                         break;
                     }
                     $criteria[] = $child['criterion'];
                     $operator = $child['operator'];
                     $value = $child['value'];
                 }
                 if ($criteria) {
                     $vars->set('text', $value);
                     $vars->set('operator', $operator);
                     foreach ($criteria as $criterion) {
                         if ($criterion == Whups_Query::CRITERION_COMMENT) {
                             $vars->set('comments', true);
                         } elseif ($criterion == Whups_Query::CRITERION_SUMMARY) {
                             $vars->set('summary', true);
                         }
                     }
                     return 'text';
                 }
                 // Search for attributes.
                 $attribs = array_keys($GLOBALS['whups_driver']->getAttributesForType());
                 $criteria = array();
                 $operator = $value = null;
                 foreach ($qobj['children'] as $child) {
                     if ($child['type'] != Whups_Query::TYPE_CRITERION || $child['criterion'] != Whups_Query::CRITERION_ATTRIBUTE || isset($operator) && $operator != $child['operator'] || isset($value) && $value != $child['value'] || !in_array($child['cvalue'], $attribs)) {
                         $criteria = false;
                         break;
                     }
                     $criteria[] = $child['cvalue'];
                     $operator = $child['operator'];
//.........这里部分代码省略.........
开发者ID:raz0rsdge,项目名称:horde,代码行数:101,代码来源:Query.php

示例14: catch

             $Form->execute();
             $notification->push(_("Device information updated."), 'horde.success');
             $action = 'list';
             break;
         } catch (Exception $e) {
             $notification->push($e);
         }
     } elseif ($Form->isSubmitted()) {
         // Submitted but not valid
         $notification->push(_("Problem processing the form.  Please check below and try again."), 'horde.warning');
     }
     // Create a new add/edit form
     $devid = Horde_Util::getFormData('devid');
     $devices = $shout->devices->getDevices($curaccount);
     $vars = new Horde_Variables($devices[$devid]);
     $vars->set('action', $action);
     $Form = new DeviceDetailsForm($vars);
     // Make sure we get the right template below.
     $action = 'edit';
     break;
 case 'delete':
     $title .= sprintf(_("Delete Devices %s"), $extension);
     $devid = Horde_Util::getFormData('devid');
     $vars = Horde_Variables::getDefaultVariables();
     $vars->set('account', $curaccount);
     $Form = new DeviceDeleteForm($vars);
     $FormValid = $Form->validate($vars, true);
     if ($Form->isSubmitted() && $FormValid) {
         try {
             $Form->execute();
             $notification->push(_("Device Deleted."));
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:devices.php

示例15: render

 /**
  * Render the table.
  *
  * @param array $data  The data to render (unused).
  *
  * @return mixed The HTML needed to render the table or false if failed.
  */
 public function render($data = null)
 {
     global $notification;
     try {
         $result = $this->getMetaData();
     } catch (Hermes_Exception $e) {
         $notification->push($e->getMessage(), 'horde.error');
         return false;
     }
     $varRenderer = new Horde_Core_Ui_VarRenderer_Html();
     $html = '<h1 class="header">';
     // Table title.
     if (isset($this->_config['title'])) {
         $html .= $this->_config['title'];
     } else {
         $html .= _("Table");
     }
     // Hook for icons and things
     if (isset($this->_config['title_extra'])) {
         $html .= $this->_config['title_extra'];
     }
     $html .= '</h1>';
     // Column titles.
     $html .= '<table class="time striped" id="hermes_time" cellspacing="0"><thead><tr class="item">';
     foreach ($this->_metaData['sections']['data']['columns'] as $col) {
         $html .= '<th' . (isset($col['colspan']) ? ' colspan="' . $col['colspan'] . '"' : '') . '>' . $col['title'] . '</th>';
     }
     $html .= '</tr></thead>';
     // Display data.
     try {
         $data = $this->_getData();
     } catch (Hermes_Exception $e) {
         $notification->push($e, 'horde.error');
         $data = array();
     }
     foreach ($this->_metaData['sections'] as $secname => $section) {
         if (empty($data[$secname])) {
             continue;
         }
         /* Open the table section, either a tbody or the tfoot. */
         $html .= $secname == 'footer' ? '<tfoot>' : '<tbody>';
         // This Horde_Variables object is populated for each table row
         // so that we can use the Horde_Core_Ui_VarRenderer.
         $vars = new Horde_Variables();
         $form = null;
         foreach ($data[$secname] as $row) {
             $html .= '<tr>';
             foreach ($row as $key => $value) {
                 $vars->set($key, $value);
             }
             foreach ($section['columns'] as $col) {
                 $value = null;
                 if (isset($row[$col['name']])) {
                     $value = $row[$col['name']];
                 }
                 $align = '';
                 if (isset($col['align'])) {
                     $align = ' align="' . htmlspecialchars($col['align']) . '"';
                 }
                 $colspan = '';
                 if (isset($col['colspan'])) {
                     $colspan = ' colspan="' . htmlspecialchars($col['colspan']) . '"';
                 }
                 $html .= "<td{$align}{$colspan}";
                 if (!empty($col['nobr'])) {
                     $html .= ' class="nowrap"';
                 }
                 $html .= '>';
                 // XXX: Should probably be done at the <tr> with a class.
                 if (!empty($row['strong'])) {
                     $html .= '<strong>';
                 }
                 if (isset($col['type']) && substr($col['type'], 0, 1) == '%') {
                     switch ($col['type']) {
                         case '%html':
                             if (!empty($row[$col['name']])) {
                                 $html .= $row[$col['name']];
                             }
                             break;
                     }
                 } else {
                     $html .= $varRenderer->render($form, $this->_formVars[$secname][$col['name']], $vars);
                 }
                 if (!empty($row['strong'])) {
                     $html .= '</strong>';
                 }
                 $html .= '</td>';
             }
             $html .= '</tr>';
         }
         // Close the table section.
         $html .= $secname == 'footer' ? '</tfoot>' : '</tbody>';
     }
//.........这里部分代码省略.........
开发者ID:jubinpatel,项目名称:horde,代码行数:101,代码来源:Table.php


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