From 23201670b1c2722c1579a315fba1d8581561651d Mon Sep 17 00:00:00 2001 From: Gerry Raab Date: Mon, 4 Jul 2016 18:25:35 +0200 Subject: [PATCH] Phrasentext delete --- application/controllers/system/Phrases.php | 16 ++++++++-- application/libraries/PhrasesLib.php | 31 ++++++++++++------- application/views/system/phraseinhaltEdit.php | 6 ++-- .../views/system/phrasesinhaltList.php | 6 ++-- 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/application/controllers/system/Phrases.php b/application/controllers/system/Phrases.php index 4bc0ad209..e62cee746 100644 --- a/application/controllers/system/Phrases.php +++ b/application/controllers/system/Phrases.php @@ -47,6 +47,18 @@ class Phrases extends FHC_Controller $v = $this->load->view('system/phrasesinhaltList.php', $data); } + public function deltext($phrasentext_id=null, $phrase_id = null) + { + if (empty($phrase_id) or empty($phrasentext_id)) + exit; + $phrase_inhalt = $this->phraseslib->delPhrasentext($phrasentext_id); + if ($phrase_inhalt->error) + show_error($phrase_inhalt->retval); + //var_dump($vorlage); + + redirect('/system/Phrases/view/'.$phrase_id); + } + public function edit($phrase_id = null) { if (empty($phrase_id)) @@ -107,9 +119,9 @@ class Phrases extends FHC_Controller redirect('/system/Phrases/editText/'.$phrase_inhalt_id); } - public function editText($phrase_inhalt_id) + public function editText($phrasentext_id) { - $phrase_inhalt = $this->phraseslib->getPhraseInhaltById($phrase_inhalt_id); + $phrase_inhalt = $this->phraseslib->getPhrasentextById($phrasentext_id); if ($phrase_inhalt->error) show_error($phrase_inhalt->retval); $data = $phrase_inhalt->retval[0]; diff --git a/application/libraries/PhrasesLib.php b/application/libraries/PhrasesLib.php index 46283c286..620a6c948 100644 --- a/application/libraries/PhrasesLib.php +++ b/application/libraries/PhrasesLib.php @@ -9,19 +9,19 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); class PhrasesLib { /* - * + * */ public function __construct() { //require_once APPPATH.'config/message.php'; $this->ci =& get_instance(); - + $this->ci->load->library('parser'); - + $this->ci->load->model('system/Phrase_model', 'PhraseModel'); $this->ci->load->model('system/Phrasentext_model', 'PhrasentextModel'); - + $this->ci->load->helper('language'); $this->ci->load->helper('Message'); //$this->ci->lang->load('fhcomplete'); @@ -63,6 +63,15 @@ class PhrasesLib return $phrasentext; } + function delPhrasentext($phrasentext_id) + { + if (empty($phrasentext_id)) + return $this->_error(MSG_ERR_INVALID_MSG_ID); + + $phrasentext = $this->ci->PhrasentextModel->delete(array('phrasentext_id' => $phrasentext_id)); + return $phrasentext; + } + /** * savePhrase() - will save a spezific Phrase. * @@ -93,9 +102,9 @@ class PhrasesLib $phrasentext = $this->ci->PhrasentextModel->load($phrasentext_id); return $phrasentext; } - + /** - * getPhrases() - + * getPhrases() - * * @return struct */ @@ -109,7 +118,7 @@ class PhrasesLib { $result = $this->_error('app and sprache parameters are required'); } - + return $result; } @@ -180,17 +189,17 @@ class PhrasesLib $text = $this->ci->parser->parse_string($text, $data, TRUE); return $text; } - + /* - * + * */ protected function _error($retval = '', $message = EXIT_ERROR) { return error($retval, $message); } - + /* - * + * */ protected function _success($retval, $message = EXIT_SUCCESS) { diff --git a/application/views/system/phraseinhaltEdit.php b/application/views/system/phraseinhaltEdit.php index 00ec8996d..4c3647499 100644 --- a/application/views/system/phraseinhaltEdit.php +++ b/application/views/system/phraseinhaltEdit.php @@ -4,10 +4,10 @@
-

Phrase Inhalt:

+

Phrase Inhalt:

-
- + + diff --git a/application/views/system/phrasesinhaltList.php b/application/views/system/phrasesinhaltList.php index 8e4897ff4..0efc1691b 100644 --- a/application/views/system/phrasesinhaltList.php +++ b/application/views/system/phrasesinhaltList.php @@ -19,17 +19,19 @@ + - + - + +
OEText Beschreibung
phrase_inhalt_id; ?>
phrasentext_id; ?> sprache; ?> orgeinheit_kurzbz; ?> orgform_kurzbz; ?> text; ?> description; ?>editeditdelete