mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
- Added new migration script 018_status_grund.php
- Added new permission "public.tbl_status_grund" in fhcomplete.php - Manage statusgrund from vilesci
This commit is contained in:
@@ -181,6 +181,7 @@ $config['fhc_acl'] = array
|
||||
'public.tbl_standort' => 'basis/standort',
|
||||
'public.tbl_statistik' => 'basis/statistik',
|
||||
'public.tbl_status' => 'basis/status',
|
||||
'public.tbl_status_grund' => 'basis/status',
|
||||
'public.tbl_student' => 'basis/student',
|
||||
'public.tbl_studentlehrverband' => 'basis/studentlehrverband',
|
||||
'public.tbl_studiengang' => 'basis/studiengang',
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
if (! defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Statusgrund extends VileSci_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model("crm/Status_model", "StatusModel");
|
||||
$this->load->model("crm/Statusgrund_model", "StatusgrundModel");
|
||||
$this->load->model("system/Sprache_model", "SpracheModel");
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->view("crm/statusgrund.php");
|
||||
}
|
||||
|
||||
public function listStatus()
|
||||
{
|
||||
$status = $this->StatusModel->load();
|
||||
if ($status->error)
|
||||
{
|
||||
show_error($status->retval);
|
||||
}
|
||||
|
||||
$data = array (
|
||||
"status" => $status->retval
|
||||
);
|
||||
|
||||
$this->load->view("crm/statusgrundList.php", $data);
|
||||
}
|
||||
|
||||
public function editGrund($status_kurzbz)
|
||||
{
|
||||
$statusGrund = $this->StatusgrundModel->loadWhere(array("status_kurzbz" => $status_kurzbz));
|
||||
if ($statusGrund->error)
|
||||
{
|
||||
show_error($statusGrund->retval);
|
||||
}
|
||||
|
||||
if (count($statusGrund->retval) == 0)
|
||||
{
|
||||
$statusGrund->retval[0] = new stdClass();
|
||||
$statusGrund->retval[0]->status_kurzbz = $status_kurzbz;
|
||||
}
|
||||
|
||||
$sprache = $this->SpracheModel->load();
|
||||
if ($sprache->error)
|
||||
{
|
||||
show_error($sprache->retval);
|
||||
}
|
||||
|
||||
$data = array (
|
||||
"statusgrund" => $statusGrund->retval[0],
|
||||
"sprache" => $sprache->retval
|
||||
);
|
||||
|
||||
$this->load->view("crm/statusgrundEdit.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]) != "")
|
||||
{
|
||||
$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] = 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(
|
||||
"aktiv" => $aktiv,
|
||||
"bezeichnung_mehrsprachig" => $bezeichnung_mehrsprachig,
|
||||
"beschreibung" => $beschreibung,
|
||||
"status_kurzbz" => $status_kurzbz
|
||||
);
|
||||
|
||||
if (is_numeric($statusgrund_kurzbz))
|
||||
{
|
||||
$statusgrund = $this->StatusgrundModel->update($statusgrund_kurzbz, $data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$statusgrund = $this->StatusgrundModel->insert($data);
|
||||
}
|
||||
|
||||
if ($statusgrund->error)
|
||||
{
|
||||
show_error($tatusgrund->retval);
|
||||
}
|
||||
|
||||
redirect("/crm/Statusgrund/editGrund/" . $status_kurzbz);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
if (! defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
require_once APPPATH . "/libraries/MigrationLib.php";
|
||||
|
||||
class Migration_Status_grund extends MigrationLib
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function up()
|
||||
{
|
||||
$this->startUP();
|
||||
|
||||
$fields = array(
|
||||
"statusgrund_kurzbz" => array(
|
||||
"type" => "integer",
|
||||
"auto_increment" => true
|
||||
),
|
||||
"status_kurzbz" => array(
|
||||
"type" => "varchar(20)"
|
||||
),
|
||||
"aktiv" => array(
|
||||
"type" => "boolean DEFAULT FALSE",
|
||||
"null" => true
|
||||
),
|
||||
"bezeichnung_mehrsprachig" => array(
|
||||
"type" => "varchar(255)[]"
|
||||
),
|
||||
"beschreibung" => array(
|
||||
"type" => "text[]"
|
||||
)
|
||||
);
|
||||
$this->createTable("public", "tbl_status_grund", $fields);
|
||||
$this->addPrimaryKey(
|
||||
"public",
|
||||
"tbl_status_grund",
|
||||
"pk_tbl_status_grund",
|
||||
array("statusgrund_kurzbz")
|
||||
);
|
||||
$this->addForeingKey(
|
||||
"public",
|
||||
"tbl_status_grund",
|
||||
"fk_status_grundstatus_kurzbz",
|
||||
"status_kurzbz",
|
||||
"public",
|
||||
"tbl_status",
|
||||
"status_kurzbz",
|
||||
"ON UPDATE CASCADE ON DELETE RESTRICT"
|
||||
);
|
||||
$this->addUniqueKey(
|
||||
"public",
|
||||
"tbl_status_grund",
|
||||
"uk_tbl_status_grund_status_kurzbz",
|
||||
array("status_kurzbz")
|
||||
);
|
||||
$this->grantTable("SELECT", "public", "tbl_status_grund", "web");
|
||||
$this->grantTable(array("SELECT", "INSERT", "DELETE", "UPDATE"), "public", "tbl_status_grund", "admin");
|
||||
$this->grantTable(array("SELECT", "INSERT", "DELETE", "UPDATE"), "public", "tbl_status_grund", "vilesci");
|
||||
|
||||
$this->endUP();
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->startDown();
|
||||
|
||||
$this->dropTable("public", "tbl_status_grund");
|
||||
|
||||
$this->endDown();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
class Statusgrund_model extends DB_Model
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = "public.tbl_status_grund";
|
||||
$this->pk = "statusgrund_kurzbz";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
|
||||
<html lang="de_AT">
|
||||
|
||||
<head>
|
||||
<title>VileSci - Statusgrund</title>
|
||||
<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" />
|
||||
<noframes>
|
||||
<body bgcolor="#FFFFFF">
|
||||
This application works only with a frames-enabled browser.<br />
|
||||
</body>
|
||||
</noframes>
|
||||
</frameset>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
$this->load->view('templates/header', array('title' => 'StatusgrundEdit'));
|
||||
|
||||
$sg = $statusgrund;
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="span4">
|
||||
<h2>Status: <?php echo $sg->status_kurzbz; ?></h2>
|
||||
<form method="post" action="../saveGrund">
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Bezeichnung mehrsprachig:<br/><br/>
|
||||
|
||||
<?php
|
||||
if (isset($sg->bezeichnung_mehrsprachig))
|
||||
{
|
||||
$val = str_replace("{", "", $sg->bezeichnung_mehrsprachig);
|
||||
$val = str_replace("}", "", $val);
|
||||
$val = str_replace("\"", "", $val);
|
||||
$val = explode(",", $val);
|
||||
}
|
||||
else
|
||||
{
|
||||
$val = array();
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
?>
|
||||
|
||||
<?php foreach ($sprache as $s): ?>
|
||||
<?php echo $s->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">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Beschreibung:<br/><br/>
|
||||
|
||||
<?php
|
||||
if (isset($sg->beschreibung))
|
||||
{
|
||||
$val = str_replace("{", "", $sg->beschreibung);
|
||||
$val = str_replace("}", "", $val);
|
||||
$val = str_replace("\"", "", $val);
|
||||
$val = explode(",", $val);
|
||||
}
|
||||
else
|
||||
{
|
||||
$val = array();
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
?>
|
||||
|
||||
<?php foreach ($sprache as $s): ?>
|
||||
<?php echo $s->sprache; ?>:<br/>
|
||||
<?php
|
||||
if (!isset($val[$i]))
|
||||
{
|
||||
$val[$i] = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
$val = str_replace("|", ",", $val);
|
||||
}
|
||||
?>
|
||||
<textarea name="beschreibung[]"><?php echo $val[$i++]; ?></textarea><br/>
|
||||
<?php endforeach ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Aktiv:
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="aktiv" <?php echo isset($sg->aktiv) && $sg->aktiv == "t" ? "checked" : ""; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="center">
|
||||
<button type="submit">Save</button>
|
||||
</td>
|
||||
</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>
|
||||
</html>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
$this->load->view('templates/header', array('title' => 'StatusgrundList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '3:{sorter:false}'));
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="span4">
|
||||
<h2>Status</h2>
|
||||
<table id="t1" class="tablesorter">
|
||||
<thead>
|
||||
<tr>
|
||||
<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><?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>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user