Exemplo n.º 1
0
    function renderHelpConfig()
    {
        $return = "";
        $sitepath = fieldsattachHelper::getabsoluteURL();
        $form = $this->form->getFieldset("percha_vimeo");
        $return .= JHtml::_('sliders.panel', JText::_("JGLOBAL_FIELDSET_VIMEO_OPTIONS"), "percha_" . $this->params->get('name', "") . '-params');
        $return .= '<fieldset class="panelform" >
			<ul class="adminformlist" style="overflow:hidden;">';
        // foreach ($this->param as $name => $fieldset){
        foreach ($form as $field) {
            $return .= "<li>" . $field->label . " " . $field->input . "</li>";
        }
        $return .= '<div><input type="button" value="' . JText::_("Update Config") . '" onclick="controler_percha_vimeo()" /></div>';
        $return .= '</ul> </fieldset>';
        $return .= '<script src="' . $sitepath . 'plugins/fieldsattachment/vimeo/controler.js" type="text/javascript"></script> ';
        return $return;
    }
Exemplo n.º 2
0
    function getGallery1($articleid, $fieldsattachid)
    {
        // Load the tooltip behavior.
        $db = JFactory::getDbo();
        $directory = "administrator/";
        if (JFactory::getApplication()->isAdmin()) {
            $directory = "";
        }
        $query = $db->getQuery(true);
        // Select some fields
        $query->select('*');
        // From the hello table
        $query->from('#__fieldsattach_images');
        $query->where("articleid = " . $articleid . " AND fieldsattachid=" . $fieldsattachid);
        $query->order("ordering");
        $db->setQuery($query);
        //$str = $query;
        $rows = $db->loadObjectList();
        $str = '<div class="page-header" style="position:relative;"><a class=\'modal\' rel=\'{handler: "iframe", size: {x: 980, y: 500}}\' href=\'' . JURI::base(false) . '/' . $directory . 'index.php?option=com_fieldsattach&view=fieldsattachimage&layout=edit&tmpl=component&reset=2\'></a>';
        $str .= '<a class="modal btn btn-primary" rel="{handler: \'iframe\', size: {x: 980, y: 500}}" href="' . JURI::base(false) . 'index.php?option=com_fieldsattach&view=fieldsattachimage&layout=edit&tmpl=component&reset=2&fieldsattachid=' . $fieldsattachid . '">' . JText::_('NEW IMAGE') . '</a>';
        $str .= '&nbsp;&nbsp;';
        $str .= '<a href="#" onclick="update_gallery' . $fieldsattachid . '();return false;"><img src="' . JURI::base(false) . '/' . $directory . 'components/com_fieldsattach/images/icon-refresh.png" alt="refresh" /></a>';
        $str .= '</div>';
        $str .= '
		  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" /> 
		  <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>';
        $str .= " \n<style> \n.ui-sortable{overflow:hidden; margin:0; padding:0;}\n.sortable li  {\n  cursor: move;margin: 0 10px 12px 0; border:1px #ccc solid; float:left;border-radius: 5px;\n  padding: 3px;   width:200px; height:200px; overflow:hidden;\n} \n</style>";
        $str .= '<div   class="ui-sortable"><ul id="gallerysortable' . $fieldsattachid . '" class="sortable" >';
        $sitepath = fieldsattachHelper::getabsoluteURL();
        if ($rows > 0) {
            foreach ($rows as $row) {
                $url_edit = JURI::base() . 'index.php?option=com_fieldsattach&view=fieldsattachimage&tmpl=component&layout=edit&id=' . $row->id . '&fieldsattachid=' . $fieldsattachid . '&reset=2';
                $url_delete = JURI::base() . 'index.php?option=com_fieldsattach&amp;view=fieldsattachimages&amp;task=delete&amp;id=' . $row->id . '&amp;tmpl=component&amp;fieldsid=' . $fieldsattachid;
                $str .= '
	                  <li id="image_' . $fieldsattachid . '_' . $row->id . '"  style="width:150px; height:150px; ">
				    <div class="btn-group" style="margin-bottom:4px;">
					       <a class="modal btn btn-mini" style="min-width:20px;" href="' . $sitepath . $row->image1 . '">' . JText::_('ZOOM') . '</a>
					       <a class="modal btn btn-mini" style="min-width:20px;" href="' . $url_edit . '" rel="{handler: \'iframe\', size: {x: 980, y: 500}}">' . JText::_('EDIT') . '</a>
					       <a class="modal btn btn-mini" style="min-width:20px;" href="' . $url_delete . '" rel="{handler: \'iframe\', size: {x: 980, y: 500}}">' . JText::_('DELETE') . '</a>
					 
				    </div>
				    <img src="' . $sitepath . $row->image1 . '" alt="' . $row->title . '" />
		               	   
	                  </li>
	                  ';
            }
        }
        $str .= '</ul></div>
';
        return $str;
    }
Exemplo n.º 3
0
 /**
  * Return a image gallery HTML tag
  *
  * @param	$articleid	 id of article
  *              $fieldsids  id of field
  *
  * @return	html gallery   list
  * @since	1.6
  */
 public function getImageGallery($articleid, $fieldsids, $category = false)
 {
     $html = '<ul class="gallery">';
     $db =& JFactory::getDBO();
     $query = 'SELECT  a.* FROM #__fieldsattach_images as a  WHERE a.fieldsattachid = ' . $fieldsids . ' AND a.articleid= ' . $articleid . ' ORDER BY a.ordering';
     if ($category) {
         $query = 'SELECT  a.* FROM #__fieldsattach_images as a  WHERE a.fieldsattachid = ' . $fieldsids . ' AND a.catid= ' . $articleid . ' ORDER BY a.ordering';
     }
     $db->setQuery($query);
     $result = $db->loadObjectList();
     $firs_link = '';
     $cont = 0;
     $sitepath = fieldsattachHelper::getabsoluteURL();
     if (!empty($result)) {
         foreach ($result as $obj) {
             //if (JFile::exists( JPATH_SITE .DS."images".DS."documents".DS. $articleid .DS. $result->value)  )
             $html .= '<li>';
             if (JFile::exists(JPATH_SITE . DS . $obj->image2)) {
                 $html .= '<a href="' . $sitepath . '' . $obj->image1 . '" id="imgFiche" class="nyroModal" title="' . $obj->title . '" rel="gal_' . $articleid . '">';
                 $html .= '<img src="' . $sitepath . '' . $obj->image2 . '"  alt="' . $obj->title . '" />';
             } else {
                 $html .= '<img src="' . $sitepath . '' . $obj->image1 . '"  alt="' . $obj->title . '" />';
             }
             if (JFile::exists(JPATH_SITE . DS . $obj->image2)) {
                 $html .= '</a>';
             }
             $html .= '</li>';
             $cont++;
         }
     }
     $html .= '</ul>';
     return $html;
 }
Exemplo n.º 4
0
 function action($articleid, $fieldsid, $fieldsvalueid)
 {
     $path = $this->params->get("path");
     $file = "field_" . $fieldsid . "_upload";
     $documentpath = $this->params->get("documentpath");
     if (empty($documentpath)) {
         /*$sitepath = JURI::base() ;
           $pos = strrpos($sitepath, "administrator");
           if(!empty($pos)){$sitepath  = JURI::base().'..'.DS;}*/
         $sitepath = fieldsattachHelper::getabsoluteURL();
         $this->params->set("path", $sitepath . 'images' . DS . 'documents');
         //$documentpath=  JPATH_INSTALLATION.DS.'..'.DS.'images'.DS.'documents';
         $documentpath = JPATH_BASE . DS . 'images' . DS . 'documents';
     }
     plgfieldsattachment_file::deleteFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath);
     plgfieldsattachment_file::uploadFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath);
 }
