Ejemplo n.º 1
0
 /**
  * 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);
 }
Ejemplo n.º 2
0
 /**
  * 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());
 }
Ejemplo n.º 3
0
 /**
  * Returns options for the javascript object (Currently only language strings).
  *
  * @return array An array of options.
  */
 public function get_js_opts()
 {
     $opts = parent::get_js_opts();
     $opts['lang_any'] = get_string('any', 'moodle');
     $opts['lang_days'] = array(0 => get_string('sun', 'calendar'), 1 => get_string('mon', 'calendar'), 2 => get_string('tue', 'calendar'), 3 => get_string('wed', 'calendar'), 4 => get_string('thu', 'calendar'), 5 => get_string('fri', 'calendar'), 6 => get_string('sat', 'calendar'));
     foreach ($opts['lang_days'] as $i => $str) {
         $opts['lang_days'][$i] = $opts['lang_days'][$i][0];
     }
     $opts['lang_months'] = array(0 => get_string('month_jan', 'local_elisprogram'), 1 => get_string('month_feb', 'local_elisprogram'), 2 => get_string('month_mar', 'local_elisprogram'), 3 => get_string('month_apr', 'local_elisprogram'), 4 => get_string('month_may', 'local_elisprogram'), 5 => get_string('month_jun', 'local_elisprogram'), 6 => get_string('month_jul', 'local_elisprogram'), 7 => get_string('month_aug', 'local_elisprogram'), 8 => get_string('month_sep', 'local_elisprogram'), 9 => get_string('month_oct', 'local_elisprogram'), 10 => get_string('month_nov', 'local_elisprogram'), 11 => get_string('month_dec', 'local_elisprogram'));
     $opts['lang_clear'] = get_string('clear', 'local_elisprogram');
     return $opts;
 }
Ejemplo n.º 4
0
 /**
  * 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);
 }
Ejemplo n.º 5
0
 /**
  * Returns options for the javascript object.
  *
  * @return array An array of options.
  */
 public function get_js_opts()
 {
     $opts = parent::get_js_opts();
     $opts['lang_any'] = get_string('any', 'moodle');
     return $opts;
 }