Пример #1
0
 /**
  * Constructs the table
  *
  * @param course_enrolment_manager $manager
  */
 public function __construct(course_enrolment_manager $manager)
 {
     $this->manager = $manager;
     $this->page = optional_param(self::PAGEVAR, 0, PARAM_INT);
     $this->perpage = optional_param(self::PERPAGEVAR, self::DEFAULTPERPAGE, PARAM_INT);
     $this->sort = optional_param(self::SORTVAR, self::DEFAULTSORT, PARAM_ALPHANUM);
     $this->sortdirection = optional_param(self::SORTDIRECTIONVAR, self::DEFAULTSORTDIRECTION, PARAM_ALPHA);
     $this->attributes = array('class' => 'userenrolment');
     if (!in_array($this->sort, self::$sortablefields)) {
         $this->sort = self::DEFAULTSORT;
     }
     if ($this->page < 0) {
         $this->page = 0;
     }
     if ($this->sortdirection !== 'ASC' && $this->sortdirection !== 'DESC') {
         $this->sortdirection = self::DEFAULTSORTDIRECTION;
     }
     $this->id = html_writer::random_id();
     // Collect the bulk operations for the currently filtered plugin if there is one.
     $plugin = $manager->get_filtered_enrolment_plugin();
     if ($plugin and enrol_is_enabled($plugin->get_name())) {
         $this->bulkoperations = $plugin->get_bulk_operations($manager);
     }
 }