本文整理汇总了PHP中Horde_Variables类的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Variables类的具体用法?PHP Horde_Variables怎么用?PHP Horde_Variables使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Horde_Variables类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testRemove
public function testRemove()
{
$vars = new Horde_Variables(array('a' => 'a', 'b' => 'b', 'c' => array(1, 2, 3), 'd' => array('z' => 'z', 'y' => array('f' => 'f', 'g' => 'g'))));
$vars->remove('a');
$vars->remove('d[y][g]');
$this->assertNull($vars->a);
$this->assertEquals('b', $vars->b);
$this->assertEquals(array(1, 2, 3), $vars->c);
$this->assertEquals(array('z' => 'z', 'y' => array('f' => 'f')), $vars->d);
}
开发者ID:jubinpatel,项目名称:horde,代码行数:10,代码来源:VariablesTest.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: 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: _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
示例5: __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
示例6: 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
示例7: _content
/**
*/
protected function _content()
{
if (!($query = $this->_getQuery())) {
return '<p class="horde-content"><em>' . _("No query to run") . '</em></p>';
}
$vars = Horde_Variables::getDefaultVariables();
$tickets = $GLOBALS['whups_driver']->executeQuery($query, $vars);
return $this->_table($tickets, 'whups_block_query_' . $query->id);
}
开发者ID:jubinpatel,项目名称:horde,代码行数:11,代码来源:Query.php
示例8: __construct
public function __construct(&$object, $buttons)
{
$this->koward =& Koward::singleton();
parent::__construct(Horde_Variables::getDefaultVariables());
$this->setTitle(_("Object actions"));
$this->object = $object;
if (!empty($buttons)) {
$this->setButtons($buttons);
}
}
开发者ID:jubinpatel,项目名称:horde,代码行数:10,代码来源:Actions.php
示例9: refreshContent
/**
* Handle user initiated block refresh. Set a private member to avoid
* BC issues with having to add a parameter to the _content method.
*
* @param Horde_Variables $vars
*
* @return string
*/
public function refreshContent($vars = null)
{
if (empty($vars) || empty($vars->location)) {
$this->_refreshParams = Horde_Variables::getDefaultVariables();
$this->_refreshParams->set('location', $this->_params['location']);
} else {
$this->_refreshParams = $vars;
}
return $this->_content();
}
开发者ID:horde,项目名称:horde,代码行数:18,代码来源:Metar.php
示例10: testTwoAssignees
public function testTwoAssignees()
{
$share = array_shift($GLOBALS['nag_shares']->listShares('[email protected]'));
$share = $GLOBALS['nag_shares']->getShare($share->getName());
$share->addUserPermission('jane', Horde_Perms::READ);
$vars = Horde_Variables::getDefaultVariables();
$vars->set('tasklist_id', $share->getName());
$form = new Nag_Form_Task($vars, _("New Task"));
$this->assertEquals(array('jane' => 'jane', '[email protected]' => '[email protected]'), $this->_getAssignees($form));
}
开发者ID:jubinpatel,项目名称:horde,代码行数:10,代码来源:Base.php
示例11: appTests
/**
*/
public function appTests()
{
$ret = '<h1>Mail Server Support Test</h1>';
$vars = Horde_Variables::getDefaultVariables();
if ($vars->user && $vars->passwd) {
$ret .= $this->_doConnectionTest($vars);
}
$self_url = Horde::selfUrl()->add('app', 'imp');
Horde::startBuffer();
require IMP_TEMPLATES . '/test/mailserver.inc';
return $ret . Horde::endBuffer();
}
开发者ID:horde,项目名称:horde,代码行数:14,代码来源:Test.php
示例12: 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
示例13: 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());
}
开发者ID:jubinpatel,项目名称:horde,代码行数:56,代码来源:Api.php
示例14: _content
protected function _content()
{
$vars = Horde_Variables::getDefaultVariables();
$formname = $vars->get('formname');
$done = false;
$form = new Horde_Form($vars);
$fields = $GLOBALS['injector']->getInstance('Ulaform_Factory_Driver')->create()->getFields($this->_params['form_id']);
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'] == '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']);
}
if ($formname) {
$form->validate($vars);
if ($form->isValid() && $formname) {
$form->getInfo($vars, $info);
$info['form_id'] = $this->_params['form_id'];
try {
$submit = $GLOBALS['ulaform_driver']->submitForm($info);
$GLOBALS['notification']->push(_("Form submitted successfully."), 'horde.success');
$done = true;
} catch (Horde_Exception $e) {
$GLOBALS['notification']->push(sprintf(_("Error submitting form. %s."), $e->getMessage()), 'horde.error');
}
}
}
/* Render active or inactive, depending if submitted or
* not. */
$render_type = $done ? 'renderInactive' : 'renderActive';
/* Render the form. */
$renderer = new Horde_Form_Renderer();
$renderer->showHeader(false);
Horde::startBuffer();
$form->{$render_type}($renderer, $vars, Horde::selfUrl(true), 'post');
return Horde::endBuffer();
}
开发者ID:jubinpatel,项目名称:horde,代码行数:39,代码来源:Form.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
示例16: editActions
/**
* Check for, and handle, image editing actions.
*
* @param string $actionID The action identifier.
*
* @return boolean True if an action was handled, otherwise false.
* @throws Ansel_Exception
*/
public static function editActions($actionID)
{
global $notification, $page_output, $registry;
$ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Storage');
$gallery_id = Horde_Util::getFormData('gallery');
$image_id = Horde_Util::getFormData('image');
$date = Ansel::getDateParameter();
$page = Horde_Util::getFormData('page', 0);
$watermark_font = Horde_Util::getFormData('font');
$watermark_halign = Horde_Util::getFormData('whalign');
$watermark_valign = Horde_Util::getFormData('wvalign');
$watermark = Horde_Util::getFormData('watermark', $GLOBALS['prefs']->getValue('watermark_text'));
// Get the gallery object and style information.
try {
$gallery = $ansel_storage->getGallery($gallery_id);
} catch (Ansel_Exception $e) {
$notification->push(sprintf(_("Gallery %s not found."), $gallery_id), 'horde.error');
Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
exit;
}
switch ($actionID) {
case 'modify':
try {
$image = $ansel_storage->getImage($image_id);
$ret = Horde_Util::getFormData('ret', 'gallery');
} catch (Ansel_Exception $e) {
$notification->push(_("Photo not found."), 'horde.error');
Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
exit;
}
$title = sprintf(_("Edit properties :: %s"), $image->filename);
// Set up the form object.
$vars = Horde_Variables::getDefaultVariables();
if ($ret == 'gallery') {
$vars->set('actionID', 'saveclose');
} else {
$vars->set('actionID', 'savecloseimage');
}
$form = new Ansel_Form_Image($vars, $title);
$renderer = new Horde_Form_Renderer();
// Set up the gallery attributes.
$vars->set('image_default', $image->id == $gallery->get('default'));
$vars->set('image_desc', $image->caption);
$vars->set('image_tags', implode(', ', $image->getTags()));
$vars->set('image_originalDate', $image->originalDate);
$vars->set('image_uploaded', $image->uploaded);
$page_output->header(array('title' => $title));
$form->renderActive($renderer, $vars, Horde::url('image.php'), 'post', 'multipart/form-data');
$page_output->footer();
exit;
case 'savecloseimage':
case 'saveclose':
case 'save':
$title = _("Save Photo");
if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("Access denied saving photo to this gallery."), 'horde.error');
Ansel::getUrlFor('view', array_merge(array('gallery' => $gallery_id, 'slug' => $gallery->get('slug'), 'view' => 'Gallery', 'page' => $page), $date), true)->redirect();
exit;
}
// Validate the form object.
$vars = Horde_Variables::getDefaultVariables();
$vars->set('actionID', 'save');
$renderer = new Horde_Form_Renderer();
$form = new Ansel_Form_Image($vars, _("Edit a photo"));
// Update existing image.
if ($form->validate($vars)) {
$form->getInfo($vars, $info);
// Replacing photo
if (!empty($info['file0']['file'])) {
try {
$GLOBALS['browser']->wasFileUploaded('file0');
if (filesize($info['file0']['file'])) {
$data = file_get_contents($info['file0']['file']);
if (getimagesize($info['file0']['file']) === false) {
$notification->push(_("The file you uploaded does not appear to be a valid photo."), 'horde.error');
unset($data);
}
}
} catch (Horde_Browser_Exception $e) {
}
}
$image = $ansel_storage->getImage($image_id);
$image->caption = $vars->get('image_desc');
$image->setTags(explode(',', $vars->get('image_tags')));
$newDate = new Horde_Date($vars->get('image_originalDate'));
$image->originalDate = (int) $newDate->timestamp();
if (!empty($data)) {
try {
$image->replace($data);
} catch (Ansel_Exception $e) {
$notification->push(_("There was an error replacing the photo."), 'horde.error');
}
//.........这里部分代码省略.........
开发者ID:raz0rsdge,项目名称:horde,代码行数:101,代码来源:ActionHandler.php
示例17: 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
示例18: html
/**
* Return the HTML representing this view.
*
* @return string The HTML.
*
*/
public function html()
{
global $conf, $prefs, $registry;
$vars = Horde_Variables::getDefaultVariables();
if (!empty($this->_params['page'])) {
$vars->add('page', $this->_params['page']);
}
if (!empty($this->_params['pager_url'])) {
$this->_pagerurl = $this->_params['pager_url'];
$override = true;
} else {
$override = false;
$this->_pagerurl = Ansel::getUrlFor('view', array('owner' => $this->_owner, 'special' => $this->_special, 'groupby' => $this->_view->groupby, 'view' => 'List'));
}
$p_params = array('num' => $this->_view->numGalleries, 'url' => $this->_pagerurl, 'perpage' => $this->_view->gPerPage);
if ($override) {
$p_params['url_callback'] = null;
}
$this->_pager = new Horde_Core_Ui_Pager('page', $vars, $p_params);
$preserve = array('sort_dir' => $this->_view->sortDir);
if (!empty($this->_view->sortBy)) {
$preserve['sort'] = $this->_view->sortBy;
}
$this->_pager->preserve($preserve);
if ($this->_view->numGalleries) {
$min = $this->_page * $this->_view->gPerPage;
$max = $min + $this->_view->gPerPage;
if ($max > $this->_view->numGalleries) {
$max = $this->_view->numGalleries - $min;
}
$this->_view->start = $min + 1;
$this->_view->end = min($this->_view->numGalleries, $min + $this->_view->gPerPage);
if ($this->_owner) {
$this->_view->refresh_link = Ansel::getUrlFor('view', array('groupby' => $this->_view->groupby, 'owner' => $this->_owner, 'page' => $this->_page, 'view' => 'List'));
} else {
$this->_view->refresh_link = Ansel::getUrlFor('view', array('view' => 'List', 'groupby' => $this->_view->groupby, 'page' => $this->_page));
}
// Get top-level / default gallery style.
if (empty($this->_params['style'])) {
$style = Ansel::getStyleDefinition($prefs->getValue('default_gallerystyle'));
} else {
$style = Ansel::getStyleDefinition($this->_params['style']);
}
// Final touches.
if (empty($this->_params['api'])) {
$this->_view->breadcrumbs = Ansel::getBreadcrumbs();
$this->_view->groupbyUrl = strval(Ansel::getUrlFor('group', array('actionID' => 'groupby', 'groupby' => 'owner')));
}
$this->_view->pager = $this->_pager->render();
$this->_view->style = $style;
$this->_view->tilesperrow = $prefs->getValue('tilesperrow');
$this->_view->cellwidth = round(100 / $this->_view->tilesperrow);
$this->_view->params = $this->_params;
$GLOBALS['page_output']->addScriptFile('views/common.js');
return $this->_view->render('list');
}
return ' ';
}
开发者ID:horde,项目名称:horde,代码行数:64,代码来源:List.php
示例19: header
<?php
/**
* $Id: delete_event.php,v 1.1 2010/10/24 17:24:39 pety Exp pety $
*
* Copyright 2007-2009 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*
* @author Peter Sagi <[email protected]>
*/
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('cloudbank');
require_once CLOUDBANK_BASE . '/lib/Cloudbank.php';
require_once CLOUDBANK_BASE . '/lib/Book.php';
/* main() */
$g_variables =& Horde_Variables::getDefaultVariables();
$g_account_id = $g_variables->get('account_id');
$g_event_id = $g_variables->get('event_id');
try {
Book::Singleton()->deleteEvent($g_event_id);
header('Location: ' . Horde::url('events.php', true)->add(array('ledger_account_id' => $g_account_id, 'ledger_account_type' => CloudBankConsts::LedgerAccountType_Account), NULL, false));
} catch (Exception $v_exception) {
Cloudbank::PushError(Book::XtractMessage($v_exception));
$page_output->header();
$notification->notify(array('listeners' => 'status'));
$page_output->footer();
}
开发者ID:psagi,项目名称:cloudbank,代码行数:29,代码来源:delete_event.php
示例20: basename
/**
* Gets the upload and sets up the upload data array. Either
* fetches an upload done with this submit or retrieves stored
* upload info.
* @param Horde_Variables $vars The form state to check this field for
* @param Horde_Form_Variable $var The Form field object to check
*
*/
function _getUpload(&$vars, &$var)
{
global $session;
/* Don't bother with this function if already called and set
* up vars. */
if (!empty($this->_img)) {
return true;
}
/* Check if file has been uploaded. */
$varname = $var->getVarName();
try {
$GLOBALS['browser']->wasFileUploaded($varname . '[new]');
$this->_uploaded = true;
/* A file has been uploaded on this submit. Save to temp dir for
* preview work. */
$this->_img['img']['type'] = $this->getUploadedFileType($varname . '[new]');
/* Get the other parts of the upload. */
Horde_Array::getArrayParts($varname . '[new]', $base, $keys);
/* Get the temporary file name. */
$keys_path = array_merge(array($base, 'tmp_name'), $keys);
$this->_img['img']['file'] = Horde_Array::getElement($_FILES, $keys_path);
/* Get the actual file name. */
$keys_path = array_merge(array($base, 'name'), $keys);
$this->_img['img']['name'] = Horde_Array::getElement($_FILES, $keys_path);
/* Get the file size. */
$keys_path = array_merge(array($base, 'size'), $keys);
$this->_img['img']['size'] = Horde_Array::getElement($_FILES, $keys_path);
/* Get any existing values for the image upload field. */
$upload = $vars->get($var->getVarName());
if (!empty($upload['hash'])) {
$upload['img'] = $session->get('horde', 'form/' . $upload['hash']);
$session->remove('horde', 'form/' . $upload['hash']);
}
/* Get the temp file if already one uploaded, otherwise create a
* new temporary file. */
if (!empty($upload['img']['file'])) {
$tmp_file = Horde::getTempDir() . '/' . $upload['img']['file'];
} else {
$tmp_file = Horde::getTempFile('Horde', false);
}
/* Move the browser created temp file to the new temp file. */
move_uploaded_file($this->_img['img']['file'], $tmp_file);
$this->_img['img']['file'] = basename($tmp_file);
} catch (Horde_Browser_Exception $e) {
$this->_uploaded = $e;
/* File has not been uploaded. */
$upload = $vars->get($var->getVarName());
/* File is explicitly removed */
if ($vars->get('remove_' . $var->getVarName())) {
$this->_img = null;
$session->remove('horde', 'form/' . $upload['hash']);
return;
}
if ($this->_uploaded->getCode() == 4 && !empty($upload['hash']) && $session->exists('horde', 'form/' . $upload['hash'])) {
$this->_img['img'] = $session->get('horde', 'form/' . $upload['hash']);
$session->remove('horde', 'form/' . $upload['hash']);
if (isset($this->_img['error'])) {
$this->_uploaded = PEAR::raiseError($this->_img['error']);
}
}
}
if (isset($this->_img['img'])) {
$session->set('horde', 'form/' . $this->getRandomId(), $this->_img['img']);
}
}
开发者ID:raz0rsdge,项目名称:horde,代码行数:73,代码来源:Type.php
注:本文中的Horde_Variables类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论