diff --git a/application/controllers/ViewMessage.php b/application/controllers/ViewMessage.php index a3fc1acba..35f5a5b4b 100644 --- a/application/controllers/ViewMessage.php +++ b/application/controllers/ViewMessage.php @@ -81,7 +81,7 @@ class ViewMessage extends FHC_Controller 'href' => $href ); - $this->load->view('system/messageHTML.php', $data); + $this->load->view('system/messages/messageHTML.php', $data); } } @@ -94,7 +94,7 @@ class ViewMessage extends FHC_Controller if (isEmptyString($token)) { - show_error('no token supplied'); + show_error('No token supplied'); } $msg = null; @@ -104,7 +104,7 @@ class ViewMessage extends FHC_Controller if (!hasData($msg)) { - show_error('no message found'); + show_error('No message found'); } $msg = $msg->retval[0]; @@ -114,7 +114,7 @@ class ViewMessage extends FHC_Controller if (!hasData($receiverData)) { - show_error('no sender found'); + show_error('No sender found'); } $data = array ( @@ -123,7 +123,7 @@ class ViewMessage extends FHC_Controller 'token' => $token ); - $this->load->view('system/messageWriteReply', $data); + $this->load->view('system/messages/messageWriteReply', $data); } /** @@ -134,8 +134,6 @@ class ViewMessage extends FHC_Controller $this->load->model('system/Message_model', 'MessageModel'); $this->load->library('MessageLib'); - $error = false; - $subject = $this->input->post('subject'); $body = $this->input->post('body'); $persons = $this->input->post('persons'); @@ -145,7 +143,6 @@ class ViewMessage extends FHC_Controller if (!isset($relationmessage_id) || $relationmessage_id == '' || !isset($token) || $token == '') { show_error('Error while sending reply'); - $error = true; } $relationmsg = $this->MessageTokenModel->getMessageByToken($token); @@ -154,7 +151,6 @@ class ViewMessage extends FHC_Controller if (!hasData($relationmsg) || $relationmessage_id !== $relationmsg->retval[0]->message_id) { show_error('Error while sending reply'); - $error = true; } // get sender (receiver of previous msg) @@ -166,20 +162,16 @@ class ViewMessage extends FHC_Controller // send message(s) if (hasData($data)) { + // Loads the person log library + $this->load->library('PersonLogLib'); + for ($i = 0; $i < count($data->retval); $i++) { $dataArray = (array)$data->retval[$i]; $msg = $this->messagelib->sendMessage($sender_id, $dataArray['person_id'], $subject, $body, PRIORITY_NORMAL, $relationmessage_id, null); - if ($msg->error) - { - show_error($msg->retval); - $error = true; - break; - } - // Loads the person log library - $this->load->library('PersonLogLib'); + if ($msg->error) show_error($msg->retval); // Write log entry for sender $logtype_kurzbz = 'Action'; @@ -193,7 +185,8 @@ class ViewMessage extends FHC_Controller $oe_kurzbz = null; $insertvon = 'online'; - $this->personloglib->log( + // Logs person data + $personLog = $this->personloglib->log( $sender_id, $logtype_kurzbz, $logdata, @@ -203,14 +196,11 @@ class ViewMessage extends FHC_Controller $insertvon ); - //unpark bewerber after he sends message - $this->personloglib->unPark($sender_id); + // Unpark bewerber after he sends message + $personLog = $this->personloglib->unPark($sender_id); } } - if (!$error) - { - $this->load->view('system/messageSent'); - } + $this->load->view('system/messages/messageReplySent'); } } diff --git a/application/controllers/person/Gradelist.php b/application/controllers/person/Gradelist.php new file mode 100644 index 000000000..bf179ad35 --- /dev/null +++ b/application/controllers/person/Gradelist.php @@ -0,0 +1,349 @@ + array('student:r', 'student/noten:r') + ) + ); + + // Loads models + $this->load->model('person/person_model', 'PersonModel'); + $this->load->model('organisation/studiengang_model', 'StudiengangModel'); + $this->load->model('crm/student_model', 'StudentModel'); + $this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel'); + $this->load->model('education/zeugnisnote_model', 'ZeugnisnoteModel'); + $this->load->model('education/lehrveranstaltung_model', 'LehrveranstaltungModel'); + $this->load->model('codex/note_model', 'NoteModel'); + + $this->loadPhrases( + array( + 'global', + 'person', + 'lehre', + 'ui' + ) + ); + + $result_noten = $this->NoteModel->load(); + foreach ($result_noten->retval as $row) + { + $this->_grades[$row->note]['positiv'] = $row->positiv; + $this->_grades[$row->note]['anmerkung'] = $row->anmerkung; + $this->_grades[$row->note]['notenwert'] = $row->notenwert; + } + } + + /** + * Print all Grades of a person + * @param $uid UID of the Person + */ + public function index($uid = null) + { + if (is_null($uid)) + $uid = getAuthUID(); + + // load student + $student = $this->StudentModel->load(array($uid)); + if (!isSuccess($student) || !hasData($student)) + { + echo "You have no Permission or User does not exists"; + exit; + } + + // Check if logged in User has permission to see grades of this person + $stg = $this->StudiengangModel->load($student->retval[0]->studiengang_kz); + if (!$this->hasPermission($uid, $stg->retval[0]->oe_kurzbz)) + { + echo "You have no Permission or User does not exists"; + exit; + } + $person = $this->PersonModel->getByUid($uid); + + $courses = $this->loadCourseInformation($student->retval[0]->prestudent_id, $student->retval[0]->student_uid); + + $data = array ( + "user" => $uid, + "person" => $person->retval[0], + "courses" => $courses, + "grades" => $this->_grades + ); + + $this->load->view('person/gradelist/gradelist.php', $data); + } + + /** + * Check if the Logged in User has permission to see the grades of this person + * @param $uid UID of the Person we want to see + * @param $oe_kurzbz Organisation Unit of the Person we want to see + * @return true if the logged in User is allowed to see the content, false if not + */ + private function hasPermission($uid, $oe_kurzbz) + { + $loggedinUser = getAuthUID(); + if($uid != $loggedinUser) + { + $this->load->library('PermissionLib'); + if($this->permissionlib->isBerechtigt('student/noten','s',$oe_kurzbz)) + { + return true; + } + return false; + } + else + { + return true; + } + } + + /** + * Loads the Courses and Grades of the Student + * + * @param $prestudent_id of the Student + * @return array with the courses + */ + private function loadCourseInformation($prestudent_id, $uid) + { + $this->load->library('StudienplanLib'); + + // Get status of Student + $result_status = $this->PrestudentstatusModel->getStatusByFilter($prestudent_id); + + if (isError($result_status) || !hasData($result_status)) + { + return error('No Status Found'); + } + + // Get Courses from studyplan for each semester of the student + foreach ($result_status->retval as $row_status) + { + if (in_array($row_status->status_kurzbz, + array('Student','Diplomand','Incoming','Abbrecher','Unterbrecher','Absolvent'))) + { + // LVs fuer das Semester holen lt Studienplan + $lvtree = $this->studienplanlib->getLehrveranstaltungTree( + $row_status->studienplan_id, + $row_status->ausbildungssemester, + true + ); + $courses['semester'][$row_status->studiensemester_kurzbz]['lvs'] = $lvtree; + $courses['semester'][$row_status->studiensemester_kurzbz]['lvs_nonstpl'] = array(); + + $result_stpl = $this->StudienplanModel->load($row_status->studienplan_id); + if(isSuccess($result_stpl) && hasData($result_stpl)) + { + $stpl_bezeichnung = $result_stpl->retval[0]->bezeichnung; + } + else + $stpl_bezeichnung = 'unknown'; + + $courses['semester'][$row_status->studiensemester_kurzbz]['data'] = array( + 'status' => $row_status->status_kurzbz, + 'ausbildungssemester' => $row_status->ausbildungssemester, + 'studiensemester_kurzbz' => $row_status->studiensemester_kurzbz, + 'studienplan_id' => $row_status->studienplan_id, + 'studienplan_bezeichnung' => $stpl_bezeichnung, + ); + } + } + + // Load Grades and add to studyplan + $result_zeugnis = $this->ZeugnisnoteModel->loadWhere(array("student_uid" => $uid)); + + if (isSuccess($result_zeugnis) && hasData($result_zeugnis)) + { + foreach ($courses['semester'] as $key=>$value) + { + $this->fillNotenPart( + $result_zeugnis, + $courses['semester'][$key]['lvs'], + $value['data']['studiensemester_kurzbz'] + ); + } + } + + // Build Array of Courses that are not part of the studyplan + foreach ($result_zeugnis->retval as $row_noten) + { + if (!isset($row_noten->found)) + { + $result_lv = $this->LehrveranstaltungModel->load($row_noten->lehrveranstaltung_id); + $courses['semester'][$row_noten->studiensemester_kurzbz]['lvs_nonstpl'][] = array( + 'lehrveranstaltung_id' => $row_noten->lehrveranstaltung_id, + 'lehrtyp_kurzbz' => $result_lv->retval[0]->lehrtyp_kurzbz, + 'pflicht' => false, + 'bezeichnung' => $result_lv->retval[0]->bezeichnung, + 'ects' => $result_lv->retval[0]->ects, + 'note' => $row_noten->note, + 'datum' => $row_noten->benotungsdatum + ); + if(!isset($courses['semester'][$row_noten->studiensemester_kurzbz]['data']['ectssumme_nonstpl'])) + $courses['semester'][$row_noten->studiensemester_kurzbz]['data']['ectssumme_nonstpl'] = 0; + $courses['semester'][$row_noten->studiensemester_kurzbz]['data']['ectssumme_nonstpl'] += $result_lv->retval[0]->ects; + } + } + + $sum_gradeweighted_overall = 0; + $sum_ectsweighted_overall = 0; + $sum_grades_overall = 0; + $num_grades_overall = 0; + $sum_ects_overall = 0; + $sum_ects_positiv_overall = 0; + + // Calculate Sum and Average + foreach ($courses['semester'] as $stsem => $row_lvs) + { + $grades = $this->getGrades($row_lvs['lvs']); + + $num_grades = 0; + $sum_ects = 0; + $sum_ects_positiv = 0; + $sum_grades = 0; + $notendurchschnitt = 0; + $sum_gradeweighted = 0; + $sum_ectsweighted = 0; + + foreach ($grades as $row) + { + if ($this->_grades[$row['note']]['notenwert'] != '') + { + $num_grades++; + $sum_grades += $this->_grades[$row['note']]['notenwert']; + + $sum_ectsweighted += $row['ects']; + $sum_gradeweighted += $row['ects'] * $this->_grades[$row['note']]['notenwert']; + } + $sum_ects += $row['ects']; + if ($this->_grades[$row['note']]['positiv']) + $sum_ects_positiv += $row['ects']; + } + if ($num_grades > 0) + $notendurchschnitt = $sum_grades / $num_grades; + else + $notendurchschnitt = 0; + + if ($sum_ectsweighted > 0) + $notendurchschnittgewichtet = $sum_gradeweighted / $sum_ectsweighted; + else + $notendurchschnittgewichtet = 0; + + $num_grades_overall += $num_grades; + $sum_grades_overall += $sum_grades; + $sum_gradeweighted_overall += $sum_gradeweighted; + $sum_ectsweighted_overall += $sum_ectsweighted; + $sum_ects_overall += $sum_ects; + $sum_ects_positiv_overall += $sum_ects_positiv; + + $courses['semester'][$stsem]['data']['notendurchschnitt'] = number_format($notendurchschnitt, 2); + $courses['semester'][$stsem]['data']['notendurchschnittgewichtet'] = number_format($notendurchschnittgewichtet, 2); + $courses['semester'][$stsem]['data']['ectssumme'] = number_format($sum_ects,2); + $courses['semester'][$stsem]['data']['ectssumme_positiv'] = number_formaT($sum_ects_positiv,2); + } + + if ($num_grades_overall > 0) + $notendurchschnitt = $sum_grades_overall / $num_grades_overall; + else + $notendurchschnitt = 0; + + if ($sum_ectsweighted_overall > 0) + $notendurchschnittgewichtet = $sum_gradeweighted_overall / $sum_ectsweighted_overall; + else + $notendurchschnittgewichtet = 0; + + $courses['overall'] = array( + 'notendurchschnitt' => number_format($notendurchschnitt, 2), + 'notendurchschnittgewichtet' => number_format($notendurchschnittgewichtet, 2), + 'ectssumme' => $sum_ects_overall, + 'ectssumme_positiv' => $sum_ects_positiv_overall + ); + return $courses; + } + + /** + * Combines the Studyplan Courses recursively with the Grades of the Student + * Grades that are found in the Studyplan are marked, the others are added to a separate list + * @param $noten reference to array of all grades. + * @param $courses reference to array of all courses. + * @param $studiensemester_kurzbz Studiensemester of the Course and Grades + */ + private function fillNotenPart(&$noten, &$courses, $studiensemester_kurzbz) + { + foreach ($courses as $key => $value) + { + foreach ($noten->retval as $notenkey => $row_noten) + { + if ($row_noten->lehrveranstaltung_id == $value['lehrveranstaltung_id'] + && $row_noten->studiensemester_kurzbz == $studiensemester_kurzbz) + { + $courses[$key]['note'] = $row_noten->note; + $courses[$key]['datum'] = $row_noten->benotungsdatum; + $noten->retval[$notenkey]->found = true; + } + if (isset($value['childs'])) + $this->fillNotenPart($noten, $courses[$key]['childs'], $studiensemester_kurzbz); + } + } + } + + /** + * Reads all the Courses recursivly and Returns an Array with the Grades and ECTS + * @param $courses array of courses + * @return array with grades and ects + */ + public function getGrades($courses) + { + $grades = array(); + foreach ($courses as $row) + { + if (isset($row['note']) && $row['note'] != '') + { + $grades[] = array( + 'note' => $row['note'], + 'ects' => $row['ects'] + ); + } + + if ($row['childs']) + { + $childgrades = $this->getGrades($row['childs']); + $grades = array_merge($grades, $childgrades); + } + } + return $grades; + } + + /** + * Helper Function to Display recursive Courses + * @param $course array if courses + * @param $depth integer defines the number parent elements + */ + static function printRow($course, $depth) + { + $ci =& get_instance(); + $ci->load->view('person/gradelist/course.php', + array( + 'course' => $course, + 'depth' => $depth + ) + ); + + if (isset($course['childs'])) + { + foreach ($course['childs'] as $row_course) + Gradelist::printRow($row_course, $depth + 1); + } + } +} diff --git a/application/controllers/system/FASMessages.php b/application/controllers/system/FASMessages.php new file mode 100644 index 000000000..6c01f73a8 --- /dev/null +++ b/application/controllers/system/FASMessages.php @@ -0,0 +1,155 @@ + 'basis/message:rw', + 'writeReply' => 'basis/message:rw' + ) + ); + + // Loads the message library + $this->load->library('MessageLib'); + + // Loads the widget library + $this->load->library('WidgetLib'); + + $this->loadPhrases( + array( + 'global', + 'ui' + ) + ); + } + + // ----------------------------------------------------------------------------------------------------------------- + // Public methods + + /** + * Write a new message + */ + public function write($sender_id) + { + $prestudent_id = $this->input->post('prestudent_id'); // recipients prestudend_id(s) + + if (!is_numeric($sender_id)) + { + show_error('The current logged user person_id is not defined'); + } + + $msgVarsData = $this->_getMsgVarsData($prestudent_id); + + // Retrieves message vars for a person from view view vw_msg_vars_person + $variablesArray = $this->messagelib->getMessageVarsPerson(); + + // Organisation units used to get the templates + $oe_kurzbz = $this->messagelib->getOeKurzbz($sender_id); + + // Admin or commoner? + $isAdmin = $this->messagelib->getIsAdmin($sender_id); + + $data = array( + 'recipients' => $msgVarsData->retval, + 'variables' => $variablesArray, + 'oe_kurzbz' => $oe_kurzbz, // used to get the templates + 'isAdmin' => $isAdmin + ); + + $this->load->view('system/messages/messageWrite', $data); + } + + /** + * Write a reply + */ + public function writeReply($sender_id, $msg_id, $receiver_id) + { + $prestudent_id = $this->input->post('prestudent_id'); // recipients prestudend_id(s) + + if (!is_numeric($sender_id)) + { + show_error('The current logged user person_id is not defined'); + } + + if (!is_numeric($msg_id)) + { + show_error('The msg_id must be a number'); + } + + if (!is_numeric($receiver_id)) + { + show_error('The receiver_id must be a number'); + } + + $msg = $this->_getMessage($msg_id, $receiver_id); + + $msgVarsData = $this->_getMsgVarsData($prestudent_id); + + // Retrieves message vars for a person from view view vw_msg_vars_person + $variablesArray = $this->messagelib->getMessageVarsPerson(); + + // Organisation units used to get the templates + $oe_kurzbz = $this->messagelib->getOeKurzbz($sender_id); + + // Admin or commoner? + $isAdmin = $this->messagelib->getIsAdmin($sender_id); + + $data = array( + 'recipients' => $msgVarsData->retval, + 'message' => $msg, + 'variables' => $variablesArray, + 'oe_kurzbz' => $oe_kurzbz, // used to get the templates + 'isAdmin' => $isAdmin + ); + + $this->load->view('system/messages/messageWrite', $data); + } + + // ----------------------------------------------------------------------------------------------------------------- + // Private methods + + /** + * + */ + private function _getMessage($msg_id, $receiver_id) + { + $msg = $this->messagelib->getMessage($msg_id, $receiver_id); + if (isError($msg)) + { + show_error($msg->retval); + } + elseif (!hasData($msg)) + { + show_error('The selected message does not exist'); + } + else + { + $msg = $msg->retval[0]; + } + + return $msg; + } + + /** + * Retrieves message vars from view vw_msg_vars + */ + private function _getMsgVarsData($prestudent_id) + { + $this->load->model('system/Message_model', 'MessageModel'); + $msgVarsData = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudent_id); + + if (isError($msgVarsData)) + { + show_error($msgVarsData->retval); + } + + return $msgVarsData; + } +} diff --git a/application/controllers/system/Messages.php b/application/controllers/system/Messages.php index d197f8458..ed6d12044 100644 --- a/application/controllers/system/Messages.php +++ b/application/controllers/system/Messages.php @@ -4,8 +4,6 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); class Messages extends Auth_Controller { - private $uid; // contains the UID of the logged user - /** * */ @@ -28,344 +26,189 @@ class Messages extends Auth_Controller // Loads the widget library $this->load->library('WidgetLib'); - $this->load->model('person/Person_model', 'PersonModel'); + $this->load->model('system/Message_model', 'MessageModel'); $this->loadPhrases( array( 'global', - 'person', - 'lehre', - 'ui', - 'infocenter' + 'ui' ) ); - - $this->_setAuthUID(); // sets property uid } + // ----------------------------------------------------------------------------------------------------------------- + // Public methods + /** - * write + * Write a new message */ - public function write($sender_id = null, $msg_id = null, $receiver_id = null) + public function write() { - if ($sender_id === null) - { - $user_person = $this->PersonModel->getByUid($this->uid); - - if (isError($user_person)) - { - show_error($user_person->retval); - } - $sender_id = $user_person->retval[0]->person_id; - } - - $prestudent_id = $this->input->post('prestudent_id'); $person_id = $this->input->post('person_id'); - $personOnly = false; + $sender_id = null; - if (isset($person_id) && !isset($prestudent_id)) - $personOnly = true; - - $msg = null; - - // Get message data if possible - if (is_numeric($msg_id) && is_numeric($receiver_id)) + $authUser = $this->_getAuthUser(); + if (isError($authUser)) { - $msg = $this->messagelib->getMessage($msg_id, $receiver_id); - if ($msg->error) - { - show_error($msg->retval); - } - else - { - $msg = $msg->retval[0]; - } + show_error($authUser->retval); } - - $variablesArray = array(); - $msgVarsData = array(); - - // Get variables - $this->load->model('system/Message_model', 'MessageModel'); - if ($personOnly === true) - $this->getPersonMsgData($person_id, $variablesArray, $msgVarsData); else - $this->getPrestudentMsgData($prestudent_id, $variablesArray, $msgVarsData); - - // Organisation units used to get the templates - $oe_kurzbz = array(); // A person can have more organisation units - $this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel'); - $benutzerResult = $this->BenutzerfunktionModel->getByPersonId($sender_id); - if (hasData($benutzerResult)) { - foreach ($benutzerResult->retval as $val) - { - $oe_kurzbz[] = $val->oe_kurzbz; - } + $sender_id = getData($authUser)[0]->person_id; } - // Admin or commoner? - $this->load->model('system/Benutzerrolle_model', 'BenutzerrolleModel'); - $isAdmin = $this->BenutzerrolleModel->isAdminByPersonId($sender_id); - if (isError($isAdmin)) - { - show_error($isAdmin->retval); - } + $msgVarsData = $this->_getMsgVarsData($person_id); + + // Retrieves message vars for a person from view view vw_msg_vars_person + $variablesArray = $this->messagelib->getMessageVarsPerson(); + + // Organisation units used to get the templates + $oe_kurzbz = $this->messagelib->getOeKurzbz($sender_id); + + // Admin or commoner? + $isAdmin = $this->messagelib->getIsAdmin($sender_id); $data = array ( - 'sender_id' => $sender_id, - 'receivers' => isset($msgVarsData->retval) ? $msgVarsData->retval : $msgVarsData, - 'message' => $msg, + 'recipients' => $msgVarsData->retval, 'variables' => $variablesArray, 'oe_kurzbz' => $oe_kurzbz, // used to get the templates - 'isAdmin' => $isAdmin->retval, - 'personOnly' => $personOnly//indicates if sent only to persons + 'isAdmin' => $isAdmin ); - $v = $this->load->view('system/messageWrite', $data); + $this->load->view('system/messages/messageWrite', $data); } /** - * gets Message Variables and their data for Prestudent - * @param $prestudent_id - * @param $variablesArray to be filled with variable names - * @param $msgVarsData to be filled with variable data + * Send message */ - private function getPrestudentMsgData($prestudent_id, &$variablesArray, &$msgVarsData) + public function send() { - $msgVarsData = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudent_id); - if ($msgVarsData->error) - { - show_error($msgVarsData->retval); - } + $persons = $this->input->post('persons'); + $relationmessage_id = $this->input->post('relationmessage_id'); - if (!hasData($variables = $this->MessageModel->getMessageVars())) - { - unset($variables); - } - else - { - $variablesArray = array(); - // Skip person_id and prestudent_id - for ($i = 2; $i < count($variables->retval); $i++) - { - $variablesArray['{'.str_replace(" ", "_", strtolower($variables->retval[$i])).'}'] = $variables->retval[$i]; - } - } + $msgVarsData = $this->MessageModel->getMsgVarsDataByPersonId($persons); - array_shift($variables->retval); // Remove person_id - array_shift($variables->retval); // Remove prestudent_id - } + $send = $this->_send($msgVarsData, $relationmessage_id); - /** - * gets Message Variables and their data for Person - * @param $person_id - * @param $variablesArray to be filled with variable names - * @param $msgVarsData to be filled with variable data - */ - private function getPersonMsgData($person_id, &$variablesArray, &$msgVarsData) - { - $msgVarsData = $this->MessageModel->getMsgVarsDataByPersonId($person_id); - if ($msgVarsData->error) - { - show_error($msgVarsData->retval); - } - - if (!hasData($variables = $this->MessageModel->getMessageVarsPerson())) - { - unset($variables); - } - else - { - $variablesArray = array(); - // Skip person_id - for ($i = 1; $i < count($variables->retval); $i++) - { - $variablesArray['{'.str_replace(" ", "_", strtolower($variables->retval[$i])).'}'] = $variables->retval[$i]; - } - array_shift($variables->retval); // Remove person_id - } - } - - /** - * send - */ - public function send($sender_id = null) - { - $result = $this->_execSend($sender_id); - - if (isSuccess($result)) - { - echo "Messages sent successfully"; - } - else - { - echo "Error when sending message"; - } + $this->load->view('system/messages/messageSent', array('success' => isSuccess($send))); } /** * Send message, response is in JSON format - * @param $sender_id */ - public function sendJson($sender_id = null) + public function sendJson() { - $result = $this->_execSend($sender_id); + $prestudents = $this->input->post('prestudents'); + $vorlage_kurzbz = $this->input->post('vorlage_kurzbz'); + $oe_kurzbz = $this->input->post('oe_kurzbz'); + $msgVars = $this->input->post('msgvars'); - $this->output - ->set_content_type('application/json') - ->set_output(json_encode($result)); + $msgVarsData = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudents); + + $this->load->model('crm/Prestudent_model', 'PrestudentModel'); + $prestudentsData = $this->PrestudentModel->getOrganisationunits($prestudents); + + // Adds the organisation unit to each prestudent + if (isEmptyString($oe_kurzbz) && hasData($msgVarsData) && hasData($prestudentsData)) + { + for ($i = 0; $i < count($msgVarsData->retval); $i++) + { + for ($p = 0; $p < count($prestudentsData->retval); $p++) + { + if ($prestudentsData->retval[$p]->prestudent_id == $msgVarsData->retval[$i]->prestudent_id) + { + $msgVarsData->retval[$i]->oe_kurzbz = $prestudentsData->retval[$p]->oe_kurzbz; + break; + } + } + } + } + + $send = $this->_send($msgVarsData, null, $oe_kurzbz, $vorlage_kurzbz, $msgVars); + if (isError($send)) + { + $this->outputJsonError($send->retval); + } + else + { + $this->outputJsonSuccess($send->retval); + } } + // ----------------------------------------------------------------------------------------------------------------- + // Private methods + /** * Executes message sending * @param $sender_id * @return array wether execution was successfull - error or success */ - private function _execSend($sender_id) + private function _send($msgVarsData, $relationmessage_id = null, $oe_kurzbz = null, $vorlage_kurzbz = null, $msgVars = null) { - if ($sender_id === null) - { - $user_person = $this->PersonModel->getByUid($this->uid); - - if (!hasData($user_person)) - { - return error('no sender'); - } - $sender_id = $user_person->retval[0]->person_id; - } - $subject = $this->input->post('subject'); $body = $this->input->post('body'); - $prestudents = $this->input->post('prestudents'); - $persons = $this->input->post('persons'); - $relationmessage_id = $this->input->post('relationmessage_id'); - $vorlage_kurzbz = $this->input->post('vorlage_kurzbz'); - $oe_kurzbz = $this->input->post('oe_kurzbz'); - $msgvars = $this->input->post('msgvars'); - if (!isset($relationmessage_id) || $relationmessage_id == '') - { - $relationmessage_id = null; - } + $authUser = $this->_getAuthUser(); - // get message data of prestudents or persons - $prestudentsData = array(); - if ($prestudents !== null) - { - $data = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudents); - // - $this->load->model('crm/Prestudent_model', 'PrestudentModel'); - $prestudentsData = $this->PrestudentModel->getOrganisationunits($prestudents); - } - else - $data = $this->MessageModel->getMsgVarsDataByPersonId($persons); + if (isError($authUser)) return $authUser; - // send message(s) - if (hasData($data)) + $sender_id = getData($authUser)[0]->person_id; + + // Send message(s) + if (hasData($msgVarsData)) { - for ($i = 0; $i < count($data->retval); $i++) + // Loads the person log library + $this->load->library('PersonLogLib'); + + for ($i = 0; $i < count($msgVarsData->retval); $i++) { $parsedText = ""; - $dataArray = (array)$data->retval[$i]; - foreach ($dataArray as $key => $val) - { - $newKey = str_replace(" ", "_", strtolower($key)); - $dataArray[$newKey] = $dataArray[$key]; - } + $msgVarsDataArray = $this->_replaceKeys((array)$msgVarsData->retval[$i]); // replaces array keys - // if oe not given, get from prestudent - if (isEmptyString($oe_kurzbz) && hasData($prestudentsData)) - { - for ($p = 0; $p < count($prestudentsData->retval); $p++) - { - if ($prestudentsData->retval[$p]->prestudent_id == $data->retval[$i]->prestudent_id) - { - $oe_kurzbz = $prestudentsData->retval[$p]->oe_kurzbz; - } - } - } - - // send without vorlage + // Send without vorlage if (isEmptyString($vorlage_kurzbz)) { - $parsedText = $this->messagelib->parseMessageText($body, $dataArray); - $msg = $this->messagelib->sendMessage($sender_id, $dataArray['person_id'], $subject, $parsedText, PRIORITY_NORMAL, $relationmessage_id, $oe_kurzbz); + $parsedText = $this->messagelib->parseMessageText($body, $msgVarsDataArray); + $msg = $this->messagelib->sendMessage($sender_id, $msgVarsDataArray['person_id'], $subject, $parsedText, PRIORITY_NORMAL, $relationmessage_id, $oe_kurzbz); } - // send with vorlage + // Send with vorlage else { - if (isset($msgvars) && is_array($msgvars)) + if (is_array($msgVars)) { - //additional message variables - foreach ($msgvars as $key => $msgvar) + // Additional message variables + foreach ($msgVars as $key => $msgvar) { - $dataArray[$key] = $msgvar; + $msgVarsDataArray[$key] = $msgvar; } } - $msg = $this->messagelib->sendMessageVorlage($sender_id, $dataArray['person_id'], $vorlage_kurzbz, $oe_kurzbz, $dataArray); + $msg = $this->messagelib->sendMessageVorlage($sender_id, $msgVarsDataArray['person_id'], $vorlage_kurzbz, $oe_kurzbz, $msgVarsDataArray); } - if ($msg->error) - { - return error($msg->msg); - } + if (isError($msg)) return $msg; - // Loads the person log library - $this->load->library('PersonLogLib'); - - //write log entry - $this->personloglib->log( - $dataArray['person_id'], + // Write log entry + $personLog = $this->personloglib->log( + $msgVarsDataArray['person_id'], 'Action', array( 'name' => 'Message sent', - 'message' => 'Message sent from person '.$sender_id.' to '.$dataArray['person_id'].', messageid '.$msg->retval, + 'message' => 'Message sent from person '.$sender_id.' to '.$msgVarsDataArray['person_id'].', messageid '.$msg->retval, 'success' => 'true' ), 'kommunikation', 'core', null, - $this->uid + getAuthUID() ); - } - return success('success'); + + return success('Messages sent successfully'); } - } - - /** - * getPersonId - */ - private function getPersonId() - { - $person_id = null; - - if ($this->input->get('person_id') !== null) + else { - $person_id = $this->input->get('person_id'); + return $msgVarsData; } - elseif ($this->input->post('person_id') !== null) - { - $person_id = $this->input->get('person_id'); - } - - if (!is_numeric($person_id)) - { - show_error('Person_id is not numeric'); - } - - return $person_id; - } - - /** - * Retrieve the UID of the logged user and checks if it is valid - */ - private function _setAuthUID() - { - $this->uid = getAuthUID(); - - if (!$this->uid) show_error('User authentification failed'); } /** @@ -374,16 +217,27 @@ class Messages extends Auth_Controller public function getVorlage() { $vorlage_kurzbz = $this->input->get('vorlage_kurzbz'); + $result = null; - if (isset($vorlage_kurzbz)) + if (!isEmptyString($vorlage_kurzbz)) { $this->load->model('system/Vorlagestudiengang_model', 'VorlagestudiengangModel'); $this->VorlagestudiengangModel->addOrder('version','DESC'); - $result = $this->VorlagestudiengangModel->loadWhere(array('vorlage_kurzbz' => $vorlage_kurzbz)); - $this->output - ->set_content_type('application/json') - ->set_output(json_encode($result)); + $result = $this->VorlagestudiengangModel->loadWhere(array('vorlage_kurzbz' => $vorlage_kurzbz)); + } + else + { + $result = error('The given vorlage_kurzbz is not valid'); + } + + if (isError($result) || !hasData($result)) + { + $this->outputJsonError($result->retval); + } + else + { + $this->outputJsonSuccess($result->retval); } } @@ -392,35 +246,29 @@ class Messages extends Auth_Controller */ public function parseMessageText() { - $prestudent_id = $this->input->get('prestudent_id'); $person_id = $this->input->get('person_id'); $text = $this->input->get('text'); - + $parsedText = ''; $data = null; - if (isset($person_id) && !isset($prestudent_id)) - $data = $this->MessageModel->getMsgVarsDataByPersonId($person_id); - elseif (isset($prestudent_id)) - $data = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudent_id); - - if (isset($data)) + if (is_numeric($person_id)) { - $parsedText = ""; - if (hasData($data)) - { - $dataArray = (array)$data->retval[0]; - foreach ($dataArray as $key => $val) - { - $newKey = str_replace(" ", "_", strtolower($key)); - $dataArray[$newKey] = $dataArray[$key]; - } + $data = $this->MessageModel->getMsgVarsDataByPersonId($person_id); + } + else + { + $data = error('The given person_id is not a valid number'); + } - $parsedText = $this->messagelib->parseMessageText($text, $dataArray); - } + if (isError($data) || !hasData($data)) + { + $this->outputJsonError($data->retval); + } + else + { + $parsedText = $this->messagelib->parseMessageText($text, $this->_replaceKeys((array)$data->retval[0])); - $this->output - ->set_content_type('application/json') - ->set_output(json_encode($parsedText)); + $this->outputJsonSuccess($parsedText); } } @@ -433,6 +281,7 @@ class Messages extends Auth_Controller { $msg_id = $this->input->get('msg_id'); $receiver_id = $this->input->get('receiver_id'); + $msg = $this->messagelib->getMessage($msg_id, $receiver_id); $this->output @@ -440,4 +289,51 @@ class Messages extends Auth_Controller ->set_output(json_encode(array($msg->retval[0]))); } + // ----------------------------------------------------------------------------------------------------------------- + // Private methods + + /** + * Retrieves message vars from view vw_msg_vars + */ + private function _getMsgVarsData($person_id) + { + $msgVarsData = $this->MessageModel->getMsgVarsDataByPersonId($person_id); + if (isError($msgVarsData)) + { + show_error($msgVarsData->retval); + } + + return $msgVarsData; + } + + /** + * + */ + private function _getAuthUser() + { + $sender_id = null; + + $this->load->model('person/Person_model', 'PersonModel'); + $authUser = $this->PersonModel->getByUid(getAuthUID()); + + if (!hasData($authUser)) $authUser = error('The current logged user person_id is not defined'); + + return $authUser; + } + + /** + * + */ + private function _replaceKeys($data) + { + $tmpData = array(); + + // Replaces data array keys to a lowercase without spaces string + foreach ($data as $key => $val) + { + $tmpData[str_replace(' ', '_', strtolower($key))] = $val; + } + + return $tmpData; + } } diff --git a/application/controllers/system/Phrases.php b/application/controllers/system/Phrases.php index 67c5d24f9..070750b7c 100644 --- a/application/controllers/system/Phrases.php +++ b/application/controllers/system/Phrases.php @@ -16,7 +16,6 @@ class Phrases extends Auth_Controller 'view' => 'system/phrase:r', 'deltext' => 'system/phrase:rw', 'edit' => 'system/phrase:rw', - 'write' => 'system/phrase:rw', 'save' => 'system/phrase:rw', 'newText' => 'system/phrase:rw', 'editText' => 'system/phrase:rw', @@ -115,19 +114,6 @@ class Phrases extends Auth_Controller $this->load->view('system/phrases/phrasesEdit', $data); } - /** - * - */ - public function write() - { - $data = array( - 'subject' => 'TestSubject', - 'body' => 'TestDevelopmentBodyText' - ); - - $this->load->view('system/messageWrite', $data); - } - /** * */ diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index 4c71da84a..431d0ecd8 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -631,7 +631,7 @@ class InfoCenter extends Auth_Controller public function reloadMessages($person_id) { $messages = $this->MessageModel->getMessagesOfPerson($person_id, 1); - $this->load->view('system/messageList.php', array('messages' => $messages->retval)); + $this->load->view('system/messages/messageList.php', array('messages' => $messages->retval)); } /** @@ -1166,8 +1166,6 @@ class InfoCenter extends Auth_Controller show_error($user_person->retval); } - $messagelink = site_url('/system/Messages/write/'.$user_person->retval[0]->person_id); - $data = array ( 'lockedby' => $lockedby, 'lockedbyother' => $lockedbyother, @@ -1177,8 +1175,7 @@ class InfoCenter extends Auth_Controller 'messages' => $messages->retval, 'logs' => $logs, 'notizen' => $notizen->retval, - 'notizenbewerbung' => $notizen_bewerbung->retval, - 'messagelink' => $messagelink + 'notizenbewerbung' => $notizen_bewerbung->retval ); return $data; diff --git a/application/helpers/hlp_message_helper.php b/application/helpers/hlp_message_helper.php index 1197a02ac..c8bbcaf87 100644 --- a/application/helpers/hlp_message_helper.php +++ b/application/helpers/hlp_message_helper.php @@ -82,6 +82,21 @@ function hasData($result) return false; } +/** + * Returns the property retval if $result contains data + */ +function getData($result) +{ + $data = null; + + if (hasData($result)) + { + $data = $result->retval; + } + + return $data; +} + /** * Checks if the result represents an error * Wrapper function of isSuccess, more readable code diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php index 45ccce876..c539a0bc7 100644 --- a/application/libraries/MessageLib.php +++ b/application/libraries/MessageLib.php @@ -9,36 +9,41 @@ class MessageLib { const MSG_INDX_PREFIX = 'message_'; + private $_ci; + /** * Constructor */ public function __construct() { // Get code igniter instance - $this->ci =& get_instance(); + $this->_ci =& get_instance(); // Loads message configuration - $this->ci->config->load('message'); + $this->_ci->config->load('message'); // CI Parser library - $this->ci->load->library('parser'); + $this->_ci->load->library('parser'); // Loads LogLib - $this->ci->load->library('LogLib'); + $this->_ci->load->library('LogLib'); // Loads VorlageLib - $this->ci->load->library('VorlageLib'); + $this->_ci->load->library('VorlageLib'); // Loads Mail library - $this->ci->load->library('MailLib'); + $this->_ci->load->library('MailLib'); // Loading models - $this->ci->load->model('system/Message_model', 'MessageModel'); - $this->ci->load->model('system/MsgStatus_model', 'MsgStatusModel'); - $this->ci->load->model('system/Recipient_model', 'RecipientModel'); - $this->ci->load->model('system/Attachment_model', 'AttachmentModel'); + $this->_ci->load->model('system/Message_model', 'MessageModel'); + $this->_ci->load->model('system/MsgStatus_model', 'MsgStatusModel'); + $this->_ci->load->model('system/Recipient_model', 'RecipientModel'); + $this->_ci->load->model('system/Attachment_model', 'AttachmentModel'); // Loads phrases - $this->ci->lang->load('message'); + $this->_ci->lang->load('message'); } + //------------------------------------------------------------------------------------------------------------------ + // Public methods + /** * getMessage() - returns the specified received message for a specified person */ @@ -49,9 +54,7 @@ class MessageLib if (!is_numeric($person_id)) return $this->_error('', MSG_ERR_INVALID_RECIPIENTS); - $msg = $this->ci->RecipientModel->getMessage($msg_id, $person_id); - - return $msg; + return $this->_ci->RecipientModel->getMessage($msg_id, $person_id); } /** @@ -62,9 +65,7 @@ class MessageLib if (isEmptyString($uid)) return $this->_error('', MSG_ERR_INVALID_MSG_ID); - $msg = $this->ci->RecipientModel->getMessagesByUID($uid, $oe_kurzbz, $all); - - return $msg; + return $this->_ci->RecipientModel->getMessagesByUID($uid, $oe_kurzbz, $all); } /** @@ -75,9 +76,7 @@ class MessageLib if (!is_numeric($person_id)) return $this->_error('', MSG_ERR_INVALID_MSG_ID); - $msg = $this->ci->RecipientModel->getMessagesByPerson($person_id, $oe_kurzbz, $all); - - return $msg; + return $this->_ci->RecipientModel->getMessagesByPerson($person_id, $oe_kurzbz, $all); } /** @@ -88,9 +87,7 @@ class MessageLib if (!is_numeric($person_id)) return $this->_error('', MSG_ERR_INVALID_MSG_ID); - $msg = $this->ci->MessageModel->getMessagesByPerson($person_id, $oe_kurzbz, $all); - - return $msg; + return $this->_ci->MessageModel->getMessagesByPerson($person_id, $oe_kurzbz, $all); } /** @@ -101,7 +98,7 @@ class MessageLib if (isEmptyString($token)) return $this->_error('', MSG_ERR_INVALID_TOKEN); - $result = $this->ci->RecipientModel->getMessageByToken($token); + $result = $this->_ci->RecipientModel->getMessageByToken($token); if (hasData($result)) { // Searches for a status that is different from unread @@ -124,7 +121,7 @@ class MessageLib 'status' => MSG_STATUS_READ ); - $resultIns = $this->ci->MsgStatusModel->insert($statusKey); + $resultIns = $this->_ci->MsgStatusModel->insert($statusKey); // If an error occured while writing on data base, then return it if (isError($resultIns)) { @@ -144,9 +141,7 @@ class MessageLib if (!is_numeric($person_id)) return $this->_error('', MSG_ERR_INVALID_RECIPIENTS); - $msg = $this->ci->RecipientModel->getCountUnreadMessages($person_id, $oe_kurzbz); - - return $msg; + return $this->_ci->RecipientModel->getCountUnreadMessages($person_id, $oe_kurzbz); } /** @@ -172,7 +167,7 @@ class MessageLib } // Searches if the status is already present - $result = $this->ci->MsgStatusModel->load(array($message_id, $person_id, $status)); + $result = $this->_ci->MsgStatusModel->load(array($message_id, $person_id, $status)); if (hasData($result)) { // status already present @@ -186,7 +181,7 @@ class MessageLib 'status' => $status ); - $result = $this->ci->MsgStatusModel->insert($statusKey); + $result = $this->_ci->MsgStatusModel->insert($statusKey); } return $result; @@ -199,7 +194,7 @@ class MessageLib { if (!is_numeric($sender_id)) { - $sender_id = $this->ci->config->item('system_person_id'); + $sender_id = $this->_ci->config->item('system_person_id'); } $receivers = $this->_getReceivers($receiver_id, $oe_kurzbz); @@ -230,7 +225,7 @@ class MessageLib if (isSuccess($result)) { // If the system is configured to send messages immediately - if ($this->ci->config->item('send_immediately') === true) + if ($this->_ci->config->item('send_immediately') === true) { // Send message by email! $resultSendEmail = $this->sendOne($result->retval, $subject, $body, $multiPartMime); @@ -274,7 +269,7 @@ class MessageLib { if (!is_numeric($sender_id)) { - $sender_id = $this->ci->config->item('system_person_id'); + $sender_id = $this->_ci->config->item('system_person_id'); } $receivers = $this->_getReceivers($receiver_id, $oe_kurzbz); @@ -290,7 +285,7 @@ class MessageLib else { // Load reveiver data to get its relative language - $this->ci->load->model('person/Person_model', 'PersonModel'); + $this->_ci->load->model('person/Person_model', 'PersonModel'); } // Looping on receivers @@ -299,14 +294,14 @@ class MessageLib $receiver_id = $receivers->retval[$i]->person_id; // Checks if the receiver exists - $result = $this->ci->PersonModel->load($receiver_id); + $result = $this->_ci->PersonModel->load($receiver_id); if (hasData($result)) { // Retrives the language of the logged user $sprache = getUserLanguage(); // Loads template data - $result = $this->ci->vorlagelib->loadVorlagetext($vorlage_kurzbz, $oe_kurzbz, $orgform_kurzbz, $sprache); + $result = $this->_ci->vorlagelib->loadVorlagetext($vorlage_kurzbz, $oe_kurzbz, $orgform_kurzbz, $sprache); if (isSuccess($result)) { // If the text and the subject of the template are not empty @@ -314,9 +309,9 @@ class MessageLib !isEmptyString($result->retval[0]->text) && !isEmptyString($result->retval[0]->subject)) { // Parses template text - $parsedText = $this->ci->vorlagelib->parseVorlagetext($result->retval[0]->text, $data); + $parsedText = $this->_ci->vorlagelib->parseVorlagetext($result->retval[0]->text, $data); // Parses subject - $subject = $this->ci->vorlagelib->parseVorlagetext($result->retval[0]->subject, $data); + $subject = $this->_ci->vorlagelib->parseVorlagetext($result->retval[0]->subject, $data); // Save message $result = $this->_saveMessage($sender_id, $receiver_id, $subject, $parsedText, $relationmessage_id, $oe_kurzbz); @@ -324,7 +319,7 @@ class MessageLib if (isSuccess($result)) { // If the system is configured to send messages immediately - if ($this->ci->config->item('send_immediately') === true) + if ($this->_ci->config->item('send_immediately') === true) { // Send message by email! $resultSendEmail = $this->sendOne($result->retval, $subject, $parsedText, $multiPartMime); @@ -389,21 +384,21 @@ class MessageLib $sent = true; // optimistic expectation // Gets standard configs - $cfg = $this->ci->maillib->getConfigs(); + $cfg = $this->_ci->maillib->getConfigs(); $cfg->email_number_to_sent = $numberToSent; $cfg->email_number_per_time_range = $numberPerTimeRange; $cfg->email_time_range = $email_time_range; $cfg->email_from_system = $email_from_system; // Overrides configs with the parameters - $this->ci->maillib->overrideConfigs($cfg); + $this->_ci->maillib->overrideConfigs($cfg); - // Gets a number ($this->ci->maillib->getMaxEmailToSent()) of unsent messages from DB + // Gets a number ($this->_ci->maillib->getMaxEmailToSent()) of unsent messages from DB // having EMAIL_KONTAKT_TYPE as relative contact type - $result = $this->ci->RecipientModel->getMessages( + $result = $this->_ci->RecipientModel->getMessages( EMAIL_KONTAKT_TYPE, null, - $this->ci->maillib->getConfigs()->email_number_to_sent + $this->_ci->maillib->getConfigs()->email_number_to_sent ); // Checks if errors were occurred if (isSuccess($result)) @@ -418,14 +413,14 @@ class MessageLib if ((!is_null($result->retval[$i]->receiver) && $result->retval[$i]->receiver != '') || (!is_null($result->retval[$i]->employeecontact) && $result->retval[$i]->employeecontact != '')) { - $href = $this->ci->config->item('message_server').$this->ci->config->item('message_html_view_url').$result->retval[$i]->token; + $href = $this->_ci->config->item('message_server').$this->_ci->config->item('message_html_view_url').$result->retval[$i]->token; - $vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailHTML'); + $vorlage = $this->_ci->vorlagelib->loadVorlagetext('MessageMailHTML'); if(hasData($vorlage)) { // Using a template for the html email body - $body = $this->ci->parser->parse_string( + $body = $this->_ci->parser->parse_string( $vorlage->retval[0]->text, array( 'href' => $href, @@ -438,7 +433,7 @@ class MessageLib else { // Using a template for the html email body - $body = $this->ci->parser->parse( + $body = $this->_ci->parser->parse( 'templates/mailHTML', array( 'href' => $href, @@ -450,14 +445,14 @@ class MessageLib } if (is_null($body) || $body == '') { - $this->ci->loglib->logError('Error while parsing the mail template'); + $this->_ci->loglib->logError('Error while parsing the mail template'); } - $vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailTXT'); + $vorlage = $this->_ci->vorlagelib->loadVorlagetext('MessageMailTXT'); if(hasData($vorlage)) { // Using a template for the plain text email body - $altBody = $this->ci->parser->parse_string( + $altBody = $this->_ci->parser->parse_string( $vorlage->retval[0]->text, array( 'href' => $href, @@ -470,7 +465,7 @@ class MessageLib else { // Using a template for the plain text email body - $altBody = $this->ci->parser->parse( + $altBody = $this->_ci->parser->parse( 'templates/mailTXT', array( 'href' => $href, @@ -482,7 +477,7 @@ class MessageLib } if (is_null($altBody) || $altBody == '') { - $this->ci->loglib->logError('Error while parsing the mail template'); + $this->_ci->loglib->logError('Error while parsing the mail template'); } // If the sender is not an employee, then system-sender is used if empty @@ -499,7 +494,7 @@ class MessageLib } // Sending email - $sent = $this->ci->maillib->send( + $sent = $this->_ci->maillib->send( $sender, $receiverContact, $result->retval[$i]->subject, @@ -512,7 +507,7 @@ class MessageLib // If errors were occurred while sending the email if (!$sent) { - $this->ci->loglib->logError('Error while sending an email'); + $this->_ci->loglib->logError('Error while sending an email'); // Writing errors in tbl_msg_recipient $sme = $this->setMessageError( $result->retval[$i]->message_id, @@ -522,7 +517,7 @@ class MessageLib ); if (!$sme) { - $this->ci->loglib->logError('Error while updating DB'); + $this->_ci->loglib->logError('Error while updating DB'); } } else @@ -532,13 +527,13 @@ class MessageLib // If some errors occurred if (!$sent) { - $this->ci->loglib->logError('Error while updating DB'); + $this->_ci->loglib->logError('Error while updating DB'); } } } else { - $this->ci->loglib->logError('This person does not have an email account'); + $this->_ci->loglib->logError('This person does not have an email account'); // Writing errors in tbl_msg_recipient $sme = $this->setMessageError( $result->retval[$i]->message_id, @@ -548,7 +543,7 @@ class MessageLib ); if (!$sme) { - $this->ci->loglib->logError('Error while updating DB'); + $this->_ci->loglib->logError('Error while updating DB'); } $sent = true; // Non blocking error } @@ -556,13 +551,13 @@ class MessageLib } else { - $this->ci->loglib->logInfo('There are no email to be sent'); + $this->_ci->loglib->logInfo('There are no email to be sent'); $sent = false; } } else { - $this->ci->loglib->logError('Something went wrong while getting data from DB'); + $this->_ci->loglib->logError('Something went wrong while getting data from DB'); $sent = false; } @@ -577,7 +572,7 @@ class MessageLib $sent = true; // optimistic expectation // Get a specific message from DB having EMAIL_KONTAKT_TYPE as relative contact type - $result = $this->ci->RecipientModel->getMessages( + $result = $this->_ci->RecipientModel->getMessages( EMAIL_KONTAKT_TYPE, null, null, @@ -598,12 +593,12 @@ class MessageLib if ($multiPartMime === true) { // Using a template for the html email body - $href = $this->ci->config->item('message_server').$this->ci->config->item('message_html_view_url').$result->retval[0]->token; + $href = $this->_ci->config->item('message_server').$this->_ci->config->item('message_html_view_url').$result->retval[0]->token; - $vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailHTML'); + $vorlage = $this->_ci->vorlagelib->loadVorlagetext('MessageMailHTML'); if(hasData($vorlage)) { - $bodyMsg = $this->ci->parser->parse_string( + $bodyMsg = $this->_ci->parser->parse_string( $vorlage->retval[0]->text, array( 'href' => $href, @@ -615,7 +610,7 @@ class MessageLib } else { - $bodyMsg = $this->ci->parser->parse( + $bodyMsg = $this->_ci->parser->parse( 'templates/mailHTML', array( 'href' => $href, @@ -628,14 +623,14 @@ class MessageLib if (is_null($bodyMsg) || $bodyMsg == '') { // $body = $result->retval[0]->body; - $this->ci->loglib->logError('Error while parsing the html mail template'); + $this->_ci->loglib->logError('Error while parsing the html mail template'); } // Using a template for the plain text email body - $vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailTXT'); + $vorlage = $this->_ci->vorlagelib->loadVorlagetext('MessageMailTXT'); if(hasData($vorlage)) { - $altBody = $this->ci->parser->parse_string( + $altBody = $this->_ci->parser->parse_string( $vorlage->retval[0]->text, array( 'href' => $href, @@ -647,7 +642,7 @@ class MessageLib } else { - $altBody = $this->ci->parser->parse( + $altBody = $this->_ci->parser->parse( 'templates/mailTXT', array( 'href' => $href, @@ -659,7 +654,7 @@ class MessageLib } if (is_null($altBody) || $altBody == '') { - $this->ci->loglib->logError('Error while parsing the plain text mail template'); + $this->_ci->loglib->logError('Error while parsing the plain text mail template'); } } else @@ -681,7 +676,7 @@ class MessageLib } // Sending email - $sent = $this->ci->maillib->send( + $sent = $this->_ci->maillib->send( null, $receiverContact, is_null($subject) ? $result->retval[0]->subject : $subject, // if parameter subject is not null, use it! @@ -694,7 +689,7 @@ class MessageLib // If errors were occurred while sending the email if (!$sent) { - $this->ci->loglib->logError('Error while sending an email'); + $this->_ci->loglib->logError('Error while sending an email'); // Writing errors in tbl_msg_recipient $sme = $this->setMessageError( $result->retval[0]->message_id, @@ -704,7 +699,7 @@ class MessageLib ); if (!$sme) { - $this->ci->loglib->logError('Error while updating DB'); + $this->_ci->loglib->logError('Error while updating DB'); } } else @@ -714,13 +709,13 @@ class MessageLib // If the email has been sent and the DB updated if (!$sent) { - $this->ci->loglib->logError('Error while updating DB'); + $this->_ci->loglib->logError('Error while updating DB'); } } } else { - $this->ci->loglib->logError('This person does not have an email account'); + $this->_ci->loglib->logError('This person does not have an email account'); // Writing errors in tbl_msg_recipient $sme = $this->setMessageError( $result->retval[0]->message_id, @@ -730,27 +725,100 @@ class MessageLib ); if (!$sme) { - $this->ci->loglib->logError('Error while updating DB'); + $this->_ci->loglib->logError('Error while updating DB'); } $sent = true; // Non blocking error } } else { - $this->ci->loglib->logInfo('There are no email to be sent'); + $this->_ci->loglib->logInfo('There are no email to be sent'); $sent = false; } } else { - $this->ci->loglib->logError('Something went wrong while getting data from DB'); + $this->_ci->loglib->logError('Something went wrong while getting data from DB'); $sent = false; } return $sent; } - // ------------------------------------------------------------------------ + /** + * parseMessageText + */ + public function parseMessageText($text, $data = array()) + { + return $this->_ci->parser->parse_string($text, $data, true); + } + + /** + * Gets data for Person from view vw_msg_vars_person + * @param $person_id + */ + public function getMessageVarsPerson() + { + $variablesArray = array(); + $variables = $this->_ci->MessageModel->getMessageVarsPerson(); + + if (isError($variables)) + { + show_error($variables->retval); + } + elseif (hasData($variables)) + { + // Skip person_id + for ($i = 1; $i < count($variables->retval); $i++) + { + $variablesArray['{'.str_replace(' ', '_', strtolower($variables->retval[$i])).'}'] = $variables->retval[$i]; + } + array_shift($variables->retval); // Remove person_id + } + + return $variablesArray; + } + + /** + * A person may belongs to more organisation units + */ + public function getOeKurzbz($sender_id) + { + $oe_kurzbz = array(); + + $this->_ci->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel'); + $benutzerResult = $this->_ci->BenutzerfunktionModel->getByPersonId($sender_id); + if (isError($benutzerResult)) + { + show_error($benutzerResult->retval); + } + elseif (hasData($benutzerResult)) + { + foreach ($benutzerResult->retval as $val) + { + $oe_kurzbz[] = $val->oe_kurzbz; + } + } + + return $oe_kurzbz; + } + + /** + * Admin or commoner? + */ + public function getIsAdmin($sender_id) + { + $this->_ci->load->model('system/Benutzerrolle_model', 'BenutzerrolleModel'); + $isAdmin = $this->_ci->BenutzerrolleModel->isAdminByPersonId($sender_id); + if (isError($isAdmin)) + { + show_error($isAdmin->retval); + } + + return $isAdmin->retval; + } + + //------------------------------------------------------------------------------------------------------------------ // Private methods /** @@ -761,7 +829,7 @@ class MessageLib $updated = false; // Updates table tbl_msg_recipient - $resultUpdate = $this->ci->RecipientModel->update(array($receiver_id, $message_id), $parameters); + $resultUpdate = $this->_ci->RecipientModel->update(array($receiver_id, $message_id), $parameters); // Checks if errors were occurred if (isSuccess($resultUpdate) && is_array($resultUpdate->retval)) { @@ -802,13 +870,13 @@ class MessageLib private function _getReceiversByOekurzbz($oe_kurzbz) { // Load Benutzerfunktion_model - $this->ci->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel'); + $this->_ci->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel'); // Join with table public.tbl_benutzer on field uid - $this->ci->BenutzerfunktionModel->addJoin('public.tbl_benutzer', 'uid'); + $this->_ci->BenutzerfunktionModel->addJoin('public.tbl_benutzer', 'uid'); // Get all the valid receivers id using the oe_kurzbz - $receivers = $this->ci->BenutzerfunktionModel->loadWhere( - 'oe_kurzbz = '.$this->ci->db->escape($oe_kurzbz). - ' AND funktion_kurzbz = '.$this->ci->db->escape($this->ci->config->item('assistent_function')). + $receivers = $this->_ci->BenutzerfunktionModel->loadWhere( + 'oe_kurzbz = '.$this->_ci->db->escape($oe_kurzbz). + ' AND funktion_kurzbz = '.$this->_ci->db->escape($this->_ci->config->item('assistent_function')). ' AND (NOW() BETWEEN COALESCE(datum_von, NOW()) AND COALESCE(datum_bis, NOW()))' ); @@ -851,8 +919,8 @@ class MessageLib private function _checkReceiverId($receiver_id) { // Load Person_model - $this->ci->load->model('person/Person_model', 'PersonModel'); - $result = $this->ci->PersonModel->load($receiver_id); + $this->_ci->load->model('person/Person_model', 'PersonModel'); + $result = $this->_ci->PersonModel->load($receiver_id); if (hasData($result)) { return true; @@ -867,7 +935,7 @@ class MessageLib private function _saveMessage($sender_id, $receiver_id, $subject, $body, $relationmessage_id, $oe_kurzbz) { // Starts db transaction - $this->ci->db->trans_start(false); + $this->_ci->db->trans_start(false); // Save Message $msgData = array( @@ -878,7 +946,7 @@ class MessageLib 'relationmessage_id' => $relationmessage_id, 'oe_kurzbz' => $oe_kurzbz ); - $result = $this->ci->MessageModel->insert($msgData); + $result = $this->_ci->MessageModel->insert($msgData); if (isSuccess($result)) { // Link the message with the receiver @@ -888,7 +956,7 @@ class MessageLib 'message_id' => $msg_id, 'token' => generateToken() ); - $result = $this->ci->RecipientModel->insert($recipientData); + $result = $this->_ci->RecipientModel->insert($recipientData); if (isSuccess($result)) { // Save message status @@ -897,20 +965,20 @@ class MessageLib 'person_id' => $receiver_id, 'status' => MSG_STATUS_UNREAD ); - $result = $this->ci->MsgStatusModel->insert($statusData); + $result = $this->_ci->MsgStatusModel->insert($statusData); } } - $this->ci->db->trans_complete(); + $this->_ci->db->trans_complete(); - if ($this->ci->db->trans_status() === false || isError($result)) + if ($this->_ci->db->trans_status() === false || isError($result)) { - $this->ci->db->trans_rollback(); + $this->_ci->db->trans_rollback(); $result = $this->_error($result->msg, EXIT_ERROR); } else { - $this->ci->db->trans_commit(); + $this->_ci->db->trans_commit(); $result = $this->_success($msg_id); } @@ -932,12 +1000,4 @@ class MessageLib { return success($retval, $code, MessageLib::MSG_INDX_PREFIX); } - - /** - * - */ - public function parseMessageText($text, $data = array()) - { - return $this->ci->parser->parse_string($text, $data, true); - } } diff --git a/application/libraries/StudienplanLib.php b/application/libraries/StudienplanLib.php new file mode 100644 index 000000000..c40120721 --- /dev/null +++ b/application/libraries/StudienplanLib.php @@ -0,0 +1,72 @@ +ci =& get_instance(); + + // Loads model Organisationseinheit_model + $this->ci->load->model('organisation/Studienplan_model', 'StudienplanModel'); + } + + public function getLehrveranstaltungTree($studienplan_id, $semester, $studplan = null) + { + $tree = array(); + $data = $this->ci->StudienplanModel->getStudienplanLehrveranstaltung($studienplan_id, $semester); + if(isSuccess($data) && hasData($data)) + { + $this->lehrveranstaltungen = $data->retval; + foreach($this->lehrveranstaltungen as $row) + { + if (!is_null($studplan) && $row->export != $studplan) + continue; + + if (is_null($row->studienplan_lehrveranstaltung_id_parent)) + { + $treeitem = array( + 'lehrveranstaltung_id' => $row->lehrveranstaltung_id, + 'lehrtyp_kurzbz' => $row->lehrtyp_kurzbz, + 'pflicht' => $row->pflicht, + 'bezeichnung' => $row->bezeichnung, + 'ects' => $row->ects + ); + $childs = $this->getChildElements($row->studienplan_lehrveranstaltung_id); + if(is_array($childs) && count($childs) > 0) + $treeitem['childs'] = $childs; + $tree[] = $treeitem; + } + } + } + return $tree; + } + + private function getChildElements($studienplan_lehrveranstaltung_id) + { + $subtree = array(); + + foreach($this->lehrveranstaltungen as $row) + { + if($studienplan_lehrveranstaltung_id == $row->studienplan_lehrveranstaltung_id_parent) + { + $treeitem = array( + 'lehrveranstaltung_id' => $row->lehrveranstaltung_id, + 'lehrtyp_kurzbz' => $row->lehrtyp_kurzbz, + 'pflicht' => $row->pflicht, + 'bezeichnung' => $row->bezeichnung, + 'ects' => $row->ects + ); + $childs = $this->getChildElements($row->studienplan_lehrveranstaltung_id); + if(is_array($childs)) + $treeitem['childs'] = $childs; + $subtree[] = $treeitem; + } + } + return $subtree; + } +} diff --git a/application/models/accounting/Kostenstelle_model.php b/application/models/accounting/Kostenstelle_model.php index f338b69d5..719d08835 100644 --- a/application/models/accounting/Kostenstelle_model.php +++ b/application/models/accounting/Kostenstelle_model.php @@ -13,12 +13,12 @@ class Kostenstelle_model extends DB_Model } /** - * Gets all active Kostenstellen for a geschaeftsjahr, as determined by the geschaeftsjahrvon and bis fields + * Gets Kostenstellen for a geschaeftsjahr, as determined by the geschaeftsjahrvon and bis fields * Gets Kostenstellen of current Geschaeftsjahr if Geschaeftsjahr not specified * @param $geschaeftsjahr * @return array|null Kostenstellen or empty array if no geschaeftsjahr found */ - public function getActiveKostenstellenForGeschaeftsjahr($geschaeftsjahr = null) + public function getKostenstellenForGeschaeftsjahr($geschaeftsjahr = null) { $this->load->model('organisation/geschaeftsjahr_model', 'GeschaeftsjahrModel'); @@ -47,12 +47,12 @@ class Kostenstelle_model extends DB_Model } /** - * Gets all active Kostenstellen for a geschaeftsjahr, as determined by the geschaeftsjahrvon and bis fields, together with their oe, + * Gets Kostenstellen for a geschaeftsjahr, as determined by the geschaeftsjahrvon and bis fields, together with their oe, * hierarchally sorted, gets Kostenstellen of current Geschaeftsjahr if Geschaeftsjahr not specified * @param null $geschaeftsjahr * @return array|null */ - public function getActiveKostenstellenForGeschaeftsjahrWithOe($geschaeftsjahr = null) + public function getKostenstellenForGegitschaeftsjahrWithOe($geschaeftsjahr = null) { $this->load->model('organisation/geschaeftsjahr_model', 'GeschaeftsjahrModel'); diff --git a/application/models/crm/Student_model.php b/application/models/crm/Student_model.php index 0d03fd50f..532658208 100644 --- a/application/models/crm/Student_model.php +++ b/application/models/crm/Student_model.php @@ -14,13 +14,13 @@ class Student_model extends DB_Model } // **** -// * Generiert die Matrikelnummer -// * FORMAT: 0710254001 -// * 07 = Jahr -// * 1/2/0 = WS/SS/incoming -// * 0254 = Studiengangskennzahl vierstellig -// * 001 = Laufende Nummer -// **** + // * Generiert die Matrikelnummer + // * FORMAT: 0710254001 + // * 07 = Jahr + // * 1/2/0 = WS/SS/incoming + // * 0254 = Studiengangskennzahl vierstellig + // * 001 = Laufende Nummer + // **** public function generateMatrikelnummer($studiengang_kz, $studiensemester_kurzbz) { $jahr = mb_substr($studiensemester_kurzbz, 4); diff --git a/application/models/organisation/Studienplan_model.php b/application/models/organisation/Studienplan_model.php index 5fe7ef44d..2c3b36c03 100644 --- a/application/models/organisation/Studienplan_model.php +++ b/application/models/organisation/Studienplan_model.php @@ -11,35 +11,46 @@ class Studienplan_model extends DB_Model $this->dbTable = "lehre.tbl_studienplan"; $this->pk = "studienplan_id"; } - + public function getStudienplaene($studiengang_kz) { $this->addJoin("lehre.tbl_studienordnung", "studienordnung_id"); - + return $this->loadWhere(array("studiengang_kz" => $studiengang_kz)); } - + public function getStudienplaeneBySemester($studiengang_kz, $studiensemester_kurzbz, $ausbildungssemester = null, $orgform_kurzbz = null) { $this->addJoin("lehre.tbl_studienordnung", "studienordnung_id"); $this->addJoin("lehre.tbl_studienplan_semester", "studienplan_id"); - + $whereArray = array( "tbl_studienplan.aktiv" => "TRUE", "tbl_studienordnung.studiengang_kz" => $studiengang_kz, "tbl_studienplan_semester.studiensemester_kurzbz" => $studiensemester_kurzbz ); - + if(!is_null($ausbildungssemester)) { $whereArray["tbl_studienplan_semester.semester"] = $ausbildungssemester; } - + if(!is_null($orgform_kurzbz)) { $whereArray["orgform_kurzbz"] = $orgform_kurzbz; } - + return $this->StudienplanModel->loadWhere($whereArray); } -} \ No newline at end of file + + public function getStudienplanLehrveranstaltung($studienplan_id, $semester) + { + $this->addJoin('lehre.tbl_studienplan_lehrveranstaltung', 'studienplan_id'); + $this->addJoin('lehre.tbl_lehrveranstaltung', 'lehrveranstaltung_id'); + $this->addOrder('tbl_lehrveranstaltung.sort'); + return $this->loadWhere(array( + 'studienplan_id' => $studienplan_id, + 'tbl_studienplan_lehrveranstaltung.semester' => $semester + )); + } +} diff --git a/application/views/person/gradelist/course.php b/application/views/person/gradelist/course.php new file mode 100644 index 000000000..1f1f1911b --- /dev/null +++ b/application/views/person/gradelist/course.php @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/application/views/person/gradelist/gradelist.php b/application/views/person/gradelist/gradelist.php new file mode 100644 index 000000000..f00978294 --- /dev/null +++ b/application/views/person/gradelist/gradelist.php @@ -0,0 +1,52 @@ +load->view( + 'templates/FHC-Header', + array( + 'title' => 'Gradelist', + 'jquery' => true, + 'jqueryui' => true, + 'bootstrap' => true, + 'fontawesome' => true, + 'ajaxlib' => true, + 'customCSSs' => array( + 'public/css/tools/gradelist.css' + ), + 'customJSs' => array( + 'public/js/bootstrapper.js' + ) + ) + ); +?> + +
+
+
+
+
+

+ p->t('global', 'uebersicht')); ?> - + vorname.' '.$person->nachname.' ('.$user.')';?> +

