angeltypes about section

This commit is contained in:
Philip Häusler 2014-03-09 13:39:04 +01:00
parent 98f355cd86
commit f40b78faac
7 changed files with 60 additions and 9 deletions

View File

@ -27,6 +27,9 @@ function angeltypes_controller() {
case 'delete':
list($title, $content) = angeltype_delete_controller();
break;
case 'about':
list($title, $content) = angeltypes_about_controller();
break;
}
return array(
@ -35,6 +38,22 @@ function angeltypes_controller() {
);
}
/**
* Job description for all angeltypes (public to everyone)
*/
function angeltypes_about_controller() {
global $privileges, $user;
$angeltypes = AngelTypes();
if ($angeltypes === false)
engelsystem_error("Unable to load angeltypes.");
return array(
_("Teams/Engeltypes description"),
AngelTypes_about_view($angeltypes)
);
}
/**
* Delete an Angeltype.
*/
@ -139,6 +158,9 @@ function angeltype_edit_controller() {
function angeltype_controller() {
global $privileges, $user;
if (! in_array('angeltypes', $privileges))
redirect('?');
if (! isset($_REQUEST['angeltype_id']))
redirect(page_link_to('angeltypes'));
@ -168,6 +190,9 @@ function angeltype_controller() {
function angeltypes_list_controller() {
global $privileges, $user;
if (! in_array('angeltypes', $privileges))
redirect('?');
$angeltypes = AngelTypes_with_user($user);
if ($angeltypes === false)
engelsystem_error("Unable to load angeltypes.");

View File

@ -99,6 +99,16 @@ function AngelTypes_with_user($user) {
ORDER BY `name`");
}
/**
* Returns all angeltypes.
*/
function AngelTypes() {
return sql_select("
SELECT *
FROM `AngelTypes`
ORDER BY `name`");
}
/**
* Returns AngelType id array
*/

View File

@ -13,7 +13,7 @@ function logout_title() {
// Engel registrieren
function guest_register() {
global $tshirt_sizes, $enable_tshirt_size, $default_theme, $faq_url;
global $tshirt_sizes, $enable_tshirt_size, $default_theme;
$msg = "";
$nick = "";
@ -153,7 +153,7 @@ function guest_register() {
form_text('hometown', _("Hometown"), $hometown),
$enable_tshirt_size ? form_select('tshirt_size', _("Shirt size") . "*", $tshirt_sizes, $tshirt_size) : '',
// form_textarea('comment', _("Did you help at former CCC events and which tasks have you performed then?"), $comment),
form_checkboxes('angel_types', _("What do you want to do?") . sprintf("<br>(<a href=\"%s\">%s</a>)", $faq_url, _("Description of job types")), $angel_types, $selected_angel_types),
form_checkboxes('angel_types', _("What do you want to do?") . sprintf("<br>(<a href=\"%s\">%s</a>)", page_link_to('angeltypes') . '&action=about', _("Description of job types")), $angel_types, $selected_angel_types),
form_info("", _("Restricted angel types need will be confirmed later by an archangel. You can change your selection in the options section.")),
form_password('password', _("Password") . "*"),
form_password('password2', _("Confirm password") . "*"),

View File

@ -4,7 +4,7 @@ function settings_title() {
}
function user_settings() {
global $enable_tshirt_size, $tshirt_sizes, $themes, $locales, $faq_url;
global $enable_tshirt_size, $tshirt_sizes, $themes, $locales;
global $user;
$msg = "";
@ -180,7 +180,7 @@ function user_settings() {
form_text('jabber', _("Jabber"), $jabber),
form_text('hometown', _("Hometown"), $hometown),
$enable_tshirt_size ? form_select('tshirt_size', _("Shirt size"), $tshirt_sizes, $tshirt_size) : '',
form_checkboxes('angel_types', _("What do you want to do?") . sprintf("<br>(<a href=\"%s\">%s</a>)", $faq_url, _("Description of job types")), $angel_types, $selected_angel_types),
form_checkboxes('angel_types', _("What do you want to do?") . sprintf("<br>(<a href=\"%s\">%s</a>)", page_link_to('angeltypes') . '&action=about', _("Description of job types")), $angel_types, $selected_angel_types),
form_submit('submit', _("Save"))
)),
form(array(

View File

@ -292,7 +292,7 @@ function user_shifts() {
function view_user_shifts() {
global $user, $privileges;
global $ical_shifts, $faq_url;
global $ical_shifts;
$ical_shifts = array();
$days = sql_select_single_col("SELECT DISTINCT DATE(FROM_UNIXTIME(`start`)) AS `id`, DATE(FROM_UNIXTIME(`start`)) AS `name` FROM `Shifts` ORDER BY `start`");
@ -726,7 +726,7 @@ function view_user_shifts() {
'end_time' => $_SESSION['user_shifts']['end_time'],
'type_select' => make_select($types, $_SESSION['user_shifts']['types'], "types", _("Tasks") . '<sup>1</sup>'),
'filled_select' => make_select($filled, $_SESSION['user_shifts']['filled'], "filled", _("Occupancy")),
'task_notice' => '<sup>1</sup>' . _("The tasks shown here are influenced by the preferences you defined in your settings!") . " <a href=\"" . $faq_url . "\">" . _("Description of the jobs.") . "</a>",
'task_notice' => '<sup>1</sup>' . _("The tasks shown here are influenced by the preferences you defined in your settings!") . " <a href=\"" . page_link_to('angeltypes') . '&action=about' . "\">" . _("Description of the jobs.") . "</a>",
'new_style_checkbox' => '<label><input type="checkbox" name="new_style" value="1" ' . ($_SESSION['user_shifts']['new_style'] ? ' checked' : '') . '> ' . _("Use new style if possible") . '</label>',
'shifts_table' => $shifts_table,
'ical_text' => '<h2>' . _("iCal export") . '</h2><p>' . sprintf(_("Export of shown shifts. <a href=\"%s\">iCal format</a> or <a href=\"%s\">JSON format</a> available (please keep secret, otherwise <a href=\"%s\">reset the api key</a>)."), page_link_to_absolute('ical') . '&key=' . $user['api_key'], page_link_to_absolute('shifts_json_export') . '&key=' . $user['api_key'], page_link_to('user_myshifts') . '&reset') . '</p>',

View File

@ -117,4 +117,19 @@ function AngelTypes_list_view($angeltypes, $admin_angeltypes) {
));
}
function AngelTypes_about_view($angeltypes) {
$content = array(
'<p>' . _("Here is the list of teams and their tasks:") . '</p>'
);
$parsedown = new Parsedown();
foreach ($angeltypes as $angeltype) {
$content[] = '<h2>' . $angeltype['name'] . '</h2>';
if ($angeltype['restricted'])
$content[] = info(_("This angeltype is restricted by double-opt-in by a team coordinator. Please show up at the according introduction meetings."), true);
$content[] = $parsedown->parse($angeltype['description']);
}
return page($content);
}
?>

View File

@ -77,7 +77,8 @@ $free_pages = array(
'shifts_json_export_all',
'user_password_recovery',
'api',
'credits'
'credits',
'angeltypes'
);
// Gewünschte Seite/Funktion