mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
- application/core/* -> CS compliant
- application/libraries/* -> CS compliant - FHC_Model isEntitled method now return error() or success() - Updated all code that uses isEntitled method from FHC_Model - Removed Squiz.PHP.DisallowSizeFunctionsInLoops from CS ruleset - Removed depracated method replace from DB_Model - Removed unused method pgArrayPhp from DB_Model - Renamed method arrayMergeIndex to _arrayCombine in DB_Model and set as private - Added method _manageUDFs to DB_Model (a wrapper for UDFLib->manageUDFs)
This commit is contained in:
@@ -1,10 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once APPPATH . '/libraries/REST_Controller.php';
|
require_once APPPATH.'/libraries/REST_Controller.php';
|
||||||
|
|
||||||
class APIv1_Controller extends REST_Controller
|
class APIv1_Controller extends REST_Controller
|
||||||
{
|
{
|
||||||
function __construct()
|
/**
|
||||||
|
* Standard constructor for all the RESTful resources
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
@@ -13,4 +16,4 @@ class APIv1_Controller extends REST_Controller
|
|||||||
|
|
||||||
log_message('debug', 'Called API: '.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']);
|
log_message('debug', 'Called API: '.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+143
-191
@@ -26,7 +26,7 @@ class DB_Model extends FHC_Model
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
function __construct($dbTable = null, $pk = null, $hasSequence = true)
|
public function __construct($dbTable = null, $pk = null, $hasSequence = true)
|
||||||
{
|
{
|
||||||
// Call parent constructor
|
// Call parent constructor
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -54,15 +54,14 @@ class DB_Model extends FHC_Model
|
|||||||
*/
|
*/
|
||||||
public function insert($data)
|
public function insert($data)
|
||||||
{
|
{
|
||||||
// Check Class-Attributes
|
// Check class properties
|
||||||
if (is_null($this->dbTable))
|
if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
||||||
return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
|
||||||
|
|
||||||
// Checks rights
|
// Checks rights
|
||||||
if ($isEntitled = $this->_isEntitled(PermissionLib::INSERT_RIGHT)) return $isEntitled;
|
if (isError($ent = $this->_isEntitled(PermissionLib::INSERT_RIGHT))) return $ent;
|
||||||
|
|
||||||
// If this table has UDF and the validation of them is ok
|
// If this table has UDF and the validation of them is ok
|
||||||
if ($this->hasUDF() && isError($validate = $this->udflib->manageUDFs($data, $this->dbTable))) return $validate;
|
if (isError($validate = $this->_manageUDFs($data, $this->dbTable))) return $validate;
|
||||||
|
|
||||||
// DB-INSERT
|
// DB-INSERT
|
||||||
if ($this->db->insert($this->dbTable, $data))
|
if ($this->db->insert($this->dbTable, $data))
|
||||||
@@ -90,32 +89,9 @@ class DB_Model extends FHC_Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return error($this->db->error(), FHC_DB_ERROR);
|
return error($this->db->error(), FHC_DB_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Replace Data in DB-Table
|
|
||||||
*
|
|
||||||
* @param array $data DataArray for Replacement
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* DEPRECATED: to be updated, not maintained
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function replace($data)
|
|
||||||
{
|
|
||||||
// Check Class-Attributes
|
|
||||||
if (is_null($this->dbTable))
|
|
||||||
return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
|
||||||
|
|
||||||
// Checks rights
|
|
||||||
if ($isEntitled = $this->_isEntitled(PermissionLib::REPLACE_RIGHT)) return $isEntitled;
|
|
||||||
|
|
||||||
// DB-REPLACE
|
|
||||||
if ($this->db->replace($this->dbTable, $data))
|
|
||||||
return success($this->db->insert_id());
|
|
||||||
else
|
|
||||||
return error($this->db->error(), FHC_DB_ERROR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,36 +103,42 @@ class DB_Model extends FHC_Model
|
|||||||
*/
|
*/
|
||||||
public function update($id, $data)
|
public function update($id, $data)
|
||||||
{
|
{
|
||||||
// Check Class-Attributes
|
// Check class properties
|
||||||
if (is_null($this->dbTable))
|
if (is_null($this->pk)) return error(FHC_MODEL_ERROR, FHC_NOPK);
|
||||||
return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
||||||
if (is_null($this->pk))
|
|
||||||
return error(FHC_MODEL_ERROR, FHC_NOPK);
|
|
||||||
|
|
||||||
// Checks rights
|
// Checks rights
|
||||||
if ($isEntitled = $this->_isEntitled(PermissionLib::UPDATE_RIGHT)) return $isEntitled;
|
if (isError($ent = $this->_isEntitled(PermissionLib::UPDATE_RIGHT))) return $ent;
|
||||||
|
|
||||||
// If this table has UDF and the validation of them is ok
|
// If this table has UDF and the validation of them is ok
|
||||||
if ($this->hasUDF() && isError($validate = $this->udflib->manageUDFs($data, $this->dbTable, $this->getUDFs($id))))
|
if (isError($validate = $this->udflib->manageUDFs($data, $this->dbTable, $this->getUDFs($id)))) return $validate;
|
||||||
{
|
|
||||||
return $validate;
|
|
||||||
}
|
|
||||||
|
|
||||||
// DB-UPDATE
|
$tmpId = $id;
|
||||||
// Check for composite Primary Key
|
|
||||||
|
// Check for composite Primary Key, prepare the where clause
|
||||||
if (is_array($id))
|
if (is_array($id))
|
||||||
{
|
{
|
||||||
if (isset($id[0]))
|
if (isset($id[0]))
|
||||||
$this->db->where($this->arrayMergeIndex($this->pk, $id));
|
{
|
||||||
else
|
$tmpId = $this->_arrayCombine($this->pk, $id);
|
||||||
$this->db->where($id);
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->db->where($this->pk, $id);
|
{
|
||||||
|
$tmpId = array($this->pk => $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->where($tmpId);
|
||||||
|
|
||||||
|
// DB-UPDATE
|
||||||
if ($this->db->update($this->dbTable, $data))
|
if ($this->db->update($this->dbTable, $data))
|
||||||
|
{
|
||||||
return success($id);
|
return success($id);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return error($this->db->error(), FHC_DB_ERROR);
|
return error($this->db->error(), FHC_DB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,30 +149,37 @@ class DB_Model extends FHC_Model
|
|||||||
*/
|
*/
|
||||||
public function delete($id)
|
public function delete($id)
|
||||||
{
|
{
|
||||||
// Check Class-Attributes
|
// Check class properties
|
||||||
if (is_null($this->dbTable))
|
if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
||||||
return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
if (is_null($this->pk)) return error(FHC_MODEL_ERROR, FHC_NOPK);
|
||||||
if (is_null($this->pk))
|
|
||||||
return error(FHC_MODEL_ERROR, FHC_NOPK);
|
|
||||||
|
|
||||||
// Checks rights
|
// Checks rights
|
||||||
if ($isEntitled = $this->_isEntitled(PermissionLib::DELETE_RIGHT)) return $isEntitled;
|
if (isError($ent = $this->_isEntitled(PermissionLib::DELETE_RIGHT))) return $ent;
|
||||||
|
|
||||||
// DB-DELETE
|
$tmpId = $id;
|
||||||
|
|
||||||
// Check for composite Primary Key
|
// Check for composite Primary Key
|
||||||
if (is_array($id))
|
if (is_array($id))
|
||||||
{
|
{
|
||||||
if (isset($id[0]))
|
if (isset($id[0]))
|
||||||
$result = $this->db->delete($this->dbTable, $this->arrayMergeIndex($this->pk, $id));
|
{
|
||||||
else
|
$tmpId = $this->_arrayCombine($this->pk, $id);
|
||||||
$result = $this->db->delete($this->dbTable, $id);
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$result = $this->db->delete($this->dbTable, array($this->pk => $id));
|
{
|
||||||
if ($result)
|
$tmpId = array($this->pk => $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// DB-DELETE
|
||||||
|
if ($this->db->delete($this->dbTable, $tmpId))
|
||||||
|
{
|
||||||
return success($id);
|
return success($id);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return error($this->db->error(), FHC_DB_ERROR);
|
return error($this->db->error(), FHC_DB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -201,33 +190,37 @@ class DB_Model extends FHC_Model
|
|||||||
*/
|
*/
|
||||||
public function load($id = null)
|
public function load($id = null)
|
||||||
{
|
{
|
||||||
// Check Class-Attributes
|
// Check class properties
|
||||||
if (is_null($this->dbTable))
|
if (is_null($this->pk)) return error(FHC_MODEL_ERROR, FHC_NOPK);
|
||||||
return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
||||||
if (is_null($this->pk))
|
|
||||||
return error(FHC_MODEL_ERROR, FHC_NOPK);
|
|
||||||
|
|
||||||
// Checks rights
|
// Checks rights
|
||||||
if ($isEntitled = $this->_isEntitled(PermissionLib::SELECT_RIGHT)) return $isEntitled;
|
if (isError($ent = $this->_isEntitled(PermissionLib::SELECT_RIGHT))) return $ent;
|
||||||
|
|
||||||
|
$tmpId = $id;
|
||||||
|
|
||||||
// DB-SELECT
|
|
||||||
// Check for composite Primary Key
|
// Check for composite Primary Key
|
||||||
if (is_array($id))
|
if (is_array($id))
|
||||||
{
|
{
|
||||||
if (isset($id[0]))
|
if (isset($id[0]))
|
||||||
$result = $this->db->get_where($this->dbTable, $this->arrayMergeIndex($this->pk, $id));
|
{
|
||||||
else
|
$tmpId = $this->_arrayCombine($this->pk, $id);
|
||||||
$result = $this->db->get_where($this->dbTable, $id);
|
}
|
||||||
}
|
}
|
||||||
elseif (empty($id))
|
|
||||||
$result = $this->db->get($this->dbTable);
|
|
||||||
else
|
else
|
||||||
$result = $this->db->get_where($this->dbTable, array($this->pk => $id));
|
{
|
||||||
|
$tmpId = array($this->pk => $id);
|
||||||
|
}
|
||||||
|
|
||||||
if ($result)
|
// DB-SELECT
|
||||||
|
if ($result = $this->db->get_where($this->dbTable, $tmpId))
|
||||||
|
{
|
||||||
return success($this->_toPhp($result));
|
return success($this->_toPhp($result));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return error($this->db->error(), FHC_DB_ERROR);
|
return error($this->db->error(), FHC_DB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -237,20 +230,21 @@ class DB_Model extends FHC_Model
|
|||||||
*/
|
*/
|
||||||
public function loadWhere($where = null)
|
public function loadWhere($where = null)
|
||||||
{
|
{
|
||||||
// Check Class-Attributes
|
// Check class properties
|
||||||
if (is_null($this->dbTable))
|
if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
||||||
return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
|
||||||
|
|
||||||
// Checks rights
|
// Checks rights
|
||||||
if ($isEntitled = $this->_isEntitled(PermissionLib::SELECT_RIGHT)) return $isEntitled;
|
if (isError($ent = $this->_isEntitled(PermissionLib::SELECT_RIGHT))) return $ent;
|
||||||
|
|
||||||
// Execute query
|
// Execute query
|
||||||
$result = $this->db->get_where($this->dbTable, $where);
|
if ($result = $this->db->get_where($this->dbTable, $where))
|
||||||
|
{
|
||||||
if ($result)
|
|
||||||
return success($this->_toPhp($result));
|
return success($this->_toPhp($result));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return error($this->db->error(), FHC_DB_ERROR);
|
return error($this->db->error(), FHC_DB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -267,12 +261,11 @@ class DB_Model extends FHC_Model
|
|||||||
*/
|
*/
|
||||||
public function loadTree($mainTable, $sideTables, $where = null, $sideTablesAliases = null)
|
public function loadTree($mainTable, $sideTables, $where = null, $sideTablesAliases = null)
|
||||||
{
|
{
|
||||||
// Check Class-Attributes
|
// Check class properties
|
||||||
if (is_null($this->dbTable))
|
if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
||||||
return error(FHC_MODEL_ERROR, FHC_NODBTABLE);
|
|
||||||
|
|
||||||
// Checks rights
|
// Checks rights
|
||||||
if ($isEntitled = $this->_isEntitled(PermissionLib::SELECT_RIGHT)) return $isEntitled;
|
if (isError($ent = $this->_isEntitled(PermissionLib::SELECT_RIGHT))) return $ent;
|
||||||
|
|
||||||
// List of tables on which it will work
|
// List of tables on which it will work
|
||||||
$tables = array_merge(array($mainTable), $sideTables);
|
$tables = array_merge(array($mainTable), $sideTables);
|
||||||
@@ -302,7 +295,7 @@ class DB_Model extends FHC_Model
|
|||||||
// To avoid overwriting of the properties within the object returned by CI
|
// To avoid overwriting of the properties within the object returned by CI
|
||||||
// will be given an alias to every column, that will be composed with the following schema
|
// will be given an alias to every column, that will be composed with the following schema
|
||||||
// <table name>.<column name> AS <table_name>_<column name>
|
// <table name>.<column name> AS <table_name>_<column name>
|
||||||
$select .= $tables[$t] . '.' . $fields[$f]->column_name . ' AS ' . $tables[$t] . '_' . $fields[$f]->column_name;
|
$select .= $tables[$t].'.'.$fields[$f]->column_name.' AS '.$tables[$t].'_'.$fields[$f]->column_name;
|
||||||
if ($f < count($fields) - 1) $select .= ', ';
|
if ($f < count($fields) - 1) $select .= ', ';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,7 +336,7 @@ class DB_Model extends FHC_Model
|
|||||||
|
|
||||||
foreach (array_slice($objectVars, $tableColumnsCountArrayOffset, $tableColumnsCountArray[$f]) as $key => $value)
|
foreach (array_slice($objectVars, $tableColumnsCountArrayOffset, $tableColumnsCountArray[$f]) as $key => $value)
|
||||||
{
|
{
|
||||||
$objTmpArray[$f]->{str_replace($tables[$f] . '_', '', $key)} = $value;
|
$objTmpArray[$f]->{str_replace($tables[$f].'_', '', $key)} = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tableColumnsCountArrayOffset += $tableColumnsCountArray[$f]; // Increasing the offset
|
$tableColumnsCountArrayOffset += $tableColumnsCountArray[$f]; // Increasing the offset
|
||||||
@@ -378,7 +371,7 @@ class DB_Model extends FHC_Model
|
|||||||
{
|
{
|
||||||
$returnArray[$k]->{$sideTableProperty} = array($sideTableObj);
|
$returnArray[$k]->{$sideTableProperty} = array($sideTableObj);
|
||||||
}
|
}
|
||||||
else if (array_search($sideTableObj, $returnArray[$k]->{$sideTableProperty}) === false)
|
elseif (array_search($sideTableObj, $returnArray[$k]->{$sideTableProperty}) === false)
|
||||||
{
|
{
|
||||||
array_push($returnArray[$k]->{$sideTableProperty}, $sideTableObj);
|
array_push($returnArray[$k]->{$sideTableProperty}, $sideTableObj);
|
||||||
}
|
}
|
||||||
@@ -425,9 +418,8 @@ class DB_Model extends FHC_Model
|
|||||||
*/
|
*/
|
||||||
public function addOrder($field = null, $type = 'ASC')
|
public function addOrder($field = null, $type = 'ASC')
|
||||||
{
|
{
|
||||||
// Check Class-Attributes and parameters
|
// Check class properties and parameters
|
||||||
if (is_null($field) || !in_array($type, array('ASC', 'DESC')))
|
if (is_null($field) || !in_array($type, array('ASC', 'DESC'))) return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR);
|
||||||
return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR);
|
|
||||||
|
|
||||||
$this->db->order_by($field, $type);
|
$this->db->order_by($field, $type);
|
||||||
|
|
||||||
@@ -441,9 +433,8 @@ class DB_Model extends FHC_Model
|
|||||||
*/
|
*/
|
||||||
public function addSelect($select, $escape = true)
|
public function addSelect($select, $escape = true)
|
||||||
{
|
{
|
||||||
// Check Class-Attributes and parameters
|
// Check class properties and parameters
|
||||||
if (is_null($select) || $select == '')
|
if (is_null($select) || $select == '') return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR);
|
||||||
return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR);
|
|
||||||
|
|
||||||
$this->db->select($select, $escape);
|
$this->db->select($select, $escape);
|
||||||
|
|
||||||
@@ -467,9 +458,8 @@ class DB_Model extends FHC_Model
|
|||||||
*/
|
*/
|
||||||
public function addLimit($start = null, $end = null)
|
public function addLimit($start = null, $end = null)
|
||||||
{
|
{
|
||||||
// Check Class-Attributes and parameters
|
// Check class properties and parameters
|
||||||
if (!is_numeric($start) || (is_numeric($start) && $start <= 0))
|
if (!is_numeric($start) || (is_numeric($start) && $start <= 0)) return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR);
|
||||||
return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR);
|
|
||||||
|
|
||||||
if (is_numeric($end) && $end > $start)
|
if (is_numeric($end) && $end > $start)
|
||||||
{
|
{
|
||||||
@@ -493,12 +483,11 @@ class DB_Model extends FHC_Model
|
|||||||
$tmpTable = trim($table);
|
$tmpTable = trim($table);
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($tmpTable))
|
if (empty($tmpTable)) return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR);
|
||||||
return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR);
|
|
||||||
|
|
||||||
if (!empty($alias))
|
if (!empty($alias))
|
||||||
{
|
{
|
||||||
$tmpTable .= ' AS ' . $alias;
|
$tmpTable .= ' AS '.$alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->from($tmpTable);
|
$this->db->from($tmpTable);
|
||||||
@@ -562,7 +551,7 @@ class DB_Model extends FHC_Model
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// If false
|
// If false
|
||||||
else if ($val == DB_Model::PGSQL_BOOLEAN_FALSE)
|
elseif ($val == DB_Model::PGSQL_BOOLEAN_FALSE)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -570,65 +559,11 @@ class DB_Model extends FHC_Model
|
|||||||
// If it is null, let it be null
|
// If it is null, let it be null
|
||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert PG-Array to PHP-Array
|
|
||||||
*
|
|
||||||
* @param string $s PG-String to convert
|
|
||||||
* @param string $start start-point for recursive iterations
|
|
||||||
* @param string $end end-point for recursive iterations
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function pgArrayPhp($s, $start=0, &$end=NULL)
|
|
||||||
{
|
|
||||||
if (empty($s) || $s[0]!='{') return NULL;
|
|
||||||
$return = array();
|
|
||||||
$br = 0;
|
|
||||||
$string = false;
|
|
||||||
$quote='';
|
|
||||||
$len = strlen($s);
|
|
||||||
$v = '';
|
|
||||||
for ($i=$start+1; $i<$len;$i++)
|
|
||||||
{
|
|
||||||
$ch = $s[$i];
|
|
||||||
if (!$string && $ch=='}')
|
|
||||||
{
|
|
||||||
if ($v!=='' || !empty($return))
|
|
||||||
$return[] = $v;
|
|
||||||
$end = $i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (!$string && $ch=='{')
|
|
||||||
$v = $this->pgArrayPhp($s,$i,$i);
|
|
||||||
else
|
|
||||||
if (!$string && $ch==',')
|
|
||||||
{
|
|
||||||
$return[] = $v;
|
|
||||||
$v = '';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (!$string && ($ch=='\'' || $ch=='\''))
|
|
||||||
{
|
|
||||||
$string = true;
|
|
||||||
$quote = $ch;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if ($string && $ch==$quote && $s[$i-1]=='\\')
|
|
||||||
$v = substr($v,0,-1).$ch;
|
|
||||||
else
|
|
||||||
if ($string && $ch==$quote && $s[$i-1]!='\\')
|
|
||||||
$string = FALSE;
|
|
||||||
else
|
|
||||||
$v .= $ch;
|
|
||||||
}
|
|
||||||
return $return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts from PostgreSQL array to php array
|
* Converts from PostgreSQL array to php array
|
||||||
* It also takes care about array of booleans
|
* It also takes care about array of booleans
|
||||||
*/
|
*/
|
||||||
public function pgsqlArrayToPhpArray($string, $booleans = false)
|
public function pgsqlArrayToPhpArray($string, $booleans = false)
|
||||||
{
|
{
|
||||||
// At least returns an empty array
|
// At least returns an empty array
|
||||||
@@ -696,13 +631,14 @@ class DB_Model extends FHC_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Returns all the UDF contained in this table ($dbTable)
|
||||||
|
* If no UDF are present, an empty array will be returned
|
||||||
*/
|
*/
|
||||||
public function getUDFs($id, $udfName = null)
|
public function getUDFs($id, $udfName = null)
|
||||||
{
|
{
|
||||||
$udfs = array();
|
$udfs = array();
|
||||||
|
|
||||||
$this->addSelect(UDFLib::COLUMN_NAME);
|
$this->addSelect(UDFLib::COLUMN_NAME); // select only the column with UDF
|
||||||
|
|
||||||
$result = $this->load($id);
|
$result = $this->load($id);
|
||||||
if (hasData($result))
|
if (hasData($result))
|
||||||
@@ -713,12 +649,12 @@ class DB_Model extends FHC_Model
|
|||||||
{
|
{
|
||||||
if ($udfName != null && $udfName == $key)
|
if ($udfName != null && $udfName == $key)
|
||||||
{
|
{
|
||||||
$udfs[$key] = $value; //
|
$udfs[$key] = $value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$udfs[$key] = $value; //
|
$udfs[$key] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -737,22 +673,6 @@ class DB_Model extends FHC_Model
|
|||||||
// ------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------
|
||||||
// Protected methods
|
// Protected methods
|
||||||
|
|
||||||
/**
|
|
||||||
* Invalid ID
|
|
||||||
*
|
|
||||||
* @param array $i Array with indexes.
|
|
||||||
* @param array $v Array with values.
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function arrayMergeIndex($idexes, $values)
|
|
||||||
{
|
|
||||||
if (count($idexes) != count($values))
|
|
||||||
return false;
|
|
||||||
for ($j = 0; $j < count($idexes); $j++)
|
|
||||||
$a[$idexes[$j]] = $values[$j];
|
|
||||||
return $a;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a query and converts array and boolean data types from PgSql to php
|
* Executes a query and converts array and boolean data types from PgSql to php
|
||||||
* @return: boolean false on failure
|
* @return: boolean false on failure
|
||||||
@@ -803,8 +723,8 @@ class DB_Model extends FHC_Model
|
|||||||
protected function getSchemaAndTable($schemaAndTable)
|
protected function getSchemaAndTable($schemaAndTable)
|
||||||
{
|
{
|
||||||
$result = new stdClass();
|
$result = new stdClass();
|
||||||
$result->schema = DB_Model::DEFAULT_SCHEMA;
|
|
||||||
$result->table = $schemaAndTable;
|
$result->table = $schemaAndTable;
|
||||||
|
$result->schema = DB_Model::DEFAULT_SCHEMA;
|
||||||
|
|
||||||
// If a schema is specified
|
// If a schema is specified
|
||||||
if (($pos = strpos($schemaAndTable, '.')) !== false)
|
if (($pos = strpos($schemaAndTable, '.')) !== false)
|
||||||
@@ -819,27 +739,59 @@ class DB_Model extends FHC_Model
|
|||||||
// ------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------
|
||||||
// Private methods
|
// Private methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invalid ID
|
||||||
|
*
|
||||||
|
* @param array $i Array with indexes.
|
||||||
|
* @param array $v Array with values.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function _arrayCombine($idexes, $values)
|
||||||
|
{
|
||||||
|
if (count($idexes) != count($values)) return null;
|
||||||
|
|
||||||
|
return array_combine($idexes, $values);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the caller is entitled to perform this operation with this right
|
* Checks if the caller is entitled to perform this operation with this right
|
||||||
*/
|
*/
|
||||||
private function _isEntitled($permission)
|
private function _isEntitled($permission)
|
||||||
{
|
{
|
||||||
|
$ent = success(true);
|
||||||
|
|
||||||
// If the caller is _not_ a model _and_ tries to read data, then avoids to check permissions
|
// If the caller is _not_ a model _and_ tries to read data, then avoids to check permissions
|
||||||
// Otherwise checks always the permissions
|
// Otherwise checks always the permissions
|
||||||
if (($permission == PermissionLib::SELECT_RIGHT &&
|
if (($permission == PermissionLib::SELECT_RIGHT
|
||||||
substr(get_called_class(), -6) == DB_Model::MODEL_POSTFIX) ||
|
&& substr(get_called_class(), -6) == DB_Model::MODEL_POSTFIX)
|
||||||
$permission != PermissionLib::SELECT_RIGHT)
|
|| $permission != PermissionLib::SELECT_RIGHT)
|
||||||
{
|
{
|
||||||
|
$ent = $this->isEntitled($this->dbTable, $permission, FHC_NORIGHT, FHC_MODEL_ERROR);
|
||||||
// If true is not returned, then an error has occurred
|
// If true is not returned, then an error has occurred
|
||||||
if (($isEntitled = $this->isEntitled($this->dbTable, $permission, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent))
|
||||||
{
|
{
|
||||||
// Before returning the object containing the error, reset the build query
|
// Before returning the object containing the error, reset the build query
|
||||||
// This is for preventing that other parts of the query will be built before of the next execution
|
// This is for preventing that other parts of the query will be built before of the next execution
|
||||||
$this->resetQuery();
|
$this->resetQuery();
|
||||||
|
|
||||||
return $isEntitled;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $ent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper method for UDFLib->manageUDFs
|
||||||
|
*/
|
||||||
|
private function _manageUDFs(&$data, $schemaAndTable, $udfValues = null)
|
||||||
|
{
|
||||||
|
$manageUDFs = success(true);
|
||||||
|
|
||||||
|
if ($this->hasUDF())
|
||||||
|
{
|
||||||
|
$manageUDFs = $this->udflib->manageUDFs($data, $this->dbTable, $this->getUDFs($id));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $manageUDFs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -858,7 +810,7 @@ class DB_Model extends FHC_Model
|
|||||||
{
|
{
|
||||||
$toBeConverterdArray = array(); // Fields to be converted
|
$toBeConverterdArray = array(); // Fields to be converted
|
||||||
$metaDataArray = $result->field_data(); // Fields information
|
$metaDataArray = $result->field_data(); // Fields information
|
||||||
for($i = 0; $i < count($metaDataArray); $i++) // Looking for booleans and arrays
|
for ($i = 0; $i < count($metaDataArray); $i++) // Looking for booleans and arrays
|
||||||
{
|
{
|
||||||
// If array type, boolean type OR a UDF
|
// If array type, boolean type OR a UDF
|
||||||
if (strpos($metaDataArray[$i]->type, DB_Model::PGSQL_ARRAY_TYPE) !== false
|
if (strpos($metaDataArray[$i]->type, DB_Model::PGSQL_ARRAY_TYPE) !== false
|
||||||
@@ -882,12 +834,12 @@ class DB_Model extends FHC_Model
|
|||||||
// Returns the array of objects, each of them represents a DB record
|
// Returns the array of objects, each of them represents a DB record
|
||||||
$resultsArray = $result->result();
|
$resultsArray = $result->result();
|
||||||
// Looping on results
|
// Looping on results
|
||||||
for($i = 0; $i < count($resultsArray); $i++)
|
for ($i = 0; $i < count($resultsArray); $i++)
|
||||||
{
|
{
|
||||||
// Single element
|
// Single element
|
||||||
$resultElement = $resultsArray[$i];
|
$resultElement = $resultsArray[$i];
|
||||||
// Looping on fields to be converted
|
// Looping on fields to be converted
|
||||||
for($j = 0; $j < count($toBeConverterdArray); $j++)
|
for ($j = 0; $j < count($toBeConverterdArray); $j++)
|
||||||
{
|
{
|
||||||
// Single element
|
// Single element
|
||||||
$toBeConverted = $toBeConverterdArray[$j];
|
$toBeConverted = $toBeConverterdArray[$j];
|
||||||
@@ -901,12 +853,12 @@ class DB_Model extends FHC_Model
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Boolean type
|
// Boolean type
|
||||||
else if ($toBeConverted->type == DB_Model::PGSQL_BOOLEAN_TYPE)
|
elseif ($toBeConverted->type == DB_Model::PGSQL_BOOLEAN_TYPE)
|
||||||
{
|
{
|
||||||
$resultElement->{$toBeConverted->name} = $this->pgBoolPhp($resultElement->{$toBeConverted->name});
|
$resultElement->{$toBeConverted->name} = $this->pgBoolPhp($resultElement->{$toBeConverted->name});
|
||||||
}
|
}
|
||||||
// UDF
|
// UDF
|
||||||
else if ($this->udflib->isUDFColumn($toBeConverted->name, $toBeConverted->type))
|
elseif ($this->udflib->isUDFColumn($toBeConverted->name, $toBeConverted->type))
|
||||||
{
|
{
|
||||||
$jsonValues = json_decode($resultElement->{$toBeConverted->name}); // decode UDFs values
|
$jsonValues = json_decode($resultElement->{$toBeConverted->name}); // decode UDFs values
|
||||||
if ($jsonValues != null) // if decode is ok
|
if ($jsonValues != null) // if decode is ok
|
||||||
@@ -964,4 +916,4 @@ class DB_Model extends FHC_Model
|
|||||||
|
|
||||||
return $this->execQuery($query, array(strtolower($schema), strtolower($table)));
|
return $this->execQuery($query, array(strtolower($schema), strtolower($table)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,13 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
|||||||
|
|
||||||
class FHC_Controller extends CI_Controller
|
class FHC_Controller extends CI_Controller
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Standard construct for all the controllers, loads the authentication system
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->load->helper('fhcauth');
|
$this->load->helper('fhcauth');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,12 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
|||||||
|
|
||||||
class FHC_Model extends CI_Model
|
class FHC_Model extends CI_Model
|
||||||
{
|
{
|
||||||
function __construct()
|
/**
|
||||||
|
* Standard constructor for all the models
|
||||||
|
* It loads the helper message to manage the values returned by methods
|
||||||
|
* It loads the permission library
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
@@ -25,19 +30,20 @@ class FHC_Model extends CI_Model
|
|||||||
*/
|
*/
|
||||||
public function isEntitled($sourceName, $accessType, $languageMessageCode, $msgErrorCode)
|
public function isEntitled($sourceName, $accessType, $languageMessageCode, $msgErrorCode)
|
||||||
{
|
{
|
||||||
|
$isEntitled = success(true);
|
||||||
|
|
||||||
if ($this->permissionlib->isEntitled($sourceName, $accessType) === false)
|
if ($this->permissionlib->isEntitled($sourceName, $accessType) === false)
|
||||||
{
|
{
|
||||||
$retval = sprintf(
|
$retval = sprintf(
|
||||||
'%s -> %s:%s',
|
'%s -> %s:%s',
|
||||||
lang('fhc_' . $languageMessageCode),
|
lang('fhc_'.$languageMessageCode),
|
||||||
$this->permissionlib->getBerechtigungKurzbz($sourceName),
|
$this->permissionlib->getBerechtigungKurzbz($sourceName),
|
||||||
$accessType
|
$accessType
|
||||||
);
|
);
|
||||||
return error($retval, $msgErrorCode);
|
|
||||||
}
|
$isEntitled = error($retval, $msgErrorCode);
|
||||||
else
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $isEntitled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,11 @@
|
|||||||
class FS_Model extends FHC_Model
|
class FS_Model extends FHC_Model
|
||||||
{
|
{
|
||||||
protected $filepath; // Path of the file
|
protected $filepath; // Path of the file
|
||||||
protected $acl; // Name of the permissions array index for FS writing, reading...
|
|
||||||
|
/**
|
||||||
function __construct($filepath = null)
|
* Loads FilesystemLib and set properties
|
||||||
|
*/
|
||||||
|
public function __construct($filepath = null)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
@@ -26,16 +28,13 @@ class FS_Model extends FHC_Model
|
|||||||
public function read($filename)
|
public function read($filename)
|
||||||
{
|
{
|
||||||
// Check Class-Attributes
|
// Check Class-Attributes
|
||||||
if (is_null($this->filepath))
|
if (is_null($this->filepath)) return error(FHC_MODEL_ERROR, FHC_ERROR);
|
||||||
return error(FHC_MODEL_ERROR, FHC_ERROR);
|
|
||||||
|
|
||||||
// Check method parameters
|
// Check method parameters
|
||||||
if (is_null($filename))
|
if (is_null($filename)) return error(FHC_MODEL_ERROR, FHC_ERROR);
|
||||||
return error(FHC_MODEL_ERROR, FHC_ERROR);
|
|
||||||
|
|
||||||
// Check rights
|
// Check rights
|
||||||
if (($chkRights = $this->isEntitled($this->filepath, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled($this->filepath, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $chkRights;
|
|
||||||
|
|
||||||
if (!is_null($data = $this->filesystemlib->read($this->filepath, $filename)))
|
if (!is_null($data = $this->filesystemlib->read($this->filepath, $filename)))
|
||||||
{
|
{
|
||||||
@@ -56,18 +55,14 @@ class FS_Model extends FHC_Model
|
|||||||
public function write($filename, $content)
|
public function write($filename, $content)
|
||||||
{
|
{
|
||||||
// Check Class-Attributes
|
// Check Class-Attributes
|
||||||
if (is_null($this->filepath))
|
if (is_null($this->filepath)) return error(FHC_MODEL_ERROR, FHC_ERROR);
|
||||||
return error(FHC_MODEL_ERROR, FHC_ERROR);
|
|
||||||
|
|
||||||
// Check method parameters
|
// Check method parameters
|
||||||
if (is_null($filename))
|
if (is_null($filename)) return error(FHC_MODEL_ERROR, FHC_ERROR);
|
||||||
return error(FHC_MODEL_ERROR, FHC_ERROR);
|
if (is_null($content)) return error(FHC_MODEL_ERROR, FHC_ERROR);
|
||||||
if (is_null($content))
|
|
||||||
return error(FHC_MODEL_ERROR, FHC_ERROR);
|
|
||||||
|
|
||||||
// Check rights
|
// Check rights
|
||||||
if (($chkRights = $this->isEntitled($this->filepath, PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError(($ent = $this->isEntitled($this->filepath, PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))) return $ent;
|
||||||
return $chkRights;
|
|
||||||
|
|
||||||
if ($this->filesystemlib->write($this->filepath, $filename, base64_decode($content)) === true)
|
if ($this->filesystemlib->write($this->filepath, $filename, base64_decode($content)) === true)
|
||||||
{
|
{
|
||||||
@@ -88,18 +83,14 @@ class FS_Model extends FHC_Model
|
|||||||
public function append($filename, $content)
|
public function append($filename, $content)
|
||||||
{
|
{
|
||||||
// Check Class-Attributes
|
// Check Class-Attributes
|
||||||
if (is_null($this->filepath))
|
if (is_null($this->filepath)) return error(FHC_MODEL_ERROR, FHC_ERROR);
|
||||||
return error(FHC_MODEL_ERROR, FHC_ERROR);
|
|
||||||
|
|
||||||
// Check method parameters
|
// Check method parameters
|
||||||
if (is_null($filename))
|
if (is_null($content)) return error(FHC_MODEL_ERROR, FHC_ERROR);
|
||||||
return error(FHC_MODEL_ERROR, FHC_ERROR);
|
if (is_null($filename)) return error(FHC_MODEL_ERROR, FHC_ERROR);
|
||||||
if (is_null($content))
|
|
||||||
return error(FHC_MODEL_ERROR, FHC_ERROR);
|
|
||||||
|
|
||||||
// Check rights
|
// Check rights
|
||||||
if (($chkRights = $this->isEntitled($this->filepath, PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled($this->filepath, PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $chkRights;
|
|
||||||
|
|
||||||
if ($this->filesystemlib->append($this->filepath, $filename, base64_decode($content)) === true)
|
if ($this->filesystemlib->append($this->filepath, $filename, base64_decode($content)) === true)
|
||||||
{
|
{
|
||||||
@@ -120,16 +111,13 @@ class FS_Model extends FHC_Model
|
|||||||
public function remove($filename)
|
public function remove($filename)
|
||||||
{
|
{
|
||||||
// Check Class-Attributes
|
// Check Class-Attributes
|
||||||
if (is_null($this->filepath))
|
if (is_null($this->filepath)) return error(FHC_MODEL_ERROR, FHC_ERROR);
|
||||||
return error(FHC_MODEL_ERROR, FHC_ERROR);
|
|
||||||
|
|
||||||
// Check method parameters
|
// Check method parameters
|
||||||
if (is_null($filename))
|
if (is_null($filename)) return error(FHC_MODEL_ERROR, FHC_ERROR);
|
||||||
return error(FHC_MODEL_ERROR, FHC_ERROR);
|
|
||||||
|
|
||||||
// Check rights
|
// Check rights
|
||||||
if (($chkRights = $this->isEntitled($this->filepath, PermissionLib::DELETE_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled($this->filepath, PermissionLib::DELETE_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $chkRights;
|
|
||||||
|
|
||||||
if ($this->filesystemlib->remove($this->filepath, $filename) === true)
|
if ($this->filesystemlib->remove($this->filepath, $filename) === true)
|
||||||
{
|
{
|
||||||
@@ -150,18 +138,14 @@ class FS_Model extends FHC_Model
|
|||||||
public function rename($filename, $newFilename)
|
public function rename($filename, $newFilename)
|
||||||
{
|
{
|
||||||
// Check Class-Attributes
|
// Check Class-Attributes
|
||||||
if (is_null($this->filepath))
|
if (is_null($this->filepath)) return error(FHC_MODEL_ERROR, FHC_ERROR);
|
||||||
return error(FHC_MODEL_ERROR, FHC_ERROR);
|
|
||||||
|
|
||||||
// Check method parameters
|
// Check method parameters
|
||||||
if (is_null($filename))
|
if (is_null($filename)) return error(FHC_MODEL_ERROR, FHC_ERROR);
|
||||||
return error(FHC_MODEL_ERROR, FHC_ERROR);
|
if (is_null($newFilename)) return error(FHC_MODEL_ERROR, FHC_ERROR);
|
||||||
if (is_null($newFilename))
|
|
||||||
return error(FHC_MODEL_ERROR, FHC_ERROR);
|
|
||||||
|
|
||||||
// Check rights
|
// Check rights
|
||||||
if (($chkRights = $this->isEntitled($this->filepath, PermissionLib::UPDATE_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled($this->filepath, PermissionLib::UPDATE_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $chkRights;
|
|
||||||
|
|
||||||
if ($this->filesystemlib->rename($this->filepath, $filename, $this->filepath, $newFilename) === true)
|
if ($this->filesystemlib->rename($this->filepath, $filename, $this->filepath, $newFilename) === true)
|
||||||
{
|
{
|
||||||
@@ -172,4 +156,4 @@ class FS_Model extends FHC_Model
|
|||||||
return error(FHC_MODEL_ERROR, FHC_ERROR);
|
return error(FHC_MODEL_ERROR, FHC_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ if (! defined("BASEPATH")) exit("No direct script access allowed");
|
|||||||
|
|
||||||
class VileSci_Controller extends FHC_Controller
|
class VileSci_Controller extends FHC_Controller
|
||||||
{
|
{
|
||||||
function __construct()
|
/**
|
||||||
|
* Standard construct for all the controllers used in VileSci
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class CallerLib
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If the given resource is a library
|
// If the given resource is a library
|
||||||
else if (strpos($parameters->resourceName, CallerLib::LIB_PREFIX) !== false)
|
elseif (strpos($parameters->resourceName, CallerLib::LIB_PREFIX) !== false)
|
||||||
{
|
{
|
||||||
// Check if the resource is already loaded, it works only with libraries and drivers
|
// Check if the resource is already loaded, it works only with libraries and drivers
|
||||||
$isLoaded = $this->ci->load->is_loaded($parameters->resourceName);
|
$isLoaded = $this->ci->load->is_loaded($parameters->resourceName);
|
||||||
@@ -89,10 +89,10 @@ class CallerLib
|
|||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
// Only for libraries, permissions are automatically handled by models
|
// Only for libraries, permissions are automatically handled by models
|
||||||
$result = $this->checkLibraryPermission(
|
$result = $this->checkLibraryPermission(
|
||||||
$parameters->resourcePath,
|
$parameters->resourcePath,
|
||||||
$parameters->resourceName,
|
$parameters->resourceName,
|
||||||
$parameters->function,
|
$parameters->function,
|
||||||
$permissionType
|
$permissionType
|
||||||
);
|
);
|
||||||
if (isError($result))
|
if (isError($result))
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ class CallerLib
|
|||||||
// Wrong selection!
|
// Wrong selection!
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result = error('Neither a lib nor model: ' . $parameters->resourcePath . $parameters->resourceName);
|
$result = error('Neither a lib nor model: '.$parameters->resourcePath.$parameters->resourceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the resource was found and loaded
|
// If the resource was found and loaded
|
||||||
@@ -166,7 +166,7 @@ class CallerLib
|
|||||||
$parameters->resourcePath = str_replace($parameters->resourceName, '', $parameterValue);
|
$parameters->resourcePath = str_replace($parameters->resourceName, '', $parameterValue);
|
||||||
}
|
}
|
||||||
// The name of the function
|
// The name of the function
|
||||||
else if ($parameterName == CallerLib::FUNCTION_PARAMETER)
|
elseif ($parameterName == CallerLib::FUNCTION_PARAMETER)
|
||||||
{
|
{
|
||||||
$parameters->function = $parameterValue;
|
$parameters->function = $parameterValue;
|
||||||
}
|
}
|
||||||
@@ -217,7 +217,7 @@ class CallerLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a model using the given path and name
|
* Loads a model using the given path and name
|
||||||
*
|
*
|
||||||
* NOTE: the models automatically handle the permissions
|
* NOTE: the models automatically handle the permissions
|
||||||
*/
|
*/
|
||||||
private function _loadModel($resourcePath, $resourceName)
|
private function _loadModel($resourcePath, $resourceName)
|
||||||
@@ -227,12 +227,12 @@ class CallerLib
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$loaded = $this->ci->load->model($resourcePath . $resourceName);
|
$loaded = $this->ci->load->model($resourcePath.$resourceName);
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
// Errors while loading the model
|
// Errors while loading the model
|
||||||
$result = error('Errors while loading the model: ' . $e->getMessage());
|
$result = error('Errors while loading the model: '.$e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($loaded))
|
if (!is_null($loaded))
|
||||||
@@ -257,7 +257,7 @@ class CallerLib
|
|||||||
$permissionPath = $resourcePath;
|
$permissionPath = $resourcePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
$permissionPath .= $resourceName . '.' . $function;
|
$permissionPath .= $resourceName.'.'.$function;
|
||||||
|
|
||||||
if ($this->ci->permissionlib->isEntitled($permissionPath, $permissionType) === false)
|
if ($this->ci->permissionlib->isEntitled($permissionPath, $permissionType) === false)
|
||||||
{
|
{
|
||||||
@@ -273,14 +273,14 @@ class CallerLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a library using the given path and name
|
* Loads a library using the given path and name
|
||||||
*
|
*
|
||||||
* The method 'library' of the class CI_Loader provided by CI has some limitations,
|
* The method 'library' of the class CI_Loader provided by CI has some limitations,
|
||||||
* so to be able to check errors was used a workaround.
|
* so to be able to check errors was used a workaround.
|
||||||
* It consists in:
|
* It consists in:
|
||||||
* - Checking if the file (identified by parameters $resourcePath and $resourceName) exists
|
* - Checking if the file (identified by parameters $resourcePath and $resourceName) exists
|
||||||
* - If exists it will be loaded using the method 'file' from CI_Loader
|
* - If exists it will be loaded using the method 'file' from CI_Loader
|
||||||
* - Checks if the loaded file contains a class identified by parameter $resourceName
|
* - Checks if the loaded file contains a class identified by parameter $resourceName
|
||||||
*
|
*
|
||||||
* If one of the previous tests fails, it will be returned a null value
|
* If one of the previous tests fails, it will be returned a null value
|
||||||
*/
|
*/
|
||||||
private function _loadLibrary($resourcePath, $resourceName)
|
private function _loadLibrary($resourcePath, $resourceName)
|
||||||
@@ -295,8 +295,8 @@ class CallerLib
|
|||||||
$found = null;
|
$found = null;
|
||||||
for ($i = 0; $i < count($packagePaths) && is_null($found); $i++)
|
for ($i = 0; $i < count($packagePaths) && is_null($found); $i++)
|
||||||
{
|
{
|
||||||
$file = $packagePaths[$i] . CallerLib::LIBS_PATH . DIRECTORY_SEPARATOR .
|
$file = $packagePaths[$i].CallerLib::LIBS_PATH.DIRECTORY_SEPARATOR.
|
||||||
$resourcePath . $resourceName . CallerLib::LIB_FILE_EXTENSION;
|
$resourcePath.$resourceName.CallerLib::LIB_FILE_EXTENSION;
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$found = $file;
|
$found = $file;
|
||||||
@@ -313,20 +313,20 @@ class CallerLib
|
|||||||
{
|
{
|
||||||
$loaded = null;
|
$loaded = null;
|
||||||
// Same phrase error as load->model() provided by CI
|
// Same phrase error as load->model() provided by CI
|
||||||
$result = error($found . ' exists, but doesn\'t declare class ' . $resourceName);
|
$result = error($found.' exists, but doesn\'t declare class '.$resourceName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$loaded = null;
|
$loaded = null;
|
||||||
// Same phrase error as load->model() provided by CI
|
// Same phrase error as load->model() provided by CI
|
||||||
$result = error('Unable to load the requested class: ' . $resourceName);
|
$result = error('Unable to load the requested class: '.$resourceName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
// Errors while loading the library
|
// Errors while loading the library
|
||||||
$result = error('Errors while loading the library: ' . $e->getMessage());
|
$result = error('Errors while loading the library: '.$e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($loaded))
|
if (!is_null($loaded))
|
||||||
@@ -339,7 +339,7 @@ class CallerLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls a method of a class with the given parameters and returns its result
|
* Calls a method of a class with the given parameters and returns its result
|
||||||
*
|
*
|
||||||
* @param string $resourceName identifies the class name
|
* @param string $resourceName identifies the class name
|
||||||
* @param string $function identifies the method name
|
* @param string $function identifies the method name
|
||||||
* @param array $parameters contains the parameters to be passed to the method
|
* @param array $parameters contains the parameters to be passed to the method
|
||||||
@@ -359,7 +359,7 @@ class CallerLib
|
|||||||
// If the function is static
|
// If the function is static
|
||||||
if ($reflectionMethod->isStatic() === true)
|
if ($reflectionMethod->isStatic() === true)
|
||||||
{
|
{
|
||||||
$classMethod = $resourceName . '::' . $function;
|
$classMethod = $resourceName.'::'.$function;
|
||||||
}
|
}
|
||||||
// If the function is not static
|
// If the function is not static
|
||||||
else
|
else
|
||||||
@@ -370,7 +370,6 @@ class CallerLib
|
|||||||
// If the resource's function is callable
|
// If the resource's function is callable
|
||||||
if (is_callable($classMethod))
|
if (is_callable($classMethod))
|
||||||
{
|
{
|
||||||
|
|
||||||
// Call resource->function()
|
// Call resource->function()
|
||||||
// @ was applied to prevent really ugly and unmanageable errors
|
// @ was applied to prevent really ugly and unmanageable errors
|
||||||
$resultCall = @call_user_func_array($classMethod, $parameters);
|
$resultCall = @call_user_func_array($classMethod, $parameters);
|
||||||
@@ -379,7 +378,7 @@ class CallerLib
|
|||||||
// it will be recognized like a running error. A little bit tricky ;)
|
// it will be recognized like a running error. A little bit tricky ;)
|
||||||
if ($resultCall === false)
|
if ($resultCall === false)
|
||||||
{
|
{
|
||||||
$result = error('Error running ' . $resourceName . '->' . $function . '()');
|
$result = error('Error running '.$resourceName.'->'.$function.'()');
|
||||||
}
|
}
|
||||||
// Returns the result of resource->function()
|
// Returns the result of resource->function()
|
||||||
else
|
else
|
||||||
@@ -389,14 +388,13 @@ class CallerLib
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result = error($resourceName . '->' . $function . '() is not callable!');
|
$result = error($resourceName.'->'.$function.'() is not callable!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result = error(
|
$result = error(
|
||||||
'Number of required parameters: ' . $reflectionMethod->getNumberOfRequiredParameters() .
|
'Number of required parameters: '.$reflectionMethod->getNumberOfRequiredParameters().'. Given: '.count($parameters)
|
||||||
'. Given: ' . count($parameters)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -407,4 +405,4 @@ class CallerLib
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,8 @@
|
|||||||
|
|
||||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class DmsLib
|
class DmsLib
|
||||||
{
|
{
|
||||||
//
|
|
||||||
const FILE_CONTENT_PROPERTY = 'file_content';
|
const FILE_CONTENT_PROPERTY = 'file_content';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,7 +23,7 @@ class DmsLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* read
|
||||||
*/
|
*/
|
||||||
public function read($dms_id, $version = null)
|
public function read($dms_id, $version = null)
|
||||||
{
|
{
|
||||||
@@ -66,7 +62,7 @@ class DmsLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* getAktenAcceptedDms
|
||||||
*/
|
*/
|
||||||
public function getAktenAcceptedDms($person_id, $dokument_kurzbz = null, $no_file = null)
|
public function getAktenAcceptedDms($person_id, $dokument_kurzbz = null, $no_file = null)
|
||||||
{
|
{
|
||||||
@@ -92,13 +88,13 @@ class DmsLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* save
|
||||||
*/
|
*/
|
||||||
public function save($dms)
|
public function save($dms)
|
||||||
{
|
{
|
||||||
$result = null;
|
$result = null;
|
||||||
|
|
||||||
if(isset($dms['new']) && $dms['new'] == true)
|
if (isset($dms['new']) && $dms['new'] == true)
|
||||||
{
|
{
|
||||||
// Remove new parameter to avoid DB insert errors
|
// Remove new parameter to avoid DB insert errors
|
||||||
unset($dms['new']);
|
unset($dms['new']);
|
||||||
@@ -107,7 +103,7 @@ class DmsLib
|
|||||||
if (isSuccess($result))
|
if (isSuccess($result))
|
||||||
{
|
{
|
||||||
$filename = $result->retval;
|
$filename = $result->retval;
|
||||||
if(isset($dms['dms_id']) && $dms['dms_id'] != '')
|
if (isset($dms['dms_id']) && $dms['dms_id'] != '')
|
||||||
{
|
{
|
||||||
$result = $this->ci->DmsVersionModel->insert(
|
$result = $this->ci->DmsVersionModel->insert(
|
||||||
$this->ci->DmsVersionModel->filterFields($dms, $dms['dms_id'], $filename)
|
$this->ci->DmsVersionModel->filterFields($dms, $dms['dms_id'], $filename)
|
||||||
@@ -148,7 +144,7 @@ class DmsLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* delete
|
||||||
*/
|
*/
|
||||||
public function delete($person_id, $dms_id)
|
public function delete($person_id, $dms_id)
|
||||||
{
|
{
|
||||||
@@ -218,11 +214,11 @@ class DmsLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* _saveFileOnInsert
|
||||||
*/
|
*/
|
||||||
private function _saveFileOnInsert($dms)
|
private function _saveFileOnInsert($dms)
|
||||||
{
|
{
|
||||||
$filename = uniqid() . '.' . pathinfo($dms['name'], PATHINFO_EXTENSION);
|
$filename = uniqid().'.'.pathinfo($dms['name'], PATHINFO_EXTENSION);
|
||||||
|
|
||||||
$result = $this->ci->DmsFSModel->write($filename, $dms['file_content']);
|
$result = $this->ci->DmsFSModel->write($filename, $dms['file_content']);
|
||||||
if (isSuccess($result))
|
if (isSuccess($result))
|
||||||
@@ -234,13 +230,13 @@ class DmsLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* _saveFileOnUpdate
|
||||||
*/
|
*/
|
||||||
private function _saveFileOnUpdate($dms)
|
private function _saveFileOnUpdate($dms)
|
||||||
{
|
{
|
||||||
$result = null;
|
$result = null;
|
||||||
|
|
||||||
if(isset($dms['version']))
|
if (isset($dms['version']))
|
||||||
{
|
{
|
||||||
$result = $this->read($dms['dms_id'], $dms['version']);
|
$result = $this->read($dms['dms_id'], $dms['version']);
|
||||||
|
|
||||||
@@ -252,4 +248,4 @@ class DmsLib
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,6 @@
|
|||||||
* @since Version 1.0.0
|
* @since Version 1.0.0
|
||||||
* @filesource
|
* @filesource
|
||||||
*/
|
*/
|
||||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
|
||||||
|
|
||||||
require_once FHCPATH.'include/authentication.class.php';
|
|
||||||
require_once FHCPATH.'include/AddonAuthentication.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FHC-Auth Helpers
|
* FHC-Auth Helpers
|
||||||
@@ -25,7 +21,10 @@ require_once FHCPATH.'include/AddonAuthentication.php';
|
|||||||
* @link http://fhcomplete.org/user_guide/helpers/fhcauth_helper.html
|
* @link http://fhcomplete.org/user_guide/helpers/fhcauth_helper.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
require_once FHCPATH.'include/authentication.class.php';
|
||||||
|
require_once FHCPATH.'include/AddonAuthentication.php';
|
||||||
|
|
||||||
class FHC_Auth extends authentication
|
class FHC_Auth extends authentication
|
||||||
{
|
{
|
||||||
@@ -39,10 +38,6 @@ class FHC_Auth extends authentication
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Auth Username, Password over FH-Complete
|
* Auth Username, Password over FH-Complete
|
||||||
*
|
|
||||||
* @param string $username
|
|
||||||
* @param string $password
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function basicAuthentication($username, $password)
|
public function basicAuthentication($username, $password)
|
||||||
{
|
{
|
||||||
@@ -57,9 +52,9 @@ class FHC_Auth extends authentication
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* TO BE UPDATED
|
* TO BE UPDATED
|
||||||
*
|
*
|
||||||
* Get the md5 hashed password by the addon username
|
* Get the md5 hashed password by the addon username
|
||||||
*
|
*
|
||||||
* @param string $username addon username
|
* @param string $username addon username
|
||||||
@@ -71,4 +66,4 @@ class FHC_Auth extends authentication
|
|||||||
|
|
||||||
return md5($aam->getPasswordByUsername($username));
|
return md5($aam->getPasswordByUsername($username));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/***
|
||||||
* FH-Complete
|
* FH-Complete
|
||||||
*
|
*
|
||||||
* @package FHC-API
|
* @package FHC-API
|
||||||
@@ -10,19 +10,13 @@
|
|||||||
* @since Version 1.0
|
* @since Version 1.0
|
||||||
* @filesource
|
* @filesource
|
||||||
*/
|
*/
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
|
|
||||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
class FilesystemLib
|
class FilesystemLib
|
||||||
{
|
{
|
||||||
/*
|
/**
|
||||||
*
|
* checkParameters
|
||||||
*/
|
|
||||||
public function __construct() {}
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
private function checkParameters($filepath, $filename)
|
private function checkParameters($filepath, $filename)
|
||||||
{
|
{
|
||||||
@@ -37,8 +31,8 @@ class FilesystemLib
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
*
|
* read
|
||||||
*/
|
*/
|
||||||
public function read($filepath, $filename)
|
public function read($filepath, $filename)
|
||||||
{
|
{
|
||||||
@@ -46,7 +40,7 @@ class FilesystemLib
|
|||||||
|
|
||||||
if ($this->checkParameters($filepath, $filename))
|
if ($this->checkParameters($filepath, $filename))
|
||||||
{
|
{
|
||||||
$resource = $filepath . DIRECTORY_SEPARATOR . $filename;
|
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
|
||||||
if (file_exists($resource) && $fileHandle = fopen($resource, 'r'))
|
if (file_exists($resource) && $fileHandle = fopen($resource, 'r'))
|
||||||
{
|
{
|
||||||
$result = '';
|
$result = '';
|
||||||
@@ -61,8 +55,8 @@ class FilesystemLib
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
*
|
* write
|
||||||
*/
|
*/
|
||||||
public function write($filepath, $filename, $content)
|
public function write($filepath, $filename, $content)
|
||||||
{
|
{
|
||||||
@@ -70,7 +64,7 @@ class FilesystemLib
|
|||||||
|
|
||||||
if ($this->checkParameters($filepath, $filename) && isset($content))
|
if ($this->checkParameters($filepath, $filename) && isset($content))
|
||||||
{
|
{
|
||||||
$resource = $filepath . DIRECTORY_SEPARATOR . $filename;
|
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
|
||||||
if (is_writable($filepath) && $fileHandle = fopen($resource, 'w'))
|
if (is_writable($filepath) && $fileHandle = fopen($resource, 'w'))
|
||||||
{
|
{
|
||||||
if (fwrite($fileHandle, $content) !== false)
|
if (fwrite($fileHandle, $content) !== false)
|
||||||
@@ -84,8 +78,8 @@ class FilesystemLib
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
*
|
* append
|
||||||
*/
|
*/
|
||||||
public function append($filepath, $filename, $content)
|
public function append($filepath, $filename, $content)
|
||||||
{
|
{
|
||||||
@@ -93,7 +87,7 @@ class FilesystemLib
|
|||||||
|
|
||||||
if ($this->checkParameters($filepath, $filename) && isset($content))
|
if ($this->checkParameters($filepath, $filename) && isset($content))
|
||||||
{
|
{
|
||||||
$resource = $filepath . DIRECTORY_SEPARATOR . $filename;
|
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
|
||||||
if (is_writable($resource) && $fileHandle = fopen($resource, 'a'))
|
if (is_writable($resource) && $fileHandle = fopen($resource, 'a'))
|
||||||
{
|
{
|
||||||
if (fwrite($fileHandle, $content) !== false)
|
if (fwrite($fileHandle, $content) !== false)
|
||||||
@@ -107,8 +101,8 @@ class FilesystemLib
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
*
|
* remove
|
||||||
*/
|
*/
|
||||||
public function remove($filepath, $filename)
|
public function remove($filepath, $filename)
|
||||||
{
|
{
|
||||||
@@ -118,7 +112,7 @@ class FilesystemLib
|
|||||||
{
|
{
|
||||||
if (is_writable($filepath))
|
if (is_writable($filepath))
|
||||||
{
|
{
|
||||||
$resource = $filepath . DIRECTORY_SEPARATOR . $filename;
|
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
|
||||||
$result = unlink($resource);
|
$result = unlink($resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,8 +120,8 @@ class FilesystemLib
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
*
|
* rename
|
||||||
*/
|
*/
|
||||||
public function rename($filepath, $filename, $newFilepath, $newFilename)
|
public function rename($filepath, $filename, $newFilepath, $newFilename)
|
||||||
{
|
{
|
||||||
@@ -135,14 +129,14 @@ class FilesystemLib
|
|||||||
|
|
||||||
if ($this->checkParameters($filepath, $filename) && $this->checkParameters($newFilepath, $newFilename))
|
if ($this->checkParameters($filepath, $filename) && $this->checkParameters($newFilepath, $newFilename))
|
||||||
{
|
{
|
||||||
$resource = $filepath . DIRECTORY_SEPARATOR . $filename;
|
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
|
||||||
if (is_writable($filepath) && is_writable($newFilepath) && file_exists($resource))
|
if (is_writable($filepath) && is_writable($newFilepath) && file_exists($resource))
|
||||||
{
|
{
|
||||||
$destination = $newFilepath . DIRECTORY_SEPARATOR . $newFilename;
|
$destination = $newFilepath.DIRECTORY_SEPARATOR.$newFilename;
|
||||||
$result = rename($resource, $destination);
|
$result = rename($resource, $destination);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,24 +17,25 @@ class LogLib
|
|||||||
const LINE_SEPARATOR = ':';
|
const LINE_SEPARATOR = ':';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object initialization
|
* format
|
||||||
*/
|
*/
|
||||||
public function __construct() {}
|
|
||||||
|
|
||||||
private function format($class, $function, $line)
|
private function format($class, $function, $line)
|
||||||
{
|
{
|
||||||
$formatted = LogLib::CALLER_PREFIX;
|
$formatted = LogLib::CALLER_PREFIX;
|
||||||
|
|
||||||
if (!is_null($class) && $class != '')
|
if (!is_null($class) && $class != '')
|
||||||
{
|
{
|
||||||
$formatted .= $class . LogLib::CLASS_POSTFIX;
|
$formatted .= $class.LogLib::CLASS_POSTFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
$formatted .= $function . LogLib::LINE_SEPARATOR . $line . LogLib::CALLER_POSTFIX . ' ';
|
$formatted .= $function.LogLib::LINE_SEPARATOR.$line.LogLib::CALLER_POSTFIX.' ';
|
||||||
|
|
||||||
return $formatted;
|
return $formatted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getCaller
|
||||||
|
*/
|
||||||
private function getCaller()
|
private function getCaller()
|
||||||
{
|
{
|
||||||
$classIndex = 3;
|
$classIndex = 3;
|
||||||
@@ -62,13 +63,16 @@ class LogLib
|
|||||||
return $this->format($class, $function, $line);
|
return $this->format($class, $function, $line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* log
|
||||||
|
*/
|
||||||
private function log($level, $message)
|
private function log($level, $message)
|
||||||
{
|
{
|
||||||
log_message($level, $this->getCaller() . $message);
|
log_message($level, $this->getCaller().$message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* logDebug
|
||||||
*/
|
*/
|
||||||
public function logDebug($message)
|
public function logDebug($message)
|
||||||
{
|
{
|
||||||
@@ -76,7 +80,7 @@ class LogLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* logInfo
|
||||||
*/
|
*/
|
||||||
public function logInfo($message)
|
public function logInfo($message)
|
||||||
{
|
{
|
||||||
@@ -84,10 +88,10 @@ class LogLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* logError
|
||||||
*/
|
*/
|
||||||
public function logError($message)
|
public function logError($message)
|
||||||
{
|
{
|
||||||
$this->log(LogLib::ERROR, $message);
|
$this->log(LogLib::ERROR, $message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (! defined("BASEPATH")) exit("No direct script access allowed");
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Library to manage the sending of the email
|
* Library to manage the sending of the email
|
||||||
@@ -27,33 +27,33 @@ class MailLib
|
|||||||
$this->ci =& get_instance();
|
$this->ci =& get_instance();
|
||||||
|
|
||||||
// The second parameter is used to avoiding name collisions in the config array
|
// The second parameter is used to avoiding name collisions in the config array
|
||||||
$this->ci->config->load("mail", true);
|
$this->ci->config->load('mail', true);
|
||||||
|
|
||||||
// CI Email library
|
// CI Email library
|
||||||
$this->ci->load->library("email");
|
$this->ci->load->library('email');
|
||||||
|
|
||||||
// Initializing email library with the loaded configurations
|
// Initializing email library with the loaded configurations
|
||||||
$this->ci->email->initialize($this->ci->config->config["mail"]);
|
$this->ci->email->initialize($this->ci->config->config['mail']);
|
||||||
|
|
||||||
// Set the configuration properties with the standard configuration values
|
// Set the configuration properties with the standard configuration values
|
||||||
$this->email_number_to_sent = $this->getEmailCfgItem("email_number_to_sent");
|
$this->email_number_to_sent = $this->getEmailCfgItem('email_number_to_sent');
|
||||||
$this->email_number_per_time_range = $this->getEmailCfgItem("email_number_per_time_range");
|
$this->email_number_per_time_range = $this->getEmailCfgItem('email_number_per_time_range');
|
||||||
$this->email_time_range = $this->getEmailCfgItem("email_time_range");
|
$this->email_time_range = $this->getEmailCfgItem('email_time_range');
|
||||||
$this->email_from_system = $this->getEmailCfgItem("email_from_system");
|
$this->email_from_system = $this->getEmailCfgItem('email_from_system');
|
||||||
$this->alias_from_system = $this->getEmailCfgItem("alias_from_system");
|
$this->alias_from_system = $this->getEmailCfgItem('alias_from_system');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a single email
|
* Sends a single email
|
||||||
*/
|
*/
|
||||||
public function send($from, $to, $subject, $message, $alias = "", $cc = null, $bcc = null, $altMessage = '')
|
public function send($from, $to, $subject, $message, $alias = '', $cc = null, $bcc = null, $altMessage = '')
|
||||||
{
|
{
|
||||||
// If from is not specified then use the standard one
|
// If from is not specified then use the standard one
|
||||||
if (is_null($from) || $from == "")
|
if (is_null($from) || $from == '')
|
||||||
{
|
{
|
||||||
$from = $this->email_from_system;
|
$from = $this->email_from_system;
|
||||||
// If alias is not specified then use the standard one
|
// If alias is not specified then use the standard one
|
||||||
if (is_null($alias) || $alias == "")
|
if (is_null($alias) || $alias == '')
|
||||||
{
|
{
|
||||||
$alias = $this->alias_from_system;
|
$alias = $this->alias_from_system;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,15 @@
|
|||||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Messaging Library for FH-Complete
|
* Messaging Library for FH-Complete
|
||||||
*/
|
*/
|
||||||
class MessageLib
|
class MessageLib
|
||||||
{
|
{
|
||||||
const MSG_INDX_PREFIX = 'message_';
|
const MSG_INDX_PREFIX = 'message_';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// Get code igniter instance
|
// Get code igniter instance
|
||||||
@@ -43,10 +46,6 @@ class MessageLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* getMessage() - returns the spicified received message for a specified person
|
* getMessage() - returns the spicified received message for a specified person
|
||||||
*
|
|
||||||
* @param string $msg_id REQUIRED
|
|
||||||
* @param string $person_id REQUIRED
|
|
||||||
* @return object
|
|
||||||
*/
|
*/
|
||||||
public function getMessage($msg_id, $person_id)
|
public function getMessage($msg_id, $person_id)
|
||||||
{
|
{
|
||||||
@@ -62,9 +61,6 @@ class MessageLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* getMessagesByUID() - will return all messages, including the latest status for specified user. It don´t returns Attachments.
|
* getMessagesByUID() - will return all messages, including the latest status for specified user. It don´t returns Attachments.
|
||||||
*
|
|
||||||
* @param string $uid REQUIRED
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function getMessagesByUID($uid, $all = false)
|
public function getMessagesByUID($uid, $all = false)
|
||||||
{
|
{
|
||||||
@@ -78,9 +74,6 @@ class MessageLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* getMessagesByPerson() - will return all messages, including the latest status for specified user. It don´t returns Attachments.
|
* getMessagesByPerson() - will return all messages, including the latest status for specified user. It don´t returns Attachments.
|
||||||
*
|
|
||||||
* @param bigint $person_id REQUIRED
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function getMessagesByPerson($person_id, $all = false)
|
public function getMessagesByPerson($person_id, $all = false)
|
||||||
{
|
{
|
||||||
@@ -94,9 +87,6 @@ class MessageLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* getSentMessagesByPerson() - Get all sent messages from a person identified by person_id
|
* getSentMessagesByPerson() - Get all sent messages from a person identified by person_id
|
||||||
*
|
|
||||||
* @param bigint $person_id REQUIRED
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function getSentMessagesByPerson($person_id, $all = false)
|
public function getSentMessagesByPerson($person_id, $all = false)
|
||||||
{
|
{
|
||||||
@@ -110,9 +100,6 @@ class MessageLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* getMessageByToken
|
* getMessageByToken
|
||||||
*
|
|
||||||
* @param token string
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function getMessageByToken($token)
|
public function getMessageByToken($token)
|
||||||
{
|
{
|
||||||
@@ -156,9 +143,6 @@ class MessageLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* getCountUnreadMessages
|
* getCountUnreadMessages
|
||||||
*
|
|
||||||
* @param bigint $person_id REQUIRED
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function getCountUnreadMessages($person_id)
|
public function getCountUnreadMessages($person_id)
|
||||||
{
|
{
|
||||||
@@ -172,11 +156,6 @@ class MessageLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* updateMessageStatus() - will change status on message for particular user
|
* updateMessageStatus() - 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
|
|
||||||
*/
|
*/
|
||||||
public function updateMessageStatus($message_id, $person_id, $status)
|
public function updateMessageStatus($message_id, $person_id, $status)
|
||||||
{
|
{
|
||||||
@@ -219,7 +198,6 @@ class MessageLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* sendMessage() - sends new internal message. This function will create a new thread
|
* sendMessage() - sends new internal message. This function will create a new thread
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function sendMessage($sender_id, $receiver_id, $subject, $body, $priority = PRIORITY_NORMAL, $relationmessage_id = null, $oe_kurzbz = null, $multiPartMime = true)
|
public function sendMessage($sender_id, $receiver_id, $subject, $body, $priority = PRIORITY_NORMAL, $relationmessage_id = null, $oe_kurzbz = null, $multiPartMime = true)
|
||||||
{
|
{
|
||||||
@@ -270,7 +248,7 @@ class MessageLib
|
|||||||
$result = $this->_error('', MSG_ERR_SUBJECT_EMPTY);
|
$result = $this->_error('', MSG_ERR_SUBJECT_EMPTY);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (empty($body))
|
elseif (empty($body))
|
||||||
{
|
{
|
||||||
$result = $this->_error('', MSG_ERR_BODY_EMPTY);
|
$result = $this->_error('', MSG_ERR_BODY_EMPTY);
|
||||||
break;
|
break;
|
||||||
@@ -295,13 +273,6 @@ class MessageLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* sendMessageVorlage() - sends new internal message using a template
|
* sendMessageVorlage() - sends new internal message using a template
|
||||||
*
|
|
||||||
* @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
|
|
||||||
*/
|
*/
|
||||||
public function sendMessageVorlage($sender_id, $receiver_id, $vorlage_kurzbz, $oe_kurzbz, $data, $relationmessage_id = null, $orgform_kurzbz = null, $multiPartMime = true)
|
public function sendMessageVorlage($sender_id, $receiver_id, $vorlage_kurzbz, $oe_kurzbz, $data, $relationmessage_id = null, $orgform_kurzbz = null, $multiPartMime = true)
|
||||||
{
|
{
|
||||||
@@ -375,19 +346,19 @@ class MessageLib
|
|||||||
$result = $this->_error('', MSG_ERR_TEMPLATE_NOT_FOUND);
|
$result = $this->_error('', MSG_ERR_TEMPLATE_NOT_FOUND);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (is_array($result->retval) && count($result->retval) > 0)
|
elseif (is_array($result->retval) && count($result->retval) > 0)
|
||||||
{
|
{
|
||||||
if (is_null($result->retval[0]->oe_kurzbz))
|
if (is_null($result->retval[0]->oe_kurzbz))
|
||||||
{
|
{
|
||||||
$result = $this->_error('', MSG_ERR_TEMPLATE_NOT_FOUND);
|
$result = $this->_error('', MSG_ERR_TEMPLATE_NOT_FOUND);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (empty($result->retval[0]->text))
|
elseif (empty($result->retval[0]->text))
|
||||||
{
|
{
|
||||||
$result = $this->_error('', MSG_ERR_INVALID_TEMPLATE);
|
$result = $this->_error('', MSG_ERR_INVALID_TEMPLATE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (empty($result->retval[0]->subject))
|
elseif (empty($result->retval[0]->subject))
|
||||||
{
|
{
|
||||||
$result = $this->_error('', MSG_ERR_INVALID_TEMPLATE);
|
$result = $this->_error('', MSG_ERR_INVALID_TEMPLATE);
|
||||||
break;
|
break;
|
||||||
@@ -453,7 +424,7 @@ class MessageLib
|
|||||||
// If the person has an email account
|
// If the person has an email account
|
||||||
if (!is_null($result->retval[$i]->receiver) && $result->retval[$i]->receiver != '')
|
if (!is_null($result->retval[$i]->receiver) && $result->retval[$i]->receiver != '')
|
||||||
{
|
{
|
||||||
$href = $this->ci->config->item('message_server') . $this->ci->config->item('message_html_view_url') . $result->retval[0]->token;
|
$href = $this->ci->config->item('message_server').$this->ci->config->item('message_html_view_url').$result->retval[0]->token;
|
||||||
// Using a template for the html email body
|
// Using a template for the html email body
|
||||||
$body = $this->ci->parser->parse(
|
$body = $this->ci->parser->parse(
|
||||||
'templates/mailHTML',
|
'templates/mailHTML',
|
||||||
@@ -533,10 +504,10 @@ class MessageLib
|
|||||||
$this->ci->loglib->logError('This person does not have an email account');
|
$this->ci->loglib->logError('This person does not have an email account');
|
||||||
// Writing errors in tbl_message_recipient
|
// Writing errors in tbl_message_recipient
|
||||||
$sme = $this->setMessageError(
|
$sme = $this->setMessageError(
|
||||||
$result->retval[$i]->message_id,
|
$result->retval[$i]->message_id,
|
||||||
$result->retval[$i]->receiver_id,
|
$result->retval[$i]->receiver_id,
|
||||||
'This person does not have an email account',
|
'This person does not have an email account',
|
||||||
$result->retval[$i]->sentinfo
|
$result->retval[$i]->sentinfo
|
||||||
);
|
);
|
||||||
if (!$sme)
|
if (!$sme)
|
||||||
{
|
{
|
||||||
@@ -570,10 +541,10 @@ class MessageLib
|
|||||||
|
|
||||||
// Get a specific message from DB having EMAIL_KONTAKT_TYPE as relative contact type
|
// Get a specific message from DB having EMAIL_KONTAKT_TYPE as relative contact type
|
||||||
$result = $this->ci->RecipientModel->getMessages(
|
$result = $this->ci->RecipientModel->getMessages(
|
||||||
EMAIL_KONTAKT_TYPE,
|
EMAIL_KONTAKT_TYPE,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
$message_id
|
$message_id
|
||||||
);
|
);
|
||||||
// Checks if errors were occurred
|
// Checks if errors were occurred
|
||||||
if (isSuccess($result))
|
if (isSuccess($result))
|
||||||
@@ -588,7 +559,7 @@ class MessageLib
|
|||||||
if ($multiPartMime === true)
|
if ($multiPartMime === true)
|
||||||
{
|
{
|
||||||
// Using a template for the html email body
|
// Using a template for the html email body
|
||||||
$href = $this->ci->config->item('message_server') . $this->ci->config->item('message_html_view_url') . $result->retval[0]->token;
|
$href = $this->ci->config->item('message_server').$this->ci->config->item('message_html_view_url').$result->retval[0]->token;
|
||||||
$bodyMsg = $this->ci->parser->parse(
|
$bodyMsg = $this->ci->parser->parse(
|
||||||
'templates/mailHTML',
|
'templates/mailHTML',
|
||||||
array(
|
array(
|
||||||
@@ -648,10 +619,10 @@ class MessageLib
|
|||||||
$this->ci->loglib->logError('Error while sending an email');
|
$this->ci->loglib->logError('Error while sending an email');
|
||||||
// Writing errors in tbl_message_status
|
// Writing errors in tbl_message_status
|
||||||
$sme = $this->setMessageError(
|
$sme = $this->setMessageError(
|
||||||
$result->retval[0]->message_id,
|
$result->retval[0]->message_id,
|
||||||
$result->retval[0]->receiver_id,
|
$result->retval[0]->receiver_id,
|
||||||
'Error while sending an email',
|
'Error while sending an email',
|
||||||
$result->retval[0]->sentinfo
|
$result->retval[0]->sentinfo
|
||||||
);
|
);
|
||||||
if (!$sme)
|
if (!$sme)
|
||||||
{
|
{
|
||||||
@@ -674,10 +645,10 @@ class MessageLib
|
|||||||
$this->ci->loglib->logError('This person does not have an email account');
|
$this->ci->loglib->logError('This person does not have an email account');
|
||||||
// Writing errors in tbl_message_status
|
// Writing errors in tbl_message_status
|
||||||
$sme = $this->setMessageError(
|
$sme = $this->setMessageError(
|
||||||
$result->retval[0]->message_id,
|
$result->retval[0]->message_id,
|
||||||
$result->retval[0]->receiver_id,
|
$result->retval[0]->receiver_id,
|
||||||
'This person does not have an email account',
|
'This person does not have an email account',
|
||||||
$result->retval[0]->sentinfo
|
$result->retval[0]->sentinfo
|
||||||
);
|
);
|
||||||
if (!$sme)
|
if (!$sme)
|
||||||
{
|
{
|
||||||
@@ -702,8 +673,7 @@ class MessageLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
// Private Functions from here out!
|
// Private methods
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the table tbl_message_recipient
|
* Update the table tbl_message_recipient
|
||||||
@@ -740,7 +710,7 @@ class MessageLib
|
|||||||
{
|
{
|
||||||
if (!is_null($prevSentInfo) && $prevSentInfo != '')
|
if (!is_null($prevSentInfo) && $prevSentInfo != '')
|
||||||
{
|
{
|
||||||
$sentInfo = $prevSentInfo . SENT_INFO_NEWLINE . $sentInfo;
|
$sentInfo = $prevSentInfo.SENT_INFO_NEWLINE.$sentInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parameters = array('sent' => null, 'sentinfo' => $sentInfo);
|
$parameters = array('sent' => null, 'sentinfo' => $sentInfo);
|
||||||
@@ -759,8 +729,8 @@ class MessageLib
|
|||||||
$this->ci->BenutzerfunktionModel->addJoin('public.tbl_benutzer', 'uid');
|
$this->ci->BenutzerfunktionModel->addJoin('public.tbl_benutzer', 'uid');
|
||||||
// Get all the valid receivers id using the oe_kurzbz
|
// Get all the valid receivers id using the oe_kurzbz
|
||||||
$receivers = $this->ci->BenutzerfunktionModel->loadWhere(
|
$receivers = $this->ci->BenutzerfunktionModel->loadWhere(
|
||||||
'oe_kurzbz = \'' . $oe_kurzbz . '\''.
|
'oe_kurzbz = \''.$oe_kurzbz.'\''.
|
||||||
' AND funktion_kurzbz = \'' . $this->ci->config->item('assistent_function') . '\'' .
|
' AND funktion_kurzbz = \''.$this->ci->config->item('assistent_function').'\''.
|
||||||
' AND (NOW() BETWEEN COALESCE(datum_von, NOW()) AND COALESCE(datum_bis, NOW()))'
|
' AND (NOW() BETWEEN COALESCE(datum_von, NOW()) AND COALESCE(datum_bis, NOW()))'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -76,11 +76,11 @@ class MigrationLib extends CI_Migration
|
|||||||
{
|
{
|
||||||
if ($this->cli === true)
|
if ($this->cli === true)
|
||||||
{
|
{
|
||||||
$colored = "\033[" . $color . "m%s\033[37m";
|
$colored = "\033[".$color."m%s\033[37m";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$colored = "<font color=\"" . $this->HTML_COLORS[$color] . "\">%s</font>";
|
$colored = "<font color=\"".$this->HTML_COLORS[$color]."\">%s</font>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ class MigrationLib extends CI_Migration
|
|||||||
*/
|
*/
|
||||||
private function _print($prefix, $text, $color = null)
|
private function _print($prefix, $text, $color = null)
|
||||||
{
|
{
|
||||||
printf($this->getColored($color), sprintf("%s %s" . $this->getEOL(), $prefix, $text));
|
printf($this->getColored($color), sprintf("%s %s".$this->getEOL(), $prefix, $text));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -139,8 +139,8 @@ class MigrationLib extends CI_Migration
|
|||||||
*/
|
*/
|
||||||
protected function startUP()
|
protected function startUP()
|
||||||
{
|
{
|
||||||
$this->printInfo(sprintf("%s Start method up of class %s %s",
|
$this->printInfo(
|
||||||
MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
|
sprintf("%s Start method up of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,8 +149,8 @@ class MigrationLib extends CI_Migration
|
|||||||
*/
|
*/
|
||||||
protected function endUP()
|
protected function endUP()
|
||||||
{
|
{
|
||||||
$this->printInfo(sprintf("%s End method up of class %s %s",
|
$this->printInfo(
|
||||||
MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
|
sprintf("%s End method up of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,8 +159,8 @@ class MigrationLib extends CI_Migration
|
|||||||
*/
|
*/
|
||||||
protected function startDown()
|
protected function startDown()
|
||||||
{
|
{
|
||||||
$this->printInfo(sprintf("%s Start method down of class %s %s",
|
$this->printInfo(
|
||||||
MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
|
sprintf("%s Start method down of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,8 +169,8 @@ class MigrationLib extends CI_Migration
|
|||||||
*/
|
*/
|
||||||
protected function endDown()
|
protected function endDown()
|
||||||
{
|
{
|
||||||
$this->printInfo(sprintf("%s End method down of class %s %s",
|
$this->printInfo(
|
||||||
MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
|
sprintf("%s End method down of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,11 +179,11 @@ class MigrationLib extends CI_Migration
|
|||||||
*/
|
*/
|
||||||
protected function addColumn($schema, $table, $fields)
|
protected function addColumn($schema, $table, $fields)
|
||||||
{
|
{
|
||||||
foreach($fields as $name => $definition)
|
foreach ($fields as $name => $definition)
|
||||||
{
|
{
|
||||||
if (!$this->columnExists($name, $schema, $table))
|
if (!$this->columnExists($name, $schema, $table))
|
||||||
{
|
{
|
||||||
if ($this->dbforge->add_column($schema . '.' . $table, array($name => $definition)))
|
if ($this->dbforge->add_column($schema.'.'.$table, array($name => $definition)))
|
||||||
{
|
{
|
||||||
$this->printMessage(sprintf("Column %s.%s.%s of type %s added", $schema, $table, $name, $definition["type"]));
|
$this->printMessage(sprintf("Column %s.%s.%s of type %s added", $schema, $table, $name, $definition["type"]));
|
||||||
}
|
}
|
||||||
@@ -204,11 +204,11 @@ class MigrationLib extends CI_Migration
|
|||||||
*/
|
*/
|
||||||
protected function modifyColumn($schema, $table, $fields)
|
protected function modifyColumn($schema, $table, $fields)
|
||||||
{
|
{
|
||||||
foreach($fields as $name => $definition)
|
foreach ($fields as $name => $definition)
|
||||||
{
|
{
|
||||||
if ($this->columnExists($name, $schema, $table))
|
if ($this->columnExists($name, $schema, $table))
|
||||||
{
|
{
|
||||||
if ($this->dbforge->modify_column($schema . '.' . $table, array($name => $definition)))
|
if ($this->dbforge->modify_column($schema.'.'.$table, array($name => $definition)))
|
||||||
{
|
{
|
||||||
$this->printMessage(sprintf("Column %s.%s.%s has been modified", $schema, $table, $name));
|
$this->printMessage(sprintf("Column %s.%s.%s has been modified", $schema, $table, $name));
|
||||||
}
|
}
|
||||||
@@ -231,7 +231,7 @@ class MigrationLib extends CI_Migration
|
|||||||
{
|
{
|
||||||
if ($this->columnExists($field, $schema, $table))
|
if ($this->columnExists($field, $schema, $table))
|
||||||
{
|
{
|
||||||
if ($this->dbforge->drop_column($schema . '.' . $table, $field))
|
if ($this->dbforge->drop_column($schema.'.'.$table, $field))
|
||||||
{
|
{
|
||||||
$this->printMessage(sprintf("Column %s.%s.%s has been dropped", $schema, $table, $field));
|
$this->printMessage(sprintf("Column %s.%s.%s has been dropped", $schema, $table, $field));
|
||||||
}
|
}
|
||||||
@@ -289,8 +289,17 @@ class MigrationLib extends CI_Migration
|
|||||||
*/
|
*/
|
||||||
protected function addForeingKey($schema, $table, $name, $field, $schemaDest, $tableDest, $fieldDest, $attributes)
|
protected function addForeingKey($schema, $table, $name, $field, $schemaDest, $tableDest, $fieldDest, $attributes)
|
||||||
{
|
{
|
||||||
$query = sprintf("ALTER TABLE %s.%s ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s.%s (%s) %s",
|
$query = sprintf(
|
||||||
$schema, $table, $name, $field, $schemaDest, $tableDest, $fieldDest, $attributes);
|
"ALTER TABLE %s.%s ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s.%s (%s) %s",
|
||||||
|
$schema,
|
||||||
|
$table,
|
||||||
|
$name,
|
||||||
|
$field,
|
||||||
|
$schemaDest,
|
||||||
|
$tableDest,
|
||||||
|
$fieldDest,
|
||||||
|
$attributes
|
||||||
|
);
|
||||||
|
|
||||||
if (@$this->db->simple_query($query))
|
if (@$this->db->simple_query($query))
|
||||||
{
|
{
|
||||||
@@ -371,22 +380,26 @@ class MigrationLib extends CI_Migration
|
|||||||
if (@$this->db->simple_query($query))
|
if (@$this->db->simple_query($query))
|
||||||
{
|
{
|
||||||
$this->printMessage(
|
$this->printMessage(
|
||||||
sprintf("Granted permissions %s on table %s.%s to user %s",
|
sprintf(
|
||||||
is_null($stringPermission) ? $permissions : $stringPermission,
|
"Granted permissions %s on table %s.%s to user %s",
|
||||||
$schema,
|
is_null($stringPermission) ? $permissions : $stringPermission,
|
||||||
$table,
|
$schema,
|
||||||
$user
|
$table,
|
||||||
));
|
$user
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->printError(
|
$this->printError(
|
||||||
sprintf("Granting permissions %s on table %s.%s to user %s",
|
sprintf(
|
||||||
is_null($stringPermission) ? $permissions : $stringPermission,
|
"Granting permissions %s on table %s.%s to user %s",
|
||||||
$schema,
|
is_null($stringPermission) ? $permissions : $stringPermission,
|
||||||
$table,
|
$schema,
|
||||||
$user
|
$table,
|
||||||
));
|
$user
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,7 +410,7 @@ class MigrationLib extends CI_Migration
|
|||||||
{
|
{
|
||||||
$this->dbforge->add_field($fields);
|
$this->dbforge->add_field($fields);
|
||||||
|
|
||||||
if ($this->dbforge->create_table($schema . '.' . $table, true))
|
if ($this->dbforge->create_table($schema.'.'.$table, true))
|
||||||
{
|
{
|
||||||
$this->printMessage(sprintf("Table %s.%s created or existing", $schema, $table));
|
$this->printMessage(sprintf("Table %s.%s created or existing", $schema, $table));
|
||||||
}
|
}
|
||||||
@@ -412,7 +425,7 @@ class MigrationLib extends CI_Migration
|
|||||||
*/
|
*/
|
||||||
protected function dropTable($schema, $table)
|
protected function dropTable($schema, $table)
|
||||||
{
|
{
|
||||||
if ($this->dbforge->drop_table($schema . "." . $table))
|
if ($this->dbforge->drop_table($schema.".".$table))
|
||||||
{
|
{
|
||||||
$this->printMessage(sprintf("Table %s.%s has been dropped", $schema, $table));
|
$this->printMessage(sprintf("Table %s.%s has been dropped", $schema, $table));
|
||||||
}
|
}
|
||||||
@@ -503,22 +516,26 @@ class MigrationLib extends CI_Migration
|
|||||||
if (@$this->db->simple_query($query))
|
if (@$this->db->simple_query($query))
|
||||||
{
|
{
|
||||||
$this->printMessage(
|
$this->printMessage(
|
||||||
sprintf("Granted permissions %s on sequence %s.%s to user %s",
|
sprintf(
|
||||||
is_null($stringPermission) ? $permissions : $stringPermission,
|
"Granted permissions %s on sequence %s.%s to user %s",
|
||||||
$schema,
|
is_null($stringPermission) ? $permissions : $stringPermission,
|
||||||
$sequence,
|
$schema,
|
||||||
$user
|
$sequence,
|
||||||
));
|
$user
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->printError(
|
$this->printError(
|
||||||
sprintf("Granting permissions %s on sequence %s.%s to user %s",
|
sprintf(
|
||||||
is_null($stringPermission) ? $permissions : $stringPermission,
|
"Granting permissions %s on sequence %s.%s to user %s",
|
||||||
$schema,
|
is_null($stringPermission) ? $permissions : $stringPermission,
|
||||||
$sequence,
|
$schema,
|
||||||
$user
|
$sequence,
|
||||||
));
|
$user
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -542,9 +559,9 @@ class MigrationLib extends CI_Migration
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->printInfo(
|
$this->printInfo(
|
||||||
"Query correctly executed: " .
|
"Query correctly executed: ".
|
||||||
substr(preg_replace("/\s+/", " ", trim($query)), 0, MigrationLib::PRINT_QUERY_LEN) .
|
substr(preg_replace("/\s+/", " ", trim($query)), 0, MigrationLib::PRINT_QUERY_LEN).
|
||||||
(strlen($query) > MigrationLib::PRINT_QUERY_LEN ? "..." : "")
|
(strlen($query) > MigrationLib::PRINT_QUERY_LEN ? "..." : "")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ if (! defined("BASEPATH")) exit("No direct script access allowed");
|
|||||||
|
|
||||||
class OrganisationseinheitLib
|
class OrganisationseinheitLib
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Loads model OrganisationseinheitModel
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->ci =& get_instance();
|
$this->ci =& get_instance();
|
||||||
@@ -22,7 +25,7 @@ class OrganisationseinheitLib
|
|||||||
* to the top, starting from the given oe_kurzbz. It stops when it finds a
|
* to the top, starting from the given oe_kurzbz. It stops when it finds a
|
||||||
* match with the other table, which attributes are passed as parameters:
|
* match with the other table, which attributes are passed as parameters:
|
||||||
* schema name, table name, fields to be selected, where conditions, orderby clause
|
* schema name, table name, fields to be selected, where conditions, orderby clause
|
||||||
*
|
*
|
||||||
* @param string $schema REQUIRED
|
* @param string $schema REQUIRED
|
||||||
* @param string $table REQUIRED
|
* @param string $table REQUIRED
|
||||||
* @param mixed $fields REQUIRED
|
* @param mixed $fields REQUIRED
|
||||||
@@ -63,6 +66,9 @@ class OrganisationseinheitLib
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* treeSearchEntire
|
||||||
|
*/
|
||||||
public function treeSearchEntire($table, $alias, $fields, $where, $orderby, $oe_kurzbz)
|
public function treeSearchEntire($table, $alias, $fields, $where, $orderby, $oe_kurzbz)
|
||||||
{
|
{
|
||||||
$select = "";
|
$select = "";
|
||||||
@@ -90,12 +96,15 @@ class OrganisationseinheitLib
|
|||||||
{
|
{
|
||||||
$tmpResult = $this->treeSearchEntire($table, $alias, $select, $where, $orderby, $result->retval[0]->_ppk);
|
$tmpResult = $this->treeSearchEntire($table, $alias, $select, $where, $orderby, $result->retval[0]->_ppk);
|
||||||
|
|
||||||
if (hasData($tmpResult) && $tmpResult->retval[0]->_pk != null && $tmpResult->retval[0]->_ppk != null && $tmpResult->retval[0]->_jtpk != null)
|
if (hasData($tmpResult)
|
||||||
|
&& $tmpResult->retval[0]->_pk != null
|
||||||
|
&& $tmpResult->retval[0]->_ppk != null
|
||||||
|
&& $tmpResult->retval[0]->_jtpk != null)
|
||||||
{
|
{
|
||||||
$result->retval = array_merge($result->retval, $tmpResult->retval);
|
$result->retval = array_merge($result->retval, $tmpResult->retval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($result->retval[0]->_ppk != null)
|
elseif ($result->retval[0]->_ppk != null)
|
||||||
{
|
{
|
||||||
$result = $this->treeSearchEntire($table, $alias, $select, $where, $orderby, $result->retval[0]->_ppk);
|
$result = $this->treeSearchEntire($table, $alias, $select, $where, $orderby, $result->retval[0]->_ppk);
|
||||||
}
|
}
|
||||||
@@ -103,4 +112,4 @@ class OrganisationseinheitLib
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class PermissionLib
|
|||||||
* PermissionLib's constructor
|
* PermissionLib's constructor
|
||||||
* Here is initialized the static property bb with all the rights of the user (API caller)
|
* Here is initialized the static property bb with all the rights of the user (API caller)
|
||||||
*/
|
*/
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// Loads CI instance
|
// Loads CI instance
|
||||||
$this->ci =& get_instance();
|
$this->ci =& get_instance();
|
||||||
@@ -64,17 +64,16 @@ class PermissionLib
|
|||||||
*/
|
*/
|
||||||
public function isEntitled($sourceName, $permissionType)
|
public function isEntitled($sourceName, $permissionType)
|
||||||
{
|
{
|
||||||
|
$isEntitled = false;
|
||||||
|
|
||||||
// If the resource exists
|
// If the resource exists
|
||||||
if (isset($this->acl[$sourceName]))
|
if (isset($this->acl[$sourceName]))
|
||||||
{
|
{
|
||||||
// Checks permission
|
// Checks permission
|
||||||
return $this->_isBerechtigt($this->acl[$sourceName], $permissionType);
|
$isEntitled = $this->_isBerechtigt($this->acl[$sourceName], $permissionType);
|
||||||
}
|
|
||||||
// if the resource does not exist, do not lose useful clock cycles
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $isEntitled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,26 +81,26 @@ class PermissionLib
|
|||||||
*/
|
*/
|
||||||
public function getBerechtigungKurzbz($sourceName)
|
public function getBerechtigungKurzbz($sourceName)
|
||||||
{
|
{
|
||||||
|
$returnValue = null;
|
||||||
|
|
||||||
if (isset($this->acl[$sourceName]))
|
if (isset($this->acl[$sourceName]))
|
||||||
{
|
{
|
||||||
return $this->acl[$sourceName];
|
$returnValue = $this->acl[$sourceName];
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks user's (API caller) rights
|
* Checks user's (API caller) rights
|
||||||
*/
|
*/
|
||||||
private function _isBerechtigt($berechtigung_kurzbz, $art = null, $oe_kurzbz = null, $kostenstelle_id = null)
|
private function _isBerechtigt($berechtigung_kurzbz, $art = null, $oe_kurzbz = null, $kostenstelle_id = null)
|
||||||
{
|
{
|
||||||
$isBerechtigt = false;
|
$isBerechtigt = false;
|
||||||
|
|
||||||
if (!is_null($berechtigung_kurzbz))
|
if (!is_null($berechtigung_kurzbz))
|
||||||
{
|
{
|
||||||
if(self::$bb->isBerechtigt($berechtigung_kurzbz, $oe_kurzbz, $art, $kostenstelle_id))
|
if (self::$bb->isBerechtigt($berechtigung_kurzbz, $oe_kurzbz, $art, $kostenstelle_id))
|
||||||
{
|
{
|
||||||
$isBerechtigt = true;
|
$isBerechtigt = true;
|
||||||
}
|
}
|
||||||
@@ -109,4 +108,4 @@ class PermissionLib
|
|||||||
|
|
||||||
return $isBerechtigt;
|
return $isBerechtigt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
/**
|
|
||||||
* Name: Messaging Library for FH-Complete
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class PhrasesLib
|
class PhrasesLib
|
||||||
{
|
{
|
||||||
/*
|
/**
|
||||||
*
|
* Loads parser library
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -28,17 +24,12 @@ class PhrasesLib
|
|||||||
$this->ci->load->helper('language');
|
$this->ci->load->helper('language');
|
||||||
// Loads helper message to manage returning messages
|
// Loads helper message to manage returning messages
|
||||||
$this->ci->load->helper('message');
|
$this->ci->load->helper('message');
|
||||||
|
|
||||||
//$this->ci->lang->load('fhcomplete');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getPhrase() - will load a spezific Phrase
|
* getPhrase() - will load a spezific Phrase
|
||||||
*
|
|
||||||
* @param integer $vorlage_kurzbz REQUIRED
|
|
||||||
* @return struct
|
|
||||||
*/
|
*/
|
||||||
function getPhrase($phrase_id)
|
public function getPhrase($phrase_id)
|
||||||
{
|
{
|
||||||
if (empty($phrase_id))
|
if (empty($phrase_id))
|
||||||
return error(MSG_ERR_INVALID_MSG_ID);
|
return error(MSG_ERR_INVALID_MSG_ID);
|
||||||
@@ -49,17 +40,17 @@ class PhrasesLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* getSubMessages() - will return all Messages subordinated from a specified message.
|
* getSubMessages() - will return all Messages subordinated from a specified message.
|
||||||
*
|
|
||||||
* @param integer $msg_id REQUIRED
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
function getPhraseByApp($app = null)
|
public function getPhraseByApp($app = null)
|
||||||
{
|
{
|
||||||
$phrases = $this->ci->PhraseModel->loadWhere(array('app' => $app));
|
$phrases = $this->ci->PhraseModel->loadWhere(array('app' => $app));
|
||||||
return $phrases;
|
return $phrases;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPhraseInhalt($phrase_id)
|
/**
|
||||||
|
* getPhraseInhalt
|
||||||
|
*/
|
||||||
|
public function getPhraseInhalt($phrase_id)
|
||||||
{
|
{
|
||||||
if (empty($phrase_id))
|
if (empty($phrase_id))
|
||||||
return error(MSG_ERR_INVALID_MSG_ID);
|
return error(MSG_ERR_INVALID_MSG_ID);
|
||||||
@@ -68,7 +59,10 @@ class PhrasesLib
|
|||||||
return $phrasentext;
|
return $phrasentext;
|
||||||
}
|
}
|
||||||
|
|
||||||
function delPhrasentext($phrasentext_id)
|
/**
|
||||||
|
* delPhrasentext
|
||||||
|
*/
|
||||||
|
public function delPhrasentext($phrasentext_id)
|
||||||
{
|
{
|
||||||
if (empty($phrasentext_id))
|
if (empty($phrasentext_id))
|
||||||
return error(MSG_ERR_INVALID_MSG_ID);
|
return error(MSG_ERR_INVALID_MSG_ID);
|
||||||
@@ -79,11 +73,8 @@ class PhrasesLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* savePhrase() - will save a spezific Phrase.
|
* savePhrase() - will save a spezific Phrase.
|
||||||
*
|
|
||||||
* @param array $data REQUIRED
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
function savePhrase($phrase_id, $data)
|
public function savePhrase($phrase_id, $data)
|
||||||
{
|
{
|
||||||
if (empty($data))
|
if (empty($data))
|
||||||
return error(MSG_ERR_INVALID_MSG_ID);
|
return error(MSG_ERR_INVALID_MSG_ID);
|
||||||
@@ -95,11 +86,8 @@ class PhrasesLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template.
|
* getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template.
|
||||||
*
|
|
||||||
* @param string $vorlage_kurzbz REQUIRED
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
function getPhrasentextById($phrasentext_id)
|
public function getPhrasentextById($phrasentext_id)
|
||||||
{
|
{
|
||||||
if (empty($phrasentext_id))
|
if (empty($phrasentext_id))
|
||||||
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
||||||
@@ -109,11 +97,9 @@ class PhrasesLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getPhrases() -
|
* getPhrases()
|
||||||
*
|
|
||||||
* @return struct
|
|
||||||
*/
|
*/
|
||||||
function getPhrases($app, $sprache, $phrase = null, $orgeinheit_kurzbz = null, $orgform_kurzbz = null, $blockTags = null)
|
public function getPhrases($app, $sprache, $phrase = null, $orgeinheit_kurzbz = null, $orgform_kurzbz = null, $blockTags = null)
|
||||||
{
|
{
|
||||||
if (isset($app) && isset($sprache))
|
if (isset($app) && isset($sprache))
|
||||||
{
|
{
|
||||||
@@ -163,11 +149,8 @@ class PhrasesLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* insertPhraseinhalt() - will load tbl_vorlagestudiengang for a spezific Template.
|
* insertPhraseinhalt() - will load tbl_vorlagestudiengang for a spezific Template.
|
||||||
*
|
|
||||||
* @param string $vorlage_kurzbz REQUIRED
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
function insertPhraseinhalt($data)
|
public function insertPhraseinhalt($data)
|
||||||
{
|
{
|
||||||
$phrasentext = $this->ci->PhrasentextModel->insert($data);
|
$phrasentext = $this->ci->PhrasentextModel->insert($data);
|
||||||
return $phrasentext;
|
return $phrasentext;
|
||||||
@@ -175,11 +158,8 @@ class PhrasesLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* getVorlagetextById() - will load tbl_vorlagestudiengang for a spezific Template.
|
* getVorlagetextById() - will load tbl_vorlagestudiengang for a spezific Template.
|
||||||
*
|
|
||||||
* @param string $vorlage_kurzbz REQUIRED
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
function getVorlagetextById($vorlagestudiengang_id)
|
public function getVorlagetextById($vorlagestudiengang_id)
|
||||||
{
|
{
|
||||||
$vorlagetext = $this->ci->VorlageStudiengangModel->load($vorlagestudiengang_id);
|
$vorlagetext = $this->ci->VorlageStudiengangModel->load($vorlagestudiengang_id);
|
||||||
return $vorlagetext;
|
return $vorlagetext;
|
||||||
@@ -187,11 +167,8 @@ class PhrasesLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* saveVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
|
* saveVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
|
||||||
*
|
|
||||||
* @param string $vorlage_kurzbz REQUIRED
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
function updatePhraseInhalt($phrasentext_id, $data)
|
public function updatePhraseInhalt($phrasentext_id, $data)
|
||||||
{
|
{
|
||||||
$phrasentext = $this->ci->PhrasentextModel->update($phrasentext_id, $data);
|
$phrasentext = $this->ci->PhrasentextModel->update($phrasentext_id, $data);
|
||||||
return $phrasentext;
|
return $phrasentext;
|
||||||
@@ -199,16 +176,12 @@ class PhrasesLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* parseVorlagetext() - will parse a Vorlagetext.
|
* parseVorlagetext() - will parse a Vorlagetext.
|
||||||
*
|
|
||||||
* @param string $text REQUIRED
|
|
||||||
* @param array $data REQUIRED
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
function parseVorlagetext($text, $data = array())
|
public function parseVorlagetext($text, $data = array())
|
||||||
{
|
{
|
||||||
if (empty($text))
|
if (empty($text))
|
||||||
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
||||||
$text = $this->ci->parser->parse_string($text, $data, TRUE);
|
$text = $this->ci->parser->parse_string($text, $data, true);
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class ReihungstestLib
|
class ReihungstestLib
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -84,4 +81,4 @@ class ReihungstestLib
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class UDFLib
|
|||||||
private $_ci; // Code igniter instance
|
private $_ci; // Code igniter instance
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Loads fhc helper
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -61,7 +61,7 @@ class UDFLib
|
|||||||
// Public methods
|
// Public methods
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* UDFWidget
|
||||||
*/
|
*/
|
||||||
public function UDFWidget($args, $htmlArgs = array())
|
public function UDFWidget($args, $htmlArgs = array())
|
||||||
{
|
{
|
||||||
@@ -100,6 +100,7 @@ class UDFLib
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* It renders the HTML of the UDF
|
* It renders the HTML of the UDF
|
||||||
|
*
|
||||||
* NOTE: When this method is called $widgetData contains different data from
|
* NOTE: When this method is called $widgetData contains different data from
|
||||||
* parameter $args in the constructor
|
* parameter $args in the constructor
|
||||||
*/
|
*/
|
||||||
@@ -137,7 +138,7 @@ class UDFLib
|
|||||||
$this->_sortJsonSchemas($jsonSchemasArray); // Sort the list of UDF by sort property
|
$this->_sortJsonSchemas($jsonSchemasArray); // Sort the list of UDF by sort property
|
||||||
|
|
||||||
// Loops through json schemas
|
// Loops through json schemas
|
||||||
foreach($jsonSchemasArray as $jsonSchema)
|
foreach ($jsonSchemasArray as $jsonSchema)
|
||||||
{
|
{
|
||||||
// If the type property is not present then show an error
|
// If the type property is not present then show an error
|
||||||
if (!isset($jsonSchema->{UDFLib::TYPE}))
|
if (!isset($jsonSchema->{UDFLib::TYPE}))
|
||||||
@@ -266,7 +267,7 @@ class UDFLib
|
|||||||
// If $toBeValidated == true => validation is performed
|
// If $toBeValidated == true => validation is performed
|
||||||
// If $toBeValidated == false => validation is NOT performed
|
// If $toBeValidated == false => validation is NOT performed
|
||||||
$toBeValidated = false;
|
$toBeValidated = false;
|
||||||
// If this UDF is NOT a checkbox
|
// If this UDF is NOT a checkbox
|
||||||
if ($decodedUDFDefinition->{UDFLib::TYPE} != UDFLib::CHKBOX_TYPE)
|
if ($decodedUDFDefinition->{UDFLib::TYPE} != UDFLib::CHKBOX_TYPE)
|
||||||
{
|
{
|
||||||
// If required property is NOT present in the UDF description
|
// If required property is NOT present in the UDF description
|
||||||
@@ -292,9 +293,9 @@ class UDFLib
|
|||||||
if ($toBeValidated === true) // Checks if validation should be performed
|
if ($toBeValidated === true) // Checks if validation should be performed
|
||||||
{
|
{
|
||||||
$tmpValidate = $this->_validateUDFs(
|
$tmpValidate = $this->_validateUDFs(
|
||||||
$decodedUDFDefinition->{UDFLib::VALIDATION}, //
|
$decodedUDFDefinition->{UDFLib::VALIDATION},
|
||||||
$decodedUDFDefinition->{UDFLib::NAME}, //
|
$decodedUDFDefinition->{UDFLib::NAME},
|
||||||
$val //
|
$val
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -315,7 +316,7 @@ class UDFLib
|
|||||||
|
|
||||||
// Copies the remaining required UDFs into $notValidUDFsArray
|
// Copies the remaining required UDFs into $notValidUDFsArray
|
||||||
// because they were not supplied, therefore must be notified as error
|
// because they were not supplied, therefore must be notified as error
|
||||||
foreach($requiredUDFsArray as $key => $val)
|
foreach ($requiredUDFsArray as $key => $val)
|
||||||
{
|
{
|
||||||
$notValidUDFsArray[] = array($val);
|
$notValidUDFsArray[] = array($val);
|
||||||
}
|
}
|
||||||
@@ -327,7 +328,7 @@ class UDFLib
|
|||||||
// of the UDF that are not updated
|
// of the UDF that are not updated
|
||||||
if (is_array($udfValues) && count($udfValues) > 0)
|
if (is_array($udfValues) && count($udfValues) > 0)
|
||||||
{
|
{
|
||||||
foreach($udfValues as $fieldName => $fieldValue)
|
foreach ($udfValues as $fieldName => $fieldValue)
|
||||||
{
|
{
|
||||||
// If this field is not present in the given parameters
|
// If this field is not present in the given parameters
|
||||||
// then copy it from the DB without changes
|
// then copy it from the DB without changes
|
||||||
@@ -354,7 +355,7 @@ class UDFLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* isUDFColumn
|
||||||
*/
|
*/
|
||||||
public function isUDFColumn($columnName, $columnType)
|
public function isUDFColumn($columnName, $columnType)
|
||||||
{
|
{
|
||||||
@@ -377,7 +378,7 @@ class UDFLib
|
|||||||
*/
|
*/
|
||||||
private function _popUDFParameters(&$data)
|
private function _popUDFParameters(&$data)
|
||||||
{
|
{
|
||||||
foreach($data as $key => $val)
|
foreach ($data as $key => $val)
|
||||||
{
|
{
|
||||||
if (substr($key, 0, 4) == UDFLib::COLUMN_PREFIX)
|
if (substr($key, 0, 4) == UDFLib::COLUMN_PREFIX)
|
||||||
{
|
{
|
||||||
@@ -402,7 +403,7 @@ class UDFLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loops through all the supplied UDFs values
|
// Loops through all the supplied UDFs values
|
||||||
foreach($tmpUdfValues as $udfValIndx => $udfVal)
|
foreach ($tmpUdfValues as $udfValIndx => $udfVal)
|
||||||
{
|
{
|
||||||
// If the single UDF value is not an array or an object
|
// If the single UDF value is not an array or an object
|
||||||
if (!is_array($udfVal) && !is_object($udfVal))
|
if (!is_array($udfVal) && !is_object($udfVal))
|
||||||
@@ -456,7 +457,7 @@ class UDFLib
|
|||||||
if (isset($decodedUDFValidation->{UDFLib::REGEX})
|
if (isset($decodedUDFValidation->{UDFLib::REGEX})
|
||||||
&& is_array($decodedUDFValidation->{UDFLib::REGEX}))
|
&& is_array($decodedUDFValidation->{UDFLib::REGEX}))
|
||||||
{
|
{
|
||||||
foreach($decodedUDFValidation->{UDFLib::REGEX} as $regexIndx => $regex)
|
foreach ($decodedUDFValidation->{UDFLib::REGEX} as $regexIndx => $regex)
|
||||||
{
|
{
|
||||||
if ($regex->language == UDFLib::BE_REGEX_LANGUAGE)
|
if ($regex->language == UDFLib::BE_REGEX_LANGUAGE)
|
||||||
{
|
{
|
||||||
@@ -499,9 +500,7 @@ class UDFLib
|
|||||||
*/
|
*/
|
||||||
private function _sortJsonSchemas(&$jsonSchemasArray)
|
private function _sortJsonSchemas(&$jsonSchemasArray)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
usort($jsonSchemasArray, function ($a, $b) {
|
usort($jsonSchemasArray, function ($a, $b) {
|
||||||
//
|
|
||||||
if (!isset($a->{UDFLib::SORT}))
|
if (!isset($a->{UDFLib::SORT}))
|
||||||
{
|
{
|
||||||
$a->{UDFLib::SORT} = 9999;
|
$a->{UDFLib::SORT} = 9999;
|
||||||
@@ -510,7 +509,6 @@ class UDFLib
|
|||||||
{
|
{
|
||||||
$b->{UDFLib::SORT} = 9999;
|
$b->{UDFLib::SORT} = 9999;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($a->{UDFLib::SORT} == $b->{UDFLib::SORT})
|
if ($a->{UDFLib::SORT} == $b->{UDFLib::SORT})
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@@ -541,7 +539,7 @@ class UDFLib
|
|||||||
{
|
{
|
||||||
show_error($udfResults->retval);
|
show_error($udfResults->retval);
|
||||||
}
|
}
|
||||||
else if (is_string($udfResults))
|
elseif (is_string($udfResults))
|
||||||
{
|
{
|
||||||
show_error($udfResults);
|
show_error($udfResults);
|
||||||
}
|
}
|
||||||
@@ -550,7 +548,7 @@ class UDFLib
|
|||||||
show_error('UDFWidget: generic error occurred');
|
show_error('UDFWidget: generic error occurred');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!hasData($udfResults))
|
elseif (!hasData($udfResults))
|
||||||
{
|
{
|
||||||
show_error(sprintf('%s.%s does not contain UDF', $schema, $table));
|
show_error(sprintf('%s.%s does not contain UDF', $schema, $table));
|
||||||
}
|
}
|
||||||
@@ -569,27 +567,27 @@ class UDFLib
|
|||||||
$this->_renderCheckbox($jsonSchema, $widgetData);
|
$this->_renderCheckbox($jsonSchema, $widgetData);
|
||||||
}
|
}
|
||||||
// Textfield
|
// Textfield
|
||||||
else if ($jsonSchema->{UDFLib::TYPE} == 'textfield')
|
elseif ($jsonSchema->{UDFLib::TYPE} == 'textfield')
|
||||||
{
|
{
|
||||||
$this->_renderTextfield($jsonSchema, $widgetData);
|
$this->_renderTextfield($jsonSchema, $widgetData);
|
||||||
}
|
}
|
||||||
// Textarea
|
// Textarea
|
||||||
else if ($jsonSchema->{UDFLib::TYPE} == 'textarea')
|
elseif ($jsonSchema->{UDFLib::TYPE} == 'textarea')
|
||||||
{
|
{
|
||||||
$this->_renderTextarea($jsonSchema, $widgetData);
|
$this->_renderTextarea($jsonSchema, $widgetData);
|
||||||
}
|
}
|
||||||
// Date
|
// Date
|
||||||
else if ($jsonSchema->{UDFLib::TYPE} == 'date')
|
elseif ($jsonSchema->{UDFLib::TYPE} == 'date')
|
||||||
{
|
{
|
||||||
|
// To be done
|
||||||
}
|
}
|
||||||
// Dropdown
|
// Dropdown
|
||||||
else if ($jsonSchema->{UDFLib::TYPE} == 'dropdown')
|
elseif ($jsonSchema->{UDFLib::TYPE} == 'dropdown')
|
||||||
{
|
{
|
||||||
$this->_renderDropdown($jsonSchema, $widgetData);
|
$this->_renderDropdown($jsonSchema, $widgetData);
|
||||||
}
|
}
|
||||||
// Multiple dropdown
|
// Multiple dropdown
|
||||||
else if ($jsonSchema->{UDFLib::TYPE} == 'multipledropdown')
|
elseif ($jsonSchema->{UDFLib::TYPE} == 'multipledropdown')
|
||||||
{
|
{
|
||||||
$this->_renderDropdown($jsonSchema, $widgetData, true);
|
$this->_renderDropdown($jsonSchema, $widgetData, true);
|
||||||
}
|
}
|
||||||
@@ -620,12 +618,12 @@ class UDFLib
|
|||||||
$parameters = $jsonSchema->{UDFLib::LIST_VALUES}->enum;
|
$parameters = $jsonSchema->{UDFLib::LIST_VALUES}->enum;
|
||||||
}
|
}
|
||||||
// If the list of values to show should be retrived with a SQL statement
|
// If the list of values to show should be retrived with a SQL statement
|
||||||
else if (isset($jsonSchema->{UDFLib::LIST_VALUES}->sql))
|
elseif (isset($jsonSchema->{UDFLib::LIST_VALUES}->sql))
|
||||||
{
|
{
|
||||||
// UDFModel is loaded in method _loadUDF that is called before the current method
|
// UDFModel is loaded in method _loadUDF that is called before the current method
|
||||||
$queryResult = $this->_ci->UDFModel->execQuery($jsonSchema->{UDFLib::LIST_VALUES}->sql);
|
$queryResult = $this->_ci->UDFModel->execQuery($jsonSchema->{UDFLib::LIST_VALUES}->sql);
|
||||||
if (hasData($queryResult))
|
if (hasData($queryResult))
|
||||||
{
|
{
|
||||||
$parameters = $queryResult->retval;
|
$parameters = $queryResult->retval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -796,7 +794,7 @@ class UDFLib
|
|||||||
if (isset($jsonSchemaValidation->{UDFLib::REGEX})
|
if (isset($jsonSchemaValidation->{UDFLib::REGEX})
|
||||||
&& is_array($jsonSchemaValidation->{UDFLib::REGEX}))
|
&& is_array($jsonSchemaValidation->{UDFLib::REGEX}))
|
||||||
{
|
{
|
||||||
foreach($jsonSchemaValidation->{UDFLib::REGEX} as $regex)
|
foreach ($jsonSchemaValidation->{UDFLib::REGEX} as $regex)
|
||||||
{
|
{
|
||||||
if ($regex->language === UDFLib::FE_REGEX_LANGUAGE)
|
if ($regex->language === UDFLib::FE_REGEX_LANGUAGE)
|
||||||
{
|
{
|
||||||
@@ -836,4 +834,4 @@ class UDFLib
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
/**
|
|
||||||
* Name: Messaging Library for FH-Complete
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
class VorlageLib
|
class VorlageLib
|
||||||
{
|
{
|
||||||
private $recipients = array();
|
private $recipients = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads parser library and OrganisationseinheitLib library
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
require_once APPPATH.'config/message.php';
|
require_once APPPATH.'config/message.php';
|
||||||
@@ -32,10 +30,10 @@ class VorlageLib
|
|||||||
/**
|
/**
|
||||||
* getVorlage() - will load a spezific Template
|
* getVorlage() - will load a spezific Template
|
||||||
*
|
*
|
||||||
* @param integer $vorlage_kurzbz REQUIRED
|
* @param int $vorlage_kurzbz REQUIRED
|
||||||
* @return struct
|
* @return struct
|
||||||
*/
|
*/
|
||||||
function getVorlage($vorlage_kurzbz)
|
public function getVorlage($vorlage_kurzbz)
|
||||||
{
|
{
|
||||||
if (empty($vorlage_kurzbz))
|
if (empty($vorlage_kurzbz))
|
||||||
return error(MSG_ERR_INVALID_MSG_ID);
|
return error(MSG_ERR_INVALID_MSG_ID);
|
||||||
@@ -47,23 +45,22 @@ class VorlageLib
|
|||||||
/**
|
/**
|
||||||
* getSubMessages() - will return all Messages subordinated from a specified message.
|
* getSubMessages() - will return all Messages subordinated from a specified message.
|
||||||
*
|
*
|
||||||
* @param integer $msg_id REQUIRED
|
* @param int $msg_id REQUIRED
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getVorlageByMimetype($mimetype = null)
|
public function getVorlageByMimetype($mimetype = null)
|
||||||
{
|
{
|
||||||
$vorlage = $this->ci->VorlageModel->loadWhere(array('mimetype' => $mimetype));
|
$vorlage = $this->ci->VorlageModel->loadWhere(array('mimetype' => $mimetype));
|
||||||
return $vorlage;
|
return $vorlage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* saveVorlage() - will save a spezific Template.
|
* saveVorlage() - will save a spezific Template.
|
||||||
*
|
*
|
||||||
* @param array $data REQUIRED
|
* @param array $data REQUIRED
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function saveVorlage($vorlage_kurzbz, $data)
|
public function saveVorlage($vorlage_kurzbz, $data)
|
||||||
{
|
{
|
||||||
if (empty($data))
|
if (empty($data))
|
||||||
return error(MSG_ERR_INVALID_MSG_ID);
|
return error(MSG_ERR_INVALID_MSG_ID);
|
||||||
@@ -72,19 +69,18 @@ class VorlageLib
|
|||||||
return $vorlage;
|
return $vorlage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template.
|
* getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template.
|
||||||
*
|
*
|
||||||
* @param string $vorlage_kurzbz REQUIRED
|
* @param string $vorlage_kurzbz REQUIRED
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getVorlagetextByVorlage($vorlage_kurzbz)
|
public function getVorlagetextByVorlage($vorlage_kurzbz)
|
||||||
{
|
{
|
||||||
if (empty($vorlage_kurzbz))
|
if (empty($vorlage_kurzbz))
|
||||||
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
||||||
|
|
||||||
$vorlage = $this->ci->VorlageStudiengangModel->loadWhere(array('vorlage_kurzbz' =>$vorlage_kurzbz));
|
$vorlage = $this->ci->VorlageStudiengangModel->loadWhere(array('vorlage_kurzbz' => $vorlage_kurzbz));
|
||||||
return $vorlage;
|
return $vorlage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +93,7 @@ class VorlageLib
|
|||||||
* @param string $sprache OPTIONAL
|
* @param string $sprache OPTIONAL
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function loadVorlagetext($vorlage_kurzbz, $oe_kurzbz = null, $orgform_kurzbz = null, $sprache = null)
|
public function loadVorlagetext($vorlage_kurzbz, $oe_kurzbz = null, $orgform_kurzbz = null, $sprache = null)
|
||||||
{
|
{
|
||||||
if (empty($vorlage_kurzbz))
|
if (empty($vorlage_kurzbz))
|
||||||
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
||||||
@@ -126,40 +122,35 @@ class VorlageLib
|
|||||||
$where = $this->_where($vorlage_kurzbz, $orgform_kurzbz, $sprache);
|
$where = $this->_where($vorlage_kurzbz, $orgform_kurzbz, $sprache);
|
||||||
|
|
||||||
$vorlage = $this->ci->organisationseinheitlib->treeSearch(
|
$vorlage = $this->ci->organisationseinheitlib->treeSearch(
|
||||||
'public',
|
'public',
|
||||||
'tbl_vorlagestudiengang',
|
'tbl_vorlagestudiengang',
|
||||||
array("vorlage_kurzbz", "studiengang_kz", "version", "text", "oe_kurzbz",
|
array("vorlage_kurzbz", "studiengang_kz", "version", "text", "oe_kurzbz",
|
||||||
"vorlagestudiengang_id", "style", "berechtigung", "anmerkung_vorlagestudiengang",
|
"vorlagestudiengang_id", "style", "berechtigung", "anmerkung_vorlagestudiengang",
|
||||||
"aktiv", "sprache", "subject", "orgform_kurzbz"),
|
"aktiv", "sprache", "subject", "orgform_kurzbz"),
|
||||||
$where,
|
$where,
|
||||||
"version DESC",
|
"version DESC",
|
||||||
$oe_kurzbz
|
$oe_kurzbz
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $vorlage;
|
return $vorlage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* _where
|
||||||
|
*/
|
||||||
private function _where($vorlage_kurzbz, $orgform_kurzbz, $sprache)
|
private function _where($vorlage_kurzbz, $orgform_kurzbz, $sprache)
|
||||||
{
|
{
|
||||||
// Builds where clause
|
// Builds where clause
|
||||||
$where = "vorlage_kurzbz = ".$this->ci->VorlageModel->escape($vorlage_kurzbz);
|
$where = "vorlage_kurzbz = ".$this->ci->VorlageModel->escape($vorlage_kurzbz);
|
||||||
// if (is_null($orgform_kurzbz))
|
|
||||||
// {
|
|
||||||
// $where .= " AND orgform_kurzbz IS NULL";
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// $where .= " AND orgform_kurzbz = " . $this->ci->VorlageModel->escape($orgform_kurzbz);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (is_null($sprache))
|
if (is_null($sprache))
|
||||||
{
|
{
|
||||||
$where .= " AND sprache IS NULL";
|
$where .= " AND sprache IS NULL";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$where .= " AND sprache = " . $this->ci->VorlageModel->escape($sprache);
|
$where .= " AND sprache = ".$this->ci->VorlageModel->escape($sprache);
|
||||||
}
|
}
|
||||||
|
|
||||||
$where .= " AND aktiv = true";
|
$where .= " AND aktiv = true";
|
||||||
@@ -173,7 +164,7 @@ class VorlageLib
|
|||||||
* @param string $vorlage_kurzbz REQUIRED
|
* @param string $vorlage_kurzbz REQUIRED
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function insertVorlagetext($data)
|
public function insertVorlagetext($data)
|
||||||
{
|
{
|
||||||
$vorlagetext = $this->ci->VorlageStudiengangModel->insert($data);
|
$vorlagetext = $this->ci->VorlageStudiengangModel->insert($data);
|
||||||
return $vorlagetext;
|
return $vorlagetext;
|
||||||
@@ -185,7 +176,7 @@ class VorlageLib
|
|||||||
* @param string $vorlage_kurzbz REQUIRED
|
* @param string $vorlage_kurzbz REQUIRED
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getVorlagetextById($vorlagestudiengang_id)
|
public function getVorlagetextById($vorlagestudiengang_id)
|
||||||
{
|
{
|
||||||
$vorlagetext = $this->ci->VorlageStudiengangModel->load($vorlagestudiengang_id);
|
$vorlagetext = $this->ci->VorlageStudiengangModel->load($vorlagestudiengang_id);
|
||||||
return $vorlagetext;
|
return $vorlagetext;
|
||||||
@@ -197,7 +188,7 @@ class VorlageLib
|
|||||||
* @param string $vorlage_kurzbz REQUIRED
|
* @param string $vorlage_kurzbz REQUIRED
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function updateVorlagetext($vorlagestudiengang_id, $data)
|
public function updateVorlagetext($vorlagestudiengang_id, $data)
|
||||||
{
|
{
|
||||||
$vorlagetext = $this->ci->VorlageStudiengangModel->update($vorlagestudiengang_id, $data);
|
$vorlagetext = $this->ci->VorlageStudiengangModel->update($vorlagestudiengang_id, $data);
|
||||||
return $vorlagetext;
|
return $vorlagetext;
|
||||||
@@ -210,11 +201,11 @@ class VorlageLib
|
|||||||
* @param array $data REQUIRED
|
* @param array $data REQUIRED
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function parseVorlagetext($text, $data = array())
|
public function parseVorlagetext($text, $data = array())
|
||||||
{
|
{
|
||||||
if (empty($text))
|
if (empty($text))
|
||||||
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
||||||
$text = $this->ci->parser->parse_string($text, $data, TRUE);
|
$text = $this->ci->parser->parse_string($text, $data, true);
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,11 +12,13 @@ class Orgform_model extends DB_Model
|
|||||||
$this->pk = 'orgform_kurzbz';
|
$this->pk = 'orgform_kurzbz';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all the orgform except VBB and ZGS
|
||||||
|
*/
|
||||||
public function getOrgformLV()
|
public function getOrgformLV()
|
||||||
{
|
{
|
||||||
// Checks rights
|
// Checks rights
|
||||||
if (($isEntitled = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $isEntitled;
|
|
||||||
|
|
||||||
$query = "SELECT *
|
$query = "SELECT *
|
||||||
FROM bis.tbl_orgform
|
FROM bis.tbl_orgform
|
||||||
@@ -25,4 +27,4 @@ class Orgform_model extends DB_Model
|
|||||||
|
|
||||||
return $this->execQuery($query);
|
return $this->execQuery($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,19 +13,12 @@ class Akte_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* getAkten
|
||||||
*/
|
*/
|
||||||
public function getAkten($person_id, $dokument_kurzbz = null, $stg_kz = null, $prestudent_id = null)
|
public function getAkten($person_id, $dokument_kurzbz = null, $stg_kz = null, $prestudent_id = null)
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $isEntitled;
|
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_dokument', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
|
||||||
return $isEntitled;
|
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_dokumentstudiengang', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
|
||||||
return $isEntitled;
|
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_dokumentprestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
|
||||||
return $isEntitled;
|
|
||||||
|
|
||||||
$query = 'SELECT akte_id,
|
$query = 'SELECT akte_id,
|
||||||
person_id,
|
person_id,
|
||||||
@@ -79,17 +72,12 @@ class Akte_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* getAktenAccepted
|
||||||
*/
|
*/
|
||||||
public function getAktenAccepted($person_id, $dokument_kurzbz = null)
|
public function getAktenAccepted($person_id, $dokument_kurzbz = null)
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $isEntitled;
|
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
|
||||||
return $isEntitled;
|
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_dokumentprestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
|
||||||
return $isEntitled;
|
|
||||||
|
|
||||||
$query = 'SELECT a.akte_id,
|
$query = 'SELECT a.akte_id,
|
||||||
a.person_id,
|
a.person_id,
|
||||||
@@ -130,21 +118,13 @@ class Akte_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* getAktenAcceptedDms
|
||||||
*/
|
*/
|
||||||
public function getAktenAcceptedDms($person_id, $dokument_kurzbz = null)
|
public function getAktenAcceptedDms($person_id, $dokument_kurzbz = null)
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $isEntitled;
|
if (isError($ent = $this->isEntitled('campus.tbl_dms', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
|
||||||
return $isEntitled;
|
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_dokumentprestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
|
||||||
return $isEntitled;
|
|
||||||
if (($isEntitled = $this->isEntitled('campus.tbl_dms', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
|
||||||
return $isEntitled;
|
|
||||||
if (($isEntitled = $this->isEntitled('campus.tbl_dms_version', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
|
||||||
return $isEntitled;
|
|
||||||
|
|
||||||
$query = 'SELECT a.akte_id,
|
$query = 'SELECT a.akte_id,
|
||||||
a.person_id,
|
a.person_id,
|
||||||
@@ -193,4 +173,4 @@ class Akte_model extends DB_Model
|
|||||||
|
|
||||||
return $this->execQuery($query, $parametersArray);
|
return $this->execQuery($query, $parametersArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,13 @@ class Dokumentprestudent_model extends DB_Model
|
|||||||
$this->pk = array('prestudent_id', 'dokument_kurzbz');
|
$this->pk = array('prestudent_id', 'dokument_kurzbz');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* setAccepted
|
||||||
|
*/
|
||||||
public function setAccepted($prestudent_id, $studiengang_kz)
|
public function setAccepted($prestudent_id, $studiengang_kz)
|
||||||
{
|
{
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_dokumentprestudent', PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_dokumentprestudent', PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
|
|
||||||
$result = null;
|
$result = null;
|
||||||
|
|
||||||
@@ -41,10 +44,13 @@ class Dokumentprestudent_model extends DB_Model
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* setAcceptedDocuments
|
||||||
|
*/
|
||||||
public function setAcceptedDocuments($prestudent_id, $dokument_kurzbz)
|
public function setAcceptedDocuments($prestudent_id, $dokument_kurzbz)
|
||||||
{
|
{
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_dokumentprestudent', PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_dokumentprestudent', PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
|
|
||||||
$result = null;
|
$result = null;
|
||||||
|
|
||||||
@@ -68,4 +74,4 @@ class Dokumentprestudent_model extends DB_Model
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,11 +12,13 @@ class Dokumentstudiengang_model extends DB_Model
|
|||||||
$this->pk = array('studiengang_kz', 'dokument_kurzbz');
|
$this->pk = array('studiengang_kz', 'dokument_kurzbz');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getDokumentstudiengangByStudiengang_kz
|
||||||
|
*/
|
||||||
public function getDokumentstudiengangByStudiengang_kz($studiengang_kz, $onlinebewerbung = null, $pflicht = null, $nachreichbar = null)
|
public function getDokumentstudiengangByStudiengang_kz($studiengang_kz, $onlinebewerbung = null, $pflicht = null, $nachreichbar = null)
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_dokument', 's', FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_dokument', 's', FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $isEntitled;
|
|
||||||
|
|
||||||
$this->addJoin('public.tbl_dokument', 'dokument_kurzbz');
|
$this->addJoin('public.tbl_dokument', 'dokument_kurzbz');
|
||||||
|
|
||||||
@@ -39,4 +41,4 @@ class Dokumentstudiengang_model extends DB_Model
|
|||||||
|
|
||||||
return $this->loadWhere($parameterArray);
|
return $this->loadWhere($parameterArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,17 +13,15 @@ class Prestudent_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* getLastStatuses
|
||||||
*/
|
*/
|
||||||
public function getLastStatuses($person_id, $studiensemester_kurzbz = null, $studiengang_kz = null, $status_kurzbz = null)
|
public function getLastStatuses($person_id, $studiensemester_kurzbz = null, $studiengang_kz = null, $status_kurzbz = null)
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $isEntitled;
|
if (isError($ent = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
|
||||||
return $isEntitled;
|
|
||||||
|
|
||||||
$query = 'SELECT *
|
$query = 'SELECT *
|
||||||
FROM public.tbl_prestudent p
|
FROM public.tbl_prestudent p
|
||||||
@@ -60,7 +58,7 @@ class Prestudent_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* updateAufnahmegruppe
|
||||||
*/
|
*/
|
||||||
public function updateAufnahmegruppe($prestudentIdArray, $aufnahmegruppe)
|
public function updateAufnahmegruppe($prestudentIdArray, $aufnahmegruppe)
|
||||||
{
|
{
|
||||||
@@ -85,8 +83,12 @@ class Prestudent_model extends DB_Model
|
|||||||
* - stufe and aufnahmegruppe
|
* - stufe and aufnahmegruppe
|
||||||
* - reihungstest score
|
* - reihungstest score
|
||||||
*/
|
*/
|
||||||
public function getPrestudentMultiAssign($studiengang = null, $studiensemester = null, $gruppe = null, $reihungstest = null, $stufe = null)
|
public function getPrestudentMultiAssign(
|
||||||
|
$studiengang = null, $studiensemester = null, $gruppe = null, $reihungstest = null, $stufe = null
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
|
|
||||||
$this->addSelect(
|
$this->addSelect(
|
||||||
'p.person_id,
|
'p.person_id,
|
||||||
prestudent_id,
|
prestudent_id,
|
||||||
|
|||||||
@@ -14,17 +14,15 @@ class Prestudentstatus_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* getLastStatus
|
||||||
*/
|
*/
|
||||||
public function getLastStatus($prestudent_id, $studiensemester_kurzbz = '', $status_kurzbz = '')
|
public function getLastStatus($prestudent_id, $studiensemester_kurzbz = '', $status_kurzbz = '')
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $isEntitled;
|
if (isError($ent = $this->isEntitled('lehre.tbl_studienplan', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('lehre.tbl_studienplan', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
|
||||||
return $isEntitled;
|
|
||||||
|
|
||||||
$query = 'SELECT tbl_prestudentstatus.*,
|
$query = 'SELECT tbl_prestudentstatus.*,
|
||||||
bezeichnung AS studienplan_bezeichnung,
|
bezeichnung AS studienplan_bezeichnung,
|
||||||
@@ -53,10 +51,12 @@ class Prestudentstatus_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* updateStufe
|
||||||
*/
|
*/
|
||||||
public function updateStufe($prestudentIdArray, $stufe)
|
public function updateStufe($prestudentIdArray, $stufe)
|
||||||
{
|
{
|
||||||
|
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
|
|
||||||
return $this->execQuery(
|
return $this->execQuery(
|
||||||
'UPDATE public.tbl_prestudentstatus
|
'UPDATE public.tbl_prestudentstatus
|
||||||
SET rt_stufe = ?
|
SET rt_stufe = ?
|
||||||
@@ -82,8 +82,8 @@ class Prestudentstatus_model extends DB_Model
|
|||||||
public function getStatusByFilter($prestudent_id, $status_kurzbz = '', $ausbildungssemester = '', $studiensemester_kurzbz = '')
|
public function getStatusByFilter($prestudent_id, $status_kurzbz = '', $ausbildungssemester = '', $studiensemester_kurzbz = '')
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
|
|
||||||
$query = '
|
$query = '
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -13,15 +13,14 @@ class Studiengang_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* getAllForBewerbung
|
||||||
*/
|
*/
|
||||||
public function getAllForBewerbung()
|
public function getAllForBewerbung()
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled('lehre.vw_studienplan', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $isEntitled;
|
if (isError($ent = $this->isEntitled('bis.tbl_lgartcode', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('bis.tbl_lgartcode', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('lehre.vw_studienplan', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $isEntitled;
|
|
||||||
|
|
||||||
$allForBewerbungQuery = 'SELECT DISTINCT studiengang_kz,
|
$allForBewerbungQuery = 'SELECT DISTINCT studiengang_kz,
|
||||||
typ,
|
typ,
|
||||||
@@ -100,10 +99,12 @@ class Studiengang_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* getStudienplan
|
||||||
*/
|
*/
|
||||||
public function getStudienplan($studiensemester_kurzbz, $ausbildungssemester, $aktiv, $onlinebewerbung)
|
public function getStudienplan($studiensemester_kurzbz, $ausbildungssemester, $aktiv, $onlinebewerbung)
|
||||||
{
|
{
|
||||||
|
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
|
|
||||||
// Join table public.tbl_studiengang with table lehre.tbl_studienordnung on column studiengang_kz
|
// Join table public.tbl_studiengang with table lehre.tbl_studienordnung on column studiengang_kz
|
||||||
$this->addJoin('lehre.tbl_studienordnung', 'studiengang_kz');
|
$this->addJoin('lehre.tbl_studienordnung', 'studiengang_kz');
|
||||||
// Then join with table lehre.tbl_studienplan on column studienordnung_id
|
// Then join with table lehre.tbl_studienplan on column studienordnung_id
|
||||||
@@ -135,10 +136,12 @@ class Studiengang_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* getStudiengangBewerbung
|
||||||
*/
|
*/
|
||||||
public function getStudiengangBewerbung()
|
public function getStudiengangBewerbung()
|
||||||
{
|
{
|
||||||
|
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
|
|
||||||
// Join table public.tbl_studiengang with table lehre.tbl_studienordnung on column studiengang_kz
|
// Join table public.tbl_studiengang with table lehre.tbl_studienordnung on column studiengang_kz
|
||||||
$this->addJoin('lehre.tbl_studienordnung', 'studiengang_kz');
|
$this->addJoin('lehre.tbl_studienordnung', 'studiengang_kz');
|
||||||
// Join table lehre.tbl_studienordnung with table lehre.tbl_akadgrad on column akadgrad_id
|
// Join table lehre.tbl_studienordnung with table lehre.tbl_akadgrad on column akadgrad_id
|
||||||
@@ -150,7 +153,8 @@ class Studiengang_model extends DB_Model
|
|||||||
// Then join with table lehre.tbl_bewerbungsfrist on column studiensemester_kurzbz
|
// Then join with table lehre.tbl_bewerbungsfrist on column studiensemester_kurzbz
|
||||||
$this->addJoin(
|
$this->addJoin(
|
||||||
'public.tbl_bewerbungstermine',
|
'public.tbl_bewerbungstermine',
|
||||||
'tbl_bewerbungstermine.studiensemester_kurzbz = ss.studiensemester_kurzbz AND tbl_bewerbungstermine.studienplan_id = ss.studienplan_id',
|
'tbl_bewerbungstermine.studiensemester_kurzbz = ss.studiensemester_kurzbz
|
||||||
|
AND tbl_bewerbungstermine.studienplan_id = ss.studienplan_id',
|
||||||
'LEFT'
|
'LEFT'
|
||||||
);
|
);
|
||||||
// Ordering by studiengang_kz and studienplan_id
|
// Ordering by studiengang_kz and studienplan_id
|
||||||
@@ -166,7 +170,9 @@ class Studiengang_model extends DB_Model
|
|||||||
'public.tbl_studiengang.aktiv = TRUE
|
'public.tbl_studiengang.aktiv = TRUE
|
||||||
AND public.tbl_studiengang.onlinebewerbung = TRUE
|
AND public.tbl_studiengang.onlinebewerbung = TRUE
|
||||||
AND ((tbl_bewerbungstermine.beginn <= NOW() AND tbl_bewerbungstermine.ende >= NOW()) OR tbl_bewerbungstermine.beginn IS NULL)
|
AND ((tbl_bewerbungstermine.beginn <= NOW() AND tbl_bewerbungstermine.ende >= NOW()) OR tbl_bewerbungstermine.beginn IS NULL)
|
||||||
AND ss.studiensemester_kurzbz IN (SELECT DISTINCT studiensemester_kurzbz FROM public.tbl_bewerbungstermine WHERE beginn <= NOW() AND ende >= NOW())
|
AND ss.studiensemester_kurzbz IN (
|
||||||
|
SELECT DISTINCT studiensemester_kurzbz FROM public.tbl_bewerbungstermine WHERE beginn <= NOW() AND ende >= NOW()
|
||||||
|
)
|
||||||
AND ss.semester = 1
|
AND ss.semester = 1
|
||||||
AND lehre.tbl_studienplan.aktiv = TRUE'
|
AND lehre.tbl_studienplan.aktiv = TRUE'
|
||||||
,
|
,
|
||||||
@@ -180,10 +186,12 @@ class Studiengang_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* getAppliedStudiengang
|
||||||
*/
|
*/
|
||||||
public function getAppliedStudiengang($person_id, $studiensemester_kurzbz, $titel)
|
public function getAppliedStudiengang($person_id, $studiensemester_kurzbz, $titel)
|
||||||
{
|
{
|
||||||
|
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
|
|
||||||
// Then join with table public.tbl_prestudent
|
// Then join with table public.tbl_prestudent
|
||||||
$this->addJoin('public.tbl_prestudent', 'studiengang_kz');
|
$this->addJoin('public.tbl_prestudent', 'studiengang_kz');
|
||||||
// Join table public.tbl_prestudentstatus
|
// Join table public.tbl_prestudentstatus
|
||||||
@@ -227,10 +235,12 @@ class Studiengang_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* getAppliedStudiengangFromNow
|
||||||
*/
|
*/
|
||||||
public function getAppliedStudiengangFromNow($person_id, $titel)
|
public function getAppliedStudiengangFromNow($person_id, $titel)
|
||||||
{
|
{
|
||||||
|
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
|
|
||||||
// Then join with table public.tbl_prestudent
|
// Then join with table public.tbl_prestudent
|
||||||
$this->addJoin('public.tbl_prestudent', 'studiengang_kz');
|
$this->addJoin('public.tbl_prestudent', 'studiengang_kz');
|
||||||
// Join table public.tbl_prestudentstatus
|
// Join table public.tbl_prestudentstatus
|
||||||
@@ -278,20 +288,20 @@ class Studiengang_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* getAvailableReihungstestByPersonId
|
||||||
*/
|
*/
|
||||||
public function getAvailableReihungstestByPersonId($person_id)
|
public function getAvailableReihungstestByPersonId($person_id)
|
||||||
{
|
{
|
||||||
if (($isEntitled = $this->isEntitled('lehre.tbl_studienordnung', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('lehre.tbl_studienplan', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('lehre.tbl_studienplan', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_reihungstest', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_reihungstest', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('lehre.tbl_studienordnung', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
|
|
||||||
$this->addJoin('lehre.tbl_studienordnung', 'studiengang_kz');
|
$this->addJoin('lehre.tbl_studienordnung', 'studiengang_kz');
|
||||||
|
|
||||||
@@ -334,4 +344,4 @@ class Studiengang_model extends DB_Model
|
|||||||
array('reihungstest')
|
array('reihungstest')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,11 +13,13 @@ class Studiensemester_model extends DB_Model
|
|||||||
$this->hasSequence = false;
|
$this->hasSequence = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getLastOrAktSemester
|
||||||
|
*/
|
||||||
public function getLastOrAktSemester($days = 60)
|
public function getLastOrAktSemester($days = 60)
|
||||||
{
|
{
|
||||||
// Checks rights
|
// Checks rights
|
||||||
if (($isEntitled = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $isEntitled;
|
|
||||||
|
|
||||||
if (!is_numeric($days))
|
if (!is_numeric($days))
|
||||||
{
|
{
|
||||||
@@ -33,11 +35,13 @@ class Studiensemester_model extends DB_Model
|
|||||||
return $this->execQuery($query);
|
return $this->execQuery($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getNextFrom
|
||||||
|
*/
|
||||||
public function getNextFrom($studiensemester_kurzbz)
|
public function getNextFrom($studiensemester_kurzbz)
|
||||||
{
|
{
|
||||||
// Checks rights
|
// Checks rights
|
||||||
if (($isEntitled = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $isEntitled;
|
|
||||||
|
|
||||||
$query = 'SELECT studiensemester_kurzbz,
|
$query = 'SELECT studiensemester_kurzbz,
|
||||||
start,
|
start,
|
||||||
@@ -55,13 +59,13 @@ class Studiensemester_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* getNearest
|
||||||
*/
|
*/
|
||||||
public function getNearest($semester = '')
|
public function getNearest($semester = '')
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled('public.vw_studiensemester', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.vw_studiensemester', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
|
|
||||||
$query = 'SELECT studiensemester_kurzbz,
|
$query = 'SELECT studiensemester_kurzbz,
|
||||||
start,
|
start,
|
||||||
@@ -86,4 +90,4 @@ class Studiensemester_model extends DB_Model
|
|||||||
|
|
||||||
return $this->execQuery($query);
|
return $this->execQuery($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,28 +12,31 @@ class Person_model extends DB_Model
|
|||||||
$this->pk = 'person_id';
|
$this->pk = 'person_id';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getPersonKontaktByZugangscode
|
||||||
|
*/
|
||||||
public function getPersonKontaktByZugangscode($zugangscode, $email)
|
public function getPersonKontaktByZugangscode($zugangscode, $email)
|
||||||
{
|
{
|
||||||
$this->addJoin('public.tbl_kontakt', 'person_id');
|
$this->addJoin('public.tbl_kontakt', 'person_id');
|
||||||
|
|
||||||
return $this->loadWhere(array('zugangscode' => $zugangscode, 'kontakt' => $email));
|
return $this->loadWhere(array('zugangscode' => $zugangscode, 'kontakt' => $email));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* checkBewerbung
|
||||||
*/
|
*/
|
||||||
public function checkBewerbung($email, $studiensemester_kurzbz = null)
|
public function checkBewerbung($email, $studiensemester_kurzbz = null)
|
||||||
{
|
{
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_kontakt', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_kontakt', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_benutzer', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_benutzer', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
|
|
||||||
$checkBewerbungQuery = '';
|
$checkBewerbungQuery = '';
|
||||||
$parametersArray = array($email, $email, $email);
|
$parametersArray = array($email, $email, $email);
|
||||||
@@ -67,6 +70,9 @@ class Person_model extends DB_Model
|
|||||||
return $this->execQuery($checkBewerbungQuery, $parametersArray);
|
return $this->execQuery($checkBewerbungQuery, $parametersArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* updatePerson
|
||||||
|
*/
|
||||||
public function updatePerson($person)
|
public function updatePerson($person)
|
||||||
{
|
{
|
||||||
if (isset($person['svnr']) && $person['svnr'] != '')
|
if (isset($person['svnr']) && $person['svnr'] != '')
|
||||||
@@ -93,15 +99,15 @@ class Person_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* getPersonFromStatus
|
||||||
*/
|
*/
|
||||||
public function getPersonFromStatus($status_kurzbz, $von, $bis)
|
public function getPersonFromStatus($status_kurzbz, $von, $bis)
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
|
|
||||||
$this->addJoin('public.tbl_prestudent', 'person_id');
|
$this->addJoin('public.tbl_prestudent', 'person_id');
|
||||||
|
|
||||||
@@ -129,5 +135,4 @@ class Person_model extends DB_Model
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ class Message_model extends DB_Model
|
|||||||
public function getMessagesByPerson($person_id, $all)
|
public function getMessagesByPerson($person_id, $all)
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
|
|
||||||
$sql = 'SELECT m.message_id,
|
$sql = 'SELECT m.message_id,
|
||||||
m.person_id,
|
m.person_id,
|
||||||
@@ -68,7 +68,7 @@ class Message_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* getMessageVars
|
||||||
*/
|
*/
|
||||||
public function getMessageVars()
|
public function getMessageVars()
|
||||||
{
|
{
|
||||||
@@ -85,7 +85,7 @@ class Message_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* getMsgVarsDataByPrestudentId
|
||||||
*/
|
*/
|
||||||
public function getMsgVarsDataByPrestudentId($prestudent_id)
|
public function getMsgVarsDataByPrestudentId($prestudent_id)
|
||||||
{
|
{
|
||||||
@@ -93,4 +93,4 @@ class Message_model extends DB_Model
|
|||||||
|
|
||||||
return $this->execQuery(sprintf($query, is_array($prestudent_id) ? 'IN' : '='), array($prestudent_id));
|
return $this->execQuery(sprintf($query, is_array($prestudent_id) ? 'IN' : '='), array($prestudent_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,15 +13,15 @@ class Phrase_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* getPhrases
|
||||||
*/
|
*/
|
||||||
public function getPhrases($app, $sprache, $phrase = null, $orgeinheit_kurzbz = null, $orgform_kurzbz = null)
|
public function getPhrases($app, $sprache, $phrase = null, $orgeinheit_kurzbz = null, $orgform_kurzbz = null)
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled('system.tbl_phrase', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('system.tbl_phrase', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('system.tbl_phrasentext', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('system.tbl_phrasentext', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
|
|
||||||
$parametersArray = array('app' => $app, 'sprache' => $sprache);
|
$parametersArray = array('app' => $app, 'sprache' => $sprache);
|
||||||
|
|
||||||
@@ -60,4 +60,4 @@ class Phrase_model extends DB_Model
|
|||||||
|
|
||||||
return $this->execQuery($query, $parametersArray);
|
return $this->execQuery($query, $parametersArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ class Recipient_model extends DB_Model
|
|||||||
public function getMessage($message_id, $person_id)
|
public function getMessage($message_id, $person_id)
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_kontakt', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_kontakt', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
|
|
||||||
$query = 'SELECT mr.message_id,
|
$query = 'SELECT mr.message_id,
|
||||||
mr.person_id,
|
mr.person_id,
|
||||||
@@ -56,12 +56,12 @@ class Recipient_model extends DB_Model
|
|||||||
public function getMessageByToken($token)
|
public function getMessageByToken($token)
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
|
|
||||||
$sql = 'SELECT r.message_id,
|
$sql = 'SELECT r.message_id,
|
||||||
m.person_id as sender_id,
|
m.person_id as sender_id,
|
||||||
@@ -90,14 +90,14 @@ class Recipient_model extends DB_Model
|
|||||||
public function getMessagesByPerson($person_id, $all)
|
public function getMessagesByPerson($person_id, $all)
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
|
|
||||||
$sql = 'SELECT DISTINCT ON (r.message_id) r.message_id,
|
$sql = 'SELECT DISTINCT ON (r.message_id) r.message_id,
|
||||||
m.person_id,
|
m.person_id,
|
||||||
@@ -152,14 +152,14 @@ class Recipient_model extends DB_Model
|
|||||||
// if same user
|
// if same user
|
||||||
if ($uid === getAuthUID())
|
if ($uid === getAuthUID())
|
||||||
{
|
{
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
}
|
}
|
||||||
// if different user, for reading messages from other users
|
// if different user, for reading messages from other users
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get Data
|
// get Data
|
||||||
@@ -208,12 +208,12 @@ class Recipient_model extends DB_Model
|
|||||||
public function getMessages($kontaktType, $sent, $limit = null, $message_id = null)
|
public function getMessages($kontaktType, $sent, $limit = null, $message_id = null)
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_kontakt', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_kontakt', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
|
|
||||||
$query = 'SELECT mm.message_id,
|
$query = 'SELECT mm.message_id,
|
||||||
ks.kontakt as sender,
|
ks.kontakt as sender,
|
||||||
@@ -266,10 +266,10 @@ class Recipient_model extends DB_Model
|
|||||||
public function getCountUnreadMessages($person_id)
|
public function getCountUnreadMessages($person_id)
|
||||||
{
|
{
|
||||||
// Checks if the operation is permitted by the API caller
|
// Checks if the operation is permitted by the API caller
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
if (($isEntitled = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))
|
||||||
return $isEntitled;
|
return $ent;
|
||||||
|
|
||||||
$sql = 'SELECT COUNT(r.message_id) AS unreadMessages
|
$sql = 'SELECT COUNT(r.message_id) AS unreadMessages
|
||||||
FROM public.tbl_msg_recipient r JOIN public.tbl_msg_status s
|
FROM public.tbl_msg_recipient r JOIN public.tbl_msg_status s
|
||||||
@@ -288,4 +288,4 @@ class Recipient_model extends DB_Model
|
|||||||
|
|
||||||
return $this->execQuery($sql, $parametersArray);
|
return $this->execQuery($sql, $parametersArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,14 +12,16 @@ class Vorlage_model extends DB_Model
|
|||||||
$this->pk = 'vorlage_kurzbz';
|
$this->pk = 'vorlage_kurzbz';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns mume types
|
||||||
|
*/
|
||||||
public function getMimeTypes()
|
public function getMimeTypes()
|
||||||
{
|
{
|
||||||
// Checks rights
|
// Checks rights
|
||||||
if (($isEntitled = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $isEntitled;
|
|
||||||
|
|
||||||
$query = 'SELECT DISTINCT mimetype FROM public.tbl_vorlage ORDER BY mimetype';
|
$query = 'SELECT DISTINCT mimetype FROM public.tbl_vorlage ORDER BY mimetype';
|
||||||
|
|
||||||
return $this->execQuery($query);
|
return $this->execQuery($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,13 +13,12 @@ class Vorlagedokument_model extends DB_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* loadDokumenteFromVorlagestudiengang
|
||||||
*/
|
*/
|
||||||
public function loadDokumenteFromVorlagestudiengang($vorlagestudiengang_id)
|
public function loadDokumenteFromVorlagestudiengang($vorlagestudiengang_id)
|
||||||
{
|
{
|
||||||
// Checks rights
|
// Checks rights
|
||||||
if (($isEntitled = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
|
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
|
||||||
return $isEntitled;
|
|
||||||
|
|
||||||
$qry = 'SELECT vorlagedokument_id,
|
$qry = 'SELECT vorlagedokument_id,
|
||||||
sort,
|
sort,
|
||||||
@@ -33,4 +32,4 @@ class Vorlagedokument_model extends DB_Model
|
|||||||
|
|
||||||
return $this->execQuery($qry, array($vorlagestudiengang_id));
|
return $this->execQuery($qry, array($vorlagestudiengang_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,18 +23,19 @@
|
|||||||
<property name="absoluteLineLimit" value="150"/>
|
<property name="absoluteLineLimit" value="150"/>
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
|
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
|
||||||
|
|
||||||
<rule ref="Squiz.Classes.LowercaseClassKeywords"/>
|
<rule ref="Squiz.Classes.LowercaseClassKeywords"/>
|
||||||
|
|
||||||
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
|
|
||||||
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
|
|
||||||
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
|
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
|
||||||
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
|
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
|
||||||
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
|
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
|
||||||
|
|
||||||
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
|
|
||||||
<rule ref="Generic.Commenting.Todo"/>
|
<rule ref="Generic.Commenting.Todo"/>
|
||||||
|
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
We allow EOL after closing braces
|
We allow EOL after closing braces
|
||||||
@@ -47,20 +48,19 @@
|
|||||||
|
|
||||||
<rule ref="Squiz.Operators.ValidLogicalOperators"/>
|
<rule ref="Squiz.Operators.ValidLogicalOperators"/>
|
||||||
|
|
||||||
<rule ref="Generic.PHP.DeprecatedFunctions"/>
|
|
||||||
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>
|
|
||||||
<rule ref="Squiz.PHP.Eval"/>
|
<rule ref="Squiz.PHP.Eval"/>
|
||||||
<rule ref="Generic.PHP.ForbiddenFunctions"/>
|
|
||||||
<rule ref="Squiz.PHP.NonExecutableCode"/>
|
<rule ref="Squiz.PHP.NonExecutableCode"/>
|
||||||
<rule ref="Generic.PHP.NoSilencedErrors"/>
|
<rule ref="Generic.PHP.NoSilencedErrors"/>
|
||||||
|
<rule ref="Generic.PHP.ForbiddenFunctions"/>
|
||||||
|
<rule ref="Generic.PHP.DeprecatedFunctions"/>
|
||||||
|
|
||||||
<rule ref="Squiz.Scope.MemberVarScope"/>
|
<rule ref="Squiz.Scope.MemberVarScope"/>
|
||||||
<rule ref="Squiz.Scope.StaticThisUsage"/>
|
<rule ref="Squiz.Scope.StaticThisUsage"/>
|
||||||
|
|
||||||
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
|
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
|
||||||
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
|
|
||||||
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
|
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
|
||||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
|
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
|
||||||
|
|
||||||
<!-- Relax some src/* and tests/* rules -->
|
<!-- Relax some src/* and tests/* rules -->
|
||||||
<rule ref="Squiz.Classes.ValidClassName">
|
<rule ref="Squiz.Classes.ValidClassName">
|
||||||
|
|||||||
Reference in New Issue
Block a user