Example #1
0
 function renderInput($articleid, $fieldsid, $value, $extras = null)
 {
     $directory = "";
     if (JFactory::getApplication()->isAdmin()) {
         $directory = "";
     }
     $session =& JFactory::getSession();
     $session->set('articleid', $articleid);
     $session->set('fieldsattachid', $fieldsid);
     $sitepath = fieldsattachHelper::getabsoluteURL();
     $str_gallery = '<div id="gallery_' . $fieldsid . '" class="galleryfield" style="margin-top:50px;">' . plgfieldsattachment_imagegallery::getGallery1($articleid, $fieldsid) . '</div>';
     $str = '';
     /*$str .=  '<div style=" position:relative; width:150px;  overflow: hidden;">
           <div  class="button2-left" >
           <div class="image" >';
       if ((JRequest::getVar('option')=='com_categories' && JRequest::getVar('layout')=="edit"   ))
       {
           $str  .='<a class="modal-button" title="Article" href="'.$sitepath.'/administrator/index.php?option=com_fieldsattach&amp;view=fieldsattachimages&amp;tmpl=component&amp;catid='.$articleid.'&amp;fieldsattachid='.$fieldsid.'&amp;reset=1" onclick="IeCursorFix(); return false;" rel="{handler: \'iframe\', size: {x: 980, y: 500}}">';
        }else{
           $str  .='<a class="modal-button" title="Article" href="'.$sitepath.'/administrator/index.php?option=com_fieldsattach&amp;view=fieldsattachimages&amp;tmpl=component&amp;articleid='.$articleid.'&amp;catid='.$articleid.'&amp;fieldsattachid='.$fieldsid.'&amp;reset=1" onclick="IeCursorFix(); return false;" rel="{handler: \'iframe\', size: {x: 980, y: 500}}">';
       }
        $str  .=JText::_("Gallery administrator");
        $str  .=' 
               </a>
               </div>
               </div>
               </div>';*/
     /*$str .= '<div style="position:relative; float:right; top:0px;"><a class=\'modal\' rel=\'{handler: "iframe", size: {x: 980, y: 500}}\' href=\'index.php?option=com_fieldsattach&view=fieldsattachimage&layout=edit&tmpl=component&reset=2\'></a>
     			';
                $str .= "<a href='#' onclick='update_gallery".$fieldsid."();return false;'><img src='components/com_fieldsattach/images/icon-refresh.png' alt='refresh' /></a>";
     		$str .= "<a class='modal' rel='{handler: \"iframe\", size: {x: 980, y: 500}}' href='index.php?option=com_fieldsattach&view=fieldsattachimage&layout=edit&tmpl=component&reset=2'><img src='components/com_fieldsattach/images/icon-32-new.png' alt='refresh' /></a>";
     		$str .= '</div>';*/
     $str .= $str_gallery;
     $str .= "<script type=\"text/javascript\">\n                                        \n\t\t\t\t\t\twindow.addEvent('domready', function(){\n\t\t\t\t\t\t\t\t   \n\t\t\t\t\t\t\t\t  update_gallery" . $fieldsid . "(); \n\t\t\t\t\t\t\t\t   \n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t}); \n                                               \n\t\t\t\t\t\t\n\t\t\t\t\t\tfunction update_gallery" . $fieldsid . "()\n\t\t\t\t\t\t{\n                                                        \n\t\t\t\t\t\t\t \n\t\t\t\t\t\t  \tvar url_" . $fieldsid . " = \"" . JURI::base(false) . "/index.php?option=com_fieldsattach&view=fieldsattachimagesajax&tmpl=component&catid=" . $articleid . "&fieldsid=" . $fieldsid . "\";\n\t\t\t\t\t\t \t \n                                                        var xmlhttp;\n                                                        if (window.XMLHttpRequest)\n                                                        {// code for IE7+, Firefox, Chrome, Opera, Safari\n                                                        xmlhttp=new XMLHttpRequest();\n                                                        }\n                                                        else\n                                                        {// code for IE6, IE5\n                                                        xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n                                                        }\n                                                        xmlhttp.onreadystatechange=function()\n                                                        {\n                                                        if (xmlhttp.readyState==4 && xmlhttp.status==200)\n                                                            {\n                                                                 document.getElementById(\"gallery_" . $fieldsid . "\").innerHTML=xmlhttp.responseText;\n                                                                 SqueezeBox.initialize({});\n                                                                 SqueezeBox.assign(\$\$('#gallery_" . $fieldsid . " a.modal'), { parse: 'rel'});\n                                                      \n                                                            }\n                                                        }\n                                                        xmlhttp.open(\"GET\",  url_" . $fieldsid . " ,true);\n                                                        xmlhttp.send(); \n\t\t\t\t\t\t}\n\t\t\t\t</script>";
     return $str;
 }
