/** * Constructor. * * @param moodle_database &$DB The global moodle_database object. * @param string $name The name of the filter. Used when receiving data to determine where to send the data. * @param string $label The label that will be displayed on the filter button. * @param array $fielddata An array of field information used by the filter. Formatted like [field]=>[label]. * Usually this is what field the filter will use to affect the datatable results, but refer * to the individual filter for specifics. * @param string $endpoint The endpoint to make requests to, when searching for a choice. */ public function __construct(moodle_database &$DB, $name, $label, array $fielddata = array(), $endpoint = null) { if (empty($endpoint)) { throw new Exception("You must specify an endpoint URL for menuofchoices filter '{$name}'"); } $this->endpoint = strpos($endpoint, '?') !== false ? $endpoint . '&m=filter' : $endpoint . '?m=filter'; parent::__construct($DB, $name, $label, $fielddata); }
/** * Constructor. * * @param moodle_database &$DB The global moodle_database object. * @param string $name The name of the filter. Used when receiving data to determine where to send the data. * @param string $label The label that will be displayed on the filter button. * @param array $fielddata An array of field information used by the filter. Formatted like [field]=>[label]. Usually this is * what field the filter will use to affect the datatable results, but refer to the individual filter * for specifics. * @param string $endpoint The endpoint to make requests to, when searching for a choice. */ public function __construct(moodle_database &$DB, $name, $label, array $fielddata = array(), $endpoint = null) { if (empty($endpoint)) { throw new Exception("You must specify an endpoint URL for usersetuser_autoassigned filter '{$name}'"); } $this->endpoint = strpos($endpoint, '?') !== false ? $endpoint . '&m=filter' : $endpoint . '?m=filter'; $this->choices = array('auto' => get_string('yes', 'moodle'), 'manual' => get_string('no', 'moodle')); parent::__construct($DB, $name, $label, array()); }
/** * Constructor. * * @param moodle_database &$DB The global moodle_database object. * @param string $name The name of the filter. Used when receiving data to determine where to send the data. * @param string $label The label that will be displayed on the filter button. * @param array $fielddata An array of field information used by the filter. Formatted like [field]=>[label]. * Usually this is what field the filter will use to affect the datatable results, but refer * to the individual filter for specifics. * @param string $endpoint The endpoint to make requests to, when searching for a choice. * @param string $choicestable The table to use for available choices. * @param string $choicesfield The the field to use for available choices. */ public function __construct(moodle_database &$DB, $name, $label, array $fielddata = array(), $endpoint = null, $choicestable = '', $choicesfield = '') { if (empty($endpoint)) { throw new Exception("You must specify an endpoint URL for searchselect filter '{$name}'"); } $this->endpoint = strpos($endpoint, '?') !== false ? $endpoint . '&m=filter' : $endpoint . '?m=filter'; if (empty($choicestable) || !is_string($choicestable)) { throw new Exception('You must specify a non-empty string for the choices table parameter.'); } $this->choicestable = $choicestable; if (empty($choicesfield) || !is_string($choicesfield)) { throw new Exception('You must specify a non-empty string for the choices field parameter'); } $this->choicesfield = $choicesfield; parent::__construct($DB, $name, $label, $fielddata); }