Wicked_Page::getCurrentPage PHP Method

getCurrentPage() public static method

Returns the page we are currently on.
public static getCurrentPage ( ) : Wicked_Page
return Wicked_Page The current page.
    public static function getCurrentPage()
    {
        return Wicked_Page::getPage(rtrim(Horde_Util::getFormData('page'), '/'), Horde_Util::getFormData('version'), Horde_Util::getFormData('referrer'));
    }

Usage Example

Ejemplo n.º 1
0
<?php

/**
 * Copyright 2003-2014 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author Tyler Colbert <*****@*****.**>
 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('wicked');
$actionID = Horde_Util::getFormData('actionID');
try {
    $page = Wicked_Page::getCurrentPage();
} catch (Wicked_Exception $e) {
    $notification->push(_("Internal error viewing requested page"), 'horde.error');
    $page = Wicked_Page::getPage('');
    $actionID = null;
}
switch ($actionID) {
    case 'lock':
        if (!$page->allows(Wicked::MODE_LOCKING)) {
            $notification->push(_("You are not allowed to lock this page"), 'horde.error');
            break;
        }
        try {
            $result = $page->lock();
        } catch (Wicked_Exception $e) {
            $notification->push(sprintf(_("Page failed to lock: %s"), $e->getMessage()), 'horde.error');
        }