| 1 |
<?php |
<?php |
| 2 |
/** |
/** |
|
* @version $Id: admin.categories.php,v 1.1 2005/07/22 01:52:06 eddieajau Exp $ |
|
| 3 |
* @package Mambo |
* @package Mambo |
| 4 |
* @subpackage Categories |
* @subpackage Categories |
| 5 |
* @copyright (C) 2000 - 2005 Miro International Pty Ltd |
* @copyright Refer to copyright.php |
| 6 |
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL |
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL |
| 7 |
* Mambo is Free Software |
* @author Mambo Foundation Inc see README.php |
| 8 |
*/ |
*/ |
| 9 |
|
|
| 10 |
/** ensure this file is being included by a parent file */ |
/** ensure this file is being included by a parent file */ |
| 323 |
$types[] = mosHTML::makeOption( 'contact_category_table', T_('Contact Category Table') ); |
$types[] = mosHTML::makeOption( 'contact_category_table', T_('Contact Category Table') ); |
| 324 |
} else |
} else |
| 325 |
if ($row->section == 'com_newsfeeds') { |
if ($row->section == 'com_newsfeeds') { |
| 326 |
$types[] = mosHTML::makeOption( 'newsfeed_category_table', T_('Newsfeed Category Table') ); |
$types[] = mosHTML::makeOption( 'newsfeed_category_table', T_('News Feed Category Table') ); |
| 327 |
} else |
} else |
| 328 |
if ($row->section == 'com_weblinks') { |
if ($row->section == 'com_weblinks') { |
| 329 |
$types[] = mosHTML::makeOption( 'weblink_category_table', T_('Weblink Category Table') ); |
$types[] = mosHTML::makeOption( 'weblink_category_table', T_('Web Link Category Table') ); |
| 330 |
} else { |
} else { |
| 331 |
$types[] = mosHTML::makeOption( 'content_category', T_('Content Category Table') ); |
$types[] = mosHTML::makeOption( 'content_category', T_('Content Category Table') ); |
| 332 |
$types[] = mosHTML::makeOption( 'content_blog_category', T_('Content Category Blog') ); |
$types[] = mosHTML::makeOption( 'content_blog_category', T_('Content Category Blog') ); |
| 555 |
|
|
| 556 |
$row = new mosCategory( $database ); |
$row = new mosCategory( $database ); |
| 557 |
$row->bind( $_POST ); |
$row->bind( $_POST ); |
| 558 |
|
// sanitize |
| 559 |
|
$row->id = intval($row->id); |
| 560 |
$row->checkin(); |
$row->checkin(); |
| 561 |
mosRedirect( 'index2.php?option=com_categories§ion='. $redirect ); |
mosRedirect( 'index2.php?option=com_categories§ion='. $redirect ); |
| 562 |
} |
} |
| 800 |
|
|
| 801 |
case 'newsfeed_category_table': |
case 'newsfeed_category_table': |
| 802 |
$link = 'index.php?option=com_newsfeeds&catid='. $id; |
$link = 'index.php?option=com_newsfeeds&catid='. $id; |
| 803 |
$menutype = T_('Newsfeed Category Table'); |
$menutype = T_('News Feed Category Table'); |
| 804 |
break; |
break; |
| 805 |
|
|
| 806 |
case 'weblink_category_table': |
case 'weblink_category_table': |
| 807 |
$link = 'index.php?option=com_weblinks&catid='. $id; |
$link = 'index.php?option=com_weblinks&catid='. $id; |
| 808 |
$menutype = T_('Weblink Category Table'); |
$menutype = T_('Web Link Category Table'); |
| 809 |
break; |
break; |
| 810 |
|
|
| 811 |
default:; |
default:; |
| 837 |
|
|
| 838 |
function saveOrder( &$cid, $section ) { |
function saveOrder( &$cid, $section ) { |
| 839 |
global $database; |
global $database; |
|
|
|
|
$total = count( $cid ); |
|
| 840 |
$order = mosGetParam( $_POST, 'order', array(0) ); |
$order = mosGetParam( $_POST, 'order', array(0) ); |
| 841 |
$row = new mosCategory( $database ); |
$row = new mosCategory( $database ); |
| 842 |
$conditions = array(); |
$sections = array(); |
|
|
|
| 843 |
// update ordering values |
// update ordering values |
| 844 |
for( $i=0; $i < $total; $i++ ) { |
foreach ($cid as $i=>$ciditem) { |
| 845 |
$row->load( $cid[$i] ); |
$row->load( $ciditem ); |
| 846 |
if ($row->ordering != $order[$i]) { |
if ($row->ordering != $order[$i]) { |
| 847 |
$row->ordering = $order[$i]; |
$row->ordering = $order[$i]; |
| 848 |
if (!$row->store()) { |
if (!$row->store()) { |
| 849 |
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n"; |
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n"; |
| 850 |
exit(); |
exit(); |
| 851 |
} // if |
} |
| 852 |
// remember to updateOrder this group |
// remember to updateOrder this group |
| 853 |
$condition = "section='$row->section'"; |
$sections[$row->section] = $row->id; |
| 854 |
$found = false; |
} |
| 855 |
foreach ( $conditions as $cond ) |
} |
|
if ($cond[1]==$condition) { |
|
|
$found = true; |
|
|
break; |
|
|
} // if |
|
|
if (!$found) $conditions[] = array($row->id, $condition); |
|
|
} // if |
|
|
} // for |
|
|
|
|
| 856 |
// execute updateOrder for each group |
// execute updateOrder for each group |
| 857 |
foreach ( $conditions as $cond ) { |
foreach ($sections as $section=>$rowid) { |
| 858 |
$row->load( $cond[0] ); |
$row->updateOrder("section='$section'"); |
|
$row->updateOrder( $cond[1] ); |
|
| 859 |
} // foreach |
} // foreach |
|
|
|
| 860 |
$msg = T_('New ordering saved'); |
$msg = T_('New ordering saved'); |
| 861 |
mosRedirect( 'index2.php?option=com_categories§ion='. $section, $msg ); |
mosRedirect( 'index2.php?option=com_categories§ion='. $section, $msg ); |
| 862 |
} // saveOrder |
} // saveOrder |