Advertisement
manchumahara

Module position Custom Param type for Joomla

Jul 5th, 2012
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.77 KB | None | 0 0
  1. <?php
  2. /**
  3.  * @version Id: adminpowermenu.php $
  4.  * @package Joomla
  5.  * @subpackage  Content
  6.  * @copyright   Copyright (C)2010-2012 codeboxr.com. All rights reserved.
  7.  * @license GNU/GPL, http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
  8.  * @Support Forum http://codeboxr.com/product/admin-power-menu-for-joomla
  9.  */
  10.  
  11.  
  12. // no direct access
  13. defined( '_JEXEC' ) or die( 'Restricted access' );
  14.  
  15. if(version_compare(JVERSION,'1.6.0','ge')) {
  16.     jimport('joomla.form.formfield');
  17.     class JFormFieldModposition extends JFormField {
  18.         var $type = 'modposition';
  19.         function getInput(){
  20.             return JElementModposition::fetchElement($this->name, $this->value, $this->element, $this->options['control']);
  21.         }
  22.     }
  23. }
  24.  
  25. class JElementModposition extends JElement
  26. {
  27.     /**
  28.      * Element name
  29.      *
  30.      * @access  protected
  31.      * @var     string
  32.      */
  33.     var $_name = 'modposition';        
  34.         function fetchElement( $name, $value, &$node, $control_name ) {            
  35.             if (!defined ('CODEBOXR_MODPOS')) {
  36.                 define ('CODEBOXR_MODPOS', 1);
  37.                 //
  38.             }    
  39.            
  40.             //let's list the module positions
  41.             //$client   =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
  42.            
  43.             $clientid = 0;  // for home page
  44.             $user =& JFactory::getUser();
  45.             $db   =& JFactory::getDBO();
  46.             $query = 'SELECT m.position AS text, m.position AS value'
  47.                             . ' FROM #__modules as m'
  48.                             . ' WHERE m.client_id = '.(int) $clientid
  49.                             . ' GROUP BY m.position'
  50.                             . ' ORDER BY m.position'
  51.                             ;
  52.             //$positions[] = JHTML::_('select.option',  '0', '- '. JText::_( 'Select Position' ) .' -' );
  53.             $db->setQuery( $query );
  54.             //$positions = array();
  55.             $positions =  $db->loadObjectList();
  56.             //var_dump($positions);
  57.             //var_dump($positions);
  58.             //$lists['position']    = JHTML::_('select.genericlist',   $positions, 'filter_position', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', "$filter_position" );
  59.            
  60.            
  61.             if(version_compare(JVERSION,'1.6.0','ge')) {
  62.                     $fieldName = $name.'[]';
  63.             }
  64.             else {
  65.                     $fieldName = $control_name.'['.$name.'][]';
  66.             }
  67.  
  68.             //$doc->addScriptDeclaration($js);
  69.             $output= JHTML::_('select.genericlist',  $positions, $fieldName, 'class="inputbox" style="width:90%;" multiple="multiple" size="10"', 'value', 'text', $value );
  70.             return $output;                          
  71.  
  72.     }//end function fectchElement
  73.        
  74. }//end class
  75. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement