[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/administrator/components/com_menus/newsfeed_link/ -> newsfeed_link.class.php (source)

   1  <?php
   2  /**
   3  * @version $Id: newsfeed_link.class.php 5047 2006-09-14 13:49:01Z friesengeist $
   4  * @package Joomla
   5  * @subpackage Menus
   6  * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
   7  * @license http://www.gnu.org/copyleft/gpl.html 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( '_VALID_MOS' ) or die( 'Restricted access' );
  17  
  18  /**
  19  * Newsfeed item link class
  20  * @package Joomla
  21  * @subpackage Menus
  22  */
  23  class newsfeed_link_menu {
  24  
  25  	function edit( &$uid, $menutype, $option ) {
  26          global $database, $my, $mainframe;
  27          global $mosConfig_absolute_path;
  28  
  29          $menu = new mosMenu( $database );
  30          $menu->load( (int)$uid );
  31  
  32          // fail if checked out not by 'me'
  33          if ($menu->checked_out && $menu->checked_out != $my->id) {
  34              mosErrorAlert( "The module ".$menu->title." is currently being edited by another administrator" );
  35          }
  36  
  37          if ( $uid ) {
  38              $menu->checkout( $my->id );
  39          } else {
  40              // load values for new entry
  41              $menu->type         = 'newsfeed_link';
  42              $menu->menutype     = $menutype;
  43              $menu->browserNav     = 0;
  44              $menu->ordering     = 9999;
  45              $menu->parent         = intval( mosGetParam( $_POST, 'parent', 0 ) );
  46              $menu->published     = 1;
  47          }
  48  
  49          if ( $uid ) {
  50              $temp = explode( 'feedid=', $menu->link );
  51              $query = "SELECT *, c.title AS category"
  52              . "\n FROM #__newsfeeds AS a"
  53              . "\n INNER JOIN #__categories AS c ON a.catid = c.id"
  54              . "\n WHERE a.id = " . (int) $temp[1]
  55              ;
  56              $database->setQuery( $query );
  57              $newsfeed = $database->loadObjectlist();
  58              // outputs item name, category & section instead of the select list
  59              $lists['newsfeed'] = '
  60              <table width="100%">
  61              <tr>
  62                  <td width="10%">
  63                  Item:
  64                  </td>
  65                  <td>
  66                  '. $newsfeed[0]->name .'
  67                  </td>
  68              </tr>
  69              <tr>
  70                  <td width="10%">
  71                  Position:
  72                  </td>
  73                  <td>
  74                  '. $newsfeed[0]->category .'
  75                  </td>
  76              </tr>
  77              </table>';
  78              $lists['newsfeed'] .= '<input type="hidden" name="newsfeed_link" value="'. $temp[1] .'" />';
  79              $newsfeeds = '';
  80          } else {
  81              $query = "SELECT a.id AS value, CONCAT( c.title, ' - ', a.name ) AS text, a.catid "
  82              . "\n FROM #__newsfeeds AS a"
  83              . "\n INNER JOIN #__categories AS c ON a.catid = c.id"
  84              . "\n WHERE a.published = 1"
  85              . "\n ORDER BY a.catid, a.name"
  86              ;
  87              $database->setQuery( $query );
  88              $newsfeeds = $database->loadObjectList( );
  89  
  90              //    Create a list of links
  91              $lists['newsfeed'] = mosHTML::selectList( $newsfeeds, 'newsfeed_link', 'class="inputbox" size="10"', 'value', 'text', '' );
  92          }
  93  
  94          // build html select list for target window
  95          $lists['target']         = mosAdminMenus::Target( $menu );
  96  
  97          // build the html select list for ordering
  98          $lists['ordering']         = mosAdminMenus::Ordering( $menu, $uid );
  99          // build the html select list for the group access
 100          $lists['access']         = mosAdminMenus::Access( $menu );
 101          // build the html select list for paraent item
 102          $lists['parent']         = mosAdminMenus::Parent( $menu );
 103          // build published button option
 104          $lists['published']     = mosAdminMenus::Published( $menu );
 105          // build the url link output
 106          $lists['link']         = mosAdminMenus::Link( $menu, $uid );
 107  
 108          // get params definitions
 109          $params = new mosParameters( $menu->params, $mainframe->getPath( 'menu_xml', $menu->type ), 'menu' );
 110  
 111          newsfeed_link_menu_html::edit( $menu, $lists, $params, $option, $newsfeeds );
 112      }
 113  }
 114  ?>


Généré le : Wed Nov 21 14:43:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics