protected function initialize() { // Global translations $this->getLanguage()->addKeys(array("COM_" . strtoupper($this->component->name) => $this->component->display_name), "", false); $this->getLanguage()->addKeys(array("N_ITEMS_UNPUBLISHED" => JText::_('COM_JDEVELOPER_N_ITEMS_UNPUBLISHED'), "N_ITEMS_ARCHIVED" => JText::_('COM_JDEVELOPER_N_ITEMS_ARCHIVED'), "N_ITEMS_TRASHED" => JText::_('COM_JDEVELOPER_N_ITEMS_TRASHED'), "N_ITEMS_DELETED" => JText::_('COM_JDEVELOPER_N_ITEMS_DELETED'), "PARAMS_FIELDSET_LABEL" => JText::_('COM_JDEVELOPER_PARAMS_FIELDSET_LABEL'))); // System translations $this->getLanguage("sys")->addKeys(array("COM_" . strtoupper($this->component->name) => $this->component->display_name), "", false); $this->getLanguage("sys")->addKeys(array(strtoupper($this->component->name) => $this->component->display_name), "", false); return parent::initialize(); }
protected function initialize() { $buffer = array(); foreach ($this->tables as $table) { $create = JDeveloperCreate::getInstance("table.admin.sql", array("item_id" => $table->id)); $buffer[] = $create->getBuffer(); } $this->template = new JDeveloperTemplate(implode("\n\n", $buffer), false); return parent::initialize(); }
/** * @see JDeveloperCreateComponent::initialize() */ protected function initialize() { $this->template->addPlaceholders(array("fields" => $this->getConfigFields(), "form" => $this->getForm($this->component->form_id))); return parent::initialize(); }
protected function initialize() { $this->template->addPlaceHolders(array('getfields' => $this->getFields(), 'submenu' => $this->submenu())); return parent::initialize(); }
public function write($path = "") { return parent::write($this->createDir . "/admin/sql/uninstall.mysql.utf8.sql"); }
protected function initialize() { $this->template->addPlaceHolders(array("Sections" => $this->sections(), "form" => $this->getForm($this->component->form_id_access))); return parent::initialize(); }
protected function initialize() { $this->template->addPlaceHolders(array('items' => $this->getItemRoute())); return parent::initialize(); }
/** * 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(); }
public function write($path = "") { return parent::write($this->createDir . "/admin/sql/updates/" . $this->component->version . ".sql"); }
/** * Create component ids * * @param array $ids The component */ public function create($ids = array()) { // Initialize $user = JFactory::getUser(); $app = JFactory::getApplication(); $this->setRedirect(JRoute::_('index.php?option=com_jdeveloper&view=component', false)); if (empty($ids)) { $ids = $app->input->get('cid', array(), 'array'); } // Check access if (!$user->authorise('components.create', 'com_jdeveloper')) { $this->setMessage(JText::_('COM_JDEVELOPER_ACTION_NOT_ALLOWED'), 'warning'); return; } // Load classes JDeveloperLoader::import('archive'); JDeveloperLoader::import('template'); JDeveloperLoader::import('component', JDeveloperCREATE); JDeveloperLoader::import('table', JDeveloperCREATE); jimport('joomla.filesystem.folder'); // Create component for each id foreach ($ids as $id) { $component = $this->getModel()->getItem($id); $path = $component->createDir; // Delete old archive if exists JFile::exists($path . '.zip') ? JFile::delete($path . '.zip') : null; // Create component JDeveloperCreateComponent::execute("admin", array("item_id" => $id)); JDeveloperCreateTable::execute("admin", array("item_id" => $id)); // Create component for frontend if ($component->get('site', 0)) { JDeveloperCreateComponent::execute("site", array("item_id" => $id)); JDeveloperCreateTable::execute("site", array("item_id" => $id)); } // Get language files content $buffer = JDeveloperLanguage::getInstance("com_" . $component->name)->sort()->toINI(); $buffer_sys = JDeveloperLanguage::getInstance("com_" . $component->name . "_sys")->sort()->toINI(); // Write language files foreach ($component->params["languages"] as $lang) { JFile::write($component->createDir . "/admin/language/{$lang}.com_" . strtolower($component->name) . ".ini", $buffer); JFile::write($component->createDir . "/admin/language/{$lang}.com_" . strtolower($component->name) . ".sys.ini", $buffer_sys); $component->site ? JFile::write($component->createDir . "/site/language/{$lang}.com_" . strtolower($component->name) . ".ini", $buffer) : null; } // Create HTML files for each folder JDeveloperArchive::html($path . '/admin'); (int) $component->get('site', 0) ? JDeveloperArchive::html($path . '/site') : null; // Create ZIP archive and delete folder JDeveloperArchive::zip($path); JFolder::delete($path); } $this->setMessage(JText::sprintf('COM_JDEVELOPER_COMPONENT_CREATED', count($ids))); }
protected function initialize() { $this->template->addPlaceHolders(array('author' => $this->component->get('author'), 'author_email' => $this->component->get('author_email'), 'author_url' => $this->component->get('author_url'), 'copyright' => $this->component->get('copyright'), 'creationdate' => date("M Y"), 'licence' => $this->component->get('licence'), 'languages_site' => $this->langSite(), 'languages_admin' => $this->langAdmin(), 'submenus' => $this->submenus(), 'updatefiles' => $this->updateFiles(), 'version' => $this->component->get('version'))); $this->template->addAreas(array('dbtables' => !empty($this->tables), 'frontend' => $this->component->site, 'mvc' => !empty($this->tables))); return parent::initialize(); }