/** * The constructor */ public function __construct($config = array()) { parent::__construct(); $app = JFactory::getApplication(); if (!isset($config['item_id']) || empty($config['item_id'])) { throw new Exception($this->_name . ": No plugin id given"); } // Get plugin data $this->item = $this->getModel('plugin')->getItem($config['item_id']); $this->type = "plg_" . strtolower($this->item->folder) . "_" . strtolower($this->item->name); // Create plugin directory $this->createDir = $this->item->createDir; // Set template base dirs $this->templateDirs[0] = JDeveloperXTD . "/templates/plugin"; $this->templateDirs[1] = JDeveloperTEMPLATES . "/plugin"; $this->template = $this->getTemplate(); if ($this->template === false) { throw new JDeveloperException($this->getErrors()); } // Get the plugin header $params = JComponentHelper::getParams('com_jdeveloper'); $header = new JDeveloperTemplate(JDeveloperTEMPLATES . DS . 'fileheader.txt'); $header->addPlaceholders(array('Author' => $params->get('author'), 'Copyright' => $params->get('copyright'), 'Extension' => ucfirst($this->item->name), 'License' => $params->get('license'), 'Version' => $this->item->version)); self::$templateHeader = $header->getBuffer(); }
/** * 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(); }
/** * The constructor */ public function __construct($config = array()) { parent::__construct(); $app = JFactory::getApplication(); if (!isset($config['FieldId']) || empty($config['FieldId'])) { throw new JDeveloperException($this->_name . ": No field id given"); } // Get field data $this->field = $this->getModel('field')->getItem($config['FieldId']); // Get table data $this->table = $this->getModel('table')->getItem($this->field->table); // Get component data $this->component = $this->getModel('component')->getItem($this->table->component); // Create component directory $this->createDir = $this->component->createDir; }
/** * 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 form id given"); } // Get form data $this->item = $this->getModel('form')->getItem($config['item_id']); // Set template base dirs $this->templateDirs[0] = JDeveloperXTD . "/templates/form"; $this->templateDirs[1] = JDeveloperTEMPLATES . "/form"; $this->template = $this->getTemplate(); if ($this->template === false) { throw new JDeveloperException($this->getErrors()); } }