/** * Gets the enrolment action. * * Includes condition to only show for non-enrolled users. (The table can show both enrolled and not enrolled) * * @return array An array of deepsight_action objects that will be available for each element. */ public function get_actions() { $actions = parent::get_actions(); $enrolaction = new deepsight_action_enrol($this->DB, 'enrol'); $enrolaction->endpoint = strpos($this->endpoint, '?') !== false ? $this->endpoint . '&m=action' : $this->endpoint . '?m=action'; $enrolaction->condition = 'function(rowdata) { return (rowdata.meta.enrolled == true) ? false : true; }'; array_unshift($actions, $enrolaction); return $actions; }
/** * Gets the edit and unenrolment actions. * * @return array An array of deepsight_action objects that will be available for each element. */ public function get_actions() { $actions = parent::get_actions(); $editaction = new deepsight_action_enroledit($this->DB, 'edit'); $editaction->endpoint = strpos($this->endpoint, '?') !== false ? $this->endpoint . '&m=action' : $this->endpoint . '?m=action'; $unenrolaction = new deepsight_action_unenrol($this->DB, 'unenrol'); $unenrolaction->endpoint = strpos($this->endpoint, '?') !== false ? $this->endpoint . '&m=action' : $this->endpoint . '?m=action'; array_unshift($actions, $editaction, $unenrolaction); return $actions; }