[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

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

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Menus
   5  * @author Mambo Foundation Inc see README.php
   6  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   7  * See COPYRIGHT.php for copyright notices and details.
   8  * @license GNU/GPL Version 2, see LICENSE.php
   9  *
  10  * Redistributions of files must retain the above copyright notice.
  11  *
  12  * Mambo is free software; you can redistribute it and/or
  13  * modify it under the terms of the GNU General Public License
  14  * as published by the Free Software Foundation; version 2 of the License.
  15  */
  16  
  17  /** ensure this file is being included by a parent file */
  18  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  19  
  20  /**
  21  * Newsfeed item link class
  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( $uid );
  31      
  32          // fail if checked out not by 'me'
  33          if ($menu->checked_out && $menu->checked_out <> $my->id) {
  34              echo "<script>alert('".sprintf(T_('The module % is currently being edited by another administrator'), $menu->title)."'); document.location.href='index2.php?option=$option'</script>\n";
  35              exit(0);
  36          }
  37      
  38          if ( $uid ) {
  39              $menu->checkout( $my->id );
  40          } else {
  41              // load values for new entry
  42              $menu->type = 'newsfeed_link';
  43              $menu->menutype = $menutype;
  44              $menu->browserNav = 0;
  45              $menu->ordering = 9999;
  46              $menu->parent = intval( mosGetParam( $_POST, 'parent', 0 ) );
  47              $menu->published = 1;
  48          }
  49      
  50          if ( $uid ) {
  51              $temp = explode( 'feedid=', $menu->link );
  52              $query = "SELECT *, c.title AS category"
  53              . "\n FROM #__newsfeeds AS a"
  54              . "\n INNER JOIN #__categories AS c ON a.catid = c.id"
  55              . "\n WHERE a.id = '". $temp[1] ."'"
  56              ;
  57              $database->setQuery( $query );
  58              $newsfeed = $database->loadObjectlist();
  59              // outputs item name, category & section instead of the select list
  60              $lists['newsfeed'] = '
  61              <table width="100%">
  62              <tr>
  63                  <td width="10%">
  64                  '.T_('Item:').'
  65                  </td>
  66                  <td>
  67                  '. $newsfeed[0]->name .'
  68                  </td>
  69              </tr>
  70              <tr>
  71                  <td width="10%">
  72                  '.T_('Position:').'
  73                  </td>
  74                  <td>
  75                  '. $newsfeed[0]->category .'
  76                  </td>
  77              </tr>
  78              </table>';
  79              $lists['newsfeed'] .= '<input type="hidden" name="newsfeed_link" value="'. $temp[1] .'" />';
  80              $newsfeeds = '';
  81          } else {
  82              $query = "SELECT a.id AS value, CONCAT( c.title, ' - ', a.name ) AS text, a.catid "
  83              . "\n FROM #__newsfeeds AS a"
  84              . "\n INNER JOIN #__categories AS c ON a.catid = c.id"
  85              . "\n WHERE a.published = '1'"
  86              . "\n ORDER BY a.catid, a.name"
  87              ;
  88              $database->setQuery( $query );
  89              $newsfeeds = $database->loadObjectList( );
  90      
  91              //    Create a list of links
  92              $lists['newsfeed'] = mosHTML::selectList( $newsfeeds, 'newsfeed_link', 'class="inputbox" size="10"', 'value', 'text', '' );
  93          }
  94          
  95          // build html select list for target window
  96          $lists['target']         = mosAdminMenus::Target( $menu );
  97      
  98          // build the html select list for ordering
  99          $lists['ordering']         = mosAdminMenus::Ordering( $menu, $uid );
 100          // build the html select list for the group access
 101          $lists['access']         = mosAdminMenus::Access( $menu );
 102          // build the html select list for paraent item
 103          $lists['parent']         = mosAdminMenus::Parent( $menu );
 104          // build published button option
 105          $lists['published']     = mosAdminMenus::Published( $menu );
 106          // build the url link output
 107          $lists['link']         = mosAdminMenus::Link( $menu, $uid );
 108          
 109          // get params definitions
 110          $params =& new mosAdminParameters( $menu->params, $mainframe->getPath( 'menu_xml', $menu->type ), 'menu' );
 111      
 112          newsfeed_link_menu_html::edit( $menu, $lists, $params, $option, $newsfeeds );
 113      }
 114  }
 115  ?>