[scu-smp] r275 committed - Complete - issue 43: Expire Mentee\Mentor and their connection ...

0 views
Skip to first unread message

scu...@googlecode.com

unread,
Oct 2, 2010, 3:52:26 AM10/2/10
to scu...@googlegroups.com
Revision: 275
Author: sid.moradi
Date: Sat Oct 2 00:51:21 2010
Log: Complete - issue 43: Expire Mentee\Mentor and their connection
http://code.google.com/p/scu-smp/issues/detail?id=43

* Some minor Refactoring
http://code.google.com/p/scu-smp/source/detail?r=275

Added:
/trunk/smp-php/smp/view/search/menteeSearchFullPanel.php
Modified:
/trunk/smp-php/smp/command/mentee/ExpireMenteeFormCommand.php
/trunk/smp-php/smp/command/mentee/ListAllMenteeCommand.php
/trunk/smp-php/smp/command/mentee/UndoExpireMenteeFormCommand.php
/trunk/smp-php/smp/command/mentor/ExpireMentorFormCommand.php
/trunk/smp-php/smp/command/mentor/ListAllMentorCommand.php
/trunk/smp-php/smp/command/mentor/UndoExpireMentorFormCommand.php
/trunk/smp-php/smp/datagrid/MenteeDatagrid.php
/trunk/smp-php/smp/view/common/menu.php
/trunk/smp-php/smp/view/mentee/listAllMentee.php
/trunk/smp-php/smp/view/mentee/listMatchedMentee.php
/trunk/smp-php/smp/view/mentor/listAllMentor.php
/trunk/smp-php/smp/view/mentor/listMatchedMentor.php
/trunk/smp-php/smp/view/search/menteeSearchExpiredPanel.php
/trunk/smp-php/smp/view/search/menteeSearchPanel.php

=======================================
--- /dev/null
+++ /trunk/smp-php/smp/view/search/menteeSearchFullPanel.php Sat Oct 2
00:51:21 2010
@@ -0,0 +1,62 @@
+<?php
+/**
+ * Created at 02/10/2010 4:57:17 PM
+ * smp/view/search/menteeSearchFullPanel
+ *
+ * @author <a href="mailto:smor...@scu.edu.au">Sid</a>
+ * @version 1.0
+ */
+require_once('smp/util/FormBuilder.php');
+
+$indent = " ";
+
+print $indent . "<a onClick=\"return toggleMe('menteeSearchDiv')\">\r\n";
+print $indent . " <div class=\"searchHeader\">Mentee Search
Panel</div>\r\n";
+print $indent . "</a>\r\n";
+
+print $indent . "<div id=\"menteeSearchDiv\" class=\"searchPanel\">\r\n";
+$searchForm = new smp_util_FormBuilder();
+$searchForm->setIndent($indent. " ");
+
+if ($searchForm->isPost()) {
+ $searchForm->setValues($request->getProperties());
+}
+if (!is_null($request->getSearchEntity())) {
+ $mentee = $request->getSearchEntity();
+ $searchForm->setValue('firstname', $mentee->getStudent()->getFirstname());
+ $searchForm->setValue('lastname', $mentee->getStudent()->getLastname());
+ $searchForm->setValue('studentNumber',
$mentee->getStudent()->getStudentNumber());
+ $searchForm->setValue('courseId', $mentee->getStudent()->getCourseId());
+ $searchForm->setValue('gender', $mentee->getStudent()->getGender());
+ $searchForm->setValue('studyMode', $mentee->getStudent()->getStudyMode());
+ $searchForm->setValue('expired', $mentee->getExpired());
+ $searchForm->setValue('matched', $mentee->getMatched());
+}
+
+print $searchForm->open('menteeSearchForm', "form_container",
$_SERVER['REQUEST_URI']);
+print $searchForm->hidden(Constants::ACTION, Constants::ACTION_SEARCH);
+print $searchForm->label('firstname','Firstname:', 'grid_1');
+print $searchForm->textBox('firstname', null,
null,1,'grid_2','smallinput');
+print $searchForm->label('lastname','Lastname:', 'grid_1');
+print $searchForm->textBox('lastname', null, null,1,'grid_2','smallinput');
+print $searchForm->label('studentNumber','StudentNumber:', 'grid_1');
+print $searchForm->textBox('studentNumber', null,
null,1,'grid_4','smallinput');
+
+print $searchForm->label('courseId','Course:', 'grid_1');
+print $searchForm->selectBox('courseId', null, null,1,'grid_2',
VH::getDynamicArray('course', true),'smallinput');
+print $searchForm->label('gender','Gender:', 'grid_1');
+print $searchForm->selectBox('gender', null, null,1,'grid_2',
VH::getFixArray('gender', true),'smallinput');
+print $searchForm->label('studyMode','StudyMode:', 'grid_1');
+print $searchForm->selectBox('studyMode', null, null,1,'grid_3',
VH::getFixArray('study_mode', true),'input');
+print $searchForm->button('clearButton', 'Clear', 'button',
1,'grid_1', 'button', array('onClick'=>'clearForm(this.form)'));
+
+print $searchForm->label("expired" , "Expired:", "grid_1");
+print $searchForm->checkBox("expired", "", 1, "grid_2");
+print $searchForm->label("matched" , "Matched:", "grid_1");
+print $searchForm->checkBox("matched", "", 1, "grid_2");
+print $searchForm->label("empty_space" , "&nbsp;", "grid_4");
+
+
+print $searchForm->button('searchButton', 'Search', 'submit', 1,'grid_1');
+print $searchForm->close();
+print $indent . "</div>\r\n";
=======================================
--- /trunk/smp-php/smp/command/mentee/ExpireMenteeFormCommand.php Fri Oct
1 23:34:50 2010
+++ /trunk/smp-php/smp/command/mentee/ExpireMenteeFormCommand.php Sat Oct
2 00:51:21 2010
@@ -25,7 +25,7 @@
}
}

- $request->redirect("mentee/listMatchedMentee");
+ $request->redirect($request->getProperty('next'));
}

function doSecurity() {
=======================================
--- /trunk/smp-php/smp/command/mentee/ListAllMenteeCommand.php Fri Sep 10
00:00:54 2010
+++ /trunk/smp-php/smp/command/mentee/ListAllMenteeCommand.php Sat Oct 2
00:51:21 2010
@@ -25,14 +25,12 @@
$student->setGender($request->getProperty('gender'));
$student->setCourseId($request->getProperty('courseId'));
$student->setStudyMode($request->getProperty('studyMode'));
-
- $action = $request->getProperty(Constants::ACTION);
- if($action == Constants::ACTION_SEARCH){
- $mentee->setStudent($student);
-
smp_base_SessionRegistry::setSearchEntity('mentee_ListAllMentee_MenteeSearch',
$mentee);
- }
- }
-
+ $mentee->setExpired((is_null($request->getProperty('expired')) ? null :
true));
+ $mentee->setMatched((is_null($request->getProperty('matched')) ? null :
true));
+
+ $mentee->setStudent($student);
+
smp_base_SessionRegistry::setSearchEntity('mentee_ListAllMentee_MenteeSearch',
$mentee);
+ }
$mentee =
smp_base_SessionRegistry::getSearchEntity('mentee_ListAllMentee_MenteeSearch');
$request->setSearchEntity($mentee);

=======================================
--- /trunk/smp-php/smp/command/mentee/UndoExpireMenteeFormCommand.php Fri
Oct 1 23:34:50 2010
+++ /trunk/smp-php/smp/command/mentee/UndoExpireMenteeFormCommand.php Sat
Oct 2 00:51:21 2010
@@ -25,7 +25,7 @@
}
}

