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


PHP Horde_Variables::get方法代码示例

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


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

示例1: _doSearch

 /**
  * Perform search
  *
  * @throws Mnemo_Exception
  */
 protected function _doSearch()
 {
     $search_pattern = $this->_vars->get('search_pattern');
     $search_type = $this->_vars->get('search_type');
     $search_desc = $search_type == 'desc';
     $search_body = $search_type == 'body';
     if (!empty($search_pattern) && ($search_body || $search_desc)) {
         $search_pattern = '/' . preg_quote($search_pattern, '/') . '/i';
         $search_result = array();
         foreach ($this->_notes as $memo_id => $memo) {
             if ($search_desc && preg_match($search_pattern, $memo['desc']) || $search_body && preg_match($search_pattern, $memo['body'])) {
                 $search_result[$memo_id] = $memo;
             }
         }
         $this->_notes = $search_result;
     } elseif ($search_type == 'tags') {
         // Tag search, use the browser.
         $this->_browser->clearSearch();
         $tags = $GLOBALS['injector']->getInstance('Mnemo_Tagger')->split($this->_vars->get('search_pattern'));
         foreach ($tags as $tag) {
             $this->_browser->addTag($tag);
         }
         $this->_notes = $this->_browser->getSlice();
         $this->_handleActions(false);
         return;
     }
     $this->_baseurl->add(array('actionID' => 'search_memos', 'search_pattern' => $search_pattern, 'search_type' => $search_type));
 }
开发者ID:horde,项目名称:horde,代码行数:33,代码来源:List.php

示例2: _handle

 /**
  */
 protected function _handle(Horde_Variables $vars)
 {
     // Avoid errors if 'input' isn't set and short-circuit empty searches.
     if (!isset($vars->input)) {
         $result = array();
     } else {
         $input = $vars->get($vars->input);
         $result = strlen($input) ? $this->_handleAutoCompleter($input) : array();
     }
     return new Horde_Core_Ajax_Response_Prototypejs($result);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:13,代码来源:AutoCompleter.php

示例3: validateDeleteForm

 /**
  * Function to validate any delete form input.
  *
  * @param TODO $info  TODO
  *
  * @return mixed  If the delete button confirmation has been pressed return
  *                true, if any other submit button has been pressed return
  *                false. If form did not validate return null.
  */
 public function validateDeleteForm(&$info)
 {
     $form_submit = $this->_vars->get('submitbutton');
     if ($form_submit == Horde_Core_Translation::t("Delete")) {
         if ($this->_form->validate($this->_vars)) {
             $this->_form->getInfo($this->_vars, $info);
             return true;
         }
     } elseif (!empty($form_submit)) {
         return false;
     }
     return null;
 }
开发者ID:horde,项目名称:horde,代码行数:22,代码来源:Ui.php

示例4: 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

示例5: _handle

 /**
  * Form variables used:
  *   - input
  */
 protected function _handle(Horde_Variables $vars)
 {
     global $injector;
     $args = array('html' => !empty($vars->html));
     if (isset($vars->locale)) {
         $args['locale'] = $vars->locale;
     }
     $input = $vars->get($vars->input);
     try {
         return new Horde_Core_Ajax_Response_Prototypejs($injector->getInstance('Horde_Core_Factory_SpellChecker')->create($args, $input)->spellCheck($input));
     } catch (Horde_Exception $e) {
         Horde::log($e, 'ERR');
         return array('bad' => array(), 'suggestions' => array());
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:19,代码来源:SpellChecker.php

示例6: _checkToken

 /**
  * Check token.
  *
  * @param array $actions  The list of actions that require token checking.
  *
  * @return string  The verified action ID.
  */
 protected function _checkToken($actions)
 {
     global $notification, $session;
     $actionID = $this->vars->actionID;
     /* Run through the action handlers */
     if (!empty($actions) && strlen($actionID) && in_array($actionID, $actions)) {
         try {
             $session->checkToken($this->vars->get(self::INGO_TOKEN));
         } catch (Horde_Exception $e) {
             $notification->push($e);
             $actionID = null;
         }
     }
     return $actionID;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:22,代码来源:Base.php

示例7: __construct

 /**
  */
 public function __construct(Horde_Variables $vars)
 {
     global $conf, $injector, $registry;
     $this->_userid = $registry->getAuth();
     if ($conf['user']['change'] === true) {
         $this->_userid = $vars->get('userid', $this->_userid);
     } else {
         try {
             $this->_userid = Horde::callHook('default_username', array(), 'passwd');
         } catch (Horde_Exception_HookNotSet $e) {
         }
     }
     $this->_backends = $injector->getInstance('Passwd_Factory_Driver')->backends;
     $this->_vars = $vars;
     $this->_init();
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:18,代码来源:Basic.php

示例8: run

 /**
  * expects
  *   $notification
  *   $registry
  *   $vars
  */
 public function run()
 {
     extract($this->_params, EXTR_REFS);
     $form = new Jonah_Form_Feed($vars);
     /* Set up some variables. */
     $formname = $vars->get('formname');
     $channel_id = $vars->get('channel_id');
     /* Form not yet submitted and is being edited. */
     if (!$formname && $channel_id) {
         $vars = new Horde_Variables($GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($channel_id));
     }
     /* Get the vars for channel type. */
     $channel_type = $vars->get('channel_type');
     /* Check permissions and deny if not allowed. */
     if (!Jonah::checkPermissions(Jonah::typeToPermName($channel_type), Horde_Perms::EDIT, $channel_id)) {
         $notification->push(_("You are not authorised for this action."), 'horde.warning');
         throw new Horde_Exception_AuthenticationFailure();
     }
     /* Output the extra fields required for this channel type. */
     $form->setExtraFields($channel_id);
     if ($formname && empty($changed_type)) {
         if ($form->validate($vars)) {
             $form->getInfo($vars, $info);
             try {
                 $save = $GLOBALS['injector']->getInstance('Jonah_Driver')->saveChannel($info);
                 $notification->push(sprintf(_("The feed \"%s\" has been saved."), $info['channel_name']), 'horde.success');
                 Horde::url('channels')->redirect();
                 exit;
             } catch (Exception $e) {
                 $notification->push(sprintf(_("There was an error saving the feed: %s"), $e->getMessage()), 'horde.error');
             }
         }
     }
     $GLOBALS['page_output']->header(array('title' => $form->getTitle()));
     $notification->notify(array('listeners' => 'status'));
     $form->renderActive(new Horde_Form_Renderer(), $vars, Horde::url('channels/edit.php'), 'post');
     $GLOBALS['page_output']->footer();
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:44,代码来源:ChannelEdit.php

示例9: array

 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('ulaform', array('admin' => true));
/* Get some variables. */
$changed_action = false;
$vars = Horde_Variables::getDefaultVariables();
$form_id = $vars->get('form_id');
$old_form_action = $vars->get('old_form_action');
$formname = $vars->get('formname');
$ulaform_driver = $injector->getInstance('Ulaform_Factory_Driver')->create();
/* Check if a form is being edited. */
if ($form_id && !$formname) {
    $vars = new Horde_Variables($ulaform_driver->getForm($form_id));
}
/* Get the form action var, whether from edit or new. */
$form_action = $vars->get('form_action');
/* 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);
开发者ID:raz0rsdge,项目名称:horde,代码行数:31,代码来源:edit.php

示例10: download

 /**
  * @throws Kronolith_Exception
  */
 public function download(Horde_Variables $vars)
 {
     global $display_calendars, $injector;
     switch ($vars->actionID) {
         case 'download_file':
             $source = Horde_Util::getFormData('source');
             $key = Horde_Util::getFormData('key');
             $filename = Horde_Util::getFormData('file');
             $type = Horde_Util::getFormData('type');
             list($driver_type, $calendar) = explode('|', $source);
             if ($driver_type == 'internal' && !Kronolith::hasPermission($calendar, Horde_Perms::SHOW)) {
                 $GLOBALS['notification']->push(_("Permission Denied"), 'horde.error');
                 return false;
             }
             try {
                 $driver = Kronolith::getDriver($driver_type, $calendar);
             } catch (Exception $e) {
                 $GLOBALS['notification']->push($e, 'horde.error');
                 return false;
             }
             $event = $driver->getEvent($key);
             /* Check permissions. */
             if (!$event->hasPermission(Horde_Perms::READ)) {
                 throw new Kronolith_Exception(_("You do not have permission to view this event."));
             }
             try {
                 $data = $event->vfsInit()->read(Kronolith::VFS_PATH . '/' . $event->getVfsUid(), $filename);
             } catch (Horde_Vfs_Exception $e) {
                 Horde::log($e, 'ERR');
                 throw new Kronolith_Exception(sprintf(_("Access denied to %s"), $filename));
             }
             try {
                 return array('data' => $data, 'name' => $vars->file, 'type' => $type);
             } catch (Horde_Vfs_Exception $e) {
                 Horde::log($e, 'ERR');
                 throw new Kronolith_Exception(sprintf(_("Access denied to %s"), $vars->file));
             }
         case 'export':
             if ($vars->all_events) {
                 $end = $start = null;
             } else {
                 $start = new Horde_Date($vars->start_year, $vars->start_month, $vars->start_day);
                 $end = new Horde_Date($vars->end_year, $vars->end_month, $vars->end_day);
             }
             $calendars = $vars->get('exportCal', $display_calendars);
             if (!is_array($calendars)) {
                 $calendars = array($calendars);
             }
             $events = array();
             foreach ($calendars as $calendar) {
                 list($type, $cal) = explode('_', $calendar, 2);
                 $kronolith_driver = Kronolith::getDriver($type, $cal);
                 $calendarObject = Kronolith::getCalendar($kronolith_driver);
                 if (!$calendarObject || !$calendarObject->hasPermission(Horde_Perms::READ)) {
                     throw new Horde_Exception_PermissionDenied();
                 }
                 $events[$calendar] = $kronolith_driver->listEvents($start, $end, array('cover_dates' => false, 'hide_exceptions' => $vars->exportID == Horde_Data::EXPORT_ICALENDAR));
             }
             switch ($vars->exportID) {
                 case Horde_Data::EXPORT_CSV:
                     $data = array();
                     foreach ($events as $calevents) {
                         foreach ($calevents as $dayevents) {
                             foreach ($dayevents as $event) {
                                 $row = array('alarm' => $event->alarm, 'description' => $event->description, 'end_date' => $event->end->format('Y-m-d'), 'end_time' => $event->end->format('H:i:s'), 'location' => $event->location, 'private' => intval($event->private), 'recur_type' => null, 'recur_end_date' => null, 'recur_interval' => null, 'recur_data' => null, 'start_date' => $event->start->format('Y-m-d'), 'start_time' => $event->start->format('H:i:s'), 'tags' => implode(', ', $event->tags), 'title' => $event->getTitle());
                                 if ($event->recurs()) {
                                     $row['recur_type'] = $event->recurrence->getRecurType();
                                     if ($event->recurrence->hasRecurEnd()) {
                                         $row['recur_end_date'] = $event->recurrence->recurEnd->format('Y-m-d');
                                     }
                                     $row['recur_interval'] = $event->recurrence->getRecurInterval();
                                     $row['recur_data'] = $event->recurrence->recurData;
                                 }
                                 $data[] = $row;
                             }
                         }
                     }
                     $injector->getInstance('Horde_Core_Factory_Data')->create('Csv', array('cleanup' => array($this, 'cleanupData')))->exportFile(_("events.csv"), $data, true);
                     exit;
                 case Horde_Data::EXPORT_ICALENDAR:
                     $calNames = array();
                     $iCal = new Horde_Icalendar();
                     foreach ($events as $calevents) {
                         foreach ($calevents as $dayevents) {
                             foreach ($dayevents as $event) {
                                 $calNames[Kronolith::getCalendar($event->getDriver())->name()] = true;
                                 $iCal->addComponent($event->toiCalendar($iCal));
                             }
                         }
                     }
                     $iCal->setAttribute('X-WR-CALNAME', implode(', ', array_keys($calNames)));
                     return array('data' => $iCal->exportvCalendar(), 'name' => _("events.ics"), 'type' => 'text/calendar');
             }
     }
 }
开发者ID:horde,项目名称:horde,代码行数:98,代码来源:Application.php

示例11: 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

示例12: catch

         } else {
             $form1->renderActive($renderer, $vars, $adminurl, 'post');
         }
     }
     break;
 case 'whups_form_admin_editreplysteptwo':
     $form = new Whups_Form_Admin_EditReplyStepTwo($vars);
     $vars->set('action', 'type');
     if ($vars->get('formname') == 'whups_form_admin_editreplysteptwo' && $form->validate($vars)) {
         try {
             $whups_driver->updateReply($vars->get('reply'), $vars->get('reply_name'), $vars->get('reply_text'));
             $notification->push(_("The form reply has been modified."), 'horde.success');
             _open();
             $form->renderInactive($renderer, $vars);
             echo '<br />';
             $vars = new Horde_Variables(array('type' => $vars->get('type')));
         } catch (Whups_Exception $e) {
             $notification->push(_("There was an error editing the form reply:") . ' ' . $e->getMessage(), 'horde.error');
         }
         _open();
         $form1 = new Whups_Form_Admin_EditReplyStepOne($vars);
         $form1->renderActive($renderer, $vars, $adminurl, 'post');
         echo '<br />';
         $form2 = new Whups_Form_Admin_AddReply($vars);
         $form2->renderActive($renderer, $vars, $adminurl, 'post');
     } else {
         _open();
         $form->renderActive($renderer, $vars, $adminurl, 'post');
     }
     break;
 case 'whups_form_admin_deletereply':
开发者ID:horde,项目名称:horde,代码行数:31,代码来源:index.php

示例13: setPreferredSortOrder

 /**
  * Saves the sort order to the preferences backend.
  *
  * @param Horde_Variables $vars  Variables object.
  * @param string $source         Source.
  */
 public static function setPreferredSortOrder(Horde_Variables $vars, $source)
 {
     if (!strlen($sortby = $vars->get('sortby'))) {
         return;
     }
     $sources = self::getColumns();
     $columns = isset($sources[$source]) ? $sources[$source] : array();
     $column_name = self::getColumnName($sortby, $columns);
     $append = true;
     $ascending = $vars->get('sortdir') == 0;
     if ($vars->get('sortadd')) {
         $sortorder = self::getPreferredSortOrder();
         foreach ($sortorder as $i => $elt) {
             if ($elt['field'] == $column_name) {
                 $sortorder[$i]['ascending'] = $ascending;
                 $append = false;
             }
         }
     } else {
         $sortorder = array();
     }
     if ($append) {
         $sortorder[] = array('ascending' => $ascending, 'field' => $column_name);
     }
     $GLOBALS['prefs']->setValue('sortorder', serialize($sortorder));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:32,代码来源:Turba.php

示例14: removeMessage

 /**
  * Allows other Horde apps to remove 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.
  *
  * @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 delete
  * </pre>
  * @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 removeMessage($scope, $forum_name, $callback, $params = array(), $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('agoraRemoveMessage');
     $queue->attach('status');
     /* Set up the forums object. */
     $forums = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create($scope);
     $params['forum_id'] = $forums->getForumId($forum_name);
     if (empty($params['forum_id'])) {
         return PEAR::raiseError(sprintf(_("Forum %s does not exist."), $forum_name));
     }
     /* Set up the messages control object. */
     $messages = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create($scope, $params['forum_id']);
     if ($messages instanceof PEAR_Error) {
         PEAR::raiseError(sprintf(_("Could not delete the message. %s"), $messages->getMessage()));
     }
     /* Check delete permissions. */
     if (!$messages->hasPermission(Horde_Perms::DELETE)) {
         return PEAR::raiseError(sprintf(_("You don't have permission to delete messages in forum %s."), $params['forum_id']));
     }
     /* Get the message to be deleted. */
     $message = $messages->getMessage($params['message_id']);
     if ($message instanceof PEAR_Error) {
         return PEAR::raiseError(sprintf(_("Could not delete the message. %s"), $message->getMessage()));
     }
     /* Set up the form. */
     $vars = new Horde_Variables($variables);
     $form = new Horde_Form($vars, sprintf(_("Delete \"%s\" and all replies?"), $message['message_subject']), 'delete_agora_message');
     $form->setButtons(array(_("Delete"), _("Cancel")));
     $form->addHidden('', 'forum_id', 'int', true);
     $form->addHidden('', 'message_id', 'int', true);
     if ($form->validate()) {
         if ($vars->get('submitbutton') == _("Delete")) {
             $result = $messages->deleteMessage($params['message_id']);
             if ($result instanceof PEAR_Error) {
                 $queue->push(sprintf(_("Could not delete the message. %s"), $result->getMessage()), 'horde.error');
             } else {
                 $queue->push(_("Message deleted."), 'horde.success');
                 $count = $messages->countMessages();
                 $registry->callByPackage($scope, $callback, array($forum_name, 'messages', $count));
             }
         } else {
             $queue->push(_("Message not deleted."), 'horde.message');
         }
         Horde::startBuffer();
         $queue->notify(array('listeners' => 'status'));
         return Horde::endBuffer();
     }
     Horde::startBuffer();
     $form->renderActive(null, null, null, 'post', null, false);
     return Horde::endBuffer();
 }
开发者ID:horde,项目名称:horde,代码行数:83,代码来源:Api.php

示例15: sendReminders

 /**
  * Sends reminders, one email per user.
  *
  * @param Horde_Variables $vars  The selection criteria:
  *                               - 'id' (integer) for individual tickets
  *                               - 'queue' (integer) for tickets of a queue.
  *                                 - 'category' (array) for ticket
  *                                   categories, defaults to unresolved
  *                                   tickets.
  *                               - 'unassigned' (boolean) for unassigned
  *                                 tickets.
  *
  * @throws Whups_Exception
  */
 public static function sendReminders($vars)
 {
     global $whups_driver;
     if ($vars->get('id')) {
         $info = array('id' => $vars->get('id'));
     } elseif ($vars->get('queue')) {
         $info['queue'] = $vars->get('queue');
         if ($vars->get('category')) {
             $info['category'] = $vars->get('category');
         } else {
             // Make sure that resolved tickets aren't returned.
             $info['category'] = array('unconfirmed', 'new', 'assigned');
         }
     } else {
         throw new Whups_Exception(_("You must select at least one queue to send reminders for."));
     }
     $tickets = $whups_driver->getTicketsByProperties($info);
     self::sortTickets($tickets);
     if (!count($tickets)) {
         throw new Whups_Exception(_("No tickets matched your search criteria."));
     }
     $unassigned = $vars->get('unassigned');
     $remind = array();
     foreach ($tickets as $info) {
         $info['link'] = self::urlFor('ticket', $info['id'], true, -1);
         $owners = $whups_driver->getOwners($info['id']);
         if (!empty($owners)) {
             foreach (reset($owners) as $owner) {
                 $remind[$owner][] = $info;
             }
         } elseif (!empty($unassigned)) {
             $remind['**' . $unassigned][] = $info;
         }
     }
     /* Build message template. */
     $view = new Horde_View(array('templatePath' => WHUPS_BASE . '/config'));
     $view->date = strftime($GLOBALS['prefs']->getValue('date_format'));
     /* Get queue specific notification message text, if available. */
     $message_file = WHUPS_BASE . '/config/reminder_email.plain';
     if (file_exists($message_file . '.local.php')) {
         $message_file .= '.local.php';
     } else {
         $message_file .= '.php';
     }
     $message_file = basename($message_file);
     foreach ($remind as $user => $utickets) {
         if (empty($user) || !count($utickets)) {
             continue;
         }
         $view->tickets = $utickets;
         $subject = _("Reminder: Your open tickets");
         $whups_driver->mail(array('recipients' => array($user => 'owner'), 'subject' => $subject, 'view' => $view, 'template' => $message_file, 'from' => $user));
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:68,代码来源:Whups.php


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