/** * The constructor */ public function __construct($config = array()) { parent::__construct(); $app = JFactory::getApplication(); if (!isset($config['item_id']) || empty($config['item_id'])) { throw new JDeveloperException($this->_name . ": No component id given"); } // Get component data $this->component = $this->getModel('component')->getItem($config['item_id']); // Get table data $this->tables = $this->getModel('tables')->getComponentTables($config['item_id']); // Get component directory $this->createDir = $this->component->createDir; $this->filePath = $this->templateFile; // Set template base dirs $this->templateDirs[0] = JDeveloperXTD . "/templates/component"; $this->templateDirs[1] = JDeveloperTEMPLATES . "/component"; $this->template = $this->getTemplate(); if ($this->template === false) { throw new JDeveloperException($this->getErrors()); } // Get the template header $params = JComponentHelper::getParams('com_jdeveloper'); $header = new JDeveloperTemplate(JDeveloperTEMPLATES . '/fileheader.txt'); $header->addPlaceholders(array('Author' => $params->get('author'), 'Copyright' => $params->get('copyright'), 'License' => $params->get('license'), 'Version' => $this->component->version, 'Extension' => ucfirst($this->component->display_name))); self::$templateHeader = $header->getBuffer(); }