From 4ad5de915ae57ef488c88da8bcfc9ac5e5bd486c Mon Sep 17 00:00:00 2001 From: Andreas Moik Date: Mon, 8 Aug 2016 11:14:22 +0200 Subject: [PATCH] added page to link documents with templates --- application/config/fhcomplete.php | 1 + application/controllers/system/Templates.php | 39 +- application/libraries/VorlageLib.php | 2 +- application/models/system/Dokument_model.php | 14 + .../models/system/Vorlagedokument_model.php | 41 + application/views/system/phraseinhaltEdit.php | 156 +-- application/views/system/phrasesList.php | 76 +- .../views/system/templateLinkDocuments.php | 67 ++ application/views/system/templatesEdit.php | 64 +- application/views/system/templatesList.php | 76 +- application/views/system/templatetextEdit.php | 86 +- application/views/system/templatetextList.php | 95 +- include/vorlage.class.php | 996 +++++++++--------- system/dbupdate_3.2.php | 2 +- 14 files changed, 940 insertions(+), 775 deletions(-) create mode 100644 application/models/system/Dokument_model.php create mode 100644 application/models/system/Vorlagedokument_model.php create mode 100644 application/views/system/templateLinkDocuments.php diff --git a/application/config/fhcomplete.php b/application/config/fhcomplete.php index 6b86ea6a8..7fc457b61 100755 --- a/application/config/fhcomplete.php +++ b/application/config/fhcomplete.php @@ -190,6 +190,7 @@ $config['fhc_acl'] = array 'public.tbl_tag' => 'basis/tag', 'public.tbl_variable' => 'basis/variable', 'public.tbl_vorlage' => 'system/vorlage', + 'public.tbl_vorlagedokument' => 'system/vorlagestudiengang', 'public.tbl_vorlagestudiengang' => 'system/vorlagestudiengang', 'public.tbl_rt_person' => 'basis/person', 'public.vw_studiensemester' => 'basis/studiensemester', diff --git a/application/controllers/system/Templates.php b/application/controllers/system/Templates.php index aca104d0b..16667c960 100755 --- a/application/controllers/system/Templates.php +++ b/application/controllers/system/Templates.php @@ -42,7 +42,7 @@ class Templates extends FHC_Controller $vorlagentext = $this->vorlagelib->getVorlagetextByVorlage($vorlage_kurzbz); if ($vorlagentext->error) show_error($vorlagentext->retval); - //var_dump($vorlage); + //var_dump($vorlagentext); $data = array ( @@ -128,6 +128,43 @@ class Templates extends FHC_Controller $this->load->view('system/templatetextEdit', $data); } + public function linkDocuments($vorlagestudiengang_id) + { + $this->load->model('system/vorlagedokument_model'); + $return = $this->vorlagedokument_model->loadDokumenteFromVorlagestudiengang($vorlagestudiengang_id); + $data['documents'] = $return->retval; + + $this->load->model('system/dokument_model'); + $this->dokument_model->addOrder("bezeichnung"); + $return = $this->dokument_model->load(); + $data['allDocuments'] = $return->retval; + + $data['vorlagestudiengang_id'] = $vorlagestudiengang_id; + + $this->load->view('system/templateLinkDocuments', $data); + } + + public function saveDocuments($vorlagestudiengang_id, $dokument_kurzbz, $sort) + { + $this->load->model('system/vorlagedokument_model'); + $insert['vorlagestudiengang_id'] = $vorlagestudiengang_id; + $insert['dokument_kurzbz'] = $dokument_kurzbz; + $insert['sort'] = $sort; + $this->vorlagedokument_model->insert($insert); + } + + public function deleteDocumentLink($vorlagestudiengang_id) + { + $this->load->model('system/vorlagedokument_model'); + $this->vorlagedokument_model->delete($vorlagestudiengang_id); + } + + public function changeSort($vorlagestudiengang_id, $sort) + { + $this->load->model('system/vorlagedokument_model'); + $this->vorlagedokument_model->update($vorlagestudiengang_id, array("sort"=>$sort)); + } + public function saveText() { $vorlagestudiengang_id = $this->input->post('vorlagestudiengang_id', TRUE); diff --git a/application/libraries/VorlageLib.php b/application/libraries/VorlageLib.php index 5a0f6a9e8..bdd770cd4 100644 --- a/application/libraries/VorlageLib.php +++ b/application/libraries/VorlageLib.php @@ -217,4 +217,4 @@ class VorlageLib $return->retval = $retval; return $return; } -} \ No newline at end of file +} diff --git a/application/models/system/Dokument_model.php b/application/models/system/Dokument_model.php new file mode 100644 index 000000000..7ef2be716 --- /dev/null +++ b/application/models/system/Dokument_model.php @@ -0,0 +1,14 @@ +dbTable = 'public.tbl_dokument'; + $this->pk = 'dokument_kurzbz'; + } +} diff --git a/application/models/system/Vorlagedokument_model.php b/application/models/system/Vorlagedokument_model.php new file mode 100644 index 000000000..62741d52b --- /dev/null +++ b/application/models/system/Vorlagedokument_model.php @@ -0,0 +1,41 @@ +dbTable = 'public.tbl_vorlagedokument'; + $this->pk = 'vorlagedokument_id'; + } + + /** + * + */ + public function loadDokumenteFromVorlagestudiengang($vorlagestudiengang_id) + { + // Checks if the operation is permitted by the API caller + if (! $this->fhc_db_acl->isBerechtigt($this->getBerechtigungKurzbz('public.tbl_vorlagedokument'), 's')) + return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->getBerechtigungKurzbz('public.tbl_vorlagedokument'), FHC_MODEL_ERROR); + + $result = null; + + $qry = "SELECT vorlagedokument_id, sort, vorlagestudiengang_id, dokument_kurzbz, bezeichnung + FROM public.tbl_vorlagedokument + JOIN public.tbl_dokument USING(dokument_kurzbz) + WHERE vorlagestudiengang_id=? + ORDER BY sort ASC + "; + + $result = $this->db->query($qry, array($vorlagestudiengang_id)); + + + if (is_object($result)) + return $this->_success($result->result()); + else + return $this->_error($this->db->error(), FHC_DB_ERROR); + } +} diff --git a/application/views/system/phraseinhaltEdit.php b/application/views/system/phraseinhaltEdit.php index 10f22d587..37cd9fa40 100644 --- a/application/views/system/phraseinhaltEdit.php +++ b/application/views/system/phraseinhaltEdit.php @@ -1,78 +1,78 @@ -load->view('templates/header', array('title' => 'TemplateEdit', 'jquery' => true, 'textile' => true)); -?> - -
-
-

