Merge branch 'master' into signatur

This commit is contained in:
Andreas Österreicher
2018-02-22 00:00:43 +01:00
17 changed files with 710 additions and 349 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ $config['roles'] = array
'basis/adresse','basis/akte','basis/kontakt','basis/log','basis/nation','basis/notiz','basis/notizzuordnung',
'basis/person','basis/prestudent','basis/prestudentstatus','basis/status','basis/zgv','basis/zgvmaster',
'lehre/studienplan','system/filters','fs/dms','basis/message','basis/benutzerrolle', 'basis/sprache',
'system/personlock'
'system/personlock','basis/benutzerfunktion','system/vorlagestudiengang'
)
)
);
+13 -8
View File
@@ -33,7 +33,7 @@ class ViewMessage extends CI_Controller
// Load model MessageToken_model, not calling the authentication system
$this->load->model('system/MessageToken_model', 'MessageTokenModel');
}
/**
* Using the MessageTokenModel instead of MessageLib to allow
* viewing the message without prompting the login
@@ -50,32 +50,37 @@ class ViewMessage extends CI_Controller
if (is_array($msg->retval) && count($msg->retval) > 0)
{
$setReadMessageStatusByToken = $this->MessageTokenModel->setReadMessageStatusByToken($token);
if (isError($setReadMessageStatusByToken))
{
show_error($msg->$setReadMessageStatusByToken);
}
$sender_id = $msg->retval[0]->sender_id;
$receiver_id = $msg->retval[0]->receiver_id;
$sender = $this->MessageTokenModel->getSenderData($sender_id);
// To decide how to change the redirection
$isEmployee = $this->MessageTokenModel->isEmployee($receiver_id);
if (!is_bool($isEmployee) && isError($isEmployee))
{
show_error($isEmployee);
}
if($this->config->item('redirect_view_message_url') != '')
$href = APP_ROOT . $this->config->item('redirect_view_message_url') . $token;
else
$href = '';
$data = array (
'sender_id' => $sender_id,
'sender' => $sender->retval[0],
'message' => $msg->retval[0],
'isEmployee' => $isEmployee,
'href' => APP_ROOT . $this->config->item('redirect_view_message_url') . $token
'href' => $href
);
$this->load->view('system/messageHTML.php', $data);
}
}
}
}
@@ -69,6 +69,7 @@ class InfoCenter extends VileSci_Controller
// Loads libraries
$this->load->library('DmsLib');
$this->load->library('PersonLogLib');
$this->load->library('MailLib');
$this->load->library('WidgetLib');
$this->_setAuthUID(); // sets property uid
@@ -313,7 +314,7 @@ class InfoCenter extends VileSci_Controller
$lastStatus = $lastStatus->retval[0];
//check if still Interessent and not freigegeben yet
if($lastStatus->status_kurzbz === 'Interessent' && !isset($lastStatus->bestaetigtam))
if ($lastStatus->status_kurzbz === 'Interessent' && !isset($lastStatus->bestaetigtam))
{
$result = $this->PrestudentstatusModel->update(
array(
@@ -542,11 +543,23 @@ class InfoCenter extends VileSci_Controller
*/
private function _loadPersonData($person_id)
{
$lockedby = $this->PersonLockModel->checkIfLocked($person_id);
$locked = $this->PersonLockModel->checkIfLocked($person_id, self::APP);
if (isError($lockedby))
if (isError($locked))
{
show_error($lockedby->retval);
show_error($locked->retval);
}
$lockedby = null;
//mark red if locked by other user
$lockedbyother = false;
if (isset($locked->retval[0]->uid))
{
$lockedby = $locked->retval[0]->uid;
if ($lockedby !== $this->uid)
$lockedbyother = true;
}
$stammdaten = $this->PersonModel->getPersonStammdaten($person_id, true);
@@ -599,7 +612,8 @@ class InfoCenter extends VileSci_Controller
$messagelink = base_url('/index.ci.php/system/Messages/write/'.$user_person->retval[0]->person_id);
$data = array (
'lockedby' => isset($lockedby->retval[0]->uid) ? $lockedby->retval[0]->uid : null,
'lockedby' => $lockedby,
'lockedbyother' => $lockedbyother,
'stammdaten' => $stammdaten->retval,
'dokumente' => $dokumente->retval,
'dokumente_nachgereicht' => $dokumente_nachgereicht->retval,
@@ -741,4 +755,9 @@ class InfoCenter extends VileSci_Controller
$this->uid
);
}
/*
private function _sendFreigabeMail()
{
$this->maillib->send('alex@alex-ThinkCentre-M900', 'karpen_ko@hotmail.com', 'test', 'test');
}*/
}
+15
View File
@@ -540,6 +540,21 @@ class DB_Model extends FHC_Model
return $this->db->escape($value);
}
/**
* This method call the method escape_like_str from class CI_DB_driver, therefore:
* this method should be used when strings are to be used in LIKE conditions so that LIKE wildcards (%, _)
* in the string are also properly escaped.
* NOTE: The escape_like_str() method uses ! (exclamation mark) to escape special characters for LIKE conditions.
* Because this method escapes partial strings that you would wrap in quotes yourself, it cannot automatically
* add the ESCAPE '!' condition for you, and so youll have to manually do that.
*
* @return void
*/
public function escapeLike($value)
{
return $this->db->escape_like_str($value);
}
/**
* Convert PG-Boolean to PHP-Boolean
*
+114 -45
View File
@@ -426,42 +426,78 @@ 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[0]->token;
// Using a template for the html email body
$body = $this->ci->parser->parse(
'templates/mailHTML',
array(
'href' => $href,
'subject' => $result->retval[0]->subject,
'body' => $result->retval[0]->body
),
true
);
$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');
if(hasData($vorlage))
{
// Using a template for the html email body
$body = $this->ci->parser->parse_string(
$vorlage->retval[0]->text,
array(
'href' => $href,
'subject' => $result->retval[$i]->subject,
'body' => $result->retval[$i]->body
),
true
);
}
else
{
// Using a template for the html email body
$body = $this->ci->parser->parse(
'templates/mailHTML',
array(
'href' => $href,
'subject' => $result->retval[$i]->subject,
'body' => $result->retval[$i]->body
),
true
);
}
if (is_null($body) || $body == '')
{
$this->ci->loglib->logError('Error while parsing the mail template');
}
// Using a template for the plain text email body
$altBody = $this->ci->parser->parse(
'templates/mailTXT',
array(
'href' => $href,
'subject' => $result->retval[0]->subject,
'body' => $result->retval[0]->body
),
true
);
$vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailTXT');
if(hasData($vorlage))
{
// Using a template for the plain text email body
$altBody = $this->ci->parser->parse_string(
$vorlage->retval[0]->text,
array(
'href' => $href,
'subject' => $result->retval[$i]->subject,
'body' => $result->retval[$i]->body
),
true
);
}
else
{
// Using a template for the plain text email body
$altBody = $this->ci->parser->parse(
'templates/mailTXT',
array(
'href' => $href,
'subject' => $result->retval[$i]->subject,
'body' => $result->retval[$i]->body
),
true
);
}
if (is_null($altBody) || $altBody == '')
{
$this->ci->loglib->logError('Error while parsing the mail template');
}
// If the sender kontakt does not exist, then system-sender is used if empty
// If the sender is not an employee, then system-sender is used if empty
$sender = '';
if (!is_null($result->retval[0]->sender) && $result->retval[0]->sender != '')
if (!is_null($result->retval[0]->senderemployeecontact) && $result->retval[0]->senderemployeecontact != '')
{
$sender = $result->retval[0]->sender;
$sender = $result->retval[0]->senderemployeecontact.'@'.DOMAIN;
}
$receiverContact = $result->retval[$i]->receiver;
@@ -571,15 +607,32 @@ class MessageLib
{
// 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;
$bodyMsg = $this->ci->parser->parse(
'templates/mailHTML',
array(
'href' => $href,
'subject' => $result->retval[0]->subject,
'body' => $result->retval[0]->body
),
true
);
$vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailHTML');
if(hasData($vorlage))
{
$bodyMsg = $this->ci->parser->parse_string(
$vorlage->retval[0]->text,
array(
'href' => $href,
'subject' => $result->retval[0]->subject,
'body' => $result->retval[0]->body
),
true
);
}
else
{
$bodyMsg = $this->ci->parser->parse(
'templates/mailHTML',
array(
'href' => $href,
'subject' => $result->retval[0]->subject,
'body' => $result->retval[0]->body
),
true
);
}
if (is_null($bodyMsg) || $bodyMsg == '')
{
// $body = $result->retval[0]->body;
@@ -587,15 +640,31 @@ class MessageLib
}
// Using a template for the plain text email body
$altBody = $this->ci->parser->parse(
'templates/mailTXT',
array(
'href' => $href,
'subject' => $result->retval[0]->subject,
'body' => $result->retval[0]->body
),
true
);
$vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailHTML');
if(hasData($vorlage))
{
$altBody = $this->ci->parser->parse_string(
$vorlage->retval[0]->text,
array(
'href' => $href,
'subject' => $result->retval[0]->subject,
'body' => $result->retval[0]->body
),
true
);
}
else
{
$altBody = $this->ci->parser->parse(
'templates/mailTXT',
array(
'href' => $href,
'subject' => $result->retval[0]->subject,
'body' => $result->retval[0]->body
),
true
);
}
if (is_null($altBody) || $altBody == '')
{
$this->ci->loglib->logError('Error while parsing the plain text mail template');
@@ -606,11 +675,11 @@ class MessageLib
$bodyMsg = $altBody = $body;
}
// If the sender kontakt does not exist, then system-sender is used if empty
// If the sender is not an employee, then system-sender is used if empty
$sender = '';
if (!is_null($result->retval[0]->sender) && $result->retval[0]->sender != '')
if (!is_null($result->retval[0]->senderemployeecontact) && $result->retval[0]->senderemployeecontact != '')
{
$sender = $result->retval[0]->sender;
$sender = $result->retval[0]->senderemployeecontact.'@'.DOMAIN;
}
$receiverContact = $result->retval[0]->receiver;
+120 -120
View File
@@ -9,9 +9,9 @@ class VorlageLib
/**
* Loads parser library and OrganisationseinheitLib library
*/
public function __construct()
{
require_once APPPATH.'config/message.php';
public function __construct()
{
require_once APPPATH.'config/message.php';
$this->ci =& get_instance();
@@ -21,83 +21,83 @@ class VorlageLib
$this->ci->load->model('system/Vorlage_model', 'VorlageModel');
$this->ci->load->model('system/Vorlagestudiengang_model', 'VorlageStudiengangModel');
$this->ci->load->helper('language');
// Loads helper message to manage returning messages
$this->ci->load->helper('language');
// Loads helper message to manage returning messages
$this->ci->load->helper('message');
//$this->ci->lang->load('fhcomplete');
}
//$this->ci->lang->load('fhcomplete');
}
/**
* getVorlage() - will load a spezific Template
*
* @param int $vorlage_kurzbz REQUIRED
* @return struct
*/
public function getVorlage($vorlage_kurzbz)
{
if (empty($vorlage_kurzbz))
return error(MSG_ERR_INVALID_MSG_ID);
$vorlage = $this->ci->VorlageModel->load($vorlage_kurzbz);
return $vorlage;
}
/**
* getSubMessages() - will return all Messages subordinated from a specified message.
*
* @param int $msg_id REQUIRED
* @return array
*/
public function getVorlageByMimetype($mimetype = null)
{
$vorlage = $this->ci->VorlageModel->loadWhere(array('mimetype' => $mimetype));
return $vorlage;
}
/**
* saveVorlage() - will save a spezific Template.
*
* @param array $data REQUIRED
* @return array
*/
public function saveVorlage($vorlage_kurzbz, $data)
{
if (empty($data))
return error(MSG_ERR_INVALID_MSG_ID);
$vorlage = $this->ci->VorlageModel->update($vorlage_kurzbz, $data);
return $vorlage;
}
/**
* getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
public function getVorlagetextByVorlage($vorlage_kurzbz)
* getVorlage() - will load a spezific Template
*
* @param int $vorlage_kurzbz REQUIRED
* @return struct
*/
public function getVorlage($vorlage_kurzbz)
{
if (empty($vorlage_kurzbz))
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
if (empty($vorlage_kurzbz))
return error(MSG_ERR_INVALID_MSG_ID);
$vorlage = $this->ci->VorlageStudiengangModel->loadWhere(array('vorlage_kurzbz' => $vorlage_kurzbz));
return $vorlage;
}
$vorlage = $this->ci->VorlageModel->load($vorlage_kurzbz);
return $vorlage;
}
/**
* loadVorlagetext() - will load the best fitting Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @param string $oe_kurzbz OPTIONAL
* @param string $orgform_kurzbz OPTIONAL
* getSubMessages() - will return all Messages subordinated from a specified message.
*
* @param int $msg_id REQUIRED
* @return array
*/
public function getVorlageByMimetype($mimetype = null)
{
$vorlage = $this->ci->VorlageModel->loadWhere(array('mimetype' => $mimetype));
return $vorlage;
}
/**
* saveVorlage() - will save a spezific Template.
*
* @param array $data REQUIRED
* @return array
*/
public function saveVorlage($vorlage_kurzbz, $data)
{
if (empty($data))
return error(MSG_ERR_INVALID_MSG_ID);
$vorlage = $this->ci->VorlageModel->update($vorlage_kurzbz, $data);
return $vorlage;
}
/**
* getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
public function getVorlagetextByVorlage($vorlage_kurzbz)
{
if (empty($vorlage_kurzbz))
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
$vorlage = $this->ci->VorlageStudiengangModel->loadWhere(array('vorlage_kurzbz' => $vorlage_kurzbz));
return $vorlage;
}
/**
* loadVorlagetext() - will load the best fitting Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @param string $oe_kurzbz OPTIONAL
* @param string $orgform_kurzbz OPTIONAL
* @param string $sprache OPTIONAL
* @return array
*/
public function loadVorlagetext($vorlage_kurzbz, $oe_kurzbz = null, $orgform_kurzbz = null, $sprache = null)
* @return array
*/
public function loadVorlagetext($vorlage_kurzbz, $oe_kurzbz = null, $orgform_kurzbz = null, $sprache = null)
{
if (empty($vorlage_kurzbz))
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
if (empty($vorlage_kurzbz))
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
// Try to search the template with the given vorlage_kurzbz and other parameters if present
$queryParameters = array("vorlage_kurzbz" => $vorlage_kurzbz, "aktiv" => true);
@@ -120,7 +120,7 @@ class VorlageLib
{
// Builds where clause
$where = $this->_where($vorlage_kurzbz, $orgform_kurzbz, $sprache);
$vorlage = $this->ci->organisationseinheitlib->treeSearch(
'public',
'tbl_vorlagestudiengang',
@@ -133,17 +133,17 @@ class VorlageLib
);
}
return $vorlage;
}
return $vorlage;
}
/**
* _where
*/
private function _where($vorlage_kurzbz, $orgform_kurzbz, $sprache)
{
/**
* _where
*/
private function _where($vorlage_kurzbz, $orgform_kurzbz, $sprache)
{
// Builds where clause
$where = "vorlage_kurzbz = ".$this->ci->VorlageModel->escape($vorlage_kurzbz);
if (is_null($sprache))
{
$where .= " AND sprache IS NULL";
@@ -152,60 +152,60 @@ class VorlageLib
{
$where .= " AND sprache = ".$this->ci->VorlageModel->escape($sprache);
}
$where .= " AND aktiv = true";
return $where;
}
}
/**
* insertVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
public function insertVorlagetext($data)
* insertVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
public function insertVorlagetext($data)
{
$vorlagetext = $this->ci->VorlageStudiengangModel->insert($data);
return $vorlagetext;
}
$vorlagetext = $this->ci->VorlageStudiengangModel->insert($data);
return $vorlagetext;
}
/**
* loadVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
public function getVorlagetextById($vorlagestudiengang_id)
* loadVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
public function getVorlagetextById($vorlagestudiengang_id)
{
$vorlagetext = $this->ci->VorlageStudiengangModel->load($vorlagestudiengang_id);
return $vorlagetext;
}
$vorlagetext = $this->ci->VorlageStudiengangModel->load($vorlagestudiengang_id);
return $vorlagetext;
}
/**
* saveVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
public function updateVorlagetext($vorlagestudiengang_id, $data)
* saveVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
public function updateVorlagetext($vorlagestudiengang_id, $data)
{
$vorlagetext = $this->ci->VorlageStudiengangModel->update($vorlagestudiengang_id, $data);
return $vorlagetext;
}
$vorlagetext = $this->ci->VorlageStudiengangModel->update($vorlagestudiengang_id, $data);
return $vorlagetext;
}
/**
* parseVorlagetext() - will parse a Vorlagetext.
*
* @param string $text REQUIRED
* @param array $data REQUIRED
* @return string
*/
public function parseVorlagetext($text, $data = array())
* parseVorlagetext() - will parse a Vorlagetext.
*
* @param string $text REQUIRED
* @param array $data REQUIRED
* @return string
*/
public function parseVorlagetext($text, $data = array())
{
if (empty($text))
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
if (empty($text))
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
$text = $this->ci->parser->parse_string($text, $data, true);
return $text;
}
}
}
+14 -16
View File
@@ -17,31 +17,29 @@ class PersonLock_model extends DB_Model
}
/**
* checks if a specific person is locked. By default, looks for any entries in locktable for the person.
* Alternatively, looks only for locks in a certain app
* Checks if a specific person is locked. By default, looks for entries with no app in locktable for the person.
* Alternatively, looks only for locks in a certain app.
* @param $person_id
* @param null $app
* @return array all locks for a person if locked, null otherwise
*/
public function checkIfLocked($person_id, $app = null)
{
$lockdata = $app === null ? array('person_id' => $person_id) : array('person_id' => $person_id, 'app' => $app);
$lockdata = array('person_id' => $person_id, 'app' => $app);
$result = $this->loadWhere($lockdata);
if($result->error)
if ($result->error)
return error($result->retval);
if (count($result->retval) > 0)
return success($result->retval);
else
{
if(count($result->retval) > 0)
return success($result->retval);
else
return success(null);
}
return success(null);
}
/**
* locks a person. returns null if person was not locked (e.g. when already locked)
* Locks a person. Returns null if person was not locked (e.g. when already locked).
* @param $person_id
* @param $uid user who locks the person
* @param $app optional, application in which person is locked
@@ -51,19 +49,19 @@ class PersonLock_model extends DB_Model
{
$locked = $this->checkIfLocked($person_id, $app);
if($locked->error)
if ($locked->error)
return error($locked->retval);
//insert only if not already locked
if($locked->retval === null)
if ($locked->retval === null)
return $this->insert(array('person_id' => $person_id, 'uid' => $uid, 'app' => $app));
else
return success(null);
}
/**
* remove a lock for a person. By default, removes any entries in locktable for the person
* Alternatively, removes only locks in a certain app
* Remove a lock for a person. By default, removes any entries in locktable for the person.
* Alternatively, removes only locks in a certain app.
* @param $person_id
* @param null $app
* @return array deleted lock ids if person was locked, null otherwise
@@ -79,7 +77,7 @@ class PersonLock_model extends DB_Model
foreach ($locks->retval as $lock)
{
$result = $this->delete($lock->lock_id);
if($result->error)
if ($result->error)
return error($result->retval);
$deleted[] = $lock;
@@ -261,6 +261,7 @@ class Recipient_model extends DB_Model
ks.kontakt as sender,
kr.kontakt as receiver,
mu.mitarbeiter_uid as employeeContact,
ms.mitarbeiter_uid as senderemployeeContact,
mr.person_id as receiver_id,
mr.token,
mm.subject,
@@ -278,7 +279,13 @@ class Recipient_model extends DB_Model
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)';
) mu ON (mu.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
) ms ON (ms.person_id = mm.person_id)';
$parametersArray = array($kontaktType, $kontaktType);
@@ -4,6 +4,7 @@
array(
'title' => 'Info Center',
'jquery' => true,
'jqueryui' => true,
'bootstrap' => true,
'fontawesome' => true,
'sbadmintemplate' => true,
@@ -1,4 +1,7 @@
<?php
$APP = 'infocenter';
$filterWidgetArray = array(
'query' => '
SELECT
@@ -60,8 +63,10 @@
AND ps.person_id = p.person_id
AND tbl_studiengang.typ in(\'b\')
LIMIT 1
) AS "AnzahlAbgeschickt"
) AS "AnzahlAbgeschickt",
pl.zeitpunkt AS "LockDate"
FROM public.tbl_person p
LEFT JOIN (SELECT person_id, zeitpunkt FROM system.tbl_person_lock WHERE app = \''.$APP.'\') pl USING(person_id)
WHERE
EXISTS(
SELECT 1
@@ -135,7 +140,24 @@
}
}
if ($fieldName == 'LockDate')
{
if ($datasetRaw->{$fieldName} == '01.01.1970 01:00:00')
{
$datasetRaw->{$fieldName} = 'Not locked';
}
}
return $datasetRaw;
},
'markRow' => function($datasetRaw) {
if ($datasetRaw->LockDate != '')
{
return true;
}
return false;
}
);
@@ -147,7 +169,7 @@
}
else
{
$filterWidgetArray['app'] = 'infocenter';
$filterWidgetArray['app'] = $APP;
$filterWidgetArray['datasetName'] = 'PersonActions';
$filterWidgetArray['filterKurzbz'] = 'InfoCenterNotSentApplicationAll';
}
@@ -36,7 +36,7 @@
?>
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="row<?php if($lockedbyother) echo ' alert-danger' ?>">
<div class="col-lg-8">
<h3 class="page-header">
Infocenter Details: <?php echo $stammdaten->vorname.' '.$stammdaten->nachname ?>
+4 -3
View File
@@ -27,7 +27,8 @@
</td>
</tr>
<tr>
<td>
<td valign="top">
<br>
<b>Message:</b>
</td>
<td>
@@ -38,7 +39,7 @@
</td>
</tr>
<?php
if ($isEmployee === false)
if ($isEmployee === false && $href != '')
{
?>
<tr>
@@ -48,7 +49,7 @@
</tr>
<?php
}
?>
?>
</table>
</center>
+155 -12
View File
@@ -1,5 +1,13 @@
<style>
.filter-name-title {
font-family: inherit;
font-size: 20px;
font-weight: bold;
line-height: 1.1;
color: black;
}
.filters-hidden-panel {
margin: 0 10px 10px 10px;
}
@@ -8,10 +16,105 @@
display: none !important;
}
.filter-select-fields-dnd-div {
height: 50px;
}
.filter-select-field-dnd-span {
border: 1px solid black;
border-radius: 7px;
margin-left: 3px;
margin-right: 3px;
padding: 10px;
}
.filter-select-field-dnd-span:hover {
cursor: move;
}
.filter-select-field-dnd-span a {
cursor: pointer;
}
.selection-before::before {
content: "";
position: absolute;
top: 0;
right: 100%;
height: 100%;
margin-right: 3px;
border-left: 2px solid #428bca;
}
.selection-after::after {
content: "";
position: absolute;
top: 0;
left: 100%;
height: 100%;
margin-left: 3px;
border-right: 2px solid #428bca;
}
</style>
<script language="Javascript" type="text/javascript">
$(document).ready(function() {
$(".filter-select-field-dnd-span").draggable({
containment: "parent",
cursor: "move",
opacity: 0.4,
revert: "invalid",
revertDuration: 200
});
$(".filter-select-field-dnd-span").droppable({
accept: ".filter-select-field-dnd-span",
over: function(event, ui) {
$(this).on("mousemove", function( event ) {
var padding = 20;
var elementCenter = $(this).offset().left + (padding + $(this).width() / 2);
console.log(elementCenter);
console.log(event.pageX);
if (event.pageX > elementCenter)
{
$(this).addClass("selection-after");
$(this).removeClass("selection-before");
}
else if (event.pageX < elementCenter)
{
$(this).addClass("selection-before");
$(this).removeClass("selection-after");
}
});
},
out: function(event, ui) {
$(this).off("mousemove");
$(this).removeClass("selection-before");
$(this).removeClass("selection-after");
},
drop: function(event, ui) {
var padding = 20;
var elementCenter = $(this).offset().left + (padding + $(this).width() / 2);
if (event.pageX > elementCenter)
{
$(this).insertBefore(ui.draggable);
}
else if (event.pageX < elementCenter)
{
$(this).insertAfter(ui.draggable);
}
$(this).off("mousemove");
$(this).removeClass("selection-before");
$(this).removeClass("selection-after");
}
});
$("#addField").change(function() {
$("#filterForm").submit();
});
@@ -54,34 +157,74 @@
$("#filterForm").submit();
});
$("[data-toggle='collapse']").click(function() {
var filterOptionsStatus = sessionStorage.getItem('filter-options-status');
if (filterOptionsStatus != null && filterOptionsStatus == 'closed')
{
sessionStorage.setItem('filter-options-status', 'open');
}
else
{
sessionStorage.setItem('filter-options-status', 'closed');
}
});
var filterOptionsStatus = sessionStorage.getItem('filter-options-status');
if (filterOptionsStatus != null && filterOptionsStatus == 'open')
{
$('.collapse').collapse("show");
}
});
</script>
<div class="row">
<div class="col-lg-12">
<form class="form-inline" id="filterForm" method="POST" action="<?php echo current_url(); ?>">
<div>
<?php FilterWidget::loadViewSelectFields($listFields); ?>
</div>
<div>
<?php FilterWidget::loadViewSelectFilters($metaData); ?>
</div>
<?php FilterWidget::displayFilterName(); ?>
<div>
<?php FilterWidget::loadViewSaveFilter(); ?>
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapseFilterHeader">Filter options</a>
</h4>
</div>
<div id="collapseFilterHeader" class="panel-collapse collapse">
<div class="filters-hidden-panel">
<div>
<?php FilterWidget::loadViewSelectFields($listFields); ?>
</div>
<br>
<div>
<?php FilterWidget::loadViewSelectFilters($metaData); ?>
</div>
<br>
<div>
<?php FilterWidget::loadViewSaveFilter(); ?>
</div>
</div>
</div>
</div>
</div>
<br>
<div id="datasetActionsTop">
</div>
<div id="datasetActionsTop"></div>
<div>
<?php FilterWidget::loadViewTableDataset($dataset); ?>
</div>
<div id="datasetActionsBottom">
</div>
<div id="datasetActionsBottom"></div>
</form>
</div>
</div>
@@ -1,63 +1,54 @@
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapseSelectFields">Select columns</a>
</h4>
</div>
<div id="collapseSelectFields" class="panel-collapse collapse">
<div class="filters-hidden-panel">
<div>
<?php
$selectedFields = FilterWidget::getSelectedFields();
$columnsAliases = FilterWidget::getColumnsAliases();
<div id="filterSelectFieldsDnd" class="filter-select-fields-dnd-div">
<?php
$selectedFields = FilterWidget::getSelectedFields();
$columnsAliases = FilterWidget::getColumnsAliases();
for ($selectedFieldsCounter = 0; $selectedFieldsCounter < count($selectedFields); $selectedFieldsCounter++)
{
$selectedField = $selectedFields[$selectedFieldsCounter];
$selectedFieldAlias = $selectedField;
for ($selectedFieldsCounter = 0; $selectedFieldsCounter < count($selectedFields); $selectedFieldsCounter++)
{
$selectedField = $selectedFields[$selectedFieldsCounter];
$selectedFieldAlias = $selectedField;
if ($columnsAliases != null)
{
$indx = array_search($selectedField, $listFields);
if ($indx !== false)
{
$selectedFieldAlias = $columnsAliases[$indx];
}
}
?>
<input type="button" value="<?php echo $selectedFieldAlias; ?> X" class="remove-field" fieldToRemove="<?php echo $selectedField; ?>">
<?php
}
?>
<input type="hidden" id="<?php echo FilterWidget::CMD_REMOVE_FIELD; ?>" name="<?php echo FilterWidget::CMD_REMOVE_FIELD; ?>" value="">
</div>
<div>
<span>
Add field:
</span>
<span>
<select id="<?php echo FilterWidget::CMD_ADD_FIELD; ?>" name="<?php echo FilterWidget::CMD_ADD_FIELD; ?>">
<option value="">Select a field to add..</option>
<?php
for ($listFieldsCounter = 0; $listFieldsCounter < count($listFields); $listFieldsCounter++)
{
$listField = $listFields[$listFieldsCounter];
$listFieldAlias = $listField;
if ($columnsAliases != null)
{
$listFieldAlias = $columnsAliases[$listFieldsCounter];
}
?>
<option value="<?php echo $listField; ?>"><?php echo $listFieldAlias; ?></option>
<?php
}
?>
</select>
</span>
</div>
</div>
</div>
</div>
if ($columnsAliases != null)
{
$indx = array_search($selectedField, $listFields);
if ($indx !== false)
{
$selectedFieldAlias = $columnsAliases[$indx];
}
}
?>
<span class="filter-select-field-dnd-span">
<?php echo $selectedFieldAlias; ?>
<a class="remove-field" fieldToRemove="<?php echo $selectedField; ?>">X</a>
<input type="hidden" name="<?php echo $selectedField; ?>" value="<?php echo $selectedField; ?>">
</span>
<?php
}
?>
</div>
<input type="hidden" id="<?php echo FilterWidget::CMD_REMOVE_FIELD; ?>" name="<?php echo FilterWidget::CMD_REMOVE_FIELD; ?>" value="">
<div>
<span>
Add field:
</span>
<span>
<select id="<?php echo FilterWidget::CMD_ADD_FIELD; ?>" name="<?php echo FilterWidget::CMD_ADD_FIELD; ?>">
<option value="">Select a field to add..</option>
<?php
for ($listFieldsCounter = 0; $listFieldsCounter < count($listFields); $listFieldsCounter++)
{
$listField = $listFields[$listFieldsCounter];
$listFieldAlias = $listField;
if ($columnsAliases != null)
{
$listFieldAlias = $columnsAliases[$listFieldsCounter];
}
?>
<option value="<?php echo $listField; ?>"><?php echo $listFieldAlias; ?></option>
<?php
}
?>
</select>
</span>
</div>
@@ -1,82 +1,69 @@
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapseSelectFilters">Select filters</a>
</h4>
</div>
<div id="collapseSelectFilters" class="panel-collapse collapse">
<div class="filters-hidden-panel">
<div>
<?php
$selectedFilters = FilterWidget::getSelectedFilters();
$columnsAliases = FilterWidget::getColumnsAliases();
<div>
<?php
$selectedFilters = FilterWidget::getSelectedFilters();
$columnsAliases = FilterWidget::getColumnsAliases();
for ($filtersCounter = 0; $filtersCounter < count($selectedFilters); $filtersCounter++)
{
$selectedFilter = $selectedFilters[$filtersCounter];
for ($filtersCounter = 0; $filtersCounter < count($selectedFilters); $filtersCounter++)
{
$selectedFilter = $selectedFilters[$filtersCounter];
$md = FilterWidget::getFilterMetaData($selectedFilter, $metaData);
$selectedFieldAlias = $md->name;
$md = FilterWidget::getFilterMetaData($selectedFilter, $metaData);
$selectedFieldAlias = $md->name;
if ($columnsAliases != null)
{
$indx = array_search($selectedFilter, $listFields);
if ($indx !== false)
{
$selectedFieldAlias = $columnsAliases[$indx];
}
}
if ($columnsAliases != null)
{
$indx = array_search($selectedFilter, $listFields);
if ($indx !== false)
{
$selectedFieldAlias = $columnsAliases[$indx];
}
}
?>
<div>
?>
<div>
<span>
<?php echo $selectedFieldAlias; ?>
</span>
<span>
<?php echo $selectedFieldAlias; ?>
</span>
<?php echo FilterWidget::renderFilterType($md); ?>
<?php echo FilterWidget::renderFilterType($md); ?>
<span>
<input type="button" value="X" class="remove-filter" filterToRemove="<?php echo $md->name; ?>">
</span>
<span>
<input type="button" value="X" class="remove-filter" filterToRemove="<?php echo $md->name; ?>">
</span>
</div>
<?php
}
?>
<input type="hidden" id="<?php echo FilterWidget::CMD_REMOVE_FILTER; ?>" name="<?php echo FilterWidget::CMD_REMOVE_FILTER; ?>" value="">
</div>
<div>
<span>
Add filter:
</span>
<span>
<select id="<?php echo FilterWidget::CMD_ADD_FILTER; ?>" name="<?php echo FilterWidget::CMD_ADD_FILTER; ?>">
<option value="">Select a filter to add...</option>
<?php
for ($listFieldsCounter = 0; $listFieldsCounter < count($listFields); $listFieldsCounter++)
{
$field = $listFields[$listFieldsCounter];
$listFieldAlias = $field;
if ($columnsAliases != null)
{
$listFieldAlias = $columnsAliases[$listFieldsCounter];
}
?>
<option value="<?php echo $field; ?>"><?php echo $listFieldAlias; ?></option>
<?php
}
?>
</select>
</span>
<span>
<input id="applyFilter" name="applyFilter" type="button" value="Apply">
</span>
</div>
</div>
</div>
<?php
}
?>
<input type="hidden" id="<?php echo FilterWidget::CMD_REMOVE_FILTER; ?>" name="<?php echo FilterWidget::CMD_REMOVE_FILTER; ?>" value="">
</div>
<div>
<span>
Add filter:
</span>
<span>
<select id="<?php echo FilterWidget::CMD_ADD_FILTER; ?>" name="<?php echo FilterWidget::CMD_ADD_FILTER; ?>">
<option value="">Select a filter to add...</option>
<?php
for ($listFieldsCounter = 0; $listFieldsCounter < count($listFields); $listFieldsCounter++)
{
$field = $listFields[$listFieldsCounter];
$listFieldAlias = $field;
if ($columnsAliases != null)
{
$listFieldAlias = $columnsAliases[$listFieldsCounter];
}
?>
<option value="<?php echo $field; ?>"><?php echo $listFieldAlias; ?></option>
<?php
}
?>
</select>
</span>
<span>
<input id="applyFilter" name="applyFilter" type="button" value="Apply">
</span>
</div>
</div>
@@ -55,7 +55,7 @@
{
$result = $results[$resultsCounter];
?>
<tr>
<tr class="<?php echo FilterWidget::markRow($result); ?>">
<?php
if ($checkboxes != null)
{
+105 -2
View File
@@ -13,6 +13,8 @@ class FilterWidget extends Widget
const DB_RESULT = 'dbResult';
const ADDITIONAL_COLUMNS = 'additionalColumns';
const FORMAT_RAW = 'formatRaw';
const MARK_ROW = 'markRow';
const ALTERNATIVE_MARK_ROW_CLASS = 'alternativeMarkRowClass';
const CHECKBOXES = 'checkboxes';
const HIDE_HEADER = 'hideHeader';
const HIDE_SAVE = 'hideSave';
@@ -35,6 +37,7 @@ class FilterWidget extends Widget
const ACTIVE_FILTERS = 'activeFilters';
const ACTIVE_FILTERS_OPTION = 'activeFiltersOption';
const ACTIVE_FILTERS_OPERATION = 'activeFiltersOperation';
const FILTER_NAME = 'filterName';
const ACTIVE_FILTER_OPTION_POSTFIX = '-option';
const ACTIVE_FILTER_OPERATION_POSTFIX = '-operation';
@@ -60,6 +63,8 @@ class FilterWidget extends Widget
const DEFAULT_DATE_FORMAT = 'd.m.Y H:i:s';
const DEFAULT_MARK_ROW_CLASS = 'text-danger';
private $app;
private $query;
private $datasetName;
@@ -67,8 +72,11 @@ class FilterWidget extends Widget
private $filterId;
private $additionalColumns;
private $formatRaw;
private $markRow;
private $alternativeMarkRowClass;
private $checkboxes;
private $columnsAliases;
private $filterName;
private $dataset;
private $metaData;
@@ -108,6 +116,12 @@ class FilterWidget extends Widget
$this->filterId = $filterSessionArray[self::FILTER_ID];
}
//
if ($this->filterName == null && isset($filterSessionArray[self::FILTER_NAME]))
{
$this->filterName = $filterSessionArray[self::FILTER_NAME];
}
//
if ($filterSessionArray[self::FILTER_ID] != $this->filterId)
{
@@ -385,6 +399,37 @@ class FilterWidget extends Widget
return $tmpDatasetRaw;
}
/**
*
*/
public static function markRow($datasetRaw)
{
$class = '';
if (is_object($datasetRaw))
{
$markRow = self::$FilterWidgetInstance->getMarkRow();
if ($markRow != null)
{
if ($markRow($datasetRaw) === true)
{
$alternativeMarkRowClass = self::$FilterWidgetInstance->getAlternativeMarkRowClass();
if ($alternativeMarkRowClass != null)
{
$class = $alternativeMarkRowClass;
}
else
{
$class = self::DEFAULT_MARK_ROW_CLASS;
}
}
}
}
return $class;
}
/**
*
*/
@@ -393,6 +438,17 @@ class FilterWidget extends Widget
return self::$FilterWidgetInstance->_getCheckboxes();
}
/**
*
*/
public static function displayFilterName()
{
if (self::$FilterWidgetInstance->filterName != null && self::$FilterWidgetInstance->filterName != '')
{
echo '<div class="filter-name-title">'.self::$FilterWidgetInstance->filterName.'</div><br>';
}
}
//------------------------------------------------------------------------------------------------------------------
// Protected
@@ -419,6 +475,22 @@ class FilterWidget extends Widget
return $this->formatRaw;
}
/**
*
*/
protected function getMarkRow()
{
return $this->markRow;
}
/**
*
*/
protected function getAlternativeMarkRowClass()
{
return $this->alternativeMarkRowClass;
}
/**
*
*/
@@ -559,6 +631,11 @@ class FilterWidget extends Widget
$filterSessionArray[self::COLUMNS_ALIASES] = array();
}
if (!isset($filterSessionArray[self::FILTER_NAME]))
{
$filterSessionArray[self::FILTER_NAME] = null;
}
$this->session->set_userdata(self::SESSION_NAME, $filterSessionArray);
}
@@ -574,10 +651,13 @@ class FilterWidget extends Widget
$this->filterId = null;
$this->additionalColumns = null;
$this->formatRaw = null;
$this->markRow = null;
$this->alternativeMarkRowClass = null;
$this->checkboxes = null;
$this->hideHeader = false;
$this->hideSave = false;
$this->columnsAliases = null;
$this->filterName = null;
if (!is_array($args) || (is_array($args) && count($args) == 0))
{
@@ -638,6 +718,16 @@ class FilterWidget extends Widget
$this->formatRaw = $args[self::FORMAT_RAW];
}
if (isset($args[self::MARK_ROW]) && is_callable($args[self::MARK_ROW]))
{
$this->markRow = $args[self::MARK_ROW];
}
if (isset($args[self::ALTERNATIVE_MARK_ROW_CLASS]) && $args[self::ALTERNATIVE_MARK_ROW_CLASS] != '')
{
$this->alternativeMarkRowClass = $args[self::ALTERNATIVE_MARK_ROW_CLASS];
}
if (isset($args[self::CHECKBOXES])
&& is_array($args[self::CHECKBOXES])
&& count($args[self::CHECKBOXES]) > 0)
@@ -723,6 +813,7 @@ class FilterWidget extends Widget
$activeFilters = array();
$activeFiltersOperation = array();
$activeFiltersOption = array();
$filterName = null;
if (isset($jsonEncodedFilter->columns))
{
@@ -756,12 +847,20 @@ class FilterWidget extends Widget
}
}
if (isset($jsonEncodedFilter->name))
{
$filterName = $jsonEncodedFilter->name;
}
$this->filterName = $filterName;
$filterSessionArray = array(
self::SELECTED_FIELDS => $selectedFields,
self::SELECTED_FILTERS => $selectedFilters,
self::ACTIVE_FILTERS => $activeFilters,
self::ACTIVE_FILTERS_OPERATION => $activeFiltersOperation,
self::ACTIVE_FILTERS_OPTION => $activeFiltersOption
self::ACTIVE_FILTERS_OPTION => $activeFiltersOption,
self::FILTER_NAME => $filterName
);
$this->session->set_userdata(self::SESSION_NAME, $filterSessionArray);
@@ -773,7 +872,8 @@ class FilterWidget extends Widget
self::SELECTED_FILTERS => array(),
self::ACTIVE_FILTERS => array(),
self::ACTIVE_FILTERS_OPERATION => array(),
self::ACTIVE_FILTERS_OPTION => array()
self::ACTIVE_FILTERS_OPTION => array(),
self::FILTER_NAME => null
);
$this->session->set_userdata(self::SESSION_NAME, $filterSessionArray);
@@ -1038,6 +1138,7 @@ class FilterWidget extends Widget
);
$filterSessionArray[self::FILTER_ID] = $this->filterId;
$filterSessionArray[self::FILTER_NAME] = $this->filterName;
$this->session->set_userdata(self::SESSION_NAME, $filterSessionArray);
}
@@ -1130,9 +1231,11 @@ class FilterWidget extends Widget
}
break;
case self::OP_CONTAINS:
$activeFilterValue = $this->FiltersModel->escapeLike($activeFilterValue); // escapes
$condition = ' ILIKE \'%'.$activeFilterValue.'%\'';
break;
case self::OP_NOT_CONTAINS:
$activeFilterValue = $this->FiltersModel->escapeLike($activeFilterValue); // escapes
$condition = ' NOT ILIKE \'%'.$activeFilterValue.'%\'';
break;
case self::OP_IS_TRUE: