コード例 #1
0
ファイル: phocagallerycategory.php プロジェクト: Tommar/vino
 protected function getInput()
 {
     $helper = new BtApbHelper();
     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::_('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 "<span class='{$class} source_phocagallery_not_found'>" . JText::_('PHOCA_ALERT') . "</span>";
     }
 }
コード例 #2
0
ファイル: jgallerycategory.php プロジェクト: Tommar/vino
 /**
  * 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_bt_apb/helpers/helper.php';
     $helper = new BtApbHelper();
     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 "<span class='{$class} source_jgallery_not_found'>" . JText::_('MOD_BTBGSLIDESHOW_JOOMGALLERY_ALERT') . "</span>";
     }
 }
コード例 #3
0
ファイル: mod_bt_apb.php プロジェクト: Tommar/vino
        } else {
            $video = '<video width="320" height="240" controls loop  autoplay><source src="' . $params->get('html5_video') . '"></source>Your browser does not support the video tag.</video>';
        }
    }
}
//prepare parameters
$headingText = $params->get('heading_text');
$subText = $params->get('sub_text');
$buttonText = $params->get('button_text');
$thumbnailHeight = $params->get('thumbnail_height', 200);
$thumbnailWidth = $params->get('thumbnail_width', 200);
$backgroundOverlay = '';
if ($params->get('textured_color', '')) {
    $backgroundOverlay .= $params->get('textured_color');
}
if ($params->get('background_textured', '')) {
    $relative_path = '/modules/mod_bt_apb/assets/images/pattern/';
    $backgroundOverlay .= ' url(' . JURI::root() . $relative_path . $params->get('background_textured') . ') ';
}
if ($params->get('textured_opacity', '')) {
    $backgroundOverlayOpacity = $params->get('textured_opacity');
} else {
    $backgroundOverlayOpacity = '';
}
$speedFactor = $params->get('speed_factor', 0.5);
$contentWidth = $params->get('content_width', '');
$contentEffect = $params->get('content_effect', 'fade');
$contentEffectCustom = $params->get('content_custom_effect', '');
$rows = $params->get('number_rows', 2);
BtApbHelper::fetchHead($params);
require JModuleHelper::getLayoutPath('mod_bt_apb', $params->get('layout', 'default'));
コード例 #4
0
ファイル: gallery.php プロジェクト: Tommar/vino
    protected function _build($moduleID, $name, $value)
    {
        /* @var JDocument $document */
        $document = JFactory::getDocument();
        if (version_compare(JVERSION, '1.6.0', 'ge')) {
            $document->addScript(JURI::root() . "modules/mod_bt_apb/assets/js/btslideshow.min.js");
            $document->addScript(JURI::root() . "modules/mod_bt_apb/assets/js/btbase64.min.js");
            $document->addScriptDeclaration('(function($){$(document).ready(function(){initGallery();});})(jQuery);');
        } else {
            $document->addScript(JURI::root() . "modules/mod_bt_apb/assets/js/btloader.min.js");
            // Hack, replace mootools by newer
            foreach ($document->_scripts as $key => $tmp) {
                if (preg_match('#media/system/js/mootools.js#is', $key)) {
                    unset($document->_scripts[$key]);
                }
            }
            $mootools = array(JURI::root() . "modules/mod_bt_apb/assets/js/mootools-core.js" => 'text/javascript', JURI::root() . "modules/mod_bt_apb/assets/js/mootools-more.js" => 'text/javascript');
            $document->_scripts = $mootools + $document->_scripts;
            ?>
            <script>

                (function(){
                    var libs = [
                        '<?php 
            echo JURI::root();
            ?>
modules/mod_bt_apb/assets/js/mootools-core.js',
                        '<?php 
            echo JURI::root();
            ?>
modules/mod_bt_apb/assets/js/mootools-more.js',
                        '<?php 
            echo JURI::root();
            ?>
modules/mod_bt_apb/assets/js/btslideshow.min.js',
                        '<?php 
            echo JURI::root();
            ?>
modules/mod_bt_apb/assets/js/btbase64.min.js',
                        '<?php 
            echo JURI::root();
            ?>
modules/mod_bt_apb/assets/squeezebox/squeezebox.min.js'
                    ];

                    BT.Loader.js(libs, function(){
                        initGallery();
                    });
                    BT.Loader.css('<?php 
            echo JURI::root();
            ?>
modules/mod_bt_apb/assets/squeezebox/assets/squeezebox.css');

                    window.addEvent('load', function() {
                        document.combobox = null;
                        var combobox = new JCombobox();
                        document.combobox = combobox;
                    });

                })();
            </script>
            <?php 
        }
        // Remove temp files
        $images = json_decode(base64_decode($value));
        //check if 0 folder exists
        $saveDir = JPATH_SITE . '/modules/mod_bt_apb/images';
        if ($moduleID != 0 && JFolder::exists($saveDir . '/0')) {
            JFolder::move($saveDir . '/0', $saveDir . '/' . $moduleID);
        }
        //load file if miss save
        $originalDir = $saveDir . '/' . $moduleID . '/original';
        if (is_dir($originalDir)) {
            $open = opendir($originalDir);
            $arrFiles = array();
            $filename = readdir($open);
            while ($filename !== false) {
                //check validated file
                if (filetype($originalDir . '/' . $filename) == "file") {
                    $existed = false;
                    if (count($images) > 0) {
                        foreach ($images as $image) {
                            if ($image->file == $filename) {
                                $existed = true;
                                break;
                            }
                        }
                    }
                    if (!$existed) {
                        $objFile = new stdClass();
                        $objFile->file = $filename;
                        $objFile->title = '';
                        $images[] = $objFile;
                    }
                }
                $filename = readdir($open);
            }
        }
        $moduleURI = JPATH_SITE . "/modules/mod_bt_apb/";
        if (isset($this->params)) {
            $thumbWidth = $this->params->thumbnail_width;
            $thumbHeight = $this->params->thumbnail_height;
            // Make thumbnail if haven't created or just change the size
            $originalPath = JPATH_SITE . '/modules/mod_bt_apb/images/original/';
            $thumbnailPath = JPATH_SITE . '/modules/mod_bt_apb/images/thumbnail/';
            $originalFile = '';
            foreach ($images as $image) {
                $file = $thumbnailPath . $image->file;
                if ($this->params->remote_image) {
                    if (isset($image->remote)) {
                        $originalFile = $image->remote;
                    } else {
                        $originalFile = $originalPath . $image->file;
                    }
                } else {
                    if (file_exists($originalPath . $image->file)) {
                        $originalFile = $originalPath . $image->file;
                    } else {
                        if (isset($image->remote)) {
                            $originalFile = $image->remote;
                        }
                    }
                }
                if (file_exists($file)) {
                    $imageSize = getimagesize($file);
                    if ($imageSize[0] != $thumbWidth || $imageSize[1] != $thumbHeight) {
                        BTImageHelper::resize($originalFile, $file, $thumbWidth, $thumbHeight, true, 100);
                    }
                } else {
                    BTImageHelper::resize($originalFile, $file, $thumbWidth, $thumbHeight, true, 100);
                }
            }
        }
        $value = base64_encode(json_encode($images));
        $html = '
			<div id="btss-message" class="clearfix"></div>
                  <ul id="btss-upload-list"></ul>
			<div id="btss-file-uploader">
				<noscript>
					<p>' . JText::_('MOD_BTBGSLIDESHOW_NOTICE_JAVASCRIPT') . '</p>
				</noscript>
			</div>
			<input id="btss-gallery-hidden" class="gallery-option" type="hidden" name="' . $name . '" value="" />
			<ul id="btss-gallery-container" class="clearfix"></ul>
			';
        ?>
        <script type="text/javascript">
            function openFrame(a){
                var jQ = jQuery.noConflict();				
                if(jQ("#ifK2Articles").css('display') != 'none') return false;
                if(jQ(a).attr('rel') == 0){
                    jQ(a).html('Back');
                    jQ(a).attr('rel', 1);
                    jQ("#sbox-window .adminform").hide();
                    jQ("#sbox-window").animate({height: 450}, 300);
                    jQ("#ifArticles").show();
                }else{
                    jQ(a).html('Select Article');
                    jQ(a).attr('rel', 0);
                    jQ("#sbox-window .adminform").show();
                    jQ("#sbox-window").animate({height: 380}, 300);
                    jQ("#ifArticles").hide();
                }
                return false;
            }

            function jSelectArticle_jform_params_id(id, title, order){
                var jQ = jQuery.noConflict();				
                jQ("#btss-article").html('Select Article');
                jQ("#btss-article").attr('rel', 0);
                jQ("#ifArticles").hide();
                jQ("#sbox-window").animate({height: 380}, 300);
                jQ("#sbox-window .adminform").show();
                jQ.ajax({
                    type: "post",
                    url: location.href,
                    data: {action: "get_article",article_id : id},
                    success: function(response){
                        var data = jQ.parseJSON(response);						
                        if(data!= null && data.success){
                            jQ("#sbox-window .btss-title").val(title);
                            jQ("#sbox-window .btss-link").val(data.link);
                            jQ("#sbox-window .btss-desc").val(data.desc);							
                        }else{
                            jQ("#sbox-window .adminform").prepend(
                            "<div style='color: red; font-size: 10px;'>Importing article is failed. Have some errors.</div>"
                        );
                        }
                    },
                    error: function(jqXHR, textStatus, errorThrown){
                        //alert('Sending ajax request is failed. Check ajax.php, please.')
                    }
                });
            }
        <?php 
        require_once JPATH_ROOT . '/modules/mod_bt_apb/helpers/helper.php';
        if (BtApbHelper::checkK2Component()) {
            ?>
                    function openK2Frame(a){
                        var jQ = jQuery.noConflict();
                        if(jQ("#ifArticles").css('display') != 'none') return false;
                        if(jQ(a).attr('rel') == 0){
                            jQ(a).html('Back');
                            jQ(a).attr('rel', 1);
                            jQ("#sbox-window .adminform").hide();
                            jQ("#sbox-window").animate({height: 450}, 300);
                            jQ("#ifK2Articles").show();
                        }else{
                            jQ(a).html('Select K2 Article');
                            jQ(a).attr('rel', 0);
                            jQ("#sbox-window .adminform").show();
                            jQ("#sbox-window").animate({height: 380}, 300);
                            jQ("#ifK2Articles").hide();
                        }
                        return false;
                    }
                    function jSelectItem(id, title, objectname){
                        var jQ = jQuery.noConflict();
                        jQ("#btss-k2article").html('Select K2 Article');
                        jQ("#btss-k2article").attr('rel', 0);
                        jQ("#ifK2Articles").hide();
                        jQ("#sbox-window").animate({height: 350}, 300);
                        jQ("#sbox-window .adminform").show();
                        jQ.ajax({
                            type: "post",
                            url: location.href,
                            data: {action: "get_article", article_id : id, k2 : 1},
                            success: function(response){
                                var data = jQ.parseJSON(response);
                                if(data!= null && data.success){
                                    jQ("#sbox-window .btss-title").val(title);									
                                    jQ("#sbox-window .btss-link").val(data.link);									
                                    jQ("#sbox-window .btss-desc").val(data.desc);
                                }else{
                                    jQ("#sbox-window .adminform").prepend(
                                    "<div style='color: red; font-size: 10px;'>Importing k2 article is failed. Have some errors.</div>"
                                );
                                }
                            },
                            error: function(jqXHR, textStatus, errorThrown){
                                //alert('Sending ajax request is failed. Check ajax.php, please.')
                            }
                        });
                    }
            <?php 
        }
        ?>
	
			function initGallery(){
                BTSlideshow = new BT.Slideshow({
                    liveUrl: '<?php 
        echo JURI::root();
        ?>
',
                    encodedItems: '<?php 
        echo $value;
        ?>
',
                    moduleID: '<?php 
        echo $moduleID;
        ?>
',
                    galleryContainer: 'btss-gallery-container',
                    dialogTemplate:
                        '<div style="margin: 10px 0px 10px 10px;" class="button2-left">'+
                        '     <div class="blank">'+
                        '         <a id="btss-article" onclick="openFrame(this);" title="Import from article" class="btn btn-small" rel="0">Select Article</a>' +
                        '     </div>'+
                        '</div>'+
        <?php 
        if (BtApbHelper::checkK2Component()) {
            ?>
                            '<div style="margin: 10px 0px 10px 10px;" class="button2-left">'+
                                '     <div class="blank">'+
                                '         <a id="btss-k2article" onclick="openK2Frame(this);" title="Import from K2 article" class="btn btn-small" rel="0">Select K2 Article</a>' +
                                '     </div>'+
                                '</div>'+
            <?php 
        }
        ?>
                    '<fieldset style="clear: both;" class="adminform">' +
						'<legend><?php 
        echo JText::_('CAPTION');
        ?>
</legend>'+
                        '<ul class="adminformlist">' +
                        '<li>' +
                        '<label class="btss-title-lbl" class="hasTip" title="<?php 
        echo JText::_('TITLE_DESC');
        ?>
" for="btss-title"><?php 
        echo JText::_('TITLE_LABEL');
        ?>
</label>' +
                        '<input class="btss-title" type="text" name="btss-title" size="90" />' +
                        '</li>' +
                        '<li>' +
                        '<label class="btss-link-lbl" class="hasTip" title="<?php 
        echo JText::_('LINK_DESC');
        ?>
" for="btss-link"><?php 
        echo JText::_('LINK_LABEL');
        ?>
</label>' +
                        '<input class="btss-link" type="text" name="btss-link" size="90" />' +
                        '</li>' +
                        '<li>' +
                        '<label class="btss-target-lbl" class="hasTip" title="<?php 
        echo JText::_('TARGET_DESC');
        ?>
" for="btss-target"><?php 
        echo JText::_('TARGET_LABEL');
        ?>
</label>' +
                        '<select class="btss-target" name="btss-link">' +
                        '   <option value=""><?php 
        echo JText::_('TARGET_CURRENT');
        ?>
</option>' +
                        '   <option value="_blank"><?php 
        echo JText::_('TARGET_BLANK');
        ?>
</option>' +
                        '   <option value="window"><?php 
        echo JText::_('TARGET_WINDOW');
        ?>
</option>' +
                        '</select>'+
                        '</li>' +						
                        '<li>' +
                        '<label class="btss-desc-lbl" class="hasTip" title="<?php 
        echo JText::_('DESCRIPTION_DESC');
        ?>
" for="btss-desc"><?php 
        echo JText::_('DESCRIPTION_LABEL');
        ?>
</label>' +
                        '<textarea style="width: 375px;" class="btss-desc" name="btss-desc" rows="5" cols="50"></textarea>' +
                        '</li>' +
                        '</ul>' +                      
                        '</fieldset>' +						
						'<div style="clear: both;">' +
                        '<label>&nbsp;</label><button class="btss-dialog-ok btn btn-small" style="margin-left: 10px;"><?php 
        echo JText::_('BTN_OK');
        ?>
</button><button class="btss-dialog-cancel btn btn-small" style="margin-left: 10px;"><?php 
        echo JText::_('BTN_CANCEL');
        ?>
</button>'+
                        '</div>' +
                        '<iframe style="display: none" id="ifArticles" height="400" frameborder="0" width="775" src="index.php?option=com_content&view=articles&layout=modal&tmpl=component&function=jSelectArticle_jform_params_id"></iframe>'+
                        '<iframe style="display: none" id="ifK2Articles" height="400" frameborder="0" width="775" src="index.php?option=com_k2&view=images&task=element&tmpl=component"></iframe>'
                });


           };

        </script>
        <?php 
        return $html;
    }
