Hermes::showAjaxView PHP Method

showAjaxView() public static method

Returns true if we are showing the Ajax view.
public static showAjaxView ( ) : boolean
return boolean
    public static function showAjaxView()
    {
        return $GLOBALS['registry']->getView() == Horde_Registry::VIEW_DYNAMIC && $GLOBALS['prefs']->getValue('dynamic_view');
    }

Usage Example

Beispiel #1
0
<?php

/**
 * Copyright 2004-2015 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file LICENSE for license information (BSD). If you
 * did not receive this file, see http://www.horde.org/licenses/bsdl.php.
 *
 * @author Jason M. Felice <*****@*****.**>
 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('hermes');
if (Hermes::showAjaxView()) {
    Horde::url('', true)->setAnchor('search')->redirect();
}
$vars = Horde_Variables::getDefaultVariables();
$delete = $vars->get('delete');
if (!empty($delete)) {
    try {
        $GLOBALS['injector']->getInstance('Hermes_Driver')->updateTime(array(array('id' => $delete, 'delete' => true)));
    } catch (Horde_Exception $e) {
        $notification->push(sprintf(_("There was an error deleting the time: %s"), $e->getMessage()), 'horde.error');
    }
    $notification->push(_("The time entry was successfully deleted."), 'horde.success');
    $vars->remove('delete');
}
$criteria = null;
$formname = $vars->get('formname');
switch ($formname) {
    case 'hermes_form_search':
        $form = new Hermes_Form_Search($vars);