コード例 #1
0
 protected function getInput()
 {
     $db = JFactory::getDBO();
     //build the list of categories
     $query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid' . ' FROM #__phocadownload_categories AS a' . ' WHERE a.published = 1' . ' ORDER BY a.ordering';
     $db->setQuery($query);
     $data = $db->loadObjectList();
     // TODO - check for other views than category edit
     $view = JRequest::getVar('view');
     $catId = -1;
     if ($view == 'phocadownloadcat') {
         $id = $this->form->getValue('id');
         // id of current category
         if ((int) $id > 0) {
             $catId = $id;
         }
     }
     /*if ($view == 'phocadownloadfile') {
     			$id 	= $this->form->getValue('catid'); // id of current category
     			if ((int)$id > 0) {
     				$catId = $id;
     			}
     		}*/
     $required = (string) $this->element['required'] == 'true' ? TRUE : FALSE;
     $tree = array();
     $text = '';
     $tree = PhocaDownloadCategory::CategoryTreeOption($data, $tree, 0, $text, $catId);
     //if ($required == TRUE) {
     //} else {
     array_unshift($tree, JHTML::_('select.option', '', '- ' . JText::_('COM_PHOCADOWNLOAD_SELECT_CATEGORY') . ' -', 'value', 'text'));
     //}
     return JHTML::_('select.genericlist', $tree, $this->name, 'class="inputbox"', 'value', 'text', $this->value, $this->id);
 }
コード例 #2
0
ファイル: view.html.php プロジェクト: BillVGN/PortalPRP
	function display($tpl = null) {
		$app	= JFactory::getApplication();
		JHtml::_('behavior.tooltip');
		JHtml::_('behavior.formvalidation');
		JHtml::_('behavior.keepalive');
		JHtml::_('formbehavior.chosen', 'select');
		
		//Frontend Changes
		$tUri = '';
		if (!$app->isAdmin()) {
			$tUri = JURI::base();
			
		}
		
		$document	= JFactory::getDocument();
		$uri		= JFactory::getURI();
		JHTML::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' );
		
		$eName				= JRequest::getVar('e_name');
		$this->t['ename']		= preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName );
		$this->t['backlink']	= $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinks&tmpl=component&e_name='.$this->t['ename'];
		
		
		// Category Tree
		$db = JFactory::getDBO();
		$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid'
		. ' FROM #__phocadownload_categories AS a'
	//	. ' WHERE a.published = 1' You can hide not published and not authorized categories too
	//	. ' AND a.approved = 1'
		. ' ORDER BY a.ordering';
		$db->setQuery( $query );
		$categories = $db->loadObjectList();

		$tree = array();
		$text = '';
		$tree = PhocaDownloadCategory::CategoryTreeOption($categories, $tree, 0, $text, -1);
		//-----------------------------------------------------------------------
		
		// Multiple
		$ctrl	= 'hidecategories';
		$attribs	= ' ';
		$attribs	.= ' size="5"';
		//$attribs	.= 'class="'.$v.'"';
		$attribs	.= ' class="inputbox"';
		$attribs	.= ' multiple="multiple"';
		$ctrl		.= '';
		//$value		= implode( '|', )
		
		$categoriesOutput = JHTML::_('select.genericlist', $tree, $ctrl, $attribs, 'value', 'text', 0, 'hidecategories' );
		
		$this->assignRef('categoriesoutput',	$categoriesOutput);
		
		parent::display($tpl);
	}
