/** * Test addclasstable->get_item_display_options() */ public function test_get_item_display_options() { $this->load_csv_data(); $class = new pmclass(100); $class->load(); $items = array(); $url = new moodle_url('http://localhost/'); $addclasstable = new addclasstable($items, $url); $option = $addclasstable->get_item_display_options('', $class); $expected = '<a href="index.php?s=crscat&section=curr&clsid=100&action=savenew">Choose</a>'; $this->assertEquals($expected, $option); }
function display_add() { // action_add global $OUTPUT; $crsid = cm_get_param('crsid', 0); $sort = $this->optional_param('sort', 'startdate', PARAM_ALPHA); $dir = $this->optional_param('dir', 'ASC', PARAM_ALPHA); if ($sort == 'timeofday') { $sort = 'starttimehour'; } $this->include_js(); $classes = pmclass_get_listing($sort, $dir, 0, 0, '', '', $crsid, true); if ($classes->valid() === true) { echo html_writer::tag('div', '', array('id' => 'chooseclass', 'style' => 'overflow: auto')); $table = new addclasstable($classes, new moodle_url(htmlspecialchars_decode($this->url))); $table->print_yui_table('chooseclass'); } else { echo $OUTPUT->heading(get_string('no_classes_available', 'local_elisprogram')); } unset($classes); }
function action_add() { $crsid = cm_get_param('crsid', 0); if ($classes = cmclass_get_listing('startdate', 'ASC', 0, 0, '', '', $crsid, true)) { $table = new addclasstable($classes); $table->print_table(); } else { print_heading(get_string('no_classes_available', 'block_curr_admin')); } }