Exemple #1
0
 static function getHTML($articleid, $fieldsid, $category = false, $write = false)
 {
     global $globalreturn;
     //$str  = fieldattach::getSelect($articleid, $fieldsid);
     //$valor = fieldattach::getValue( $articleid,  $fieldsid, $category  );
     //$title = fieldattach::getName( $articleid,  $fieldsid , $category );
     //$published = plgfieldsattachment_select::getPublished( $fieldsid  );
     if (method_exists('fieldattach', 'getFieldValues')) {
         $jsonValues = fieldattach::getFieldValues($articleid, $fieldsid, $category);
         $jsonValuesArray = json_decode($jsonValues);
         $valor = html_entity_decode($jsonValuesArray->value);
         $title = $jsonValuesArray->title;
         $published = $jsonValuesArray->published;
         $showTitle = $jsonValuesArray->showtitle;
     } else {
         $valor = fieldattach::getValue($articleid, $fieldsid, $category);
         $title = fieldattach::getName($articleid, $fieldsid, $category);
         $published = plgfieldsattachment_checkbox::getPublished($fieldsid);
         $showTitle = fieldattach::getShowTitle($fieldid);
     }
     $html = "";
     if (!empty($valor) && $published) {
         //$isNull= plgfieldsattachment_select::isNull( $fieldsid , $valor, $category );
         $valorselects = fieldattach::getValueSelect($fieldsid, $valor);
         //echo "<br />ISNULL:".$isNull."---<br/>";
         //if(!$isNull){
         if (!empty($valorselects)) {
             $html = plgfieldsattachment_checkbox::getTemplate($fieldsid, "select");
             /*
                                     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("[VALUE]", stripslashes($valorselects), $html);
             $html = str_replace("[FIELD_ID]", $fieldsid, $html);
             $html = str_replace("[ARTICLE_ID]", $articleid, $html);
         } else {
             $html = "";
         }
     }
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }
Exemple #2
0
 static function getHTML($articleid, $fieldsid, $category = false, $write = false)
 {
     global $globalreturn;
     if (method_exists('fieldattach', 'getFieldValues')) {
         $jsonValues = fieldattach::getFieldValues($articleid, $fieldsid, $category);
         $jsonValuesArray = json_decode($jsonValues);
         if (count($jsonValuesArray) > 0) {
             $valor = html_entity_decode($jsonValuesArray->value);
             $title = $jsonValuesArray->title;
             $published = $jsonValuesArray->published;
             $showTitle = $jsonValuesArray->showtitle;
         }
     } else {
         $valor = fieldattach::getValue($articleid, $fieldsid, $category);
         $title = fieldattach::getName($articleid, $fieldsid, $category);
         $published = plgfieldsattachment_textarea::getPublished($fieldsid);
         $showTitle = fieldattach::getShowTitle($fieldsid);
     }
     $html = "";
     if (!empty($valor) && $published) {
         $html = plgfieldsattachment_textarea::getTemplate($fieldsid, "textarea");
         /*
                         Templating INPUT *****************************
             [TITLE] - Title of field
                         [FIELD_ID] - Field id 
                         [VALUE] - Value of input
         */
         if ($showTitle) {
             $html = str_replace("[TITLE]", $title, $html);
         } else {
             $html = str_replace("[TITLE]", "", $html);
         }
         $html = str_replace("[VALUE]", $valor, $html);
         $html = str_replace("[FIELD_ID]", $fieldsid, $html);
         $html = str_replace("[ARTICLE_ID]", $articleid, $html);
     }
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }
Exemple #3
0
 function getHTML($articleid, $fieldsid, $category = true, $write = false)
 {
     global $globalreturn;
     $db =& JFactory::getDBO();
     $query = 'SELECT positionarticle FROM #__fieldsattach WHERE id = ' . $fieldsid;
     $db->setQuery($query);
     $category = $db->loadResult();
     $valor = fieldattach::getValue($articleid, $fieldsid, $category);
     $title = fieldattach::getName($articleid, $fieldsid, $category);
     $html = "";
     $published = plgfieldsattachment_textarea::getPublished($fieldsid);
     if (!empty($valor) && $published) {
         $html = plgfieldsattachment_textarea::getTemplate($fieldsid);
         /*
                             Templating INPUT *****************************
             [TITLE] - Title of field
                             [FIELD_ID] - Field id 
                             [VALUE] - Value of input
         */
         if (fieldattach::getShowTitle($fieldsid)) {
             $html = str_replace("[TITLE]", $title, $html);
         } else {
             $html = str_replace("[TITLE]", "", $html);
         }
         $html = str_replace("[VALUE]", $valor, $html);
         $html = str_replace("[FIELD_ID]", $fieldsid, $html);
         $html = str_replace("[ARTICLE_ID]", $articleid, $html);
     }
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }
Exemple #4
0
 function getHTML($articleid, $fieldid, $category = false, $write = false)
 {
     global $globalreturn;
     $html = "";
     $extrainfo = fieldattach::getExtra($fieldid);
     $format = $extrainfo[0];
     if (empty($format)) {
         $format = "%Y-%m-%d";
     }
     $valor = fieldattach::getValue($articleid, $fieldid, $category);
     if (!empty($valor)) {
         $html = '<div class="field_' . $fieldid . '" >';
         if (fieldattach::getShowTitle($fieldid)) {
             $html .= '<span class="title">' . fieldattach::getName($articleid, $fieldid, $category) . '<span> ';
         }
         $valor = str_replace("/", "-", $valor);
         $date = new JDate($valor);
         //$str .= '<span class="date">'.$date->toFormat( $format ).'</span>';
         $html .= '<span class="date">' . $date->toFormat($format) . '</span>';
         $html .= '</div>';
     }
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }
 function getHTML($articleid, $fieldsid, $category = false, $write = false)
 {
     $valores = fieldattach::getValue($articleid, $fieldsid);
     $title = fieldattach::getName($articleid, $fieldsid);
     $extras = fieldattach::getExtra($fieldsid);
     $db =& JFactory::getDBO();
     $query = 'SELECT a.extras FROM #__fieldsattach as a  WHERE a.id = ' . $fieldsid;
     $db->setQuery($query);
     $extras = $db->loadResult();
     $str = '<div>';
     if (fieldattach::getShowTitle($fieldsid)) {
         $str .= '<span class="title">' . $title . ' </span>';
     }
     //$str .= "<br> resultado1: ".$extras;
     $lineas = array();
     //echo count($extras);
     $lineas = explode(chr(13), $extras);
     //$str .= "<br> resultado2: ".$lineas[0];
     // echo $extras."<br />---- ".$extras."-----<br /><br />";
     /* foreach ($lineas as $linea)
        { 
                   echo "<br />---- ".$linea."-----<br /><br />";
               }*/
     foreach ($lineas as $linea) {
         global $globalreturn;
         $tmp = explode('|', $linea);
         $arrays = explode(",", $valores);
         $title = $tmp[0];
         $valor = "";
         if (count($tmp) > 1) {
             $valor = $tmp[1];
         }
         foreach ($arrays as $obj) {
             if (!empty($obj)) {
                 if (trim($obj) == trim($valor)) {
                     if (!empty($title)) {
                         $str .= $title . "<br />";
                     }
                 }
             }
         }
     }
     $str .= ' </div>';
     //WRITE THE RESULT
     if ($write) {
         echo $str;
     } else {
         $globalreturn = $str;
         return $str;
     }
 }
Exemple #6
0
 /**
  * get a LINK
  *
  * @param	$articleid	 id of article
  *              $fieldsids  id of field 
  *              $category if category
  *
  * @return	value to link.
  * @since	1.6
  */
 function getLink($articleid, $fieldid)
 {
     $html = '';
     $valor = fieldattach::getValue($articleid, $fieldid);
     $title = fieldattach::getName($articleid, $fieldid);
     $tmp = explode('|', $valor);
     $url = $tmp[0];
     if (count($tmp) > 1) {
         if (!empty($tmp[1])) {
             $text = $tmp[1];
         } else {
             $text = $url;
         }
     } else {
         $text = $url;
     }
     if (!empty($url)) {
         $pos = strrpos($url, "http://");
         if ($pos === false) {
             // note: three equal signs
             $valorhtml = '<a href="' . $url . '" >';
         } else {
             $valorhtml = '<a href="' . $url . '" target="_blank">';
         }
         $valorhtml .= $text . '</a>';
         $html .= '<div id="cel_' . $fieldid . '" class="link">';
         if (fieldattach::getShowTitle($fieldid)) {
             $html .= '<span class="title">' . $title . ' </span>';
         }
         $html .= '<span class="value">' . $valorhtml . '</span></div>';
     }
     return $html;
 }
Exemple #7
0
 function getHTML($articleid, $fieldsid, $category = false, $write = false)
 {
     global $globalreturn;
     //$str  = fieldattach::getFileDownload($articleid, $fieldsid, $category );
     //GET Extras ***************************
     $fieldsids = $fieldsid;
     $extras = fieldattach::getExtra($fieldsids);
     $html = "";
     if (!empty($extras)) {
         if (count($extras) > 0) {
             $selectable = $extras[0];
         }
     }
     //GET Values ***************************
     $valor = fieldattach::getValue($articleid, $fieldsids, $category);
     $title = fieldattach::getName($articleid, $fieldsids);
     $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)) {
         $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;
     }
 }
