/** * Launch an actiongroup method * @param string $path identifier 'module|AG::method' * @param array $vars parameters */ function &process($path, $vars = array()) { static $instance = array(); $toReturn = null; $extractedPath = CopixActionGroup::extractPath($path); if ($extractedPath === null) { trigger_error(CopixI18N::get('copix:copix.error.load.actiongroup', $path), E_USER_ERROR); return $toReturn; } $actionGroupID = $extractedPath->module . '|' . $extractedPath->actiongroup; if (!isset($instance[$actionGroupID])) { if ($extractedPath->module === null) { $execPath = COPIX_PROJECT_PATH; } else { $execPath = COPIX_MODULE_PATH . $extractedPath->module . '/'; } $fileName = $execPath . COPIX_ACTIONGROUP_DIR . strtolower(strtolower($extractedPath->actiongroup)) . '.actiongroup.php'; if (is_readable($fileName)) { require_once $fileName; } else { trigger_error(CopixI18N::get('copix:copix.error.load.actiongroup', $path . '-' . $fileName), E_USER_ERROR); return $toReturn; } //Nom des objets/méthodes à utiliser. $objName = 'ActionGroup' . $extractedPath->actiongroup; //instance de l'objet, qui s'enregistre dans GLOBALS['COPIX']['ACTIONGROUP'] $instance[$actionGroupID] =& new $objName(); } $methName = $extractedPath->method; CopixContext::push($extractedPath->module); $instance[$actionGroupID]->vars =& $vars; $toReturn = $instance[$actionGroupID]->{$methName}(); CopixContext::pop(); return $toReturn; }