From d8476f244dd0ee1bccaab53f123fa12f2a9c9501 Mon Sep 17 00:00:00 2001 From: msquare Date: Fri, 24 Nov 2017 10:02:52 +0100 Subject: complete feature contact info for angeltypes, fixes #275 --- includes/view/AngelTypes_view.php | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'includes/view/AngelTypes_view.php') diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php index baf0e04a..6e70b3be 100644 --- a/includes/view/AngelTypes_view.php +++ b/includes/view/AngelTypes_view.php @@ -92,15 +92,20 @@ function AngelType_edit_view($angeltype, $supporter_mode) _('Requires driver license'), $angeltype['requires_driver_license'] ), - //form_text('contact_name', _('Name'), $angeltype['contact_name']), - //form_text('contact_dect', _('DECT'), $angeltype['contact_dect']), - //form_text('contact_email', _('E-Mail'), $angeltype['contact_email']), form_info( '', _('Restricted angel types can only be used by an angel if enabled by a supporter (double opt-in).') ), form_textarea('description', _('Description'), $angeltype['description']), form_info('', _('Please use markdown for the description.')), + heading(_('Contact'), 3), + form_info( + '', + _('Primary contact person/desk for user questions.') + ), + form_text('contact_name', _('Name'), $angeltype['contact_name']), + form_text('contact_dect', _('DECT'), $angeltype['contact_dect']), + form_text('contact_email', _('E-Mail'), $angeltype['contact_email']), form_submit('submit', _('Save')) ]) ]); @@ -322,6 +327,10 @@ function AngelType_view( msg() ]; + if(AngelType_has_contact_info($angeltype)) { + $page[] = AngelTypes_render_contact_info($angeltype); + } + $page[] = '

' . _('Description') . '

'; $parsedown = new Parsedown(); if ($angeltype['description'] != '') { @@ -392,6 +401,20 @@ function AngelType_view( return page_with_title(sprintf(_('Team %s'), $angeltype['name']), $page); } +/** + * Renders the contact info + * + * @param Anteltype $angeltype + * @return string HTML + */ +function AngelTypes_render_contact_info($angeltype) { + return heading(_('Contact'), 3) . description([ + _('Name') => $angeltype['contact_name'], + _('DECT') => $angeltype['contact_dect'], + _('E-Mail') => $angeltype['contact_email'] + ]); +} + /** * Display the list of angeltypes. * @@ -431,6 +454,10 @@ function AngelTypes_about_view_angeltype($angeltype) $html = '

' . $angeltype['name'] . '

'; + if(AngelType_has_contact_info($angeltype)) { + $html .= AngelTypes_render_contact_info($angeltype); + } + if (isset($angeltype['user_angeltype_id'])) { $buttons = []; if ($angeltype['user_angeltype_id'] != null) { -- cgit v1.2.3-54-g00ecf