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


PHP Navigation::add方法代码示例

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


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

示例1: Navigation

 function test_adding_node()
 {
     $n = new Navigation();
     $blog_node = (object) array('data' => 'Blog', 'attr' => (object) array('id' => 'blog', 'sort' => 0));
     /**
      * Add blog page.
      */
     $n->add($blog_node, 'index');
     /**
      * Should have second id now:
      *
      * index
      * - blog
      */
     $this->assertEquals($n->get_all_ids(), array('index', 'blog'));
     // Remove and re-add index
     $n->remove('index');
     $this->assertEquals($n->get_all_ids(), array());
     $n->add('index');
     $index_node = $n->node('index');
     $expected_index = (object) array('data' => 'Home', 'attr' => (object) array('id' => 'index', 'sort' => 0));
     /*
      * Should have index node with title 'Home' from the database.
      */
     $this->assertEquals($expected_index, $index_node);
 }
开发者ID:Selwyn-b,项目名称:elefant,代码行数:26,代码来源:NavigationTest.php

示例2: testNavOverwrite

 public function testNavOverwrite()
 {
     $defaults = Navigation::getDefaults();
     Hash::merge($defaults, array('title' => 'Permissions', 'url' => array('admin' => true, 'plugin' => 'acl', 'controller' => 'acl_permissions', 'action' => 'index'), 'weight' => 30));
     $item = array('title' => 'Permissions', 'url' => array('admin' => true, 'plugin' => 'acl_extras', 'controller' => 'acl_extras_permissions', 'action' => 'index'), 'weight' => 30);
     Navigation::add('users.children.permissions', $item);
     $items = Navigation::items();
     $expected = Hash::merge($defaults, array('title' => 'Permissions', 'url' => array('admin' => true, 'plugin' => 'acl_extras', 'controller' => 'acl_extras_permissions', 'action' => 'index'), 'weight' => 30));
     $this->assertEquals($expected, $items['users']['children']['permissions']);
 }
开发者ID:gourmet,项目名称:common,代码行数:10,代码来源:NavigationTest.php

示例3: createComponentNavigation

 public function createComponentNavigation($name)
 {
     $navigation = new Navigation();
     // nastavení překladače (nepovinné)
     $navigation->setTranslator(new MyTranslator());
     // nastavení šablony (nepovinné)
     $navigation->setTemplate('/cesta/k/sablone.phtml');
     $navigation->getRoot()->label = 'Homepage';
     $navigation->add('Articles', $this->link('Articles:default'));
 }
开发者ID:karelklima,项目名称:nette-navigation-builder,代码行数:10,代码来源:MyPresenter.php

示例4: controllerConstructClasses

 public function controllerConstructClasses(CakeEvent $Event)
 {
     $Event->result['components'][] = 'RequestHandler';
     $default = array('plugin' => 'webmaster', 'controller' => 'webmaster', 'action' => 'robots');
     $link = sprintf('<a href="%s">%s</a>', Router::url($default), __d('webmaster', "Create it now"));
     $filename = '`robots.txt`';
     $Event->result = Hash::merge((array) $Event->result, array('alertMessages' => array('robots.success' => array('message' => __d('webmaster', "Your %s file was successfully updated.", $filename), 'redirect' => Router::url(array_merge($default, array('action' => 'dashboard')))), 'robots.fail' => array('message' => __d('webmaster', "There was a problem updating your %s file", $filename), 'level' => 'error'), 'robots.exists' => array('message' => __d('webmaster', "A %s was already manually created in your application's webroot. " . "To dynamically manage it, you will need to delete it first.", $filename), 'level' => 'error', 'redirect' => true, 'dismiss' => true), 'robots.invalid' => array('message' => __d('webmaster', "Your %s file does not exist. %s.", $filename, $link), 'level' => 'warning', 'redirect' => null, 'dismiss' => true))));
     Navigation::add('Admin.webmaster', array('access' => 'User.admin', 'title' => __d('webmaster', "Webmaster"), 'url' => array('plugin' => 'webmaster', 'controller' => 'webmaster', 'action' => 'index', 'prefix' => 'admin', 'admin' => true), 'weight' => 9090));
     Navigation::add('Admin.webmaster.children.manage_robots', array('access' => 'User.admin', 'title' => __d('webmaster', "Manage Robots"), 'url' => array('plugin' => 'webmaster', 'controller' => 'webmaster', 'action' => 'robots', 'prefix' => 'admin', 'admin' => true), 'weight' => 1000));
     Navigation::add('Admin.webmaster.children.robots', array('access' => 'User.admin', 'title' => __d('webmaster', "Preview Robots"), 'url' => Router::url('/robots.txt', true), 'weight' => 2000, 'htmlAttributes' => array('a' => array('target' => '_blank'))));
     Navigation::add('Admin.webmaster.children.sitemap', array('access' => 'User.admin', 'title' => __d('webmaster', "Preview Sitemap"), 'url' => Router::url('/sitemap.xml', true), 'weight' => 3000, 'htmlAttributes' => array('a' => array('target' => '_blank'))));
 }