- $request->redirect("mentee/listMatchedMentee");
+ $request->redirect($request->getProperty('next'));
}

function doSecurity() {
=======================================
--- /trunk/smp-php/smp/command/mentor/ExpireMentorFormCommand.php Tue Sep
21 05:27:40 2010
+++ /trunk/smp-php/smp/command/mentor/ExpireMentorFormCommand.php Sat Oct
2 00:51:21 2010
@@ -24,7 +24,7 @@
}
}

- $request->redirect("mentor/listMatchedMentor");
+ $request->redirect($request->getProperty('next'));
}

function doSecurity() {
=======================================
--- /trunk/smp-php/smp/command/mentor/ListAllMentorCommand.php Mon Sep 20
01:10:16 2010
+++ /trunk/smp-php/smp/command/mentor/ListAllMentorCommand.php Sat Oct 2
00:51:21 2010
@@ -24,9 +24,9 @@
$student->setGender($request->getProperty('gender'));
$student->setCourseId($request->getProperty('courseId'));
$student->setStudyMode($request->getProperty('studyMode'));
- $mentor->setExpired($request->getProperty('expired'));
- $mentor->setMatched($request->getProperty('matched'));
- $mentor->setTrained($request->getProperty('trained'));
+ $mentor->setExpired((is_null($request->getProperty('expired')) ? null :
true));
+ $mentor->setMatched((is_null($request->getProperty('matched')) ? null :
true));
+ $mentor->setTrained((is_null($request->getProperty('trained')) ? null :
true));

$mentor->setStudent($student);

smp_base_SessionRegistry::setSearchEntity('mentor_ListAllMentor_MentorSearch',
$mentor);
=======================================
--- /trunk/smp-php/smp/command/mentor/UndoExpireMentorFormCommand.php Fri
Oct 1 23:34:50 2010
+++ /trunk/smp-php/smp/command/mentor/UndoExpireMentorFormCommand.php Sat
Oct 2 00:51:21 2010
@@ -23,8 +23,8 @@
$request->addError("Selected Mentor by id [".$mentorId."] did not
updated as Not Expired Mentor.");
}
}
-
- $request->redirect("mentor/listMatchedMentor");
+
+ $request->redirect($request->getProperty('next'));
}

