Task #408: Statusgründe

This commit is contained in:
bison-paolo
2016-09-29 17:17:58 +02:00
parent 9a8863e5ef
commit 233b60d916
7 changed files with 438 additions and 51 deletions
+197 -39
View File
@@ -29,10 +29,10 @@ class Statusgrund extends VileSci_Controller
"status" => $status->retval
);
$this->load->view("crm/statusgrundList.php", $data);
$this->load->view("crm/statusList.php", $data);
}
public function editGrund($status_kurzbz)
public function listGrund($status_kurzbz)
{
$statusGrund = $this->StatusgrundModel->loadWhere(array("status_kurzbz" => $status_kurzbz));
if ($statusGrund->error)
@@ -40,10 +40,20 @@ class Statusgrund extends VileSci_Controller
show_error($statusGrund->retval);
}
if (count($statusGrund->retval) == 0)
$data = array (
"statusGrund" => $statusGrund->retval,
"status_kurzbz" => $status_kurzbz
);
$this->load->view("crm/statusGrundList.php", $data);
}
public function editGrund($statusgrund_kurzbz, $update = null)
{
$statusGrund = $this->StatusgrundModel->load($statusgrund_kurzbz);
if ($statusGrund->error)
{
$statusGrund->retval[0] = new stdClass();
$statusGrund->retval[0]->status_kurzbz = $status_kurzbz;
show_error($statusGrund->retval);
}
$sprache = $this->SpracheModel->load();
@@ -54,35 +64,76 @@ class Statusgrund extends VileSci_Controller
$data = array (
"statusgrund" => $statusGrund->retval[0],
"sprache" => $sprache->retval
"sprache" => $sprache->retval,
"update" => $update
);
$this->load->view("crm/statusgrundEdit.php", $data);
}
public function editStatus($status_kurzbz, $update = null)
{
$status = $this->StatusModel->load($status_kurzbz);
if ($status->error)
{
show_error($status->retval);
}
$sprache = $this->SpracheModel->load();
if ($sprache->error)
{
show_error($sprache->retval);
}
$data = array (
"status" => $status->retval[0],
"sprache" => $sprache->retval,
"update" => $update
);
$this->load->view("crm/statusEdit.php", $data);
}
public function newGrund($status_kurzbz)
{
$sprache = $this->SpracheModel->load();
if ($sprache->error)
{
show_error($sprache->retval);
}
$data = array (
"status_kurzbz" => $status_kurzbz,
"sprache" => $sprache->retval
);
$this->load->view("crm/statusgrundNew.php", $data);
}
public function saveGrund()
{
$statusgrund_kurzbz = $this->input->post("statusgrund_kurzbz");
$aktiv = $this->input->post("aktiv") != null && $this->input->post("aktiv") == "on" ? true : false;
$bezeichnung_mehrsprachig = $this->input->post("bezeichnung_mehrsprachig");
$beschreibung = $this->input->post("beschreibung");
$status_kurzbz = $this->input->post("status_kurzbz");
for ($i = 0; $i < count($bezeichnung_mehrsprachig); $i++)
{
if ($i == 0) $tmp = "{";
if (trim($bezeichnung_mehrsprachig[$i]) != "")
if (trim($bezeichnung_mehrsprachig[$i]) == "")
{
$bezeichnung_mehrsprachig[$i] = str_replace(",", "|", $bezeichnung_mehrsprachig[$i]);
if ($i < count($bezeichnung_mehrsprachig) - 1)
{
$tmp .= $bezeichnung_mehrsprachig[$i] . ",";
}
else
{
$tmp .= $bezeichnung_mehrsprachig[$i];
}
$bezeichnung_mehrsprachig[$i] = "\"\"";
}
$bezeichnung_mehrsprachig[$i] = str_replace(",", "|", $bezeichnung_mehrsprachig[$i]);
if ($i < count($bezeichnung_mehrsprachig) - 1)
{
$tmp .= $bezeichnung_mehrsprachig[$i] . ",";
}
else
{
$tmp .= $bezeichnung_mehrsprachig[$i];
}
if ($i == count($bezeichnung_mehrsprachig) - 1) $bezeichnung_mehrsprachig = $tmp . "}";
@@ -92,17 +143,19 @@ class Statusgrund extends VileSci_Controller
{
if ($i == 0) $tmp = "{";
if (trim($beschreibung[$i]) != "")
if (trim($beschreibung[$i]) == "")
{
$beschreibung[$i] = str_replace(",", "|", $beschreibung[$i]);
if ($i < count($beschreibung) - 1)
{
$tmp .= $beschreibung[$i] . ",";
}
else
{
$tmp .= $beschreibung[$i];
}
$beschreibung[$i] = "\"\"";
}
$beschreibung[$i] = str_replace(",", "|", $beschreibung[$i]);
if ($i < count($beschreibung) - 1)
{
$tmp .= $beschreibung[$i] . ",";
}
else
{
$tmp .= $beschreibung[$i];
}
if ($i == count($beschreibung) - 1) $beschreibung = $tmp . "}";
@@ -111,24 +164,129 @@ class Statusgrund extends VileSci_Controller
$data = array(
"aktiv" => $aktiv,
"bezeichnung_mehrsprachig" => $bezeichnung_mehrsprachig,
"beschreibung" => $beschreibung,
"status_kurzbz" => $status_kurzbz
"beschreibung" => $beschreibung
);
if (is_numeric($statusgrund_kurzbz))
{
$statusgrund = $this->StatusgrundModel->update($statusgrund_kurzbz, $data);
}
else
{
$statusgrund = $this->StatusgrundModel->insert($data);
}
$statusgrund = $this->StatusgrundModel->update($statusgrund_kurzbz, $data);
if ($statusgrund->error)
{
show_error($tatusgrund->retval);
show_error($statusgrund->retval);
}
redirect("/crm/Statusgrund/editGrund/" . $status_kurzbz);
redirect("/crm/Statusgrund/editGrund/" . $statusgrund_kurzbz . "/" . true);
}
public function insGrund()
{
$aktiv = $this->input->post("aktiv") != null && $this->input->post("aktiv") == "on" ? true : false;
$bezeichnung_mehrsprachig = $this->input->post("bezeichnung_mehrsprachig");
$beschreibung = $this->input->post("beschreibung");
$status_kurzbz = $this->input->post("status_kurzbz");
for ($i = 0; $i < count($bezeichnung_mehrsprachig); $i++)
{
if ($i == 0) $tmp = "{";
if (trim($bezeichnung_mehrsprachig[$i]) == "")
{
$bezeichnung_mehrsprachig[$i] = "\"\"";
}
$bezeichnung_mehrsprachig[$i] = str_replace(",", "|", $bezeichnung_mehrsprachig[$i]);
if ($i < count($bezeichnung_mehrsprachig) - 1)
{
$tmp .= $bezeichnung_mehrsprachig[$i] . ",";
}
else
{
$tmp .= $bezeichnung_mehrsprachig[$i];
}
if ($i == count($bezeichnung_mehrsprachig) - 1) $bezeichnung_mehrsprachig = $tmp . "}";
}
for ($i = 0; $i < count($beschreibung); $i++)
{
if ($i == 0) $tmp = "{";
if (trim($beschreibung[$i]) == "")
{
$beschreibung[$i] = "\"\"";
}
$beschreibung[$i] = str_replace(",", "|", $beschreibung[$i]);
if ($i < count($beschreibung) - 1)
{
$tmp .= $beschreibung[$i] . ",";
}
else
{
$tmp .= $beschreibung[$i];
}
if ($i == count($beschreibung) - 1) $beschreibung = $tmp . "}";
}
$data = array(
"status_kurzbz" => $status_kurzbz,
"aktiv" => $aktiv,
"bezeichnung_mehrsprachig" => $bezeichnung_mehrsprachig,
"beschreibung" => $beschreibung
);
$statusgrund = $this->StatusgrundModel->insert($data);
if ($statusgrund->error)
{
show_error($statusgrund->retval);
}
redirect("/crm/Statusgrund/editGrund/" . $statusgrund->retval . "/" . true);
}
public function saveStatus()
{
$status_kurzbz = $this->input->post("status_kurzbz");
$anmerkung = $this->input->post("anmerkung");
$bezeichnung_mehrsprachig = $this->input->post("bezeichnung_mehrsprachig");
$beschreibung = $this->input->post("beschreibung");
for ($i = 0; $i < count($bezeichnung_mehrsprachig); $i++)
{
if ($i == 0) $tmp = "{";
if (trim($bezeichnung_mehrsprachig[$i]) == "")
{
$bezeichnung_mehrsprachig[$i] = "\"\"";
}
$bezeichnung_mehrsprachig[$i] = str_replace(",", "|", $bezeichnung_mehrsprachig[$i]);
if ($i < count($bezeichnung_mehrsprachig) - 1)
{
$tmp .= $bezeichnung_mehrsprachig[$i] . ",";
}
else
{
$tmp .= $bezeichnung_mehrsprachig[$i];
}
if ($i == count($bezeichnung_mehrsprachig) - 1) $bezeichnung_mehrsprachig = $tmp . "}";
}
$data = array(
"anmerkung" => $anmerkung,
"bezeichnung_mehrsprachig" => $bezeichnung_mehrsprachig,
"beschreibung" => $beschreibung
);
$status = $this->StatusModel->update($status_kurzbz, $data);
if ($status->error)
{
show_error($status->retval);
}
redirect("/crm/Statusgrund/editStatus/" . $status_kurzbz . "/" . true);
}
}
+99
View File
@@ -0,0 +1,99 @@
<?php
$this->load->view('templates/header', array('title' => 'StatusEdit'));
$s = $status;
?>
<div class="row">
<div class="span4">
<h2>Status: <?php echo $s->status_kurzbz; ?></h2>
<form method="post" action="../saveStatus">
<table>
<tr>
<td colspan="2">
beschreibung:<br/><br/>
<input type="text" name="beschreibung" value="<?php echo $s->beschreibung; ?>" /><br/>
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
Anmerkung:<br/><br/>
<textarea name="anmerkung"><?php echo $s->anmerkung; ?></textarea><br/>
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
Bezeichnung mehrsprachig:<br/><br/>
<?php
if (isset($s->bezeichnung_mehrsprachig))
{
$val = str_replace("{", "", $s->bezeichnung_mehrsprachig);
$val = str_replace("}", "", $val);
$val = str_replace("\"", "", $val);
$val = explode(",", $val);
}
else
{
$val = array();
}
$i = 0;
?>
<?php foreach ($sprache as $sp): ?>
<?php echo $sp->sprache; ?>:<br/>
<?php
if (!isset($val[$i]))
{
$val[$i] = "";
}
else
{
$val = str_replace("|", ",", $val);
}
?>
<input type="text" name="bezeichnung_mehrsprachig[]" value="<?php echo $val[$i++]; ?>" /><br/>
<?php endforeach ?>
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td colspan="2" align="center">
<button type="submit">Save</button>
</td>
</tr>
</table>
<input type="hidden" name="status_kurzbz" value="<?php echo $s->status_kurzbz; ?>" />
</form>
</div>
</div>
</body>
<?php
if (!is_null($update))
{
?>
<script>
parent.document.getElementById("StatusgrundLeft").contentWindow.location.reload(true);
</script>
<?php
}
?>
</html>
+36
View File
@@ -0,0 +1,36 @@
<?php
$this->load->view('templates/header', array('title' => 'StatusgrundList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '4:{sorter:false}'));
?>
<div class="row">
<div class="span4">
<a href="../newGrund/<?php echo $status_kurzbz; ?>" target="StatusgrundBottom">+ Neu Grund</a>
</div>
</div>
<div class="row">
<div class="span4">
<table id="t1" class="tablesorter">
<thead>
<tr>
<th class='table-sortable:default'>ID</th>
<th>Aktiv</th>
<th>Bezeichnung mehrsprachig</th>
<th>Beschreibung</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($statusGrund as $s): ?>
<tr>
<td><a href="../editGrund/<?php echo $s->statusgrund_kurzbz; ?>" target="StatusgrundBottom"><?php echo $s->status_kurzbz; ?></a></td>
<td><?php echo $s->aktiv; ?></td>
<td><?php echo $s->bezeichnung_mehrsprachig; ?></td>
<td><?php echo $s->beschreibung; ?></td>
<td><a href="../editGrund/<?php echo $s->statusgrund_kurzbz; ?>" target="StatusgrundBottom">Edit</a></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
</div>
</body>
</html>
@@ -11,20 +11,24 @@
<th class='table-sortable:default'>Status</th>
<th>beschreibung</th>
<th>anmerkung</th>
<th>ext_id</th>
<th>bezeichnung_mehrsprachig</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($status as $s): ?>
<tr>
<td><a href="editGrund/<?php echo $s->status_kurzbz; ?>" target="StatusgrundBottom"><?php echo $s->status_kurzbz; ?></a></td>
<td>
<a href="listGrund/<?php echo $s->status_kurzbz; ?>" target="StatusgrundTop" onClick="parent.document.getElementById('StatusgrundBottom').src=''">
<?php echo $s->status_kurzbz; ?>
</a>
</td>
<td><?php echo $s->beschreibung; ?></td>
<td><?php echo $s->anmerkung; ?></td>
<td><?php echo $s->ext_id; ?></td>
<td><?php echo $s->bezeichnung_mehrsprachig; ?></td>
<td><a href="editGrund/<?php echo $s->status_kurzbz; ?>" target="StatusgrundBottom">Edit</a></td>
<td>
<a href="editStatus/<?php echo $s->status_kurzbz; ?>" target="StatusgrundBottom" onClick="parent.document.getElementById('StatusgrundTop').src=''">
Edit
</a>
</td>
</tr>
<?php endforeach ?>
</tbody>
+16 -3
View File
@@ -6,14 +6,27 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<frameset rows="40%,*">
<frame src="Statusgrund/listStatus" id="StatusgrundTop" name="StatusgrundTop" frameborder="0" />
<frame src="" id="StatusgrundBottom" name="StatusgrundBottom" frameborder="0" />
<frameset cols="30%, *">
<frame src="Statusgrund/listStatus" id="StatusgrundLeft" name="StatusgrundLeft" frameborder="1" />
<noframes>
<body bgcolor="#FFFFFF">
This application works only with a frames-enabled browser.<br />
</body>
</noframes>
<frameset rows="30%, *">
<frame src="" id="StatusgrundTop" name="StatusgrundTop" frameborder="1" />
<noframes>
<body bgcolor="#FFFFFF">
This application works only with a frames-enabled browser.<br />
</body>
</noframes>
<frame src="" id="StatusgrundBottom" name="StatusgrundBottom" frameborder="1" />
<noframes>
<body bgcolor="#FFFFFF">
This application works only with a frames-enabled browser.<br />
</body>
</noframes>
</frameset>
</frameset>
</html>
+14 -3
View File
@@ -6,8 +6,8 @@
<div class="row">
<div class="span4">
<h2>Status: <?php echo $sg->status_kurzbz; ?></h2>
<form method="post" action="../saveGrund">
<h2>Status grund: <?php echo $sg->status_kurzbz; ?></h2>
<form method="post" action="<?php echo APP_ROOT . "index.ci.php/crm/Statusgrund/saveGrund";?>">
<table>
<tr>
<td colspan="2">
@@ -112,9 +112,20 @@
</tr>
</table>
<input type="hidden" name="statusgrund_kurzbz" value="<?php echo isset($sg->statusgrund_kurzbz) ? $sg->statusgrund_kurzbz : ""; ?>" />
<input type="hidden" name="status_kurzbz" value="<?php echo $sg->status_kurzbz; ?>" />
</form>
</div>
</div>
</body>
<?php
if (!is_null($update))
{
?>
<script>
parent.document.getElementById("StatusgrundTop").contentWindow.location.reload(true);
</script>
<?php
}
?>
</html>
+66
View File
@@ -0,0 +1,66 @@
<?php
$this->load->view('templates/header', array('title' => 'StatusgrundNew'));
?>
<div class="row">
<div class="span4">
<h2>New status grund</h2>
<form method="post" action="<?php echo APP_ROOT . "index.ci.php/crm/Statusgrund/insGrund";?>">
<table>
<tr>
<td colspan="2">
Bezeichnung mehrsprachig:<br/><br/>
<?php foreach ($sprache as $s): ?>
<?php echo $s->sprache; ?>:<br/>
<input type="text" name="bezeichnung_mehrsprachig[]" value="" /><br/>
<?php endforeach ?>
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
Beschreibung:<br/><br/>
<?php foreach ($sprache as $s): ?>
<?php echo $s->sprache; ?>:<br/>
<textarea name="beschreibung[]"></textarea><br/>
<?php endforeach ?>
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td>
Aktiv:
</td>
<td>
<input type="checkbox" name="aktiv" />
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td colspan="2" align="center">
<button type="submit">Save</button>
</td>
</tr>
</table>
<input type="hidden" name="status_kurzbz" value="<?php echo $status_kurzbz; ?>" />
</form>
</div>
</div>
</body>
</html>