From d8cd786079c650408c602cfe8323c39ecac014f0 Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 22 Aug 2017 16:24:51 +0200 Subject: [PATCH 01/31] - 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) --- application/core/APIv1_Controller.php | 9 +- application/core/DB_Model.php | 334 ++++++++---------- application/core/FHC_Controller.php | 5 +- application/core/FHC_Model.php | 22 +- application/core/FS_Model.php | 64 ++-- application/core/VileSci_Controller.php | 5 +- application/libraries/CallerLib.php | 50 ++- application/libraries/DmsLib.php | 26 +- application/libraries/FHC_Auth.php | 19 +- application/libraries/FilesystemLib.php | 46 ++- application/libraries/LogLib.php | 24 +- application/libraries/MailLib.php | 24 +- application/libraries/MessageLib.php | 92 ++--- application/libraries/MigrationLib.php | 111 +++--- .../libraries/OrganisationseinheitLib.php | 17 +- application/libraries/PermissionLib.php | 29 +- application/libraries/PhrasesLib.php | 73 ++-- application/libraries/ReihungstestLib.php | 5 +- application/libraries/UDFLib.php | 54 ++- application/libraries/VorlageLib.php | 71 ++-- application/models/codex/Orgform_model.php | 8 +- application/models/crm/Akte_model.php | 36 +- .../models/crm/Dokumentprestudent_model.php | 16 +- .../models/crm/Dokumentstudiengang_model.php | 8 +- application/models/crm/Prestudent_model.php | 20 +- .../models/crm/Prestudentstatus_model.php | 20 +- .../models/organisation/Studiengang_model.php | 56 +-- .../organisation/Studiensemester_model.php | 20 +- application/models/person/Person_model.php | 41 ++- application/models/system/Message_model.php | 18 +- application/models/system/Phrase_model.php | 12 +- application/models/system/Recipient_model.php | 74 ++-- application/models/system/Vorlage_model.php | 8 +- .../models/system/Vorlagedokument_model.php | 7 +- tests/codesniffer/FHComplete/ruleset.xml | 16 +- 35 files changed, 672 insertions(+), 768 deletions(-) diff --git a/application/core/APIv1_Controller.php b/application/core/APIv1_Controller.php index 76654b559..5303bf02d 100644 --- a/application/core/APIv1_Controller.php +++ b/application/core/APIv1_Controller.php @@ -1,10 +1,13 @@ dbTable)) - return error(FHC_MODEL_ERROR, FHC_NODBTABLE); + // Check class properties + if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE); // 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->hasUDF() && isError($validate = $this->udflib->manageUDFs($data, $this->dbTable))) return $validate; + if (isError($validate = $this->_manageUDFs($data, $this->dbTable))) return $validate; // DB-INSERT if ($this->db->insert($this->dbTable, $data)) @@ -90,32 +89,9 @@ class DB_Model extends FHC_Model } } else + { 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) { - // Check Class-Attributes - if (is_null($this->dbTable)) - return error(FHC_MODEL_ERROR, FHC_NODBTABLE); - if (is_null($this->pk)) - return error(FHC_MODEL_ERROR, FHC_NOPK); + // Check class properties + if (is_null($this->pk)) return error(FHC_MODEL_ERROR, FHC_NOPK); + if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE); // 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->hasUDF() && isError($validate = $this->udflib->manageUDFs($data, $this->dbTable, $this->getUDFs($id)))) - { - return $validate; - } + if (isError($validate = $this->udflib->manageUDFs($data, $this->dbTable, $this->getUDFs($id)))) return $validate; - // DB-UPDATE - // Check for composite Primary Key + $tmpId = $id; + + // Check for composite Primary Key, prepare the where clause if (is_array($id)) { if (isset($id[0])) - $this->db->where($this->arrayMergeIndex($this->pk, $id)); - else - $this->db->where($id); + { + $tmpId = $this->_arrayCombine($this->pk, $id); + } } 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)) + { return success($id); + } else + { return error($this->db->error(), FHC_DB_ERROR); + } } /** @@ -167,30 +149,37 @@ class DB_Model extends FHC_Model */ public function delete($id) { - // Check Class-Attributes - if (is_null($this->dbTable)) - return error(FHC_MODEL_ERROR, FHC_NODBTABLE); - if (is_null($this->pk)) - return error(FHC_MODEL_ERROR, FHC_NOPK); + // Check class properties + 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 - if ($isEntitled = $this->_isEntitled(PermissionLib::DELETE_RIGHT)) return $isEntitled; - - // DB-DELETE + if (isError($ent = $this->_isEntitled(PermissionLib::DELETE_RIGHT))) return $ent; + + $tmpId = $id; + // Check for composite Primary Key if (is_array($id)) { if (isset($id[0])) - $result = $this->db->delete($this->dbTable, $this->arrayMergeIndex($this->pk, $id)); - else - $result = $this->db->delete($this->dbTable, $id); + { + $tmpId = $this->_arrayCombine($this->pk, $id); + } } 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); + } else + { return error($this->db->error(), FHC_DB_ERROR); + } } /** @@ -201,33 +190,37 @@ class DB_Model extends FHC_Model */ public function load($id = null) { - // Check Class-Attributes - if (is_null($this->dbTable)) - return error(FHC_MODEL_ERROR, FHC_NODBTABLE); - if (is_null($this->pk)) - return error(FHC_MODEL_ERROR, FHC_NOPK); + // Check class properties + if (is_null($this->pk)) return error(FHC_MODEL_ERROR, FHC_NOPK); + if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE); // 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 if (is_array($id)) { if (isset($id[0])) - $result = $this->db->get_where($this->dbTable, $this->arrayMergeIndex($this->pk, $id)); - else - $result = $this->db->get_where($this->dbTable, $id); + { + $tmpId = $this->_arrayCombine($this->pk, $id); + } } - elseif (empty($id)) - $result = $this->db->get($this->dbTable); 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)); + } else + { return error($this->db->error(), FHC_DB_ERROR); + } } /** @@ -237,20 +230,21 @@ class DB_Model extends FHC_Model */ public function loadWhere($where = null) { - // Check Class-Attributes - if (is_null($this->dbTable)) - return error(FHC_MODEL_ERROR, FHC_NODBTABLE); + // Check class properties + if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE); // Checks rights - if ($isEntitled = $this->_isEntitled(PermissionLib::SELECT_RIGHT)) return $isEntitled; + if (isError($ent = $this->_isEntitled(PermissionLib::SELECT_RIGHT))) return $ent; // Execute query - $result = $this->db->get_where($this->dbTable, $where); - - if ($result) + if ($result = $this->db->get_where($this->dbTable, $where)) + { return success($this->_toPhp($result)); + } else + { 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) { - // Check Class-Attributes - if (is_null($this->dbTable)) - return error(FHC_MODEL_ERROR, FHC_NODBTABLE); + // Check class properties + if (is_null($this->dbTable)) return error(FHC_MODEL_ERROR, FHC_NODBTABLE); // 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 $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 // will be given an alias to every column, that will be composed with the following schema // . AS _ - $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 .= ', '; } @@ -343,7 +336,7 @@ class DB_Model extends FHC_Model 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 @@ -378,7 +371,7 @@ class DB_Model extends FHC_Model { $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); } @@ -425,9 +418,8 @@ class DB_Model extends FHC_Model */ public function addOrder($field = null, $type = 'ASC') { - // Check Class-Attributes and parameters - if (is_null($field) || !in_array($type, array('ASC', 'DESC'))) - return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR); + // Check class properties and parameters + if (is_null($field) || !in_array($type, array('ASC', 'DESC'))) return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR); $this->db->order_by($field, $type); @@ -441,9 +433,8 @@ class DB_Model extends FHC_Model */ public function addSelect($select, $escape = true) { - // Check Class-Attributes and parameters - if (is_null($select) || $select == '') - return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR); + // Check class properties and parameters + if (is_null($select) || $select == '') return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR); $this->db->select($select, $escape); @@ -467,9 +458,8 @@ class DB_Model extends FHC_Model */ public function addLimit($start = null, $end = null) { - // Check Class-Attributes and parameters - if (!is_numeric($start) || (is_numeric($start) && $start <= 0)) - return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR); + // Check class properties and parameters + if (!is_numeric($start) || (is_numeric($start) && $start <= 0)) return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR); if (is_numeric($end) && $end > $start) { @@ -493,12 +483,11 @@ class DB_Model extends FHC_Model $tmpTable = trim($table); // Check parameters - if (empty($tmpTable)) - return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR); + if (empty($tmpTable)) return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR); if (!empty($alias)) { - $tmpTable .= ' AS ' . $alias; + $tmpTable .= ' AS '.$alias; } $this->db->from($tmpTable); @@ -562,7 +551,7 @@ class DB_Model extends FHC_Model return true; } // If false - else if ($val == DB_Model::PGSQL_BOOLEAN_FALSE) + elseif ($val == DB_Model::PGSQL_BOOLEAN_FALSE) { return false; } @@ -570,65 +559,11 @@ class DB_Model extends FHC_Model // If it is null, let it be null 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 - * It also takes care about array of booleans - */ + * Converts from PostgreSQL array to php array + * It also takes care about array of booleans + */ public function pgsqlArrayToPhpArray($string, $booleans = false) { // 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) { $udfs = array(); - $this->addSelect(UDFLib::COLUMN_NAME); + $this->addSelect(UDFLib::COLUMN_NAME); // select only the column with UDF $result = $this->load($id); if (hasData($result)) @@ -713,12 +649,12 @@ class DB_Model extends FHC_Model { if ($udfName != null && $udfName == $key) { - $udfs[$key] = $value; // + $udfs[$key] = $value; break; } else { - $udfs[$key] = $value; // + $udfs[$key] = $value; } } } @@ -737,22 +673,6 @@ class DB_Model extends FHC_Model // ------------------------------------------------------------------------------------------ // 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 * @return: boolean false on failure @@ -803,8 +723,8 @@ class DB_Model extends FHC_Model protected function getSchemaAndTable($schemaAndTable) { $result = new stdClass(); - $result->schema = DB_Model::DEFAULT_SCHEMA; $result->table = $schemaAndTable; + $result->schema = DB_Model::DEFAULT_SCHEMA; // If a schema is specified if (($pos = strpos($schemaAndTable, '.')) !== false) @@ -819,27 +739,59 @@ class DB_Model extends FHC_Model // ------------------------------------------------------------------------------------------ // 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 */ private function _isEntitled($permission) { + $ent = success(true); + // If the caller is _not_ a model _and_ tries to read data, then avoids to check permissions // Otherwise checks always the permissions - if (($permission == PermissionLib::SELECT_RIGHT && - substr(get_called_class(), -6) == DB_Model::MODEL_POSTFIX) || - $permission != PermissionLib::SELECT_RIGHT) + if (($permission == PermissionLib::SELECT_RIGHT + && substr(get_called_class(), -6) == DB_Model::MODEL_POSTFIX) + || $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 (($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 // This is for preventing that other parts of the query will be built before of the next execution $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 $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 (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 $resultsArray = $result->result(); // Looping on results - for($i = 0; $i < count($resultsArray); $i++) + for ($i = 0; $i < count($resultsArray); $i++) { // Single element $resultElement = $resultsArray[$i]; // Looping on fields to be converted - for($j = 0; $j < count($toBeConverterdArray); $j++) + for ($j = 0; $j < count($toBeConverterdArray); $j++) { // Single element $toBeConverted = $toBeConverterdArray[$j]; @@ -901,12 +853,12 @@ class DB_Model extends FHC_Model ); } // 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}); } // 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 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))); } -} \ No newline at end of file +} diff --git a/application/core/FHC_Controller.php b/application/core/FHC_Controller.php index fcffd7a82..5e252998e 100644 --- a/application/core/FHC_Controller.php +++ b/application/core/FHC_Controller.php @@ -4,10 +4,13 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); class FHC_Controller extends CI_Controller { + /** + * Standard construct for all the controllers, loads the authentication system + */ public function __construct() { parent::__construct(); $this->load->helper('fhcauth'); } -} \ No newline at end of file +} diff --git a/application/core/FHC_Model.php b/application/core/FHC_Model.php index a63411475..dbd556dd5 100644 --- a/application/core/FHC_Model.php +++ b/application/core/FHC_Model.php @@ -4,7 +4,12 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); 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(); @@ -25,19 +30,20 @@ class FHC_Model extends CI_Model */ public function isEntitled($sourceName, $accessType, $languageMessageCode, $msgErrorCode) { + $isEntitled = success(true); + if ($this->permissionlib->isEntitled($sourceName, $accessType) === false) { $retval = sprintf( '%s -> %s:%s', - lang('fhc_' . $languageMessageCode), + lang('fhc_'.$languageMessageCode), $this->permissionlib->getBerechtigungKurzbz($sourceName), $accessType ); - return error($retval, $msgErrorCode); - } - else - { - return true; + + $isEntitled = error($retval, $msgErrorCode); } + + return $isEntitled; } -} \ No newline at end of file +} diff --git a/application/core/FS_Model.php b/application/core/FS_Model.php index c79360e9f..8b006e91a 100644 --- a/application/core/FS_Model.php +++ b/application/core/FS_Model.php @@ -3,9 +3,11 @@ class FS_Model extends FHC_Model { 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(); @@ -26,16 +28,13 @@ class FS_Model extends FHC_Model public function read($filename) { // Check Class-Attributes - if (is_null($this->filepath)) - return error(FHC_MODEL_ERROR, FHC_ERROR); + if (is_null($this->filepath)) return error(FHC_MODEL_ERROR, FHC_ERROR); // Check method parameters - if (is_null($filename)) - return error(FHC_MODEL_ERROR, FHC_ERROR); + if (is_null($filename)) return error(FHC_MODEL_ERROR, FHC_ERROR); // Check rights - if (($chkRights = $this->isEntitled($this->filepath, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $chkRights; + if (isError($ent = $this->isEntitled($this->filepath, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; 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) { // Check Class-Attributes - if (is_null($this->filepath)) - return error(FHC_MODEL_ERROR, FHC_ERROR); + if (is_null($this->filepath)) return error(FHC_MODEL_ERROR, FHC_ERROR); // Check method parameters - if (is_null($filename)) - return error(FHC_MODEL_ERROR, FHC_ERROR); - if (is_null($content)) - 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 - if (($chkRights = $this->isEntitled($this->filepath, PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $chkRights; + if (isError(($ent = $this->isEntitled($this->filepath, PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)))) return $ent; 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) { // Check Class-Attributes - if (is_null($this->filepath)) - return error(FHC_MODEL_ERROR, FHC_ERROR); + if (is_null($this->filepath)) return error(FHC_MODEL_ERROR, FHC_ERROR); // Check method parameters - if (is_null($filename)) - 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); + if (is_null($filename)) return error(FHC_MODEL_ERROR, FHC_ERROR); // Check rights - if (($chkRights = $this->isEntitled($this->filepath, PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $chkRights; + if (isError($ent = $this->isEntitled($this->filepath, PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; 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) { // Check Class-Attributes - if (is_null($this->filepath)) - return error(FHC_MODEL_ERROR, FHC_ERROR); + if (is_null($this->filepath)) return error(FHC_MODEL_ERROR, FHC_ERROR); // Check method parameters - if (is_null($filename)) - return error(FHC_MODEL_ERROR, FHC_ERROR); + if (is_null($filename)) return error(FHC_MODEL_ERROR, FHC_ERROR); // Check rights - if (($chkRights = $this->isEntitled($this->filepath, PermissionLib::DELETE_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $chkRights; + if (isError($ent = $this->isEntitled($this->filepath, PermissionLib::DELETE_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; if ($this->filesystemlib->remove($this->filepath, $filename) === true) { @@ -150,18 +138,14 @@ class FS_Model extends FHC_Model public function rename($filename, $newFilename) { // Check Class-Attributes - if (is_null($this->filepath)) - return error(FHC_MODEL_ERROR, FHC_ERROR); + if (is_null($this->filepath)) return error(FHC_MODEL_ERROR, FHC_ERROR); // Check method parameters - if (is_null($filename)) - return error(FHC_MODEL_ERROR, FHC_ERROR); - if (is_null($newFilename)) - return error(FHC_MODEL_ERROR, FHC_ERROR); + if (is_null($filename)) return error(FHC_MODEL_ERROR, FHC_ERROR); + if (is_null($newFilename)) return error(FHC_MODEL_ERROR, FHC_ERROR); // Check rights - if (($chkRights = $this->isEntitled($this->filepath, PermissionLib::UPDATE_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $chkRights; + if (isError($ent = $this->isEntitled($this->filepath, PermissionLib::UPDATE_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; 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); } } -} \ No newline at end of file +} diff --git a/application/core/VileSci_Controller.php b/application/core/VileSci_Controller.php index 4eaa733a1..cc2979d39 100644 --- a/application/core/VileSci_Controller.php +++ b/application/core/VileSci_Controller.php @@ -4,7 +4,10 @@ if (! defined("BASEPATH")) exit("No direct script access allowed"); class VileSci_Controller extends FHC_Controller { - function __construct() + /** + * Standard construct for all the controllers used in VileSci + */ + public function __construct() { parent::__construct(); } diff --git a/application/libraries/CallerLib.php b/application/libraries/CallerLib.php index 219a871d3..856f0855a 100644 --- a/application/libraries/CallerLib.php +++ b/application/libraries/CallerLib.php @@ -79,7 +79,7 @@ class CallerLib } } // 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 $isLoaded = $this->ci->load->is_loaded($parameters->resourceName); @@ -89,10 +89,10 @@ class CallerLib // Checks if the operation is permitted by the API caller // Only for libraries, permissions are automatically handled by models $result = $this->checkLibraryPermission( - $parameters->resourcePath, - $parameters->resourceName, - $parameters->function, - $permissionType + $parameters->resourcePath, + $parameters->resourceName, + $parameters->function, + $permissionType ); if (isError($result)) { @@ -117,7 +117,7 @@ class CallerLib // Wrong selection! 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 @@ -166,7 +166,7 @@ class CallerLib $parameters->resourcePath = str_replace($parameters->resourceName, '', $parameterValue); } // The name of the function - else if ($parameterName == CallerLib::FUNCTION_PARAMETER) + elseif ($parameterName == CallerLib::FUNCTION_PARAMETER) { $parameters->function = $parameterValue; } @@ -217,7 +217,7 @@ class CallerLib /** * Loads a model using the given path and name - * + * * NOTE: the models automatically handle the permissions */ private function _loadModel($resourcePath, $resourceName) @@ -227,12 +227,12 @@ class CallerLib try { - $loaded = $this->ci->load->model($resourcePath . $resourceName); + $loaded = $this->ci->load->model($resourcePath.$resourceName); } catch (Exception $e) { // 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)) @@ -257,7 +257,7 @@ class CallerLib $permissionPath = $resourcePath; } - $permissionPath .= $resourceName . '.' . $function; + $permissionPath .= $resourceName.'.'.$function; if ($this->ci->permissionlib->isEntitled($permissionPath, $permissionType) === false) { @@ -273,14 +273,14 @@ class CallerLib /** * Loads a library using the given path and name - * + * * 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. * It consists in: * - Checking if the file (identified by parameters $resourcePath and $resourceName) exists * - 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 - * + * * If one of the previous tests fails, it will be returned a null value */ private function _loadLibrary($resourcePath, $resourceName) @@ -295,8 +295,8 @@ class CallerLib $found = null; for ($i = 0; $i < count($packagePaths) && is_null($found); $i++) { - $file = $packagePaths[$i] . CallerLib::LIBS_PATH . DIRECTORY_SEPARATOR . - $resourcePath . $resourceName . CallerLib::LIB_FILE_EXTENSION; + $file = $packagePaths[$i].CallerLib::LIBS_PATH.DIRECTORY_SEPARATOR. + $resourcePath.$resourceName.CallerLib::LIB_FILE_EXTENSION; if (file_exists($file)) { $found = $file; @@ -313,20 +313,20 @@ class CallerLib { $loaded = null; // 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 { $loaded = null; // 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) { // 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)) @@ -339,7 +339,7 @@ class CallerLib /** * Calls a method of a class with the given parameters and returns its result - * + * * @param string $resourceName identifies the class name * @param string $function identifies the method name * @param array $parameters contains the parameters to be passed to the method @@ -359,7 +359,7 @@ class CallerLib // If the function is static if ($reflectionMethod->isStatic() === true) { - $classMethod = $resourceName . '::' . $function; + $classMethod = $resourceName.'::'.$function; } // If the function is not static else @@ -370,7 +370,6 @@ class CallerLib // If the resource's function is callable if (is_callable($classMethod)) { - // Call resource->function() // @ was applied to prevent really ugly and unmanageable errors $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 ;) if ($resultCall === false) { - $result = error('Error running ' . $resourceName . '->' . $function . '()'); + $result = error('Error running '.$resourceName.'->'.$function.'()'); } // Returns the result of resource->function() else @@ -389,14 +388,13 @@ class CallerLib } else { - $result = error($resourceName . '->' . $function . '() is not callable!'); + $result = error($resourceName.'->'.$function.'() is not callable!'); } } else { $result = error( - 'Number of required parameters: ' . $reflectionMethod->getNumberOfRequiredParameters() . - '. Given: ' . count($parameters) + 'Number of required parameters: '.$reflectionMethod->getNumberOfRequiredParameters().'. Given: '.count($parameters) ); } } @@ -407,4 +405,4 @@ class CallerLib return $result; } -} \ No newline at end of file +} diff --git a/application/libraries/DmsLib.php b/application/libraries/DmsLib.php index a4b82ef12..7ee160f85 100644 --- a/application/libraries/DmsLib.php +++ b/application/libraries/DmsLib.php @@ -2,12 +2,8 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); -/** - * - */ class DmsLib { - // const FILE_CONTENT_PROPERTY = 'file_content'; /** @@ -27,7 +23,7 @@ class DmsLib } /** - * + * read */ 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) { @@ -92,13 +88,13 @@ class DmsLib } /** - * + * save */ public function save($dms) { $result = null; - if(isset($dms['new']) && $dms['new'] == true) + if (isset($dms['new']) && $dms['new'] == true) { // Remove new parameter to avoid DB insert errors unset($dms['new']); @@ -107,7 +103,7 @@ class DmsLib if (isSuccess($result)) { $filename = $result->retval; - if(isset($dms['dms_id']) && $dms['dms_id'] != '') + if (isset($dms['dms_id']) && $dms['dms_id'] != '') { $result = $this->ci->DmsVersionModel->insert( $this->ci->DmsVersionModel->filterFields($dms, $dms['dms_id'], $filename) @@ -148,7 +144,7 @@ class DmsLib } /** - * + * delete */ public function delete($person_id, $dms_id) { @@ -218,11 +214,11 @@ class DmsLib } /** - * + * _saveFileOnInsert */ 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']); if (isSuccess($result)) @@ -234,13 +230,13 @@ class DmsLib } /** - * + * _saveFileOnUpdate */ private function _saveFileOnUpdate($dms) { $result = null; - if(isset($dms['version'])) + if (isset($dms['version'])) { $result = $this->read($dms['dms_id'], $dms['version']); @@ -252,4 +248,4 @@ class DmsLib return $result; } -} \ No newline at end of file +} diff --git a/application/libraries/FHC_Auth.php b/application/libraries/FHC_Auth.php index a56cf0237..dd7bb09e2 100644 --- a/application/libraries/FHC_Auth.php +++ b/application/libraries/FHC_Auth.php @@ -10,10 +10,6 @@ * @since Version 1.0.0 * @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 @@ -25,7 +21,10 @@ require_once FHCPATH.'include/AddonAuthentication.php'; * @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 { @@ -39,10 +38,6 @@ class FHC_Auth extends authentication /** * Auth Username, Password over FH-Complete - * - * @param string $username - * @param string $password - * @return bool */ public function basicAuthentication($username, $password) { @@ -57,9 +52,9 @@ class FHC_Auth extends authentication } /** - * + * * TO BE UPDATED - * + * * Get the md5 hashed password by the addon username * * @param string $username addon username @@ -71,4 +66,4 @@ class FHC_Auth extends authentication return md5($aam->getPasswordByUsername($username)); } -} \ No newline at end of file +} diff --git a/application/libraries/FilesystemLib.php b/application/libraries/FilesystemLib.php index 0b1dbc5d0..c940acede 100644 --- a/application/libraries/FilesystemLib.php +++ b/application/libraries/FilesystemLib.php @@ -1,5 +1,5 @@ checkParameters($filepath, $filename)) { - $resource = $filepath . DIRECTORY_SEPARATOR . $filename; + $resource = $filepath.DIRECTORY_SEPARATOR.$filename; if (file_exists($resource) && $fileHandle = fopen($resource, 'r')) { $result = ''; @@ -61,8 +55,8 @@ class FilesystemLib return $result; } - /* - * + /** + * write */ public function write($filepath, $filename, $content) { @@ -70,7 +64,7 @@ class FilesystemLib 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 (fwrite($fileHandle, $content) !== false) @@ -84,8 +78,8 @@ class FilesystemLib return $result; } - /* - * + /** + * append */ public function append($filepath, $filename, $content) { @@ -93,7 +87,7 @@ class FilesystemLib 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 (fwrite($fileHandle, $content) !== false) @@ -107,8 +101,8 @@ class FilesystemLib return $result; } - /* - * + /** + * remove */ public function remove($filepath, $filename) { @@ -118,7 +112,7 @@ class FilesystemLib { if (is_writable($filepath)) { - $resource = $filepath . DIRECTORY_SEPARATOR . $filename; + $resource = $filepath.DIRECTORY_SEPARATOR.$filename; $result = unlink($resource); } } @@ -126,8 +120,8 @@ class FilesystemLib return $result; } - /* - * + /** + * rename */ public function rename($filepath, $filename, $newFilepath, $newFilename) { @@ -135,14 +129,14 @@ class FilesystemLib 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)) { - $destination = $newFilepath . DIRECTORY_SEPARATOR . $newFilename; + $destination = $newFilepath.DIRECTORY_SEPARATOR.$newFilename; $result = rename($resource, $destination); } } return $result; } -} \ No newline at end of file +} diff --git a/application/libraries/LogLib.php b/application/libraries/LogLib.php index f104d6e99..be401f208 100644 --- a/application/libraries/LogLib.php +++ b/application/libraries/LogLib.php @@ -17,24 +17,25 @@ class LogLib const LINE_SEPARATOR = ':'; /** - * Object initialization + * format */ - public function __construct() {} - private function format($class, $function, $line) { $formatted = LogLib::CALLER_PREFIX; 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; } + /** + * getCaller + */ private function getCaller() { $classIndex = 3; @@ -62,13 +63,16 @@ class LogLib return $this->format($class, $function, $line); } + /** + * log + */ private function log($level, $message) { - log_message($level, $this->getCaller() . $message); + log_message($level, $this->getCaller().$message); } /** - * + * logDebug */ public function logDebug($message) { @@ -76,7 +80,7 @@ class LogLib } /** - * + * logInfo */ public function logInfo($message) { @@ -84,10 +88,10 @@ class LogLib } /** - * + * logError */ public function logError($message) { $this->log(LogLib::ERROR, $message); } -} \ No newline at end of file +} diff --git a/application/libraries/MailLib.php b/application/libraries/MailLib.php index ee2fa9419..5c7093461 100755 --- a/application/libraries/MailLib.php +++ b/application/libraries/MailLib.php @@ -1,6 +1,6 @@ ci =& get_instance(); // 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 - $this->ci->load->library("email"); + $this->ci->load->library('email'); // 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 - $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_time_range = $this->getEmailCfgItem("email_time_range"); - $this->email_from_system = $this->getEmailCfgItem("email_from_system"); - $this->alias_from_system = $this->getEmailCfgItem("alias_from_system"); + $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_time_range = $this->getEmailCfgItem('email_time_range'); + $this->email_from_system = $this->getEmailCfgItem('email_from_system'); + $this->alias_from_system = $this->getEmailCfgItem('alias_from_system'); } /** * 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 (is_null($from) || $from == "") + if (is_null($from) || $from == '') { $from = $this->email_from_system; // 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; } diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php index cbcb6863a..7a1d8df8f 100755 --- a/application/libraries/MessageLib.php +++ b/application/libraries/MessageLib.php @@ -3,12 +3,15 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); /** -* Messaging Library for FH-Complete -*/ + * Messaging Library for FH-Complete + */ class MessageLib { const MSG_INDX_PREFIX = 'message_'; + /** + * Constructor + */ public function __construct() { // Get code igniter instance @@ -43,10 +46,6 @@ class MessageLib /** * 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) { @@ -62,9 +61,6 @@ class MessageLib /** * 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) { @@ -78,9 +74,6 @@ class MessageLib /** * 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) { @@ -94,9 +87,6 @@ class MessageLib /** * 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) { @@ -110,9 +100,6 @@ class MessageLib /** * getMessageByToken - * - * @param token string - * @return array */ public function getMessageByToken($token) { @@ -156,9 +143,6 @@ class MessageLib /** * getCountUnreadMessages - * - * @param bigint $person_id REQUIRED - * @return array */ public function getCountUnreadMessages($person_id) { @@ -172,11 +156,6 @@ class MessageLib /** * 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) { @@ -219,7 +198,6 @@ class MessageLib /** * 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) { @@ -270,7 +248,7 @@ class MessageLib $result = $this->_error('', MSG_ERR_SUBJECT_EMPTY); break; } - else if (empty($body)) + elseif (empty($body)) { $result = $this->_error('', MSG_ERR_BODY_EMPTY); break; @@ -295,13 +273,6 @@ class MessageLib /** * 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) { @@ -375,19 +346,19 @@ class MessageLib $result = $this->_error('', MSG_ERR_TEMPLATE_NOT_FOUND); 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)) { $result = $this->_error('', MSG_ERR_TEMPLATE_NOT_FOUND); break; } - else if (empty($result->retval[0]->text)) + elseif (empty($result->retval[0]->text)) { $result = $this->_error('', MSG_ERR_INVALID_TEMPLATE); break; } - else if (empty($result->retval[0]->subject)) + elseif (empty($result->retval[0]->subject)) { $result = $this->_error('', MSG_ERR_INVALID_TEMPLATE); break; @@ -453,7 +424,7 @@ class MessageLib // If the person has an email account 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 $body = $this->ci->parser->parse( 'templates/mailHTML', @@ -533,10 +504,10 @@ class MessageLib $this->ci->loglib->logError('This person does not have an email account'); // Writing errors in tbl_message_recipient $sme = $this->setMessageError( - $result->retval[$i]->message_id, - $result->retval[$i]->receiver_id, - 'This person does not have an email account', - $result->retval[$i]->sentinfo + $result->retval[$i]->message_id, + $result->retval[$i]->receiver_id, + 'This person does not have an email account', + $result->retval[$i]->sentinfo ); if (!$sme) { @@ -570,10 +541,10 @@ class MessageLib // Get a specific message from DB having EMAIL_KONTAKT_TYPE as relative contact type $result = $this->ci->RecipientModel->getMessages( - EMAIL_KONTAKT_TYPE, - null, - null, - $message_id + EMAIL_KONTAKT_TYPE, + null, + null, + $message_id ); // Checks if errors were occurred if (isSuccess($result)) @@ -588,7 +559,7 @@ class MessageLib if ($multiPartMime === true) { // 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( 'templates/mailHTML', array( @@ -648,10 +619,10 @@ class MessageLib $this->ci->loglib->logError('Error while sending an email'); // Writing errors in tbl_message_status $sme = $this->setMessageError( - $result->retval[0]->message_id, - $result->retval[0]->receiver_id, - 'Error while sending an email', - $result->retval[0]->sentinfo + $result->retval[0]->message_id, + $result->retval[0]->receiver_id, + 'Error while sending an email', + $result->retval[0]->sentinfo ); if (!$sme) { @@ -674,10 +645,10 @@ class MessageLib $this->ci->loglib->logError('This person does not have an email account'); // Writing errors in tbl_message_status $sme = $this->setMessageError( - $result->retval[0]->message_id, - $result->retval[0]->receiver_id, - 'This person does not have an email account', - $result->retval[0]->sentinfo + $result->retval[0]->message_id, + $result->retval[0]->receiver_id, + 'This person does not have an email account', + $result->retval[0]->sentinfo ); if (!$sme) { @@ -702,8 +673,7 @@ class MessageLib } // ------------------------------------------------------------------------ - // Private Functions from here out! - // ------------------------------------------------------------------------ + // Private methods /** * Update the table tbl_message_recipient @@ -740,7 +710,7 @@ class MessageLib { if (!is_null($prevSentInfo) && $prevSentInfo != '') { - $sentInfo = $prevSentInfo . SENT_INFO_NEWLINE . $sentInfo; + $sentInfo = $prevSentInfo.SENT_INFO_NEWLINE.$sentInfo; } $parameters = array('sent' => null, 'sentinfo' => $sentInfo); @@ -759,8 +729,8 @@ class MessageLib $this->ci->BenutzerfunktionModel->addJoin('public.tbl_benutzer', 'uid'); // Get all the valid receivers id using the oe_kurzbz $receivers = $this->ci->BenutzerfunktionModel->loadWhere( - 'oe_kurzbz = \'' . $oe_kurzbz . '\''. - ' AND funktion_kurzbz = \'' . $this->ci->config->item('assistent_function') . '\'' . + 'oe_kurzbz = \''.$oe_kurzbz.'\''. + ' AND funktion_kurzbz = \''.$this->ci->config->item('assistent_function').'\''. ' AND (NOW() BETWEEN COALESCE(datum_von, NOW()) AND COALESCE(datum_bis, NOW()))' ); diff --git a/application/libraries/MigrationLib.php b/application/libraries/MigrationLib.php index 92899ebca..a35cafc65 100644 --- a/application/libraries/MigrationLib.php +++ b/application/libraries/MigrationLib.php @@ -76,11 +76,11 @@ class MigrationLib extends CI_Migration { if ($this->cli === true) { - $colored = "\033[" . $color . "m%s\033[37m"; + $colored = "\033[".$color."m%s\033[37m"; } else { - $colored = "HTML_COLORS[$color] . "\">%s"; + $colored = "HTML_COLORS[$color]."\">%s"; } } @@ -92,7 +92,7 @@ class MigrationLib extends CI_Migration */ 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() { - $this->printInfo(sprintf("%s Start method up of class %s %s", - MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR) + $this->printInfo( + 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() { - $this->printInfo(sprintf("%s End method up of class %s %s", - MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR) + $this->printInfo( + 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() { - $this->printInfo(sprintf("%s Start method down of class %s %s", - MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR) + $this->printInfo( + 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() { - $this->printInfo(sprintf("%s End method down of class %s %s", - MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR) + $this->printInfo( + 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) { - foreach($fields as $name => $definition) + foreach ($fields as $name => $definition) { 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"])); } @@ -204,11 +204,11 @@ class MigrationLib extends CI_Migration */ protected function modifyColumn($schema, $table, $fields) { - foreach($fields as $name => $definition) + foreach ($fields as $name => $definition) { 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)); } @@ -231,7 +231,7 @@ class MigrationLib extends CI_Migration { 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)); } @@ -289,8 +289,17 @@ class MigrationLib extends CI_Migration */ 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", - $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", + $schema, + $table, + $name, + $field, + $schemaDest, + $tableDest, + $fieldDest, + $attributes + ); if (@$this->db->simple_query($query)) { @@ -371,22 +380,26 @@ class MigrationLib extends CI_Migration if (@$this->db->simple_query($query)) { $this->printMessage( - sprintf("Granted permissions %s on table %s.%s to user %s", - is_null($stringPermission) ? $permissions : $stringPermission, - $schema, - $table, - $user - )); + sprintf( + "Granted permissions %s on table %s.%s to user %s", + is_null($stringPermission) ? $permissions : $stringPermission, + $schema, + $table, + $user + ) + ); } else { $this->printError( - sprintf("Granting permissions %s on table %s.%s to user %s", - is_null($stringPermission) ? $permissions : $stringPermission, - $schema, - $table, - $user - )); + sprintf( + "Granting permissions %s on table %s.%s to user %s", + is_null($stringPermission) ? $permissions : $stringPermission, + $schema, + $table, + $user + ) + ); } } @@ -397,7 +410,7 @@ class MigrationLib extends CI_Migration { $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)); } @@ -412,7 +425,7 @@ class MigrationLib extends CI_Migration */ 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)); } @@ -503,22 +516,26 @@ class MigrationLib extends CI_Migration if (@$this->db->simple_query($query)) { $this->printMessage( - sprintf("Granted permissions %s on sequence %s.%s to user %s", - is_null($stringPermission) ? $permissions : $stringPermission, - $schema, - $sequence, - $user - )); + sprintf( + "Granted permissions %s on sequence %s.%s to user %s", + is_null($stringPermission) ? $permissions : $stringPermission, + $schema, + $sequence, + $user + ) + ); } else { $this->printError( - sprintf("Granting permissions %s on sequence %s.%s to user %s", - is_null($stringPermission) ? $permissions : $stringPermission, - $schema, - $sequence, - $user - )); + sprintf( + "Granting permissions %s on sequence %s.%s to user %s", + is_null($stringPermission) ? $permissions : $stringPermission, + $schema, + $sequence, + $user + ) + ); } } @@ -542,9 +559,9 @@ class MigrationLib extends CI_Migration } $this->printInfo( - "Query correctly executed: " . - substr(preg_replace("/\s+/", " ", trim($query)), 0, MigrationLib::PRINT_QUERY_LEN) . + "Query correctly executed: ". + substr(preg_replace("/\s+/", " ", trim($query)), 0, MigrationLib::PRINT_QUERY_LEN). (strlen($query) > MigrationLib::PRINT_QUERY_LEN ? "..." : "") ); } -} \ No newline at end of file +} diff --git a/application/libraries/OrganisationseinheitLib.php b/application/libraries/OrganisationseinheitLib.php index 8d125abc0..e70e8cb76 100644 --- a/application/libraries/OrganisationseinheitLib.php +++ b/application/libraries/OrganisationseinheitLib.php @@ -4,6 +4,9 @@ if (! defined("BASEPATH")) exit("No direct script access allowed"); class OrganisationseinheitLib { + /** + * Loads model OrganisationseinheitModel + */ public function __construct() { $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 * match with the other table, which attributes are passed as parameters: * schema name, table name, fields to be selected, where conditions, orderby clause - * + * * @param string $schema REQUIRED * @param string $table REQUIRED * @param mixed $fields REQUIRED @@ -63,6 +66,9 @@ class OrganisationseinheitLib return $result; } + /** + * treeSearchEntire + */ public function treeSearchEntire($table, $alias, $fields, $where, $orderby, $oe_kurzbz) { $select = ""; @@ -90,12 +96,15 @@ class OrganisationseinheitLib { $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); } } - 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); } @@ -103,4 +112,4 @@ class OrganisationseinheitLib return $result; } -} \ No newline at end of file +} diff --git a/application/libraries/PermissionLib.php b/application/libraries/PermissionLib.php index 3bd70eb40..f418f06b2 100644 --- a/application/libraries/PermissionLib.php +++ b/application/libraries/PermissionLib.php @@ -37,7 +37,7 @@ class PermissionLib * PermissionLib's constructor * Here is initialized the static property bb with all the rights of the user (API caller) */ - function __construct() + public function __construct() { // Loads CI instance $this->ci =& get_instance(); @@ -64,17 +64,16 @@ class PermissionLib */ public function isEntitled($sourceName, $permissionType) { + $isEntitled = false; + // If the resource exists if (isset($this->acl[$sourceName])) { // Checks permission - return $this->_isBerechtigt($this->acl[$sourceName], $permissionType); - } - // if the resource does not exist, do not lose useful clock cycles - else - { - return false; + $isEntitled = $this->_isBerechtigt($this->acl[$sourceName], $permissionType); } + + return $isEntitled; } /** @@ -82,26 +81,26 @@ class PermissionLib */ public function getBerechtigungKurzbz($sourceName) { + $returnValue = null; + if (isset($this->acl[$sourceName])) { - return $this->acl[$sourceName]; - } - else - { - return null; + $returnValue = $this->acl[$sourceName]; } + + return $returnValue; } /** * 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; 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; } @@ -109,4 +108,4 @@ class PermissionLib return $isBerechtigt; } -} \ No newline at end of file +} diff --git a/application/libraries/PhrasesLib.php b/application/libraries/PhrasesLib.php index 0ae5c72c0..873da85c1 100644 --- a/application/libraries/PhrasesLib.php +++ b/application/libraries/PhrasesLib.php @@ -1,15 +1,11 @@ ci->load->helper('language'); // Loads helper message to manage returning messages $this->ci->load->helper('message'); - - //$this->ci->lang->load('fhcomplete'); } /** * 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)) return error(MSG_ERR_INVALID_MSG_ID); @@ -49,17 +40,17 @@ class PhrasesLib /** * 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)); return $phrases; } - function getPhraseInhalt($phrase_id) + /** + * getPhraseInhalt + */ + public function getPhraseInhalt($phrase_id) { if (empty($phrase_id)) return error(MSG_ERR_INVALID_MSG_ID); @@ -68,7 +59,10 @@ class PhrasesLib return $phrasentext; } - function delPhrasentext($phrasentext_id) + /** + * delPhrasentext + */ + public function delPhrasentext($phrasentext_id) { if (empty($phrasentext_id)) return error(MSG_ERR_INVALID_MSG_ID); @@ -79,11 +73,8 @@ class PhrasesLib /** * 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)) return error(MSG_ERR_INVALID_MSG_ID); @@ -95,11 +86,8 @@ class PhrasesLib /** * 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)) return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false)); @@ -109,11 +97,9 @@ class PhrasesLib } /** - * getPhrases() - - * - * @return struct + * getPhrases() */ - 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)) { @@ -163,11 +149,8 @@ class PhrasesLib /** * 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); return $phrasentext; @@ -175,11 +158,8 @@ class PhrasesLib /** * 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); return $vorlagetext; @@ -187,11 +167,8 @@ class PhrasesLib /** * 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); return $phrasentext; @@ -199,16 +176,12 @@ class PhrasesLib /** * 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)) 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; } -} \ No newline at end of file +} diff --git a/application/libraries/ReihungstestLib.php b/application/libraries/ReihungstestLib.php index 4030e50c3..5b40e65e3 100644 --- a/application/libraries/ReihungstestLib.php +++ b/application/libraries/ReihungstestLib.php @@ -2,9 +2,6 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); -/** - * - */ class ReihungstestLib { /** @@ -84,4 +81,4 @@ class ReihungstestLib return false; } -} \ No newline at end of file +} diff --git a/application/libraries/UDFLib.php b/application/libraries/UDFLib.php index f174dd8e5..b509304c7 100644 --- a/application/libraries/UDFLib.php +++ b/application/libraries/UDFLib.php @@ -48,7 +48,7 @@ class UDFLib private $_ci; // Code igniter instance /** - * + * Loads fhc helper */ public function __construct() { @@ -61,7 +61,7 @@ class UDFLib // Public methods /** - * + * UDFWidget */ public function UDFWidget($args, $htmlArgs = array()) { @@ -100,6 +100,7 @@ class UDFLib /** * It renders the HTML of the UDF + * * NOTE: When this method is called $widgetData contains different data from * parameter $args in the constructor */ @@ -137,7 +138,7 @@ class UDFLib $this->_sortJsonSchemas($jsonSchemasArray); // Sort the list of UDF by sort property // Loops through json schemas - foreach($jsonSchemasArray as $jsonSchema) + foreach ($jsonSchemasArray as $jsonSchema) { // If the type property is not present then show an error if (!isset($jsonSchema->{UDFLib::TYPE})) @@ -266,7 +267,7 @@ class UDFLib // If $toBeValidated == true => validation is performed // If $toBeValidated == false => validation is NOT performed $toBeValidated = false; - // If this UDF is NOT a checkbox + // If this UDF is NOT a checkbox if ($decodedUDFDefinition->{UDFLib::TYPE} != UDFLib::CHKBOX_TYPE) { // 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 { $tmpValidate = $this->_validateUDFs( - $decodedUDFDefinition->{UDFLib::VALIDATION}, // - $decodedUDFDefinition->{UDFLib::NAME}, // - $val // + $decodedUDFDefinition->{UDFLib::VALIDATION}, + $decodedUDFDefinition->{UDFLib::NAME}, + $val ); } } @@ -315,7 +316,7 @@ class UDFLib // Copies the remaining required UDFs into $notValidUDFsArray // because they were not supplied, therefore must be notified as error - foreach($requiredUDFsArray as $key => $val) + foreach ($requiredUDFsArray as $key => $val) { $notValidUDFsArray[] = array($val); } @@ -327,7 +328,7 @@ class UDFLib // of the UDF that are not updated 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 // then copy it from the DB without changes @@ -354,7 +355,7 @@ class UDFLib } /** - * + * isUDFColumn */ public function isUDFColumn($columnName, $columnType) { @@ -377,7 +378,7 @@ class UDFLib */ private function _popUDFParameters(&$data) { - foreach($data as $key => $val) + foreach ($data as $key => $val) { if (substr($key, 0, 4) == UDFLib::COLUMN_PREFIX) { @@ -402,7 +403,7 @@ class UDFLib } // 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 (!is_array($udfVal) && !is_object($udfVal)) @@ -456,7 +457,7 @@ class UDFLib if (isset($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) { @@ -499,9 +500,7 @@ class UDFLib */ private function _sortJsonSchemas(&$jsonSchemasArray) { - // usort($jsonSchemasArray, function ($a, $b) { - // if (!isset($a->{UDFLib::SORT})) { $a->{UDFLib::SORT} = 9999; @@ -510,7 +509,6 @@ class UDFLib { $b->{UDFLib::SORT} = 9999; } - if ($a->{UDFLib::SORT} == $b->{UDFLib::SORT}) { return 0; @@ -541,7 +539,7 @@ class UDFLib { show_error($udfResults->retval); } - else if (is_string($udfResults)) + elseif (is_string($udfResults)) { show_error($udfResults); } @@ -550,7 +548,7 @@ class UDFLib show_error('UDFWidget: generic error occurred'); } } - else if (!hasData($udfResults)) + elseif (!hasData($udfResults)) { show_error(sprintf('%s.%s does not contain UDF', $schema, $table)); } @@ -569,27 +567,27 @@ class UDFLib $this->_renderCheckbox($jsonSchema, $widgetData); } // Textfield - else if ($jsonSchema->{UDFLib::TYPE} == 'textfield') + elseif ($jsonSchema->{UDFLib::TYPE} == 'textfield') { $this->_renderTextfield($jsonSchema, $widgetData); } // Textarea - else if ($jsonSchema->{UDFLib::TYPE} == 'textarea') + elseif ($jsonSchema->{UDFLib::TYPE} == 'textarea') { $this->_renderTextarea($jsonSchema, $widgetData); } // Date - else if ($jsonSchema->{UDFLib::TYPE} == 'date') + elseif ($jsonSchema->{UDFLib::TYPE} == 'date') { - + // To be done } // Dropdown - else if ($jsonSchema->{UDFLib::TYPE} == 'dropdown') + elseif ($jsonSchema->{UDFLib::TYPE} == 'dropdown') { $this->_renderDropdown($jsonSchema, $widgetData); } // Multiple dropdown - else if ($jsonSchema->{UDFLib::TYPE} == 'multipledropdown') + elseif ($jsonSchema->{UDFLib::TYPE} == 'multipledropdown') { $this->_renderDropdown($jsonSchema, $widgetData, true); } @@ -620,12 +618,12 @@ class UDFLib $parameters = $jsonSchema->{UDFLib::LIST_VALUES}->enum; } // 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 $queryResult = $this->_ci->UDFModel->execQuery($jsonSchema->{UDFLib::LIST_VALUES}->sql); if (hasData($queryResult)) - { + { $parameters = $queryResult->retval; } } @@ -796,7 +794,7 @@ class UDFLib if (isset($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) { @@ -836,4 +834,4 @@ class UDFLib } } } -} \ No newline at end of file +} diff --git a/application/libraries/VorlageLib.php b/application/libraries/VorlageLib.php index eb0caa3a8..81ce44149 100644 --- a/application/libraries/VorlageLib.php +++ b/application/libraries/VorlageLib.php @@ -1,16 +1,14 @@ ci->VorlageModel->loadWhere(array('mimetype' => $mimetype)); return $vorlage; } - /** * saveVorlage() - will save a spezific Template. * * @param array $data REQUIRED * @return array */ - function saveVorlage($vorlage_kurzbz, $data) + public function saveVorlage($vorlage_kurzbz, $data) { if (empty($data)) return error(MSG_ERR_INVALID_MSG_ID); @@ -72,19 +69,18 @@ class VorlageLib return $vorlage; } - /** * getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template. * * @param string $vorlage_kurzbz REQUIRED * @return array */ - function getVorlagetextByVorlage($vorlage_kurzbz) + public function getVorlagetextByVorlage($vorlage_kurzbz) { if (empty($vorlage_kurzbz)) 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; } @@ -97,7 +93,7 @@ class VorlageLib * @param string $sprache OPTIONAL * @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)) return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false)); @@ -126,40 +122,35 @@ class VorlageLib $where = $this->_where($vorlage_kurzbz, $orgform_kurzbz, $sprache); $vorlage = $this->ci->organisationseinheitlib->treeSearch( - 'public', - 'tbl_vorlagestudiengang', - array("vorlage_kurzbz", "studiengang_kz", "version", "text", "oe_kurzbz", - "vorlagestudiengang_id", "style", "berechtigung", "anmerkung_vorlagestudiengang", - "aktiv", "sprache", "subject", "orgform_kurzbz"), - $where, - "version DESC", - $oe_kurzbz + 'public', + 'tbl_vorlagestudiengang', + array("vorlage_kurzbz", "studiengang_kz", "version", "text", "oe_kurzbz", + "vorlagestudiengang_id", "style", "berechtigung", "anmerkung_vorlagestudiengang", + "aktiv", "sprache", "subject", "orgform_kurzbz"), + $where, + "version DESC", + $oe_kurzbz ); } return $vorlage; } - + + /** + * _where + */ private function _where($vorlage_kurzbz, $orgform_kurzbz, $sprache) { // Builds where clause $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)) { $where .= " AND sprache IS NULL"; } else { - $where .= " AND sprache = " . $this->ci->VorlageModel->escape($sprache); + $where .= " AND sprache = ".$this->ci->VorlageModel->escape($sprache); } $where .= " AND aktiv = true"; @@ -173,7 +164,7 @@ class VorlageLib * @param string $vorlage_kurzbz REQUIRED * @return array */ - function insertVorlagetext($data) + public function insertVorlagetext($data) { $vorlagetext = $this->ci->VorlageStudiengangModel->insert($data); return $vorlagetext; @@ -185,7 +176,7 @@ class VorlageLib * @param string $vorlage_kurzbz REQUIRED * @return array */ - function getVorlagetextById($vorlagestudiengang_id) + public function getVorlagetextById($vorlagestudiengang_id) { $vorlagetext = $this->ci->VorlageStudiengangModel->load($vorlagestudiengang_id); return $vorlagetext; @@ -197,7 +188,7 @@ class VorlageLib * @param string $vorlage_kurzbz REQUIRED * @return array */ - function updateVorlagetext($vorlagestudiengang_id, $data) + public function updateVorlagetext($vorlagestudiengang_id, $data) { $vorlagetext = $this->ci->VorlageStudiengangModel->update($vorlagestudiengang_id, $data); return $vorlagetext; @@ -210,11 +201,11 @@ class VorlageLib * @param array $data REQUIRED * @return string */ - function parseVorlagetext($text, $data = array()) + public function parseVorlagetext($text, $data = array()) { if (empty($text)) 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; } -} \ No newline at end of file +} diff --git a/application/models/codex/Orgform_model.php b/application/models/codex/Orgform_model.php index 238376ba4..69a9d6b0d 100644 --- a/application/models/codex/Orgform_model.php +++ b/application/models/codex/Orgform_model.php @@ -12,11 +12,13 @@ class Orgform_model extends DB_Model $this->pk = 'orgform_kurzbz'; } + /** + * Returns all the orgform except VBB and ZGS + */ public function getOrgformLV() { // Checks rights - if (($isEntitled = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; $query = "SELECT * FROM bis.tbl_orgform @@ -25,4 +27,4 @@ class Orgform_model extends DB_Model return $this->execQuery($query); } -} \ No newline at end of file +} diff --git a/application/models/crm/Akte_model.php b/application/models/crm/Akte_model.php index 8fb1a0ba3..4301af240 100644 --- a/application/models/crm/Akte_model.php +++ b/application/models/crm/Akte_model.php @@ -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) { // 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) - 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; + if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; $query = 'SELECT akte_id, person_id, @@ -79,17 +72,12 @@ class Akte_model extends DB_Model } /** - * + * getAktenAccepted */ public function getAktenAccepted($person_id, $dokument_kurzbz = null) { // 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) - 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; + if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; $query = 'SELECT a.akte_id, a.person_id, @@ -130,21 +118,13 @@ class Akte_model extends DB_Model } /** - * + * getAktenAcceptedDms */ public function getAktenAcceptedDms($person_id, $dokument_kurzbz = null) { // 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) - 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; - 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; + if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; + if (isError($ent = $this->isEntitled('campus.tbl_dms', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; $query = 'SELECT a.akte_id, a.person_id, @@ -193,4 +173,4 @@ class Akte_model extends DB_Model return $this->execQuery($query, $parametersArray); } -} \ No newline at end of file +} diff --git a/application/models/crm/Dokumentprestudent_model.php b/application/models/crm/Dokumentprestudent_model.php index 720c976e6..001df404b 100644 --- a/application/models/crm/Dokumentprestudent_model.php +++ b/application/models/crm/Dokumentprestudent_model.php @@ -12,10 +12,13 @@ class Dokumentprestudent_model extends DB_Model $this->pk = array('prestudent_id', 'dokument_kurzbz'); } + /** + * setAccepted + */ public function setAccepted($prestudent_id, $studiengang_kz) { - if (($isEntitled = $this->isEntitled('public.tbl_dokumentprestudent', PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_dokumentprestudent', PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $result = null; @@ -41,10 +44,13 @@ class Dokumentprestudent_model extends DB_Model return $result; } + /** + * setAcceptedDocuments + */ public function setAcceptedDocuments($prestudent_id, $dokument_kurzbz) { - if (($isEntitled = $this->isEntitled('public.tbl_dokumentprestudent', PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_dokumentprestudent', PermissionLib::INSERT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $result = null; @@ -68,4 +74,4 @@ class Dokumentprestudent_model extends DB_Model return $result; } -} \ No newline at end of file +} diff --git a/application/models/crm/Dokumentstudiengang_model.php b/application/models/crm/Dokumentstudiengang_model.php index e96bd6e55..697920409 100644 --- a/application/models/crm/Dokumentstudiengang_model.php +++ b/application/models/crm/Dokumentstudiengang_model.php @@ -12,11 +12,13 @@ class Dokumentstudiengang_model extends DB_Model $this->pk = array('studiengang_kz', 'dokument_kurzbz'); } + /** + * getDokumentstudiengangByStudiengang_kz + */ public function getDokumentstudiengangByStudiengang_kz($studiengang_kz, $onlinebewerbung = null, $pflicht = null, $nachreichbar = null) { // Checks if the operation is permitted by the API caller - if (($isEntitled = $this->isEntitled('public.tbl_dokument', 's', FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_dokument', 's', FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; $this->addJoin('public.tbl_dokument', 'dokument_kurzbz'); @@ -39,4 +41,4 @@ class Dokumentstudiengang_model extends DB_Model return $this->loadWhere($parameterArray); } -} \ No newline at end of file +} diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php index 39ad17da5..7e05eeccd 100644 --- a/application/models/crm/Prestudent_model.php +++ b/application/models/crm/Prestudent_model.php @@ -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) { // 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) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; + if (isError($ent = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; + if (isError($ent = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $query = 'SELECT * FROM public.tbl_prestudent p @@ -60,7 +58,7 @@ class Prestudent_model extends DB_Model } /** - * + * updateAufnahmegruppe */ public function updateAufnahmegruppe($prestudentIdArray, $aufnahmegruppe) { @@ -85,8 +83,12 @@ class Prestudent_model extends DB_Model * - stufe and aufnahmegruppe * - 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( 'p.person_id, prestudent_id, diff --git a/application/models/crm/Prestudentstatus_model.php b/application/models/crm/Prestudentstatus_model.php index beb5eb845..75f0269c5 100644 --- a/application/models/crm/Prestudentstatus_model.php +++ b/application/models/crm/Prestudentstatus_model.php @@ -14,17 +14,15 @@ class Prestudentstatus_model extends DB_Model } /** - * @return void + * getLastStatus */ public function getLastStatus($prestudent_id, $studiensemester_kurzbz = '', $status_kurzbz = '') { // 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) - return $isEntitled; - if (($isEntitled = $this->isEntitled('lehre.tbl_studienplan', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; + if (isError($ent = $this->isEntitled('lehre.tbl_studienplan', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; + if (isError($ent = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $query = 'SELECT tbl_prestudentstatus.*, bezeichnung AS studienplan_bezeichnung, @@ -53,10 +51,12 @@ class Prestudentstatus_model extends DB_Model } /** - * + * updateStufe */ 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( 'UPDATE public.tbl_prestudentstatus SET rt_stufe = ? @@ -82,8 +82,8 @@ class Prestudentstatus_model extends DB_Model public function getStatusByFilter($prestudent_id, $status_kurzbz = '', $ausbildungssemester = '', $studiensemester_kurzbz = '') { // 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) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $query = ' SELECT diff --git a/application/models/organisation/Studiengang_model.php b/application/models/organisation/Studiengang_model.php index 39b1249a2..a15191eab 100644 --- a/application/models/organisation/Studiengang_model.php +++ b/application/models/organisation/Studiengang_model.php @@ -13,15 +13,14 @@ class Studiengang_model extends DB_Model } /** - * + * getAllForBewerbung */ public function getAllForBewerbung() { // 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) - return $isEntitled; - if (($isEntitled = $this->isEntitled('bis.tbl_lgartcode', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; + if (isError($ent = $this->isEntitled('bis.tbl_lgartcode', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; + if (isError($ent = $this->isEntitled('lehre.vw_studienplan', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; $allForBewerbungQuery = 'SELECT DISTINCT studiengang_kz, typ, @@ -100,10 +99,12 @@ class Studiengang_model extends DB_Model } /** - * + * getStudienplan */ 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 $this->addJoin('lehre.tbl_studienordnung', 'studiengang_kz'); // 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() { + 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 $this->addJoin('lehre.tbl_studienordnung', 'studiengang_kz'); // 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 $this->addJoin( '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' ); // Ordering by studiengang_kz and studienplan_id @@ -166,7 +170,9 @@ class Studiengang_model extends DB_Model 'public.tbl_studiengang.aktiv = TRUE AND public.tbl_studiengang.onlinebewerbung = TRUE 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 lehre.tbl_studienplan.aktiv = TRUE' , @@ -180,10 +186,12 @@ class Studiengang_model extends DB_Model } /** - * + * getAppliedStudiengang */ 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 $this->addJoin('public.tbl_prestudent', 'studiengang_kz'); // Join table public.tbl_prestudentstatus @@ -227,10 +235,12 @@ class Studiengang_model extends DB_Model } /** - * + * getAppliedStudiengangFromNow */ 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 $this->addJoin('public.tbl_prestudent', 'studiengang_kz'); // Join table public.tbl_prestudentstatus @@ -278,20 +288,20 @@ class Studiengang_model extends DB_Model } /** - * + * getAvailableReihungstestByPersonId */ public function getAvailableReihungstestByPersonId($person_id) { - if (($isEntitled = $this->isEntitled('lehre.tbl_studienordnung', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; - if (($isEntitled = $this->isEntitled('lehre.tbl_studienplan', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_reihungstest', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('lehre.tbl_studienplan', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_reihungstest', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('lehre.tbl_studienordnung', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $this->addJoin('lehre.tbl_studienordnung', 'studiengang_kz'); @@ -334,4 +344,4 @@ class Studiengang_model extends DB_Model array('reihungstest') ); } -} \ No newline at end of file +} diff --git a/application/models/organisation/Studiensemester_model.php b/application/models/organisation/Studiensemester_model.php index 1c5119b2a..e3c1261ca 100644 --- a/application/models/organisation/Studiensemester_model.php +++ b/application/models/organisation/Studiensemester_model.php @@ -13,11 +13,13 @@ class Studiensemester_model extends DB_Model $this->hasSequence = false; } + /** + * getLastOrAktSemester + */ public function getLastOrAktSemester($days = 60) { // Checks rights - if (($isEntitled = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; if (!is_numeric($days)) { @@ -33,11 +35,13 @@ class Studiensemester_model extends DB_Model return $this->execQuery($query); } + /** + * getNextFrom + */ public function getNextFrom($studiensemester_kurzbz) { // Checks rights - if (($isEntitled = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; $query = 'SELECT studiensemester_kurzbz, start, @@ -55,13 +59,13 @@ class Studiensemester_model extends DB_Model } /** - * @return void + * getNearest */ public function getNearest($semester = '') { // 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) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.vw_studiensemester', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $query = 'SELECT studiensemester_kurzbz, start, @@ -86,4 +90,4 @@ class Studiensemester_model extends DB_Model return $this->execQuery($query); } -} \ No newline at end of file +} diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index 8298c0d1e..2ea9d4d25 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -12,28 +12,31 @@ class Person_model extends DB_Model $this->pk = 'person_id'; } + /** + * getPersonKontaktByZugangscode + */ public function getPersonKontaktByZugangscode($zugangscode, $email) { $this->addJoin('public.tbl_kontakt', 'person_id'); - + return $this->loadWhere(array('zugangscode' => $zugangscode, 'kontakt' => $email)); } /** - * + * checkBewerbung */ public function checkBewerbung($email, $studiensemester_kurzbz = null) { - if (($isEntitled = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_kontakt', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_benutzer', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - 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_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_kontakt', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_benutzer', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $checkBewerbungQuery = ''; $parametersArray = array($email, $email, $email); @@ -67,6 +70,9 @@ class Person_model extends DB_Model return $this->execQuery($checkBewerbungQuery, $parametersArray); } + /** + * updatePerson + */ public function updatePerson($person) { 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) { // 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) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_prestudent', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_prestudentstatus', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $this->addJoin('public.tbl_prestudent', 'person_id'); @@ -129,5 +135,4 @@ class Person_model extends DB_Model return $result; } - } diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php index 0cb3162c2..76e86b356 100644 --- a/application/models/system/Message_model.php +++ b/application/models/system/Message_model.php @@ -20,12 +20,12 @@ class Message_model extends DB_Model public function getMessagesByPerson($person_id, $all) { // 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) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $sql = 'SELECT m.message_id, m.person_id, @@ -68,7 +68,7 @@ class Message_model extends DB_Model } /** - * + * getMessageVars */ public function getMessageVars() { @@ -85,7 +85,7 @@ class Message_model extends DB_Model } /** - * + * getMsgVarsDataByPrestudentId */ 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)); } -} \ No newline at end of file +} diff --git a/application/models/system/Phrase_model.php b/application/models/system/Phrase_model.php index 13ae9aa19..775940a0c 100644 --- a/application/models/system/Phrase_model.php +++ b/application/models/system/Phrase_model.php @@ -13,15 +13,15 @@ class Phrase_model extends DB_Model } /** - * + * getPhrases */ public function getPhrases($app, $sprache, $phrase = null, $orgeinheit_kurzbz = null, $orgform_kurzbz = null) { // 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) - return $isEntitled; - if (($isEntitled = $this->isEntitled('system.tbl_phrasentext', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('system.tbl_phrase', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('system.tbl_phrasentext', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $parametersArray = array('app' => $app, 'sprache' => $sprache); @@ -60,4 +60,4 @@ class Phrase_model extends DB_Model return $this->execQuery($query, $parametersArray); } -} \ No newline at end of file +} diff --git a/application/models/system/Recipient_model.php b/application/models/system/Recipient_model.php index a76382925..790f7487e 100644 --- a/application/models/system/Recipient_model.php +++ b/application/models/system/Recipient_model.php @@ -19,14 +19,14 @@ class Recipient_model extends DB_Model public function getMessage($message_id, $person_id) { // 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) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_kontakt', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_kontakt', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $query = 'SELECT mr.message_id, mr.person_id, @@ -56,12 +56,12 @@ class Recipient_model extends DB_Model public function getMessageByToken($token) { // 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) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $sql = 'SELECT r.message_id, m.person_id as sender_id, @@ -90,14 +90,14 @@ class Recipient_model extends DB_Model public function getMessagesByPerson($person_id, $all) { // 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) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_person', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $sql = 'SELECT DISTINCT ON (r.message_id) r.message_id, m.person_id, @@ -152,14 +152,14 @@ class Recipient_model extends DB_Model // if same user if ($uid === getAuthUID()) { - if (($isEntitled = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; } // if different user, for reading messages from other users else { - if (($isEntitled = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; } // get Data @@ -208,12 +208,12 @@ class Recipient_model extends DB_Model public function getMessages($kontaktType, $sent, $limit = null, $message_id = null) { // 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) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_kontakt', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_msg_message', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_kontakt', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $query = 'SELECT mm.message_id, ks.kontakt as sender, @@ -266,10 +266,10 @@ class Recipient_model extends DB_Model public function getCountUnreadMessages($person_id) { // 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) - return $isEntitled; - if (($isEntitled = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled('public.tbl_msg_recipient', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; + if (isError($ent = $this->isEntitled('public.tbl_msg_status', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) + return $ent; $sql = 'SELECT COUNT(r.message_id) AS unreadMessages 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); } -} \ No newline at end of file +} diff --git a/application/models/system/Vorlage_model.php b/application/models/system/Vorlage_model.php index bca397825..380f26b99 100644 --- a/application/models/system/Vorlage_model.php +++ b/application/models/system/Vorlage_model.php @@ -12,14 +12,16 @@ class Vorlage_model extends DB_Model $this->pk = 'vorlage_kurzbz'; } + /** + * Returns mume types + */ public function getMimeTypes() { // Checks rights - if (($isEntitled = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; $query = 'SELECT DISTINCT mimetype FROM public.tbl_vorlage ORDER BY mimetype'; return $this->execQuery($query); } -} \ No newline at end of file +} diff --git a/application/models/system/Vorlagedokument_model.php b/application/models/system/Vorlagedokument_model.php index 23c0de329..e557d6e4d 100644 --- a/application/models/system/Vorlagedokument_model.php +++ b/application/models/system/Vorlagedokument_model.php @@ -13,13 +13,12 @@ class Vorlagedokument_model extends DB_Model } /** - * + * loadDokumenteFromVorlagestudiengang */ public function loadDokumenteFromVorlagestudiengang($vorlagestudiengang_id) { // Checks rights - if (($isEntitled = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) - return $isEntitled; + if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; $qry = 'SELECT vorlagedokument_id, sort, @@ -33,4 +32,4 @@ class Vorlagedokument_model extends DB_Model return $this->execQuery($qry, array($vorlagestudiengang_id)); } -} \ No newline at end of file +} diff --git a/tests/codesniffer/FHComplete/ruleset.xml b/tests/codesniffer/FHComplete/ruleset.xml index 80c043082..2940ce8b9 100644 --- a/tests/codesniffer/FHComplete/ruleset.xml +++ b/tests/codesniffer/FHComplete/ruleset.xml @@ -23,18 +23,19 @@ + - - - + + + - + From 809d65a62e21e8fa26b0c606dfb4f60d4a4db8db Mon Sep 17 00:00:00 2001 From: Andreas Oesterreicher Date: Tue, 22 Aug 2017 23:23:58 +0200 Subject: [PATCH 02/31] =?UTF-8?q?Der=20Mitarbeiterexport=20im=20FAS=20expo?= =?UTF-8?q?rtiert=20nun=20nicht=20mehr=20die=20Mitarbeiter=20des=20Ausgew?= =?UTF-8?q?=C3=A4hlten=20Filters=20sondern=20die=20markierten=20Mitarbeite?= =?UTF-8?q?r.=20Wenn=20keine=20Mitarbeiter=20markiert=20wurden=20werden=20?= =?UTF-8?q?alle=20angezeigten=20Mitarbeiter=20exportiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/mitarbeiter/mitarbeiteroverlay.js.php | 82 ++++++------- content/statistik/mitarbeiterexport.xls.php | 70 +++-------- include/mitarbeiter.class.php | 109 +++++++++++++++++- 3 files changed, 154 insertions(+), 107 deletions(-) diff --git a/content/mitarbeiter/mitarbeiteroverlay.js.php b/content/mitarbeiter/mitarbeiteroverlay.js.php index ca5e07508..ee77e42af 100644 --- a/content/mitarbeiter/mitarbeiteroverlay.js.php +++ b/content/mitarbeiter/mitarbeiteroverlay.js.php @@ -623,7 +623,7 @@ function MitarbeiterAuswahl() // ***** Termine ***** document.getElementById('mitarbeiter-termine').setAttribute('src','termine.xul.php?mitarbeiter_uid='+uid); } - + // ***** UDF ***** if (document.getElementById('mitarbeiter-tabs').selectedItem == document.getElementById('mitarbeiter-tab-udf')) { @@ -915,56 +915,48 @@ function MitarbeiterNeu() } // **** -// * Exportiert die Daten in ein Excel File +// * Excel Export der Mitarbeiter // **** function MitarbeiterExport() { - var treeMitarbeiter=document.getElementById('mitarbeiter-tree'); - var treeMitarbeiterMenu=document.getElementById('tree-menu-mitarbeiter'); - var col = treeMitarbeiterMenu.columns ? treeMitarbeiterMenu.columns["tree-menu-mitarbeiter-col-filter"] : "tree-menu-mitarbeiter-col-filter"; - var filter=treeMitarbeiterMenu.view.getCellText(treeMitarbeiterMenu.currentIndex,col); - cols = treeMitarbeiter.getElementsByTagName('treecol'); - - var url = "content/statistik/mitarbeiterexport.xls.php"; - var attributes="?type=mitarbeiter"; - if (filter=="Studiengangsleiter") - attributes+="&stgl=true"; - if (filter=="Fachbereichsleiter") - attributes+="&fbl=true"; - if (filter=="Alle") - attributes+="&alle=true"; - if (filter=="Aktive") - attributes+="&aktiv=true"; - if (filter=="FixAngestellte") - attributes+="&fix=true&aktiv=true"; - if (filter=="FixAngestellteAlle") - attributes+="&fix=true"; - if (filter=="Inaktive") - attributes+="&aktiv=false"; - if (filter=="Karenziert") - attributes+="&karenziert=true"; - if (filter=="Ausgeschieden") - attributes+="&ausgeschieden=true"; - if (filter=="FreiAngestellte") - attributes+="&fix=false&aktiv=true"; - if (filter=="FreiAngestellteAlle") - attributes+="&fix=false"; - - url+=attributes; - spalte=0; - for(i in cols) + var tree = document.getElementById('mitarbeiter-tree'); + var data=''; + //Wenn nichts markiert wurde -> alle exportieren + if(tree.currentIndex==-1) { - if(cols[i].hidden==false) + if(tree.view) + var items = tree.view.rowCount; //Anzahl der Zeilen ermitteln + else + return false; + + for (var v=0; v < items; v++) { - url += "&spalte"+spalte+"="+MitarbeiterDetailgetSpaltenname(cols[i].id); - spalte=spalte+1; + var mitarbeiter_uid = getTreeCellText(tree, 'mitarbeiter-treecol-uid', v); + data = data+';'+mitarbeiter_uid; } } - //url+='&spalte0=titelpre&spalte1=vorname&spalte2=vornamen&spalte3=familienname&spalte4=uid'; + else + { + var start = new Object(); + var end = new Object(); + var numRanges = tree.view.selection.getRangeCount(); + var paramList= ''; + var anzahl=0; - //alert(url); - //window.open(url,"","chrome,status=no, modal, width=400, height=250, centerscreen, resizable"); - window.location.href=url; + //alle markierten personen holen + for (var t = 0; t < numRanges; t++) + { + tree.view.selection.getRangeAt(t,start,end); + for (var v = start.value; v <= end.value; v++) + { + mitarbeiter_uid = getTreeCellText(tree, 'mitarbeiter-treecol-uid', v); + data = data+';'+mitarbeiter_uid; + } + } + } + + action = 'content/statistik/mitarbeiterexport.xls.php'; + OpenWindowPost(action, data); } // **** @@ -1992,9 +1984,9 @@ function MitarbeiterUDFIFrameLoad() { //Ausgewaehlte person_id holen var person_id = getTreeCellText(tree, 'mitarbeiter-treecol-person_id', tree.currentIndex); - + url = 'udf.xul.php?person_id='+person_id; document.getElementById('mitarbeiter-udf').setAttribute('src', url); } catch(e) {} -} \ No newline at end of file +} diff --git a/content/statistik/mitarbeiterexport.xls.php b/content/statistik/mitarbeiterexport.xls.php index 3c943cde8..e21e4a1c2 100644 --- a/content/statistik/mitarbeiterexport.xls.php +++ b/content/statistik/mitarbeiterexport.xls.php @@ -36,59 +36,13 @@ $db = new basis_db(); $user = get_uid(); loadVariables($user); -//Parameter holen - -if (isset($_GET['fix'])) - $fix = $_GET['fix']; -else - $fix=null; - -if (isset($_GET['stgl'])) - $stgl = ($_GET['stgl'] == 'true' ? true : false); -else - $stgl=null; - -if (isset($_GET['fbl'])) - $fbl = $_GET['fbl']; -else - $fbl=null; - -if (isset($_GET['aktiv'])) - $aktiv = $_GET['aktiv']; -else - $aktiv=null; - -if (isset($_GET['karenziert'])) - $karenziert = $_GET['karenziert']; -else - $karenziert=null; - -if (isset($_GET['ausgeschieden'])) - $ausgeschieden = $_GET['ausgeschieden']; -else - $ausgeschieden=null; - -if (isset($_GET['zustelladresse'])) - $zustelladresse = $_GET['zustelladresse']; -else - $zustelladresse = null; - -// Die Spalten die Exportiert werden sollen, werden per GET uebergeben -// spalte1=nachname, spalte2=vorname, spalte3=gebdatum, ... -$anzSpalten = 0; -$varname = 'spalte'.(string)$anzSpalten; -while (isset($_GET[$varname])) -{ - $spalte[$anzSpalten] = $_GET[$varname]; - $anzSpalten++; - $varname = 'spalte'.(string)$anzSpalten; -} - -$zustelladresse = true; +$data = $_POST['data']; +$uids= explode(';',$data); // Mitarbeiter holen $mitarbeiterDAO = new mitarbeiter(); -$mitarbeiterDAO->getPersonal($fix, $stgl, $fbl, $aktiv, $karenziert, $ausgeschieden, $semester_aktuell); +//$mitarbeiterDAO->getPersonal($fix, $stgl, $fbl, $aktiv, $karenziert, $ausgeschieden, $semester_aktuell); +$mitarbeiterDAO->getMitarbeiterArray($uids); //Sortieren der Eintraege nach Nachname, Vorname //Umlaute werden ersetzt damit diese nicht unten angereiht werden @@ -106,6 +60,10 @@ foreach ($mitarbeiterDAO->result as $key => $foo) array_multisort($nachname, SORT_ASC, $vorname, SORT_ASC, $mitarbeiterDAO->result); +$spalte = array('titelpre', 'vorname', 'vornamen', 'nachname', 'titelpost','gebdatum','svnr','ersatzkennzeichen', + 'aktiv','personalnummer', 'kurzbz','fixangestellt','lektor'); +$anzSpalten = count($spalte); + // Creating a workbook $workbook = new Spreadsheet_Excel_Writer(); $workbook->setVersion(8); @@ -193,7 +151,7 @@ foreach ($mitarbeiterDAO->result as $mitarbeiter) if (mb_strlen($row->ort) > $maxlength[$col]) $maxlength[$col] = mb_strlen($row->ort); $worksheet->write($zeile, $col, $row->ort); - + $col++; if ($row->firma_id != '') { @@ -210,15 +168,15 @@ foreach ($mitarbeiterDAO->result as $mitarbeiter) } } } - + $col++; - + // UDF if (isset($mitarbeiter->p_udf_values)) { $udfPerson = json_decode($mitarbeiter->p_udf_values); if (is_object($udfPerson)) $udfPerson = (array)$udfPerson; - + foreach($udfTitlesPerson as $udfTitle) { if (isset($udfPerson[$udfTitle['name']])) @@ -234,7 +192,7 @@ foreach ($mitarbeiterDAO->result as $mitarbeiter) else if(is_array($udfPerson[$udfTitle['name']]) && isset($udfTitle['enum'])) { $toWrite = $udf->dropdownListValuesToString($udfPerson[$udfTitle['name']], $udfTitle['enum']); - + if (mb_strlen($toWrite) > $maxlength[$col]) { $maxlength[$col] = mb_strlen($toWrite); @@ -263,4 +221,4 @@ $worksheet->setColumn($col, $col, $maxlength[$col] + 2); $workbook->close(); -?> \ No newline at end of file +?> diff --git a/include/mitarbeiter.class.php b/include/mitarbeiter.class.php index 77fbc5702..c9a53f902 100644 --- a/include/mitarbeiter.class.php +++ b/include/mitarbeiter.class.php @@ -647,25 +647,25 @@ class mitarbeiter extends benutzer { $hasUDF = false; $udf = new UDF(); - + $qry = "SELECT DISTINCT ON(mitarbeiter_uid) *, tbl_benutzer.aktiv as aktiv, tbl_mitarbeiter.insertamum, tbl_mitarbeiter.insertvon, tbl_mitarbeiter.updateamum, tbl_mitarbeiter.updatevon"; - + if ($hasUDF = $udf->personHasUDF()) { $qry .= ", public.tbl_person.udf_values AS p_udf_values"; } - + $qry .= " FROM ((public.tbl_mitarbeiter JOIN public.tbl_benutzer ON(mitarbeiter_uid=uid)) JOIN public.tbl_person USING(person_id)) LEFT JOIN public.tbl_benutzerfunktion USING(uid) LEFT JOIN campus.tbl_resturlaub USING(mitarbeiter_uid) WHERE true"; - + if($fix=='true') $qry .= " AND fixangestellt=true"; if($fix=='false') @@ -740,7 +740,7 @@ class mitarbeiter extends benutzer $qry.=';'; - + if($this->db_query($qry)) { while($row = $this->db_fetch_object()) @@ -793,7 +793,7 @@ class mitarbeiter extends benutzer { $obj->p_udf_values = $row->p_udf_values; } - + $this->result[] = $obj; } return true; @@ -1324,5 +1324,102 @@ class mitarbeiter extends benutzer return false; } } + + /** + * Laedt die Mitarbeiter die uebergeben werden + * + * @param $uid_arr + * @return boolean + */ + public function getMitarbeiterArray($uid_arr) + { + if(count($uid_arr)==0) + return true; + + $hasUDF = false; + $udf = new UDF(); + + $qry = "SELECT DISTINCT ON(mitarbeiter_uid) *, + tbl_benutzer.aktiv as aktiv, + tbl_mitarbeiter.insertamum, + tbl_mitarbeiter.insertvon, + tbl_mitarbeiter.updateamum, + tbl_mitarbeiter.updatevon"; + + if ($hasUDF = $udf->personHasUDF()) + { + $qry .= ", public.tbl_person.udf_values AS p_udf_values"; + } + + $qry .= " FROM ((public.tbl_mitarbeiter JOIN public.tbl_benutzer ON(mitarbeiter_uid=uid)) + JOIN public.tbl_person USING(person_id)) + LEFT JOIN public.tbl_benutzerfunktion USING(uid) + LEFT JOIN campus.tbl_resturlaub USING(mitarbeiter_uid) + WHERE uid in(".$this->db_implode4SQL($uid_arr).")";; + + if($this->db_query($qry)) + { + while($row = $this->db_fetch_object()) + { + $obj = new mitarbeiter(); + + $obj->person_id = $row->person_id; + $obj->staatsbuergerschaft = $row->staatsbuergerschaft; + $obj->geburtsnation = $row->geburtsnation; + $obj->sprache = $row->sprache; + $obj->anrede = $row->anrede; + $obj->titelpost = $row->titelpost; + $obj->titelpre = $row->titelpre; + $obj->nachname = $row->nachname; + $obj->vorname = $row->vorname; + $obj->vornamen = $row->vornamen; + $obj->gebdatum = $row->gebdatum; + $obj->gebort = $row->gebort; + $obj->gebzeit = $row->gebzeit; + $obj->anmerkung = $row->anmerkung; + $obj->homepage = $row->homepage; + $obj->svnr = $row->svnr; + $obj->ersatzkennzeichen = $row->ersatzkennzeichen; + $obj->familienstand = $row->familienstand; + $obj->geschlecht = $row->geschlecht; + $obj->anzahlkinder = $row->anzahlkinder; + $obj->bnaktiv = $this->db_parse_bool($row->aktiv); + $obj->uid = $row->uid; + $obj->personalnummer = $row->personalnummer; + $obj->telefonklappe = $row->telefonklappe; + $obj->kurzbz = $row->kurzbz; + $obj->lektor = $this->db_parse_bool($row->lektor); + $obj->fixangestellt = $this->db_parse_bool($row->fixangestellt); + $obj->bismelden = $this->db_parse_bool($row->bismelden); + $obj->stundensatz = $row->stundensatz; + $obj->ausbildungcode = $row->ausbildungcode; + $obj->ort_kurzbz = $row->ort_kurzbz; + $obj->standort_id = $row->standort_id; + $obj->anmerkung = $row->anmerkung; + $obj->alias = $row->alias; + $obj->insertamum = $row->insertamum; + $obj->insertvon = $row->insertvon; + $obj->updateamum = $row->updateamum; + $obj->updatevon = $row->updatevon; + + $obj->urlaubstageprojahr = $row->urlaubstageprojahr; + $obj->resturlaubstage = $row->resturlaubstage; + + if ($hasUDF) + { + $obj->p_udf_values = $row->p_udf_values; + } + + $this->result[] = $obj; + } + return true; + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } + } ?> From 3181d3741e64de2e055f066e82ee9137582a1a59 Mon Sep 17 00:00:00 2001 From: Andreas Oesterreicher Date: Tue, 22 Aug 2017 23:25:56 +0200 Subject: [PATCH 03/31] fixed Typo --- CHANGELOG.md | 1 + content/mitarbeiter/mitarbeiteroverlay.xul.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73a56f5dd..61be20952 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ ### CHANGED - **[CORE]** Berechtigungsprüfung wurde angepasst damit deaktivierte Benutzer keine Berechtigungen mehr haben +- **[FAS]** Mitarbeiterexport exportiert jetzt nur noch die markierten Personen ### Updateinfo - **[CORE]** Infoscreen wurde umbenannt (informationsbildschirm.php) diff --git a/content/mitarbeiter/mitarbeiteroverlay.xul.php b/content/mitarbeiter/mitarbeiteroverlay.xul.php index 2104471fe..51ac61ddf 100644 --- a/content/mitarbeiter/mitarbeiteroverlay.xul.php +++ b/content/mitarbeiter/mitarbeiteroverlay.xul.php @@ -66,7 +66,7 @@ echo ' - +
- - - - - - - -
- widgetlib->widget( - 'Studiengang_widget', - array(DropdownWidget::SELECTED_ELEMENT => $studiengang), - array('name' => 'studiengang', 'id' => 'studiengangFilter') - ); - ?> - - widgetlib->widget( - 'Studiensemester_widget', - array(DropdownWidget::SELECTED_ELEMENT => $studiensemester), - array('name' => 'studiensemester', 'id' => 'studiensemesterFilter') - ); - ?> - - widgetlib->widget( - 'Reihungstest_widget', - array( - DropdownWidget::SELECTED_ELEMENT => $reihungstest, - 'studiengang' => $studiengang, - 'studiensemester' => $studiensemester - ), - array('name' => 'reihungstest', 'id' => 'reihungstestFilter') - ); - ?> - - widgetlib->widget( - 'Aufnahmegruppe_widget', - array(DropdownWidget::SELECTED_ELEMENT => $aufnahmegruppe), - array('name' => 'aufnahmegruppe', 'id' => 'aufnahmegruppeFilter') - ); - ?> - - widgetlib->widget( - 'Stufe_widget', - array(DropdownWidget::SELECTED_ELEMENT => $stufe), - array('name' => 'stufe', 'id' => 'stufeFilter') - ); - ?> -
- - -
- -
- - - - - - - - - - - - - - - - - -
- Assign to: -
- widgetlib->widget( - 'Stufe_widget', - array('stufe' => $stufe), - array('name' => 'stufe', 'id' => 'stufeAssign') - ); - ?> -   - -
- widgetlib->widget( - 'Aufnahmegruppe_widget', - array('aufnahmegruppe' => $aufnahmegruppe), - array('name' => 'aufnahmegruppe', 'id' => 'aufnahmegruppeAssign') - ); - ?> -   - -
- -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Prestudent IDPerson IDVornameNachnameGeschlechtStudiengangOrgFormStudienplanGeburtsdatumEmailStufeGruppePunkte
- - - prestudent_id; ?> - - person_id; ?> - - vorname; ?> - - nachname; ?> - - geschlecht; ?> - - kurzbzlang; ?> - - orgform_kurzbz; ?> - - studienplan; ?> - - gebdatum; ?> - - email; ?> - - rt_stufe; ?> - - aufnahmegruppe_kurzbz; ?> - - punkte; ?> -
- -
-
- - - - - - -load->view("templates/footer"); ?> \ No newline at end of file +load->view("templates/header", array("title" => "Users manager", "jquery19" => true, "tablesort" => true, "jquery_checkboxes" => true, "jquery_custom" => true)); ?> + + +
+ + + + + + + + +
+ widgetlib->widget( + 'Studiengang_widget', + array(DropdownWidget::SELECTED_ELEMENT => $studiengang), + array('name' => 'studiengang', 'id' => 'studiengangFilter') + ); + ?> + + widgetlib->widget( + 'Studiensemester_widget', + array(DropdownWidget::SELECTED_ELEMENT => $studiensemester), + array('name' => 'studiensemester', 'id' => 'studiensemesterFilter') + ); + ?> + + widgetlib->widget( + 'Reihungstest_widget', + array( + DropdownWidget::SELECTED_ELEMENT => $reihungstest, + 'studiengang' => $studiengang, + 'studiensemester' => $studiensemester + ), + array('name' => 'reihungstest', 'id' => 'reihungstestFilter') + ); + ?> + + widgetlib->widget( + 'Aufnahmegruppe_widget', + array(DropdownWidget::SELECTED_ELEMENT => $aufnahmegruppe), + array('name' => 'aufnahmegruppe', 'id' => 'aufnahmegruppeFilter') + ); + ?> + + widgetlib->widget( + 'Stufe_widget', + array(DropdownWidget::SELECTED_ELEMENT => $stufe), + array('name' => 'stufe', 'id' => 'stufeFilter') + ); + ?> +
+
+ +
+ +
+ + + + + + + + + + + + + + + + + +
+ Assign to: +
+ widgetlib->widget( + 'Stufe_widget', + array('stufe' => $stufe), + array('name' => 'stufe', 'id' => 'stufeAssign') + ); + ?> +   + +
+ widgetlib->widget( + 'Aufnahmegruppe_widget', + array('aufnahmegruppe' => $aufnahmegruppe), + array('name' => 'aufnahmegruppe', 'id' => 'aufnahmegruppeAssign') + ); + ?> +   + +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 Prestudent IDPerson IDVornameNachnameGeschlechtStudiengangOrgFormStudienplanGeburtsdatumEmailStufeGruppePunkte
+ + + prestudent_id; ?> + + person_id; ?> + + vorname; ?> + + nachname; ?> + + geschlecht; ?> + + kurzbzlang; ?> + + orgform_kurzbz; ?> + + studienplan; ?> + + gebdatum; ?> + + email; ?> + + rt_stufe; ?> + + aufnahmegruppe_kurzbz; ?> + + punkte; ?> +
+ +
+
+ + + + + + +load->view("templates/footer"); ?> diff --git a/application/views/system/messageWrite.php b/application/views/system/messageWrite.php index 4f4ea7427..b5424e09f 100644 --- a/application/views/system/messageWrite.php +++ b/application/views/system/messageWrite.php @@ -1,286 +1,286 @@ -load->view("templates/header", array("title" => "MessageReply", "jquery" => true, "tinymce" => true)); ?> - - - - - -
- - - - - - - - - - - - - -
- To: - - 1 && $i % 10 == 0) - { - echo '
'; - } - echo $receiver->Vorname . " " . $receiver->Nachname . "; "; - } - ?> -
- Subject:  - - subject; - } - ?> - -
- - - - - - - -
- Message:
- body; - } - ?> - -
  - -
