Ejemplo n.º 1
0
 /**
  * Constructor
  * @param string $alias aliacs for the table being filtered on
  * @param string $name the name of the filter instance
  * @param string $label the label of the filter instance
  * @param boolean $advanced advanced form element flag
  * @param string $field user table filed name
  */
 function generalized_filter_date($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced, !empty($options['help']) ? $options['help'] : array('date', $label, 'local_eliscore'));
     $this->_field = $field;
     if (isset($options['never_included'])) {
         $this->_never_included = $options['never_included'];
     }
     if (isset($options['timezone'])) {
         $this->_timezone = $options['timezone'];
     }
     if (isset($options['dateformat'])) {
         $this->_dateformat = $options['dateformat'];
     }
     if (isset($options['choices']['startyear'])) {
         $this->_startyear = $options['choices']['startyear'];
     }
     if (isset($options['choices']['stopyear'])) {
         $this->_stopyear = $options['choices']['stopyear'];
     }
     if (isset($options['inctime'])) {
         $this->_inctime = $options['inctime'];
     } else {
         if (isset($options['choices']['inctime'])) {
             $this->_inctime = $options['choices']['inctime'];
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Constructor
  * @param string $name the name of the filter instance
  * @param string $label the label of the filter instance
  * @param boolean $advanced advanced form element flag
  * @param string $field user table field name
  * @param array $options mixed array of checkbox options - see above
  */
 function generalized_filter_checkboxes($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced, !empty($options['help']) ? $options['help'] : null);
     $this->_field = $field;
     $this->_options = $options;
     $this->_isrequired = !empty($options['isrequired']) ? $options['isrequired'] : false;
 }
Ejemplo n.º 3
0
 /**
  * Constructor
  * @param string $alias aliacs for the table being filtered on
  * @param string $name the name of the filter instance
  * @param string $label the label of the filter instance
  * @param boolean $advanced advanced form element flag
  * @param string $field user table filed name
  */
 function generalized_filter_text($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced, !empty($options['help']) ? $options['help'] : array('text', $label, 'local_eliscore'));
     $this->_field = $field;
     if (isset($options['casesensitive'])) {
         $this->_casesensitive = $options['casesensitive'];
     }
 }
Ejemplo n.º 4
0
 /**
  * Constructor
  * @param string $alias aliacs for the table being filtered on
  * @param string $name the name of the filter instance
  * @param string $label the label of the filter instance
  * @param boolean $advanced advanced form element flag
  * @param string $field user table filed name
  */
 function generalized_filter_date($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced, !empty($options['help']) ? $options['help'] : array('date', $label, 'filters'));
     $this->_field = $field;
     if (isset($options['never_included'])) {
         $this->_never_included = $options['never_included'];
     }
 }
Ejemplo n.º 5
0
 /**
  * Constructor
  * @param string $uniqueid the name of the column
  * @param string $alias an alias for the column name
  * @param string $name the name of the filter instance
  * @param string $label the label of the filter instance
  * @param boolean $advanced advanced form element flag
  * @param string $field user table filed name
  * @param array $options select options <= in this case, this contains the list of selected custom fields
  * @return none
  */
 function generalized_filter_custom_field_multiselect($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced);
     global $SESSION;
     // Set up required class variables
     $this->_field = $field;
     $this->_fieldidlist = base64_encode(serialize($options['fieldids']));
     $this->_block_instance = $options['block_instance'];
 }
Ejemplo n.º 6
0
 /**
  * Constructor
  * @param string $name the name of the filter instance
  * @param string $label the label of the filter instance
  * @param boolean $advanced advanced form element flag
  * @param string $field user table filed name
  * @param array $options select options
  */
 function generalized_filter_display_text($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced, !empty($options['help']) ? $options['help'] : array('displaytext', $label, 'local_eliscore'));
     if (!empty($options['columns'])) {
         $this->_columns = $options['columns'];
     }
     if (!empty($options['rows'])) {
         $this->_rows = $options['rows'];
     }
 }
Ejemplo n.º 7
0
 /**
  * Constructor
  * @param string $name the name of the filter instance
  * @param string $label the label of the filter instance
  * @param boolean $advanced advanced form element flag
  * @param string $field user table filed name
  * @param array $options select options
  * @param mixed $default option
  */
 function generalized_filter_equalityselect($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     global $CFG;
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced, !empty($options['help']) ? $options['help'] : array('select', $label, 'local_eliscore'));
     $this->_field = $field;
     $choices = $options['choices'];
     $this->_options = $choices;
     $this->_default = $options['default'];
     $this->_numeric = $options['numeric'];
 }
Ejemplo n.º 8
0
 /**
  * Constructor
  *
  * @param string $uniqueid A unique id
  * @param string $alias    An alias
  * @param string $name     A name
  * @param string $label    A label
  * @param bool   $advanced Whether it should be hidden when advanced items are hidden
  * @param object $help     The help object
  * @param array  $options  An array of options
  */
 function generalized_filter_display_table($uniqueid, $alias, $name, $label, $advanced, $help = null, $options = array())
 {
     $this->options = $options;
     if (array_key_exists('lang', $options)) {
         $this->languagefile = $options['lang'];
     }
     if (array_key_exists('help', $options)) {
         $this->help = $options['help'];
     }
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced, $help);
 }
Ejemplo n.º 9
0
 /**
  * Constructor
  *
  * @param string $name the name of the filter instance
  * @param string $label the label of the filter instance
  * @param boolean $advanced advanced form element flag
  * @param string $field user table filed name
  * @param array $options select options
  */
 function generalized_filter_simpleselect($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced, !empty($options['help']) ? $options['help'] : array('simpleselect', $label, 'local_eliscore'));
     if (!is_array($options)) {
         $options = array($options);
     }
     foreach ($this->_optionfields as $var => $option) {
         if (array_key_exists($option, $options)) {
             $this->{$var} = $options[$option];
         }
     }
 }
Ejemplo n.º 10
0
 /**
  * Constructor
  * @param string $name the name of the filter instance
  * @param string $label the label of the filter instance
  * @param boolean $advanced advanced form element flag
  * @param string $field user table filed name
  * @param array $options select options
  */
 function generalized_filter_simpleselect($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced, !empty($options['help']) ? $options['help'] : array('simpleselect', $label, 'filters'));
     $this->_field = $field;
     $extrafields = array('_options' => 'choices', '_numeric' => 'numeric', '_anyvalue' => 'anyvalue', '_noany' => 'noany', '_onchange' => 'onchange', '_multiple' => 'multiple', '_class' => 'class');
     if (!is_array($options)) {
         $options = array($options);
     }
     foreach ($extrafields as $var => $extra) {
         if (array_key_exists($extra, $options)) {
             $this->{$var} = $options[$extra];
         }
     }
 }
 /**
  * Constructor
  * @param string $uniqueid the name of the column
  * @param string $alias an alias for the column name
  * @param string $name the name of the filter instance
  * @param string $label the label of the filter instance
  * @param boolean $advanced advanced form element flag
  * @param string $field user table field name
  * @param array $options select options <= in this case, this contains the list of selected custom fields
  */
 function generalized_filter_custom_field_multiselect_values($uniqueid, $alias, $name, $label, $advanced, $field, $options = array(), $fieldidlist = array(), $fieldnamelist = array(), $action = '')
 {
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced);
     // Initialize class variables
     $this->_field = $field;
     $this->_block_instance = $options['block_instance'];
     $this->_field_exceptions = !empty($options['field_exceptions']) ? $options['field_exceptions'] : array();
     $this->_fieldidlist = $fieldidlist;
     $this->_reportname = isset($options['reportname']) ? $options['reportname'] : '';
     if (isset($options['help'])) {
         $this->_filterhelp = $options['help'];
     } else {
         $this->_filterhelp = null;
     }
 }
Ejemplo n.º 12
0
 /**
  * Constructor
  * @param string $name the name of the filter instance
  * @param string $label the label of the filter instance
  * @param boolean $advanced advanced form element flag
  * @param string $field user table filed name
  * @param array $options select options
  * @param mixed $default option
  */
 function generalized_filter_profileselect($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     global $CFG;
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced, !empty($options['help']) ? $options['help'] : array('select', $label, 'filters'));
     $this->_field = $field;
     $choices = array();
     if ($profile_field_record_id = get_field('user_info_field', 'id', 'shortname', $options['profilefieldname'])) {
         if ($profile_options = get_records_sql("SELECT DISTINCT data\n                                                   FROM {$CFG->prefix}user_info_data\n                                                   WHERE fieldid = {$profile_field_record_id}")) {
             foreach ($profile_options as $profile_option) {
                 $choices[$profile_option->data] = $profile_option->data;
             }
         }
     }
     $this->_options = $choices;
     $this->_profilefieldname = $options['profilefieldname'];
     $this->_default = $options['default'];
 }