Phrasentext:

- -
- - - - - - - - - - - - - - - templatelib->widget("tinymce_widget", array('name' => 'text', 'text' => $text)); - ?> - -
OEtemplatelib->widget("organisationseinheit_widget", array('oe_kurzbz' => $orgeinheit_kurzbz)); ?>Preview
Orgformtemplatelib->widget("orgform_widget", array('orgform_kurzbz' => $orgform_kurzbz)); ?>
Sprachetemplatelib->widget("sprache_widget", array('sprache' => $sprache)); ?>
Text -
-
Beschreibung

Formatierung (Textile) Hilfe:


- - _emphasis_ - *strong* - ??citation?? - -deleted text- - +inserted text+ - ^superscript^ -
- Textile CheatSheet -
-
- -
-
- - - - - - - +load->view('templates/header', array('title' => 'TemplateEdit', 'jquery' => true, 'textile' => true)); +?> + +
+
+

Phrasentext:

+ +
+ + + + + + + + + + + + + + + templatelib->widget("tinymce_widget", array('name' => 'text', 'text' => $text)); + ?> + +
OEtemplatelib->widget("organisationseinheit_widget", array('oe_kurzbz' => $orgeinheit_kurzbz)); ?>Preview
Orgformtemplatelib->widget("orgform_widget", array('orgform_kurzbz' => $orgform_kurzbz)); ?>
Sprachetemplatelib->widget("sprache_widget", array('sprache' => $sprache)); ?>
Text +
+
Beschreibung

Formatierung (Textile) Hilfe:


+ + _emphasis_ + *strong* + ??citation?? + -deleted text- + +inserted text+ + ^superscript^ +
+ Textile CheatSheet +
+
+ +
+
+ + + + + + + diff --git a/application/views/system/phrasesList.php b/application/views/system/phrasesList.php index b95c0b57b..9f036af24 100644 --- a/application/views/system/phrasesList.php +++ b/application/views/system/phrasesList.php @@ -1,38 +1,38 @@ -load->view('templates/header', array('title' => 'PhrasesList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '3:{sorter:false}')); -?> -
-
-

Phrasen

- - - - - - - - - - - - - - - - - - -
IDAppPhrase
phrase_id; ?>app; ?>phrase; ?>Phrasentexte bearbeiten
-
-
- - +load->view('templates/header', array('title' => 'PhrasesList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '3:{sorter:false}')); +?> +
+
+

Phrasen

+ + + + + + + + + + + + + + + + + + +
IDAppPhrase
phrase_id; ?>app; ?>phrase; ?>Phrasentexte bearbeiten
+
+
+ + diff --git a/application/views/system/templateLinkDocuments.php b/application/views/system/templateLinkDocuments.php new file mode 100644 index 000000000..b9133a874 --- /dev/null +++ b/application/views/system/templateLinkDocuments.php @@ -0,0 +1,67 @@ +load->view('templates/header', array('title' => 'TemplateLinkDocuments', 'tablesort' => true, 'tableid' => 't1', 'sortList' => '2,1', 'headers' => '3:{sorter:false},4:{sorter:false}')); +?> + + + + +

+ + + + + + + + + + + + + + + + + + + + + +
IDBezeichnungSortierung
vorlagedokument_id?>bezeichnung?> sort?> löschen
+ + + + + + diff --git a/application/views/system/templatesEdit.php b/application/views/system/templatesEdit.php index 4318f3ba1..53c61eb6d 100644 --- a/application/views/system/templatesEdit.php +++ b/application/views/system/templatesEdit.php @@ -1,32 +1,32 @@ -load->view('templates/header', array('title' => 'TemplateEdit', 'jsoneditor' => true)); -?> -
-
-

Vorlage: vorlage_kurzbz; ?>

-
- Bezeichnung: - Anmerkung:
- - MimeType:templatelib->widget("mimetype_widget", array('mimetype' => $vorlage->mimetype)); ?> - - Attribute: templatelib->widget("jsoneditor_widget", array('json' => $vorlage->attribute)); ?> - - - - -
- -
-
- - - - +load->view('templates/header', array('title' => 'TemplateEdit', 'jsoneditor' => true)); +?> +
+
+

Vorlage: vorlage_kurzbz; ?>

+
+ Bezeichnung: + Anmerkung:
+ + MimeType:templatelib->widget("mimetype_widget", array('mimetype' => $vorlage->mimetype)); ?> + + Attribute: templatelib->widget("jsoneditor_widget", array('json' => $vorlage->attribute)); ?> + + + + +
+ +
+
+ + + + diff --git a/application/views/system/templatesList.php b/application/views/system/templatesList.php index 7d2a84844..e1a7d0ee8 100644 --- a/application/views/system/templatesList.php +++ b/application/views/system/templatesList.php @@ -1,38 +1,38 @@ -load->view('templates/header', array('title' => 'TemplatesList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '4:{sorter:false}')); -?> -
-
-

Vorlagen

-
-MimeType -templatelib->widget("mimetype_widget", array('mimetype' => $mimetype)); -?> - -
- - - - - - - - - - - - - - - - - - - -
VorlageBezeichnungAnmerkungMimeType
vorlage_kurzbz; ?>bezeichnung; ?>anmerkung; ?>mimetype; ?>Vorlagenexte bearbeiten
-
-
- - +load->view('templates/header', array('title' => 'TemplatesList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '4:{sorter:false}')); +?> +
+
+

Vorlagen

+
+MimeType +templatelib->widget("mimetype_widget", array('mimetype' => $mimetype)); +?> + +
+ + + + + + + + + + + + + + + + + + + +
VorlageBezeichnungAnmerkungMimeType
vorlage_kurzbz; ?>bezeichnung; ?>anmerkung; ?>mimetype; ?>Vorlagenexte bearbeiten
+
+
+ + diff --git a/application/views/system/templatetextEdit.php b/application/views/system/templatetextEdit.php index fcf1866fe..b5e011086 100644 --- a/application/views/system/templatetextEdit.php +++ b/application/views/system/templatetextEdit.php @@ -1,43 +1,43 @@ -load->view('templates/header', array('title' => 'TemplateEdit', 'tinymce' => true, 'jsonforms' => true)); -?> - -
-
-

Vorlagetext:

- -
- OE:templatelib->widget("organisationseinheit_widget", array('oe_kurzbz' => $oe_kurzbz, 'typ' => "'Erhalter','Studienzentrum','Studiengang','Lehrgang'")); ?> - Sprache:templatelib->widget("sprache_widget", array('sprache' => $sprache)); ?> - OrgForm:templatelib->widget("orgform_widget", array('orgform' => $orgform_kurzbz)); ?> - Version: - Aktiv: - - - templatelib->widget("tinymce_widget", array('name' => 'text', 'text' => $text)); - ?> - -
-

Preview-Data

-
- templatelib->widget("jsonforms_widget", array('id' => 'dataform', 'schema' => $schema)); ?> - - -
-
-
- - - -