Example #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);
     $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;
     }
 }
Example #2
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_select::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_select::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;
     }
 }