コード例 #5
0
ファイル: ajax.php プロジェクト: Tommar/vino
 /**
  * Get images from JoomGallery Component
  */
 function getImagesFromJoomGallery(&$photos)
 {
     if (!is_array($photos)) {
         $photos = array();
     }
     require_once JPATH_ROOT . '/modules/mod_bt_apb/helpers/helper.php';
     $helper = new BtApbHelper();
     if (!$helper->checkJGalleryComponent()) {
         $this->result["success"] = false;
         $this->result["message"] = JText::_('COM_JOOMGALLERY_NOT_EXIST');
     } else {
         $rs = $helper->getJoomGalleryPhotos(JRequest::getString('jgallery_catid'));
         if (count($rs) > 0) {
             foreach ($rs as $photo) {
                 $file = JURI::root() . "images/joomgallery/originals/" . $photo->cat_name . '/' . $photo->filename;
                 $fileInfo = pathinfo($file);
                 $hashedName = md5($this->moduleID . '-' . 'jgallery-' . $photo->cat_name . '-' . $fileInfo['filename']);
                 if ($file && !JFile::exists($this->saveDir . "/tmp/manager/{$hashedName}.{$fileInfo["extension"]}") && !in_array($hashedName . '.' . $fileInfo["extension"], $this->items)) {
                     $objFile = new stdClass();
                     $objFile->file = str_replace('http://', '', $file);
                     $objFile->title = $photo->title;
                     $objFile->source = 'jgallery-' . $photo->cat_name;
                     $photos[] = $objFile;
                 }
             }
         }
     }
 }