Commit 16932304 authored by Daniel Neis Araujo's avatar Daniel Neis Araujo

coding style 3rd round

parent 1abfb38a
......@@ -75,10 +75,10 @@ class block_featuredcourses extends block_base {
$content .= html_writer::start_tag('div', array('class' => 'summary'));
$content .= $chelper->get_course_formatted_summary($course,
array('overflowdiv' => true, 'noclean' => true, 'para' => false));
$content .= html_writer::end_tag('div'); // .summary
$content .= html_writer::end_tag('div');
}
// display course overview files
// Display course overview files.
$contentimages = $contentfiles = '';
foreach ($course->get_course_overviewfiles() as $file) {
$isimage = $file->is_valid_image();
......
......@@ -31,7 +31,6 @@ class block_featuredcourses_delete_featuredcourse_form extends moodleform {
public function definition() {
$mform =& $this->_form;
// hidden elements
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'courseid');
......
......@@ -71,12 +71,12 @@ if ($editform->is_cancelled()) {
$site = get_site();
$PAGE->set_title(get_string('editpagetitle', 'block_featuredcourses'));
$PAGE->set_heading($site->fullname . ' - ' .
get_string('pluginname', 'block_featuredcourses'));
$PAGE->set_heading($site->fullname . ' - ' . get_string('pluginname', 'block_featuredcourses'));
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('editpagedesc', 'block_featuredcourses'));
echo $OUTPUT->header(),
$editform->display();
$OUTPUT->heading(get_string('editpagedesc', 'block_featuredcourses')),
echo $OUTPUT->footer();
$editform->render(),
$OUTPUT->footer();
......@@ -34,45 +34,52 @@ class featuredcourses_form extends moodleform {
/**
* Form definition.
*/
function definition() {
public function definition() {
global $CFG;
$mform = $this->_form;
$availablecourses = $this->_customdata['availablecourses']; // this contains the data of this form
$featuredcourses = $this->_customdata['featuredcourses']; // this contains the data of this form
$availablecourses = $this->_customdata['availablecourses'];
$featuredcourses = $this->_customdata['featuredcourses'];
$availablecourseslist = array();
foreach ($availablecourses as $c) {
$availablecourseslist[$c->id] = $c->shortname . ' : ' . $c->fullname;
}
// Forms to edit existing featured courses
// Forms to edit existing featured courses.
foreach ($featuredcourses as $c) {
$mform->addElement('header','featured', get_string('featuredcourse', 'block_featuredcourses', $c->shortname . ' - '. $c->fullname));
$mform->addElement('header', 'featured',
get_string('featuredcourse', 'block_featuredcourses', $c->shortname . ' - '. $c->fullname));
$mform->addElement('hidden', 'featured['.$c->id.'][id]', null);
$mform->setType('featured['.$c->id.'][id]', PARAM_INT);
$mform->setConstant('featured['.$c->id.'][id]', $c->id);
$mform->addElement('text', 'featured['.$c->id.'][sortorder]', get_string('sortorder', 'block_featuredcourses'));
$mform->addRule('featured['.$c->id.'][sortorder]', get_string('missingsortorder', 'block_featuredcourses'), 'required', null, 'client');
$mform->addRule('featured['.$c->id.'][sortorder]',
get_string('missingsortorder', 'block_featuredcourses'), 'required', null, 'client');
$mform->setType('featured['.$c->id.'][sortorder]', PARAM_INT);
$mform->setDefault('featured['.$c->id.'][sortorder]', $c->sortorder);
$mform->addElement('static', 'link', get_string('deletelink', 'block_featuredcourses', $CFG->wwwroot.'/blocks/featuredcourses/delete_featuredcourse.php?courseid='.$c->id));
$mform->addElement('static', 'link',
get_string('deletelink', 'block_featuredcourses',
$CFG->wwwroot.'/blocks/featuredcourses/delete_featuredcourse.php?courseid='.$c->id));
}
// Add a new featured course
$mform->addElement('header','add', get_string('addfeaturedcourse', 'block_featuredcourses'));
// Add a new featured course.
$mform->addElement('header', 'add', get_string('addfeaturedcourse', 'block_featuredcourses'));
$mform->addElement('checkbox', 'doadd', get_string('doadd', 'block_featuredcourses'));
$mform->addElement('select', 'newfeatured[courseid]', get_string('courseid', 'block_featuredcourses'), $availablecourseslist);
$mform->addRule('newfeatured[courseid]', get_string('missingcourseid', 'block_featuredcourses'), 'required', null, 'client');
$mform->addElement('select', 'newfeatured[courseid]',
get_string('courseid', 'block_featuredcourses'), $availablecourseslist);
$mform->addRule('newfeatured[courseid]', get_string('missingcourseid', 'block_featuredcourses'),
'required', null, 'client');
$mform->disabledIf('newfeatured[courseid]', 'doadd', 'notchecked');
$mform->addElement('text', 'newfeatured[sortorder]', get_string('sortorder', 'block_featuredcourses'));
$mform->addRule('newfeatured[sortorder]', get_string('missingsortorder', 'block_featuredcourses'), 'required', null, 'client');
$mform->addRule('newfeatured[sortorder]', get_string('missingsortorder', 'block_featuredcourses'),
'required', null, 'client');
$mform->setType('newfeatured[sortorder]', PARAM_INT);
$mform->disabledIf('newfeatured[sortorder]', 'doadd', 'notchecked');
......
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment