/** * Get a inputs of content * * @access public * @since 1.5 */ function getinputfields($id, $fields, $backend, $fontend, $backendcategory, $exist_options, &$body = null, &$str = null, &$str_options = null) { $str = ''; $this->exist = false; $this->exist_options = false; //Menu tabulador $menuTabstr = ''; if (count($fields) > 0) { $sitepath = fieldsattachHelper::getabsoluteURL(); // if(JRequest::getVar("view")=="fieldsattachunidad") $str = '<script src="'.$sitepath.'plugins/system/fieldsattachment/js/fieldattachment.js" type="text/javascript"></script> '; if ($backend || $fontend) { $str = '<script src="' . $sitepath . 'plugins/system/fieldsattachment/js/fieldattachment.js" type="text/javascript"></script> '; //$str_options = '<script src="'.$sitepath.'plugins/system/fieldsattachment/js/fieldattachment.js" type="text/javascript"></script> '; } $idgroup = ""; //TABS RENDER AFTER DESCRIPTION ==================================================================== if (count($fields) > 0) { $this->exist = false; foreach ($fields as $field) { if ($field->idgroup != $idgroup) { $menuTabstr .= '<li class="addtab"><a href="#fiedlsattachTab_' . $field->idgroup . '" data-toggle="tab" >' . $field->titlegroup . '</a></li>'; $this->exist = true; $idgroup = $field->idgroup; } } if (!$this->exist) { //after $str = "" <-- LOOK because //$str .=""; } } //INPUTS ================================================ $this->exist = false; //inputs RENDER ==================================================================== $idgroup = -1; $this->exist = false; $cont = -1; $cuantos_en_str = 0; $field->position = 1; if (count($fields) > 0) { foreach ($fields as $field) { //if($field->position == 1){ $cont++; if ($field->idgroup != $idgroup) { if ($idgroup > 0) { if ($this->exist == true) { $str .= '</div> '; } } $this->exist = true; $cuantos_en_str++; $str .= '<div class="tab-pane" id="fiedlsattachTab_' . $field->idgroup . '" >'; if (!empty($field->descriptiongroup)) { $str .= '<div class="desc">' . $field->descriptiongroup . '</div>'; } } $idgroup = $field->idgroup; //NEW GET PLUGIN ******************************************************************** JPluginHelper::importPlugin('fieldsattachment'); // very important //select //$this->array_fields = $this->params->get( 'array_fields' ); if (empty($this->array_fields)) { $this->array_fields = fieldsattachHelper::get_extensions(); } if (count($this->array_fields) > 0) { foreach ($this->array_fields as $obj) { $function = "plgfieldsattachment_" . $obj . "::construct();"; //$base = JPATH_BASE; //$base = str_replace("/administrator", "", $base); $base = JPATH_SITE; $file = $base . '/plugins/fieldsattachment/' . $obj . '/' . $obj . '.php'; if (JFile::exists($file)) { //file exist eval($function); $function = 'plgfieldsattachment_' . $obj . "::getName();"; eval("\$plugin_name =" . $function . ""); //$str .= $field->type." == ".$plugin_name."<br />"; eval($function); JError::raiseNotice(500, "sssssdsf"); if ($field->type == $plugin_name) { if ($backendcategory) { $value = JRequest::getVar("field_" . $field->id, fieldsattachHelper::getfieldsvalueCategories($field->id, $id), 'post', 'string', JREQUEST_ALLOWHTML); JError::raiseNotice(500, "sssssdsf"); //$value = JRequest::getVar("field_".$field->id, $this->getfieldsvalueCategories( $field->id, $id)); } else { // $value = JRequest::getVar("field_".$field->id,fieldsattachHelper::getfieldsvalue( $field->id, $id), 'post', 'string', JREQUEST_ALLOWHTML); $value = ""; if (isset($_POST["field_" . $field->id])) { $value = $_POST["field_" . $field->id]; } else { $value = fieldsattachHelper::getfieldsvalue($field->id, $id); } //$value = JRequest::getVar("field_".$field->id, $this->getfieldsvalue( $field->id, $id)); } $value = addslashes($value); //SESSION VALUE $session = JFactory::getSession(); $value_session = $session->get("field_" . $field->id); if (!empty($value_session) && empty($value)) { $value = $value_session; } //DELETE SESSION VALUE $session->clear("field_" . $field->id); $function = 'plgfieldsattachment_' . $obj . '::renderInput(' . $id . ',' . $field->id . ',"' . $value . '","' . $field->extras . '");'; //$function = "plgfieldsattachment_".$obj."::renderInput(".$id.",".$field->id.",'".$value."','".$field->extras."');"; eval("\$tmp=" . $function . ""); $str .= '<div class="control-group"><label class="control-label" for="field_' . $field->id . '">' . $field->title; if ($field->required) { $str .= ' </label><span>(*)</span>'; } $str .= '<div class="controls">' . $tmp . '</div>'; $str .= '</div>'; //Reset field of category description ===================== // fieldsattachHelper::resetToDescription($id, $field->id, &$body); $this->resetToDescription($id, $field->id); } } } } //$str .= '</div>'; //END inputs RENDER ========================================================= } //END INPUT ============================================ } } $this->menuTabstr = $menuTabstr; $this->str = $str; }
/** * Injects Insert Tags input box and drop down menu to adminForm * * @access public * @since 1.5 */ function onBeforeRender() { $id = JRequest::getVar('id'); //EDIT ARTICLE ===================================================================== if (!$id) { $cid = JRequest::getVar('cid', array(), '', 'array'); @($id = $cid[0]); $view = JRequest::getVar('view'); if ($view == 'article') { $path = ''; } else { $path = '..' . DS; } } $task = JRequest::getVar('task'); $option = JRequest::getVar('option'); $id = JRequest::getVar('id', JRequest::getVar('a_id')); $user =& JFactory::getUser(); $task = JRequest::getVar('task'); $option = JRequest::getVar('option'); $id = JRequest::getVar('id', JRequest::getVar('a_id')); $view = JRequest::getVar('view'); $layout = JRequest::getVar('layout'); $fontend = false; if ($option == 'com_content' && $user->get('id') > 0 && $view == 'form' && $layout == 'edit') { $fontend = true; } $backend = false; if ($option == 'com_content' && $layout == 'edit') { $backend = true; } $backendcategory = false; if (JRequest::getVar('option') == 'com_categories' && JRequest::getVar('view') == "category" && JRequest::getVar('extension') == "com_content") { $backendcategory = true; $backend = true; } if (!empty($id)) { if ($backend || $fontend) { $fields = array(); if ($backendcategory) { if (!empty($id)) { $fields_tmp0 = fieldsattachHelper::getfieldsForAllCategory($id); $fields = fieldsattachHelper::getfieldsCategory($id); $fields = array_merge($fields_tmp0, $fields); } } else { $fields_tmp0 = fieldsattachHelper::getfieldsForAll($id); $fields_tmp1 = fieldsattachHelper::getfields($id); $fields_tmp1 = array_merge($fields_tmp0, $fields_tmp1); $fields_tmp2 = fieldsattachHelper::getfieldsForArticlesid($id, $fields_tmp1); $fields = array_merge($fields_tmp1, $fields_tmp2); } //****** //INPUTS ================================================ $this->exist = false; $this->fields = $fields; //inputs RENDER ==================================================================== $idgroup = -1; $titlegropu = ""; $this->exist = false; $cont = -1; $cuantos_en_str = 0; //$field->position=1; $str = ""; //$('ul#list li:first').after('ul#list li:eq(1)') //If J3.1 ******* if (version_compare(JVERSION, '3.1', '>') == 1) { if (count($fields) > 0) { foreach ($fields as $field) { //if($field->position == 1){ //JError::raiseNotice(500, "FIELD ".$field->id); if ($field->idgroup != $idgroup) { $cont++; //JError::raiseNotice(500, "FIELD ".$field->title); if ($idgroup > 0) { if ($this->exist == true) { $str .= '</div> '; //JError::raiseNotice(500, "Escribir content"); $myTabContent = JLayoutHelper::render('libraries.cms.html.bootstrap.starttabset', array('selector' => 'myTab')); $document = JFactory::getDocument(); $content = $document->getBuffer('component'); $content = str_replace($myTabContent, $myTabContent . JHtml::_('bootstrap.addTab', 'myTab', 'tabID' . $idgroup, $titlegropu) . $str . JHtml::_('bootstrap.endTab'), $content); $document->setBuffer($content, array('type' => 'component', 'name' => '', 'title' => '')); $str = ""; } } $this->exist = true; $cuantos_en_str++; $str .= '<div class="tab-panewww" id="fiedlsattachTab_' . $field->idgroup . '" >'; if (!empty($field->descriptiongroup)) { $str .= '<div class="desc">' . $field->descriptiongroup . '</div>'; } } $idgroup = $field->idgroup; $titlegropu = $field->titlegroup; //NEW GET PLUGIN ******************************************************************** JPluginHelper::importPlugin('fieldsattachment'); // very important //select if (empty($this->array_fields)) { $this->array_fields = fieldsattachHelper::get_extensions(); } if (count($this->array_fields) > 0) { foreach ($this->array_fields as $obj) { $function = "plgfieldsattachment_" . $obj . "::construct();"; //$base = JPATH_BASE; //$base = str_replace("/administrator", "", $base); $base = JPATH_SITE; $file = $base . '/plugins/fieldsattachment/' . $obj . '/' . $obj . '.php'; if (JFile::exists($file)) { //file exist eval($function); $function = 'plgfieldsattachment_' . $obj . "::getName();"; eval("\$plugin_name =" . $function . ""); //$str .= $field->type." == ".$plugin_name."<br />"; eval($function); //JError::raiseNotice(500, "sssssdsf"); if ($field->type == $plugin_name) { if ($backendcategory) { $value = JRequest::getVar("field_" . $field->id, fieldsattachHelper::getfieldsvalueCategories($field->id, $id), 'post', 'string', JREQUEST_ALLOWHTML); // JError::raiseNotice(500, "sssssdsf"); //$value = JRequest::getVar("field_".$field->id, $this->getfieldsvalueCategories( $field->id, $id)); } else { // $value = JRequest::getVar("field_".$field->id,fieldsattachHelper::getfieldsvalue( $field->id, $id), 'post', 'string', JREQUEST_ALLOWHTML); $value = ""; if (isset($_POST["field_" . $field->id])) { $value = $_POST["field_" . $field->id]; } else { $value = fieldsattachHelper::getfieldsvalue($field->id, $id); } //$value = JRequest::getVar("field_".$field->id, $this->getfieldsvalue( $field->id, $id)); } $value = addslashes($value); //SESSION VALUE $session = JFactory::getSession(); $value_session = $session->get("field_" . $field->id); if (!empty($value_session) && empty($value)) { $value = $value_session; } //DELETE SESSION VALUE $session->clear("field_" . $field->id); $function = 'plgfieldsattachment_' . $obj . '::renderInput(' . $id . ',' . $field->id . ',"' . $value . '","' . $field->extras . '");'; //$function = "plgfieldsattachment_".$obj."::renderInput(".$id.",".$field->id.",'".$value."','".$field->extras."');"; eval("\$tmp=" . $function . ""); //ERROR: //$str .= '<div id="control-group_'.$field->id.'" class="control-group"><label class="control-label" for="field_'.$field->id.'">' . $field->title; //if($field->required) {$str .= '</label> <span>(*)</span>';} //CORRECT: $str .= '<div id="control-group_' . $field->id . '" class="control-group"><label class="control-label" for="field_' . $field->id . '">' . $field->title . '</label>'; if ($field->required) { $str .= '<span>(*)</span>'; } $str .= '<div class="controls">' . $tmp . '</div>'; $str .= '</div>'; //Reset field of category description ===================== // fieldsattachHelper::resetToDescription($id, $field->id, &$body); //$this->resetToDescription($id, $field->id); } } } } //END inputs RENDER ========================================================= } $str .= '</div>'; //END INPUT ============================================ } //******* //nav-tabs if ($fontend) { /*$myTabContent = JLayoutHelper::render('libraries.cms.html.bootstrap.starttabset', array('selector' => 'myTab')); $document = JFactory::getDocument(); $content = $document->getBuffer('component'); $content = str_replace($myTabContent, $myTabContent.JHtml::_('bootstrap.addTab', 'myTab', 'tabID'.$idgroup, $titlegropu).$str.JHtml::_('bootstrap.endTab'), $content); $document->setBuffer($content, array('type' => 'component', 'name' => '', 'title' => '')); */ } else { $myTabContent = JLayoutHelper::render('libraries.cms.html.bootstrap.starttabset', array('selector' => 'myTab')); $document = JFactory::getDocument(); $content = $document->getBuffer('component'); $content = str_replace($myTabContent, $myTabContent . JHtml::_('bootstrap.addTab', 'myTab', 'tabID' . $idgroup, $titlegropu) . $str . JHtml::_('bootstrap.endTab'), $content); $document->setBuffer($content, array('type' => 'component', 'name' => '', 'title' => '')); } } //*************** //$('ul#list li:first').after('ul#list li:eq(1)') $document =& JFactory::getDocument(); //$(window).load() //$document->addScript('/plugins/system/sjdinfinitescroll/jquery.infinitescroll.js'); $script = 'jQuery(window).load(function() { '; $script .= "tt = jQuery('#myTabTabs li:eq(1)').html();"; $script .= "num= jQuery('ul#myTabTabs li').length;"; for ($i = 0; $i <= $cont; $i++) { $script .= "var lastli = jQuery('ul#myTabTabs li:eq('+(num-1)+')');"; $script .= "jQuery('ul#myTabTabs li:first').after(lastli);"; } $script .= '});'; $document->addScriptDeclaration($script); } } //IF no empty ID //ENND : If 3.1 ******* }
/** * Get a inputs of content * * @access public * @since 1.5 */ function getinputfields($id, $fields, $backend, $fontend, $backendcategory, $exist_options, &$body = null, &$str = null, &$str_options = null) { $str = ''; $this->exist = false; $this->exist_options = false; if (count($fields) > 0) { $sitepath = fieldsattachHelper::getabsoluteURL(); // if(JRequest::getVar("view")=="fieldsattachunidad") $str = '<script src="'.$sitepath.'plugins/system/fieldsattachment/js/fieldattachment.js" type="text/javascript"></script> '; if ($backend || $fontend) { $str = '<script src="' . $sitepath . 'plugins/system/fieldsattachment/js/fieldattachment.js" type="text/javascript"></script> '; $str_options = '<script src="' . $sitepath . 'plugins/system/fieldsattachment/js/fieldattachment.js" type="text/javascript"></script> '; } if ($backend) { $str .= '<script src="' . $sitepath . 'plugins/system/fieldsattachment/js/TabPane.js" type="text/javascript"></script> '; $str .= "<script type='text/javascript'> document.addEvent('domready', function() {\n var tabPane = new TabPane('demo');\n });</script>"; $str .= '<div id="demo"><ul class="tabs">'; } else { } $idgroup = ""; //TABS RENDER AFTER DESCRIPTION ==================================================================== if (count($fields) > 0) { $this->exist = false; foreach ($fields as $field) { if ($field->idgroup != $idgroup) { if ($backend) { if ($field->position == 1) { $str .= '<li class="tab">' . $field->titlegroup . '</li>'; $this->exist = true; } } $idgroup = $field->idgroup; } } if (!$this->exist) { //after $str = "" <-- LOOK because $str .= ""; } } if ($backend) { if (!empty($str)) { $str .= '</ul><div class="fieldscontent"> '; } } //inputs RENDER ==================================================================== $idgroup = -1; $this->exist = false; $cont = -1; $cuantos_en_str = 0; if (count($fields) > 0) { foreach ($fields as $field) { //if($field->position == 1){ $cont++; if ($field->idgroup != $idgroup) { if ($idgroup > 0) { if ($backend) { if ($field->position == 1) { if ($this->exist == true) { $str .= '</div> '; } } else { if ($this->exist_options) { $str_options .= '</ul></fieldset></div></div> '; } } } else { $str .= '</div></fieldset>'; } } if ($backend) { if ($field->position == 1) { $this->exist = true; $cuantos_en_str++; $str .= '<div id="' . $fields[0]->titlegroup . '-' . $field->idgroup . '" class="content" >'; if (!empty($field->descriptiongroup)) { $str .= '<div class="desc">' . $field->descriptiongroup . '</div>'; } } else { $this->exist_options = true; $str_options .= '<div class="panel fieldsattach"> <h3 class="pane-toggler title" id="meta-fieldsattach' . $field->id . '"> <a href="javascript:void(0);"><span>' . $field->titlegroup . '</span> </a></h3><div class="pane-slider content">'; if (!empty($field->descriptiongroup)) { $str_options .= '<div class="desc">' . $field->descriptiongroup . '</div>'; } $str_options .= '<fieldset class="panelform"><ul class="adminformlist">'; } } else { $str .= '<fieldset id="group_' . $field->id . '" class="group"><legend>' . $field->titlegroup . '</legend>'; $str .= '<div class="formelm-area">'; if (!empty($field->descriptiongroup)) { $str .= '<div class="desc">' . $field->descriptiongroup . '</div>'; } } } $idgroup = $field->idgroup; if ($backend) { if ($field->position == 1) { $str .= '<div id="fields_' . $field->id . '" class="fields">'; } } if ($backend) { if ($field->position == 1) { $str .= '<div style="width:100%; margin: 5px 0 5px 0px; padding:3px 0 3px 5px; color:#165a8f; overflow:hidden;background-color:#eee; border:#dcdcdc solid 1px;"> <label for="field_' . $field->id . '" style=" font-weight:bold; font-size:14px;">'; } } else { $str .= '<h3 class="frontendtitle" id="meta-fieldsattach' . $field->id . '">'; } if ($field->position == 1 || $fontend) { $str .= $field->title . ""; } if ($backend) { if ($field->position == 1) { $str .= '</label>'; if ($field->required) { $str .= ' <span style="color:#f00;font-size:0.9em;">(* Required)</span>'; } $str .= '</div>'; } } else { if ($field->required) { $str .= ' <span class="star"> *</span>'; } $str .= '</h3>'; } //NEW GET PLUGIN ******************************************************************** JPluginHelper::importPlugin('fieldsattachment'); // very important //select //$this->array_fields = $this->params->get( 'array_fields' ); if (empty($this->array_fields)) { $this->array_fields = fieldsattachHelper::get_extensions(); } if (count($this->array_fields) > 0) { foreach ($this->array_fields as $obj) { $function = "plgfieldsattachment_" . $obj . "::construct();"; //$base = JPATH_BASE; //$base = str_replace("/administrator", "", $base); $base = JPATH_SITE; $file = $base . '/plugins/fieldsattachment/' . $obj . '/' . $obj . '.php'; if (JFile::exists($file)) { //file exist eval($function); $function = 'plgfieldsattachment_' . $obj . "::getName();"; eval("\$plugin_name =" . $function . ""); //$str .= $field->type." == ".$plugin_name."<br />"; eval($function); if ($field->type == $plugin_name) { if ($backendcategory) { $value = JRequest::getVar("field_" . $field->id, fieldsattachHelper::getfieldsvalueCategories($field->id, $id), 'post', 'string', JREQUEST_ALLOWHTML); //$value = JRequest::getVar("field_".$field->id, $this->getfieldsvalueCategories( $field->id, $id)); } else { // $value = JRequest::getVar("field_".$field->id,fieldsattachHelper::getfieldsvalue( $field->id, $id), 'post', 'string', JREQUEST_ALLOWHTML); $value = ""; if (isset($_POST["field_" . $field->id])) { $value = $_POST["field_" . $field->id]; } else { $value = fieldsattachHelper::getfieldsvalue($field->id, $id); } //$value = JRequest::getVar("field_".$field->id, $this->getfieldsvalue( $field->id, $id)); } $value = addslashes($value); //SESSION VALUE $session = JFactory::getSession(); $value_session = $session->get("field_" . $field->id); if (!empty($value_session) && empty($value)) { $value = $value_session; } //DELETE SESSION VALUE $session->clear("field_" . $field->id); $function = 'plgfieldsattachment_' . $obj . '::renderInput(' . $id . ',' . $field->id . ',"' . $value . '","' . $field->extras . '");'; //$function = "plgfieldsattachment_".$obj."::renderInput(".$id.",".$field->id.",'".$value."','".$field->extras."');"; if ($field->position == 1 || $fontend) { $str .= '<div id="col' . $field->id . '" class="col" style=" width:100%; overflow:hidden" >'; eval("\$str .=" . $function . ""); $str .= '</div>'; //echo "AAAAAAAAAAAAAAAAAA:".$field->id; //Reset field of category description ===================== //fieldsattachHelper::resetToDescription($id, $field->id, &$body); $this->resetToDescription($id, $field->id); } else { eval("\$tmp=" . $function . ""); $str_options .= '<li><label>' . $field->title . '</label>' . $tmp . '</li>'; //Reset field of category description ===================== // fieldsattachHelper::resetToDescription($id, $field->id, &$body); $this->resetToDescription($id, $field->id); } } } } } if ($backend) { if ($field->position == 1) { $str .= '</div>'; } } //END inputs RENDER ========================================================= } } if ($backend) { if (!empty($str)) { $str .= '</div>'; } if (!empty($str_options)) { $str_options .= '</ul></fieldset></div></div> '; } } else { $str .= '</div></fieldset>'; } if ($backend) { if (!empty($str)) { $str .= '</div>'; $str .= '</div>'; } } } else { $str = ""; } //echo $str; //return $str; $this->str = $str; $this->str_options = $str_options; }