コード例 #1
0
 function extraFields()
 {
     $k2Path = JPATH_ADMINISTRATOR . '/components/com_k2/';
     JTable::addIncludePath($k2Path . 'tables');
     require_once $k2Path . 'models/model.php';
     require_once $k2Path . 'models/category.php';
     require_once $k2Path . 'models/extrafield.php';
     $mainframe = JFactory::getApplication();
     $itemID = JRequest::getInt('id', NULL);
     //$categoryModel = $this->getModel('category');
     $categoryModel = new K2ModelCategory();
     $category = $categoryModel->getData();
     //$extraFieldModel = $this->getModel('extraField');
     $extraFieldModel = new K2ModelExtraField();
     $extraFields = $extraFieldModel->getExtraFieldsByGroup($category->extraFieldsGroup);
     $output = '<table class="admintable" id="extraFields">';
     $counter = 0;
     if (count($extraFields)) {
         foreach ($extraFields as $extraField) {
             if ($extraField->type == 'header') {
                 $output .= '<tr><td colspan="2" ><h4 class="k2ExtraFieldHeader">' . $extraField->name . '</h4></td></tr>';
             } else {
                 $output .= '<tr><td align="right" class="key"><label for="K2ExtraField_' . $extraField->id . '">' . $extraField->name . '</label></td>';
                 $html = $extraFieldModel->renderExtraField($extraField, $itemID);
                 if ($extraField->type == 'textfield') {
                     $html2 = $this->renderField($itemID, $extraField);
                     if ($html2) {
                         $html = $html2;
                     }
                 }
                 $output .= '<td>' . $html . '</td></tr>';
             }
             $counter++;
         }
     }
     $output .= '</table>';
     if ($counter == 0) {
         $output = JText::_('K2_THIS_CATEGORY_DOESNT_HAVE_ASSIGNED_EXTRA_FIELDS');
     }
     echo $output;
     $mainframe->close();
 }
コード例 #2
0
ファイル: view.html.php プロジェクト: vuchannguyen/dayhoc
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $user =& JFactory::getUser();
     $option = JRequest::getCmd('option');
     $view = JRequest::getCmd('view');
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int');
     $filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', 'c.ordering', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $filter_trash = $mainframe->getUserStateFromRequest($option . $view . 'filter_trash', 'filter_trash', 0, 'int');
     $filter_category = $mainframe->getUserStateFromRequest($option . $view . 'filter_category', 'filter_category', 0, 'int');
     $filter_state = $mainframe->getUserStateFromRequest($option . $view . 'filter_state', 'filter_state', -1, 'int');
     $language = $mainframe->getUserStateFromRequest($option . $view . 'language', 'language', '', 'string');
     $search = $mainframe->getUserStateFromRequest($option . $view . 'search', 'search', '', 'string');
     $search = JString::strtolower($search);
     $model =& $this->getModel();
     $total = $model->getTotal();
     if ($limitstart > $total - $limit) {
         $limitstart = max(0, (int) (ceil($total / $limit) - 1) * $limit);
         JRequest::setVar('limitstart', $limitstart);
     }
     $categories = $model->getData();
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'category.php';
     $categoryModel = new K2ModelCategory();
     $params =& JComponentHelper::getParams('com_k2');
     $this->assignRef('params', $params);
     if ($params->get('showItemsCounterAdmin')) {
         for ($i = 0; $i < sizeof($categories); $i++) {
             $categories[$i]->numOfItems = $categoryModel->countCategoryItems($categories[$i]->id);
             $categories[$i]->numOfTrashedItems = $categoryModel->countCategoryItems($categories[$i]->id, 1);
         }
     }
     $this->assignRef('rows', $categories);
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $this->assignRef('page', $pageNav);
     $lists = array();
     $lists['search'] = $search;
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     $filter_trash_options[] = JHTML::_('select.option', 0, JText::_('K2_CURRENT'));
     $filter_trash_options[] = JHTML::_('select.option', 1, JText::_('K2_TRASHED'));
     $lists['trash'] = JHTML::_('select.genericlist', $filter_trash_options, 'filter_trash', '', 'value', 'text', $filter_trash);
     $filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE'));
     $filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED'));
     $filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED'));
     $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state);
     $categoriesModel = JModel::getInstance('Categories', 'K2Model');
     $categories_option[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_CATEGORY'));
     $categoriesFilter = $categoriesModel->categoriesTree(NULL, true, false);
     $categories_options = @array_merge($categories_option, $categoriesFilter);
     $lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'filter_category', '', 'value', 'text', $filter_category);
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $languages = JHTML::_('contentlanguage.existing', true, true);
         array_unshift($languages, JHTML::_('select.option', '', JText::_('K2_SELECT_LANGUAGE')));
         $lists['language'] = JHTML::_('select.genericlist', $languages, 'language', '', 'value', 'text', $language);
     }
     $this->assignRef('lists', $lists);
     JToolBarHelper::title(JText::_('K2_CATEGORIES'), 'k2.png');
     if ($filter_trash == 1) {
         JToolBarHelper::custom('restore', 'restore.png', 'restore_f2.png', 'K2_RESTORE', true);
         JToolBarHelper::deleteList('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_CATEGORIES', 'remove', 'K2_DELETE');
     } else {
         JToolBarHelper::publishList();
         JToolBarHelper::unpublishList();
         JToolBarHelper::customX('move', 'move.png', 'move_f2.png', 'K2_MOVE');
         JToolBarHelper::customX('copy', 'copy.png', 'copy_f2.png', 'K2_COPY');
         JToolBarHelper::editList();
         JToolBarHelper::addNew();
         JToolBarHelper::trash('trash');
     }
     if (K2_JVERSION == '16') {
         JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS');
     } else {
         $toolbar =& JToolBar::getInstance('toolbar');
         $toolbar->appendButton('Popup', 'config', 'Parameters', 'index.php?option=com_k2&view=settings');
     }
     $this->loadHelper('html');
     K2HelperHTML::subMenu();
     $this->assignRef('filter_trash', $filter_trash);
     $template = $mainframe->getTemplate();
     $this->assignRef('template', $template);
     $ordering = ($this->lists['order'] == 'c.ordering' || $this->lists['order'] == 'c.parent, c.ordering') && !$this->filter_trash;
     $this->assignRef('ordering', $ordering);
     parent::display($tpl);
 }
