diff --git a/application/helpers/hlp_sancho_helper.php b/application/helpers/hlp_sancho_helper.php index c788f1bbf..f063365ec 100644 --- a/application/helpers/hlp_sancho_helper.php +++ b/application/helpers/hlp_sancho_helper.php @@ -66,7 +66,7 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm $body = _parseMailContent('Sancho_Mail_Template', $layout); // Send mail - $ci->maillib->send('sancho@'. DOMAIN, $to, $subject, $body); + $ci->maillib->send('sancho@'. DOMAIN, $to, $subject, $body, $alias = '', $cc = null, $bcc = null, $altMessage = '', $bulk = true, $autogenerated = true); } /** diff --git a/application/libraries/MailLib.php b/application/libraries/MailLib.php index 0871273b5..6d0a48f73 100644 --- a/application/libraries/MailLib.php +++ b/application/libraries/MailLib.php @@ -19,7 +19,7 @@ class MailLib * Class constructor */ public function __construct() - { + { // Set the counter to 0 $this->sended = 0; @@ -46,7 +46,7 @@ class MailLib /** * Sends a single email */ - public function send($from, $to, $subject, $message, $alias = '', $cc = null, $bcc = null, $altMessage = '') + public function send($from, $to, $subject, $message, $alias = '', $cc = null, $bcc = null, $altMessage = '', $bulk = false, $autogenerated = false) { // If from is not specified then use the standard one if (is_null($from) || $from == '') @@ -90,6 +90,11 @@ class MailLib $this->ci->email->message($message); if (!isEmptyString($altMessage)) $this->ci->email->set_alt_message($altMessage); + if($bulk) + $this->ci->email->set_header('Precedence', 'bulk'); + if($autogenerated) + $this->ci->email->set_header('Auto-Submitted', 'auto-generated'); + // Avoid printing on standard output ugly error messages $result = @$this->ci->email->send(); diff --git a/application/models/education/Lehrveranstaltung_model.php b/application/models/education/Lehrveranstaltung_model.php index c042c2e0a..0a76df4b9 100644 --- a/application/models/education/Lehrveranstaltung_model.php +++ b/application/models/education/Lehrveranstaltung_model.php @@ -14,11 +14,11 @@ class Lehrveranstaltung_model extends DB_Model /** * Gets unique Groupstrings for Lehrveranstaltungen, e.g. WS2018_BIF_1_PRJM_VZ_LV12345 - * @param $studiensemester_kurzbz - * @param null $ausbildungssemester - * @param null $studiengang_kz - * @param null $lehrveranstaltung_ids - * @return StdClass + * @param string $studiensemester_kurzbz + * @param string $ausbildungssemester + * @param string $studiengang_kz + * @param string|array $lehrveranstaltung_ids + * @return array|null */ public function getLehrveranstaltungGroupNames($studiensemester_kurzbz, $ausbildungssemester = null, $studiengang_kz = null, $lehrveranstaltung_ids = null) { diff --git a/application/models/organisation/Organisationseinheit_model.php b/application/models/organisation/Organisationseinheit_model.php index 272204e7e..f9353c7b3 100644 --- a/application/models/organisation/Organisationseinheit_model.php +++ b/application/models/organisation/Organisationseinheit_model.php @@ -119,7 +119,7 @@ class Organisationseinheit_model extends DB_Model /** * Liefert die ChildNodes einer Organisationseinheit * @param $oe_kurzbz - * @param bool $includeinactive - wether to include inactive parent oes + * @param bool $includeinactive wether to include inactive parent oes * @return array mit den Childs inkl dem Uebergebenen Element */ public function getChilds($oe_kurzbz, $includeinactive = false) @@ -131,19 +131,20 @@ class Organisationseinheit_model extends DB_Model WHERE oe_kurzbz=? %s UNION ALL SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes - WHERE o.oe_parent_kurzbz=oes.oe_kurzbz + WHERE o.oe_parent_kurzbz=oes.oe_kurzbz %s ) SELECT oe_kurzbz FROM oes GROUP BY oe_kurzbz;"; - return $this->execQuery(sprintf($query, $includeinactive === true ? "" : "AND aktiv = true"), array($oe_kurzbz)); + $aktivstring = $includeinactive === true ? "" : "AND aktiv = true"; + return $this->execQuery(sprintf($query, $aktivstring, $aktivstring), array($oe_kurzbz)); } /** * Liefert die OEs die im Tree ueberhalb der uebergebene OE liegen * @param $oe_kurzbz - * @param bool $includeinactive - wether to include inactive parent oes + * @param bool $includeinactive wether to include inactive parent oes * @return array|null */ public function getParents($oe_kurzbz, $includeinactive = false) @@ -155,12 +156,13 @@ class Organisationseinheit_model extends DB_Model WHERE oe_kurzbz=? %s UNION ALL SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes - WHERE o.oe_kurzbz=oes.oe_parent_kurzbz and aktiv = true + WHERE o.oe_kurzbz=oes.oe_parent_kurzbz %s ) SELECT oe_kurzbz FROM oes"; - return $this->execQuery(sprintf($query, $includeinactive === true ? "" : "AND aktiv = true"), array($oe_kurzbz)); + $aktivstring = $includeinactive === true ? "" : "AND aktiv = true"; + return $this->execQuery(sprintf($query, $aktivstring, $aktivstring), array($oe_kurzbz)); } } diff --git a/application/models/person/Benutzerfunktion_model.php b/application/models/person/Benutzerfunktion_model.php index e6f030e7f..02a27e87a 100644 --- a/application/models/person/Benutzerfunktion_model.php +++ b/application/models/person/Benutzerfunktion_model.php @@ -25,13 +25,14 @@ class Benutzerfunktion_model extends DB_Model /** * Gets all Benutzer for a given OE and specified Benutzerfunktionen - * @param $funktion_kurzbz string with one benutzerfunktionname or array with one or more - * @param $oe_kurzbz - * @param bool $activeoeonly if true, retrieve only active Organisationseinheiten - * @param bool $activebenonly if true, retrieve only active Benutzer + * @param string $funktion_kurzbz String with one benutzerfunktionname or array with one or more. + * @param string $oe_kurzbz + * @param bool $activeoeonly If true, retrieve only active Organisationseinheiten. + * @param bool $activebenonly If true, retrieve only active Benutzer. + * @param bool $oerecursive If true, retrieve all oes under given oe_kurzbz recursively. * @return array|null */ - public function getBenutzerFunktionen($funktion_kurzbz, $oe_kurzbz = null, $activeoeonly = false, $activebenonly = false) + public function getBenutzerFunktionen($funktion_kurzbz, $oe_kurzbz = null, $activeoeonly = false, $activebenonly = false, $oerecursive = false) { $parametersArray = array(); @@ -57,7 +58,35 @@ class Benutzerfunktion_model extends DB_Model if (is_string($oe_kurzbz)) { - $query .= " AND tbl_benutzerfunktion.oe_kurzbz = ?"; + if ($oerecursive === true) + { + $query .= + " AND oe_kurzbz IN + ( + WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz, aktiv) as + ( + SELECT oe_kurzbz, oe_parent_kurzbz, aktiv FROM public.tbl_organisationseinheit + WHERE oe_kurzbz=?"; + + if ($activeoeonly === true) + $query .= " AND aktiv=true"; + + $query .= + " UNION ALL + SELECT o.oe_kurzbz, o.oe_parent_kurzbz, o.aktiv FROM public.tbl_organisationseinheit o, oes + WHERE o.oe_parent_kurzbz=oes.oe_kurzbz + ) + SELECT oe_kurzbz + FROM oes"; + if ($activeoeonly === true) + { + $query .= " WHERE aktiv=true"; + } + $query .= " GROUP BY oe_kurzbz)"; + } + else + $query .= " AND tbl_benutzerfunktion.oe_kurzbz = ?"; + $parametersArray[] = $oe_kurzbz; } @@ -71,7 +100,7 @@ class Benutzerfunktion_model extends DB_Model $query .= " AND tbl_organisationseinheit.aktiv"; } - $query .= " ORDER BY funktion_kurzbz, oe_kurzbz, uid"; + $query .= " ORDER BY oe_kurzbz, funktion_kurzbz, uid"; return $this->execQuery($query, $parametersArray); } diff --git a/cis/private/lehre/benotungstool/lvgesamtnoteeintragen.php b/cis/private/lehre/benotungstool/lvgesamtnoteeintragen.php index c3648d4fa..3c9985a8b 100644 --- a/cis/private/lehre/benotungstool/lvgesamtnoteeintragen.php +++ b/cis/private/lehre/benotungstool/lvgesamtnoteeintragen.php @@ -82,10 +82,14 @@ $uebung_id = (isset($_GET['uebung_id'])?$_GET['uebung_id']:''); $uid = (isset($_GET['uid'])?$_GET['uid']:''); $noten_anmerkung=array(); +$noten_arr=array(); $note_obj = new note(); $note_obj->getAll(); foreach($note_obj->result as $row) - $noten_anmerkung[$row->anmerkung]=$row->note; +{ + $noten_anmerkung[$row->anmerkung] = $row->note; + $noten_arr[$row->note] = $row; +} //Studiensemester laden $stsem_obj = new studiensemester(); @@ -238,12 +242,23 @@ if (isset($_REQUEST["submit"])) } // Hole Zeugnisnote wenn schon eine eingetragen ist - /* if ($zeugnisnote = new zeugnisnote($lvid, $student_uid, $stsem)) + { $znote = $zeugnisnote->note; - else - $znote = null; - */ + + if (!empty($znote) && array_key_exists($znote, $noten_arr)) + { + $notenobj = $noten_arr[$znote]; + + // Note nicht speichern wenn Zeugnisnote nicht überschreibbar + if ($notenobj->lkt_ueberschreibbar === false) + { + $response .= "\n".$p->t('benotungstool/noteNichtUeberschreibbar', array($matrikelnummer, $notenobj->bezeichnung)); + continue; + } + } + } + $val=savenote($db,$lvid, $student_uid, $note, $punkte); if($val!='neu' && $val!='update' && $val!='update_f') $response.=$val; diff --git a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php index fa9bdc980..a41e362fd 100644 --- a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php +++ b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php @@ -181,6 +181,7 @@ foreach ($noten_obj->result as $row) $noten_array[$row->note]['positiv'] = $row->positiv; $noten_array[$row->note]['aktiv'] = $row->aktiv; $noten_array[$row->note]['lehre'] = $row->lehre; + $noten_array[$row->note]['lkt_ueberschreibbar'] = $row->lkt_ueberschreibbar; $noten_array[$row->note]['anmerkung'] = $row->anmerkung; foreach ($sprachen->result AS $s) $noten_array[$row->note]['bezeichnung_mehrsprachig'][$s->sprache] = $row->bezeichnung_mehrsprachig[$s->sprache]; @@ -1249,21 +1250,34 @@ if (defined("CIS_GESAMTNOTE_PRUEFUNG_MOODLE_LE_NOTE") && CIS_GESAMTNOTE_PRUEFUNG action='" . $_SERVER['PHP_SELF'] . "?lvid=$lvid&lehreinheit_id=$lehreinheit_id&stsem=$stsem'> "; - + + // nur überschreibbare Noten können geändert werden + $ueberschreibbar = true; + + if (isset($noten_array[$znote]['lkt_ueberschreibbar']) && $noten_array[$znote]['lkt_ueberschreibbar'] === false) + $ueberschreibbar = false; + // Punkte if (CIS_GESAMTNOTE_PUNKTE) { + $htmlstring .= ' '; + size="3"'; + + if ($ueberschreibbar) + $htmlstring .= ' oninput="PunkteEingabe(' . $i . ')"'; + else + $htmlstring .= ' disabled="disabled"'; + + $htmlstring .= '/>'; } - + // Noten DropDown - if ($punkte_vorschlag != '' && CIS_GESAMTNOTE_PUNKTE) + if (($punkte_vorschlag != '' && CIS_GESAMTNOTE_PUNKTE) || $ueberschreibbar == false) $disabled = 'disabled="disabled"'; else $disabled = ''; @@ -1281,10 +1295,13 @@ if (defined("CIS_GESAMTNOTE_PRUEFUNG_MOODLE_LE_NOTE") && CIS_GESAMTNOTE_PRUEFUNG } $htmlstring .= ''; $htmlstring .= " - - - - "; + "; + if ($ueberschreibbar) + { + $htmlstring .= ""; + } + $htmlstring .= " + "; } else { @@ -1370,13 +1387,18 @@ if (defined("CIS_GESAMTNOTE_PRUEFUNG_MOODLE_LE_NOTE") && CIS_GESAMTNOTE_PRUEFUNG $htmlstring .= '