开发者ID:gourmet,项目名称:webmaster,代码行数:12,代码来源:WebmasterEventListener.php

示例5: main

 *	Toggle plugin admin
 *  http://api.jquery.com/slidetoggle
 *
 *  Generates content, that slide-toggles further content on click.
 *
 *	@package    Monstra
 *  @subpackage Plugins
 *	@author     Andreas Müller | devmount <mail@devmount.de>
 *	@license    MIT
 *  @link       https://github.com/devmount-monstra/toggle
 *
 */
// Add plugin styles and scripts
Javascript::add('plugins/toggle/js/toggle.admin.js', 'backend', 11);
// Admin Navigation: add new item to 'extends' section
Navigation::add(__('Toggle', 'toggle'), 'extends', 'toggle', 10);
/**
 * Toggle class
 * 
 */
class ToggleAdmin extends Backend
{
    /**
     * main toggle admin function
     */
    public static function main()
    {
        // handle option form submit
        if (Request::post('toggle_options')) {
            if (Security::check(Request::post('csrf'))) {
                Option::update('toggle_duration', (int) Request::post('toggle_duration'));
开发者ID:devmount-monstra,项目名称:toggle,代码行数:31,代码来源:toggle.admin.php

示例6: main

<?php

// Add plugin navigation link
Navigation::add(__('Snippets', 'snippets'), 'extends', 'snippets', 3);
Dashboard::addNewItem('snippets', __('Snippets', 'snippets'), 'index.php?id=snippets&action=add_snippet', 3);
/**
 * Snippets Admin Class
 */
class SnippetsAdmin extends Backend
{
    /**
     * Snippets admin function
     */
    public static function main()
    {
        // Init vars
        $snippets_path = STORAGE . DS . 'snippets' . DS;
        $snippets_list = array();
        $errors = array();
        // Check for get actions
        // -------------------------------------
        if (Request::get('action')) {
            // Switch actions
            // -------------------------------------
            switch (Request::get('action')) {
                // Add snippet
                // -------------------------------------
                case "add_snippet":
                    if (Request::post('add_snippets') || Request::post('add_snippets_and_exit')) {
                        if (Security::check(Request::post('csrf'))) {
                            if (trim(Request::post('name')) == '') {
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:31,代码来源:snippets.admin.php

示例7: header

    header('WWW-Authenticate: Basic realm="Navigation"');
    header('HTTP/1.0 401 Unauthorized');
    echo json_encode($res);
    return;
}
$error = false;
$out = null;
$nav = new Navigation();
switch ($this->params[0]) {
    case 'add':
        $id = $_POST['page'];
        $parent = $_POST['parent'];
        if ($parent === 'false') {
            $parent = false;
        }
        if ($nav->add($id, $parent) && $nav->save()) {
            $out = array('msg' => sprintf('Page %s added to tree under %s.', $id, $parent), 'page' => $id, 'parent' => $parent);
        } else {
            $error = $nav->error;
        }
        break;
    case 'move':
        $id = $_POST['page'];
        $ref = $_POST['ref'];
        $pos = $_POST['pos'];
        if ($nav->move($id, $ref, $pos) && $nav->save()) {
            $out = array('msg' => sprintf('Page %s moved to %s %s.', $id, $pos, $ref), 'page' => $id, 'ref' => $ref, 'pos' => $pos);
        } else {
            $error = $nav->error;
        }
        break;
开发者ID:nathanieltite,项目名称:elefant,代码行数:31,代码来源:api.php

示例8: main

<?php

// Add plugin navigation link
Navigation::add(__('Blocks', 'blocks'), 'content', 'blocks', 2);
Dashboard::addNewItem('blocks', __('Blocks', 'blocks'), 'index.php?id=blocks&action=add_block', 2);
/**
 * Blocks Admin Class
 */
class BlocksAdmin extends Backend
{
    /**
     * Blocks admin function
     */
    public static function main()
    {
        // Init vars
        $blocks_path = STORAGE . DS . 'blocks' . DS;
        $blocks_list = array();
        $errors = array();
        // Check for get actions
        // -------------------------------------
        if (Request::get('action')) {
            // Switch actions
            // -------------------------------------
            switch (Request::get('action')) {
                // Add block
                // -------------------------------------
                case "add_block":
                    if (Request::post('add_blocks') || Request::post('add_blocks_and_exit')) {
                        if (Security::check(Request::post('csrf'))) {
                            if (trim(Request::post('name')) == '') {
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:31,代码来源:blocks.admin.php

示例9: main

<?php

// Add plugin navigation link
Navigation::add(__('Information', 'information'), 'system', 'information', 6);
/**
 * Information Admin Class
 */
class InformationAdmin extends Backend
{
    /**
     * Information main function
     */
    public static function main()
    {
        // Init vars
        $php_modules = array();
        // Get array with the names of all modules compiled and loaded
        $php_modules = get_loaded_extensions();
        // Display view
        View::factory('box/information/views/backend/index')->assign('php_modules', $php_modules)->display();
    }
}
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:22,代码来源:information.admin.php

示例10: main

<?php

Stylesheet::add('plugins/box/filesmanager/css/style.css', 'backend', 11);
Javascript::add('plugins/box/filesmanager/js/fileuploader.js', 'backend', 11);
Javascript::add('plugins/box/plugins/js/plugins.js', 'backend', 11);
// Add plugin navigation link
Navigation::add(__('Plugins', 'plugins'), 'extends', 'plugins', 1);
// Add action on admin_pre_render hook
Action::add('admin_pre_render', 'PluginsAdmin::_readmeLoadAjax');
/**
 * Plugins Admin
 */
class PluginsAdmin extends Backend
{
    /**
     * Plugins admin
     */
    public static function main()
    {
        // Get siteurl
        $site_url = Option::get('siteurl');
        // Get installed plugin from $plugins array
        $installed_plugins = Plugin::$plugins;
        // Get installed users plugins
        $_users_plugins = array();
        foreach (Plugin::$plugins as $plugin) {
            if ($plugin['privilege'] !== 'box') {
                $_users_plugins[] = $plugin['id'];
            }
        }
        // Get plugins table
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:31,代码来源:plugins.admin.php

示例11:

 *
 *	@package    Monstra
 *  @subpackage Plugins
 *	@author     Andreas Müller | devmount <mail@devmount.de>
 *	@license    MIT
 *  @link       https://github.com/devmount-monstra/events
 *
 */
// Add plugin styles and scripts
Stylesheet::add('plugins/events/css/events.admin.css', 'backend', 11);
Javascript::add('plugins/events/js/events.admin.js', 'backend', 11);
// lib: Image Picker http://rvera.github.io/image-picker/
Stylesheet::add('plugins/events/lib/image-picker/image-picker.css', 'backend', 11);
Javascript::add('plugins/events/lib/image-picker/image-picker.js', 'backend', 11);
// Admin Navigation: add new item
Navigation::add(__('Events', 'events'), 'content', 'events', 10);
// Add action on admin_pre_render hook
Action::add('admin_pre_render', 'EventsAdmin::_getAjaxData');
// register repository classes
require_once 'repositories/repository.events.php';
require_once 'repositories/repository.categories.php';
require_once 'repositories/repository.locations.php';
/**
 * Events class
 *
 */
class EventsAdmin extends Backend
{
    /**
     * Ajax: get Event by ID
     */
开发者ID:devmount-monstra,项目名称:events,代码行数:31,代码来源:events.admin.php

示例12: main

<?php

// Add plugin navigation link
Navigation::add(__('Themes', 'themes'), 'extends', 'themes', 2);
/**
 * Themes Admin Class
 */
class ThemesAdmin extends Backend
{
    /**
     * Themes plugin admin
     */
    public static function main()
    {
        // Get current themes
        $current_site_theme = Option::get('theme_site_name');
        $current_admin_theme = Option::get('theme_admin_name');
        // Init vars
        $themes_site = Themes::getSiteThemes();
        $themes_admin = Themes::getAdminThemes();
        $templates = Themes::getTemplates();
        $chunks = Themes::getChunks();
        $styles = Themes::getStyles();
        $scripts = Themes::getScripts();
        $errors = array();
        $chunk_path = THEMES_SITE . DS . $current_site_theme . DS;
        $template_path = THEMES_SITE . DS . $current_site_theme . DS;
        $style_path = THEMES_SITE . DS . $current_site_theme . DS . 'css' . DS;
        $script_path = THEMES_SITE . DS . $current_site_theme . DS . 'js' . DS;
        // Save site theme
        if (Request::post('save_site_theme')) {
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:31,代码来源:themes.admin.php

示例13: main

<?php

// Add plugin navigation link
Navigation::add(__('Backups', 'backup'), 'system', 'backup', 3);
/**
 * Backup Admin Class
 */
class BackupAdmin extends Backend
{
    /**
     * Backup admin
     */
    public static function main()
    {
        $backups_path = ROOT . DS . 'backups';
        // Create backup
        // -------------------------------------
        if (Request::post('create_backup')) {
            if (Security::check(Request::post('csrf'))) {
                @set_time_limit(0);
                @ini_set("memory_limit", "512M");
                $zip = Zip::factory();
                // Add storage folder
                $zip->readDir(STORAGE . DS, false);
                // Add public folder
                $zip->readDir(ROOT . DS . 'public' . DS, false);
                // Add plugins folder
                $zip->readDir(PLUGINS . DS, false, null, array(PLUGINS . DS . 'box'));
                if ($zip->archive($backups_path . DS . Date::format(time(), "Y-m-d-H-i-s") . '.zip')) {
                    Notification::set('success', __('Backup was created', 'backup'));
                } else {
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:31,代码来源:backup.admin.php

示例14: main

<?php

// Add plugin navigation link
Navigation::add(__('Slider', 'slider'), 'content', 'slider', 4);
/**
 * Slider Admin Class
 */
class SliderAdmin extends Backend
{
    /**
     * Slider table
     *
     * @var object
     */
    public static $slider = null;
    /**
     * Main
     */
    public static function main()
    {
        // Get slider table
        SliderAdmin::$slider = new Table('slider');
        // Get pages table
        $pages = new Table('pages');
        // Create target array
        $slider_item_target_array = array('' => '', '_blank' => '_blank', '_parent' => '_parent', '_top' => '_top');
        // Create order array
        $slider_item_order_array = range(0, 40);
        // Check for get actions
        // ---------------------------------------------
        if (Request::get('action')) {
开发者ID:cmroanirgo,项目名称:monstra-slider,代码行数:31,代码来源:slider.admin.php

示例15: main

<?php

// Add plugin navigation link
Navigation::add(__('Users', 'users'), 'system', 'users', 2);
/**
 * Users Admin Class
 */
class UsersAdmin extends Backend
{
    /**
     * Users admin
     */
    public static function main()
    {
        // Users roles
        $roles = array('admin' => __('Admin', 'users'), 'editor' => __('Editor', 'users'), 'user' => __('User', 'users'));
        // Get uses table
        $users = new Table('users');
        if (Option::get('users_frontend_registration') === 'true') {
            $users_frontend_registration = true;
        } else {
            $users_frontend_registration = false;
        }
        if (Request::post('users_frontend_submit')) {
            if (Security::check(Request::post('csrf'))) {
                if (Request::post('users_frontend_registration')) {
                    $users_frontend_registration = 'true';
                } else {
                    $users_frontend_registration = 'false';
                }
                if (Option::update('users_frontend_registration', $users_frontend_registration)) {
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:31,代码来源:users.admin.php


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