}
if ($editingon && has_capability('moodle/category:manage', $context)) {
- echo '<div class="buttons">';
+ echo $OUTPUT->container_start('buttons');
// Print button to update this category
$options = array('id' => $category->id);
- print_single_button($CFG->wwwroot.'/course/editcategory.php', $options, get_string('editcategorythis'), 'get');
+ echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/course/editcategory.php', $options, get_string('editcategorythis'), 'get'));
// Print button for creating new categories
$options = array('parent' => $category->id);
- print_single_button($CFG->wwwroot.'/course/editcategory.php', $options, get_string('addsubcategory'), 'get');
+ echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/course/editcategory.php', $options, get_string('addsubcategory'), 'get'));
- echo '</div>';
+ echo $OUTPUT->container_end();
}
/// Print out all the sub-categories
$options['id'] = $category->id;
$options['resort'] = 'name';
$options['sesskey'] = sesskey();
- print_single_button('category.php', $options, get_string('resortcoursesbyname'), 'get');
+ echo $OUTPUT->button(html_form::make_button('category.php', $options, get_string('resortcoursesbyname'), 'get'));
}
if (has_capability('moodle/course:create', $context)) {
/// Print button to create a new course
unset($options);
$options['category'] = $category->id;
- print_single_button('edit.php', $options, get_string('addnewcourse'), 'get');
+ echo $OUTPUT->button(html_form::make_button('edit.php', $options, get_string('addnewcourse'), 'get'));
}
if (!empty($CFG->enablecourserequests) && $category->id == $CFG->enablecourserequests) {
print_header("$site->shortname: $strdeletecheck", $site->fullname, $navigation);
- notice_yesno("$strdeletecoursecheck<br /><br />" . format_string($course->fullname) .
- " (" . format_string($course->shortname) . ")",
- "delete.php?id=$course->id&delete=".md5($course->timemodified)."&sesskey=".sesskey(),
- "category.php?id=$course->category");
+ $message = "$strdeletecoursecheck<br /><br />" . format_string($course->fullname) . " (" . format_string($course->shortname) . ")";
+ echo $OUTPUT->confirm($message, "delete.php?id=$course->id&delete=".md5($course->timemodified), "category.php?id=$course->category");
echo $OUTPUT->footer();
exit;
if (!empty($fromcoursesearch) && !empty($creator)) {
$totalcount = 0;
$courses = get_courses_search(explode(" ",$fromcoursesearch),"fullname ASC",$page,50,$totalcount);
+ $table = new html_table();
if (is_array($courses) and count($courses) > 0) {
$table->data[] = array('<b>'.get_string('searchresults').'</b>','','');
foreach ($courses as $scourse) {
}
}
if (!empty($table)) {
- print_table($table);
+ echo $OUTPUT->table($table);
}
?>
echo $OUTPUT->box_end();
}
- echo '<div class="buttons">';
+ echo $OUTPUT->container_start('buttons');
if (has_capability('moodle/course:create', $systemcontext)) {
/// Print link to create a new course
/// Get the 1st available category
$options = array('category' => $CFG->defaultrequestcategory);
- print_single_button('edit.php', $options, get_string('addnewcourse'), 'get');
+ $form = html_form::make_button('edit.php', $options, get_string('addnewcourse'));
+ $form->method = 'get';
+ echo $OUTPUT->button($form);
}
print_course_request_buttons($systemcontext);
- echo '</div>';
+ echo $OUTPUT->container_end();
echo $OUTPUT->footer();
exit;
}
// print create course link to first category
$options = array();
$options = array('category' => $CFG->defaultrequestcategory);
- print_single_button('edit.php', $options, get_string('addnewcourse'), 'get');
+ $form = html_form::make_button('edit.php', $options, get_string('addnewcourse'));
+ $form->method = 'get';
+ echo $OUTPUT->button($form);
}
// Print button for creating new categories
if (has_capability('moodle/category:manage', $systemcontext)) {
$options = array();
$options['parent'] = 0;
- print_single_button('editcategory.php', $options, get_string('addnewcategory'), 'get');
+ $form = html_form::make_button('editcategory.php', $options, get_string('addnewcategory'));
+ $form->method = 'get';
+ echo $OUTPUT->button($form);
}
print_course_request_buttons($systemcontext);
* @param object $systemcontext the system context.
*/
function print_course_request_buttons($systemcontext) {
- global $CFG, $DB;
+ global $CFG, $DB, $OUTPUT;
if (empty($CFG->enablecourserequests)) {
return;
}
if (isloggedin() && !isguestuser() && !has_capability('moodle/course:create', $systemcontext) && has_capability('moodle/course:request', $systemcontext)) {
/// Print a button to request a new course
- print_single_button('request.php', NULL, get_string('requestcourse'), 'get');
+ echo $OUTPUT->button(html_form::make_button('request.php', NULL, get_string('requestcourse'), 'get'));
}
/// Print a button to manage pending requests
if (has_capability('moodle/site:approvecourse', $systemcontext)) {
- print_single_button('pending.php', NULL, get_string('coursespending'), 'get', '_self', false, '', !$DB->record_exists('course_request', array()));
+ $form = html_form::make_button('pending.php', NULL, get_string('coursespending'), 'get');
+ $form->button->disabled = !$DB->record_exists('course_request', array());
+ echo $OUTPUT->button($form);
}
}
* to see it.
*/
function update_category_button($categoryid = 0) {
- global $CFG, $PAGE;
+ global $CFG, $PAGE, $OUTPUT;
// Check permissions.
if (!can_edit_in_category($categoryid)) {
} else {
$page = 'index.php';
}
- return print_single_button($CFG->wwwroot . '/course/' . $page, $options, $label, 'get', '', true);
+ return $OUTPUT->button(html_form::make_button($CFG->wwwroot . '/course/' . $page, $options, $label, 'get'));
}
/**
$options = array();
$options['category'] = $category->id;
echo '<div class="addcoursebutton">';
- print_single_button($CFG->wwwroot.'/course/edit.php', $options, get_string("addnewcourse"));
+ echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/course/edit.php', $options, get_string("addnewcourse")));
echo '</div>';
}
}
echo "<table width=\"100%\"><tr><td align=\"center\">";
print_course_search("", false, "short");
echo "</td><td align=\"center\">";
- print_single_button("$CFG->wwwroot/course/index.php", NULL, get_string("fulllistofcourses"), "get");
+ echo $OUTPUT->button(html_form::make_button("$CFG->wwwroot/course/index.php", NULL, get_string("fulllistofcourses"), "get"));
echo "</td></tr></table>\n";
}
// print_simple_box_start('center', '60%', '#FFAAAA', 20, 'noticebox');
echo $OUTPUT->box_start('noticebox');
- notice_yesno($strdeletecheckfull, 'mod.php', $return, $optionsyes, $optionsno, 'post', 'get');
+ $formcontinue = html_form::make_button('mod.php', $optionsyes, get_string('yes'));
+ $formcancel = html_form::make_button($return, $optionsno, get_string('no'), 'get');
+ echo $OUTPUT->confirm($strdeletecheckfull, $formcontinue, $formcancel);
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
echo $OUTPUT->heading(get_string('coursespending'));
/// Build a table of all the requests.
- $table->class = 'pendingcourserequests generaltable';
+ $table = new html_table();
+ $table->add_class('pendingcourserequests generaltable');
$table->align = array('center', 'center', 'center', 'center', 'center', 'center', 'center');
$table->head = array(' ', get_string('shortname'), get_string('fullname'),
get_string('requestedby'), get_string('summary'), get_string('requestreason'), get_string('action'));
$row[] = fullname($requester);
$row[] = format_string($course->summary);
$row[] = format_string($course->reason);
- $row[] = print_single_button($baseurl, array('approve' => $course->id, 'sesskey' => sesskey()), get_string('approve'), 'get', '', true) .
- print_single_button($baseurl, array('reject' => $course->id), get_string('rejectdots'), 'get', '', true);
+ $row[] = $OUTPUT->button(html_form::make_button($baseurl, array('approve' => $course->id, 'sesskey' => sesskey()), get_string('approve'), 'get')) .
+ $OUTPUT->button(html_form::make_button($baseurl, array('reject' => $course->id), get_string('rejectdots'), 'get'));
/// Add the row to the table.
$table->data[] = $row;
}
/// Display the table.
- print_table($table);
+ echo $OUTPUT->table($table);
/// Message about name collisions, if necessary.
if (!empty($collision)) {
}
/// Finish off the page.
- print_single_button($CFG->wwwroot . '/course/index.php', array(), get_string('backtocourselisting'));
+ echo $OUTPUT->button(html_form::make_button($CFG->wwwroot . '/course/index.php', array(), get_string('backtocourselisting')));
echo $OUTPUT->footer();
?>
print_error('nostatstodisplay', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
}
+ $table = new html_table();
$table->width = 'auto';
if ($mode == STATS_MODE_DETAILED) {
.'<div>'."\n"
.'<input type="hidden" name="mode" value="'.$mode.'" />'."\n";
- print_table($table);
+ echo $OUTPUT->table($table);
echo '</div>';
echo '</form>';
}
}
- $table = new StdClass;
+ $table = new html_table();
$table->align = array('left','center','center','center');
$param->table = str_replace('user_','',$param->table);
switch ($param->table) {
$lastrecord[] = $lastlink;
$table->data[] = $lastrecord;
}
- print_table($table);
+ echo $OUTPUT->table($table);
}
}
$data[] = $line;
}
- $table = new object();
+ $table = new html_table();
$table->head = array(get_string('resetcomponent'), get_string('resettask'), get_string('resetstatus'));
$table->size = array('20%', '40%', '40%');
$table->align = array('left', 'left', 'left');
$table->width = '80%';
$table->data = $data;
- print_table($table);
+ echo $OUTPUT->table($table);
echo $OUTPUT->continue_button('view.php?id='.$course->id); // Back to course page
echo $OUTPUT->footer();
print_error('nousers');
}
$strunenrolsure = get_string('unenrolsure', '', fullname($user, true));
- notice_yesno($strunenrolsure, "unenrol.php?id=$id&user=$user->id&confirm=yes&sesskey=".sesskey(),
- $_SERVER['HTTP_REFERER']);
+ echo $OUTPUT->confirm($strunenrolsure, "unenrol.php?id=$id&user=$user->id&confirm=yes", $PAGE->url);
} else {
$strunenrolsure = get_string('unenrolsure', '', get_string("yourself"));
- notice_yesno($strunenrolsure, "unenrol.php?id=$id&confirm=yes&sesskey=".sesskey(),
- $_SERVER['HTTP_REFERER']);
+ echo $OUTPUT->confirm($strunenrolsure, "unenrol.php?id=$id&confirm=yes", $PAGE->url);
}
echo $OUTPUT->footer();
// What the heck is this about? -- MD
$stats = stats_fix_zeros($stats,$param->timeafter,$param->table,(!empty($param->line2)),(!empty($param->line3)));
- $table = new object();
+ $table = new html_table();
$table->align = array('left','center','center','center');
$param->table = str_replace('user_','',$param->table);
switch ($param->table) {
$a[] = $stat->line3;
$table->data[] = $a;
}
- print_table($table);
+ echo $OUTPUT->table($table);
break;
case "outline" :