diff --git a/application/controllers/crm/Statusgrund.php b/application/controllers/crm/Statusgrund.php index 2626909e2..dcec272fa 100644 --- a/application/controllers/crm/Statusgrund.php +++ b/application/controllers/crm/Statusgrund.php @@ -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); } } diff --git a/application/views/crm/statusEdit.php b/application/views/crm/statusEdit.php new file mode 100644 index 000000000..15ed2ed9f --- /dev/null +++ b/application/views/crm/statusEdit.php @@ -0,0 +1,99 @@ +load->view('templates/header', array('title' => 'StatusEdit')); + + $s = $status; +?> + +
+
+

Status: status_kurzbz; ?>

+
+ + + + + + + + + + + + + + + + + + + + + + +
+ beschreibung:

+
+
+   +
+ Anmerkung:

+
+
+   +
+ Bezeichnung mehrsprachig:

+ + bezeichnung_mehrsprachig)) + { + $val = str_replace("{", "", $s->bezeichnung_mehrsprachig); + $val = str_replace("}", "", $val); + $val = str_replace("\"", "", $val); + $val = explode(",", $val); + } + else + { + $val = array(); + } + + $i = 0; + ?> + + + sprache; ?>:
+ +
+ + +
+   +
+ +
+ +
+
+
+ + + + + + + diff --git a/application/views/crm/statusGrundList.php b/application/views/crm/statusGrundList.php new file mode 100644 index 000000000..00be76b2f --- /dev/null +++ b/application/views/crm/statusGrundList.php @@ -0,0 +1,36 @@ +load->view('templates/header', array('title' => 'StatusgrundList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '4:{sorter:false}')); +?> +
+
+ + Neu Grund +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
IDAktivBezeichnung mehrsprachigBeschreibung
status_kurzbz; ?>aktiv; ?>bezeichnung_mehrsprachig; ?>beschreibung; ?>Edit
+
+
+ + diff --git a/application/views/crm/statusgrundList.php b/application/views/crm/statusList.php similarity index 60% rename from application/views/crm/statusgrundList.php rename to application/views/crm/statusList.php index f3d646c25..9032bac73 100644 --- a/application/views/crm/statusgrundList.php +++ b/application/views/crm/statusList.php @@ -11,20 +11,24 @@ Status beschreibung anmerkung - ext_id - bezeichnung_mehrsprachig - status_kurzbz; ?> + + + status_kurzbz; ?> + + beschreibung; ?> anmerkung; ?> - ext_id; ?> - bezeichnung_mehrsprachig; ?> - Edit + + + Edit + + diff --git a/application/views/crm/statusgrund.php b/application/views/crm/statusgrund.php index e0eee2ad0..e79fa5d05 100644 --- a/application/views/crm/statusgrund.php +++ b/application/views/crm/statusgrund.php @@ -6,14 +6,27 @@ - - - + + <body bgcolor="#FFFFFF"> This application works only with a frames-enabled browser.<br /> </body> + + + + <body bgcolor="#FFFFFF"> + This application works only with a frames-enabled browser.<br /> + </body> + + + + <body bgcolor="#FFFFFF"> + This application works only with a frames-enabled browser.<br /> + </body> + + diff --git a/application/views/crm/statusgrundEdit.php b/application/views/crm/statusgrundEdit.php index fc3ab2f03..81ac84a32 100644 --- a/application/views/crm/statusgrundEdit.php +++ b/application/views/crm/statusgrundEdit.php @@ -6,8 +6,8 @@
-

Status: status_kurzbz; ?>

-
+

Status grund: status_kurzbz; ?>

+ ">
@@ -112,9 +112,20 @@
" /> -
+ + + + + diff --git a/application/views/crm/statusgrundNew.php b/application/views/crm/statusgrundNew.php new file mode 100644 index 000000000..76a433474 --- /dev/null +++ b/application/views/crm/statusgrundNew.php @@ -0,0 +1,66 @@ +load->view('templates/header', array('title' => 'StatusgrundNew')); +?> + +
+
+

New status grund

+
"> + + + + + + + + + + + + + + + + + + + + + + + +
+ Bezeichnung mehrsprachig:

+ + + sprache; ?>:
+
+ + +
+   +
+ Beschreibung:

+ + + sprache; ?>:
+
+ +
+   +
+ Aktiv: + + +
+   +
+ +
+ +
+
+
+ + +