示例#1
1
 /**
  * Method to get an array of data items.
  *
  * @return  array  An array of data items
  *
  * @since   12.2
  */
 public function getItems()
 {
     jimport('joomla.filesystem.folder');
     $items = array();
     $files = JFolder::files(JDeveloperArchive::getArchiveDir());
     $store = $this->getStoreId('getItems');
     foreach ($files as $file) {
         if (preg_match('/(^pkg_).*(.zip$)/', $file)) {
             $item = new JObject();
             $item->set('id', $file);
             $item->set('name', $file);
             $item->set('created', date("Y M d - H:i:s", filemtime(JDeveloperArchive::getArchiveDir() . DS . $file)));
             $item->createDir = JDeveloperArchive::getArchiveDir() . "/" . JDeveloperArchive::getArchiveName("pkg_", $item->name, $item->get("version", "1.0.0"));
             $content = array();
             if (!($zip = zip_open(JDeveloperArchive::getArchiveDir() . DS . $file))) {
                 throw new Exception("Failed to open {$file}");
             }
             while ($zip_entry = zip_read($zip)) {
                 if (preg_match('/.zip$/', zip_entry_name($zip_entry))) {
                     $content[] = zip_entry_name($zip_entry);
                 }
             }
             $item->set('content', implode('<br>', $content));
             $items[] = $item;
         }
     }
     // Add the items to the internal cache.
     $this->cache['packages'] = $items;
     return $this->cache['packages'];
 }
示例#2
0
 /**
  * Method to get an array of data items.
  *
  * @return  array  An array of data items
  *
  * @since   12.2
  */
 public function getItems()
 {
     JDeveloperLoader::import("archive");
     $extension = JTable::getInstance("Extension", "JTable");
     // Get a storage key.
     $store = $this->getStoreId('getItems');
     // Load the list items.
     $items = parent::getItems();
     // Add information
     foreach ($items as $item) {
         // Is Component already installed?
         $item->createDir = JDeveloperArchive::getArchiveDir() . "/" . JDeveloperArchive::getArchiveName("mod_", $item->name, $item->version);
         $item->installed = JDeveloperInstall::isInstalled("module", "mod_" . $item->name);
         if ($item->installed) {
             $extension->load(array("name" => "mod_" . $item->name, "type" => "module"));
             $item->enabled = (bool) $extension->enabled;
         } else {
             $item->enabled = false;
         }
     }
     // If emtpy or an error, just return.
     if (empty($items)) {
         return array();
     }
     // Add the items to the internal cache.
     $this->cache[$store] = $items;
     return $this->cache[$store];
 }
示例#3
0
 /**
  * Method to get an array of data items.
  *
  * @return  array  An array of data items
  *
  * @since   12.2
  */
 public function getItems()
 {
     require_once JDeveloperLIB . DS . 'archive.php';
     // Get a storage key.
     $store = $this->getStoreId('getItems');
     // Load the list items.
     $items = parent::getItems();
     // Add information
     foreach ($items as $item) {
         // Is Component already installed?
         $item->installed = JDeveloperInstall::isInstalled("template", $item->name);
         $item->createDir = JDeveloperArchive::getArchiveDir() . "/" . JDeveloperArchive::getArchiveName("tpl_", $item->name, $item->version);
     }
     // If emtpy or an error, just return.
     if (empty($items)) {
         return array();
     }
     // Add the items to the internal cache.
     $this->cache[$store] = $items;
     return $this->cache[$store];
 }
示例#4
0
 /**
  * Method to get a single record.
  *
  * @param   integer  $pk  The id of the primary key.
  *
  * @return  mixed    Object on success, false on failure.
  *
  * @since   12.2
  */
 public function getItem($pk = null)
 {
     $app = JFactory::getApplication();
     $itemId = $this->getState("data.id", 0);
     $layout = $app->input->get("layout", "default", "string");
     if (empty($pk) && $layout == "default" && !empty($itemId)) {
         $pk = $itemId;
     }
     if (false === ($item = parent::getItem($pk))) {
         return false;
     }
     // Get related config form id
     $table = JTable::getInstance("Form", "JDeveloperTable");
     if ($table->load(array("tag" => "config", "relation" => "module." . $item->id . ".config"), true)) {
         $item->form_id = $table->id;
     } else {
         $item->form_id = 0;
     }
     $item->installed = JDeveloperInstall::isInstalled("module", "mod_" . $item->name);
     $item->createDir = JDeveloperArchive::getArchiveDir() . "/" . JDeveloperArchive::getArchiveName("mod_", $item->name, $item->version);
     $params = JComponentHelper::getParams("com_jdeveloper");
     if (empty($item->params['author'])) {
         $item->params['author'] = $params->get("author", "");
     }
     if (empty($item->params['author_email'])) {
         $item->params['author_email'] = $params->get("author_email", "");
     }
     if (empty($item->params['author_url'])) {
         $item->params['author_url'] = $params->get("author_url", "");
     }
     if (empty($item->params['copyright'])) {
         $item->params['copyright'] = $params->get("copyright", "");
     }
     if (empty($item->params['license'])) {
         $item->params['license'] = $params->get("license", "");
     }
     return $item;
 }
示例#5
0
 /**
  * Method to get an array of data items.
  *
  * @return  array  An array of data items
  *
  * @since   12.2
  */
 public function getItems()
 {
     require_once JDeveloperLIB . DS . 'archive.php';
     // Get a storage key.
     $store = $this->getStoreId('getItems');
     // Load the list items.
     $items = parent::getItems();
     // If emtpy or an error, just return.
     if (empty($items)) {
         return array();
     }
     // Get the ids and names of the components
     $db = JFactory::getDbo();
     // Add information
     foreach ($items as $item) {
         $query = $db->getQuery(true)->select('COUNT(*)')->from('#__jdeveloper_tables AS t')->where('t.component = "' . $db->escape($item->id) . '"');
         $db->setQuery($query);
         $item->numberOfTables = $db->loadResult();
         // Get the main table
         $query2 = $db->getQuery(true)->select('name')->from('#__jdeveloper_tables As t')->where('t.component = ' . $db->quote($item->id))->order('t.ordering', 'asc');
         $db->setQuery($query2);
         $result = $db->loadAssoc();
         $item->maintable = $result['name'];
         // Is Component already installed?
         $item->installed = JDeveloperInstall::isInstalled("component", "com_" . $item->name);
     }
     // Get the params as an array
     foreach ($items as $item) {
         $item->createDir = JDeveloperArchive::getArchiveDir() . "/" . JDeveloperArchive::getArchiveName("com_", $item->name, $item->version);
         $registry = new JRegistry();
         $registry->loadString($item->params);
         $item->params = $registry->toArray();
     }
     // Add the items to the internal cache.
     $this->cache[$store] = $items;
     return $this->cache[$store];
 }