[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/administrator/components/com_menus/views/item/ -> view.php (source)

   1  <?php
   2  /**
   3  * @version        $Id: view.php 14401 2010-01-26 14:10:00Z louis $
   4  * @package        Joomla
   5  * @subpackage    Menus
   6  * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7  * @license        GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // no direct access
  16  defined( '_JEXEC' ) or die( 'Restricted access' );
  17  
  18  jimport('joomla.application.component.view');
  19  jimport('joomla.html.pane');
  20  
  21  /**
  22   * @package        Joomla
  23   * @subpackage    Menus
  24   * @since 1.5
  25   */
  26  class MenusViewItem extends JView
  27  {
  28      var $_name = 'item';
  29  
  30  	function edit($tpl = null)
  31      {
  32          JRequest::setVar( 'hidemainmenu', 1 );
  33  
  34          global $mainframe;
  35  
  36          $lang =& JFactory::getLanguage();
  37          $this->_layout = 'form';
  38  
  39          $item = &$this->get('Item');
  40  
  41          // clean item data
  42          JFilterOutput::objectHTMLSafe( $item, ENT_QUOTES, '' );
  43  
  44          // Set toolbar items for the page
  45          if (!$item->id) {
  46              JToolBarHelper::title( JText::_( 'Menu Item' ) .': <small><small>[ '. JText::_( 'New' ) .' ]</small></small>', 'menu.png' );
  47          } else {
  48              JToolBarHelper::title( JText::_( 'Menu Item' ) .': <small><small>[ '. JText::_( 'Edit' ) .' ]</small></small>', 'menu.png' );
  49          }
  50          JToolBarHelper::save();
  51          JToolBarHelper::apply();
  52          if ($item->id) {
  53              // for existing items the button is renamed `close`
  54              JToolBarHelper::cancel( 'cancelItem', 'Close' );
  55          } else {
  56              JToolBarHelper::cancel('cancelItem');
  57          }
  58          JToolBarHelper::help( 'screen.menus.edit' );
  59  
  60          // Load component language files
  61          $component        = &$this->get('Component');
  62          $lang->load($component->option, JPATH_ADMINISTRATOR);
  63  
  64          // Initialize variables
  65          $urlparams        = $this->get( 'UrlParams' );
  66          $params            = $this->get( 'StateParams' );
  67          $sysparams        = $this->get( 'SystemParams' );
  68          $advanced        = $this->get( 'AdvancedParams' );
  69          $component        = $this->get( 'ComponentParams' );
  70          $name            = $this->get( 'StateName' );
  71          $description    = $this->get( 'StateDescription' );
  72          $menuTypes         = MenusHelper::getMenuTypeList();
  73          $components        = MenusHelper::getComponentList();
  74  
  75          JHTML::_('behavior.tooltip');
  76  
  77          $document = & JFactory::getDocument();
  78          if ($item->id) {
  79              $document->setTitle(JText::_( 'Menu Item' ) .': ['. JText::_( 'Edit' ) .']');
  80          } else {
  81              $document->setTitle(JText::_( 'Menu Item' ) .': ['. JText::_( 'New' ) .']');
  82          }
  83  
  84          // Was showing up null in some cases....
  85          if (!$item->published) {
  86              $item->published = 0;
  87          }
  88          $lists = new stdClass();
  89          $lists->published = MenusHelper::Published($item);
  90          $lists->disabled = ($item->type != 'url' ? 'readonly="true"' : '');
  91  
  92          $item->expansion = null;
  93          if ($item->type != 'url') {
  94              $lists->disabled = 'readonly="true"';
  95              $item->linkfield = '<input type="hidden" name="link" value="'.$item->link.'" />';
  96              if (($item->id) && ($item->type == 'component') && (isset($item->linkparts['option']))) {
  97                  $item->expansion = '&amp;expand='.trim(str_replace('com_', '', $item->linkparts['option']));
  98              }
  99          } else {
 100              $lists->disabled = null;
 101              $item->linkfield = null;
 102          }
 103  
 104          $this->assignRef('lists'    , $lists);
 105          $this->assignRef('item'        , $item);
 106          $this->assignRef('urlparams', $urlparams);
 107          $this->assignRef('sysparams', $sysparams);
 108          $this->assignRef('params'    , $params);
 109          $this->assignRef('advanced'    , $advanced);
 110          $this->assignRef('comp'        , $component);
 111          $this->assignRef('menutypes', $menuTypes);
 112          $this->assignRef('name'        , $name);
 113          $this->assignRef('description', $description);
 114  
 115          // Add slider pane
 116          // TODO: allowAllClose should default true in J!1.6, so remove the array when it does.
 117          $pane = &JPane::getInstance('sliders', array('allowAllClose' => true));
 118          $this->assignRef('pane', $pane);
 119  
 120          parent::display($tpl);
 121      }
 122  
 123  	function type($tpl = null)
 124      {
 125          JRequest::setVar( 'hidemainmenu', 1 );
 126  
 127          global $mainframe;
 128  
 129          $lang =& JFactory::getLanguage();
 130          $this->_layout = 'type';
 131  
 132          $item = &$this->get('Item');
 133  
 134          // Set toolbar items for the page
 135          if (!$item->id) {
 136              JToolBarHelper::title(  JText::_( 'Menu Item' ) .': <small><small>[ '. JText::_( 'New' ) .' ]</small></small>', 'menu.png' );
 137          } else {
 138              JToolBarHelper::title(  JText::_( 'Change Menu Item' ), 'menu.png' );
 139          }
 140  
 141          // Set toolbar items for the page
 142          JToolBarHelper::cancel('view');
 143          JToolBarHelper::help( 'screen.menus.edit' );
 144  
 145          // Add scripts and stylesheets to the document
 146          $document    = & JFactory::getDocument();
 147  
 148          if($lang->isRTL()){
 149              $document->addStyleSheet('components/com_menus/assets/type_rtl.css');
 150          } else {
 151              $document->addStyleSheet('components/com_menus/assets/type.css');
 152          }
 153          JHTML::_('behavior.tooltip');
 154  
 155          // Load component language files
 156          $components    = MenusHelper::getComponentList();
 157          $n = count($components);
 158          for($i = 0; $i < $n; $i++)
 159          {
 160              $path = JPATH_SITE.DS.'components'.DS.$components[$i]->option.DS.'views';
 161              $components[$i]->legacy = !is_dir($path);
 162  
 163              $lang->load($components[$i]->option, JPATH_ADMINISTRATOR);
 164          }
 165  
 166          // Initialize variables
 167          $item            = &$this->get('Item');
 168          $expansion        = &$this->get('Expansion');
 169          $component        = &$this->get('Component');
 170          $name            = $this->get( 'StateName' );
 171          $description    = $this->get( 'StateDescription' );
 172          $menuTypes         = MenusHelper::getMenuTypeList();
 173  
 174          // Set document title
 175          if ($item->id) {
 176              $document->setTitle(JText::_( 'Menu Item' ) .': ['. JText::_( 'Edit' ) .']');
 177          } else {
 178              $document->setTitle(JText::_( 'Menu Item' ) .': ['. JText::_( 'New' ) .']');
 179          }
 180  
 181          $this->assignRef('item',        $item);
 182          $this->assignRef('components',    $components);
 183          $this->assignRef('expansion',    $expansion);
 184  
 185          parent::display($tpl);
 186      }
 187  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1