[Logicampus-svn] SF.net SVN: logicampus:[1310] logicampus/trunk
Brought to you by:
trilexcom
From: <if...@us...> - 2010-02-26 10:58:41
|
Revision: 1310 http://logicampus.svn.sourceforge.net/logicampus/?rev=1310&view=rev Author: iflaah Date: 2010-02-26 10:58:34 +0000 (Fri, 26 Feb 2010) Log Message: ----------- student evaluation form files Added Paths: ----------- logicampus/trunk/data/evaluation_form.mysql.sql logicampus/trunk/data/evaluationform_flag.mysql.sql logicampus/trunk/data/student_evaluation_form.mysql.sql logicampus/trunk/src/logicreate/lib/EvaluationForm.php logicampus/trunk/src/logicreate/lib/EvaluationformFlag.php logicampus/trunk/src/logicreate/lib/StudentEvaluationForm.php logicampus/trunk/src/logicreate/services/administration/createEvalForm.lcp logicampus/trunk/src/logicreate/services/administration/studentVisibleDates.lcp logicampus/trunk/src/logicreate/services/administration/teacherEvaluation.lcp logicampus/trunk/src/logicreate/services/administration/templates/createEvalForm.html logicampus/trunk/src/logicreate/services/administration/templates/studentVisibleDates.html logicampus/trunk/src/logicreate/services/administration/templates/teacherEvaluation.html logicampus/trunk/src/logicreate/services/classroom/evaluation.lcp logicampus/trunk/src/logicreate/services/classroom/templates/evaluation.html Added: logicampus/trunk/data/evaluation_form.mysql.sql =================================================================== --- logicampus/trunk/data/evaluation_form.mysql.sql (rev 0) +++ logicampus/trunk/data/evaluation_form.mysql.sql 2010-02-26 10:58:34 UTC (rev 1310) @@ -0,0 +1,21 @@ +-- Dumping SQL for project logicampus +-- entity version: 0.0 +-- DB type: mysql +-- generated on: 02.26.2010 + + +DROP TABLE IF EXISTS `evaluation_form`; +CREATE TABLE `evaluation_form` ( + + `serial_no` integer (11) NOT NULL auto_increment, + `question` varchar (255) NOT NULL, + `visible` tinyint (1) NOT NULL, + `excellent` tinyint (1) NOT NULL, + `very_good` tinyint (1) NOT NULL, + `good` tinyint (1) NOT NULL, + `satisfactory` tinyint (1) NOT NULL, + `unsatisfactory` tinyint (1) NOT NULL, + `date_created` datetime NOT NULL, + `weightage` integer NOT NULL, + PRIMARY KEY (serial_no) +); Added: logicampus/trunk/data/evaluationform_flag.mysql.sql =================================================================== --- logicampus/trunk/data/evaluationform_flag.mysql.sql (rev 0) +++ logicampus/trunk/data/evaluationform_flag.mysql.sql 2010-02-26 10:58:34 UTC (rev 1310) @@ -0,0 +1,14 @@ +-- Dumping SQL for project logicampus +-- entity version: 0.0 +-- DB type: mysql +-- generated on: 02.26.2010 + + +DROP TABLE IF EXISTS `evaluationform_flag`; +CREATE TABLE `evaluationform_flag` ( + + `eval_form` varchar (20) NOT NULL, + `flag` binary (1) NOT NULL, + `start` datetime NOT NULL, + `end` datetime NOT NULL +); Added: logicampus/trunk/data/student_evaluation_form.mysql.sql =================================================================== --- logicampus/trunk/data/student_evaluation_form.mysql.sql (rev 0) +++ logicampus/trunk/data/student_evaluation_form.mysql.sql 2010-02-26 10:58:34 UTC (rev 1310) @@ -0,0 +1,15 @@ +-- Dumping SQL for project logicampus +-- entity version: 0.0 +-- DB type: mysql +-- generated on: 02.26.2010 + + +DROP TABLE IF EXISTS `student_evaluation_form`; +CREATE TABLE `student_evaluation_form` ( + + `id` integer (10) NOT NULL, + `student_id` integer (11) NOT NULL, + `id_classes` integer (11) NOT NULL, + `serial_no` integer (5) NOT NULL, + `rank` integer (5) NOT NULL +); Added: logicampus/trunk/src/logicreate/lib/EvaluationForm.php =================================================================== --- logicampus/trunk/src/logicreate/lib/EvaluationForm.php (rev 0) +++ logicampus/trunk/src/logicreate/lib/EvaluationForm.php 2010-02-26 10:58:34 UTC (rev 1310) @@ -0,0 +1,272 @@ +<? + +class EvaluationFormBase { + + var $_new = true; //not pulled from DB + var $_modified; //set() called + var $_version = '1.7'; //PBDO version number + var $_entityVersion = ''; //Source version number + var $serialNo; + var $question; + var $visible; + var $excellent; + var $veryGood; + var $good; + var $satisfactory; + var $unsatisfactory; + var $dateCreated; + var $weightage; + + var $__attributes = array( + 'serialNo'=>'integer', + 'question'=>'varchar', + 'visible'=>'tinyint', + 'excellent'=>'tinyint', + 'veryGood'=>'tinyint', + 'good'=>'tinyint', + 'satisfactory'=>'tinyint', + 'unsatisfactory'=>'tinyint', + 'dateCreated'=>'datetime', + 'weightage'=>'integer'); + + var $__nulls = array(); + + + + function getPrimaryKey() { + return $this->serialNo; + } + + + function setPrimaryKey($val) { + $this->serialNo = $val; + } + + + function save($dsn="default") { + if ( $this->isNew() ) { + $this->setPrimaryKey(EvaluationFormPeer::doInsert($this,$dsn)); + } else { + EvaluationFormPeer::doUpdate($this,$dsn); + } + } + + + function load($key,$dsn="default") { + $where = ''; + if (is_array($key) ) { + while (list ($k,$v) = @each($key) ) { + $where .= "$k='$v' and "; + } + $where = substr($where,0,-5); + } else { + $where = "serial_no='".$key."'"; + } + $array = EvaluationFormPeer::doSelect($where,$dsn); + return $array[0]; + } + + + function loadAll($dsn="default") { + $array = EvaluationFormPeer::doSelect('',$dsn); + return $array; + } + + + function delete($deep=false,$dsn="default") { + EvaluationFormPeer::doDelete($this,$deep,$dsn); + } + + + function isNew() { + return $this->_new; + } + + + function isModified() { + return $this->_modified; + + } + + + function get($key) { + return $this->{$key}; + } + + + /** + * only sets if the new value is !== the current value + * returns true if the value was updated + * also, sets _modified to true on success + */ + function set($key,$val) { + if ($this->{$key} !== $val) { + $this->_modified = true; + $this->{$key} = $val; + return true; + } + return false; + } + +} + + +class EvaluationFormPeerBase { + + var $tableName = 'evaluation_form'; + + function doSelect($where,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + $st = new PBDO_SelectStatement("evaluation_form",$where); + $st->fields['serial_no'] = 'serial_no'; + $st->fields['question'] = 'question'; + $st->fields['visible'] = 'visible'; + $st->fields['excellent'] = 'excellent'; + $st->fields['very_good'] = 'very_good'; + $st->fields['good'] = 'good'; + $st->fields['satisfactory'] = 'satisfactory'; + $st->fields['unsatisfactory'] = 'unsatisfactory'; + $st->fields['date_created'] = 'date_created'; + $st->fields['weightage'] = 'weightage'; + + + $array = array(); + $db->executeQuery($st); + while($db->nextRecord() ) { + $array[] = EvaluationFormPeer::row2Obj($db->record); + } + return $array; + } + + function doInsert(&$obj,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + $st = new PBDO_InsertStatement("evaluation_form"); + $st->fields['serial_no'] = $obj->serialNo; + $st->fields['question'] = $obj->question; + $st->fields['visible'] = $obj->visible; + $st->fields['excellent'] = $obj->excellent; + $st->fields['very_good'] = $obj->veryGood; + $st->fields['good'] = $obj->good; + $st->fields['satisfactory'] = $obj->satisfactory; + $st->fields['unsatisfactory'] = $obj->unsatisfactory; + $st->fields['date_created'] = $obj->dateCreated; + $st->fields['weightage'] = $obj->weightage; + + + $st->key = 'serial_no'; + $db->executeQuery($st); + + $obj->_new = false; + $obj->_modified = false; + $id = $db->getInsertID(); + return $id; + + } + + function doUpdate(&$obj,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + $st = new PBDO_UpdateStatement("evaluation_form"); + $st->fields['serial_no'] = $obj->serialNo; + $st->fields['question'] = $obj->question; + $st->fields['visible'] = $obj->visible; + $st->fields['excellent'] = $obj->excellent; + $st->fields['very_good'] = $obj->veryGood; + $st->fields['good'] = $obj->good; + $st->fields['satisfactory'] = $obj->satisfactory; + $st->fields['unsatisfactory'] = $obj->unsatisfactory; + $st->fields['date_created'] = $obj->dateCreated; + $st->fields['weightage'] = $obj->weightage; + + + $st->key = 'serial_no'; + $db->executeQuery($st); + $obj->_modified = false; + + } + + function doReplace($obj,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + if ($this->isNew() ) { + $db->executeQuery(new PBDO_InsertStatement($criteria)); + } else { + $db->executeQuery(new PBDO_UpdateStatement($criteria)); + } + } + + + /** + * remove an object + */ + function doDelete(&$obj,$deep=false,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + $st = new PBDO_DeleteStatement("evaluation_form","serial_no = '".$obj->getPrimaryKey()."'"); + + $db->executeQuery($st); + + if ( $deep ) { + + } + + $obj->_new = false; + $obj->_modified = false; + $id = $db->getInsertID(); + return $id; + + } + + + + /** + * send a raw query + */ + function doQuery(&$sql,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + + $db->query($sql); + + return; + } + + + + function row2Obj($row) { + $x = new EvaluationForm(); + $x->serialNo = $row['serial_no']; + $x->question = $row['question']; + $x->visible = $row['visible']; + $x->excellent = $row['excellent']; + $x->veryGood = $row['very_good']; + $x->good = $row['good']; + $x->satisfactory = $row['satisfactory']; + $x->unsatisfactory = $row['unsatisfactory']; + $x->dateCreated = $row['date_created']; + $x->weightage = $row['weightage']; + + $x->_new = false; + return $x; + } + + +} + + +//You can edit this class, but do not change this next line! +class EvaluationForm extends EvaluationFormBase { + + + +} + + + +class EvaluationFormPeer extends EvaluationFormPeerBase { + +} + +?> \ No newline at end of file Added: logicampus/trunk/src/logicreate/lib/EvaluationformFlag.php =================================================================== --- logicampus/trunk/src/logicreate/lib/EvaluationformFlag.php (rev 0) +++ logicampus/trunk/src/logicreate/lib/EvaluationformFlag.php 2010-02-26 10:58:34 UTC (rev 1310) @@ -0,0 +1,236 @@ +<? + +class EvaluationformFlagBase { + + var $_new = true; //not pulled from DB + var $_modified; //set() called + var $_version = '1.7'; //PBDO version number + var $_entityVersion = ''; //Source version number + var $evalForm; + var $flag; + var $start; + var $end; + + var $__attributes = array( + 'evalForm'=>'varchar', + 'flag'=>'binary', + 'start'=>'datetime', + 'end'=>'datetime'); + + var $__nulls = array(); + + + + function getPrimaryKey() { + return $this->; + } + + + function setPrimaryKey($val) { + $this-> = $val; + } + + + function save($dsn="default") { + if ( $this->isNew() ) { + $this->setPrimaryKey(EvaluationformFlagPeer::doInsert($this,$dsn)); + } else { + EvaluationformFlagPeer::doUpdate($this,$dsn); + } + } + + + function load($key,$dsn="default") { + $where = ''; + if (is_array($key) ) { + while (list ($k,$v) = @each($key) ) { + $where .= "$k='$v' and "; + } + $where = substr($where,0,-5); + } else { + $where = "='".$key."'"; + } + $array = EvaluationformFlagPeer::doSelect($where,$dsn); + return $array[0]; + } + + + function loadAll($dsn="default") { + $array = EvaluationformFlagPeer::doSelect('',$dsn); + return $array; + } + + + function delete($deep=false,$dsn="default") { + EvaluationformFlagPeer::doDelete($this,$deep,$dsn); + } + + + function isNew() { + return $this->_new; + } + + + function isModified() { + return $this->_modified; + + } + + + function get($key) { + return $this->{$key}; + } + + + /** + * only sets if the new value is !== the current value + * returns true if the value was updated + * also, sets _modified to true on success + */ + function set($key,$val) { + if ($this->{$key} !== $val) { + $this->_modified = true; + $this->{$key} = $val; + return true; + } + return false; + } + +} + + +class EvaluationformFlagPeerBase { + + var $tableName = 'evaluationform_flag'; + + function doSelect($where,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + $st = new PBDO_SelectStatement("evaluationform_flag",$where); + $st->fields['eval_form'] = 'eval_form'; + $st->fields['flag'] = 'flag'; + $st->fields['start'] = 'start'; + $st->fields['end'] = 'end'; + + + $array = array(); + $db->executeQuery($st); + while($db->nextRecord() ) { + $array[] = EvaluationformFlagPeer::row2Obj($db->record); + } + return $array; + } + + function doInsert(&$obj,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + $st = new PBDO_InsertStatement("evaluationform_flag"); + $st->fields['eval_form'] = $obj->evalForm; + $st->fields['flag'] = $obj->flag; + $st->fields['start'] = $obj->start; + $st->fields['end'] = $obj->end; + + + $st->key = ''; + $db->executeQuery($st); + + $obj->_new = false; + $obj->_modified = false; + $id = $db->getInsertID(); + return $id; + + } + + function doUpdate(&$obj,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + $st = new PBDO_UpdateStatement("evaluationform_flag"); + $st->fields['eval_form'] = $obj->evalForm; + $st->fields['flag'] = $obj->flag; + $st->fields['start'] = $obj->start; + $st->fields['end'] = $obj->end; + + + $st->key = ''; + $db->executeQuery($st); + $obj->_modified = false; + + } + + function doReplace($obj,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + if ($this->isNew() ) { + $db->executeQuery(new PBDO_InsertStatement($criteria)); + } else { + $db->executeQuery(new PBDO_UpdateStatement($criteria)); + } + } + + + /** + * remove an object + */ + function doDelete(&$obj,$deep=false,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + $st = new PBDO_DeleteStatement("evaluationform_flag"," = '".$obj->getPrimaryKey()."'"); + + $db->executeQuery($st); + + if ( $deep ) { + + } + + $obj->_new = false; + $obj->_modified = false; + $id = $db->getInsertID(); + return $id; + + } + + + + /** + * send a raw query + */ + function doQuery(&$sql,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + + $db->query($sql); + + return; + } + + + + function row2Obj($row) { + $x = new EvaluationformFlag(); + $x->evalForm = $row['eval_form']; + $x->flag = $row['flag']; + $x->start = $row['start']; + $x->end = $row['end']; + + $x->_new = false; + return $x; + } + + +} + + +//You can edit this class, but do not change this next line! +class EvaluationformFlag extends EvaluationformFlagBase { + + + +} + + + +class EvaluationformFlagPeer extends EvaluationformFlagPeerBase { + +} + +?> \ No newline at end of file Added: logicampus/trunk/src/logicreate/lib/StudentEvaluationForm.php =================================================================== --- logicampus/trunk/src/logicreate/lib/StudentEvaluationForm.php (rev 0) +++ logicampus/trunk/src/logicreate/lib/StudentEvaluationForm.php 2010-02-26 10:58:34 UTC (rev 1310) @@ -0,0 +1,242 @@ +<? + +class StudentEvaluationFormBase { + + var $_new = true; //not pulled from DB + var $_modified; //set() called + var $_version = '1.7'; //PBDO version number + var $_entityVersion = ''; //Source version number + var $id; + var $studentId; + var $idClasses; + var $serialNo; + var $rank; + + var $__attributes = array( + 'id'=>'integer', + 'studentId'=>'integer', + 'idClasses'=>'integer', + 'serialNo'=>'integer', + 'rank'=>'integer'); + + var $__nulls = array(); + + + + function getPrimaryKey() { + return $this->; + } + + + function setPrimaryKey($val) { + $this-> = $val; + } + + + function save($dsn="default") { + if ( $this->isNew() ) { + $this->setPrimaryKey(StudentEvaluationFormPeer::doInsert($this,$dsn)); + } else { + StudentEvaluationFormPeer::doUpdate($this,$dsn); + } + } + + + function load($key,$dsn="default") { + $where = ''; + if (is_array($key) ) { + while (list ($k,$v) = @each($key) ) { + $where .= "$k='$v' and "; + } + $where = substr($where,0,-5); + } else { + $where = "='".$key."'"; + } + $array = StudentEvaluationFormPeer::doSelect($where,$dsn); + return $array[0]; + } + + + function loadAll($dsn="default") { + $array = StudentEvaluationFormPeer::doSelect('',$dsn); + return $array; + } + + + function delete($deep=false,$dsn="default") { + StudentEvaluationFormPeer::doDelete($this,$deep,$dsn); + } + + + function isNew() { + return $this->_new; + } + + + function isModified() { + return $this->_modified; + + } + + + function get($key) { + return $this->{$key}; + } + + + /** + * only sets if the new value is !== the current value + * returns true if the value was updated + * also, sets _modified to true on success + */ + function set($key,$val) { + if ($this->{$key} !== $val) { + $this->_modified = true; + $this->{$key} = $val; + return true; + } + return false; + } + +} + + +class StudentEvaluationFormPeerBase { + + var $tableName = 'student_evaluation_form'; + + function doSelect($where,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + $st = new PBDO_SelectStatement("student_evaluation_form",$where); + $st->fields['id'] = 'id'; + $st->fields['student_id'] = 'student_id'; + $st->fields['id_classes'] = 'id_classes'; + $st->fields['serial_no'] = 'serial_no'; + $st->fields['rank'] = 'rank'; + + + $array = array(); + $db->executeQuery($st); + while($db->nextRecord() ) { + $array[] = StudentEvaluationFormPeer::row2Obj($db->record); + } + return $array; + } + + function doInsert(&$obj,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + $st = new PBDO_InsertStatement("student_evaluation_form"); + $st->fields['id'] = $obj->id; + $st->fields['student_id'] = $obj->studentId; + $st->fields['id_classes'] = $obj->idClasses; + $st->fields['serial_no'] = $obj->serialNo; + $st->fields['rank'] = $obj->rank; + + + $st->key = ''; + $db->executeQuery($st); + + $obj->_new = false; + $obj->_modified = false; + $id = $db->getInsertID(); + return $id; + + } + + function doUpdate(&$obj,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + $st = new PBDO_UpdateStatement("student_evaluation_form"); + $st->fields['id'] = $obj->id; + $st->fields['student_id'] = $obj->studentId; + $st->fields['id_classes'] = $obj->idClasses; + $st->fields['serial_no'] = $obj->serialNo; + $st->fields['rank'] = $obj->rank; + + + $st->key = ''; + $db->executeQuery($st); + $obj->_modified = false; + + } + + function doReplace($obj,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + if ($this->isNew() ) { + $db->executeQuery(new PBDO_InsertStatement($criteria)); + } else { + $db->executeQuery(new PBDO_UpdateStatement($criteria)); + } + } + + + /** + * remove an object + */ + function doDelete(&$obj,$deep=false,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + $st = new PBDO_DeleteStatement("student_evaluation_form"," = '".$obj->getPrimaryKey()."'"); + + $db->executeQuery($st); + + if ( $deep ) { + + } + + $obj->_new = false; + $obj->_modified = false; + $id = $db->getInsertID(); + return $id; + + } + + + + /** + * send a raw query + */ + function doQuery(&$sql,$dsn="default") { + //use this tableName + $db = DB::getHandle($dsn); + + $db->query($sql); + + return; + } + + + + function row2Obj($row) { + $x = new StudentEvaluationForm(); + $x->id = $row['id']; + $x->studentId = $row['student_id']; + $x->idClasses = $row['id_classes']; + $x->serialNo = $row['serial_no']; + $x->rank = $row['rank']; + + $x->_new = false; + return $x; + } + + +} + + +//You can edit this class, but do not change this next line! +class StudentEvaluationForm extends StudentEvaluationFormBase { + + + +} + + + +class StudentEvaluationFormPeer extends StudentEvaluationFormPeerBase { + +} + +?> \ No newline at end of file Added: logicampus/trunk/src/logicreate/services/administration/createEvalForm.lcp =================================================================== --- logicampus/trunk/src/logicreate/services/administration/createEvalForm.lcp (rev 0) +++ logicampus/trunk/src/logicreate/services/administration/createEvalForm.lcp 2010-02-26 10:58:34 UTC (rev 1310) @@ -0,0 +1,183 @@ +<?php +/* + * Created on Oct 15, 2009 + */ + + +include_once(LIB_PATH.'rss/simplepie.php'); +//include_once(LIB_PATH.'lc_enrollment.php'); +//include_once(LIB_PATH.'lc_class.php'); + + +class createEvalForm extends AdminService +{ + + var $presentor = "htmlPresentation"; + var $cleanedArray = array(); # used for forms + var $authorizer = 'NoAuth'; + + // links + var $sectionTitle = 'Create Evaluation Form'; + var $navlinks = array( + 'Administration Home' => '' + ); + var $applinks = array( + 'Student Visible Dates' => 'studentVisibleDates/' + ); + + + function run($db,&$u,&$lc,&$t) + { + + + $this->sectionTitle = 'Create Evaluation Form'; + $this->inactivelinks = array( 'Create Evaluation Form' ); + $lc->templateName='createEvalForm'; + + $evalFlag=0; + $db->query("select flag from evaluationform_flag where eval_form='form1' and flag='1'"); + if($db->nextRecord()) + { + $evalFlag=$db->record['flag']; + } + + $questions=array(); + + $db->query("select * from evaluation_form"); + While($db->nextRecord()) + { + array_push($questions,$db->record); + + } + + $db->query("select sum(weightage) as sum from evaluation_form"); + if($db->nextRecord()) + { + $sum=$db->record['sum']; + } + if($sum == 100) + { + $t['flag']=1; + } + + $t['evalFlag']=$evalFlag; + $t['question']=$questions; + } + + function addQuestionRun($db,&$u,&$lc,&$t) + { + + $quest=$lc->postvars['question']; + $per=$lc->postvars['percentage']; + $fleeg=0; + + $serial=$lc->postvars['hiddenserial']; + + $db->query("select * from evaluation_form where serial_no='$serial'"); + if($db->nextRecord()) + { + $alreadyQuest=$db->record['weightage']; + $fleeg=1; + + } + + $db->query("select sum(weightage) as sum from evaluation_form"); + if($db->nextRecord()) + { + $sum=$db->record['sum']; + } + if($fleeg) + { + $sum=$sum-$alreadyQuest; + } + $sum=$sum+$per; + + + if($sum > 100) + { + $t['srno'] = $serial; + $t['tempQuest']=$quest; + $t['error']="The limit to 100% has been acceded!"; + $t['msg']="Please, re-enter percentage for the question."; + } + else + { + if($sum == 100) + { + $t['msg']="The limit to 100% has been achieved."; + $t['flag']=1; + } + + if($fleeg) + { + $db->query("delete from evaluation_form where serial_no='$serial'"); + + } + + $db->query("insert into evaluation_form (question,date_created,weightage)values('$quest',sysdate(),'$per')"); + $t['msg']="Added Successfully"; + + $serial=0; + } + + $this->run($db,&$u,&$lc,&$t); + } + + function updateRun($db,&$u,&$lc,&$t) + { + + $data=explode('.',$lc->getvars['data']); + $column=$data[2]; + if($data[1]) + { + $db->query("update evaluation_form set $data[2]='0' where serial_no='$data[0]'"); + } + else + { + $db->query("update evaluation_form set $data[2]='1' where serial_no='$data[0]'"); + } + $this->run($db,&$u,&$lc,&$t); + + } + + function finalRun($db,&$u,&$lc,&$t) + { + $db->query("update evaluationform_flag SET flag='1' where eval_form='form1'"); + + $t['msg']="Sucessfully Finalized."; + $this->run($db,&$u,&$lc,&$t); + } + + function deleteRun($db,&$u,&$lc,&$t) + { + $sno=$lc->getvars['id']; + + $db->query("delete from evaluation_form where serial_no='$sno'"); + $this->run($db,&$u,&$lc,&$t); + } + + + function editQuestionRun($db,&$u,&$lc,&$t) + { + $sno=$lc->getvars['id']; + + $db->query("select question,weightage,serial_no from evaluation_form where serial_no='$sno'"); + if($db->nextRecord()) + { + $quest=$db->record['question']; + $weight=$db->record['weightage']; + $sno=$db->record['serial_no']; + } + + $t['tempQuest']=$quest; + $t['weight']=$weight; + $t['srno']=$sno; + + $this->run($db,&$u,&$lc,&$t); + } + + + +} + +?> Added: logicampus/trunk/src/logicreate/services/administration/studentVisibleDates.lcp =================================================================== --- logicampus/trunk/src/logicreate/services/administration/studentVisibleDates.lcp (rev 0) +++ logicampus/trunk/src/logicreate/services/administration/studentVisibleDates.lcp 2010-02-26 10:58:34 UTC (rev 1310) @@ -0,0 +1,63 @@ +<?php +/* + * Created on Dec 1, 2009 + */ + + include_once(LIB_PATH.'rss/simplepie.php'); + + +class studentVisibleDates extends AdminService +{ + + var $presentor = "htmlPresentation"; + var $cleanedArray = array(); # used for forms + var $authorizer = 'NoAuth'; + + // links + var $sectionTitle = 'Student Visible Dates'; + var $navlinks = array( + 'Administration Home' => '' + ); + var $applinks = array( + 'Create Evaluation Form' => 'createEvalForm/' + ); + + + function run($db,&$u,&$lc,&$t) + { + + $this->sectionTitle = 'Student Visible Dates'; + $this->inactivelinks = array( 'Student Visible Dates' ); + $lc->templateName='studentVisibleDates'; + + $db->query("select DATE_FORMAT(start,'%M,%e,%Y')as sdate,DATE_FORMAT(end,'%M,%e,%Y') as edate from evaluationform_flag where flag='1' and eval_form='form1'"); + if($db->nextRecord()) + { + $start=$db->record['sdate']; + $end=$db->record['edate']; + } + + $sdate=explode(',',$start); + $edate=explode(',',$end); + + $t['sdate']=$sdate; + $t['edate']=$edate; + + } + + function dateRun($db,&$u,&$lc,&$t) + { + $dateStart=$lc->postvars['dateStart']['year']. '-'.$lc->postvars['dateStart']['month']. '-'. $lc->postvars['dateStart']['day']; + $dateEnd=$lc->postvars['dateEnd']['year']. '-'.$lc->postvars['dateEnd']['month']. '-'. $lc->postvars['dateEnd']['day']; + + $db->query("update evaluationform_flag set start='".addslashes($dateStart)."',end='".addslashes($dateEnd)."' where eval_form='form1' and flag='1'"); + + $t['msg']="Successfully Set."; + + $this->run($db,&$u,&$lc,&$t); + } + +} + + +?> Added: logicampus/trunk/src/logicreate/services/administration/teacherEvaluation.lcp =================================================================== --- logicampus/trunk/src/logicreate/services/administration/teacherEvaluation.lcp (rev 0) +++ logicampus/trunk/src/logicreate/services/administration/teacherEvaluation.lcp 2010-02-26 10:58:34 UTC (rev 1310) @@ -0,0 +1,183 @@ +<?php +/* + * Created on Dec 15, 2009 + * + */ + + +class teacherEvaluation extends AdminService +{ + + var $presentor = "htmlPresentation"; + var $cleanedArray = array(); # used for forms + var $authorizer = 'NoAuth'; + + // links + var $sectionTitle = 'Teacher Evaluation'; + var $navlinks = array('Administration Home' => ''); + //var $applinks = array('Student Visible Dates' => 'studentVisibleDates/'); + + + + function run($db,&$u,&$lc,&$t) + { + + $this->sectionTitle = 'Teacher Evaluation'; + $this->inactivelinks = array( 'Teacher Evaluation' ); + $lc->templateName='teacherEvaluation'; + + $semRecord=array(); + + $db->query("select * from semesters"); + while($db->nextRecord()) + { + array_push($semRecord,$db->record); + } + + + + $t['semRecord']=$semRecord; + + } + + function teacherRun($db,&$u,&$lc,&$t) + { + + $semesterId=$lc->postvars['semester']; + + $semesterEx=explode('.',$semesterId); + + $id=array(); + $names=array(); + $s=$semesterEx[0]; + $db->query("select c.*,concat(p.firstname,' ',p.lastname) as name from classes as c, profile as p " . + "where c.id_semesters='$s' and c.facultyId=p.username order by p.firstname"); + while($db->nextRecord()) + { + array_push($id,$db->record); + array_push($names,$db->record['name']); + } + + $t['semesterSel']=$semesterEx[1]." ".$semesterEx[2]; + $t['flog']=1; + $t['ids']=$id; + $t['names']=$names; + $t['semesterId']=$semesterId; + + + $this->run($db,&$u,&$lc,&$t); + } + + function recordRun($db,&$u,&$lc,&$t) + { + $flag=1; + + $rec=$lc->getvars['rec']; + $rec=explode('|',$rec); + $semRecord=array(); + + $db->query("select c.*,s.id_semesters, s.semesterTerm,s.semesterYear,concat(p.firstname,' ',p.lastname) as name " . + "from classes c,semesters s,profile p " . + "where s.id_semesters=c.id_semesters and p.username=c.facultyId" . + " and c.facultyId='".$rec[2]."' and c.id_courses='".$rec[1]."' and c.id_classes='".$rec[0]."'"); + + + if($db->nextRecord()) + { + $header=$db->record; + } + + $t['header']=$header; + $t['flag']=$flag; + + $this->evaluationRun($db,&$u,&$lc,&$t,$header[id_semesters],$header[id_classes]); + + $lc->postvars['semester'] = $rec[3]; + $this->teacherRun($db,&$u,&$lc,&$t); + + } + + function evaluationRun($db,&$u,&$lc,&$t,$id_semester,$id_classes) + { + + //getting the serial number of questions and their respective weightage + $evalForm=array(); + $countEval=0; + + $db->query("select * from evaluation_form"); + while($db->nextRecord()) + { + array_push($evalForm,$db->record); + $countEval++; + } + + $option=array(); + foreach($evalForm as $e) + { + if($e['excellent']) + $option[$e[serial_no]][count]++; + if($e['very_good']) + $option[$e[serial_no]][count]++; + if($e['good']) + $option[$e[serial_no]][count]++; + if($e['satisfactory']) + $option[$e[serial_no]][count]++; + if($e['unsatisfactory']) + $option[$e[serial_no]][count]++; + + } + + + //getting the data(ids of students) from student_evaluation_form + $totalStud=0; + $studIds=array(); + $db->query("select * from student_evaluation_form where id_classes='$id_classes' group by student_id"); + while($db->nextRecord()) + { + array_push( $studIds,$db->record); + $totalStud++; + } + + $score=0; + $rep=array(); + foreach($evalForm as $e) + { + + $score=0; + foreach($studIds as $id) + { + $db->query("select rank from student_evaluation_form " . + "where id_classes='$id_classes' and serial_no='".$e[serial_no]."' and student_id='".$id[student_id]."'"); + if($db->nextRecord()) + { + $score=$score+$db->record['rank']; + } + } + $rep[$e[serial_no]]=$score; + + } + + + $average=array(); + $i=0; + foreach($evalForm as $e) + { + $val=0; + $val=$e[weightage]/$option[$e[serial_no]][count]; + $average[$i]=($rep[$e[serial_no]] * $val)/($totalStud * $e[weightage]); + $i++; + } + + $t['average']=$average; + $t['fleeg']=1; + $t['flog']=1; + + } +} + + + +?> + + + Added: logicampus/trunk/src/logicreate/services/administration/templates/createEvalForm.html =================================================================== --- logicampus/trunk/src/logicreate/services/administration/templates/createEvalForm.html (rev 0) +++ logicampus/trunk/src/logicreate/services/administration/templates/createEvalForm.html 2010-02-26 10:58:34 UTC (rev 1310) @@ -0,0 +1,189 @@ +<?=$t['sectionheader'];?> + +<?php if ( $t['msg'] ) { ?> + <p style="color:blue;"><?=$t['msg'];?></p> +<?php } ?> +<?php if ( $t['error'] ) { ?> + <p style="color:red;"><?=$t['error'];?></p> +<?php } ?> + + +<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US"> +<!-- + * Created on Oct 15, 2009 + --> + <head> + <title>createEvalForm</title> + <script language="JavaScript" type="text/javascript"> + + + function checkQuestion() + { + var quest=document.getElementById("question").value; + //alert("hello"+quest); + + if( quest == 0 ) + { + alert("Write in a question and then press submit button."); + return false; + } + else + { + var reply=confirm("Are you sure to submit the following questions?\n"+quest); + if(reply) + { + return true; + } + return false; + } + + } + + function confirmFinal() + { + var reply=confirm("Are you sure to finalise the questions?"); + if(reply) + { + return true; + } + return false; + } + + function check(e) + { + var key; + var keychar; + + if (window.event) + key = window.event.keyCode; + keychar = String.fromCharCode(key); + + if ((("0123456789").indexOf(keychar) > -1)) + return true; + else + return false; + } + + function deleteQuestion() + { + var reply=confirm("Are you sure to delete the question?"); + if(reply) + { + return true; + } + return false; + } + + + + </script> + + </head> + <body> + <? if($t['flag']== 0){?> + <form method="post" action="<?=appurl('administration/createEvalForm/event=addQuestion')?>" name="questForm" onSubmit="return checkQuestion();"> + <table> + <tr> + <!--<td><strong>Put your questions<strong></td>--> + </tr> + <tr><td> </td></tr> + <tr> + <td><strong>Question:<strong></td> + <td><textarea name="question" rows="4" cols="20" id="question"><?=$t['tempQuest']?></textarea></td> + <td>Please, enter question.</td> + </tr> + <tr> + <td><strong>Weightage:<strong></td> + <td><input type="text" name="percentage" value="<?=$t['weight']?>" onKeyPress="return check(event);"></td> + <td>Please, provide the percentage of this question. (Note: Overall percentage is 100%)</td> + </tr> + <tr><td> </td></tr> + <input type="hidden" name="hiddenserial" value="<?=$t['srno']?>"/> + <tr><td><input type="submit" value="Submit" /></td></tr> + <tr><td> </td></tr> + </table> + </form> + <?}?> + <?php + + $questions=$t['question']; + $i=1; + + ?> + + <hr> + <form action="<?= appurl('administration/createEvalForm/event=final')?>" method="post" name="viewForm"> + <table border=1> + + <tr> + <td><strong>Question No.</strong></td> + <td><strong>Question</strong></td> + <td><strong>Weight</strong></td> + <?if($t['evalFlag'] == 0){?> + <td><strong>Excellent</strong></td> + <td><strong>Very Good</strong></td> + <td><strong> Good </strong></td> + <td><strong>Satisfactory</strong></td> + <td><strong>Unatisfactory</strong></td> + <?}?> + <!--<td> </td>--> + <!--<td><strong>Visibility</strong></td>--> + </tr> + + <? + foreach($questions as $q) + { + print_r("<tr>"); + //print_r("<td>".$i."</td>"); + ?> + <td align="center"><?=$i?></td> + <input type="hidden" name="hiddensn<?=$i?>" value="<?=$q[serial_no]?>"/> + <!--<td><input type="text" name="qn<?=$i?>" value="<?=$q[question]?>" readonly></td>--> + <td><?=$q[question]?></td> + <!--<td align="center"><input type="text" name="weight<?=$i?>" value="<?=$q[weightage]?>" size="4" readonly"/></td>--> + <td><?=$q[weightage]?></td> + <?if($t['evalFlag'] == 0){?> + <td align="center"><a href="createEvalForm/event=update/data=<?=$q[serial_no].".".$q[excellent]."."."excellent"?>"><?if($q[excellent]){echo "delete";}else{echo "add";}?></a></td> + <td align="center"><a href="createEvalForm/event=update/data=<?=$q[serial_no].".".$q[very_good]."."."very_good"?>"><?if($q[very_good]){echo "delete";}else{echo "add";}?></a></td> + <td align="center"><a href="createEvalForm/event=update/data=<?=$q[serial_no].".".$q[good]."."."good"?>"><?if($q[good]){echo "delete";}else{echo "add";}?></a></td> + <td align="center"><a href="createEvalForm/event=update/data=<?=$q[serial_no].".".$q[satisfactory]."."."satisfactory"?>"><?if($q[satisfactory]){echo "delete";}else{echo "add";}?></a></td> + <td align="center"><a href="createEvalForm/event=update/data=<?=$q[serial_no].".".$q[unsatisfactory]."."."unsatisfactory"?>"><?if($q[unsatisfactory]){echo "delete";}else{echo "add";}?></a></td> + <td align="center"><a href="createEvalForm/event=editQuestion/id=<?=$q[serial_no]?>">edit</a> / <a href="createEvalForm/event=delete/id=<?=$q[serial_no]?>" onClick="return deleteQuestion();">delete</a></td> + <?}?> + <!-- <td align="center"><input type="checkbox" name="visibility[]" id="visibility" value="<?=$i?>" --><?//if($q[visible]){echo "checked";}?> + + <? print_r("</tr>"); + $i++; + $k++; + } + + ?> + + </table> + + <!--<table> + <tr><td> </td></tr> + <tr> + <td width="300"> <td> + <td><input type="submit" name="submitWeight" value="Submit"/></td> + </tr> + </table> --> + <table> + <tr><td> </td></tr> + <tr><td> </td></tr> + <tr> + <td> </td> + <td> </td> + <?if($t['flag'] != 0){?> + <td><input type="submit" name="finalized" value="Finalize and make it visible to students" onClick="return confirmFinal()"/></td> + <?}else{?> + <td><input type="submit" name="finalized" value="Finalize and make it visible to students" disabled/></td> + <?}?> + <td>Note: You can finalize only when, overall weightage, 100% is completely distributed.</td> + </tr> + + </table> + </form> + </body> + +</html> Added: logicampus/trunk/src/logicreate/services/administration/templates/studentVisibleDates.html =================================================================== --- logicampus/trunk/src/logicreate/services/administration/templates/studentVisibleDates.html (rev 0) +++ logicampus/trunk/src/logicreate/services/administration/templates/studentVisibleDates.html 2010-02-26 10:58:34 UTC (rev 1310) @@ -0,0 +1,216 @@ +<?=$t['sectionheader'];?> + +<?php if ( $t['msg'] ) { ?> + <p style="color:blue;"><?=$t['msg'];?></p> +<?php } ?> +<?php if ( $t['error'] ) { ?> + <p style="color:red;"><?=$t['error'];?></p> +<?php } ?> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US"> +<!-- + * Created on Dec 1, 2009 + --> + <head> + <title> </title> + </head> + <body> + <?php + $sdate=array(); + $edate=array(); + $sdate=$t['sdate']; + $edate=$t['edate']; + ?> + + <form action="<?=appurl('administration/studentVisibleDates/event=date')?>" method="post" name="dateForm"> + <table> + <tr><td colspan="2" valign="top" class="tabletitle">Visibility Dates</td></tr> + <tr><td colspan="2" valign="top" class="instructions">instructions: Enter the begining and ending date for the visibility of the form. +</td></tr> + + <tr><td valign="top" class="">Visibility Start Date</td><td valign="top" class=""> +<select name='dateStart[month]'> + <?if($sdate[0] == "January" ){?> + <option value="1" SELECTED>January</option> + <?}else{?> + <option value="1">January</option> + <?}if($sdate[0] == "February"){?> + <option value="2" SELECTED>February</option> + <?}else{?> + <option value="2">February</option> + <?}if($sdate[0] == "March"){?> + <option value="3" SELECTED>March</option> + <?}else{?> + <option value="3">March</option> + <?}if($sdate[0] == "April"){?> + <option value="4" SELECTED>April</option> + <?}else{?> + <option value="4">April</option> + <?}if($sdate[0] == "May"){?> + <option value="5" SELECTED>May</option> + <?}else{?> + <option value="5">May</option> + <?}if($sdate[0] == "June"){?> + <option value="6" SELECTED>June</option> + <?}else{?> + <option value="6">June</option> + <?}if($sdate[0] == "July"){?> + <option value="7" SELECTED>July</option> + <?}else{?> + <option value="7">July</option> + <?}if($sdate[0] == "August"){?> + <option value="8" SELECTED>August</option> + <?}else{?> + <option value="8">August</option> + <?}if($sdate[0] == "September"){?> + <option value="9" SELECTED>September</option> + <?}else{?> + <option value="9">September</option> + <?}if($sdate[0] == "October"){?> + <option value="10" SELECTED>October</option> + <?}else{?> + <option value="10">October</option> + <?}if($sdate[0] == "November"){?> + <option value="11" SELECTED>November</option> + <?}else{?> + <option value="11">November</option> + <?}if($sdate[0] == "December"){?> + <option value="12" SELECTED>December</option> + <?}else{?> + <option value="12">December</option> + <?}?> +</select> + +<select name='dateStart[day]'> +<?php + + for($i=1;$i<=31;$i++) + { + if($sdate[1] == $i) + { + print_r("<option value=".$i." SELECTED>".$i."</option>"); + } + else + { + print_r("<option value=".$i.">".$i."</option>"); + } + } +?> +</select> +<select name='dateStart[year]'> +<?php + + for($j=2009;$j<=2020;$j++) + { + if($sdate[2] == $j) + { + print_r("<option value=".$j." SELECTED>".$j."</option>"); + } + else + { + print_r("<option value=".$j.">".$j."</option>"); + } + } +?> +</select> + +</td> +</tr> + +<tr><td valign="top" class="">Visibility End Date</td><td valign="top" class=""> +<select name='dateEnd[month]'> + <?if($edate[0] == "January" ){?> + <option value="1" SELECTED>January</option> + <?}else{?> + <option value="1">January</option> + <?}if($edate[0] == "February"){?> + <option value="2" SELECTED>February</option> + <?}else{?> + <option value="2">February</option> + <?}if($edate[0] == "March"){?> + <option value="3" SELECTED>March</option> + <?}else{?> + <option value="3">March</option> + <?}if($edate[0] == "April"){?> + <option value="4" SELECTED>April</option> + <?}else{?> + <option value="4">April</option> + <?}if($edate[0] == "May"){?> + <option value="5" SELECTED>May</option> + <?}else{?> + <option value="5">May</option> + <?}if($edate[0] == "June"){?> + <option value="6" SELECTED>June</option> + <?}else{?> + <option value="6">June</option> + <?}if($edate[0] == "July"){?> + <option value="7" SELECTED>July</option> + <?}else{?> + <option value="7">July</option> + <?}if($edate[0] == "August"){?> + <option value="8" SELECTED>August</option> + <?}else{?> + <option value="8">August</option> + <?}if($edate[0] == "September"){?> + <option value="9" SELECTED>September</option> + <?}else{?> + <option value="9">September</option> + <?}if($edate[0] == "October"){?> + <option value="10" SELECTED>October</option> + <?}else{?> + <option value="10">October</option> + <?}if($edate[0] == "November"){?> + <option value="11" SELECTED>November</option> + <?}else{?> + <option value="11">November</option> + <?}if($edate[0] == "December"){?> + <option value="12" SELECTED>December</option> + <?}else{?> + <option value="12">December</option> + <?}?> +</select> +<select name='dateEnd[day]'> +<?php + + for($i=1;$i<=31;$i++) + { + if($edate[1] == $i) + { + print_r("<option value=".$i." SELECTED>".$i."</option>"); + } + else + { + print_r("<option value=".$i.">".$i."</option>"); + } + } +?> +</select> + +<select name='dateEnd[year]'> +<?php + + for($j=2009;$j<=2020;$j++) + { + if($edate[2] == $j) + { + print_r("<option value=".$j." SELECTED>".$j."</option>"); + } + else + { + print_r("<option value=".$j.">".$j."</option>"); + } + } +?> +</select> +</td> +</tr> +<tr><td> </td></tr> +<tr><td><input type="submit" name="submit" value="Submit"/></td></tr> + + </table> + </form> + </body> +</html> Added: logicampus/trunk/src/logicreate/services/administration/templates/teacherEvaluation.html =================================================================== --- logicampus/trunk/src/logicreate/services/administration/templates/teacherEvaluation.html (rev 0) +++ logicampus/trunk/src/logicreate/services/administration/templates/teacherEvaluation.html 2010-02-26 10:58:34 UTC (rev 1310) @@ -0,0 +1,161 @@ +<?=$t['sectionheader'];?> + +<?php if ( $t['msg'] ) { ?> + <p style="color:blue;"><?=$t['msg'];?></p> +<?php } ?> +<?php if ( $t['error'] ) { ?> + <p style="color:red;"><?=$t['error'];?></p> +<?php } ?> + + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US"> +<!-- + * Created on Dec 15, 2009 + --> + <head> + <title>Teacher Evaluation</title> + </head> + <script language="JavaScript" type="text/javascript"> + + function reDirect(rec) + { + + window.location="../teacherEvaluation/event=record/rec="+rec; + + } + + </script> + + <body> + <?php + $semRecord=$t['semRecord']; + + ?> + <form action="<?= appurl('administration/teacherEvaluation/event=teacher')?>" method="post" name="formSemester"> + <table> + <tr> + <td><strong>View Evaluation :</strong></td> + <td><select name="semester"> + <?php + + foreach($semRecord as $sem) + { + + if($t['semesterSel']==$sem[semesterTerm]." ".$sem[semesterYear]){?> + + <option value="<?=$sem[id_semesters].".".$sem[semesterTerm].".".$sem[semesterYear]?>" Selected><?=$sem[semesterTerm]." ".$sem[semesterYear]?></option> + <?}else{?> + <option value="<?=$sem[id_semesters].".".$sem[semesterTerm].".".$sem[semesterYear]?>"><?=$sem[semesterTerm]." ".$sem[semesterYear]?></option> + <?} + }?> + </select></td> + </tr> + <tr><td> </td></tr> + <tr> + <td> </td> + <td><input type="submit" name="submit" value="Get List"/></td> + </tr> + </table> + </form> + + + <?php + $names=$t['names']; + $ids=$t['ids']; + $semId=$t['semesterId']; + $i=0; + + if($t['flog']){ + ?> + <hr> + <form action="<?=appurl('administration/teacherEvaluation/event=record')?>" method="post" name="formRecord"> + <table> + <tr> + <td><strong>Serial No.</strong></td> + <td><strong>Name</strong></td> + </tr> + <?php + $i=1; + foreach($names as $n) + { + print_r("<tr><td align=\"center\">".$i."</td>"); + print_r("<td>".$n."</td>"); + ?> + <td><input type="button" name="view" value="view" onClick="<?echo "reDirect('".$ids[$i-1][id_classes]."|".$ids[$i-1][id_courses]."|".$ids[$i-1][facultyId]."|".$semId."')";?>"/></td></tr> + <? + $i++; + }?> + </tr> + </table> + </form> + + + + <?php + } + $header=$t['header']; + + if ($t['flag']){ + ?> + + <hr> + <table> + <tr> + <td>Semester: <strong><?=$header[semestserTerm]." ".$header[semesterTear]?></strong></td> + <td width="850"> </td> + <td>Instructor Name: <strong><?=$header[name]?></strong></td> + </tr> + <tr> + <td>Course: <strong><?=$header[courseFamilyNumber]?></strong></td> + <td width="850"> </td> + <td>Section Number: <strong><?=$header[sectionNumbers]?></strong></td> + </tr> + <tr> + <td>Clsss Id: <strong><?=$header[id_classes]?></strong></td> + </tr> + </table> + + <?}?> + <br> + <?php + $average=$t['average']; + $overall=array(); + $i=1; + if($t['fleeg']){ + ?> + + <table> + <tr> + <td><strong>Questions</strong></td> + <td> </td> + <td><strong>Percentage</strong></td> + </tr> + <?php + foreach($average as $a) + { + ?> + <tr> + <td align="center">Q<?=$i?></strong></td> + <td align="center">----------------</td> + <? + $overall[$i-1]=($a * 100); + ?> + <td align="center"><?=round($overall[$i-1],2)?></td> + </tr> + <? $i++; + }?> + + <tr><td> </td></tr> + <tr> + <td><strong>Overall Percentage:<strong></td> + <td><strong><?= round(array_sum($overall)/($i-1),2)?>%</strong></td> + <tr> + + </table> + + <?}?> + </body> +</html> Added: logicampus/trunk/src/logicreate/services/classroom/evaluation.lcp =================================================================== --- logicampus/trunk/src/logicreate/services/classroom/evaluation.lcp (rev 0) +++ logicampus/trunk/src/logicreate/services/classroom/evaluation.lcp 2010-02-26 10:58:34 UTC (rev 1310) @@ -0,0 +1,99 @@ +<?php +/* + * Created on Dec 4, 2009 + */ + + + class evaluation extends StudentService + { + + var $presentor='htmlPresentation'; + + var $sectionTitle = 'Evaluation'; + var $inactivelinks = array('Evaluation'); + + function run(&$db,&$u,&$lc,&$t) + { + $lc->templateName='evaluation'; + + $flag=0; + $today=date("Y-m-d",time()); + + $db->query("SELECT * FROM evaluationform_flag WHERE flag='1' AND eval_form='form1'" . + "AND (START<'".$today."' AND END>'".$today."') " . + "OR(START='".$today."' OR END='".$today."')"); + if($db->nextRecord()) + { + $flag=1; + } + + if($flag == 1) + { + + $classId=$u->activeClassTaken->id_classes; + $userId=$u->userId; + + $record=array(); + + $db->query("select * from student_evaluation_form where id_classes='$classId' and student_id='$userId'"); + while($db->nextRecord()) + { + array_push($record,$db->record); + } + + $quests=array(); + $db->query("select * from evaluation_form"); + while($db->nextRecord()) + { + array_push($quests,$db->record); + } + + $t['quests']=$quests; + $t['record']=$record; + $t['flag']=$flag; + + + } + else + { + $t['msg']="Sorry, the form can not be visible to you in the current dates."; + } + + } + + function evaluateRun(&$db,&$u,&$lc,&$t) + { + + $classId=$u->activeClassTaken->id_classes; + $userId=$u->userId; + + $totalQuest=$lc->postvars['hidden']; + + for($i=1;$i<=$totalQuest;$i++) + { + $value=$lc->postvars['quest'.$i]; + $value=explode('.',$value); + + $db->query("select * from student_evaluation_form " . + "where id_classes='$classId' and serial_no='$value[2]' and student_id='$userId'"); + if($db->nextRecord()) + { + + $db->query("update student_evaluation_form set rank='$value[0]' where id_classes='$classId' " . + "and student_id='$userId' and serial_no='$value[2]'"); + + } + else + { + $db->query("insert into student_evaluation_form (student_id,id_classes,serial_no,rank)" . + "values('$userId','$classId','$value[2]','$value[0]')"); + } + + } + + $t['msg']="Sucessfully saved."; + $this->run(&$db,&$u,&$lc,&$t); + } + } + +?> Added: logicampus/trunk/src/logicreate/services/classroom/templates/evaluation.html =================================================================== --- logicampus/trunk/src/logicreate/services/classroom/templates/evaluation.html (rev 0) +++ logicampus/trunk/src/logicreate/services/classroom/templates/evaluation.html 2010-02-26 10:58:34 UTC (rev 1310) @@ -0,0 +1,111 @@ +<?=$t['sectionheader'];?> + +<?php if ( $t['msg'] ) { ?> + <p style="color:blue;"><?=$t['msg'];?></p> +<?php } ?> +<?php if ( $t['error'] ) { ?> + <p style="color:red;"><?=$t['error'];?></p> +<?php } ?> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US"> +<!-- + * Created on Dec 4, 2009 + * + * To change the template for this generated file go to + * Window - Preferences - PHPeclipse - PHP - Code Templates +--> + <head> + <title>evaluation form</title> + + <script language="JavaScript" type="text/javascript"> + function checkQuestion(i) + { + var k = 0; + for(k=1; k < i; k++) + { + var flag = false; + for (var l=0; l < 5; l++) + { + var ques = document.getElementById('quest'+k+l).checked; + if(ques) + { + flag = true; + break; + } + } + if(!flag) + { + alert("Select At Least One Choice From Each Question"); + return false; + } + + } + document.getElementById("form1").submit(); + } + + </script> + + </head> + <body> + <?php + $quests=$t['quests']; + $record=$t['record']; + ?> + + <form action="<?=appurl('classroom/evaluation/event=evaluate')?>" method="post" name="form1" id="form1"> + <?php if($t['flag'] == 1){?> + <table border='1'> + <tr> + <td><strong>Question No.</strong></td> + <td><strong>Question</strong></td> + <td><strong>Excellent</strong></td> + <td><strong>Very Good</strong></td> + <td><strong>Good</strong></td> + <td><strong>Satisfactory</strong></td> + <td><strong>Unsatisfactory</strong></td> + </tr> + + + <?php + $i=1; + foreach($quests as $q) + { + $j = 0; + ?> + <tr> + <td align="center"><?=$i?></td> + <td><?=$q[question]?></td> + <td align="center"><input type="radio" name="quest<?=$i?>" id = "quest<?=$i.$j?>" value="5.excellent.<?=$q[serial_no]?>" <?if($q[excellent]== 0){echo "DISABLED";} if($record[$i-1][rank] == 5){echo "CHECKED";}?>/></td> + <?$j++?> + <td align="center"><input type="radio" name="quest<?=$i?>" id = "quest<?=$i.$j?>" value="4.verygood.<?=$q[serial_no]?>" <?if($q[very_good]== 0){echo "DISABLED";}if($record[$i-1][rank] == 4){echo "CHECKED";}?>/></td> + <?$j++?> + <td align="center"><input type="radio" name="quest<?=$i?>" id = "quest<?=$i.$j?>" value="3.good.<?=$q[serial_no]?>" <?if($q[good]== 0){echo "DISABLED";}if($record[$i-1][rank] == 3){echo "CHECKED";}?>/></td> + <?$j++?> + <td align="center"><input type="radio" name="quest<?=$i?>" id = "quest<?=$i.$j?>" value="2.satisfactory.<?=$q[serial_no]?>" <?if($q[satisfactory]== 0){echo "DISABLED";}if($record[$i-1][rank] == 2){echo "CHECKED";}?>/></td> + <?$j++?> + <td align="center"><input type="radio" name="quest<?=$i?>" id = "quest<?=$i.$j?>" value="1.unsatisfactory.<?=$q[serial_no]?>" <?if($q[unsatisfactory]== 0){echo "DISABLED";}if($record[$i-1][rank] == 1){echo "CHECKED";}?>/></td> + </tr> + <? + $i++; + } + + ?> + + </table> + <table> + <input type="hidden" name="hidden" value="<?=$i-1?>"/> + <tr><td> </td></tr> + <tr> + <td> </td> + <td> </td> + <td><input type="button" name="submitBtn" value="Save" onClick = "return checkQuestion(<?=$i?>)"/></td> + </tr> + </table> + <?}?> + </form> + + </body> +</html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |