diff --git a/application/models/content/News_model.php b/application/models/content/News_model.php index 8d636d808..7d475081d 100644 --- a/application/models/content/News_model.php +++ b/application/models/content/News_model.php @@ -11,4 +11,18 @@ class News_model extends DB_Model $this->dbTable = 'campus.tbl_news'; $this->pk = 'news_id'; } + + public function getAll($limit = null) + { + // TODO check ob über content table. Aktuell sind die news texte NULL, deshalb über content table holen. +// $this->addJoin('campus.tbl_content', 'content_id'); +// $this->addJoin('campus.tbl_contentsprache', 'content_id'); + + return $this->loadWhere(' + text IS NOT NULL + AND datum <= NOW() AND (datum_bis IS NULL OR datum_bis >= now()::date) + ORDER BY datum DESC + LIMIT '. $this->escape($limit) + ); + } } diff --git a/public/js/components/DashboardWidget/Url.js b/public/js/components/DashboardWidget/Url.js new file mode 100644 index 000000000..f374b7ed8 --- /dev/null +++ b/public/js/components/DashboardWidget/Url.js @@ -0,0 +1,84 @@ +import AbstractWidget from './Abstract'; + +export default { + name: 'WidgetsUrl', + data: () => ({ + links: [] + }), + mixins: [ + AbstractWidget + ], + computed: { + tagName() { + return this.config.tag !== undefined && this.config.tag.length > 0 ? this.config.tag : 'Meine Urls'; + } + }, + methods: { + addLink(){ + let linkId = this.links.length; + + this.links.push({ + id: linkId, + tag: this.config.tag, + title: this.title, + url: this.url + }) + }, + removeLink(linkId){ + let indexToRemove = this.links.findIndex((obj => obj.id === linkId)); + this.links.splice(indexToRemove, 1); + } + }, + created() { + this.links = TEST_LINKS; + // this.links = TEST_KEINE_LINKS; + }, + template: ` +
` +} +const TEST_KEINE_LINKS = []; +const TEST_LINKS = [ + { + id: 0, + tag: 'Zeitverwaltung', + title: 'Zeitverwaltung' + 'link 0', + url: 'https://www.technikum-wien.at' + }, + { + id: 1, + tag: 'Zeitverwaltung', + title: 'Zeitverwaltung' + 'link 1', + url: 'https://www.technikum-wien.at' + }, + { + id: 2, + tag: 'Zeitverwaltung', + title: 'Zeitverwaltung' + 'link 2', + url: 'https://www.technikum-wien.at' + }, + { + id: 3, + tag: 'Zeitverwaltung', + title: 'Zeitverwaltung' + 'link 3', + url: 'https://www.technikum-wien.at' + } +]; \ No newline at end of file