Added:
/trunk/smp-php/smp/command/mentee/ExpireMenteeFormCommand.php
/trunk/smp-php/smp/command/mentee/ListMatchedMenteeCommand.php
/trunk/smp-php/smp/command/mentee/UndoExpireMenteeFormCommand.php
/trunk/smp-php/smp/view/mentee/listMatchedMentee.php
/trunk/smp-php/smp/view/search/menteeSearchExpiredPanel.php
Deleted:
/trunk/smp-php/smp/command/student/ListMatchedMenteeCommand.php
/trunk/smp-php/smp/view/student/listMatchedMentee.php
Modified:
/trunk/smp-php/smp/command/mentor/UndoExpireMentorFormCommand.php
/trunk/smp-php/smp/datagrid/MenteeDatagrid.php
/trunk/smp-php/smp/mapper/MenteeMapper.php
/trunk/smp-php/smp/mapper/MentorMapper.php
/trunk/smp-php/smp/mapper/MentorMenteeMapper.php
/trunk/smp-php/smp/service/MenteeService.php
/trunk/smp-php/smp/service/MentorService.php
/trunk/smp-php/smp/view/common/menu.php
=======================================
--- /dev/null
+++ /trunk/smp-php/smp/command/mentee/ExpireMenteeFormCommand.php Fri Oct
1 23:34:50 2010
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Created at 02/10/2010 3:30:35 PM
+ * smp_command_mentee_ExpireMenteeFormCommand
+ *
+ * @author <a href="mailto:smor...@scu.edu.au">Sid</a>
+ * @version 1.0
+ */
+require_once('smp/service/MenteeService.php');
+
+class smp_command_mentee_ExpireMenteeFormCommand extends
smp_command_Command {
+
+ function doExecute(smp_controller_Request $request) {
+ $menteeService = new smp_service_MenteeService();
+
+ $menteeId = $request->getProperty('menteeId');
+ if (is_null($menteeId)) {
+ $request->addFeedback("Please Select Mentee for being Marked as Expired
Mentee!");
+ } else {
+ $result = $menteeService->markMenteeAsExpired($menteeId);
+ if ($result) {
+ $request->addFeedback("Selected Mentee by id [".$menteeId."] updated
as Expired Mentee.");
+ } else {
+ $request->addError("Selected Mentee by id [".$menteeId."] did not
updated as Expired Mentee.");
+ }
+ }
+
+ $request->redirect("mentee/listMatchedMentee");
+ }
+
+ function doSecurity() {
+ $this->roles = array(Constants::ROLE_MANAGER,
Constants::ROLE_COORDINATOR);
+ }
+}
=======================================
--- /dev/null
+++ /trunk/smp-php/smp/command/mentee/ListMatchedMenteeCommand.php Fri Oct
1 23:34:50 2010
@@ -0,0 +1,51 @@
+<?php
+/**
+ * Created at 26/07/2010 9:37:33 AM
+ * smp_command_mentee_ListMatchedMenteeCommand
+ *
+ * @author <a href="mailto:smor...@scu.edu.au">Sid</a>
+ * @author <a href="mailto:sl...@scu.edu.au">Bruce</a>
+ * @version 1.0
+ */
+require_once('smp/command/Command.php');
+require_once('smp/service/MenteeService.php');
+require_once('smp/domain/Student.php');
+require_once('smp/base/SessionRegistry.php');
+
+class smp_command_mentee_ListMatchedMenteeCommand extends
smp_command_Command {
+
+ function doExecute(smp_controller_Request $request) {
+ $menteeService = new smp_service_MenteeService();
+
+ $mentee = new smp_domain_Mentee();
+ $mentee->setMatched(true);
+ $mentee->setExpired(false);
+
smp_base_SessionRegistry::setSearchEntity('mentee_ListMatchedMentee_MenteeSearch',
$mentee);
+ if($request->isPost()){
+ $student = new smp_domain_Student();
+ $student->setFirstname($request->getProperty('firstname'));
+ $student->setLastname($request->getProperty('lastname'));
+ $student->setStudentNumber($request->getProperty('studentNumber'));
+ $student->setGender($request->getProperty('gender'));
+ $student->setCourseId($request->getProperty('courseId'));
+ $student->setStudyMode($request->getProperty('studyMode'));
+ $mentee->setExpired((is_null($request->getProperty('expired')) ?
false : true));
+
+ $action = $request->getProperty(Constants::ACTION);
+ if($action==Constants::ACTION_SEARCH){
+ $mentee->setStudent($student);
+
smp_base_SessionRegistry::setSearchEntity('mentee_ListMatchedMentee_MenteeSearch',
$mentee);
+ }
+ }
+ $mentee =
smp_base_SessionRegistry::getSearchEntity('mentee_ListMatchedMentee_MenteeSearch');
+ $request->setSearchEntity($mentee);
+
+ $datagrid = $menteeService->getMatchedMenteeDatagrid($mentee);
+ $request->setDatagrid($datagrid);
+ $request->setTitle("List of Matched Mentees");
+ }
+
+ function doSecurity() {
+ $this->roles = array(Constants::ROLE_MANAGER,
Constants::ROLE_COORDINATOR);
+ }
+}
=======================================
--- /dev/null
+++ /trunk/smp-php/smp/command/mentee/UndoExpireMenteeFormCommand.php Fri
Oct 1 23:34:50 2010
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Created at 02/10/2010 3:35:29 PM
+ * smp_command_mentee_UndoExpireMenteeFormCommand
+ *
+ * @author <a href="mailto:smor...@scu.edu.au">Sid</a>
+ * @version 1.0
+ */
+require_once('smp/service/MenteeService.php');
+
+class smp_command_mentee_UndoExpireMenteeFormCommand extends
smp_command_Command {
+
+ function doExecute(smp_controller_Request $request) {
+ $menteeService = new smp_service_MenteeService();
+
+ $menteeId = $request->getProperty('menteeId');
+ if (is_null($menteeId)) {
+ $request->addFeedback("Please Select Mentee for being Marked as Not
Expired Mentee!");
+ } else {
+ $result = $menteeService->markMenteeAsNotExpired($menteeId);
+ if ($result) {
+ $request->addFeedback("Selected Mentee by id [".$menteeId."] updated
as Not Expired Mentee.");
+ } else {
+ $request->addError("Selected Mentee by id [".$menteeId."] did not
updated as Not Expired Mentee.");
+ }
+ }
+
+ $request->redirect("mentee/listMatchedMentee");
+ }
+
+ function doSecurity() {
+ $this->roles = array(Constants::ROLE_MANAGER,
Constants::ROLE_COORDINATOR);
+ }
+}
=======================================
--- /dev/null
+++ /trunk/smp-php/smp/view/mentee/listMatchedMentee.php Fri Oct 1
23:34:50 2010
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Created at 26/07/2010 9:25:44 AM
+ * smp/view/student/listMatchedMentee.php
+ *
+ * @author <a href="mailto:smor...@scu.edu.au">Sid</a>
+ * @author <a href="mailto:sl...@scu.edu.au">Bruce</a>
+ * @version 1.0
+ */
+include('smp/view/common/header.php');
+require_once('smp/util/OptionProvider.php');
+require_once('smp/util/DatagridUtil.php');
+
+$indent = " ";
+print $indent."<br><h1>List of Matched Mentees</h1><br>\r\n";
+
+include("smp/view/search/menteeSearchExpiredPanel.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');
+//format the gender column form f/m to Female/Male
+$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()'));
+
+$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&menteeId=".
$menteeId ."\" onclick=\"return confirmSubmit()\">Mark as Not Expired</a>";
+ } else {
+ return "<a href=\"index.php?cmd=mentee/expireMenteeForm&menteeId=".
$menteeId ."\" onclick=\"return confirmSubmit()\">Mark as Expired</a>";
+ }
+}
+
+function formatStudyMode($params){
+ $key = $params['record']['study_mode'];
+ return VH::getValueFromFixArray('study_mode',$key);
+}
+function formatGender($params){
+ $key=$params['record']['gender'];
+ return VH::getValueFromFixArray('gender', $key);
+}
+function formatCourseId($params){
+ $id = $params['record']['course_id'];
+ return VH::getValueFromDynamicArray('course', $id);
+}
+function printMentorOfMentee($params){
+ $menteeId=$params['record']['id'];
+ $mentorLastname=$params['record']['mentor_lastname'];
+ return "<a
href=\"index.php?cmd=student/showStudentMenteeMentor&menteeId=".$menteeId."\">".$mentorLastname."</a>";
+}
+function format_id($params) {
+ $id = $params['record']['id'];
+ return "<a href=\"index.php?cmd=mentee/showMentee&id=$id\">$id</a>";
+}
=======================================
--- /dev/null
+++ /trunk/smp-php/smp/view/search/menteeSearchExpiredPanel.php Fri Oct 1
23:34:50 2010
@@ -0,0 +1,56 @@
+<?php
+/**
+ * Created at 02/10/2010 3:49:01 PM
+ * smp/view/search/MenteeSearchExpiredPanel.php
+ *
+ * @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());
+}
+
+print $searchForm->open('mentorSearchForm', "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_1','smallinput');
+print $searchForm->label("expired", "Expired:", "grid_1");
+print $searchForm->checkBox("expired", "", 1,"grid_1");
+print $searchForm->button('clearButton', 'Clear', 'button',
1,'grid_1', 'button', array('onClick'=>'clearForm(this.form)'));
+
+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('searchButton', 'Search', 'submit', 1,'grid_1');
+print $searchForm->close();
+print $indent . "</div>\r\n";
=======================================
--- /trunk/smp-php/smp/command/student/ListMatchedMenteeCommand.php Fri Sep
10 00:00:54 2010
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * Created at 26/07/2010 9:37:33 AM
- * smp_command_student_ListMatchedMenteeCommand
- *
- * @author <a href="mailto:smor...@scu.edu.au">Sid</a>
- * @author <a href="mailto:sl...@scu.edu.au">Bruce</a>
- * @version 1.0
- */
-require_once('smp/command/Command.php');
-require_once('smp/service/MenteeService.php');
-require_once('smp/domain/Student.php');
-require_once('smp/base/SessionRegistry.php');
-class smp_command_student_ListMatchedMenteeCommand extends
smp_command_Command {
-
- function doExecute(smp_controller_Request $request) {
- $menteeService = new smp_service_MenteeService();
-
- $mentee = new smp_domain_Mentee();
- $mentee->setMatched(true);
-
smp_base_SessionRegistry::setSearchEntity('student_ListMatchedMentee_MenteeSearch',
$mentee);
- if($request->isPost()){
- $student = new smp_domain_Student();
- $student->setFirstname($request->getProperty('firstname'));
- $student->setLastname($request->getProperty('lastname'));
- $student->setStudentNumber($request->getProperty('studentNumber'));
- $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('student_ListMatchedMentee_MenteeSearch',
$mentee);
- }
- }
- $mentee =
smp_base_SessionRegistry::getSearchEntity('student_ListMatchedMentee_MenteeSearch');
- $request->setSearchEntity($mentee);
-
- $datagrid = $menteeService->getMatchedMenteeDatagrid($mentee);
- $request->setDatagrid($datagrid);
- $request->setTitle("List of Matched Mentees");
- }
-
- function doSecurity() {
- $this->roles = array(Constants::ROLE_MANAGER,
Constants::ROLE_COORDINATOR);
- }
-}
=======================================
--- /trunk/smp-php/smp/view/student/listMatchedMentee.php Sun Sep 5
22:34:10 2010
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/**
- * Created at 26/07/2010 9:25:44 AM
- * smp/view/student/listMatchedMentee.php
- *
- * @author <a href="mailto:smor...@scu.edu.au">Sid</a>
- * @author <a href="mailto:sl...@scu.edu.au">Bruce</a>
- * @version 1.0
- */
-include('smp/view/common/header.php');
-require_once('smp/util/OptionProvider.php');
-require_once('smp/util/DatagridUtil.php');
-
-$indent = " ";
-print $indent."<br><h1>List of Matched Mentees</h1><br>\r\n";
-
-include("smp/view/search/menteeSearchPanel.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');
-//format the gender column form f/m to Female/Male
-$genderColumn=$datagrid->getColumnByField('gender');
-$genderColumn->setFormatter('formatGender');
-
-$datagrid->addColumn(new Structures_DataGrid_Column("Mentor", null,null,
array('width'=>'20%'),null,'printMentorOfMentee()'));
-
-$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 formatStudyMode($params){
- $key = $params['record']['study_mode'];
- return VH::getValueFromFixArray('study_mode',$key);
-}
-function formatGender($params){
- $key=$params['record']['gender'];
- return VH::getValueFromFixArray('gender', $key);
-}
-function formatCourseId($params){
- $id = $params['record']['course_id'];
- return VH::getValueFromDynamicArray('course', $id);
-}
-function printMentorOfMentee($params){
- $menteeId=$params['record']['id'];
- $mentorLastname=$params['record']['mentor_lastname'];
- return "<a
href=\"index.php?cmd=student/showStudentMenteeMentor&menteeId=".$menteeId."\">".$mentorLastname."</a>";
-}
-function format_id($params) {
- $id = $params['record']['id'];
- return "<a href=\"index.php?cmd=mentee/showMentee&id=$id\">$id</a>";
-}
=======================================
--- /trunk/smp-php/smp/command/mentor/UndoExpireMentorFormCommand.php Tue
Sep 21 05:27:40 2010
+++ /trunk/smp-php/smp/command/mentor/UndoExpireMentorFormCommand.php Fri
Oct 1 23:34:50 2010
@@ -1,7 +1,7 @@
<?php
/**
* Created at 20/09/2010 10:32:20 PM
- * __FILE__
+ * smp_command_mentor_UndoExpireMentorFormCommand
*
* @author <a href="mailto:smor...@scu.edu.au">Sid</a>
* @version 1.0
=======================================
--- /trunk/smp-php/smp/datagrid/MenteeDatagrid.php Mon Aug 30 00:27:20 2010
+++ /trunk/smp-php/smp/datagrid/MenteeDatagrid.php Fri Oct 1 23:34:50 2010
@@ -46,7 +46,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,
(SELECT lastname FROM smp_student WHERE smp_mentor.student_id =
smp_student.id) AS mentor_lastname
FROM smp_mentee, smp_student, smp_mentor_mentee, smp_mentor WHERE
smp_mentee.student_id = smp_student.id AND smp_mentee.id =
smp_mentor_mentee.mentee_id AND smp_mentor_mentee.mentor_id =
smp_mentor.id".$menteeSearchCriteria.$studentSearchCriteria;
self::$datagrid->setDefaultSort(array('id' => 'DESC'));
=======================================
--- /trunk/smp-php/smp/mapper/MenteeMapper.php Sun Sep 19 19:01:25 2010
+++ /trunk/smp-php/smp/mapper/MenteeMapper.php Fri Oct 1 23:34:50 2010
@@ -19,7 +19,6 @@
private $studentMapper;
private $contactMapper;
private $mentorMenteeMapper;
-// private $mentorMapper;
function __construct($adodb = null) {
parent::__construct($adodb);
@@ -27,28 +26,17 @@
$this->studentMapper = new smp_mapper_StudentMapper(self::$ADODB);
$this->contactMapper = new smp_mapper_ContactMapper(self::$ADODB);
$this->mentorMenteeMapper = new
smp_mapper_MentorMenteeMapper(self::$ADODB);
-// $this->mentorMapper = new smp_mapper_MentorMapper(self::$ADODB);
$this->insertStmt = self::$ADODB->Prepare('INSERT INTO smp_mentee
(user_id, student_id, contact_id, matched, expired) VALUES (?,?,?,?,?)');
}
- function targetClass() {
- return "smp_domain_Mentee";
- }
-
- function doCreateObject(array $array) {
- $obj = new smp_domain_Mentee();
- $obj->setId($array['id']);
- $obj->setUserId($array['user_id']);
- $obj->setStudentId($array['student_id']);
- $obj->setContactId($array['contact_id']);
- $obj->setMatched($array['matched']);
- $obj->setExpired($array['expired']);
- return $obj;
- }
-
- function doInsert(smp_domain_DomainObject $obj) {
- $values = array($obj->getUserId(), $obj->getStudentId(),
$obj->getContactId(), $obj->getMatched(), $obj->getExpired());
- return self::$ADODB->Execute($this->insertStmt, $values);
+ function markMenteeAsExpired($id) {
+ $updateStmt = self::$ADODB->Prepare("UPDATE smp_mentee SET expired=?
WHERE id=?");
+ return self::$ADODB->Execute($updateStmt, array(true, $id));
+ }
+
+ function markMenteeAsNotExpired($id) {
+ $updateStmt = self::$ADODB->Prepare("UPDATE smp_mentee SET expired=?
WHERE id=?");
+ return self::$ADODB->Execute($updateStmt, array(false, $id));
}
function save(smp_domain_Mentee $mentee) {
@@ -192,5 +180,25 @@
$mentor->setExpired($array['expired']);
return $mentor;
}
+
+ function targetClass() {
+ return "smp_domain_Mentee";
+ }
+
+ function doCreateObject(array $array) {
+ $obj = new smp_domain_Mentee();
+ $obj->setId($array['id']);
+ $obj->setUserId($array['user_id']);
+ $obj->setStudentId($array['student_id']);
+ $obj->setContactId($array['contact_id']);
+ $obj->setMatched($array['matched']);
+ $obj->setExpired($array['expired']);
+ return $obj;
+ }
+
+ function doInsert(smp_domain_DomainObject $obj) {
+ $values = array($obj->getUserId(), $obj->getStudentId(),
$obj->getContactId(), $obj->getMatched(), $obj->getExpired());
+ return self::$ADODB->Execute($this->insertStmt, $values);
+ }
}
=======================================
--- /trunk/smp-php/smp/mapper/MentorMapper.php Tue Sep 21 05:27:40 2010
+++ /trunk/smp-php/smp/mapper/MentorMapper.php Fri Oct 1 23:34:50 2010
@@ -27,23 +27,6 @@
$this->insertStmt = self::$ADODB->Prepare('INSERT INTO smp_mentor
(user_id, student_id, contact_id, mentee_limit, trained, matched, expired)
VALUES (?,?,?,?,?,?,?)');
}
- function targetClass() {
- return "smp_domain_Mentor";
- }
-
- function doCreateObject(array $array) {
- $obj = new smp_domain_Mentor();
- $obj->setId($array['id']);
- $obj->setUserId($array['user_id']);
- $obj->setStudentId($array['student_id']);
- $obj->setContactId($array['contact_id']);
- $obj->setMenteeLimit($array['mentee_limit']);
- $obj->setTrained($array['trained']);
- $obj->setMatched($array['matched']);
- $obj->setExpired($array['expired']);
- return $obj;
- }
-
function getEmailAddressToArray($mentor) {
$mentees =
$this->menteeMapper->findMenteesWithMentorId($mentor->getId());
$emailArray = array();
@@ -68,11 +51,6 @@
$rs = self::$ADODB->Execute($updateStmt, array($menteeLimit, $mentorId));
return ($rs === false ? false : true);
}
-
- function doInsert(smp_domain_DomainObject $obj) {
- $values = array($obj->getUserId(), $obj->getStudentId(),
$obj->getContactId(), $obj->getMenteeLimit(), $obj->getTrained(),
$obj->getMatched(), $obj->getExpired());
- return self::$ADODB->Execute($this->insertStmt, $values);
- }
function save(smp_domain_Mentor $mentor) {
$rs = self::doInsert($mentor);
@@ -174,5 +152,26 @@
return $mentor;
}
+ function targetClass() {
+ return "smp_domain_Mentor";
+ }
+
+ function doInsert(smp_domain_DomainObject $obj) {
+ $values = array($obj->getUserId(), $obj->getStudentId(),
$obj->getContactId(), $obj->getMenteeLimit(), $obj->getTrained(),
$obj->getMatched(), $obj->getExpired());
+ return self::$ADODB->Execute($this->insertStmt, $values);
+ }
+
+ function doCreateObject(array $array) {
+ $obj = new smp_domain_Mentor();
+ $obj->setId($array['id']);
+ $obj->setUserId($array['user_id']);
+ $obj->setStudentId($array['student_id']);
+ $obj->setContactId($array['contact_id']);
+ $obj->setMenteeLimit($array['mentee_limit']);
+ $obj->setTrained($array['trained']);
+ $obj->setMatched($array['matched']);
+ $obj->setExpired($array['expired']);
+ return $obj;
+ }
}
=======================================
--- /trunk/smp-php/smp/mapper/MentorMenteeMapper.php Sun Aug 29 01:55:14
2010
+++ /trunk/smp-php/smp/mapper/MentorMenteeMapper.php Fri Oct 1 23:34:50
2010
@@ -21,17 +21,14 @@
return $rs;
}
- function targetClass() {
- return "smp_domain_MentorMentee";
- }
-
- function doInsert(smp_domain_DomainObject $obj) {}
-
- function doCreateObject(array $array) {
- $obj = new smp_domain_MentorMentee($array['mentor_id'],
$array['mentee_id'], $array['create_time'], $array['expired'],
$array['id']);
- $obj->setMentorContactConfirm($array['mentor_contact_confirm']);
- $obj->setMentorContactConfirmTime($array['mentor_contact_confirm_time']);
- return $obj;
+ function markMentorAsExpired($mentorId) {
+ $updateStmt = self::$ADODB->Prepare('UPDATE smp_mentor_mentee SET
expired=? WHERE mentor_id=?');
+ return self::$ADODB->Execute($updateStmt, array(true, $mentorId));
+ }
+
+ function markMenteeAsExpired($menteeId) {
+ $updateStmt = self::$ADODB->Prepare('UPDATE smp_mentor_mentee SET
expired=? WHERE mentee_id=?');
+ return self::$ADODB->Execute($updateStmt, array(true, $menteeId));
}
function findRelationWithMentorId($mentorId) {
@@ -52,5 +49,18 @@
$row = $rs->FetchRow();
return (is_array($row) ? self::doCreateObject($row) : null);
}
+
+ function targetClass() {
+ return "smp_domain_MentorMentee";
+ }
+
+ function doInsert(smp_domain_DomainObject $obj) {}
+
+ function doCreateObject(array $array) {
+ $obj = new smp_domain_MentorMentee($array['mentor_id'],
$array['mentee_id'], $array['create_time'], $array['expired'],
$array['id']);
+ $obj->setMentorContactConfirm($array['mentor_contact_confirm']);
+ $obj->setMentorContactConfirmTime($array['mentor_contact_confirm_time']);
+ return $obj;
+ }
}
=======================================
--- /trunk/smp-php/smp/service/MenteeService.php Sun Sep 19 21:01:39 2010
+++ /trunk/smp-php/smp/service/MenteeService.php Fri Oct 1 23:34:50 2010
@@ -16,6 +16,7 @@
protected $studentMapper;
protected $menteeMapper;
protected $menteeDatagrid;
+ protected $mentorMenteeMapper;
function __construct() {
$this->menteeMapper = new smp_mapper_MenteeMapper();
@@ -23,6 +24,17 @@
$this->userMapper = new smp_mapper_UserMapper();
$this->contactMapper = new smp_mapper_ContactMapper();
$this->menteeDatagrid = new smp_datagrid_MenteeDatagrid();
+ $this->mentorMenteeMapper = new smp_mapper_MentorMenteeMapper();
+ }
+
+ function markMenteeAsExpired($menteeId) {
+ $result = $this->menteeMapper->markMenteeAsExpired($menteeId);
+ $result = $this->mentorMenteeMapper->markMenteeAsExpired($menteeId);
+ return $result;
+ }
+
+ function markMenteeAsNotExpired($menteeId) {
+ return $this->menteeMapper->markMenteeAsNotExpired($menteeId);
}
function getCurrentMentorEmailAddressArray() {
=======================================
--- /trunk/smp-php/smp/service/MentorService.php Tue Sep 21 05:27:40 2010
+++ /trunk/smp-php/smp/service/MentorService.php Fri Oct 1 23:34:50 2010
@@ -20,6 +20,7 @@
protected $studentMapper;
protected $userMapper;
protected $mentorDatagrid;
+ protected $mentorMenteeMapper;
function __construct() {
$this->menteeMapper = new smp_mapper_MenteeMapper();
@@ -28,6 +29,7 @@
$this->userMapper = new smp_mapper_UserMapper();
$this->contactMapper = new smp_mapper_ContactMapper();
$this->mentorDatagrid = new smp_datagrid_MentorDatagrid();
+ $this->mentorMenteeMapper = new smp_mapper_MentorMenteeMapper();
}
function getCurrentMenteesEmailAddressArray() {
@@ -88,7 +90,9 @@
}
function markMentorAsExpired($mentorId) {
- return $this->mentorMapper->markMentorAsExpired($mentorId);
+ $result = $this->mentorMapper->markMentorAsExpired($mentorId);
+ $result = $this->mentorMenteeMapper->markMentorAsExpired($mentorId);
+ return $result;
}
function markMentorAsNotExpired($mentorId) {
=======================================
--- /trunk/smp-php/smp/view/common/menu.php Fri Oct 1 01:30:37 2010
+++ /trunk/smp-php/smp/view/common/menu.php Fri Oct 1 23:34:50 2010
@@ -31,7 +31,7 @@
<li><a href="index.php?cmd=matching/listNonTrainedMentor">Active
Mentors</a></li>
<li><a href="index.php?cmd=matching/listNewMentees">Matching
Mentee</a></li>
<li><a href="index.php?cmd=mentor/listMatchedMentor">Matched
Mentors</a></li>
- <li><a href="index.php?cmd=student/listMatchedMentee">Matched
Mentees</a></li>
+ <li><a href="index.php?cmd=mentee/listMatchedMentee">Matched
Mentees</a></li>
<li><a href="index.php?cmd=mentor/listActiveMentor">Mentor set
Limit</a></li>
<li><a
href="index.php?cmd=mentormentee/listAllMentorMentee">Contact
confirmed ?</a></li>
</ul>