Beispiel #1
0
 /**
  * Tests the JHtmlList::positions method.
  *
  * @return  void
  *
  * @since   3.1
  */
 public function testPositions()
 {
     $result = JHtmlList::positions('position-list', 'center', null, '1', '1', '1', '1', 'positions');
     // Build the container to check the <select> element
     $matcher = array('id' => 'positions', 'tag' => 'select', 'child' => array('tag' => 'option', 'content' => 'Left', 'attributes' => array('value' => 'left')));
     $this->assertTag($matcher, $result, 'Expected a <select> element with id "user-list" containing a child <option value="left">Left</option>');
 }
 /**
  * Tests the JHtmlList::positions method.
  *
  * @return  void
  *
  * @since   11.3
  */
 public function testPositions()
 {
     //TODO: Replace JGLOBAL_LEFT with translated string
     $this->assertThat(JHtmlList::positions('position-list', 'center', null, '1', '1', '1', '1', 'positions'), $this->StringContains('<option value="left">JGLOBAL_LEFT</option>'));
 }
Beispiel #3
0
 /**
  * Build a select list with a specific ordering
  *
  * @param   integer  $value     The scalar value
  * @param   integer  $id        The id for an existing item in the list
  * @param   string   $query     The query
  * @param   integer  $neworder  1 if new and first, -1 if new and last,
  *                              0  or null if existing item
  *
  * @return  string  Html for the ordered list
  *
  * @since   11.1
  *
  * @see         JHtmlList::ordering
  * @deprecated  12.1  Use JHtml::_('list.ordering') instead
  */
 public static function specificordering($value, $id, $query, $neworder = 0)
 {
     if (is_object($value)) {
         $value = $value->ordering;
     }
     if ($id) {
         $neworder = 0;
     } else {
         if ($neworder) {
             $neworder = 1;
         } else {
             $neworder = -1;
         }
     }
     return JHtmlList::ordering('ordering', $query, '', $value, $neworder);
 }
