mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
- Tags testversion
- header tooltips - lehre spalte markieren wenn altes semester - legende-tab hinzugefuegt
This commit is contained in:
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH'))
|
||||
exit('No direct script access allowed');
|
||||
|
||||
class Tag_Controller extends FHCAPI_Controller
|
||||
{
|
||||
private $_uid;
|
||||
|
||||
const BERECHTIGUNG_KURZBZ = 'admin:rw';
|
||||
|
||||
public function __construct($permissions)
|
||||
{
|
||||
$default_permissions = [
|
||||
'getTag' => self::BERECHTIGUNG_KURZBZ,
|
||||
'getTags' => self::BERECHTIGUNG_KURZBZ,
|
||||
'addTag' => self::BERECHTIGUNG_KURZBZ,
|
||||
|
||||
'updateTag' => self::BERECHTIGUNG_KURZBZ,
|
||||
'doneTag' => self::BERECHTIGUNG_KURZBZ,
|
||||
'deleteTag' => self::BERECHTIGUNG_KURZBZ,
|
||||
];
|
||||
|
||||
$merged_permissions = array_merge($default_permissions, $permissions);
|
||||
|
||||
parent::__construct($merged_permissions);
|
||||
|
||||
$this->_setAuthUID();
|
||||
$this->load->model('person/Notiz_model', 'NotizModel');
|
||||
$this->load->model('system/Notiztyp_model', 'NotiztypModel');
|
||||
$this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel');
|
||||
}
|
||||
|
||||
public function getTag()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
|
||||
$this->NotizModel->addSelect(
|
||||
'tbl_notiz.titel,
|
||||
tbl_notiz.text,
|
||||
array_to_json(bezeichnung_mehrsprachig::varchar[])->>0 as bezeichnung,
|
||||
tbl_notiz.notiz_id,
|
||||
tbl_notiz_typ.style,
|
||||
tbl_notiz.erledigt as done,
|
||||
tbl_notiz.insertamum,
|
||||
tbl_notiz.updateamum,
|
||||
tbl_notiz.insertvon,
|
||||
tbl_notiz.updatevon
|
||||
'
|
||||
);
|
||||
$this->NotizModel->addJoin('public.tbl_notiz_typ', 'public.tbl_notiz.typ = public.tbl_notiz_typ.typ_kurzbz');
|
||||
$notiz = $this->NotizModel->loadWhere(array('notiz_id' => $id));
|
||||
|
||||
$this->terminateWithSuccess(hasData($notiz) ? getData($notiz)[0] : array());
|
||||
}
|
||||
|
||||
public function getTags()
|
||||
{
|
||||
$this->NotiztypModel->addSelect(
|
||||
'typ_kurzbz as tag_typ_kurzbz,
|
||||
array_to_json(bezeichnung_mehrsprachig::varchar[])->>0 as bezeichnung,
|
||||
style,
|
||||
beschreibung,
|
||||
tag
|
||||
'
|
||||
);
|
||||
$notiztypen = $this->NotiztypModel->loadWhere(array('aktiv' => true));
|
||||
$this->terminateWithSuccess(hasData($notiztypen) ? getData($notiztypen) : array());
|
||||
}
|
||||
|
||||
public function addTag($withZuordnung = true)
|
||||
{
|
||||
$postData = $this->getPostJson();
|
||||
|
||||
$checkTyp = $this->NotiztypModel->loadWhere(array('typ_kurzbz' => $postData->tag_typ_kurzbz));
|
||||
|
||||
if (!hasData($checkTyp))
|
||||
$this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$return = "";
|
||||
|
||||
if ($withZuordnung)
|
||||
{
|
||||
$checkZuordnungType = $this->NotizzuordnungModel->isValidType($postData->zuordnung_typ);
|
||||
if (!isSuccess($checkZuordnungType))
|
||||
$this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$values = array_unique($postData->values);
|
||||
|
||||
foreach ($values as $value)
|
||||
{
|
||||
$insertResult = $this->addNotiz($postData);
|
||||
|
||||
if (isError($insertResult))
|
||||
$this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$insertZuordnung = $this->NotizzuordnungModel->insert(array(
|
||||
'notiz_id' => $insertResult->retval,
|
||||
$postData->zuordnung_typ => $value
|
||||
));
|
||||
|
||||
if (isError($insertZuordnung))
|
||||
$this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$return[] = [$postData->zuordnung_typ => $value, 'id' => $insertResult->retval];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$insertResult = $this->addNotiz($postData);
|
||||
if (isError($insertResult))
|
||||
$this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$return = $insertResult->retval;
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess($return);
|
||||
}
|
||||
|
||||
private function addNotiz($postData)
|
||||
{
|
||||
return $this->NotizModel->insert(array(
|
||||
'titel' => 'TAG', //TODO klären
|
||||
'text' => $postData->notiz,
|
||||
'verfasser_uid' => $this->_uid,
|
||||
'erledigt' => false,
|
||||
'insertamum' => date('Y-m-d H:i:s'),
|
||||
'insertvon' => $this->_uid,
|
||||
'typ' => $postData->tag_typ_kurzbz
|
||||
));
|
||||
|
||||
}
|
||||
public function updateTag()
|
||||
{
|
||||
$postData = $this->getPostJson();
|
||||
$updateData = $this->NotizModel->update(array('notiz_id' => $postData->id),
|
||||
array('text' => $postData->notiz)
|
||||
);
|
||||
$this->terminateWithSuccess($updateData);
|
||||
}
|
||||
public function doneTag()
|
||||
{
|
||||
$postData = $this->getPostJson();
|
||||
$updateData = $this->NotizModel->update(array('notiz_id' => $postData->id),
|
||||
array('erledigt' => !$postData->done)
|
||||
);
|
||||
|
||||
$this->terminateWithSuccess($updateData);
|
||||
}
|
||||
|
||||
public function deleteTag()
|
||||
{
|
||||
$postData = $this->getPostJson();
|
||||
$deleteZuordnung = $this->NotizzuordnungModel->delete(array(
|
||||
'notiz_id' => $postData->id
|
||||
));
|
||||
|
||||
if (isSuccess($deleteZuordnung))
|
||||
{
|
||||
$deleteNotiz = $this->NotizModel->delete(array(
|
||||
'notiz_id' => $postData->id
|
||||
));
|
||||
}
|
||||
$this->terminateWithSuccess(true);
|
||||
}
|
||||
|
||||
private function _setAuthUID()
|
||||
{
|
||||
$this->_uid = getAuthUID();
|
||||
|
||||
if (!$this->_uid)
|
||||
show_error('User authentification failed');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
class Notiztyp_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_notiz_typ';
|
||||
$this->pk = 'typ_kurzbz';
|
||||
}
|
||||
}
|
||||
@@ -44,3 +44,4 @@
|
||||
$tablewidget = isset($tablewidget) ? $tablewidget : false;
|
||||
$udfs = isset($udfs) ? $udfs : false;
|
||||
$widgets = isset($widgets) ? $widgets : false;
|
||||
$tags = isset($tags) ? $tags : false;
|
||||
|
||||
@@ -118,6 +118,9 @@
|
||||
// CIS
|
||||
if ($cis === true) generateCSSsInclude('public/css/cis_bs5.css');
|
||||
|
||||
//Tags
|
||||
if ($tags === true) generateCSSsInclude('public/css/tags.css');
|
||||
|
||||
// Eventually required CSS
|
||||
generateCSSsInclude($customCSSs); // Eventually required CSS
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
:is(.tag_notice, .tag_inwork, .tag_planning) {
|
||||
display: inline-block;
|
||||
padding: 5px 10px;
|
||||
margin-right: 5px;
|
||||
border-radius: 3px;
|
||||
color: white;
|
||||
cursor: default;
|
||||
font-size: .75em;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
.tag_notice {
|
||||
background-color: red !important;
|
||||
}
|
||||
.tag_inwork {
|
||||
background-color: violet !important;
|
||||
}
|
||||
.tag_planning {
|
||||
background-color: lightblue !important;
|
||||
}
|
||||
|
||||
.dropdown-list {
|
||||
list-style: none;
|
||||
background-color: white;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
padding: 10px 10px 10px;
|
||||
max-width: 200px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.plus-button-container.disabled {
|
||||
pointer-events: none;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.plus-more-tags {
|
||||
font-weight: bold;
|
||||
color: #007bff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.all-tags-modal-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.tag-done {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.modificationdate {
|
||||
font-style: italic;
|
||||
font-size: 0.7em;
|
||||
text-align: left;
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
import CoreForm from '../Form/Form.js';
|
||||
import FormInput from "../Form/Input.js";
|
||||
import BsModal from '../Bootstrap/Modal.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CoreForm,
|
||||
FormInput,
|
||||
BsModal,
|
||||
},
|
||||
emits: [
|
||||
'added',
|
||||
'updated',
|
||||
'deleted',
|
||||
],
|
||||
props: {
|
||||
endpoint: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
zuordnung_typ: String,
|
||||
savepoint: {},
|
||||
values: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showList: false,
|
||||
selectedTagId: null,
|
||||
tagData: {
|
||||
beschreibung: "",
|
||||
tag_typ_kurzbz: "",
|
||||
notiz: "",
|
||||
style: "",
|
||||
zuordnung_typ: "",
|
||||
id: "",
|
||||
insertamum: "",
|
||||
insertvon: "",
|
||||
updateamum: "",
|
||||
updatevon: "",
|
||||
response: ""
|
||||
},
|
||||
mode: "create"
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.init();
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
init() {
|
||||
if (!this.endpoint)
|
||||
return;
|
||||
this.endpoint.getTags()
|
||||
.then(response => response.data)
|
||||
.then(response => {
|
||||
this.tags = response
|
||||
})
|
||||
},
|
||||
hideList() {
|
||||
this.showList = false;
|
||||
},
|
||||
async editTag(tag_id) {
|
||||
let getData = {
|
||||
'id': tag_id
|
||||
};
|
||||
|
||||
this.endpoint.getTag(getData)
|
||||
.then(result => result.data)
|
||||
.then(result => this.openModal(result))
|
||||
},
|
||||
openModal(item = null)
|
||||
{
|
||||
this.tagData.beschreibung = item.bezeichnung;
|
||||
this.tagData.tag_typ_kurzbz = item.tag_typ_kurzbz;
|
||||
this.tagData.style = item.style;
|
||||
this.tagData.zuordnung_typ = this.zuordnung_typ;
|
||||
this.tagData.done = item.done;
|
||||
this.tagData.insertamum = item.insertamum;
|
||||
this.tagData.updateamum = item.updateamum;
|
||||
this.tagData.updatevon = item.updatevon;
|
||||
this.tagData.insertvon = item.insertvon;
|
||||
|
||||
if (item && item.notiz_id)
|
||||
{
|
||||
this.selectedTagId = item.notiz_id;
|
||||
this.tagData.notiz = item.text;
|
||||
this.mode = "edit";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.selectedTagId = null;
|
||||
this.tagData.notiz = "";
|
||||
this.mode = "create";
|
||||
}
|
||||
this.$refs.tagModal.show();
|
||||
},
|
||||
async saveTag()
|
||||
{
|
||||
let postData = {
|
||||
tag_typ_kurzbz: this.tagData.tag_typ_kurzbz,
|
||||
notiz: this.tagData.notiz,
|
||||
zuordnung_typ: this.tagData.zuordnung_typ,
|
||||
values: this.values
|
||||
}
|
||||
|
||||
if (this.mode === "edit")
|
||||
{
|
||||
postData.id = this.selectedTagId;
|
||||
this.tagData.id = this.selectedTagId;
|
||||
this.endpoint.updateTag(postData);
|
||||
this.$emit("updated", this.tagData);
|
||||
this.$refs.tagModal.hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.endpoint.addTag(postData)
|
||||
.then(response => response.data)
|
||||
.then(response => {
|
||||
if (typeof response === 'number') {
|
||||
console.log(response);
|
||||
this.tagData.id = response;
|
||||
} else {
|
||||
this.tagData.response = response;
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
this.$emit("added", this.tagData);
|
||||
})
|
||||
.then(() => {
|
||||
this.$refs.tagModal.hide();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
async doneTag()
|
||||
{
|
||||
this.tagData.id = this.selectedTagId;
|
||||
this.tagData.done = !this.tagData.done;
|
||||
|
||||
let postData = {
|
||||
id: this.selectedTagId,
|
||||
done: !this.tagData.done
|
||||
}
|
||||
this.endpoint.doneTag(postData)
|
||||
this.$emit("updated", this.tagData);
|
||||
this.$refs.tagModal.hide();
|
||||
},
|
||||
async deleteTag()
|
||||
{
|
||||
let postData = {
|
||||
id: this.selectedTagId
|
||||
}
|
||||
this.endpoint.deleteTag(postData)
|
||||
this.$emit("deleted", this.selectedTagId)
|
||||
this.$refs.tagModal.hide();
|
||||
},
|
||||
reset() {
|
||||
this.tagData = {
|
||||
beschreibung: "",
|
||||
tag_typ_kurzbz: "",
|
||||
notiz: "",
|
||||
style: "",
|
||||
zuordnung_typ: "",
|
||||
id: "",
|
||||
done: false,
|
||||
insertamum: "",
|
||||
insertvon: "",
|
||||
updateamum: "",
|
||||
updatevon: "",
|
||||
response: ""
|
||||
};
|
||||
this.selectedTagId = null;
|
||||
this.mode = "create";
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<div class="plus-button-container" @mouseleave="hideList">
|
||||
<button @mouseover="showList = true"
|
||||
:disabled="!values || values.length === 0"
|
||||
class="btn btn-secondary btn-sm">
|
||||
<i class="fa-solid fa-plus fa-xl"></i>
|
||||
</button>
|
||||
<ul v-if="showList" class="dropdown-list">
|
||||
<li v-for="(item, index) in tags" :key="index" @click="openModal(item)" :title="item.bezeichnung">
|
||||
{{ item.bezeichnung }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<bs-modal
|
||||
ref="tagModal"
|
||||
class="fade text-center"
|
||||
dialog-class="modal-dialog-centered"
|
||||
@hidden-bs-modal="reset"
|
||||
>
|
||||
<template #title>
|
||||
<span :class="tagData.style">{{ tagData.beschreibung }}</span>
|
||||
</template>
|
||||
<template #default>
|
||||
<div class="col">
|
||||
<form-input
|
||||
v-model="tagData.notiz"
|
||||
type="textarea"
|
||||
field="notiz"
|
||||
placeholder="Notiz..."
|
||||
></form-input>
|
||||
<div class="modificationdate">angelegt von {{ tagData.insertvon }} am {{ tagData.insertamum }}</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div class="d-flex justify-content-between w-100">
|
||||
<div>
|
||||
<button
|
||||
v-if="mode === 'edit'"
|
||||
class="btn btn-success me-2"
|
||||
@click="doneTag"
|
||||
>
|
||||
{{ tagData.done ? 'Rückgängig' : 'Erledigt' }}
|
||||
</button>
|
||||
<button v-if="mode === 'edit'" class="btn btn-danger" @click="deleteTag">Löschen</button>
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" @click="saveTag">
|
||||
{{ mode === "edit" ? $p.t('ui', 'bearbeiten') : $p.t('studierendenantrag', 'btn_create') }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
</bs-modal>`,
|
||||
}
|
||||
@@ -57,6 +57,8 @@ require_once('dbupdate_3.4/34543_ux_template.php');
|
||||
require_once('dbupdate_3.4/17513_Entwicklungsteam.php');
|
||||
require_once('dbupdate_3.4/28575_softwarebereitstellung.php');
|
||||
require_once('dbupdate_3.4/40717_lv_faktor.php');
|
||||
require_once('dbupdate_3.4/48526_pep_tagging.php');
|
||||
|
||||
|
||||
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
|
||||
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
|
||||
|
||||
Reference in New Issue
Block a user