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; } }
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 = ""; $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; } }
<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, $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; } }
/** * Return a table HTML with a list of units * * @param $id id of article * $fieldsids id of field * * @return html of table * @since 1.6 */ public function getListUnits($articleid, $fieldsids, $category = false) { $str = '<div>'; $extrainfo = fieldattach::getExtra($fieldsids); $title = fieldattach::getName($articleid, $fieldsids, $category); if (fieldattach::getShowTitle($fieldsids)) { $str .= '<div class="title">' . $title . ' </div>'; } $str .= '<table><thead><tr>'; foreach ($extrainfo as $result) { $str .= '<th>' . $result . '</th>'; } $str .= '</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); $str .= '<tr>'; foreach ($extrainfo as $obj) { if (isset($jsonobj->{$obj})) { $str .= '<td>' . $jsonobj->{$obj} . '</td>'; } } $str .= '</tr>'; } $str .= '</table></div>'; return $str; }
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; } }
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; } }
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; } }