mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-21 17:02:19 +00:00
- Modified FHC_Model contructor to get UID from vilesci authentication
- Copied functionalities from old libraries to controllers - Ported old libraries to CI - Modified codeception
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
class Orgform_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -11,4 +11,23 @@ class Orgform_model extends DB_Model
|
||||
$this->dbTable = 'bis.tbl_orgform';
|
||||
$this->pk = 'orgform_kurzbz';
|
||||
}
|
||||
}
|
||||
|
||||
public function getOrgformLV()
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl['bis.tbl_orgform'], 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['bis.tbl_orgform'], FHC_MODEL_ERROR);
|
||||
|
||||
$query = "SELECT *
|
||||
FROM bis.tbl_orgform
|
||||
WHERE orgform_kurzbz NOT IN ('VBB', 'ZGS')
|
||||
ORDER BY orgform_kurzbz";
|
||||
|
||||
$result = $this->db->query($query);
|
||||
|
||||
if (is_object($result))
|
||||
return $this->_success($result->result());
|
||||
else
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
class Studiensemester_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -11,4 +11,93 @@ class Studiensemester_model extends DB_Model
|
||||
$this->dbTable = 'public.tbl_studiensemester';
|
||||
$this->pk = 'studiensemester_kurzbz';
|
||||
}
|
||||
}
|
||||
|
||||
public function getLastOrAktSemester($days = 60)
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl['public.tbl_studiensemester'], 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['public.tbl_studiensemester'], FHC_MODEL_ERROR);
|
||||
|
||||
if (!is_numeric($days))
|
||||
{
|
||||
$days = 60;
|
||||
}
|
||||
|
||||
$query = "SELECT studiensemester_kurzbz
|
||||
FROM public.tbl_studiensemester
|
||||
WHERE start < NOW() - '" . $days . " DAYS'::INTERVAL
|
||||
ORDER BY start DESC
|
||||
LIMIT 1";
|
||||
|
||||
$result = $this->db->query($query);
|
||||
|
||||
if (is_object($result))
|
||||
return $this->_success($result->result());
|
||||
else
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
|
||||
public function getNextFrom($studiensemester_kurzbz)
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl['public.tbl_studiensemester'], 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['public.tbl_studiensemester'], FHC_MODEL_ERROR);
|
||||
|
||||
$query = "SELECT studiensemester_kurzbz,
|
||||
start,
|
||||
ende
|
||||
FROM public.tbl_studiensemester
|
||||
WHERE start > (
|
||||
SELECT ende
|
||||
FROM public.tbl_studiensemester
|
||||
WHERE studiensemester_kurzbz = ?
|
||||
)
|
||||
ORDER BY start
|
||||
LIMIT 1";
|
||||
|
||||
$result = $this->db->query($query, array($studiensemester_kurzbz));
|
||||
|
||||
if (is_object($result))
|
||||
return $this->_success($result->result());
|
||||
else
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function getNearest($semester = '')
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl['public.vw_studiensemester'], 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['public.vw_studiensemester'], FHC_MODEL_ERROR);
|
||||
|
||||
$query = "SELECT studiensemester_kurzbz,
|
||||
start,
|
||||
ende
|
||||
FROM public.vw_studiensemester";
|
||||
|
||||
if (is_numeric($semester))
|
||||
{
|
||||
if ($semester % 2 == 0)
|
||||
{
|
||||
$ss = 'SS';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ss = 'WS';
|
||||
}
|
||||
|
||||
$query .= " WHERE SUBSTRING(studiensemester_kurzbz FROM 1 FOR 2) = '" . $ss . "'";
|
||||
}
|
||||
|
||||
$query .= " ORDER BY delta LIMIT 1";
|
||||
|
||||
$result = $this->db->query($query);
|
||||
|
||||
if (is_object($result))
|
||||
return $this->_success($result->result());
|
||||
else
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ class Person_model extends DB_Model
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function checkBewerbung($email, $studiensemester_kurzbz = NULL)
|
||||
public function checkBewerbung($email, $studiensemester_kurzbz = null)
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl['public.tbl_person'], 's'))
|
||||
@@ -33,9 +33,9 @@ class Person_model extends DB_Model
|
||||
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);
|
||||
|
||||
$result = NULL;
|
||||
$result = null;
|
||||
|
||||
if(is_null($studiensemester_kurzbz))
|
||||
if (is_null($studiensemester_kurzbz))
|
||||
{
|
||||
$checkBewerbungQuery = "SELECT DISTINCT p.person_id, p.zugangscode, p.insertamum
|
||||
FROM public.tbl_person p JOIN public.tbl_kontakt k ON p.person_id = k.person_id
|
||||
@@ -63,9 +63,9 @@ class Person_model extends DB_Model
|
||||
$result = $this->db->query($checkBewerbungQuery, array($email, $email, $email, $studiensemester_kurzbz));
|
||||
}
|
||||
|
||||
if(is_object($result))
|
||||
if (is_object($result))
|
||||
return $this->_success($result->result());
|
||||
else
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user