Ejemplo n.º 1
0
 /**
  * Setting the toolbar
  */
 protected function addToolBar()
 {
     JRequest::setVar('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->id;
     $isNew = $this->item->id == 0;
     $canDo = fieldsattachHelper::getActions($this->item->id);
     JToolBarHelper::title($isNew ? JText::_('COM_fieldsattach_MANAGER_fieldsattach_NEW') : JText::_('COM_fieldsattach_MANAGER_fieldsattach_EDIT'), 'fieldsattach');
     // Built the actions for new and existing records.
     if ($isNew) {
         // For new records, check the create permission.
         if ($canDo->get('core.create')) {
             JToolBarHelper::apply('fieldsattachgroup.apply', 'JTOOLBAR_APPLY');
             JToolBarHelper::save('fieldsattachgroup.save', 'JTOOLBAR_SAVE');
             JToolBarHelper::custom('fieldsattachgroup.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
         }
         JToolBarHelper::cancel('cancel', 'JTOOLBAR_CANCEL');
     } else {
         if ($canDo->get('core.edit')) {
             // We can save the new record
             JToolBarHelper::apply('fieldsattachgroup.apply', 'JTOOLBAR_APPLY');
             JToolBarHelper::save('fieldsattachgroup.save', 'JTOOLBAR_SAVE');
             // We can save this record, but check the create permission to see if we can return to make a new one.
             if ($canDo->get('core.create')) {
                 JToolBarHelper::custom('fieldsattachgroup.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
             }
         }
         /*if ($canDo->get('core.create'))
         		{
         			JToolBarHelper::custom('fieldsattachgroup.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
         		}*/
         JToolBarHelper::cancel('fieldsattachgroup.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Ejemplo n.º 2
0
 /**
  * Setting the toolbar
  */
 protected function addToolBar()
 {
     $canDo = fieldsattachHelper::getActions();
     JToolBarHelper::title(JText::_('COM_FIELDATTACH_MANAGER_FIELDATTACHS'), 'cpanel');
     if ($canDo->get('core.admin')) {
         //JToolBarHelper::divider();
         JToolBarHelper::preferences('com_fieldsattach');
     }
 }
Ejemplo n.º 3
0
 /**
  * Setting the toolbar
  */
 protected function addToolBar()
 {
     $canDo = fieldsattachHelper::getActions();
     JToolBarHelper::title(JText::_('COM_FIELDATTACH_MANAGER_FIELDATTACHIMAGES'), 'fieldsattach');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('fieldsattachimage.add', 'JTOOLBAR_NEW');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('fieldsattachimage.edit', 'JTOOLBAR_EDIT');
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'fieldsattachimage.delete', 'JTOOLBAR_DELETE');
     }
 }
Ejemplo n.º 4
0
    function renderHelpConfig()
    {
        $return = "";
        $sitepath = fieldsattachHelper::getabsoluteURL();
        $form = $this->form->getFieldset("percha_vimeo");
        $return .= JHtml::_('sliders.panel', JText::_("JGLOBAL_FIELDSET_VIMEO_OPTIONS"), "percha_" . $this->params->get('name', "") . '-params');
        $return .= '<fieldset class="panelform" >
			<ul class="adminformlist" style="overflow:hidden;">';
        // foreach ($this->param as $name => $fieldset){
        foreach ($form as $field) {
            $return .= "<li>" . $field->label . " " . $field->input . "</li>";
        }
        $return .= '<div><input type="button" value="' . JText::_("Update Config") . '" onclick="controler_percha_vimeo()" /></div>';
        $return .= '</ul> </fieldset>';
        $return .= '<script src="' . $sitepath . 'plugins/fieldsattachment/vimeo/controler.js" type="text/javascript"></script> ';
        return $return;
    }
Ejemplo n.º 5
0
 /**
  * Setting the toolbar
  */
 protected function addToolBar()
 {
     $canDo = fieldsattachHelper::getActions();
     JToolBarHelper::title(JText::_('COM_FIELDATTACH_MANAGER_FIELDATTACHSHELP'), 'systeminfo');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('fieldsattach.add', 'JTOOLBAR_NEW');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('fieldsattach.edit', 'JTOOLBAR_EDIT');
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'fieldsattach.delete', 'JTOOLBAR_DELETE');
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::divider();
         JToolBarHelper::preferences('com_fieldsattach');
     }
 }
Ejemplo n.º 6
0
 /**
  * Setting the toolbar
  */
 protected function addToolBar()
 {
     $canDo = fieldsattachHelper::getActions();
     JToolBarHelper::title(JText::_('COM_FIELDATTACH_MANAGER_FIELDATTACHGROUPS'), 'categories');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('fieldsattachgroup.add', 'JTOOLBAR_NEW');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('fieldsattachgroup.edit', 'JTOOLBAR_EDIT');
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'fieldsattachgroup.delete', 'JTOOLBAR_DELETE');
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::divider();
         JToolBarHelper::custom('fieldsattachgroup.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
         JToolBarHelper::custom('fieldsattachgroup.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::divider();
         JToolBarHelper::preferences('com_fieldsattach');
     }
 }
Ejemplo n.º 7
0
 /**
  * Return a image gallery HTML tag
  *
  * @param	$articleid	 id of article
  *              $fieldsids  id of field
  *
  * @return	html gallery   list
  * @since	1.6
  */
 public function getImageGallery($articleid, $fieldsids, $category = false)
 {
     $html = '<ul class="gallery">';
     $db =& JFactory::getDBO();
     $query = 'SELECT  a.* FROM #__fieldsattach_images as a  WHERE a.fieldsattachid = ' . $fieldsids . ' AND a.articleid= ' . $articleid . ' ORDER BY a.ordering';
     if ($category) {
         $query = 'SELECT  a.* FROM #__fieldsattach_images as a  WHERE a.fieldsattachid = ' . $fieldsids . ' AND a.catid= ' . $articleid . ' ORDER BY a.ordering';
     }
     $db->setQuery($query);
     $result = $db->loadObjectList();
     $firs_link = '';
     $cont = 0;
     $sitepath = fieldsattachHelper::getabsoluteURL();
     if (!empty($result)) {
         foreach ($result as $obj) {
             //if (JFile::exists( JPATH_SITE .DS."images".DS."documents".DS. $articleid .DS. $result->value)  )
             $html .= '<li>';
             if (JFile::exists(JPATH_SITE . DS . $obj->image2)) {
                 $html .= '<a href="' . $sitepath . '' . $obj->image1 . '" id="imgFiche" class="nyroModal" title="' . $obj->title . '" rel="gal_' . $articleid . '">';
                 $html .= '<img src="' . $sitepath . '' . $obj->image2 . '"  alt="' . $obj->title . '" />';
             } else {
                 $html .= '<img src="' . $sitepath . '' . $obj->image1 . '"  alt="' . $obj->title . '" />';
             }
             if (JFile::exists(JPATH_SITE . DS . $obj->image2)) {
                 $html .= '</a>';
             }
             $html .= '</li>';
             $cont++;
         }
     }
     $html .= '</ul>';
     return $html;
 }
 private function getAll(&$article)
 {
     if (!empty($article->id) && JRequest::getVar("view") == "article") {
         $db =& JFactory::getDBO();
         $query = 'SELECT *  FROM #__extensions as a WHERE a.folder = "fieldsattachment"  AND a.enabled= 1';
         $db->setQuery($query);
         $results_plugins = $db->loadObjectList();
         $tmp_fields[] = array();
         $tmp_fields = fieldsattachHelper::getfieldsForAll($article->id);
         $fields[] = array();
         // $fields = $this->getfields($article->id);
         $fields = fieldsattachHelper::getfields($article->id);
         $fields = array_merge($tmp_fields, $fields);
         $fields_tmp2[] = array();
         $fields_tmp2 = fieldsattachHelper::getfieldsForArticlesid($article->id, $fields);
         $fields = array_merge($fields, $fields_tmp2);
         if (count($fields) > 0) {
             //$body = str_replace('</head>', $header_code.'</head>', $body);
             $idgroup = $fields[0]->idgroup;
             $str = '';
             $str_before = '';
             $cont = 0;
             foreach ($fields as $field) {
                 //NEW
                 JPluginHelper::importPlugin('fieldsattachment');
                 // very important
                 //select
                 foreach ($results_plugins as $obj) {
                     $function = "plgfieldsattachment_" . $obj->element . "::construct();";
                     //NEW PACTH CRISTIAN 10_04_2012 =======================
                     $base = JPATH_SITE;
                     $file = $base . '/plugins/fieldsattachment/' . $obj->element . '/' . $obj->element . '.php';
                     //echo "<br>".$file;
                     if (JFile::exists($file)) {
                         //file exist
                         eval($function);
                         // eval($function);
                         $i = count($this->array_fields);
                         $this->array_fields[$i] = $obj->element;
                         //$str .= "<br> ".$field->type." == ".$obj->element;
                         if ($field->type == $obj->element && $field->visible) {
                             $function = "plgfieldsattachment_" . $obj->element . "::getHTML(" . $article->id . "," . $field->id . ");";
                             //$str .= "<br> ".$function ;
                             if ($field->positionarticle == 1) {
                                 eval("\$str_before .=" . $function . "");
                             } else {
                                 eval("\$str .=" . $function . "");
                             }
                             // $str .= $function;
                         }
                     }
                     //=====================================================
                 }
                 /*
                 
                                               //EXTRA INFORMATION
                                               $width = '400';
                                               $height = '400';
                                               $filter = '';
                                               if(!empty($field->extras))
                                                 {
                                                     //$lineas = explode('":"',  $field->params);
                                                     //$tmp = substr($lineas[1], 0, strlen($lineas[1])-2);
                                                     $tmp = $field->extras;
                                                     //$str .= "<br> resultado1: ".$tmp;
                                                     $lineas = explode(chr(13),  $tmp);
                                                     //$str .= "<br> resultado2: ".$lineas[0];
                 
                                                     foreach ($lineas as $linea)
                                                     {
                                                         $tmp = explode('|',  $linea);
                                                         if (!empty($tmp[0])) $width = $tmp[0];
                                                         if (!empty($tmp[1])) $height = $tmp[1];
                                                         if (!empty($tmp[2])) $filter = $tmp[2];
                                                     }
                 
                                                 }  
                                                 //************************************************************************
                                                 //**************************** multiple select **********************
                                                 //***********************************************************************
                                                   if (($field->type == "select_multiple")&&($field->visible ))
                                                     {
                                                        $str .= fieldattach::getSelectmultiple($article->id, $field->id);
                                                     }
                 */
                 //************************************************************************
                 //**************************** titulo campos **********************
                 //***********************************************************************
                 //&& (!empty( $fields[$cont+1] ))
                 if ($cont + 1 < count($fields)) {
                     if ($idgroup != $fields[$cont + 1]->idgroup && !empty($str)) {
                         $eltitle = false;
                         if (isset($field->shortitlegroup)) {
                             if ($field->shortitlegroup) {
                                 $eltitle = true;
                             }
                         }
                         if ($eltitle) {
                             $article->text .= '<h3>' . $field->titlegroup . '</h3>';
                         }
                         $article->text = $str_before . $article->text . $str;
                         $str = '';
                     }
                     $idgroup = $fields[$cont + 1]->idgroup;
                 } else {
                     $article->text = $str_before . $article->text . $str;
                 }
                 $cont++;
             }
         }
     }
 }
Ejemplo n.º 9
0
                    </div>
                 
                    

                    <div class="tab-pane"  id="extra">
                            <?php 
$db =& JFactory::getDBO();
$query = 'SELECT *  FROM #__extensions as a WHERE a.folder = "fieldsattachment"  AND a.enabled= 1';
$db->setQuery($query);
$results = $db->loadObjectList();
foreach ($results as $obj) {
    //echo JHtml::_('sliders.start', 'fieldsattach-slider-'.$obj->element);
    //echo '<div id="fieldsattach-slider-'.$obj->element.'" class="pane-sliders"><div id="percha_'.$obj->element.'-params" class="content">';
    echo '<div id="fieldsattach-slider-' . $obj->element . '" class="pane-sliders"><div class="panel" >';
    echo '<div class="pane-slider content pane-down" >';
    echo fieldsattachHelper::getForm($obj->element);
    echo '</div></div></div>';
    /*$function  = "plgfieldsattachment_".$obj->element."::construct();";
      eval('echo '. $function.';'); 
      $function  = "plgfieldsattachment_".$obj->element."::renderHelpConfig();";
      eval('echo '. $function.';');*/
    // echo  JHtml::_('sliders.end');
}
?>
		
                    </div>
            </div>
        </div>
	 
		<input type="hidden" name="task" value="fieldsattachunidad.edit" />
		<?php 
Ejemplo n.º 10
0
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select');
$params = $this->form->getFieldsets('params');
$articlesid = "";
if ($this->item->articlesid) {
    $articlesid = explode(",", $this->item->articlesid);
}
$str = '
    //FUNCTION AD LI =========================================
    function init_obj(){
    ';
if (!empty($articlesid)) {
    foreach ($articlesid as $articleid) {
        //$str .='alert("'.getTitle($articleid).'");';
        $str .= 'var title = "' . fieldsattachHelper::getTitle($articleid) . '" ;';
        if (!empty($articleid)) {
            $str .= 'obj.AddId(  ' . $articleid . ', title);';
        }
    }
}
$str .= '
     //alert("init ' . $articlesid . '");
     var myArray = String(document.id("jform_articlesid").value).split(\',\');
}';
$document = JFactory::getDocument();
$document->addScriptDeclaration($str);
?>
 

Ejemplo n.º 11
0
 /**
  * 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">&#160;*</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;
 }
Ejemplo n.º 12
0
 function import()
 {
     $app = JFactory::getApplication();
     //DB Connection
     $Config = new JConfig();
     $host = $Config->host;
     $user = $Config->user;
     $pass = $Config->password;
     $name = $Config->db;
     $prefix = $Config->dbprefix;
     $return = "";
     $link = mysql_connect($host, $user, $pass);
     mysql_select_db($name, $link);
     if ($_FILES["file"]["error"] > 0) {
         $str = "Error: " . $_FILES["file"]["error"] . "<br />";
         $app->enqueueMessage($str);
     } else {
         $str = "<br /><br />Upload: " . $_FILES["file"]["name"] . "<br />";
         $str .= "Type: " . $_FILES["file"]["type"] . "<br />";
         $str .= "Size: " . $_FILES["file"]["size"] / 1024 . " Kb<br />";
         $str .= "Stored in: " . $_FILES["file"]["tmp_name"] . " <br /><br />";
         $app->enqueueMessage($str);
         // let's pretend that connection to server is established
         // and database chosen...
         /*$sql = explode(';#%%', file_get_contents ($_FILES["file"]["tmp_name"]));
         	    $n = count ($sql) - 1;
         	    for ($i = 0; $i < $n; $i++) {
         		$query = $sql[$i];
         		echo $query."<br>";
         		$result = mysql_query ($query) or die ('<p>Query: <br><tt>' . $query . '</tt><br>failed. MySQL error: ' . mysql_error());
         	    }
         	    */
         $file_content = file($_FILES["file"]["tmp_name"]);
         $cont = 0;
         foreach ($file_content as $sql_line) {
             if (trim($sql_line) != "" && strpos($sql_line, "--") == false) {
                 //echo $sql_line.'<br/><br/>';
                 mysql_query($sql_line);
                 $cont++;
             }
         }
         $app->enqueueMessage(JTEXT::_("IMPORT OK") . ":" . $cont . " SQL");
     }
     // Load the submenu.
     fieldsattachHelper::addSubmenu(JRequest::getCmd('view', 'fieldsattach'));
     parent::display();
 }
Ejemplo n.º 13
0
        function getGallery1($articleid, $fieldsattachid)
        {
            // Load the tooltip behavior. 


        $db = JFactory::getDbo();
        $directory = "administrator/";
        if ( JFactory::getApplication()->isAdmin()) {
             $directory = "";
        }

        $query = $db->getQuery(true);
         // Select some fields
		$query->select('*');

		// From the hello table
		$query->from('#__fieldsattach_images');
        $query->where("articleid = ".$articleid." AND fieldsattachid=".$fieldsattachid);

        $query->order("ordering");
 
               // $db = JFactory::getDbo();

		 $db->setQuery($query);
		 //$str = $query;
		 $rows= $db->loadObjectList();
		 	$str = '<div style="position:relative; float:left; top:-50px;"><a class=\'modal\' rel=\'{handler: "iframe", size: {x: 980, y: 500}}\' href=\''.JURI::base(false).'/'.$directory.'index.php?option=com_fieldsattach&view=fieldsattachimage&layout=edit&tmpl=component&reset=2\'></a>
 			';
            $str .= "<a href='#' onclick='update_gallery".$fieldsattachid."();return false;'><img src='".JURI::base(false)."/".$directory."components/com_fieldsattach/images/icon-refresh.png' alt='refresh' /></a>";
			//$str .= "<a class='modal' rel='{handler: \"iframe\", size: {x: 980, y: 500}}' href='index.php?option=com_fieldsattach&view=fieldsattachimage&layout=edit&tmpl=component&reset=2&fieldsattachid=".$fieldsattachid."'><img src='components/com_fieldsattach/images/icon-32-new.png' alt='refresh' /></a>";
			$str .= '</div>';
         

             $str .= "<ul style='overflow:hidden;'>";
             $sitepath  =  fieldsattachHelper::getabsoluteURL(); 
             if($rows>0){
               foreach ($rows as $row)
                {
                  //$url_edit ='index.php?option=com_fieldsattach&amp;task=fieldsattachimage.edit&amp;id='.$row->id.'&amp;tmpl=component&amp;reset=2&amp;fieldsattachid='.$fieldsattachid.'&amp;direct=true';
				  $url_edit =JURI::base(false).'/index.php?option=com_fieldsattach&view=fieldsattachimage&tmpl=component&layout=edit&id='.$row->id.'&fieldsattachid='.$fieldsattachid.'&reset=2';
				  $url_delete =JURI::base(false).'/index.php?option=com_fieldsattach&amp;view=fieldsattachimages&amp;task=delete&amp;id='.$row->id.'&amp;tmpl=component&amp;fieldsid='.$fieldsattachid;
                  $str.= '<li style="width:150px; height:150px; margin: 0px 10px 10px 0; overflow:hidden; float:left; border:1px solid #ddd;">
                  <div style="overflow:hidden;margin-bottom:8px;"><div style="width:32px;float:left;"> <a class="modal" href="'.$sitepath.''.$row->image1.'"><img src="'.JURI::base(false).$directory.'components/com_fieldsattach/images/icon-zoom.png" alt="zoom" /></a>
                  </div>
                  <div style="width:32px;float:right;"><a class="modal" href="'.$url_delete.'" rel="{handler: \'iframe\', size: {x: 980, y: 500}}"><img src="'.JURI::base(false).$directory.'/components/com_fieldsattach/images/icon-32-delete.png" alt="zoom" /></a>
                  </div></div>
               	  <div><a class="modal"  href="'.$url_edit.'" rel="{handler: \'iframe\', size: {x: 980, y: 500}}" ><img src="'.$sitepath.''.$row->image1.'" alt="'.$row->title.'" width="150" /></a>
                  </div>
                  </li>';

                }
             }
			$str .= "<li style='width:80px; background:url(".JURI::base(false)."/".$directory."components/com_fieldsattach/images/icon-32-new.png) no-repeat 50px 40px; height:10px; margin: 0px 10px 10px 0; overflow:hidden; float:left; border:1px solid #ddd;padding:80px 20px 60px 35px;'>
			<a class='modal' rel='{handler: \"iframe\", size: {x: 980, y: 500}}' href='".JURI::base(false)."index.php?option=com_fieldsattach&view=fieldsattachimage&layout=edit&tmpl=component&reset=2&fieldsattachid=".$fieldsattachid."'>";
			$str .= JText::_("NEW IMAGE").'</a></li>';
		
            $str .= "</ul>";
            
             return $str;
        }
Ejemplo n.º 14
0
 function action($articleid, $fieldsid, $fieldsvalueid)
 {
     $path = $this->params->get("path");
     $documentpath = $this->params->get("documentpath");
     if (empty($documentpath)) {
         $sitepath = fieldsattachHelper::getabsoluteURL();
         $this->params->set("path", $sitepath . 'images' . DS . 'documents');
         //$documentpath=  JPATH_INSTALLATION.DS.'..'.DS.'images'.DS.'documents';
         $documentpath = JPATH_BASE . DS . 'images' . DS . 'documents';
     }
     //Categories ============================================================================
     if (JRequest::getVar('option') == 'com_categories' && JRequest::getVar('layout') == "edit") {
         //$documentpath=  JPATH_INSTALLATION.DS.'..'.DS.'images'.DS.'documentscategories';
         $documentpath = JPATH_BASE . DS . 'images' . DS . 'documentscategories';
     }
     $file = "field_" . $fieldsid . "_upload";
     fieldsattachHelper::deleteFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath);
     $nombreficherofinal = fieldsattachHelper::uploadFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath);
     $width = 0;
     $height = 0;
     $filter = "";
     $selectable = "";
     $nombrefichero = "";
     if (!empty($nombreficherofinal)) {
         $db = JFactory::getDbo();
         $query = 'SELECT a.extras FROM #__fieldsattach as a WHERE a.id=' . $fieldsid . '';
         $db->setQuery($query);
         $results = $db->loadObject();
         $tmp = "";
         //JError::raiseWarning( 100, $obj->type." --- ". $query   );
         if (!empty($results)) {
             $tmp = $results->extras;
             //JError::raiseWarning( 100,  " --- ". $results->extras   );
         }
         //$str .= "<br> resultado1: ".$tmp;
         $lineas = explode(chr(13), $tmp);
         //$str .= "<br> resultado2: ".$lineas[0];
         $str .= '<div>';
         foreach ($lineas as $linea) {
             $tmp = explode('|', $linea);
             $width = $tmp[0];
             $height = $tmp[1];
             $filter = $tmp[2];
             $selectable = $tmp[3];
             //echo $width.'ssX'.$height.'<br>';
             $nombrefichero = $_FILES[$file]["name"];
         }
         // $app = JFactory::getApplication();
         // $app->enqueueMessage(  "---width:".$width  );
         fieldsattachHelper::resize($nombreficherofinal, $nombreficherofinal, $width, $height, $articleid, $documentpath, $filter);
     }
 }
