]> git.mjollnir.org Git - moodle.git/commitdiff
admin page cleanup (google soc 2006)... updated to use new pagelib
authorvinkmar <vinkmar>
Fri, 18 Aug 2006 07:27:05 +0000 (07:27 +0000)
committervinkmar <vinkmar>
Fri, 18 Aug 2006 07:27:05 +0000 (07:27 +0000)
course/category.php
course/index.php
theme/index.php

index 47400c4a8bb924c5c9cafa65d2b1448ffcfdc60c..cd9b35ae4017618ad725040bba64520a1397743f 100644 (file)
@@ -9,7 +9,7 @@
     $id       = required_param('id', PARAM_INT);          // Category id
     $page     = optional_param('page', 0, PARAM_INT);     // which page to show
     $perpage  = optional_param('perpage', 20, PARAM_INT); // how many per page
-    $edit     = optional_param('edit', -1, PARAM_BOOL);
+    $categoryedit     = optional_param('categoryedit', -1, PARAM_BOOL);
     $hide     = optional_param('hide', 0, PARAM_INT);
     $show     = optional_param('show', 0, PARAM_INT);
     $moveup   = optional_param('moveup', 0, PARAM_INT);
@@ -32,7 +32,7 @@
 
     if (iscreator()) {
         if ($edit !== -1) {
-            $USER->categoryediting = $edit;
+            $USER->categoryediting = $categoryedit;
         }
         $navbaritem = update_category_button($category->id);
 
 
     if ($creatorediting) {
         if ($adminediting) {
-            print_header("$site->shortname: $category->name", "$site->fullname: $strcourses",
-                         "<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> ".
-                         "<a href=\"index.php\">$strcategories</a> -> $category->name",
-                         "", "", true, $navbaritem);
+            // modify this to treat this as an admin page
+
+            require_once($CFG->dirroot . '/admin/adminlib.php');
+            admin_externalpage_setup('coursemgmt');
+            admin_externalpage_print_header();
         } else {
             print_header("$site->shortname: $category->name", "$site->fullname: $strcourses",
                          "<a href=\"index.php\">$strcategories</a> -> $category->name", "", "", true, $navbaritem);
        print_course_search();
     
     echo "</center>";
-
-    print_footer();
+    
+    if ($adminediting) {
+        admin_externalpage_print_footer();
+    } else {
+        print_footer();
+    }
 
 ?>
index 71583cdbccc56eee647b5a08980aaf9e99407f63..ed57d7d0bd8a36f9a044adad16489e57a40facf3 100644 (file)
@@ -5,7 +5,7 @@
     require_once("../config.php");
     require_once("lib.php");
 
-    $edit     = optional_param('edit', -1,PARAM_BOOL);
+    $categoryedit = optional_param('categoryedit', -1,PARAM_BOOL);
     $delete   = optional_param('delete',0,PARAM_INT);
     $hide     = optional_param('hide',0,PARAM_INT);
     $show     = optional_param('show',0,PARAM_INT);
@@ -26,8 +26,8 @@
     }
 
     if (isadmin()) {
-        if ($edit !== -1) {
-            $USER->categoryediting = $edit;
+        if ($categoryedit !== -1) {
+            $USER->categoryediting = $categoryedit;
         }
         $adminediting = !empty($USER->categoryediting);
     } else {
 
 /// From now on is all the admin functions
 
-    require_login();
 
-    if (!isadmin()) {
-        error("Only administrators can use this page!");
-    }
+    require_once($CFG->dirroot . '/admin/adminlib.php');
+    admin_externalpage_setup('coursemgmt');
+
 
 /// Print headings
 
@@ -91,9 +90,9 @@
     $straction = get_string("action");
     $straddnewcategory = get_string("addnewcategory");
 
-    print_header("$site->shortname: $strcategories", "$site->fullname", 
-                 "<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $strcategories",
-                 "addform.addcategory", "", true, update_categories_button());
+
+
+    admin_externalpage_print_header();
 
     print_heading($strcategories);
 
     echo "<br />";
     echo "</center>";
 
-    print_footer();
+    admin_externalpage_print_footer();
 
 
 
@@ -352,7 +351,7 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
             echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
         }
         $linkcss = $category->visible ? "" : " class=\"dimmed\" ";
-        echo "<a $linkcss title=\"$str->edit\" href=\"category.php?id=$category->id&amp;edit=on&amp;sesskey=$USER->sesskey\">$category->name</a>";
+        echo "<a $linkcss title=\"$str->edit\" href=\"category.php?id=$category->id&amp;categoryedit=on&amp;sesskey=$USER->sesskey\">$category->name</a>";
         echo "</td>";
 
         echo "<td align=\"right\">$category->coursecount</td>";
index 1978637fc9d058679b61220d9e4bd5f93cd2cb2d..c50ecc2d21647c6beed230d9c43470b65cb84391 100644 (file)
@@ -1,18 +1,11 @@
 <?php // $Id$
 
     require_once("../config.php");
+    require_once($CFG->dirroot . '/admin/adminlib.php');
 
     $choose = optional_param("choose",'',PARAM_FILE);   // set this theme as default
 
-    if (! $site = get_site()) {
-        error("Site doesn't exist!");
-    }
-
-    require_login();
-
-    if (!isadmin()) {
-        error("You must be an administrator to change themes.");
-    }
+    admin_externalpage_setup('themeselector');
 
     unset($SESSION->theme);
 
         }
         if (set_config("theme", $choose)) {
             theme_setup($choose);
-
-            print_header("$site->shortname: $strthemes", $site->fullname, 
-                 "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> ".
-                 "<a href=\"$CFG->wwwroot/$CFG->admin/configure.php\">$strconfiguration</a> -> $strthemes");
+              admin_externalpage_print_header();
             print_heading(get_string("themesaved"));
             print_continue("$CFG->wwwroot/");
 
                 echo format_text(implode('', $file), FORMAT_MOODLE);
                 print_simple_box_end();
             }
-            print_footer();
+              admin_externalpage_print_footer();
             exit;
         } else {
             error("Could not set the theme!");
         }
     }
 
-    print_header("$site->shortname: $strthemes", $site->fullname, 
-                 "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> ".
-                 "<a href=\"$CFG->wwwroot/$CFG->admin/configure.php\">$strconfiguration</a> -> $strthemes");
+              admin_externalpage_print_header('themeselector');
 
 
     print_heading($strthemes);
     $options["sub"] = "themes";
     print_single_button("$CFG->wwwroot/doc/index.php", $options, get_string("howtomakethemes"));
     echo "</div>";
-    print_footer();
+    admin_externalpage_print_footer();
+
 
 ?>