Ejemplo n.º 1
0
 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>";
     }
 }
Ejemplo n.º 2
0
 /**
  * Returns the HTML for a category select box form field.
  *
  * @access  protected
  * @return  object    The category select box form field.
  * @since   2.0
  */
 function getInput()
 {
     require_once JPATH_ROOT . '/modules/mod_btimagegallery/helpers/helper.php';
     $helper = new BTImageGalleryHelper();
     if ($helper->checkJGalleryComponent()) {
         require_once JPATH_ADMINISTRATOR . '/components/com_joomgallery/includes/defines.php';
         JLoader::register('JoomExtensions', JPATH_ADMINISTRATOR . '/components/' . _JOOM_OPTION . '/helpers/extensions.php');
         JLoader::register('JoomHelper', JPATH_BASE . '/components/' . _JOOM_OPTION . '/helpers/helper.php');
         JLoader::register('JoomConfig', JPATH_BASE . '/components/' . _JOOM_OPTION . '/helpers/config.php');
         JLoader::register('JoomAmbit', JPATH_BASE . '/components/' . _JOOM_OPTION . '/helpers/ambit.php');
         JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/' . _JOOM_OPTION . '/tables');
         JHTML::addIncludePath(JPATH_BASE . '/components/' . _JOOM_OPTION . '/helpers/html');
         $class = $this->element['class'] ? (string) $this->element['class'] : '';
         if ($this->element['required'] && $this->element['required'] == true && strpos($class, 'required') === false) {
             if (!empty($class)) {
                 $class .= ' ';
             }
             $class .= 'required';
         }
         if ($this->element['validate'] && (string) $this->element['validate'] == 'joompositivenumeric') {
             $doc =& JFactory::getDocument();
             // Add a validation script for form validation
             $js_validate = "\n            window.addEvent('domready', function() {\n              document.formvalidator.setHandler('joompositivenumeric', function(value) {\n                regex=/^[1-9]+[0-9]*\$/;\n                return regex.test(value);\n              })\n            });";
             $doc->addScriptDeclaration($js_validate);
             // Element class needs attribute validate-...
             if (!empty($class)) {
                 $class .= ' ';
             }
             $class .= 'validate-' . (string) $this->element['validate'];
             // Add some style to make the slect box red bordered when invalid
             $css = '
         select.invalid {
           border: 1px solid red;
         }';
             $doc->addStyleDeclaration($css);
         }
         $attr = '';
         $attr .= !empty($class) ? ' class="' . $class . '"' : '';
         $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
         $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
         $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
         $action = $this->element['action'] ? (string) $this->element['action'] : 'core.create';
         $exclude = $this->element['exclude'] ? (int) $this->element['exclude'] : null;
         $task = $this->element['task'] ? (int) $this->element['task'] : null;
         $html = JHTML::_('joomselect.categorylist', $this->value, $this->name, $attr, $exclude, '- ', $task, $action, $this->id);
         return $html;
     } else {
         $class = $this->element['class'] ? (string) $this->element['class'] : '';
         return "<div class='{$class}'>" . JText::_('MOD_BTIMAGEGALLERY_JOOMGALLERY_ALERT') . "</div>";
     }
 }
Ejemplo n.º 3
0
                         $objFile = new stdClass();
                         $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;
                     }
                 }
             }
         }
Ejemplo n.º 4
0
            if (isset($photo->remote)) {
                $originalFile = $photo->remote;
            } else {
                $originalFile = $originalPath . $photo->file;
            }
        } else {
            if (file_exists($originalPath . $photo->file)) {
                $originalFile = $originalPath . $photo->file;
            } else {
                if (isset($photo->remote)) {
                    $originalFile = $photo->remote;
                }
            }
        }
        if (file_exists($file)) {
            $imageSize = getimagesize($file);
            if ($imageSize[0] != $thumbWidth || $imageSize[1] != $thumbHeight) {
                BTImageHelper::resize($originalFile, $file, $thumbWidth, $thumbHeight);
            }
        } else {
            BTImageHelper::resize($originalFile, $file, $thumbWidth, $thumbHeight);
        }
    }
    $photosList = array_chunk($photos, $itemPerLi);
}
$liWidth = floor($thumbWidth * 0.7);
$liWidth = floor($thumbHeight * 0.7);
BTImageGalleryHelper::fetchHead($params);
$language = JFactory::getLanguage();
$rtl = $language->isRTL();
require JModuleHelper::getLayoutPath('mod_btimagegallery', 'default');