Changeset 4578 for trunk/core/viewhelper/smarty/function.load_module.php
- Timestamp:
- 08/15/10 18:45:12 (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/viewhelper/smarty/function.load_module.php
r4493 r4578 37 37 /*if($params['name'] == 'news') 38 38 { 39 clansuite_xdebug::firebug($params);39 Clansuite_Debug::firebug($params); 40 40 }*/ 41 41 42 42 # Init incomming Variables 43 $module = isset( $params['name']) ? (string) mb_strtolower($params['name']) : '';44 $submodule = isset( $params['sub'] ) ? (string) mb_strtolower($params['sub']): '';45 $action = isset( $params['action']) ? (string) $params['action'] : '';46 $items = isset( $params['items'] ) ? (int) $params['items']: null;43 $module = isset($params['name']) ? (string) mb_strtolower($params['name']) : ''; 44 $submodule = isset($params['sub']) ? (string) mb_strtolower($params['sub']) : ''; 45 $action = isset($params['action']) ? (string) $params['action'] : ''; 46 $items = isset($params['items']) ? (int) $params['items'] : null; 47 47 48 48 # WATCH it, this resets the incomming parameters array … … 51 51 $module_classname = 'clansuite_module_'; 52 52 # Construct the variable module_name 53 if (isset($submodule) and mb_strlen($submodule) > 0)53 if(isset($submodule) and mb_strlen($submodule) > 0) 54 54 { 55 55 # like "clansuite_module_admin_menu" 56 $module_classname .= $module . '_' . $submodule;56 $module_classname .= $module . '_' . $submodule; 57 57 } 58 58 else … … 65 65 66 66 # Load class, if not already loaded 67 if (class_exists($module_classname, false) == false)67 if(class_exists($module_classname, false) == false) 68 68 { 69 69 # Check if class was loaded 70 if( Clansuite_Loader::loadModul($module_classname) == false)70 if(Clansuite_Loader::loadModul($module_classname) == false) 71 71 { 72 return '<br/>Module missing or misspelled: <strong>' . $module_classname.'</strong>';72 return '<br/>Module missing or misspelled: <strong>' . $module_classname . '</strong>'; 73 73 } 74 74 } 75 75 76 76 # Instantiate Class 77 $controller = new $module_classname; 77 $controller = new $module_classname( 78 Clansuite_CMS::getInjector()->instantiate('Clansuite_HttpRequest'), 79 Clansuite_CMS::getInjector()->instantiate('Clansuite_HttpResponse') 80 ); 78 81 $controller->setView($smarty); 79 82 $controller->initModel($module); … … 82 85 * Get the Ouptut of the Object->Method Call 83 86 */ 84 if( method_exists( $controller, $action ))87 if(method_exists($controller, $action)) 85 88 { 86 89 # exceptional handling of parameters and output for adminmenu 87 if ( $module_classname == 'clansuite_module_menu_admin')90 if($module_classname == 'clansuite_module_menu_admin') 88 91 { 89 92 $parameters = array(); 90 93 91 94 # Build a Parameter Array from Parameter String like: param|param|etc 92 if( empty($params['params']))95 if(empty($params['params'])) 93 96 { 94 97 $parameters = null; … … 102 105 } 103 106 104 # fastcall107 # call 105 108 $controller->$action($items); 106 107 #Clansuite_Loader::callClassMethod($controller, $action, $items);108 109 109 110 /** … … 116 117 * wich is defined by $smarty->template_dir. 117 118 * the order of detection is also determined by that array. 118 * @see $smarty->template_dir, clansuite_xdebug::printr($smarty->template_dir);119 * @see $smarty->template_dir, Clansuite_Debug::printr($smarty->template_dir); 119 120 */ 120 121 if($smarty->templateExists($module.DS.$action.'.tpl')) 121 if($smarty->templateExists($module . DS . $action . '.tpl')) 122 122 { 123 123 # $smarty->template_dir[s]..\news\widget_news.tpl 124 return $smarty->fetch($module .DS.$action.'.tpl');124 return $smarty->fetch($module . DS . $action . '.tpl'); 125 125 } 126 elseif($smarty->templateExists($module .DS.'view'.DS.$action.'.tpl'))126 elseif($smarty->templateExists($module . DS . 'view' . DS . $action . '.tpl')) 127 127 { 128 128 # $smarty->template_dir[s]..\news\view\widget_news.tpl 129 return $smarty->fetch($module .DS.'view'.DS.$action.'.tpl');129 return $smarty->fetch($module . DS . 'view' . DS . $action . '.tpl'); 130 130 } 131 131 else 132 132 { 133 return $smarty->trigger_error('Error! Failed to load Widget-Template for <br /> ' .$module_classname.' -> '.$action.'('.$items.')');133 return $smarty->trigger_error('Error! Failed to load Widget-Template for <br /> ' . $module_classname . ' -> ' . $action . '(' . $items . ')'); 134 134 } 135 135 } 136 136 else 137 137 { 138 return $smarty->trigger_error('Error! Failed to load Widget: <br /> ' .$module_classname.' -> '.$action.'('.$items.')');138 return $smarty->trigger_error('Error! Failed to load Widget: <br /> ' . $module_classname . ' -> ' . $action . '(' . $items . ')'); 139 139 } 140 140 }
Note: See TracChangeset
for help on using the changeset viewer.