- Variables:
- -
- -
- - - - - - - -
- widgetlib->widget( - 'Vorlage_widget', - array('oe_kurzbz' => $oe_kurzbz, 'isAdmin' => $isAdmin), - array('name' => 'vorlage', 'id' => 'vorlageDnD') - ); - ?> - -   - - -
- -
- - 0) - { - ?> -
- Preview: -
-
- - - - - - - - - - -
- Recipient: - -   - Refresh -
-   -
- -
-
- - - prestudent_id . '">' . "\n"; - } - ?> - - - - - -
- - - - - -load->view("templates/footer"); ?> \ No newline at end of file +load->view("templates/header", array("title" => "MessageReply", "jquery19" => true, "tinymce" => true)); ?> + + + + + +
+ + + + + + + + + + + + + +
+ To: + + 1 && $i % 10 == 0) + { + echo '
'; + } + echo $receiver->Vorname . " " . $receiver->Nachname . "; "; + } + ?> +
+ Subject:  + + subject; + } + ?> + +
+ + + + + + + +
+ Message:
+ body; + } + ?> + +
  + +
+ Variables:
+ +
+ +
+ + + + + + + +
+ widgetlib->widget( + 'Vorlage_widget', + array('oe_kurzbz' => $oe_kurzbz, 'isAdmin' => $isAdmin), + array('name' => 'vorlage', 'id' => 'vorlageDnD') + ); + ?> + +   + + +
+ +
+ + 0) + { + ?> +
+ Preview: +
+
+ + + + + + + + + + +
+ Recipient: + +   + Refresh +
+   +
+ +
+
+ + + prestudent_id . '">' . "\n"; + } + ?> + + + + + +
+ + + + + +load->view("templates/footer"); ?> diff --git a/application/views/templates/header.php b/application/views/templates/header.php index 9e47c6fff..59ddde80f 100644 --- a/application/views/templates/header.php +++ b/application/views/templates/header.php @@ -2,7 +2,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); isset($title) ? $title = 'VileSci - '.$title : $title = 'VileSci'; -!isset($jquery) ? $jquery = false : $jquery = $jquery; +!isset($jquery19) ? $jquery19 = false : $jquery19 = $jquery19; !isset($jqueryComposer) ? $jqueryComposer = false : $jqueryComposer = $jqueryComposer; !isset($jqueryui) ? $jqueryui = false : $jqueryui = $jqueryui; !isset($jquery_checkboxes) ? $jquery_checkboxes = false : $jquery_checkboxes = $jquery_checkboxes; @@ -19,7 +19,7 @@ isset($title) ? $title = 'VileSci - '.$title : $title = 'VileSci'; !isset($datepicker) ? $datepicker = false : $datepicker = $datepicker; if ($tablesort || $jquery_checkboxes || $jquery_custom) - $jquery = true; + $jquery19 = true; if($datepicker) $jqueryui = true; @@ -27,7 +27,7 @@ if($datepicker) if($jqueryui) $jqueryComposer = true; -if($jquery && $jqueryComposer) +if($jquery19 && $jqueryComposer) show_error("Two JQuery versions used: composer and include folder version"); ?> @@ -42,7 +42,7 @@ if($jquery && $jqueryComposer) - + From 10f263aaa5def4a73ef25bfa3e98ee8033939d67 Mon Sep 17 00:00:00 2001 From: Paolo Date: Fri, 25 Aug 2017 14:17:35 +0200 Subject: [PATCH 09/31] Renamed widget vorlage_widget.php into Vorlage_widget.php --- application/widgets/{vorlage_widget.php => Vorlage_widget.php} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename application/widgets/{vorlage_widget.php => Vorlage_widget.php} (99%) diff --git a/application/widgets/vorlage_widget.php b/application/widgets/Vorlage_widget.php similarity index 99% rename from application/widgets/vorlage_widget.php rename to application/widgets/Vorlage_widget.php index 91cba301f..f92b49fcd 100644 --- a/application/widgets/vorlage_widget.php +++ b/application/widgets/Vorlage_widget.php @@ -125,4 +125,4 @@ class Vorlage_widget extends DropdownWidget return $vorlage; } -} \ No newline at end of file +} From add7ebb15d096a7a0fc2017e0aae205f7317ab22 Mon Sep 17 00:00:00 2001 From: Paolo Date: Fri, 25 Aug 2017 14:46:25 +0200 Subject: [PATCH 10/31] Removed unused files from include directory --- include/js/CSS and JavaScript.txt | 50 -- include/js/jquery-barcode-1.3.3.js | 828 ------------------------- include/js/jquery-barcode-1.3.3.min.js | 15 - include/js/jquery.idTabs.min.js | 12 - include/js/jquery.tools.min.js | 38 -- include/js/sorttable.js | 493 --------------- 6 files changed, 1436 deletions(-) delete mode 100644 include/js/CSS and JavaScript.txt delete mode 100644 include/js/jquery-barcode-1.3.3.js delete mode 100644 include/js/jquery-barcode-1.3.3.min.js delete mode 100644 include/js/jquery.idTabs.min.js delete mode 100644 include/js/jquery.tools.min.js delete mode 100644 include/js/sorttable.js diff --git a/include/js/CSS and JavaScript.txt b/include/js/CSS and JavaScript.txt deleted file mode 100644 index 741eff8e0..000000000 --- a/include/js/CSS and JavaScript.txt +++ /dev/null @@ -1,50 +0,0 @@ -CSS FILES -***************************** -in einzubindender Reihenfolge -Alle CSS Files im Ordner trunk/skin - -jquery.css - ->autocomplete - ->datepicker - -tabelsort.css - ->tablesort - -fhcomplete.css - -wawi/cis/fas.css - - -JS FILES -***************************** -in einzubindender Reihenfolge -Alle JS Files im Ordner trunk/include/js - - - -// DEPRECATED NICHT MEHR VERWENDEN! -jquery.js - ->autocomplete (Plugin Version) - ->datepicker - ->tablesorter - ->Deutsches Schema fuer datepicker - - - -jquery1.9.min.js - -> jqueryUI (autocomplete, datepicker, etc) - -> Deutsches Schema für datepicker - -> tablesorter - - -Tablesorter -************** -$(document).ready(function() -{ - $("#t1").tablesorter( - { - sortList: [[2,1]], - widgets: ["zebra"] - }); -}); - diff --git a/include/js/jquery-barcode-1.3.3.js b/include/js/jquery-barcode-1.3.3.js deleted file mode 100644 index 65f91b092..000000000 --- a/include/js/jquery-barcode-1.3.3.js +++ /dev/null @@ -1,828 +0,0 @@ -/* - * BarCode Coder Library (BCC Library) - * BCCL Version 1.0 - * - * Porting : Jquery barcode plugin - * Version : 1.3.3 - * - * Date : October 17 2009 - * Author : DEMONTE Jean-Baptiste (firejocker) - * Contact : jbdemonte @ gmail.com - * Web site: http://barcode-coder.com/ - * dual licence : http://www.cecill.info/licences/Licence_CeCILL_V2-fr.html - * http://www.gnu.org/licenses/gpl.html - * - * Managed : - * - * standard 2 of 5 (std25) - * interleaved 2 of 5 (int25) - * ean 8 (ean8) - * ean 13 (ean13) - * code 11 (code11) - * code 39 (code39) - * code 93 (code93) - * code 128 (code128) - * codabar (codabar) - * msi (msi) - * - * Output : - * - * CSS (compatible with any browser) - To print, you must set the option in your browser "print background image" - * SVG inline (not compatible with IE) - * BMP inline (not compatible with IE) - * - * - * 1.1 - 2009/05/26 - * -> std25 fixed - * - * 1.2 - 2009/09/10 - * parseInt replaced by intval (nb: parseInt("09") => 0) - * code128 fixed (C Table analyse) - * Thanks to Vadim for the bug reporting - * 1.3 - 2009/09/26 - * add bmp and svg image renderer - * 1.3.2 - 2009/10/03 - * manage int and string formated values for barcode width/height - * 1.3.3 - 2009/10/17 - * no wait document is ready to add plugin - * - */ - -$.barcode = { - settings:{ - barWidth: 1, - barHeight: 50, - showHRI: true, - marginHRI: 5, - bgColor: "#FFFFFF", - color: "#000000", - fontSize: "10px", - output: "css" - }, - intval: function(val){ - var type = typeof( val ); - if (type == 'string'){ - val = val.replace(/[^0-9-.]/g, ""); - val = parseInt(val * 1, 10); - if (isNaN(val) || !isFinite(val)){ - return 0; - } else{ - return val; - } - } else if (type == 'number' && isFinite(val) ){ - return Math.floor(val); - } else{ - return 0; - } - }, - i25: { // std25 int25 - encoding: [ "NNWWN", "WNNNW", "NWNNW", "WWNNN", "NNWNW", - "WNWNN", "NWWNN", "NNNWW", "WNNWN","NWNWN"], - compute: function(code, crc, type){ - if (! crc) { - if (code.length % 2 != 0) code = '0' + code; - } else { - if ( (type == "int25") && (code.length % 2 == 0) ) code = '0' + code; - var odd = true, v, sum = 0; - for(var i=code.length-1; i>-1; i--){ - v = $.barcode.intval(code.charAt(i)); - if (isNaN(v)) return(""); - sum += odd ? 3 * v : v; - odd = ! odd; - } - code += ((10 - sum % 10) % 10).toString(); - } - return(code); - }, - getDigit: function(code, crc, type){ - code = this.compute(code, crc, type); - if (code == "") return(""); - result = ""; - - var i, j; - if (type == "int25") { - // Interleaved 2 of 5 - - // start - result += "1010"; - - // digits + CRC - var c1, c2; - for(i=0; i '9') ){ - return(""); - } - } - // get checksum - code = this.compute(code, type); - - // process analyse - var result = "101"; // start - - if (type == "ean8"){ - - // process left part - for(var i=0; i<4; i++){ - result += this.encoding[$.barcode.intval(code.charAt(i))][0]; - } - - // center guard bars - result += "01010"; - - // process right part - for(var i=4; i<8; i++){ - result += this.encoding[$.barcode.intval(code.charAt(i))][2]; - } - - } else { // ean13 - // extract first digit and get sequence - var seq = this.first[ $.barcode.intval(code.charAt(0)) ]; - - // process left part - for(var i=1; i<7; i++){ - result += this.encoding[$.barcode.intval(code.charAt(i))][ $.barcode.intval(seq.charAt(i-1)) ]; - } - - // center guard bars - result += "01010"; - - // process right part - for(var i=7; i<13; i++){ - result += this.encoding[$.barcode.intval(code.charAt(i))][ 2 ]; - } - } // ean13 - - result += "101"; // stop - return(result); - }, - compute: function (code, type){ - var len = type == "ean13" ? 12 : 7; - code = code.substring(0, len); - var sum = 0, odd = true; - for(i=code.length-1; i>-1; i--){ - sum += (odd ? 3 : 1) * $.barcode.intval(code.charAt(i)); - odd = ! odd; - } - return(code + ((10 - sum % 10) % 10).toString()); - } - }, - msi: { - encoding:[ "100100100100", "100100100110", "100100110100", "100100110110", - "100110100100", "100110100110", "100110110100", "100110110110", - "110100100100", "110100100110"], - compute: function(code, crc){ - if (typeof(crc) == "object"){ - if (crc.crc1 == "mod10"){ - code = this.computeMod10(code); - } else if (crc.crc1 == "mod11"){ - code = this.computeMod11(code); - } - if (crc.crc2 == "mod10"){ - code = this.computeMod10(code); - } else if (crc.crc2 == "mod11"){ - code = this.computeMod11(code); - } - } else if (typeof(crc) == "boolean"){ - if (crc){ - code = this.computeMod10(code); - } - } - return(code); - }, - computeMod10:function(code){ - var i, - toPart1 = code.length % 2; - var n1 = 0, sum = 0; - for(i=0; i=0; i--){ - sum += weight * $.barcode.intval(code.charAt(i)); - weight = weight == 7 ? 2 : weight + 1; - } - return(code + ((11 - sum % 11) % 11).toString()); - }, - getDigit: function(code, crc){ - var table = "0123456789"; - var index = 0; - var result = ""; - - code = this.compute(code, false); - - // start - result = "110"; - - // digits - for(i=0; i=0; i--){ - weightC = weightC == 10 ? 1 : weightC + 1; - weightK = weightK == 10 ? 1 : weightK + 1; - - index = table.indexOf( code.charAt(i) ); - - weightSumC += weightC * index; - weightSumK += weightK * index; - } - - var c = weightSumC % 11; - weightSumK += c; - var k = weightSumK % 11; - - result += this.encoding[c] + intercharacter; - - if (code.length >= 10){ - result += this.encoding[k] + intercharacter; - } - - // stop - result += "1011001"; - - return(result); - } - }, - code39: { - encoding:[ "101001101101", "110100101011", "101100101011", "110110010101", - "101001101011", "110100110101", "101100110101", "101001011011", - "110100101101", "101100101101", "110101001011", "101101001011", - "110110100101", "101011001011", "110101100101", "101101100101", - "101010011011", "110101001101", "101101001101", "101011001101", - "110101010011", "101101010011", "110110101001", "101011010011", - "110101101001", "101101101001", "101010110011", "110101011001", - "101101011001", "101011011001", "110010101011", "100110101011", - "110011010101", "100101101011", "110010110101", "100110110101", - "100101011011", "110010101101", "100110101101", "100100100101", - "100100101001", "100101001001", "101001001001", "100101101101"], - getDigit: function(code){ - var table = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*"; - var i, index, result="", intercharacter='0'; - - if (code.indexOf('*') >= 0) return(""); - - // Add Start and Stop charactere : * - code = ("*" + code + "*").toUpperCase(); - - for(i=0; i 0) result += intercharacter; - result += this.encoding[ index ]; - } - return(result); - } - }, - code93:{ - encoding:[ "100010100", "101001000", "101000100", "101000010", - "100101000", "100100100", "100100010", "101010000", - "100010010", "100001010", "110101000", "110100100", - "110100010", "110010100", "110010010", "110001010", - "101101000", "101100100", "101100010", "100110100", - "100011010", "101011000", "101001100", "101000110", - "100101100", "100010110", "110110100", "110110010", - "110101100", "110100110", "110010110", "110011010", - "101101100", "101100110", "100110110", "100111010", - "100101110", "111010100", "111010010", "111001010", - "101101110", "101110110", "110101110", "100100110", - "111011010", "111010110", "100110010", "101011110"], - getDigit: function(code, crc){ - var table = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%____*", // _ => ($), (%), (/) et (+) - c, result = ""; - - if (code.indexOf('*') >= 0) return(""); - - code = code.toUpperCase(); - - // start : * - result += this.encoding[47]; - - // digits - for(i=0; i=0; i--){ - weightC = weightC == 20 ? 1 : weightC + 1; - weightK = weightK == 15 ? 1 : weightK + 1; - - index = table.indexOf( code.charAt(i) ); - - weightSumC += weightC * index; - weightSumK += weightK * index; - } - - var c = weightSumC % 47; - weightSumK += c; - var k = weightSumK % 47; - - result += this.encoding[c]; - result += this.encoding[k]; - } - - // stop : * - result += this.encoding[47]; - - // Terminaison bar - result += '1'; - return(result); - } - - }, - code128: { - encoding:[ "11011001100", "11001101100", "11001100110", "10010011000", - "10010001100", "10001001100", "10011001000", "10011000100", - "10001100100", "11001001000", "11001000100", "11000100100", - "10110011100", "10011011100", "10011001110", "10111001100", - "10011101100", "10011100110", "11001110010", "11001011100", - "11001001110", "11011100100", "11001110100", "11101101110", - "11101001100", "11100101100", "11100100110", "11101100100", - "11100110100", "11100110010", "11011011000", "11011000110", - "11000110110", "10100011000", "10001011000", "10001000110", - "10110001000", "10001101000", "10001100010", "11010001000", - "11000101000", "11000100010", "10110111000", "10110001110", - "10001101110", "10111011000", "10111000110", "10001110110", - "11101110110", "11010001110", "11000101110", "11011101000", - "11011100010", "11011101110", "11101011000", "11101000110", - "11100010110", "11101101000", "11101100010", "11100011010", - "11101111010", "11001000010", "11110001010", "10100110000", - "10100001100", "10010110000", "10010000110", "10000101100", - "10000100110", "10110010000", "10110000100", "10011010000", - "10011000010", "10000110100", "10000110010", "11000010010", - "11001010000", "11110111010", "11000010100", "10001111010", - "10100111100", "10010111100", "10010011110", "10111100100", - "10011110100", "10011110010", "11110100100", "11110010100", - "11110010010", "11011011110", "11011110110", "11110110110", - "10101111000", "10100011110", "10001011110", "10111101000", - "10111100010", "11110101000", "11110100010", "10111011110", - "10111101110", "11101011110", "11110101110", "11010000100", - "11010010000", "11010011100", "11000111010"], - getDigit: function(code){ - var tableB = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; - var result = ""; - var sum = 0; - var isum = 0; - var i = 0; - var j = 0; - var value = 0; - - // check each characters - for(i=0; i 1; - var c = ''; - for(i=0; i<3 && i= '0' && c <= '9'; - } - - sum = tableCActivated ? 105 : 104; - - // start : [105] : C table or [104] : B table - result = this.encoding[ sum ]; - - i = 0; - while( i < code.length ){ - - if (! tableCActivated){ - j = 0; - // check next character to activate C table if interresting - while ( (i + j < code.length) && (code.charAt(i+j) >= '0') && (code.charAt(i+j) <= '9') ) j++; - - // 6 min everywhere or 4 mini at the end - tableCActivated = (j > 5) || ((i + j - 1 == code.length) && (j > 3)); - - if ( tableCActivated ){ - result += this.encoding[ 99 ]; // C table - sum += ++isum * 99; - } - // 2 min for table C so need table B - } else if ( (i == code.length) || (code.charAt(i) < '0') || (code.charAt(i) > '9') || (code.charAt(i+1) < '0') || (code.charAt(i+1) > '9') ) { - tableCActivated = false; - result += this.encoding[ 100 ]; // B table - sum += ++isum * 100; - } - - if ( tableCActivated ) { - value = $.barcode.intval(code.charAt(i) + code.charAt(i+1)); // Add two characters (numeric) - i += 2; - } else { - value = tableB.indexOf( code.charAt(i) ); // Add one character - i += 1; - } - result += this.encoding[ value ]; - sum += ++isum * value; - } - - // Add CRC - result += this.encoding[ sum % 103 ]; - - // Stop - result += this.encoding[106]; - - // Termination bar - result += "11"; - - return(result); - } - }, - codabar: { - encoding:[ "101010011", "101011001", "101001011", "110010101", - "101101001", "110101001", "100101011", "100101101", - "100110101", "110100101", "101001101", "101100101", - "1101011011", "1101101011", "1101101101", "1011011011", - "1011001001", "1010010011", "1001001011", "1010011001"], - getDigit: function(code){ - var table = "0123456789-$:/.+"; - var i, index, result="", intercharacter = '0'; - - // add start : A->D : arbitrary choose A - result += this.encoding[16] + intercharacter; - - for(i=0; iD : arbitrary choose A - result += this.encoding[16]; - return(result); - } - }, - // little endian convertor - lec:{ - // convert an int - cInt: function(value, byteCount){ - var le = ''; - for(var i=0; i> 8; - } - return le; - }, - // return a byte string from rgb values - cRgb: function(r,g,b){ - return String.fromCharCode(b) + String.fromCharCode(g) + String.fromCharCode(r); - }, - // return a byte string from a hex string color - cHexColor: function(hex){ - var v = parseInt('0x' + hex.substr(1)); - var b = v & 0xFF; - v = v >> 8; - var g = v & 0xFF; - var r = v >> 8; - return(this.cRgb(r,g,b)); - } - }, - // test if a string is a hexa string color (like #FF0000) - isHexColor: function (value){ - var r = new RegExp("#[0-91-F]", "gi"); - return value.match(r); - }, - // encode data in base64 - base64Encode: function(value) { - var r = '', c1, c2, c3, b1, b2, b3, b4; - var k = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - var i = 0; - while (i < value.length) { - c1 = value.charCodeAt(i++); - c2 = value.charCodeAt(i++); - c3 = value.charCodeAt(i++); - b1 = c1 >> 2; - b2 = ((c1 & 3) << 4) | (c2 >> 4); - b3 = ((c2 & 15) << 2) | (c3 >> 6); - b4 = c3 & 63; - if (isNaN(c2)) b3 = b4 = 64; - else if (isNaN(c3)) b4 = 64; - r += k.charAt(b1) + k.charAt(b2) + k.charAt(b3) + k.charAt(b4); - } - return r; - }, - // bmp barcode renderer - digitToBmp: function($container, settings, digit, hri){ - var barWidth = $.barcode.intval(settings.barWidth); - var barHeight = $.barcode.intval(settings.barHeight); - var i = 0; - var c0 = this.isHexColor(settings.bgColor) ? this.lec.cHexColor(settings.bgColor) : this.lec.cRgb(255,255,255); - var c1 = this.isHexColor(settings.color) ? this.lec.cHexColor(settings.color) : this.lec.cRgb(0,0,0); - var bar0 = ''; - var bar1 = ''; - // create one bar 0 and 1 of "barWidth" byte length - for(i=0; i"; - current = digit.charAt(i); - len=1; - } - } - if (len > 0){ - content += (current == '0' ? bar0 : bar1) + (len * barWidth) + "px\">"; - } - if (settings.showHRI){ - // add HRI centered - content += "
"+hri+"
"; - } - // set "css" image to the container - $container - .css("padding", "0px") - .css("overflow", "auto") - .css("width", (barWidth * digit.length) + "px") - .html(content); - }, - // svg barcode renderer - digitToSvg: function($container, settings, digit, hri){ - var barWidth = $.barcode.intval(settings.barWidth); - var barHeight = $.barcode.intval(settings.barHeight); - var width = digit.length * barWidth; - var height = barHeight; - var fontSize = $.barcode.intval(settings.fontSize); - if (settings.showHRI){ - height += $.barcode.intval(settings.marginHRI) + fontSize; - } - // svg header - var svg = ''; - - // background - svg += ''; - - var len = 0; - var current = digit.charAt(0); - for(var i=0; i'; - } - current = digit.charAt(i); - len=1; - } - } - if ( (len > 0) && (current == '1') ){ - svg += ''; - } - if (settings.showHRI){ - // add HRI as centered text - svg += ''; - svg += '' + hri + ''; - svg += ''; - } - // svg footer - svg += ''; - - // create a dom object, flush container and add object to the container - var object = document.createElement('object'); - object.setAttribute('type', 'image/svg+xml'); - object.setAttribute('data', 'data:image/svg+xml,'+ svg); - $container.html("").append(object); - } -} - - -$.fn.extend({ - barcode: function(datas, type, settings) { - var digit = "", - hri = "", - code = "", - crc = true; - - if (typeof(datas) == "string"){ - code = datas; - } else if (typeof(datas) == "object"){ - code = typeof(datas.code) == "string" ? datas.code : ""; - crc = typeof(datas.crc) != "undefined" ? datas.crc : true; - } - - if (code == "") return(false); - - - switch(type){ - case "std25": - case "int25": - digit = $.barcode.i25.getDigit(code, crc, type); - hri = $.barcode.i25.compute(code, crc, type); - break; - case "ean8": - case "ean13": - digit = $.barcode.ean.getDigit(code, type); - hri = $.barcode.ean.compute(code, type); - break; - case "code11": - digit = $.barcode.code11.getDigit(code); - hri = code; - break; - case "code39": - digit = $.barcode.code39.getDigit(code); - hri = code; - break; - case "code93": - digit = $.barcode.code93.getDigit(code, crc); - hri = code; - break; - case "code128": - digit = $.barcode.code128.getDigit(code); - hri = code; - break - case "codabar": - digit = $.barcode.codabar.getDigit(code); - hri = code; - break; - case "msi": - digit = $.barcode.msi.getDigit(code, crc); - hri = $.barcode.msi.compute(code, crc); - break; - } - if (digit.length == 0) return($(this)); - // add Quiet Zone - digit = "0000000000" + digit + "0000000000"; - - // merge default settings with call settings - if (settings == undefined){ - settings = []; - } - for(var name in $.barcode.settings){ - if (settings[name] == undefined) settings[name] = $.barcode.settings[name]; - } - - var $this = $(this); - - // call the god renderer - switch(settings.output){ - case "bmp": - $.barcode.digitToBmp($this, settings, digit, hri); - break; - case "svg": - $.barcode.digitToSvg($this, settings, digit, hri); - break; - default: - $.barcode.digitToCss($this, settings, digit, hri); - break; - } - - - return($this); - } -}); \ No newline at end of file diff --git a/include/js/jquery-barcode-1.3.3.min.js b/include/js/jquery-barcode-1.3.3.min.js deleted file mode 100644 index 0af2301e9..000000000 --- a/include/js/jquery-barcode-1.3.3.min.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * BarCode Coder Library (BCC Library) - * BCCL Version 1.0 - * - * Porting : Jquery barcode plugin - * Version : 1.3.3 - * - * Date : October 17 2009 - * Author : DEMONTE Jean-Baptiste (firejocker) - * Contact : jbdemonte @ gmail.com - * Web site: http://barcode-coder.com/ - * dual licence : http://www.cecill.info/licences/Licence_CeCILL_V2-fr.html - * http://www.gnu.org/licenses/gpl.html - */ -$.barcode={settings:{barWidth:1,barHeight:50,showHRI:true,marginHRI:5,bgColor:"#FFFFFF",color:"#000000",fontSize:"10px",output:"css"},intval:function(b){var a=typeof(b);if(a=="string"){b=b.replace(/[^0-9-.]/g,"");b=parseInt(b*1,10);if(isNaN(b)||!isFinite(b)){return 0}else{return b}}else{if(a=="number"&&isFinite(b)){return Math.floor(b)}else{return 0}}},i25:{encoding:["NNWWN","WNNNW","NWNNW","WWNNN","NNWNW","WNWNN","NWWNN","NNNWW","WNNWN","NWNWN"],compute:function(e,g,d){if(!g){if(e.length%2!=0){e="0"+e}}else{if((d=="int25")&&(e.length%2==0)){e="0"+e}var f=true,a,c=0;for(var b=e.length-1;b>-1;b--){a=$.barcode.intval(e.charAt(b));if(isNaN(a)){return("")}c+=f?3*a:a;f=!f}e+=((10-c%10)%10).toString()}return(e)},getDigit:function(g,h,f){g=this.compute(g,h,f);if(g==""){return("")}result="";var d,a;if(f=="int25"){result+="1010";var e,b;for(d=0;d"9")){return("")}}g=this.compute(g,f);var a="101";if(f=="ean8"){for(var e=0;e<4;e++){a+=this.encoding[$.barcode.intval(g.charAt(e))][0]}a+="01010";for(var e=4;e<8;e++){a+=this.encoding[$.barcode.intval(g.charAt(e))][2]}}else{var d=this.first[$.barcode.intval(g.charAt(0))];for(var e=1;e<7;e++){a+=this.encoding[$.barcode.intval(g.charAt(e))][$.barcode.intval(d.charAt(e-1))]}a+="01010";for(var e=7;e<13;e++){a+=this.encoding[$.barcode.intval(g.charAt(e))][2]}}a+="101";return(a)},compute:function(d,c){var a=c=="ean13"?12:7;d=d.substring(0,a);var b=0,e=true;for(i=d.length-1;i>-1;i--){b+=(e?3:1)*$.barcode.intval(d.charAt(i));e=!e}return(d+((10-b%10)%10).toString())}},msi:{encoding:["100100100100","100100100110","100100110100","100100110110","100110100100","100110100110","100110110100","100110110110","110100100100","110100100110"],compute:function(a,b){if(typeof(b)=="object"){if(b.crc1=="mod10"){a=this.computeMod10(a)}else{if(b.crc1=="mod11"){a=this.computeMod11(a)}}if(b.crc2=="mod10"){a=this.computeMod10(a)}else{if(b.crc2=="mod11"){a=this.computeMod11(a)}}}else{if(typeof(b)=="boolean"){if(b){a=this.computeMod10(a)}}}return(a)},computeMod10:function(f){var c,a=f.length%2;var e=0,d=0;for(c=0;c=0;a--){b+=d*$.barcode.intval(c.charAt(a));d=d==7?2:d+1}return(c+((11-b%11)%11).toString())},getDigit:function(d,e){var c="0123456789";var b=0;var a="";d=this.compute(d,false);a="110";for(i=0;i=0;g--){m=m==10?1:m+1;h=h==10?1:h+1;j=n.indexOf(b.charAt(g));f+=m*j;a+=h*j}var l=f%11;a+=l;var e=a%11;o+=this.encoding[l]+d;if(b.length>=10){o+=this.encoding[e]+d}o+="1011001";return(o)}},code39:{encoding:["101001101101","110100101011","101100101011","110110010101","101001101011","110100110101","101100110101","101001011011","110100101101","101100101101","110101001011","101101001011","110110100101","101011001011","110101100101","101101100101","101010011011","110101001101","101101001101","101011001101","110101010011","101101010011","110110101001","101011010011","110101101001","101101101001","101010110011","110101011001","101101011001","101011011001","110010101011","100110101011","110011010101","100101101011","110010110101","100110110101","100101011011","110010101101","100110101101","100100100101","100100101001","100101001001","101001001001","100101101101"],getDigit:function(f){var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*";var d,c,b="",a="0";if(f.indexOf("*")>=0){return("")}f=("*"+f+"*").toUpperCase();for(d=0;d0){b+=a}b+=this.encoding[c]}return(b)}},code93:{encoding:["100010100","101001000","101000100","101000010","100101000","100100100","100100010","101010000","100010010","100001010","110101000","110100100","110100010","110010100","110010010","110001010","101101000","101100100","101100010","100110100","100011010","101011000","101001100","101000110","100101100","100010110","110110100","110110010","110101100","110100110","110010110","110011010","101101100","101100110","100110110","100111010","100101110","111010100","111010010","111001010","101101110","101110110","110101110","100100110","111011010","111010110","100110010","101011110"],getDigit:function(b,g){var l="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%____*",h,m="";if(b.indexOf("*")>=0){return("")}b=b.toUpperCase();m+=this.encoding[47];for(i=0;i=0;i--){j=j==20?1:j+1;f=f==15?1:f+1;index=l.indexOf(b.charAt(i));e+=j*index;a+=f*index}var h=e%47;a+=h;var d=a%47;m+=this.encoding[h];m+=this.encoding[d]}m+=this.encoding[47];m+="1";return(m)}},code128:{encoding:["11011001100","11001101100","11001100110","10010011000","10010001100","10001001100","10011001000","10011000100","10001100100","11001001000","11001000100","11000100100","10110011100","10011011100","10011001110","10111001100","10011101100","10011100110","11001110010","11001011100","11001001110","11011100100","11001110100","11101101110","11101001100","11100101100","11100100110","11101100100","11100110100","11100110010","11011011000","11011000110","11000110110","10100011000","10001011000","10001000110","10110001000","10001101000","10001100010","11010001000","11000101000","11000100010","10110111000","10110001110","10001101110","10111011000","10111000110","10001110110","11101110110","11010001110","11000101110","11011101000","11011100010","11011101110","11101011000","11101000110","11100010110","11101101000","11101100010","11100011010","11101111010","11001000010","11110001010","10100110000","10100001100","10010110000","10010000110","10000101100","10000100110","10110010000","10110000100","10011010000","10011000010","10000110100","10000110010","11000010010","11001010000","11110111010","11000010100","10001111010","10100111100","10010111100","10010011110","10111100100","10011110100","10011110010","11110100100","11110010100","11110010010","11011011110","11011110110","11110110110","10101111000","10100011110","10001011110","10111101000","10111100010","11110101000","11110100010","10111011110","10111101110","11101011110","11110101110","11010000100","11010010000","11010011100","11000111010"],getDigit:function(b){var a=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~";var m="";var h=0;var d=0;var g=0;var f=0;var l=0;for(g=0;g1;var k="";for(g=0;g<3&&g="0"&&k<="9"}h=e?105:104;m=this.encoding[h];g=0;while(g="0")&&(b.charAt(g+f)<="9")){f++}e=(f>5)||((g+f-1==b.length)&&(f>3));if(e){m+=this.encoding[99];h+=++d*99}}else{if((g==b.length)||(b.charAt(g)<"0")||(b.charAt(g)>"9")||(b.charAt(g+1)<"0")||(b.charAt(g+1)>"9")){e=false;m+=this.encoding[100];h+=++d*100}}if(e){l=$.barcode.intval(b.charAt(g)+b.charAt(g+1));g+=2}else{l=a.indexOf(b.charAt(g));g+=1}m+=this.encoding[l];h+=++d*l}m+=this.encoding[h%103];m+=this.encoding[106];m+="11";return(m)}},codabar:{encoding:["101010011","101011001","101001011","110010101","101101001","110101001","100101011","100101101","100110101","110100101","101001101","101100101","1101011011","1101101011","1101101101","1011011011","1011001001","1010010011","1001001011","1010011001"],getDigit:function(f){var e="0123456789-$:/.+";var d,c,b="",a="0";b+=this.encoding[16]+a;for(d=0;d>8}return b},cRgb:function(d,c,a){return String.fromCharCode(a)+String.fromCharCode(c)+String.fromCharCode(d)},cHexColor:function(f){var c=parseInt("0x"+f.substr(1));var a=c&255;c=c>>8;var e=c&255;var d=c>>8;return(this.cRgb(d,e,a))}},isHexColor:function(b){var a=new RegExp("#[0-91-F]","gi");return b.match(a)},base64Encode:function(m){var a="",f,d,c,l,j,h,g;var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var e=0;while(e>2;j=((f&3)<<4)|(d>>4);h=((d&15)<<2)|(c>>6);g=c&63;if(isNaN(d)){h=g=64}else{if(isNaN(c)){g=64}}a+=b.charAt(l)+b.charAt(j)+b.charAt(h)+b.charAt(g)}return a},digitToBmp:function(q,c,l,e){var r=$.barcode.intval(c.barWidth);var p=$.barcode.intval(c.barHeight);var g=0;var h=this.isHexColor(c.bgColor)?this.lec.cHexColor(c.bgColor):this.lec.cRgb(255,255,255);var f=this.isHexColor(c.color)?this.lec.cHexColor(c.color):this.lec.cRgb(0,0,0);var n="";var k="";for(g=0;g';e=g.charAt(c);d=1}}if(d>0){f+=(e=="0"?j:h)+(d*m)+'px">'}if(a.showHRI){f+='
'+b+"
"}l.css("padding","0px").css("overflow","auto").css("width",(m*g.length)+"px").html(f)},digitToSvg:function(m,b,j,d){var o=$.barcode.intval(b.barWidth);var k=$.barcode.intval(b.barHeight);var a=j.length*o;var l=k;var n=$.barcode.intval(b.fontSize);if(b.showHRI){l+=$.barcode.intval(b.marginHRI)+n}var f='';f+='';var g=0;var h=j.charAt(0);for(var e=0;e'}h=j.charAt(e);g=1}}if((g>0)&&(h=="1")){f+=''}if(b.showHRI){f+='';f+=''+d+"";f+=""}f+="";var c=document.createElement("object");c.setAttribute("type","image/svg+xml");c.setAttribute("data","data:image/svg+xml,"+f);m.html("").append(c)}};$.fn.extend({barcode:function(e,h,c){var j="",d="",b="",f=true;if(typeof(e)=="string"){b=e}else{if(typeof(e)=="object"){b=typeof(e.code)=="string"?e.code:"";f=typeof(e.crc)!="undefined"?e.crc:true}}if(b==""){return(false)}switch(h){case"std25":case"int25":j=$.barcode.i25.getDigit(b,f,h);d=$.barcode.i25.compute(b,f,h);break;case"ean8":case"ean13":j=$.barcode.ean.getDigit(b,h);d=$.barcode.ean.compute(b,h);break;case"code11":j=$.barcode.code11.getDigit(b);d=b;break;case"code39":j=$.barcode.code39.getDigit(b);d=b;break;case"code93":j=$.barcode.code93.getDigit(b,f);d=b;break;case"code128":j=$.barcode.code128.getDigit(b);d=b;break;case"codabar":j=$.barcode.codabar.getDigit(b);d=b;break;case"msi":j=$.barcode.msi.getDigit(b,f);d=$.barcode.msi.compute(b,f);break}if(j.length==0){return($(this))}j="0000000000"+j+"0000000000";if(c==undefined){c=[]}for(var a in $.barcode.settings){if(c[a]==undefined){c[a]=$.barcode.settings[a]}}var g=$(this);switch(c.output){case"bmp":$.barcode.digitToBmp(g,c,j,d);break;case"svg":$.barcode.digitToSvg(g,c,j,d);break;default:$.barcode.digitToCss(g,c,j,d);break}return(g)}}); \ No newline at end of file diff --git a/include/js/jquery.idTabs.min.js b/include/js/jquery.idTabs.min.js deleted file mode 100644 index 7106f5496..000000000 --- a/include/js/jquery.idTabs.min.js +++ /dev/null @@ -1,12 +0,0 @@ -/* idTabs ~ Sean Catchpole - Version 2.2 - MIT/GPL */ -(function(){var dep={"jQuery":"http://code.jquery.com/jquery-latest.min.js"};var init=function(){(function($){$.fn.idTabs=function(){var s={};for(var i=0;im){return e.click(0,n)}}if(!l.length){if(i>=0){return e}k=f.initialIndex;l=g.eq(k)}if(k===i){return e}n=n||d.Event();n.type="onBeforeClick";j.trigger(n,[k]);if(n.isDefaultPrevented()){return}c[f.effect].call(e,k,function(){n.type="onClick";j.trigger(n,[k])});n.type="onStart";j.trigger(n,[k]);if(n.isDefaultPrevented()){return}i=k;g.removeClass(f.current);l.addClass(f.current);return e},getConf:function(){return f},getTabs:function(){return g},getPanes:function(){return h},getCurrentPane:function(){return h.eq(i)},getCurrentTab:function(){return g.eq(i)},getIndex:function(){return i},next:function(){return e.click(i+1)},prev:function(){return e.click(i-1)},bind:function(k,l){j.bind(k,l);return e},onBeforeClick:function(k){return this.bind("onBeforeClick",k)},onClick:function(k){return this.bind("onClick",k)},unbind:function(k){j.unbind(k);return e}});g.each(function(k){d(this).bind(f.event,function(l){e.click(k,l);return false})});if(location.hash){e.click(location.hash)}else{if(f.initialIndex===0||f.initialIndex>0){e.click(f.initialIndex)}}h.find("a[href^=#]").click(function(k){e.click(d(this).attr("href"),k)})}d.fn.tabs=function(i,f){var g=this.eq(typeof f=="number"?f:0).data("tabs");if(g){return g}if(d.isFunction(f)){f={onBeforeClick:f}}var h=d.extend({},d.tools.tabs.conf),e=this.length;f=d.extend(h,f);this.each(function(l){var j=d(this);var k=j.find(f.tabs);if(!k.length){k=j.children()}var m=i.jquery?i:j.children(i);if(!m.length){m=e==1?d(i):j.parent().find(i)}g=new a(k,m,f);j.data("tabs",g)});return f.api?g:this}})(jQuery); -(function(b){var a=b.tools.tabs;a.plugins=a.plugins||{};a.plugins.slideshow={version:"1.0.2",conf:{next:".forward",prev:".backward",disabledClass:"disabled",autoplay:false,autopause:true,interval:3000,clickable:true,api:false}};b.prototype.slideshow=function(e){var f=b.extend({},a.plugins.slideshow.conf),c=this.length,d;e=b.extend(f,e);this.each(function(){var p=b(this),m=p.tabs(),i=b(m),o=m;b.each(e,function(t,u){if(b.isFunction(u)){m.bind(t,u)}});function n(t){return c==1?b(t):p.parent().find(t)}var s=n(e.next).click(function(){m.next()});var q=n(e.prev).click(function(){m.prev()});var h,j,l,g=false;b.extend(m,{play:function(){if(h){return}var t=b.Event("onBeforePlay");i.trigger(t);if(t.isDefaultPrevented()){return m}g=false;h=setInterval(m.next,e.interval);i.trigger("onPlay");m.next()},pause:function(){if(!h){return m}var t=b.Event("onBeforePause");i.trigger(t);if(t.isDefaultPrevented()){return m}h=clearInterval(h);l=clearInterval(l);i.trigger("onPause")},stop:function(){m.pause();g=true},onBeforePlay:function(t){return m.bind("onBeforePlay",t)},onPlay:function(t){return m.bind("onPlay",t)},onBeforePause:function(t){return m.bind("onBeforePause",t)},onPause:function(t){return m.bind("onPause",t)}});if(e.autopause){var k=m.getTabs().add(s).add(q).add(m.getPanes());k.hover(function(){m.pause();j=clearInterval(j)},function(){if(!g){j=setTimeout(m.play,e.interval)}})}if(e.autoplay){l=setTimeout(m.play,e.interval)}else{m.stop()}if(e.clickable){m.getPanes().click(function(){m.next()})}if(!m.getConf().rotate){var r=e.disabledClass;if(!m.getIndex()){q.addClass(r)}m.onBeforeClick(function(u,t){if(!t){q.addClass(r)}else{q.removeClass(r);if(t==m.getTabs().length-1){s.addClass(r)}else{s.removeClass(r)}}})}});return e.api?d:this}})(jQuery); -(function(d){var a=d.tools.tabs;a.plugins=a.plugins||{};a.plugins.history={version:"1.0.2",conf:{api:false}};var e,b;function c(f){if(f){var g=b.contentWindow.document;g.open().close();g.location.hash=f}}d.fn.onHash=function(g){var f=this;if(d.browser.msie&&d.browser.version<"8"){if(!b){b=d("