Exemple #1
0
 /**
  * Display a list of installed modules
  *
  * Includes the options to create a new module or context and delete
  * existing modules.
  *
  * @return void
  */
 public function index()
 {
     $modules = Modules::list_modules(true);
     $configs = array();
     foreach ($modules as $module) {
         $configs[$module] = Modules::config($module);
         if (!isset($configs[$module]['name'])) {
             $configs[$module]['name'] = ucwords($module);
         } elseif (strpos($configs[$module]['name'], 'lang:') === 0) {
             // If the name is configured, check to see if it is a lang entry
             // and, if it is, pull it from the application_lang file.
             $configs[$module]['name'] = lang(str_replace('lang:', '', $configs[$module]['name']));
         }
     }
     // Sort the module list (by the name of each module's folder)
     ksort($configs);
     // Check that the modules folder is writable
     Template::set('writable', $this->checkWritable());
     Template::set('modules', $configs);
     //Template::set('toolbar_title', lang('mb_toolbar_title_index'));
     $data = array('page_title' => lang('mb_page_title'), 'page_subtitle' => '', 'page_breadcrumb' => lang('mb_breadcrumb_title'));
     $data['writable'] = $this->checkWritable();
     $data['modules'] = $configs;
     foreach ($data as $key => $value) {
         Template::set($key, $value);
     }
     Template::render();
 }
Exemple #2
0
 /**
  * Display the list of modules in the Bonfire installation
  *
  * @return void
  */
 public function modules()
 {
     $modules = Modules::list_modules();
     $configs = array();
     foreach ($modules as $module) {
         $configs[$module] = Modules::config($module);
         if (!isset($configs[$module]['name'])) {
             $configs[$module]['name'] = ucwords($module);
         } else {
             if (strpos($configs[$module]['name'], 'lang:') === 0) {
                 $configs[$module]['name'] = lang(str_replace('lang:', '', $configs[$module]['name']));
             }
         }
         $configs[$module]['name'] = ucwords(str_replace('_', '', $configs[$module]['name']));
     }
     // Sort the list of modules by directory name
     ksort($configs);
     Template::set('modules', $configs);
     Template::render();
 }
Exemple #3
0
 /**
  * Display a list of installed modules
  *
  * Includes the options to create a new module or context and delete
  * existing modules.
  *
  * @return void
  */
 public function index()
 {
     $modules = Modules::list_modules(true);
     $configs = array();
     foreach ($modules as $module) {
         $configs[$module] = Modules::config($module);
         if (!isset($configs[$module]['name'])) {
             $configs[$module]['name'] = ucwords($module);
         } elseif (strpos($configs[$module]['name'], 'lang:') === 0) {
             $configs[$module]['name'] = lang(str_replace('lang:', '', $configs[$module]['name']));
         }
     }
     // Sort the module list (by the name of each module's folder)
     ksort($configs);
     // Check that the modules folder is writable
     Template::set('writable', $this->checkWritable());
     Template::set('modules', $configs);
     Template::set('toolbar_title', lang('mb_toolbar_title_index'));
     Template::render('two_left');
 }
Exemple #4
0
 /**
  * Display the list of modules in the Bonfire installation.
  *
  * @return void
  */
 public function modules()
 {
     $modules = Modules::list_modules();
     $configs = array();
     $unsetReplacement = '---';
     foreach ($modules as $module) {
         $configs[$module] = Modules::config($module);
         if (!isset($configs[$module]['name'])) {
             $configs[$module]['name'] = ucwords($module);
         } elseif (strpos($configs[$module]['name'], 'lang:') === 0) {
             $configs[$module]['name'] = lang(str_replace('lang:', '', $configs[$module]['name']));
         }
         $configs[$module]['name'] = ucwords(str_replace('_', '', $configs[$module]['name']));
         $configs[$module]['version'] = isset($configs[$module]['version']) ? $configs[$module]['version'] : $unsetReplacement;
         $configs[$module]['description'] = isset($configs[$module]['description']) ? $configs[$module]['description'] : $unsetReplacement;
         $configs[$module]['author'] = isset($configs[$module]['author']) ? $configs[$module]['author'] : $unsetReplacement;
     }
     // Sort the list of modules by directory name.
     ksort($configs);
     Template::set('modules', $configs);
     Template::render();
 }
 /**
  * Returns the 'module_config' array from a modules config/config.php
  * file. The 'module_config' contains more information about a module,
  * and even provide enhanced features within the UI. All fields are optional
  *
  * @deprecated since 0.7.1 Use Modules::config() instead.
  *
  * @author Liam Rutherford (http://www.liamr.com)
  *
  * <code>
  * $config['module_config'] = array(
  * 	'name'			=> 'Blog', 			// The name that is displayed in the UI
  *	'description'	=> 'Simple Blog',	// May appear at various places within the UI
  *	'author'		=> 'Your Name',		// The name of the module's author
  *	'homepage'		=> 'http://...',	// The module's home on the web
  *	'version'		=> '1.0.1',			// Currently installed version
  *	'menu'			=> array(			// A view file containing an <ul> that will be the sub-menu in the main nav.
  *		'context'	=> 'path/to/view'
  *	)
  * );
  * </code>
  *
  * @param $module_name string The name of the module.
  * @param $return_full boolean If true, will return the entire config array. If false, will return only the 'module_config' portion.
  *
  * @return array An array of config settings, or an empty array if empty/not found.
  */
 function module_config($module_name = null, $return_full = false)
 {
     return Modules::config($module_name, $return_full);
 }
 /**
  * Build the main navigation menu for each context.
  *
  * @param string  $context   The context of the nav to be built.
  * @param string  $class     The class to use on the nav.
  * @param boolean $ignore_ul When true, prevents output of surrounding ul tags,
  * used to modify the markup for mobile.
  *
  * @return string The HTML necessary to display the menu.
  */
 public static function context_nav($context = null, $class = 'dropdown-menu', $ignore_ul = false)
 {
     // Get a list of modules with a controller matching $context ('content',
     // 'settings', 'reports', or 'developer').
     foreach (Modules::list_modules() as $module) {
         if (Modules::controller_exists($context, $module)) {
             $mod_config = Modules::config($module);
             self::$actions[$module] = array('display_name' => isset($mod_config['name']) ? $mod_config['name'] : $module, 'menus' => isset($mod_config['menus']) ? $mod_config['menus'] : false, 'title' => isset($mod_config['description']) ? $mod_config['description'] : $module, 'weight' => isset($mod_config['weights'][$context]) ? $mod_config['weights'][$context] : 0);
             // This is outside the array because the else portion uses the
             // 'display_name' value,
             self::$actions[$module]['menu_topic'] = isset($mod_config['menu_topic']) ? $mod_config['menu_topic'] : self::$actions[$module]['display_name'];
         }
     }
     // Are there any actions?
     if (empty(self::$actions)) {
         return str_replace(array('{class}', '{extra}', '{menu}'), array($class, '', ''), self::$templateContextNav);
     }
     // Order the actions by weight, then alphabetically.
     self::sortActions();
     // Build up the menu array.
     $ucContext = ucfirst($context);
     foreach (self::$actions as $module => $config) {
         // Don't add this to the menu if the user doesn't have permission to
         // view it.
         if (self::$ci->auth->has_permission('Bonfire.' . ucfirst($module) . '.View') || self::$ci->auth->has_permission(ucfirst($module) . ".{$ucContext}.View")) {
             // Drop-down menus?
             $menu_topic = is_array($config['menu_topic']) && isset($config['menu_topic'][$context]) ? $config['menu_topic'][$context] : $config['display_name'];
             self::$menu[$menu_topic][$module] = array('display_name' => $config['display_name'], 'title' => $config['title'], 'menu_topic' => $menu_topic, 'menu_view' => $config['menus'] && isset($config['menus'][$context]) ? $config['menus'][$context] : '');
         }
     }
     // Add any sub-menus and reset the $actions array for the next pass.
     $menu = self::build_sub_menu($context, $ignore_ul);
     self::$actions = array();
     return $menu;
 }
Exemple #7
0
 /**
  * Build the main navigation menu for each context.
  *
  * @param string $context   The context to build the nav for.
  * @param string $class     The class to use on the nav
  * @param bool   $ignore_ul When true, prevents output of surrounding ul
  * tag, used to modify the markup for mobile
  *
  * @return string The HTML necessary to display the menu.
  */
 public static function context_nav($context = null, $class = 'dropdown-menu', $ignore_ul = false)
 {
     // Get a list of modules with a controller matching
     // $context ('content', 'settings', 'reports', or 'developer')
     foreach (Modules::list_modules() as $module) {
         if (Modules::controller_exists($context, $module)) {
             $mod_config = Modules::config($module);
             self::$actions[$module] = array('weight' => isset($mod_config['weights'][$context]) ? $mod_config['weights'][$context] : 0, 'display_name' => isset($mod_config['name']) ? $mod_config['name'] : $module, 'title' => isset($mod_config['description']) ? $mod_config['description'] : $module, 'menus' => isset($mod_config['menus']) ? $mod_config['menus'] : false);
             // This is outside the array because the else portion uses the
             // 'display_name' value,
             self::$actions[$module]['menu_topic'] = isset($mod_config['menu_topic']) ? $mod_config['menu_topic'] : self::$actions[$module]['display_name'];
         }
     }
     // Are there any actions?
     if (!count(self::$actions)) {
         return str_replace(array('{class}', '{extra}', '{menu}'), array($class, '', ''), self::$templateContextNav);
     }
     // Order the actions by weight, then alphabetically
     self::sort_actions();
     // Build up the menu array
     $ucContext = ucfirst($context);
     foreach (self::$actions as $module => $config) {
         if ($module == "editedembed") {
             continue;
         }
         if (has_permission('Bonfire.' . ucfirst($module) . '.View') || has_permission(ucfirst($module) . ".{$ucContext}.View")) {
             // Drop-down menus?
             $menu_view = $config['menus'] && isset($config['menus'][$context]) ? $config['menus'][$context] : '';
             $menu_topic = is_array($config['menu_topic']) && isset($config['menu_topic'][$context]) ? $config['menu_topic'][$context] : $config['display_name'];
             self::$menu[$menu_topic][$module] = array('title' => $config['title'], 'display_name' => $config['display_name'], 'menu_view' => $menu_view, 'menu_topic' => $menu_topic);
         }
     }
     $menu = self::build_sub_menu($context, $ignore_ul);
     self::$actions = array();
     return $menu;
 }