Exemple #1
0
 /**
  * Method to check the progress of a component generation.
  * 
  * @param	string	$token		A form session token used to validate we are on the same form
  *
  * @return	array	An array of the progress (at completion) for the component generation.
  */
 public function checkGenerateProgress($token)
 {
     $progress_array = array();
     $ajaxTask = $this->getState('ajax');
     $progress = new ComponentArchitectGenerateProgressHelper();
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     switch ($ajaxTask) {
         case 'step':
             // get the progress session data
             $progress_array = $progress->getProgress($token);
             break;
             // Handle completion when there has been an error
         // Handle completion when there has been an error
         case 'complete':
             // get the progress session data
             $progress_array = $progress->getProgress($token);
             // Make sure session data is cleared
             $progress->clearProgress($token);
             break;
         default:
             break;
     }
     return $progress_array;
 }
Exemple #2
0
 /**
  * Method to get generate the component using helper functions.
  * 
  * @param	string	$token		A form session token used to validate we are on the same form
  *
  * @return	array	An array of the progress (at completion) for the component generation.
  */
 public function generate($token)
 {
     $component_id = (int) $this->getState('component_id', 0);
     $code_template_id = (int) $this->getState('code_template_id', 0);
     $output_path = (string) $this->getState('output_path', '');
     $zip_format = (string) $this->getState('zip_format', '');
     $logging = (int) $this->getState('logging', 0);
     $description = (string) $this->getState('description', '');
     // Initialise session data
     $progress = new ComponentArchitectGenerateProgressHelper();
     $progress->initialiseProgress($token);
     require_once JPATH_COMPONENT . '/' . 'helpers' . '/' . 'generate.php';
     $generate = new ComponentArchitectGenerateHelper($token);
     $generate->generateComponent($component_id, $code_template_id, $token, $output_path, $zip_format, (bool) $logging);
     $progress_array = $progress->getProgress($token);
     $progress->clearProgress($token);
     return $progress_array;
 }