mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
Modified to request recommendation (+send mails) ONLY if LV has lectors
Modifications done for STGL Overview and Detailview Signed-off-by: cris-technikum <hainberg@technikum-wien.at>
This commit is contained in:
@@ -241,13 +241,26 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
$inProgressLektor = getUserLanguage() == 'German'
|
||||
? $inProgressLektor->bezeichnung_mehrsprachig[0]
|
||||
: $inProgressLektor->bezeichnung_mehrsprachig[1];
|
||||
|
||||
|
||||
$retval = array();
|
||||
$counter = 0;
|
||||
|
||||
foreach ($data as $item)
|
||||
{
|
||||
// Approve Anrechnung
|
||||
if(getData($this->anrechnunglib->requestRecommendation($item['anrechnung_id'])))
|
||||
// Check if Anrechnungs-LV has lector
|
||||
if (!$this->anrechnunglib->LVhasLector($item['anrechnung_id']))
|
||||
{
|
||||
$json[]= array(
|
||||
// Count up LV with no lector
|
||||
$counter++;
|
||||
|
||||
// Break, if LV has no lector
|
||||
break;
|
||||
}
|
||||
|
||||
// Request Recommendation
|
||||
if($this->anrechnunglib->requestRecommendation($item['anrechnung_id']))
|
||||
{
|
||||
$retval[]= array(
|
||||
'anrechnung_id' => $item['anrechnung_id'],
|
||||
'status_kurzbz' => self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR,
|
||||
'status_bezeichnung' => $inProgressLektor,
|
||||
@@ -256,26 +269,29 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send mails to lectors
|
||||
* NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector
|
||||
* even if they are required for more recommendations
|
||||
* */
|
||||
if (!isEmptyArray($retval))
|
||||
{
|
||||
self::_sendSanchoMailToLectors($retval);
|
||||
|
||||
// Output json to ajax
|
||||
return $this->outputJsonSuccess($retval);
|
||||
}
|
||||
|
||||
// Output json to ajax
|
||||
if (isset($json) && !isEmptyArray($json))
|
||||
if (isEmptyArray($retval) && $counter > 0)
|
||||
{
|
||||
/**
|
||||
* Send mails to lectors
|
||||
* NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector
|
||||
* even if they are required for more recommendations
|
||||
* */
|
||||
if (!$this->_sendSanchoMailToLectors($json))
|
||||
{
|
||||
show_error('Failed sending emails');
|
||||
}
|
||||
|
||||
return $this->outputJsonSuccess($json);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->outputJsonError('Es wurden keine Empfehlungen angefordert');
|
||||
return $this->outputJsonError(
|
||||
"Empfehlung wurde nicht angefordert,\nDer LV sind keine LektorInnen zugeteilt."
|
||||
);
|
||||
}
|
||||
|
||||
return $this->outputJsonError('Es wurden keine Empfehlungen angefordert');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -575,8 +591,8 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lectors (prio for LV-Leitung, if not present to all lectors of LV.
|
||||
* Anyway this function will receive a unique array to avoid sending more mails to one and the same lector.
|
||||
* Get unique array of LV lectors.
|
||||
* Only get LV Leitung if present, otherwise all lectors of LV.
|
||||
* @param $anrechnung_arr
|
||||
* @return array
|
||||
*/
|
||||
@@ -620,7 +636,7 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
unset($lector->lvleiter);
|
||||
}
|
||||
|
||||
// Now make the lector array aka mail receivers unique
|
||||
// Make the lector array unique
|
||||
$lector_arr = array_unique($lector_arr, SORT_REGULAR);
|
||||
|
||||
return $lector_arr;
|
||||
|
||||
@@ -206,12 +206,25 @@ class approveAnrechnungUebersicht extends Auth_Controller
|
||||
? $inProgressLektor->bezeichnung_mehrsprachig[0]
|
||||
: $inProgressLektor->bezeichnung_mehrsprachig[1];
|
||||
|
||||
$retval = array();
|
||||
$counter = 0;
|
||||
|
||||
foreach ($data as $item)
|
||||
{
|
||||
// Approve Anrechnung
|
||||
if(getData($this->anrechnunglib->requestRecommendation($item['anrechnung_id'])))
|
||||
// Check if Anrechnungs-LV has lector
|
||||
if (!$this->anrechnunglib->LVhasLector($item['anrechnung_id']))
|
||||
{
|
||||
$json[]= array(
|
||||
// Count up LV with no lector
|
||||
$counter++;
|
||||
|
||||
// Continue loop, if LV has no lector
|
||||
continue;
|
||||
}
|
||||
|
||||
// Request Recommendation
|
||||
if($this->anrechnunglib->requestRecommendation($item['anrechnung_id']))
|
||||
{
|
||||
$retval[]= array(
|
||||
'anrechnung_id' => $item['anrechnung_id'],
|
||||
'status_kurzbz' => self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR,
|
||||
'status_bezeichnung' => $inProgressLektor,
|
||||
@@ -220,25 +233,23 @@ class approveAnrechnungUebersicht extends Auth_Controller
|
||||
}
|
||||
}
|
||||
|
||||
// Output json to ajax
|
||||
if (isset($json) && !isEmptyArray($json))
|
||||
/**
|
||||
* Send mails to lectors
|
||||
* NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector
|
||||
* even if they are required for more recommendations
|
||||
* */
|
||||
if (!isEmptyArray($retval))
|
||||
{
|
||||
/**
|
||||
* Send mails to lectors
|
||||
* NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector
|
||||
* even if they are required for more recommendations
|
||||
* */
|
||||
if (!$this->_sendSanchoMailToLectors($json))
|
||||
{
|
||||
show_error('Failed sending emails');
|
||||
}
|
||||
|
||||
return $this->outputJsonSuccess($json);
|
||||
self::_sendSanchoMailToLectors($retval);
|
||||
}
|
||||
else
|
||||
|
||||
// Output json to ajax
|
||||
if (isEmptyArray($retval) && $counter == 0)
|
||||
{
|
||||
return $this->outputJsonError('Es wurden keine Empfehlungen angefordert');
|
||||
}
|
||||
|
||||
return $this->outputJsonSuccess($retval);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -464,7 +464,7 @@ class AnrechnungLib
|
||||
|| $status_kurzbz == self::ANRECHNUNGSTATUS_REJECTED
|
||||
|| $status_kurzbz == self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR)
|
||||
{
|
||||
return success(false); // dont ask for recommendation
|
||||
return false; // dont ask for recommendation
|
||||
}
|
||||
|
||||
// Start DB transaction
|
||||
@@ -494,7 +494,7 @@ class AnrechnungLib
|
||||
return error($result->msg, EXIT_ERROR);
|
||||
}
|
||||
|
||||
return success(true); // recommended
|
||||
return true; // recommended
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -639,6 +639,24 @@ class AnrechnungLib
|
||||
// Return filename
|
||||
return 'Anrechnungsantrag'. $orgform_kurzbz .'_LV-'. $lehrveranstaltung_id. '_'. $fullname;
|
||||
}
|
||||
|
||||
public function LVhasLector($anrechnung_id)
|
||||
{
|
||||
$result = $this->ci->AnrechnungModel->load($anrechnung_id);
|
||||
if (!hasData($result))
|
||||
{
|
||||
showError('Anrechnung existiert nicht');
|
||||
}
|
||||
|
||||
// Get lectors of lehrveranstaltung
|
||||
$result = $this->ci->LehrveranstaltungModel->getLecturersByLv(
|
||||
$result->retval[0]->studiensemester_kurzbz,
|
||||
$result->retval[0]->lehrveranstaltung_id
|
||||
);
|
||||
|
||||
// Continue, if LV has no lector (there is no one to ask for recommendation)
|
||||
return hasData($result) ? true : false;
|
||||
}
|
||||
|
||||
// Return an object with Anrechnungdata
|
||||
private function _setAnrechnungDataObject($anrechnung)
|
||||
|
||||
@@ -43,6 +43,7 @@ $this->load->view(
|
||||
'bitteMindEinenAntragWaehlen',
|
||||
'bitteBegruendungAngeben',
|
||||
'empfehlungWurdeAngefordert',
|
||||
'empfehlungWurdeAngefordertAusnahmeWoKeineLektoren',
|
||||
'anrechnungenWurdenGenehmigt',
|
||||
'anrechnungenWurdenAbgelehnt'
|
||||
),
|
||||
|
||||
@@ -426,12 +426,23 @@ $(function(){
|
||||
|
||||
if (!data.error && data.retval != null)
|
||||
{
|
||||
// Update status 'genehmigt'
|
||||
$('#tableWidgetTabulator').tabulator('updateData', data.retval);
|
||||
|
||||
// Print success message
|
||||
FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t("ui", "empfehlungWurdeAngefordert"));
|
||||
// Print info message, if not all selected recommendations were requested
|
||||
if (data.retval.length < selected_data.length){
|
||||
FHC_DialogLib.alertInfo(
|
||||
FHC_PhrasesLib.t(
|
||||
"ui", "empfehlungWurdeAngefordertAusnahmeWoKeineLektoren",
|
||||
[selected_data.length, data.retval.length, selected_data.length - data.retval.length])
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Print success message
|
||||
FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t("ui", "empfehlungWurdeAngefordert"));
|
||||
}
|
||||
}
|
||||
|
||||
//Update status 'genehmigt'
|
||||
$('#tableWidgetTabulator').tabulator('updateData', data.retval);
|
||||
},
|
||||
errorCallback: function (jqXHR, textStatus, errorThrown)
|
||||
{
|
||||
|
||||
@@ -10210,6 +10210,26 @@ array(
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ui',
|
||||
'phrase' => 'empfehlungWurdeAngefordertAusnahmeWoKeineLektoren',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => "Empfehlungsanfragen: {0}<br>Abgeschickt: {1}<br>Nicht abgeschickt: {2}<br>Grund: Keine Lektoren zu LV zugeteilt.",
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => "Requests for recommendation: {0}<br>Sent: {1}<br>Not sent: {2}<br>Reason: No lectors assigned to the course yet.",
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ui',
|
||||
|
||||
Reference in New Issue
Block a user