Created
May 13, 2020 07:59
-
-
Save Krassmus/0bcf1dc4a7d0900a11654323b2bf8c18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SemesterCourseSearch extends SQLSearch | |
{ | |
public function __construct() | |
{ | |
$this->sql = $this->getSQL(); | |
} | |
public function getTitle() | |
{ | |
return _("Veranstaltung suchen"); | |
} | |
/** | |
* returns a sql-string appropriate for the searchtype of the current class | |
* | |
* @return string | |
*/ | |
private function getSQL() | |
{ | |
$semester = Semester::findCurrent(); | |
return "SELECT DISTINCT seminare.Seminar_id, seminare.Name | |
FROM seminare | |
LEFT JOIN seminar_user ON (seminar_user.Seminar_id = seminare.Seminar_id AND seminar_user.status = 'dozent') | |
LEFT JOIN auth_user_md5 ON (auth_user_md5.user_id = seminar_user.user_id) | |
WHERE ( | |
seminare.Name LIKE :input | |
OR CONCAT(auth_user_md5.Vorname, ' ', auth_user_md5.Nachname) LIKE :input | |
OR seminare.VeranstaltungsNummer LIKE :input | |
OR seminare.Untertitel LIKE :input | |
OR seminare.Beschreibung LIKE :input | |
OR seminare.Ort LIKE :input | |
OR seminare.Sonstiges LIKE :input | |
) | |
AND seminare.visible = 1 | |
AND ( | |
seminare.start_time = ".DBManaget::get()->quote($semester['beginn'])." | |
OR (seminare.start_time < ".DBManaget::get()->quote($semester['beginn'])." AND seminare.duration_time = -1) | |
OR (seminare.start_time < ".DBManaget::get()->quote($semester['beginn'])." AND seminare.duration_time + seminare.start_time >= ".DBManaget::get()->quote($semester['beginn']).") | |
) | |
AND seminare.status NOT IN ('".implode("', '", studygroup_sem_types())."') " . | |
(Config::get()->IMPORTANT_SEMNUMBER | |
? "ORDER BY seminare.VeranstaltungsNummer, seminare.Name" | |
: "ORDER BY seminare.Name"); | |
} | |
/** | |
* A very simple overwrite of the same method from SearchType class. | |
* returns the absolute path to this class for autoincluding this class. | |
* | |
* @return: path to this class | |
*/ | |
public function includePath() | |
{ | |
return studip_relative_path(__FILE__); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment