Skip to content
Permalink
Browse files

Ersteller hinzugefügt

  • Loading branch information
kveldscholten committed Oct 31, 2019
1 parent 5a9acc3 commit f4cbe98d1b08f316d662be7c98f7297f21664636
@@ -10,7 +10,7 @@ class Config extends \Ilch\Config\Install
{
public $config = [
'key' => 'kvticket',
'version' => '1.2.0',
'version' => '1.3.0',
'icon_small' => 'fa-ticket',
'author' => 'Veldscholten, Kevin',
'languages' => [
@@ -47,6 +47,7 @@ public function getInstallSql()
`datetime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`status` INT(11) NOT NULL DEFAULT 0,
`editor` INT(11) NOT NULL DEFAULT 0,
`creator` INT(11) NOT NULL DEFAULT 0,
`cat` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1;
@@ -75,7 +76,10 @@ public function getUpdate($installedVersion)
`title` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1;');
case "1.2":
case "1.3":
// Add ticket creator
$this->db()->query('ALTER TABLE `[prefix]_kvticket` ADD `creator` INT(11) NOT NULL DEFAULT 0 AFTER `editor`;');
}
}
}
@@ -28,7 +28,7 @@ public function indexAction()
$this->getLayout()->getHmenu()
->add($this->getTranslator()->trans('menuTickets'), ['action' => 'index']);
$columns = array('datetime', 'title', 'editor', 'status', 'cat');
$columns = array('datetime', 'title', 'creator', 'editor', 'status', 'cat');
$column = $this->getRequest()->getParam('column') && in_array($this->getRequest()->getParam('column'), $columns) ? $this->getRequest()->getParam('column') : $columns[0];
$sort_order = $this->getRequest()->getParam('order') && strtolower($this->getRequest()->getParam('order')) == 'asc' ? 'ASC' : 'DESC';
@@ -100,6 +100,9 @@ public function newAction()
$ticketModel->setTitle($this->getRequest()->getPost('title'))
->setText($this->getRequest()->getPost('text'))
->setCat($this->getRequest()->getPost('cat'));
if ($this->getUser()) {
$ticketModel->setCreator($this->getUser()->getId());
}
$ticketMapper->save($ticketModel);
$this->redirect()
@@ -108,6 +108,8 @@ public function treatAction()
$ticketModel = new TicketModel();
if ($this->getRequest()->getParam('id')) {
$ticketModel->setId($this->getRequest()->getParam('id'));
} else {
$ticketModel->setCreator($this->getUser()->getId());
}
$ticketModel->setTitle($this->getRequest()->getPost('title'))
->setText($this->getRequest()->getPost('text'))
@@ -39,6 +39,7 @@ public function getTickets($where = [], $order = ['datetime' => 'DESC'])
->setDatetime($entries['datetime'])
->setStatus($entries['status'])
->setEditor($entries['editor'])
->setCreator($entries['creator'])
->setCat($entries['cat']);
$tickets[] = $entryModel;
}
@@ -71,6 +72,7 @@ public function save(TicketModel $ticket)
'text' => $ticket->getText(),
'status' => $ticket->getStatus(),
'editor' => $ticket->getEditor(),
'creator' => $ticket->getCreator(),
'cat' => $ticket->getCat()
];
@@ -50,6 +50,13 @@ class Ticket extends \Ilch\Model
*/
protected $editor;
/**
* The Creator.
*
* @var int
*/
protected $creator;
/**
* The Category.
*
@@ -185,6 +192,29 @@ public function setEditor($editor)
return $this;
}
/**
* Gets the Creator.
*
* @return int
*/
public function getCreator()
{
return $this->creator;
}
/**
* Sets the Creator.
*
* @param int $editor
* @return $this
*/
public function setCreator($creator)
{
$this->creator = (int)$creator;
return $this;
}
/**
* Gets the Category.
*
@@ -11,6 +11,7 @@
'entry' => 'Eintragen',
'status' => 'Status',
'editor' => 'Bearbeiter',
'creator' => 'Ersteller',
'datetime' => 'Datum / Uhrzeit',
'title' => 'Titel',
'cat' => 'Kategorie',
@@ -26,4 +27,5 @@
'show' => 'Anzeigen',
'back' => 'Zurück',
'search' => 'Suche',
'noSelection' => 'Keine Auswahl',
];
@@ -11,6 +11,7 @@
'entry' => 'Entry',
'status' => 'Status',
'editor' => 'Editor',
'creator' => 'Creator',
'datetime' => 'Date / Time',
'title' => 'Title',
'cat' => 'Category',
@@ -26,4 +27,5 @@
'show' => 'Show',
'back' => 'Back',
'search' => 'Search',
'noSelection' => 'No selection',
];
@@ -17,6 +17,7 @@
<col class="col-lg-1" />
<col class="col-lg-1" />
<col class="col-lg-1" />
<col class="col-lg-1" />
</colgroup>
<thead>
<tr>
@@ -25,13 +26,15 @@
<th></th>
<th><?=$this->getTrans('menuTickets') ?></th>
<th><?=$this->getTrans('cat') ?></th>
<th><?=$this->getTrans('creator') ?></th>
<th><?=$this->getTrans('editor') ?></th>
<th><?=$this->getTrans('datetime') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->get('openTickets') as $ticket): ?>
<?php $user = $userMapper->getUserById($ticket->getEditor()); ?>
<?php $creator = $userMapper->getUserById($ticket->getCreator()); ?>
<?php $editor = $userMapper->getUserById($ticket->getEditor()); ?>
<?php $datetime = new \Ilch\Date($ticket->getDatetime()); ?>
<?php $cat = $catMapper->getCategoryById($ticket->getCat()); ?>
<tr>
@@ -40,7 +43,8 @@
<td><?=$this->getDeleteIcon(['action' => 'del', 'id' => $ticket->getId()]) ?></td>
<td><?=$this->escape($ticket->getTitle()) ?></td>
<td><?=($cat) ? $cat->getTitle() : '' ?></td>
<td><?=($user) ? $user->getName() : '' ?></td>
<td><?=($creator) ? $creator->getName() : '' ?></td>
<td><?=($editor) ? $editor->getName() : '' ?></td>
<td><?=$datetime->format('d.m.Y H:i') ?></td>
</tr>
<?php endforeach; ?>
@@ -61,6 +65,7 @@
<col class="col-lg-1" />
<col class="col-lg-1" />
<col class="col-lg-1" />
<col class="col-lg-1" />
</colgroup>
<thead>
<tr>
@@ -69,13 +74,15 @@
<th></th>
<th><?=$this->getTrans('menuTickets') ?></th>
<th><?=$this->getTrans('cat') ?></th>
<th><?=$this->getTrans('creator') ?></th>
<th><?=$this->getTrans('editor') ?></th>
<th><?=$this->getTrans('datetime') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->get('editTickets') as $ticket): ?>
<?php $user = $userMapper->getUserById($ticket->getEditor()); ?>
<?php $creator = $userMapper->getUserById($ticket->getCreator()); ?>
<?php $editor = $userMapper->getUserById($ticket->getEditor()); ?>
<?php $datetime = new \Ilch\Date($ticket->getDatetime()); ?>
<?php $cat = $catMapper->getCategoryById($ticket->getCat()); ?>
<tr>
@@ -84,7 +91,8 @@
<td><?=$this->getDeleteIcon(['action' => 'del', 'id' => $ticket->getId()]) ?></td>
<td><?=$this->escape($ticket->getTitle()) ?></td>
<td><?=($cat) ? $cat->getTitle() : '' ?></td>
<td><?=($user) ? $user->getName() : '' ?></td>
<td><?=($creator) ? $creator->getName() : '' ?></td>
<td><?=($editor) ? $editor->getName() : '' ?></td>
<td><?=$datetime->format('d.m.Y H:i') ?></td>
</tr>
<?php endforeach; ?>
@@ -105,6 +113,7 @@
<col class="col-lg-1" />
<col class="col-lg-1" />
<col class="col-lg-1" />
<col class="col-lg-1" />
</colgroup>
<thead>
<tr>
@@ -113,13 +122,15 @@
<th></th>
<th><?=$this->getTrans('menuTickets') ?></th>
<th><?=$this->getTrans('cat') ?></th>
<th><?=$this->getTrans('creator') ?></th>
<th><?=$this->getTrans('editor') ?></th>
<th><?=$this->getTrans('datetime') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->get('compTickets') as $ticket): ?>
<?php $user = $userMapper->getUserById($ticket->getEditor()); ?>
<?php $creator = $userMapper->getUserById($ticket->getCreator()); ?>
<?php $editor = $userMapper->getUserById($ticket->getEditor()); ?>
<?php $datetime = new \Ilch\Date($ticket->getDatetime()); ?>
<?php $cat = $catMapper->getCategoryById($ticket->getCat()); ?>
<tr>
@@ -128,7 +139,8 @@
<td><?=$this->getDeleteIcon(['action' => 'del', 'id' => $ticket->getId()]) ?></td>
<td><?=$this->escape($ticket->getTitle()) ?></td>
<td><?=($cat) ? $cat->getTitle() : '' ?></td>
<td><?=($user) ? $user->getName() : '' ?></td>
<td><?=($creator) ? $creator->getName() : '' ?></td>
<td><?=($editor) ? $editor->getName() : '' ?></td>
<td><?=$datetime->format('d.m.Y H:i') ?></td>
</tr>
<?php endforeach; ?>
@@ -148,28 +160,32 @@
<col class="col-lg-1" />
<col class="col-lg-1" />
<col class="col-lg-1" />
<col class="col-lg-1" />
</colgroup>
<thead>
<tr>
<th><?=$this->getCheckAllCheckbox('check_tickets') ?></th>
<th></th>
<th><?=$this->getTrans('menuTickets') ?></th>
<th><?=$this->getTrans('cat') ?></th>
<th><?=$this->getTrans('creator') ?></th>
<th><?=$this->getTrans('editor') ?></th>
<th><?=$this->getTrans('datetime') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->get('closeTickets') as $ticket): ?>
<?php $user = $userMapper->getUserById($ticket->getEditor()); ?>
<?php $creator = $userMapper->getUserById($ticket->getCreator()); ?>
<?php $editor = $userMapper->getUserById($ticket->getEditor()); ?>
<?php $datetime = new \Ilch\Date($ticket->getDatetime()); ?>
<?php $cat = $catMapper->getCategoryById($ticket->getCat()); ?>
<tr>
<td><?=$this->getDeleteCheckbox('check_tickets', $ticket->getId()) ?></td>
<td><?=$this->getDeleteIcon(['action' => 'del', 'id' => $ticket->getId()]) ?></td>
<td><?=$this->escape($ticket->getTitle()) ?></td>
<td><?=($cat) ? $cat->getTitle() : '' ?></td>
<td><?=($user) ? $user->getName() : '' ?></td>
<td><?=($creator) ? $creator->getName() : '' ?></td>
<td><?=($editor) ? $editor->getName() : '' ?></td>
<td><?=$datetime->format('d.m.Y H:i') ?></td>
</tr>
<?php endforeach; ?>
@@ -20,7 +20,7 @@
</label>
<div class="col-lg-4">
<select class="form-control" id="cat" name="cat">
<option value="0" <?=(!$this->get('ticket')) ? 'selected' : '' ?>></option>
<option value="0" <?=(!$this->get('ticket')) ? 'selected' : '' ?>><?=$this->getTrans('noSelection') ?></option>
<?php foreach ($this->get('cats') as $cat): ?>
<option value="<?=$cat->getId() ?>" <?=($this->get('ticket') && $this->get('ticket')->getCat() == $cat->getId()) ? 'selected' : '' ?>><?=$cat->getTitle() ?></option>
<?php endforeach; ?>
@@ -58,7 +58,7 @@ class="form-control"
</label>
<div class="col-lg-4">
<select class="chosen-select form-control" id="editor" name="editor" data-placeholder="<?=$this->getTrans('selectuser') ?>">
<option value="0" <?=(!$this->get('ticket')) ? 'selected' : '' ?>></option>
<option value="0" <?=(!$this->get('ticket')) ? 'selected' : '' ?>><?=$this->getTrans('noSelection') ?></option>
<?php foreach ($this->get('users') as $user): ?>
<?php if ($user->hasAccess('module_kvticket',true) != ''): ?>
<option value="<?=$user->getId() ?>" <?=(($this->get('ticket') && $this->get('ticket')->getEditor() == $user->getId()) || ((!$this->get('ticket') || $this->get('ticket')->getEditor() == 0) && $user->getId() == $this->getUser()->getId())) ? 'selected' : '' ?>><?=$this->escape($user->getName()) ?></option>
@@ -19,20 +19,23 @@
<col class="col-lg-2" />
<col class="col-lg-2" />
<col class="col-lg-2" />
<col class="col-lg-2" />
</colgroup>
<thead>
<tr>
<th><a href="<?=$this->getUrl(['column' => 'title', 'order' => $this->get('sort_order') == 'ASC' ? 'desc' : 'asc']) ?>" title="<?=$this->getTrans('title') ?>"><?=$this->getTrans('title') ?><i class="fa fa-sort<?php echo $this->get('sort_column') == 'title' ? '-' . str_replace(array('ASC','DESC'), array('up','down'), $this->get('sort_order')) : ''; ?>"></i></a></th>
<th><a href="<?=$this->getUrl(['column' => 'cat', 'order' => $this->get('sort_order') == 'ASC' ? 'desc' : 'asc']) ?>" title="<?=$this->getTrans('cat') ?>"><?=$this->getTrans('cat') ?><i class="fa fa-sort<?php echo $this->get('sort_column') == 'cat' ? '-' . str_replace(array('ASC','DESC'), array('up','down'), $this->get('sort_order')) : ''; ?>"></i></a></th>
<th><a href="<?=$this->getUrl(['column' => 'datetime', 'order' => $this->get('sort_order') == 'ASC' ? 'desc' : 'asc']) ?>" title="<?=$this->getTrans('datetime') ?>"><?=$this->getTrans('datetime') ?><i class="fa fa-sort<?php echo $this->get('sort_column') == 'datetime' ? '-' . str_replace(array('ASC','DESC'), array('up','down'), $this->get('sort_order')) : ''; ?>"></i></a></th>
<th><a href="<?=$this->getUrl(['column' => 'creator', 'order' => $this->get('sort_order') == 'ASC' ? 'desc' : 'asc']) ?>" title="<?=$this->getTrans('creator') ?>"><?=$this->getTrans('creator') ?><i class="fa fa-sort<?php echo $this->get('sort_column') == 'creator' ? '-' . str_replace(array('ASC','DESC'), array('up','down'), $this->get('sort_order')) : ''; ?>"></i></a></th>
<th><a href="<?=$this->getUrl(['column' => 'editor', 'order' => $this->get('sort_order') == 'ASC' ? 'desc' : 'asc']) ?>" title="<?=$this->getTrans('editor') ?>"><?=$this->getTrans('editor') ?><i class="fa fa-sort<?php echo $this->get('sort_column') == 'editor' ? '-' . str_replace(array('ASC','DESC'), array('up','down'), $this->get('sort_order')) : ''; ?>"></i></a></th>
<th><a href="<?=$this->getUrl(['column' => 'status', 'order' => $this->get('sort_order') == 'ASC' ? 'desc' : 'asc']) ?>" title="<?=$this->getTrans('status') ?>"><?=$this->getTrans('status') ?><i class="fa fa-sort<?php echo $this->get('sort_column') == 'status' ? '-' . str_replace(array('ASC','DESC'), array('up','down'), $this->get('sort_order')) : ''; ?>"></i></a></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->get('tickets') as $ticket): ?>
<?php
$user = $userMapper->getUserById($ticket->getEditor());
<?php
$creator = $userMapper->getUserById($ticket->getCreator());
$editor = $userMapper->getUserById($ticket->getEditor());
$datetime = new \Ilch\Date($ticket->getDatetime());
$cat = $catMapper->getCategoryById($ticket->getCat());
@@ -56,9 +59,10 @@
<?=$this->escape($ticket->getTitle()) ?>
</a>
</td>
<td <?=($this->get('sort_column') == 'datetime'?'class="table-active"':'') ?>><?=($cat ? $cat->getTitle() : '') ?></td>
<td <?=($this->get('sort_column') == 'cat'?'class="table-active"':'') ?>><?=($cat ? $cat->getTitle() : '') ?></td>
<td <?=($this->get('sort_column') == 'datetime'?'class="table-active"':'') ?>><?=$datetime->format('d.m.Y H:i') ?></td>
<td <?=($this->get('sort_column') == 'editor'?'class="table-active"':'') ?>><?=($user) ? $user->getName() : '' ?></td>
<td <?=($this->get('sort_column') == 'creator'?'class="table-active"':'') ?>><?=($creator) ? $creator->getName() : '' ?></td>
<td <?=($this->get('sort_column') == 'editor'?'class="table-active"':'') ?>><?=($editor) ? $editor->getName() : '' ?></td>
<td <?=($this->get('sort_column') == 'status'?'class="table-active"':'') ?>><?=$ticketStatus ?></td>
</tr>
<?php endforeach; ?>
@@ -7,7 +7,7 @@
</label>
<div class="col-lg-4">
<select class="form-control" id="cat" name="cat">
<option value="0" selected></option>
<option value="0" selected><?=$this->getTrans('noSelection') ?></option>
<?php foreach ($this->get('cats') as $cat): ?>
<option value="<?=$cat->getId() ?>"><?=$cat->getTitle() ?></option>
<?php endforeach; ?>

0 comments on commit f4cbe98

Please sign in to comment.
You can’t perform that action at this time.