I have created a new page. It is located inside of a folder in the root of the Moodle directory, so – http://loclahost/moodle/newmodule/index.php. The Block columns do not appear. I’m worried that by putting the new directory in the root of Moodle I may have broken links to the necessary files. I don’t want to turn this into a block because it is supporting several hefty forms that modify a database for majors that I have created. I actually use blocks to display the information and this is really the administrative panel.
Does anyone have any ideas?
<?PHP
require_once('../config.php');
require_once($CFG->libdir.'/weblib.php');
require_once('edit_major_form.php');
print_header_simple('Major', 'heading', 'navigation', '', '', true, ' ', '', false, '', false);
$_GET['major'] = 'add'; // For testing
if(isset($_GET['major'])) {
switch ($_GET['major']) {
case add:
$heading = 'Add a New Major';
$mform = new add_major_form();
break;
case editmajor:
$heading = 'Select a Major to Edit';
$mform = new choose_edit_major_form('editform');
break;
case edit:
$heading = 'Edit Major';
$mform = new edit_major_form();
echo 'Im in the if statement on index because I have an edit<br/>';
if(isset($_GET['id'])) {
$foundmajor = $mform->fill_edit_form($_GET['id']);
echo 'Im in the if statement on index because I have an id<br/>';
print_r($foundmajor);
$mform->set_data($foundmajor);
//$mform->display();
}
break;
case disable:
$heading = 'Disable a Major';
$mform = new remove_major_form();
break;
default:
$heading = 'Add a New Major';
$mform = new add_major_form();
}
}
echo '<div class="admin">'; // Admin Box For Style Purposes
echo '<h2 class="headingblock header ">'.$heading.'</h2>';
echo '<div class="generalbox">'; // Containing Box
if ($mform->is_cancelled()){
//here you tell php what to do if your user presses cancel
echo 'Canceled'; // Eventually change this to go to a Show All Majors Page
}
// this branch is where you process validated data
else if ($fromform=$mform->get_data()){
print_r($errors);
$mform->display();
}
// else is executed if the form is submitted but the data doesnt validate
// or on the first display of the form.
else {
//"<a href=\"$CFG->wwwroot/mod/$module->name/index.php?id=$course->id\">$strmodulenameplural</a> ->
//$strnav $streditinga", $mform->focus(), "", false);
//notice use of $mform->focus() above which puts the cursor
//in the first form field or the first field with an error.
//put data you want to fill out in the form into array $toform here then :
// $mform->set_data();
print_r($msform->$errors);
$mform->display();
}
echo '</div>'; // End Containing Box
echo '</div>'; // End Admin Box For Style Purposes
print_footer($course=NULL, $usercourse=NULL, $return=false);
?>