Ejemplo n.º 15
0
 function action($articleid, $fieldsid, $fieldsvalueid)
 {
     $path = $this->path1;
     $documentpath = $this->documentpath;
     //FIND FOLDER ************************************************************
     $documentpath = JPATH_ROOT . DS . 'images' . DS . 'documents';
     $option = JRequest::getVar("option");
     //Categories ============================================================================
     if ($option == 'com_categories') {
         $documentpath = JPATH_ROOT . DS . 'images' . DS . 'documentscategories';
     }
     $file = "field_" . $fieldsid . "_upload";
     fieldsattachHelper::deleteFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath);
     if (!empty($_FILES[$file]['tmp_name'])) {
         //Create folder if not exist ----------------------------
         if (!JFolder::create($documentpath . DS . $articleid)) {
             JError::raiseWarning(100, JTEXT::_("I haven't created:") . $documentpath . DS . $articleid);
         } else {
             //$app->enqueueMessage( JTEXT::_("Folder created:"). $documentpath .DS. $articleid)   ;
         }
         $nombreficherofinal = fieldsattachHelper::uploadFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath);
         $width = 0;
         $height = 0;
         $filter = "";
         $selectable = "";
         $nombrefichero = "";
         if (!empty($nombreficherofinal)) {
             $db = JFactory::getDbo();
             $query = 'SELECT a.extras FROM #__fieldsattach as a WHERE a.id=' . $fieldsid . '';
             $db->setQuery($query);
             $results = $db->loadObject();
             $tmp = "";
             if (!empty($results)) {
                 $tmp = $results->extras;
             }
             $lineas = explode(chr(13), $tmp);
             $str .= '<div>';
             foreach ($lineas as $linea) {
                 $tmp = explode('|', $linea);
                 $width = $tmp[0];
                 $height = $tmp[1];
                 $filter = $tmp[2];
                 $selectable = $tmp[3];
                 $nombrefichero = $_FILES[$file]["name"];
             }
             fieldsattachHelper::resize($nombreficherofinal, $nombreficherofinal, $width, $height, $articleid, $documentpath, $filter);
         }
     }
 }
Ejemplo n.º 16
0
 /**
  * Injects Insert Tags input box and drop down menu to adminForm
  *
  * @access	public
  * @since	1.5
  */
 function onAfterRenderCategory()
 {
     $db =& JFactory::getDBO();
     $query = 'SELECT *  FROM #__extensions as a WHERE a.folder = "fieldsattachment"  AND a.enabled= 1';
     $db->setQuery($query);
     $results_plugins = $db->loadObjectList();
     $body = JResponse::getBody();
     //echo "sssssssssssssssssssssssssssssssss:: ".count($results_plugins);
     $id = JRequest::getVar('id');
     if (!empty($id)) {
         $fields_tmp0 = fieldsattachHelper::getfieldsForAllCategory($id);
         $fields = fieldsattachHelper::getfieldsCategory($id);
         $fields = array_merge($fields_tmp0, $fields);
     }
     $idgroup = -1;
     if (count($fields) > 0) {
         $exist = false;
         //NEW
         JPluginHelper::importPlugin('fieldsattachment');
         // very important
         foreach ($fields as $field) {
             //select
             foreach ($results_plugins as $obj) {
                 $function = "plgfieldsattachment_" . $obj->element . "::construct();";
                 $base = JPATH_BASE;
                 $base = str_replace("/administrator", "", $base);
                 $base = JPATH_SITE;
                 $file = $base . '/plugins/fieldsattachment/' . $obj->element . '/' . $obj->element . '.php';
                 if (JFile::exists($file)) {
                     //file exist
                     eval($function);
                 }
                 $i = count($this->array_fields);
                 //$str .= "<br> ".$field->type." == ".$obj->element;
                 if ($field->type == $obj->element && $field->visible) {
                     $function = "plgfieldsattachment_" . $obj->element . "::getHTML(" . $id . "," . $field->id . ", true);";
                     //$sustitucion  = "<br> ".$function ;
                     // echo "<br>".$function;
                     eval("\$sustitucion   =" . $function . "");
                     // $str .= $function;
                 }
             }
             //echo "xxxxxxxxxx dd:".$idgroup;
             // $body .=    $field->titlegroup.'sdddddddddddddddddddddddddddddddddddddddddddddddd<br>ss';
             if ($field->visible) {
                 $patron = "{fieldsattach_" . $field->id . "}";
                 // echo $patron;
                 $body = str_replace($patron, $sustitucion, $body);
                 $exist = true;
                 $idgroup = $field->idgroup;
             } else {
                 $patron = "{fieldsattach_" . $field->id . "}";
                 // echo $patron;
                 $body = str_replace($patron, "", $body);
             }
         }
     }
     JResponse::setBody($body);
 }
