diff --git a/cohort/assign.php b/cohort/assign.php index 6befd5b0e44..0d6c83af9ec 100644 --- a/cohort/assign.php +++ b/cohort/assign.php @@ -17,13 +17,12 @@ /** * Cohort related management functions, this file needs to be included manually. * - * @package core - * @subpackage cohort + * @package core_cohort * @copyright 2010 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once('../config.php'); +require('../config.php'); require_once($CFG->dirroot.'/cohort/locallib.php'); $id = required_param('id', PARAM_INT); @@ -41,7 +40,7 @@ $PAGE->set_url('/cohort/assign.php', array('id'=>$id)); $returnurl = new moodle_url('/cohort/index.php', array('contextid'=>$cohort->contextid)); if (!empty($cohort->component)) { - // we can not manually edit cohorts that were created by external systems, sorry + // We can not manually edit cohorts that were created by external systems, sorry. redirect($returnurl); } diff --git a/cohort/edit.php b/cohort/edit.php index 721d790ed67..3a18ddb9327 100644 --- a/cohort/edit.php +++ b/cohort/edit.php @@ -1,5 +1,4 @@ . - /** * Cohort related management functions, this file needs to be included manually. * - * @package core - * @subpackage cohort + * @package core_cohort * @copyright 2010 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -58,7 +55,7 @@ require_capability('moodle/cohort:manage', $context); $returnurl = new moodle_url('/cohort/index.php', array('contextid'=>$context->id)); if (!empty($cohort->component)) { - // we can not manually edit cohorts that were created by external systems, sorry + // We can not manually edit cohorts that were created by external systems, sorry. redirect($returnurl); } @@ -97,12 +94,12 @@ if ($delete and $cohort->id) { $editoroptions = array('maxfiles'=>0, 'context'=>$context); if ($cohort->id) { - // edit existing + // Edit existing. $cohort = file_prepare_standard_editor($cohort, 'description', $editoroptions, $context); $strheading = get_string('editcohort', 'cohort'); } else { - // add new + // Add new. $cohort = file_prepare_standard_editor($cohort, 'description', $editoroptions, $context); $strheading = get_string('addcohort', 'cohort'); } @@ -125,7 +122,7 @@ if ($editform->is_cancelled()) { cohort_add_cohort($data); } - // use new context id, it could have been changed + // Use new context id, it could have been changed. redirect(new moodle_url('/cohort/index.php', array('contextid'=>$data->contextid))); } diff --git a/cohort/edit_form.php b/cohort/edit_form.php index 81e7a7cb6c0..c23c249b97c 100644 --- a/cohort/edit_form.php +++ b/cohort/edit_form.php @@ -1,5 +1,4 @@ dirroot . '/lib/formslib.php'); @@ -49,7 +45,7 @@ class cohort_edit_form extends moodleform { $mform->addElement('select', 'contextid', get_string('context', 'role'), $options); $mform->addElement('text', 'idnumber', get_string('idnumber', 'cohort'), 'maxlength="254" size="50"'); - $mform->setType('idnumber', PARAM_RAW); // idnumbers are plain text, must not be changed + $mform->setType('idnumber', PARAM_RAW); // Idnumbers are plain text, must not be changed. $mform->addElement('editor', 'description_editor', get_string('description', 'cohort'), null, $editoroptions); $mform->setType('description_editor', PARAM_RAW); @@ -69,7 +65,7 @@ class cohort_edit_form extends moodleform { $idnumber = trim($data['idnumber']); if ($idnumber === '') { - // fine, empty is ok + // Fine, empty is ok. } else if ($data['id']) { $current = $DB->get_record('cohort', array('id'=>$data['id']), '*', MUST_EXIST); @@ -95,16 +91,16 @@ class cohort_edit_form extends moodleform { $options = array(); $syscontext = context_system::instance(); if (has_capability('moodle/cohort:manage', $syscontext)) { - $options[$syscontext->id] = print_context_name($syscontext); + $options[$syscontext->id] = $syscontext->get_context_name(); } foreach ($displaylist as $cid=>$name) { $context = context_coursecat::instance($cid); $options[$context->id] = $name; } - // always add current - this is not likely, but if the logic gets changed it might be a problem + // Always add current - this is not likely, but if the logic gets changed it might be a problem. if (!isset($options[$currentcontextid])) { $context = context::instance_by_id($currentcontextid, MUST_EXIST); - $options[$context->id] = print_context_name($syscontext); + $options[$context->id] = $syscontext->get_context_name(); } return $options; } diff --git a/cohort/index.php b/cohort/index.php index 00aab668325..0ce53bd872f 100644 --- a/cohort/index.php +++ b/cohort/index.php @@ -1,5 +1,4 @@ header(); echo $OUTPUT->heading(get_string('cohortsin', 'cohort', print_context_name($context))); -// add search form +// Add search form. $search = html_writer::start_tag('form', array('id'=>'searchcohortquery', 'method'=>'get')); $search .= html_writer::start_tag('div'); -$search .= html_writer::label(get_string('searchcohort', 'cohort').':', 'cohort_search_q'); +$search .= html_writer::label(get_string('searchcohort', 'cohort'), 'cohort_search_q'); // No : in form labels! $search .= html_writer::empty_tag('input', array('id'=>'cohort_search_q', 'type'=>'text', 'name'=>'search', 'value'=>$searchquery)); $search .= html_writer::empty_tag('input', array('type'=>'submit', 'value'=>get_string('search', 'cohort'))); $search .= html_writer::end_tag('div'); @@ -83,7 +81,7 @@ echo $search; $cohorts = cohort_get_cohorts($context->id, $page, 25, $searchquery); -// output pagination bar +// Output pagination bar. $params = array('page' => $page); if ($contextid) { $params['contextid'] = $contextid; @@ -98,7 +96,7 @@ $data = array(); foreach($cohorts['cohorts'] as $cohort) { $line = array(); $line[] = format_string($cohort->name); - $line[] = s($cohort->idnumber); // plain text + $line[] = s($cohort->idnumber); // All idnumbers are plain text. $line[] = format_text($cohort->description, $cohort->descriptionformat); $line[] = $DB->count_records('cohort_members', array('cohortid'=>$cohort->id)); @@ -137,4 +135,4 @@ if ($manager) { echo $OUTPUT->single_button(new moodle_url('/cohort/edit.php', array('contextid'=>$context->id)), get_string('add')); } -echo $OUTPUT->footer(); \ No newline at end of file +echo $OUTPUT->footer(); diff --git a/cohort/lib.php b/cohort/lib.php index 88b00f15da7..f2d425079eb 100644 --- a/cohort/lib.php +++ b/cohort/lib.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); /** * Add new cohort. * - * @param object $cohort - * @return int + * @param stdClass $cohort + * @return int new cohort id */ function cohort_add_cohort($cohort) { global $DB; @@ -65,7 +65,7 @@ function cohort_add_cohort($cohort) { /** * Update existing cohort. - * @param object $cohort + * @param stdClass $cohort * @return void */ function cohort_update_cohort($cohort) { @@ -82,7 +82,7 @@ function cohort_update_cohort($cohort) { /** * Delete cohort. - * @param object $cohort + * @param stdClass $cohort * @return void */ function cohort_delete_cohort($cohort) { @@ -102,7 +102,7 @@ function cohort_delete_cohort($cohort) { * Somehow deal with cohorts when deleting course category, * we can not just delete them because they might be used in enrol * plugins or referenced in external systems. - * @param object $category + * @param stdClass $category * @return void */ function cohort_delete_category($category) { diff --git a/cohort/locallib.php b/cohort/locallib.php index 7465140429b..cfc4b73efd8 100644 --- a/cohort/locallib.php +++ b/cohort/locallib.php @@ -27,6 +27,7 @@ defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot . '/cohot/lib.php'); require_once($CFG->dirroot . '/user/selector/lib.php'); + /** * Cohort assignment candidates */ @@ -40,12 +41,12 @@ class cohort_candidate_selector extends user_selector_base { /** * Candidate users - * @param $search + * @param string $search * @return array */ public function find_users($search) { global $DB; - //by default wherecondition retrieves all users except the deleted, not confirmed and guest + // By default wherecondition retrieves all users except the deleted, not confirmed and guest. list($wherecondition, $params) = $this->search_sql($search, 'u'); $params['cohortid'] = $this->cohortid; @@ -103,12 +104,12 @@ class cohort_existing_selector extends user_selector_base { /** * Candidate users - * @param $search + * @param string $search * @return array */ public function find_users($search) { global $DB; - //by default wherecondition retrieves all users except the deleted, not confirmed and guest + // By default wherecondition retrieves all users except the deleted, not confirmed and guest. list($wherecondition, $params) = $this->search_sql($search, 'u'); $params['cohortid'] = $this->cohortid;