Beispiel #1
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;
     }
 }
Beispiel #2
0
 public function searchinput($fieldsid, $value, $extras)
 {
     return plgfieldsattachment_select::renderInput(-1, $fieldsid, $value, $extras);
 }
Beispiel #3
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;
     }
 }
Beispiel #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;
     }
 }