mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
Merge branch 'master' into dbskel
This commit is contained in:
@@ -7,60 +7,34 @@ class FAS_UDF extends Auth_Controller
|
||||
const FAS_UDF_SESSION_NAME = 'fasUdfSessionName';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'basis/person:r',
|
||||
'saveUDF' => 'basis/person:rw'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$this->load->model('person/Person_model', 'PersonModel');
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$fasUdfSession = getSession(self::FAS_UDF_SESSION_NAME);
|
||||
|
||||
$person_id = $this->input->get('person_id');
|
||||
if (isset($fasUdfSession['person_id']))
|
||||
{
|
||||
if (!isset($person_id))
|
||||
{
|
||||
$person_id = $fasUdfSession['person_id'];
|
||||
}
|
||||
unset($fasUdfSession['person_id']);
|
||||
}
|
||||
|
||||
$prestudent_id = $this->input->get('prestudent_id');
|
||||
if (isset($fasUdfSession['prestudent_id']))
|
||||
{
|
||||
if (!isset($prestudent_id))
|
||||
{
|
||||
$prestudent_id = $fasUdfSession['prestudent_id'];
|
||||
}
|
||||
unset($fasUdfSession['prestudent_id']);
|
||||
}
|
||||
|
||||
$result = null;
|
||||
if (isset($fasUdfSession['result']))
|
||||
{
|
||||
$result = clone $fasUdfSession['result'];
|
||||
setSessionElement(self::FAS_UDF_SESSION_NAME, 'result', null);
|
||||
}
|
||||
|
||||
$data = array('result' => $result);
|
||||
$data = array();
|
||||
|
||||
if (isset($person_id) && is_numeric($person_id))
|
||||
{
|
||||
if ($this->PersonModel->hasUDF())
|
||||
{
|
||||
$personUdfs = $this->PersonModel->getUDFs($person_id);
|
||||
$personUdfs['person_id'] = $person_id;
|
||||
$data['person_id'] = $person_id;
|
||||
$data['personUdfs'] = $personUdfs;
|
||||
}
|
||||
}
|
||||
@@ -70,61 +44,12 @@ class FAS_UDF extends Auth_Controller
|
||||
if ($this->PrestudentModel->hasUDF())
|
||||
{
|
||||
$prestudentUdfs = $this->PrestudentModel->getUDFs($prestudent_id);
|
||||
$prestudentUdfs['prestudent_id'] = $prestudent_id;
|
||||
$data['prestudent_id'] = $prestudent_id;
|
||||
$data['prestudentUdfs'] = $prestudentUdfs;
|
||||
}
|
||||
}
|
||||
|
||||
$this->load->view('system/fas_udf', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function saveUDF()
|
||||
{
|
||||
$udfs = $this->input->post();
|
||||
$validation = $this->_validate($udfs);
|
||||
|
||||
$userdata = array(
|
||||
'person_id' => $this->input->post('person_id'),
|
||||
'prestudent_id' => $this->input->post('prestudent_id')
|
||||
);
|
||||
|
||||
if (isSuccess($validation))
|
||||
{
|
||||
// Load model UDF_model
|
||||
$this->load->model('system/FAS_UDF_model', 'FASUDFModel');
|
||||
|
||||
$result = $this->FASUDFModel->saveUDFs($udfs);
|
||||
|
||||
$userdata['result'] = $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$userdata['result'] = $validation;
|
||||
}
|
||||
|
||||
setSessionElement(self::FAS_UDF_SESSION_NAME, 'person_id', $userdata['person_id']);
|
||||
setSessionElement(self::FAS_UDF_SESSION_NAME, 'prestudent_id', $userdata['prestudent_id']);
|
||||
setSessionElement(self::FAS_UDF_SESSION_NAME, 'result', $userdata['result']);
|
||||
|
||||
redirect('system/FAS_UDF');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _validate($udfs)
|
||||
{
|
||||
$validation = error('person_id or prestudent_id is missing');
|
||||
|
||||
if((isset($udfs['person_id']) && !(is_null($udfs['person_id'])) && ($udfs['person_id'] != ''))
|
||||
|| (isset($udfs['prestudent_id']) && !(is_null($udfs['prestudent_id'])) && ($udfs['prestudent_id'] != '')))
|
||||
{
|
||||
$validation = success(true);
|
||||
}
|
||||
|
||||
return $validation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class LogsViewer extends Auth_Controller
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Main page of the InfoCenter tool
|
||||
* Everything has a beginning
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
@@ -1337,7 +1337,7 @@ class InfoCenter extends Auth_Controller
|
||||
show_error(getError($prestudentWithZgv));
|
||||
}
|
||||
|
||||
$zgvpruefung = $prestudentWithZgv->retval[0];
|
||||
$zgvpruefung = getData($prestudentWithZgv);
|
||||
|
||||
if (isset($zgvpruefung->prestudentstatus))
|
||||
{
|
||||
@@ -1362,11 +1362,15 @@ class InfoCenter extends Auth_Controller
|
||||
$zgvpruefung->isRtFreigegeben = false;
|
||||
$zgvpruefung->isStgFreigegeben = false;
|
||||
$zgvpruefung->sendStgFreigabeMsg = true;//wether Stgudiengangfreigabemessage can be sent (for "exceptions", Studiengänge with no message sending)
|
||||
$this->PrestudentstatusModel->addSelect('bestaetigtam, statusgrund_id, tbl_status_grund.bezeichnung_mehrsprachig AS bezeichnung_statusgrund');
|
||||
$this->PrestudentstatusModel->addJoin('public.tbl_status_grund', 'statusgrund_id', 'LEFT');
|
||||
$isFreigegeben = $this->PrestudentstatusModel->loadWhere(array('studiensemester_kurzbz' => $zgvpruefung->prestudentstatus->studiensemester_kurzbz,
|
||||
'tbl_prestudentstatus.status_kurzbz' => self::INTERESSENTSTATUS, 'prestudent_id' => $prestudent->prestudent_id));
|
||||
|
||||
$isFreigegeben = null;
|
||||
if (isset($zgvpruefung->prestudentstatus->studiensemester_kurzbz))
|
||||
{
|
||||
$this->PrestudentstatusModel->addSelect('bestaetigtam, statusgrund_id, tbl_status_grund.bezeichnung_mehrsprachig AS bezeichnung_statusgrund');
|
||||
$this->PrestudentstatusModel->addJoin('public.tbl_status_grund', 'statusgrund_id', 'LEFT');
|
||||
$isFreigegeben = $this->PrestudentstatusModel->loadWhere(array('studiensemester_kurzbz' => $zgvpruefung->prestudentstatus->studiensemester_kurzbz,
|
||||
'tbl_prestudentstatus.status_kurzbz' => self::INTERESSENTSTATUS, 'prestudent_id' => $prestudent->prestudent_id));
|
||||
}
|
||||
|
||||
if (hasData($isFreigegeben))
|
||||
{
|
||||
@@ -1537,9 +1541,10 @@ class InfoCenter extends Auth_Controller
|
||||
show_error(getError($prestudent));
|
||||
}
|
||||
|
||||
$person_id = $prestudent->retval[0]->person_id;
|
||||
$studiengang_kurzbz = $prestudent->retval[0]->studiengang;
|
||||
$studiengang_bezeichnung = $prestudent->retval[0]->studiengangbezeichnung;
|
||||
$prestudentdata = getData($prestudent);
|
||||
$person_id = $prestudentdata->person_id;
|
||||
$studiengang_kurzbz = $prestudentdata->studiengang;
|
||||
$studiengang_bezeichnung = $prestudentdata->studiengangbezeichnung;
|
||||
|
||||
return array('person_id' => $person_id, 'studiengang_kurzbz' => $studiengang_kurzbz, 'studiengang_bezeichnung' => $studiengang_bezeichnung);
|
||||
}
|
||||
@@ -1582,7 +1587,8 @@ class InfoCenter extends Auth_Controller
|
||||
private function _sendFreigabeMail($prestudent_id)
|
||||
{
|
||||
//get data
|
||||
$prestudent = $this->PrestudentModel->getPrestudentWithZgv($prestudent_id)->retval[0];
|
||||
$prestudent = $this->PrestudentModel->getPrestudentWithZgv($prestudent_id);
|
||||
$prestudent = getData($prestudent);
|
||||
$prestudentstatus = $prestudent->prestudentstatus;
|
||||
$person_id = $prestudent->person_id;
|
||||
$person = $this->PersonModel->getPersonStammdaten($person_id, true)->retval;
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This controller acts as REST JSON interface between the JobsQueueLib, that contains all the needed functionalities to
|
||||
* operate with the Jobs Queue System, and other tools that cannot access directly to such library
|
||||
*/
|
||||
class JobsQueueManager extends Auth_Controller
|
||||
{
|
||||
// Config entry name for White list of permissions...
|
||||
const JOB_TYPE_PERMISSIONS_WHITE_LIST = 'job_type_permissions_white_list';
|
||||
// Parameter names
|
||||
const PARAM_JOBS = 'jobs';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'getLastJobs' => 'admin:r',
|
||||
'addNewJobsToQueue' => 'admin:rw',
|
||||
'updateJobsQueue' => 'admin:rw'
|
||||
)
|
||||
);
|
||||
|
||||
// Loading config file jqm
|
||||
$this->config->load('jqm');
|
||||
|
||||
// Loads JobsQueueLib
|
||||
$this->load->library('JobsQueueLib');
|
||||
// Loads permission lib
|
||||
$this->load->library('PermissionLib');
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* To get all the most recently added jobs using the given job type
|
||||
*/
|
||||
public function getLastJobs()
|
||||
{
|
||||
$type = $this->input->get(JobsQueueLib::PROPERTY_TYPE);
|
||||
|
||||
$this->_checkPermissions($type);
|
||||
|
||||
$this->outputJson($this->jobsqueuelib->getLastJobs($type));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new jobs in the jobs queue with the given type
|
||||
* jobs is an array of job objects
|
||||
*/
|
||||
public function addNewJobsToQueue()
|
||||
{
|
||||
$type = $this->input->post(JobsQueueLib::PROPERTY_TYPE);
|
||||
$jobs = $this->input->post(self::PARAM_JOBS);
|
||||
|
||||
$this->_checkPermissions($type);
|
||||
|
||||
// Otherwise convert jobs from json to php and call JobsQueueLib library
|
||||
$this->outputJson($this->jobsqueuelib->addNewJobsToQueue($type, $this->_convertJobs($jobs)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new jobs in the jobs queue with the given type
|
||||
* jobs is an array of job objects
|
||||
*/
|
||||
public function updateJobsQueue()
|
||||
{
|
||||
$type = $this->input->post(JobsQueueLib::PROPERTY_TYPE);
|
||||
$jobs = $this->input->post(self::PARAM_JOBS);
|
||||
|
||||
$this->_checkPermissions($type);
|
||||
|
||||
// Otherwise convert jobs from json to php and call JobsQueueLib library
|
||||
$this->outputJson($this->jobsqueuelib->updateJobsQueue($type, $this->_convertJobs($jobs)));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _checkPermissions($type)
|
||||
{
|
||||
// Checks if the caller has the permissions to add new jobs with the given type in the queue
|
||||
if (!$this->permissionlib->isEntitled($this->config->item(self::JOB_TYPE_PERMISSIONS_WHITE_LIST), $type))
|
||||
{
|
||||
// Permissions NOT valid
|
||||
$this->terminateWithJsonError('You are not allowed to access to this content');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _convertJobs($jobs)
|
||||
{
|
||||
if (isEmptyArray($jobs)) return null; // if not a valid array then return null
|
||||
|
||||
$convertedJobsArray = array(); // returned values
|
||||
|
||||
// Loops through all the provided jobs
|
||||
foreach ($jobs as $job)
|
||||
{
|
||||
$tmpObj = json_decode($job); // Try to decode json to php
|
||||
|
||||
// If decode was a success
|
||||
if ($tmpObj != null)
|
||||
{
|
||||
$convertedJobsArray[] = $tmpObj; // then store the decoded object in the result array
|
||||
}
|
||||
else // otherwise
|
||||
{
|
||||
// Create a new object and store the error message in it
|
||||
$tmpObj = new stdClass();
|
||||
$tmpObj->{JobsQueueLib::PROPERTY_ERROR} = 'A not valid json was provided';
|
||||
|
||||
$convertedJobsArray[] = $tmpObj; // store this object into the result array
|
||||
}
|
||||
}
|
||||
|
||||
return $convertedJobsArray;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Jobs Queue Viewer
|
||||
*
|
||||
* This controller renders a FilterWidget to monitor the current status of the Jobs Queue System
|
||||
*/
|
||||
class JobsQueueViewer extends Auth_Controller
|
||||
{
|
||||
const PARAM_START_DATE = 'startDate';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'system/developer:r'
|
||||
)
|
||||
);
|
||||
|
||||
// Loads WidgetLib
|
||||
$this->load->library('WidgetLib');
|
||||
|
||||
// Loads JobsQueueLib
|
||||
$this->load->library('JobsQueueLib');
|
||||
|
||||
// Loads phrases system
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
'global',
|
||||
'ui',
|
||||
'filter'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Everything has a beginning
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('system/jq/jobsQueueViewer.php');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user