Ejemplo n.º 17
0
    /**
     * Method to get content articles
     *
     * @return	array	The field option objects.
     * @since	1.6
     */
    protected function getInput()
    {
        // Initialize variables.
        $session = JFactory::getSession();
        $options = array();
        $attr = '';
        // Initialize some field attributes.
        $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
        // To avoid user's confusion, readonly="true" should imply disabled="true".
        if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') {
            $attr .= ' disabled="disabled"';
        }
        $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
        $attr .= $this->multiple ? ' multiple="multiple"' : '';
        // Initialize JavaScript field attributes.
        $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
        //now get to the business of finding the articles
        $db =& JFactory::getDBO();
        $query = 'SELECT * FROM #__fieldsattach_groups WHERE published=1 ORDER BY title';
        $db->setQuery($query);
        $groups = $db->loadObjectList();
        $fields = array();
        // set up first element of the array as all articles
        $fields[0]->id = '';
        $fields[0]->title = JText::_("ALLARTICLES");
        /*if((int)$this->value>0)
          {
                  $query = 'SELECT title FROM #__content WHERE id='.$this->value;
                   $db->setQuery( $query );
          }*/
        //loop through categories
        foreach ($groups as $group) {
            $optgroup = JHTML::_('select.optgroup', $group->title, 'id', 'title');
            $query = 'SELECT id,title FROM #__fieldsattach WHERE groupid=' . $group->id;
            $db->setQuery($query);
            $results = $db->loadObjectList();
            if (count($results) > 0) {
                array_push($fields, $optgroup);
                foreach ($results as $result) {
                    array_push($fields, $result);
                }
            }
        }
        if ($this->value) {
            $query = 'SELECT id,title FROM #__fieldsattach WHERE id=' . $this->value;
            $db->setQuery($query);
            $field = $db->loadObject();
        } else {
            $field->title = JText::_('COM_CONTENT_SELECT_AN_ARTICLE');
        }
        $link = 'index.php?option=com_fieldsattach&amp;view=fieldsattachunidades&amp;layout=modal&amp;tmpl=component&amp;function=jSelectFields';
        // Output
        // Build the script.
        $script = array();
        $script[] = '	function jSelectFields(id, title, catid, object) {';
        //$script[] = '		document.id("jform_request_fields").value += id + ",";';
        //$script[] = '		document.id("fieldsid_name").value = title;';
        $script[] = '		SqueezeBox.close(); obj.AddId(id, title);';
        $script[] = '	}';
        $script[] = '	';
        $fieldsid = explode(",", $field->id);
        echo "DValue:" . $this->value;
        echo "<br>vID:" . $this->id;
        $str = '
    //FUNCTION AD LI =========================================
    function init_obj(){
    ';
        if ($fieldsid) {
            foreach ($fieldsid as $fieldid) {
                //$str .='alert("'.getTitle($articleid).'");';
                $str .= 'var title = "' . fieldsattachHelper::getTitle($fieldid) . '" ;';
                if (!empty($fieldid)) {
                    $str .= 'obj.AddId(  ' . $fieldid . ', title);';
                }
            }
        }
        $str .= '
     //alert("init ' . $articlesid . '");
     //var myArray = String(document.id("jform_request_fields").value).split(\',\');
}';
        $document = JFactory::getDocument();
        $document->addScriptDeclaration($str);
        $base = JURI::base();
        $base = str_replace("administrator/", "", $base);
        $js = $base . "components" . DS . "com_fieldsattach" . DS . "views" . DS . "advancedsearch" . DS . "fields" . DS . "fields.js";
        // Add the script to the document head.
        JFactory::getDocument()->addScript($js);
        JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
        //$fieldName	= $control_name.'['.$name.']';
        JHTML::_('behavior.modal', 'a.modal');
        // $html = "\n".'<div style="float: left;"><input style="background: #ffffff;" type="text" id="fieldsid_name" value="'.htmlspecialchars($field->title, ENT_QUOTES, 'UTF-8').'" disabled="disabled" /></div>';
        //		$html .= "\n &nbsp; <input class=\"inputbox modal-button\" type=\"button\" value=\"".JText::_('Select')."\" />";
        $html .= '<div class="button2-left"><div class="blank"><a class="modal" title="' . JText::_('Select an Article') . '"  href="' . $link . '" rel="{handler: \'iframe\', size: {x: 650, y: 375}}">' . JText::_('Select') . '</a></div></div>' . "\n";
        //$html .= "\n".'<input type="text" id="jform[request][fields]" name="jform_request_fields" value="'.$this->value.'" />'   ;
        $html .= "\n" . '<input type="text" id="' . $name . '_id" name="' . $fieldName . '" value="' . (int) $value . '" />';
        $html .= '<div style="width:100%; overflow: hidden; background-color:#f00;">
                                                <ul id="fieldslist">
                                                    
                                                </ul>
                                            </div>';
        //jform[request][advancedsearchcategories][]
        return $html;
        //return JHTML::_('select.genericlist',  $articles, $this->name, trim($attr), 'id', 'title', $this->value );
    }
