From 6ceec76e7d27798aeaf968afe2b800bffb9b30f1 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Wed, 27 Dec 2017 13:36:38 +0100 Subject: [PATCH] feature request: filter angel types based on account settings, closes #362 --- includes/model/UserAngelTypes_model.php | 17 ++++++++ includes/pages/user_shifts.php | 49 ++++++++++++++++------ locale/de_DE.UTF-8/LC_MESSAGES/default.mo | Bin 43684 -> 43711 bytes locale/de_DE.UTF-8/LC_MESSAGES/default.po | 8 +++- public/js/forms.js | 37 +++++++++------- 5 files changed, 80 insertions(+), 31 deletions(-) diff --git a/includes/model/UserAngelTypes_model.php b/includes/model/UserAngelTypes_model.php index 7b22e347..71901b97 100644 --- a/includes/model/UserAngelTypes_model.php +++ b/includes/model/UserAngelTypes_model.php @@ -226,3 +226,20 @@ function UserAngelType_by_User_and_AngelType($user, $angeltype) ] ); } + +/** + * Get an UserAngelTypes by user + * + * @param array $user + * @return array[]|null + */ +function UserAngelTypes_by_User($user) +{ + return DB::select(' + SELECT * + FROM `UserAngelTypes` + WHERE `user_id`=? + ', + [$user['UID']] + ); +} diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 2c30c86a..d822054e 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -186,6 +186,7 @@ function view_user_shifts() $session->set('ShiftsFilter', $shiftsFilter); } + /** @var ShiftsFilter $shiftsFilter */ $shiftsFilter = $session->get('ShiftsFilter'); update_ShiftsFilter($shiftsFilter, in_array('user_shifts_admin', $privileges), $days); @@ -214,6 +215,11 @@ function view_user_shifts() info(render_user_arrived_hint()); } + $ownTypes = []; + foreach (UserAngelTypes_by_User($user) as $type) { + $ownTypes[] = (int)$type['angeltype_id']; + } + return page([ div('col-md-12', [ msg(), @@ -238,7 +244,13 @@ function view_user_shifts() $types, $shiftsFilter->getTypes(), 'types', - _('Angeltypes') . '1' + _('Angeltypes') . '1', + [ + button( + 'javascript: checkOwnTypes(\'selection_types\', ' . json_encode($ownTypes) . ')', + _('Own') + ), + ] ), 'filled_select' => make_select($filled, $shiftsFilter->getFilled(), 'filled', _('Occupancy')), 'task_notice' => @@ -269,12 +281,12 @@ function view_user_shifts() /** * Returns a hint for the user how the ical feature works. */ -function ical_hint() { +function ical_hint() +{ global $user; return heading( - _('iCal export'), 2) - . '

' . sprintf( + _('iCal export'), 2) . '

' . sprintf( _('Export of shown shifts. iCal format or JSON format available (please keep secret, otherwise reset the api key).'), page_link_to('ical', ['key' => $user['api_key']]), page_link_to('shifts_json_export', ['key' => $user['api_key']]), @@ -291,15 +303,23 @@ function get_ids_from_array($array) return $array['id']; } -function make_select($items, $selected, $name, $title = null) +/** + * @param array $items + * @param array $selected + * @param string $name + * @param string $title + * @param array $additionalButtons + * @return string + */ +function make_select($items, $selected, $name, $title = null, $additionalButtons = []) { - $html_items = []; + $htmlItems = []; if (isset($title)) { - $html_items[] = '

' . $title . '

' . "\n"; + $htmlItems[] = '

' . $title . '

' . "\n"; } foreach ($items as $i) { - $html_items[] = '
' + $htmlItems[] = '
' . '' @@ -307,11 +327,14 @@ function make_select($items, $selected, $name, $title = null) . '

'; } $html = '
' . "\n"; - $html .= implode("\n", $html_items); - $html .= buttons([ - button('javascript: checkAll(\'selection_' . $name . '\', true)', _('All'), ''), - button('javascript: checkAll(\'selection_' . $name . '\', false)', _('None'), '') - ]); + $html .= implode("\n", $htmlItems); + + $buttons = []; + $buttons[] = button('javascript: checkAll(\'selection_' . $name . '\', true)', _('All')); + $buttons[] = button('javascript: checkAll(\'selection_' . $name . '\', false)', _('None')); + $buttons = array_merge($buttons, $additionalButtons); + $html .= buttons($buttons); + $html .= '
' . "\n"; return $html; } diff --git a/locale/de_DE.UTF-8/LC_MESSAGES/default.mo b/locale/de_DE.UTF-8/LC_MESSAGES/default.mo index a58c3a058f222f5f8b1c408670462b33c8e978a7..b7f8e94120f84e567df8664aac6498a46ecfbd89 100644 GIT binary patch delta 11467 zcmYk?2YgTG9>?($5fKtW5?M$h5{V>|SdG1c8bzv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u`x}Gj&Jzq3R|}veQX>+eJ1g*o@*&_*>i~6Q*KaO-nQtB`p^HBs9QW&jXi~9ZB?&(w|I%EwsXUJ|*9vv@xW>krEW4YfVs%Fq)KYoK_F_SW% zxFa^k=P?x@9WgdOWbMz1uZi<c&%ae5c*8jmp|2XDPp{mLr6^ zVfY0mQwk{h(N3a#PWdsaxvVoLbH=ToWd% z;W?ff=@ut@gKREk5N*p-KA==1Uw}VQDo_GwR|m^dB8mMdJBUMRcY~5n`JVg=>d;?z zkB*ZB6{(+KD?T8;Pkh0v=uam8HIQT#r8*}{a^ro(I?j_f#;y22%1p`{^4gwvs-|XF zCfh}+OwC)UzjE}aOnHiq(bVZ^Mj20>O9`{*0*D__hI8%{Pf)dTZbi;`Q+}gH#~se< zI89keypgh&a*BL5K1Z2F(J_)Tm$HfckSaLZQuKFNed^ZX7nC5%EJ`suiWJU$M%m-V zzw6EC#IF<`JE+XVKd_`{Pqk<-U(dyAVNp+$|4aFjQm?2bfAA4sCHC7IRDDb6)\n" "Language-Team: \n" "Language: de_DE\n" @@ -1867,6 +1867,10 @@ msgstr "belegt" msgid "free" msgstr "frei" +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:251 +msgid "Own" +msgstr "Eigene" + #: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:243 msgid "Occupancy" msgstr "Belegung" diff --git a/public/js/forms.js b/public/js/forms.js index c7f4a095..1efd80bb 100644 --- a/public/js/forms.js +++ b/public/js/forms.js @@ -1,20 +1,25 @@ /** - * Runs through the DOM under the element with the given id, finds all - * checkboxes and sets them to the wanted state. + * Sets all checkboxes to the wanted state * - * @param String - * id Id of the element containing all the checkboxes - * @param Boolean - * checked True if the checkboxes should be checked + * @param {string} id Id of the element containing all the checkboxes + * @param {bool} checked True if the checkboxes should be checked */ function checkAll(id, checked) { - var obj = document.getElementById(id); - var boxes = obj.getElementsByTagName("input"); - for (var i = 0; i < boxes.length; i++) { - if (boxes[i].type === "checkbox" && !boxes[i].disabled) { - boxes[i].checked = checked; - } - } + $("#" + id + " input[type='checkbox']").each(function () { + this.checked = checked; + }); +} + +/** + * Sets the checkboxes according to the given type + * + * @param {string} id The elements ID + * @param {list} shifts_list A list of numbers + */ +function checkOwnTypes(id, shifts_list) { + $('#' + id + ' input[type=checkbox]').each(function () { + this.checked = $.inArray(parseInt(this.value), shifts_list); + }); } /** @@ -82,8 +87,8 @@ $(function () { $("input[type='submit']").prop("readonly", true).addClass("disabled"); return true; }); - - $(".dropdown-menu").css("max-height", function() { - return ($(window).height() - 50) + "px"; + + $(".dropdown-menu").css("max-height", function () { + return ($(window).height() - 50) + "px"; }).css("overflow-y", "scroll"); });