Example #2
0
<?php

/**
 * @version		$Id: default.php 15 2011-09-02 18:37:15Z cristian $
 * @package		fieldsattach
 * @subpackage		Components
 * @copyright		Copyright (C) 2011 - 2020 Open Source Cristian Grañó, Inc. All rights reserved.
 * @author		Cristian Grañó
 * @link		http://joomlacode.org/gf/project/fieldsattach_1_6/
 * @license		License GNU General Public License version 2 or later
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
$sitepath = JPATH_SITE;
JLoader::register('fieldsattachHelper', $sitepath . DS . 'administrator/components/com_fieldsattach/helpers/fieldsattach.php');
// load tooltip behavior
JHtml::_('behavior.tooltip');
JPluginHelper::importPlugin('fieldsattachment');
// very important
//renderInput
plgfieldsattachment_imagegallery::construct();
//$articleid, $fieldsid, $value, $extras=null
$articleid = JRequest::getVar("catid");
$fieldsid = JRequest::getVar("fieldsid");
//echo plgfieldsattachment_imagegallery::renderInput($articleid, $fieldsid, null);
//echo fieldsattachHelper::getGallery($articleid, $fieldsid);
echo plgfieldsattachment_imagegallery::getGallery1($articleid, $fieldsid);
?>
	 
 
Example #3
0
 function getHTML($articleid, $fieldsid, $category = false, $write = false)
 {
     //$str =   fieldattach::getImageGallery($articleid, $fieldsid,$category);
     global $globalreturn;
     $html = "";
     //$html =  '<ul class="gallery">';
     $db =& JFactory::getDBO();
     $query = 'SELECT  a.* FROM #__fieldsattach_images as a  WHERE a.fieldsattachid = ' . $fieldsid . ' AND a.articleid= ' . $articleid . ' ORDER BY a.ordering';
     if ($category) {
         $query = 'SELECT  a.* FROM #__fieldsattach_images as a  WHERE a.fieldsattachid = ' . $fieldsid . ' AND a.catid= ' . $articleid . ' ORDER BY a.ordering';
     }
     $db->setQuery($query);
     $result = $db->loadObjectList();
     $firs_link = '';
     $cont = 0;
     $sitepath = fieldsattachHelper::getabsoluteURL();
     $title = fieldattach::getName($articleid, $fieldsid, $category);
     $published = plgfieldsattachment_imagegallery::getPublished($fieldsid);
     if (!empty($result) && $published) {
         $html = plgfieldsattachment_imagegallery::getTemplate($fieldsid, "imagegallery");
         $line = plgfieldsattachment_imagegallery::getLineTemplate($fieldsid);
         $lines = "";
         /*
                         Templating IMAGEGLLERY *****************************
         [URL1] - Image1
                         [URL2] - Image2
                         [URL3] - Image3
                         [URL1] - Image1
                         [FIELD_ID] - Field id 
                         [ARTICLE_ID] - Article id
                         [TITLE] - Article id
                         [DESCRIPTION] - Article id
         */
         foreach ($result as $obj) {
             $img1 = $sitepath . '' . $obj->image1;
             $img2 = $sitepath . '' . $obj->image2;
             $img3 = $sitepath . '' . $obj->image3;
             $title = $obj->title;
             $description = $obj->description;
             $tmp = $line;
             $tmp = str_replace("[URL1]", $img1, $tmp);
             $tmp = str_replace("[URL2]", $img2, $tmp);
             $tmp = str_replace("[URL3]", $img3, $tmp);
             $tmp = str_replace("[ARTICLE_ID]", $articleid, $tmp);
             $tmp = str_replace("[FIELD_ID]", $fieldsid, $tmp);
             $tmp = str_replace("[TITLE]", $title, $tmp);
             $tmp = str_replace("[DESCRIPTION]", $description, $tmp);
             /*
             if (!JFile::exists( JPATH_SITE .DS. $obj->image2)  )
             {
                 $tmp = str_replace('</a>', '', $tmp);
                 $tmp = preg_replace('/<a[^>]+href[^>]+>/', '', $tmp);
             }
             */
             $lines .= $tmp;
         }
         if (fieldattach::getShowTitle($fieldsid)) {
             $html = str_replace("[TITLE]", $title, $html);
         } else {
             $html = str_replace("[TITLE]", "", $html);
         }
         $html = str_replace("[ARTICLE_ID]", $articleid, $html);
         $html = str_replace("[FIELD_ID]", $fieldsid, $html);
         $html = str_replace("[LINES]", $lines, $html);
     }
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }