/** * Register a Joomla! extension as an EasyCreator project. * * @return mixed Redirect on success | boolean false on error */ public function register_project() { $input = JFactory::getApplication()->input; $builder = new EcrProjectBuilder(); $type = $input->get('ecr_project_type'); $name = $input->get('ecr_project_name'); $scope = $input->get('ecr_project_scope'); $project = $builder->registerProject($type, $name, $scope); if (false == $project) { //-- Error JFactory::getApplication()->enqueueMessage('Can not register project', 'error'); $builder->printErrors(); EcrHtml::formEnd(); return false; } $ecr_project = JFile::stripExt($project->getEcrXmlFileName()); $uri = 'index.php?option=com_easycreator&controller=stuffer&ecr_project=' . $ecr_project; $this->setRedirect($uri, jgettext('Your project has been registered')); }
/** * DoIt * * @throws Exception * @return void */ public function doExecute() { require JPATH_BASE . '/helpers/loader.php'; require JPATH_BASE . '/includes/defines.php'; jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); var_dump(getcwd()); var_dump($this->input->args); // Known project types $types = EcrProjectHelper::getProjectTypes(); // Known project "Tags" - short forms $tags = EcrProjectHelper::getProjectTypesTags(); // Predefined actions $actions = $this->getActions(); var_dump($actions); var_dump($tags); // @todo What do you want to do today ? =;) return; $this->input->set('ecr_project', 'wap_fuuuschubidu'); $builder = new EcrProjectBuilder(); $type = 'webapp'; //getCmd('tpl_type'); $name = 'mvc_1'; //getCmd('tpl_name'); $comName = 'wap_gugugugu'; //getCmd('com_name'); if (in_array($type, array('cliapp', 'webapp'))) { define('JPATH_SITE', __DIR__); } $newProject = $builder->build($type, $name, $comName); if (!$newProject) { //-- Error $this->out('An error happened while creating your project'); // JFactory::getApplication()->enqueueMessage(jgettext('An error happened while creating your project'), 'error'); // $builder->printErrors(); $errors = $builder->getErrors(); var_dump($errors); //EcrHtml::formEnd(); return; } if ('test' == JFactory::getApplication()->input->get('ecr_test_mode')) { //-- Exiting in test mode echo '<h2>Exiting in test mode...</h2>'; echo $builder->printLog(); $builder->printErrors(); EcrHtml::formEnd(); return; } $ecr_project = JFile::stripExt($newProject->getEcrXmlFileName()); // $uri = 'index.php?option=com_easycreator&controller=stuffer&ecr_project='.$ecr_project; $this->out('Your project has been created'); echo ECRPATH_DATA; $project = EcrProjectHelper::getProject(); var_dump($project); }