[opw-web] Improve role messages on front page



commit 1daaf2f92a8107569427f2591bc60e00539a2d3b
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sun Apr 20 00:11:34 2014 -0400

    Improve role messages on front page
    
    After the program announcement date, show different messages on
    the front pages for students who were accepted and not accepted.

 lang/en-gb.php                                |    4 ++-
 modules/mod_program_home.php                  |   42 +++++++++++++++++++++++++
 skins/easterngreen/html/tpl_program_home.html |   10 +++---
 3 files changed, 50 insertions(+), 6 deletions(-)
---
diff --git a/lang/en-gb.php b/lang/en-gb.php
index eac69a2..16ef5d6 100644
--- a/lang/en-gb.php
+++ b/lang/en-gb.php
@@ -137,7 +137,9 @@ $lang_data = array(
     'cancel_mentor'         => 'Cancel mentor application',
     'view_proposals'        => 'View project proposals',
     'resign_program'        => 'Resign from this program',
-    'role_student'          => 'You are applying for this program',
+    'role_student_applied'  => 'You are applying for this program',
+    'role_student_accepted' => 'You were accepted to this program!',
+    'role_student_rejected' => 'You were not accepted for this program. Please continue working with your 
organization and apply in a future round.',
     'role_mentor'           => 'You are a mentor for this program',
     'role_resigned'         => 'You have resigned from this program and cannot participate again',
     'role_rejected'         => 'Your mentorship application has been declined and you cannot participate in 
this program as a mentor',
diff --git a/modules/mod_program_home.php b/modules/mod_program_home.php
index efdf2c3..8dffe54 100644
--- a/modules/mod_program_home.php
+++ b/modules/mod_program_home.php
@@ -36,6 +36,47 @@ if ($program_data != null)
         'dl_mentor'     => date('M d Y, h:i a T', $program_data['dl_mentor']),
     ));
 
+    if ($role == 's')
+    {
+        if ($show_started) {
+            $sql = "SELECT COUNT(*) AS count " .
+                   "FROM {$db->prefix}participants p " .
+                   "LEFT JOIN {$db->prefix}projects prj " .
+                   "ON p.project_id = prj.id " .
+                   "WHERE p.username = :username " .
+                   "AND p.program_id = :program_id " .
+                   "AND prj.is_accepted = 1 ";
+
+            $row = $db->query($sql,
+                              array('program_id' => $program_data['id'],
+                                    'username' => $user->username),
+                              true);
+
+            if ($row['count'] > 0)
+                $role_message = $lang->get('role_student_accepted');
+            else
+                $role_message = $lang->get('role_student_rejected');
+        }
+        else
+            $role_message = $lang->get('role_student_applied');
+    }
+    else if ($role == 'm')
+    {
+        $role_message = $lang->get('role_mentor');
+    }
+    else if ($role == 'i')
+    {
+        $role_message = $lang->get('role_intermediate');
+    }
+    else if ($role == 'r')
+    {
+        $role_message = $lang->get('role_resigned');
+    }
+    else
+    {
+        $role_message = '';
+    }
+
     // Assign screen data for the program
     $skin->assign(array(
         'program_id'               => $program_data['id'],
@@ -46,6 +87,7 @@ if ($program_data != null)
         'student_deadlines'        => $lang->get('student_dl_info'),
         'mentor_deadlines'         => $lang->get('mentor_dl_info'),
         'return_url'               => urlencode($core->request_uri()),
+        'role_message'             => $role_message,
         'prg_guest_visibility'     => $skin->visibility($role == 'g' || $role == 'r'),
         'prg_resign_visibility'    => $skin->visibility(false),
         'prg_rejected_visibility'  => $skin->visibility($role == 'x'),
diff --git a/skins/easterngreen/html/tpl_program_home.html b/skins/easterngreen/html/tpl_program_home.html
index 0394282..fd456f4 100644
--- a/skins/easterngreen/html/tpl_program_home.html
+++ b/skins/easterngreen/html/tpl_program_home.html
@@ -76,14 +76,14 @@
         <div class="[[prg_resign_visibility]]">
             <h4 class="resign-notice">
                 <i class="icon-user"></i>
-                {{role_resigned}}
+                [[role_message]]
             </h4>
         </div>
 
         <div class="[[prg_student_visibility]]">
             <h4>
                 <i class="icon-user"></i>
-                {{role_student}}
+                [[role_message]]
             </h4>
 
             <a href="?q=view_projects&amp;a=editor&amp;prg=[[program_id]]" class="btn btn-large 
[[dl_student_visibility]]">
@@ -109,7 +109,7 @@
         <div class="[[prg_interm_visibility]]">
             <h4>
                 <i class="icon-user"></i>
-                {{role_intermediate}}
+                [[role_message]]
             </h4>
 
             <div class="resign-block">
@@ -122,7 +122,7 @@
         <div class="[[prg_mentor_visibility]]">
             <h4>
                 <i class="icon-user"></i>
-                {{role_mentor}}
+                [[role_message]]
             </h4>
 
             <a href="?q=manage_projects&amp;prg=[[program_id]]" class="btn btn-large 
[[dl_mentor_visibility]]">
@@ -145,7 +145,7 @@
         <div class="[[prg_rejected_visibility]]">
             <h4 class="rejected-notice">
                 <i class="icon-user"></i>
-                {{role_rejected}}
+                [[role_message]]
             </h4>
         </div>
 


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