+
+
+
+ p->t('lehre', 'notendurchschnitt'); ?>: +
+ p->t('lehre', 'gewichteternotendurchschnitt'); ?>: +
+ p->t('lehre', 'ects'); ?>: +
+
+ $row_semester) + { + $this->load->view('person/gradelist/semester.php', $row_semester); + } + ?> +
+
+
+
+ + +load->view('templates/FHC-Footer'); ?> diff --git a/application/views/person/gradelist/semester.php b/application/views/person/gradelist/semester.php new file mode 100644 index 000000000..ae9bbc5bc --- /dev/null +++ b/application/views/person/gradelist/semester.php @@ -0,0 +1,117 @@ + +
+
+
+ +
+
+ 0): + + echo '

Lehrveranstaltungen laut Studienplan '.$semesterdata['studienplan_bezeichnung'].'

'; + ?> + + + + + + + + + + + + + + + + + + +
p->t('lehre','lehrveranstaltung');?>p->t('lehre','ects');?>p->t('lehre','note');?>
+ +
+ 0): + ?> +

p->t('lehre','nichtstudienplanrelevanteKurse'); ?>

+ + + + + + + + + + + + + + + + + + +
p->t('lehre','lehrveranstaltung');?>p->t('lehre','ects');?>p->t('lehre','note');?>
+ +
+ +
+
+
+
diff --git a/application/views/system/infocenter/infocenterDetails.php b/application/views/system/infocenter/infocenterDetails.php index c59702a65..f29be7127 100644 --- a/application/views/system/infocenter/infocenterDetails.php +++ b/application/views/system/infocenter/infocenterDetails.php @@ -143,7 +143,7 @@
load->view('system/messageList.php', $messages); + $this->load->view('system/messages/messageList.php', $messages); ?>
diff --git a/application/views/system/infocenter/stammdaten.php b/application/views/system/infocenter/stammdaten.php index 08058f099..2b481692e 100644 --- a/application/views/system/infocenter/stammdaten.php +++ b/application/views/system/infocenter/stammdaten.php @@ -66,7 +66,7 @@ - kontakte as $kontakt): ?> @@ -113,12 +113,11 @@
-
- -  p->t('ui','nachrichtSenden') ?> + + + +  p->t('ui','nachrichtSenden'); ?> +
zugangscode)): ?> diff --git a/application/views/system/messageSent.php b/application/views/system/messageSent.php deleted file mode 100644 index bf02b2367..000000000 --- a/application/views/system/messageSent.php +++ /dev/null @@ -1,107 +0,0 @@ -load->view( - 'templates/FHC-Header', - array( - 'title' => 'MessageSent', - 'jquery' => true, - 'bootstrap' => true, - 'fontawesome' => true, - 'sbadmintemplate' => true, - 'customCSSs' => array('public/css/sbadmin2/admintemplate_contentonly.css', 'public/css/messaging/messageSent.css') - ) -); -?> - -
-
-
-
-
- -
-
- -
-
-
-
-
-
-
-
- Message sent successfully! -
-
- Nachricht erfolgreich versandt! -
-
-
-
-
-
- - Thank you for your message. - - - We will get back to you shortly. - -
-
- - Herzlichen Dank für Ihre Nachricht. - - - Wir werden uns schnellstmöglich um Ihr Anliegen kümmern. - -
-
-
-
-
- You can safely close this window. -
-
- Sie können dieses Fenster schließen. -
-
-
-
-
- Your InfoCenter@FHTW Team -
-
- Ihr InfoCenter@FHTW Team -
-
-
-
-
-
-
-

- Fachhochschule Technikum Wien | University of Applied Sciences Technikum Wien -
Hoechstaedtplatz 6, 1200 Wien, AUSTRIA -
www.technikum-wien.at -

-
-
-
- -
-
-
-
- - -load->view("templates/FHC-Footer"); ?> diff --git a/application/views/system/messageWrite.php b/application/views/system/messageWrite.php deleted file mode 100644 index e53872ac4..000000000 --- a/application/views/system/messageWrite.php +++ /dev/null @@ -1,319 +0,0 @@ -load->view( - 'templates/FHC-Header', - array( - 'title' => 'MessageReply', - 'jquery' => true, - 'bootstrap' => true, - 'fontawesome' => true, - 'tinymce' => true, - 'sbadmintemplate' => true, - 'customCSSs' => array('public/css/sbadmin2/admintemplate_contentonly.css', 'public/css/messaging/messageWrite.css'), - 'customJSs' => array('public/js/bootstrapper.js') - ) -); -?> - - -
-
-
-
-
- -
-
-
-
-
-
- -
-
- 1 && $i % 10 == 0) - { - echo '
'; - } - echo $receiver->Vorname." ".$receiver->Nachname."; "; - } - ?> -
-
-
-
-
-
- -
  - subject; - } - ?> -
- -
-
-
-
-
-
- - body; - } - ?> - -
- -
-
- - -
-
- -
-
-
-
- widgetlib->widget( - 'Vorlage_widget', - array('oe_kurzbz' => $oe_kurzbz, 'isAdmin' => $isAdmin), - array('name' => 'vorlage', 'id' => 'vorlageDnD') - ); - ?> -
-
- -
-
- 0): ?> -
-
-
- -
-
-
-
-
-
- - -   - Refresh -
-
-
- -
-
-
- -
- - - person_id; - $fieldname = 'persons[]'; - } - else - { - $receiverid = $receiver->prestudent_id; - $fieldname = 'prestudents[]'; - } - echo ''."\n"; - } - ?> - - - - - -
-
-
-
- - - - -load->view("templates/FHC-Footer"); ?> diff --git a/application/views/system/messageWriteReply.php b/application/views/system/messageWriteReply.php deleted file mode 100644 index 0987b6226..000000000 --- a/application/views/system/messageWriteReply.php +++ /dev/null @@ -1,89 +0,0 @@ -load->view( - 'templates/FHC-Header', - array( - 'title' => 'MessageReply', - 'jquery' => true, - 'bootstrap' => true, - 'fontawesome' => true, - 'tinymce' => true, - 'sbadmintemplate' => true, - 'customCSSs' => array('public/css/sbadmin2/admintemplate_contentonly.css', 'public/css/messaging/messageWrite.css'), - 'customJSs' => array('public/js/bootstrapper.js') - ) -); -?> - - -
-
-
-
-
- -
-
-
- load->view('system/messageForm.php'); ?> - person_id; - $fieldname = 'persons[]'; - - echo ''."\n"; - } - ?> - - - - - - - -
-
-
-
- - -load->view("templates/FHC-Footer"); ?> diff --git a/application/views/system/messageForm.php b/application/views/system/messages/messageForm.php similarity index 100% rename from application/views/system/messageForm.php rename to application/views/system/messages/messageForm.php diff --git a/application/views/system/messageHTML.php b/application/views/system/messages/messageHTML.php similarity index 100% rename from application/views/system/messageHTML.php rename to application/views/system/messages/messageHTML.php diff --git a/application/views/system/messageList.php b/application/views/system/messages/messageList.php similarity index 100% rename from application/views/system/messageList.php rename to application/views/system/messages/messageList.php diff --git a/application/views/system/messages/messageReplySent.php b/application/views/system/messages/messageReplySent.php new file mode 100644 index 000000000..88fc945b0 --- /dev/null +++ b/application/views/system/messages/messageReplySent.php @@ -0,0 +1,103 @@ +load->view( + 'templates/FHC-Header', + array( + 'title' => 'MessageSent', + 'jquery' => true, + 'bootstrap' => true, + 'fontawesome' => true, + 'sbadmintemplate' => true, + 'customCSSs' => array('public/css/sbadmin2/admintemplate_contentonly.css', 'public/css/messaging/messageSent.css') + ) + ); +?> + + +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+
+
+
+ Message sent successfully! +
+
+ Nachricht erfolgreich versandt! +
+
+
+
+
+
+ + Thank you for your message. + + + We will get back to you shortly. + +
+
+ + Herzlichen Dank für Ihre Nachricht. + + + Wir werden uns schnellstmöglich um Ihr Anliegen kümmern. + +
+
+ +
+ +
+
+ You can safely close this window. +
+
+ Sie können dieses Fenster schließen. +
+
+
+
+
+ Your InfoCenter@FHTW Team +
+
+ Ihr InfoCenter@FHTW Team +
+
+
+
+
+
+
+

