From: Winfried Kappeler Date: Thu, 23 Jul 2020 18:21:53 +0000 (+0200) Subject: WBC2020.07.23.00: Spalte "Fahrdienst", Farbanpassung, akt. Skeleton X-Git-Url: https://gitweb.hamatoma.de/?a=commitdiff_plain;h=HEAD;p=webcal.git WBC2020.07.23.00: Spalte "Fahrdienst", Farbanpassung, akt. Skeleton * local.css: ** Farbe Tabellenzeile:hover * Locals: * frame: mit green.css und gray.css * addmember(), subMember() und membersOfTerm(): + Param $type * neu: $_frameSnippets, frameSnippets() und localFrame() * Terms: ** neues Feld: userterms.userterm_type ** neu: Filter "Start" in Seite base ** Seite Edit: neu: "Fahrdienst" mit buttonAddFahrdienst und buttonSubFahrdienst --- diff --git a/app/locals/build/common/locals.frame.snippets.html b/app/locals/build/common/locals.frame.snippets.html index 293fe12..f3c59b5 100644 --- a/app/locals/build/common/locals.frame.snippets.html +++ b/app/locals/build/common/locals.frame.snippets.html @@ -11,6 +11,8 @@ SNIPPET_ROOT: + + diff --git a/app/locals/locals.model.php b/app/locals/locals.model.php index 571bb2b..0d12c51 100644 --- a/app/locals/locals.model.php +++ b/app/locals/locals.model.php @@ -27,12 +27,13 @@ trait Model * @param int $term * the related term */ - public function addMember(int $member, int $term) + public function addMember(int $member, int $term, string $type) { $sql = $this->_sqlSnippetsModel->getSnippet('SQL_INSERT_USERTERM'); $this->_db->prepareAndExecute($sql, [ ':member' => $member, ':term' => $term, + ':type' => $type, ':user' => $_SESSION['shortname'] ]); } @@ -45,12 +46,13 @@ trait Model * @param int $term * the related term */ - public function subMember(int $member, int $term) + public function subMember(int $member, int $term, string $type) { $sql = $this->_sqlSnippetsModel->getSnippet('SQL_DELETE_USERTERM'); $this->_db->prepareAndExecute($sql, [ ':member' => $member, - ':term' => $term + ':term' => $term, + ':type' => $type ]); } @@ -61,11 +63,12 @@ trait Model * the members related to this term will be assembled * @return string the display names of the members, delimited by ' ' */ - public function membersOfTerm(int $term): string + public function membersOfTerm(int $term, string $type): string { $sql = $this->_sqlSnippetsModel->getSnippet('SQL_USERTERM_BY_TERM'); $recs = $this->_db->readall($sql, [ - ':term' => $term + ':term' => $term, + ':type' => $type ], false); $rc = ''; foreach ($recs as &$rec) { diff --git a/app/locals/locals.view.php b/app/locals/locals.view.php index ff757d9..4cd3d71 100644 --- a/app/locals/locals.view.php +++ b/app/locals/locals.view.php @@ -18,6 +18,8 @@ trait View ] ]; + private $_frameSnippets; + /** * Adapts the full page in a application depending way. * @@ -29,4 +31,46 @@ trait View // do nothing } + /** + * Returns null or the local frame snippets. + * + * @param string $module + * the calling module: the result can depend on this + * @param string $page + * the calling page: the result can depend on this + * @return LN\Snippets|NULL null: no local frame is available otherwise: the local frame snippets + */ + public function frameSnippets(?string $module = null, ?string $page = null): ?LN\Snippets + { + if ($this->_frameSnippets == null) { + $name = ROOT . 'app/locals/build/common/locals.frame.snippets.html'; + if (\file_exists($name)) { + $this->_frameSnippets = new LN\Snippets(); + $this->_frameSnippets->readSnippets($name); + } + } + return $this->_frameSnippets; + } + + /** + * Returns null or the local frame snippets. + * + * @param string $module + * the calling module: the result can depend on this + * @param string $page + * the calling page: the result can depend on this + * @param array $macros + * the page specific placeholder map + * @return string the local frame + */ + public function localFrame(string $module, ?string $page, ?array &$macros) + { + $common = TC\Controller::getInstance(); + $snippets = $this->frameSnippets($module, $page); + $frame = $snippets->getSnippet('SNIPPET_ROOT', $macros); + $config = $this->simpleConfiguration($module, $page); + LN\StringUtils::replaceMacros($frame, $config, true); + $common->replaceCommonMacros($frame); + return $frame; + } } diff --git a/app/locals/sql/locals.snippets.sql b/app/locals/sql/locals.snippets.sql index 6ff8c6d..b4506b6 100644 --- a/app/locals/sql/locals.snippets.sql +++ b/app/locals/sql/locals.snippets.sql @@ -1,15 +1,15 @@ SQL_INSERT_USERTERM: insert into userterms - (userterm_user, userterm_term, created, createdby) + (userterm_user, userterm_term, userterm_type, created, createdby) values - (:member, :term, now(), :user) + (:member, :term, :type, now(), :user) ; SQL_DELETE_USERTERM: delete from userterms where - userterm_term=:term and userterm_user=:member + userterm_term=:term and userterm_user=:member and userterm_type=:type ; SQL_USERTERM_BY_TERM: @@ -20,6 +20,7 @@ from left join loginusers u on u.user_id=tt.userterm_user where userterm_term=:term + AND userterm_type=:type order by user_displayname ; diff --git a/app/terms/build/base/terms.base.config.php b/app/terms/build/base/terms.base.config.php index c0906e4..611f834 100644 --- a/app/terms/build/base/terms.base.config.php +++ b/app/terms/build/base/terms.base.config.php @@ -1,13 +1,13 @@ '', 'local_css' => '', 'local_pageType' => 'base', + 'data' => 'Daten', 'local_title' => 'Termine', + 'parent_title' => 'Termine', 'hasFilter' => TC\Controller::getInstance()->configurationAsBool('terms', 'filter:switch'), // PHP_HOOK_CONFIG_BASE diff --git a/app/terms/build/base/terms.base.snippets.html b/app/terms/build/base/terms.base.snippets.html index 3f3f14a..9fcc8db 100644 --- a/app/terms/build/base/terms.base.snippets.html +++ b/app/terms/build/base/terms.base.snippets.html @@ -5,11 +5,22 @@ SNIPPET_ROOT:
+ +
+ ###SNIPPET_COMMON_LEGEND_PAGED### +
+
+
+
+
+
+
+
-###SNIPPET_IF_2### +###SNIPPET_IF_3###
@@ -22,6 +33,7 @@ SNIPPET_ROOT: Datum###COMMON_SNIPPET[SNIPPET_SORT_BUTTON,sort_term_date]### Bezeichnung###COMMON_SNIPPET[SNIPPET_SORT_BUTTON,sort_term_name]### Platzanweiser + Fahrdienst Bemerkung @@ -34,8 +46,9 @@ SNIPPET_ROOT: -SNIPPET_IF_2: -
+SNIPPET_IF_3: +
+
SNIPPET_ROW: @@ -46,6 +59,7 @@ SNIPPET_ROW: ###term_date### ###term_name### ###members### + ###members2### ###term_info### ###alt_delete### diff --git a/app/terms/build/common/terms.common.config.php b/app/terms/build/common/terms.common.config.php deleted file mode 100644 index 4d0e492..0000000 --- a/app/terms/build/common/terms.common.config.php +++ /dev/null @@ -1,13 +0,0 @@ - '', - 'local_css' => '', - 'data' => 'Daten', 'parent_title' => 'Termine', - - // PHP_HOOK_CONFIG_COMMON - '!EoA!' => '' -); diff --git a/app/terms/build/common/terms.common.snippets.html b/app/terms/build/common/terms.common.snippets.html deleted file mode 100644 index 6e42e03..0000000 --- a/app/terms/build/common/terms.common.snippets.html +++ /dev/null @@ -1,8 +0,0 @@ -SNIPPET_FIELDS: - - - -SNIPPET_DUMMY_FOR_HOOK: - - -END: diff --git a/app/terms/build/delete/terms.delete.config.php b/app/terms/build/delete/terms.delete.config.php index 7e8df43..629bbc9 100644 --- a/app/terms/build/delete/terms.delete.config.php +++ b/app/terms/build/delete/terms.delete.config.php @@ -1,13 +1,13 @@ '', 'local_css' => '', 'local_pageType' => 'delete', + 'data' => 'Daten', 'local_title' => 'Termin löschen', + 'parent_title' => 'Termine', // PHP_HOOK_CONFIG_DELETE '!EoA!' => '' diff --git a/app/terms/build/delete/terms.delete.snippets.html b/app/terms/build/delete/terms.delete.snippets.html index 2187d9b..551a300 100644 --- a/app/terms/build/delete/terms.delete.snippets.html +++ b/app/terms/build/delete/terms.delete.snippets.html @@ -11,12 +11,17 @@ SNIPPET_ROOT:
-
-
-
+
+
+
+
+
+
-
-
+
+
+
+
diff --git a/app/terms/build/edit/terms.edit.config.php b/app/terms/build/edit/terms.edit.config.php index afe55fe..f227639 100644 --- a/app/terms/build/edit/terms.edit.config.php +++ b/app/terms/build/edit/terms.edit.config.php @@ -1,13 +1,13 @@ '', 'local_css' => '', 'local_pageType' => 'edit', + 'data' => 'Daten', 'local_title' => 'Termin ändern', + 'parent_title' => 'Termine', // PHP_HOOK_CONFIG_EDIT '!EoA!' => '' diff --git a/app/terms/build/edit/terms.edit.snippets.html b/app/terms/build/edit/terms.edit.snippets.html index 01c3cbe..178a76b 100644 --- a/app/terms/build/edit/terms.edit.snippets.html +++ b/app/terms/build/edit/terms.edit.snippets.html @@ -10,18 +10,36 @@ SNIPPET_ROOT:
-
-
-
+
+
+
+
+
+
-
+
+
-
+
+
+
+ + +
+
+
+
+
+
+
+ +
###SNIPPET_IF_2### ###SNIPPET_IF_3### -
+
+
@@ -32,6 +50,7 @@ SNIPPET_IF_2:
+ SNIPPET_IF_3:
diff --git a/app/terms/build/new/terms.new.config.php b/app/terms/build/new/terms.new.config.php index da46f2f..6e036c8 100644 --- a/app/terms/build/new/terms.new.config.php +++ b/app/terms/build/new/terms.new.config.php @@ -1,13 +1,13 @@ '', 'local_css' => '', 'local_pageType' => 'new', + 'data' => 'Daten', 'local_title' => 'Neuer Termin', + 'parent_title' => 'Termine', // PHP_HOOK_CONFIG_NEW '!EoA!' => '' diff --git a/app/terms/build/new/terms.new.snippets.html b/app/terms/build/new/terms.new.snippets.html index 02c155d..941eb62 100644 --- a/app/terms/build/new/terms.new.snippets.html +++ b/app/terms/build/new/terms.new.snippets.html @@ -10,13 +10,18 @@ SNIPPET_ROOT:
-
-
-
+
+
+
+
+
+
###errors###
-
-
+
+
+
+
diff --git a/app/terms/sql/terms.snippets.sql b/app/terms/sql/terms.snippets.sql index bbac8f9..5fd028a 100644 --- a/app/terms/sql/terms.snippets.sql +++ b/app/terms/sql/terms.snippets.sql @@ -41,7 +41,8 @@ SELECT FROM terms tt WHERE - tt.deletedat is null + tt.term_date >= :date + AND tt.deletedat is null SQL_TERMS_BASE_GETALL_COUNT: SELECT @@ -49,7 +50,8 @@ SELECT FROM terms tt WHERE - tt.deletedat is null + tt.term_date >= :date + AND tt.deletedat is null SQL_TERMS_NEW_INSERT: INSERT INTO terms ( diff --git a/app/terms/sql/terms.sql b/app/terms/sql/terms.sql index 19e0612..69345f6 100644 --- a/app/terms/sql/terms.sql +++ b/app/terms/sql/terms.sql @@ -37,6 +37,7 @@ CREATE TABLE userterms( term_id int(10) unsigned NOT NULL AUTO_INCREMENT, userterm_term int(10) unsigned, userterm_user int(10) unsigned, + userterm_type varchar(16), created timestamp NULL, createdby varchar(16), changed timestamp NULL, @@ -50,7 +51,7 @@ CREATE TABLE userterms( INSERT INTO configurations (configuration_scope, configuration_property, configuration_order, configuration_type, configuration_value, configuration_description, configuration_changed_by) VALUES -('terms', 'required:base', 0, 'string', 'term_id,userterm_term,userterm_user,created,createdby,changed,changedby,deletedat,deletedby', 'Pflichtfelder bei terms. Trennung mit Komma', 'wk'); +('terms', 'required:base', 0, 'string', 'term_id,userterm_term,userterm_user,userterm_type,created,createdby,changed,changedby,deletedat,deletedby', 'Pflichtfelder bei terms. Trennung mit Komma', 'wk'); -- ! endif insert into starters (starter_name, starter_label, starter_parent, starter_image, starter_link) values ( diff --git a/app/terms/terms.model.php b/app/terms/terms.model.php index 1e154c9..05cdecf 100644 --- a/app/terms/terms.model.php +++ b/app/terms/terms.model.php @@ -97,6 +97,9 @@ trait Model { array_push($replacement, $parts[2*$ix+1]); } } + if ($record['date'] == null) { + $record['date'] = new \DateTime('1900-01-01 00:00:00'); + } $sqlCount = $this->_sqlSnippetsModel->getSnippet('SQL_TERMS_BASE_GETALL_COUNT'); @@ -106,6 +109,7 @@ trait Model { } // PHP_HOOK_MODEL_TERMS_BASE_GETALL_START $params = [ + ':date' => $record['date'] != null ? LN\DB::dateTimeToDbDateTime($record['date']) : null, ]; // PHP_HOOK_MODEL_TERMS_BASE_GETALL_PARAM_FIX $countFiltered = intval($this->_db->readUniqueValue($sqlCount, $params)); diff --git a/app/terms/terms.view.php b/app/terms/terms.view.php index 7062541..b26516c 100644 --- a/app/terms/terms.view.php +++ b/app/terms/terms.view.php @@ -12,70 +12,7 @@ trait View { use \lib\native\MViewC; // PHP_HOOK_VIEW_USE_TRAIT - private $_build = [ - 'base' => [ - 'name' => 'base', - 'site' => 1, - 'config' => 1 - ], - 'new' => [ - 'name' => 'new', - 'site' => 1, - 'config' => 1 - ], - 'edit' => [ - 'name' => 'edit', - 'site' => 1, - 'config' => 1 - ], - 'delete' => [ - 'name' => 'delete', - 'site' => 1, - 'config' => 1 - ] - ]; public $_moduleType = 'backend'; - /** - * Returns the configuration of the common page. - * - * @return array the configuration - */ - public function getCommonConfig() - { - // common config is included in edit config: - $config = $this->_getConfiguration($this->_build['edit'], 'edit'); - return $config; - } - /** - * Handles AJAX requests. - */ - public function ajax() - { - [ - $snippets, - $config - ] = $this->_getSnippetsAndConfig($this->_build['edit'], 'edit'); - $common = TC\Controller::getInstance(); - $fieldSet = $this->buildCommonFieldSet('edit', URL_DOMAIN_APP_PREFIX . '/terms/ajax'); - $answer = ''; - if (! \array_key_exists('ajaxMode', $_POST)) { - error_log('Terms::ajax(): Missing argument "ajaxMode"'); - } else { - switch ($_POST['ajaxMode']) { - case 'newChanged': - $answer = $common->testNewChanged($fieldSet); - break; - case 'editChanged': - $record = $this->termById($_POST['termID']); - $answer = $common->testNewChanged($fieldSet); - break; - default: - error_log('Terms::ajax(): unknown mode: ' . $_POST['ajaxMode']); - break; - } - } - $this->answerAjax($answer ?? ''); - } // PHP_HOOK_VIEW_METHODS /** @@ -89,9 +26,9 @@ trait View { $locals = LOC\Controller::getInstance(); // PHP_HOOK_BASE_INIT [ - $snippets, - $config - ] = $this->_getSnippetsAndConfig($this->_build['base'], 'base'); + $config, + $snippets + ] = $this->simpleConfigurationAndSnippet('terms', 'base'); $content = $snippets->getSnippet('SNIPPET_ROOT', $config); $breadcrumbs = [ [ @@ -105,7 +42,7 @@ trait View { $urlAction = FULL_URL_APP_PREFIX . '/terms/base'; $fieldSet = new LN\FieldSet('base', $config, $urlAction, $validator); $common->addPagingAndSortingFields($fieldSet); - + $fieldDate = new LN\InputField($fieldSet, "filterDate", '', 'datetime', null, 'Start'); // PHP_HOOK_BASE_FIELDS $fieldSet->setFromPost(); // PHP_HOOK_BASE_START @@ -117,11 +54,13 @@ trait View { $storage->fetchFromFieldset($fieldSet, $storageFields); if (count($_POST) == 0){ // First call - // PHP_HOOK_BASE_FIRST_CALL + // === start PHP_HOOK_BASE_FIRST_CALL + $fieldDate->value = new \DateTime(); + // === end PHP_HOOK_BASE_FIRST_CALL } // PHP_HOOK_BASE_FIELDS_READY $pagingData = $common->getPagingAndSortingData($fieldSet, $storage); - $empty = false; + $empty = empty($fieldDate->value); if (\array_key_exists('buttonNew', $_POST)) { $linkPage = '/terms/new'; // PHP_HOOK_BASE_REDIRECT_BUTTONNEW @@ -136,6 +75,7 @@ trait View { $rows = ''; $record = []; $sqlReplacement = ''; + $record['date'] = LN\StringUtils::stringToDateTime($fieldSet->getField('filterDate')->value, $error); // PHP_HOOK_BASE_BEFORE_GET_ALL $records = $this->getAllTermsBase($sqlReplacement, $pagingData, $record); $content = $common->setLegendWithPages($pagingData, $content, ! $empty); @@ -148,7 +88,8 @@ trait View { foreach ($records as &$rec) { $rowNo++; // === start PHP_HOOK_BASE_TABLE_ROW_ADAPTION - $rec['members'] = $locals->membersOfTerm($rec['term_id']); + $rec['members'] = $locals->membersOfTerm($rec['term_id'], 'anweiser'); + $rec['members2'] = $locals->membersOfTerm($rec['term_id'], 'fahrdienst'); // === end PHP_HOOK_BASE_TABLE_ROW_ADAPTION $html = $common->rowFromDatabase($templateRow, $rec); if (! $editAllowed){ @@ -161,7 +102,7 @@ trait View { } $content = str_replace('###ROWS###', $rows, $content); // PHP_HOOK_BASE_HTML - $common->switchConditional($content, 'SNIPPET_IF_2', null, 'role', '1,2', false, $snippets, $config); + $common->switchConditional($content, 'SNIPPET_IF_3', null, 'role', '1,2', false, $snippets, $config); $dummyStr = null; $map = $locals->buildPlaceholderMap('', $config); // PHP_HOOK_BASE_HTML_REPLACEMENT @@ -183,9 +124,9 @@ trait View { $locals = LOC\Controller::getInstance(); // PHP_HOOK_NEW_INIT [ - $snippets, - $config - ] = $this->_getSnippetsAndConfig($this->_build['new'], 'new'); + $config, + $snippets + ] = $this->simpleConfigurationAndSnippet('terms', 'new'); // PHP_HOOK_NEW_FIELDSET_START $content = null; $validator = new TermsValidator($this); @@ -278,9 +219,9 @@ trait View { // PHP_HOOK_EDIT_INIT $termID = isset($_GET['termID']) ? $_GET['termID'] : (isset($_POST['term_id']) ? $_POST['term_id'] : -1); [ - $snippets, - $config - ] = $this->_getSnippetsAndConfig($this->_build['edit'], 'edit'); + $config, + $snippets + ] = $this->simpleConfigurationAndSnippet('terms', 'edit'); // PHP_HOOK_EDIT_FIELDSET_START $content = null; $validator = new TermsValidator($this); @@ -290,11 +231,15 @@ trait View { $fieldName = new LN\InputField($fieldSet, "term_name", ':db:', 'text', null, 'Bezeichnung'); $fieldDate = new LN\InputField($fieldSet, "term_date", ':db:', 'datetime', null, 'Datum'); $fieldInfo = new LN\InputField($fieldSet, "term_info", ':db:', 'text', null, 'Bemerkungen'); - $fieldMembers = new LN\InputField($fieldSet, "members", ':readonly:', 'text', null, 'Platzanweiser'); + $fieldMembers = new LN\InputField($fieldSet, "members", ':readonly:', 'text', null, 'Platzanweiser'); $fieldMembersShdw = new LN\InputField($fieldSet, "membersShdw", ':isshadow:hidden:', 'text'); $fieldMember = new LN\InputField($fieldSet, "member", ':undef:', 'combobox', null, 'Ändern'); + $fieldMembers2 = new LN\InputField($fieldSet, "members2", ':readonly:', 'text', null, 'Fahrdienst'); + $fieldMembers2Shdw = new LN\InputField($fieldSet, "members2Shdw", ':isshadow:hidden:', 'text'); + $fieldMember2 = new LN\InputField($fieldSet, "member2", ':undef:', 'combobox', null, 'Ändern'); // === start PHP_HOOK_EDIT_FIELDSET_COMPLETE_FIELDS $common->fillUserCombobox($fieldMember, [1, 27, 30], false); + $common->fillUserCombobox($fieldMember2, [1, 27, 30], false); // === end PHP_HOOK_EDIT_FIELDSET_COMPLETE_FIELDS $fieldSet->setFromPost(); // PHP_HOOK_EDIT_START @@ -310,6 +255,7 @@ trait View { $fieldSet->setFromRecord($record); // === start PHP_HOOK_EDIT_FIRST_CALL_EARLY $fieldMember->value = $_SESSION['userID']; + $fieldMember2->value = $_SESSION['userID']; // === end PHP_HOOK_EDIT_FIRST_CALL_EARLY } // PHP_HOOK_EDIT_START2 @@ -353,9 +299,13 @@ trait View { } else { // === start PHP_HOOK_EDIT_VALIDATED if (\array_key_exists('buttonAdd', $_POST)){ - $locals->addMember($fieldMember->value, $termID); + $locals->addMember(intval($fieldMember->value), $termID, 'anweiser'); } elseif (\array_key_exists('buttonSub', $_POST)){ - $locals->subMember($fieldMember->value, $termID); + $locals->subMember(intval($fieldMember->value), $termID, 'anweiser'); + } elseif (\array_key_exists('buttonAddFahrdienst', $_POST)){ + $locals->addMember(intval($fieldMember2->value), $termID, 'fahrdienst'); + } elseif (\array_key_exists('buttonSubFahrdienst', $_POST)){ + $locals->subMember(intval($fieldMember2->value), $termID, 'fahrdienst'); } // === end PHP_HOOK_EDIT_VALIDATED } @@ -380,7 +330,8 @@ trait View { $storageAllowed = true; $buttonName = 'buttonSave'; // === start PHP_HOOK_EDIT_HTML - $fieldMembers->value = $locals->membersOfTerm($termID); + $fieldMembers->value = $locals->membersOfTerm($termID, 'anweiser'); + $fieldMembers2->value = $locals->membersOfTerm($termID, 'fahrdienst'); // === end PHP_HOOK_EDIT_HTML $common->switchConditional($content, 'SNIPPET_IF_2', null, 'role', '1,2', false, $snippets, $config); $common->switchConditional($content, 'SNIPPET_IF_3', null, 'role', '3,4', false, $snippets, $config); @@ -406,9 +357,9 @@ trait View { { // PHP_HOOK_DELETE_INIT [ - $snippets, - $config - ] = $this->_getSnippetsAndConfig($this->_build['delete'], 'delete'); + $config, + $snippets + ] = $this->simpleConfigurationAndSnippet('terms', 'delete'); $sysflags = TS\Controller::getInstance(); $record = null; if (\array_key_exists('termID', $_GET)){ @@ -492,15 +443,13 @@ trait View { */ public function base() { + $common = TC\Controller::getInstance(); // PHP_HOOK_VIEW_BUILD_METHOD_BASE $html = $this->buildBase(); - $macros = $this->_getConfiguration($this->_build['base'], 'base'); - $common = TC\Controller::getInstance(); - $locals = LOC\Controller::getInstance(); - $html = $common->buildFullPage($macros, $html); - $locals->adaptFullPage($html); - $this->_showHTML($html); + $macros = $this->simpleConfiguration('terms', 'base'); + $frame = $common->createFullPage($html, 'terms', 'base', $macros); + $this->_showHTML($frame); return $html; } @@ -513,15 +462,13 @@ trait View { */ public function new() { + $common = TC\Controller::getInstance(); // PHP_HOOK_VIEW_BUILD_METHOD_NEW $html = $this->buildNew(); - $macros = $this->_getConfiguration($this->_build['new'], 'new'); - $common = TC\Controller::getInstance(); - $locals = LOC\Controller::getInstance(); - $html = $common->buildFullPage($macros, $html); - $locals->adaptFullPage($html); - $this->_showHTML($html); + $macros = $this->simpleConfiguration('terms', 'new'); + $frame = $common->createFullPage($html, 'terms', 'new', $macros); + $this->_showHTML($frame); return $html; } @@ -534,15 +481,13 @@ trait View { */ public function edit() { + $common = TC\Controller::getInstance(); // PHP_HOOK_VIEW_BUILD_METHOD_EDIT $html = $this->buildEdit(); - $macros = $this->_getConfiguration($this->_build['edit'], 'edit'); - $common = TC\Controller::getInstance(); - $locals = LOC\Controller::getInstance(); - $html = $common->buildFullPage($macros, $html); - $locals->adaptFullPage($html); - $this->_showHTML($html); + $macros = $this->simpleConfiguration('terms', 'edit'); + $frame = $common->createFullPage($html, 'terms', 'edit', $macros); + $this->_showHTML($frame); return $html; } @@ -555,15 +500,13 @@ trait View { */ public function delete() { + $common = TC\Controller::getInstance(); // PHP_HOOK_VIEW_BUILD_METHOD_DELETE $html = $this->buildDelete(); - $macros = $this->_getConfiguration($this->_build['delete'], 'delete'); - $common = TC\Controller::getInstance(); - $locals = LOC\Controller::getInstance(); - $html = $common->buildFullPage($macros, $html); - $locals->adaptFullPage($html); - $this->_showHTML($html); + $macros = $this->simpleConfiguration('terms', 'delete'); + $frame = $common->createFullPage($html, 'terms', 'delete', $macros); + $this->_showHTML($frame); return $html; } diff --git a/config/changes/version.php b/config/changes/version.php index e6db836..4c076a4 100644 --- a/config/changes/version.php +++ b/config/changes/version.php @@ -15,8 +15,8 @@ * * Die anderen Versionsnummern dienen nur der Information. */ -define ( 'APPLICATION_VERSION', 'WCL2020.05.24.00' ); -define ( 'DB_VERSION', '2018.11.28.00' ); +define ( 'APPLICATION_VERSION', 'WCL2020.07.23.00' ); +define ( 'DB_VERSION', '2019.05.20.00' ); define ( 'TEST_DB_VERSION', '2018.11.07.00' ); define ( 'LIB_VERSION', defined ( 'SKELETON_VERSION' ) ? SKELETON_VERSION : '???' ); ?> diff --git a/public/css/page/common/blue.css b/public/css/page/common/blue.css new file mode 120000 index 0000000..b9ff524 --- /dev/null +++ b/public/css/page/common/blue.css @@ -0,0 +1 @@ +../../../../../skeleton/public/css/page/common/blue.css \ No newline at end of file diff --git a/public/css/page/common/gray.css b/public/css/page/common/gray.css new file mode 100644 index 0000000..8fc9296 --- /dev/null +++ b/public/css/page/common/gray.css @@ -0,0 +1,128 @@ +.navbar-nav a:hover.nav-link { + color: #FFF; +} +a.nav-link { + color: #CCC; +} +.tabs-modules a.nav-link { + color: #777; +} +.tabs-modules a:hover.nav-link { + color: #333; +} +.logout { + color: #CCC; + background-color: #333; + border-color: #CCC; +} +.logout:hover { + color: #000; + background-color: #BBB; + border-color: #333; +} +.db-table tr, .db-table th, .db-table td{ + border: grey solid 1px; +} +fieldset { + border: gray solid 1px; +} +.summary { + background-color: lightgray; +} +.ui-datepicker-header { + background: url('/public/img/vendor/jquery-ui/dark_leather.png') repeat 0 0 #000; + color: #e0e0e0; + -webkit-box-shadow: inset 0px 1px 1px 0px rgba(250, 250, 250, 2); + -moz-box-shadow: inset 0px 1px 1px 0px rgba(250, 250, 250, .2); + box-shadow: inset 0px 1px 1px 0px rgba(250, 250, 250, .2); + text-shadow: 1px -1px 0px #000; + border-color: #111; + filter: dropshadow(color=#000, offx=1, offy=-1); +} +.ui-datepicker-prev, .ui-datepicker-next { + background-image: url('/public/img/vendor/jquery-ui/arrow.png'); +} + +.ui-datepicker thead { + background-color: #f7f7f7; + background-image: -moz-linear-gradient(top, #f7f7f7 0%, #f1f1f1 100%); + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f7f7f7), color-stop(100%,#f1f1f1)); + background-image: -webkit-linear-gradient(top, #f7f7f7 0%,#f1f1f1 100%); + background-image: -o-linear-gradient(top, #f7f7f7 0%,#f1f1f1 100%); + background-image: -ms-linear-gradient(top, #f7f7f7 0%,#f1f1f1 100%); + background-image: linear-gradient(top, #f7f7f7 0%,#f1f1f1 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f7f7f7', endColorstr='#f1f1f1',GradientType=0 ); + border-bottom: 1px solid #bbb; +} + +.ui-datepicker th { + color: #666666; + text-shadow: 1px 0px 0px #fff; + filter: dropshadow(color=#fff, offx=1, offy=0); +} +.ui-datepicker tbody td { + border-right: 1px solid #bbb; +} +.ui-datepicker tbody tr { + border-bottom: 1px solid #bbb; +} +.ui-datepicker td span, .ui-datepicker td a { + color: #666666; + text-shadow: 1px 1px 0px #fff; + filter: dropshadow(color=#fff, offx=1, offy=1); +} +.ui-datepicker-calendar .ui-state-default { + background: #ededed; + background: -moz-linear-gradient(top, #ededed 0%, #dedede 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ededed), color-stop(100%,#dedede)); + background: -webkit-linear-gradient(top, #ededed 0%,#dedede 100%); + background: -o-linear-gradient(top, #ededed 0%,#dedede 100%); + background: -ms-linear-gradient(top, #ededed 0%,#dedede 100%); + background: linear-gradient(top, #ededed 0%,#dedede 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ededed', endColorstr='#dedede',GradientType=0 ); + -webkit-box-shadow: inset 1px 1px 0px 0px rgba(250, 250, 250, .5); + -moz-box-shadow: inset 1px 1px 0px 0px rgba(250, 250, 250, .5); + box-shadow: inset 1px 1px 0px 0px rgba(250, 250, 250, .5); +} +.ui-datepicker-calendar .ui-state-hover { + background: #f7f7f7; +} +.ui-datepicker-calendar .ui-state-active { + -webkit-box-shadow: inset 0px 0px 10px 0px rgba(0, 0, 0, .1); + -moz-box-shadow: inset 0px 0px 10px 0px rgba(0, 0, 0, .1); + box-shadow: inset 0px 0px 10px 0px rgba(0, 0, 0, .1); + color: #e0e0e0; +} +.ui-datepicker-calendar .ui-state-disabled { + background: #ededed; +} +.ui-datepicker-unselectable .ui-state-default { + background: #f4f4f4; + color: #b4b3b3; +} +fieldset.fieldgroup-header { + background-color: white; +} +.tab-pane .paging-block, +.tab-pane .table { + background-color: white; +} +.field-set-pane { + border: solid black 1px; +} +.pseudo-button { + border: solid 2px #babab9; + background-color: #e8e8e7; +} +.customtable tr, .customtable th, .customtable td{ + border: grey solid 1px; +} +.tabs-modules a.tab-module-link { + background-color: #f0f0f0; + border-color: #111; + border: solid 1px black; +} +.page-link:hover { + color: black; +} + diff --git a/public/css/page/common/green.css b/public/css/page/common/green.css new file mode 120000 index 0000000..4e2bf50 --- /dev/null +++ b/public/css/page/common/green.css @@ -0,0 +1 @@ +../../../../../skeleton/public/css/page/common/green.css \ No newline at end of file diff --git a/public/css/page/common/local.css b/public/css/page/common/local.css index de23d49..b4d5b41 100644 --- a/public/css/page/common/local.css +++ b/public/css/page/common/local.css @@ -130,4 +130,7 @@ input, .pseudo-field { .filtered-text { background-color: #e4eda3; -} \ No newline at end of file +} +.table tr:hover { + background: #e4eda3 !important; +} diff --git a/tools/generator/terms.module b/tools/generator/terms.module index ddeba02..0d41f55 100644 --- a/tools/generator/terms.module +++ b/tools/generator/terms.module @@ -16,6 +16,7 @@ module Terms Term dbfield term_id "Id" int primary dbfield userterm_term " " int ref:terms.term_id dbfield userterm_user " " int ref:loginusers.user_id + dbfield userterm_type " " text size:16 end.dbtable dbtable loginusers user @@ -47,6 +48,10 @@ module Terms Term page base "Termine" option.page sql.getall:PHP_HOOK_SQL_GET_ALL option.page sql.getall.count:PHP_HOOK_SQL_GET_ALL_COUNT + section panel.filter + filterfield filterDate "Start" 2 4 term_date date.lowerbound + button buttonSearch "Suchen" 2 4 none + end.section section panel.fields empty.line if role in 1,2 @@ -55,9 +60,9 @@ module Terms Term end.if end.section section table - option.table viewed:term_id:term_date:term_name:members:term_info + option.table viewed:term_id:term_date:term_name:members:members2:term_info option.table sorted:term_id:term_date:term_name - option.table heads:"Id":"Datum":"Bezeichnung":"Platzanweiser":"Bemerkung" + option.table heads:"Id":"Datum":"Bezeichnung":"Platzanweiser":"Fahrdienst":"Bemerkung" option.table edit.by.dialog option.table delete.by.dialog end.section @@ -76,11 +81,17 @@ module Terms Term dbreference term_name 2 4 dbreference term_date 2 4 dbreference term_info 2 10 - field members "Platzanweiser" text 2 10 rows:3 readonly no.storage + field members "Platzanweiser" text 2 10 rows:3 readonly no.storage field member "Ändern" int 2 4 combobox undef no.storage button buttonAdd "Hinzufügen" 0 3 none button buttonSub "Entfernen" 0 3 none empty.line + field members2 "Fahrdienst" text 2 10 rows:3 readonly no.storage + field member2 "Ändern" int 2 4 combobox undef no.storage + button buttonAddFahrdienst "Hinzufügen" 0 3 none + button buttonSubFahrdienst "Entfernen" 0 3 none + empty.line + empty.line if role in 1,2 button buttonSave "Speichern" 2 4 save.and.exit end.if diff --git a/tools/generator/terms.snippets.php b/tools/generator/terms.snippets.php index 8aecdc0..22d1af7 100644 --- a/tools/generator/terms.snippets.php +++ b/tools/generator/terms.snippets.php @@ -4,7 +4,8 @@ SELECT FROM terms tt WHERE - tt.deletedat is null + tt.term_date >= :date + AND tt.deletedat is null PHP_HOOK_SQL_GET_ALL_COUNT: SELECT @@ -12,28 +13,40 @@ SELECT FROM terms tt WHERE - tt.deletedat is null + tt.term_date >= :date + AND tt.deletedat is null PHP_HOOK_EDIT_FIELDSET_COMPLETE_FIELDS: $common->fillUserCombobox($fieldMember, [1, 27, 30], false); + $common->fillUserCombobox($fieldMember2, [1, 27, 30], false); PHP_HOOK_EDIT_VALIDATED: if (\array_key_exists('buttonAdd', $_POST)){ - $locals->addMember($fieldMember->value, $termID); + $locals->addMember(intval($fieldMember->value), $termID, 'anweiser'); } elseif (\array_key_exists('buttonSub', $_POST)){ - $locals->subMember($fieldMember->value, $termID); + $locals->subMember(intval($fieldMember->value), $termID, 'anweiser'); + } elseif (\array_key_exists('buttonAddFahrdienst', $_POST)){ + $locals->addMember(intval($fieldMember2->value), $termID, 'fahrdienst'); + } elseif (\array_key_exists('buttonSubFahrdienst', $_POST)){ + $locals->subMember(intval($fieldMember2->value), $termID, 'fahrdienst'); } PHP_HOOK_EDIT_HTML: - $fieldMembers->value = $locals->membersOfTerm($termID); + $fieldMembers->value = $locals->membersOfTerm($termID, 'anweiser'); + $fieldMembers2->value = $locals->membersOfTerm($termID, 'fahrdienst'); PHP_HOOK_BASE_TABLE_ROW_ADAPTION: - $rec['members'] = $locals->membersOfTerm($rec['term_id']); + $rec['members'] = $locals->membersOfTerm($rec['term_id'], 'anweiser'); + $rec['members2'] = $locals->membersOfTerm($rec['term_id'], 'fahrdienst'); PHP_HOOK_EDIT_FIRST_CALL_EARLY: $fieldMember->value = $_SESSION['userID']; + $fieldMember2->value = $_SESSION['userID']; PHP_HOOK_BASE_TABLE_RECORDS_ADAPTION: $deleteAllowed = $_SESSION['roleID'] <= 2; +PHP_HOOK_BASE_FIRST_CALL: + $fieldDate->value = new \DateTime(); + END: \ No newline at end of file