Source for file content_item_link.class.php

Documentation is available at content_item_link.class.php

  1. <?php
  2. /**
  3. @package Mambo
  4. @subpackage Menus
  5. @copyright  Refer to copyright.php
  6. @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
  7. @author Mambo Foundation Inc see README.php
  8. */ 
  9.  
  10. /** ensure this file is being included by a parent file */
  11. defined'_VALID_MOS' or die'Direct Access to this location is not allowed.' );
  12.  
  13. /**
  14. * Content item link class
  15. */
  16.  
  17.     function edit&$uid$menutype$option {
  18.         global $database$my$mainframe;
  19.         global $mosConfig_absolute_path;
  20.     
  21.         $menu new mosMenu$database );
  22.         $menu->load$uid );
  23.     
  24.         // fail if checked out not by 'me'
  25.         if ($menu->checked_out && $menu->checked_out <> $my->id{
  26.             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";
  27.             exit(0);
  28.         }
  29.     
  30.         if $uid {
  31.             $menu->checkout$my->id );
  32.         else {
  33.             // load values for new entry
  34.             $menu->type 'content_item_link';
  35.             $menu->menutype $menutype;
  36.             $menu->browserNav 0;
  37.             $menu->ordering 9999;
  38.             $menu->parent intvalmosGetParam$_POST'parent') );
  39.             $menu->published 1;
  40.         }
  41.     
  42.         if $uid {
  43.             $link     'javascript:submitbutton( \'redirect\' );';
  44.             
  45.             $temp     explode'id='$menu->link );
  46.              $query "SELECT a.title, c.name AS category, s.name AS section"
  47.             . "\n FROM #__content AS a"
  48.             . "\n LEFT JOIN #__categories AS c ON a.catid = c.id"
  49.             . "\n LEFT JOIN #__sections AS s ON a.sectionid = s.id"
  50.             . "\n WHERE a.id = '"$temp[1."'"
  51.             ;
  52.             $database->setQuery$query );
  53.             $content $database->loadObjectlist();
  54.             // outputs item name, category & section instead of the select list
  55.             $lists['content''
  56.             <table width="100%">
  57.             <tr>
  58.                 <td width="10%">
  59.                 Item:
  60.                 </td>
  61.                 <td>
  62.                 <a href="'$link .'" title="'.T_('Edit Content Item').'">
  63.                 '$content[0]->title .'
  64.                 </a>
  65.                 </td>
  66.             </tr>
  67.             <tr>
  68.                 <td width="10%">
  69.                 '.T_('Category:').'
  70.                 </td>
  71.                 <td>
  72.                 '$content[0]->category .'
  73.                 </td>
  74.             </tr>
  75.             <tr>
  76.                 <td width="10%">
  77.                 '.T_('Section:').'
  78.                 </td>
  79.                 <td>
  80.                 '$content[0]->section .'
  81.                 </td>
  82.             </tr>
  83.             </table>';
  84.             $contents '';
  85.             $lists['content'.= '<input type="hidden" name="content_item_link" value="'$temp[1.'" />';
  86.         else {
  87.             $query "SELECT a.id AS value, a.title AS text, a.sectionid, a.catid "
  88.             . "\n FROM #__content AS a"
  89.             . "\n INNER JOIN #__categories AS c ON a.catid = c.id"
  90.             . "\n INNER JOIN #__sections AS s ON a.sectionid = s.id"
  91.             . "\n WHERE a.state = '1'"
  92.             . "\n ORDER BY a.sectionid, a.catid, a.title"
  93.             ;
  94.             $database->setQuery$query );
  95.             $contents $database->loadObjectList);
  96.     
  97.             foreach $contents as $content {
  98.                 $database->setQuery"SELECT s.title"
  99.                 . "\n FROM #__sections AS s"
  100.                 . "\n WHERE s.scope = 'content'"
  101.                 . "\n AND s.id = '"$content->sectionid ."'"
  102.                 );
  103.                 $section $database->loadResult();
  104.     
  105.                 $database->setQuery"SELECT c.title"
  106.                 . "\n FROM #__categories AS c"
  107.                 . "\n WHERE c.id = '"$content->catid ."'"
  108.                 );
  109.                 $category $database->loadResult();
  110.         
  111.                 $value $content->value;
  112.                 $text $section ." - "$category ." / "$content->text ."&nbsp;&nbsp;&nbsp;&nbsp;";
  113.                 
  114.                 $temp[mosHTML::makeOption$value$text );
  115.                 $contents $temp;
  116.             }
  117.     
  118.             //    Create a list of links
  119.             $lists['content'mosHTML::selectList$contents'content_item_link''class="inputbox" size="10"''value''text''' );
  120.         }
  121.         
  122.         // build html select list for target window
  123.         $lists['target']         mosAdminMenus::Target$menu );
  124.     
  125.         // build the html select list for ordering
  126.         $lists['ordering']         mosAdminMenus::Ordering$menu$uid );
  127.         // build the html select list for the group access
  128.         $lists['access']         mosAdminMenus::Access$menu );
  129.         // build the html select list for paraent item
  130.         $lists['parent']         mosAdminMenus::Parent$menu );
  131.         // build published button option
  132.         $lists['published']     mosAdminMenus::Published$menu );
  133.         // build the url link output
  134.         $lists['link']         mosAdminMenus::Link$menu$uid );
  135.         
  136.         // get params definitions
  137.         $params =new mosAdminParameters$menu->params$mainframe->getPath'menu_xml'$menu->type )'menu' );
  138.     
  139.         content_item_link_menu_html::edit$menu$lists$params$option$contents );
  140.     }
  141.     
  142.     function redirect$id {
  143.         global $database;
  144.         
  145.         $menu new mosMenu$database );
  146.         $menu->bind$_POST );
  147.         $menuid mosGetParam$_POST'menuid');
  148.         if $menuid {
  149.             $menu->id $menuid;
  150.         }
  151.         $menu->checkin();
  152.     
  153.         mosRedirect'index2.php?option=com_content&task=edit&id='$id );    
  154.     }
  155. }
  156. ?>

Documentation generated on Mon, 05 May 2008 16:18:42 +0400 by phpDocumentor 1.4.0