Example #1
0
 function index()
 {
     $this->load->helper('directory');
     $this->load->helper('inflector');
     // get tests from applications folder
     $test_list = array();
     $app_tests = $this->_get_tests(APPPATH . '/tests/', 'application');
     // get tests for modules
     $modules = $this->config->item('modules_allowed', 'fuel');
     $modules[] = 'fuel';
     $test_list = array();
     foreach ($modules as $module) {
         $module_test_folder = Fuel_modules::module_path($module) . '/tests/';
         $module_tests_list = $this->_get_tests($module_test_folder, $module);
         // merge the arrays with a + to preserve keys
         if (!empty($module_tests_list)) {
             $test_list = $test_list + $module_tests_list;
         }
     }
     // merge the arrays with a + to preserve keys
     if (!empty($app_tests)) {
         $test_list = $test_list + $app_tests;
     }
     asort($test_list);
     $vars['test_list'] = $test_list;
     $this->_render('tester', $vars);
 }
Example #2
0
 /**
  * Retrieve the info for a module
  *
  * @access	public
  * @param	string	module name (optional)
  * @return	array
  */
 public function info($prop = NULL)
 {
     if (empty($this->_init)) {
         $inits = Fuel_modules::get_all_module_configs();
         if (isset($inits[$this->module])) {
             $this->_init = $inits[$this->module];
         }
     }
     if (empty($this->_info)) {
         $this->CI->load->helper('inflector');
         $this->CI->load->helper('string');
         $defaults = array('module_name' => humanize($this->module), 'module_uri' => $this->module, 'model_name' => $this->module . '_model', 'model_location' => '', 'view_location' => '', 'display_field' => '', 'preview_path' => '', 'views' => array('list' => 'modules/module_list', 'create_edit' => 'modules/module_create_edit', 'delete' => 'modules/module_delete'), 'permission' => array($this->module, 'create', 'edit', 'publish', 'delete', 'export'), 'js_controller' => 'fuel.controller.BaseFuelController', 'js_controller_path' => '', 'js_controller_params' => array(), 'js_localized' => array(), 'js' => '', 'edit_method' => 'find_one_array', 'instructions' => lang('module_instructions_default', strtolower(humanize($this->module))), 'filters' => array(), 'archivable' => TRUE, 'table_headers' => array(), 'table_actions' => array('EDIT', 'VIEW', 'DELETE'), 'item_actions' => array('save', 'view', 'publish', 'activate', 'delete', 'duplicate', 'replace', 'create'), 'list_actions' => array(), 'rows_selectable' => TRUE, 'precedence_col' => 'precedence', 'clear_cache_on_save' => TRUE, 'create_action_name' => lang('btn_create'), 'configuration' => '', 'nav_selected' => NULL, 'default_col' => NULL, 'default_order' => NULL, 'sanitize_input' => TRUE, 'sanitize_files' => FALSE, 'displayonly' => FALSE, 'language' => '', 'language_col' => 'language', 'hidden' => FALSE, 'disabled' => FALSE, 'icon_class' => '', 'folder' => '', 'exportable' => FALSE, 'limit_options' => array('50' => '50', '100' => '100', '200' => '200'), 'advanced_search' => FALSE, 'disable_heading_sort' => FALSE, 'description' => '', 'search_field' => '', 'pages' => array());
         $info = array();
         foreach ($defaults as $key => $val) {
             if (isset($this->_init[$key])) {
                 $info[$key] = $this->_init[$key];
             } else {
                 $info[$key] = $val;
             }
         }
         // icon class for module
         if (empty($info['icon_class'])) {
             $info['icon_class'] = 'ico_' . url_title(str_replace('/', '_', $info['module_uri']), '_', TRUE);
         }
         // localize certain fields
         if (empty($info['module_name']) and $module_name = lang('module_' . $this->module)) {
             $info['module_name'] = $module_name;
         }
         // set proper jqxController name
         if (is_array($info['js_controller'])) {
             if (empty($info['js_controller_path'])) {
                 $info['js_controller_path'] = js_path('', key($info['js_controller']));
             }
             $info['js_controller'] = current($info['js_controller']);
         } else {
             if (is_string($info['js_controller']) and strpos($info['js_controller'], '.') === FALSE) {
                 //$info['js_controller'] = 'fuel.controller.'.$info['js_controller'];
                 $info['js_controller'] = $info['js_controller'];
             }
         }
         // convert slashes to jqx object periods
         $info['js_controller'] = str_replace('/', '.', $info['js_controller']);
         // set the base path to the controller file if still empty
         if (empty($info['js_controller_path'])) {
             $info['js_controller_path'] = js_path('', FUEL_FOLDER);
         }
         if ($create_action_name = lang('module_' . $this->module . '_create')) {
             $info['create_action_name'] = $create_action_name;
         }
         $this->_info = $info;
         // must be done after the above
         if (empty($this->_info['display_field'])) {
             $fields = $this->model()->fields();
             // loop through the fields and find the first column that doesn't have id or _id at the end of it
             for ($i = 1; $i < count($fields); $i++) {
                 if (substr($fields[$i], -3) != '_id') {
                     $this->_info['display_field'] = $fields[$i];
                     break;
                 }
             }
             if (empty($this->_info['display_field'])) {
                 $this->_info['display_field'] = $fields[1];
             }
             // usually the second field is the display_field... first is the id
         }
     }
     if (empty($prop)) {
         return $this->_info;
     } else {
         if (isset($this->_info[$prop])) {
             return $this->_info[$prop];
         } else {
             return FALSE;
         }
     }
 }