Ejemplo n.º 18
0
 /**
  * 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;
 }
Ejemplo n.º 19
0
<form action="<?php 
echo JRoute::_('index.php?option=com_fieldsattach&view=fieldsattachunidades');
?>
" method="post" name="adminForm" id="adminForm">
        <fieldset id="filter-bar">
		<div class="filter-select fltrt"> 
                        <?php 
//echo $this->create_filter();
?>
                     <select name="filter_group_id" class="inputbox" onchange="this.form.submit()">
				<option value="-1"><?php 
echo JText::_('- Choose group -');
?>
</option>
				<?php 
echo JHtml::_('select.options', fieldsattachHelper::getGroups(), 'value', 'text', $this->state->get('filter.group_id'));
?>
                    </select>
                    <select name="filter_language" class="inputbox" onchange="this.form.submit()">
				<option value=""><?php 
echo JText::_('JOPTION_SELECT_LANGUAGE');
?>
</option>
				<?php 
echo JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language'));
?>
		    </select>
		</div>
        
        
		<input type="hidden" value="asc" name="directionTable" id="directionTable"  />
Ejemplo n.º 20
0
 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;
     }
 }
Ejemplo n.º 21
0
    function getGallery1($articleid, $fieldsattachid)
    {
        // Load the tooltip behavior.
        $db = JFactory::getDbo();
        $directory = "administrator/";
        if (JFactory::getApplication()->isAdmin()) {
            $directory = "";
        }
        $query = $db->getQuery(true);
        // Select some fields
        $query->select('*');
        // From the hello table
        $query->from('#__fieldsattach_images');
        $query->where("articleid = " . $articleid . " AND fieldsattachid=" . $fieldsattachid);
        $query->order("ordering");
        $db->setQuery($query);
        //$str = $query;
        $rows = $db->loadObjectList();
        $str = '<div class="page-header" style="position:relative;"><a class=\'modal\' rel=\'{handler: "iframe", size: {x: 980, y: 500}}\' href=\'' . JURI::base(false) . '/' . $directory . 'index.php?option=com_fieldsattach&view=fieldsattachimage&layout=edit&tmpl=component&reset=2\'></a>';
        $str .= '<a class="modal btn btn-primary" rel="{handler: \'iframe\', size: {x: 980, y: 500}}" href="' . JURI::base(false) . 'index.php?option=com_fieldsattach&view=fieldsattachimage&layout=edit&tmpl=component&reset=2&fieldsattachid=' . $fieldsattachid . '">' . JText::_('NEW IMAGE') . '</a>';
        $str .= '&nbsp;&nbsp;';
        $str .= '<a href="#" onclick="update_gallery' . $fieldsattachid . '();return false;"><img src="' . JURI::base(false) . '/' . $directory . 'components/com_fieldsattach/images/icon-refresh.png" alt="refresh" /></a>';
        $str .= '</div>';
        $str .= '
		  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" /> 
		  <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>';
        $str .= " \n<style> \n.ui-sortable{overflow:hidden; margin:0; padding:0;}\n.sortable li  {\n  cursor: move;margin: 0 10px 12px 0; border:1px #ccc solid; float:left;border-radius: 5px;\n  padding: 3px;   width:200px; height:200px; overflow:hidden;\n} \n</style>";
        $str .= '<div   class="ui-sortable"><ul id="gallerysortable' . $fieldsattachid . '" class="sortable" >';
        $sitepath = fieldsattachHelper::getabsoluteURL();
        if ($rows > 0) {
            foreach ($rows as $row) {
                $url_edit = JURI::base() . 'index.php?option=com_fieldsattach&view=fieldsattachimage&tmpl=component&layout=edit&id=' . $row->id . '&fieldsattachid=' . $fieldsattachid . '&reset=2';
                $url_delete = JURI::base() . 'index.php?option=com_fieldsattach&amp;view=fieldsattachimages&amp;task=delete&amp;id=' . $row->id . '&amp;tmpl=component&amp;fieldsid=' . $fieldsattachid;
                $str .= '
	                  <li id="image_' . $fieldsattachid . '_' . $row->id . '"  style="width:150px; height:150px; ">
				    <div class="btn-group" style="margin-bottom:4px;">
					       <a class="modal btn btn-mini" style="min-width:20px;" href="' . $sitepath . $row->image1 . '">' . JText::_('ZOOM') . '</a>
					       <a class="modal btn btn-mini" style="min-width:20px;" href="' . $url_edit . '" rel="{handler: \'iframe\', size: {x: 980, y: 500}}">' . JText::_('EDIT') . '</a>
					       <a class="modal btn btn-mini" style="min-width:20px;" href="' . $url_delete . '" rel="{handler: \'iframe\', size: {x: 980, y: 500}}">' . JText::_('DELETE') . '</a>
					 
				    </div>
				    <img src="' . $sitepath . $row->image1 . '" alt="' . $row->title . '" />
		               	   
	                  </li>
	                  ';
            }
        }
        $str .= '</ul></div>
';
        return $str;
    }
Ejemplo n.º 22
0
 function action($articleid, $fieldsid, $fieldsvalueid)
 {
     $path = $this->params->get("path");
     $file = "field_" . $fieldsid . "_upload";
     $documentpath = $this->params->get("documentpath");
     if (empty($documentpath)) {
         /*$sitepath = JURI::base() ;
           $pos = strrpos($sitepath, "administrator");
           if(!empty($pos)){$sitepath  = JURI::base().'..'.DS;}*/
         $sitepath = fieldsattachHelper::getabsoluteURL();
         $this->params->set("path", $sitepath . 'images' . DS . 'documents');
         //$documentpath=  JPATH_INSTALLATION.DS.'..'.DS.'images'.DS.'documents';
         $documentpath = JPATH_BASE . DS . 'images' . DS . 'documents';
     }
     plgfieldsattachment_file::deleteFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath);
     plgfieldsattachment_file::uploadFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath);
 }
Ejemplo n.º 23
0
 /**
  * Method to get content articles
  *
  * @return	array	The field option objects.
  * @since	1.6
  */
 protected function getInput()
 {
     // Initialize variables.
     $session = JFactory::getSession();
     $options = array();
     $attr = '';
     // Initialize some field attributes.
     $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     // To avoid user's confusion, readonly="true" should imply disabled="true".
     if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') {
         $attr .= ' disabled="disabled"';
     }
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $attr .= $this->multiple ? ' multiple="multiple"' : '';
     // Initialize JavaScript field attributes.
     $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     //now get to the business of finding the articles
     $db =& JFactory::getDBO();
     $query = 'SELECT * FROM #__fieldsattach_groups WHERE published=1 ORDER BY title';
     $db->setQuery($query);
     $groups = $db->loadObjectList();
     $fields = array();
     // set up first element of the array as all articles
     $fields[0]->id = '';
     $fields[0]->title = JText::_("ALLARTICLES");
     /*if((int)$this->value>0)
       {
               $query = 'SELECT title FROM #__content WHERE id='.$this->value;
                $db->setQuery( $query );
       }*/
     //loop through categories
     foreach ($groups as $group) {
         $optgroup = JHTML::_('select.optgroup', $group->title, 'id', 'title');
         $query = 'SELECT id,title FROM #__fieldsattach WHERE groupid=' . $group->id;
         $db->setQuery($query);
         $results = $db->loadObjectList();
         if (count($results) > 0) {
             array_push($fields, $optgroup);
             foreach ($results as $result) {
                 array_push($fields, $result);
             }
         }
     }
     if ($this->value) {
         $query = 'SELECT id,title FROM #__fieldsattach WHERE id=' . $this->value;
         $db->setQuery($query);
         $field = $db->loadObject();
     } else {
         $field->title = JText::_('COM_CONTENT_SELECT_AN_ARTICLE');
     }
     $link = 'index.php?option=com_fieldsattach&amp;view=fieldsattachunidades&amp;layout=modal&amp;tmpl=component&amp;function=jSelectFields&object=' . $this->id;
     // Output
     // Build the script.
     $script = array();
     $script[] = '	function jSelectFields(id, title, catid, object,type) {';
     //$script[] = '		document.id("jform_request_fields").value += id + ",";';
     //$script[] = '		document.id("fieldsid_name").value = title;';
     //$script[] = ' alert(type);';
     $script[] = ' if( (type=="input") || (type=="textarea") || (type=="select") || (type=="selectmultiple") ){';
     $script[] = '		SqueezeBox.close(); obj.AddId(id, title, object,"");';
     $script[] = ' }else{ alert("' . JText::_("TYPE_NOT_VALID") . '");}';
     $script[] = '	}';
     $script[] = '	';
     $fieldsid = explode(",", $this->value);
     $str = '
             //FUNCTION AD LI =========================================
             function init_obj(){
             ';
     if ($fieldsid) {
         foreach ($fieldsid as $fieldid) {
             $tmp = explode("_", $fieldid);
             //echo $tmp;
             $text_filtre = "";
             if (count($tmp) > 1) {
                 for ($cont = 1; $cont < count($tmp); $cont++) {
                     $text_filtre .= $tmp[$cont];
                     if ($cont < count($tmp) - 1) {
                         $text_filtre .= "_";
                     }
                 }
             }
             //$str .='alert("'.$fieldid.'--'.fieldsattachHelper::getFieldsTitle('$fieldid').'");';
             $str .= 'var title = "' . fieldsattachHelper::getFieldsTitle($tmp[0]) . '" ;';
             if (!empty($fieldid)) {
                 $str .= 'obj.AddId(  ' . $tmp[0] . ', title, "' . $this->id . '", "' . $text_filtre . '");';
             }
         }
     }
     $str .= '
         }';
     $document = JFactory::getDocument();
     $document->addScriptDeclaration($str);
     $base = JURI::base();
     $base = str_replace("administrator/", "", $base);
     $js = $base . "components" . DS . "com_fieldsattach" . DS . "views" . DS . "advancedsearch" . DS . "fields" . DS . "fieldsextra.js";
     // Add the script to the document head.
     JFactory::getDocument()->addScript($js);
     JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
     //$fieldName	= $control_name.'['.$name.']';
     JHTML::_('behavior.modal', 'a.modal');
     $html = "\n" . '<div style="display:block; overflow:hidden;width:100%; margin:30px 0 0 0;padding-top:20px; border-top:#ccc 2px solid;">';
     $html .= '<div class="button2-left"><div class="blank"><a class="modal" title="' . JText::_('Select an Article') . '"  href="' . $link . '" rel="{handler: \'iframe\', size: {x: 650, y: 375}}">' . JText::_('Select') . '</a></div></div>' . "\n";
     //$html .= "\n".'<input type="text" id="jform[request][fields]" name="jform_request_fields" value="'.$this->value.'" />'   ;
     $html .= "\n" . '<input type="hidden" id="' . $this->id . '" name="' . $this->name . '" value="' . $this->value . '" />';
     $html .= '<div style="width:100%; margin:20px 0 ; padding:20px 0; border-bottom: 2px solid #ccc; overflow: hidden; ">
                                             <ul id="fieldslist">
                                                 
                                             </ul>
                                         </div></div>';
     //jform[request][advancedsearchcategories][]
     return $html;
     //return JHTML::_('select.genericlist',  $articles, $this->name, trim($attr), 'id', 'title', $this->value );
 }
Ejemplo n.º 24
0
 private function getAll($article)
 {
     if (!empty($article->id) && JRequest::getVar("view") == "article") {
         $db = JFactory::getDBO();
         $query = 'SELECT *  FROM #__extensions as a WHERE a.folder = "fieldsattachment"  AND a.enabled= 1';
         $db->setQuery($query);
         $results_plugins = $db->loadObjectList();
         $tmp_fields[] = array();
         $tmp_fields = fieldsattachHelper::getfieldsForAll($article->id);
         $fields[] = array();
         $fields = fieldsattachHelper::getfields($article->id);
         $fields = array_merge($tmp_fields, $fields);
         $fields_tmp2[] = array();
         $fields_tmp2 = fieldsattachHelper::getfieldsForArticlesid($article->id, $fields);
         $fields = array_merge($fields, $fields_tmp2);
         //User access view the layout takes some responsibility for display of limited information.
         $user = JFactory::getUser();
         $groups = $user->getAuthorisedViewLevels();
         if (count($fields) > 0) {
             //$body = str_replace('</head>', $header_code.'</head>', $body);
             $idgroup = $fields[0]->idgroup;
             $str = '';
             $str_before = '';
             $cont = 0;
             foreach ($fields as $field) {
                 //echo "field id: ".$field->id;
                 //echo "<br>field id: ".$field->access;
                 if (in_array($field->access, $groups)) {
                     //NEW
                     JPluginHelper::importPlugin('fieldsattachment');
                     // very important
                     //select
                     foreach ($results_plugins as $obj) {
                         $function = "plgfieldsattachment_" . $obj->element . "::construct1();";
                         //NEW PACTH CRISTIAN 10_04_2012 =======================
                         $base = JPATH_SITE;
                         $file = $base . '/plugins/fieldsattachment/' . $obj->element . '/' . $obj->element . '.php';
                         //echo "<br>".$file;
                         if (JFile::exists($file)) {
                             //file exist
                             eval($function);
                             // eval($function);
                             $i = count($this->array_fields);
                             $this->array_fields[$i] = $obj->element;
                             //$str .= "<br> ".$field->type." == ".$obj->element;
                             if ($field->type == $obj->element && $field->visible) {
                                 $function = "plgfieldsattachment_" . $obj->element . "::getHTML(" . $article->id . "," . $field->id . ");";
                                 //$str .= "<br> ".$function ;
                                 if ($field->positionarticle == 1) {
                                     eval("\$str_before .=" . $function . "");
                                 } else {
                                     eval("\$str .=" . $function . "");
                                 }
                                 // $str .= $function;
                             }
                         }
                         //=====================================================
                     }
                     //************************************************************************
                     //**************************** titulo campos **********************
                     //***********************************************************************
                     if ($cont + 1 < count($fields)) {
                         if ($idgroup != $fields[$cont + 1]->idgroup && !empty($str)) {
                             $eltitle = false;
                             if (isset($field->shortitlegroup)) {
                                 if ($field->shortitlegroup) {
                                     $eltitle = true;
                                 }
                             }
                             if ($eltitle) {
                                 $article->text .= '<h3>' . $field->titlegroup . '</h3>';
                             }
                             $article->text = $str_before . $article->text . $str;
                             $str = '';
                         }
                         $idgroup = $fields[$cont + 1]->idgroup;
                     } else {
                         $article->text = $str_before . $article->text . $str;
                         $article->fulltext = $str_before . $article->fulltext . $str;
                     }
                 }
                 $cont++;
             }
         }
     }
 }