/** * initialize * * @param Controller $controller instance of controller * @return void */ public function initialize(Controller $controller) { $this->_controller = $controller; if ($this->_config('multiRole')) { Croogo::hookAdminTab('Users/admin_add', 'Roles', 'Acl.admin/roles'); Croogo::hookAdminTab('Users/admin_edit', 'Roles', 'Acl.admin/roles'); } }
/** * Hook admin tabs */ protected function _adminTabs() { $controller = Inflector::camelize($this->request->params['controller']); $title = __d('pltfrm', 'Webhosting product'); $element = 'Pltfrm.admin/node_webhosting_product_tab'; $options = array('elementData' => array('webhostingHostGroups' => array('aaaaa', 'ffffff', 'fdddd'))); Croogo::hookAdminTab("{$controller}/admin_add", $title, $element, $options); Croogo::hookAdminTab("{$controller}/admin_edit", $title, $element, $options); }
/** * Hook admin tabs when type allows commenting */ protected function _adminTabs() { if (empty($this->_View->viewVars['type']['Type']['comment_status'])) { return; } $controller = Inflector::camelize($this->request->params['controller']); $title = __d('croogo', 'Comments'); $element = 'Comments.admin/comments_tab'; Croogo::hookAdminTab("{$controller}/admin_add", $title, $element); Croogo::hookAdminTab("{$controller}/admin_edit", $title, $element); }
/** * Hook admin tabs when $taxonomy is set */ protected function _adminTabs() { $controller = Inflector::camelize($this->request->params['controller']); if (empty($this->_View->viewVars['taxonomy']) || $controller == 'Terms') { return; } $title = __d('croogo', 'Terms'); $element = 'Taxonomy.admin/terms_tab'; Croogo::hookAdminTab("{$controller}/admin_add", $title, $element); Croogo::hookAdminTab("{$controller}/admin_edit", $title, $element); }
/** * Hook admin menu element to set role parent */ protected function _setupRole() { $title = __d('croogo', 'Parent Role'); $element = 'Acl.admin/parent_role'; Croogo::hookAdminTab('Roles/admin_add', $title, $element); Croogo::hookAdminTab('Roles/admin_edit', $title, $element); $this->_controller->Role->bindAro(); $id = null; if (!empty($this->_controller->request->params['pass'][0])) { $id = $this->_controller->request->params['pass'][0]; } $this->_controller->set('parents', $this->_controller->Role->allowedParents($id)); }
/** * initialize * * attaches Acl and RowLevelAcl behavior to the controller's primary model and * hook the appropriate admin tabs */ public function initialize(Controller $controller) { $this->_controller = $controller; $Model = $controller->{$controller->modelClass}; $Model->Behaviors->load('Acl', array('className' => 'Croogo.CroogoAcl', 'type' => 'controlled')); $Model->Behaviors->load('RowLevelAcl', array('className' => 'Acl.RowLevelAcl')); $name = $controller->name; $element = 'Acl.admin/row_acl'; if (!empty($this->settings['adminTabElement'])) { $element = $this->settings['adminTabElement']; } $adminTabActions = array('admin_add', 'admin_edit'); if (!empty($this->settings['adminTabActions'])) { $adminTabActions += $this->settings['adminTabActions']; } foreach ($adminTabActions as $action) { Croogo::hookAdminTab("{$name}/{$action}", __d('croogo', 'Permissions'), $element); } }
<?php CroogoNav::add('sidebar', 'webshop.children.orders', array('title' => __d('webshop_orders', 'Orders'), 'url' => array('admin' => true, 'plugin' => 'webshop_orders', 'controller' => 'orders', 'action' => 'index'))); CroogoNav::add('webshop-customer-dashboard', 'orders', array('title' => __d('webshop_orders', 'Orders'), 'url' => array('prefix' => 'panel', 'plugin' => 'webshop_orders', 'controller' => 'orders', 'action' => 'index'))); CroogoNav::add('webshop-dashboard-order-actions', 'view', array('title' => __d('webshop_orders', 'View'), 'url' => array('controller' => 'orders', 'action' => 'view', '_id'), 'htmlAttributes' => array('class' => 'btn-primary'))); CroogoNav::add('webshop-dashboard-order-actions', 'pay', array('title' => __d('webshop_orders', 'Pay'), 'url' => array('controller' => 'orders', 'action' => 'pay', '_id'), 'htmlAttributes' => array('class' => 'btn-success'))); Croogo::hookHelper('*', 'WebshopOrders.Order'); Croogo::hookAdminTab('Customers/admin_view', __d('webshop_orders', 'Orders'), 'WebshopOrders.admin/tab/orders');
Croogo::hookComponent('*', 'Example.Example'); /** * Helper * * This plugin's Example helper will be loaded via NodesController. */ Croogo::hookHelper('Nodes', 'Example.Example'); /** * Admin menu (navigation) * * This plugin's admin_menu element will be rendered in admin panel under Extensions menu. */ Croogo::hookAdminMenu('Example'); /** * Admin row action * * When browsing the content list in admin panel (Content > List), * an extra link called 'Example' will be placed under 'Actions' column. */ Croogo::hookAdminRowAction('Nodes/admin_index', 'Example', 'plugin:example/controller:example/action:index/:id'); /** * Admin tab * * When adding/editing Content (Nodes), * an extra tab with title 'Example' will be shown with markup generated from the plugin's admin_tab_node element. * * Useful for adding form extra form fields if necessary. */ Croogo::hookAdminTab('Nodes/admin_add', 'Example', 'example.admin_tab_node'); Croogo::hookAdminTab('Nodes/admin_edit', 'Example', 'example.admin_tab_node');
<?php CroogoCache::config('switcher_default', array_merge(Configure::read('Cache.defaultConfig'), array('duration' => '+10 minutes'))); Croogo::hookBehavior('Node', 'Switcher.Switcher'); Croogo::hookComponent('*', 'Switcher.Switcher'); Croogo::hookHelper('*', 'Switcher.Switcher'); Croogo::hookAdminTab('Nodes/admin_edit', 'Switcher', 'switcher.admin_tab_node'); Croogo::hookAdminTab('Nodes/admin_add', 'Switcher', 'switcher.admin_tab_node'); CroogoNav::add('extensions.children.switcher', array('title' => 'Switcher', 'url' => '#', 'children' => array('paths' => array('title' => 'Paths', 'url' => array('admin' => true, 'plugin' => 'switcher', 'controller' => 'switcher_paths', 'action' => 'index'), 'weight' => 10), 'nodes' => array('title' => 'Nodes', 'url' => array('admin' => true, 'plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'index'), 'weight' => 20))));
<?php Croogo::hookRoutes('Multiattach'); Croogo::hookComponent('Nodes', 'Multiattach.Multiattaches'); Croogo::hookBehavior('Node', 'Multiattach.Multiattach', array()); //Croogo::hookAdminTab('Nodes/admin_add', 'Attachments', 'Multiattach.admin_tab_node'); Croogo::hookAdminTab('Nodes/admin_edit', 'Attachments', 'Multiattach.admin_tab_node'); CroogoNav::add('settings.children.multiattach', array('title' => __('Multiattach'), 'url' => array('plugin' => 'Multiattach', 'controller' => 'Multiattach', 'action' => 'settings'), 'access' => array('admin')));
protected function _setPermissionRoots() { $roots = $this->AclAco->getPermissionRoots(); foreach ($roots as $id => $root) { Croogo::hookAdminTab('AclPermissions/admin_index', __d('croogo', $root['Aco']['title']), 'Croogo.blank', array('linkOptions' => array('data-alias' => $root['Aco']['alias']))); } $this->set(compact('roots')); }
<?php Croogo::hookBehavior('Node', 'CustomFields.CustomFieldHolder'); Croogo::hookAdminTab('Nodes/admin_add', __d('custom_fields', 'Custom fields'), 'CustomFields.tab_custom_fields'); Croogo::hookAdminTab('Nodes/admin_edit', __d('custom_fields', 'Custom fields'), 'CustomFields.tab_custom_fields');
Croogo::hookComponent('*', 'Revisions.Revisions'); /** * Helper * * This plugin's Revisions helper will be loaded via NodesController. */ Croogo::hookHelper('Nodes', 'Revisions.Revisions'); /** * Admin menu (navigation) * * This plugin's admin_menu element will be rendered in admin panel under Extensions menu. */ //Croogo::hookAdminMenu('Revisions'); /** * Admin row action * * When browsing the content list in admin panel (Content > List), * an extra link called 'Revisions' will be placed under 'Actions' column. */ //Croogo::hookAdminRowAction('Nodes/admin_index', 'Revisions', 'controller:nodes/action:edit/:id#node-revisions'); /** * Admin tab * * When adding/editing Content (Nodes), * an extra tab with title 'Revisions' will be shown with markup generated from the plugin's admin_tab_node element. * * Useful for adding form extra form fields if necessary. */ Croogo::hookAdminTab('Nodes/admin_add', 'Revisions', 'Revisions.admin_tab_node'); Croogo::hookAdminTab('Nodes/admin_edit', 'Revisions', 'Revisions.admin_tab_node');
<?php $cacheConfig = array_merge(Configure::read('Cache.defaultConfig'), array('groups' => array('seo_lite'))); CroogoCache::config('seo_lite', $cacheConfig); Configure::write('Seolite.keys', array('meta_keywords' => array('label' => __d('seolite', 'Keywords')), 'meta_description' => array('label' => __d('seolite', 'Description')), 'rel_canonical' => array('label' => __d('seolite', 'Canonical Page')))); Croogo::hookHelper('*', 'Seolite.SeoLite'); $queryString = env('REQUEST_URI'); if (strpos($queryString, 'admin') === false) { return; } /* * stuff for /admin routes only */ Croogo::hookBehavior('Node', 'Seolite.SeoCustomFields', array('priority' => 1)); $title = 'SeoLite'; $element = 'Seolite.admin/meta'; $options = array('elementData' => array('field' => 'body')); Croogo::hookAdminTab('Nodes/admin_add', $title, $element, $options); Croogo::hookAdminTab('Nodes/admin_edit', $title, $element, $options); $options['elementData']['field'] = 'description'; Croogo::hookAdminTab('SeoLiteUrls/admin_add', $title, $element, $options); Croogo::hookAdminTab('SeoLiteUrls/admin_edit', $title, $element, $options); CroogoNav::add('sidebar', 'extensions.children.seo_lite', array('title' => 'SeoLite', 'url' => 'javascript:void(0)', 'children' => array('urls' => array('title' => __d('seo_lite', 'Meta by URL'), 'url' => array('admin' => true, 'plugin' => 'seolite', 'controller' => 'seo_lite_urls', 'action' => 'index')))));
<?php Croogo::hookBehavior('Node', 'Sites.SiteFilter', array('relationship' => array('hasAndBelongsToMany' => array('Site' => array('className' => 'Sites.Site', 'with' => 'Sites.SitesNode', 'foreignKey' => 'node_id', 'associationForeignKey' => 'site_id', 'unique' => 'keepExisting'))))); Croogo::hookBehavior('Block', 'Sites.SiteFilter', array('relationship' => array('hasAndBelongsToMany' => array('Site' => array('className' => 'Sites.Site', 'with' => 'Sites.SitesBlock', 'foreignKey' => 'block_id', 'associationForeignKey' => 'site_id', 'unique' => 'keepExisting', 'joinTable' => 'sites_blocks'))))); Croogo::hookBehavior('Link', 'Sites.SiteFilter', array('relationship' => array('hasAndBelongsToMany' => array('Site' => array('className' => 'Sites.Site', 'with' => 'Sites.SitesLink', 'foreignKey' => 'link_id', 'associationForeignKey' => 'site_id', 'unique' => 'keepExisting', 'joinTable' => 'sites_links'))))); if (Configure::read('Cakeforum.name') !== false) { Croogo::hookBehavior('ForumCategory', 'Sites.SiteFilter', array('relationship' => array('hasAndBelongsToMany' => array('Site' => array('className' => 'Sites.Site', 'with' => 'Sites.SitesForumCategory', 'foreignKey' => 'forum_category_id', 'associationForeignKey' => 'site_id'))))); Croogo::hookComponent('ForumCategories', 'Sites.SiteFilter'); } Croogo::hookComponent('*', array('Sites.Multisite' => array('priority' => 5))); Croogo::hookHelper('*', 'Sites.Sites'); // uncomment this line to use absolute url for menu links // alternatively, you can hook this helper later via other plugins // Croogo::hookHelper('*', 'Sites.SitesMenus'); Croogo::hookAdminTab('Nodes/admin_add', 'Sites', 'sites.sites_selection'); Croogo::hookAdminTab('Nodes/admin_edit', 'Sites', 'sites.sites_selection'); Croogo::hookAdminTab('Attachments/admin_add', 'Sites', 'sites.sites_selection'); Croogo::hookAdminTab('Attachments/admin_edit', 'Sites', 'sites.sites_selection'); Croogo::hookAdminTab('Blocks/admin_add', 'Sites', 'sites.sites_selection'); Croogo::hookAdminTab('Blocks/admin_edit', 'Sites', 'sites.sites_selection'); Croogo::hookAdminTab('Links/admin_add', 'Sites', 'sites.sites_selection'); Croogo::hookAdminTab('Links/admin_edit', 'Sites', 'sites.sites_selection'); $cacheConfig = Cache::config('_cake_model_'); $cacheConfig = Hash::merge($cacheConfig['settings'], array('prefix' => 'sites_', 'path' => CACHE . 'queries', 'duration' => '+1 hour')); Cache::config('sites', $cacheConfig); require 'admin_menu.php';
spl_autoload_register(function ($class) { $defaultPath = CakePlugin::path('Assets') . 'Vendor' . DS . 'Gaufrette' . DS . 'src' . DS; $base = Configure::read('Assets.GaufretteLib'); if (empty($base)) { $base = $defaultPath; } $class = str_replace('\\', DS, $class); if (file_exists($base . $class . '.php')) { include $base . $class . '.php'; } }); Configure::write('Wysiwyg.attachmentBrowseUrl', array('plugin' => 'assets', 'controller' => 'assets_attachments', 'action' => 'browse')); Configure::write('Wysiwyg.uploadsPath', ''); Croogo::mergeConfig('Wysiwyg.actions', array('AssetsAttachments/admin_browse')); App::uses('StorageManager', 'Assets.Lib'); StorageManager::config('LocalAttachment', array('description' => 'Local Attachment', 'adapterOptions' => array(WWW_ROOT . 'assets', true), 'adapterClass' => '\\Gaufrette\\Adapter\\Local', 'class' => '\\Gaufrette\\Filesystem')); StorageManager::config('LegacyLocalAttachment', array('description' => 'Local Attachment (Legacy)', 'adapterOptions' => array(WWW_ROOT . 'uploads', true), 'adapterClass' => '\\Gaufrette\\Adapter\\Local', 'class' => '\\Gaufrette\\Filesystem')); // TODO: make this configurable via backend $actions = array('Nodes/admin_edit', 'Blocks/admin_edit', 'Types/admin_edit'); $tabTitle = __d('assets', 'Assets'); foreach ($actions as $action) { list($controller, ) = explode('/', $action); Croogo::hookAdminTab($action, $tabTitle, 'Assets.admin/asset_list'); Croogo::hookHelper($controller, 'Assets.AssetsAdmin'); } // TODO: make this configurable via backend $models = array('Block', 'Node', 'Type'); foreach ($models as $model) { Croogo::hookBehavior($model, 'Assets.LinkedAssets', array('priority' => 9)); } Croogo::hookHelper('*', 'Assets.AssetsFilter');
CroogoNav::add('sidebar', 'webshop', array('title' => __d('webshop', 'Webshop'), 'url' => '#', 'weight' => 30, 'children' => array('customers' => array('title' => __d('webshop', 'Customers'), 'url' => array('plugin' => 'webshop', 'controller' => 'customers', 'action' => 'index')), 'products' => array('title' => __d('webshop', 'Products'), 'url' => array('plugin' => 'webshop', 'controller' => 'products', 'action' => 'index')), 'Configuration groups' => array('title' => __d('webshop', 'Configuration groups'), 'url' => array('plugin' => 'webshop', 'controller' => 'configuration_groups', 'action0' => 'index')), 'Configuration options' => array('title' => __d('webshop', 'Configuration options'), 'url' => array('plugin' => 'webshop', 'controller' => 'configuration_options', 'action' => 'index')), 'configuration' => array('title' => __d('webshop', 'Configuration'), 'url' => '#')))); CroogoNav::add('sidebar', 'settings.children.webshop', array('title' => __d('webshop', 'Webshop'), 'url' => '#')); CroogoNav::add('webshop-dashboard-address_details-actions', 'edit', array('title' => __d('webshop', 'Edit'), 'url' => array('controller' => 'address_details', 'action' => 'edit', '_id'), 'htmlAttributes' => array('class' => 'btn-primary'))); CroogoNav::add('webshop-dashboard-customer_contacts-actions', 'edit', array('title' => __d('webshop', 'Edit'), 'url' => array('controller' => 'customer_contacts', 'action' => 'edit', '_id'), 'htmlAttributes' => array('class' => 'btn-primary'))); //endregion //region Helpers Croogo::hookHelper('*', 'Webshop.Product'); Croogo::hookHelper('*', 'Webshop.ConfigurationOption'); Croogo::hookHelper('*', 'Webshop.Webshop'); //endregion //region Behaviors Croogo::hookBehavior('Node', 'Webshop.Product'); //endregion //region Components Croogo::hookComponent('*', 'Webshop.CustomerAccess'); //endregion Configure::write('Webshop.customer_access_providers', array()); Croogo::mergeConfig('Translate.models.ConfigurationOption', array('fields' => array('name' => 'nameTranslation'), 'translateModel' => 'Webshop.ConfigurationOption')); //region Panel prefix setup Croogo::mergeConfig('Routing.prefixes', array('panel')); Router::reload(); //endregion //region Admin panels //region Admin tabs Croogo::hookAdminTab('Products/admin_edit', 'Configuration implementation', 'Pltfrm.admin/node_webhosting_product_tab'); //endregion //region Admin hooks Croogo::hookAdminBox('Products/admin_edit', 'Configuration group', 'Webshop.admin/product/box_configuration_group_selector'); //endregion //endregion App::build(array('CustomerAccessProvider' => array('%s' . 'CustomerAccessProvider' . DS)), App::REGISTER);