Beispiel #4
0
 /**
  * Display method
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return	void
  */
 function display($tpl = null)
 {
     $objISUtils = JSNISFactory::getObj('classes.jsn_is_utils');
     $objJSNTheme = JSNISFactory::getObj('classes.jsn_is_themes');
     $this->_document = JFactory::getDocument();
     $lists = array();
     $format = JRequest::getVar('view_format', 'temporary');
     $showlist_id = JRequest::getInt('showlist_id');
     $showcaseTheme = JRequest::getVar('theme', 'showcasethemeclassic');
     $model = $this->getModel();
     $items = $this->get('data');
     $session = JFactory::getSession();
     $overallWidthDimensionValue = '%';
     $showcaseThemeSession = $session->get('showcaseThemeSession');
     $session->clear('showcaseThemeSession');
     // GENERAL TAB BEGIN
     if ($showcaseThemeSession) {
         $publishShowcase = $showcaseThemeSession['published'];
     } else {
         if ($items->published != '') {
             $publishShowcase = $items->published;
         } else {
             $publishShowcase = 1;
         }
     }
     $lists['published'] = JHTML::_('jsnselect.booleanlist', 'published', '', $publishShowcase);
     $query = 'SELECT ordering AS value, showcase_title AS text FROM #__imageshow_showcase ORDER BY ordering';
     $lists['ordering'] = JHtmlList::ordering('ordering', $query, '', $items->showcase_id);
     //$lists['ordering']	= JHTML::_('list.specificordering',  $items, $items->showcase_id, $query );
     $generalImagesOrder = array('0' => array('value' => 'forward', 'text' => JText::_('SHOWCASE_GENERAL_FORWARD')), '1' => array('value' => 'backward', 'text' => JText::_('SHOWCASE_GENERAL_BACKWARD')), '2' => array('value' => 'random', 'text' => JText::_('SHOWCASE_GENERAL_RANDOM')));
     $dimension = array('0' => array('value' => 'px', 'text' => JText::_('px')), '1' => array('value' => '%', 'text' => JText::_('%')));
     // GENERAL TAB END
     $generalData = array();
     if (!empty($showcaseThemeSession)) {
         $generalData['generalTitle'] = $showcaseThemeSession['showcase_title'];
         $generalData['generalWidth'] = $showcaseThemeSession['general_overall_width'] . $showcaseThemeSession['overall_width_dimension'];
         $generalData['generalHeight'] = $showcaseThemeSession['general_overall_height'];
     } else {
         if ($items->general_overall_width) {
             $generalData['generalTitle'] = htmlspecialchars($items->showcase_title);
             $generalData['generalWidth'] = $items->general_overall_width;
             $generalData['generalHeight'] = $items->general_overall_height;
         } else {
             $generalData['generalTitle'] = '';
             $generalData['generalWidth'] = '100%';
             $generalData['generalHeight'] = '450';
         }
     }
     $overallWith = $generalData['generalWidth'];
     $posPercentageOverallWidth = strpos($overallWith, '%');
     if ($posPercentageOverallWidth) {
         $overallWith = substr($overallWith, 0, $posPercentageOverallWidth + 1);
         $overallWidthDimensionValue = "%";
     } else {
         $overallWith = (int) $overallWith;
         $overallWidthDimensionValue = "px";
     }
     $lists['overallWidthDimension'] = JHTML::_('select.genericList', $dimension, 'overall_width_dimension', 'class="overall-width-dimension" style="width: 50px;" onchange="checkOverallWidth();" ' . '', 'value', 'text', $overallWidthDimensionValue);
     $remoteTheme = $objJSNTheme->compareSources();
     $needInstallList = $objJSNTheme->getNeedInstallList($remoteTheme);
     $localTheme = $objJSNTheme->compareLocalSources();
     $needUpdateList = $objJSNTheme->getNeedUpdateList($localTheme);
     $canAutoDownload = true;
     $objJSNUtils = JSNISFactory::getObj('classes.jsn_is_utils');
     if (!$objJSNUtils->checkEnvironmentDownload()) {
         $canAutoDownload = false;
     }
     $this->assignRef('canAutoDownload', $canAutoDownload);
     $this->assignRef('needUpdateList', $needUpdateList);
     $this->assignRef('needInstallList', $needInstallList);
     $this->assignRef('generalData', $generalData);
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->_addAssets();
     $this->addToolbar();
     if (!$this->_checkAction()) {
         JFactory::getApplication()->redirect('index.php?option=com_imageshow&controller=showcase', JText::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED'), 'error');
         return false;
     }
     parent::display($tpl);
 }
Beispiel #5
0
 /**
  * Display method
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return	void
  */
 public function display($tpl = null)
 {
     $images = array();
     $catid = 0;
     $tmpjs = '';
     $albumID = '';
     $lists = array();
     $countImage = 0;
     $canAutoDownload = true;
     $this->_document = JFactory::getDocument();
     $objJSNUtils = JSNISFactory::getObj('classes.jsn_is_utils');
     $objJSNImages = JSNISFactory::getObj('classes.jsn_is_images');
     $objJSNJSLanguages = JSNISFactory::getObj('classes.jsn_is_jslanguages');
     $objImages = JSNISFactory::getObj('classes.jsn_is_images');
     $objJSNMsg = JSNISFactory::getObj('classes.jsn_is_message');
     $model = $this->getModel();
     $items = $this->get('data');
     // Get messages
     $msgs = '';
     $msgs = $objJSNMsg->getList('SHOWLISTS');
     $msgs = count($msgs) ? JSNUtilsMessage::showMessages($msgs) : '';
     if (isset($items->image_source_name) && $items->image_source_name != '') {
         $imageSource = JSNISFactory::getSource($items->image_source_name, $items->image_source_type, $items->showlist_id);
         $cat = $objImages->getAllCatShowlist($items->showlist_id);
         if (!empty($cat)) {
             $catid = $cat[0];
             $config = array('album' => $catid);
             $sync = $imageSource->getShowlistMode();
             if ($sync == 'sync') {
                 $images = $imageSource->loadImages($config);
             } else {
                 $images = $imageSource->loadImages($config);
             }
         }
         if ($imageSource->getShowlistMode() == 'sync') {
             $rmcat = 'JSNISImageGrid.removecatSelected();';
         } else {
             $rmcat = '';
         }
         $totalimage = count($images);
         if ($totalimage) {
             $imageInfo = (array) @$images->images[0];
             $albumID = @$imageInfo['album_extid'];
         }
         $jscode = "\n\t\t\t\tvar JSNISImageGrid;\n\t\t\t\tvar initImageGrid = false;\n\t\t\t\tvar baseUrl = '" . JURI::root() . "';\n\t\t\t\tvar VERSION_EDITION_NOTICE = \"" . JText::_('VERSION_EDITION_NOTICE') . "\";\n\t\t\t(function(\$){\n\t\t\t\tfunction jsnisOpenTree(child)\n\t\t\t\t{\n\t\t\t\t\tvar parent = child.parent().parent();\n\n\t\t\t\t\tif (parent.attr('id') == 'jsn-jtree-categories' || parent.attr('id') == undefined) return;\n\n\t\t\t\t\tif (parent.hasClass('secondchild'))\n\t\t\t\t\t{\n\t\t\t\t\t\tparent.parent().parent().removeClass('jsn-jtree-close').addClass('jsn-jtree-open');\n\t\t\t\t\t\tparent.removeClass('jsn-jtree-close').addClass('jsn-jtree-open');\n\t\t\t\t\t\tparent.find('>ul').css('display','block');\n\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tparent.removeClass('jsn-jtree-close').addClass('jsn-jtree-open');\n\t\t\t\t\t\tparent.find('>ul').css('display','block');\n\t\t\t\t\t\tjsnisOpenTree(parent);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfunction jsnisReshowTree(tree)\n\t\t\t\t{\n\t\t\t\t\ttree.children('li').each(function(){\n\n\t\t\t\t\t\tif (\$(this).children('ul').length)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (\$(this).hasClass('catselected'))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tjsnisOpenTree(\$(this));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tvar treeChild = \$(this).children('ul');\n\t\t\t\t\t\t\tjsnisReshowTree(treeChild);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (\$(this).hasClass('catselected'))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tjsnisOpenTree(\$(this));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t}\n\t\t\t\t\$('#dialogbox:ui-dialog').dialog('destroy');\n\t\t\t\t\$('#dialogbox2:ui-dialog').dialog('destroy');\n\t\t\t\t\$(document).ready(function ()\n\t\t\t\t{\n\t\t\t\t\t\$('#jsn_is_showlist_tabs').tabs({\n\t\t\t\t\t\tactivate: function(event, ui)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(ui.newPanel.attr('id') == 'tab-showlist-images' && !initImageGrid)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tJSNISImageGrid = \$.JSNISImageGridGetInstaces({\n\t\t\t\t\t\t\t\t\tshowListID   : '" . $items->showlist_id . "',\n\t\t\t\t\t\t\t\t\tsourceName   : '" . $items->image_source_name . "',\n\t\t\t\t\t\t\t\t\tsourceType   : '" . $items->image_source_type . "',\n\t\t\t\t\t\t\t\t\tselectMode   : '" . $imageSource->getShowlistMode() . "',\n\t\t\t\t\t\t\t\t\tpagination\t : '" . $imageSource->_source['sourceDefine']->pagination . "',\n\t\t\t\t\t\t\t\t\tlayoutHeight : 500,\n\t\t\t\t\t\t\t\t\tlayoutWidth  : '100%'\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t" . $rmcat . "\n\t\t\t\t\t\t\t\t" . $tmpjs . "\n\t\t\t\t\t\t\t\tJSNISImageGrid.initialize();\n\t\t\t\t\t\t\t\tif(!\$('.media-item').length && !\$('.jtree-selected', \$('#images')).length)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tJSNISImageGrid.cookie.set('rate_of_west', 58);\n\t\t\t\t\t\t\t\t\tJSNISImageGrid.UILayout.sizePane('west', '58%');\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\$('#jsn-jtree-categories').children('ul').each(function(){\n\t\t\t\t\t\t\t\t\t\$(this).children('li').each(function(){\n\t\t\t\t\t\t\t\t\t\t\$(this).children('ul').each(function(){\n\t\t\t\t\t\t\t\t\t\t\t\$(this).children('li').each(function(){\n\t\t\t\t\t\t\t\t\t\t\t\t\$(this).find('ul').css('display','none');\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\$('#jsn-jtree-categories').children('ul').each(function(){\n\t\t\t\t\t\t\t\t\tjsnisReshowTree(\$(this));\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tinitImageGrid = true;\n\t\t\t\t\t\t\t\tJSNISImageGrid.overrideSaveEvent();\n\t\t\t\t\t\t\t\tJSNISImageShow.getScriptCheckThumb(" . $items->showlist_id . ");\n\t\t\t\t\t\t\t\t\$(window).trigger('resize');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t})((typeof JoomlaShine != 'undefined' && typeof JoomlaShine.jQuery != 'undefined') ? JoomlaShine.jQuery : jQuery);";
         $this->_document->addScriptDeclaration($objJSNJSLanguages->loadLang());
         $this->_document->addScriptDeclaration($jscode);
         $showlistMode = $imageSource->getShowlistMode();
         $this->assignRef('selectMode', $showlistMode);
     } else {
         $jscode = "var baseUrl = '" . JURI::root() . "'";
         $this->_document->addScriptDeclaration($jscode);
     }
     if ($items->showlist_id && $items->showlist_id != '') {
         if ($objJSNImages->checkImageLimition($items->showlist_id)) {
             $msg = JText::_('SHOWLIST_YOU_HAVE_REACHED_THE_LIMITATION_OF_10_IMAGES_IN_FREE_EDITION');
             JError::raiseNotice(100, $msg);
         }
         $countImage = $objJSNImages->countImagesShowList($items->showlist_id);
         $countImage = $countImage[0];
     }
     $authorizationCombo = array('0' => array('value' => '0', 'text' => JText::_('SHOWLIST_NO_MESSAGE')), '1' => array('value' => '1', 'text' => JText::_('SHOWLIST_JOOMLA_ARTICLE')));
     $imagesLoadingOrder = array('0' => array('value' => 'forward', 'text' => JText::_('SHOWLIST_GENERAL_FORWARD')), '1' => array('value' => 'backward', 'text' => JText::_('SHOWLIST_GENERAL_BACKWARD')), '2' => array('value' => 'random', 'text' => JText::_('SHOWLIST_GENERAL_RANDOM')));
     $showExifData = array('0' => array('value' => 'no', 'text' => JText::_('SHOWLIST_SHOW_EXIF_DATA_NO')), '1' => array('value' => 'title', 'text' => JText::_('SHOWLIST_SHOW_EXIF_DATA_TITLE')), '2' => array('value' => 'description', 'text' => JText::_('SHOWLIST_SHOW_EXIF_DATA_DESCRIPTION')));
     $lists['imagesLoadingOrder'] = JHTML::_('select.genericList', $imagesLoadingOrder, 'image_loading_order', 'class="inputbox" ' . '', 'value', 'text', $items->image_loading_order);
     $lists['showExifData'] = JHTML::_('select.genericList', $showExifData, 'show_exif_data', 'class="inputbox" ' . '', 'value', 'text', $items->show_exif_data);
     $lists['authorizationCombo'] = JHTML::_('select.genericList', $authorizationCombo, 'authorization_status', 'class="inputbox" onchange="JSNISImageShow.ShowListCheckAuthorizationContent();"' . '', 'value', 'text', $items->authorization_status);
     $lists['published'] = JHTML::_('jsnselect.booleanlist', 'published', '', $items->published != '' ? $items->published : 1);
     $lists['overrideTitle'] = JHTML::_('jsnselect.booleanlist', 'override_title', '', $items->override_title);
     $lists['overrideDesc'] = JHTML::_('jsnselect.booleanlist', 'override_description', '', $items->override_description);
     $lists['overrideLink'] = JHTML::_('jsnselect.booleanlist', 'override_link', '', $items->override_link);
     $query = 'SELECT ordering AS value, showlist_title AS text' . ' FROM #__imageshow_showlist' . ' ORDER BY ordering';
     $lists['ordering'] = JHtmlList::ordering('ordering', $query, '', $items->showlist_id);
     if (!$objJSNUtils->checkEnvironmentDownload()) {
         $canAutoDownload = false;
     }
     $image_model = $this->getModel();
     $categories = $model->getTreeMenu();
     $articlesCatgories = $model->getTreeArticle();
     $this->assign('categories', $categories);
     $this->assign('articles_catgories', $articlesCatgories);
     $this->assignRef('canAutoDownload', $canAutoDownload);
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('imageSource', $imageSource);
     $this->assignRef('countImage', $countImage);
     $this->assignRef('images', $images);
     $this->assignRef('catSelected', $catid);
     $this->assignRef('albumID', $albumID);
     $this->assignRef('totalImage', $totalimage);
     $this->assignRef('msgs', $msgs);
     $this->_addAssets();
     $this->addToolbar();
     if (!$this->_checkAction()) {
         JFactory::getApplication()->redirect('index.php?option=com_imageshow&controller=showlist', JText::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED'), 'error');
         return false;
     }
     parent::display($tpl);
 }
Beispiel #6
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/localize_empresa.php';
     $state = $this->get('State');
     $canDo = Localize_empresaHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_LOCALIZE_EMPRESA_TITLE_CADASTRODEEMPRESAS'), 'cadastrodeempresas.png');
     //Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/cadastrodeempresa';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('cadastrodeempresa.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('cadastrodeempresa.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('cadastrodeempresas.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('cadastrodeempresas.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
         } else {
             if (isset($this->items[0])) {
                 //If this component does not use state then show a direct delete button as we can not trash
                 JToolBarHelper::deleteList('', 'cadastrodeempresas.delete', 'JTOOLBAR_DELETE');
             }
         }
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::archiveList('cadastrodeempresas.archive', 'JTOOLBAR_ARCHIVE');
         }
         if (isset($this->items[0]->checked_out)) {
             JToolBarHelper::custom('cadastrodeempresas.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
         }
     }
     //Show trash and delete for components that uses the state field
     if (isset($this->items[0]->state)) {
         if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
             JToolBarHelper::deleteList('', 'cadastrodeempresas.delete', 'JTOOLBAR_EMPTY_TRASH');
             JToolBarHelper::divider();
         } else {
             if ($canDo->get('core.edit.state')) {
                 JToolBarHelper::trash('cadastrodeempresas.trash', 'JTOOLBAR_TRASH');
                 JToolBarHelper::divider();
             }
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_localize_empresa');
     }
     //Set sidebar action - New in 3.0
     JHtmlSidebar::setAction('index.php?option=com_localize_empresa&view=cadastrodeempresas');
     $this->extra_sidebar = '';
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true));
     //Filter for the field corretores
     $this->extra_sidebar .= '<div class="other-filters">';
     $this->extra_sidebar .= '<small><label for="filter_corretores">Corretores</label></small>';
     $this->extra_sidebar .= JHtmlList::users('filter_corretores', $this->state->get('filter.corretores'), 1, 'onchange="this.form.submit();"');
     $this->extra_sidebar .= '</div>';
 }
 function display($tpl = null)
 {
     VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
     // Load the helper(s)
     $this->loadHelper('html');
     $layoutName = JRequest::getWord('layout');
     $model = VmModel::getModel();
     // The list of fields which can't be toggled
     //$lists['coreFields']= array( 'name','username', 'email', 'password', 'password2' );
     $lists['coreFields'] = $model->getCoreFields();
     if ($layoutName == 'edit') {
         $editor = JFactory::getEditor();
         $userField = $model->getUserfield();
         $this->SetViewTitle('USERFIELD', $userField->name);
         $this->userFieldPlugin = '';
         if ($userField->virtuemart_userfield_id < 1) {
             // Insert new userfield
             $this->assignRef('ordering', JText::_('COM_VIRTUEMART_NEW_ITEMS_PLACE'));
             $userFieldValues = array();
             $attribs = '';
             $lists['type'] = JHTML::_('select.genericlist', $this->_getTypes(), 'type', $attribs, 'type', 'text', $userField->type);
         } else {
             // Update existing userfield
             // Ordering dropdown
             $qry = 'SELECT ordering AS value, name AS text' . ' FROM #__virtuemart_userfields' . ' ORDER BY ordering';
             // $ordering = JHTML::_('list.specificordering',  $userField, $userField->virtuemart_userfield_id, $qry);
             $ordering = JHtmlList::ordering('ordering', $qry, '', $userField->virtuemart_userfield_id, 0);
             $this->assignRef('ordering', $ordering);
             $userFieldValues = $model->getUserfieldValues();
             $lists['type'] = $this->_getTypes($userField->type) . '<input id="type" type="hidden" name="type" value="' . $userField->type . '" />';
             if (strpos($userField->type, 'plugin') !== false) {
                 $this->userFieldPlugin = self::renderUserfieldPlugin(substr($userField->type, 6), $userField);
             }
         }
         JToolBarHelper::divider();
         JToolBarHelper::save();
         JToolBarHelper::apply();
         JToolBarHelper::cancel();
         $notoggle = in_array($userField->name, $lists['coreFields']) ? 'class="readonly"' : '';
         // Vendor selection
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $lists['vendors'] = ShopFunctions::renderVendorList($userField->virtuemart_vendor_id);
         }
         // 			$vendor_model = VmModel::getModel('vendor');
         // 			$vendor_list = $vendor_model->getVendors();
         // 			$lists['vendors'] = JHTML::_('select.genericlist', $vendor_list, 'virtuemart_vendor_id', '', 'virtuemart_vendor_id', 'vendor_name', $userField->virtuemart_vendor_id);
         // Shopper groups for EU VAT Id
         $shoppergroup_model = VmModel::getModel('shoppergroup');
         $shoppergroup_list = $shoppergroup_model->getShopperGroups(true);
         array_unshift($shoppergroup_list, '0');
         $lists['shoppergroups'] = JHTML::_('select.genericlist', $shoppergroup_list, 'virtuemart_shoppergroup_id', '', 'virtuemart_shoppergroup_id', 'shopper_group_name', $model->_params->get('virtuemart_shoppergroup_id'));
         // Minimum age select
         $ages = array();
         for ($i = 13; $i <= 25; $i++) {
             $ages[] = array('key' => $i, 'value' => $i . ' ' . JText::_('COM_VIRTUEMART_YEAR_S'));
         }
         $lists['minimum_age'] = JHTML::_('select.genericlist', $ages, 'minimum_age', '', 'key', 'value', $model->_params->get('minimum_age', 18));
         // Web address types
         $webaddress_types = array(array('key' => 0, 'value' => JText::_('COM_VIRTUEMART_USERFIELDS_URL_ONLY')), array('key' => 2, 'value' => JText::_('COM_VIRTUEMART_USERFIELDS_HYPERTEXT_URL')));
         $lists['webaddresstypes'] = JHTML::_('select.genericlist', $webaddress_types, 'webaddresstype', '', 'key', 'value', $model->_params->get('webaddresstype'));
         // Userfield values
         if (($n = count($userFieldValues)) < 1) {
             $lists['userfield_values'] = '<tr>' . '<td><input type="text" value="" name="vValues[0]" /></td>' . '<td><input type="text" size="50" value="" name="vNames[0]" /></td>' . '</tr>';
             $i = 1;
         } else {
             $lists['userfield_values'] = '';
             $lang = JFactory::getLanguage();
             for ($i = 0; $i < $n; $i++) {
                 $translate = $lang->hasKey($userFieldValues[$i]->fieldtitle) ? " (" . JText::_($userFieldValues[$i]->fieldtitle) . ")" : "";
                 $lists['userfield_values'] .= '<tr>' . '<td><input type="text" value="' . $userFieldValues[$i]->fieldvalue . '" name="vValues[' . $i . ']" /></td>' . '<td><input type="text" size="50" value="' . $userFieldValues[$i]->fieldtitle . '" name="vNames[' . $i . ']"   />' . $translate . '<input type="button" class="button deleteRow" value=" - " /></td>' . '</tr>';
             }
         }
         $this->assignRef('valueCount', --$i);
         // 			vmdebug('$userField->shipment',$userField);
         // Toggles
         $lists['required'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_FIELDMANAGER_REQUIRED', 'required', $userField->required, $notoggle);
         $lists['published'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_PUBLISHED', 'published', $userField->published, $notoggle);
         $lists['registration'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_ON_REGISTRATION', 'registration', $userField->registration, $notoggle);
         $lists['shipment'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_ON_SHIPPING', 'shipment', $userField->shipment, $notoggle);
         $lists['account'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_ON_ACCOUNT', 'account', $userField->account, $notoggle);
         $lists['readonly'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_USERFIELDS_READONLY', 'readonly', $userField->readonly, $notoggle);
         $this->lists = $lists;
         $this->userField = $userField;
         $this->userFieldValues = $userFieldValues;
         $this->editor = $editor;
     } else {
         if (JRequest::getWord('format', '') === 'raw') {
             $tpl = 'results';
         } else {
             JToolBarHelper::title(JText::_('COM_VIRTUEMART_MANAGE_USER_FIELDS'));
             JToolBarHelper::custom('toggle.registration.1', 'publish', '', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_REGISTRATION');
             JToolBarHelper::custom('toggle.registration.0', 'unpublish', '', 'COM_VIRTUEMART_FIELDMANAGER_HIDE_REGISTRATION');
             JToolBarHelper::custom('toggle.shipment.1', 'publish', '', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_SHIPPING');
             JToolBarHelper::custom('toggle.shipment.0', 'unpublish', '', 'COM_VIRTUEMART_FIELDMANAGER_HIDE_SHIPPING');
             JToolBarHelper::custom('toggle.account.1', 'publish', '', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_ACCOUNT');
             JToolBarHelper::custom('toggle.account.0', 'unpublish', '', 'COM_VIRTUEMART_FIELDMANAGER_HIDE_ACCOUNT');
             JToolBarHelper::divider();
             // JToolBarHelper::deleteList();
             JToolBarHelper::custom('toggle.required.1', 'publish', '', 'COM_VIRTUEMART_FIELDMANAGER_REQUIRE');
             JToolBarHelper::custom('toggle.required.0', 'unpublish', '', 'COM_VIRTUEMART_FIELDMANAGER_UNREQUIRE');
             $this->addStandardDefaultViewCommands();
         }
         $this->addStandardDefaultViewLists($model, 'ordering', 'ASC');
         $this->userfieldsList = $model->getUserfieldsList();
         $this->pagination = $model->getPagination();
     }
     $this->lists['coreFields'] = $lists['coreFields'];
     parent::display($tpl);
     if ($tpl === 'results') {
         echo $this->AjaxScripts();
     }
 }
Beispiel #8
0
 function getOrdering($item)
 {
     $query = 'SELECT ordering AS value, title AS text' . ' FROM #__jav_forums' . ' ORDER BY ordering';
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $neworder = 0;
         if (is_object($item)) {
             $item = $item->ordering;
         }
         if (isset($item->id)) {
             $neworder = 0;
         } else {
             if ($neworder) {
                 $neworder = 1;
             } else {
                 $neworder = -1;
             }
         }
         return JHtmlList::ordering('ordering', $query, '', $item, $neworder);
     } else {
         return JHTML::_('list.specificordering', $item, $item->id, $query);
     }
 }
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/einsatzkomponente.php';
     $state = $this->get('State');
     $canDo = EinsatzkomponenteHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_EINSATZKOMPONENTE_TITLE_EINSATZBILDMANAGER'), 'einsatzbildmanager.png');
     //Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/einsatzbilderbearbeiten';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('einsatzbilderbearbeiten.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('einsatzbilderbearbeiten.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('einsatzbildmanager.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('einsatzbildmanager.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
         } else {
             if (isset($this->items[0])) {
                 //If this component does not use state then show a direct delete button as we can not trash
                 JToolBarHelper::deleteList('', 'einsatzbildmanager.delete', 'JTOOLBAR_DELETE');
             }
         }
         //            if (isset($this->items[0]->state)) {
         //			    JToolBarHelper::divider();
         //			    JToolBarHelper::archiveList('einsatzbildmanager.archive','JTOOLBAR_ARCHIVE');
         //            }
         if (isset($this->items[0]->checked_out)) {
             JToolBarHelper::custom('einsatzbildmanager.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
         }
     }
     JToolBarHelper::custom('einsatzbildmanager.thumb', 'edit', 'edit', 'Thumbs erstellen', true);
     JToolBarHelper::custom('einsatzbildmanager.repid', 'upload', 'upload', 'Flash Uploader', false);
     //Show trash and delete for components that uses the state field
     if (isset($this->items[0]->state)) {
         if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
             JToolBarHelper::deleteList('', 'einsatzbildmanager.delete', 'JTOOLBAR_EMPTY_TRASH');
             JToolBarHelper::divider();
         } else {
             if ($canDo->get('core.edit.state')) {
                 //JToolBarHelper::trash('einsatzbildmanager.trash','JTOOLBAR_TRASH');
                 JToolBarHelper::deleteList('', 'einsatzbildmanager.delete', 'JTOOLBAR_DELETE');
                 JToolBarHelper::divider();
             }
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_einsatzkomponente');
     }
     //Set sidebar action - New in 3.0
     JHtmlSidebar::setAction('index.php?option=com_einsatzkomponente&view=einsatzbildmanager');
     //Filter for the field created_by
     $this->extra_sidebar .= '<small><label for="filter_created_by">Created by</label></small>';
     $this->extra_sidebar .= JHtmlList::users('filter_created_by', $this->state->get('filter.created_by'), 1, 'onchange="this.form.submit();"');
     $options = '';
     $options[] = JHtml::_('select.option', '1', 'JPUBLISHED');
     $options[] = JHtml::_('select.option', '0', 'JUNPUBLISHED');
     $options[] = JHtml::_('select.option', '*', 'JALL');
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.state'), true));
     $this->extra_sidebar = '';
 }
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/einsatzkomponente.php';
     $state = $this->get('State');
     $canDo = EinsatzkomponenteHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_EINSATZKOMPONENTE_TITLE_EINSATZBERICHTE'), 'einsatzberichte.png');
     //Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/einsatzbericht';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('einsatzbericht.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('einsatzbericht.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('einsatzberichte.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('einsatzberichte.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
         } else {
             if (isset($this->items[0])) {
                 //If this component does not use state then show a direct delete button as we can not trash
                 JToolBarHelper::deleteList('', 'einsatzberichte.delete', 'JTOOLBAR_DELETE');
             }
         }
         if (isset($this->items[0]->checked_out)) {
             JToolBarHelper::custom('einsatzberichte.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
         }
     }
     //Show trash and delete for components that uses the state field
     if (isset($this->items[0]->state)) {
         if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
             JToolBarHelper::deleteList('', 'einsatzberichte.delete', 'JTOOLBAR_EMPTY_TRASH');
             JToolBarHelper::divider();
         } else {
             if ($canDo->get('core.edit.state')) {
                 //JToolBarHelper::trash('einsatzberichte.trash','JTOOLBAR_TRASH');
                 JToolBarHelper::deleteList('', 'einsatzberichte.delete', 'JTOOLBAR_DELETE');
                 JToolBarHelper::divider();
             }
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_einsatzkomponente');
         if ($this->params->get('send_mail_backend', '0')) {
             JToolBarHelper::custom('einsatzberichte.sendMail', 'edit', 'edit', 'Als Mail versenden', true);
         }
     }
     $version = new JVersion();
     if ($version->isCompatible('3.0')) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::custom('einsatzberichte.article', 'edit', 'edit', 'Als Artikel erstellen', true);
         }
         JToolBarHelper::custom('einsatzberichte.pdf', 'upload', 'upload', 'Als PDF exportieren', true);
     }
     if ($canDo->get('core.create')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::archiveList('einsatzberichte.archive', 'Als Folgeeinsatz markieren');
         }
     }
     //Set sidebar action - New in 3.0
     JHtmlSidebar::setAction('index.php?option=com_einsatzkomponente&view=einsatzberichte');
     $this->extra_sidebar = '';
     //Filter for the field auswahl_orga;
     jimport('joomla.form.form');
     $options = array();
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     $form = JForm::getInstance('com_einsatzkomponente.einsatzbericht', 'einsatzbericht');
     $field = $form->getField('auswahl_orga');
     $query = $form->getFieldAttribute('filter_auswahl_orga', 'query');
     $translate = $form->getFieldAttribute('filter_auswahl_orga', 'translate');
     $key = $form->getFieldAttribute('filter_auswahl_orga', 'key_field');
     $value = $form->getFieldAttribute('filter_auswahl_orga', 'value_field');
     // Get the database object.
     $db = JFactory::getDBO();
     // Set the query and get the result list.
     $db->setQuery($query);
     $items = $db->loadObjectlist();
     // Build the field options.
     if (!empty($items)) {
         foreach ($items as $item) {
             if ($translate == true) {
                 $options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value}));
             } else {
                 $options[] = JHtml::_('select.option', $item->{$key}, $item->{$value});
             }
         }
     }
     JHtmlSidebar::addFilter('$auswahl_orga', 'filter_auswahl_orga', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.auswahl_orga')), true);
     //Filter for the field tickerkat;
     jimport('joomla.form.form');
     $options = array();
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     $form = JForm::getInstance('com_einsatzkomponente.einsatzbericht', 'einsatzbericht');
     $field = $form->getField('tickerkat');
     $query = $form->getFieldAttribute('filter_tickerkat', 'query');
     $translate = $form->getFieldAttribute('filter_tickerkat', 'translate');
     $key = $form->getFieldAttribute('filter_tickerkat', 'key_field');
     $value = $form->getFieldAttribute('filter_tickerkat', 'value_field');
     // Get the database object.
     $db = JFactory::getDBO();
     // Set the query and get the result list.
     $db->setQuery($query);
     $items = $db->loadObjectlist();
     // Build the field options.
     if (!empty($items)) {
         foreach ($items as $item) {
             if ($translate == true) {
                 $options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value}));
             } else {
                 $options[] = JHtml::_('select.option', $item->{$key}, $item->{$value});
             }
         }
     }
     JHtmlSidebar::addFilter('$tickerkat', 'filter_tickerkat', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.tickerkat')), true);
     //Filter for the field data1;
     jimport('joomla.form.form');
     $options = array();
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     $form = JForm::getInstance('com_einsatzkomponente.einsatzbericht', 'einsatzbericht');
     $field = $form->getField('data1');
     $query = $form->getFieldAttribute('filter_data1', 'query');
     $translate = $form->getFieldAttribute('filter_data1', 'translate');
     $key = $form->getFieldAttribute('filter_data1', 'key_field');
     $value = $form->getFieldAttribute('filter_data1', 'value_field');
     // Get the database object.
     $db = JFactory::getDBO();
     // Set the query and get the result list.
     $db->setQuery($query);
     $items = $db->loadObjectlist();
     // Build the field options.
     if (!empty($items)) {
         foreach ($items as $item) {
             if ($translate == true) {
                 $options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value}));
             } else {
                 $options[] = JHtml::_('select.option', $item->{$key}, $item->{$value});
             }
         }
     }
     JHtmlSidebar::addFilter('$data1', 'filter_data1', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.data1')), true);
     //Filter for the field alerting;
     jimport('joomla.form.form');
     $options = array();
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     $form = JForm::getInstance('com_einsatzkomponente.einsatzbericht', 'einsatzbericht');
     $field = $form->getField('alerting');
     $query = $form->getFieldAttribute('filter_alerting', 'query');
     $translate = $form->getFieldAttribute('filter_alerting', 'translate');
     $key = $form->getFieldAttribute('filter_alerting', 'key_field');
     $value = $form->getFieldAttribute('filter_alerting', 'value_field');
     // Get the database object.
     $db = JFactory::getDBO();
     // Set the query and get the result list.
     $db->setQuery($query);
     $items = $db->loadObjectlist();
     // Build the field options.
     if (!empty($items)) {
         foreach ($items as $item) {
             if ($translate == true) {
                 $options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value}));
             } else {
                 $options[] = JHtml::_('select.option', $item->{$key}, $item->{$value});
             }
         }
     }
     JHtmlSidebar::addFilter('$alerting', 'filter_alerting', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.alerting')), true);
     //Filter for the field date1
     $this->extra_sidebar .= '<div class="div_side_filter">';
     $this->extra_sidebar .= '<small><label for="filter_from_date1">ab Datum</label></small>';
     $this->extra_sidebar .= JHtml::_('calendar', $this->state->get('filter.date1.from'), 'filter_from_date1', 'filter_from_date1', '%Y-%m-%d', array('style' => 'width:142px;', 'onchange' => 'this.form.submit();'));
     $this->extra_sidebar .= '<small><label for="filter_to_date1">bis Datum</label></small>';
     $this->extra_sidebar .= JHtml::_('calendar', $this->state->get('filter.date1.to'), 'filter_to_date1', 'filter_to_date1', '%Y-%m-%d', array('style' => 'width:142px;', 'onchange' => 'this.form.submit();'));
     $this->extra_sidebar .= '<hr class="hr-condensed">';
     $this->extra_sidebar .= '</div>';
     $options = '';
     $options[] = JHtml::_('select.option', '1', 'JPUBLISHED');
     $options[] = JHtml::_('select.option', '0', 'JUNPUBLISHED');
     $options[] = JHtml::_('select.option', '2', 'Folgeeinsatz');
     $options[] = JHtml::_('select.option', '*', 'JALL');
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.state'), true));
     //Filter for the field created_by
     $this->extra_sidebar .= '<div class="div_side_filter">';
     $this->extra_sidebar .= '<small><label for="filter_created_by">Erstellt von</label></small>';
     $this->extra_sidebar .= JHtmlList::users('filter_created_by', $this->state->get('filter.created_by'), 1, 'onchange="this.form.submit();"');
     $this->extra_sidebar .= '</div>';
 }