mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-22 01:12:17 +00:00
Datenverbund
- Added new Page to Manage missing bPK - Improved Error Handling on DVB Class
This commit is contained in:
@@ -0,0 +1,199 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Page for checking Persons where no bPK was found automatically
|
||||
*/
|
||||
class BPKWartung extends Auth_Controller
|
||||
{
|
||||
private $_uid; // contains the UID of the logged user
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'admin:r',
|
||||
'showDetails' => 'admin:r',
|
||||
'saveBPK' => 'admin:rw',
|
||||
)
|
||||
);
|
||||
|
||||
// Loads models
|
||||
$this->load->model('crm/akte_model', 'AkteModel');
|
||||
$this->load->model('person/person_model', 'PersonModel');
|
||||
$this->load->model('person/adresse_model', 'AdressModel');
|
||||
|
||||
$this->load->library('WidgetLib');
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
'global',
|
||||
'person',
|
||||
'lehre',
|
||||
'ui',
|
||||
'infocenter',
|
||||
'filter'
|
||||
)
|
||||
);
|
||||
|
||||
$this->setControllerId(); // sets the controller id
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Main page of the InfoCenter tool
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->_setNavigationMenuIndex(); // define the navigation menu for this page
|
||||
|
||||
$this->load->view('person/bpk/bpkwartung.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Personal details page of the InfoCenter tool
|
||||
* Initialization function, gets person and prestudent data and loads the view with the data
|
||||
* @param $person_id
|
||||
*/
|
||||
public function showDetails()
|
||||
{
|
||||
$this->_setNavigationMenuShowDetails();
|
||||
$person_id = $this->input->get('person_id');
|
||||
|
||||
if (!is_numeric($person_id))
|
||||
show_error('person id is not numeric!');
|
||||
|
||||
$personexists = $this->PersonModel->load($person_id);
|
||||
|
||||
if (isError($personexists))
|
||||
show_error($personexists->retval);
|
||||
|
||||
if (!hasData($personexists))
|
||||
show_error('Person does not exist!');
|
||||
|
||||
$persondata = $this->_loadPersonData($person_id);
|
||||
|
||||
|
||||
$data[self::FHC_CONTROLLER_ID] = $this->getControllerId();
|
||||
|
||||
$this->load->view('person/bpk/bpkDetails.php', $persondata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a ZGV for a prestudent, includes Ort, Datum, Nation for bachelor and master
|
||||
* @param $prestudent_id
|
||||
*/
|
||||
public function saveBPK()
|
||||
{
|
||||
$person_id = $this->input->post('person_id');
|
||||
$bpk = $this->input->post('bpk');
|
||||
|
||||
if (isEmptyString($person_id))
|
||||
$result = error('PersonID missing');
|
||||
else
|
||||
{
|
||||
$result = $this->PersonModel->update(
|
||||
$person_id,
|
||||
array(
|
||||
'bpk' => $bpk,
|
||||
'updateamum' => date('Y-m-d H:i:s')
|
||||
)
|
||||
);
|
||||
redirect('person/BPKWartung/index');
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Loads all necessary Person data: Stammdaten (name, svnr, contact, ...), Dokumente, Logs and Notizen
|
||||
* @param $person_id
|
||||
* @return array
|
||||
*/
|
||||
private function _loadPersonData($person_id)
|
||||
{
|
||||
$stammdaten = $this->PersonModel->getPersonStammdaten($person_id, true);
|
||||
|
||||
if (isError($stammdaten))
|
||||
{
|
||||
show_error($stammdaten->retval);
|
||||
}
|
||||
|
||||
if (!isset($stammdaten->retval))
|
||||
return null;
|
||||
|
||||
$adresse = $this->AdressModel->getZustellAdresse($person_id);
|
||||
|
||||
if (isError($adresse))
|
||||
{
|
||||
show_error($adresse->retval);
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'stammdaten' => $stammdaten->retval,
|
||||
'adresse' => $adresse->retval[0]
|
||||
);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the navigation menu for the showDetails page
|
||||
*/
|
||||
private function _setNavigationMenuShowDetails()
|
||||
{
|
||||
$this->load->library('NavigationLib', array('navigation_page' => 'person/BPKWartung/showDetails'));
|
||||
|
||||
$link = site_url('person/BPKWartung');
|
||||
|
||||
$this->navigationlib->setSessionMenu(
|
||||
array(
|
||||
'back' => $this->navigationlib->oneLevel(
|
||||
'Zurück', // description
|
||||
$link, // link
|
||||
array(), // children
|
||||
'angle-left', // icon
|
||||
true, // expand
|
||||
null, // subscriptDescription
|
||||
null, // subscriptLinkClass
|
||||
null, // subscriptLinkValue
|
||||
'', // target
|
||||
1 // sort
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the navigation menu for the showDetails page
|
||||
*/
|
||||
private function _setNavigationMenuIndex()
|
||||
{
|
||||
$this->load->library('NavigationLib', array('navigation_page' => 'person/BPKWartung/index'));
|
||||
|
||||
$link = site_url();
|
||||
|
||||
$this->navigationlib->setSessionMenu(
|
||||
array(
|
||||
'back' => $this->navigationlib->oneLevel(
|
||||
'Zurück', // description
|
||||
$link, // link
|
||||
array(), // children
|
||||
'angle-left', // icon
|
||||
true, // expand
|
||||
null, // subscriptDescription
|
||||
null, // subscriptLinkClass
|
||||
null, // subscriptLinkValue
|
||||
'', // target
|
||||
1 // sort
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user