function doSecurity() {
=======================================
--- /trunk/smp-php/smp/datagrid/MenteeDatagrid.php Fri Oct 1 23:34:50 2010
+++ /trunk/smp-php/smp/datagrid/MenteeDatagrid.php Sat Oct 2 00:51:21 2010
@@ -23,7 +23,7 @@
$menteeSearchCriteria = (!is_null($mentee) ?
self::getSearchCriteria($mentee, 'smp_mentee.', true) : "");
$studentSearchCriteria = (!is_null($mentee) ?
self::getSearchCriteria($mentee->getStudent(), 'smp_student.', true) : "");

- $query = "SELECT smp_mentee.id, smp_student.firstname,
smp_student.lastname, smp_student.student_number, smp_student.course_id,
smp_student.gender, smp_student.study_mode
+ $query = "SELECT smp_mentee.id, smp_mentee.expired,
smp_student.firstname, smp_student.lastname, smp_student.student_number,
smp_student.course_id, smp_student.gender, smp_student.study_mode
FROM smp_mentee INNER JOIN smp_student WHERE smp_mentee.student_id =
smp_student.id ".$menteeSearchCriteria.$studentSearchCriteria;
self::$datagrid->setDefaultSort(array('id' => 'DESC'));
self::$datagrid->bind($query, self::$options);
=======================================
--- /trunk/smp-php/smp/view/common/menu.php Fri Oct 1 23:34:50 2010
+++ /trunk/smp-php/smp/view/common/menu.php Sat Oct 2 00:51:21 2010
@@ -6,7 +6,7 @@
?>
<li><a href="#" class="MenuBarItemSubmenu">Admin</a>
<ul>
- <li><a href="index.php?cmd=user/list">User list</a></li>
+ <li><a href="index.php?cmd=user/list">User List</a></li>
<li><a href="index.php?cmd=log/list">Biz Log</a></li>
</ul>
</li>
@@ -16,9 +16,9 @@
?>
<li><a href="#" class="MenuBarItemSubmenu">Manager</a>
<ul>
- <li><a href="index.php?cmd=coordinator/list">Coordinator
list</a></li>
- <li><a href="index.php?cmd=mentor/listAllMentor">Mentor
list</a></li>
- <li><a href="index.php?cmd=mentee/listAllMentee">Mentee
list</a></li>
+ <li><a href="index.php?cmd=coordinator/list">Coordinator
List</a></li>
+ <li><a href="index.php?cmd=mentor/listAllMentor">Mentor
List</a></li>
+ <li><a href="index.php?cmd=mentee/listAllMentee">Mentee
List</a></li>
<li><a href="index.php?cmd=course/list">Course List</a></li>
</ul>
</li>
=======================================
--- /trunk/smp-php/smp/view/mentee/listAllMentee.php Sun Sep 5 22:34:10
2010
+++ /trunk/smp-php/smp/view/mentee/listAllMentee.php Sat Oct 2 00:51:21
2010
@@ -14,36 +14,35 @@
$indent = " ";
print $indent."<br><h1>List of Mentees</h1><br>\r\n";

-include("smp/view/search/menteeSearchPanel.php");
+include("smp/view/search/menteeSearchFullPanel.php");

$datagrid = $request->getDatagrid();

$datagrid = smp_util_DatagridUtil::formatColumn('id', $datagrid);
//use Formatter to edit generated data
-$studyModeColumn =& $datagrid->getColumnByField('study_mode');
-$studyModeColumn->setFormatter('formatStudyMode');
-$studyModeColumn =& $datagrid->getColumnByField('course_id');
-$studyModeColumn->setFormatter('format_course_id');
-function formatStudyMode($params){
- $key=$params['record']['study_mode'];
- return VH::getValueFromFixArray('study_mode', $key);
-}
-//format the gender column form f/m to Female/Male
-$genderColumn = $datagrid->getColumnByField('gender');
-$genderColumn->setFormatter('formatGender');
-function formatGender($params){
- $key=$params['record']['gender'];
- return VH::getValueFromFixArray('gender', $key);
-}
-
-$table = smp_util_DatagridUtil::getCustomHtmlTable();
-
+$datagrid = smp_util_DatagridUtil::formatColumn('study_mode', $datagrid);
+$datagrid = smp_util_DatagridUtil::formatColumn('course_id', $datagrid);
+$datagrid = smp_util_DatagridUtil::formatColumn('gender', $datagrid);
+
+$datagrid->addColumn(new Structures_DataGrid_Column('Mark as
Expired',null,null,array('width'=>'15%'),null,'printMarkAsExpired()'));
+
+$table = smp_util_DatagridUtil::getCustomHtmlTable();
$datagrid->fill($table, smp_util_DatagridUtil::getRenderOptions());

print $table->toHtml();
$datagrid->render(DATAGRID_RENDER_PAGER);

include('smp/view/common/footer.php');
+
+function printMarkAsExpired($params){
+ $menteeId = $params['record']['id'];
+ $expired = $params['record']['expired'];
+ if ($expired) {
+ return "<a
href=\"index.php?cmd=mentee/undoExpireMenteeForm&amp;menteeId=".
$menteeId ."&amp;next=mentee/listAllMentee\" onclick=\"return
confirmSubmit()\">Mark as Not Expired</a>";
+ } else {
+ return "<a href=\"index.php?cmd=mentee/expireMenteeForm&amp;menteeId=".
$menteeId ."&amp;next=mentee/listAllMentee\" onclick=\"return
confirmSubmit()\">Mark as Expired</a>";
+ }
+}
function format_course_id($params){
$key = $params['record']['course_id'];
return VH::getValueFromDynamicArray('course', $key);
@@ -52,3 +51,11 @@
$id = $params['record']['id'];
return "<a href=\"index.php?cmd=mentee/showMentee&id=$id\">$id</a>";
}
+function format_study_mode($params){
+ $key=$params['record']['study_mode'];
+ return VH::getValueFromFixArray('study_mode', $key);
+}
+function format_gender($params){
+ $key=$params['record']['gender'];
+ return VH::getValueFromFixArray('gender', $key);
+}
=======================================
--- /trunk/smp-php/smp/view/mentee/listMatchedMentee.php Fri Oct 1
23:34:50 2010
+++ /trunk/smp-php/smp/view/mentee/listMatchedMentee.php Sat Oct 2
00:51:21 2010
@@ -25,8 +25,8 @@
$genderColumn=$datagrid->getColumnByField('gender');
$genderColumn->setFormatter('formatGender');

-$datagrid->addColumn(new Structures_DataGrid_Column("Mentor", null,null,
array('width'=>'20%'),null,'printMentorOfMentee()'));
-$datagrid->addColumn(new Structures_DataGrid_Column('Mark as
Expired',null,null,array('width'=>'20%'),null,'printMarkAsExpired()'));
+$datagrid->addColumn(new Structures_DataGrid_Column("Mentor", null,null,
array('width'=>'15%'),null,'printMentorOfMentee()'));
+$datagrid->addColumn(new Structures_DataGrid_Column('Mark as
Expired',null,null,array('width'=>'15%'),null,'printMarkAsExpired()'));

$table=smp_util_DatagridUtil::getCustomHtmlTable();

@@ -41,9 +41,9 @@
$menteeId = $params['record']['id'];
$expired = $params['record']['expired'];
if ($expired) {
- return "<a
href=\"index.php?cmd=mentee/undoExpireMenteeForm&amp;menteeId=".
$menteeId ."\" onclick=\"return confirmSubmit()\">Mark as Not Expired</a>";
+ return "<a
href=\"index.php?cmd=mentee/undoExpireMenteeForm&amp;menteeId=".
$menteeId ."&amp;next=mentee/listMatchedMentee\" onclick=\"return
confirmSubmit()\">Mark as Not Expired</a>";
} else {
- return "<a href=\"index.php?cmd=mentee/expireMenteeForm&amp;menteeId=".
$menteeId ."\" onclick=\"return confirmSubmit()\">Mark as Expired</a>";
+ return "<a href=\"index.php?cmd=mentee/expireMenteeForm&amp;menteeId=".
$menteeId ."&amp;next=mentee/listMatchedMentee\" onclick=\"return
confirmSubmit()\">Mark as Expired</a>";
}
}

=======================================
--- /trunk/smp-php/smp/view/mentor/listAllMentor.php Tue Sep 21 05:27:40
2010
+++ /trunk/smp-php/smp/view/mentor/listAllMentor.php Sat Oct 2 00:51:21
2010
@@ -19,6 +19,7 @@
if (is_null($request->getProperty('output_format'))) {
include('smp/view/common/header.php');
$datagrid = smp_util_DatagridUtil::formatColumn('id', $datagrid);
+ $datagrid->addColumn(new Structures_DataGrid_Column('Mark as
Expired',null,null,array('width'=>'15%'),null,'printMarkAsExpired()'));

$indent = " ";
print $indent."<br/><h1>List of All Mentors</h1><br/>\r\n";
@@ -50,6 +51,15 @@
$datagrid->render(DATAGRID_RENDER_CSV);
}

+function printMarkAsExpired($params){
+ $mentorId = $params['record']['id'];
+ $expired = $params['record']['expired'];
+ if ($expired) {
+ return "<a
href=\"index.php?cmd=mentor/undoExpireMentorForm&amp;mentorId=".
$mentorId ."&amp;next=mentor/listAllMentor\" onclick=\"return
confirmSubmit()\">Mark as Not Expired</a>";
+ } else {
+ return "<a href=\"index.php?cmd=mentor/expireMentorForm&amp;mentorId=".
$mentorId ."&amp;next=mentor/listAllMentor\" onclick=\"return
confirmSubmit()\">Mark as Expired</a>";
+ }
+}
function format_gender($params){
$key = $params['record']['gender'];
return VH::getValueFromFixArray('gender', $key);
@@ -65,6 +75,4 @@
function format_id($params) {
$id = $params['record']['id'];
return "<a href=\"index.php?cmd=mentor/showMentor&id=$id\">$id</a>";
-}
-
-
+}
=======================================
--- /trunk/smp-php/smp/view/mentor/listMatchedMentor.php Tue Sep 21
05:27:40 2010
+++ /trunk/smp-php/smp/view/mentor/listMatchedMentor.php Sat Oct 2
00:51:21 2010
@@ -71,8 +71,8 @@
$mentorId = $params['record']['id'];
$expired = $params['record']['expired'];
if ($expired) {
- return "<a
href=\"index.php?cmd=mentor/undoExpireMentorForm&amp;mentorId=".
$mentorId ."\" onclick=\"return confirmSubmit()\">Mark as Not Expired</a>";
+ return "<a
href=\"index.php?cmd=mentor/undoExpireMentorForm&amp;mentorId=".
$mentorId ."&amp;next=mentor/listMatchedMentor\" onclick=\"return
confirmSubmit()\">Mark as Not Expired</a>";
} else {
- return "<a href=\"index.php?cmd=mentor/expireMentorForm&amp;mentorId=".
$mentorId ."\" onclick=\"return confirmSubmit()\">Mark as Expired</a>";
+ return "<a href=\"index.php?cmd=mentor/expireMentorForm&amp;mentorId=".
$mentorId ."&amp;next=mentor/listMatchedMentor\" onclick=\"return
confirmSubmit()\">Mark as Expired</a>";
}
}
=======================================
--- /trunk/smp-php/smp/view/search/menteeSearchExpiredPanel.php Fri Oct 1
23:34:50 2010
+++ /trunk/smp-php/smp/view/search/menteeSearchExpiredPanel.php Sat Oct 2
00:51:21 2010
@@ -32,7 +32,7 @@
$searchForm->setValue('expired', $mentee->getExpired());
}

-print $searchForm->open('mentorSearchForm', "form_container",
$_SERVER['REQUEST_URI']);
+print $searchForm->open('menteeSearchForm', "form_container",
$_SERVER['REQUEST_URI']);
print $searchForm->hidden(Constants::ACTION, Constants::ACTION_SEARCH);
print $searchForm->label('firstname','Firstname:', 'grid_1');
print $searchForm->textBox('firstname', null,
null,1,'grid_2','smallinput');
=======================================
--- /trunk/smp-php/smp/view/search/menteeSearchPanel.php Sun Aug 29
05:58:28 2010
+++ /trunk/smp-php/smp/view/search/menteeSearchPanel.php Sat Oct 2
00:51:21 2010
@@ -31,7 +31,7 @@
$searchForm->setValue('studyMode', $mentee->getStudent()->getStudyMode());
}

-print $searchForm->open('mentorSearchForm', "form_container",
$_SERVER['REQUEST_URI']);
+print $searchForm->open('menteeSearchForm', "form_container",
$_SERVER['REQUEST_URI']);
print $searchForm->hidden(Constants::ACTION, Constants::ACTION_SEARCH);
print $searchForm->label('firstname','Firstname:', 'grid_1');
print $searchForm->textBox('firstname', null,
null,1,'grid_2','smallinput');

Reply all
Reply to author
Forward
0 new messages