From 25e0ba9407462ecf7a71d448d591b0fec663ec69 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 22 Jun 2016 01:24:59 +0200 Subject: [PATCH] basic phrases editing --- application/controllers/system/Phrases.php | 70 ++++++++----------- application/libraries/PhrasesLib.php | 26 +++---- application/views/system/phraseinhaltEdit.php | 31 ++++++++ application/views/system/phrasesEdit.php | 17 +++++ .../views/system/phrasesinhaltList.php | 2 + include/tw/vilesci_menu_main.inc.php | 3 +- 6 files changed, 96 insertions(+), 53 deletions(-) create mode 100644 application/views/system/phraseinhaltEdit.php create mode 100644 application/views/system/phrasesEdit.php diff --git a/application/controllers/system/Phrases.php b/application/controllers/system/Phrases.php index eedb4bb1e..28e186014 100644 --- a/application/controllers/system/Phrases.php +++ b/application/controllers/system/Phrases.php @@ -47,23 +47,23 @@ class Phrases extends FHC_Controller $v = $this->load->view('system/phrasesinhaltList.php', $data); } - public function edit($vorlage_kurzbz = null) + public function edit($phrase_id = null) { - if (empty($vorlage_kurzbz)) + if (empty($phrase_id)) exit; - $vorlage = $this->vorlagelib->getVorlage($vorlage_kurzbz); + $phrase = $this->phraseslib->getPhrase($phrase_id); //var_dump($vorlage); - if ($vorlage->error) - show_error($vorlage->retval); - if (count($vorlage->retval) != 1) - show_error('Nachricht nicht vorhanden! ID: '.$vorlage_kurzbz); + if ($phrase->error) + show_error($phrase->retval); + if (count($phrase->retval) != 1) + show_error('Phrase nicht vorhanden! ID: '.$phrase_id); $data = array ( - 'vorlage' => $vorlage->retval[0] + 'phrase' => $phrase->retval[0] ); //var_dump($data['message']); - $v = $this->load->view('system/templatesEdit', $data); + $v = $this->load->view('system/phrasesEdit', $data); } public function write($vorlage_kurzbz = null) @@ -78,17 +78,14 @@ class Phrases extends FHC_Controller public function save() { - $vorlage_kurzbz = $this->input->post('vorlage_kurzbz', TRUE); - $data['bezeichnung'] = $this->input->post('bezeichnung', TRUE); - $data['anmerkung'] = $this->input->post('anmerkung', TRUE); - $data['mimetype'] = $this->input->post('mimetype', TRUE); - $data['attribute'] = $this->input->post('attribute', TRUE); - $vorlage = $this->vorlagelib->saveVorlage($vorlage_kurzbz, $data); - if ($vorlage->error) - show_error($vorlage->retval); - $vorlage_kurzbz = $vorlage->retval; + $phrase_id = $this->input->post('phrase_id', TRUE); + $data['phrase'] = $this->input->post('phrase', TRUE); + $phrase = $this->phraseslib->savePhrase($phrase_id, $data); + if ($phrase->error) + show_error($phrase->retval); + $phrase_id = $phrase->retval; - redirect('/system/Templates/edit/'.$vorlage_kurzbz); + redirect('/system/Phrases/edit/'.$phrase_id); } public function newText() @@ -109,33 +106,28 @@ class Phrases extends FHC_Controller redirect('/system/Templates/editText/'.$vorlagestudiengang_id); } - public function editText($vorlagestudiengang_id) + public function editText($phrase_inhalt_id) { - $vorlagetext = $this->vorlagelib->getVorlagetextById($vorlagestudiengang_id); - if ($vorlagetext->error) - show_error($vorlagetext->retval); - $data = $vorlagetext->retval[0]; + $phrase_inhalt = $this->phraseslib->getPhraseInhaltById($phrase_inhalt_id); + if ($phrase_inhalt->error) + show_error($phrase_inhalt->retval); + $data = $phrase_inhalt->retval[0]; - // Preview-Data - $schema = $this->vorlagelib->getVorlage($data->vorlage_kurzbz); - $data->schema = $schema->retval[0]->attribute; - - $this->load->view('system/templatetextEdit', $data); + $this->load->view('system/phraseinhaltEdit', $data); } public function saveText() { - $vorlagestudiengang_id = $this->input->post('vorlagestudiengang_id', TRUE); - $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); + $phrase_inhalt_id = $this->input->post('phrase_inhalt_id', TRUE); + $data['orgeinheit_kurzbz'] = $this->input->post('oe_kurzbz', TRUE); $data['text'] = $this->input->post('text', TRUE); - $data['aktiv'] = $this->input->post('aktiv', TRUE); - $vorlagetext = $this->vorlagelib->updateVorlagetext($vorlagestudiengang_id, $data); - if ($vorlagetext->error) - show_error($vorlagetext->retval); - $data['vorlagestudiengang_id'] = $vorlagestudiengang_id; - redirect('/system/Templates/editText/'.$vorlagestudiengang_id); + $data['description'] = $this->input->post('description', TRUE); + $data['sprache'] = $this->input->post('sprache', TRUE); + $phrase_inhalt = $this->phraseslib->updatePhraseInhalt($phrase_inhalt_id, $data); + if ($phrase_inhalt->error) + show_error($phrase_inhalt->retval); + $data['phrase_inhalt_id'] = $phrase_inhalt_id; + redirect('/system/Phrases/editText/'.$phrase_inhalt_id); //$this->load->view('system/templatetextEdit', $data); } diff --git a/application/libraries/PhrasesLib.php b/application/libraries/PhrasesLib.php index 1fad64e56..1cc023863 100644 --- a/application/libraries/PhrasesLib.php +++ b/application/libraries/PhrasesLib.php @@ -30,10 +30,10 @@ class PhrasesLib */ function getPhrase($phrase_id) { - if (empty($vorlage_kurzbz)) + if (empty($phrase_id)) return $this->_error(MSG_ERR_INVALID_MSG_ID); - $Phrase = $this->ci->PhraseModel->load($phrase_id); + $phrase = $this->ci->PhraseModel->load($phrase_id); return $phrase; } @@ -59,18 +59,18 @@ class PhrasesLib } /** - * saveVorlage() - will save a spezific Template. + * savePhrase() - will save a spezific Phrase. * * @param array $data REQUIRED * @return array */ - function saveVorlage($vorlage_kurzbz, $data) + function savePhrase($phrase_id, $data) { if (empty($data)) return $this->_error(MSG_ERR_INVALID_MSG_ID); - $vorlage = $this->ci->VorlageModel->update($vorlage_kurzbz, $data); - return $vorlage; + $phrase = $this->ci->PhraseModel->update($phrase_id, $data); + return $phrase; } @@ -80,13 +80,13 @@ class PhrasesLib * @param string $vorlage_kurzbz REQUIRED * @return array */ - function getVorlagetextByVorlage($vorlage_kurzbz) + function getPhraseInhaltById($phrase_inhalt_id) { - if (empty($vorlage_kurzbz)) + if (empty($phrase_inhalt_id)) return $this->_error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false)); - $vorlage = $this->ci->VorlageStudiengangModel->loadWhere(array('vorlage_kurzbz' =>$vorlage_kurzbz)); - return $vorlage; + $phrase_inhalt = $this->ci->PhraseInhaltModel->loadWhere(array('phrase_inhalt_id' =>$phrase_inhalt_id)); + return $phrase_inhalt; } /** @@ -136,10 +136,10 @@ class PhrasesLib * @param string $vorlage_kurzbz REQUIRED * @return array */ - function updateVorlagetext($vorlagestudiengang_id, $data) + function updatePhraseInhalt($phrase_inhalt_id, $data) { - $vorlagetext = $this->ci->VorlageStudiengangModel->update($vorlagestudiengang_id, $data); - return $vorlagetext; + $phrase_inhalt = $this->ci->PhraseInhaltModel->update($phrase_inhalt_id, $data); + return $phrase_inhalt; } /** diff --git a/application/views/system/phraseinhaltEdit.php b/application/views/system/phraseinhaltEdit.php new file mode 100644 index 000000000..2e2d39ded --- /dev/null +++ b/application/views/system/phraseinhaltEdit.php @@ -0,0 +1,31 @@ +load->view('templates/header', array('title' => 'TemplateEdit', 'tinymce' => true, 'jsonforms' => true)); +?> + +
+
+

Phrase Inhalt:

+ +
+ + + + + + + templatelib->widget("tinymce_widget", array('name' => 'text', 'text' => $text)); + ?> + +
OEtemplatelib->widget("organisationseinheit_widget", array('oe_kurzbz' => $orgeinheit_kurzbz)); ?>
Sprache
Text
Beschreibung
+
+ +
+
+ + + + diff --git a/application/views/system/phrasesEdit.php b/application/views/system/phrasesEdit.php new file mode 100644 index 000000000..d967dee83 --- /dev/null +++ b/application/views/system/phrasesEdit.php @@ -0,0 +1,17 @@ +load->view('templates/header', array('title' => 'PhrasesEdit')); +?> +
+
+

Phrase: phrase_id; ?>

+
+ Bezeichnung: + + +
+ +
+
+ + + diff --git a/application/views/system/phrasesinhaltList.php b/application/views/system/phrasesinhaltList.php index 4e6b5fe43..bcc046031 100644 --- a/application/views/system/phrasesinhaltList.php +++ b/application/views/system/phrasesinhaltList.php @@ -18,6 +18,7 @@ OrgForm Text Beschreibung + @@ -28,6 +29,7 @@ orgform_kurzbz; ?> text; ?> description; ?> + edit diff --git a/include/tw/vilesci_menu_main.inc.php b/include/tw/vilesci_menu_main.inc.php index cd0a36009..2d27ed56d 100644 --- a/include/tw/vilesci_menu_main.inc.php +++ b/include/tw/vilesci_menu_main.inc.php @@ -225,7 +225,8 @@ $menu=array 'link'=>'left.php?categorie=Admin', 'target'=>'nav', 'Cronjobs'=>array('name'=>'Cronjobs', 'link'=>'stammdaten/cronjobverwaltung.php', 'target'=>'main','permissions'=>array('basis/cronjob')), 'Vorlagen'=>array('name'=>'Vorlagen', 'link'=>'../index.ci.php/system/Templates', 'target'=>'main','permissions'=>array('basis/cronjob')), - 'Messages'=>array('name'=>'Nachrichten', 'link'=>'../index.ci.php/system/Messages', 'target'=>'main','permissions'=>array('basis/cronjob')) + 'Messages'=>array('name'=>'Nachrichten', 'link'=>'../index.ci.php/system/Messages', 'target'=>'main','permissions'=>array('basis/cronjob')), + 'Phrasen'=>array('name'=>'Phrasen', 'link'=>'../index.ci.php/system/Phrases', 'target'=>'main','permissions'=>array('basis/cronjob')) ), 'SD-Tools'=> array (