コード例 #3
0
ファイル: view.html.php プロジェクト: BillVGN/PortalPRP
	function display($tpl = null) {
		$app	= JFactory::getApplication();
		$db		= JFactory::getDBO();
		JHtml::_('behavior.tooltip');
		JHtml::_('behavior.formvalidation');
		JHtml::_('behavior.keepalive');
		JHtml::_('formbehavior.chosen', 'select');
		//Frontend Changes
		$tUri = '';
		if (!$app->isAdmin()) {
			$tUri = JURI::base();
			
		}
		
		$document	= JFactory::getDocument();
		$uri		= JFactory::getURI();
		JHTML::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' );
		
		$eName				= JRequest::getVar('e_name');
		$this->t['ename']		= preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName );
		$this->t['backlink']	= $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinks&tmpl=component&e_name='.$this->t['ename'];
		
		$model 			= $this->getModel();
		
		// build list of categories
		//$javascript 	= 'class="inputbox" size="1" onchange="submitform( );"';
		$javascript 	= 'class="inputbox" size="1"';
		$filter_catid	= '';
		
		$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid'
		. ' FROM #__phocadownload_categories AS a'
		. ' WHERE a.published = 1'
		//. ' AND a.approved = 1'
		. ' ORDER BY a.ordering';
		$db->setQuery( $query );
		$phocadownloads = $db->loadObjectList();

		$tree = array();
		$text = '';
		$tree = PhocaDownloadCategory::CategoryTreeOption($phocadownloads, $tree, 0, $text, -1);
		array_unshift($tree, JHTML::_('select.option', '0', '- '.JText::_('COM_PHOCADOWNLOAD_SELECT_CATEGORY').' -', 'value', 'text'));
		$lists['catid'] = JHTML::_( 'select.genericlist', $tree, 'catid',  $javascript , 'value', 'text', $filter_catid );
		//-----------------------------------------------------------------------
		
		$this->assignRef('lists',	$lists);
		
		parent::display($tpl);
	}
コード例 #4
0
ファイル: batch.php プロジェクト: jbelborja/lavid3
 public static function item($published, $category = 0)
 {
     // Create the copy/move options.
     $options = array(JHtml::_('select.option', 'c', JText::_('JLIB_HTML_BATCH_COPY')), JHtml::_('select.option', 'm', JText::_('JLIB_HTML_BATCH_MOVE')));
     $db = JFactory::getDBO();
     //build the list of categories
     $query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid' . ' FROM #__phocadownload_categories AS a' . ' ORDER BY a.ordering';
     $db->setQuery($query);
     $data = $db->loadObjectList();
     $tree = array();
     $text = '';
     $catId = -1;
     $tree = PhocaDownloadCategory::CategoryTreeOption($data, $tree, 0, $text, $catId);
     if ($category == 1) {
         array_unshift($tree, JHTML::_('select.option', 0, JText::_('JLIB_HTML_ADD_TO_ROOT'), 'value', 'text'));
     }
     // Create the batch selector to change select the category by which to move or copy.
     $lines = array('<label id="batch-choose-action-lbl" for="batch-choose-action">', JText::_('JLIB_HTML_BATCH_MENU_LABEL'), '</label>', '<fieldset id="batch-choose-action" class="combo">', '<select name="batch[category_id]" class="inputbox" id="batch-category-id">', '<option value="">' . JText::_('JSELECT') . '</option>', JHTML::_('select.options', $tree), '</select>', JHTML::_('select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm'), '</fieldset>');
     return implode("\n", $lines);
 }
コード例 #5
0
ファイル: category.php プロジェクト: BillVGN/PortalPRP
	public static function options($type = 0)
	{
		if ($type == 1) {
			$tree[0] 			= new JObject();
			$tree[0]->text 		= JText::_('COM_PHOCADOWNLOAD_MAIN_CSS');
			$tree[0]->value 	= 1;
			$tree[1] 			= new JObject();
			$tree[1]->text 		= JText::_('COM_PHOCADOWNLOAD_CUSTOM_CSS');
			$tree[1]->value 	= 2;
			return $tree;
		}
		
		$db = JFactory::getDBO();

       //build the list of categories
		$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid'
		. ' FROM #__phocadownload_categories AS a'
		. ' WHERE a.published = 1'
		. ' ORDER BY a.ordering';
		$db->setQuery( $query );
		$items = $db->loadObjectList();
	
		$catId	= -1;
		
		$javascript 	= 'class="inputbox" size="1" onchange="submitform( );"';
		
		$tree = array();
		$text = '';
		$tree = PhocaDownloadCategory::CategoryTreeOption($items, $tree, 0, $text, $catId);
		
		return $tree;

	}