コード例 #3
0
ファイル: view.html.php プロジェクト: Gskflute/joomla25
 /**
  *  view display method
  * @return void
  **/
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('COM_K2IMPORT_TITLE'), 'generic.png');
     k2importToolbarHelper::upload();
     k2importToolbarHelper::export();
     k2importToolbarHelper::instructions();
     $document =& JFactory::getDocument();
     $document->addStyleSheet('components/com_k2import/css/k2import.css');
     $document->addScript('../media/system/js/modal.js');
     $document->addStyleSheet('../media/system/css/modal.css');
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         JHtml::_('behavior.framework', true);
         JHTML::_('behavior.modal');
         jimport('joomla.html.html.behavior');
     }
     //TODO shouldn't this go to the .js file?
     $js = "\n\t\twindow.addEvent('domready', function(){\n\t\t\t\t\$('browseSrv').addEvent('click', function(e){\n\t\t\te = new Event(e).stop();\n\t\t\tSqueezeBox.initialize();\n\t\t\tSqueezeBox.fromElement(this, {\n\t\t\t\thandler: 'iframe',\n\t\t\t\turl: '" . JURI::base() . "index.php?option=com_k2import&view=item&task=filebrowser&type=text&tmpl=component',\n\t\t\t\tsize: {x: 590, y: 400}\n\t\t\t});\n\t\t})\n\t\t\n\t\t\n\t\t\$('k2ResetButton').addEvent('click', function(e){\n\t\t\te.preventDefault();\n\t\t\t\$('adminForm').search.value = '';\n\t\t\t\$('adminForm').filter_trash.options[0].selected = true;\n\t\t\t\$('adminForm').filter_state.options[0].selected = true;\n\t\t\t\$('adminForm').language.options[0].selected = true;\t\t\n\t\t\t\$('adminForm').action = 'index.php';\n\t\t\t\$('adminForm').task.value = ''; \n\t\t\tthis.form.submit();\n\t\t\t});\n\t\n\t\t\$('k2SubmitButton').addEvent('click', function(e){\t\n\t\t\t\$('adminForm').action = 'index.php';\n\t\t\t\$('adminForm').task.value = ''; \n\t\t\tthis.form.submit();\n\t\t\t});\n\t\t\n\t\t\n\t\t});\n\t\t";
     $document->addScriptDeclaration($js);
     //---------------------------------------
     //the pieces starting from here is taken from K2:
     //administrator/components/com_k2/views/categories/view.html.php
     /**
      * @version		$Id: view.html.php 1112 2011-10-11 14:34:53Z lefteris.kavadas $
      * @package		K2
      * @author		JoomlaWorks http://www.joomlaworks.gr
      * @copyright	Copyright (c) 2006 - 2011 JoomlaWorks Ltd. All rights reserved.
      * @license		GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
      */
     //Artur Neumann www.individual-it.net info@individual-it.net  29.02.2012
     //changed all K2_* textes
     $mainframe =& JFactory::getApplication();
     $user =& JFactory::getUser();
     $option = JRequest::getCmd('option');
     $view = JRequest::getCmd('view');
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int');
     $filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', 'c.ordering', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $filter_trash = $mainframe->getUserStateFromRequest($option . $view . 'filter_trash', 'filter_trash', 0, 'int');
     $filter_category = $mainframe->getUserStateFromRequest($option . $view . 'filter_category', 'filter_category', 0, 'int');
     $filter_state = $mainframe->getUserStateFromRequest($option . $view . 'filter_state', 'filter_state', -1, 'int');
     $language = $mainframe->getUserStateFromRequest($option . $view . 'language', 'language', '', 'string');
     $search = $mainframe->getUserStateFromRequest($option . $view . 'search', 'search', '', 'string');
     $search = JString::strtolower($search);
     //Artur Neumann www.individual-it.net info@individual-it.net  21.02.2012
     //importing the model directly
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'categories.php';
     //Artur Neumann www.individual-it.net info@individual-it.net  21.02.2012
     //$model = & $this->getModel(); doesn't work for us so we take it directly
     $model = new K2ModelCategories();
     $categories = $model->getData();
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'category.php';
     $categoryModel = new K2ModelCategory();
     $params =& JComponentHelper::getParams('com_k2');
     $this->assignRef('params', $params);
     if ($params->get('showItemsCounterAdmin')) {
         for ($i = 0; $i < sizeof($categories); $i++) {
             $categories[$i]->numOfItems = $categoryModel->countCategoryItems($categories[$i]->id);
         }
     }
     $this->assignRef('rows', $categories);
     $total = $model->getTotal();
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $this->assignRef('page', $pageNav);
     $lists = array();
     $lists['search'] = $search;
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     $filter_trash_options[] = JHTML::_('select.option', 0, JText::_('COM_K2IMPORT_CURRENT'));
     $filter_trash_options[] = JHTML::_('select.option', 1, JText::_('COM_K2IMPORT_TRASHED'));
     $lists['trash'] = JHTML::_('select.genericlist', $filter_trash_options, 'filter_trash', '', 'value', 'text', $filter_trash);
     $filter_state_options[] = JHTML::_('select.option', -1, JText::_('COM_K2IMPORT_SELECT_STATE'));
     $filter_state_options[] = JHTML::_('select.option', 1, JText::_('COM_K2IMPORT_PUBLISHED'));
     $filter_state_options[] = JHTML::_('select.option', 0, JText::_('COM_K2IMPORT_UNPUBLISHED'));
     $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state);
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $languages = JHTML::_('contentlanguage.existing', true, true);
         array_unshift($languages, JHTML::_('select.option', '', JText::_('COM_K2IMPORT_SELECT_LANGUAGE')));
         $lists['language'] = JHTML::_('select.genericlist', $languages, 'language', '', 'value', 'text', $language);
     }
     $this->assignRef('lists', $lists);
     //Artur Neumann www.individual-it.net info@individual-it.net 20.02.2012
     //deleted K2 toolbar because not needed in my extension
     $this->assignRef('filter_trash', $filter_trash);
     $template = $mainframe->getTemplate();
     $this->assignRef('template', $template);
     $ordering = ($this->lists['order'] == 'c.ordering' || $this->lists['order'] == 'c.parent, c.ordering') && !$this->filter_trash;
     $this->assignRef('ordering', $ordering);
     //
     parent::display($tpl);
 }
