diff options
author | Philip Häusler <msquare@notrademark.de> | 2014-03-09 13:12:46 +0100 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2014-03-09 13:12:46 +0100 |
commit | 98f355cd86828ccb8a24f24ab06c29d53bff530c (patch) | |
tree | 7fa647c06f260ffcb8a7c8189fb4ed8d02c88b18 /includes | |
parent | 893bb5a9cf365c831e75fafc83dffdbced09a466 (diff) |
added angeltype description
Diffstat (limited to 'includes')
-rw-r--r-- | includes/controller/angeltypes_controller.php | 12 | ||||
-rw-r--r-- | includes/model/AngelType_model.php | 12 | ||||
-rw-r--r-- | includes/view/AngelTypes_view.php | 11 |
3 files changed, 25 insertions, 10 deletions
diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php index fbbdbb84..d3690645 100644 --- a/includes/controller/angeltypes_controller.php +++ b/includes/controller/angeltypes_controller.php @@ -77,6 +77,8 @@ function angeltype_edit_controller() { $name = ""; $restricted = false; + $description = ""; + if (isset($_REQUEST['angeltype_id'])) { $angeltype = AngelType($_REQUEST['angeltype_id']); if ($angeltype === false) @@ -86,6 +88,7 @@ function angeltype_edit_controller() { $name = $angeltype['name']; $restricted = $angeltype['restricted']; + $description = $angeltype['description']; } if (isset($_REQUEST['submit'])) { @@ -101,16 +104,19 @@ function angeltype_edit_controller() { $restricted = isset($_REQUEST['restricted']); + if (isset($_REQUEST['description'])) + $description = strip_request_item_nl('description'); + if ($ok) { $restricted = $restricted ? 1 : 0; if (isset($angeltype)) { - $result = AngelType_update($angeltype['id'], $name, $restricted); + $result = AngelType_update($angeltype['id'], $name, $restricted, $description); if ($result === false) engelsystem_error("Unable to update angeltype."); engelsystem_log("Updated angeltype: " . $name . ", restricted: " . $restricted); $angeltype_id = $angeltype['id']; } else { - $angeltype_id = AngelType_create($name, $restricted); + $angeltype_id = AngelType_create($name, $restricted, $description); if ($angeltype_id === false) engelsystem_error("Unable to create angeltype."); engelsystem_log("Created angeltype: " . $name . ", restricted: " . $restricted); @@ -123,7 +129,7 @@ function angeltype_edit_controller() { return array( isset($angeltype) ? sprintf(_("Edit %s"), $name) : _("Add new angeltype"), - AngelType_edit_view($name, $restricted) + AngelType_edit_view($name, $restricted, $description) ); } diff --git a/includes/model/AngelType_model.php b/includes/model/AngelType_model.php index 180712b2..8f577571 100644 --- a/includes/model/AngelType_model.php +++ b/includes/model/AngelType_model.php @@ -17,12 +17,14 @@ function AngelType_delete($angeltype) { * @param int $angeltype_id * @param string $name * @param boolean $restricted + * @param string $description */ -function AngelType_update($angeltype_id, $name, $restricted) { +function AngelType_update($angeltype_id, $name, $restricted, $description) { return sql_query(" UPDATE `AngelTypes` SET `name`='" . sql_escape($name) . "', - `restricted`=" . sql_escape($restricted ? 1 : 0) . " + `restricted`=" . sql_escape($restricted ? 1 : 0) . ", + `description`='" . sql_escape($description) . "' WHERE `id`=" . sql_escape($angeltype_id) . " LIMIT 1"); } @@ -32,13 +34,15 @@ function AngelType_update($angeltype_id, $name, $restricted) { * * @param string $name * @param boolean $restricted + * @param string $description * @return New Angeltype id */ -function AngelType_create($name, $restricted) { +function AngelType_create($name, $restricted, $description) { $result = sql_query(" INSERT INTO `AngelTypes` SET `name`='" . sql_escape($name) . "', - `restricted`=" . sql_escape($restricted ? 1 : 0)); + `restricted`=" . sql_escape($restricted ? 1 : 0) . " + `description`='" . sql_escape($description) . "'"); if ($result === false) return false; return sql_id(); diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php index f0ab0e42..e8e1f56d 100644 --- a/includes/view/AngelTypes_view.php +++ b/includes/view/AngelTypes_view.php @@ -10,7 +10,7 @@ function AngelType_delete_view($angeltype) { )); } -function AngelType_edit_view($name, $restricted) { +function AngelType_edit_view($name, $restricted, $description) { return page(array( buttons(array( button(page_link_to('angeltypes'), _("Angeltypes"), 'back') @@ -20,6 +20,8 @@ function AngelType_edit_view($name, $restricted) { form_text('name', _("Name"), $name), form_checkbox('restricted', _("Restricted"), $restricted), form_info("", _("Restricted angel types can only be used by an angel if enabled by an archangel (double opt-in).")), + form_textarea('description', _("Description"), $description), + form_info("", _("Please use markdown for the description.")), form_submit('submit', _("Save")) )) )); @@ -48,8 +50,11 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel buttons($buttons) ); - // $page[] = '<h3>' . _("Info") . '</h3>'; - // Description + Team-Coordinators + $page[] = '<h3>' . _("Description") . '</h3>'; + $parsedown = new Parsedown(); + $page[] = $parsedown->parse($angeltype['description']); + + // Team-Coordinators list missing $page[] = '<h3>' . _("Members") . '</h3>'; $members_confirmed = array(); |