Exemplo n.º 5
0
 static function getHTML($articleid, $fieldsid, $category = false, $write = false)
 {
     global $globalreturn;
     //$str  = fieldattach::getFileDownload($articleid, $fieldsid, $category );
     //GET Extras ***************************
     $fieldsids = $fieldsid;
     $extras = fieldattach::getExtra($fieldsid);
     $html = "";
     if (!empty($extras)) {
         if (count($extras) > 0) {
             $selectable = $extras[0];
         }
     }
     //GET Values ***************************
     if (method_exists('fieldattach', 'getFieldValues')) {
         $jsonValues = fieldattach::getFieldValues($articleid, $fieldsid, $category);
         $jsonValuesArray = json_decode($jsonValues);
         $valor = $jsonValuesArray->value;
         $title = $jsonValuesArray->title;
         $published = $jsonValuesArray->published;
         $showTitle = $jsonValuesArray->showtitle;
     } else {
         $valor = fieldattach::getValue($articleid, $fieldsids, $category);
         $title = fieldattach::getName($articleid, $fieldsids);
         $published = plgfieldsattachment_file::getPublished($fieldsid);
         $showTitle = fieldattach::getShowTitle($fieldid);
     }
     $directorio = "documents";
     $tmpfile = explode("|", $valor);
     $file = $tmpfile[0];
     $titlefile = JText::_("DOWNLOAD");
     if (count($tmpfile) > 1) {
         $titlefile = $tmpfile[1];
     }
     if ($category) {
         $directorio = 'documentscategories';
     }
     //Build url link
     if ($selectable == "selectable") {
         $file_absolute = fieldsattachHelper::getabsoluteURL() . $file;
     } else {
         $file_absolute = 'images/' . $directorio . '/' . $articleid . '/' . $file;
     }
     if (!empty($valor) && $published) {
         //$title = fieldattach::getName($articleid, $fieldsid, $category);
         $html = plgfieldsattachment_file::getTemplate($fieldsid, "file");
         /*
                         Templating Laouyt *****************************
             [TITLE] - Title of field
                         [FIELD_ID] - Field id 
                         [VALUE] - Value of input
                         [ARTICLE_ID] - Article id
         */
         if ($showTitle) {
             $html = str_replace("[TITLE]", $title, $html);
         } else {
             $html = str_replace("[TITLE]", "", $html);
         }
         $html = str_replace("[FIELD_ID]", $fieldsid, $html);
         $html = str_replace("[ARTICLE_ID]", $articleid, $html);
         $html = str_replace("[TITLE_FILE]", $titlefile, $html);
         $html = str_replace("[URL]", $file_absolute, $html);
         if ($selectable == "selectable") {
         } else {
             if (!JFile::exists(JPATH_SITE . DS . "images" . DS . $directorio . DS . $articleid . DS . $file)) {
                 $html = "";
             }
         }
         /*$html .= '<div class="download">';
           if($selectable=="selectable"){
               if(fieldattach::getShowTitle(   $fieldsids  ))  $html .= '<span class="title">'.$title.' </span>';
               $html .=  '<a href="'.$file_absolute.'"   alt="'.$titlefile.'" class="downloads" target="_blank" />'.$titlefile.'</a>';
             
           }else{
               if (JFile::exists( JPATH_SITE .DS."images".DS.$directorio.DS. $articleid .DS. $file)  )
               {
                   if(fieldattach::getShowTitle(   $fieldsids  ))  $html .= '<span class="title">'.$title.' </span>';
                       $html .=  '<a href="'.$file_absolute.'"   alt="'.$titlefile.'" class="downloads" target="_blank" />'.$titlefile.'</a>';
               }
           }
           $html .= '</div>';*/
     }
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }
Exemplo n.º 6
0
 /**
  * Get a inputs of content
  *
  * @access	public
  * @since	1.5
  */
 function getinputfields($id, $fields, $backend, $fontend, $backendcategory, $exist_options, &$body = null, &$str = null, &$str_options = null)
 {
     $str = '';
     $this->exist = false;
     $this->exist_options = false;
     //Menu tabulador
     $menuTabstr = '';
     if (count($fields) > 0) {
         $sitepath = fieldsattachHelper::getabsoluteURL();
         // if(JRequest::getVar("view")=="fieldsattachunidad") $str = '<script src="'.$sitepath.'plugins/system/fieldsattachment/js/fieldattachment.js" type="text/javascript"></script> ';
         if ($backend || $fontend) {
             $str = '<script src="' . $sitepath . 'plugins/system/fieldsattachment/js/fieldattachment.js" type="text/javascript"></script> ';
             //$str_options = '<script src="'.$sitepath.'plugins/system/fieldsattachment/js/fieldattachment.js" type="text/javascript"></script> ';
         }
         $idgroup = "";
         //TABS RENDER AFTER DESCRIPTION ====================================================================
         if (count($fields) > 0) {
             $this->exist = false;
             foreach ($fields as $field) {
                 if ($field->idgroup != $idgroup) {
                     $menuTabstr .= '<li class="addtab"><a href="#fiedlsattachTab_' . $field->idgroup . '" data-toggle="tab" >' . $field->titlegroup . '</a></li>';
                     $this->exist = true;
                     $idgroup = $field->idgroup;
                 }
             }
             if (!$this->exist) {
                 //after $str = "" <-- LOOK because
                 //$str  .="";
             }
         }
         //INPUTS ================================================
         $this->exist = false;
         //inputs RENDER ====================================================================
         $idgroup = -1;
         $this->exist = false;
         $cont = -1;
         $cuantos_en_str = 0;
         $field->position = 1;
         if (count($fields) > 0) {
             foreach ($fields as $field) {
                 //if($field->position == 1){
                 $cont++;
                 if ($field->idgroup != $idgroup) {
                     if ($idgroup > 0) {
                         if ($this->exist == true) {
                             $str .= '</div> ';
                         }
                     }
                     $this->exist = true;
                     $cuantos_en_str++;
                     $str .= '<div class="tab-pane" id="fiedlsattachTab_' . $field->idgroup . '"  >';
                     if (!empty($field->descriptiongroup)) {
                         $str .= '<div class="desc">' . $field->descriptiongroup . '</div>';
                     }
                 }
                 $idgroup = $field->idgroup;
                 //NEW GET PLUGIN ********************************************************************
                 JPluginHelper::importPlugin('fieldsattachment');
                 // very important
                 //select
                 //$this->array_fields = $this->params->get( 'array_fields' );
                 if (empty($this->array_fields)) {
                     $this->array_fields = fieldsattachHelper::get_extensions();
                 }
                 if (count($this->array_fields) > 0) {
                     foreach ($this->array_fields as $obj) {
                         $function = "plgfieldsattachment_" . $obj . "::construct();";
                         //$base = JPATH_BASE;
                         //$base = str_replace("/administrator", "", $base);
                         $base = JPATH_SITE;
                         $file = $base . '/plugins/fieldsattachment/' . $obj . '/' . $obj . '.php';
                         if (JFile::exists($file)) {
                             //file exist
                             eval($function);
                             $function = 'plgfieldsattachment_' . $obj . "::getName();";
                             eval("\$plugin_name =" . $function . "");
                             //$str .= $field->type." == ".$plugin_name."<br />";
                             eval($function);
                             JError::raiseNotice(500, "sssssdsf");
                             if ($field->type == $plugin_name) {
                                 if ($backendcategory) {
                                     $value = JRequest::getVar("field_" . $field->id, fieldsattachHelper::getfieldsvalueCategories($field->id, $id), 'post', 'string', JREQUEST_ALLOWHTML);
                                     JError::raiseNotice(500, "sssssdsf");
                                     //$value = JRequest::getVar("field_".$field->id, $this->getfieldsvalueCategories(  $field->id, $id));
                                 } else {
                                     // $value = JRequest::getVar("field_".$field->id,fieldsattachHelper::getfieldsvalue(  $field->id, $id), 'post', 'string', JREQUEST_ALLOWHTML);
                                     $value = "";
                                     if (isset($_POST["field_" . $field->id])) {
                                         $value = $_POST["field_" . $field->id];
                                     } else {
                                         $value = fieldsattachHelper::getfieldsvalue($field->id, $id);
                                     }
                                     //$value = JRequest::getVar("field_".$field->id, $this->getfieldsvalue(  $field->id, $id));
                                 }
                                 $value = addslashes($value);
                                 //SESSION VALUE
                                 $session = JFactory::getSession();
                                 $value_session = $session->get("field_" . $field->id);
                                 if (!empty($value_session) && empty($value)) {
                                     $value = $value_session;
                                 }
                                 //DELETE SESSION VALUE
                                 $session->clear("field_" . $field->id);
                                 $function = 'plgfieldsattachment_' . $obj . '::renderInput(' . $id . ',' . $field->id . ',"' . $value . '","' . $field->extras . '");';
                                 //$function  =  "plgfieldsattachment_".$obj."::renderInput(".$id.",".$field->id.",'".$value."','".$field->extras."');";
                                 eval("\$tmp=" . $function . "");
                                 $str .= '<div class="control-group"><label class="control-label" for="field_' . $field->id . '">' . $field->title;
                                 if ($field->required) {
                                     $str .= '  </label><span>(*)</span>';
                                 }
                                 $str .= '<div class="controls">' . $tmp . '</div>';
                                 $str .= '</div>';
                                 //Reset field of category description =====================
                                 // fieldsattachHelper::resetToDescription($id, $field->id, &$body);
                                 $this->resetToDescription($id, $field->id);
                             }
                         }
                     }
                 }
                 //$str .= '</div>';
                 //END inputs RENDER =========================================================
             }
             //END INPUT ============================================
         }
     }
     $this->menuTabstr = $menuTabstr;
     $this->str = $str;
 }