+ Fachhochschule Technikum Wien | University of Applied Sciences Technikum Wien +
Hoechstaedtplatz 6, 1200 Wien, AUSTRIA +
www.technikum-wien.at +

+
+
+
+
+
+
+
+ + +load->view("templates/FHC-Footer"); ?> diff --git a/application/views/system/messages/messageSent.php b/application/views/system/messages/messageSent.php new file mode 100644 index 000000000..674ccd5a0 --- /dev/null +++ b/application/views/system/messages/messageSent.php @@ -0,0 +1,92 @@ +load->view( + 'templates/FHC-Header', + array( + 'title' => 'MessageSent', + 'jquery' => true, + 'bootstrap' => true, + 'fontawesome' => true, + 'sbadmintemplate' => true, + 'customCSSs' => array('public/css/sbadmin2/admintemplate_contentonly.css', 'public/css/messaging/messageSent.css') + ) + ); +?> + + +
+
+
+ + + +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+
+
+ Message sent successfully! +
+
+ Nachricht erfolgreich versandt! +
+
+
+ +
+ +
+ +
+
+ You can safely close this window. +
+
+ Sie können dieses Fenster schließen. +
+
+ +
+ +
+
+ +
+
+

+ Fachhochschule Technikum Wien | University of Applied Sciences Technikum Wien +
Hoechstaedtplatz 6, 1200 Wien, AUSTRIA +
www.technikum-wien.at +

