mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-22 17:32:18 +00:00
- Changed helper and language autoload
- Changed language config - Removed never used constants - Changed rest_language in rest config file - Adapted models that where extending FHC_Model - Adapted code to load hlp_return_object - Adapted code to use exit status codes constants
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This model extends FHC_Model because here is just implemented logic
|
||||
* This model extends CI_Model because here is just implemented logic
|
||||
* It does not represent a resource (ex. like models that extend DB_Model)
|
||||
*/
|
||||
class Messages_model extends FHC_Model
|
||||
class Messages_model extends CI_Model
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@@ -11,7 +11,7 @@ class Notiz_model extends DB_Model
|
||||
$this->dbTable = 'public.tbl_notiz';
|
||||
$this->pk = 'notiz_id';
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Get a specialization for a prestudent
|
||||
@@ -20,10 +20,10 @@ class Notiz_model extends DB_Model
|
||||
{
|
||||
// Join with the table public.tbl_notizzuordnung using notiz_id
|
||||
$this->addJoin('public.tbl_notizzuordnung', 'notiz_id');
|
||||
|
||||
|
||||
return $this->NotizModel->loadWhere(array('prestudent_id' => $prestudent_id, 'titel' => $titel));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove a specialization
|
||||
*/
|
||||
@@ -31,31 +31,31 @@ class Notiz_model extends DB_Model
|
||||
{
|
||||
// Loads model Notizzuordnung_model
|
||||
$this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel');
|
||||
|
||||
|
||||
// Start DB transaction
|
||||
$this->db->trans_start(false);
|
||||
|
||||
|
||||
$result = $this->delete(array('notiz_id' => $notiz_id));
|
||||
if (isSuccess($result))
|
||||
{
|
||||
$result = $this->NotizzuordnungModel->delete(array('notiz_id' => $notiz_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);
|
||||
$result = error('An error occurred while removing a specialization', EXIT_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->trans_commit();
|
||||
$result = success('Specialization successfully removed');
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -66,32 +66,32 @@ class Notiz_model extends DB_Model
|
||||
{
|
||||
// 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' => true));
|
||||
$notiz_id = $result->retval;
|
||||
if (isSuccess($result))
|
||||
{
|
||||
$result = $this->NotizzuordnungModel->insert(array('notiz_id' => $notiz_id, 'prestudent_id' => $prestudent_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);
|
||||
$result = error('An error occurred while adding a specialization', EXIT_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->trans_commit();
|
||||
$result = success($notiz_id);
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ class Notiz_model extends DB_Model
|
||||
if ($this->db->trans_status() === false || isError($result))
|
||||
{
|
||||
$this->db->trans_rollback();
|
||||
$result = error($result->msg, EXIT_ERROR);
|
||||
$result = error('An error occurred while adding a note for a person', EXIT_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -151,7 +151,7 @@ class Message_model extends DB_Model
|
||||
}
|
||||
else
|
||||
{
|
||||
return error($this->db->error(), FHC_DB_ERROR);
|
||||
return error($this->db->error(), EXIT_DATABASE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ class Message_model extends DB_Model
|
||||
}
|
||||
else
|
||||
{
|
||||
return error($this->db->error(), FHC_DB_ERROR);
|
||||
return error($this->db->error(), EXIT_DATABASE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user