[opw-web] Edit Program: Add button to mark undecided applications as rejected



commit d7bbc74d29d6cee27fd7bc20a35598d7021c0343
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sun Apr 30 18:55:55 2017 -0400

    Edit Program: Add button to mark undecided applications as rejected
    
    After all projects have been selected, it's useful to be able to mass-reject
    the remaining undecided projects. There's no super-natural place for this
    (View Applications is broken up by organization), so just wedge it into
    the center "Edit Program" screen where an admin would go to handle other
    program-global tasks.

 lang/en-gb.php                                     |    1 +
 modules/mod_manage_programs.php                    |   10 ++++++++++
 .../html/tpl_manage_programs_editor.html           |    6 ++++++
 3 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/lang/en-gb.php b/lang/en-gb.php
index be80226..27ea2dc 100644
--- a/lang/en-gb.php
+++ b/lang/en-gb.php
@@ -114,6 +114,7 @@ $lang_data = array(
     'mentor_contract'       => 'Mentor agreement',
     'sample_contract_link'  => 'Link to sample agreement',
     'enable_contracts'      => 'Users can accept agreements',
+    'reject_undecided'      => 'Mark undecided applications as rejected',
     'dl_student'            => 'Application deadline',
     'dl_mentor'             => 'Selection deadline',
     'show_deadlines'        => 'Show deadlines',
diff --git a/modules/mod_manage_programs.php b/modules/mod_manage_programs.php
index 9a0f129..79db2c3 100644
--- a/modules/mod_manage_programs.php
+++ b/modules/mod_manage_programs.php
@@ -23,6 +23,7 @@ $page = $core->variable('pg', 1);
 $limit_start = ($page - 1) * $config->per_page;
 
 $program_save = isset($_POST['program_save']);
+$reject_undecided = isset($_POST['reject_undecided']);
 $confirm = isset($_POST['yes']);
 
 // Serve the page based on the action
@@ -71,6 +72,15 @@ if ($action == 'list')
     $module_title = $lang->get('manage_programs');
     $module_data = $skin->output('tpl_manage_programs');
 }
+else if ($action == 'editor' && $reject_undecided)
+{
+  $user->check_csrf();
+  $sql = "UPDATE {$db->prefix}projects SET is_accepted = 0 " .
+         "WHERE is_accepted = -1 " .
+         "  AND program_id = :id";
+  $db->query($sql, array('id' => $id));
+  $core->redirect("?q=manage_programs&a=editor&p={$id}");
+}
 else if ($action == 'editor')
 {
     $page_title = $id == 0 ? $lang->get('add_program') : $lang->get('edit_program');
diff --git a/skins/easterngreen/html/tpl_manage_programs_editor.html 
b/skins/easterngreen/html/tpl_manage_programs_editor.html
index 2cbef5b..eee3b09 100644
--- a/skins/easterngreen/html/tpl_manage_programs_editor.html
+++ b/skins/easterngreen/html/tpl_manage_programs_editor.html
@@ -89,6 +89,12 @@
     </div>
 </div>
 
+<div class="control-group">
+  <button type="submit" name="reject_undecided" class="btn">
+    {{reject_undecided}}
+  </button>
+</div>
+
 <div class="form-actions">
     <button type="submit" name="program_save" class="btn btn-primary">
         <i class="icon-ok-sign icon-white"></i>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]