diff --git a/application/config/autoload.php b/application/config/autoload.php index c40606b70..43aaa1598 100755 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -114,7 +114,7 @@ $autoload['config'] = array('fhcomplete'); | "codeigniter_lang.php" would be referenced as array('codeigniter'); | */ -$autoload['language'] = array(); +$autoload['language'] = array('fhcomplete'); /* | ------------------------------------------------------------------- diff --git a/application/config/constants.php b/application/config/constants.php index 3a85ad023..e1593c799 100755 --- a/application/config/constants.php +++ b/application/config/constants.php @@ -16,6 +16,7 @@ define('FHC_MODEL_ERROR', 2); // Model Error define('FHC_DB_ERROR', 3); // Database Error define('FHC_NODBTABLE', 4); // No DB-Table is set define('FHC_NORIGHT', 5); // No rights +define('FHC_INVALIDID', 6); // Invalid or no ID (key) diff --git a/application/controllers/system/Templates.php b/application/controllers/system/Templates.php index 8914763b0..8503a2a2e 100755 --- a/application/controllers/system/Templates.php +++ b/application/controllers/system/Templates.php @@ -35,6 +35,23 @@ class Templates extends FHC_Controller $v = $this->load->view('system/templatesList.php', $data); } + public function view($vorlage_kurzbz = null) + { + if (empty($vorlage_kurzbz)) + exit; + $vorlagentext = $this->vorlagelib->getVorlagentextByVorlage($vorlage_kurzbz); + if ($vorlagentext->error) + show_error($vorlagentext->retval); + //var_dump($vorlage); + + $data = array + ( + 'vorlage_kurzbz' => $vorlage_kurzbz, + 'vorlagentext' => $vorlagentext->retval + ); + $v = $this->load->view('system/templatetextList.php', $data); + } + public function edit($vorlage_kurzbz = null) { if (empty($vorlage_kurzbz)) @@ -77,4 +94,19 @@ class Templates extends FHC_Controller redirect('/system/Templates/edit/'.$vorlage_kurzbz); } + + public function newtext() + { + $vorlage_kurzbz = $this->input->post('vorlage_kurzbz', TRUE); + $data = array + ( + 'vorlage_kurzbz' => $vorlage_kurzbz; + ); + $vorlagetext = $this->vorlagelib->insertVorlagetext($data); + if ($vorlage->error) + show_error($vorlage->retval); + $vorlage_kurzbz = $vorlage->retval; + + redirect('/system/Templates/edit/'.$vorlage_kurzbz); + } } diff --git a/application/language/de-AT/fhcomplete_lang.php b/application/language/de-AT/fhcomplete_lang.php index 6816fc4db..3dcc7fe74 100644 --- a/application/language/de-AT/fhcomplete_lang.php +++ b/application/language/de-AT/fhcomplete_lang.php @@ -1,5 +1,10 @@ ci =& get_instance(); $this->ci->load->model('system/Vorlage_model', 'VorlageModel'); + $this->ci->load->model('system/Vorlagestudiengang_model', 'VorlageStudiengangModel'); $this->ci->load->helper('language'); - $this->ci->lang->load('message'); + //$this->ci->lang->load('fhcomplete'); } /** @@ -48,6 +49,7 @@ class VorlageLib return $vorlage; } + /** * saveVorlage() - will save a spezific Template. * @@ -62,13 +64,29 @@ class VorlageLib $vorlage = $this->ci->VorlageModel->update($vorlage_kurzbz, $data); return $vorlage; } + + + /** + * getVorlagentextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template. + * + * @param string $vorlage_kurzbz REQUIRED + * @return array + */ + function getVorlagentextByVorlage($vorlage_kurzbz) + { + if (empty($vorlage_kurzbz)) + return $this->_error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false)); + + $vorlage = $this->ci->VorlageStudiengangModel->loadWhere(array('vorlage_kurzbz' =>$vorlage_kurzbz)); + return $vorlage; + } /** --------------------------------------------------------------- * Success * * @param mixed $retval * @return array */ - protected function _success($retval, $message = MSG_SUCCESS) + protected function _success($retval, $message = FHC_SUCCESS) { $return = new stdClass(); $return->error = EXIT_SUCCESS; @@ -83,7 +101,7 @@ class VorlageLib * * @return array */ - protected function _error($retval = '', $message = MSG_ERROR_GENERAL) + protected function _error($retval = '', $message = FHC_ERROR) { $return = new stdClass(); $return->error = EXIT_ERROR; diff --git a/application/views/system/templatesList.php b/application/views/system/templatesList.php index 7e8adeffb..572d7aaaa 100644 --- a/application/views/system/templatesList.php +++ b/application/views/system/templatesList.php @@ -4,7 +4,8 @@