Annotation of /mambo/branches/4.6/administrator/components/com_menus/content_typed/content_typed.class.php
Parent Directory
|
Revision Log
Revision 1754 - (view) (download)
| 1 : | andphe | 1754 | <?php |
| 2 : | /** | ||
| 3 : | * @package Mambo | ||
| 4 : | * @subpackage Menus | ||
| 5 : | ocs_cms | 1396 | * @author Mambo Foundation Inc see README.php |
| 6 : | * @copyright Mambo Foundation Inc. | ||
| 7 : | * See COPYRIGHT.php for copyright notices and details. | ||
| 8 : | * @license GNU/GPL Version 2, see LICENSE.php | ||
| 9 : | * Mambo is free software; you can redistribute it and/or | ||
| 10 : | * modify it under the terms of the GNU General Public License | ||
| 11 : | * as published by the Free Software Foundation; version 2 of the License. | ||
| 12 : | */ | ||
| 13 : | andphe | 1754 | |
| 14 : | /** ensure this file is being included by a parent file */ | ||
| 15 : | defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); | ||
| 16 : | |||
| 17 : | class content_typed_menu { | ||
| 18 : | |||
| 19 : | function edit( &$uid, $menutype, $option ) { | ||
| 20 : | global $database, $my, $mainframe; | ||
| 21 : | global $mosConfig_absolute_path; | ||
| 22 : | |||
| 23 : | $menu = new mosMenu( $database ); | ||
| 24 : | $menu->load( $uid ); | ||
| 25 : | |||
| 26 : | // fail if checked out not by 'me' | ||
| 27 : | if ($menu->checked_out && $menu->checked_out <> $my->id) { | ||
| 28 : | 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"; | ||
| 29 : | exit(0); | ||
| 30 : | } | ||
| 31 : | |||
| 32 : | if ( $uid ) { | ||
| 33 : | $menu->checkout( $my->id ); | ||
| 34 : | } else { | ||
| 35 : | // load values for new entry | ||
| 36 : | $menu->type = 'content_typed'; | ||
| 37 : | $menu->menutype = $menutype; | ||
| 38 : | $menu->browserNav = 0; | ||
| 39 : | $menu->ordering = 9999; | ||
| 40 : | $menu->parent = intval( mosGetParam( $_POST, 'parent', 0 ) ); | ||
| 41 : | $menu->published = 1; | ||
| 42 : | } | ||
| 43 : | |||
| 44 : | if ( $uid ) { | ||
| 45 : | $temp = explode( 'id=', $menu->link ); | ||
| 46 : | // @RawSQLUse, trivial_implementation, SELECT, CONCEPT | ||
| 47 : | $query = "SELECT a.title, a.title_alias, a.id" | ||
| 48 : | . "\n FROM #__content AS a" | ||
| 49 : | . "\n WHERE a.id = '". $temp[1] ."'" | ||
| 50 : | ; | ||
| 51 : | $database->setQuery( $query ); | ||
| 52 : | $content = $database->loadObjectlist(); | ||
| 53 : | // outputs item name, category & section instead of the select list | ||
| 54 : | if ( $content[0]->title_alias ) { | ||
| 55 : | $alias = ' (<i>'. $content[0]->title_alias .'</i>)'; | ||
| 56 : | } else { | ||
| 57 : | $alias = ''; | ||
| 58 : | } | ||
| 59 : | $contents = ''; | ||
| 60 : | $link = 'javascript:submitbutton( \'redirect\' );'; | ||
| 61 : | $lists['content'] = '<input type="hidden" name="content_typed" value="'. $temp[1] .'" />'; | ||
| 62 : | $lists['content'] .= '<a href="'. $link .'" title="Edit Static Content Item">'. $content[0]->title . $alias .'</a>'; | ||
| 63 : | } else { | ||
| 64 : | $query = "SELECT a.id AS value, CONCAT( a.title, '(', a.title_alias, ')' ) AS text" | ||
| 65 : | . "\n FROM #__content AS a" | ||
| 66 : | . "\n WHERE a.state = '1'" | ||
| 67 : | . "\n AND a.sectionid = '0'" | ||
| 68 : | . "\n AND a.catid = '0'" | ||
| 69 : | . "\n ORDER BY a.id, a.title" | ||
| 70 : | ; | ||
| 71 : | $database->setQuery( $query ); | ||
| 72 : | $contents = $database->loadObjectList( ); | ||
| 73 : | |||
| 74 : | // Create a list of links | ||
| 75 : | $lists['content'] = mosHTML::selectList( $contents, 'content_typed', 'class="inputbox" size="10"', 'value', 'text', '' ); | ||
| 76 : | } | ||
| 77 : | |||
| 78 : | // build html select list for target window | ||
| 79 : | $lists['target'] = mosAdminMenus::Target( $menu ); | ||
| 80 : | |||
| 81 : | // build the html select list for ordering | ||
| 82 : | $lists['ordering'] = mosAdminMenus::Ordering( $menu, $uid ); | ||
| 83 : | // build the html select list for the group access | ||
| 84 : | $lists['access'] = mosAdminMenus::Access( $menu ); | ||
| 85 : | // build the html select list for paraent item | ||
| 86 : | $lists['parent'] = mosAdminMenus::Parent( $menu ); | ||
| 87 : | // build published button option | ||
| 88 : | $lists['published'] = mosAdminMenus::Published( $menu ); | ||
| 89 : | // build the url link output | ||
| 90 : | $lists['link'] = mosAdminMenus::Link( $menu, $uid ); | ||
| 91 : | |||
| 92 : | // get params definitions | ||
| 93 : | $params =& new mosAdminParameters( $menu->params, $mainframe->getPath( 'menu_xml', $menu->type ), 'menu' ); | ||
| 94 : | |||
| 95 : | content_menu_html::edit( $menu, $lists, $params, $option, $contents ); | ||
| 96 : | } | ||
| 97 : | |||
| 98 : | function redirect( $id ) { | ||
| 99 : | global $database; | ||
| 100 : | |||
| 101 : | $menu = new mosMenu( $database ); | ||
| 102 : | $menu->bind( $_POST ); | ||
| 103 : | $menuid = mosGetParam( $_POST, 'menuid', 0 ); | ||
| 104 : | if ( $menuid ) { | ||
| 105 : | $menu->id = $menuid; | ||
| 106 : | } | ||
| 107 : | $menu->checkin(); | ||
| 108 : | |||
| 109 : | mosRedirect( 'index2.php?option=com_typedcontent&task=edit&id='. $id ); | ||
| 110 : | } | ||
| 111 : | } | ||
| 112 : | |||
| 113 : | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