コード例 #4
0
ファイル: view.html.php プロジェクト: navinpai/GEC-Tandav
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $user =& JFactory::getUser();
     $option = JRequest::getCmd('option');
     $view = JRequest::getCmd('view');
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int');
     $filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', '', 'string');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $filter_trash = $mainframe->getUserStateFromRequest($option . $view . 'filter_trash', 'filter_trash', 0, 'int');
     $filter_category = $mainframe->getUserStateFromRequest($option . $view . 'filter_category', 'filter_category', 0, 'int');
     $filter_state = $mainframe->getUserStateFromRequest($option . $view . 'filter_state', 'filter_state', -1, 'int');
     $search = $mainframe->getUserStateFromRequest($option . $view . 'search', 'search', '', 'string');
     $search = JString::strtolower($search);
     $model =& $this->getModel();
     $categories = $model->getData();
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'category.php';
     $categoryModel = new K2ModelCategory();
     $params =& JComponentHelper::getParams('com_k2');
     $this->assignRef('params', $params);
     if ($params->get('showItemsCounterAdmin')) {
         for ($i = 0; $i < sizeof($categories); $i++) {
             $categories[$i]->numOfItems = $categoryModel->countCategoryItems($categories[$i]->id);
         }
     }
     $this->assignRef('rows', $categories);
     $total = $model->getTotal();
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $this->assignRef('page', $pageNav);
     $lists = array();
     $lists['search'] = $search;
     if (!$filter_order) {
         $filter_order = "c.parent, c.ordering";
     }
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     $filter_trash_options[] = JHTML::_('select.option', 0, JText::_('Current'));
     $filter_trash_options[] = JHTML::_('select.option', 1, JText::_('Trashed'));
     $lists['trash'] = JHTML::_('select.genericlist', $filter_trash_options, 'filter_trash', 'onchange="this.form.submit();"', 'value', 'text', $filter_trash);
     $filter_state_options[] = JHTML::_('select.option', -1, JText::_('-- Select State --'));
     $filter_state_options[] = JHTML::_('select.option', 1, JText::_('Published'));
     $filter_state_options[] = JHTML::_('select.option', 0, JText::_('Unpublished'));
     $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', 'onchange="this.form.submit();"', 'value', 'text', $filter_state);
     $this->assignRef('lists', $lists);
     JToolBarHelper::title(JText::_('Categories'));
     if ($filter_trash == 1) {
         JToolBarHelper::custom('restore', 'restore.png', 'restore_f2.png', JText::_('Restore'), true);
         JToolBarHelper::deleteList(JText::_('Are you sure you want to delete selected categories?'), 'remove', JText::_('Delete'));
     } else {
         JToolBarHelper::publishList();
         JToolBarHelper::unpublishList();
         JToolBarHelper::editList();
         JToolBarHelper::addNew();
         JToolBarHelper::trash('trash');
     }
     JToolBarHelper::preferences('com_k2', '500', '600');
     JSubMenuHelper::addEntry(JText::_('Dashboard'), 'index.php?option=com_k2');
     JSubMenuHelper::addEntry(JText::_('Items'), 'index.php?option=com_k2&view=items');
     JSubMenuHelper::addEntry(JText::_('Categories'), 'index.php?option=com_k2&view=categories', true);
     JSubMenuHelper::addEntry(JText::_('Tags'), 'index.php?option=com_k2&view=tags');
     JSubMenuHelper::addEntry(JText::_('Comments'), 'index.php?option=com_k2&view=comments');
     if ($user->gid > 23) {
         JSubMenuHelper::addEntry(JText::_('Users'), 'index.php?option=com_k2&view=users');
         JSubMenuHelper::addEntry(JText::_('User Groups'), 'index.php?option=com_k2&view=userGroups');
         JSubMenuHelper::addEntry(JText::_('Extra Fields'), 'index.php?option=com_k2&view=extraFields');
         JSubMenuHelper::addEntry(JText::_('Extra Field Groups'), 'index.php?option=com_k2&view=extraFieldsGroups');
         JSubMenuHelper::addEntry(JText::_('Information'), 'index.php?option=com_k2&view=info');
     }
     $this->assignRef('filter_trash', $filter_trash);
     parent::display($tpl);
 }