2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
9 /* This program 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. */
12 /****************************************************************/
15 define('AT_INCLUDE_PATH', '../include/');
17 require(AT_INCLUDE_PATH.'vitals.inc.php');
18 admin_authenticate(AT_ADMIN_PRIV_ADMIN);
20 require(AT_INCLUDE_PATH.'header.inc.php');
22 echo '<div style="padding-left: 30px;"><pre>';
24 echo "cpID\torder\t cID";
26 $sql = "SELECT content_id, content_parent_id, ordering, course_id FROM ".TABLE_PREFIX."content ORDER BY course_id, content_parent_id, ordering";
27 $result = mysql_query($sql, $db);
30 while ($row = mysql_fetch_assoc($result)) {
31 if ($current_course_id != $row['course_id']) {
32 echo "\n\n-- course id $row[course_id]\n\n";
33 $current_course_id = $row['course_id'];
34 unset($current_parent_id);
38 echo $row['content_parent_id'] . "\t" . $row['ordering'] . "\t" . $row['content_id'];
39 if ($current_parent_id != $row['content_parent_id']) {
40 $current_parent_id = $row['content_parent_id'];
45 if ($row['ordering'] != $ordering) {
46 echo "\t mismatch : expecting $ordering [fixed]";
47 $sql = "UPDATE ".TABLE_PREFIX."content SET ordering=$ordering WHERE content_id=$row[content_id]";
48 mysql_query($sql, $db);
49 write_to_log(AT_ADMIN_LOG_UPDATE, 'content', mysql_affected_rows($db), $sql);
59 $savant->assign('ordering', $ordering);
60 $savant->assign('content_id', $content_id);
61 $savant->assign('content_parent_id', $content_parent_id);
64 $savant->display('admin/fix_content.tmpl.php');
65 require(AT_INCLUDE_PATH.'footer.inc.php');