Esempio n. 1
0
	public function getInput()
	{
		$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'].'"' : '';

		// Output
		$currentid = JFactory::getApplication()->input->getInt('id');
		$categories = JEMCategories::getCategoriesTree();


		$db		= JFactory::getDbo();
		$query	= $db->getQuery(true);
		$query = 'SELECT DISTINCT catid FROM #__jem_cats_event_relations WHERE itemid = '. $db->quote($currentid);

		$db->setQuery($query);
		$selectedcats = $db->loadColumn();

		return JEMCategories::buildcatselect($categories, 'cid[]', $selectedcats, 0, trim($attr));
	}
Esempio n. 2
0
 public function display($tpl = null)
 {
     // Load pane behavior
     jimport('joomla.html.pane');
     // initialise variables
     $document = JFactory::getDocument();
     // Load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
     // Cause of group limits we can't use class here to build the categories tree
     $categories = $this->get('Categories');
     // build selectlists
     $categories = JEMCategories::buildcatselect($categories, 'cid[]', null, 0, 'multiple="multiple" size="8 class="inputbox"');
     $this->categories = $categories;
     // add toolbar
     $this->addToolbar();
     parent::display($tpl);
 }
Esempio n. 3
0
	public function getInput()
	{
		$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'].'"' : '';


		//$attr .= $this->element['required'] ? ' class="required modal-value"' : "";

// 		if ($this->required) {
// 			$class = ' class="required modal-value"';
// 		}

		// Output

		//$categories = JEMCategories::getCategoriesTree(0);
		//$Lists['parent_id'] 		= JEMCategories::buildcatselect($categories, 'parent_id', $row->parent_id, 1);

		$currentid = JFactory::getApplication()->input->getInt('id');
		$categories = JEMCategories::getCategoriesTree(0);

		$db		= JFactory::getDbo();
		$query	= $db->getQuery(true);
		$query = 'SELECT DISTINCT parent_id FROM #__jem_categories WHERE id = '. $db->quote($currentid);

		$db->setQuery($query);
		$currentparent_id = $db->loadColumn();

		return JEMCategories::buildcatselect($categories, 'parent_id', $currentparent_id, 1);
	}