Exemple #8
0
 function getHTML($articleid, $fieldid, $category = false, $write = false)
 {
     global $globalreturn;
     $html = '';
     $valorhtml = "";
     $valor = fieldattach::getValue($articleid, $fieldid);
     $title = fieldattach::getName($articleid, $fieldid);
     $published = plgfieldsattachment_contactrelated::getPublished($fieldid);
     /*
     
                     Templating IMAGEGLLERY *****************************
       [URL] - Link to article
     
                     [TITLE] - title 
     
                     [TEXT] - text 
     
                     [ARTICLE_ID] - id article 
     
                     [FIELD_ID] - Fieldsid
     */
     if (!empty($valor) && $published) {
         $listids = explode(",", $valor);
         $html = plgfieldsattachment_contactrelated::getTemplate($fieldid);
         $line = plgfieldsattachment_contactrelated::getLineTemplate($fieldid);
         $lines = "";
         foreach ($listids as $id) {
             $obj = plgfieldsattachment_contactrelated::getArticle($id);
             $title_article = $obj->title;
             $text = $obj->introtext;
             $slug = $obj->id . ":" . $obj->alias;
             $catid = $obj->catid;
             $url = "";
             $url = JRoute::_(ContentHelperRoute::getArticleRoute($slug, $catid));
             $tmp = $line;
             $tmp = str_replace("[URL]", $url, $tmp);
             $tmp = str_replace("[TITLE]", $title_article, $tmp);
             $tmp = str_replace("[TEXT]", $text, $tmp);
             $tmp = str_replace("[ARTICLE_ID]", $articleid, $tmp);
             $tmp = str_replace("[FIELD_ID]", $fieldid, $tmp);
             $lines .= $tmp;
         }
         if (fieldattach::getShowTitle($fieldid)) {
             $html = str_replace("[TITLE]", $title, $html);
         } else {
             $html = str_replace("[TITLE]", "", $html);
         }
         $html = str_replace("[ARTICLE_ID]", $articleid, $html);
         $html = str_replace("[FIELD_ID]", $fieldid, $html);
         $html = str_replace("[LINES]", $lines, $html);
     }
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }
Exemple #9
0
        function getHTML($articleid, $fieldid, $category = false, $write=false)
        { 
            global $globalreturn;
          //$str = fieldattach::getInput($articleid, $fieldid, $category); 
          $html ='';
          $valor = fieldattach::getValue( $articleid,  $fieldid , $category   );
          $title = fieldattach::getName( $articleid,  $fieldid , $category  );

          if(!empty($valor))
          {
              $html = $valor;
          }
            
           //WRITE THE RESULT
           if($write)
           {
                echo $html;
           }else{
                $globalreturn = $html;
                return $html; 
           }
        }
Exemple #10
0
 function getHTML($articleid, $fieldid, $category = false, $write = false)
 {
     global $globalreturn;
     //$str = fieldattach::getListUnits($articleid, $fieldid, $category);
     //return $str;
     $fieldsids = $fieldid;
     $html = '<div>';
     $extrainfo = fieldattach::getExtra($fieldsids);
     $title = fieldattach::getName($articleid, $fieldsids, $category);
     if (fieldattach::getShowTitle($fieldsids)) {
         $html .= '<div class="title">' . $title . ' </div>';
     }
     $html .= '<table><thead><tr>';
     foreach ($extrainfo as $result) {
         $html .= '<th>' . $result . '</th>';
     }
     $html .= '</tr></thead>';
     $valor = fieldattach::getValue($articleid, $fieldsids, $category);
     $valor = str_replace("&quot;", '"', $valor);
     $json = explode("},", $valor);
     $i = 0;
     foreach ($json as $linea) {
         //$linea =  substr($linea, 0 , strlen($linea)-1);
         $linea = str_replace("},", "", $linea);
         $linea = str_replace("}", "", $linea);
         $linea = $linea . '}';
         // $jsonobj = json_decode('{"Modelo":"asd","Largo_mts":"sdafsfas","Acción":"dfasdf","Tramos":"","Plegado":"","ø_Base":"","Peso_g":"","Cajas":"","CÓDIGO":""}');
         $jsonobj = json_decode($linea);
         $html .= '<tr>';
         foreach ($extrainfo as $obj) {
             if (isset($jsonobj->{$obj})) {
                 $html .= '<td>' . $jsonobj->{$obj} . '</td>';
             }
         }
         $html .= '</tr>';
     }
     $html .= '</table></div>';
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }
Exemple #11
0
 function getHTML($articleid, $fieldsid, $category = false, $write = false)
 {
     global $globalreturn;
     //$str  = fieldattach::getSelect($articleid, $fieldsid);
     $valor = fieldattach::getValue($articleid, $fieldsid, $category);
     $title = fieldattach::getName($articleid, $fieldsid, $category);
     $published = plgfieldsattachment_select::getPublished($fieldsid);
     $html = "";
     if (!empty($valor) && $published) {
         $isNull = plgfieldsattachment_select::isNull($fieldsid, $valor, $category);
         //echo "<br />ISNULL:".$isNull."---<br/>";
         if (!$isNull) {
             $valorselects = fieldattach::getValueSelect($fieldsid, $valor);
             $html = plgfieldsattachment_select::getTemplate($fieldsid);
             /*
                                         Templating Laouyt *****************************
                 [TITLE] - Title of field
                                         [FIELD_ID] - Field id 
                                         [VALUE] - Value of input
                                         [ARTICLE_ID] - Article id
             */
             if (fieldattach::getShowTitle($fieldsid)) {
                 $html = str_replace("[TITLE]", $title, $html);
             } else {
                 $html = str_replace("[TITLE]", "", $html);
             }
             $html = str_replace("[VALUE]", stripslashes($valorselects), $html);
             $html = str_replace("[FIELD_ID]", $fieldsid, $html);
             $html = str_replace("[ARTICLE_ID]", $articleid, $html);
         } else {
             $html = "";
         }
     }
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }
Exemple #12
0
 function getHTML($articleid, $fieldid, $category = false, $write = false)
 {
     global $globalreturn;
     //$str = fieldattach::getInput($articleid, $fieldid, $category);
     $html = '';
     $valor = fieldattach::getValue($articleid, $fieldid, $category);
     $title = fieldattach::getName($articleid, $fieldid, $category);
     if (!empty($valor)) {
         $html .= '<div id="cel_' . $fieldid . '" class=" ">';
         if (fieldattach::getShowTitle($fieldid)) {
             $html .= '<span class="title">' . $title . ' </span>';
         }
         $html .= '<span class="value">' . $valor . '</span></div>';
     }
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }
Exemple #13
0
 function getHTML($articleid, $fieldid, $category = false, $write = false)
 {
     global $globalreturn;
     $html = '';
     $valor = fieldattach::getValue($articleid, $fieldid);
     $title = fieldattach::getName($articleid, $fieldid);
     $tmp = explode('|', $valor);
     $url = $tmp[0];
     if (count($tmp) > 1) {
         if (!empty($tmp[1])) {
             $text = $tmp[1];
         } else {
             $text = $url;
         }
     } else {
         $text = $url;
     }
     $target = -1;
     if (count($tmp) > 2) {
         $target = $tmp[2];
     }
     if (!empty($url)) {
         $pos = strrpos($url, "http://");
         //AUTOOO
         if ($pos === false) {
             // note: three equal signs
             $valorhtml = '<a href="' . $url . '" >';
         } else {
             $valorhtml = '<a href="' . $url . '" target="_blank">';
         }
         //SAME WINDOW
         if ($target == 1) {
             $valorhtml = '<a href="' . $url . '" >';
         }
         //NEW WINDOW
         if ($target == 2) {
             $valorhtml = '<a href="' . $url . '" target="_blank">';
         }
         $valorhtml .= $text . '</a>';
         $html .= '<div id="cel_' . $fieldid . '" class="link">';
         if (fieldattach::getShowTitle($fieldid)) {
             $html .= '<span class="title">' . $title . ' </span>';
         }
         $html .= '<span class="value">' . $valorhtml . '</span></div>';
     }
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }
Exemple #14
0
 static function getHTML($articleid, $fieldsid, $category = false, $write = false)
 {
     // $str  ='<div id="cel_'.$articleid.'" class="field_'.$fieldsid.'">'.fieldattach::getImg($articleid, $fieldsid,"", $category).'</div>';
     $html = '';
     global $globalreturn;
     $directorio = 'documents';
     //Categories ============================================================================
     if ($category) {
         $directorio = 'documentscategories';
     }
     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, $fieldsid, $category);
         $title = fieldattach::getName($articleid, $fieldsid, $category);
         $published = plgfieldsattachment_select::getPublished($fieldsid);
         $showTitle = fieldattach::getShowTitle($fieldid);
     }
     /*
                 $db = JFactory::getDBO(  );
     	    	$query = 'SELECT  a.value  FROM #__fieldsattach_values as a INNER JOIN #__fieldsattach as b ON  b.id = a.fieldsid  WHERE a.fieldsid IN ('.$fieldsid.') AND (b.language="'. JRequest::getVar("language", "*").'" OR b.language="*") AND a.articleid= '.$articleid;
                 
     
                 if($category) {
                     $query = 'SELECT  a.value  FROM #__fieldsattach_categories_values as a INNER JOIN #__fieldsattach as b ON  b.id = a.fieldsid  WHERE a.fieldsid IN ('.$fieldsid.') AND (b.language="'. JRequest::getVar("language", "*").'" OR b.language="*") AND a.catid= '.$articleid;
                     $directorio = 'documentscategories' ;
     
                 }
     
                 $db->setQuery( $query );
     $result = $db->loadResult();
     */
     $file = "";
     //$published = plgfieldsattachment_image::getPublished( $fieldsid  );
     if (!empty($valor) && $published) {
         $file = $valor;
         if (JFile::exists(JPATH_ROOT . DS . "images" . DS . $directorio . DS . $articleid . DS . $file)) {
             // $html .=  '<img src="images/'.$directorio.'/'.$articleid.'/'.$result.'" title = "'.$title.'" alt="'.$title.'" />' ;
             $html = plgfieldsattachment_image::getTemplate($fieldsid, "image");
             $url = 'images/' . $directorio . '/' . $articleid . '/' . $valor;
         } else {
             if (JFile::exists(JPATH_ROOT . DS . $valor)) {
                 //$html .=  '<img src="'.$result.'" title = "'.$title.'" alt="'.$title.'" />' ;
                 $html = plgfieldsattachment_image::getTemplate($fieldsid, "image");
                 $url = $valor;
             }
         }
         /*
                         Templating replace *****************************
         [URL] - Url of image
                         [FIELD_ID] - Field id 
                         [ARTICLE_ID] - Article id
                         [TITLE] - Title of field
         */
         if ($showTitle) {
             $html = str_replace("[TITLE]", $title, $html);
         } else {
             $html = str_replace("[TITLE]", "", $html);
         }
         $html = str_replace("[URL]", $url, $html);
         $html = str_replace("[FIELD_ID]", $fieldsid, $html);
         $html = str_replace("[ARTICLE_ID]", $articleid, $html);
     }
     //$html .= '</div>';
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }
Exemple #15
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;
     }
 }
Exemple #16
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;
     }
 }
Exemple #17
0
 function getHTML($articleid, $fieldsid, $category = false, $write = false)
 {
     global $globalreturn;
     //$str  = fieldattach::getSelect($articleid, $fieldsid);
     $valor = fieldattach::getValue($articleid, $fieldsid, $category);
     $title = fieldattach::getName($articleid, $fieldsid, $category);
     $html = "";
     if (!empty($valor)) {
         $isNull = plgfieldsattachment_select::isNull($fieldsid, $valor, $category);
         //echo "<br />ISNULL:".$isNull."---<br/>";
         if (!$isNull) {
             $valorselects = fieldattach::getValueSelect($fieldsid, $valor);
             $html .= '<div id="cel_' . $fieldsid . '" class=" ">';
             if (fieldattach::getShowTitle($fieldsid)) {
                 $html .= '<span class="title">' . $title . ' </span>';
             }
             $html .= '<span class="value">' . $valorselects . '</span></div>';
         } else {
             $html = "";
         }
     }
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }
Exemple #18
0
 function getHTML($articleid, $fieldid, $category = false, $write = false)
 {
     global $globalreturn;
     $html = ' ';
     $valor = fieldattach::getValue($articleid, $fieldid, $category);
     if (!empty($valor)) {
         $html = '<div class="field_' . $fieldid . '">' . fieldattach::getName($articleid, $fieldid, $category) . '</div>';
     }
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }