diff --git a/CHANGELOG.md b/CHANGELOG.md
index 61be20952..b979e9c50 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,14 +13,17 @@
- **[FAS]** Bei Statuswechsel von Studierenden können Gründe für den Statuswechsel angegeben werden
- **[ADDONS]** Addons können Menüpunkte im Vilesci anpassen
- **[ADDONS]** Addons können Noten für die Gesamtnote vorschlagen
+- **[CORE]** UserDefinedFields
### CHANGED
- **[CORE]** Berechtigungsprüfung wurde angepasst damit deaktivierte Benutzer keine Berechtigungen mehr haben
- **[FAS]** Mitarbeiterexport exportiert jetzt nur noch die markierten Personen
+- **[CORE]** Has many as possible javascripts and css present in the repository were removed. Their lack is overcome by the packages in the composer. In the meanwhile also the versions were updated
### Updateinfo
- **[CORE]** Infoscreen wurde umbenannt (informationsbildschirm.php)
- **[CORE]** Moodle Schnittstelle wurde aus dem Core entfernt und in ein eigenes Addon verschoben. Moodle Versionen < 2.4 werden nicht mehr unterstützt
+- **[CORE]** Update campus.tbl_templates (contentmittitel and contentohnetitel) with system/templates/contentmittitel_xslt_xhtml.xslt andsystem/templates/contentohnetitel_xslt_xhtml.xslt
## [3.2]
diff --git a/application/config/fhcomplete.php b/application/config/fhcomplete.php
index 6ed5e93bd..3c540ea65 100755
--- a/application/config/fhcomplete.php
+++ b/application/config/fhcomplete.php
@@ -243,4 +243,6 @@ $config['fhc_acl'] = array
'PhrasesLib.getPhrase' => 'system/PhrasesLib'
);
-$config['addons_aufnahme_url'] = 'http://debian.dev/build/addons/aufnahme/cis/index.php';
+//
+$config['addons_aufnahme_url'] = array();
+$config['addons_aufnahme_url']['OE_ROOT'] = 'http://debian.dev/addons/aufnahme/OE_ROOT/cis/index.php';
diff --git a/application/config/rest.php b/application/config/rest.php
index 1b6514abf..ec2d6f5ad 100644
--- a/application/config/rest.php
+++ b/application/config/rest.php
@@ -167,9 +167,9 @@ $config['auth_library_function'] = 'basicAuthentication';
| $config['auth_override_class_method']['accounts']['user'] = 'basic';
| $config['auth_override_class_method']['dashboard']['*'] = 'none|digest|basic';
|
-| Here 'deals', 'accounts' and 'dashboard' are controller names, 'view', 'insert' and 'user' are methods within.
- * An asterisk may also be used to specify an authentication method for an entire classes methods.
- * Ex: $config['auth_override_class_method']['dashboard']['*'] = 'basic'; (NOTE: leave off the '_get' or '_post' from the end
+| Here 'deals', 'accounts' and 'dashboard' are controller names, 'view', 'insert' and 'user' are methods within.
+ * An asterisk may also be used to specify an authentication method for an entire classes methods.
+ * Ex: $config['auth_override_class_method']['dashboard']['*'] = 'basic'; (NOTE: leave off the '_get' or '_post' from the end
* of the method name)
| Acceptable values are; 'none', 'digest' and 'basic'.
|
@@ -223,7 +223,7 @@ $config['auth_library_function'] = 'basicAuthentication';
| restrict certain methods to IPs in your whitelist
|
*/
-$config['rest_ip_whitelist_enabled'] = FALSE;
+$config['rest_ip_whitelist_enabled'] = TRUE;
/*
|--------------------------------------------------------------------------
@@ -238,7 +238,7 @@ $config['rest_ip_whitelist_enabled'] = FALSE;
| 127.0.0.1 and 0.0.0.0 are allowed by default
|
*/
-$config['rest_ip_whitelist'] = '';
+$config['rest_ip_whitelist'] = '127.0.0.1';
/*
|--------------------------------------------------------------------------
diff --git a/application/controllers/Redirect.php b/application/controllers/Redirect.php
index 136d2fc35..99d459771 100644
--- a/application/controllers/Redirect.php
+++ b/application/controllers/Redirect.php
@@ -25,13 +25,52 @@ class Redirect extends FHC_Controller
// Loads config file fhcomplete
$this->config->load('fhcomplete');
+
+ // Loads message helper
+ $this->load->helper('message');
+
+ // Loads model MessageTokenModel
+ $this->load->model('system/MessageToken_model', 'MessageTokenModel');
+
+ // Loads library OrganisationseinheitLib
+ $this->load->library('OrganisationseinheitLib');
}
+ /**
+ * redirectByToken
+ *
+ * - Loads the message using a token
+ * - Loads the root of the organisation unit tree using the oe_kurzbz present in the message
+ * - Redirect to the aufnahme related to the found organisation unit
+ */
public function redirectByToken($token)
{
- if (isset($token))
+ $msg = $this->MessageTokenModel->getMessageByToken($token);
+ if ($msg->error)
{
- redirect($this->config->item('addons_aufnahme_url') . '?token=' . $token);
+ show_error($msg->retval);
+ }
+
+ $oe_kurzbz = $msg->retval[0]->oe_kurzbz;
+
+ if ($oe_kurzbz != null && $oe_kurzbz != '')
+ {
+ $rootOE = $this->organisationseinheitlib->getRoot($oe_kurzbz);
+ if ($rootOE->error)
+ {
+ show_error($rootOE->retval);
+ }
+
+ $addonAufnahmeUrls = $this->config->item('addons_aufnahme_url');
+
+ if (isset($token)
+ && hasData($msg)
+ && is_array($addonAufnahmeUrls)
+ && hasData($rootOE)
+ && isset($addonAufnahmeUrls[$rootOE->retval[0]->oe_kurzbz]))
+ {
+ redirect($addonAufnahmeUrls[$rootOE->retval[0]->oe_kurzbz] . '?token=' . $token);
+ }
}
}
-}
\ No newline at end of file
+}
diff --git a/application/controllers/api/v1/organisation/Studiengang2.php b/application/controllers/api/v1/organisation/Studiengang2.php
index 097cd64b3..bea2f218e 100644
--- a/application/controllers/api/v1/organisation/Studiengang2.php
+++ b/application/controllers/api/v1/organisation/Studiengang2.php
@@ -11,28 +11,32 @@
* @filesource
*/
// ------------------------------------------------------------------------
-if (!defined("BASEPATH")) exit("No direct script access allowed");
+if (!defined('BASEPATH')) exit('No direct script access allowed');
class Studiengang2 extends APIv1_Controller
{
/**
- * Course API constructor.
+ *
*/
public function __construct()
{
parent::__construct();
+
// Load model PersonModel
- $this->load->model("organisation/studiengang_model", "StudiengangModel");
+ $this->load->model('organisation/studiengang_model', 'StudiengangModel');
}
-
+
+ /**
+ * getStudiengang
+ */
public function getStudiengang()
{
- $studiengang_kz = $this->get("studiengang_kz");
-
+ $studiengang_kz = $this->get('studiengang_kz');
+
if (isset($studiengang_kz))
{
$result = $this->StudiengangModel->load($studiengang_kz);
-
+
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -40,32 +44,35 @@ class Studiengang2 extends APIv1_Controller
$this->response();
}
}
-
+
+ /**
+ * getAllForBewerbung
+ */
public function getAllForBewerbung()
{
$this->response($this->StudiengangModel->getAllForBewerbung(), REST_Controller::HTTP_OK);
}
-
+
/**
- * Method getStudiengangStudienplan
+ * getStudiengangStudienplan
*/
public function getStudiengangStudienplan()
{
// Getting HTTP GET parameters
- $studiensemester_kurzbz = $this->get("studiensemester_kurzbz");
- $ausbildungssemester = $this->get("ausbildungssemester");
- $aktiv = $this->get("aktiv");
- $onlinebewerbung = $this->get("onlinebewerbung");
-
+ $studiensemester_kurzbz = $this->get('studiensemester_kurzbz');
+ $ausbildungssemester = $this->get('ausbildungssemester');
+ $aktiv = $this->get('aktiv');
+ $onlinebewerbung = $this->get('onlinebewerbung');
+
// If $studiensemester_kurzbz and $ausbildungssemester are present
if (isset($studiensemester_kurzbz) && isset($ausbildungssemester))
{
// Check & set
- if (!isset($aktiv)) $aktiv = "TRUE";
- if (!isset($onlinebewerbung)) $onlinebewerbung = "TRUE";
-
+ if (!isset($aktiv)) $aktiv = 'TRUE';
+ if (!isset($onlinebewerbung)) $onlinebewerbung = 'TRUE';
+
$result = $this->StudiengangModel->getStudienplan($studiensemester_kurzbz, $ausbildungssemester, $aktiv, $onlinebewerbung);
-
+
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -73,33 +80,38 @@ class Studiengang2 extends APIv1_Controller
$this->response();
}
}
-
+
+ /**
+ * getStudiengangBewerbung
+ */
public function getStudiengangBewerbung()
{
- $result = $this->StudiengangModel->getStudiengangBewerbung();
-
+ $oe_kurzbz = $this->get('oe_kurzbz');
+
+ $result = $this->StudiengangModel->getStudiengangBewerbung($oe_kurzbz);
+
$this->response($result, REST_Controller::HTTP_OK);
}
-
+
/**
- * @return void
+ * getAppliedStudiengang
*/
public function getAppliedStudiengang()
{
$person_id = $this->get('person_id');
$studiensemester_kurzbz = $this->get('studiensemester_kurzbz');
$titel = $this->get('titel');
-
+
if (isset($person_id) && isset($studiensemester_kurzbz) && isset($titel))
{
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
-
+
$result = $this->StudiengangModel->getAppliedStudiengang(
$person_id,
$studiensemester_kurzbz,
$titel
);
-
+
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -107,24 +119,24 @@ class Studiengang2 extends APIv1_Controller
$this->response();
}
}
-
+
/**
- * @return void
+ * getAppliedStudiengangFromNow
*/
public function getAppliedStudiengangFromNow()
{
$person_id = $this->get('person_id');
$titel = $this->get('titel');
-
+
if (isset($person_id) && isset($titel))
{
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
-
+
$result = $this->StudiengangModel->getAppliedStudiengangFromNow(
$person_id,
$titel
);
-
+
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -132,4 +144,31 @@ class Studiengang2 extends APIv1_Controller
$this->response();
}
}
-}
\ No newline at end of file
+
+ /**
+ * getAppliedStudiengangFromNowOE
+ */
+ public function getAppliedStudiengangFromNowOE()
+ {
+ $person_id = $this->get('person_id');
+ $titel = $this->get('titel');
+ $oe_kurzbz = $this->get('oe_kurzbz');
+
+ if (isset($person_id) && isset($titel) && isset($oe_kurzbz))
+ {
+ $this->load->model('organisation/Studiengang_model', 'StudiengangModel');
+
+ $result = $this->StudiengangModel->getAppliedStudiengangFromNowOE(
+ $person_id,
+ $titel,
+ $oe_kurzbz
+ );
+
+ $this->response($result, REST_Controller::HTTP_OK);
+ }
+ else
+ {
+ $this->response();
+ }
+ }
+}
diff --git a/application/controllers/api/v1/system/Message.php b/application/controllers/api/v1/system/Message.php
index 3302e7c6b..0f3f79855 100644
--- a/application/controllers/api/v1/system/Message.php
+++ b/application/controllers/api/v1/system/Message.php
@@ -27,17 +27,18 @@ class Message extends APIv1_Controller
}
/**
- * @return void
+ * getMessagesByPersonID
*/
public function getMessagesByPersonID()
{
$person_id = $this->get('person_id');
+ $oe_kurzbz = $this->get('oe_kurzbz'); // root organisation unit
$all = $this->get('all');
-
+
if (isset($person_id))
{
- $result = $this->messagelib->getMessagesByPerson($person_id, $all);
-
+ $result = $this->messagelib->getMessagesByPerson($person_id, $oe_kurzbz, $all);
+
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -45,19 +46,20 @@ class Message extends APIv1_Controller
$this->response();
}
}
-
+
/**
- * @return void
+ * getMessagesByUID
*/
public function getMessagesByUID()
{
$uid = $this->get('uid');
+ $oe_kurzbz = $this->get('oe_kurzbz'); // root organisation unit
$all = $this->get('all');
-
+
if (isset($uid))
{
- $result = $this->messagelib->getMessagesByUID($uid, $all);
-
+ $result = $this->messagelib->getMessagesByUID($uid, $oe_kurzbz, $all);
+
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -65,18 +67,18 @@ class Message extends APIv1_Controller
$this->response();
}
}
-
+
/**
- * @return void
+ * getMessagesByToken
*/
public function getMessagesByToken()
{
$token = $this->get('token');
-
+
if (isset($token))
{
$result = $this->messagelib->getMessageByToken($token);
-
+
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -84,19 +86,20 @@ class Message extends APIv1_Controller
$this->response();
}
}
-
+
/**
- * @return void
+ * getSentMessagesByPerson
*/
public function getSentMessagesByPerson()
{
$person_id = $this->get('person_id');
+ $oe_kurzbz = $this->get('oe_kurzbz'); // root organisation unit
$all = $this->get('all');
-
+
if (isset($person_id))
{
- $result = $this->messagelib->getSentMessagesByPerson($person_id, $all);
-
+ $result = $this->messagelib->getSentMessagesByPerson($person_id, $oe_kurzbz, $all);
+
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -104,18 +107,19 @@ class Message extends APIv1_Controller
$this->response();
}
}
-
+
/**
- * @return void
+ * getCountUnreadMessages
*/
public function getCountUnreadMessages()
{
$person_id = $this->get('person_id');
-
+ $oe_kurzbz = $this->get('oe_kurzbz'); // root organisation unit
+
if (isset($person_id))
{
- $result = $this->messagelib->getCountUnreadMessages($person_id);
-
+ $result = $this->messagelib->getCountUnreadMessages($person_id, $oe_kurzbz);
+
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -123,14 +127,14 @@ class Message extends APIv1_Controller
$this->response();
}
}
-
+
/**
- * @return void
+ * postMessage
*/
public function postMessage()
{
$validation = $this->_validatePostMessage($this->post());
-
+
if (isSuccess($validation))
{
$result = $this->messagelib->sendMessage(
@@ -140,10 +144,10 @@ class Message extends APIv1_Controller
$this->post()['body'],
PRIORITY_NORMAL,
isset($this->post()['relationmessage_id']) ? $this->post()['relationmessage_id'] : null,
- isset($this->post()['oe_kurzbz']) ? $this->post()['oe_kurzbz'] : null,
+ isset($this->post()['oe_kurzbz']) ? $this->post()['oe_kurzbz'] : null, // Sender organisation unit
isset($this->post()['multiPartMime']) ? $this->post()['multiPartMime'] : true
);
-
+
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -151,27 +155,27 @@ class Message extends APIv1_Controller
$this->response($validation, REST_Controller::HTTP_OK);
}
}
-
+
/**
- * @return void
+ * postMessageVorlage
*/
public function postMessageVorlage()
{
$validation = $this->_validatePostMessageVorlage($this->post());
-
+
if (isSuccess($validation))
{
$result = $this->messagelib->sendMessageVorlage(
isset($this->post()['sender_id']) ? $this->post()['sender_id'] : null,
isset($this->post()['receiver_id']) ? $this->post()['receiver_id'] : null,
$this->post()['vorlage_kurzbz'],
- isset($this->post()['oe_kurzbz']) ? $this->post()['oe_kurzbz'] : null,
+ isset($this->post()['oe_kurzbz']) ? $this->post()['oe_kurzbz'] : null, // Sender organisation unit
$this->post()['data'],
isset($this->post()['relationmessage_id']) ? $this->post()['relationmessage_id'] : null,
isset($this->post()['orgform_kurzbz']) ? $this->post()['orgform_kurzbz'] : null,
isset($this->post()['multiPartMime']) ? $this->post()['multiPartMime'] : true
);
-
+
$this->response($result, REST_Controller::HTTP_OK);
}
else
@@ -179,16 +183,16 @@ class Message extends APIv1_Controller
$this->response($validation, REST_Controller::HTTP_OK);
}
}
-
+
/**
- * @return void
+ * postChangeStatus
*/
public function postChangeStatus()
{
$person_id = $this->post()['person_id'];
$message_id = $this->post()['message_id'];
$status = $this->post()['status'];
-
+
if (isset($person_id) && isset($message_id) && isset($status) &&
in_array($status, array(MSG_STATUS_UNREAD, MSG_STATUS_READ, MSG_STATUS_ARCHIVED, MSG_STATUS_DELETED)))
{
@@ -201,7 +205,10 @@ class Message extends APIv1_Controller
$this->response();
}
}
-
+
+ /**
+ * _validatePostMessage
+ */
private function _validatePostMessage($message = null)
{
if (!isset($message))
@@ -220,10 +227,13 @@ class Message extends APIv1_Controller
{
return error('If a receiver_id is not given a oe_kurzbz must be specified');
}
-
+
return success('Input data are valid');
}
-
+
+ /**
+ * _validatePostMessageVorlage
+ */
private function _validatePostMessageVorlage($message = null)
{
if (!isset($message))
@@ -242,7 +252,7 @@ class Message extends APIv1_Controller
{
return error('If a receiver_id is not given a oe_kurzbz must be specified');
}
-
+
return success('Input data are valid');
}
-}
\ No newline at end of file
+}
diff --git a/application/controllers/system/Messages.php b/application/controllers/system/Messages.php
index 472f818d5..73d405dcc 100755
--- a/application/controllers/system/Messages.php
+++ b/application/controllers/system/Messages.php
@@ -2,29 +2,32 @@
if (! defined('BASEPATH')) exit('No direct script access allowed');
-class Messages extends VileSci_Controller
+class Messages extends VileSci_Controller
{
+ /**
+ *
+ */
public function __construct()
{
parent::__construct();
-
+
// Loads the message library
$this->load->library('MessageLib');
-
+
// Loads the widget library
$this->load->library('WidgetLib');
-
+
$this->load->model('person/Person_model', 'PersonModel');
}
-
+
/**
- *
+ * write
*/
public function write($sender_id, $msg_id = null, $receiver_id = null)
{
$prestudent_id = $this->input->post('prestudent_id');
$msg = null;
-
+
// Get message data if possible
if (is_numeric($msg_id) && is_numeric($receiver_id))
{
@@ -38,7 +41,7 @@ class Messages extends VileSci_Controller
$msg = $msg->retval[0];
}
}
-
+
// Get variables
$this->load->model('system/Message_model', 'MessageModel');
$msgVarsDataByPrestudentId = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudent_id);
@@ -46,7 +49,7 @@ class Messages extends VileSci_Controller
{
show_error($msgVarsDataByPrestudentId->retval);
}
-
+
if (!hasData($variables = $this->MessageModel->getMessageVars()))
{
unset($variables);
@@ -60,11 +63,11 @@ class Messages extends VileSci_Controller
$variablesArray['{'.str_replace(" ", "_", strtolower($variables->retval[$i])).'}'] = $variables->retval[$i];
}
}
-
+
array_shift($variables->retval); // Remove person_id
array_shift($variables->retval); // Remove prestudent_id
-
- // Organisation units
+
+ // 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);
@@ -75,7 +78,7 @@ class Messages extends VileSci_Controller
$oe_kurzbz[] = $val->oe_kurzbz;
}
}
-
+
// Admin or commoner?
$this->load->model('system/Benutzerrolle_model', 'BenutzerrolleModel');
$isAdmin = $this->BenutzerrolleModel->isAdminByPersonId($sender_id);
@@ -83,38 +86,45 @@ class Messages extends VileSci_Controller
{
show_error($isAdmin->retval);
}
-
+
$data = array (
'sender_id' => $sender_id,
'receivers' => $msgVarsDataByPrestudentId->retval,
'message' => $msg,
'variables' => $variablesArray,
- 'oe_kurzbz' => $oe_kurzbz,
+ 'oe_kurzbz' => $oe_kurzbz, // used to get the templates
'isAdmin' => $isAdmin->retval
);
-
+
$v = $this->load->view('system/messageWrite', $data);
}
-
+
/**
- *
+ * send
*/
public function send($sender_id)
{
$error = false;
-
+
$subject = $this->input->post('subject');
$body = $this->input->post('body');
$prestudents = $this->input->post('prestudents');
$relationmessage_id = $this->input->post('relationmessage_id');
-
+
if (!isset($relationmessage_id) || $relationmessage_id == '')
{
$relationmessage_id = null;
}
-
+
+ //
$data = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudents);
- if (hasData($data))
+
+ //
+ $this->load->model('crm/Prestudent_model', 'PrestudentModel');
+ $prestudentsData = $this->PrestudentModel->getOrganisationunits($prestudents);
+
+ //
+ if (hasData($data) && hasData($prestudentsData))
{
for ($i = 0; $i < count($data->retval); $i++)
{
@@ -125,10 +135,19 @@ class Messages extends VileSci_Controller
$newKey = str_replace(" ", "_", strtolower($key));
$dataArray[$newKey] = $dataArray[$key];
}
-
+
$parsedText = $this->messagelib->parseMessageText($body, $dataArray);
-
- $msg = $this->messagelib->sendMessage($sender_id, $dataArray['person_id'], $subject, $parsedText, PRIORITY_NORMAL, $relationmessage_id);
+
+ $oe_kurzbz = '';
+ 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;
+ }
+ }
+
+ $msg = $this->messagelib->sendMessage($sender_id, $dataArray['person_id'], $subject, $parsedText, PRIORITY_NORMAL, $relationmessage_id, $oe_kurzbz);
if ($msg->error)
{
show_error($msg->retval);
@@ -137,20 +156,20 @@ class Messages extends VileSci_Controller
}
}
}
-
+
if (!$error)
{
echo "Messages sent successfully";
}
}
-
+
/**
- *
+ * getPersonId
*/
private function getPersonId()
{
$person_id = null;
-
+
if ($this->input->get('person_id') !== null)
{
$person_id = $this->input->get('person_id');
@@ -159,45 +178,45 @@ class Messages extends VileSci_Controller
{
$person_id = $this->input->get('person_id');
}
-
+
if (!is_numeric($person_id))
{
show_error('Person_id is not numeric');
}
-
+
return $person_id;
}
-
+
/**
- *
+ * getVorlage
*/
public function getVorlage()
{
$vorlage_kurzbz = $this->input->get('vorlage_kurzbz');
-
+
if (isset($vorlage_kurzbz))
{
$this->load->model('system/Vorlagestudiengang_model', 'VorlagestudiengangModel');
$result = $this->VorlagestudiengangModel->loadWhere(array('vorlage_kurzbz' => $vorlage_kurzbz));
-
+
$this->output
->set_content_type('application/json')
->set_output(json_encode($result));
}
}
-
+
/**
- *
+ * parseMessageText
*/
public function parseMessageText()
{
$prestudent_id = $this->input->get('prestudent_id');
$text = $this->input->get('text');
-
+
if (isset($prestudent_id))
{
$data = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudent_id);
-
+
$parsedText = "";
if (hasData($data))
{
@@ -207,13 +226,13 @@ class Messages extends VileSci_Controller
$newKey = str_replace(" ", "_", strtolower($key));
$dataArray[$newKey] = $dataArray[$key];
}
-
+
$parsedText = $this->messagelib->parseMessageText($text, $dataArray);
}
-
+
$this->output
->set_content_type('application/json')
->set_output(json_encode($parsedText));
}
}
-}
\ No newline at end of file
+}
diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php
index 7a1d8df8f..d5daca634 100755
--- a/application/libraries/MessageLib.php
+++ b/application/libraries/MessageLib.php
@@ -62,12 +62,12 @@ class MessageLib
/**
* getMessagesByUID() - will return all messages, including the latest status for specified user. It don´t returns Attachments.
*/
- public function getMessagesByUID($uid, $all = false)
+ public function getMessagesByUID($uid, $oe_kurzbz = null, $all = false)
{
if (empty($uid))
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
- $msg = $this->ci->RecipientModel->getMessagesByUID($uid, $all);
+ $msg = $this->ci->RecipientModel->getMessagesByUID($uid, $oe_kurzbz, $all);
return $msg;
}
@@ -75,12 +75,12 @@ class MessageLib
/**
* getMessagesByPerson() - will return all messages, including the latest status for specified user. It don´t returns Attachments.
*/
- public function getMessagesByPerson($person_id, $all = false)
+ public function getMessagesByPerson($person_id, $oe_kurzbz = null, $all = false)
{
if (empty($person_id))
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
- $msg = $this->ci->RecipientModel->getMessagesByPerson($person_id, $all);
+ $msg = $this->ci->RecipientModel->getMessagesByPerson($person_id, $oe_kurzbz, $all);
return $msg;
}
@@ -88,12 +88,12 @@ class MessageLib
/**
* getSentMessagesByPerson() - Get all sent messages from a person identified by person_id
*/
- public function getSentMessagesByPerson($person_id, $all = false)
+ public function getSentMessagesByPerson($person_id, $oe_kurzbz = null, $all = false)
{
if (empty($person_id))
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
- $msg = $this->ci->MessageModel->getMessagesByPerson($person_id, $all);
+ $msg = $this->ci->MessageModel->getMessagesByPerson($person_id, $oe_kurzbz, $all);
return $msg;
}
@@ -144,12 +144,12 @@ class MessageLib
/**
* getCountUnreadMessages
*/
- public function getCountUnreadMessages($person_id)
+ public function getCountUnreadMessages($person_id, $oe_kurzbz = null)
{
if (!is_numeric($person_id))
return $this->_error('', MSG_ERR_INVALID_RECIPIENTS);
- $msg = $this->ci->RecipientModel->getCountUnreadMessages($person_id);
+ $msg = $this->ci->RecipientModel->getCountUnreadMessages($person_id, $oe_kurzbz);
return $msg;
}
@@ -422,7 +422,8 @@ class MessageLib
for ($i = 0; $i < count($result->retval) && $sent; $i++)
{
// If the person has an email account
- if (!is_null($result->retval[$i]->receiver) && $result->retval[$i]->receiver != '')
+ 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[0]->token;
// Using a template for the html email body
@@ -461,10 +462,17 @@ class MessageLib
{
$sender = $result->retval[0]->sender;
}
+
+ $receiverContanct = $result->retval[$i]->receiver;
+ if (!is_null($result->retval[$i]->employeecontact) && $result->retval[$i]->employeecontact != '')
+ {
+ $receiverContanct = $result->retval[$i]->employeecontact.'@'.DOMAIN;
+ }
+
// Sending email
$sent = $this->ci->maillib->send(
$sender,
- $result->retval[$i]->receiver,
+ $receiverContanct,
$result->retval[$i]->subject,
$body,
null,
@@ -546,6 +554,7 @@ class MessageLib
null,
$message_id
);
+
// Checks if errors were occurred
if (isSuccess($result))
{
@@ -553,7 +562,8 @@ class MessageLib
if (is_array($result->retval) && count($result->retval) > 0)
{
// If the person has an email account
- if (!is_null($result->retval[0]->receiver) && $result->retval[0]->receiver != '')
+ if ((!is_null($result->retval[0]->receiver) && $result->retval[0]->receiver != '')
+ || (!is_null($result->retval[0]->employeecontact) && $result->retval[0]->employeecontact != ''))
{
// If it is required use a multi-part message in MIME format
if ($multiPartMime === true)
@@ -602,10 +612,16 @@ class MessageLib
$sender = $result->retval[0]->sender;
}
+ $receiverContanct = $result->retval[0]->receiver;
+ if (!is_null($result->retval[0]->employeecontact) && $result->retval[0]->employeecontact != '')
+ {
+ $receiverContanct = $result->retval[0]->employeecontact.'@'.DOMAIN;
+ }
+
// Sending email
$sent = $this->ci->maillib->send(
$sender,
- $result->retval[0]->receiver,
+ $receiverContanct,
is_null($subject) ? $result->retval[0]->subject : $subject, // if parameter subject is not null, use it!
$bodyMsg,
null,
diff --git a/application/libraries/OrganisationseinheitLib.php b/application/libraries/OrganisationseinheitLib.php
index e70e8cb76..b98e8c2c0 100644
--- a/application/libraries/OrganisationseinheitLib.php
+++ b/application/libraries/OrganisationseinheitLib.php
@@ -10,14 +10,14 @@ class OrganisationseinheitLib
public function __construct()
{
$this->ci =& get_instance();
-
+
// Loads model Organisationseinheit_model
$this->ci->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel');
-
+
// Loads helper message to manage returning messages
$this->ci->load->helper('Message');
}
-
+
/**
* treeSearch
*
@@ -54,7 +54,7 @@ class OrganisationseinheitLib
}
$result = $this->ci->OrganisationseinheitModel->getOneLevel($schema, $table, $select, $where, $orderby, $oe_kurzbz);
-
+
if (hasData($result))
{
if ($result->retval[0]->_ppk != null && $result->retval[0]->oe_kurzbz == null)
@@ -62,12 +62,14 @@ class OrganisationseinheitLib
return $this->treeSearch($schema, $table, $select, $where, $orderby, $result->retval[0]->_ppk);
}
}
-
+
return $result;
}
-
+
/**
* treeSearchEntire
+ *
+ * Like tree search, but it returns all the results found while travelling through the tree structure
*/
public function treeSearchEntire($table, $alias, $fields, $where, $orderby, $oe_kurzbz)
{
@@ -89,13 +91,13 @@ class OrganisationseinheitLib
}
$result = $this->ci->OrganisationseinheitModel->getOneLevelAlias($table, $alias, $select, $where, $orderby, $oe_kurzbz);
-
+
if (hasData($result))
{
if ($result->retval[0]->_pk != null && $result->retval[0]->_ppk != null && $result->retval[0]->_jtpk != null)
{
$tmpResult = $this->treeSearchEntire($table, $alias, $select, $where, $orderby, $result->retval[0]->_ppk);
-
+
if (hasData($tmpResult)
&& $tmpResult->retval[0]->_pk != null
&& $tmpResult->retval[0]->_ppk != null
@@ -109,7 +111,25 @@ class OrganisationseinheitLib
$result = $this->treeSearchEntire($table, $alias, $select, $where, $orderby, $result->retval[0]->_ppk);
}
}
-
+
+ return $result;
+ }
+
+ /**
+ * getRoot - Get the root of the organisation unit tree which belongs the given organisation unit parameter
+ */
+ public function getRoot($oe_kurzbz)
+ {
+ $result = $this->ci->OrganisationseinheitModel->load($oe_kurzbz);
+
+ if (hasData($result))
+ {
+ if ($result->retval[0]->oe_parent_kurzbz != null)
+ {
+ $result = $this->getRoot($result->retval[0]->oe_parent_kurzbz);
+ }
+ }
+
return $result;
}
}
diff --git a/application/libraries/UDFLib.php b/application/libraries/UDFLib.php
index ad0e14c03..f3a2ae735 100644
--- a/application/libraries/UDFLib.php
+++ b/application/libraries/UDFLib.php
@@ -46,6 +46,7 @@ class UDFLib
const PHRASES_APP_NAME = 'core'; // Name of the app parameter used to retrive phrases
private $_ci; // Code igniter instance
+ private $UDFs; // Associative array containing names and values of the given UDF parameters
/**
* Loads fhc helper
@@ -55,6 +56,8 @@ class UDFLib
$this->_ci =& get_instance();
$this->_ci->load->helper('fhc');
+
+ $this->UDFs = array(); // by default is an empty array
}
// -------------------------------------------------------------------------------------------------
diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php
index 7e05eeccd..2919036e9 100644
--- a/application/models/crm/Prestudent_model.php
+++ b/application/models/crm/Prestudent_model.php
@@ -88,7 +88,7 @@ class Prestudent_model extends DB_Model
)
{
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
-
+
$this->addSelect(
'p.person_id,
prestudent_id,
@@ -179,4 +179,17 @@ class Prestudent_model extends DB_Model
return $this->loadWhere($parametersArray);
}
+
+ /**
+ * getOrganisationunits
+ */
+ public function getOrganisationunits($prestudent_id)
+ {
+ $query = 'SELECT p.prestudent_id, s.oe_kurzbz
+ FROM public.tbl_prestudent p
+ INNER JOIN public.tbl_studiengang s USING(studiengang_kz)
+ WHERE prestudent_id %s ?';
+
+ return $this->execQuery(sprintf($query, is_array($prestudent_id) ? 'IN' : '='), array($prestudent_id));
+ }
}
diff --git a/application/models/organisation/Organisationseinheit_model.php b/application/models/organisation/Organisationseinheit_model.php
index 0414cd560..37b269f79 100755
--- a/application/models/organisation/Organisationseinheit_model.php
+++ b/application/models/organisation/Organisationseinheit_model.php
@@ -1,4 +1,5 @@
pk = 'oe_kurzbz';
}
+ /**
+ * getRecursiveList
+ */
public function getRecursiveList($typ = null)
{
$qry = "WITH RECURSIVE tree (oe_kurzbz, bezeichnung, path, organisationseinheittyp_kurzbz) AS (
@@ -31,17 +35,17 @@ class Organisationseinheit_model extends DB_Model
SELECT oe_kurzbz AS id,
SUBSTRING(REGEXP_REPLACE(path, '[A-z]+\|', '-', 'g') || bezeichnung, 2) AS description
FROM tree";
-
+
$parametersArray = array();
-
+
if (is_array($typ) && count($typ) > 0)
{
$parametersArray[] = $typ;
$qry .= ' WHERE organisationseinheittyp_kurzbz IN ?';
}
-
+
$qry .= ' ORDER BY path';
-
+
return $this->execQuery($qry, $parametersArray);
}
@@ -78,12 +82,15 @@ class Organisationseinheit_model extends DB_Model
) _joined_table ON (orgs._pk = _joined_table._pk)
WHERE orgs._pk = ?
ORDER BY %s";
-
+
$query = sprintf($query, $table, $fields, $schema, $table, $where, $orderby);
-
+
return $this->execQuery($query, array($oe_kurzbz));
}
-
+
+ /**
+ * getOneLevelAlias
+ */
public function getOneLevelAlias($table, $alias, $fields, $where, $orderby, $oe_kurzbz)
{
$query = "WITH RECURSIVE organizations(_pk, _ppk) AS
@@ -103,9 +110,9 @@ class Organisationseinheit_model extends DB_Model
) _joined_table ON (orgs._pk = _joined_table._jtpk)
WHERE orgs._pk = ?
ORDER BY %s";
-
+
$query = sprintf($query, $alias, $fields, $table, $where, $orderby);
-
+
return $this->execQuery($query, array($oe_kurzbz));
}
-}
\ No newline at end of file
+}
diff --git a/application/models/organisation/Studiengang_model.php b/application/models/organisation/Studiengang_model.php
index a15191eab..36e4b6992 100644
--- a/application/models/organisation/Studiengang_model.php
+++ b/application/models/organisation/Studiengang_model.php
@@ -104,7 +104,7 @@ class Studiengang_model extends DB_Model
public function getStudienplan($studiensemester_kurzbz, $ausbildungssemester, $aktiv, $onlinebewerbung)
{
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
-
+
// Join table public.tbl_studiengang with table lehre.tbl_studienordnung on column studiengang_kz
$this->addJoin('lehre.tbl_studienordnung', 'studiengang_kz');
// Then join with table lehre.tbl_studienplan on column studienordnung_id
@@ -138,10 +138,10 @@ class Studiengang_model extends DB_Model
/**
* getStudiengangBewerbung
*/
- public function getStudiengangBewerbung()
+ public function getStudiengangBewerbung($oe_kurzbz = null)
{
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
-
+
// Join table public.tbl_studiengang with table lehre.tbl_studienordnung on column studiengang_kz
$this->addJoin('lehre.tbl_studienordnung', 'studiengang_kz');
// Join table lehre.tbl_studienordnung with table lehre.tbl_akadgrad on column akadgrad_id
@@ -161,21 +161,45 @@ class Studiengang_model extends DB_Model
$this->addOrder('public.tbl_studiengang.bezeichnung');
$this->addOrder('lehre.tbl_studienplan.studienplan_id');
+ $where = 'public.tbl_studiengang.aktiv = TRUE
+ AND public.tbl_studiengang.onlinebewerbung = TRUE
+ AND (
+ (tbl_bewerbungstermine.beginn <= NOW() AND tbl_bewerbungstermine.ende >= NOW())
+ OR tbl_bewerbungstermine.beginn IS NULL
+ )
+ AND ss.studiensemester_kurzbz IN (
+ SELECT DISTINCT studiensemester_kurzbz
+ FROM public.tbl_bewerbungstermine
+ WHERE beginn <= NOW() AND ende >= NOW()
+ )
+ AND ss.semester = 1
+ AND lehre.tbl_studienplan.aktiv = TRUE';
+
+ if ($oe_kurzbz != null)
+ {
+ $where .= ' AND public.tbl_studiengang.oe_kurzbz IN (
+ WITH RECURSIVE organizations(_pk, _ppk) AS
+ (
+ SELECT o.oe_kurzbz, o.oe_parent_kurzbz
+ FROM public.tbl_organisationseinheit o
+ WHERE o.oe_parent_kurzbz IS NULL
+ AND o.oe_kurzbz = '.$this->escape($oe_kurzbz).'
+ UNION ALL
+ SELECT o.oe_kurzbz, o.oe_parent_kurzbz
+ FROM public.tbl_organisationseinheit o INNER JOIN organizations orgs ON (o.oe_parent_kurzbz = orgs._pk)
+ )
+ SELECT orgs._pk
+ FROM organizations orgs
+ )';
+ }
+
$result = $this->loadTree(
'public.tbl_studiengang',
array(
'lehre.tbl_studienplan',
'lehre.tbl_akadgrad'
),
- 'public.tbl_studiengang.aktiv = TRUE
- AND public.tbl_studiengang.onlinebewerbung = TRUE
- AND ((tbl_bewerbungstermine.beginn <= NOW() AND tbl_bewerbungstermine.ende >= NOW()) OR tbl_bewerbungstermine.beginn IS NULL)
- AND ss.studiensemester_kurzbz IN (
- SELECT DISTINCT studiensemester_kurzbz FROM public.tbl_bewerbungstermine WHERE beginn <= NOW() AND ende >= NOW()
- )
- AND ss.semester = 1
- AND lehre.tbl_studienplan.aktiv = TRUE'
- ,
+ $where,
array(
'studienplaene',
'akadgrad'
@@ -191,7 +215,7 @@ class Studiengang_model extends DB_Model
public function getAppliedStudiengang($person_id, $studiensemester_kurzbz, $titel)
{
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
-
+
// Then join with table public.tbl_prestudent
$this->addJoin('public.tbl_prestudent', 'studiengang_kz');
// Join table public.tbl_prestudentstatus
@@ -233,14 +257,14 @@ class Studiengang_model extends DB_Model
return $result;
}
-
+
/**
* getAppliedStudiengangFromNow
*/
public function getAppliedStudiengangFromNow($person_id, $titel)
{
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
-
+
// Then join with table public.tbl_prestudent
$this->addJoin('public.tbl_prestudent', 'studiengang_kz');
// Join table public.tbl_prestudentstatus
@@ -257,10 +281,10 @@ class Studiengang_model extends DB_Model
'prestudent_id',
'LEFT'
);
-
+
// Ordering by studiengang_kz and studienplan_id
$this->addOrder('public.tbl_studiengang.bezeichnung');
-
+
$result = $this->loadTree(
'public.tbl_studiengang',
array(
@@ -283,7 +307,74 @@ class Studiengang_model extends DB_Model
'notizen'
)
);
-
+
+ return $result;
+ }
+
+ /**
+ * getAppliedStudiengangFromNowOE
+ */
+ public function getAppliedStudiengangFromNowOE($person_id, $titel, $oe_kurzbz)
+ {
+ if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
+
+ // Then join with table public.tbl_prestudent
+ $this->addJoin('public.tbl_prestudent', 'studiengang_kz');
+ // Join table public.tbl_prestudentstatus
+ $this->addJoin('public.tbl_prestudentstatus', 'prestudent_id');
+ // Then join with table lehre.tbl_studienplan
+ $this->addJoin('lehre.tbl_studienplan', 'studienplan_id');
+ // Then join with table public.tbl_notizzuordnung + public.tbl_notiz
+ $this->addJoin(
+ '(
+ SELECT public.tbl_notiz.*, public.tbl_notizzuordnung.prestudent_id
+ FROM public.tbl_notiz JOIN public.tbl_notizzuordnung USING(notiz_id)
+ WHERE titel = '.$this->escape($titel).
+ ') tbl_notiz',
+ 'prestudent_id',
+ 'LEFT'
+ );
+
+ // Ordering by studiengang_kz and studienplan_id
+ $this->addOrder('public.tbl_studiengang.bezeichnung');
+
+ $result = $this->loadTree(
+ 'public.tbl_studiengang',
+ array(
+ 'public.tbl_prestudent',
+ 'public.tbl_prestudentstatus',
+ 'lehre.tbl_studienplan',
+ 'public.tbl_notiz'
+ ),
+ 'public.tbl_prestudent.person_id = '.$this->escape($person_id).
+ ' AND public.tbl_prestudentstatus.studiensemester_kurzbz IN (
+ SELECT studiensemester_kurzbz
+ FROM public.tbl_studiensemester
+ WHERE ende >= NOW()
+ )
+ AND (public.tbl_prestudentstatus.status_kurzbz = \'Interessent\')
+ AND public.tbl_studiengang.oe_kurzbz IN (
+ WITH RECURSIVE organizations(_pk, _ppk) AS
+ (
+ SELECT o.oe_kurzbz, o.oe_parent_kurzbz
+ FROM public.tbl_organisationseinheit o
+ WHERE o.oe_parent_kurzbz IS NULL
+ AND o.oe_kurzbz = '.$this->escape($oe_kurzbz).'
+ UNION ALL
+ SELECT o.oe_kurzbz, o.oe_parent_kurzbz
+ FROM public.tbl_organisationseinheit o INNER JOIN organizations orgs ON (o.oe_parent_kurzbz = orgs._pk)
+ )
+ SELECT orgs._pk
+ FROM organizations orgs
+ )',
+ array(
+ 'prestudenten',
+ 'prestudentstatus',
+ 'studienplaene',
+ 'notizen'
+ )
+ );
+
return $result;
}
diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php
index 76e86b356..b94bc3861 100644
--- a/application/models/system/Message_model.php
+++ b/application/models/system/Message_model.php
@@ -1,4 +1,4 @@
-dbTable = 'public.tbl_msg_message';
$this->pk = 'message_id';
}
-
+
/**
* Get all sent messages from a person identified by person_id
*/
- public function getMessagesByPerson($person_id, $all)
+ public function getMessagesByPerson($person_id, $oe_kurzbz, $all)
{
// Checks if the operation is permitted by the API caller
if (isError($ent = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
@@ -26,7 +26,7 @@ class Message_model extends DB_Model
return $ent;
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
return $ent;
-
+
$sql = 'SELECT m.message_id,
m.person_id,
m.subject,
@@ -52,9 +52,9 @@ class Message_model extends DB_Model
ORDER BY insertamum DESC
) s ON (m.message_id = s.message_id AND m.person_id = s.person_id)
WHERE m.person_id = ?';
-
+
$parametersArray = array($person_id);
-
+
if ($all == 'true')
{
$sql = sprintf($sql, '');
@@ -63,17 +63,36 @@ class Message_model extends DB_Model
{
$sql = sprintf($sql, 'WHERE status >= 3');
}
-
+
+ if ($oe_kurzbz != null)
+ {
+ array_push($parametersArray, $oe_kurzbz);
+ $sql .= ' AND m.oe_kurzbz IN (
+ WITH RECURSIVE organizations(_pk, _ppk) AS
+ (
+ SELECT o.oe_kurzbz, o.oe_parent_kurzbz
+ FROM public.tbl_organisationseinheit o
+ WHERE o.oe_parent_kurzbz IS NULL
+ AND o.oe_kurzbz = ?
+ UNION ALL
+ SELECT o.oe_kurzbz, o.oe_parent_kurzbz
+ FROM public.tbl_organisationseinheit o INNER JOIN organizations orgs ON (o.oe_parent_kurzbz = orgs._pk)
+ )
+ SELECT orgs._pk
+ FROM organizations orgs
+ )';
+ }
+
return $this->execQuery($sql, $parametersArray);
}
-
+
/**
* getMessageVars
*/
public function getMessageVars()
{
$result = $this->db->query('SELECT * FROM public.vw_msg_vars WHERE 0 = 1');
-
+
if ($result)
{
return success($result->list_fields());
@@ -83,14 +102,14 @@ class Message_model extends DB_Model
return error($this->db->error(), FHC_DB_ERROR);
}
}
-
+
/**
* getMsgVarsDataByPrestudentId
*/
public function getMsgVarsDataByPrestudentId($prestudent_id)
{
$query = 'SELECT * FROM public.vw_msg_vars WHERE prestudent_id %s ?';
-
+
return $this->execQuery(sprintf($query, is_array($prestudent_id) ? 'IN' : '='), array($prestudent_id));
}
}
diff --git a/application/models/system/Recipient_model.php b/application/models/system/Recipient_model.php
index 790f7487e..c0fa75da2 100644
--- a/application/models/system/Recipient_model.php
+++ b/application/models/system/Recipient_model.php
@@ -12,7 +12,7 @@ class Recipient_model extends DB_Model
$this->pk = array('person_id', 'message_id');
$this->hasSequence = false;
}
-
+
/**
* Get data for a received message
*/
@@ -27,7 +27,7 @@ class Recipient_model extends DB_Model
return $ent;
if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
return $ent;
-
+
$query = 'SELECT mr.message_id,
mr.person_id,
mm.subject,
@@ -43,13 +43,13 @@ class Recipient_model extends DB_Model
SELECT person_id, kontakt FROM public.tbl_kontakt WHERE kontakttyp = \'email\'
) ks ON (ks.person_id = mr.person_id)
WHERE mr.message_id = ? AND mr.person_id = ?';
-
+
$parametersArray = array($message_id, $person_id);
-
+
// Get data of the messages to sent
return $this->execQuery($query, $parametersArray);
}
-
+
/**
* Get a received message identified by token
*/
@@ -62,7 +62,7 @@ class Recipient_model extends DB_Model
return $ent;
if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
return $ent;
-
+
$sql = 'SELECT r.message_id,
m.person_id as sender_id,
r.person_id as receiver_id,
@@ -80,14 +80,14 @@ class Recipient_model extends DB_Model
) s ON (r.message_id = s.message_id AND r.person_id = s.person_id)
WHERE r.token = ?
LIMIT 1';
-
+
return $this->execQuery($sql, array(MSG_STATUS_DELETED, $token));
}
-
+
/**
* Get all received messages for a person identified by person_id
*/
- public function getMessagesByPerson($person_id, $all)
+ public function getMessagesByPerson($person_id, $oe_kurzbz, $all)
{
// Checks if the operation is permitted by the API caller
if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
@@ -98,7 +98,7 @@ class Recipient_model extends DB_Model
return $ent;
if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
return $ent;
-
+
$sql = 'SELECT DISTINCT ON (r.message_id) r.message_id,
m.person_id,
m.subject,
@@ -124,11 +124,10 @@ class Recipient_model extends DB_Model
%s
ORDER BY insertamum DESC
) s ON (m.message_id = s.message_id AND r.person_id = s.person_id)
- WHERE r.person_id = ?
- ORDER BY r.message_id DESC, s.status DESC';
-
+ WHERE r.person_id = ?';
+
$parametersArray = array($person_id);
-
+
if ($all == 'true')
{
$sql = sprintf($sql, '');
@@ -138,17 +137,38 @@ class Recipient_model extends DB_Model
array_push($parametersArray, $person_id, $person_id);
$sql = sprintf($sql, 'WHERE person_id = ? AND message_id NOT IN (SELECT message_id FROM public.tbl_msg_status WHERE status >= 3 AND person_id = ?)');
}
-
+
+ if ($oe_kurzbz != null)
+ {
+ array_push($parametersArray, $oe_kurzbz);
+ $sql .= ' AND m.oe_kurzbz IN (
+ WITH RECURSIVE organizations(_pk, _ppk) AS
+ (
+ SELECT o.oe_kurzbz, o.oe_parent_kurzbz
+ FROM public.tbl_organisationseinheit o
+ WHERE o.oe_parent_kurzbz IS NULL
+ AND o.oe_kurzbz = ?
+ UNION ALL
+ SELECT o.oe_kurzbz, o.oe_parent_kurzbz
+ FROM public.tbl_organisationseinheit o INNER JOIN organizations orgs ON (o.oe_parent_kurzbz = orgs._pk)
+ )
+ SELECT orgs._pk
+ FROM organizations orgs
+ )';
+ }
+
+ $sql .= ' ORDER BY r.message_id DESC, s.status DESC';
+
return $this->execQuery($sql, $parametersArray);
}
-
+
/**
* Get all received messages for a person identified by uid
*/
- public function getMessagesByUID($uid, $all)
+ public function getMessagesByUID($uid, $oe_kurzbz, $all)
{
// Checks if the operation is permitted by the API caller
- // @ToDo: Define the special right for reading own messages 'basis/message:own'
+ // TODO: Define the special right for reading own messages 'basis/message:own'
// if same user
if ($uid === getAuthUID())
{
@@ -163,15 +183,14 @@ class Recipient_model extends DB_Model
}
// get Data
- $sql = 'SELECT b.uid,
+ $sql = 'SELECT DISTINCT ON (r.message_id) r.message_id,
m.person_id,
- m.message_id,
m.subject,
m.body,
m.priority,
+ m.insertamum,
m.relationmessage_id,
m.oe_kurzbz,
- m.insertamum,
p.anrede,
p.titelpost,
p.titelpre,
@@ -185,21 +204,46 @@ class Recipient_model extends DB_Model
JOIN public.tbl_person p ON (r.person_id = p.person_id)
JOIN public.tbl_benutzer b ON (r.person_id = b.person_id)
JOIN (
- SELECT * FROM public.tbl_msg_status ORDER BY insertamum DESC LIMIT 1
- ) s ON (r.message_id = s.message_id AND r.person_id = s.person_id)
+ SELECT message_id, person_id, status, statusinfo, insertamum
+ FROM public.tbl_msg_status
+ ORDER BY insertamum DESC
+ ) s ON (m.message_id = s.message_id AND r.person_id = s.person_id)
WHERE b.uid = ?';
-
- if (! $all)
+
+ $parametersArray = array($uid);
+
+ if ($all == 'true')
+ {
$sql .= ' AND (status < 3 OR status IS NULL)';
-
- return $this->execQuery($sql, array($uid));
+ }
+
+ if ($oe_kurzbz != null)
+ {
+ array_push($parametersArray, $oe_kurzbz);
+ $sql .= ' AND m.oe_kurzbz IN (
+ WITH RECURSIVE organizations(_pk, _ppk) AS
+ (
+ SELECT o.oe_kurzbz, o.oe_parent_kurzbz
+ FROM public.tbl_organisationseinheit o
+ WHERE o.oe_parent_kurzbz IS NULL
+ AND o.oe_kurzbz = ?
+ UNION ALL
+ SELECT o.oe_kurzbz, o.oe_parent_kurzbz
+ FROM public.tbl_organisationseinheit o INNER JOIN organizations orgs ON (o.oe_parent_kurzbz = orgs._pk)
+ )
+ SELECT orgs._pk
+ FROM organizations orgs
+ )';
+ }
+
+ return $this->execQuery($sql, $parametersArray);
}
-
+
/**
* getMessages
- *
+ *
* Gets all the messages to be sent
- *
+ *
* @param kontaktType specifies the type of the kontakt to get
* @param sent specifies the status of the messages to get (NULL never sent, otherwise the shipping date)
* @param limit specifies the number of messages to get
@@ -214,10 +258,11 @@ class Recipient_model extends DB_Model
return $ent;
if (isError($ent = $this->isEntitled('public.tbl_kontakt', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
return $ent;
-
+
$query = 'SELECT mm.message_id,
ks.kontakt as sender,
kr.kontakt as receiver,
+ mu.mitarbeiter_uid as employeeContact,
mr.person_id as receiver_id,
mr.token,
mm.subject,
@@ -229,10 +274,16 @@ class Recipient_model extends DB_Model
) ks ON (ks.person_id = mm.person_id)
LEFT JOIN (
SELECT person_id, kontakt FROM public.tbl_kontakt WHERE kontakttyp = ?
- ) kr ON (kr.person_id = mr.person_id)';
-
+ ) kr ON (kr.person_id = mr.person_id)
+ LEFT JOIN (
+ SELECT b.person_id,
+ m.mitarbeiter_uid
+ FROM public.tbl_benutzer b INNER JOIN public.tbl_mitarbeiter m ON(b.uid = m.mitarbeiter_uid)
+ WHERE b.aktiv = TRUE
+ ) mu ON (mu.person_id = mr.person_id)';
+
$parametersArray = array($kontaktType, $kontaktType);
-
+
if (is_null($sent) || $sent == '')
{
$query .= ' WHERE mr.sent IS NULL';
@@ -242,38 +293,39 @@ class Recipient_model extends DB_Model
array_push($parametersArray, $sent);
$query .= ' WHERE mr.sent = ?';
}
-
+
if (!is_null($message_id))
{
array_push($parametersArray, $message_id);
$query .= ' AND mm.message_id = ?';
}
-
+
$query .= ' ORDER BY mr.insertamum ASC';
-
+
if (!is_null($limit))
{
$query .= ' LIMIT ?';
array_push($parametersArray, $limit);
}
-
+
return $this->execQuery($query, $parametersArray);
}
-
+
/**
* Get all unread messages for a person identified by person_id
*/
- public function getCountUnreadMessages($person_id)
+ public function getCountUnreadMessages($person_id, $oe_kurzbz)
{
// Checks if the operation is permitted by the API caller
if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
return $ent;
if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
return $ent;
-
+
$sql = 'SELECT COUNT(r.message_id) AS unreadMessages
- FROM public.tbl_msg_recipient r JOIN public.tbl_msg_status s
- ON (r.message_id = s.message_id AND r.person_id = s.person_id)
+ FROM public.tbl_msg_recipient r
+ JOIN public.tbl_msg_status s ON (r.message_id = s.message_id AND r.person_id = s.person_id)
+ JOIN public.tbl_msg_message m ON (r.message_id = m.message_id)
WHERE r.person_id = ?
AND s.status = ?
AND r.message_id NOT IN (
@@ -283,9 +335,28 @@ class Recipient_model extends DB_Model
WHERE r.person_id = ?
AND s.status > ?
)';
-
+
$parametersArray = array($person_id, MSG_STATUS_UNREAD, $person_id, MSG_STATUS_UNREAD);
-
+
+ if ($oe_kurzbz != null)
+ {
+ array_push($parametersArray, $oe_kurzbz);
+ $sql .= ' AND m.oe_kurzbz IN (
+ WITH RECURSIVE organizations(_pk, _ppk) AS
+ (
+ SELECT o.oe_kurzbz, o.oe_parent_kurzbz
+ FROM public.tbl_organisationseinheit o
+ WHERE o.oe_parent_kurzbz IS NULL
+ AND o.oe_kurzbz = ?
+ UNION ALL
+ SELECT o.oe_kurzbz, o.oe_parent_kurzbz
+ FROM public.tbl_organisationseinheit o INNER JOIN organizations orgs ON (o.oe_parent_kurzbz = orgs._pk)
+ )
+ SELECT orgs._pk
+ FROM organizations orgs
+ )';
+ }
+
return $this->execQuery($sql, $parametersArray);
}
}
diff --git a/application/views/organisation/studienjahrNew.php b/application/views/organisation/studienjahrNew.php
index 61c11b12e..31fe78630 100644
--- a/application/views/organisation/studienjahrNew.php
+++ b/application/views/organisation/studienjahrNew.php
@@ -1,5 +1,5 @@
load->view('templates/header', array('title' => 'StudienjahrNew', 'jqueryComposer' => true));
+$this->load->view('templates/header', array('title' => 'StudienjahrNew', 'jqueryCurrent' => true));
?>
diff --git a/application/views/organisation/studiensemesterNew.php b/application/views/organisation/studiensemesterNew.php
index 15494ed98..76da57afb 100644
--- a/application/views/organisation/studiensemesterNew.php
+++ b/application/views/organisation/studiensemesterNew.php
@@ -1,5 +1,5 @@
load->view('templates/header', array('title' => 'StudiensemesterNew', 'jqueryComposer' => true, 'datepicker' => true, 'datepickerclass' => 'dateinput'));
+$this->load->view('templates/header', array('title' => 'StudiensemesterNew', 'jqueryCurrent' => true, 'datepicker' => true, 'datepickerclass' => 'dateinput'));
?>
diff --git a/application/views/system/aufnahme/prestudentMultiAssign.php b/application/views/system/aufnahme/prestudentMultiAssign.php
index 2223f3386..85395db47 100644
--- a/application/views/system/aufnahme/prestudentMultiAssign.php
+++ b/application/views/system/aufnahme/prestudentMultiAssign.php
@@ -1,4 +1,4 @@
-load->view("templates/header", array("title" => "Users manager", "jquery19" => true, "tablesort" => true, "jquery_checkboxes" => true, "jquery_custom" => true)); ?>
+load->view("templates/header", array("title" => "Users manager", "jqueryV1" => true, "tablesort" => true, "jquery_checkboxes" => true, "jquery_custom" => true)); ?>
-
+
-
+
-
+
-
+
-
+
load->view("templates/footer"); ?>
diff --git a/application/views/system/messageWrite.php b/application/views/system/messageWrite.php
index b5424e09f..940e097ad 100644
--- a/application/views/system/messageWrite.php
+++ b/application/views/system/messageWrite.php
@@ -1,13 +1,13 @@
-load->view("templates/header", array("title" => "MessageReply", "jquery19" => true, "tinymce" => true)); ?>
+load->view("templates/header", array("title" => "MessageReply", "jqueryV1" => true, "tinymce" => true)); ?>
-
+
-
+
-
+
-
+
-
+
load->view("templates/footer"); ?>
diff --git a/application/views/templates/header.php b/application/views/templates/header.php
index 59ddde80f..e995fb7f3 100644
--- a/application/views/templates/header.php
+++ b/application/views/templates/header.php
@@ -2,8 +2,8 @@
if (! defined('BASEPATH')) exit('No direct script access allowed');
isset($title) ? $title = 'VileSci - '.$title : $title = 'VileSci';
-!isset($jquery19) ? $jquery19 = false : $jquery19 = $jquery19;
-!isset($jqueryComposer) ? $jqueryComposer = false : $jqueryComposer = $jqueryComposer;
+!isset($jqueryV1) ? $jqueryV1 = false : $jqueryV1 = $jqueryV1;
+!isset($jqueryCurrent) ? $jqueryCurrent = false : $jqueryCurrent = $jqueryCurrent;
!isset($jqueryui) ? $jqueryui = false : $jqueryui = $jqueryui;
!isset($jquery_checkboxes) ? $jquery_checkboxes = false : $jquery_checkboxes = $jquery_checkboxes;
!isset($jquery_custom) ? $jquery_custom = false : $jquery_custom = $jquery_custom;
@@ -19,15 +19,15 @@ isset($title) ? $title = 'VileSci - '.$title : $title = 'VileSci';
!isset($datepicker) ? $datepicker = false : $datepicker = $datepicker;
if ($tablesort || $jquery_checkboxes || $jquery_custom)
- $jquery19 = true;
+ $jqueryV1 = true;
if($datepicker)
$jqueryui = true;
if($jqueryui)
- $jqueryComposer = true;
+ $jqueryCurrent = true;
-if($jquery19 && $jqueryComposer)
+if($jqueryV1 && $jqueryCurrent)
show_error("Two JQuery versions used: composer and include folder version");
?>
@@ -42,17 +42,19 @@ if($jquery19 && $jqueryComposer)
-
-
+
+
+
-
+
-
+
+
diff --git a/cis/ampel.php b/cis/ampel.php
index 27b4571d2..3036bcb2b 100755
--- a/cis/ampel.php
+++ b/cis/ampel.php
@@ -8,7 +8,7 @@ require_once('../include/phrasen.class.php');
$sprache = getSprache();
$p = new phrasen($sprache);
?>
-
+
+
+
+
+
+
+
@@ -15,7 +20,7 @@
|
-
\ No newline at end of file
+ |