Exemple #1
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_userprofileselect($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     parent::generalized_filter_simpleselect($uniqueid, $alias, $name, $label, $advanced, $field, $options);
     $this->_tables = $options['tables'];
     $this->_fieldid = $options['fieldid'];
     //print_object($this);
 }
Exemple #2
0
 /**
  * Returns the condition to be used with SQL where
  * @param array $data filter settings
  * @return string the filtering condition or null if the filter is disabled
  */
 function get_sql_filter($data)
 {
     if ($data['value'] === 0) {
         return 'TRUE';
     }
     return parent::get_sql_filter($data);
 }
Exemple #3
0
 /**
  * Returns the condition to be used with SQL where
  * @param array $data filter settings
  * @return array the filtering condition with optional parameters 
  *               or null if the filter is disabled
  */
 function get_sql_filter($data)
 {
     if ($data['value'] === 0) {
         return array('TRUE', array());
     }
     return parent::get_sql_filter($data);
 }
 /**
  * Returns the condition to be used with SQL where
  * @uses $CFG
  * @param array $data filter settings
  * @return string the filtering condition or null if the filter is disabled
  */
 function get_sql_filter($data)
 {
     global $CFG;
     $sql = parent::get_sql_filter($data);
     $full_fieldname = $this->get_full_fieldname();
     if (empty($full_fieldname)) {
         return null;
     }
     $sql = "{$this->_outerfield} IN " . " (SELECT {$this->_innerfield}" . ' FROM ' . $CFG->prefix . $this->_table . ' ' . $this->_alias . $this->_wrapper . '  WHERE ' . $sql . ')';
     return $sql;
 }
 /**
  * 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_custom_field_select($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     parent::generalized_filter_simpleselect($uniqueid, $alias, $name, $label, $advanced, $field, $options);
     if (!array_key_exists('datatype', $options)) {
         print_error('missing_datatype', 'elis_core');
     }
     if (!array_key_exists($options['datatype'], $this->_fieldtypes)) {
         print_error('unknown_datatype', 'elis_core');
     }
     if (array_key_exists('wrapper', $options)) {
         $this->_wrapper = $options['wrapper'];
     }
     if (array_key_exists('innerfield', $options)) {
         $this->_innerfield = $options['innerfield'];
     }
     $this->_datatype = $options['datatype'];
     $this->_fieldid = $options['fieldid'];
     //set up a "prefix" for the subquery, typically involving IN or EXISTS
     if (!empty($options['subqueryprefix'])) {
         //manually specified via constructor
         $this->_subqueryprefix = $options['subqueryprefix'];
     } else {
         //default to "fieldname IN ..."
         $full_fieldname = $this->get_full_fieldname();
         $this->_subqueryprefix = "{$full_fieldname} IN";
     }
     //allow for specification of extra conditions to impose on the IN/ EXISTS subquery
     $this->_extraconditions = '';
     if (!empty($options['extraconditions'])) {
         $this->_extraconditions = $options['extraconditions'];
     }
     if (!empty($options['contextlevel'])) {
         //store the context level if it's specified
         $this->_contextlevel = $options['contextlevel'];
     }
 }
 /**
  * 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_custom_field_select($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     //ob_start();
     //var_dump($options);
     //$tmp = ob_get_contents();
     //ob_end_clean();
     //error_log("generalized_filter_custom_field_select($uniqueid, $alias, $name, $label, $advanced, $field, options = {$tmp}");
     parent::generalized_filter_simpleselect($uniqueid, $alias, $name, $label, $advanced, $field, $options);
     if (!array_key_exists('datatype', $options)) {
         print_error('missing_datatype', 'local_eliscore');
     }
     if (!array_key_exists($options['datatype'], $this->_fieldtypes)) {
         print_error('unknown_datatype', 'local_eliscore');
     }
     if (array_key_exists('wrapper', $options)) {
         $this->_wrapper = $options['wrapper'];
     }
     if (array_key_exists('innerfield', $options)) {
         $this->_innerfield = $options['innerfield'];
     }
     $this->_datatype = $options['datatype'];
     $this->_fieldid = $options['fieldid'];
     //set up a "prefix" for the subquery, typically involving IN or EXISTS
     if (!empty($options['subqueryprefix'])) {
         //manually specified via constructor
         $this->_subqueryprefix = $options['subqueryprefix'];
     } else {
         $this->_subqueryprefix = "{$alias}.id IN ";
     }
     //allow for specification of extra conditions to impose on the IN/ EXISTS subquery
     $this->_extraconditions = '';
     if (!empty($options['extraconditions'])) {
         $this->_extraconditions = $options['extraconditions'];
     }
     if (!empty($options['contextlevel'])) {
         //store the context level if it's specified
         $this->_contextlevel = $options['contextlevel'];
     }
 }
Exemple #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
  */
 function generalized_filter_yesno($uniqueid, $alias, $name, $label, $advanced, $field, $options = array())
 {
     $options['choices'] = array(0 => get_string('no'), 1 => get_string('yes'));
     parent::generalized_filter_simpleselect($uniqueid, $alias, $name, $label, $advanced, $field, $options);
 }