- Method parseMessageText of controller system/messages/Messages could accept also the prestudent_id parameter

- If prestudent_id parameter then CLMessagesModel->parseMessageTextPrestudent is called
- Fixed show_error(getData error in model CLMessagesModel
- Added new method parseMessageTextPrestudent to model CLMessagesModel
- Method _prepareHtmlWriteTemplate of model CLMessagesModel now checks if data are from a prestudent and then uses MessageLib->getMessageVarsPrestudent
- Added new method getMessageVarsPrestudent to MessageLib
- Function parseMessageText in js/messaging/messageWrite.js could call system/messages/Messages/parseMessageText with prestudent_id parameter
This commit is contained in:
Paolo
2020-01-24 18:13:03 +01:00
parent 15fa4a6c90
commit 8f908887be
5 changed files with 108 additions and 23 deletions
+24
View File
@@ -190,6 +190,30 @@ class MessageLib
return $messageVarsPerson; // otherwise returns the error
}
/**
* Retrieves message vars from view vw_msg_vars
*/
public function getMessageVarsPrestudent()
{
// Retrieves message vars from view vw_msg_vars
$messageVars = $this->_ci->MessageModel->getMessageVars();
if (isSuccess($messageVars)) // if everything is ok
{
$variablesArray = array();
$tmpVariablesArray = getData($messageVars);
// Starts from 1 to skip the first element which is person_id
for ($i = 1; $i < count($tmpVariablesArray); $i++)
{
$variablesArray['{'.str_replace(' ', '_', strtolower($tmpVariablesArray[$i])).'}'] = $tmpVariablesArray[$i];
}
return success($variablesArray);
}
return $messageVars; // otherwise returns the error
}
/**
* Retrieves organisation units for each role that a user plays inside that organisation unit
*/