Merge branch 'master' into permissions

This commit is contained in:
Paolo
2018-04-18 17:35:33 +02:00
93 changed files with 6590 additions and 4328 deletions
@@ -439,6 +439,11 @@ class Filters extends CI_Controller
$filterOperationValues = $this->input->post('filterOperationValues');
$filterOptions = $this->input->post('filterOptions');
if ($fieldNames == null) $fieldNames = array();
if ($filterOperationValues == null) $filterOperationValues = array();
if ($filterOperations == null) $filterOperations = array();
if ($filterOptions == null) $filterOptions = array();
$activeFilters = array_combine($fieldNames, $filterOperationValues);
$activeFiltersOperation = array_combine($fieldNames, $filterOperations);
$activeFiltersOption = array_combine($fieldNames, $filterOptions);
+96 -14
View File
@@ -10,7 +10,7 @@ class Navigation extends FHC_Controller
const SESSION_NAME = 'NAVIGATION_MENU';
/**
*
* Constructor
*/
public function __construct()
{
@@ -23,12 +23,15 @@ class Navigation extends FHC_Controller
$this->config->load('navigation');
// Load session library
$this->load->library('session');
}
// Load session library
$this->load->library('session');
$this->load->library('ExtensionsLib');
}
/**
*
* This function creates the left Menu for each Page
* @param navigation_widget_called GET Parameter witch holds the currently called Page
* @return JSON object with the Menu Entries
*/
public function menu()
{
@@ -37,16 +40,33 @@ class Navigation extends FHC_Controller
if (isset($navigation_widget_called))
{
// Get Menu Entries of the Core
$navigationMenuArray = $this->config->item('navigation_menu');
$json = $this->wildcardsearch($navigationMenuArray, $navigation_widget_called);
if (isset($navigationMenuArray) && is_array($navigationMenuArray))
// Load Menu Entries of Extensions
$extensions = $this->extensionslib->getInstalledExtensions();
if(hasData($extensions))
{
if (isset($navigationMenuArray[$navigation_widget_called]))
$json_extension = array();
foreach($extensions->retval as $ext)
{
$json = $navigationMenuArray[$navigation_widget_called];
$filename = APPPATH.'config/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$ext->name.'/navigation.php';
if (file_exists($filename))
{
unset($config);
include($filename);
if(isset($config['navigation_menu']) && is_array($config['navigation_menu']))
{
$json_extension = array_merge_recursive($json_extension, $this->wildcardsearch($config['navigation_menu'], $navigation_widget_called));
}
}
}
// Merge Extension Menuentries with the Core Entries
$json = array_merge_recursive($json, $json_extension);
}
// Load dynamic Menu Entries from Session
if (isset($_SESSION['navigation_menu']))
{
$navigationMenuSessionArray = $_SESSION['navigation_menu'];
@@ -55,7 +75,7 @@ class Navigation extends FHC_Controller
{
if (isset($navigationMenuSessionArray[$navigation_widget_called]))
{
$json = array_merge($json, $navigationMenuSessionArray[$navigation_widget_called]);
$json = array_merge_recursive($json, $navigationMenuSessionArray[$navigation_widget_called]);
}
}
}
@@ -65,7 +85,9 @@ class Navigation extends FHC_Controller
}
/**
*
* This function creates the Top Menu for each Page
* @param navigation_widget_called GET Parameter witch holds the currently called Page
* @return JSON object with the Menu Entries
*/
public function header()
{
@@ -74,16 +96,32 @@ class Navigation extends FHC_Controller
if (isset($navigation_widget_called))
{
// Load Header Entries of Core
$navigationHeaderArray = $this->config->item('navigation_header');
$json = $this->wildcardsearch($navigationHeaderArray, $navigation_widget_called);
if (isset($navigationHeaderArray) && is_array($navigationHeaderArray))
// Load Header Entries of Extensions
$extensions = $this->extensionslib->getInstalledExtensions();
if(hasData($extensions))
{
if (isset($navigationHeaderArray[$navigation_widget_called]))
$json_extension = array();
foreach($extensions->retval as $ext)
{
$json = $navigationHeaderArray[$navigation_widget_called];
$filename = APPPATH.'config/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$ext->name.'/navigation.php';
if (file_exists($filename))
{
unset($config);
include($filename);
if(isset($config['navigation_header']) && is_array($config['navigation_header']))
{
$json_extension = array_merge_recursive($json_extension, $this->wildcardsearch($config['navigation_header'], $navigation_widget_called));
}
}
}
$json = array_merge_recursive($json, $json_extension);
}
// Load dynamic Header Entries from Session
if (isset($_SESSION['navigation_header']))
{
$navigationHeaderSessionArray = $_SESSION['navigation_header'];
@@ -92,7 +130,8 @@ class Navigation extends FHC_Controller
{
if (isset($navigationHeaderSessionArray[$navigation_widget_called]))
{
$json = array_merge($json, $navigationHeaderSessionArray[$navigation_widget_called]);
$jsontmp = $this->wildcardsearch($navigationHeaderSessionArray, $navigation_widget_called);
$json = array_merge_recursive($json, $jsontmp);
}
}
}
@@ -100,4 +139,47 @@ class Navigation extends FHC_Controller
$this->output->set_content_type('application/json')->set_output(json_encode($json));
}
/**
* Searches a Menuentry. If there is no exact entry it searches for Wildcard Entries with a Star
* Example:
* Searching for /system/foo/index will Match the following Menuentries:
* /system/foo/index
* /system/foo/*
* /system/*
* *
*
* @param $navigationArray Array to Search in.
* @param $navigation_widget_called Navigation to search for.
* @return Navigation Array if found, empty array otherwise
*/
private function wildcardsearch($navigationArray, $navigation_widget_called)
{
// Sort Navigation to have them in correct order
krsort($navigationArray);
// 100% match found
if(isset($navigationArray[$navigation_widget_called]))
{
return $navigationArray[$navigation_widget_called];
}
else
{
foreach($navigationArray as $key=>$row)
{
// Search for * Entries
if(mb_strpos($key, '*') === 0 || mb_strpos($key, '*') === mb_strlen($key) - 1)
{
// Take * Entry if Matches
$search = mb_substr($key, 0, -1);
if($search == '' || mb_strpos($navigation_widget_called, $search) === 0)
{
return $row;
}
}
}
}
return array();
}
}
+80 -41
View File
@@ -1,9 +1,12 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
class Phrases extends FHC_Controller
{
/**
*
*/
public function __construct()
{
parent::__construct(
@@ -31,107 +34,133 @@ class Phrases extends FHC_Controller
$this->load->helper('message');
}
/**
*
*/
public function index()
{
$this->load->view('system/phrases.php');
$this->load->view('system/phrases/phrases.php');
}
/**
*
*/
public function table()
{
$phrases = $this->phraseslib->getPhraseByApp('aufnahme');
if ($phrases->error)
show_error($phrases->retval);
//var_dump($vorlage);
$data = array
(
$data = array(
'app' => 'aufnahme',
'phrases' => $phrases->retval
);
$v = $this->load->view('system/phrasesList.php', $data);
$this->load->view('system/phrases/phrasesList.php', $data);
}
public function view($phrase_id = null)
/**
*
*/
public function view($phrase_id)
{
if (empty($phrase_id))
exit;
$phrase_inhalt = $this->phraseslib->getPhraseInhalt($phrase_id);
show_error('Invalid phrase_id parameter');
$phrase = $this->phraseslib->getPhrase($phrase_id);
$phrase_inhalt = $this->phraseslib->getPhraseInhalt($phrase_id);
if ($phrase_inhalt->error)
show_error($phrase_inhalt->retval);
//var_dump($vorlage);
$data = array
(
$data = array(
'phrase_id' => $phrase_id,
'phrase' => $phrase->retval[0]->phrase,
'phrase_inhalt' => $phrase_inhalt->retval
);
$v = $this->load->view('system/phrasesinhaltList.php', $data);
$this->load->view('system/phrases/phrasesinhaltList.php', $data);
}
public function deltext($phrasentext_id=null, $phrase_id = null)
/**
*
*/
public function deltext($phrasentext_id, $phrase_id)
{
if (empty($phrase_id) or empty($phrasentext_id))
exit;
if (empty($phrasentext_id) || empty($phrase_id))
show_error('Invalid phrasentext_id or phrase_id parameter');
$phrase_inhalt = $this->phraseslib->delPhrasentext($phrasentext_id);
if ($phrase_inhalt->error)
show_error($phrase_inhalt->retval);
//var_dump($vorlage);
redirect('/system/Phrases/view/'.$phrase_id);
}
/**
*
*/
public function edit($phrase_id = null)
{
if (empty($phrase_id))
exit;
if (empty($phrase_id)) return;
$phrase = $this->phraseslib->getPhrase($phrase_id);
//var_dump($vorlage);
if ($phrase->error)
show_error($phrase->retval);
if (count($phrase->retval) != 1)
show_error('Phrase nicht vorhanden! ID: '.$phrase_id);
$data = array
(
$data = array(
'phrase' => $phrase->retval[0]
);
//var_dump($data['message']);
$v = $this->load->view('system/phrasesEdit', $data);
$this->load->view('system/phrases/phrasesEdit', $data);
}
public function write($vorlage_kurzbz = null)
/**
*
*/
public function write()
{
$data = array
(
$data = array(
'subject' => 'TestSubject',
'body' => 'TestDevelopmentBodyText'
);
$v = $this->load->view('system/messageWrite', $data);
$this->load->view('system/messageWrite', $data);
}
/**
*
*/
public function save()
{
$phrase_id = $this->input->post('phrase_id');
$data['phrase'] = $this->input->post('phrase');
$data = array('phrase' => $this->input->post('phrase'));
$phrase = $this->phraseslib->savePhrase($phrase_id, $data);
if ($phrase->error)
show_error($phrase->retval);
$phrase_id = $phrase->retval;
redirect('/system/Phrases/edit/'.$phrase_id);
}
/**
*
*/
public function newText()
{
$phrase_id = $this->input->post('phrase_id');
$this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel');
$this->OrganisationseinheitModel->addLimit(1);
$this->OrganisationseinheitModel->addOrder('oe_kurzbz');
$resultOE = $this->OrganisationseinheitModel->loadWhere(array('aktiv' => true, 'oe_parent_kurzbz' => null));
$resultOE = $this->OrganisationseinheitModel->loadWhere(array('aktiv' => true, 'oe_parent_kurzbz' => null));
if ($resultOE->error)
show_error($resultOE->retval);
@@ -139,7 +168,7 @@ class Phrases extends FHC_Controller
{
$orgeinheit_kurzbz = $resultOE->retval[0]->oe_kurzbz;
$data = array (
$data = array(
'phrase_id' => $phrase_id,
'sprache' => 'German',
'text' => '',
@@ -161,30 +190,40 @@ class Phrases extends FHC_Controller
}
}
/**
*
*/
public function editText($phrasentext_id)
{
$phrase_inhalt = $this->phraseslib->getPhrasentextById($phrasentext_id);
if ($phrase_inhalt->error)
show_error($phrase_inhalt->retval);
$data = $phrase_inhalt->retval[0];
$this->load->view('system/phraseinhaltEdit', $data);
$this->load->view('system/phrases/phraseinhaltEdit', $data);
}
/**
*
*/
public function saveText()
{
$phrase_inhalt_id = $this->input->post('phrase_inhalt_id');
$data['orgeinheit_kurzbz'] = $this->input->post('oe_kurzbz');
$data['orgform_kurzbz'] = $this->input->post('orgform_kurzbz');
$data['text'] = $this->input->post('text');
$data['description'] = $this->input->post('description');
$data['sprache'] = $this->input->post('sprache');
$data = array(
'orgeinheit_kurzbz' => $this->input->post('oe_kurzbz'),
'orgform_kurzbz' => $this->input->post('orgform_kurzbz'),
'text' => $this->input->post('text'),
'description' => $this->input->post('description'),
'sprache' => $this->input->post('sprache')
);
$phrase_inhalt = $this->phraseslib->updatePhraseInhalt($phrase_inhalt_id, $data);
if ($phrase_inhalt->error)
show_error($phrase_inhalt->retval);
$data['phrase_inhalt_id'] = $phrase_inhalt_id;
redirect('/system/Phrases/editText/'.$phrase_inhalt_id);
//$this->load->view('system/templatetextEdit', $data);
}
redirect('/system/Phrases/editText/'.$phrase_inhalt_id);
}
}
@@ -24,9 +24,9 @@ class Manager extends FHC_Controller
// Load helpers to upload files
$this->load->helper(array('form', 'url'));
// Loads the extensions library
$this->load->library('ExtensionsLib');
}
// Loads the extensions library
$this->load->library('ExtensionsLib');
}
/**
*
@@ -42,6 +42,11 @@ class InfoCenter extends FHC_Controller
'logtype' => 'Action',
'name' => 'Note added',
'message' => 'Note with title %s was added'
),
'updatenotiz' => array(
'logtype' => 'Action',
'name' => 'Note updated',
'message' => 'Note with title %s was updated'
)
);
private $uid; // contains the UID of the logged user
@@ -103,7 +108,12 @@ class InfoCenter extends FHC_Controller
{
$this->load->view('system/infocenter/infocenter.php');
}
public function infocenterFreigegeben()
{
$this->load->view('system/infocenter/infocenterFreigegeben.php');
}
/**
* Initialization function, gets person and prestudent data and loads the view with the data
* @param $person_id
@@ -137,7 +147,7 @@ class InfoCenter extends FHC_Controller
)
);
}
/**
* unlocks page from edit by a person, redirects to overview filter page
* @param $person_id
@@ -367,7 +377,7 @@ class InfoCenter extends FHC_Controller
$this->_redirectToStart($prestudent_id, 'ZgvPruef');
}
/**
* Saves a new Notiz for a person
* @param $person_id
@@ -391,6 +401,44 @@ class InfoCenter extends FHC_Controller
->set_content_type('application/json')
->set_output(json_encode($result->retval));
}
/**
* Updates a new Notiz for a person
* @param int $notiz_id
* @param int $person_id
* @return bool true if success
*/
public function updateNotiz($notiz_id, $person_id)
{
$titel = $this->input->post('notiztitel');
$text = $this->input->post('notiz');
$result = $this->NotizModel->update(
$notiz_id,
array(
'titel' => $titel,
'text' => $text,
'verfasser_uid' => $this->uid,
"updateamum" => 'NOW()',
"updatevon" => $this->uid
)
);
$json = FALSE;
if (isSuccess($result))
{
$json = TRUE;
//set log "Notiz updated"
$this->_log($person_id, 'updatenotiz', array($titel));
}
$this->output
->set_content_type('application/json')
->set_output(json_encode($json));
}
/**
* Loads Notizen view for a person, helper for reloading after ajax request
@@ -514,7 +562,7 @@ class InfoCenter extends FHC_Controller
'children' => array()
)
);
$this->_fillFilters($listFiltersSent, $filtersarray['abgeschickt']);
$this->_fillFilters($listFiltersNotSent, $filtersarray['nichtabgeschickt']);
@@ -562,7 +610,7 @@ class InfoCenter extends FHC_Controller
{
$toPrint = "%s=%s";
$tofill['children'][] = array(
'link' => sprintf($toPrint, base_url('index.ci.php/system/infocenter/InfoCenter?filter_id'), $filterId),
'link' => sprintf($toPrint, site_url('system/infocenter/InfoCenter?filter_id'), $filterId),
'description' => $description
);
}
@@ -574,13 +622,8 @@ class InfoCenter extends FHC_Controller
{
$toPrint = "%s=%s";
if ($this->router->method != 'index')
{
}
$tofill['children'][] = array(
'link' => sprintf($toPrint, base_url('index.ci.php/system/infocenter/InfoCenter?filter_id'), $filterId),
'link' => sprintf($toPrint, site_url('system/infocenter/InfoCenter?filter_id'), $filterId),
'description' => $description,
'subscriptDescription' => 'Remove',
'subscriptLinkClass' => 'remove-filter',
@@ -831,6 +874,8 @@ class InfoCenter extends FHC_Controller
$prestudentstatus = $prestudent->prestudentstatus;
$person_id = $prestudent->person_id;
$person = $this->PersonModel->getPersonStammdaten($person_id, true)->retval;
$dokumente = $this->AkteModel->getAktenWithDokInfo($person_id, null, false)->retval;
$dokumenteNachzureichen = $this->AkteModel->getAktenWithDokInfo($person_id, null, true)->retval;
//fill mail variables
$interessentbez = $person->geschlecht == 'm' ? 'Ein Interessent' : 'Eine Interessentin';
@@ -838,6 +883,25 @@ class InfoCenter extends FHC_Controller
$orgform = $prestudentstatus->orgform != '' ? ' ('.$prestudentstatus->orgform.')' : '';
$geschlecht = $person->geschlecht == 'm' ? 'm&auml;nnlich' : 'weiblich';
$geburtsdatum = date('d.m.Y', strtotime($person->gebdatum));
$zgvort = !empty($prestudent->zgvort) ? ' in '.$prestudent->zgvort : '';
$zgvnation = !empty($prestudent->zgvnation_bez) ? ', '.$prestudent->zgvnation_bez : '';
$zgvdatum = !empty($prestudent->zgvdatum) ? ', am '.date_format(date_create($prestudent->zgvdatum), 'd.m.Y') : '';
$dokumenteNachzureichenMail = $dokumenteMail = array();
//convert documents to array so they can be parsed, and keeping only needed fields
$lastel = end($dokumente);
foreach ($dokumente as $dokument)
{
$postfix = $lastel === $dokument ? '' : ' |';
$dokumenteMail[] = array('dokument_bezeichnung' => $dokument->dokument_bezeichnung.$postfix);
}
foreach ($dokumenteNachzureichen as $dokument)
{
$anmerkung = !empty($dokument->anmerkung) ? ' | Anmerkung: '.$dokument->anmerkung : '';
$nachgereichtam = !empty($dokument->nachgereicht_am) ? ' | wird nachgereicht bis '.date_format(date_create($dokument->nachgereicht_am), 'd.m.Y') : '';
$dokumenteNachzureichenMail[] = array('dokument_bezeichnung' => $dokument->dokument_bezeichnung, 'anmerkung' => $anmerkung, 'nachgereicht_am' => $nachgereichtam);
}
$notizenBewerbung = $this->NotizModel->getNotizByTitel($person_id, 'Anmerkung zur Bewerbung')->retval;
@@ -874,7 +938,13 @@ class InfoCenter extends FHC_Controller
'gebdatum' => $geburtsdatum,
'mailadresse' => $mailadresse,
'prestudentid' => $prestudent_id,
'notizentext' => $notizentext
'zgvbez' => $prestudent->zgv_bez,
'zgvort' => $zgvort,
'zgvdatum' => $zgvdatum,
'zgvnation' => $zgvnation,
'notizentext' => $notizentext,
'dokumente' => $dokumenteMail,
'dokumente_nachgereicht' => $dokumenteNachzureichenMail
);
$this->load->library('parser');
@@ -884,7 +954,7 @@ class InfoCenter extends FHC_Controller
//parse freigabe html email template, wordwrap wraps text so no display errors
$email = wordwrap($this->parser->parse('templates/mailtemplates/interessentFreigabe', $data, true), 70);
$subject = ($person->geschlecht == 'm' ? 'Interessent ' : 'Interessentin ').$person->vorname.' '.$person->nachname.' freigegeben';
$subject = ($person->geschlecht == 'm' ? 'Interessent ' : 'Interessentin ').$person->vorname.' '.$person->nachname.' für '.$prestudent->studiengangbezeichnung.$orgform.' freigegeben';
$receiver = $prestudent->studiengangmail;