Stud.IP  5.4
AdminCourseFilter Class Reference

Public Member Functions

 __construct ()
 
 getCourses ()
 
 countCourses ()
 
 fetchCourses (?int $limit=null)
 
 getCoursesForAdminWidget (string $order_by='name')
 

Static Public Member Functions

static get ($reset_settings=false)
 

Data Fields

 $query = null
 
 $max_show_courses = 500
 
 $settings = []
 

Protected Member Functions

 initSettings ()
 

Static Protected Attributes

static $instance = null
 

Detailed Description

Class AdminCourseFilter

The main class to filter all courses for admins. It's a singleton class, so you better call it with AdminCourseFilter::get(). The whole class is created to provide a nice hook for plugins to add special filters into the admin-area of Stud.IP.

To add a filter with a plugin, listen to the notification "AdminCourseFilterWillQuery" like this:

NotificationCenter::addObserver($this, "addMyFilter", "AdminCourseFilterWillQuery");

Where $this is an object and "addMyFilter" a method. Such a method might look like this:

public function addLectureshipFilter($event, $filter)
{
    if ($GLOBALS['user']->cfg->getValue("LECTURESHIP_FILTER")) {
        $filter->query->join('lehrauftrag', 'seminare.Seminar_id = lehrauftrag.seminar_id');
    }
}

Within this method you alter the public $filter->query object. That query object is of type SQLQuery.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Constructor of the singleton-object.

Member Function Documentation

◆ countCourses()

countCourses ( )
Returns
integer number of courses that this filter would return

◆ fetchCourses()

fetchCourses ( ?int  $limit = null)
Parameters
int | null$limit
Returns
Course[]

◆ get()

static get (   $reset_settings = false)
static

returns an AdminCourseFilter singleton object

Returns
AdminCourseFilter or derived-class object

◆ getCourses()

getCourses ( )

Returns the data of the resultset of the AdminCourseFilter. Also saves the settings in the session. Note that a notification AdminCourseFilterWillQuery will be posted, before the result is computed. Plugins may register at this event to fully alter this AdminCourseFilter-object and so the resultset.

Returns
array associative array with seminar_ids as keys and seminar-data-arrays as values.

◆ getCoursesForAdminWidget()

getCoursesForAdminWidget ( string  $order_by = 'name')

Returns the data of the resultset of the AdminCourseFilter.

Parameters
string$order_bypossible values name or number

Note that a notification AdminCourseFilterWillQuery will be posted, before the result is computed. Plugins may register at this event to fully alter this AdminCourseFilter-object and so the resultset.

Returns
array associative array with seminar_ids as keys and seminar-data-arrays as values.

◆ initSettings()

initSettings ( )
protected

Field Documentation

◆ $instance

$instance = null
staticprotected

◆ $max_show_courses

$max_show_courses = 500

◆ $query

$query = null

◆ $settings

$settings = []

The documentation for this class was generated from the following file: