Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 3
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.º 4
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;
     }
 }