Exemplo n.º 7
0
 /**
  * Get a inputs of content
  *
  * @access	public
  * @since	1.5
  */
 function getinputfields($id, $fields, $backend, $fontend, $backendcategory, $exist_options, &$body = null, &$str = null, &$str_options = null)
 {
     $str = '';
     $this->exist = false;
     $this->exist_options = false;
     if (count($fields) > 0) {
         $sitepath = fieldsattachHelper::getabsoluteURL();
         // if(JRequest::getVar("view")=="fieldsattachunidad") $str = '<script src="'.$sitepath.'plugins/system/fieldsattachment/js/fieldattachment.js" type="text/javascript"></script> ';
         if ($backend || $fontend) {
             $str = '<script src="' . $sitepath . 'plugins/system/fieldsattachment/js/fieldattachment.js" type="text/javascript"></script> ';
             $str_options = '<script src="' . $sitepath . 'plugins/system/fieldsattachment/js/fieldattachment.js" type="text/javascript"></script> ';
         }
         if ($backend) {
             $str .= '<script src="' . $sitepath . 'plugins/system/fieldsattachment/js/TabPane.js" type="text/javascript"></script> ';
             $str .= "<script  type='text/javascript'> document.addEvent('domready', function() {\n                    var tabPane = new TabPane('demo');\n                    });</script>";
             $str .= '<div id="demo"><ul class="tabs">';
         } else {
         }
         $idgroup = "";
         //TABS RENDER AFTER DESCRIPTION ====================================================================
         if (count($fields) > 0) {
             $this->exist = false;
             foreach ($fields as $field) {
                 if ($field->idgroup != $idgroup) {
                     if ($backend) {
                         if ($field->position == 1) {
                             $str .= '<li class="tab">' . $field->titlegroup . '</li>';
                             $this->exist = true;
                         }
                     }
                     $idgroup = $field->idgroup;
                 }
             }
             if (!$this->exist) {
                 //after $str = "" <-- LOOK because
                 $str .= "";
             }
         }
         if ($backend) {
             if (!empty($str)) {
                 $str .= '</ul><div class="fieldscontent"> ';
             }
         }
         //inputs RENDER ====================================================================
         $idgroup = -1;
         $this->exist = false;
         $cont = -1;
         $cuantos_en_str = 0;
         if (count($fields) > 0) {
             foreach ($fields as $field) {
                 //if($field->position == 1){
                 $cont++;
                 if ($field->idgroup != $idgroup) {
                     if ($idgroup > 0) {
                         if ($backend) {
                             if ($field->position == 1) {
                                 if ($this->exist == true) {
                                     $str .= '</div> ';
                                 }
                             } else {
                                 if ($this->exist_options) {
                                     $str_options .= '</ul></fieldset></div></div> ';
                                 }
                             }
                         } else {
                             $str .= '</div></fieldset>';
                         }
                     }
                     if ($backend) {
                         if ($field->position == 1) {
                             $this->exist = true;
                             $cuantos_en_str++;
                             $str .= '<div id="' . $fields[0]->titlegroup . '-' . $field->idgroup . '" class="content"  >';
                             if (!empty($field->descriptiongroup)) {
                                 $str .= '<div class="desc">' . $field->descriptiongroup . '</div>';
                             }
                         } else {
                             $this->exist_options = true;
                             $str_options .= '<div class="panel fieldsattach">
                                         <h3 class="pane-toggler title" id="meta-fieldsattach' . $field->id . '">
                                         <a href="javascript:void(0);"><span>' . $field->titlegroup . '</span>
                                         </a></h3><div class="pane-slider content">';
                             if (!empty($field->descriptiongroup)) {
                                 $str_options .= '<div class="desc">' . $field->descriptiongroup . '</div>';
                             }
                             $str_options .= '<fieldset class="panelform"><ul class="adminformlist">';
                         }
                     } else {
                         $str .= '<fieldset id="group_' . $field->id . '" class="group"><legend>' . $field->titlegroup . '</legend>';
                         $str .= '<div class="formelm-area">';
                         if (!empty($field->descriptiongroup)) {
                             $str .= '<div class="desc">' . $field->descriptiongroup . '</div>';
                         }
                     }
                 }
                 $idgroup = $field->idgroup;
                 if ($backend) {
                     if ($field->position == 1) {
                         $str .= '<div id="fields_' . $field->id . '" class="fields">';
                     }
                 }
                 if ($backend) {
                     if ($field->position == 1) {
                         $str .= '<div style="width:100%; margin:  5px 0  5px 0px; padding:3px  0  3px 5px; color:#165a8f; overflow:hidden;background-color:#eee;  border:#dcdcdc solid 1px;">
                                     <label for="field_' . $field->id . '" style=" font-weight:bold; font-size:14px;">';
                     }
                 } else {
                     $str .= '<h3 class="frontendtitle" id="meta-fieldsattach' . $field->id . '">';
                 }
                 if ($field->position == 1 || $fontend) {
                     $str .= $field->title . "";
                 }
                 if ($backend) {
                     if ($field->position == 1) {
                         $str .= '</label>';
                         if ($field->required) {
                             $str .= '  <span style="color:#f00;font-size:0.9em;">(* Required)</span>';
                         }
                         $str .= '</div>';
                     }
                 } else {
                     if ($field->required) {
                         $str .= '  <span class="star">&#160;*</span>';
                     }
                     $str .= '</h3>';
                 }
                 //NEW GET PLUGIN ********************************************************************
                 JPluginHelper::importPlugin('fieldsattachment');
                 // very important
                 //select
                 //$this->array_fields = $this->params->get( 'array_fields' );
                 if (empty($this->array_fields)) {
                     $this->array_fields = fieldsattachHelper::get_extensions();
                 }
                 if (count($this->array_fields) > 0) {
                     foreach ($this->array_fields as $obj) {
                         $function = "plgfieldsattachment_" . $obj . "::construct();";
                         //$base = JPATH_BASE;
                         //$base = str_replace("/administrator", "", $base);
                         $base = JPATH_SITE;
                         $file = $base . '/plugins/fieldsattachment/' . $obj . '/' . $obj . '.php';
                         if (JFile::exists($file)) {
                             //file exist
                             eval($function);
                             $function = 'plgfieldsattachment_' . $obj . "::getName();";
                             eval("\$plugin_name =" . $function . "");
                             //$str .= $field->type." == ".$plugin_name."<br />";
                             eval($function);
                             if ($field->type == $plugin_name) {
                                 if ($backendcategory) {
                                     $value = JRequest::getVar("field_" . $field->id, fieldsattachHelper::getfieldsvalueCategories($field->id, $id), 'post', 'string', JREQUEST_ALLOWHTML);
                                     //$value = JRequest::getVar("field_".$field->id, $this->getfieldsvalueCategories(  $field->id, $id));
                                 } else {
                                     // $value = JRequest::getVar("field_".$field->id,fieldsattachHelper::getfieldsvalue(  $field->id, $id), 'post', 'string', JREQUEST_ALLOWHTML);
                                     $value = "";
                                     if (isset($_POST["field_" . $field->id])) {
                                         $value = $_POST["field_" . $field->id];
                                     } else {
                                         $value = fieldsattachHelper::getfieldsvalue($field->id, $id);
                                     }
                                     //$value = JRequest::getVar("field_".$field->id, $this->getfieldsvalue(  $field->id, $id));
                                 }
                                 $value = addslashes($value);
                                 //SESSION VALUE
                                 $session = JFactory::getSession();
                                 $value_session = $session->get("field_" . $field->id);
                                 if (!empty($value_session) && empty($value)) {
                                     $value = $value_session;
                                 }
                                 //DELETE SESSION VALUE
                                 $session->clear("field_" . $field->id);
                                 $function = 'plgfieldsattachment_' . $obj . '::renderInput(' . $id . ',' . $field->id . ',"' . $value . '","' . $field->extras . '");';
                                 //$function  =  "plgfieldsattachment_".$obj."::renderInput(".$id.",".$field->id.",'".$value."','".$field->extras."');";
                                 if ($field->position == 1 || $fontend) {
                                     $str .= '<div id="col' . $field->id . '" class="col" style=" width:100%; overflow:hidden" >';
                                     eval("\$str .=" . $function . "");
                                     $str .= '</div>';
                                     //echo "AAAAAAAAAAAAAAAAAA:".$field->id;
                                     //Reset field of category description =====================
                                     //fieldsattachHelper::resetToDescription($id, $field->id, &$body);
                                     $this->resetToDescription($id, $field->id);
                                 } else {
                                     eval("\$tmp=" . $function . "");
                                     $str_options .= '<li><label>' . $field->title . '</label>' . $tmp . '</li>';
                                     //Reset field of category description =====================
                                     // fieldsattachHelper::resetToDescription($id, $field->id, &$body);
                                     $this->resetToDescription($id, $field->id);
                                 }
                             }
                         }
                     }
                 }
                 if ($backend) {
                     if ($field->position == 1) {
                         $str .= '</div>';
                     }
                 }
                 //END inputs RENDER =========================================================
             }
         }
         if ($backend) {
             if (!empty($str)) {
                 $str .= '</div>';
             }
             if (!empty($str_options)) {
                 $str_options .= '</ul></fieldset></div></div> ';
             }
         } else {
             $str .= '</div></fieldset>';
         }
         if ($backend) {
             if (!empty($str)) {
                 $str .= '</div>';
                 $str .= '</div>';
             }
         }
     } else {
         $str = "";
     }
     //echo $str;
     //return $str;
     $this->str = $str;
     $this->str_options = $str_options;
 }
Exemplo n.º 8
0
        function getGallery1($articleid, $fieldsattachid)
        {
            // Load the tooltip behavior. 


        $db = JFactory::getDbo();
        $directory = "administrator/";
        if ( JFactory::getApplication()->isAdmin()) {
             $directory = "";
        }

        $query = $db->getQuery(true);
         // Select some fields
		$query->select('*');

		// From the hello table
		$query->from('#__fieldsattach_images');
        $query->where("articleid = ".$articleid." AND fieldsattachid=".$fieldsattachid);

        $query->order("ordering");
 
               // $db = JFactory::getDbo();

		 $db->setQuery($query);
		 //$str = $query;
		 $rows= $db->loadObjectList();
		 	$str = '<div style="position:relative; float:left; top:-50px;"><a class=\'modal\' rel=\'{handler: "iframe", size: {x: 980, y: 500}}\' href=\''.JURI::base(false).'/'.$directory.'index.php?option=com_fieldsattach&view=fieldsattachimage&layout=edit&tmpl=component&reset=2\'></a>
 			';
            $str .= "<a href='#' onclick='update_gallery".$fieldsattachid."();return false;'><img src='".JURI::base(false)."/".$directory."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&fieldsattachid=".$fieldsattachid."'><img src='components/com_fieldsattach/images/icon-32-new.png' alt='refresh' /></a>";
			$str .= '</div>';
         

             $str .= "<ul style='overflow:hidden;'>";
             $sitepath  =  fieldsattachHelper::getabsoluteURL(); 
             if($rows>0){
               foreach ($rows as $row)
                {
                  //$url_edit ='index.php?option=com_fieldsattach&amp;task=fieldsattachimage.edit&amp;id='.$row->id.'&amp;tmpl=component&amp;reset=2&amp;fieldsattachid='.$fieldsattachid.'&amp;direct=true';
				  $url_edit =JURI::base(false).'/index.php?option=com_fieldsattach&view=fieldsattachimage&tmpl=component&layout=edit&id='.$row->id.'&fieldsattachid='.$fieldsattachid.'&reset=2';
				  $url_delete =JURI::base(false).'/index.php?option=com_fieldsattach&amp;view=fieldsattachimages&amp;task=delete&amp;id='.$row->id.'&amp;tmpl=component&amp;fieldsid='.$fieldsattachid;
                  $str.= '<li style="width:150px; height:150px; margin: 0px 10px 10px 0; overflow:hidden; float:left; border:1px solid #ddd;">
                  <div style="overflow:hidden;margin-bottom:8px;"><div style="width:32px;float:left;"> <a class="modal" href="'.$sitepath.''.$row->image1.'"><img src="'.JURI::base(false).$directory.'components/com_fieldsattach/images/icon-zoom.png" alt="zoom" /></a>
                  </div>
                  <div style="width:32px;float:right;"><a class="modal" href="'.$url_delete.'" rel="{handler: \'iframe\', size: {x: 980, y: 500}}"><img src="'.JURI::base(false).$directory.'/components/com_fieldsattach/images/icon-32-delete.png" alt="zoom" /></a>
                  </div></div>
               	  <div><a class="modal"  href="'.$url_edit.'" rel="{handler: \'iframe\', size: {x: 980, y: 500}}" ><img src="'.$sitepath.''.$row->image1.'" alt="'.$row->title.'" width="150" /></a>
                  </div>
                  </li>';

                }
             }
			$str .= "<li style='width:80px; background:url(".JURI::base(false)."/".$directory."components/com_fieldsattach/images/icon-32-new.png) no-repeat 50px 40px; height:10px; margin: 0px 10px 10px 0; overflow:hidden; float:left; border:1px solid #ddd;padding:80px 20px 60px 35px;'>
			<a class='modal' rel='{handler: \"iframe\", size: {x: 980, y: 500}}' href='".JURI::base(false)."index.php?option=com_fieldsattach&view=fieldsattachimage&layout=edit&tmpl=component&reset=2&fieldsattachid=".$fieldsattachid."'>";
			$str .= JText::_("NEW IMAGE").'</a></li>';
		
            $str .= "</ul>";
            
             return $str;
        }
