function __construct($params = false)
 {
     parent::__construct($params);
     $this->tabs = array(array('tab_id' => 'currcourse_edit', 'page' => get_class($this), 'params' => array('action' => 'edit'), 'name' => 'Edit', 'showtab' => true, 'showbutton' => true, 'image' => 'edit.gif'), array('tab_id' => 'delete', 'page' => get_class($this), 'params' => array('action' => 'delete'), 'name' => 'Delete', 'showbutton' => true, 'image' => 'delete.gif'));
 }
Example #2
0
 /**
  * Tests associationpage's bulk_checkbox_selection_session function.
  * Saves values to the session.
  */
 public function test_bulkcheckboxselection_session()
 {
     global $SESSION, $_GET, $_POST;
     $_GET['s'] = 'test';
     $_GET['id'] = 1;
     $_GET['target'] = 'test';
     $select1 = new stdClass();
     $select1->id = 5;
     $select1->changed = true;
     $select1->selected = true;
     $select1->enrolment_date = new stdClass();
     $select1->enrolment_date->day = 24;
     $select1->enrolment_date->month = 7;
     $select1->enrolment_date->year = 2011;
     $select1->completion_date = new stdClass();
     $select1->completion_date->day = 24;
     $select1->completion_date->month = 7;
     $select1->completion_date->year = 2011;
     $select1->unenrol = 0;
     $select1->status = 2;
     $select1->grade = '95.000';
     $select1->credits = '150.00';
     $select1->locked = true;
     $select1->associd = 6;
     $select2 = new stdClass();
     $select2->id = 6;
     $select2->changed = false;
     $select2->selected = false;
     $select2->enrolment_date = new stdClass();
     $select2->enrolment_date->day = 24;
     $select2->enrolment_date->month = 7;
     $select2->enrolment_date->year = 2011;
     $select2->completion_date = new stdClass();
     $select2->completion_date->day = 24;
     $select2->completion_date->month = 7;
     $select2->completion_date->year = 2011;
     $select2->unenrol = 0;
     $select2->status = 2;
     $select2->grade = '95.000';
     $select2->credits = '150.00';
     $select2->locked = true;
     $select2->associd = 6;
     $_POST['selected_checkboxes'] = json_encode(array(json_encode($select1), json_encode($select2)));
     $associationpage = new associationpage();
     $associationpage->bulk_checkbox_selection_session();
     // Assert we have the correct basic keys.
     $this->assertInternalType('object', $SESSION);
     $this->assertObjectHasAttribute('associationpage', $SESSION);
     $this->assertInternalType('array', $SESSION->associationpage);
     $this->assertArrayHasKey('test1test', $SESSION->associationpage);
     $this->assertInternalType('array', $SESSION->associationpage['test1test']);
     // Assert changed user has session entry.
     $this->assertArrayHasKey(5, $SESSION->associationpage['test1test']);
     $this->assertInternalType('object', $SESSION->associationpage['test1test'][5]);
     // Enrolment date.
     $this->assertObjectHasAttribute('enrolment_date', $SESSION->associationpage['test1test'][5]);
     $this->assertInternalType('object', $SESSION->associationpage['test1test'][5]->enrolment_date);
     $this->assertObjectHasAttribute('day', $SESSION->associationpage['test1test'][5]->enrolment_date);
     $this->assertObjectHasAttribute('month', $SESSION->associationpage['test1test'][5]->enrolment_date);
     $this->assertObjectHasAttribute('year', $SESSION->associationpage['test1test'][5]->enrolment_date);
     $this->assertEquals($select1->enrolment_date->day, $SESSION->associationpage['test1test'][5]->enrolment_date->day);
     $this->assertEquals($select1->enrolment_date->month, $SESSION->associationpage['test1test'][5]->enrolment_date->month);
     $this->assertEquals($select1->enrolment_date->year, $SESSION->associationpage['test1test'][5]->enrolment_date->year);
     // Completion date.
     $this->assertObjectHasAttribute('completion_date', $SESSION->associationpage['test1test'][5]);
     $this->assertInternalType('object', $SESSION->associationpage['test1test'][5]->completion_date);
     $this->assertObjectHasAttribute('day', $SESSION->associationpage['test1test'][5]->completion_date);
     $this->assertObjectHasAttribute('month', $SESSION->associationpage['test1test'][5]->completion_date);
     $this->assertObjectHasAttribute('year', $SESSION->associationpage['test1test'][5]->completion_date);
     $this->assertEquals($select1->completion_date->day, $SESSION->associationpage['test1test'][5]->completion_date->day);
     $this->assertEquals($select1->completion_date->month, $SESSION->associationpage['test1test'][5]->completion_date->month);
     $this->assertEquals($select1->completion_date->year, $SESSION->associationpage['test1test'][5]->completion_date->year);
     // Other properties.
     $properties = array('unenrol', 'status', 'grade', 'credits', 'locked', 'associd');
     foreach ($properties as $prop) {
         $this->assertObjectHasAttribute($prop, $SESSION->associationpage['test1test'][5]);
         $this->assertEquals($select1->{$prop}, $SESSION->associationpage['test1test'][5]->{$prop});
     }
     // Assert non-changed user does NOT have a session entry.
     $this->assertArrayNotHasKey(6, $SESSION->associationpage['test1test']);
 }
 function __construct($params = false)
 {
     $this->tabs = array(array('tab_id' => 'edit', 'page' => get_class($this), 'params' => array('action' => 'edit'), 'name' => get_string('edit', 'block_curr_admin'), 'showtab' => true, 'showbutton' => true, 'image' => 'edit.gif'), array('tab_id' => 'delete', 'page' => get_class($this), 'params' => array('action' => 'delete'), 'name' => get_string('delete_label', 'block_curr_admin'), 'showbutton' => true, 'image' => 'delete.gif'));
     parent::__construct($params);
 }
 function __construct($params = false)
 {
     parent::__construct($params);
     $this->tabs = array(array('tab_id' => 'currcourse_edit', 'page' => get_class($this), 'params' => array('action' => 'edit'), 'name' => get_string('edit', 'block_curr_admin'), 'showtab' => true, 'showbutton' => true, 'image' => 'edit.gif'), array('tab_id' => 'prerequisites', 'page' => get_class($this), 'params' => array('action' => 'prereqedit'), 'name' => get_string('prerequisites', 'block_curr_admin'), 'showbutton' => true, 'image' => 'prereq.gif'), array('tab_id' => 'corequisites', 'page' => get_class($this), 'params' => array('action' => 'coreqedit'), 'name' => get_string('corequisites', 'block_curr_admin'), 'showbutton' => true, 'image' => 'coreq.gif'), array('tab_id' => 'delete', 'page' => get_class($this), 'params' => array('action' => 'delete'), 'name' => get_string('delete', 'block_curr_admin'), 'showbutton' => true, 'image' => 'delete.gif'));
 }