mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-08 23:59:28 +00:00
Merge branch 'ci' of https://github.com/FH-Complete/FHC-Core into ci
Conflicts: application/core/FHC_Model.php
This commit is contained in:
@@ -36,6 +36,32 @@ class Dms extends APIv1_Controller
|
||||
$dms_id = $this->get('dms_id');
|
||||
$version = $this->get('version');
|
||||
|
||||
if (isset($dms_id))
|
||||
{
|
||||
$result = $this->_getDms($dms_id, $version);
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS && is_array($result->retval) && count($result->retval) > 0)
|
||||
{
|
||||
if (($fileContent = $this->_readFile($result->retval[0]->filename)) != false)
|
||||
{
|
||||
$result->retval[0]->file_content = $fileContent;
|
||||
}
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _getDms($dms_id, $version)
|
||||
{
|
||||
$result = null;
|
||||
|
||||
if (isset($dms_id))
|
||||
{
|
||||
$result = $this->DmsModel->addJoin('campus.tbl_dms_version', 'dms_id');
|
||||
@@ -58,6 +84,40 @@ class Dms extends APIv1_Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function postDms()
|
||||
{
|
||||
if ($this->_validate($this->post()))
|
||||
{
|
||||
if (isset($this->post()['dms_id']))
|
||||
{
|
||||
if ($this->_saveFileOnUpdate($this->post()))
|
||||
{
|
||||
$result = $this->DmsModel->update($this->post()['dms_id'], $this->_dmsFieldsArray($this->post()));
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->DmsModel->updateDmsVersion($this->post()['dms_id'], $this->_dmsVersionFieldsArray($this->post()));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (($fileName = $this->_saveFileOnInsert($this->post())) !== false)
|
||||
{
|
||||
$result = $this->DmsModel->insert($this->_dmsFieldsArray($this->post()));
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->DmsModel->insertDmsVersion($this->_dmsVersionFieldsArray($this->post(), $result->retval, $fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
@@ -70,39 +130,139 @@ class Dms extends APIv1_Controller
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function postDms()
|
||||
private function _dmsFieldsArray($dms)
|
||||
{
|
||||
if ($this->_validate($this->post()))
|
||||
$fieldsArray = array('oe_kurzbz', 'dokument_kurzbz', 'kategorie_kurzbz');
|
||||
$returnArray = array();
|
||||
|
||||
foreach ($fieldsArray as $value)
|
||||
{
|
||||
if (isset($this->post()['dms_id']))
|
||||
if (isset($dms[$value]))
|
||||
{
|
||||
$result = $this->DmsModel->update($this->post()['dms_id'], $this->post());
|
||||
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->DmsModel->updateDmsVersion($this->post()['dms_id'], $this->post());
|
||||
}
|
||||
$returnArray[$value] = $dms[$value];
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->DmsModel->insert($this->post());
|
||||
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->DmsModel->insertDmsVersion($this->post());
|
||||
}
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _dmsVersionFieldsArray($dms, $dms_id = null, $fileName = null)
|
||||
{
|
||||
$fieldsArray = array(
|
||||
'version',
|
||||
'mimetype',
|
||||
'name',
|
||||
'beschreibung',
|
||||
'letzterzugriff',
|
||||
'insertamum',
|
||||
'insertvon',
|
||||
'updateamum',
|
||||
'updatevon'
|
||||
);
|
||||
$returnArray = array();
|
||||
|
||||
foreach ($fieldsArray as $value)
|
||||
{
|
||||
if (isset($dms[$value]))
|
||||
{
|
||||
$returnArray[$value] = $dms[$value];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($dms_id))
|
||||
{
|
||||
$returnArray['dms_id'] = $dms_id;
|
||||
}
|
||||
if (isset($fileName))
|
||||
{
|
||||
$returnArray['filename'] = $fileName;
|
||||
}
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _saveFileOnUpdate($dms)
|
||||
{
|
||||
$result = $this->_getDms($dms['dms_id'], $dms['version']);
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS && is_array($result->retval) && count($result->retval) > 0)
|
||||
{
|
||||
$fileName = DMS_PATH . $result->retval[0]->filename;
|
||||
|
||||
if (($fileContent = base64_decode($dms['file_content'])))
|
||||
{
|
||||
if (file_put_contents($fileName, $fileContent))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _saveFileOnInsert($dms)
|
||||
{
|
||||
$fileName = uniqid() . '.' . pathinfo($dms['name'], PATHINFO_EXTENSION);
|
||||
$FileNamePath = DMS_PATH . $fileName;
|
||||
|
||||
if (($fileContent = base64_decode($dms['file_content'])))
|
||||
{
|
||||
if ($fileHandle = fopen($FileNamePath, 'w'))
|
||||
{
|
||||
if(fwrite($fileHandle, $fileContent))
|
||||
{
|
||||
fclose($fileHandle);
|
||||
return $fileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _readFile($fileName)
|
||||
{
|
||||
$fileNamePath = DMS_PATH . $fileName;
|
||||
if (file_exists($fileNamePath))
|
||||
{
|
||||
if ($fileHandle = fopen($fileNamePath, 'r'))
|
||||
{
|
||||
$cTmpHEX = '';
|
||||
while (!feof($fileHandle))
|
||||
{
|
||||
$cTmpHEX .= fread($fileHandle, 8192);
|
||||
}
|
||||
fclose($fileHandle);
|
||||
return base64_encode($cTmpHEX);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function _validate($dms = NULL)
|
||||
{
|
||||
if (!isset($dms['file_content']) || (isset($dms['file_content']) && $dms['file_content'] == ''))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!isset($dms['name']) || (isset($dms['name']) && $dms['name'] == ''))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,27 @@ class Prestudent extends APIv1_Controller
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function getLastStatus()
|
||||
{
|
||||
$prestudent_id = $this->get('prestudent_id');
|
||||
$studiensemester_kurzbz = $this->get('studiensemester_kurzbz');
|
||||
$status_kurzbz = $this->get('status_kurzbz');
|
||||
|
||||
if (isset($prestudent_id))
|
||||
{
|
||||
$result = $this->PrestudentModel->getLastStatus($prestudent_id, $studiensemester_kurzbz, $status_kurzbz);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
|
||||
@@ -46,6 +46,32 @@ class Statistik extends APIv1_Controller
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function getAll()
|
||||
{
|
||||
$this->StatistikModel->addOrder($this->get('order'));
|
||||
|
||||
$result = $this->StatistikModel->loadWhole();
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function getMenueArray()
|
||||
{
|
||||
$this->StatistikModel->addOrder('gruppe');
|
||||
$this->StatistikModel->addOrder('bezeichnung');
|
||||
$this->StatistikModel->addOrder('statistik_kurzbz');
|
||||
|
||||
$result = $this->StatistikModel->loadWhole();
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
|
||||
@@ -24,7 +24,7 @@ class Adresse extends APIv1_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
// Load model PersonModel
|
||||
$this->load->model('person/adresse_model', 'AdresseModel');
|
||||
$this->load->model('person/Adresse_model', 'AdresseModel');
|
||||
// Load set the uid of the model to let to check the permissions
|
||||
$this->AdresseModel->setUID($this->_getUID());
|
||||
}
|
||||
@@ -67,4 +67,4 @@ class Adresse extends APIv1_Controller
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,31 @@ class Ort extends APIv1_Controller
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function getAll()
|
||||
{
|
||||
$raumtyp_kurzbz = $this->get('raumtyp_kurzbz');
|
||||
|
||||
$this->OrtModel->addOrder('ort_kurzbz');
|
||||
|
||||
if (!is_null($raumtyp_kurzbz) && $raumtyp_kurzbz != '')
|
||||
{
|
||||
$result = $this->OrtModel->addJoin('public.tbl_ortraumtyp', 'ort_kurzbz');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->OrtModel->loadWhere(array('raumtyp_kurzbz' => $raumtyp_kurzbz));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->OrtModel->loadWhole();
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH'))
|
||||
exit('No direct script access allowed');
|
||||
|
||||
class TblStudiengang extends FHC_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('organisation/studiengang_model');
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$keyword = '';
|
||||
$this->load->library('pagination');
|
||||
|
||||
$config['base_url'] = base_url() . 'studiengang/index/';
|
||||
$config['total_rows'] = $this->studiengang_model->total_rows();
|
||||
$config['per_page'] = 10;
|
||||
$config['uri_segment'] = 3;
|
||||
$config['suffix'] = '.html';
|
||||
$config['first_url'] = base_url() . 'studiengang.html';
|
||||
$this->pagination->initialize($config);
|
||||
|
||||
$start = $this->uri->segment(3, 0);
|
||||
$studiengang = $this->studiengang_model->index_limit($config['per_page'], $start);
|
||||
|
||||
$data = array(
|
||||
'studiengang_data' => $studiengang,
|
||||
'keyword' => $keyword,
|
||||
'pagination' => $this->pagination->create_links(),
|
||||
'total_rows' => $config['total_rows'],
|
||||
'start' => $start,
|
||||
);
|
||||
|
||||
$this->load->view('tbl_studiengang_list', $data);
|
||||
}
|
||||
|
||||
public function search()
|
||||
{
|
||||
$keyword = $this->uri->segment(3, $this->input->post('keyword', TRUE));
|
||||
$this->load->library('pagination');
|
||||
|
||||
if ($this->uri->segment(2)=='search') {
|
||||
$config['base_url'] = base_url() . 'studiengang/search/' . $keyword;
|
||||
} else {
|
||||
$config['base_url'] = base_url() . 'studiengang/index/';
|
||||
}
|
||||
|
||||
$config['total_rows'] = $this->studiengang_model->search_total_rows($keyword);
|
||||
$config['per_page'] = 10;
|
||||
$config['uri_segment'] = 4;
|
||||
$config['suffix'] = '.html';
|
||||
$config['first_url'] = base_url() . 'studiengang/search/'.$keyword.'.html';
|
||||
$this->pagination->initialize($config);
|
||||
|
||||
$start = $this->uri->segment(4, 0);
|
||||
$studiengang = $this->studiengang_model->search_index_limit($config['per_page'], $start, $keyword);
|
||||
|
||||
$data = array(
|
||||
'studiengang_data' => $studiengang,
|
||||
'keyword' => $keyword,
|
||||
'pagination' => $this->pagination->create_links(),
|
||||
'total_rows' => $config['total_rows'],
|
||||
'start' => $start,
|
||||
);
|
||||
$this->load->view('tbl_studiengang_list', $data);
|
||||
}
|
||||
|
||||
public function read($id)
|
||||
{
|
||||
$row = $this->studiengang_model->get_by_id($id);
|
||||
if ($row) {
|
||||
$data = array(
|
||||
);
|
||||
$this->load->view('tbl_studiengang_read', $data);
|
||||
} else {
|
||||
$this->session->set_flashdata('message', 'Record Not Found');
|
||||
redirect(site_url('studiengang'));
|
||||
}
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = array(
|
||||
'button' => 'Create',
|
||||
'action' => site_url('studiengang/create_action'),
|
||||
);
|
||||
$this->load->view('tbl_studiengang_form', $data);
|
||||
}
|
||||
|
||||
public function create_action()
|
||||
{
|
||||
$this->_rules();
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$this->create();
|
||||
} else {
|
||||
$data = array(
|
||||
);
|
||||
|
||||
$this->studiengang_model->insert($data);
|
||||
$this->session->set_flashdata('message', 'Create Record Success');
|
||||
redirect(site_url('studiengang'));
|
||||
}
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$row = $this->studiengang_model->get_by_id($id);
|
||||
|
||||
if ($row) {
|
||||
$data = array(
|
||||
'button' => 'Update',
|
||||
'action' => site_url('studiengang/update_action'),
|
||||
);
|
||||
$this->load->view('tbl_studiengang_form', $data);
|
||||
} else {
|
||||
$this->session->set_flashdata('message', 'Record Not Found');
|
||||
redirect(site_url('studiengang'));
|
||||
}
|
||||
}
|
||||
|
||||
public function update_action()
|
||||
{
|
||||
$this->_rules();
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$this->update($this->input->post('', TRUE));
|
||||
} else {
|
||||
$data = array(
|
||||
);
|
||||
|
||||
$this->studiengang_model->update($this->input->post('', TRUE), $data);
|
||||
$this->session->set_flashdata('message', 'Update Record Success');
|
||||
redirect(site_url('studiengang'));
|
||||
}
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
$row = $this->studiengang_model->get_by_id($id);
|
||||
|
||||
if ($row) {
|
||||
$this->studiengang_model->delete($id);
|
||||
$this->session->set_flashdata('message', 'Delete Record Success');
|
||||
redirect(site_url('studiengang'));
|
||||
} else {
|
||||
$this->session->set_flashdata('message', 'Record Not Found');
|
||||
redirect(site_url('studiengang'));
|
||||
}
|
||||
}
|
||||
|
||||
public function _rules()
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('', '', 'trim');
|
||||
$this->form_validation->set_error_delimiters('<span class="text-danger">', '</span>');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/* End of file Studiengang.php */
|
||||
/* Location: ./application/controllers/Studiengang.php */
|
||||
@@ -1,14 +1,15 @@
|
||||
<?php
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Message extends FHC_Controller {
|
||||
class Message extends FHC_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
//$this->load->library('Messaging');
|
||||
$this->load->model('person/Person_model');
|
||||
$this->load->model('system/Message_model');
|
||||
$this->load->library('messaging');
|
||||
//$this->load->model('person/Person_model');
|
||||
//$this->load->model('system/Message_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
@@ -25,20 +26,20 @@ class Message extends FHC_Controller {
|
||||
$v = $this->load->view('test.php', $data);
|
||||
}
|
||||
|
||||
public function view($id)
|
||||
public function view($msg_id)
|
||||
{
|
||||
//$messages = $this->Message_model->getMessages();
|
||||
$msg = $this->Message_model->load($id);
|
||||
$msg = $this->messaging->getMessage($msg_id);
|
||||
//var_dump($msg);
|
||||
if ($msg->error)
|
||||
show_error($msg->retval);
|
||||
if (count($msg->retval) != 1)
|
||||
show_error('Nachricht nicht vorhanden! ID: '.$id);
|
||||
show_error('Nachricht nicht vorhanden! ID: '.$msg_id);
|
||||
|
||||
$data = array
|
||||
(
|
||||
'message' => $msg->retval[0]
|
||||
);
|
||||
var_dump($data);
|
||||
var_dump($data['message']);
|
||||
$v = $this->load->view('system/message', $data);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@ class DB_Model extends FHC_Model
|
||||
// True if this table has a primary key that uses a sequence
|
||||
protected $acl; // Name of the PrimaryKey for DB-Update, Load, ...
|
||||
|
||||
function __construct($dbTable = null, $pk = null)
|
||||
function __construct($dbTable = null, $pk = null, $hasSequence = true)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = $dbTable;
|
||||
$this->pk = $pk;
|
||||
$this->hasSequence = true;
|
||||
$this->hasSequence = $hasSequence;
|
||||
$this->load->database();
|
||||
$this->acl = $this->config->item('fhc_acl');
|
||||
}
|
||||
@@ -427,4 +427,4 @@ class DB_Model extends FHC_Model
|
||||
'msg' => lang('fhc_' . $error)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@ class FHC_Model extends CI_Model
|
||||
// Get UID from the environment (HTTP authentication via authentication.class.php)
|
||||
elseif(isset($_SERVER['PHP_AUTH_USER']))
|
||||
$uid = $_SERVER['PHP_AUTH_USER'];
|
||||
|
||||
// After getting UID for the first time, it saves it in CI session
|
||||
if (isset($uid) && !isset($this->session->uid))
|
||||
{
|
||||
$this->session->uid = $uid;
|
||||
}
|
||||
|
||||
$this->load->library('FHC_DB_ACL', array('uid' => $uid));
|
||||
}
|
||||
|
||||
@@ -1,450 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* FH-Complete
|
||||
*
|
||||
* @package FHC-Helper
|
||||
* @author FHC-Team
|
||||
* @copyright Copyright (c) 2016 fhcomplete.org
|
||||
* @license GPLv3
|
||||
* @link https://fhcomplete.org
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
//require_once 'include/basis.class.php';
|
||||
|
||||
/**
|
||||
* FHC-Auth Helpers
|
||||
*
|
||||
* @package FH-Complete
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author FHC-Team
|
||||
* @link http://fhcomplete.org/user_guide/helpers/fhcauth_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
//require_once('include/sprache.class.php');
|
||||
|
||||
class basis_db
|
||||
{
|
||||
protected $ci=null;
|
||||
protected $db_result=null;
|
||||
protected $errormsg=null;
|
||||
|
||||
public function __construct($ci)
|
||||
{
|
||||
$this->ci=$ci;
|
||||
}
|
||||
|
||||
public function db_connect()
|
||||
{
|
||||
$conn_str='host='.DB_HOST.' port='.DB_PORT.' dbname='.DB_NAME.' user='.DB_USER.' password='.DB_PASSWORD;
|
||||
//Connection Herstellen
|
||||
if (DB_CONNECT_PERSISTENT)
|
||||
{
|
||||
if (!basis_db::$db_conn = pg_pconnect($conn_str))
|
||||
die('Fehler beim Oeffnen der Datenbankverbindung');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!basis_db::$db_conn = pg_connect($conn_str))
|
||||
die('Fehler beim Oeffnen der Datenbankverbindung');
|
||||
}
|
||||
}
|
||||
|
||||
public function db_query($sql)
|
||||
{
|
||||
if ($this->db_result=$this->ci->db->simple_query($sql))
|
||||
return $this->db_result;
|
||||
else
|
||||
{
|
||||
$this->errormsg.='Abfrage in Datenbank fehlgeschlagen! '.$this->db_last_error();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function db_num_rows($result=null)
|
||||
{
|
||||
if (is_null($result))
|
||||
return pg_num_rows($this->db_result);
|
||||
else
|
||||
return pg_num_rows($result);
|
||||
}
|
||||
|
||||
public function db_fetch_object($result = null, $i=null)
|
||||
{
|
||||
if (is_null($result))
|
||||
{
|
||||
if (is_null($i))
|
||||
return pg_fetch_object($this->db_result);
|
||||
else
|
||||
return pg_fetch_object($this->db_result, $i);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_null($i))
|
||||
return pg_fetch_object($result);
|
||||
else
|
||||
return pg_fetch_object($result, $i);
|
||||
}
|
||||
}
|
||||
|
||||
public function db_fetch_row($result = null, $i=null)
|
||||
{
|
||||
if (is_null($result))
|
||||
{
|
||||
if (is_null($i))
|
||||
return pg_fetch_row($this->db_result);
|
||||
else
|
||||
return pg_fetch_row($this->db_result, $i);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_null($i))
|
||||
return pg_fetch_row($result);
|
||||
else
|
||||
return pg_fetch_row($result, $i);
|
||||
}
|
||||
}
|
||||
|
||||
public function db_fetch_assoc($result = null, $i=null)
|
||||
{
|
||||
if (is_null($result))
|
||||
{
|
||||
if (is_null($i))
|
||||
return pg_fetch_assoc($this->db_result);
|
||||
else
|
||||
return pg_fetch_assoc($this->db_result, $i);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_null($i))
|
||||
return pg_fetch_row($result);
|
||||
else
|
||||
return pg_fetch_row($result, $i);
|
||||
}
|
||||
}
|
||||
|
||||
public function db_result($result = null, $i,$item)
|
||||
{
|
||||
if (is_null($result))
|
||||
{
|
||||
return pg_result($this->db_result, $i,$item);
|
||||
}
|
||||
else
|
||||
{
|
||||
return pg_result($result, $i,$item);
|
||||
}
|
||||
}
|
||||
|
||||
public function db_getResultJSON($result = null)
|
||||
{
|
||||
$rows=array();
|
||||
if (is_null($result))
|
||||
{
|
||||
while ($r = pg_fetch_assoc($this->db_result))
|
||||
$rows[] = $r;
|
||||
|
||||
//print json_encode($rows);
|
||||
}
|
||||
else
|
||||
{
|
||||
pg_result_seek($result, 0);
|
||||
//var_dump($result);
|
||||
while ($r = pg_fetch_assoc($result))
|
||||
{
|
||||
$rows[] = $r;
|
||||
}
|
||||
|
||||
//print json_encode($rows);
|
||||
}
|
||||
return json_encode($rows);
|
||||
}
|
||||
|
||||
public function db_last_error()
|
||||
{
|
||||
return pg_last_error();
|
||||
}
|
||||
|
||||
public function db_affected_rows($result=null)
|
||||
{
|
||||
if (is_null($result))
|
||||
return pg_affected_rows($this->db_result);
|
||||
else
|
||||
return pg_affected_rows($result);
|
||||
}
|
||||
|
||||
public function db_result_seek($result=null, $offset)
|
||||
{
|
||||
if (is_null($result))
|
||||
return pg_result_seek($this->db_result, $offset);
|
||||
else
|
||||
return pg_result_seek($result, $offset);
|
||||
}
|
||||
|
||||
public function db_fetch_array($result=null)
|
||||
{
|
||||
if (is_null($result))
|
||||
return pg_fetch_array($this->db_result);
|
||||
else
|
||||
return pg_fetch_array($result);
|
||||
}
|
||||
|
||||
public function db_num_fields($result=null)
|
||||
{
|
||||
if (is_null($result))
|
||||
return pg_num_fields($this->db_result);
|
||||
else
|
||||
return pg_num_fields($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert den Feldnamen mit index i
|
||||
*/
|
||||
public function db_field_name($result=null, $i)
|
||||
{
|
||||
if (is_null($result))
|
||||
return pg_field_name($this->db_result, $i);
|
||||
else
|
||||
return pg_field_name($result, $i);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt den Speicher wieder Frei.
|
||||
* (ist das sinnvoll wenn es per Value uebergeben wird??)
|
||||
*/
|
||||
public function db_free_result($result = null)
|
||||
{
|
||||
if (is_null($result))
|
||||
{
|
||||
return pg_free_result($this->db_result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return pg_free_result($result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert die aktuelle Datenbankversion
|
||||
*/
|
||||
public function db_version()
|
||||
{
|
||||
return pg_version(basis_db::$db_conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Escaped Sonderzeichen in Variablen vor der Verwendung in SQL Statements
|
||||
* um SQL Injections zu verhindern
|
||||
*
|
||||
*/
|
||||
public function db_escape($var)
|
||||
{
|
||||
return pg_escape_string($var);
|
||||
}
|
||||
|
||||
/**
|
||||
* Null Value Handling und Hochkomma für Inserts / Updates
|
||||
* Wenn die Uebergebe Variable leer ist, wird ein String mit null
|
||||
* zurueckgeliefert, wenn nicht dann wird der string unter Hochkomma zurueckgeliefert
|
||||
* es sei denn qoute=false dann wird nur der String zurueckgeliefert
|
||||
*
|
||||
* @param $var String-Value fuer SQL Request
|
||||
* @return string
|
||||
*/
|
||||
public function db_null_value($var, $qoute=true)
|
||||
{
|
||||
if ($qoute)
|
||||
return ($var!==''?$this->db_qoute($var):'null');
|
||||
else
|
||||
return ($var!==''?$var:'null');
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt einen String unter Hochkomma
|
||||
* @param $var Value fuer Insert/Update
|
||||
* @return value unter Hochkomma
|
||||
*/
|
||||
public function db_qoute($var)
|
||||
{
|
||||
return "'".$var."'";
|
||||
}
|
||||
|
||||
/**
|
||||
* Escaped einen Parameter fuer die Verwendung in Insert/Update SQL Befehlen
|
||||
* Es werden abhaengig vom Typ Hochkomma oder Null hinzugefuegt
|
||||
* @param $var Value der gesetzt werden soll
|
||||
* @param $type Typ des Values (FHC_STRING | FHC_BOOLEAN | FHC_INTEGER | ...)
|
||||
* @param $nullable boolean gibt an ob das Feld NULL sein darf. Wenn true wird
|
||||
* NULL statt einem Leerstring zurueckgeliefert
|
||||
* @return Escapter Value inklusive Hochkomma wenn noetig
|
||||
*
|
||||
* Verwendungsbeispiel:
|
||||
* Update tbl_person set nachname=$this->db_add_param($var)
|
||||
* Update tbl_person set aktiv=$this->db_add_param($var, FHC_BOOL, false)
|
||||
* Update tbl_person set anzahlkinder=$this->db_add_param($var, FHC_INT)
|
||||
*/
|
||||
public function db_add_param($var, $type=FHC_STRING, $nullable=true)
|
||||
{
|
||||
if (($var==='' || is_null($var)) && $type!=FHC_BOOLEAN)
|
||||
{
|
||||
if ($nullable)
|
||||
return 'null';
|
||||
else
|
||||
return "''";
|
||||
}
|
||||
|
||||
switch($type)
|
||||
{
|
||||
case FHC_INTEGER:
|
||||
$var = $this->db_escape($var);
|
||||
if (!is_numeric($var) && $var!=='')
|
||||
die('Invalid Integer Parameter detected:'.$var);
|
||||
$var = $this->db_null_value($var, false);
|
||||
break;
|
||||
|
||||
case FHC_LANG_ARRAY:
|
||||
|
||||
$sprache = new sprache();
|
||||
$sprache->getAll(true);
|
||||
$buf = $var;
|
||||
$var = array();
|
||||
$languages = $sprache->getAllIndexesSorted();
|
||||
|
||||
foreach($languages as $sk => $sp)
|
||||
{
|
||||
if (!$sp || !isset($buf[$sp]))
|
||||
$var[$sk] = "";
|
||||
else
|
||||
$var[$sk] = $this->db_escape($buf[$sp]);
|
||||
}
|
||||
$var = str_replace('\\', '\\\\', $var);
|
||||
$var = str_replace('"', '\\\"', $var);
|
||||
$var = '\'{"' . join('","', $var) . '"}\'';
|
||||
|
||||
break;
|
||||
|
||||
case FHC_BOOLEAN:
|
||||
if ($var===true)
|
||||
$var='true';
|
||||
elseif ($var===false)
|
||||
$var='false';
|
||||
elseif ($var=='' && $nullable)
|
||||
$var = 'null';
|
||||
else
|
||||
die('Invalid Boolean Parameter detected');
|
||||
break;
|
||||
|
||||
case FHC_STRING:
|
||||
default:
|
||||
$var = $this->db_escape($var);
|
||||
$var = $this->db_null_value($var);
|
||||
break;
|
||||
}
|
||||
return $var;
|
||||
}
|
||||
|
||||
/**
|
||||
* Erzeugt aus einem DB-Result-Boolean einen PHP Boolean
|
||||
*/
|
||||
public function db_parse_bool($var)
|
||||
{
|
||||
if ($var=='t')
|
||||
return true;
|
||||
elseif ($var=='f')
|
||||
return false;
|
||||
elseif ($var=='')
|
||||
return '';
|
||||
else
|
||||
die('Invalid DB Boolean. Wrong DB-Engine?');
|
||||
}
|
||||
|
||||
/**
|
||||
* Bereitet ein Array von Elementen auf, damit es in der IN-Klausel eines
|
||||
* Select Befehls verwendet werden kann.
|
||||
*/
|
||||
public function db_implode4SQL($array)
|
||||
{
|
||||
$string = '';
|
||||
foreach($array as $row)
|
||||
{
|
||||
if ($string!='')
|
||||
$string.=',';
|
||||
$string.=$this->db_add_param($row);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Erstellt aus einem DB Array ein PHP Array
|
||||
* @param $var DB Result Array Spalte
|
||||
* @return php array
|
||||
*/
|
||||
public function db_parse_array($var)
|
||||
{
|
||||
if ($var == '')
|
||||
return;
|
||||
preg_match_all('/(?<=^\{|,)(([^,"{]*)|\s*"((?:[^"\\\\]|\\\\(?:.|[0-9]+|x[0-9a-f]+))*)"\s*)(,|(?<!^\{)(?=\}$))/i', $var, $matches, PREG_SET_ORDER);
|
||||
$values = array();
|
||||
foreach ($matches as $match)
|
||||
{
|
||||
$values[] = $match[3] != '' ? stripcslashes($match[3]) : (strtolower($match[2]) == 'null' ? null : $match[2]);
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Erstellt aus einem DB Array ein PHP Array
|
||||
* @param $var DB Result Array Spalte
|
||||
* @return php array
|
||||
*/
|
||||
public function db_parse_lang_array($var)
|
||||
{
|
||||
|
||||
if ($var == '')
|
||||
return;
|
||||
preg_match_all('/(?<=^\{|,)(([^,"{]*)|\s*"((?:[^"\\\\]|\\\\(?:.|[0-9]+|x[0-9a-f]+))*)"\s*)(,|(?<!^\{)(?=\}$))/i', $var, $matches, PREG_SET_ORDER);
|
||||
$values = array();
|
||||
|
||||
$sprache = new sprache();
|
||||
$sprache->loadIndexArray();
|
||||
|
||||
$sprache = new sprache();
|
||||
$sprache->getAll(true);
|
||||
$languages = $sprache->getAllIndexesSorted();
|
||||
|
||||
|
||||
foreach ($matches as $mk => $match)
|
||||
{
|
||||
$values[$languages[$mk+1]] = $match[3] != '' ? stripcslashes($match[3]) : (strtolower($match[2]) == 'null' ? null : $match[2]);
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
|
||||
function indexSort($a, $b)
|
||||
{
|
||||
return strcmp($a->index, $b->index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bereitet ein Array von Elementen auf, damit es in der IN-Klausel eines
|
||||
* Select Befehls verwendet werden kann.
|
||||
*/
|
||||
function dbImplode4SQL($array)
|
||||
{
|
||||
$string = '';
|
||||
|
||||
foreach($array as $row)
|
||||
{
|
||||
if ($string != '')
|
||||
{
|
||||
$string.=',';
|
||||
}
|
||||
$string.=$this->db_add_param($row);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* FH-Complete
|
||||
*
|
||||
* @package FHC-Helper
|
||||
* @author FHC-Team
|
||||
* @copyright Copyright (c) 2016 fhcomplete.org
|
||||
* @license GPLv3
|
||||
* @link https://fhcomplete.org
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* FHC-Seed Library
|
||||
*
|
||||
* @package FH-Complete
|
||||
* @subpackage DB
|
||||
* @category Library
|
||||
* @author FHC-Team
|
||||
* @link http://fhcomplete.org/user_guide/libraries/fhc_seed.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
class FHC_Seed
|
||||
{
|
||||
/**
|
||||
* Path to seed classes
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_seed_path = NULL;
|
||||
|
||||
/**
|
||||
* Seed basename regex
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_seed_regex = '/^\d{3}_(\w+)$/';
|
||||
|
||||
/**
|
||||
* Initialize Seed Class
|
||||
*
|
||||
* @param array $config
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
// Only run this constructor on main library load
|
||||
if ( ! in_array(get_class($this), array('FHC_Seed', config_item('subclass_prefix').'Seed'), TRUE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($config as $key => $val)
|
||||
{
|
||||
$this->{'_'.$key} = $val;
|
||||
}
|
||||
|
||||
log_message('info', 'Seed Class Initialized');
|
||||
|
||||
// If not set, set it
|
||||
$this->_seed_path !== '' OR $this->_seed_path = APPPATH.'seeds/';
|
||||
|
||||
// Add trailing slash if not set
|
||||
$this->_seed_path = rtrim($this->_seed_path, '/').'/';
|
||||
|
||||
// Load seed language
|
||||
$this->lang->load('seed');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Seeds DB with Testdata
|
||||
*
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
function seed($name = null)
|
||||
{
|
||||
$seeds = $this->find_seeds();
|
||||
|
||||
if (empty($seeds))
|
||||
{
|
||||
$this->_error_string = $this->lang->line('seed_none_found');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$method = 'seed';
|
||||
$pending = array();
|
||||
foreach ($seeds as $number => $file)
|
||||
{
|
||||
include_once($file);
|
||||
$class = 'Seed_'.ucfirst(strtolower($this->_get_seed_name(basename($file, '.php'))));
|
||||
|
||||
// Validate the seed file structure
|
||||
if ( ! class_exists($class, FALSE))
|
||||
{
|
||||
$this->_error_string = sprintf($this->lang->line('seed_class_doesnt_exist'), $class);
|
||||
return FALSE;
|
||||
}
|
||||
// method_exists() returns true for non-public methods,
|
||||
// while is_callable() can't be used without instantiating.
|
||||
// Only get_class_methods() satisfies both conditions.
|
||||
elseif ( ! in_array($method, array_map('strtolower', get_class_methods($class))))
|
||||
{
|
||||
$this->_error_string = sprintf($this->lang->line('seed_missing_'.$method.'_method'), $class);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$pending[$number] = array($class, $method);
|
||||
}
|
||||
// Now just run the necessary seeds
|
||||
foreach ($pending as $number => $seed)
|
||||
{
|
||||
log_message('debug', 'Seeding '.$method);
|
||||
|
||||
$seed[0] = new $seed[0];
|
||||
call_user_func($seed);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves list of available seed files
|
||||
*
|
||||
* @return array list of seed file paths sorted by version
|
||||
*/
|
||||
public function find_seeds()
|
||||
{
|
||||
$seeds = array();
|
||||
|
||||
// Load all *_*.php files in the seeds path
|
||||
foreach (glob($this->_seed_path.'*_*.php') as $file)
|
||||
{
|
||||
$name = basename($file, '.php');
|
||||
|
||||
// Filter out non-seed files
|
||||
if (preg_match($this->_seed_regex, $name))
|
||||
{
|
||||
$number = $this->_get_seed_number($name);
|
||||
|
||||
// There cannot be duplicate seed numbers
|
||||
if (isset($seeds[$number]))
|
||||
{
|
||||
$this->_error_string = sprintf($this->lang->line('seed_multiple_version'), $number);
|
||||
show_error($this->_error_string);
|
||||
}
|
||||
|
||||
$seeds[$number] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
ksort($seeds);
|
||||
return $seeds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the seed number from a filename
|
||||
*
|
||||
* @param string $seed
|
||||
* @return string Numeric portion of a seed filename
|
||||
*/
|
||||
protected function _get_seed_number($seed)
|
||||
{
|
||||
return sscanf($seed, '%[0-9]+', $number)
|
||||
? $number : '0';
|
||||
}
|
||||
}
|
||||
@@ -1,448 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/**
|
||||
* Name: Messaging Library for CodeIgniter
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class Messaging
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
require_once APPPATH.'config/message.php';
|
||||
|
||||
$this->ci =& get_instance();
|
||||
$this->ci->load->model('message/message_model');
|
||||
$this->ci->load->helper('language');
|
||||
$this->ci->lang->load('message');
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* get_message() - will return a single message, including the status for specified user.
|
||||
*
|
||||
* @param integer $msg_id EQUIRED
|
||||
* @param integer $user_id REQUIRED
|
||||
* @return array
|
||||
*/
|
||||
function get_message($msg_id, $user_id)
|
||||
{
|
||||
if (empty($msg_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_MSG_ID);
|
||||
}
|
||||
|
||||
if (empty($user_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_USER_ID);
|
||||
}
|
||||
|
||||
if ($message = $this->ci->message_model->get_message($msg_id, $user_id))
|
||||
{
|
||||
return $this->_success($message);
|
||||
}
|
||||
|
||||
// General Error Occurred
|
||||
return $this->_general_error();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* get_full_thread() - will return a entire thread, including the status for specified user.
|
||||
*
|
||||
* @param integer $thread_id REQUIRED
|
||||
* @param integer $user_id REQUIRED
|
||||
* @param boolean $full_thread OPTIONAL - If true, user will also see messages from thread posted BEFORE user became participant
|
||||
* @param string $order_by OPTIONAL
|
||||
* @return array
|
||||
*/
|
||||
function get_full_thread($thread_id, $user_id, $full_thread = FALSE, $order_by = 'ASC')
|
||||
{
|
||||
if (empty($thread_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_THREAD_ID);
|
||||
}
|
||||
|
||||
if (empty($user_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_USER_ID);
|
||||
}
|
||||
|
||||
if ($message = $this->ci->message_model->get_full_thread($thread_id, $user_id, $full_thread, $order_by))
|
||||
{
|
||||
return $this->_success($message);
|
||||
}
|
||||
|
||||
// General Error Occurred
|
||||
return $this->_general_error();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* get_all_threads() - will return all threads for user, including the status for specified user.
|
||||
*
|
||||
* @param integer $user_id REQUIRED
|
||||
* @param boolean $full_thread OPTIONAL - If true, user will also see messages from thread posted BEFORE user became participant
|
||||
* @param string $order_by OPTIONAL
|
||||
* @return array
|
||||
*/
|
||||
function get_all_threads($user_id, $full_thread = FALSE, $order_by = 'ASC')
|
||||
{
|
||||
if (empty($user_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_USER_ID);
|
||||
}
|
||||
|
||||
$message = $this->ci->message_model->get_all_threads($user_id, $full_thread, $order_by);
|
||||
if (is_array($message))
|
||||
{
|
||||
return $this->_success($message);
|
||||
}
|
||||
|
||||
// General Error Occurred
|
||||
return $this->_general_error();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* get_all_threads_grouped() - will return all threads for user, including the status for specified user.
|
||||
* - messages are grouped in threads.
|
||||
*
|
||||
* @param integer $user_id REQUIRED
|
||||
* @param boolean $full_thread OPTIONAL - If true, user will also see messages from thread posted BEFORE user became participant
|
||||
* @param string $order_by OPTIONAL
|
||||
* @return array
|
||||
*/
|
||||
function get_all_threads_grouped($user_id, $full_thread = FALSE, $order_by = 'ASC')
|
||||
{
|
||||
if (empty($user_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_USER_ID);
|
||||
}
|
||||
|
||||
$message = $this->ci->message_model->get_all_threads($user_id, $full_thread, $order_by);
|
||||
if (is_array($message))
|
||||
{
|
||||
$threads = array();
|
||||
|
||||
foreach ($message as $msg)
|
||||
{
|
||||
if ( ! isset($threads[$msg['thread_id']]))
|
||||
{
|
||||
$threads[$msg['thread_id']]['thread_id'] = $msg['thread_id'];
|
||||
$threads[$msg['thread_id']]['messages'] = array($msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
$threads[$msg['thread_id']]['messages'][] = $msg;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_success($threads);
|
||||
}
|
||||
|
||||
// General Error Occurred
|
||||
return $this->_general_error();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* update_message_status() - will change status on message for particular user
|
||||
*
|
||||
* @param integer $msg_id REQUIRED
|
||||
* @param integer $user_id REQUIRED
|
||||
* @param integer $status_id REQUIRED - should come from config/message.php list of constants
|
||||
* @return array
|
||||
*/
|
||||
function update_message_status($msg_id, $user_id, $status_id )
|
||||
{
|
||||
if (empty($msg_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_MSG_ID);
|
||||
}
|
||||
|
||||
if (empty($user_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_USER_ID);
|
||||
}
|
||||
|
||||
if (empty($status_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_STATUS_ID);
|
||||
}
|
||||
|
||||
if ($this->ci->message_model->update_message_status($msg_id, $user_id, $status_id))
|
||||
{
|
||||
return $this->_success(NULL, MSG_STATUS_UPDATE);
|
||||
}
|
||||
|
||||
// General Error Occurred
|
||||
return $this->_general_error();
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* add_participant() - adds user to existing thread
|
||||
*
|
||||
* @param integer $thread_id REQUIRED
|
||||
* @param integer $user_id REQUIRED
|
||||
* @return array
|
||||
*/
|
||||
function add_participant($thread_id, $user_id)
|
||||
{
|
||||
if (empty($thread_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_THREAD_ID);
|
||||
}
|
||||
|
||||
if (empty($user_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_USER_ID);
|
||||
}
|
||||
|
||||
if ( ! $this->ci->message_model->valid_new_participant($thread_id, $user_id))
|
||||
{
|
||||
$this->_participant_error(MSG_ERR_PARTICIPANT_EXISTS);
|
||||
}
|
||||
|
||||
if ( ! $this->ci->message_model->application_user($user_id))
|
||||
{
|
||||
$this->_participant_error(MSG_ERR_PARTICIPANT_NONSYSTEM);
|
||||
}
|
||||
|
||||
if ($this->ci->message_model->add_participant($thread_id, $user_id ))
|
||||
{
|
||||
return $this->_success(NULL, MSG_PARTICIPANT_ADDED);
|
||||
}
|
||||
|
||||
// General Error Occurred
|
||||
return $this->_general_error();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* remove_participant() - removes user from existing thread
|
||||
*
|
||||
* @param integer $thread_id REQUIRED
|
||||
* @param integer $user_id REQUIRED
|
||||
* @return array
|
||||
*/
|
||||
function remove_participant($thread_id, $user_id)
|
||||
{
|
||||
if (empty($thread_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_THREAD_ID);
|
||||
}
|
||||
|
||||
if (empty($user_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_USER_ID);
|
||||
}
|
||||
|
||||
if ($this->ci->message_model->remove_participant($thread_id, $user_id))
|
||||
{
|
||||
return $this->_success(NULL, MSG_PARTICIPANT_REMOVED);
|
||||
}
|
||||
|
||||
// General Error Occurred
|
||||
return $this->_general_error();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* send_new_message() - sends new internal message. This function will create a new thread
|
||||
*
|
||||
* @param integer $sender_id REQUIRED
|
||||
* @param mixed $recipients REQUIRED - a single integer or an array of integers, representing user_ids
|
||||
* @param string $subject
|
||||
* @param string $body
|
||||
* @param integer $priority
|
||||
* @return array
|
||||
*/
|
||||
function send_new_message($sender_id, $recipients, $subject = '', $body = '', $priority = PRIORITY_NORMAL)
|
||||
{
|
||||
if (empty($sender_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_SENDER_ID);
|
||||
}
|
||||
|
||||
if (empty($recipients))
|
||||
{
|
||||
return array(
|
||||
'err' => 1,
|
||||
'code' => MSG_ERR_INVALID_RECIPIENTS,
|
||||
'msg' => lang('mahana_'.MSG_ERR_INVALID_RECIPIENTS)
|
||||
);
|
||||
}
|
||||
|
||||
if ($thread_id = $this->ci->message_model->send_new_message($sender_id, $recipients, $subject, $body, $priority))
|
||||
{
|
||||
return $this->_success($thread_id, MSG_MESSAGE_SENT);
|
||||
}
|
||||
|
||||
// General Error Occurred
|
||||
return $this->_general_error();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* reply_to_message() - replies to internal message. This function will NOT create a new thread or participant list
|
||||
*
|
||||
* @param integer $msg_id REQUIRED
|
||||
* @param integer $sender_id REQUIRED
|
||||
* @param string $subject
|
||||
* @param string $body
|
||||
* @param integer $priority
|
||||
* @return array
|
||||
*/
|
||||
function reply_to_message($msg_id, $sender_id, $subject = '', $body = '', $priority = PRIORITY_NORMAL)
|
||||
{
|
||||
if (empty($sender_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_SENDER_ID);
|
||||
}
|
||||
|
||||
if (empty($msg_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_MSG_ID);
|
||||
}
|
||||
|
||||
if ($new_msg_id = $this->ci->message_model->reply_to_message($msg_id, $sender_id, $body, $priority))
|
||||
{
|
||||
return $this->_success($new_msg_id, MSG_MESSAGE_SENT);
|
||||
}
|
||||
|
||||
// General Error Occurred
|
||||
return $this->_general_error();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* get_participant_list() - returns list of participants on given thread. If sender_id set, sender_id will be left off list
|
||||
*
|
||||
* @param integer $thread_id REQUIRED
|
||||
* @param integer $sender_id REQUIRED
|
||||
* @return array
|
||||
*/
|
||||
function get_participant_list($thread_id, $sender_id = 0)
|
||||
{
|
||||
if (empty($thread_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_THREAD_ID);
|
||||
}
|
||||
|
||||
if ($participants = $this->ci->message_model-> get_participant_list($thread_id, $sender_id))
|
||||
{
|
||||
return $this->_success($participants);
|
||||
}
|
||||
|
||||
// General Error Occurred
|
||||
return $this->_general_error();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* get_msg_count() - returns integer with count of message for user, by status. defaults to new messages
|
||||
*
|
||||
* @param integer $user_id REQUIRED
|
||||
* @param integer $status_id OPTIONAL - defaults to "Unread"
|
||||
* @return array
|
||||
*/
|
||||
function get_msg_count($user_id, $status_id = MSG_STATUS_UNREAD)
|
||||
{
|
||||
if (empty($user_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_USER_ID);
|
||||
}
|
||||
|
||||
if (is_numeric($message = $this->ci->message_model->get_msg_count($user_id, $status_id)))
|
||||
{
|
||||
return $this->_success($message);
|
||||
}
|
||||
|
||||
// General Error Occurred
|
||||
return $this->_general_error();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Private Functions from here out!
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Success
|
||||
*
|
||||
* @param mixed $retval
|
||||
* @return array
|
||||
*/
|
||||
private function _success($retval = '', $message = MSG_SUCCESS)
|
||||
{
|
||||
return array(
|
||||
'err' => 0,
|
||||
'code' => MSG_SUCCESS,
|
||||
'msg' => lang('mahana_' . $message),
|
||||
'retval' => $retval
|
||||
);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Invalid ID
|
||||
*
|
||||
* @param integer config.php error code numbers
|
||||
* @return array
|
||||
*/
|
||||
private function _invalid_id($error = '')
|
||||
{
|
||||
return array(
|
||||
'err' => 1,
|
||||
'code' => $error,
|
||||
'msg' => lang('mahana_'.$error)
|
||||
);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Error Particpant Exists
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function _participant_error($error = '')
|
||||
{
|
||||
return array(
|
||||
'err' => 1,
|
||||
'code' => 1,
|
||||
'msg' => lang('mahana_' . $error)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* General Error
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function _general_error()
|
||||
{
|
||||
return array(
|
||||
'err' => 1,
|
||||
'code' => MSG_ERR_GENERAL,
|
||||
'msg' => lang('mahana_'.MSG_ERR_GENERAL)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ class Dms_model extends DB_Model
|
||||
$this->pk = 'dms_id';
|
||||
}
|
||||
|
||||
protected function insertDmsVersion($data)
|
||||
public function insertDmsVersion($data)
|
||||
{
|
||||
$tableName = 'campus.tbl_dms_version';
|
||||
|
||||
@@ -27,7 +27,7 @@ class Dms_model extends DB_Model
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
|
||||
protected function updateDmsVersion($id, $data)
|
||||
public function updateDmsVersion($id, $data)
|
||||
{
|
||||
$tableName = 'campus.tbl_dms_version';
|
||||
|
||||
|
||||
@@ -11,30 +11,50 @@ class Prestudent_model extends DB_Model
|
||||
$this->dbTable = 'public.tbl_prestudent';
|
||||
$this->pk = 'prestudent_id';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loadPrestudentPerson($prestudentID)
|
||||
public function getLastStatus($prestudent_id, $studiensemester_kurzbz = '', $status_kurzbz = '')
|
||||
{
|
||||
// Check the rights
|
||||
if (! $this->fhc_db_acl->isBerechtigt('basis/person', 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> basis/person', FHC_MODEL_ERROR);
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl['public.tbl_prestudentstatus'], 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['public.tbl_prestudentstatus'], FHC_MODEL_ERROR);
|
||||
|
||||
// Prepare SQL-Query
|
||||
$this->db->select('*')
|
||||
->from('public.tbl_prestudent')
|
||||
->join('public.tbl_person', 'person_id')
|
||||
->where('prestudent_id', $prestudentID);
|
||||
// Do the query
|
||||
$result = $this->db->get()->result_object();
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl['lehre.tbl_studienplan'], 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['lehre.tbl_studienplan'], FHC_MODEL_ERROR);
|
||||
|
||||
// Return the result
|
||||
if ($result)
|
||||
return $this->_success($result);
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl['public.tbl_status'], 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['public.tbl_status'], FHC_MODEL_ERROR);
|
||||
|
||||
$query = "SELECT tbl_prestudentstatus.*,
|
||||
bezeichnung AS studienplan_bezeichnung,
|
||||
tbl_status.bezeichnung_mehrsprachig
|
||||
FROM public.tbl_prestudentstatus LEFT JOIN lehre.tbl_studienplan USING (studienplan_id)
|
||||
JOIN public.tbl_status USING (status_kurzbz)
|
||||
WHERE tbl_status.status_kurzbz = tbl_prestudentstatus.status_kurzbz
|
||||
AND prestudent_id = ?";
|
||||
|
||||
$parametersArray = array($prestudent_id);
|
||||
|
||||
if ($studiensemester_kurzbz != '')
|
||||
{
|
||||
array_push($parametersArray, $studiensemester_kurzbz);
|
||||
$query .= ' AND studiensemester_kurzbz = ?';
|
||||
}
|
||||
if ($status_kurzbz != '')
|
||||
{
|
||||
array_push($parametersArray, $status_kurzbz);
|
||||
$query .= ' AND status_kurzbz = ?';
|
||||
}
|
||||
|
||||
$query .= ' ORDER BY datum DESC, insertamum DESC, ext_id DESC LIMIT 1';
|
||||
|
||||
$result = $this->db->query($query, $parametersArray);
|
||||
|
||||
if (is_object($result))
|
||||
return $this->_success($result->result());
|
||||
else
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -23,29 +23,19 @@ class Message_model extends DB_Model
|
||||
* @param integer $person_id REQUIRED
|
||||
* @return array
|
||||
*/
|
||||
function getMessage($msg_id, $person_id)
|
||||
/*function getMessage($msg_id)
|
||||
{
|
||||
// Validate
|
||||
if (empty($msg_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_MSG_ID);
|
||||
}
|
||||
if (empty($person_id))
|
||||
{
|
||||
return $this->_invalid_id(MSG_ERR_INVALID_USER_ID);
|
||||
}
|
||||
$sql = 'SELECT m.*, s.status, t.subject, ' . "CONCAT(vorname, ' ', nachname) as user_name" .
|
||||
' FROM ' . $this->db->dbprefix . 'tbl_msg_message m ' .
|
||||
' JOIN ' . $this->db->dbprefix . 'tbl_msg_thread t ON (m.thread_id = t.thread_id) ' .
|
||||
' JOIN ' . $this->db->dbprefix . 'public.tbl_person' . ' ON (' . 'tbl_person.person_id' . ' = m.sender_id) '.
|
||||
' JOIN ' . $this->db->dbprefix . 'tbl_msg_status s ON (s.message_id = m.message_id AND s.person_id = ? ) ' .
|
||||
' WHERE m.message_id = ? ' ;
|
||||
$result = $this->db->query($sql, array($person_id, $msg_id));
|
||||
|
||||
$sql = 'SELECT * FROM tbl_msg_message JOIN tbl_person USING (person_id) WHERE message_id=?' ;
|
||||
$result = $this->db->query($sql, array($msg_id));
|
||||
if ($result)
|
||||
return $this->_success($result->result_array());
|
||||
return $this->_success($result->result());
|
||||
else
|
||||
return $this->_general_error();
|
||||
}
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}*/
|
||||
/** -----------------------------------------------------------------
|
||||
* Get a Full Thread
|
||||
* get_full_thread() - will return a entire thread, including the status for specified user.
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
class Recipient_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_msg_recipient';
|
||||
$this->pk = array('person_id', 'message_id');
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Seed_Prestudent
|
||||
{
|
||||
|
||||
public function seed($limit = 25)
|
||||
{
|
||||
echo "Seeding $limit prestudents ";
|
||||
$this->fhc =& get_instance();
|
||||
$this->fhc->load->model('crm/Prestudent_model');
|
||||
|
||||
for ($i = 0; $i < $limit; $i++)
|
||||
{
|
||||
echo ".";
|
||||
$data = array(
|
||||
'person_id' => $i+3, // start with person_id 3
|
||||
'aufmerksamdurch_kurzbz' => 'k.A.',
|
||||
'studiengang_kz' => $this->fhc->faker->firstName,
|
||||
'nachname' => $this->fhc->faker->lastName,
|
||||
//'address' => $this->faker->streetAddress,
|
||||
'gebort' => $this->fhc->faker->city,
|
||||
//'state' => $this->faker->state,
|
||||
//'country' => $this->faker->country,
|
||||
//'postcode' => $this->faker->postcode,
|
||||
//'email' => $this->faker->email,
|
||||
//'email_verified' => mt_rand(0, 1) ? '0' : '1',
|
||||
//'phone' => $this->faker->phoneNumber,
|
||||
'gebdatum' => $this->fhc->faker->dateTimeThisCentury->format('Y-m-d H:i:s'),
|
||||
//'registration_date' => $this->faker->dateTimeThisYear->format('Y-m-d H:i:s'),
|
||||
//'ip_address' => mt_rand(0, 1) ? $this->faker->ipv4 : $this->faker->ipv6,
|
||||
);
|
||||
|
||||
$this->fhc->Prestudent_model->insert($data);
|
||||
}
|
||||
|
||||
echo PHP_EOL;
|
||||
|
||||
}
|
||||
|
||||
public function truncate()
|
||||
{
|
||||
//$this->db->query('EMPTY TABLE public.person;');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Seed_Message
|
||||
{
|
||||
|
||||
public function seed($limit = 25)
|
||||
{
|
||||
echo "Seeding $limit messages ";
|
||||
$this->fhc =& get_instance();
|
||||
$this->fhc->load->model('system/Recipient_model');
|
||||
$this->fhc->Recipient_model->setUid('admin');
|
||||
$this->fhc->load->model('system/Message_model');
|
||||
|
||||
for ($i = 0; $i < $limit; $i++)
|
||||
{
|
||||
echo ".";
|
||||
|
||||
$data = array
|
||||
(
|
||||
'subject' => $this->fhc->faker->sentence(4, true),
|
||||
'body' => $this->fhc->faker->text(400),
|
||||
'person_id' => $i%5+1
|
||||
);
|
||||
$message = $this->fhc->Message_model->insert($data);
|
||||
|
||||
$data = array
|
||||
(
|
||||
'message_id' => $message->retval,
|
||||
'person_id' => $i%5+2,
|
||||
'insertvon' => 'seed'
|
||||
);
|
||||
$recipient = $this->fhc->Recipient_model->insert($data);
|
||||
if ($recipient->error)
|
||||
show_error($recipient->retval);
|
||||
//for ($j=1; $j<10; $j++)
|
||||
// $this->fhc->Message_model->addRecipient($thread->retval, $i+$j+5);
|
||||
}
|
||||
|
||||
echo PHP_EOL;
|
||||
|
||||
}
|
||||
|
||||
public function truncate()
|
||||
{
|
||||
//$this->db->query('EMPTY TABLE public.person;');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<div class="row">
|
||||
<div class="span4">
|
||||
<h2>Nachricht <?php echo $message->message_id; ?></h2>
|
||||
|
||||
Absender: <?php echo $message->person_id; ?><br/>
|
||||
Betreff: <?php echo $message->subject; ?><br/>
|
||||
Text: <?php echo $message->body; ?><br/>
|
||||
<?php
|
||||
// This is an example to show that you can load stuff from inside the template file
|
||||
echo $this->template->widget("organisationseinheit_widget", array('title' => 'Organisationseinheit', 'oe_kurzbz' => $message->oe_kurzbz));
|
||||
?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,42 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo $this->template->title->default("Default title"); ?></title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="<?php echo $this->template->description; ?>">
|
||||
<meta name="author" content="">
|
||||
<?php echo $this->template->meta; ?>
|
||||
<?php echo $this->template->stylesheet; ?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
// This is an example to show that you can load stuff from inside the template file
|
||||
echo $this->template->widget("navigation", array('title' => 'Project name'));
|
||||
?>
|
||||
|
||||
<div class="container" style="margin-top: 60px;">
|
||||
|
||||
<?php
|
||||
// This is the main content partial
|
||||
echo $this->template->content;
|
||||
?>
|
||||
|
||||
<hr>
|
||||
|
||||
<footer>
|
||||
<p>
|
||||
<?php
|
||||
// Show the footer partial, and prepend copyright message
|
||||
echo $this->template->footer->prepend("© Special Company 2012 - ");
|
||||
?>
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="//code.jquery.com/jquery-latest.min.js"></script>
|
||||
<?php echo $this->template->javascript; ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,12 @@
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a class="brand" href="#"><?php echo $title; ?></a>
|
||||
<ul class="nav">
|
||||
<?php foreach($items as $item): ?>
|
||||
<li><a href="#<?php echo $item; ?>"><?php echo $item; ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php echo $title; ?>
|
||||
<select name="organisationseinheit">
|
||||
<?php foreach($items as $item): ?>
|
||||
<option value="<?php echo $item['value']; ?>" <?php if ($item['selected']) echo 'selected'?>>
|
||||
<?php echo $item['name']; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Demo widget
|
||||
*/
|
||||
class Navigation extends Widget {
|
||||
|
||||
public function display($data) {
|
||||
|
||||
if (!isset($data['items'])) {
|
||||
$data['items'] = array('Home', 'About', 'Contact');
|
||||
}
|
||||
|
||||
$this->view('widgets/navigation', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* OE widget
|
||||
*/
|
||||
class organisationseinheit_widget extends Widget
|
||||
{
|
||||
public function display($data)
|
||||
{
|
||||
$this->load->model('organisation/Organisationseinheit_model');
|
||||
$res = $this->Organisationseinheit_model->getRecursiveList();
|
||||
var_dump($res);
|
||||
foreach ($res->retval->result() as $obj)
|
||||
{
|
||||
$item = array('name' => $obj->name, 'value' => $obj->value);
|
||||
if (isset($data['oe_kurzbz']) && $obj->value == $data['oe_kurzbz'])
|
||||
$item['selected'] = true;
|
||||
else
|
||||
$item['selected'] = false;
|
||||
$data['items'][] = $item;
|
||||
}
|
||||
|
||||
$this->view('widgets/organisationseinheit', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,10 +19,16 @@
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
require_once(dirname(__FILE__).'/datum.class.php');
|
||||
|
||||
class berechtigung extends basis_db
|
||||
// CI
|
||||
require_once(dirname(__FILE__).'/../ci_hack.php');
|
||||
require_once(dirname(__FILE__).'/../application/models/system/Berechtigung_model.php');
|
||||
|
||||
class berechtigung extends Berechtigung_model
|
||||
{
|
||||
use db_extra; //CI Hack
|
||||
|
||||
public $result=array();
|
||||
public $new;
|
||||
|
||||
@@ -46,13 +52,13 @@ class berechtigung extends basis_db
|
||||
*/
|
||||
public function load($berechtigung_kurzbz)
|
||||
{
|
||||
$qry = "SELECT * FROM system.tbl_berechtigung WHERE berechtigung_kurzbz=".$this->db_add_param($berechtigung_kurzbz);
|
||||
$result = parent::load($berechtigung_kurzbz);
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS && is_array($result->retval))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
if (count($result->retval) > 0)
|
||||
{
|
||||
$this->berechtigung_kurzbz=$row->berechtigung_kurzbz;
|
||||
$this->berechtigung_kurzbz = $row->berechtigung_kurzbz;
|
||||
$this->beschreibung = $row->beschreibung;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ require_once(dirname(__FILE__).'/../application/models/content/Dms_model.php');
|
||||
|
||||
class dms extends Dms_model
|
||||
{
|
||||
use db_extra; //CI Hack
|
||||
|
||||
public $new;
|
||||
public $result=array();
|
||||
|
||||
|
||||
@@ -23,10 +23,16 @@
|
||||
* Klasse funktion (FAS-Online)
|
||||
* @create 14-03-2006
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
require_once(dirname(__FILE__).'/datum.class.php');
|
||||
|
||||
class funktion extends basis_db
|
||||
// CI
|
||||
require_once(dirname(__FILE__).'/../ci_hack.php');
|
||||
require_once(dirname(__FILE__).'/../application/models/ressource/Funktion_model.php');
|
||||
|
||||
class funktion extends Funktion_model
|
||||
{
|
||||
use db_extra; //CI Hack
|
||||
|
||||
public $new; // boolean
|
||||
public $result = array(); // fachbereich Objekt
|
||||
|
||||
@@ -105,22 +111,24 @@ class funktion extends basis_db
|
||||
*/
|
||||
public function load($funktion_kurzbz)
|
||||
{
|
||||
if($funktion_kurzbz == '')
|
||||
if ($funktion_kurzbz == '')
|
||||
{
|
||||
$this->errormsg = 'funktion_bz darf nicht leer sein';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "SELECT * FROM public.tbl_funktion WHERE funktion_kurzbz = ".$this->db_add_param($funktion_kurzbz).";";
|
||||
|
||||
if(!$this->db_query($qry))
|
||||
$result = parent::load($funktion_kurzbz);
|
||||
|
||||
if (!is_object($result) || (is_object($result) && $result->error != EXIT_SUCCESS))
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden des Datensatzes';
|
||||
return false;
|
||||
}
|
||||
|
||||
if($row = $this->db_fetch_object())
|
||||
if (is_array($result->retval) && count($result->retval) == 1)
|
||||
{
|
||||
$row = $result->retval[0];
|
||||
|
||||
$this->funktion_kurzbz = $row->funktion_kurzbz;
|
||||
$this->beschreibung = $row->beschreibung;
|
||||
$this->aktiv = $this->db_parse_bool($row->aktiv);
|
||||
|
||||
@@ -31,6 +31,8 @@ require_once(dirname(__FILE__).'/../application/models/person/Kontakt_model.php'
|
||||
|
||||
class kontakt extends Kontakt_model
|
||||
{
|
||||
use db_extra; //CI Hack
|
||||
|
||||
public $new; // boolean
|
||||
public $result = array(); // adresse Objekt
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ require_once(dirname(__FILE__).'/../application/models/codex/Orgform_model.php')
|
||||
|
||||
class organisationsform extends Orgform_model
|
||||
{
|
||||
use db_extra; //CI Hack
|
||||
|
||||
public $orgform_kurzbz;
|
||||
public $code;
|
||||
public $bezeichnung;
|
||||
|
||||
+26
-16
@@ -23,10 +23,16 @@
|
||||
* Klasse ort (FAS-Online)
|
||||
* @create 04-12-2006
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
require_once(dirname(__FILE__).'/datum.class.php');
|
||||
|
||||
class ort extends basis_db
|
||||
// CI
|
||||
require_once(dirname(__FILE__).'/../ci_hack.php');
|
||||
require_once(dirname(__FILE__).'/../application/models/ressource/Ort_model.php');
|
||||
|
||||
class ort extends Ort_model
|
||||
{
|
||||
use db_extra; //CI Hack
|
||||
|
||||
public $new; // boolean
|
||||
public $result = array(); // ort Objekt
|
||||
|
||||
@@ -72,29 +78,33 @@ class ort extends basis_db
|
||||
* Laedt alle verfuegbaren Orte
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function getAll($raumtyp_kurzbz=null)
|
||||
public function getAll($raumtyp_kurzbz = null)
|
||||
{
|
||||
$qry = 'SELECT * FROM public.tbl_ort ORDER BY ort_kurzbz;';
|
||||
|
||||
if(!is_null($raumtyp_kurzbz) && $raumtyp_kurzbz!='')
|
||||
parent::addOrder('ort_kurzbz');
|
||||
|
||||
if (!is_null($raumtyp_kurzbz) && $raumtyp_kurzbz != '')
|
||||
{
|
||||
$qry = '
|
||||
SELECT
|
||||
tbl_ort.*
|
||||
FROM
|
||||
public.tbl_ort
|
||||
JOIN public.tbl_ortraumtyp USING(ort_kurzbz)
|
||||
WHERE raumtyp_kurzbz='.$this->db_add_param($raumtyp_kurzbz).'
|
||||
ORDER BY ort_kurzbz;';
|
||||
$result = parent::addJoin('public.tbl_ortraumtyp', 'ort_kurzbz');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = parent::loadWhere(array('raumtyp_kurzbz' => $raumtyp_kurzbz));
|
||||
}
|
||||
}
|
||||
if(!$this->db_query($qry))
|
||||
else
|
||||
{
|
||||
$result = parent::loadWhole();
|
||||
}
|
||||
|
||||
if (!is_object($result) || (is_object($result) && ($result->error != EXIT_SUCCESS || !is_array($result->retval))))
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Datensaetze';
|
||||
return false;
|
||||
}
|
||||
|
||||
while($row = $this->db_fetch_object())
|
||||
for ($i = 0; $i < count($result->retval); $i++)
|
||||
{
|
||||
$row = $result->retval[$i];
|
||||
|
||||
$ort_obj = new ort();
|
||||
|
||||
$ort_obj->ort_kurzbz = $row->ort_kurzbz;
|
||||
|
||||
@@ -31,7 +31,7 @@ require_once(dirname(__FILE__).'/../application/models/person/Person_model.php')
|
||||
class person extends Person_model
|
||||
{
|
||||
use db_extra; //CI Hack
|
||||
|
||||
|
||||
public $errormsg; // string
|
||||
public $new; // boolean
|
||||
public $personen = array(); // person Objekt
|
||||
|
||||
@@ -27,6 +27,8 @@ require_once(dirname(__FILE__).'/../application/models/crm/Preinteressent_model.
|
||||
|
||||
class preinteressent extends Preinteressent_model
|
||||
{
|
||||
use db_extra; //CI Hack
|
||||
|
||||
public $new; // boolean
|
||||
public $result = array();
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/datum.class.php');
|
||||
// require_once(dirname(__FILE__).'/person.class.php');
|
||||
// require_once(dirname(__FILE__).'/log.class.php');
|
||||
|
||||
// CI
|
||||
require_once(dirname(__FILE__).'/../ci_hack.php');
|
||||
@@ -30,6 +28,7 @@ require_once(dirname(__FILE__).'/../application/models/crm/Prestudent_model.php'
|
||||
class prestudent extends Prestudent_model
|
||||
{
|
||||
use db_extra; //CI Hack
|
||||
|
||||
public $errormsg; // string
|
||||
|
||||
//Tabellenspalten
|
||||
@@ -107,20 +106,20 @@ class prestudent extends Prestudent_model
|
||||
*/
|
||||
public function load($prestudent_id)
|
||||
{
|
||||
if(!is_numeric($prestudent_id))
|
||||
if (!is_numeric($prestudent_id))
|
||||
{
|
||||
$this->errormsg = 'ID ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = 'SELECT * '
|
||||
. 'FROM public.tbl_prestudent '
|
||||
. 'WHERE prestudent_id = '.$this->db_add_param($prestudent_id, FHC_INTEGER);
|
||||
$result = parent::load($prestudent_id);
|
||||
|
||||
if($this->db_query($qry))
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS && is_array($result->retval))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
if (count($result->retval) > 0)
|
||||
{
|
||||
$row = $result->retval[0];
|
||||
|
||||
$this->prestudent_id = $row->prestudent_id;
|
||||
$this->aufmerksamdurch_kurzbz = $row->aufmerksamdurch_kurzbz;
|
||||
$this->studiengang_kz = $row->studiengang_kz;
|
||||
@@ -155,10 +154,8 @@ class prestudent extends Prestudent_model
|
||||
$this->zgvdoktordatum = $row->zgvdoktordatum;
|
||||
$this->zgvdoktornation = $row->zgvdoktornation;
|
||||
|
||||
if(!person::load($row->person_id))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
$person = new person();
|
||||
return $person->load($row->person_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -973,33 +970,22 @@ class prestudent extends Prestudent_model
|
||||
* @param $studiensemester_kurzbz
|
||||
* @return boolean
|
||||
*/
|
||||
public function getLastStatus($prestudent_id, $studiensemester_kurzbz='', $status_kurzbz = '')
|
||||
public function getLastStatus($prestudent_id, $studiensemester_kurzbz = '', $status_kurzbz = '')
|
||||
{
|
||||
if($prestudent_id=='' || !is_numeric($prestudent_id))
|
||||
if ($prestudent_id == '' || !is_numeric($prestudent_id))
|
||||
{
|
||||
$this->errormsg = 'Prestudent_id ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "SELECT tbl_prestudentstatus.*, bezeichnung AS studienplan_bezeichnung,
|
||||
tbl_status.bezeichnung_mehrsprachig
|
||||
FROM public.tbl_prestudentstatus
|
||||
LEFT JOIN lehre.tbl_studienplan USING (studienplan_id)
|
||||
JOIN public.tbl_status USING (status_kurzbz)
|
||||
WHERE tbl_status.status_kurzbz = tbl_prestudentstatus.status_kurzbz
|
||||
AND prestudent_id=".$this->db_add_param($prestudent_id, FHC_INTEGER);
|
||||
|
||||
if($studiensemester_kurzbz!='')
|
||||
$qry.=" AND studiensemester_kurzbz=".$this->db_add_param($studiensemester_kurzbz);
|
||||
|
||||
if($status_kurzbz !='')
|
||||
$qry.= " AND status_kurzbz =".$this->db_add_param($status_kurzbz);
|
||||
|
||||
$qry.=" ORDER BY datum DESC, insertamum DESC, ext_id DESC LIMIT 1";
|
||||
if($this->db_query($qry))
|
||||
$result = parent::getLastStatus($prestudent_id, $studiensemester_kurzbz, $status_kurzbz);
|
||||
|
||||
if (is_object($result) && $result->error != EXIT_SUCCESS && is_array($result->retval))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
if (count($result->retval) > 0)
|
||||
{
|
||||
$row = $result->retval[0];
|
||||
|
||||
$this->prestudent_id = $row->prestudent_id;
|
||||
$this->status_kurzbz = $row->status_kurzbz;
|
||||
$this->status_mehrsprachig = $this->db_parse_lang_array($row->bezeichnung_mehrsprachig);
|
||||
|
||||
+33
-24
@@ -19,10 +19,16 @@
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at>
|
||||
* Karl Burkhart <burkhart@technikum-wien.at>.
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
require_once(dirname(__FILE__).'/datum.class.php');
|
||||
|
||||
class statistik extends basis_db
|
||||
// CI
|
||||
require_once(dirname(__FILE__).'/../ci_hack.php');
|
||||
require_once(dirname(__FILE__).'/../application/models/organisation/Statistik_model.php');
|
||||
|
||||
class statistik extends Statistik_model
|
||||
{
|
||||
use db_extra; //CI Hack
|
||||
|
||||
public $new;
|
||||
public $statistik_obj=array();
|
||||
public $result;
|
||||
@@ -76,17 +82,14 @@ class statistik extends basis_db
|
||||
*/
|
||||
public function load($statistik_kurzbz)
|
||||
{
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
public.tbl_statistik
|
||||
WHERE
|
||||
statistik_kurzbz = " . $this->db_add_param($statistik_kurzbz);
|
||||
$result = parent::load($statistik_kurzbz);
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS && is_array($result->retval))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
if(count($result->retval) > 0)
|
||||
{
|
||||
$row = $result->retval[0];
|
||||
|
||||
$this->statistik_kurzbz = $row->statistik_kurzbz;
|
||||
$this->content_id = $row->content_id;
|
||||
$this->bezeichnung = $row->bezeichnung;
|
||||
@@ -125,15 +128,19 @@ class statistik extends basis_db
|
||||
*/
|
||||
public function getAll($order = FALSE)
|
||||
{
|
||||
$qry = 'SELECT * FROM public.tbl_statistik';
|
||||
|
||||
if($order)
|
||||
$qry .= ' ORDER BY ' . $order;
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
if ($order)
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
parent::addOrder($order);
|
||||
}
|
||||
|
||||
$result = parent::loadWhole();
|
||||
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS && is_array($result->retval))
|
||||
{
|
||||
for ($i = 0; $i < count($result->retval); $i++)
|
||||
{
|
||||
$row = $result->retval[$i];
|
||||
|
||||
$obj = new statistik();
|
||||
|
||||
$obj->statistik_kurzbz = $row->statistik_kurzbz;
|
||||
@@ -328,17 +335,19 @@ class statistik extends basis_db
|
||||
{
|
||||
$arr = array();
|
||||
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
public.tbl_statistik
|
||||
ORDER BY gruppe, bezeichnung, statistik_kurzbz";
|
||||
parent::addOrder('gruppe');
|
||||
parent::addOrder('bezeichnung');
|
||||
parent::addOrder('statistik_kurzbz');
|
||||
|
||||
$result = parent::loadWhole();
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS && is_array($result->retval))
|
||||
{
|
||||
$lastgruppe='';
|
||||
while($row = $this->db_fetch_object($result))
|
||||
for ($i = 0; $i < count($result->retval); $i++)
|
||||
{
|
||||
$row = $result->retval[$i];
|
||||
|
||||
if($row->gruppe!='' && $row->gruppe!=$lastgruppe)
|
||||
{
|
||||
$arr[$row->gruppe]=array('name'=>$row->gruppe);
|
||||
|
||||
@@ -28,6 +28,8 @@ require_once(dirname(__FILE__).'/../application/models/organisation/Studiensemes
|
||||
|
||||
class studiensemester extends Studiensemester_model
|
||||
{
|
||||
use db_extra; //CI Hack
|
||||
|
||||
public $new; // boolean
|
||||
public $studiensemester = array(); // studiensemester Objekt
|
||||
|
||||
|
||||
@@ -1091,4 +1091,21 @@ INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art
|
||||
INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art) VALUES('basis/vw_studiensemester', 'admin', 'suid');
|
||||
INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art) VALUES('lehre/reservierung', 'admin', 'suid');
|
||||
INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art) VALUES('lehre/reihungstest', 'admin', 'suid');
|
||||
INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art) VALUES('wawi/inventar:begrenzt', 'admin', 'suid');
|
||||
INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art) VALUES('wawi/inventar:begrenzt', 'admin', 'suid');
|
||||
|
||||
-- EMPTY public.tbl_statistik
|
||||
DELETE FROM public.tbl_statistik;
|
||||
|
||||
-- INSERT Statistiks (public.tbl_statistik)
|
||||
INSERT INTO public.tbl_statistik VALUES ('StudentenHistorie', 'StudentenHistorie', NULL, 'studenten_historie.php', 'Studierende', NULL, NULL, NULL, '2011-04-04 09:25:35', 'oesi', '2011-04-04 09:25:35', 'oesi', NULL, false, NULL);
|
||||
INSERT INTO public.tbl_statistik VALUES ('Abgaengerstatistik', 'Abgängerstatistik', 9, '../../content/statistik/abgaengerstatistik.php', 'Studierende', NULL, NULL, NULL, '2011-04-01 10:57:05', 'oesi', '2011-04-01 11:13:55', 'oesi', NULL, false, NULL);
|
||||
INSERT INTO public.tbl_statistik VALUES ('Absolventenstatistik', 'Absolventenstatistik', 10, '../../content/statistik/absolventenstatistik.php', 'Studierende', NULL, NULL, NULL, '2011-04-01 10:57:46', 'oesi', '2011-04-01 11:14:01', 'oesi', NULL, false, NULL);
|
||||
INSERT INTO public.tbl_statistik VALUES ('Bewerberstatistik', 'Bewerberstatistik', 2, '../../content/statistik/bewerberstatistik.php?stsem=$Studiensemester', 'Studierende', NULL, NULL, NULL, '2011-04-01 10:43:44', 'oesi', '2011-04-01 11:14:19', 'oesi', NULL, false, NULL);
|
||||
INSERT INTO public.tbl_statistik VALUES ('Lektorenstatistik', 'Lektorenstatistik', 13, '../../content/statistik/lektorenstatistik.php', 'Mitarbeiter', NULL, NULL, NULL, '2011-04-01 11:08:41', 'oesi', '2011-04-01 11:14:27', 'oesi', NULL, false, NULL);
|
||||
INSERT INTO public.tbl_statistik VALUES ('Raumauslastung', 'Raumauslastung', 3, '../lehre/raumauslastung.php', 'LV-Plan', NULL, NULL, NULL, '2011-04-01 10:51:01', 'oesi', '2011-04-01 11:14:50', 'oesi', NULL, false, NULL);
|
||||
INSERT INTO public.tbl_statistik VALUES ('Stromanalyse', 'Stromanalyse', 15, '../../content/statistik/bama_stromanalyse.php', 'Studierende', NULL, NULL, NULL, '2011-04-01 11:09:45', 'oesi', '2011-04-01 11:14:59', 'oesi', NULL, false, NULL);
|
||||
INSERT INTO public.tbl_statistik VALUES ('Mitarbeiterstatistik', 'Mitarbeiterstatistik', 14, '../../content/statistik/mitarbeiterstatistik.php', 'Mitarbeiter', NULL, NULL, NULL, '2011-04-01 11:09:13', 'oesi', '2012-01-12 15:48:47', 'kollmitz', NULL, false, NULL);
|
||||
INSERT INTO public.tbl_statistik VALUES ('Verplanungsübersicht', 'Verplanungsübersicht', 4, '../lehre/check/verplanungsuebersicht.php', 'LV-Plan', NULL, NULL, NULL, '2011-04-01 10:51:53', 'oesi', '2011-04-01 11:15:20', 'oesi', NULL, false, NULL);
|
||||
INSERT INTO public.tbl_statistik VALUES ('Zeitwünsche', 'Zeitwünsche', 5, '../lehre/zeitwuensche.php', 'LV-Plan', NULL, NULL, NULL, '2011-04-01 10:52:37', 'oesi', '2011-04-01 11:15:27', 'oesi', NULL, false, NULL);
|
||||
INSERT INTO public.tbl_statistik VALUES ('AnzahlStudierende', 'Aktuell Studierende im Haus', 16, '../../cis/private/lvplan/stpl_week_anzahl_studenten.php', 'Studierende', NULL, NULL, NULL, '2011-04-01 11:11:52', 'oesi', '2012-02-20 19:09:16', 'kindlm', NULL, false, NULL);
|
||||
INSERT INTO public.tbl_statistik VALUES ('ALVS-Statistik', 'ALVS-Statistik', 7, '../../content/statistik/alvsstatistik.php', 'Lehre', NULL, NULL, NULL, '2011-04-01 10:54:03', 'oesi', '2011-04-01 11:23:12', 'oesi', NULL, false, NULL);
|
||||
@@ -1,11 +1,21 @@
|
||||
<?php
|
||||
|
||||
$I = new ApiTester($scenario);
|
||||
$I->wantTo('Test API call v1/person/kontakt/kontakt');
|
||||
$I->wantTo('Test API call v1/person/kontakt/ kontakt, KontaktByPersonID and KontaktByPersonIDKontaktTyp');
|
||||
$I->amHttpAuthenticated("admin", "1q2w3");
|
||||
$I->haveHttpHeader('FHC-API-KEY', 'testapikey@fhcomplete.org');
|
||||
|
||||
$I->sendGET('v1/person/kontakt/kontakt', array('kontakt_id' => 1));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/person/kontakt/KontaktByPersonID', array('person_id' => 3));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/person/kontakt/KontaktByPersonIDKontaktTyp', array('person_id' => 3, 'kontakttyp' => 'email'));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
@@ -1,10 +1,15 @@
|
||||
<?php
|
||||
|
||||
$I = new ApiTester($scenario);
|
||||
$I->wantTo('Test API call v1/codex/nation/All');
|
||||
$I->wantTo('Test API call v1/codex/nation/ nation and all');
|
||||
$I->amHttpAuthenticated("admin", "1q2w3");
|
||||
$I->haveHttpHeader('FHC-API-KEY', 'testapikey@fhcomplete.org');
|
||||
|
||||
$I->sendGET('v1/codex/nation/nation', array('nation_code' => 'A'));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/codex/nation/All');
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$I = new ApiTester($scenario);
|
||||
$I->wantTo('Test API call v1/codex/orgform Orgform and All');
|
||||
$I->wantTo('Test API call v1/codex/orgform Orgform, OrgformLV and All');
|
||||
$I->amHttpAuthenticated("admin", "1q2w3");
|
||||
$I->haveHttpHeader('FHC-API-KEY', 'testapikey@fhcomplete.org');
|
||||
|
||||
@@ -13,4 +13,9 @@ $I->seeResponseContainsJson(['error' => 0]);
|
||||
$I->sendGET('v1/codex/orgform/All');
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/codex/orgform/OrgformLV');
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$I = new ApiTester($scenario);
|
||||
$I->wantTo('Test API call v1/person/person/person');
|
||||
$I->wantTo('Test API call v1/person/person/ Person and CheckBewerbung');
|
||||
$I->amHttpAuthenticated("admin", "1q2w3");
|
||||
$I->haveHttpHeader('FHC-API-KEY', 'testapikey@fhcomplete.org');
|
||||
|
||||
@@ -32,4 +32,9 @@ $I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson([
|
||||
'person_id' => '5',
|
||||
'nachname' => 'Harvey']);
|
||||
'nachname' => 'Harvey']);
|
||||
|
||||
$I->sendGET('v1/person/person/CheckBewerbung', array('email' => 'mckenzie.vicenta@calva.dev', 'studiensemester_kurzbz' => 'WS2016'));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
@@ -10,7 +10,7 @@ $I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/crm/preinteressent/PreinteressentByPersonID', array('person_id' => 1));
|
||||
$I->sendGET('v1/crm/preinteressent/PreinteressentByPersonID', array('person_id' => 3));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
@@ -10,7 +10,7 @@ $I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/crm/prestudent/PrestudentByPersonID', array('person_id' => 1));
|
||||
$I->sendGET('v1/crm/prestudent/PrestudentByPersonID', array('person_id' => 3));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
$I = new ApiTester($scenario);
|
||||
$I->wantTo('Test API call v1/organisation/statistik statistik, All and MenueArray');
|
||||
$I->amHttpAuthenticated("admin", "1q2w3");
|
||||
$I->haveHttpHeader('FHC-API-KEY', 'testapikey@fhcomplete.org');
|
||||
|
||||
$I->sendGET('v1/organisation/statistik/Statistik', array('statistik_kurzbz' => 'Stromanalyse'));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/organisation/statistik/All');
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/organisation/statistik/MenueArray');
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$I = new ApiTester($scenario);
|
||||
$I->wantTo('Test API call v1/organisation/studiensemester studiensemester and nextStudiensemester');
|
||||
$I->wantTo('Test API call to all v1/organisation/studiensemester methods');
|
||||
$I->amHttpAuthenticated("admin", "1q2w3");
|
||||
$I->haveHttpHeader('FHC-API-KEY', 'testapikey@fhcomplete.org');
|
||||
|
||||
@@ -18,4 +18,64 @@ $I->seeResponseContainsJson(['error' => 0]);
|
||||
$I->sendGET('v1/organisation/studiensemester/NextStudiensemester', array('art' => 'WS'));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/organisation/studiensemester/All');
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/organisation/studiensemester/Akt');
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/organisation/studiensemester/AktNext', array('semester' => '1'));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/organisation/studiensemester/AktNext', array('semester' => '2'));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/organisation/studiensemester/LastOrAktSemester');
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/organisation/studiensemester/LastOrAktSemester', array('days' => '1024'));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/organisation/studiensemester/NextFrom', array('studiensemester_kurzbz' => 'WS2015'));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/organisation/studiensemester/Previous');
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/organisation/studiensemester/Nearest', array('studiensemester_kurzbz' => 'WS2015'));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/organisation/studiensemester/Finished');
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/organisation/studiensemester/Finished', array('limit' => '3'));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
|
||||
$I->sendGET('v1/organisation/studiensemester/Timestamp', array('studiensemester_kurzbz' => 'WS2015'));
|
||||
$I->seeResponseCodeIs(200);
|
||||
$I->seeResponseIsJson();
|
||||
$I->seeResponseContainsJson(['error' => 0]);
|
||||
@@ -120,6 +120,7 @@ $ort = array();
|
||||
|
||||
foreach ($ort_obj->result as $row)
|
||||
{
|
||||
$ort[$row->ort_kurzbz] = new stdClass(); // Prevents the warning "Creating default object from empty value"
|
||||
$ort[$row->ort_kurzbz]->max_person = $row->max_person;
|
||||
}
|
||||
$qry = "SELECT DISTINCT vw_".$db_stpl_table.".unr,datum, stunde, ort_kurzbz, studiensemester_kurzbz, vw_".$db_stpl_table.".studiengang_kz, vw_".$db_stpl_table.".semester, verband, gruppe, gruppe_kurzbz, UPPER(stg_typ || stg_kurzbz) as stg_kurzbz, lehrfach, lehrfach_bez
|
||||
|
||||
@@ -59,10 +59,10 @@ if(!($erg=$db->db_query($qry)))
|
||||
die($db->db_last_error());
|
||||
|
||||
$num_rows=$db->db_num_rows($erg);
|
||||
for ($i=0;$i<$num_rows;$i++)
|
||||
for ($i = 0; $i < $num_rows; $i++)
|
||||
{
|
||||
$row=$db->db_fetch_object($erg,$i);
|
||||
$wunsch[$row->tag][$row->stunde][$row->gewicht]=$row->anz;
|
||||
$row = $db->db_fetch_object($erg, $i);
|
||||
$wunsch[$row->tag][$row->stunde][$row->gewicht] = $row->anz;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -98,18 +98,21 @@ Anzahl der Lektoren: <?PHP echo $anz_lektoren; ?>
|
||||
for ($j=1; $j<7; $j++)
|
||||
{
|
||||
echo '<TR><TD>'.$tagbez[1][$j].'</TD>';
|
||||
for ($i=0;$i<$num_rows_stunde;$i++)
|
||||
if (isset($wunsch)) // Prevents warnings if no data are present
|
||||
{
|
||||
$pos=$wunsch[$j][$i+1][4]+$wunsch[$j][$i+1][5];
|
||||
$neg=(isset($wunsch[$j][$i+1][3])?$wunsch[$j][$i+1][3]:0)+
|
||||
(isset($wunsch[$j][$i+1][2])?$wunsch[$j][$i+1][2]:0)+
|
||||
(isset($wunsch[$j][$i+1][1])?$wunsch[$j][$i+1][1]:0)+
|
||||
(isset($wunsch[$j][$i+1][0])?$wunsch[$j][$i+1][0]:0);
|
||||
$bgcolor=isset($cfgStdBgcolor[round(14/$anz_lektoren*$pos)-4])?$cfgStdBgcolor[round(14/$anz_lektoren*$pos)-4]:'';
|
||||
echo '<TD bgcolor="'.$bgcolor.'">';
|
||||
echo '+:'.round(100/$anz_lektoren*$pos).'%<BR>';
|
||||
echo '-:'.round(100/$anz_lektoren*$neg).'%';
|
||||
echo '</TD>';
|
||||
for ($i=0;$i<$num_rows_stunde;$i++)
|
||||
{
|
||||
$pos=$wunsch[$j][$i+1][4]+$wunsch[$j][$i+1][5];
|
||||
$neg=(isset($wunsch[$j][$i+1][3])?$wunsch[$j][$i+1][3]:0)+
|
||||
(isset($wunsch[$j][$i+1][2])?$wunsch[$j][$i+1][2]:0)+
|
||||
(isset($wunsch[$j][$i+1][1])?$wunsch[$j][$i+1][1]:0)+
|
||||
(isset($wunsch[$j][$i+1][0])?$wunsch[$j][$i+1][0]:0);
|
||||
$bgcolor=isset($cfgStdBgcolor[round(14/$anz_lektoren*$pos)-4])?$cfgStdBgcolor[round(14/$anz_lektoren*$pos)-4]:'';
|
||||
echo '<TD bgcolor="'.$bgcolor.'">';
|
||||
echo '+:'.round(100/$anz_lektoren*$pos).'%<BR>';
|
||||
echo '-:'.round(100/$anz_lektoren*$neg).'%';
|
||||
echo '</TD>';
|
||||
}
|
||||
}
|
||||
echo '</TR>';
|
||||
}
|
||||
|
||||
@@ -289,7 +289,10 @@ if (!$funktion->load($kurzbz))
|
||||
|
||||
|
||||
$funktion = new funktion();
|
||||
$funktion->load($funktion_kurzbz);
|
||||
if (isset($funktion_kurzbz)) // Prevents notice "Undefined variable: funktion_kurzbz"
|
||||
{
|
||||
$funktion->load($funktion_kurzbz);
|
||||
}
|
||||
|
||||
if($funktion->fachbereich)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user