protected function getInput() { $helper = new BTImageGalleryHelper(); if ($helper->checkPhocaComponent()) { $db = JFactory::getDBO(); //build the list of categories $query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid' . ' FROM #__phocagallery_categories AS a' . ' WHERE a.published = 1' . ' ORDER BY a.ordering'; $db->setQuery($query); $phocagallerys = $db->loadObjectList(); // TODO - check for other views than category edit $view = JRequest::getVar('view'); $catId = -1; if ($view == 'phocagalleryc') { $id = $this->form->getValue('id'); // id of current category if ((int) $id > 0) { $catId = $id; } } $tree = array(); $text = ''; if (method_exists('PhocaGalleryRenderAdmin', 'CategoryTreeOption')) { $tree = PhocaGalleryRenderAdmin::CategoryTreeOption($phocagallerys, $tree, 0, $text, $catId); } else { if (method_exists('PhocaGalleryCategory', 'CategoryTreeOption')) { $tree = PhocaGalleryCategory::CategoryTreeOption($phocagallerys, $tree, 0, $text, $catId); } else { $class = $this->element['class'] ? (string) $this->element['class'] : ''; return "<div class='{$class}'>" . JText::_('MOD_BTBGSLIDESHOW_PHOCA_ALERT') . "</div>"; } } array_unshift($tree, JHTML::_('select.option', '', '- ' . JText::_('MOD_BTIMAGEGALLERY_PHOCA_ALL_CATEGORIES') . ' -', 'value', 'text')); // Initialize JavaScript field attributes. $class = $this->element['class'] ? (string) $this->element['class'] : ''; $attr = ''; $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; $attr .= ' class="inputbox ' . $class . '"'; $document = JFactory::getDocument(); $document->addCustomTag('<script type="text/javascript"> function changeCatid() { var catid = document.getElementById(\'jform_catid\').value; var href = document.getElementById(\'pgselectytb\').href; href = href.substring(0, href.lastIndexOf("&")); href += \'&catid=\' + catid; document.getElementById(\'pgselectytb\').href = href; } </script>'); return JHTML::_('select.genericlist', $tree, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); } else { $class = $this->element['class'] ? (string) $this->element['class'] : ''; return "<div class='{$class}'>" . JText::_('MOD_BTIMAGEGALLERY_PHOCA_ALERT') . "</div>"; } }
$objFile->file = $file; $objFile->title = $photo->title; $objFile->source = 'jgallery-' . $photo->cat_name; $sourcePhotos[] = $objFile; } } } } } break; case 'phocagallery': $phoca_catid = $params->get('phoca_catid', 0); //nếu source là phoca if (isset($phoca_catid)) { $helper = new BTImageGalleryHelper(); if ($helper->checkPhocaComponent()) { $rs = $helper->getPhocaPhotos($phoca_catid); if (count($rs) > 0) { foreach ($rs as $photo) { $file = JURI::root() . "images/phocagallery/" . $photo->filename; if ($file) { $objFile = new stdClass(); $objFile->file = $file; $objFile->title = $photo->title; $objFile->source = 'phoca-' . $photo->cat_name; $sourcePhotos[] = $objFile; } } } } }