Phrasentext delete

This commit is contained in:
Gerry Raab
2016-07-04 18:25:35 +02:00
parent de7fc12c62
commit 23201670b1
4 changed files with 41 additions and 18 deletions
+14 -2
View File
@@ -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];
+20 -11
View File
@@ -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)
{
@@ -4,10 +4,10 @@
<div class="row">
<div class="span4">
<h2>Phrase Inhalt: <?=$phrase_inhalt_id?></h2>
<h2>Phrase Inhalt: <?=$phrasentext_id?></h2>
<form method="post" action="../saveText/<?=$phrase_inhalt_id?>">
<input type="hidden" name="phrase_inhalt_id" value="<?php echo $phrase_inhalt_id; ?>" />
<form method="post" action="../saveText/<?=$phrasentext_id?>">
<input type="hidden" name="phrase_inhalt_id" value="<?php echo $phrasentext_id; ?>" />
<table>
<tr>
<td>OE</td>
@@ -19,17 +19,19 @@
<th class='table-sortable:default'>Text</th>
<th>Beschreibung</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($phrase_inhalt as $v): ?>
<tr><td><a href="../edittext/<?php echo $v->phrase_inhalt_id; ?>" target="PhrasesBottom"><?php echo $v->phrase_inhalt_id; ?></a></td>
<tr><td><a href="../edittext/<?php echo $v->phrasentext_id; ?>" target="PhrasesBottom"><?php echo $v->phrasentext_id; ?></a></td>
<td><?php echo $v->sprache; ?></td>
<td><?php echo $v->orgeinheit_kurzbz; ?></td>
<td><?php echo $v->orgform_kurzbz; ?></td>
<td><?php echo $v->text; ?></td>
<td><?php echo $v->description; ?></td>
<td><a href="../edittext/<?php echo $v->phrase_inhalt_id; ?>" target="PhrasesBottom">edit</a></td>
<td><a href="../edittext/<?php echo $v->phrasentext_id; ?>" target="PhrasesBottom">edit</a></td>
<td><a href="../deltext/<?php echo $v->phrasentext_id; ?>/<?php echo $phrase_id ?>" target="PhrasesBottom">delete</a></td>
</tr>
<?php endforeach ?>
</tbody>