Ejemplo n.º 13
0
 /**
  * Constructor
  * @param string $name the name of the filter instance
  * @param string $label the label of the filter instance
  * @param boolean $advanced advanced form element flag
  * @param string $field user table filed name
  * @param array $options select options
  * @param mixed $default option
  * @uses $DB
  */
 function generalized_filter_profileselect($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     global $DB;
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced, !empty($options['help']) ? $options['help'] : array('select', $label, 'local_eliscore'));
     $this->_field = $field;
     $choices = array();
     if ($profile_field_record_id = $DB->get_field('user_info_field', 'id', array('shortname' => $options['profilefieldname']))) {
         $profile_options = $DB->get_recordset_sql("SELECT DISTINCT data FROM {user_info_data} WHERE fieldid = ?", array($profile_field_record_id));
         foreach ($profile_options as $profile_option) {
             $choices[$profile_option->data] = $profile_option->data;
         }
         unset($profile_options);
     }
     $this->_options = $choices;
     $this->_profilefieldname = $options['profilefieldname'];
     $this->_default = $options['default'];
 }
Ejemplo n.º 14
0
 /**
  * Constructor
  * @param  string   $name      the name of the filter instance
  * @param  string   $label     the label of the filter instance
  * @param  boolean  $advanced  advanced form element flag
  * @param  string   $field     user table filed name
  * @param  array    $options   select options
  */
 public function __construct($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced, !empty($options['help']) ? $options['help'] : array('simpleselect', $label, 'filters'));
     $this->_field = $field;
     if (!isset($options['report'])) {
         print_error('autocomplete_noreport', 'local_eliscore');
     }
     $this->_parent_report = $options['report'];
     $this->parent_report_instance = php_report::get_default_instance($options['report']);
     if (isset($options['ui']) && in_array($options['ui'], array('inline', 'popup'), true)) {
         $this->_ui = $options['ui'];
     }
     if (!empty($options['restriction_sql']) && is_string($options['restriction_sql'])) {
         $this->_restriction_sql = $options['restriction_sql'];
     }
     if (!empty($options['popup_title'])) {
         $this->_popup_title = $options['popup_title'];
     }
     if (isset($options['label_template'])) {
         $this->_label_template = $options['label_template'];
     } else {
         $this->_label_template = !empty($this->_fields[0]) ? $this->_fields[0] : '';
     }
     if (isset($options['selection_enabled']) && is_bool($options['selection_enabled'])) {
         $this->_selection_enabled = $options['selection_enabled'];
     }
     if (!empty($options['defaults']['id'])) {
         $this->_default_id = $options['defaults']['id'];
     }
     if (!empty($options['defaults']['label'])) {
         $this->_default_label = $options['defaults']['label'];
     }
     if (!empty($options['required'])) {
         $this->_required = $options['required'];
     }
     $this->_useid = $field == 'id';
     $this->load_options($options);
 }
Ejemplo n.º 15
0
 /**
  * Constructor
  * @param string $alias aliacs for the table being filtered on
  * @param string $name the name of the filter instance
  * @param string $label the label of the filter instance
  * @param boolean $advanced advanced form element flag
  * @param string $field user table filed name
  */
 function generalized_filter_text($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced, !empty($options['help']) ? $options['help'] : array('text', $label, 'filters'));
     $this->_field = $field;
 }
Ejemplo n.º 16
0
 function get_default_values($filter_data)
 {
     if (isset($this->_options['default'])) {
         foreach ($filter_data as $key => $val) {
             // Should be only the one key ...
             return array($key => $this->_options['default']);
         }
     }
     return parent::get_default_values($filter_data);
 }
Ejemplo n.º 17
0
 /**
  * Constructor
  * @param string $name the name of the filter instance
  * @param string $label the label of the filter instance
  * @param boolean $advanced advanced form element flag
  * @param string $field user table field name
  * @param array $options mixed array of radio button options - see above
  */
 function generalized_filter_radiobuttons($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced, !empty($options['help']) ? $options['help'] : null);
     $this->_field = $field;
     $this->_options = $options;
 }
Ejemplo n.º 18
0
 /**
  * Constructor
  * @param string $name the name of the filter instance
  * @param string $label the label of the filter instance
  * @param boolean $advanced advanced form element flag
  * @param string $field user table filed name
  * @param array $options select options
  */
 function generalized_filter_clustertree($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     $this->options = $options;
     if (!array_key_exists('fieldset', $options)) {
         $this->options['fieldset'] = true;
     }
     parent::generalized_filter_type($uniqueid, $alias, $name, $label, $advanced, $field);
 }
Ejemplo n.º 19
0
 function get_default_values($filter_data)
 {
     if (isset($this->_default)) {
         return array($this->_uniqueid => $this->_default);
     }
     return parent::get_default_values($filter_data);
 }