This commit is contained in:
cris-technikum
2018-01-17 14:59:22 +01:00
1227 changed files with 9806 additions and 1916 deletions
+9
View File
@@ -10,6 +10,15 @@ documents/
.project
.buildpath
application/config/development/
application/extensions/
application/controllers/extensions/
application/config/extensions/
application/helpers/extensions/
application/hooks/extensions/
application/libraries/extensions/
application/models/extensions/
application/views/extensions/
application/widgets/extensions/
tests/codeception/_output/*
!/tests/codeception/_output/.placeholder
tests/codeception/codeception.yml
Executable → Regular
+1
View File
@@ -19,6 +19,7 @@
- **[CORE]** Berechtigungsprüfung wurde angepasst damit deaktivierte Benutzer keine Berechtigungen mehr haben
- **[FAS]** Mitarbeiterexport exportiert jetzt nur noch die markierten Personen
- **[CORE]** Has many as possible javascripts and css present in the repository were removed. Their lack is overcome by the packages in the composer. In the meanwhile also the versions were updated
- **[CIS]** Die Fotoliste wird jetzt mit unoconv erstellt. Die bestehende Vorlage für den Dokumentenexport muss hier angepasst werden
### Updateinfo
- **[CORE]** Infoscreen wurde umbenannt (informationsbildschirm.php)
Vendored Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
@@ -0,0 +1 @@
+3
View File
@@ -198,6 +198,7 @@ $config['fhc_acl'] = array
'system.tbl_appdaten' => 'system/appdaten',
'system.tbl_benutzerrolle' => 'basis/benutzerrolle',
'system.tbl_berechtigung' => 'basis/berechtigung',
'system.tbl_filters' => 'system/filters',
'system.tbl_cronjob' => 'basis/cronjob',
'system.tbl_phrase' => 'system/phrase',
'system.tbl_phrasentext' => 'system/phrase',
@@ -208,6 +209,8 @@ $config['fhc_acl'] = array
'system.tbl_webservicerecht' => 'basis/webservicerecht',
'system.tbl_webservicetyp' => 'basis/webservicetyp',
'system.tbl_udf' => 'system/udf',
'system.tbl_extensions' => 'system/extensions',
'system.tbl_log' => 'basis/log',
'testtool.tbl_ablauf' => 'basis/ablauf',
'testtool.tbl_antwort' => 'basis/antwort',
'testtool.tbl_frage' => 'basis/frage',
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
+12 -2
View File
@@ -1,12 +1,12 @@
<?php
if (! defined('BASEPATH'))
if (! defined('BASEPATH'))
exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Standard ROLES in FH-Complete and their persmissions
| -------------------------------------------------------------------------
|
|
*/
$config['roles'] = array
(
@@ -47,5 +47,15 @@ $config['roles'] = array
'wawi/rechnung', 'wawi/rechnung_freigeben', 'wawi/rechnung_transfer',
'wawi/storno'
)
),
array
(
'rolle_kurzbz' => 'infocenter',
'berechtigung' => array
(
'basis/adresse','basis/akte','basis/kontakt','basis/log','basis/nation','basis/notiz','basis/notizzuordnung',
'basis/person','basis/prestudent','basis/prestudentstatus','basis/status','basis/zgv','basis/zgvmaster',
'lehre/studienplan','system/filters'
)
)
);
Executable → Regular
View File
Executable → Regular
View File
View File
+29 -3
View File
@@ -424,6 +424,31 @@ class DBTools extends FHC_Controller
echo ' Roles!';
$this->config->load('roles');
foreach ($this->config->item('roles') as $role)
{
echo "\n\n".'Check role '.$role['rolle_kurzbz'];
$qry = "SELECT * FROM system.tbl_rolle
WHERE rolle_kurzbz='".$role['rolle_kurzbz']."';";
if($result = $this->db->query($qry))
{
if($result->num_rows($result)==0)
{
// Nicht vorhanden -> anlegen
$qry_insert="INSERT INTO system.tbl_rolle(rolle_kurzbz, beschreibung) VALUES ('".$role['rolle_kurzbz']."','".$role['rolle_kurzbz']."');";
if($this->db->query($qry_insert))
{
echo "\nRolle ".$role['rolle_kurzbz'].' hinzugefügt';
$neue=true;
}
else
{
echo "\nFehler: ".$role['rolle_kurzbz'].' Rolle hinzufügen nicht möglich';
continue;
}
}
}
foreach ($role['berechtigung'] as $b)
{
$qry = "SELECT * FROM system.tbl_rolleberechtigung
@@ -439,16 +464,17 @@ class DBTools extends FHC_Controller
if($this->db->query($qry_insert))
{
echo '<br>'.$role['rolle_kurzbz'].' -> '.$b.' <b>hinzugefügt</b>';
echo "\n".$role['rolle_kurzbz'].' -> '.$b.' hinzugefügt';
$neue=true;
}
else
echo '<br><span class="error">Fehler: '.$role['rolle_kurzbz'].' -> '.$b.' hinzufügen nicht möglich</span>';
echo "\nFehler: ".$role['rolle_kurzbz'].' -> '.$b.' hinzufügen nicht möglich';
}
else
echo "- $b -";
echo "\n- $b -";
}
}
}
break;
// **** Default ****
default: echo ' what? roles or permisssions?';
+12 -9
View File
@@ -31,9 +31,6 @@ class Redirect extends FHC_Controller
// Loads model MessageTokenModel
$this->load->model('system/MessageToken_model', 'MessageTokenModel');
// Loads library OrganisationseinheitLib
$this->load->library('OrganisationseinheitLib');
}
/**
@@ -55,10 +52,16 @@ class Redirect extends FHC_Controller
if ($oe_kurzbz != null && $oe_kurzbz != '')
{
$rootOE = $this->organisationseinheitlib->getRoot($oe_kurzbz);
if ($rootOE->error)
$organisationRoot = null;
$getOERoot = $this->MessageTokenModel->getOERoot($oe_kurzbz);
if (isSuccess($getOERoot)) // If no errors occurred
{
show_error($rootOE->retval);
$organisationRoot = $getOERoot->retval;
}
else
{
show_error('No organisation unit present in the message');
}
$addonAufnahmeUrls = $this->config->item('addons_aufnahme_url');
@@ -66,10 +69,10 @@ class Redirect extends FHC_Controller
if (isset($token)
&& hasData($msg)
&& is_array($addonAufnahmeUrls)
&& hasData($rootOE)
&& isset($addonAufnahmeUrls[$rootOE->retval[0]->oe_kurzbz]))
&& $organisationRoot != null
&& isset($addonAufnahmeUrls[$organisationRoot]))
{
redirect($addonAufnahmeUrls[$rootOE->retval[0]->oe_kurzbz] . '?token=' . $token);
redirect($addonAufnahmeUrls[$organisationRoot] . '?token=' . $token);
}
}
}
View File
View File
@@ -0,0 +1 @@
View File
View File
View File
View File
@@ -0,0 +1,83 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
*/
class Manager extends VileSci_Controller
{
/**
*
*/
public function __construct()
{
parent::__construct();
// Load helpers to upload files
$this->load->helper(array('form', 'url'));
// Loads the extensions library
$this->load->library('ExtensionsLib');
}
/**
*
*/
public function index()
{
$viewData = array(
'extensions' => $this->extensionslib->getInstalledExtensions()
);
$this->load->view('system/extensions/manager.php', $viewData);
}
/**
*
*/
public function toggleExtension()
{
$toggleExtension = false;
$extension_id = $this->input->post('extension_id');
$enabled = $this->input->post('enabled');
if ($enabled === 'true')
{
$toggleExtension = $this->extensionslib->enableExtension($extension_id);
}
else
{
$toggleExtension = $this->extensionslib->disableExtension($extension_id);
}
$this->output
->set_content_type('application/json')
->set_output(json_encode($toggleExtension));
}
/**
*
*/
public function delExtension()
{
$delExtension = false;
$extension_id = $this->input->post('extension_id');
$delExtension = $this->extensionslib->delExtension($extension_id);
$this->output
->set_content_type('application/json')
->set_output(json_encode($delExtension));
}
/**
*
*/
public function uploadExtension()
{
$this->extensionslib->installExtension();
}
}
@@ -0,0 +1,72 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
class InfoCenter extends VileSci_Controller
{
public function __construct()
{
parent::__construct();
//
$this->load->model('system/Filters_model', 'FiltersModel');
//
$this->load->library('WidgetLib');
}
/**
*
*/
public function index()
{
$listFiltersSent = array();
$listFiltersNotSent = array();
$listFiltersSent = $this->_getFilterList('%InfoCenterSentApplication%');
$listFiltersNotSent = $this->_getFilterList('%InfoCenterNotSentApplication%');
$this->load->view(
'system/infocenter/infocenter.php',
array(
'listFiltersSent' => $listFiltersSent,
'listFiltersNotSent' => $listFiltersNotSent
)
);
}
/**
*
*/
private function _getFilterList($filter_kurzbz)
{
$listFilters = array();
$personActionsArray = array(
'app' => 'aufnahme',
'dataset_name' => 'PersonActions',
'person_id' => null,
'default_filter' => false,
'array_length(description, 1) >' => 0
);
$this->FiltersModel->resetQuery();
$this->FiltersModel->addSelect('filter_id, description');
$this->FiltersModel->addOrder('sort', 'ASC');
$personActionsArray['filter_kurzbz ILIKE'] = $filter_kurzbz;
$filters = $this->FiltersModel->loadWhere($personActionsArray);
if (hasData($filters))
{
for ($filtersCounter = 0; $filtersCounter < count($filters->retval); $filtersCounter++)
{
$filter = $filters->retval[$filtersCounter];
$listFilters[$filter->filter_id] = $filter->description[0];
}
}
return $listFilters;
}
}
@@ -0,0 +1,393 @@
<?php
if (! defined("BASEPATH")) exit("No direct script access allowed");
/**
* Class InfocenterDetails
* shows aufnahme-related data for a person and its prestudents, enables document and zgv checks,
* displays and saves Notizen for a person, logs aufnahme-related actions for a person
*/
class InfocenterDetails extends VileSci_Controller
{
//app name for logging
const APP = 'aufnahme';
/**
* constructor
*/
public function __construct()
{
parent::__construct();
$this->load->model('person/person_model', 'PersonModel');
$this->load->model('person/notiz_model', 'NotizModel');
$this->load->model('crm/prestudent_model', 'PrestudentModel');
$this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel');
$this->load->model('crm/statusgrund_model', 'StatusgrundModel');
$this->load->model('crm/akte_model', 'AkteModel');
$this->load->library('DmsLib');
$this->load->library('WidgetLib');
$this->load->library('PersonLogLib');
$this->load->helper('fhcauth');
$this->load->helper('url');
$this->uid = getAuthUID();
if(!$this->uid)
show_error('user authentification failed');
}
/**
* loads all necessary Person data: Stammdaten (name, svnr, contact, ...), Dokumente, Logs and Notizen
* @param $person_id
* @return array
*/
private function __loadPersonData($person_id)
{
$stammdaten = $this->PersonModel->getPersonStammdaten($person_id);
if ($stammdaten->error)
{
show_error($stammdaten->retval);
}
if(!isset($stammdaten->retval))
return null;
/* $dokumente = $this->AkteModel->loadWhere(array('person_id' => $person_id));
if ($dokumente->error)
{
show_error($dokumente->retval);
}
var_dump($dokumente->retval);*/
$dokumente = $this->AkteModel->getAktenWithDokInfo($person_id, null, false);
if ($dokumente->error)
{
show_error($dokumente->retval);
}
$dokumente_nachgereicht = $this->AkteModel->getAktenWithDokInfo($person_id, null, true);
if ($dokumente_nachgereicht->error)
{
show_error($dokumente->retval);
}
//var_dump($dokumente->retval);die();
$logs = $this->personloglib->getLogs($person_id, $this::APP);
$notizen = $this->NotizModel->getNotiz($person_id);
if ($notizen->error)
{
show_error($notizen->retval);
}
$data = array (
'stammdaten' => $stammdaten->retval,
'dokumente' => $dokumente->retval,
'dokumente_nachgereicht' => $dokumente_nachgereicht->retval,
'logs' => $logs,
'notizen' => $notizen->retval
);
return $data;
}
/**
* loads all necessary Prestudent data: Zgv data, Statusgruende
* @param $person_id
* @return array
*/
private function __loadPrestudentData($person_id)
{
$zgvpruefungen = [];
$prestudenten = $this->PrestudentModel->loadWhere(array('person_id' => $person_id));
if ($prestudenten->error)
{
show_error($prestudenten->retval);
}
foreach ($prestudenten->retval as $prestudent)
{
$prestudent = $this->PrestudentModel->getPrestudentWithZgv($prestudent->prestudent_id);
if ($prestudent->error)
{
show_error($prestudent->retval);
}
$zgvpruefung = $prestudent->retval[0];
//if prestudent is not interessent or is already bestaetigt, then show only as information, non-editable
$zgvpruefung->infoonly = !isset($zgvpruefung->prestudentstatus) || isset($zgvpruefung->prestudentstatus->bestaetigtam) || $zgvpruefung->prestudentstatus->status_kurzbz != 'Interessent';
$zgvpruefungen[] = $zgvpruefung;
}
//Interessenten come first
usort($zgvpruefungen, function ($a, $b)
{
if(!isset($a->prestudentstatus->status_kurzbz) || !isset($b->prestudentstatus->status_kurzbz))
return 0;
elseif($a->prestudentstatus->status_kurzbz === 'Interessent' && $b->prestudentstatus->status_kurzbz === 'Interessent')
{
//infoonly Interessenten are behind new Interessenten
if($a->infoonly)
return 1;
elseif($b->infoonly)
return -1;
}
elseif($a->prestudentstatus->status_kurzbz === 'Interessent')
return -1;
elseif($b->prestudentstatus->status_kurzbz === 'Interessent')
return 1;
else
return 0;
});
$statusgruende = $this->StatusgrundModel->loadWhere(array('status_kurzbz' => 'Abgewiesener'))->retval;
$data = array (
'zgvpruefungen' => $zgvpruefungen,
'statusgruende' => $statusgruende
);
return $data;
}
/**
* initialization function, gets person and prestudent data and loads the view with the data
* @param $person_id
*/
public function showDetails($person_id)
{
if(!is_numeric($person_id))
show_error('person id is not numeric!');
$persondata = $this->__loadPersonData($person_id);
if(!isset($persondata))
show_error('person does not exist!');
$prestudentdata = $this->__loadPrestudentData($person_id);
$this->load->view('system/infocenter/infocenterDetails.php', array_merge($persondata, $prestudentdata));
}
/**
* saves if a document has been formal geprueft. saves current timestamp if checked as geprueft, or null if not.
*/
public function saveFormalGeprueft()
{
$akte_id = $this->input->get('akte_id');
$formalgeprueft = $this->input->get('formal_geprueft');
$person_id = $this->input->get('person_id');
if(!isset($akte_id) || !isset($formalgeprueft) || !isset($person_id))
show_error('Parameters not set!');
$akte = $this->AkteModel->load($akte_id);
if ($akte->error)
{
show_error($akte->retval);
}
$timestamp = ($formalgeprueft === 'true') ? date('Y-m-d H:i:s') : null;
$result = $this->AkteModel->update($akte_id, array('formal_geprueft_amum' => $timestamp));
if ($result->error)
{
show_error($result->retval);
}
//write person log
$this->personloglib->log($person_id, 'Action', array('name' => 'Dokument formal geprüft', 'message' => 'Dokument '.$akte->titel.' formal geprüft, gesetzt auf '.(is_null($timestamp) ? 'NULL' : $timestamp), 'success' => 'true'), $this::APP, null, $this->uid);
//redirect to start page
redirect('/system/infocenter/InfocenterDetails/showDetails/'.$person_id.'#DokPruef');
}
/**
* saves a zgv for a prestudent. includes Ort, Datum, Nation for bachelor and master.
* @param $prestudent_id
*/
public function saveZgvPruefung($prestudent_id)
{
// zgvdata
$zgv_code = $this->input->post('zgv') === 'null' ? null : $this->input->post('zgv');//check for string null, in case dropdown changed to default value
$zgvort = $this->input->post('zgvort');
$zgvdatum = $this->input->post('zgvdatum');
$zgvdatum = empty($zgvdatum) ? null : date_format(date_create($zgvdatum), 'Y-m-d');
$zgvnation_code = $this->input->post('zgvnation') === 'null' ? null : $this->input->post('zgvnation');
//zgvmasterdata
$zgvmas_code = $this->input->post('zgvmas') === 'null' ? null : $this->input->post('zgvmas');
$zgvmaort = $this->input->post('zgvmaort');
$zgvmadatum = $this->input->post('zgvmadatum');
$zgvmadatum = empty($zgvmadatum) ? null : date_format(date_create($zgvmadatum), 'Y-m-d');
$zgvmanation_code = $this->input->post('zgvmanation') === 'null' ? null : $this->input->post('zgvmanation');
$result = $this->PrestudentModel->update($prestudent_id, array('zgv_code' => $zgv_code, 'zgvort' => $zgvort, 'zgvdatum' => $zgvdatum, 'zgvnation' => $zgvnation_code,
'zgvmas_code' => $zgvmas_code, 'zgvmaort' => $zgvmaort, 'zgvmadatum' => $zgvmadatum, 'zgvmanation' => $zgvmanation_code));
if ($result->error)
{
show_error($result->retval);
}
//get extended Prestudent data for logging
$logdata = $this->__getPersonAndStudiengangFromPrestudent($prestudent_id);
$this->personloglib->log($logdata['person_id'], 'Action', array('name' => 'Zgv gespeichert', 'message' => 'Zgv für Studiengang '.$logdata['studiengang_kurzbz'].' wurde gespeichert', 'success' => 'true'), $this::APP, null, $this->uid);
$this->__redirectToStart($prestudent_id, 'ZgvPruef');
}
/**
* saves Absage for Prestudent including the reason for the Absage (statusgrund).
* inserts Studiensemester and Ausbildungssemester for the new Absage of (chronologically) last status.
* @param $prestudent_id
*/
public function saveAbsage($prestudent_id)
{
//TODO email messaging
$statusgrund = $this->input->post('statusgrund');
$lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id);
if ($lastStatus->error)
{
show_error($lastStatus->retval);
}
$result = $this->PrestudentstatusModel->insert(array('prestudent_id' => $prestudent_id, 'studiensemester_kurzbz' => $lastStatus->retval[0]->studiensemester_kurzbz, 'ausbildungssemester' => $lastStatus->retval[0]->ausbildungssemester, 'datum' => date('Y-m-d'), 'orgform_kurzbz' => $lastStatus->retval[0]->orgform_kurzbz, 'studienplan_id' => $lastStatus->retval[0]->studienplan_id, 'status_kurzbz' => 'Abgewiesener', 'statusgrund_id' => $statusgrund, 'insertvon' => $this->uid, 'insertamum' => date('Y-m-d H:i:s')));
if ($result->error)
{
show_error($result->retval);
}
$logdata = $this->__getPersonAndStudiengangFromPrestudent($prestudent_id);
$this->personloglib->log($logdata['person_id'], 'Processstate', array('name' => 'Interessent abgewiesen', 'message' => 'Interessent wurde für Studiengang '.$logdata['studiengang_kurzbz'].' abgewiesen', 'success' => 'true'), $this::APP, null, $this->uid);
$this->__redirectToStart($prestudent_id, 'ZgvPruef');
}
/**
* saves Freigabe of a Prestudent to the Studiengang.
* updates bestaetigtam and bestaetigtvon fields of the last status
* @param $prestudent_id
*/
public function saveFreigabe($prestudent_id)
{
$lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id);
if (count($lastStatus->retval) > 0)
{
$lastStatus = $lastStatus->retval[0];
$result = $this->PrestudentstatusModel->update(array('prestudent_id' => $prestudent_id, 'status_kurzbz' => $lastStatus->status_kurzbz, 'studiensemester_kurzbz' => $lastStatus->studiensemester_kurzbz, 'ausbildungssemester' => $lastStatus->ausbildungssemester),
array('bestaetigtvon' => $this->uid, 'bestaetigtam' => date('Y-m-d'), 'updatevon' => $this->uid, 'updateamum' => date('Y-m-d H:i:s')));
if ($result->error)
{
show_error($result->retval);
}
}
$logdata = $this->__getPersonAndStudiengangFromPrestudent($prestudent_id);
$this->personloglib->log($logdata['person_id'], 'Processstate', array('name' => 'Interessent freigegeben', 'message' => 'Interessent wurde für Studiengang '.$logdata['studiengang_kurzbz'].' freigegeben', 'success' => 'true'), $this::APP, null, $this->uid);
$this->__redirectToStart($prestudent_id, 'ZgvPruef');
}
/**
* saves a new Notiz for a person
* @param $person_id
*/
public function saveNotiz($person_id)
{
$titel = $this->input->post('notiztitel');
$text = $this->input->post('notiz');
$erledigt = false;
$result = $this->NotizModel->addNotizForPerson($person_id, $titel, $text, $erledigt, $this->uid);
if ($result->error)
{
show_error($result->retval);
}
$this->personloglib->log($person_id, 'Action', array('name' => 'Notiz hinzugefügt', 'message' => 'Notiz mit Titel '.$titel.' wurde hinzugefügt', 'success' => 'true'), $this::APP, null, $this->uid);
redirect('/system/infocenter/InfocenterDetails/showDetails/'.$person_id.'#NotizAkt');
}
/**
* Outputs content of an Akte, sends appropriate headers (so the document can be downloaded)
* @param $akte_id
*/
public function outputAkteContent($akte_id)
{
$akte = $this->AkteModel->load($akte_id);
if ($akte->error)
{
show_error($akte->retval);
}
$aktecontent = $this->dmslib->getAkteContent($akte_id);
if($aktecontent->error)
{
show_error($aktecontent->retval);
}
$this->output
->set_status_header(200)
->set_content_type($akte->retval[0]->mimetype, 'utf-8')
->set_header('Content-Disposition: attachment; filename="'.$akte->retval[0]->titel.'"')
->set_output($aktecontent->retval)
->_display();
}
/**
* helper function for redirecting to initial page for person from a prestudent-specific page
* @param $prestudent_id
* @param $section optional section of the page to go to
*/
private function __redirectToStart($prestudent_id, $section = '')
{
$this->PrestudentModel->addSelect('person_id');
$person_id = $this->PrestudentModel->load($prestudent_id)->retval[0]->person_id;
redirect('/system/infocenter/InfocenterDetails/showDetails/'.$person_id.'#'.$section);
}
/**
* helper function retrieves personid and studiengang kurzbz from a prestudent id
* @param $prestudent_id
* @return array
*/
private function __getPersonAndStudiengangFromPrestudent($prestudent_id)
{
$prestudent = $this->PrestudentModel->getPrestudentWithZgv($prestudent_id);
if ($prestudent->error)
{
show_error($prestudent->retval);
}
$person_id = $prestudent->retval[0]->person_id;
$studiengang_kurzbz = $prestudent->retval[0]->studiengang;
return array('person_id' => $person_id, 'studiengang_kurzbz' => $studiengang_kurzbz);
}
}
+55 -7
View File
@@ -23,6 +23,9 @@ class DB_Model extends FHC_Model
protected $hasSequence; // False if this table has a composite primary key that is not using a sequence
// True if this table has a primary key that uses a sequence
private $executedQueryMetaData;
private $executedQueryListFields;
/**
* Constructor
*/
@@ -670,6 +673,48 @@ class DB_Model extends FHC_Model
return $this->fieldExists(UDFLib::COLUMN_NAME);
}
/**
* Get the list of the fields after having executed a query
*/
public function getExecutedQueryListFields()
{
return $this->executedQueryListFields;
}
/**
* Get meda data info about the retrived fields after having executed a query
*/
public function getExecutedQueryMetaData()
{
return $this->executedQueryMetaData;
}
/**
* Like execQuery, but it allows only to perform queries to read data
*/
public function execReadOnlyQuery($query, $parametersArray = null)
{
$result = error('You are allowed to run only query for reading data'); //
$cleanedQuery = trim(preg_replace('/\t|\n|\r|;/', '', $query)); //
//
if (stripos($cleanedQuery, 'SELECT') == 0
&& (stripos($cleanedQuery, 'INSERT') > 0 || stripos($cleanedQuery, 'INSERT') == false)
&& (stripos($cleanedQuery, 'UPDATE') > 0 || stripos($cleanedQuery, 'UPDATE') == false)
&& (stripos($cleanedQuery, 'CREATE') > 0 || stripos($cleanedQuery, 'CREATE') == false)
&& (stripos($cleanedQuery, 'DELETE') > 0 || stripos($cleanedQuery, 'DELETE') == false)
&& (stripos($cleanedQuery, 'ALTER') > 0 || stripos($cleanedQuery, 'ALTER') == false)
&& (stripos($cleanedQuery, 'GRANT') > 0 || stripos($cleanedQuery, 'GRANT') == false)
&& (stripos($cleanedQuery, 'DROP') > 0 || stripos($cleanedQuery, 'DROP') == false))
{
$queryToExec = str_replace(';', '', $query); //
$result = $this->execQuery($queryToExec, $parametersArray);
}
return $result;
}
// ------------------------------------------------------------------------------------------
// Protected methods
@@ -809,20 +854,23 @@ class DB_Model extends FHC_Model
if (is_object($result))
{
$toBeConverterdArray = array(); // Fields to be converted
$metaDataArray = $result->field_data(); // Fields information
for ($i = 0; $i < count($metaDataArray); $i++) // Looking for booleans and arrays
$this->executedQueryMetaData = $result->field_data(); // Fields information
$this->executedQueryListFields = $result->list_fields(); // List of the retrived fields
for ($i = 0; $i < count($this->executedQueryMetaData); $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
|| $metaDataArray[$i]->type == DB_Model::PGSQL_BOOLEAN_TYPE
|| $this->udflib->isUDFColumn($metaDataArray[$i]->name, $metaDataArray[$i]->type))
if (strpos($this->executedQueryMetaData[$i]->type, DB_Model::PGSQL_ARRAY_TYPE) !== false
|| $this->executedQueryMetaData[$i]->type == DB_Model::PGSQL_BOOLEAN_TYPE
|| $this->udflib->isUDFColumn($this->executedQueryMetaData[$i]->name, $this->executedQueryMetaData[$i]->type))
{
// Name and type of the field to be converted
$toBeConverted = new stdClass();
// Set the type of the field to be converted
$toBeConverted->type = $metaDataArray[$i]->type;
$toBeConverted->type = $this->executedQueryMetaData[$i]->type;
// Set the name of the field to be converted
$toBeConverted->name = $metaDataArray[$i]->name;
$toBeConverted->name = $this->executedQueryMetaData[$i]->name;
// Add the field to be converted to $toBeConverterdArray
array_push($toBeConverterdArray, $toBeConverted);
}
Executable → Regular
View File
@@ -0,0 +1 @@
Executable → Regular
View File
@@ -0,0 +1 @@
Executable → Regular
View File
Executable → Regular
View File
View File
Executable → Regular
View File
View File
+29 -28
View File
@@ -14,16 +14,17 @@ class CallerLib
const LIB_FILE_EXTENSION = '.php';
const LIBS_PATH = 'libraries';
const MODEL_PREFIX = '_model';
// Black list of resources that are no allowed to be used
private static $RESOURCES_BLACK_LIST = array(
'CallerLib', // disabled self loading
'LogLib', // hardly usefull and virtually dangerous
'MigrationLib', // virtually dangerous, DB manipulation
'FilesystemLib', // virtually dangerous, direct access to file system
'PermissionLib' // usefull?
'PermissionLib', // usefull?
'PersonLogLib'
);
/**
* Object initialization
*/
@@ -31,14 +32,14 @@ class CallerLib
{
// Gets CI instance
$this->ci =& get_instance();
// Loads helper message to manage returning messages
$this->ci->load->helper('Message');
// Loads permission library
$this->ci->load->library('PermissionLib');
}
/**
* Wrapper method for _call
*/
@@ -46,7 +47,7 @@ class CallerLib
{
return $this->_call($callParameters, $permissionType);
}
/**
* Wrapper method for _call
*/
@@ -54,7 +55,7 @@ class CallerLib
{
return $this->_call($callParameters, $permissionType);
}
/**
* Everything starts here...
*/
@@ -63,7 +64,7 @@ class CallerLib
$result = null;
$parameters = $this->_getParameters($callParameters);
$validation = $this->_validateCall($parameters);
// If the validation was passed
if (isSuccess($validation))
{
@@ -119,7 +120,7 @@ class CallerLib
{
$result = error('Neither a lib nor model: '.$parameters->resourcePath.$parameters->resourceName);
}
// If the resource was found and loaded
if (!is_null($loaded))
{
@@ -134,10 +135,10 @@ class CallerLib
{
$result = $validation;
}
return $result;
}
/**
* Gets the parameters from the http call
* Search for parameters <RESOURCE_PARAMETER> and <FUNCTION_PARAMETER>
@@ -181,7 +182,7 @@ class CallerLib
return $parameters;
}
/**
* Validate the given parameters
*/
@@ -224,7 +225,7 @@ class CallerLib
{
$loaded = null;
$result = null;
try
{
$loaded = $this->ci->load->model($resourcePath.$resourceName);
@@ -234,15 +235,15 @@ class CallerLib
// Errors while loading the model
$result = error('Errors while loading the model: '.$e->getMessage());
}
if (!is_null($loaded))
{
$result = success($loaded);
}
return $result;
}
/**
* Search for a valid permission for this library that should be present with this format:
* '<library path>.<library name>.<library method name>' => '<permission>'
@@ -251,14 +252,14 @@ class CallerLib
{
$result = null;
$permissionPath = '';
if ($resourcePath != '')
{
$permissionPath = $resourcePath;
}
$permissionPath .= $resourceName.'.'.$function;
if ($this->ci->permissionlib->isEntitled($permissionPath, $permissionType) === false)
{
$result = error(FHC_NORIGHT, FHC_NORIGHT);
@@ -267,10 +268,10 @@ class CallerLib
{
$result = success('Has permission');
}
return $result;
}
/**
* Loads a library using the given path and name
*
@@ -286,7 +287,7 @@ class CallerLib
private function _loadLibrary($resourcePath, $resourceName)
{
$loaded = null;
try
{
// Gets all the configured resources paths
@@ -328,15 +329,15 @@ class CallerLib
// Errors while loading the library
$result = error('Errors while loading the library: '.$e->getMessage());
}
if (!is_null($loaded))
{
$result = success($loaded);
}
return $result;
}
/**
* Calls a method of a class with the given parameters and returns its result
*
@@ -347,7 +348,7 @@ class CallerLib
private function _callThis($resourceName, $function, $parameters)
{
$result = null;
try
{
// Get informations about the function
@@ -402,7 +403,7 @@ class CallerLib
{
$result = error($e->getMessage());
}
return $result;
}
}
+83 -26
View File
@@ -12,18 +12,21 @@ class DmsLib
public function __construct()
{
$this->ci =& get_instance();
$this->ci->load->model('crm/Akte_model', 'AkteModel');
$this->ci->load->model('content/Dms_model', 'DmsModel');
$this->ci->load->model('content/DmsVersion_model', 'DmsVersionModel');
$this->ci->load->model('content/DmsFS_model', 'DmsFSModel');
// Loads helper message to manage returning messages
$this->ci->load->helper('message');
}
/**
* read
* Read a DMS Document from the Filesystem
* @param int $dms_id ID of the Document.
* @param int $version The version of the Document (latest if null).
* @return object success or error
*/
public function read($dms_id, $version = null)
{
@@ -44,7 +47,7 @@ class DmsLib
$result = $this->ci->DmsModel->loadWhere(array('dms_id' => $dms_id, 'version' => $version));
}
}
if (hasData($result))
{
$resultFS = $this->ci->DmsFSModel->read($result->retval[0]->filename);
@@ -57,20 +60,26 @@ class DmsLib
$result = $resultFS;
}
}
return $result;
}
/**
* getAktenAcceptedDms
* Get all accepted Documents of a Person
*
* @param int $person_id ID of the person.
* @param string $dokument_kurzbz Type of document.
* @param bool $no_file If null then loads also the content.
* @return object success or error
*/
public function getAktenAcceptedDms($person_id, $dokument_kurzbz = null, $no_file = null)
{
$result = $this->ci->AkteModel->getAktenAcceptedDms($person_id, $dokument_kurzbz);
if (hasData($result) && $no_file == null)
{
for ($i = 0; $i < count($result->retval); $i++)
$cnt = count($result->retval);
for ($i = 0; $i < $cnt; $i++)
{
$resultFS = $this->ci->DmsFSModel->read($result->retval[$i]->filename);
if (isSuccess($resultFS))
@@ -83,12 +92,14 @@ class DmsLib
}
}
}
return $result;
}
/**
* save
* Saves a Document
* @param object $dms DMS Object ot be saved.
* @return object
*/
public function save($dms)
{
@@ -142,30 +153,34 @@ class DmsLib
return $result;
}
/**
* delete
* Deletes a Akte of a Person
* @param int $person_id ID of the person.
* @param int $dms_id Id of the Document.
* @return object
*/
public function delete($person_id, $dms_id)
{
$result = null;
// If the parameters are valid
if (is_numeric($person_id) && is_numeric($dms_id))
{
// Start DB transaction
$this->ci->db->trans_start(false);
// Get akte_id from table tbl_akte
$result = $this->ci->AkteModel->loadWhere(array('person_id' => $person_id, 'dms_id' => $dms_id));
if (isSuccess($result))
{
// Delete all entries in tbl_akte
for ($i = 0; $i < count($result->retval); $i++)
$cnt = count($result->retval);
for ($i = 0; $i < $cnt; $i++)
{
$this->ci->AkteModel->delete($result->retval[$i]->akte_id);
}
// Get all filenames related to this dms
$resultFileNames = $this->ci->DmsVersionModel->loadWhere(array('dms_id' => $dms_id));
if (isSuccess($resultFileNames))
@@ -179,10 +194,10 @@ class DmsLib
}
}
}
// Transaction complete!
$this->ci->db->trans_complete();
// Check if everything went ok during the transaction
if ($this->ci->db->trans_status() === false || isError($result))
{
@@ -194,12 +209,13 @@ class DmsLib
$this->ci->db->trans_commit();
$result = success('Dms successfully removed from DB');
}
// If everything is ok
if (isSuccess($result))
{
$cnt = count($resultFileNames->retval);
// Remove all files related to this person and dms
for ($i = 0; $i < count($resultFileNames->retval); $i++)
for ($i = 0; $i < $cnt; $i++)
{
$this->ci->DmsFSModel->remove($resultFileNames->retval[$i]->filename);
}
@@ -209,17 +225,56 @@ class DmsLib
{
$result = error('Invalid parameters');
}
return $result;
}
/**
* _saveFileOnInsert
* Loads the Content of an akte
* @param int $akte_id Id of the akte.
* @return object with document content or error
*/
public function getAkteContent($akte_id)
{
$akte = $this->ci->AkteModel->load($akte_id);
if (hasData($akte))
{
if ($akte->retval[0]->inhalt != '')
{
return success(base64_decode($akte->retval[0]->inhalt));
}
elseif ($akte->retval[0]->dms_id != '')
{
$dmscontent = $this->read($akte->retval[0]->dms_id);
if (isSuccess($dmscontent))
{
return success(base64_decode($dmscontent->retval[0]->file_content));
}
else
{
return error($dmscontent->retval);
}
}
else
{
return error('No Content available');
}
}
else
{
return error($akte->retval);
}
}
/**
* Saves the Content of a DMS in the Filesystem
* @param object $dms DMS object to be saved.
* @return object
*/
private function _saveFileOnInsert($dms)
{
$filename = uniqid().'.'.pathinfo($dms['name'], PATHINFO_EXTENSION);
$result = $this->ci->DmsFSModel->write($filename, $dms['file_content']);
if (isSuccess($result))
{
@@ -230,7 +285,9 @@ class DmsLib
}
/**
* _saveFileOnUpdate
* Updates the File in the Filesystem
* @param object $dms DMS object to update.
* @return object
*/
private function _saveFileOnUpdate($dms)
{
+191
View File
@@ -0,0 +1,191 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
class DocumentLib
{
private $unoconv_version;
/**
* Constructor
*/
public function __construct()
{
// Gets CI instance
$this->ci =& get_instance();
exec('unoconv --version', $ret_arr);
if(isset($ret_arr[0]))
{
$hlp = explode(' ', $ret_arr[0]);
if(isset($hlp[1]))
{
$this->unoconv_version = $hlp[1];
}
else
show_error('Could not get Unoconv Version');
}
else
show_error('Unoconv not found - Please install Unoconv');
}
/**
* Converts a File to PDF
* @param string $filename Full path to the file.
* @return success or error object
*/
public function convertToPDF($filename)
{
if (!file_exists($filename))
return error('Unable to Convert to PDF. File not found:'.$filename);
$mimetype = mime_content_type($filename);
$outFile = sys_get_temp_dir().'/FHC_'.uniqid().'.pdf';
switch ($mimetype)
{
case 'image/jpeg':
case 'image/jpg':
case 'image/pjpeg':
$this->_jpegtopdf($filename, $outFile);
return success($outFile);
case 'application/vnd.oasis.opendocument.spreadsheet':
case 'application/msword':
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
case 'application/haansoftdocx':
case 'application/vnd.ms-word':
case 'application/vnd.oasis.opendocument.text':
case 'text/plain':
$this->convert($filename, $outFile, 'pdf');
return success($outFile);
case 'application/pdf':
return success($filename);
default:
return error('Unknown Mimetype:'.$mimetype);
}
}
/**
* Combines multiple single PDFs to one PDF
*
* @param array $files Array of Files to merge (full path to file).
* @param string $outFile Path to the Output File.
* @return success or error object
*/
public function mergePDF($files, $outFile)
{
$cmd = "gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$outFile ";
$finfo = finfo_open(FILEINFO_MIME_TYPE);
// add all pdf files to the command
foreach ($files as $f)
{
$cmd .= $f." ";
if (!file_exists($f))
{
return error("File not found: '$f'");
}
if (finfo_file($finfo, $f) != "application/pdf")
{
return error("Wrong format(".finfo_file($finfo, $f)."): '$f'");
}
}
finfo_close($finfo);
exec($cmd, $out, $ret);
if ($ret != 0)
{
return error('PDF-zusammenfuegung ist derzeit nicht möglich. Bitte informieren Sie den Administrator');
}
return success(true);
}
/**
* Converts a Document to another format with unoconv
*
* @param string $inFile File that should be convertet.
* @param string $outFile Name of the Output File.
* @param string $format Outputformat (PDF, DOC, ...).
* @return success or error Object
*/
public function convert($inFile, $outFile, $format)
{
if ($this->unoconv_version == '0.6')
$command = 'unoconv -f %1$s %3$s > %2$s';
else
$command = 'unoconv -f %s --output %s %s 2>&1';
$command = sprintf($command, $format, $outFile, $inFile);
exec($command, $out, $ret);
if ($ret != 0)
{
return error('Dokumentenkonvertierung ist derzeit nicht möglich. Bitte informieren Sie den Administrator');
}
return success(true);
}
/**
* Converts a JPG to PDF
*
* @param string $filename Path to JPG.
* @param string $outfile Path to Output (pdf) File.
* @return success or error object
*/
private function _jpegtopdf($filename, $outfile)
{
if (!file_exists($filename))
return error('File does not exists');
$size = getimagesize($filename);
$margin_left_right = 18;
$margin_bottom = 18;
/*
* längere Seite ermitteln
* Hochformat wenn die Seiten gleich lang sind oder das Bild schmäler ist als die Seitenbreite
*/
if ($size[0] > $size[1] && $size[0] > 595)
{
$page_height = 595;
$page_width = 842;
//Wenn Bild kleiner oder gleich Seitenbreite, dann margin erhoehen
if ($size[0] <= $page_width)
{
$margin_left_right = ($page_width - $size[0]) / 2;
$margin_bottom = ($page_height - $size[1]);
}
}
else
{
$page_height = 842;
$page_width = 595;
//Wenn Bild kleiner oder gleich Seitenbreite, dann margin erhoehen
if ($size[0] <= $page_width)
{
$margin_left_right = ($page_width - $size[0]) / 2;
$margin_bottom = ($page_height - $size[1]);
}
}
// -r300 = 300 ppi
$cmd = 'gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -r100 ';
$cmd .= '-o '.$outfile.' viewjpeg.ps -c "('.$filename.') ';
$cmd .= '<< /PageSize ['.$page_width.' '.$page_height.'] ';
$cmd .= '/.HWMargins ['.$margin_left_right.' '.$margin_bottom.' '.$margin_left_right.' 18] ';
$cmd .= '/countspaces { [ exch { dup 32 ne { pop } if } forall ] length } bind def >> ';
$cmd .= 'setpagedevice viewJPEG"';
exec($cmd, $out, $ret);
if ($ret != 0)
{
$this->errormsg = 'jpegToPdf ist derzeit nicht möglich. Bitte informieren Sie den Administrator';
return false;
}
return true;
}
}
+138
View File
@@ -0,0 +1,138 @@
<?php
if (! defined("BASEPATH")) exit("No direct script access allowed");
/**
* Enhanced printf utility library
* Usefull to print messages in a fancy and cool way from CLI and web interface
*/
class EPrintfLib
{
// Prefixes and separator for messages
const MSG_PREFIX = "[-]";
const INFO_PREFIX = "[I]";
const ERROR_PREFIX = "[E]";
const SEPARATOR = "------------------------------";
// Console colors codes
const ERROR_COLOR = 31;
const INFO_COLOR = 33;
const PRINT_QUERY_LEN = 60;
// HTML colors names
private $HTML_COLORS = array(31 => "red", 33 => "orange");
// Used to set if the migration process is called via command line or via browser
private $cli;
/**
* Object initialization
*/
public function __construct()
{
// Get code igniter instance
$this->ci =& get_instance();
$this->setCli();
}
// -------------------------------------------------------------------------------------------------
// Public methods
/**
* Prints a formatted message
*/
public function printMessage($message)
{
$this->_print(EPrintfLib::MSG_PREFIX, $message);
}
/**
* Prints a formatted info
*/
public function printInfo($info)
{
$this->_print(EPrintfLib::INFO_PREFIX, $info, EPrintfLib::INFO_COLOR);
}
/**
* Prints a formatted error
*/
public function printError($error)
{
$this->_print(EPrintfLib::ERROR_PREFIX, $error, EPrintfLib::ERROR_COLOR);
}
/**
* Print only the end of line
*/
public function printEOL()
{
echo $this->getEOL();
}
// -------------------------------------------------------------------------------------------------
// Private methods
/**
* Set property cli to false if the migration process is called via command line
* otherwise to false if it's called via browser
*/
private function setCli()
{
if ($this->ci->input->is_cli_request())
{
$this->cli = true;
}
else
{
$this->cli = false;
}
}
/**
* Returns the character of end of line
* PHP_EOL platform dependent if cli is true
* Tag <br> if cli is false
*/
private function getEOL()
{
if ($this->cli === true)
{
return PHP_EOL;
}
else
{
return "<br>";
}
}
/**
* Returns the string needed to color the output
*/
private function getColored($color)
{
$colored = "%s";
if (!is_null($color))
{
if ($this->cli === true)
{
$colored = "\033[".$color."m%s\033[37m";
}
else
{
$colored = "<font color=\"".$this->HTML_COLORS[$color]."\">%s</font>";
}
}
return $colored;
}
/**
* Print a message, even colored if specified
*/
private function _print($prefix, $text, $color = null)
{
printf($this->getColored($color), sprintf("%s %s".$this->getEOL(), $prefix, $text));
}
}
+886
View File
@@ -0,0 +1,886 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Library to manage core extensions
*/
class ExtensionsLib
{
const SQL_DIRECTORY = 'sql'; // directory where to retrive SQL scripts
const SQL_FILE_EXTENSION = '.sql'; // SQL scripts file extension
const FILE_INPUT_NAME = 'extension'; // name of the HTTP parameter containing the archive data
const EXTENSION_JSON_NAME = 'extension.json'; // file that contains extension data
const EXTENSIONS_DIR_NAME = 'extensions'; // name of the directories where will be created the symlinks
private $ARCHIVE_EXTENSIONS = array('.tgz', '.tbz2'); // accepted file extensions for an uploaded extension
private $UPLOAD_PATH; // temporary directory to store the upload file and checks the archive
private $EXTENSIONS_PATH; // directory where all the extensions are
// Directories that are part of the extension archive
private $SOFTLINK_TARGET_DIRECTORIES = array('config', 'controllers', 'helpers', 'hooks', 'libraries', 'models', 'views', 'widgets');
private $_errorOccurred; // boolean, true if an error occurred while installing an extension
private $_currentInstalledExtensionVersion; // contains the version of the current installation of an extension
/**
* Class constructor
*/
public function __construct()
{
$this->UPLOAD_PATH = APPPATH.'tmp/';
$this->EXTENSIONS_PATH = APPPATH.'extensions/';
// Get code igniter instance
$this->ci =& get_instance();
// Loads message configurationx
$this->ci->config->load('message');
// Loads EPrintfLib
$this->ci->load->library('EPrintfLib');
// Loading models
$this->ci->load->model('system/Extensions_model', 'ExtensionsModel');
// Set default values fot class properties
$this->_errorOccurred = false;
$this->_currentInstalledExtensionVersion = 0;
}
// -------------------------------------------------------------------------------------------------
// Public methods
/**
* Main method to install an extension
*/
public function installExtension()
{
$extensionDB = null; // contains data from DB about an extension
$extensionJson = null; // contains the extension.json data
$this->_printInfo('WARNING!!! Please do not change page or stop this procedure before it is finished');
$this->_loadUploadLibrary(); // loads CI upload library
$uploadData = $this->_uploadExtension(); // perform the upload of the file and returns info about it
if ($uploadData != null) // if no error occurred
{
$this->_extractExtension($uploadData->fullPath); // extract the archive of the uploaded extension
if (!$this->_errorOccurred) // if no error occurred
{
// Retives data about any previous installation of this extension
$extensionDB = $this->_loadPreviousInstallation($uploadData->extensionName);
}
if (!$this->_errorOccurred) // if no error occurred
{
// Checks the structure of the uploaded extension
$this->_chkFSStructure($uploadData->extensionName);
}
if (!$this->_errorOccurred) // if no error occurred
{
// Checks file extension.json and returns its content
$extensionJson = $this->_chkExtensionJson($uploadData->extensionName, $extensionDB);
}
if ($extensionJson != null) // if no error occurred
{
$this->_printStart('Proceding with the installation of the extension: '.$extensionJson->name);
$this->_printEnd();
$this->_cleanPreviousInstallation($extensionJson); // cleans any previous installation
$this->_installExtension($extensionJson); // records extension data in DB
if (!$this->_errorOccurred) // if no error occurred
{
// Loads and executes neede SQL scripts
$this->_loadSQLs(
$this->UPLOAD_PATH.$extensionJson->name.'/'.ExtensionsLib::SQL_DIRECTORY,
$extensionJson
);
}
if (!$this->_errorOccurred) // if no error occurred
{
// Move the extracted extension from the temporary directory to the extensions install directory
$this->_moveExtension($extensionJson->name);
}
if (!$this->_errorOccurred) // if no error occurred
{
// Create the symlinks to the installed extension
$this->_createSymLinks($extensionJson->name);
}
}
else
{
$this->_errorOccurred = true;
}
}
else
{
$this->_errorOccurred = true;
}
if ($this->_errorOccurred === false) // if no errors occurred
{
if (!$this->_rrm($uploadData->fullPath)) // removes uploaded file
{
$this->_printInfo('Error while cleaning upload directory. Not a blocking error');
}
$this->_printMessage('Extension correctly installed, you can safely close this page');
}
else
{
$this->_printError('There was a blocking error while installing/updating an extension, rolling back');
$this->_rollback($uploadData, $extensionDB, $extensionJson); // rock & rollback!
}
}
/**
* Delete an installed extension using the extension_id stored in the DB
*/
public function delExtension($extensionId)
{
$delExtension = false;
// Loads data about this extension from the DB
$result = $this->ci->ExtensionsModel->load($extensionId);
if (hasData($result)) // if something was found
{
$extensionName = $result->retval[0]->name; // extension name
$this->_delSoftLinks($extensionName); // not to be checked, could fail if the extension is disabled
// remove the extension from the extensions installation directory
$delExtension = $this->_rrm($this->EXTENSIONS_PATH.$extensionName);
// Select all the version of this extension
$this->ci->ExtensionsModel->addSelect('extension_id');
$result = $this->ci->ExtensionsModel->loadWhere(array('name' => $extensionName));
if (hasData($result)) // if something was found
{
$extsArray = array();
foreach ($result->retval as $key => $extension) // loops on them
{
// Remove them all
$result = $this->ci->ExtensionsModel->delete($extension->extension_id);
if (isSuccess($result))
{
$delExtension = true;
}
}
}
}
return $delExtension;
}
/**
* Retrive the list of all the installed extensions
*/
public function getInstalledExtensions()
{
return $this->ci->ExtensionsModel->getInstalledExtensions();
}
/**
* To enable an extension
*/
public function enableExtension($extensionId)
{
return $this->_toggleExtension($extensionId, true);
}
/**
* To disable an extension
*/
public function disableExtension($extensionId)
{
return $this->_toggleExtension($extensionId, false);
}
// -------------------------------------------------------------------------------------------------
// Private methods
/**
* Loads the upload library of CI
*/
private function _loadUploadLibrary()
{
$this->ci->load->library(
'upload',
array(
'upload_path' => $this->UPLOAD_PATH,
'allowed_types' => '*',
'overwrite' => true
)
);
}
/**
* Perform the upload of an extension archive and returns its data
*/
private function _uploadExtension()
{
$_uploadExtension = null;
$this->_printStart('Uploading extension');
// If the upload was a success
if ($this->ci->upload->do_upload(ExtensionsLib::FILE_INPUT_NAME))
{
$uploadData = $this->ci->upload->data(); // retrives data about the uploaded file
// Checks the file extension
$uploadedFileExtension = '.'.pathinfo($uploadData['full_path'], PATHINFO_EXTENSION);
if (!in_array($uploadedFileExtension, $this->ARCHIVE_EXTENSIONS))
{
$this->_printFailure('file extension must be tgz OR tbz2');
// Remove the uploaded file
if (isset($uploadData['full_path']) && file_exists($uploadData['full_path']))
{
$this->_rrm($uploadData['full_path']);
}
}
else
{
// Returns the extension name and the full path of the uploaded file
$_uploadExtension = new stdClass();
$_uploadExtension->extensionName = str_replace($this->ARCHIVE_EXTENSIONS, '', $uploadData['file_name']);
$_uploadExtension->fullPath = $uploadData['full_path'];
}
}
else
{
$this->_printFailure($this->ci->upload->display_errors('', ''));
}
$this->_printSuccess($_uploadExtension != null);
$this->_printEnd();
return $_uploadExtension;
}
/**
* To extract the extension archive
*/
private function _extractExtension($uploadPath)
{
$this->_printStart('Extracting extension');
try
{
// Extracts the uploaded file
$pd = new PharData($uploadPath);
$pd->extractTo($this->UPLOAD_PATH, null, true);
}
catch (UnexpectedValueException $uva)
{
$this->_errorOccurred = true;
$this->_printFailure('provided an invalid archive');
}
catch (PharException $pe)
{
$this->_errorOccurred = true;
$this->_printFailure('generic error occurred, check logs');
}
$this->_printSuccess(!$this->_errorOccurred);
$this->_printEnd();
}
/**
* Loads any previous installations of the given extension from DB
*/
private function _loadPreviousInstallation($extensionName)
{
$extensionDB = null;
$this->_printStart('Loads any previous installation data');
// Loads the last version of the previous installation of this extension
$this->ci->ExtensionsModel->addOrder('version', 'DESC');
$this->ci->ExtensionsModel->addLimit(1);
$result = $this->ci->ExtensionsModel->loadWhere(array('name' => $extensionName));
if (isError($result))
{
$this->_errorOccurred = true;
$this->_printFailure('data base error: '.$result->retval);
}
else
{
if (hasData($result)) // if found
{
$extensionDB = $result->retval[0]; // return it!
}
else
{
$this->_printMessage('not found');
}
}
$this->_printSuccess(!$this->_errorOccurred);
$this->_printEnd();
return $extensionDB;
}
/**
* Checks the structure of the extension archive
*/
private function _chkFSStructure($extensionName)
{
$this->_printStart('Checking extension file system structure');
// Checks if the root directory of this archive has the same name of the extension
if (is_dir($this->UPLOAD_PATH.$extensionName))
{
// Checks if file extension.json exists inside the uploaded archive
if (!file_exists($this->UPLOAD_PATH.$extensionName.'/'.ExtensionsLib::EXTENSION_JSON_NAME))
{
$this->_errorOccurred = true;
$this->_printFailure('missing extension.json');
}
}
else
{
$this->_errorOccurred = true;
$this->_printFailure('the root directory of the archive must have the same extension name');
}
$this->_printSuccess(!$this->_errorOccurred);
$this->_printEnd();
}
/**
* Checks if extension.json is correct
*/
private function _chkExtensionJson($extensionName, $extensionDB)
{
$this->_printStart('Parsing and checking extension.json');
// Decodes extension.json
$extensionJson = json_decode(
file_get_contents($this->UPLOAD_PATH.$extensionName.'/'.ExtensionsLib::EXTENSION_JSON_NAME)
);
// Checks if the parameter name of the extension.json has the same value of the extension name
if ($extensionJson != null && isset($extensionJson->name) && $extensionJson->name == $extensionName)
{
// Checks if the parameter version of the extension.json file exists
if (isset($extensionJson->version))
{
$extensionJson->currentInstalledVersion = 0; // default current installed version of this extension
if ($extensionDB != null) // if no previous installation was found in DB
{
$extensionJson->extension_id = $extensionDB->extension_id; // get the extension_id from DB
$extensionJson->currentInstalledVersion = $extensionDB->version; // get the current installed version from DB
$this->_printMessage('Extension already installed!');
$this->_printMessage('Current version: '.$extensionDB->version);
$this->_printMessage('Version of the uploaded extension: '.$extensionJson->version);
if ($extensionJson->version == $extensionDB->version)
{
$this->_printMessage('Updating the same version!');
}
elseif ($extensionJson->version > $extensionDB->version)
{
$this->_printMessage('Updating to a new version!');
}
else // downgrade is not possible
{
$extensionJson = null;
$this->_printFailure('downgrade must be performed manually');
}
}
else
{
$this->_printMessage('Version of the uploaded extension: '.$extensionJson->version);
}
// If no errors occurred
if ($extensionJson != null)
{
require_once('version.php'); // get the core version
// Checks if the required core version of the extension is the same of this system
if (isset($extensionJson->core_version) && $extensionJson->core_version == $fhcomplete_version)
{
$this->_printMessage('Required core version: '.$extensionJson->core_version);
$this->_printMessage('Current core version: '.$fhcomplete_version);
// Checks parameter dependencies of the extension.json
if (isset($extensionJson->dependencies)
&& is_array($extensionJson->dependencies)
&& count($extensionJson->dependencies) > 0)
{
// Gets the required dependencies
$result = $this->ci->ExtensionsModel->getDependencies($extensionJson->dependencies);
// If they are matcheds
if (hasData($result) && count($result->retval) == count($extensionJson->dependencies))
{
if (isset($extensionJson->dependencies))
{
$extensionJson->dependencies = str_replace('[', '{', json_encode($extensionJson->dependencies));
$extensionJson->dependencies = str_replace(']', '}', $extensionJson->dependencies);
$this->_printMessage('Required dependencies: '.$extensionJson->dependencies);
}
else
{
$extensionJson->dependencies = '';
$this->_printMessage('No dependencies are required');
}
}
else // Otherwise not to be installed
{
$extensionJson = null;
$this->_printFailure('dependencies are missing, install them to proceed');
}
}
// Malformed dependencies parameter
elseif (isset($extensionJson->dependencies) && !is_array($extensionJson->dependencies))
{
$extensionJson = null;
$this->_printFailure('dependencies parameter must be an array');
}
// No dependencies required
elseif (!isset($extensionJson->dependencies))
{
$this->_printMessage('No dependencies are required');
}
}
else
{
$extensionJson = null;
$this->_printFailure('core_version parameter is missing or it is not equal to the versione of the core');
}
}
}
else
{
$extensionJson = null;
$this->_printFailure('version is missing');
}
}
else
{
$extensionJson = null;
$this->_printFailure('name is missing or not equal to extension name');
}
$this->_printSuccess($extensionJson != null);
$this->_printEnd();
return $extensionJson;
}
/**
* Clean any previous installations of the given archive
*/
private function _cleanPreviousInstallation($extensionJson)
{
$this->_printStart('Cleaning any previous installations in DB and file system');
// If a previous installation of this extension was found
if (isset($extensionJson->extension_id))
{
// Off with their heads!
if ($this->delExtension($extensionJson->extension_id))
{
$this->_printSuccess(true);
}
else
{
$this->_printFailure('please check logs');
}
}
else
{
$this->_printMessage('No need to clean, no previous installations found');
}
$this->_printEnd();
}
/**
* Insert extension's data into the DB
*/
private function _installExtension($extensionJson)
{
$this->_printStart('Adding new entry in the DB');
$result = $this->ci->ExtensionsModel->insert(
array(
'name' => $extensionJson->name,
'description' => isset($extensionJson->description) ? $extensionJson->description : null,
'version' => $extensionJson->version,
'license' => isset($extensionJson->license) ? $extensionJson->license : null,
'url' => isset($extensionJson->url) ? $extensionJson->url : null,
'core_version' => $extensionJson->core_version,
'dependencies' => isset($extensionJson->dependencies) ? $extensionJson->dependencies : null
)
);
if (isSuccess($result))
{
$this->_printSuccess(true);
}
else
{
$this->_errorOccurred = true;
$this->_printFailure('error while saving extension into DB');
}
$this->_printEnd();
}
/**
* Loads all the SQL scripts from the extension archive and executes them
*/
private function _loadSQLs($pkgSQLsPath, $extensionJson)
{
$this->_printStart('Loading and executing SQL files');
$this->_printInfo('WARNING: if this step will fail, the database and all the directories');
$this->_printInfo('have to be clean manually before install again this extension');
$startVersion = $extensionJson->currentInstalledVersion; // current installed version extension
// If the current installed version extension is less then the uploaded extension
if ($extensionJson->currentInstalledVersion < $extensionJson->version)
{
$startVersion++; // +1
}
// Loops through the versions
for ($sqlDir = $startVersion; $sqlDir <= $extensionJson->version; $sqlDir++)
{
// If a directory with the same value of the version is present in the sql scripts directory
if (($files = glob($pkgSQLsPath.'/'.$sqlDir.'/*'.ExtensionsLib::SQL_FILE_EXTENSION)) != false)
{
// Loads every sql files
foreach ($files as $file)
{
$sql = file_get_contents($file); // gets the entire content of the file
$this->_printMessage('Executing query:');
$this->_printMessage($sql);
// Try to execute that
if (!isSuccess($result = @$this->ci->ExtensionsModel->executeQuery($sql)))
{
$this->_errorOccurred = true;
$this->_printFailure(' error occurred while executing the query');
$this->_printInfo('Is not possible to rollback the DB changes, must be done manually');
break;
}
else
{
$this->_printMessage('Query result:');
var_dump($result->retval); // KEEP IT!!!
$this->ci->eprintflib->printEOL();
}
}
}
}
$this->_printSuccess(!$this->_errorOccurred);
$this->_printEnd();
}
/**
* Move the extension extracted archive from the temporary directory to the extensions install directory
*/
private function _moveExtension($extensionName)
{
$this->_printStart('Moving the upload extension from upload folder to extension folder');
$this->_printMessage('Current extension directory: '.$this->UPLOAD_PATH.$extensionName);
$this->_printMessage('Directory where it will be moved: '.$this->EXTENSIONS_PATH.$extensionName);
if (rename($this->UPLOAD_PATH.$extensionName.'/', $this->EXTENSIONS_PATH.$extensionName))
{
$this->_printSuccess(true);
}
else
{
$this->_errorOccurred = true;
$this->_printFailure('error while moving');
}
$this->_printEnd();
}
/**
* Creates the symlinks to the installed extension
* Wrapper method to check the result of the operation and to print out info
*/
private function _createSymLinks($extensionName)
{
$this->_printStart('Creating symlinks');
if ($this->_addSoftLinks($extensionName))
{
$this->_printSuccess(true);
}
else
{
$this->_errorOccurred = true;
$this->_printFailure('error while creating sym links');
}
$this->_printEnd();
}
/**
* Remove all the symlinks to the installed extension
*/
private function _delSoftLinks($extensionName)
{
$_delSoftLinks = false;
foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $key => $targetDirectory)
{
if (file_exists(APPPATH.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName))
{
$_delSoftLinks = unlink(APPPATH.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName);
}
}
return $_delSoftLinks;
}
/**
* Recursive remove of a file or a directory
*/
private function _rrm($dir)
{
if (!file_exists($dir))
{
return true;
}
if (!is_dir($dir))
{
return unlink($dir);
}
foreach (scandir($dir) as $item)
{
if ($item == '.' || $item == '..')
{
continue;
}
if (!$this->_rrm($dir.DIRECTORY_SEPARATOR.$item))
{
return false;
}
}
return rmdir($dir);
}
/**
* Creates the symlinks to the installed extension
*/
private function _addSoftLinks($extensionName)
{
$_addSoftLinks = false;
$extensionPath = $this->EXTENSIONS_PATH.$extensionName.'/';
// For every target directory
foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $key => $targetDirectory)
{
// If destination of the symlink does not exist
if (!file_exists(APPPATH.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName))
{
// If the target directory does not exist than creates that
if (!is_dir($extensionPath.$targetDirectory))
{
mkdir($extensionPath.$targetDirectory);
}
// Create the symlink
$_addSoftLinks = symlink(
$extensionPath.$targetDirectory,
APPPATH.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName
);
if (!$_addSoftLinks)
{
break;
}
}
}
return $_addSoftLinks;
}
/**
* To rollback an extension installation
* It will be removed all the information about the given extension from DB and file system
*/
private function _rollback($uploadData, $extensionDB, $extensionJson)
{
$this->_printStart('Rolling back the installation');
$this->_printMessage('Removing the uploaded file from upload directory');
if ($uploadData != null && isset($uploadData->fullPath) && file_exists($uploadData->fullPath))
{
$this->_rrm($uploadData->fullPath);
}
$this->_printMessage('Removing the extracted data from the upload directory');
if ($uploadData != null
&& isset($uploadData->extensionName)
&& file_exists($this->UPLOAD_PATH.$uploadData->extensionName))
{
$this->_rrm($this->UPLOAD_PATH.$uploadData->extensionName);
}
// If the upload of the file is a success and the extension name is present and no previous installation were found
if ($uploadData != null && isset($uploadData->extensionName) && $extensionDB == null)
{
// Loads all the previous installations of this extension
$this->ci->ExtensionsModel->addOrder('version', 'DESC');
$this->ci->ExtensionsModel->addLimit(1);
$result = $this->ci->ExtensionsModel->loadWhere(array('name' => $uploadData->extensionName));
if (hasData($result)) // if found
{
// Remove them all from file system and DB
$this->_printMessage('Removing entries in the DB related to this extension');
$this->delExtension($result->retval[0]->extension_id);
}
}
else // otherwise
{
// Remove them all only from DB
if ($extensionJson != null && isset($extensionJson->extension_id))
{
$this->ci->ExtensionsModel->delete($extensionJson->extension_id);
}
}
$this->_printMessage('Rollback finished');
$this->_printEnd();
}
/**
* To enable/disable an extension
*/
private function _toggleExtension($extensionId, $enabled)
{
$_toggleExtension = false;
// Loads data from DB about the given extension
$result = $this->ci->ExtensionsModel->load($extensionId);
if (hasData($result))
{
$extensionName = $result->retval[0]->name; // extension name
// If to be enabled
if ($enabled === true)
{
// Add the symlinks
$_toggleExtension = $this->_addSoftLinks($extensionName);
}
else // If to be disabled
{
// Remove all the symlinks
$_toggleExtension = $this->_delSoftLinks($extensionName);
}
if ($_toggleExtension) // if is a success
{
// Updates DB
$result = $this->ci->ExtensionsModel->update($extensionId, array('enabled' => $enabled));
if (isSuccess($result))
{
$_toggleExtension = true;
}
else // if DB update fails remove symlinks from file system
{
$this->_delSoftLinks($extensionName);
}
}
}
return $_toggleExtension;
}
/**
* Wrapper method to print a generic error
*/
private function _printError($error)
{
$this->ci->eprintflib->printError($error);
}
/**
* Wrapper method to print an error
*/
private function _printFailure($error)
{
$this->_printError('Failed: '.$error);
}
/**
* Wrapper method to print a generic message
*/
private function _printMessage($message)
{
$this->ci->eprintflib->printMessage($message);
}
/**
* Wrapper method to print a success
*/
private function _printSuccess($cond)
{
if ($cond === true)
{
$this->_printMessage('Success!!!');
}
}
/**
* Wrapper method to print info
*/
private function _printInfo($info)
{
$this->ci->eprintflib->printInfo($info);
}
/**
* Wrapper method to print a start message
*/
private function _printStart($startMessage)
{
$this->_printInfo('------------------------------------------------------------------------------------------');
$this->_printMessage($startMessage);
}
/**
* Wrapper method to print an end message
*/
private function _printEnd()
{
$this->_printInfo('------------------------------------------------------------------------------------------');
}
}
+13 -13
View File
@@ -10,29 +10,29 @@ class LogLib
const DEBUG = 'debug';
const ERROR = 'error';
const INFO = 'info';
const CALLER_PREFIX = '[';
const CALLER_POSTFIX = ']';
const CLASS_POSTFIX = '->';
const LINE_SEPARATOR = ':';
/**
* format
*/
private function format($class, $function, $line)
{
$formatted = LogLib::CALLER_PREFIX;
if (!is_null($class) && $class != '')
{
$formatted .= $class.LogLib::CLASS_POSTFIX;
}
$formatted .= $function.LogLib::LINE_SEPARATOR.$line.LogLib::CALLER_POSTFIX.' ';
return $formatted;
}
/**
* getCaller
*/
@@ -44,20 +44,20 @@ class LogLib
$class = '';
$function = '';
$line = '';
if (isset(debug_backtrace()[$classIndex]['class']) && debug_backtrace()[$classIndex]['class'] != '')
$backtrace_arr = debug_backtrace();
if (isset($backtrace_arr[$classIndex]['class']) && $backtrace_arr[$classIndex]['class'] != '')
{
$class = debug_backtrace()[$classIndex]['class'];
$class = $backtrace_arr[$classIndex]['class'];
}
if (isset(debug_backtrace()[$functionIndex]['function']) && debug_backtrace()[$functionIndex]['function'] != '')
if (isset($backtrace_arr[$functionIndex]['function']) && $backtrace_arr[$functionIndex]['function'] != '')
{
$function = debug_backtrace()[$functionIndex]['function'];
$function = $backtrace_arr[$functionIndex]['function'];
}
if (isset(debug_backtrace()[$lineIndex]['line']) && debug_backtrace()[$lineIndex]['line'] != '')
if (isset($backtrace_arr[$lineIndex]['line']) && $backgrace_arr[$lineIndex]['line'] != '')
{
$line = debug_backtrace()[$lineIndex]['line'];
$line = $backtrace_arr[$lineIndex]['line'];
}
return $this->format($class, $function, $line);
View File
View File
+74 -175
View File
@@ -7,173 +7,72 @@ if (! defined("BASEPATH")) exit("No direct script access allowed");
*/
class MigrationLib extends CI_Migration
{
// Prefixes and separator for messages
const MSG_PREFIX = "[-]";
const INFO_PREFIX = "[I]";
const ERROR_PREFIX = "[E]";
const SEPARATOR = "------------------------------";
// Console colors codes
const ERROR_COLOR = 31;
const INFO_COLOR = 33;
const PRINT_QUERY_LEN = 60;
// HTML colors names
private $HTML_COLORS = array(31 => "red", 33 => "orange");
// Used to set if the migration process is called via command line or via browser
private $cli;
/**
* Object initialization
*/
public function __construct()
{
parent::__construct();
$this->setCli();
// Loads EPrintfLib
$this->load->library('EPrintfLib');
}
/**
* Set property cli to false if the migration process is called via command line
* otherwise to false if it's called via browser
*/
private function setCli()
{
if ($this->input->is_cli_request())
{
$this->cli = true;
}
else
{
$this->cli = false;
}
}
/**
* Returns the character of end of line
* PHP_EOL platform dependent if cli is true
* Tag <br> if cli is false
*/
private function getEOL()
{
if ($this->cli === true)
{
return PHP_EOL;
}
else
{
return "<br>";
}
}
/**
* Returns the string needed to color the output
*/
private function getColored($color)
{
$colored = "%s";
if (!is_null($color))
{
if ($this->cli === true)
{
$colored = "\033[".$color."m%s\033[37m";
}
else
{
$colored = "<font color=\"".$this->HTML_COLORS[$color]."\">%s</font>";
}
}
return $colored;
}
/**
* Print a message, even colored if specified
*/
private function _print($prefix, $text, $color = null)
{
printf($this->getColored($color), sprintf("%s %s".$this->getEOL(), $prefix, $text));
}
/**
* Prints a formatted message
*/
private function printMessage($message)
{
$this->_print(MigrationLib::MSG_PREFIX, $message);
}
/**
* Prints a formatted info
*/
private function printInfo($info)
{
$this->_print(MigrationLib::INFO_PREFIX, $info, MigrationLib::INFO_COLOR);
}
/**
* Prints a formatted error
*/
private function printError($error)
{
$this->_print(MigrationLib::ERROR_PREFIX, $error, MigrationLib::ERROR_COLOR);
}
/**
* Check if a column exists in a table and schema
*/
private function columnExists($name, $schema, $table)
{
$query = sprintf("SELECT %s FROM %s.%s LIMIT 1", $name, $schema, $table);
if (@$this->db->simple_query($query))
{
return true;
}
return false;
}
/**
* Print an info about the starting of method up
*/
protected function startUP()
{
$this->printInfo(
sprintf("%s Start method up of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
$this->eprintflib->printInfo(
sprintf("%s Start method up of class %s %s", EPrintfLib::SEPARATOR, get_called_class(), EPrintfLib::SEPARATOR)
);
}
/**
* Print an info about the ending of method up
*/
protected function endUP()
{
$this->printInfo(
sprintf("%s End method up of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
$this->eprintflib->printInfo(
sprintf("%s End method up of class %s %s", EPrintfLib::SEPARATOR, get_called_class(), EPrintfLib::SEPARATOR)
);
}
/**
* Print an info about the starting of method down
*/
protected function startDown()
{
$this->printInfo(
sprintf("%s Start method down of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
$this->eprintflib->printInfo(
sprintf("%s Start method down of class %s %s", EPrintfLib::SEPARATOR, get_called_class(), EPrintfLib::SEPARATOR)
);
}
/**
* Print an info about the ending of method down
*/
protected function endDown()
{
$this->printInfo(
sprintf("%s End method down of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
$this->eprintflib->printInfo(
sprintf("%s End method down of class %s %s", EPrintfLib::SEPARATOR, get_called_class(), EPrintfLib::SEPARATOR)
);
}
/**
* Adds a column, with attributes, to a table and schema
*/
@@ -185,20 +84,20 @@ class MigrationLib extends CI_Migration
{
if ($this->dbforge->add_column($schema.'.'.$table, array($name => $definition)))
{
$this->printMessage(sprintf("Column %s.%s.%s of type %s added", $schema, $table, $name, $definition["type"]));
$this->eprintflib->printMessage(sprintf("Column %s.%s.%s of type %s added", $schema, $table, $name, $definition["type"]));
}
else
{
$this->printError(sprintf("Error while adding column %s.%s.%s of type %s", $schema, $table, $name, $definition["type"]));
$this->eprintflib->printError(sprintf("Error while adding column %s.%s.%s of type %s", $schema, $table, $name, $definition["type"]));
}
}
else
{
$this->printInfo(sprintf("Column %s.%s.%s already exists", $schema, $table, $name));
$this->eprintflib->printInfo(sprintf("Column %s.%s.%s already exists", $schema, $table, $name));
}
}
}
/**
* Modifies a column, and its attributes, of a table and schema
*/
@@ -210,20 +109,20 @@ class MigrationLib extends CI_Migration
{
if ($this->dbforge->modify_column($schema.'.'.$table, array($name => $definition)))
{
$this->printMessage(sprintf("Column %s.%s.%s has been modified", $schema, $table, $name));
$this->eprintflib->printMessage(sprintf("Column %s.%s.%s has been modified", $schema, $table, $name));
}
else
{
$this->printError(sprintf("Error while modifying column %s.%s.%s", $schema, $table, $name));
$this->eprintflib->printError(sprintf("Error while modifying column %s.%s.%s", $schema, $table, $name));
}
}
else
{
$this->printInfo(sprintf("Column %s.%s.%s doesn't exist", $schema, $table, $name));
$this->eprintflib->printInfo(sprintf("Column %s.%s.%s doesn't exist", $schema, $table, $name));
}
}
}
/**
* Drops a column from a table and schema
*/
@@ -233,19 +132,19 @@ class MigrationLib extends CI_Migration
{
if ($this->dbforge->drop_column($schema.'.'.$table, $field))
{
$this->printMessage(sprintf("Column %s.%s.%s has been dropped", $schema, $table, $field));
$this->eprintflib->printMessage(sprintf("Column %s.%s.%s has been dropped", $schema, $table, $field));
}
else
{
$this->printError(sprintf("Error while dropping column %s.%s.%s", $schema, $table, $field));
$this->eprintflib->printError(sprintf("Error while dropping column %s.%s.%s", $schema, $table, $field));
}
}
else
{
$this->printInfo(sprintf("Column %s.%s.%s doesn't exist", $schema, $table, $field));
$this->eprintflib->printInfo(sprintf("Column %s.%s.%s doesn't exist", $schema, $table, $field));
}
}
/**
* Sets a column as primary key of a table and schema
*/
@@ -273,17 +172,17 @@ class MigrationLib extends CI_Migration
{
$query = sprintf("ALTER TABLE %s.%s ADD CONSTRAINT %s PRIMARY KEY (%s)", $schema, $table, $name, $fields);
}
if (@$this->db->simple_query($query))
{
$this->printMessage(sprintf("Added primary key %s on table %s.%s", $name, $schema, $table));
$this->eprintflib->printMessage(sprintf("Added primary key %s on table %s.%s", $name, $schema, $table));
}
else
{
$this->printError(sprintf("Adding primary key %s on table %s.%s", $name, $schema, $table));
$this->eprintflib->printError(sprintf("Adding primary key %s on table %s.%s", $name, $schema, $table));
}
}
/**
* Sets a column as foreign key of a table and schema
*/
@@ -300,17 +199,17 @@ class MigrationLib extends CI_Migration
$fieldDest,
$attributes
);
if (@$this->db->simple_query($query))
{
$this->printMessage(sprintf("Added foreign key %s on table %s.%s", $name, $schema, $table));
$this->eprintflib->printMessage(sprintf("Added foreign key %s on table %s.%s", $name, $schema, $table));
}
else
{
$this->printError(sprintf("Adding foreign key %s on table %s.%s", $name, $schema, $table));
$this->eprintflib->printError(sprintf("Adding foreign key %s on table %s.%s", $name, $schema, $table));
}
}
/**
* Sets a column as unique key of a table and schema
*/
@@ -338,17 +237,17 @@ class MigrationLib extends CI_Migration
{
$query = sprintf("CREATE UNIQUE INDEX %s ON %s.%s (%s)", $name, $schema, $table, $fields);
}
if (@$this->db->simple_query($query))
{
$this->printMessage(sprintf("Added unique key %s on table %s.%s", $name, $schema, $table));
$this->eprintflib->printMessage(sprintf("Added unique key %s on table %s.%s", $name, $schema, $table));
}
else
{
$this->printError(sprintf("Adding unique key %s on table %s.%s", $name, $schema, $table));
$this->eprintflib->printError(sprintf("Adding unique key %s on table %s.%s", $name, $schema, $table));
}
}
/**
* Grants permissions to a user on a table and schema
*/
@@ -379,7 +278,7 @@ class MigrationLib extends CI_Migration
if (@$this->db->simple_query($query))
{
$this->printMessage(
$this->eprintflib->printMessage(
sprintf(
"Granted permissions %s on table %s.%s to user %s",
is_null($stringPermission) ? $permissions : $stringPermission,
@@ -391,7 +290,7 @@ class MigrationLib extends CI_Migration
}
else
{
$this->printError(
$this->eprintflib->printError(
sprintf(
"Granting permissions %s on table %s.%s to user %s",
is_null($stringPermission) ? $permissions : $stringPermission,
@@ -402,24 +301,24 @@ class MigrationLib extends CI_Migration
);
}
}
/**
* Creates a table in a schema with columns
*/
protected function createTable($schema, $table, $fields)
{
$this->dbforge->add_field($fields);
if ($this->dbforge->create_table($schema.'.'.$table, true))
{
$this->printMessage(sprintf("Table %s.%s created or existing", $schema, $table));
$this->eprintflib->printMessage(sprintf("Table %s.%s created or existing", $schema, $table));
}
else
{
$this->printError(sprintf("Creating table %s.%s", $schema, $table));
$this->eprintflib->printError(sprintf("Creating table %s.%s", $schema, $table));
}
}
/**
* Drops a table from a schema
*/
@@ -427,62 +326,62 @@ class MigrationLib extends CI_Migration
{
if ($this->dbforge->drop_table($schema.".".$table))
{
$this->printMessage(sprintf("Table %s.%s has been dropped", $schema, $table));
$this->eprintflib->printMessage(sprintf("Table %s.%s has been dropped", $schema, $table));
}
else
{
$this->printError(sprintf("Dropping table %s.%s", $schema, $table));
$this->eprintflib->printError(sprintf("Dropping table %s.%s", $schema, $table));
}
}
/**
* Initializes a sequence with the max value of a column
*/
protected function initializeSequence($schemaSrc, $sequence, $schemaDst, $table, $field)
{
$query = sprintf("SELECT SETVAL('%s.%s', (SELECT MAX(%s) FROM %s.%s))", $schemaSrc, $sequence, $field, $schemaDst, $table);
if (@$this->db->simple_query($query))
{
$this->printMessage(sprintf("Sequence %s.%s has been initialized", $schemaSrc, $sequence));
$this->eprintflib->printMessage(sprintf("Sequence %s.%s has been initialized", $schemaSrc, $sequence));
}
else
{
$this->printError(sprintf("Initializing sequence %s.%s", $schemaSrc, $sequence));
$this->eprintflib->printError(sprintf("Initializing sequence %s.%s", $schemaSrc, $sequence));
}
}
/**
* Add comment to a column
*/
protected function addCommentToColumn($schema, $table, $field, $comment)
{
$query = sprintf("COMMENT ON COLUMN %s.%s.%s IS ?", $schema, $table, $field);
if (@$this->db->query($query, array($comment)))
{
$this->printMessage(sprintf("Comment added to %s.%s.%s", $schema, $table, $field));
$this->eprintflib->printMessage(sprintf("Comment added to %s.%s.%s", $schema, $table, $field));
}
else
{
$this->printError(sprintf("Error while adding comment to %s.%s.%s", $schema, $table, $field));
$this->eprintflib->printError(sprintf("Error while adding comment to %s.%s.%s", $schema, $table, $field));
}
}
/**
* Add comment to a table
*/
protected function addCommentToTable($schema, $table, $comment)
{
$query = sprintf("COMMENT ON TABLE %s.%s IS ?", $schema, $table, $field);
if (@$this->db->query($query, array($comment)))
{
$this->printMessage(sprintf("Comment added to %s.%s", $schema, $table));
$this->eprintflib->printMessage(sprintf("Comment added to %s.%s", $schema, $table));
}
else
{
$this->printError(sprintf("Error while adding comment to %s.%s", $schema, $table));
$this->eprintflib->printError(sprintf("Error while adding comment to %s.%s", $schema, $table));
}
}
/**
@@ -515,7 +414,7 @@ class MigrationLib extends CI_Migration
if (@$this->db->simple_query($query))
{
$this->printMessage(
$this->eprintflib->printMessage(
sprintf(
"Granted permissions %s on sequence %s.%s to user %s",
is_null($stringPermission) ? $permissions : $stringPermission,
@@ -527,7 +426,7 @@ class MigrationLib extends CI_Migration
}
else
{
$this->printError(
$this->eprintflib->printError(
sprintf(
"Granting permissions %s on sequence %s.%s to user %s",
is_null($stringPermission) ? $permissions : $stringPermission,
@@ -538,7 +437,7 @@ class MigrationLib extends CI_Migration
);
}
}
/**
* Executes the given query
*/
@@ -547,21 +446,21 @@ class MigrationLib extends CI_Migration
if (! @$this->db->simple_query($query))
{
$error = $this->db->error();
if (is_array($error) && isset($error["message"]))
{
$this->printError($error["message"]);
$this->eprintflib->printError($error["message"]);
}
else
{
$this->printError("Error while executing a query");
$this->eprintflib->printError("Error while executing a query");
}
}
$this->printInfo(
$this->eprintflib->printInfo(
"Query correctly executed: ".
substr(preg_replace("/\s+/", " ", trim($query)), 0, MigrationLib::PRINT_QUERY_LEN).
(strlen($query) > MigrationLib::PRINT_QUERY_LEN ? "..." : "")
substr(preg_replace("/\s+/", " ", trim($query)), 0, EPrintfLib::PRINT_QUERY_LEN).
(strlen($query) > EPrintfLib::PRINT_QUERY_LEN ? "..." : "")
);
}
}
+2 -2
View File
@@ -75,7 +75,7 @@ class PermissionLib
if (isset($this->acl[$sourceName]))
{
// Checks permission
$isEntitled = $this->_isBerechtigt($this->acl[$sourceName], $permissionType);
$isEntitled = $this->isBerechtigt($this->acl[$sourceName], $permissionType);
}
}
else
@@ -104,7 +104,7 @@ class PermissionLib
/**
* Checks user's (API caller) rights
*/
private function _isBerechtigt($berechtigung_kurzbz, $art = null, $oe_kurzbz = null, $kostenstelle_id = null)
public function isBerechtigt($berechtigung_kurzbz, $art = null, $oe_kurzbz = null, $kostenstelle_id = null)
{
$isBerechtigt = false;
+79
View File
@@ -0,0 +1,79 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Logging Actions of Persons
*/
class PersonLogLib
{
/**
* Constructor
*/
public function __construct()
{
$this->ci =& get_instance();
$this->ci->load->model('system/PersonLog_model', 'PersonLogModel');
}
/**
* Writes a Log for a Person
* @param int $person_id ID of the Person.
* @param string $logtype_kurzbz Type of Log.
* @param array $logdata Array of the JSON Data to save.
* @param string $app Application that log belongs to.
* @param string $oe_kurzbz Organisation Unit the Log belongs to.
* @param string $user User who created the log.
* @return boolean true if success
*/
public function log($person_id, $logtype_kurzbz, $logdata, $app = 'core', $oe_kurzbz = null, $user = null)
{
$data = array(
'person_id' => $person_id,
'zeitpunkt' => date('Y-m-d H:i:s'),
'app' => $app,
'oe_kurzbz' => $oe_kurzbz,
'logtype_kurzbz' => $logtype_kurzbz,
'logdata' => json_encode($logdata),
'insertvon' => $user
);
$result = $this->ci->PersonLogModel->insert($data);
if (isSuccess($result))
return true;
else
show_error($result->retval);
}
/**
* Gets Logs for a Person, filtered by parameters.
* Requirements for retrieving log: name is set
* @param int $person_id ID of the Person.
* @param string $app Name of the App.
* @param string $oe_kurzbz Organisations Unit.
* @return object $result
*/
public function getLogs($person_id, $app = null, $oe_kurzbz = null)
{
$result = $this->ci->PersonLogModel->filterLog($person_id, $app, $oe_kurzbz);
if (isSuccess($result))
{
$decoded_logs = array();
//decode logs
foreach ($result->retval as $log)
{
$log->logdata = json_decode($log->logdata);
//requirement - logname not null
if (isset($log->logdata->name))
{
$decoded_logs[] = $log;
}
}
return $decoded_logs;
}
else
show_error($result->retval);
}
}
+11 -10
View File
@@ -351,7 +351,7 @@ abstract class REST_Controller extends CI_Controller {
self::HTTP_INTERNAL_SERVER_ERROR => 'INTERNAL SERVER ERROR',
self::HTTP_NOT_IMPLEMENTED => 'NOT IMPLEMENTED'
];
/**
* Extend this function to apply additional checking early on in the process
*
@@ -361,7 +361,7 @@ abstract class REST_Controller extends CI_Controller {
protected function early_checks()
{
}
/**
* Constructor for the REST API
*
@@ -385,7 +385,8 @@ abstract class REST_Controller extends CI_Controller {
}
// Check to see if this is CI 3.x
if (explode('.', CI_VERSION, 2)[0] < 3)
$ci_version_number = explode('.', CI_VERSION, 2);
if ($ci_version_number[0] < 3)
{
throw new Exception('REST Server requires CodeIgniter 3.x');
}
@@ -528,7 +529,7 @@ abstract class REST_Controller extends CI_Controller {
{
$this->_allow = $this->_detect_api_key();
}
// Only allow ajax requests
if ($this->input->is_ajax_request() === FALSE && $this->config->item('rest_ajax_only'))
{
@@ -607,7 +608,7 @@ abstract class REST_Controller extends CI_Controller {
//$controller_method = $object_called . '_' . $this->request->method;
// CamelCase compliant
$controller_method = $this->request->method.ucfirst($object_called);
// Do we want to log this method (if allowed by config)?
$log_method = !(isset($this->methods[$controller_method]['log']) && $this->methods[$controller_method]['log'] === FALSE);
@@ -737,7 +738,7 @@ abstract class REST_Controller extends CI_Controller {
// Set the format header
$this->output->set_content_type($this->_supported_formats[$this->response->format], strtolower($this->config->item('charset')));
$output = $this->format->factory($data)->{'to_' . $this->response->format}();
// An array must be parsed as a string, so as not to cause an array to string error
// Json is the most appropriate form for such a datatype
if ($this->response->format === 'array')
@@ -967,7 +968,7 @@ abstract class REST_Controller extends CI_Controller {
$this->rest->level = NULL;
$this->rest->user_id = NULL;
$this->rest->ignore_limits = FALSE;
// Find the key from server or arguments
if (($key = isset($this->_args[$api_key_variable]) ? $this->_args[$api_key_variable] : $this->input->server($key_name)))
{
@@ -1899,7 +1900,7 @@ abstract class REST_Controller extends CI_Controller {
], self::HTTP_UNAUTHORIZED);
}
}
/**
* Prepares for basic authentication
*
@@ -1977,7 +1978,7 @@ abstract class REST_Controller extends CI_Controller {
preg_match_all('@(username|nonce|uri|nc|cnonce|qop|response)=[\'"]?([^\'",]+)@', $digest_string, $matches);
$digest = (empty($matches[1]) || empty($matches[2])) ? [] : array_combine($matches[1], $matches[2]);
// For digest authentication the library function should return
// For digest authentication the library function should return
// already stored password for that username, even if it is hashed
$username = $this->_check_login($digest['username'], TRUE);
// If there no password
@@ -2154,4 +2155,4 @@ abstract class REST_Controller extends CI_Controller {
->get($this->config->item('rest_access_table'))
->num_rows() > 0;
}
}
}
+1 -1
View File
@@ -625,7 +625,7 @@ class UDFLib
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);
$queryResult = $this->_ci->UDFModel->execReadOnlyQuery($jsonSchema->{UDFLib::LIST_VALUES}->sql);
if (hasData($queryResult))
{
$parameters = $queryResult->retval;
@@ -0,0 +1 @@
Executable → Regular
View File
Executable → Regular
View File
+33 -2
View File
@@ -70,7 +70,7 @@ class Akte_model extends DB_Model
return $this->execQuery($query, $parametersArray);
}
/**
* getAktenAccepted
*/
@@ -116,7 +116,7 @@ class Akte_model extends DB_Model
return $this->execQuery($query, $parametersArray);
}
/**
* getAktenAcceptedDms
*/
@@ -173,4 +173,35 @@ class Akte_model extends DB_Model
return $this->execQuery($query, $parametersArray);
}
/**
* gets Akten together with documenttype info, mainly bezeichnung fields
* @param $person_id
* @param null $dokument_kurzbz
* @param bool $nachgereicht if true, retrieves only nachgereichte Dokumente. if false, only not nachgereichte. default: null, all Dokumente
* @return array
*/
public function getAktenWithDokInfo($person_id, $dokument_kurzbz = null, $nachgereicht = null)
{
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
$this->addSelect('public.tbl_akte.*, bezeichnung_mehrsprachig, dokumentbeschreibung_mehrsprachig, public.tbl_dokument.bezeichnung as dokument_bezeichnung, bis.tbl_nation.*, ausstellungsdetails');
$this->addJoin('public.tbl_dokument', 'dokument_kurzbz');
$this->addJoin('bis.tbl_nation', 'ausstellungsnation = nation_code', 'LEFT');
$where = array();
$where['person_id'] = $person_id;
if(isset($dokument_kurzbz))
$where['dokument_kurzbz'] = $dokument_kurzbz;
if(is_bool($nachgereicht))
$where['nachgereicht'] = $nachgereicht;
$dokumente = $this->loadWhere($where);
if($dokumente->error)
return error($dokumente->retval);
return success($dokumente->retval);
}
}
@@ -192,4 +192,41 @@ class Prestudent_model extends DB_Model
return $this->execQuery(sprintf($query, is_array($prestudent_id) ? 'IN' : '='), array($prestudent_id));
}
/**
* gets extended zgv data (with zgv bezeichnung) for a prestudent
* includes last status, Studiengang, zgv, zgv master
* @param $prestudent_id
*/
public function getPrestudentWithZgv($prestudent_id)
{
$this->addSelect('tbl_prestudent.*, tbl_studiengang.kurzbzlang as studiengang, tbl_studiengang.typ as studiengangtyp, tbl_zgv.zgv_code, tbl_zgv.zgv_bez,
tbl_prestudent.zgvort, tbl_prestudent.zgvdatum, tbl_prestudent.zgvnation as zgvnation_code, zgvnat.kurztext as zgvnation_kurzbez, zgvnat.langtext as zgvnation_bez, zgvnat.engltext as zgvnation_englbez,
tbl_zgvmaster.zgvmas_code, tbl_zgvmaster.zgvmas_bez, tbl_prestudent.zgvmaort, tbl_prestudent.zgvmadatum, tbl_prestudent.zgvmanation as zgvmanation_code, zgvmanat.kurztext as zgvmanation_kurzbez, zgvmanat.langtext as zgvmanation_bez, zgvmanat.engltext as zgvmanation_englbez');
$this->addJoin('public.tbl_studiengang', 'studiengang_kz', 'LEFT');
$this->addJoin('bis.tbl_zgv', 'zgv_code', 'LEFT');
$this->addJoin('bis.tbl_zgvmaster', 'zgvmas_code', 'LEFT');
$this->addJoin('bis.tbl_nation zgvnat', 'zgvnation = zgvnat.nation_code', 'LEFT');
$this->addJoin('bis.tbl_nation zgvmanat', 'zgvmanation = zgvmanat.nation_code', 'LEFT');
$prestudent = $this->load($prestudent_id);
if($prestudent->error)
return error($prestudent->retval);
//Prestudentstatus
$this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel');
$lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id);
if ($lastStatus->error)
{
return error($lastStatus->retval);
}
if(count($lastStatus->retval) > 0)
$prestudent->retval[0]->prestudentstatus = $lastStatus->retval[0];
return success($prestudent->retval);
}
}
@@ -0,0 +1 @@
Executable → Regular
View File
View File
+52 -1
View File
@@ -94,5 +94,56 @@ class Notiz_model extends DB_Model
return $result;
}
/**
* Add a Notiz for a given person
*/
public function addNotizForPerson($person_id, $titel, $text, $erledigt, $verfasser_uid)
{
// Loads model Notizzuordnung_model
$this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel');
// Start DB transaction
$this->db->trans_start(false);
$result = $this->insert(array('titel' => $titel, 'text' => $text, 'erledigt' => $erledigt, 'verfasser_uid' => $verfasser_uid,
"insertvon" => $verfasser_uid));
if (isSuccess($result))
{
$notiz_id = $result->retval;
$result = $this->NotizzuordnungModel->insert(array('notiz_id' => $notiz_id, 'person_id' => $person_id));
}
// Transaction complete!
$this->db->trans_complete();
// Check if everything went ok during the transaction
if ($this->db->trans_status() === false || isError($result))
{
$this->db->trans_rollback();
$result = error($result->msg, EXIT_ERROR);
}
else
{
$this->db->trans_commit();
$result = success($notiz_id);
}
return $result;
}
/**
* gets all Notizen for a person
* @param $person_id
*/
public function getNotiz($person_id)
{
// Join with the table public.tbl_notizzuordnung using notiz_id
$this->addJoin('public.tbl_notizzuordnung', 'notiz_id');
return $this->loadWhere(array('person_id' => $person_id));
}
// ------------------------------------------------------------------------------------------------------
}
}
+60 -1
View File
@@ -18,7 +18,7 @@ class Person_model extends DB_Model
public function getPersonKontaktByZugangscode($zugangscode, $email)
{
$this->addJoin('public.tbl_kontakt', 'person_id');
return $this->loadWhere(array('zugangscode' => $zugangscode, 'kontakt' => $email));
}
@@ -135,4 +135,63 @@ class Person_model extends DB_Model
return $result;
}
/**
* Searches a Person
* @param $filter Term to search for.
* @return DB-result
*/
public function searchPerson($filter)
{
$this->addSelect('vorname, nachname, gebdatum, person_id');
$result = $this->loadWhere(
'lower(nachname) like '.$this->db->escape('%'.$filter.'%')."
OR lower(vorname) like ".$this->db->escape('%'.$filter.'%')."
OR lower(nachname || ' ' || vorname) like ".$this->db->escape('%'.$filter.'%')."
OR lower(vorname || ' ' || nachname) like ".$this->db->escape('%'.$filter.'%'));
return $result;
}
/**
* gets Stammdaten for a person, including contactdata in textform from other tables
* nation, kontakt, adresse
* @param $person_id
* @return array
*/
public function getPersonStammdaten($person_id)
{
$this->addSelect('tbl_person.*, s.kurztext as staatsbuergerschaft, g.kurztext as geburtsnation');
$this->addJoin('bis.tbl_nation s', 'tbl_person.staatsbuergerschaft = s.nation_code', 'LEFT');
$this->addJoin('bis.tbl_nation g', 'tbl_person.geburtsnation = g.nation_code', 'LEFT');
$person = $this->load($person_id);
if($person->error)
return error($person->retval);
//return null if not found
if(count($person->retval) < 1)
return success(null);
$this->load->model('person/kontakt_model', 'KontaktModel');
$this->load->model('person/adresse_model', 'AdresseModel');
$this->KontaktModel->addDistinct();
$this->KontaktModel->addSelect('kontakttyp, anmerkung, kontakt, zustellung');
$this->KontaktModel->addOrder('kontakttyp');
$kontakte = $this->KontaktModel->loadWhere(array('person_id' => $person_id));
if($kontakte->error)
return error($kontakte->retval);
$adressen = $this->AdresseModel->loadWhere(array('person_id' => $person_id));
if($adressen->error)
return error($adressen->retval);
$stammdaten = $person->retval[0];
$stammdaten->kontakte = $kontakte->retval;
$stammdaten->adressen = $adressen->retval;
return success($stammdaten);
}
}
@@ -0,0 +1,56 @@
<?php
class Extensions_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'system.tbl_extensions';
$this->pk = 'extension_id';
}
/**
* getDependencies
*/
public function getDependencies($dependencies)
{
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
return $this->execQuery(
'SELECT *
FROM '.$this->dbTable.'
WHERE enabled = TRUE
AND name IN ?',
array('name' => $dependencies)
);
}
/**
*
*/
public function getInstalledExtensions()
{
$query = 'SELECT extension_id, e1.name, e1.version, description, license, url, core_version, dependencies, enabled
FROM system.tbl_extensions e1
INNER JOIN (
SELECT name, MAX(version) AS version
FROM system.tbl_extensions
GROUP BY name) e2
ON (e1.name = e2.name AND e1.version = e2.version)';
return $this->execQuery($query);
}
/**
*
*/
public function executeQuery($sql)
{
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
return $this->execQuery($sql);
}
}
@@ -0,0 +1,14 @@
<?php
class Filters_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'system.tbl_filters';
$this->pk = 'filter_id';
}
}
+75 -25
View File
@@ -47,7 +47,7 @@ class MessageToken_model extends CI_Model
LIMIT 1';
$result = $this->db->query($sql, array(MSG_STATUS_DELETED, $token));
// If no errors occurred
if ($result)
{
@@ -58,7 +58,7 @@ class MessageToken_model extends CI_Model
return error($this->db->error());
}
}
/**
* Set the status of a message to read. If the status of the message
* is already read then update updateamum
@@ -82,19 +82,20 @@ class MessageToken_model extends CI_Model
) s ON (r.message_id = s.message_id AND r.person_id = s.person_id)
WHERE r.token = ?
LIMIT 1';
$msgs = $this->db->query($sql, array(MSG_STATUS_ARCHIVED, $token));
// If no errors occurred
if ($msgs)
{
$msgs_result = $msgs->result();
// If at least a record is present
if (count($msgs->result()) > 0)
if (count($msgs_result) > 0)
{
$msg = $msgs->result()[0];
$msg = $msgs_result[0];
$msgStatusResult = false; // pessimistic expectation
// If the status of the message is unread
if ($msg->status == MSG_STATUS_UNREAD)
{
@@ -118,31 +119,31 @@ class MessageToken_model extends CI_Model
{
// Update updateamum to current date
$this->db->set('updateamum', 'NOW()');
$this->db->where('message_id', $msg->message_id);
$this->db->where('person_id', $msg->receiver_id);
$this->db->where('status', MSG_STATUS_READ);
$msgStatusResult = $this->db->update('public.tbl_msg_status');
}
// If some of the previous DB manipulation (update or insert) has failed
if (!$msgStatusResult)
{
return error($this->db->error());
}
}
return success($msgs->result());
return success($msgs_result);
}
else
{
return error($this->db->error());
}
return success($result->result());
}
/**
* Get data of the message sender
*/
@@ -159,9 +160,9 @@ class MessageToken_model extends CI_Model
LEFT JOIN public.tbl_benutzer b USING(person_id)
LEFT JOIN public.tbl_mitarbeiter m ON(b.uid = m.mitarbeiter_uid)
WHERE p.person_id = ?';
$result = $this->db->query($sql, array($person_id));
// If no errors occurred
if ($result)
{
@@ -172,9 +173,9 @@ class MessageToken_model extends CI_Model
return error($this->db->error());
}
}
/**
*
*
*/
public function isEmployee($person_id)
{
@@ -184,24 +185,25 @@ class MessageToken_model extends CI_Model
LEFT JOIN public.tbl_mitarbeiter m ON(b.uid = m.mitarbeiter_uid)
WHERE p.person_id = ?
AND b.aktiv = TRUE';
$result = $this->db->query($sql, array($person_id));
// If no errors occurred
if ($result)
{
// If data are present
if (is_array($result->result()) && count($result->result()) > 0)
{
$person = $result->result()[0];
$personresults = $result->result();
$person = $personresults[0];
// If it is an employee
if ($person->mitarbeiter_uid != null)
{
return true;
}
}
return false;
}
else
@@ -209,4 +211,52 @@ class MessageToken_model extends CI_Model
return error($this->db->error());
}
}
}
/**
* getRoot - Get the root of the organisation unit tree which belongs the given organisation unit parameter
*/
public function getOERoot($oe_kurzbz)
{
$sql = '
WITH RECURSIVE organizations(rid, oe_kurzbz, oe_parent_kurzbz) AS
(
SELECT 1 AS rid, o.oe_kurzbz, o.oe_parent_kurzbz
FROM public.tbl_organisationseinheit o
WHERE o.oe_kurzbz = ?
UNION ALL
SELECT rid + 1 AS rid, oe.oe_kurzbz, oe.oe_parent_kurzbz
FROM organizations org, public.tbl_organisationseinheit oe
WHERE oe.oe_kurzbz = org.oe_parent_kurzbz
AND oe.aktiv = TRUE
)
SELECT oe_kurzbz
FROM organizations orgs
ORDER BY rid DESC
LIMIT 1
';
$result = $this->db->query($sql, array($oe_kurzbz));
if ($result) // If no errors occurred
{
$result_arr = $result->result();
// If data are present
if (is_array($result_arr)
&& count($result_arr) > 0
&& is_object($result_arr[0])
&& isset($result_arr[0]->oe_kurzbz))
{
return success($result_arr[0]->oe_kurzbz);
}
else
{
return error();
}
}
else
{
return error($this->db->error());
}
return $result;
}
}
@@ -0,0 +1,87 @@
<?php
/**
* PersonLog Extends from CI_Model instead of DB_Model
* to be able to write Log without a loggedin User!
*/
class PersonLog_model extends CI_Model
{
private $dbTable;
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->load->database();
$this->dbTable = 'system.tbl_log';
}
/**
* Inserts a Log for a Person
* @param array $data Data of Log Entry to save.
* @return success object if true
*/
public function insert($data)
{
$result = $this->db->insert($this->dbTable, $data);
if ($result)
return success($this->db->insert_id());
else
return error();
}
/**
* Loads the last Log Entry of a Person
* @param int $person_id ID of the Person.
* @param string $app Name of the App.
* @param string $oe_kurzbz Organisations Unit.
* @return object $result
*/
public function getLastLog($person_id, $app = null, $oe_kurzbz = null)
{
// Check Permissions
$this->load->library('PermissionLib');
if(!$this->permissionlib->isEntitled('system.tbl_log',PermissionLib::SELECT_RIGHT))
show_error('Permission denied - You need Access to system.tbl_log');
$this->db->order_by('zeitpunkt', 'DESC');
$this->db->order_by('log_id', 'DESC');
$this->db->limit(1);
if (!is_null($app))
$this->db->where('app='.$this->db->escape($app));
if (!is_null($oe_kurzbz))
$this->db->where('oe_kurzbz='.$this->db->escape($oe_kurzbz));
$result = $this->db->get_where($this->dbTable, "person_id=".$this->db->escape($person_id));
return success($result->result());
}
/**
* Load logs for a person, filtered by parameters
* @param int $person_id ID of the Person.
* @param string $app Name of the App.
* @param string $oe_kurzbz Organisations Unit.
* @return object $result
*/
public function filterLog($person_id, $app = null, $oe_kurzbz = null)
{
// Check Permissions
$this->load->library('PermissionLib');
if(!$this->permissionlib->isEntitled('system.tbl_log',PermissionLib::SELECT_RIGHT))
show_error('Permission denied - You need Access to system.tbl_log');
$this->db->order_by('zeitpunkt', 'DESC');
$this->db->order_by('log_id', 'DESC');
if (!is_null($app))
$this->db->where('app='.$this->db->escape($app));
if (!is_null($oe_kurzbz))
$this->db->where('oe_kurzbz='.$this->db->escape($oe_kurzbz));
$result = $this->db->get_where($this->dbTable, "person_id=".$this->db->escape($person_id));
return success($result->result());
}
}
+34 -61
View File
@@ -6,10 +6,10 @@ class UDF_model extends DB_Model
const STRING_NULL = 'null';
const STRING_TRUE = 'true';
const STRING_FALSE = 'false';
const UDF_DROPDOWN_TYPE = 'dropdown';
const UDF_MULTIPLEDROPDOWN_TYPE = 'multipledropdown';
/**
* Constructor
*/
@@ -20,41 +20,14 @@ class UDF_model extends DB_Model
$this->pk = array('schema', 'table');
$this->hasSequence = false;
}
/**
* Override DB_Model method execQuery to allow only to perform queries to read data
*/
public function execQuery($query, $parametersArray = null)
{
//
if (
(
substr($query, 0, 6) == 'SELECT'
|| substr($query, 0, 4) == 'WITH'
)
&&
(
!stripos($query, 'INSERT')
&& !stripos($query, 'UPDATE')
&& !stripos($query, 'DELETE')
)
)
{
return parent::execQuery($query, $parametersArray);
}
else
{
return error('You are allowed to run only query for reading data');
}
}
/**
* Returns all the UDF for this table
*/
public function getUDFsDefinitions($schemaAndTable)
{
$st = $this->getSchemaAndTable($schemaAndTable);
$this->addSelect(UDFLib::COLUMN_JSON_DESCRIPTION);
$udfResults = $this->loadWhere(
array(
@@ -62,13 +35,13 @@ class UDF_model extends DB_Model
'table' => $st->table
)
);
return $udfResults;
}
// ------------------------------------------------------------------------------------
// These methods work only with the this version of FAS, not with the future versions
/**
* Methods to save data from FAS
*/
@@ -77,53 +50,53 @@ class UDF_model extends DB_Model
$result = error('No way man!');
$resultPerson = success('person');
$resultPrestudent = success('prestudent');
$person_id = $udfs['person_id'];
unset($udfs['person_id']);
$prestudent_id = $udfs['prestudent_id'];
unset($udfs['prestudent_id']);
$jsons = array();
//
//
if (isset($person_id))
{
// Load model Person_model
$this->load->model('person/Person_model', 'PersonModel');
$result = $this->load(array('public', 'tbl_person'));
if (isSuccess($result) && count($result->retval) == 1)
{
$jsons = json_decode($result->retval[0]->jsons);
}
$udfs = $this->_fillMissingTextUDF($udfs, $jsons);
$udfs = $this->_fillMissingChkboxUDF($udfs, $jsons);
$udfs = $this->_fillMissingDropdownUDF($udfs, $jsons);
$resultPerson = $this->PersonModel->update($person_id, $udfs);
}
//
//
if (isset($prestudent_id))
{
// Load model Prestudent_model
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$result = $this->load(array('public', 'tbl_prestudent'));
if (isSuccess($result) && count($result->retval) == 1)
{
$jsons = json_decode($result->retval[0]->jsons);
}
$udfs = $this->_fillMissingTextUDF($udfs, $jsons);
$udfs = $this->_fillMissingChkboxUDF($udfs, $jsons);
$udfs = $this->_fillMissingDropdownUDF($udfs, $jsons);
$resultPrestudent = $this->PrestudentModel->update($prestudent_id, $udfs);
}
if (isSuccess($resultPerson) && isSuccess($resultPrestudent))
{
$result = success(array($resultPerson->retval, $resultPrestudent->retval));
@@ -136,17 +109,17 @@ class UDF_model extends DB_Model
{
$result = $resultPrestudent;
}
return $result;
}
/**
*
*
*/
private function _fillMissingChkboxUDF($udfs, $jsons)
{
$_fillMissingChkboxUDF = $udfs;
foreach($jsons as $udfDescription)
{
if ($udfDescription->{UDFLib::TYPE} == UDFLib::CHKBOX_TYPE)
@@ -168,17 +141,17 @@ class UDF_model extends DB_Model
}
}
}
return $_fillMissingChkboxUDF;
}
/**
*
*
*/
private function _fillMissingDropdownUDF($udfs, $jsons)
{
$_fillMissingDropdownUDF = $udfs;
foreach($jsons as $udfDescription)
{
if ($udfDescription->{UDFLib::TYPE} == UDF_model::UDF_DROPDOWN_TYPE
@@ -194,17 +167,17 @@ class UDF_model extends DB_Model
}
}
}
return $_fillMissingDropdownUDF;
}
/**
*
*
*/
private function _fillMissingTextUDF($udfs, $jsons)
{
$_fillMissingTextUDF = $udfs;
foreach($jsons as $udfDescription)
{
if ($udfDescription->{UDFLib::TYPE} == 'textarea'
@@ -220,7 +193,7 @@ class UDF_model extends DB_Model
}
}
}
return $_fillMissingTextUDF;
}
}
}
Vendored Executable → Regular
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
@@ -0,0 +1 @@
Executable → Regular
View File
@@ -0,0 +1,168 @@
<?php $this->load->view('templates/header', array('title' => 'Extensions manager', 'jqueryV1' => true, 'tablesort' => true)); ?>
<script type="text/javascript">
$(document).ready(function() {
$(".tablesorter").each(function(i, v) {
$("#" + v.id).tablesorter({
widgets: ["zebra"],
sortList: [[0, 0]],
headers: {7: {sorter: false}}
});
});
$(".chkbox").change(function() {
var chkId = $(this).context.name;
var checked = $(this).prop("checked");
$.ajax({
url: "<?php echo current_url(); ?>/toggleExtension",
dataType: "json",
type: "POST",
data: {
extension_id: chkId,
enabled: checked
},
error: function(jqXHR, textStatus, errorThrown) {
alert("Error while saving data");
},
success: function(response, textStatus, jqXHR) {
if (response != true)
{
alert("Error while saving data");
}
},
complete: function() {
window.location.reload();
}
});
});
$(".lnkrm").click(function() {
var lnkId = $(this).context.name;
if (window.confirm('Are you really shure???') == true)
{
$.ajax({
url: "<?php echo current_url(); ?>/delExtension",
dataType: "json",
type: "POST",
data: {
extension_id: lnkId
},
error: function(jqXHR, textStatus, errorThrown) {
alert("Error while saving data");
},
success: function(response, textStatus, jqXHR) {
if (response != true)
{
alert("Error while saving data");
}
},
complete: function() {
window.location.reload();
}
});
}
});
});
</script>
<body>
<?php
if (!hasData($extensions))
{
echo 'No extension installed!<br>';
}
elseif (isError($extensions))
{
echo 'An error occurred while retriving extenions list.';
}
elseif (hasData($extensions))
{
?>
<div>
List of installed extensions
</div>
<br>
<table class="tablesorter" id="t0">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Version</th>
<th>Licence</th>
<th>URL</th>
<th>Minimum required Core version</th>
<th>Dependes on (extensions)</th>
<th>Enabled</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
$tableRow = '
<tr>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>
<input type="checkbox" class="chkbox" name="%s" %s>
</td>
<td>
<a href="#" name="%s" class="lnkrm" >Remove</a>
</td>
</tr>';
foreach ($extensions->retval as $key => $extension)
{
echo sprintf(
$tableRow,
$extension->name,
$extension->description,
$extension->version,
$extension->license,
$extension->url,
$extension->core_version,
count($extension->dependencies) == 0 ? 'None' : json_encode($extension->dependencies),
$extension->extension_id,
$extension->enabled === true ? 'checked' : '',
$extension->extension_id
);
}
?>
</tbody>
</table>
<?php
}
?>
<br>
<?php echo form_open_multipart(current_url().'/uploadExtension'); ?>
<input type="file" name="extension" />
<input type="submit" value="Install/Update extension" />
</form>
</body>
<?php $this->load->view('templates/footer'); ?>
@@ -0,0 +1,27 @@
<?php
$this->load->view('templates/FHC-Header', array('title' => 'Info Center', 'jquery3' => true, 'tablesorter' => true));
?>
<body>
<span>
<?php
$this->load->view(
'system/infocenter/infocenterFilters.php',
array(
'listFiltersSent' => $listFiltersSent,
'listFiltersNotSent' => $listFiltersNotSent
)
);
?>
</span>
<span>
<?php
$this->load->view('system/infocenter/infocenterData.php');
?>
</span>
</body>
<?php $this->load->view('templates/FHC-Footer'); ?>
@@ -0,0 +1,133 @@
<?php
$filterWidgetArray = array(
'query' => '
SELECT
p.person_id AS "PersonId",
p.vorname AS "Vorname",
p.nachname AS "Nachname",
p.gebdatum AS "Gebdatum",
(
SELECT zeitpunkt
FROM system.tbl_log
WHERE taetigkeit_kurzbz = \'bewerbung\'
AND person_id = p.person_id
ORDER BY zeitpunkt DESC
LIMIT 1
) AS "LastAction",
(
SELECT insertvon
FROM system.tbl_log
WHERE taetigkeit_kurzbz = \'bewerbung\'
AND person_id = p.person_id
ORDER BY zeitpunkt DESC
LIMIT 1
) AS "User/Operator",
(
SELECT
pss.studiensemester_kurzbz
FROM
public.tbl_prestudentstatus pss
INNER JOIN public.tbl_prestudent ps USING(prestudent_id)
WHERE pss.status_kurzbz = \'Interessent\'
AND pss.bestaetigtam IS NULL
AND pss.bestaetigtvon IS NULL
AND ps.person_id = p.person_id
ORDER BY pss.datum DESC, pss.insertamum DESC, pss.ext_id DESC
LIMIT 1
) AS "Studiensemester",
(
SELECT pss.bewerbung_abgeschicktamum
FROM
public.tbl_prestudentstatus pss
INNER JOIN public.tbl_prestudent ps USING(prestudent_id)
WHERE pss.status_kurzbz = \'Interessent\'
AND pss.bestaetigtam IS NULL
AND pss.bestaetigtvon IS NULL
AND ps.person_id = p.person_id
ORDER BY pss.datum DESC, pss.insertamum DESC, pss.ext_id DESC
LIMIT 1
) AS "SendDate"
FROM public.tbl_person p
WHERE
EXISTS(
SELECT 1
FROM public.tbl_prestudent
WHERE person_id=p.person_id
AND \'Interessent\' = (SELECT status_kurzbz FROM public.tbl_prestudentstatus
WHERE prestudent_id=tbl_prestudent.prestudent_id
ORDER BY datum DESC, insertamum DESC, ext_id DESC
LIMIT 1
)
AND EXISTS (SELECT 1 FROM public.tbl_prestudentstatus
WHERE prestudent_id=tbl_prestudent.prestudent_id
AND status_kurzbz=\'Interessent\' AND bestaetigtam IS NULL and bestaetigtvon IS NULL
AND studiensemester_kurzbz IN (
SELECT studiensemester_kurzbz
FROM public.tbl_studiensemester
WHERE (NOW() >= start AND NOW() <= ende)
OR start > NOW()
)
)
)
ORDER BY "LastAction" DESC
',
'hideHeader' => false,
'hideSave' => false,
'additionalColumns' => array('Details'),
'formatRaw' => function($fieldName, $fieldValue, $datasetRaw) {
if ($fieldName == 'Details')
{
$link = '<a href="%s%s" target="_blank">Details</a>';
$datasetRaw->{$fieldName} = sprintf(
$link,
base_url('index.ci.php/system/infocenter/infocenterDetails/showDetails/'),
$datasetRaw->PersonId
);
}
if ($fieldName == 'SendDate')
{
if ($datasetRaw->{$fieldName} == '1970.01.01 01:00:00')
{
$datasetRaw->{$fieldName} = 'Not sent';
}
}
if ($fieldName == 'LastAction')
{
if ($datasetRaw->{$fieldName} == '1970.01.01 01:00:00')
{
$datasetRaw->{$fieldName} = 'Not logged';
}
}
if ($fieldName == 'User/Operator')
{
if ($datasetRaw->{$fieldName} == '')
{
$datasetRaw->{$fieldName} = 'NA';
}
}
return $datasetRaw;
}
);
$filterId = isset($_GET['filterId']) ? $_GET['filterId'] : null;
if (isset($filterId) && is_numeric($filterId))
{
$filterWidgetArray['filterId'] = $filterId;
}
else
{
$filterWidgetArray['app'] = 'aufnahme';
$filterWidgetArray['datasetName'] = 'PersonActions';
$filterWidgetArray['filterKurzbz'] = 'InfoCenterNotSentApplicationAll';
}
echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray);
?>
@@ -0,0 +1,667 @@
<?php
$this->load->view('templates/FHC-Header', array('title' => 'InfocenterDetails', 'jquery3' => true, 'bootstrap' => true, 'fontawesome' => true, 'bootstrapdatepicker' => true, 'datatables' => true, 'sbadmintemplate' => true));
?>
<body>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h3 class="page-header">Infocenter
Details: <?php echo $stammdaten->vorname.' '.$stammdaten->nachname ?></h3>
</div>
</div>
<section>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading text-center"><h4>Stammdaten</h4></div>
<div class="panel-body">
<div class="row">
<div class="col-lg-6">
<table class="table">
<tr>
<td><strong>Vorname</strong></td>
<td><?php echo $stammdaten->vorname ?></td>
</tr>
<tr>
<td><strong>Nachname</strong></td>
<td>
<?php echo $stammdaten->nachname ?></td>
</tr>
<tr>
<td><strong>Geburtsdatum</strong></td>
<td>
<?php echo date_format(date_create($stammdaten->gebdatum), 'd.m.Y') ?></td>
</tr>
<tr>
<td><strong>Sozialversicherungsnr</strong></td>
<td>
<?php echo $stammdaten->svnr ?></td>
</tr>
<tr>
<td><strong>Staatsb&uuml;rgerschaft</strong></td>
<td>
<?php echo $stammdaten->staatsbuergerschaft ?></td>
</tr>
<tr>
<td><strong>Geschlecht</strong></td>
<td>
<?php echo $stammdaten->geschlecht ?></td>
</tr>
<tr>
<td><strong>Geburtsnation</strong></td>
<td>
<?php echo $stammdaten->geburtsnation ?></td>
</tr>
<tr>
<td><strong>Geburtsort</strong></td>
<td><?php echo $stammdaten->gebort ?></td>
</tr>
</table>
</div>
<div class="col-lg-6">
<table class="table table-bordered">
<thead>
<tr>
<th colspan="4" class="text-center">Kontakte</th>
</tr>
<tr>
<th class="text-center">Typ</th>
<th class="text-center">Kontakt</th>
<th class="text-center">Zustellung</th>
<th class="text-center">Anmerkung</th>
</tr>
</thead>
<tbody>
<?php foreach ($stammdaten->kontakte as $kontakt): ?>
<tr>
<td><?php echo ucfirst($kontakt->kontakttyp); ?></td>
<td>
<?php if ($kontakt->kontakttyp === 'email'): ?>
<a href="mailto:<?php echo $kontakt->kontakt; ?>" target="_top">
<?php
endif;
echo $kontakt->kontakt;
if ($kontakt->kontakttyp === 'email'):
?>
</a>
<?php endif; ?>
</td>
<td class="text-center"><?php echo $kontakt->zustellung === true ? '<span class="glyphicon glyphicon-ok"></span>' : ''; ?></td>
<td><?php echo $kontakt->anmerkung; ?></td>
</tr>
<?php endforeach; ?>
<?php foreach ($stammdaten->adressen as $adresse): ?>
<tr>
<td>
Adresse
</td>
<td>
<?php echo isset($adresse) ? $adresse->strasse.', '.$adresse->plz.' '.$adresse->ort : '' ?>
</td>
<td class="text-center">
<?php echo $adresse->zustelladresse === true ? '<span class="glyphicon glyphicon-ok"></span>' : '' ?>
</td>
<td>
<?php echo ($adresse->heimatadresse === true ? 'Heimatadresse' : '').($adresse->heimatadresse === true && $adresse->rechnungsadresse === true ? ', ' : '').($adresse->rechnungsadresse === true ? 'Rechnungsadresse' : ''); ?>
</td>
<tr/>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<a name="DokPruef"></a><!-- anchor for jumping to the section -->
<div class="panel-heading text-center"><h4>Dokumentenpr&uuml;fung</h4></div>
<div class="panel-body">
<table id="doctable" class="table table-striped table-bordered">
<thead>
<th>Name</th>
<th>Typ</th>
<th>Uploaddatum</th>
<th>Ausstellungsnation</th>
<th>Formal gepr&uuml;ft</th>
<!-- <th>nachzureichen</th>
<th>nachgereicht am</th>-->
</thead>
<tbody>
<?php
foreach ($dokumente as $dokument):
$geprueft = isset($dokument->formal_geprueft_amum) ? "checked" : "";
?>
<tr>
<td>
<a href="../outputAkteContent/<?php echo $dokument->akte_id ?>"><?php echo empty($dokument->titel) ? $dokument->bezeichnung : $dokument->titel ?></a>
</td>
<td><?php echo $dokument->dokument_bezeichnung ?></td>
<td><?php echo date_format(date_create($dokument->erstelltam), 'd.m.Y') ?></td>
<td><?php echo $dokument->langtext ?></td>
<td>
<input type="checkbox" class="form-check-input"
id="prchkbx<?php echo $dokument->akte_id ?>" <?php echo $geprueft ?> />
<?php echo isset($dokument->formal_geprueft_amum) ? date_format(date_create($dokument->formal_geprueft_amum), 'd.m.Y') : ''; ?>
</td>
<!-- <td class="text-center">
<?php /*echo $dokument->nachgereicht === true ? 'X' : ''; */
?>
</td>
<td>
<?php /*echo isset($dokument->nachgereicht_am) ? date_format(date_create($dokument->nachgereicht_am), 'd.m.Y') : ''; */
?>
</td>-->
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if (count($dokumente_nachgereicht) > 0): ?>
<br/>
<p>Nachzureichende Dokumente:</p>
<table id="nachgdoctable" class="table table-striped table-bordered">
<thead>
<th>Typ</th>
<th>Nachzureichen am</th>
<th>Ausstellungsnation</th>
<th>Anmerkung</th>
</thead>
<tbody>
<?php
foreach ($dokumente_nachgereicht as $dokument):
?>
<tr>
<td><?php echo $dokument->dokument_bezeichnung ?></td>
<td>
<?php echo isset($dokument->nachgereicht_am) ? date_format(date_create($dokument->nachgereicht_am), 'd.m.Y') : ''; ?>
</td>
<td>
<?php echo $dokument->langtext ?>
</td>
</td>
<td>
<?php echo $dokument->anmerkung; ?>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php endif; ?>
</div>
</div>
</div>
</div>
</section>
<section>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading text-center">
<a name="ZgvPruef"></a>
<h4>ZGV-Pr&uuml;fung</h4>
</div>
<div class="panel-body">
<div class="panel-group">
<?php foreach ($zgvpruefungen as $zgvpruefung):
$infoonly = $zgvpruefung->infoonly; ?>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse"
href="#collapse<?php echo $zgvpruefung->prestudent_id ?>">Studiengang <?php echo $zgvpruefung->studiengang ?></a>
</h4>
</div>
<div id="collapse<?php echo $zgvpruefung->prestudent_id ?>"
class="panel-collapse collapse<?php echo $infoonly ? '' : ' in' ?>">
<div class="panel-body">
<form method="post"
action="../saveZgvPruefung/<?php echo $zgvpruefung->prestudent_id ?>">
<div class="row">
<div class="col-lg-4">
<div class="form-group">
<label>Freigegeben an Studiengang: </label>
<?php echo isset($zgvpruefung->prestudentstatus->bestaetigtam) ? "ja" : "nein" ?>
</div>
</div>
<div class="col-lg-3">
<div class="form-group">
<label>Letzter Status: </label>
<?php echo isset($zgvpruefung->prestudentstatus->status_kurzbz) ? $zgvpruefung->prestudentstatus->status_kurzbz : '' ?>
</div>
</div>
<div class="col-lg-2">
<div class="form-group">
<label>Studiensemester: </label>
<?php echo isset($zgvpruefung->prestudentstatus->studiensemester_kurzbz) ? $zgvpruefung->prestudentstatus->studiensemester_kurzbz : '' ?>
</div>
</div>
<div class="col-lg-3">
<div class="form-group">
<label>Ausbildungssemester: </label>
<?php echo isset($zgvpruefung->prestudentstatus->ausbildungssemester) ? $zgvpruefung->prestudentstatus->ausbildungssemester : '' ?>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-4">
<div class="form-group">
<label>ZGV: </label>
<?php if ($infoonly)
echo $zgvpruefung->zgv_bez;
else
echo $this->widgetlib->widget(
'Zgv_widget',
array(DropdownWidget::SELECTED_ELEMENT => $zgvpruefung->zgv_code),
array('name' => 'zgv', 'id' => 'zgv')
); ?>
</div>
</div>
<div class="col-lg-3">
<div class="form-group">
<label>ZGV Ort: </label>
<?php if ($infoonly):
echo $zgvpruefung->zgvort;
else:
?>
<input type="text" class="form-control"
value="<?php echo $zgvpruefung->zgvort ?>"
name="zgvort">
<?php endif; ?>
</div>
</div>
<div class="col-lg-2">
<div class="form-group">
<label>ZGV Datum: </label>
<?php if ($infoonly):
echo date_format(date_create($zgvpruefung->zgvdatum), 'd.m.Y');
else:
?>
<input type="text" class="dateinput form-control"
value="<?php echo empty($zgvpruefung->zgvdatum) ? "" : date_format(date_create($zgvpruefung->zgvdatum), 'd.m.Y') ?>"
name="zgvdatum">
<?php endif; ?>
</div>
</div>
<div class="col-lg-3">
<div class="form-group">
<label>ZGV Nation: </label>
<?php if ($infoonly)
echo $zgvpruefung->zgvnation_bez;
else
echo $this->widgetlib->widget(
'Nation_widget',
array(DropdownWidget::SELECTED_ELEMENT => $zgvpruefung->zgvnation_code),
array('name' => 'zgvnation', 'id' => 'zgvnation')
); ?>
</div>
</div>
</div>
<!-- show only master zgv if master studiengang - start -->
<?php if ($zgvpruefung->studiengangtyp === 'm') : ?>
<div class="row">
<div class="col-lg-4">
<div class="form-group"><label>ZGV Master: </label>
<?php
if ($infoonly)
echo $zgvpruefung->zgvmas_bez;
else
echo $this->widgetlib->widget(
'Zgvmaster_widget',
array(DropdownWidget::SELECTED_ELEMENT => $zgvpruefung->zgvmas_code),
array('name' => 'zgvmas', 'id' => 'zgvmas')
); ?>
</div>
</div>
<div class="col-lg-3">
<div class="form-group">
<label>ZGV Master Ort: </label>
<?php if ($infoonly):
echo $zgvpruefung->zgvmaort;
else:
?>
<input type="text" class="form-control"
value="<?php echo $zgvpruefung->zgvmaort ?>"
name="zgvmaort">
<?php endif; ?>
</div>
</div>
<div class="col-lg-2">
<div class="form-group">
<label>ZGV Master Datum: </label>
<?php if ($infoonly):
echo date_format(date_create($zgvpruefung->zgvmadatum), 'd.m.Y');
else:
?>
<input type="text" class="dateinput form-control"
value="<?php echo empty($zgvpruefung->zgvmadatum) ? "" : date_format(date_create($zgvpruefung->zgvmadatum), 'd.m.Y') ?>"
name="zgvmadatum">
<?php endif; ?>
</div>
</div>
<div class="col-lg-3">
<div class="form-group"><label>ZGV Master Nation: </label>
<?php
if ($infoonly)
echo $zgvpruefung->zgvmanation_bez;
else
echo $this->widgetlib->widget(
'Nation_widget',
array(DropdownWidget::SELECTED_ELEMENT => $zgvpruefung->zgvmanation_code),
array('name' => 'zgvmanation', 'id' => 'zgvmanation')
); ?>
</div>
</div>
</div>
<!-- show only master zgv if master studiengang - end -->
<?php endif; ?>
<?php if (!$infoonly): ?>
<div class="row">
<div class="col-lg-12">
<button type="submit" class="btn btn-default">Speichern
</button>
</div>
</div>
<?php endif; ?>
</form>
<?php
//Prestudenten cannot be abgewiesen or freigegeben if already done
if (!$infoonly) :
?>
<hr>
<div class="row">
<div class="col-lg-12">
<form method="post"
action="../saveAbsage/<?php echo $zgvpruefung->prestudent_id ?>">
<div class="form-group">
<label class="d-inline float-left">Absagegrund:</label>
<select name="statusgrund" class="d-inline float-right">
<?php foreach ($statusgruende as $statusgrund): ?>
<option value="<?php echo $statusgrund->statusgrund_id ?>"><?php echo $statusgrund->bezeichnung_mehrsprachig[0] ?></option>
<?php endforeach ?>
</select>
</div>
<button type="button" class="btn btn-default"
data-toggle="modal" data-target="#absageModal">
Absage
</button>
<div class="modal fade" id="absageModal" tabindex="-1"
role="dialog" aria-labelledby="absageModalLabel"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close"
data-dismiss="modal"
aria-hidden="true">&times;
</button>
<h4 class="modal-title"
id="absageModalLabel">Absage best&auml;tigen</h4>
</div>
<div class="modal-body">
Bei Absage von InteressentInnen erhalten
diese den Status "Abgewiesener" und<br/>deren
Zgvdaten können
im Infocenter nicht mehr bearbeitet oder
freigegeben werden.
<br/>Alle nicht gespeicherten Zgvdaten gehen
verloren. Fortfahren?
</div>
<div class="modal-footer">
<button type="button"
class="btn btn-default"
data-dismiss="modal">Abbrechen
</button>
<button type="submit"
class="btn btn-primary">
InteressentIn abweisen
</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</form>
</div>
</div>
<hr>
<div class="row">
<div class="col-lg-12">
<button type="button" class="btn btn-default"
data-toggle="modal" data-target="#freigabeModal">
Freigabe an Studiengang
</button>
</div>
</div>
<div class="modal fade" id="freigabeModal" tabindex="-1" role="dialog"
aria-labelledby="freigabeModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;
</button>
<h4 class="modal-title" id="freigabeModalLabel">Freigabe
best&auml;tigen</h4>
</div>
<div class="modal-body">
Bei Freigabe von InteressentInnen wird deren
Interessentenstatus bestätigt und<br/>deren Zgvdaten
können im
Infocenter nicht mehr bearbeitet oder freigegeben
werden.
<br/>Alle nicht gespeicherten Zgvdaten gehen verloren.
Fortfahren?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">Abbrechen
</button>
<a href="../saveFreigabe/<?php echo $zgvpruefung->prestudent_id ?>">
<button type="button" class="btn btn-primary">
InteressentIn freigeben
</button>
</a>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<?php endif; //end if infoonly
?>
</div>
</div>
</div>
<?php endforeach; // end foreach zgvpruefungen?>
</div>
</div>
</div>
</div>
</div>
</section>
<section>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading text-center">
<a name="NotizAkt"></a>
<h4 class="text-center">Notizen &amp; Aktivit&auml;ten</h4>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-6">
<form method="post" action="../saveNotiz/<?php echo $stammdaten->person_id ?>">
<div class="form-group">
<div class="text-center">
<label>Notiz hinzuf&uuml;gen</label>
</div>
<div class="form-group">
<label>Titel: </label><input type="text" class="form-control"
name="notiztitel"/>
</div>
<div class="form-group">
<label>Text: </label><textarea name="notiz" class="form-control" rows="10"
cols="32"></textarea>
</div>
<button type="submit" class="btn btn-default">Speichern</button>
</div>
</form>
<table id="notiztable" class="table table-bordered table-hover">
<thead>
<th>Datum</th>
<th>Notiz</th>
<th>User</th>
</thead>
<tbody>
<?php foreach ($notizen as $notiz): ?>
<tr data-toggle="tooltip"
title="<?php echo isset($notiz->text) ? $notiz->text : '' ?>">
<td><?php echo date_format(date_create($notiz->insertamum), 'd.m.Y H:i:s') ?></td>
<td><?php echo $notiz->titel ?></td>
<td><?php echo $notiz->verfasser_uid ?></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
<div class="col-lg-6">
<table id="logtable" class="table table-bordered table-hover">
<thead>
<th>Datum</th>
<th>Aktivit&auml;t</th>
<th>User</th>
</thead>
<tbody>
<?php foreach ($logs as $log): ?>
<tr data-toggle="tooltip"
title="<?php echo isset($log->logdata->message) ? $log->logdata->message : '' ?>">
<td><?php echo date_format(date_create($log->zeitpunkt), 'd.m.Y H:i:s') ?></td>
<td><?php echo isset($log->logdata->name) ? $log->logdata->name : '' ?></td>
<td><?php echo $log->insertvon ?></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<script>
$(document).ready(function ()
{
//language for datatables
/* var german =
{
"sEmptyTable": "Keine Daten in der Tabelle vorhanden",
"sInfo": "_START_ bis _END_ von _TOTAL_ Einträgen",
"sInfoEmpty": "0 bis 0 von 0 Einträgen",
"sInfoFiltered": "(gefiltert von _MAX_ Einträgen)",
"sInfoPostFix": "",
"sInfoThousands": ".",
"sLengthMenu": "_MENU_ Einträge anzeigen",
"sLoadingRecords": "Wird geladen...",
"sProcessing": "Bitte warten...",
"sSearch": "Suchen",
"sZeroRecords": "Keine Einträge vorhanden.",
"oPaginate": {
"sFirst": "Erste",
"sPrevious": "Zurück",
"sNext": "Nächste",
"sLast": "Letzte"
},
"oAria": {
"sSortAscending": ": aktivieren, um Spalte aufsteigend zu sortieren",
"sSortDescending": ": aktivieren, um Spalte absteigend zu sortieren"
},
select: {
rows: {
_: '%d Zeilen ausgewählt',
0: 'Zum Auswählen auf eine Zeile klicken',
1: '1 Zeile ausgewählt'
}
}
};*/
var german = "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/German.json";
//hack for disabling table pagination if only one page
var drawCallback = function (settings)
{
var pagination = $(this).closest('.dataTables_wrapper').find('.dataTables_paginate');
pagination.toggle(this.api().page.info().pages > 1);
};
//format for sorting dates in tables
$.fn.dataTable.moment("DD.MM.YYYY");
$.fn.dataTable.moment("DD.MM.YYYY HH:mm:ss");
//initialise datatables and datepicker
$("#doctable").DataTable({
"language": {"url": german},
"responsive": true,
"paging": false,
"searching": false,
"info": false,
"order": [[2, "desc"], [1, "asc"]]
});
$("#nachgdoctable").DataTable({
"language": {"url": german},
"responsive": true,
"paging": false,
"searching": false,
"info": false,
"order": [[2, "asc"], [1, "desc"]]
});
$("#logtable").DataTable({
"language": {"url": german},
"responsive": false,
"lengthChange": false,
"info": false,
"pageLength": 25,
"order": [[0, "desc"]],
"drawCallback": drawCallback
});
$("#notiztable").DataTable({
"language": {"url": german},
"responsive": false,
"lengthChange": false,
"info": false,
"pageLength": 13,
"order": [[0, "desc"], [2, "asc"]],
"drawCallback": drawCallback
});
$(".dateinput").datepicker({
"language": "de",
"format": "dd.mm.yyyy"
});
//javascript hack - not nice!
$("select").addClass('form-control');
//add click events to "formal geprüft" checkboxes
<?php foreach($dokumente as $dokument): ?>
if ($("#prchkbx<?php echo $dokument->akte_id; ?>"))
{
$("#prchkbx<?php echo $dokument->akte_id; ?>").click(function ()
{
window.location = "../saveFormalGeprueft?akte_id=<?php echo $dokument->akte_id; ?>&formal_geprueft=" + this.checked + "&person_id=<?php echo $stammdaten->person_id ?>";
});
}
<?php endforeach ?>
}
);
</script>
</body>
<?php $this->load->view('templates/FHC-Footer'); ?>
@@ -0,0 +1,30 @@
<?php
function _printLists($listFilters)
{
foreach ($listFilters as $filterId => $description)
{
$toPrint = '<div><a href="%s=%s">%s</a></div>';
echo sprintf($toPrint, base_url('index.ci.php/system/infocenter/InfoCenter?filterId'), $filterId, $description).PHP_EOL;
}
}
// HTML
// body
// span
?>
<div>
<div>
Abgeschickt:
</div>
<?php _printLists($listFiltersSent); ?>
<div>
Nicht abgeschickt:
</div>
<?php _printLists($listFiltersNotSent); ?>
</div>
View File
View File
@@ -0,0 +1,3 @@
<!-- Footer start -->
</html>
<!-- Footer end -->
+149
View File
@@ -0,0 +1,149 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
// By default set the parameters to null
$title = isset($title) ? $title : null;
$customCSSs = isset($customCSSs) ? $customCSSs : null;
$customJSs = isset($customJSs) ? $customJSs : null;
// By default set the parameters to false
$jquery3 = isset($jquery3) ? $jquery3 : false;
$jqueryui = isset($jqueryui) ? $jqueryui : false;
$bootstrap = isset($bootstrap) ? $bootstrap : false;
$fontawesome = isset($fontawesome) ? $fontawesome : false;
$bootstrapdatepicker = isset($bootstrapdatepicker) ? $bootstrapdatepicker : false;
$datatables = isset($datatables) ? $datatables : false;
$tablesorter = isset($tablesorter) ? $tablesorter : false;
$sbadmintemplate = isset($sbadmintemplate) ? $sbadmintemplate : false;
/**
* Print the given title of the page
* NOTE: this is a required field, must be specified otherwise an error is shown
*/
function _printTitle($title)
{
if ($title != null)
{
echo $title;
}
else
{
show_error('The title for this page is not set');
}
}
/**
* Generates tags for the style sheets you want to include, the parameter could by a string or an array of strings
*/
function _generateCSSsInclude($CSSs)
{
$cssLink = '<link rel="stylesheet" type="text/css" href="%s" />';
if (isset($CSSs))
{
$tmpCSSs = is_array($CSSs) ? $CSSs : array($CSSs);
for ($tmpCSSsCounter = 0; $tmpCSSsCounter < count($tmpCSSs); $tmpCSSsCounter++)
{
$toPrint = sprintf($cssLink, base_url($tmpCSSs[$tmpCSSsCounter])).PHP_EOL;
if ($tmpCSSsCounter > 0) $toPrint = "\t\t".$toPrint;
echo $toPrint;
}
}
}
/**
* Generates tags for the javascripts you want to include, the parameter could by a string or an array of strings
*/
function _generateJSsInclude($JSs)
{
$jsInclude = '<script type="text/javascript" src="%s"></script>';
if (isset($JSs))
{
$tmpJSs = is_array($JSs) ? $JSs : array($JSs);
for ($tmpJSsCounter = 0; $tmpJSsCounter < count($tmpJSs); $tmpJSsCounter++)
{
$toPrint = sprintf($jsInclude, base_url($tmpJSs[$tmpJSsCounter])).PHP_EOL;
if ($tmpJSsCounter > 0) $toPrint = "\t\t".$toPrint;
echo $toPrint;
}
}
}
?>
<!-- Header start -->
<!DOCTYPE HTML>
<html>
<head>
<title><?php _printTitle($title); ?></title>
<meta charset="UTF-8">
<?php
// --------------------------------------------------------------------------------------------------------
// CSS
// jQuery UI CSS
if ($jqueryui === true) _generateCSSsInclude('vendor/components/jqueryui/themes/base/jquery-ui.min.css');
// bootstrap CSS
if ($bootstrap === true) _generateCSSsInclude('vendor/components/bootstrap/css/bootstrap.min.css');
// font awesome CSS
if ($fontawesome === true) _generateCSSsInclude('vendor/components/font-awesome/css/font-awesome.min.css');
// bootstrap datepicker CSS
if ($bootstrapdatepicker === true) _generateCSSsInclude('vendor/eternicode/bootstrap-datepicker/dist/css/bootstrap-datepicker3.min.css');
// datatables CSS
if ($datatables === true) _generateCSSsInclude('vendor/datatables/datatables/media/css/dataTables.bootstrap.min.css');
// Table sorter CSS
if ($tablesorter === true) _generateCSSsInclude('skin/tablesort.css');
// sb admin template CSS
if ($sbadmintemplate === true){
_generateCSSsInclude('vendor/BlackrockDigital/startbootstrap-sb-admin-2/vendor/metisMenu/metisMenu.min.css');
_generateCSSsInclude('vendor/BlackrockDigital/startbootstrap-sb-admin-2/dist/css/sb-admin-2.min.css');
}
// Eventually required CSS
_generateCSSsInclude($customCSSs); // Eventually required CSS
// --------------------------------------------------------------------------------------------------------
// Javascripts
// JQuery V3
if ($jquery3 === true) _generateJSsInclude('vendor/components/jquery/jquery.min.js');
// JQuery UI
if ($jqueryui === true) _generateJSsInclude('vendor/components/jqueryui/jquery-ui.min.js');
// bootstrap JS
if ($bootstrap === true) _generateJSsInclude('vendor/components/bootstrap/js/bootstrap.min.js');
// bootstrap datepicker JS
if ($bootstrapdatepicker === true){
_generateJSsInclude('vendor/eternicode/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js');
_generateJSsInclude('vendor/eternicode/bootstrap-datepicker/dist/locales/bootstrap-datepicker.de.min.js');
}
// datatables JS
if ($datatables === true)
{
_generateJSsInclude('vendor/datatables/datatables/media/js/jquery.dataTables.js');
_generateJSsInclude('vendor/datatables/datatables/media/js/dataTables.bootstrap.min.js');
_generateJSsInclude('vendor/moment/moment/min/moment.min.js');
_generateJSsInclude('vendor/datatables/plugins/sorting/datetime-moment.js');
}
// Table sorter JS
if ($tablesorter === true) _generateJSsInclude('vendor/christianbach/tablesorter/jquery.tablesorter.min.js');
// sb admin template JS
if ($sbadmintemplate === true){
_generateJSsInclude('vendor/BlackrockDigital/startbootstrap-sb-admin-2/vendor/metisMenu/metisMenu.min.js');
_generateJSsInclude('vendor/BlackrockDigital/startbootstrap-sb-admin-2/dist/js/sb-admin-2.js');
}
// Eventually required JS
_generateJSsInclude($customJSs);
?>
</head>
<!-- Header end -->
+11 -5
View File
@@ -69,12 +69,17 @@ if($jqueryV1 && $jqueryCurrent)
<script language="Javascript" type="text/javascript">
$(document).ready(function()
{
$("#<?php echo $tableid; ?>").tablesorter(
// Checks if the table contains data (rows)
if ($('#<?php echo $tableid; ?>').find('tbody:empty').length == 0
&& $('#<?php echo $tableid; ?>').find('tr:empty').length == 0)
{
sortList: [[<?php echo $sortList; ?>]],
widgets: ["<?php echo $widgets; ?>"],
headers: {<?php echo $headers; ?>}
});
$("#<?php echo $tableid; ?>").tablesorter(
{
sortList: [[<?php echo $sortList; ?>]],
widgets: ["<?php echo $widgets; ?>"],
headers: {<?php echo $headers; ?>}
});
}
});
</script>
<?php endif ?>
@@ -108,4 +113,5 @@ if($jqueryV1 && $jqueryCurrent)
<?php if($widgetsCSS) : ?>
<link rel="stylesheet" type="text/css" href="<?php echo base_url('skin/widgets.css'); ?>" />
<?php endif ?>
</head>
View File

Some files were not shown because too many files have changed in this diff Show More