Exemplo n.º 9
0
 function action($articleid, $fieldsid, $fieldsvalueid)
 {
     $path = $this->params->get("path");
     $documentpath = $this->params->get("documentpath");
     if (empty($documentpath)) {
         $sitepath = fieldsattachHelper::getabsoluteURL();
         $this->params->set("path", $sitepath . 'images' . DS . 'documents');
         //$documentpath=  JPATH_INSTALLATION.DS.'..'.DS.'images'.DS.'documents';
         $documentpath = JPATH_BASE . DS . 'images' . DS . 'documents';
     }
     //Categories ============================================================================
     if (JRequest::getVar('option') == 'com_categories' && JRequest::getVar('layout') == "edit") {
         //$documentpath=  JPATH_INSTALLATION.DS.'..'.DS.'images'.DS.'documentscategories';
         $documentpath = JPATH_BASE . DS . 'images' . DS . 'documentscategories';
     }
     $file = "field_" . $fieldsid . "_upload";
     fieldsattachHelper::deleteFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath);
     $nombreficherofinal = fieldsattachHelper::uploadFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath);
     $width = 0;
     $height = 0;
     $filter = "";
     $selectable = "";
     $nombrefichero = "";
     if (!empty($nombreficherofinal)) {
         $db = JFactory::getDbo();
         $query = 'SELECT a.extras FROM #__fieldsattach as a WHERE a.id=' . $fieldsid . '';
         $db->setQuery($query);
         $results = $db->loadObject();
         $tmp = "";
         //JError::raiseWarning( 100, $obj->type." --- ". $query   );
         if (!empty($results)) {
             $tmp = $results->extras;
             //JError::raiseWarning( 100,  " --- ". $results->extras   );
         }
         //$str .= "<br> resultado1: ".$tmp;
         $lineas = explode(chr(13), $tmp);
         //$str .= "<br> resultado2: ".$lineas[0];
         $str .= '<div>';
         foreach ($lineas as $linea) {
             $tmp = explode('|', $linea);
             $width = $tmp[0];
             $height = $tmp[1];
             $filter = $tmp[2];
             $selectable = $tmp[3];
             //echo $width.'ssX'.$height.'<br>';
             $nombrefichero = $_FILES[$file]["name"];
         }
         // $app = JFactory::getApplication();
         // $app->enqueueMessage(  "---width:".$width  );
         fieldsattachHelper::resize($nombreficherofinal, $nombreficherofinal, $width, $height, $articleid, $documentpath, $filter);
     }
 }
Exemplo n.º 10
0
    static function renderInput($articleid, $fieldsid, $value, $extras = null)
    {
        $required = "";
        global $sitepath;
        JLoader::register('fieldattach', $sitepath . DS . 'components/com_fieldsattach/helpers/fieldattach.php');
        $boolrequired = fieldattach::isRequired($fieldsid);
        if ($boolrequired) {
            $required = "required";
        }
        $str = "";
        //Add CSS ***********************
        $str .= '<link rel="stylesheet" href="' . JURI::root() . 'plugins/fieldsattachment/image/image.css" type="text/css" />';
        $app = JFactory::getApplication();
        $templateDir = JURI::base() . 'templates/' . $app->getTemplate();
        $css = JPATH_SITE . "/administrator/templates/" . $app->getTemplate() . "/html/com_fieldsattach/css/image.css";
        $pathcss = JURI::root() . "administrator/templates/" . $app->getTemplate() . "/html/com_fieldsattach/css/image.css";
        if (file_exists($css)) {
            $str .= '<link rel="stylesheet" href="' . $pathcss . '" type="text/css" />';
        }
        $file = $value;
        $selectable = "";
        $str .= '<div class="image" style="overflow:hidden;">';
        if (!empty($extras)) {
            $tmp = $extras;
            $lineas = explode(chr(13), $tmp);
            $str .= '
			<div class="alert alert-info">
				<button type="button" class="close" data-dismiss="alert">&times;</button>
			';
            foreach ($lineas as $linea) {
                $selectable = "";
                $filter = "";
                $height = "";
                $width = "";
                $tmp = explode('|', $linea);
                if (!empty($tmp[0])) {
                    $width = $tmp[0];
                }
                if (count($tmp) >= 1) {
                    if (!empty($tmp[1])) {
                        $height = $tmp[1];
                    }
                }
                if (count($tmp) >= 2) {
                    if (!empty($tmp[2]) && isset($tmp[2])) {
                        $filter = $tmp[2];
                    }
                }
                if (count($tmp) >= 3) {
                    if (!empty($tmp[3]) && isset($tmp[3])) {
                        $selectable = $tmp[3];
                    }
                }
                $str .= '<strong>Size: </strong>';
                $str .= !empty($width) ? $width : 'auto';
                $str .= ' x ';
                $str .= !empty($height) ? $height : 'auto';
                if (!empty($filter)) {
                    $str .= '<br /><strong>Filter: </strong> ' . $filter;
                }
                $str .= '<br /><strong>Type: </strong>';
                $str .= !empty($selectable) ? 'Joomla Image' : 'Upload Image';
            }
            $str .= '</div>';
        }
        //$path = $this->path1;
        $path = $sitepath . 'images' . DS . 'documents';
        $documentpath = JURI::root();
        $documentpath = $documentpath . DS . "images" . DS . "documents";
        $file_url = $documentpath . DS . $articleid . DS . $file;
        $file_absolute = JPATH_ROOT . DS . "images" . DS . "documents" . DS . $articleid . DS . $file;
        if (JRequest::getVar('option') == 'com_categories') {
            $file_url = str_replace("documents", "documentscategories", $file_url);
            $file_absolute = str_replace("documents", "documentscategories", $file_absolute);
        }
        if ($selectable == "selectable") {
            $file_url = fieldsattachHelper::getabsoluteURL() . $file;
        }
        if (file_exists($file_absolute) && !empty($file) || $selectable && !empty($file)) {
            //Name file
            $str .= '<p id="image1" class="thumbnail"><img src="' . $file_url . '"';
            if (!empty($width)) {
                $str .= ' width="' . $width . '" ';
            }
            if (!empty($height)) {
                $str .= ' height="' . $height . '" ';
            }
            $str .= ' alt=" "/></p>';
            //Delete
            $str .= '<p style="overflow:hidden;">';
            if ($selectable == "selectable") {
                $clear = '
				<button class="btn btn-danger" type="button" name="field_' . $fieldsid . '_delete1" onclick="javascript:$(\'field_' . $fieldsid . '\').value=\'\';$(\'image1\').style.opacity=\'0.4\';">
				' . JTEXT::_("Clear Image") . '
				</button>
				';
            } else {
                $str .= '<label class="checkbox" for="field_' . $fieldsid . '_delete">';
                $str .= '<input name="field_' . $fieldsid . '_delete" type="checkbox" /> ';
                $str .= '<strong>' . JTEXT::_("Delete current image on Save") . '</strong>';
                $str .= '</label>';
            }
            $str .= '</p>';
        } else {
            $value = "";
        }
        if ($selectable == "selectable") {
            $str .= '
			<div class="input-append">
				<input name="field_' . $fieldsid . '" id="field_' . $fieldsid . '" type="text" value="' . $value . '" class="' . $required . '" />
				<a class="modal modal-button btn btn-primary" title="Select Image" href="index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;asset=140&amp;author=&amp;fieldid=field_' . $fieldsid . '&amp;folder=" rel="{handler: \'iframe\', size: {x: 800, y: 500}}">Select Image</a>
			</div>
			';
        } else {
            $str .= " \n\t\t\t<script type='text/javascript'>\n\t\t\t\twindow.addEvent('domready', function() { \n\t\t\t\t\t//Add check evrent\n\t\t\t\t\t\$\$('#field_" . $fieldsid . "_upload').addEvent('change', function(e){ \n\t\t\t\t\t\tvar upload =\$(this).value; \n\t\t\t\t\t\tvar result = '';\n\t\t\t\t\t\tif(String(upload).length>0 ) { result = upload; }\n\t\t\t\t\t\t\$('field_" . $fieldsid . "').value= result;\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t</script>";
            $str .= '
			<input name="field_' . $fieldsid . '" id="field_' . $fieldsid . '" type="hidden" value="' . $value . '" class="customfields ' . $required . '" />
			&nbsp;
			<input name="field_' . $fieldsid . '_upload" id="field_' . $fieldsid . '_upload" type="file" class="customfields" />
			';
        }
        $str .= '</div>';
        $str .= '<script>function jInsertFieldValue(txt, field){ $(field).value= txt ;}</script>';
        return $str;
    }
Exemplo n.º 11
0
 function renderInput($articleid, $fieldsid, $value, $extras = null)
 {
     $required = "";
     global $sitepath;
     JLoader::register('fieldattach', $sitepath . DS . 'components/com_fieldsattach/helpers/fieldattach.php');
     $boolrequired = fieldattach::isRequired($fieldsid);
     if ($boolrequired) {
         $required = "required";
     }
     $str = "";
     //Add CSS ***********************
     $str .= '<link rel="stylesheet" href="' . JURI::root() . 'plugins/fieldsattachment/image/image.css" type="text/css" />';
     $app = JFactory::getApplication();
     $templateDir = JURI::base() . 'templates/' . $app->getTemplate();
     $css = JPATH_SITE . "/administrator/templates/" . $app->getTemplate() . "/html/com_fieldsattach/css/image.css";
     $pathcss = JURI::root() . "administrator/templates/" . $app->getTemplate() . "/html/com_fieldsattach/css/image.css";
     if (file_exists($css)) {
         $str .= '<link rel="stylesheet" href="' . $pathcss . '" type="text/css" />';
     }
     $file = $value;
     $selectable = "";
     $str .= '<div class="image" style="overflow:hidden;">';
     if (!empty($extras)) {
         //$lineas = explode('":"',  $field->params);
         //$tmp = substr($lineas[1], 0, strlen($lineas[1])-2);
         $tmp = $extras;
         $lineas = explode(chr(13), $tmp);
         //$str .= "<br> resultado2: ".$lineas[0];
         $str .= '<div class="config">';
         foreach ($lineas as $linea) {
             $str .= '<div class="file">';
             $selectable = "";
             $filter = "";
             $height = "";
             $width = "";
             $tmp = explode('|', $linea);
             if (!empty($tmp[0])) {
                 $width = $tmp[0];
             }
             if (count($tmp) >= 1) {
                 if (!empty($tmp[1])) {
                     $height = $tmp[1];
                 }
             }
             if (count($tmp) >= 2) {
                 if (!empty($tmp[2]) && isset($tmp[2])) {
                     $filter = $tmp[2];
                 }
             }
             if (count($tmp) >= 3) {
                 if (!empty($tmp[3]) && isset($tmp[3])) {
                     $selectable = $tmp[3];
                 }
             }
             if (!empty($width)) {
                 $str .= '<span>Size:</span> ' . $width;
             } else {
                 $str .= 'Size:-- ';
             }
             if (!empty($height)) {
                 $str .= 'X' . $height;
             } else {
                 $str .= 'X --';
             }
             if (!empty($filter)) {
                 $str .= '<br /><span>Filter:</span> ' . $filter;
             }
             if (!empty($selectable)) {
                 $str .= '<br /><span>Selectable:</span> True ';
             }
             $str .= '</div>';
         }
         $str .= '</div>';
     }
     $path = $this->path1;
     //$documentpath = $this->params->get( "documentpath" );
     $documentpath = JURI::root();
     $documentpath = $documentpath . DS . "images" . DS . "documents";
     $file_url = $documentpath . DS . $articleid . DS . $file;
     $file_absolute = JPATH_ROOT . DS . "images" . DS . "documents" . DS . $articleid . DS . $file;
     if (JRequest::getVar('option') == 'com_categories') {
         $file_url = str_replace("documents", "documentscategories", $file_url);
         $file_absolute = str_replace("documents", "documentscategories", $file_absolute);
     }
     if ($selectable == "selectable") {
         $file_url = fieldsattachHelper::getabsoluteURL() . $file;
     }
     if (file_exists($file_absolute) && !empty($file) || $selectable && !empty($file)) {
         //Name file
         $str .= '<div class="file"><img src="' . $file_url . '" ';
         if (!empty($width)) {
             $str .= ' width="' . $width . '" ';
         }
         if (!empty($height)) {
             $str .= ' height="' . $height . '" ';
         }
         $str .= ' alt=" "/></div>';
         //Delete
         $str .= '<div class="file"><div style="overflow:hidden;">';
         if ($selectable == "selectable") {
             $str .= '<label for="field_' . $fieldsid . '_delete1">';
             $str .= '<input name="field_' . $fieldsid . '_delete1" type="checkbox" onclick="javascript: $(\'field_' . $fieldsid . '\').value= \'\' ;"   />   ';
             $str .= JTEXT::_("Checkbox for delete image");
             $str .= '</label>';
         } else {
             $str .= '<label for="field_' . $fieldsid . '_delete">';
             $str .= '<input name="field_' . $fieldsid . '_delete" type="checkbox"   />    ';
             $str .= JTEXT::_("Checkbox for delete image");
             $str .= '</label>';
         }
         $str .= '</div></div> ';
     } else {
         $value = "";
     }
     if ($selectable == "selectable") {
         $str .= '<div class="file"><input name="field_' . $fieldsid . '" id="field_' . $fieldsid . '" type="text"  size="150" value="' . $value . '" class="' . $required . '" /></div> ';
         $str .= '<div class="file"><div class="button2-left">
                     <div class="blank">
                             <a class="modal modal-button btn" title="Select Image" href="index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;asset=140&amp;author=&amp;fieldid=field_' . $fieldsid . '&amp;folder=" rel="{handler: \'iframe\', size: {x: 800, y: 500}}">
                                     Select Image</a>
                     </div>
                     </div>   ';
         $str .= '</div> ';
     } else {
         $str .= " <script type='text/javascript'>\n                \n                    window.addEvent('domready', function() { \n\n                                //Add check evrent\n                                \$\$('#field_" . $fieldsid . "_upload').addEvent('change', function(e){ \n                                    var upload =\$(this).value; \n                                    var result = '';\n                                    if(String(upload).length>0 )\n                                    {\n                                        result = upload;\n                                    }\n\n                                    \$('field_" . $fieldsid . "').value= result;\n                                });\n  \n\n\n                        });</script>";
         $str .= '<div class="file"><input name="field_' . $fieldsid . '" id="field_' . $fieldsid . '" type="hidden"   value="' . $value . '" class="customfields ' . $required . '" /> ';
         $str .= '<input name="field_' . $fieldsid . '_upload" id="field_' . $fieldsid . '_upload" type="file" size="150" class="customfields" /></div>';
     }
     $str .= '</div><script>function jInsertFieldValue(txt, field){ $(field).value= txt ;}</script>';
     return $str;
 }