diff --git a/application/controllers/system/Messages.php b/application/controllers/system/Messages.php index ba3c79aee..e9f80e8c1 100755 --- a/application/controllers/system/Messages.php +++ b/application/controllers/system/Messages.php @@ -8,8 +8,7 @@ class Messages extends VileSci_Controller { parent::__construct(); $this->load->library('MessageLib'); - //$this->load->model('person/Person_model'); - //$this->load->model('system/Message_model'); + $this->load->model('person/Person_model', 'PersonModel'); } public function index($person_id = null) @@ -18,7 +17,7 @@ class Messages extends VileSci_Controller $this->load->view('system/messages.php', $data); } - public function table($person_id = null) + public function inbox($person_id = null) { if (empty($person_id)) $person_id = $this->input->post('person_id', TRUE); @@ -31,12 +30,43 @@ class Messages extends VileSci_Controller $data = array ( + 'uid' => $this->getUID(), 'messages' => $msg->retval ); - //var_dump ($data); - $this->load->view('system/messagesList.php', $data); + if (!empty($person_id)) + { + $person = $this->PersonModel->load($person_id); + $data['person'] = $person->retval[0]; + } + // var_dump ($data); + $this->load->view('system/messagesInbox.php', $data); } + public function outbox($person_id = null) + { + if (empty($person_id)) + $person_id = $this->input->post('person_id', TRUE); + if (empty($person_id)) + $msg = $this->messagelib->getMessagesByUID($this->getUID()); + else + $msg = $this->messagelib->getMessagesByPerson($person_id); + if ($msg->error) + show_error($msg->retval); + + $data = array + ( + 'uid' => $this->getUID(), + 'messages' => $msg->retval + ); + if (!empty($person_id)) + { + $person = $this->PersonModel->load($person_id); + $data['person'] = $person->retval[0]; + } + //var_dump ($data); + $this->load->view('system/messagesOutbox.php', $data); + } + public function view($msg_id) { $msg = $this->messagelib->getMessage($msg_id); diff --git a/application/controllers/system/Templates.php b/application/controllers/system/Templates.php index e5806508c..796c50c02 100755 --- a/application/controllers/system/Templates.php +++ b/application/controllers/system/Templates.php @@ -134,6 +134,10 @@ class Templates extends FHC_Controller $data['studiengang_kz'] = $this->input->post('studiengang_kz', TRUE); $data['version'] = $this->input->post('version', TRUE); $data['oe_kurzbz'] = $this->input->post('oe_kurzbz', TRUE); + if ($this->input->post('orgform_kurzbz') == '') + $data['orgform_kurzbz'] = null; + else + $data['orgform_kurzbz'] = $this->input->post('orgform_kurzbz', TRUE); $data['text'] = $this->input->post('text', TRUE); $data['aktiv'] = $this->input->post('aktiv', TRUE); $vorlagetext = $this->vorlagelib->updateVorlagetext($vorlagestudiengang_id, $data); diff --git a/application/core/DB_Model.php b/application/core/DB_Model.php index 4e5f2474d..a5bc4d298 100644 --- a/application/core/DB_Model.php +++ b/application/core/DB_Model.php @@ -128,7 +128,7 @@ class DB_Model extends FHC_Model * @param string $id ID (Primary Key) for SELECT ... WHERE * @return array */ - public function load($id) + public function load($id = null) { // Check Class-Attributes if (is_null($this->dbTable)) @@ -150,6 +150,8 @@ class DB_Model extends FHC_Model else $result = $this->db->get_where($this->dbTable, $id); } + elseif (empty($id)) + $result = $this->db->get($this->dbTable); else $result = $this->db->get_where($this->dbTable, array($this->pk => $id)); @@ -185,6 +187,8 @@ class DB_Model extends FHC_Model return $this->_error($this->db->error(), FHC_DB_ERROR); } + + /** --------------------------------------------------------------- * Load single data from DB-Table * @@ -212,7 +216,7 @@ class DB_Model extends FHC_Model else return $this->_error($this->db->error(), FHC_DB_ERROR); } - + /** --------------------------------------------------------------- * Add a table to join with * diff --git a/application/core/FHC_Controller.php b/application/core/FHC_Controller.php index 3216bbb63..66bc0c64f 100644 --- a/application/core/FHC_Controller.php +++ b/application/core/FHC_Controller.php @@ -3,7 +3,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); class FHC_Controller extends CI_Controller { - protected $_uid; // needs to be changed to protected $_uid + protected $_uid; public function __construct() { diff --git a/application/migrations/010_vorlage.php b/application/migrations/010_vorlage.php index 0fda6823c..110200fd2 100755 --- a/application/migrations/010_vorlage.php +++ b/application/migrations/010_vorlage.php @@ -29,7 +29,8 @@ class Migration_Vorlage extends CI_Migration { else echo "Error adding public.tbl_vorlage.attribute!"; } - + + // tbl_vorlagestudiengang->Subject if (! @$this->db->simple_query('SELECT subject FROM public.tbl_vorlagestudiengang')) { $this->db->insert('system.tbl_berechtigung', array( @@ -48,6 +49,7 @@ class Migration_Vorlage extends CI_Migration { echo "Error adding public.tbl_vorlagestudiengang.subject!"; } + // tbl_vorlagestudiengang->OrgForm if (! @$this->db->simple_query('SELECT orgform_kurzbz FROM public.tbl_vorlagestudiengang')) { $query= "ALTER TABLE public.tbl_vorlagestudiengang diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php index 5117b742d..b84fff1c3 100644 --- a/application/models/system/Message_model.php +++ b/application/models/system/Message_model.php @@ -23,13 +23,13 @@ class Message_model extends DB_Model if ($uid === $this->getUID()) { if (! $this->fhc_db_acl->isBerechtigt('basis/message', 's')) - return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> system/message', FHC_MODEL_ERROR); + return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> basis/message', FHC_MODEL_ERROR); } // if different user, for reading messages from other users else { if (! $this->fhc_db_acl->isBerechtigt('basis/message', 's')) - return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> system/message:all', FHC_MODEL_ERROR); + return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> basis/message:all', FHC_MODEL_ERROR); } // get Data @@ -120,4 +120,4 @@ public function getMessagesByPerson($person_id, $all) else return $this->_error($this->db->error(), FHC_DB_ERROR); } -} \ No newline at end of file +} diff --git a/application/views/system/messages.php b/application/views/system/messages.php index 4b583edb4..7bada1a87 100644 --- a/application/views/system/messages.php +++ b/application/views/system/messages.php @@ -7,7 +7,7 @@