- Modified FHC_Model, now it is saving uid in CI session

- Added codeception tests
- Added statistik to dump.sql
- Moved old libraries to CI
This commit is contained in:
paolo
2016-06-06 16:36:23 +02:00
parent dabcf8188b
commit 0dc605df3c
19 changed files with 209 additions and 34 deletions
@@ -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
+6
View File
@@ -23,6 +23,12 @@ class FHC_Model extends CI_Model
{
$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));
}
+2
View File
@@ -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();
+2
View File
@@ -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
+2
View File
@@ -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;
+1 -1
View File
@@ -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
+2
View File
@@ -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();
+1
View File
@@ -30,6 +30,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
+33 -24
View File
@@ -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);
+2
View File
@@ -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
+18 -1
View File
@@ -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);
+11 -1
View File
@@ -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]);