+
+
+ +
+
+ + + +
+
+
+ + +load->view("templates/FHC-Footer"); ?> diff --git a/application/views/system/messages/messageWrite.php b/application/views/system/messages/messageWrite.php new file mode 100644 index 000000000..93caaf861 --- /dev/null +++ b/application/views/system/messages/messageWrite.php @@ -0,0 +1,183 @@ +load->view( + 'templates/FHC-Header', + array( + 'title' => 'Write a message', + 'jquery' => true, + 'jqueryui' => true, + 'bootstrap' => true, + 'ajaxlib' => true, + 'fontawesome' => true, + 'tinymce' => true, + 'sbadmintemplate' => true, + 'customCSSs' => array('public/css/sbadmin2/admintemplate_contentonly.css', 'public/css/messaging/messageWrite.css'), + 'customJSs' => array('public/js/bootstrapper.js', 'public/js/messaging/messageWrite.js') + ) +); +?> + +
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+ 1 && $i % 10 == 0) + { + echo '
'; + } + echo $receiver->Vorname." ".$receiver->Nachname."; "; + } + ?> +
+
+
+
+
+
+ +
  + subject; + } + ?> +
+ +
+
+
+
+
+
+ + body; + } + ?> + +
+ +
+
+ + +
+
+ +
+
+
+
+ widgetlib->widget( + 'Vorlage_widget', + array('oe_kurzbz' => $oe_kurzbz, 'isAdmin' => $isAdmin), + array('name' => 'vorlage', 'id' => 'vorlageDnD') + ); + ?> +
+
+ +
+
+ 0) + { + ?> +
+
+
+ +
+
+
+
+
+
+ + +   + Refresh +
+
+
+ +
+
+
+ +
+ + + person_id.'">'."\n"; + } + ?> + + + + + +
+
+
+
+ + +load->view("templates/FHC-Footer"); ?> diff --git a/application/views/system/messages/messageWriteReply.php b/application/views/system/messages/messageWriteReply.php new file mode 100644 index 000000000..420b008be --- /dev/null +++ b/application/views/system/messages/messageWriteReply.php @@ -0,0 +1,63 @@ +load->view( + 'templates/FHC-Header', + array( + 'title' => 'MessageReply', + 'jquery' => true, + 'bootstrap' => true, + 'fontawesome' => true, + 'tinymce' => true, + 'sbadmintemplate' => true, + 'customCSSs' => array('public/css/sbadmin2/admintemplate_contentonly.css', 'public/css/messaging/messageWrite.css'), + 'customJSs' => array('public/js/bootstrapper.js', 'public/js/messaging/messageWriteReply.js') + ) +); +?> + + +
+
+
+
+
+ +
+
+
+ load->view('system/messages/messageForm.php'); + + for ($i = 0; $i < count($receivers); $i++) + { + $receiver = $receivers[$i]; + $receiverid = $receiver->person_id; + $fieldname = 'persons[]'; + + echo ''."\n"; + } + ?> + + + + + + + +
+
+
+
+ + +load->view("templates/FHC-Footer"); ?> diff --git a/application/views/templates/FHC-Header.php b/application/views/templates/FHC-Header.php index f48c97cc1..6a96eb6f9 100644 --- a/application/views/templates/FHC-Header.php +++ b/application/views/templates/FHC-Header.php @@ -93,10 +93,11 @@ // NavigationWidget CSS if ($navigationwidget === true) generateCSSsInclude('public/css/NavigationWidget.css'); + generateCSSsInclude('public/css/fhcomplete.css'); + // Eventually required CSS generateCSSsInclude($customCSSs); // Eventually required CSS - // -------------------------------------------------------------------------------------------------------- // Javascripts diff --git a/content/fas.xul.php b/content/fas.xul.php index 9f31ec1c3..6f6c3a19a 100644 --- a/content/fas.xul.php +++ b/content/fas.xul.php @@ -110,6 +110,7 @@ foreach($addon_obj->result as $addon) + @@ -371,6 +372,12 @@ foreach($addon_obj->result as $addon) label = "&menu-statistic-notenspiegel.label;" command = "menu-statistic-notenspiegel:command" accesskey = "&menu-statistic-notenspiegel.accesskey;"/> + diff --git a/content/fasoverlay.js.php b/content/fasoverlay.js.php index a4a2c4347..fa21059c3 100644 --- a/content/fasoverlay.js.php +++ b/content/fasoverlay.js.php @@ -1077,6 +1077,26 @@ function StatistikPrintNotenspiegelErweitert(typ) window.open('content/statistik/notenspiegel_erweitert.php?studiengang_kz='+studiengang_kz+'&semester='+semester+'&typ='+typ+'&orgform='+orgform,'Notenspiegel'); } +function StatistikPrintNotenspiegelStudent() +{ + var tree = document.getElementById('student-tree'); + var data=''; + //Wenn nichts markiert wurde -> alle exportieren + if(tree.currentIndex==-1) + { + alert("Bitte zuerst einen Studenten markieren"); + return; + } + + var student_uid = getTreeCellText(tree, 'student-treecol-uid', tree.currentIndex); + if (student_uid == '') + { + alert('Markierte Person ist kein Student'); + return; + } + window.open('index.ci.php/person/gradelist/index/'+student_uid,'Notenspiegel'); +} + // **** // * Liefert eine statistik ueber die Anzahl der Interessenten/Bewerber Studenten // **** @@ -1230,7 +1250,7 @@ function MessageNew() { var prestudentIdArray = getMultipleTreeCellText(tree, 'student-treecol-prestudent_id'); - var action = 'index.ci.php/system/Messages/write/' + person_id; ?>; + var action = 'index.ci.php/system/FASMessages/write/' + person_id; ?>; openWindowPostArray(action, 'prestudent_id', prestudentIdArray); } diff --git a/content/messages.js.php b/content/messages.js.php index e61108eb6..fae1db4ba 100644 --- a/content/messages.js.php +++ b/content/messages.js.php @@ -1,191 +1,191 @@ - - */ -require_once('../config/vilesci.config.inc.php'); -?> -// ********** FUNKTIONEN ********** // -var MessagePersonID=null; -var MessagesTreeDatasource=''; // Datasource des Adressen Trees -var MessagesSelectID=''; -var MessageSenderPersonID=''; -var MessageIFrameIsInitialized=false; - -var MessagesTreeSinkObserver = -{ - onBeginLoad : function(pSink) {}, - onInterrupt : function(pSink) {}, - onResume : function(pSink) {}, - onError : function(pSink, pStatus, pError) {}, - onEndLoad : function(pSink) - { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - document.getElementById('messages-tree').builder.rebuild(); - } -}; - -var MessagesTreeListener = -{ - willRebuild : function(builder) { }, - didRebuild : function(builder) - { - //timeout nur bei Mozilla notwendig da sonst die rows - //noch keine values haben. Ab Seamonkey funktionierts auch - //ohne dem setTimeout - //window.setTimeout(KontaktAdressenTreeSelectID,10); - } -}; - -// **** -// * Laedt die Trees -// **** -function loadMessages(person_id, fas_person_id) -{ - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - MessagePersonID = person_id; - MessageSenderPersonID=fas_person_id; - - //Adressen laden - url = "rdf/messages.rdf.php?person_id="+person_id+"&"+gettimestamp(); - var tree=document.getElementById('messages-tree'); - try - { - MessagesTreeDatasource.removeXMLSinkObserver(MessagesTreeSinkObserver); - tree.builder.removeListener(MessagesTreeListener); - } - catch(e) - {} - - //Alte DS entfernen - var oldDatasources = tree.database.GetDataSources(); - while(oldDatasources.hasMoreElements()) - { - tree.database.RemoveDataSource(oldDatasources.getNext()); - } - - var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService); - MessagesTreeDatasource = rdfService.GetDataSource(url); - MessagesTreeDatasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource); - MessagesTreeDatasource.QueryInterface(Components.interfaces.nsIRDFXMLSink); - tree.database.AddDataSource(MessagesTreeDatasource); - MessagesTreeDatasource.addXMLSinkObserver(MessagesTreeSinkObserver); - tree.builder.addListener(MessagesTreeListener); - -} - - -// **** -// * Zeigt HTML Seite zum Erstellen neuer Nachrichten -// **** -function MessagesNewMessage() -{ - var tree = parent.document.getElementById('student-tree'); - - if (tree.currentIndex == -1) - { - alert("Bitte markieren Sie zuerst eine Person"); - } - else - { - var prestudentIdArray = getMultipleTreeCellText(tree, 'student-treecol-prestudent_id'); - - var action = 'index.ci.php/system/Messages/write/' + MessageSenderPersonID; - - openWindowPostArray(action, 'prestudent_id', prestudentIdArray); - } -} - -/** - * Oeffnet Nachrichtenseite um eine Antwort auf eine Nachricht zu schicken - */ -function MessagesSendAnswer() -{ - var messagesTree = document.getElementById('messages-tree'); - var studentsTree = parent.document.getElementById('student-tree'); - - if (messagesTree.currentIndex == -1) - { - alert("Bitte markieren Sie zuerst eine Nachricht"); - } - else - { - var MessageId = getTreeCellText(messagesTree, 'messages-tree-message_id', messagesTree.currentIndex); - var RecipientID = getTreeCellText(messagesTree, 'messages-tree-recipient_id', messagesTree.currentIndex); - var prestudentIdArray = new Array(getTreeCellText(studentsTree, 'student-treecol-prestudent_id', studentsTree.currentIndex)); - - var action = 'index.ci.php/system/Messages/write/' + MessageSenderPersonID + '/' + MessageId + '/' + RecipientID; - - openWindowPostArray(action, 'prestudent_id', prestudentIdArray); - } -} - -function MessageAuswahl() -{ - var tree=document.getElementById('messages-tree'); - if(tree.currentIndex==-1) - { - alert("Bitte markieren Sie zuerst eine Nachricht"); - } - else - { - var text = getTreeCellText(tree, 'messages-tree-body', tree.currentIndex); - var recipient_id = getTreeCellText(tree, 'messages-tree-recipient_id', tree.currentIndex); - // Antworten ist nur moeglich wenn die Message vom User kommt - if(recipient_id==MessagePersonID) - { - document.getElementById('messages-tree-popup-answer').disabled=true; - document.getElementById('messages-button-answer').disabled=true; - } - else - { - document.getElementById('messages-tree-popup-answer').disabled=false; - document.getElementById('messages-button-answer').disabled=false; - } - } - - MessagesIFrameSetHTML(text); -} - -function MessagesIFrameSetHTML(val) -{ - MessageIFrameInit(); - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - editor = document.getElementById('message-wysiwyg'); - - if(editor.contentWindow.document.body.innerHTML!='') - { - //Inhalt leeren - editor.contentDocument.execCommand("selectall", false, null); - editor.contentDocument.execCommand("delete", false, null); - } - //Value setzen - if(val!='') - editor.contentDocument.execCommand("inserthtml", false, val); -} - -function MessageIFrameInit() -{ - if(!MessageIFrameIsInitialized) - { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - editor = document.getElementById('message-wysiwyg'); - editor.contentDocument.designMode = 'on'; - editor.style.backgroundColor="#FFFFFF"; - MessageIFrameIsInitialized=true; - } -} \ No newline at end of file + + */ +require_once('../config/vilesci.config.inc.php'); +?> +// ********** FUNKTIONEN ********** // +var MessagePersonID=null; +var MessagesTreeDatasource=''; // Datasource des Adressen Trees +var MessagesSelectID=''; +var MessageSenderPersonID=''; +var MessageIFrameIsInitialized=false; + +var MessagesTreeSinkObserver = +{ + onBeginLoad : function(pSink) {}, + onInterrupt : function(pSink) {}, + onResume : function(pSink) {}, + onError : function(pSink, pStatus, pError) {}, + onEndLoad : function(pSink) + { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + document.getElementById('messages-tree').builder.rebuild(); + } +}; + +var MessagesTreeListener = +{ + willRebuild : function(builder) { }, + didRebuild : function(builder) + { + //timeout nur bei Mozilla notwendig da sonst die rows + //noch keine values haben. Ab Seamonkey funktionierts auch + //ohne dem setTimeout + //window.setTimeout(KontaktAdressenTreeSelectID,10); + } +}; + +// **** +// * Laedt die Trees +// **** +function loadMessages(person_id, fas_person_id) +{ + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + MessagePersonID = person_id; + MessageSenderPersonID=fas_person_id; + + //Adressen laden + url = "rdf/messages.rdf.php?person_id="+person_id+"&"+gettimestamp(); + var tree=document.getElementById('messages-tree'); + try + { + MessagesTreeDatasource.removeXMLSinkObserver(MessagesTreeSinkObserver); + tree.builder.removeListener(MessagesTreeListener); + } + catch(e) + {} + + //Alte DS entfernen + var oldDatasources = tree.database.GetDataSources(); + while(oldDatasources.hasMoreElements()) + { + tree.database.RemoveDataSource(oldDatasources.getNext()); + } + + var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService); + MessagesTreeDatasource = rdfService.GetDataSource(url); + MessagesTreeDatasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource); + MessagesTreeDatasource.QueryInterface(Components.interfaces.nsIRDFXMLSink); + tree.database.AddDataSource(MessagesTreeDatasource); + MessagesTreeDatasource.addXMLSinkObserver(MessagesTreeSinkObserver); + tree.builder.addListener(MessagesTreeListener); + +} + + +// **** +// * Zeigt HTML Seite zum Erstellen neuer Nachrichten +// **** +function MessagesNewMessage() +{ + var tree = parent.document.getElementById('student-tree'); + + if (tree.currentIndex == -1) + { + alert("Bitte markieren Sie zuerst eine Person"); + } + else + { + var prestudentIdArray = getMultipleTreeCellText(tree, 'student-treecol-prestudent_id'); + + var action = 'index.ci.php/system/FASMessages/write/' + MessageSenderPersonID; + + openWindowPostArray(action, 'prestudent_id', prestudentIdArray); + } +} + +/** + * Oeffnet Nachrichtenseite um eine Antwort auf eine Nachricht zu schicken + */ +function MessagesSendAnswer() +{ + var messagesTree = document.getElementById('messages-tree'); + var studentsTree = parent.document.getElementById('student-tree'); + + if (messagesTree.currentIndex == -1) + { + alert("Bitte markieren Sie zuerst eine Nachricht"); + } + else + { + var MessageId = getTreeCellText(messagesTree, 'messages-tree-message_id', messagesTree.currentIndex); + var RecipientID = getTreeCellText(messagesTree, 'messages-tree-recipient_id', messagesTree.currentIndex); + var prestudentIdArray = new Array(getTreeCellText(studentsTree, 'student-treecol-prestudent_id', studentsTree.currentIndex)); + + var action = 'index.ci.php/system/FASMessages/writeReply/' + MessageSenderPersonID + '/' + MessageId + '/' + RecipientID; + + openWindowPostArray(action, 'prestudent_id', prestudentIdArray); + } +} + +function MessageAuswahl() +{ + var tree=document.getElementById('messages-tree'); + if (tree.currentIndex == -1) + { + alert("Bitte markieren Sie zuerst eine Nachricht"); + } + else + { + var text = getTreeCellText(tree, 'messages-tree-body', tree.currentIndex); + var recipient_id = getTreeCellText(tree, 'messages-tree-recipient_id', tree.currentIndex); + // Antworten ist nur moeglich wenn die Message vom User kommt + if (recipient_id == MessagePersonID) + { + document.getElementById('messages-tree-popup-answer').disabled=true; + document.getElementById('messages-button-answer').disabled=true; + } + else + { + document.getElementById('messages-tree-popup-answer').disabled=false; + document.getElementById('messages-button-answer').disabled=false; + } + } + + MessagesIFrameSetHTML(text); +} + +function MessagesIFrameSetHTML(val) +{ + MessageIFrameInit(); + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + editor = document.getElementById('message-wysiwyg'); + + if(editor.contentWindow.document.body.innerHTML!='') + { + //Inhalt leeren + editor.contentDocument.execCommand("selectall", false, null); + editor.contentDocument.execCommand("delete", false, null); + } + //Value setzen + if(val!='') + editor.contentDocument.execCommand("inserthtml", false, val); +} + +function MessageIFrameInit() +{ + if(!MessageIFrameIsInitialized) + { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + editor = document.getElementById('message-wysiwyg'); + editor.contentDocument.designMode = 'on'; + editor.style.backgroundColor="#FFFFFF"; + MessageIFrameIsInitialized=true; + } +} diff --git a/locale/de-AT/fas.dtd b/locale/de-AT/fas.dtd index cad80671f..1fb4fde7f 100644 --- a/locale/de-AT/fas.dtd +++ b/locale/de-AT/fas.dtd @@ -114,6 +114,10 @@ + + + + diff --git a/public/css/fhcomplete.css b/public/css/fhcomplete.css new file mode 100644 index 000000000..1f8de48b9 --- /dev/null +++ b/public/css/fhcomplete.css @@ -0,0 +1,23 @@ +.page-header { + margin: 10px 0 5px; +} +h1 { + font-size: 2rem; +} +h2 { + font-size: 1.8rem; +} +h3 { + font-size: 1.6rem; +} + +h4 { + font-size: 1.4rem; +} +h5 { + font-size: 1.2rem; +} +h6 { + font-size: 1rem; + +} diff --git a/public/css/sbadmin2/tablesort_bootstrap.css b/public/css/sbadmin2/tablesort_bootstrap.css index e190f77e3..d10d7306e 100644 --- a/public/css/sbadmin2/tablesort_bootstrap.css +++ b/public/css/sbadmin2/tablesort_bootstrap.css @@ -19,6 +19,10 @@ border-bottom: #ccc 2px solid !important; } +/* Remove black border at top of table footer */ +.tablesorter-default tfoot > tr > th { + border-top: #ccc 2px solid !important; +} /* set colors of zebra widget */ table.tablesorter tbody tr.even td, table.tablesorter tbody tr.even:hover, table.tablesorter tbody tr.even td:hover{ background-color: #ffff; @@ -57,4 +61,4 @@ table.tablesort-hover tr:hover, .tablesort-active{ /* bring datepicker to front */ #ui-datepicker-div{ z-index: 9999 !important; -} \ No newline at end of file +} diff --git a/public/css/tools/gradelist.css b/public/css/tools/gradelist.css new file mode 100644 index 000000000..68c7fff36 --- /dev/null +++ b/public/css/tools/gradelist.css @@ -0,0 +1,40 @@ +.gradetable > thead > tr > th{ + border-bottom: 1px solid black; +} +.gradetable > tbody > tr > td{ + border-bottom: 1px solid #eeeeee; +} +.gradetable > tfoot > tr > th { + border-top: 1px solid black; +} +.gradelist_row_lv { +} +.gradelist_row_modul > td { + border-bottom: 1px solid black; + background-color: #eeeeee; +} + +.gradelist_row_grade_positiv { + color: green; +} +.gradelist_row_grade_negativ { + color: red; +} +.gradelist_row_depth_1 > td:first-child { + padding-left: 15px !important; +} +.gradelist_row_depth_2 > td:first-child { + padding-left: 30px !important; +} +.gradelist_row_depth_3 > td:first-child { + padding-left: 45px !important; +} +.gradelist_row_depth_4 > td:first-child { + padding-left: 60px !important; +} +.gradelist_row_depth_5 > td:first-child { + padding-left: 75px !important; +} +.gradelist_row_depth_6 > td:first-child { + padding-left: 90px !important; +} diff --git a/public/js/AjaxLib.js b/public/js/AjaxLib.js index b47654041..47cc2b67f 100644 --- a/public/js/AjaxLib.js +++ b/public/js/AjaxLib.js @@ -146,10 +146,7 @@ var FHC_AjaxClient = { if (jQuery.type(response) == "object" && response.hasOwnProperty(CODE)) { - if (response.error == SUCCESS) - { - isSuccess = true; - } + code = response.error; } return code; diff --git a/public/js/PhrasesLib.js b/public/js/PhrasesLib.js index 64b10759d..adedfa33d 100644 --- a/public/js/PhrasesLib.js +++ b/public/js/PhrasesLib.js @@ -25,7 +25,10 @@ var FHC_PhrasesLib = { * @param {Object} params : parameters to be replaced instead of {} in phraseObj.text * @returns {String} : phrase-text */ - t: function(category, phrase, params = {}) { + t: function(category, phrase, params) { + + if (typeof(params)=='undefined') + params = {}; // Checks if FHC_JS_PHRASES_STORAGE_OBJECT is an array if ($.isArray(FHC_JS_PHRASES_STORAGE_OBJECT)) diff --git a/public/js/infocenter/infocenterDetails.js b/public/js/infocenter/infocenterDetails.js index e1b6e0e46..27a6e9497 100644 --- a/public/js/infocenter/infocenterDetails.js +++ b/public/js/infocenter/infocenterDetails.js @@ -480,7 +480,8 @@ var InfocenterDetails = { return; // check if a prestudent in same semester is already freigegeben - then not send message again - var freigegeben = false; + var rtFreigegeben = false; + var stgFreigegeben = false; var receiverPrestudentstatus = null; //get prestudentstatus of message receiver @@ -509,8 +510,15 @@ var InfocenterDetails = { && prestudentstatus.bestaetigtam !== null && prestudentstatus.status_kurzbz === "Interessent" && prestudent.studiengangtyp === "b") { - freigegeben = true; - break; + if (prestudentstatus.statusgrund_id === null) + { + rtFreigegeben = true; + break; + } + else if($.isNumeric(prestudentstatus.statusgrund_id)) + { + stgFreigegeben = true; + } } } } @@ -520,46 +528,51 @@ var InfocenterDetails = { var studiengangbezeichnung_englisch = receiverPrestudentstatus.studiengangbezeichnung_englisch; var msgvars = {}; - if (freigegeben) + if (rtfreigabe) { - InfocenterDetails._refreshLog(); - //if already freigegeben, still send (shorter) message if Quereinsteiger - if (ausbildungssemester > 1) - { - msgvars = { - 'ausbildungssemester': ausbildungssemester, - 'studiengangbezeichnung': studiengangbezeichnung, - 'studiengangbezeichnung_englisch': studiengangbezeichnung_englisch - }; - InfocenterDetails.sendFreigabeMessage(prestudentid, RTFREIGABE_MESSAGE_VORLAGE_QUER_KURZ, msgvars); - } - } - else - { - var vorlage_kurzbz = null; - - if (rtfreigabe) + if (rtFreigegeben) { + //if already for RT freigegeben, still send short message if Quereinsteiger if (ausbildungssemester > 1) { - vorlage_kurzbz = RTFREIGABE_MESSAGE_VORLAGE_QUER; msgvars = { - /*'rtlink': FHC_JS_DATA_STORAGE_OBJECT.app_root + 'addons/bewerbung/cis/registration.php?active=aufnahme',*/ 'ausbildungssemester': ausbildungssemester, 'studiengangbezeichnung': studiengangbezeichnung, 'studiengangbezeichnung_englisch': studiengangbezeichnung_englisch - } + }; + + InfocenterDetails.sendFreigabeMessage(prestudentid, RTFREIGABE_MESSAGE_VORLAGE_QUER_KURZ, msgvars); + } + } + else //not already for RT freigegeben - send RTfreigabe message + { + var vorlage = null; + //send Quereinstiegsmessage if later Ausbildungssemester + if (ausbildungssemester > 1) + { + msgvars = { + 'ausbildungssemester': ausbildungssemester, + 'studiengangbezeichnung': studiengangbezeichnung, + 'studiengangbezeichnung_englisch': studiengangbezeichnung_englisch + }; + vorlage = RTFREIGABE_MESSAGE_VORLAGE_QUER } else { - vorlage_kurzbz = RTFREIGABE_MESSAGE_VORLAGE; + //send normal RTfreigabe message + vorlage = RTFREIGABE_MESSAGE_VORLAGE } + + InfocenterDetails.sendFreigabeMessage(prestudentid, vorlage, msgvars); } - else + } + else if (rtfreigabe === false) + { + // if Freigabe to Studiengang, send StgFreigabe Message if not already sent + if (!stgFreigegeben) { - vorlage_kurzbz = STGFREIGABE_MESSAGE_VORLAGE; + InfocenterDetails.sendFreigabeMessage(prestudentid, STGFREIGABE_MESSAGE_VORLAGE, msgvars); } - InfocenterDetails.sendFreigabeMessage(prestudentid, vorlage_kurzbz, msgvars); } }; @@ -727,7 +740,7 @@ var InfocenterDetails = { var prestudent_id = this.id.substr(this.id.indexOf("_") + 1); var statusgrund_id = $("#frgstatusgrselect_" + prestudent_id + " select[name=frgstatusgrund]").val(); var data = {"prestudent_id": prestudent_id, "statusgrund_id": statusgrund_id}; - InfocenterDetails.saveFreigabe(data);//Studiengangfreigabe + InfocenterDetails.saveFreigabe(data, false);//Studiengangfreigabe } ) }, diff --git a/public/js/infocenter/infocenterPersonDataset.js b/public/js/infocenter/infocenterPersonDataset.js index d4dbd5bad..641bc7c42 100644 --- a/public/js/infocenter/infocenterPersonDataset.js +++ b/public/js/infocenter/infocenterPersonDataset.js @@ -27,7 +27,7 @@ var InfocenterPersonDataset = { appendTableActionsHtml: function() { var currurl = window.location.href; - var url = currurl.replace(/infocenter\/InfoCenter(.*)/, "Messages/write"); + var url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + "/system/Messages/write"; var formHtml = '
'; $("#datasetActionsTop").before(formHtml); diff --git a/public/js/messaging/messageWrite.js b/public/js/messaging/messageWrite.js new file mode 100644 index 000000000..9894573ee --- /dev/null +++ b/public/js/messaging/messageWrite.js @@ -0,0 +1,137 @@ +/** + * JS used by view system/messages/messageWrite + */ + +function tinymcePreviewSetContent() +{ + if ($("#tinymcePreview")) + { + if ($("#recipients").children(":selected").val() > -1) + { + parseMessageText($("#recipients").children(":selected").val(), tinyMCE.get("bodyTextArea").getContent()); + } + else + { + tinyMCE.get("tinymcePreview").setContent(""); + } + } +} + +function parseMessageText(receiver_id, text) +{ + FHC_AjaxClient.ajaxCallGet( + "system/Messages/parseMessageText", + { + person_id: receiver_id, + text: text + }, + { + successCallback: function(data, textStatus, jqXHR) { + + if (FHC_AjaxClient.hasData(data)) + { + tinyMCE.get("tinymcePreview").setContent(FHC_AjaxClient.getData(data)); + } + else if (FHC_AjaxClient.isError(data)) + { + alert(data.retval); + } + } + } + ); +} + +$(document).ready(function () +{ + tinymce.init({ + selector: "#bodyTextArea", + plugins: "autoresize", + autoresize_min_height: 150, + autoresize_max_height: 600, + autoresize_bottom_margin: 10 + }); + + tinymce.init({ + menubar: false, + toolbar: false, + statusbar: false, + readonly: 1, + selector: "#tinymcePreview", + plugins: "autoresize", + autoresize_min_height: 150, + autoresize_bottom_margin: 10 + }); + + if ($("#variables")) + { + $("#variables").dblclick(function () + { + if ($("#bodyTextArea")) + { + //if editor active add at cursor position, otherwise at end + if (tinymce.activeEditor.id === "bodyTextArea") + tinymce.activeEditor.execCommand('mceInsertContent', false, $(this).children(":selected").val()); + else + tinyMCE.get("bodyTextArea").setContent(tinyMCE.get("bodyTextArea").getContent() + $(this).children(":selected").val()); + } + }); + } + + if ($("#recipients")) + { + $("#recipients").change(tinymcePreviewSetContent); + } + + if ($("#refresh")) + { + $("#refresh").click(tinymcePreviewSetContent); + } + + if ($("#sendButton") && $("#sendForm")) + { + $("#sendButton").click(function () + { + if ($("#subject") && $("#subject").val() != '' && tinyMCE.get("bodyTextArea").getContent() != '') + { + $("#sendForm").submit(); + } + else + { + alert("Subject and text are required fields!"); + } + }); + } + + if ($("#vorlageDnD")) + { + $("#vorlageDnD").change(function () + { + var vorlage_kurzbz = this.value; + + if (vorlage_kurzbz != '') + { + FHC_AjaxClient.ajaxCallGet( + "system/Messages/getVorlage", + { + vorlage_kurzbz: vorlage_kurzbz + }, + { + successCallback: function(data, textStatus, jqXHR) { + + if (FHC_AjaxClient.hasData(data)) + { + var msg = FHC_AjaxClient.getData(data); + + tinyMCE.get("bodyTextArea").setContent(msg[0].text); + $("#subject").val(msg[0].subject); + } + } + } + ); + } + }); + } + + $("#subject").focus(); + +}); diff --git a/public/js/messaging/messageWriteReply.js b/public/js/messaging/messageWriteReply.js new file mode 100644 index 000000000..6343701d7 --- /dev/null +++ b/public/js/messaging/messageWriteReply.js @@ -0,0 +1,30 @@ +/** + * JS used by view system/messages/messageWriteReply + */ + +$(document).ready(function () +{ + tinymce.init({ + selector: "#bodyTextArea", + plugins: "autoresize", + autoresize_min_height: 150, + autoresize_max_height: 600, + autoresize_bottom_margin: 10, + auto_focus: "bodyTextArea" + }); + + if ($("#sendButton") && $("#sendForm")) + { + $("#sendButton").click(function () { + + if ($("#subject") && $("#subject").val() != '' && tinyMCE.get("bodyTextArea").getContent() != '') + { + $("#sendForm").submit(); + } + else + { + alert("Subject and text are required fields!"); + } + }); + } +}); diff --git a/system/checksystem.php b/system/checksystem.php index 73b16e3b3..7bdf96446 100644 --- a/system/checksystem.php +++ b/system/checksystem.php @@ -92,6 +92,7 @@ $beschreibung=1; $berechtigungen = array( array('admin','Super User Rechte'), array('assistenz','Assistenz'), + array('student','Defaultberechtigung für Studierende'), array('basis/addon','Addons verwalten'), array('basis/ampel','Ampeln Administrieren'), array('basis/ampeluebersicht','Ampel Übersicht für Leiter'), diff --git a/system/filtersupdate.php b/system/filtersupdate.php index d8788b292..27dbce891 100644 --- a/system/filtersupdate.php +++ b/system/filtersupdate.php @@ -36,6 +36,7 @@ $filters = array( {"name": "StgAbgeschickt"}, {"name": "Studiensemester"}, {"name": "LastAction"}, + {"name": "LastActionType"}, {"name": "User/Operator"}, {"name": "LockUser"} ], @@ -68,6 +69,7 @@ $filters = array( {"name": "StgAbgeschickt"}, {"name": "Studiensemester"}, {"name": "LastAction"}, + {"name": "LastActionType"}, {"name": "User/Operator"}, {"name": "LockUser"} ], diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 4f9d885d0..95cefaa85 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -1519,7 +1519,6 @@ $phrases = array( ) ) ), - array( 'app' => 'core', 'category' => 'filter', @@ -1541,9 +1540,6 @@ $phrases = array( ) ), - - - //**************************** CORE/person array( 'app' => 'core', @@ -2207,8 +2203,126 @@ $phrases = array( ) ) ), - - + array( + 'app' => 'core', + 'category' => 'lehre', + 'phrase' => 'ects', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'ECTS', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'ECTS', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehre', + 'phrase' => 'notendurchschnitt', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Notendurchschnitt', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Grade average', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehre', + 'phrase' => 'gewichteternotendurchschnitt', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'gewichteter Notendurchschnitt', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'weighted grade point average', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehre', + 'phrase' => 'note', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Note', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Grade', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehre', + 'phrase' => 'lehrveranstaltung', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Lehrveranstaltung', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Course', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehre', + 'phrase' => 'nichtstudienplanrelevanteKurse', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Nicht studienplanrelevante Lehrveranstaltung', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'additional Courses', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), //********************** INFOCENTER/infocenter array( diff --git a/system/xsl/Lehrauftrag_ESA_EIF.xsl b/system/xsl/Lehrauftrag_ESA_EIF.xsl new file mode 100644 index 000000000..fa743924f --- /dev/null +++ b/system/xsl/Lehrauftrag_ESA_EIF.xsl @@ -0,0 +1,529 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Abs.: Technikum Wien GmbH, Höchstädtplatz 6, 1200 Wien + + + + Lehrauftrag Lehrgang + + + + SV.Nr.: + Personalnummer: + + + Wir beauftragen Sie, im folgende Lehrveranstaltungen abzuhalten: + + + + + + + + + + + + ID + + + Lehrveranstaltung + + + Institut + + + Gruppe(n) + + + + Std. + + + Satz + + + Brutto + + + + + + + + + + + + + + + + + Summe: + + + + + + + + + + + + + + + + Die angeführten Stundensätze sind Bruttobeträge, von denen gegebenenfalls die DienstnehmerInnenanteile für Steuern und Sozialversicherung abgezogen werden. + Die angeführte Stundenzahl ist die maximal vorgesehene; abgerechnet werden jedoch nur die tatsächlich gehaltenen Stunden laut Anwesenheitslisten. + Außerdem besteht die Verpflichtung zur Teilnahme an LektorInnenkonferenzen. + + + + + + + + + + Wien, am + + + + + + + + + + + + Ort, Datum + + + + + + + Lehrgangsleitung + + + + + + + + + + + + + + + + + + + ... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +