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; } }
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; } }
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; } }
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; } }
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; } }
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; } }
function getHTML($articleid, $fieldsid, $category = false, $write=false) { global $globalreturn; //$str = fieldattach::getVimeoVideo($articleid, $fieldsid, $category ); $extrainfo = fieldattach::getExtra($fieldsids); $width="300"; $height="300"; if((count($extrainfo) >= 1)&&(!empty($extrainfo[0]))) $width= $extrainfo[0]; if((count($extrainfo) >= 2)&&(!empty($extrainfo[1]))) $height= $extrainfo[1]; $code = fieldattach::getValue( $articleid, $fieldsid, $category); if(!empty($code)){ $html = '<div id="cel_'.$fieldsid.'" class="vimeo">'; $html .= '<iframe src="http://player.vimeo.com/video/'.$code.'" width="'.$width.'" height="'.$height.'" frameborder="0"></iframe>'; $html .= '</div>'; } //WRITE THE RESULT if($write) { echo $html; }else{ $globalreturn = $html; return $html; } }
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; } }
function getHTML($articleid, $fieldsid, $category = false, $write=false ) { global $globalreturn; $html = fieldattach::getInput($articleid, $fieldsid, $category); //WRITE THE RESULT if($write) { echo $html; }else{ $globalreturn = $html; return $html; } }
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"><div class="file label">Config</div>'; 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>'; } //$str .= $this->path .DS. $id.DS. $file; //$path = $this->params->get( "documentpath" ); $path = $this->params->get("path"); // $str .= "<br>PATH:: ".$path; //$file_absolute = $path .DS. $articleid .DS. $file; // $str .= "<br>PATH file_absolute:: ".$file_absolute; $file_url = $path . DS . $articleid . DS . $file; //$documentpath = $this->params->get( "documentpath" ); $documentpath = fieldsattachHelper::getabsolutePATH(); $documentpath = $documentpath . DS . "images" . DS . "documents"; //OJOOOOOOOOOOOOOOOOOOOOO //$file_url = $documentpath.DS. $articleid .DS. $file; if (JRequest::getVar('option') == 'com_categories' && JRequest::getVar('layout') == "edit") { $file_url = str_replace("documents", "documentscategories", $file_url); } $file_absolute = $documentpath . DS . $articleid . DS . $file; if ($selectable == "selectable") { $file_url = fieldsattachHelper::getabsoluteURL() . $file; } //echo "<br>FILE: ".$file_absolute; //$str .= "<br>".$file_absolute." -> ". file_exists( '/media/Iomega_HDD/trabajos/dalmau/web3/images/documents/60/1003_LLEida1.jpg' ) ; // echo "<br>EXIST FILE: ".file_exists( $file_absolute ); 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 .= JTEXT::_("Checkbox for delete file"); $str .= '</label>'; $str .= '<input name="field_' . $fieldsid . '_delete1" type="checkbox" onclick="javascript: $(\'field_' . $fieldsid . '\').value= \'\' ;" />'; } else { $str .= '<label for="field_' . $fieldsid . '_delete">'; $str .= JTEXT::_("Checkbox for delete file"); $str .= '</label>'; $str .= '<input name="field_' . $fieldsid . '_delete" type="checkbox" />'; } $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" title="Select Image" href="index.php?option=com_media&view=images&tmpl=component&asset=140&author=&fieldid=field_' . $fieldsid . '&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; }
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; } }
function getQuerySorted($text, $phrase = '', $order = '', $areas = null, $categories = null, $fieldsfilter = null, $limit = 50, $tmpfieldid = "", $valuefieldid = "", $tmplistids = "", $rules = "", $fieldOrderid = "") { // echo "RRRULE: ".$rules; $rulesrray = explode(",", $rules); //echo "FIFIFIF:".$fieldsfilter."<br>"; $db = JFactory::getDbo(); $app = JFactory::getApplication(); $query = $db->getQuery(true); $tag = JFactory::getLanguage()->getTag(); $whereextra = ''; $arrayfieldsid = explode(",", $fieldsfilter); //First get a fieldsattach rows $fieldsrows = array(); foreach ($arrayfieldsid as $fieldsid) { $tmp1 = explode("_", $fieldsid); $tmpfieldid = $tmp1[0]; $tmp2 = plgAdvancedsearchfieldsattachment::getNameField($tmpfieldid); //echo "<br>-->".$tmp2; $fieldsrows[] = $this->toAscii($tmp2); } $str_query = ""; //Select global $str_query = 'SELECT id, title AS title, metadesc, metakey, created AS created, catid, publish_up , '; $str_query .= ' text, introtext, section, '; $str_query .= 'slug, '; $str_query .= 'catslug '; //Fieldsattach rows //echo "<br>". implode(",", $fieldsrows)."<br>"; //$build = ','. implode(",", $fieldsrows). ' '; $tmpcont = 0; $strtmp = ''; foreach ($fieldsrows as $fieldtitle) { $strtmp .= ', tmp_' . $fieldtitle; $tmpcont++; } $str_query .= $strtmp; $str_query .= ' FROM ( '; //Select global $str_query .= 'SELECT id, title AS title, metadesc, metakey, created AS created, catid, publish_up , '; $str_query .= ' text, introtext, section, '; $str_query .= 'slug, '; $str_query .= 'catslug '; //$tmp_query .=',d.fieldsid,d.value '; //Fieldsattach rows //echo "<br>". implode(",", $fieldsrows)."<br>"; //$build = ','. implode(",", $fieldsrows). ' '; $tmpcont = 0; $strtmp = ''; foreach ($fieldsrows as $fieldtitle) { $strtmp .= ', max(tmp_' . $fieldtitle . ') as tmp_' . $fieldtitle . ' '; $tmpcont++; } $str_query .= $strtmp; $str_query .= ' FROM ( '; //END select global if (count($fieldsfilter) > 0 && empty($tmplistids)) { $whereextra = ""; $cont_field = 0; //$arrayfieldsid = $fieldsfilter; $conttotal = 0; foreach ($arrayfieldsid as $fieldsid) { $tmp_query = 'SELECT a.id, a.title AS title, a.metadesc, a.metakey, a.created AS created, a.catid, a.publish_up , '; $tmp_query .= 'CONCAT(a.introtext, a.fulltext) AS text, a.introtext, c.title AS section, '; $tmp_query .= 'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug, '; $tmp_query .= 'CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as catslug '; //$tmp_query .=',d.fieldsid,d.value '; //Fieldsattach rows //echo "<br>". implode(",", $fieldsrows)."<br>"; //$build = ','. implode(",", $fieldsrows). ' '; $tmpcont = 0; $strtmp = ''; foreach ($fieldsrows as $fieldtitle) { if ($conttotal == $tmpcont) { $strtmp .= ', d.value as tmp_' . $fieldtitle . ' '; } else { $strtmp .= ', "" as tmp_' . $fieldtitle . ' '; } $tmpcont++; } $tmp_query .= $strtmp; //TABLES $tmp_query .= 'FROM #__content AS a '; $tmp_query .= 'INNER JOIN #__categories AS c ON c.id=a.catid '; $tmp_query .= 'INNER JOIN #__fieldsattach_values AS d ON d.articleid=a.id '; $tmp_query .= 'INNER JOIN #__fieldsattach AS e ON d.fieldsid=e.id '; //CONDITIONS $searchword = JRequest::getVar("searchword"); $where_fieldattach = ""; //echo "".$phrase; if ($phrase == "any") { $cont = 0; $tmp = explode(" ", $searchword); //echo "count:".count($tmp). " -- ".($tmp[0]); if (count($tmp) > 0) { if (!empty($tmp[0])) { $where_fieldattach = " ("; foreach ($tmp as $obj) { $obj = $db->Quote('%' . $db->getEscaped($obj, true) . '%', false); $where = "(d.value LIKE " . $obj . ' OR ' . "a.title LIKE " . $obj . ' OR ' . "a.introtext LIKE " . $obj . ")"; $where_fieldattach .= $where; if (count($tmp) > $cont + 1) { $where_fieldattach .= ' AND '; } $cont++; } $where_fieldattach .= " )"; } } } else { $text = $db->Quote('%' . $db->getEscaped($searchword, true) . '%', false); $where_fieldattach = "(d.value LIKE " . $text . ' OR ' . "a.title LIKE " . $text . ' OR ' . "a.introtext LIKE " . $text . ")"; } //Extra fields $tmp1 = explode("_", $fieldsid); $tmpfieldid = $tmp1[0]; $valuefieldid = ""; if (count($tmp1) > 1) { $valuefieldid = $tmp1[1]; } //echo "<br>BBB1:: ".$valuefieldid."<br>"; $valuefieldid = plgAdvancedsearchfieldsattachment::getValue($tmpfieldid, $valuefieldid); //echo "<br>BBB2:: ".$valuefieldid."<br>"; //$where .= " ( d.fieldsid = ". $fieldsid. ' AND d.value LIKE '.$text .')'; //$whereextra = ''; //echo "<br />AAA".count($arrayfieldsid).">".($cont_field)." VALUE::---".empty($valuefieldid); //if(!empty($tmpfieldid) && !empty( $tmp1[1])){ /*if(!empty($tmpfieldid) && !empty($valuefieldid)) {*/ //LIKE /* if($rulesrray[$cont_field]=="LIKE"){ //echo "<br>Ssssad sdasd1:::: ".$tmpfieldid." --- ".$valuefieldid." END<br>"; $valuefieldidtmp = $db->Quote('%'.$valuefieldid.'%', false); //echo "<br>Ssssad sdasd2:::: ".$tmpfieldid." --- ".$valuefieldid." END<br>"; $whereextra .= " ( d.fieldsid = ". $tmpfieldid. ""; if(!empty($valuefieldid)) $whereextra .= " AND d.value LIKE ".$valuefieldidtmp ; $whereextra .= " ) "; //echo "<br>Ssssad sdasd3:::: ".$whereextra." END<br>"; } //echo "<br>RULE sdasd3:::: ".$rulesrray[$cont_field]." cont:".$cont_field." END<br>"; //EQUAL if($rulesrray[$cont_field]=="EQUAL"){ $valuefieldidtmp = $db->Quote($db->getEscaped($valuefieldid, true), false); $whereextra .= " ( d.fieldsid = ". $tmpfieldid. ""; if(!empty($valuefieldid)) $whereextra .= " AND d.value = ".$valuefieldidtmp ; $whereextra .= " ) "; } //NOT EQUAL if($rulesrray[$cont_field]=="NOTEQUAL"){ $valuefieldidtmp = $db->Quote($db->getEscaped($valuefieldid, true), false); $whereextra .= " ( d.fieldsid = ". $tmpfieldid. ""; if(!empty($valuefieldid)) $whereextra .= "AND d.value != ".$valuefieldidtmp ; $whereextra .= " ) "; } //HIGHER if($rulesrray[$cont_field]=="HIGHER"){ $valuefieldidtmp = $db->Quote($db->getEscaped($valuefieldid, true), false); $whereextra .= " ( d.fieldsid = ". $tmpfieldid. ""; if(!empty($valuefieldid)) $whereextra .= "AND d.value > ".$valuefieldidtmp .")"; $whereextra .= " ) "; } //LOWER if($rulesrray[$cont_field]=="LOWER"){ $valuefieldidtmp = $db->Quote($db->getEscaped($valuefieldid, true), false); $whereextra .= " ( d.fieldsid = ". $tmpfieldid. ""; if(!empty($valuefieldid)) $whereextra .= " AND d.value < ".$valuefieldidtmp .")"; $whereextra .= " ) "; } //BETWEEN if($rulesrray[$cont_field]=="BETWEEN"){ $tmp = explode("|", $valuefieldid ); $valuefieldid_1 = $tmp[0]; $valuefieldid_2=""; if(count($tmp)>1) $valuefieldid_2 = $tmp[1]; if(!empty($valuefieldid_1) && !empty($valuefieldid_2)){ //Transform mydsql format $type = plgAdvancedsearchfieldsattachment::getType($tmpfieldid); if($type == "date") { $valuefieldid_1 = strtotime( $valuefieldid_1 ); $valuefieldid_1 = date("Y-m-d",$valuefieldid_1); $valuefieldid_2 = strtotime( $valuefieldid_2 ); $valuefieldid_2 = date("Y-m-d",$valuefieldid_2); } $valuefieldid_1 = $db->Quote($db->getEscaped($valuefieldid_1, true), false); $valuefieldid_2 = $db->Quote($db->getEscaped($valuefieldid_2, true), false); $whereextra .= " (d.fieldsid = ". $tmpfieldid. " AND d.value BETWEEN ".$valuefieldid_1 ." AND ".$valuefieldid_2 .") "; } } */ //echo "<br>SISISIS<br>".$whereextra."<br>"; //} $whereextra = " ( d.fieldsid = " . $tmpfieldid . ")"; $cont_field++; if (!empty($where_fieldattach)) { $where_fieldattach .= " AND "; } if (!empty($whereextra)) { $whereextra .= " AND "; } // $query->where( $whereextra. $where_fieldattach .' a.state=1 AND c.published = 1 AND a.access IN ('.$groups.') '); $tmp_query .= ' WHERE ' . $whereextra . ' ' . $where_fieldattach . ' a.state=1 '; // Filter by language if ($app->isSite() && $app->getLanguageFilter()) { $tmp_query .= ' AND a.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ') '; $tmp_query .= ' AND c.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ') '; } $tmpcat = explode(",", $categories); //Remove , $tmpcat = trim($tmpcat, ','); if (!empty($categories)) { $tmp_query .= ' AND c.id in (' . $categories . ')'; } if (!empty($tmplistids)) { $tmp_query .= ' AND a.id in (' . $tmplistids . ')'; } if (!empty($fieldOrderid) && is_numeric($fieldOrderid) && count($fieldsfilter) > 0) { $tmp_query .= ' AND d.fieldsid = ' . $fieldOrderid; } //$tmp_query .= ' ORDER BY ' . $order; $str_query .= $tmp_query . " "; if (count($arrayfieldsid) - 1 > $conttotal) { $str_query .= " UNION "; } $conttotal++; } //For } // $str_query .= ' ) as T'; //WHERE FULL $tmpcont = 0; $first = true; $whereextra = ""; foreach ($fieldsrows as $fieldtitle) { $fieldsid = $arrayfieldsid[$tmpcont]; $tmp1 = explode("_", $fieldsid); $tmpfieldid = $tmp1[0]; $valuefieldid = ""; if (count($tmp1) > 1) { $valuefieldid = $tmp1[1]; } //echo "<br>BBB1:: ".$valuefieldid."<br>"; $valuefieldid = plgAdvancedsearchfieldsattachment::getValue($tmpfieldid, $valuefieldid); //echo "<br>RULE:: ".$rulesrray[$cont_field]." LLL:".$tmpcont."<br>"; $tmpwhere = ''; $tmpand = ''; //Remove space $valuefieldid = trim($valuefieldid); if (!empty($valuefieldid)) { $tmpand .= ' AND '; } //LIKE if ($rulesrray[$tmpcont] == "LIKE") { $type = plgAdvancedsearchfieldsattachment::getType($tmpfieldid); switch ($type) { case "selecttree": $this->SelectTreeChild($valuefieldid); $valuefieldid = $valuefieldid . $this->tmp; //$valuefieldidtmp = $db->Quote(''.$valuefieldid.'', false); if (!empty($valuefieldid)) { $tmpwhere = ' tmp_' . $fieldtitle . ' in (' . $valuefieldid . ')'; } break; case "select": //AND VALUE $valorselects = fieldattach::getValueSelect($tmpfieldid, $valuefieldid); $valuefieldidtmp = $db->Quote('%' . $valuefieldid . '%', false); if (!empty($valuefieldid) && !empty($valuefieldid)) { $tmpwhere = ' tmp_' . $fieldtitle . ' LIKE ' . $valuefieldidtmp; } break; default: //echo "<br>Ssssad sdasd1:::: ".$tmpfieldid." --- ".$valuefieldid." END<br>"; $valuefieldidtmp = $db->Quote('%' . $valuefieldid . '%', false); if (!empty($valuefieldid) && !empty($valuefieldid)) { $tmpwhere = ' tmp_' . $fieldtitle . ' LIKE ' . $valuefieldidtmp; } } //echo "<br>Ssssad sdasd3:::: ".$whereextra." END<br>"; } //EQUAL if ($rulesrray[$tmpcont] == "EQUAL") { $valuefieldidtmp = $db->Quote($valuefieldid, false); if (!empty($valuefieldid)) { $tmpwhere = ' tmp_' . $fieldtitle . ' = ' . $valuefieldidtmp; } } //NOT EQUAL if ($rulesrray[$tmpcont] == "NOTEQUAL") { $valuefieldidtmp = $db->Quote($db->getEscaped($valuefieldid, true), false); if (!empty($valuefieldid)) { $tmpwhere = 'tmp_' . $fieldtitle . '!= ' . $valuefieldidtmp; } } //HIGHER if ($rulesrray[$tmpcont] == "HIGHER") { $valuefieldidtmp = $db->Quote($db->getEscaped($valuefieldid, true), false); if (!empty($valuefieldid)) { $tmpwhere = ' tmp_' . $fieldtitle . ' > ' . $valuefieldidtmp; } } //LOWER if ($rulesrray[$tmpcont] == "LOWER") { $valuefieldidtmp = $db->Quote($db->getEscaped($valuefieldid, true), false); if (!empty($valuefieldid)) { $tmpwhere = ' tmp_' . $fieldtitle . ' < ' . $valuefieldidtmp; } } //BETWEEN if ($rulesrray[$tmpcont] == "BETWEEN") { $tmp = explode("|", $valuefieldid); $valuefieldid_1 = $tmp[0]; $valuefieldid_2 = ""; if (count($tmp) > 1) { $valuefieldid_2 = $tmp[1]; } if (!empty($valuefieldid_1) && !empty($valuefieldid_2)) { //Transform mydsql format $type = plgAdvancedsearchfieldsattachment::getType($tmpfieldid); if ($type == "date") { $valuefieldid_1 = strtotime($valuefieldid_1); $valuefieldid_1 = date("Y-m-d", $valuefieldid_1); $valuefieldid_2 = strtotime($valuefieldid_2); $valuefieldid_2 = date("Y-m-d", $valuefieldid_2); } //$valuefieldid_1 = $db->Quote($db->getEscaped($valuefieldid_1, true), false); //$valuefieldid_2 = $db->Quote($db->getEscaped($valuefieldid_2, true), false); $tmpwhere = ' ( tmp_' . $fieldtitle . ' BETWEEN ' . $valuefieldid_1 . ' AND ' . $valuefieldid_2 . ') '; } } //$strtmp .= ' tmp_'.$fieldtitle.' tmp_'.$fieldtitle.' '; if (!empty($whereextra)) { $whereextra .= $tmpand; } $whereextra .= $tmpwhere; $tmpcont++; } $str_query .= ' GROUP BY id'; $str_query .= ') as W'; if (!empty($whereextra)) { $str_query .= " WHERE " . $whereextra; } $str_query .= ' ORDER BY ' . $order; //$query->group('a.id'); //echo $str_query; return $str_query; }
function getHTML($articleid, $fieldsid, $category = false, $write = false) { global $globalreturn; //$str = fieldattach::getYoutubeVideo($articleid, $fieldsid, $category ); $extrainfo = fieldattach::getExtra($fieldsid); $width = "300"; $height = "300"; $html = ""; if (count($extrainfo) >= 1 && !empty($extrainfo[0])) { $width = $extrainfo[0]; } if (count($extrainfo) >= 2 && !empty($extrainfo[1])) { $height = $extrainfo[1]; } $code = fieldattach::getValue($articleid, $fieldsid, $category); if (!empty($code)) { $html .= '<div id="cel_' . $fieldsid . '" class="youtube">'; $html .= '<object width="' . $width . '" height="' . $height . '"> <param name="movie" value="http://www.youtube.com/v/' . $code . '&hl=en_US&fs=1&"></param> <param name="allowFullScreen" value="true"></param> <param name="wmode" value="transparent"></param> <param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/' . $code . '&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode = "transparent" width="' . $width . '" height="' . $height . '"> </embed> </object> '; $html .= '</div>'; } //WRITE THE RESULT if ($write) { echo $html; } else { $globalreturn = $html; return $html; } }
/** * 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; }
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; } }
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; } }
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; } }
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) { 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; } }
<img src="<?php echo $this->baseurl; ?> /templates/system/images/calendar.png" alt="Calendar" class="calendar" id="field_<?php echo $val[0]; ?> _2_img"> <?php } ?> <?php //DATE ************************ if ($type == "date") { $format = "%Y-%m-%d"; $extrainfo = fieldattach::getExtra($val[0]); if (count($extrainfo) > 0) { if (!empty($extrainfo[0])) { $format = $extrainfo[0]; } } $value = $val1; JHTML::_('calendar', $value, 'field_' . $val[0] . '_1', 'field_' . $val[0] . '_1', $format, array('class' => 'customfields inputbox ', 'size' => '25', 'maxlength' => '19')); $value = $val2; JHTML::_('calendar', $value, 'field_' . $val[0] . '_2', 'field_' . $val[0] . '_2', $format, array('class' => 'customfields inputbox ', 'size' => '25', 'maxlength' => '19')); ?> <script> window.addEvent('domready', function() { Calendar.setup({ // Id of the input field inputField: "field_<?php
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(""", '"', $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; } }
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; } }
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; } }
JHtml::_('behavior.formvalidation'); //$params = $this->form->getFieldsets('params'); $sitepath = JPATH_SITE; JLoader::register('fieldattach', $sitepath . DS . 'components/com_fieldsattach/helpers/fieldattach.php'); $session =& JFactory::getSession(); $articleid = $session->get('articleid'); $catid = $session->get('catid'); $direct = JRequest::getVar('direct', false); //echo "session :: ".$session->get('catid'); //echo "articleid:: ".$session->get('articleid'); $fieldsattachid_tmp = JRequest::getVar('fieldsattachid', ''); $fieldsattachid = $session->get('fieldsattachid'); if (!empty($fieldsattachid_tmp)) { $fieldsattachid = $fieldsattachid_tmp; } $extrainfo = fieldattach::getExtra($fieldsattachid); $galleryimage2 = "0"; $galleryimage3 = "0"; $gallerydescription = "0"; if (count($extrainfo) >= 1 && !empty($extrainfo[0])) { $galleryimage2 = $extrainfo[0]; } if (count($extrainfo) >= 2 && !empty($extrainfo[1])) { $galleryimage3 = $extrainfo[1]; } if (count($extrainfo) >= 3 && !empty($extrainfo[2])) { $gallerydescription = $extrainfo[2]; } //defino una sesion y guardo datos //session_start(); setcookie('loginin', "true", time() + 3600, '/');
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; } }