[Logicampus-svn] SF.net SVN: logicampus:[1304] logicampus/trunk/src/logicreate/services/ administra
Brought to you by:
trilexcom
From: <fah...@us...> - 2009-08-05 10:50:08
|
Revision: 1304 http://logicampus.svn.sourceforge.net/logicampus/?rev=1304&view=rev Author: faheemkhan Date: 2009-08-05 10:50:00 +0000 (Wed, 05 Aug 2009) Log Message: ----------- Transcript feature addition Modified Paths: -------------- logicampus/trunk/src/logicreate/services/administration/templates/main_main.html Added Paths: ----------- logicampus/trunk/src/logicreate/services/administration/getTranscriptTemplate.lcp logicampus/trunk/src/logicreate/services/administration/templates/generateStudentTranscript.html logicampus/trunk/src/logicreate/services/administration/templates/getTranscriptTemplate.html logicampus/trunk/src/logicreate/services/administration/templates/showTranscriptTemplate.html logicampus/trunk/src/logicreate/services/administration/templates/transcript.html logicampus/trunk/src/logicreate/services/administration/transcript.lcp Added: logicampus/trunk/src/logicreate/services/administration/getTranscriptTemplate.lcp =================================================================== --- logicampus/trunk/src/logicreate/services/administration/getTranscriptTemplate.lcp (rev 0) +++ logicampus/trunk/src/logicreate/services/administration/getTranscriptTemplate.lcp 2009-08-05 10:50:00 UTC (rev 1304) @@ -0,0 +1,186 @@ + <? + /* + * MODULENAME + * created MODULEDATE + * + */ + include_once(LIB_PATH.'PBDO/TranscriptTemplate.php'); + include_once(LIB_PATH.'datagrid.php'); + include_once(LIB_PATH."LC_html.php"); + include_once(LIB_PATH.'semesterObj.php'); + include_once(LIB_PATH.'SiteForms.php'); + + class getTranscriptTemplate extends AdminService + { + var $presentor = "htmlPresentation"; + //var $authorizer = 'ServiceMapAuth'; + var $navlinks = array( + 'Administration Home' => '', + ); + + function run($db,&$u,&$lc,&$t) + { + $lc->templateName = 'getTranscriptTemplate'; + + $db->query("select * from transcript_template"); + $db->nextRecord(); + //echo $db->record['headerLine1']; + //echo $db->record['headerLine2']; + + $t['text1'] = $db->record['headerLine1']; + $t['text2'] = $db->record['headerLine2']; + $t['text3'] = $db->record['footerLine1']; + $t['text4'] = $db->record['footerLine2']; + $t['imgLocation'] = $db->record['imageLocation']; + + + + } + + + function showTranscriptRun($db,&$u,&$lc,&$t){ + + //$lc->templateName = "displayTranscript"; + //$lc->templateStyle = 'private'; + + $id_classes = array(); + $username = $lc->username; + + //echo "HELLO"; + + $content = file_get_contents( $lc->uploads['file']['tmp_name'] ) ; + + $text1 = $lc->postvars['text1']; + $text2 = $lc->postvars['text2']; + $footer1 = $lc->postvars['text3']; + $footer2 = $lc->postvars['text4']; + + + + //strrpos()Finds the position of the last occurrence of a string inside another string (case-sensitive) + /* + echo "Upload: " . $_FILES["file"]["name"] . "<br />"; + echo "Type: " . $_FILES["file"]["type"] . "<br />"; + echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; + echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; + + // $newName = time(); + */ + $dotIndex = strrpos($_FILES["file"]["name"],"."); + $myFileName = substr($_FILES["file"]["name"],0,$dotIndex); + //$myFileName = $myFileName.$newName; + $myFileExt = substr($_FILES["file"]["name"],$dotIndex,strlen($_FILES["file"]["name"])); + + $path = "images/".$_FILES['file']['name']; + + if (move_uploaded_file($_FILES['file']['tmp_name'], "$path")) { + // print "Received {$_FILES['file']['name']} - its size is {$_FILES['file']['size']}"; + } else { + // print "Upload failed!"; + } + + + /* $file=fopen("TranscriptLogo.jpg","w"); + fwrite($file,$content); + fclose($file); + */ + $db2=DB::getHandle(); + $db->query("select * from transcript_template "); + if($db->nextRecord()){ + $db2->query("update transcript_template set headerLine1 = '$text1' , headerLine2 = '$text2', imageLocation = '$myFileName$myFileExt', footerLine1 = '$footer1', footerLine2 = '$footer2'"); + + $t['msg'] = "Record saved SuccessFully"; + } + else{ + $db2->query("insert into transcript_template values('$text1','$text2','$myFileName$myFileExt','$footer1','$footer2')"); + + $t['msg'] = "Record saved SuccessFully"; + + } + $this->run($db,&$u,&$lc,&$t); + return ; + + + /* + if (file_exists(IMAGES_URL. $_FILES["file"]["name"])) + { + echo $_FILES["file"]["name"] . " already exists. "; + } + else + { + move_uploaded_file($_FILES["file"]["tmp_name"], + IMAGES_URL . $_FILES["file"]["name"]); + echo "Stored in: " . IMAGES_URL. $_FILES["file"]["name"]; + } + */ + + + //} + //else + + // } + + + /* + echo $lc->uploads['fileLocation']; + echo $lc->uploads['fileLocation']['tmp_name'] ; + + $file=fopen("TranscriptLogo.jpg","w"); + fwrite($file,$content); + fclose($file); + + //$db->query("insert into transcript_template values('$text1','$text2','".addslashes($content)."')"); + + $db->query("select logoLocation from transcript_template"); + $db->nextRecord(); + + $t['image'] = $db->record['logoLocation']; + */ + }// end of function + + + function displayTranscriptRun($db,&$u,&$lc,&$t){ + + $lc->templateName = "displayTranscript"; + $lc->templateStyle = 'private'; + //echo "In display Transcript func"; + //header('Content-Type: image/jpeg'); + // header('Content-length: '. $db->record['logoLocation']); + + $db->query("select header1,logoLocation from transcript_template"); + $db->nextRecord(); + + echo $db->record['header1'] ; + echo $db->record['logoLocation'] ; + + + + $t['image'] = $db->record['logoLocation']; + + } + + function displayImageRun($db,&$u,&$lc,&$t){ + + //$lc->templateName = "displayTranscript"; + //$lc->templateStyle = 'private'; + + $id_classes = array(); + $username = $lc->username; + $db->query("select logoLocation from transcript_template"); + $db->nextRecord(); + + header('Content-Type: image/jpeg'); + header('Content-length: '. $db->record['logoLocation']); + echo $db->record['logoLocation']; + flush(); + ob_end_flush(); + exit(); + + + + $t['image'] = $db->record['logoLocation']; + + } + + }// end of class + ?> \ No newline at end of file Added: logicampus/trunk/src/logicreate/services/administration/templates/generateStudentTranscript.html =================================================================== --- logicampus/trunk/src/logicreate/services/administration/templates/generateStudentTranscript.html (rev 0) +++ logicampus/trunk/src/logicreate/services/administration/templates/generateStudentTranscript.html 2009-08-05 10:50:00 UTC (rev 1304) @@ -0,0 +1,27 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +<title>Generate Student Transcript</title> +</head> + +<body> + +<form action="<?=appurl('administration/Transcript/')?>" method="post"> +<table> + <tr> + <td>Enter Student Username: </td> + <td><input type="text" id="studentId" name="studentId"> </td> + </tr> + <tr> + <td> </td> + <td><input type="submit" value="Proceed" > </td> + </tr> + +</table> + +</form> + +</body> +</html> Added: logicampus/trunk/src/logicreate/services/administration/templates/getTranscriptTemplate.html =================================================================== --- logicampus/trunk/src/logicreate/services/administration/templates/getTranscriptTemplate.html (rev 0) +++ logicampus/trunk/src/logicreate/services/administration/templates/getTranscriptTemplate.html 2009-08-05 10:50:00 UTC (rev 1304) @@ -0,0 +1,105 @@ + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<?=$t['sectionheader'];?> + +<? +if ($t['msg'] != '') { ?> + <br><span style="color: blue;"><?=$t['msg'];?></span> <br><br><? } ?> + +<? +if ($t['err'] == '') { ?> + +<? } else { ?> + <br><span style="color: red;"><?=$t['err'];?></span><br><br><? } ?> + + +<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US"> +<!-- + * Created on Jun 16, 2009 + * + * To change the template for this generated file go to + * Window - Preferences - PHPeclipse - PHP - Code Templates +--> + <head> + <title>getTranscript </title> + <style type="text/css"> +<!-- +.style1 {color: #FFFFFF} +--> + </style> + </head> +<script type="text/javascript" language="javascript"> +function func(){ + alert("HELLO"); + alert(document.getElementById('fileLocation').src); + +} +</script> + <body> + +<form method="post" action="<?=appurl('administration/getTranscriptTemplate/event=showTranscript')?>" enctype="multipart/form-data"> +<table width="100%"> +<tr bgcolor="#7785FD"> + <td colspan="2"><span class="style1">Define Header: </span></td> + </tr> +<tr> +<td width="30%">Header Text 1: </td> +<td width="70%"><input name="text1" type="text" value="<?= $t['text1']?>" ></td> +</tr> +<tr> + <td> </td> + <td> e.g . Punjab University College Of Information Technology </td> +</tr> +<tr> +<td width="30%">Header Text 2: </td> +<td width="70%"><input name="text2" type="text" value="<?= $t['text2']?>"></td> +</tr> +<tr> + <td> </td> + <td>e.g. The University Of Punjab</td> +</tr> +<tr bgcolor="#7785FD"> + <td colspan="2"><span class="style1">Select your Company Logo: </span></td> + </tr> +<tr> +<td width="30%">Locate the Logo Position: </td> +<td width="70%"><input name="file" type="file" value="" size="" id="file" > </td> +</tr> + +<tr> + <td> </td> + <td>e.g. Your Company Logo </td> +</tr> +<tr bgcolor="#7785FD"> + <td colspan="2"><span class="style1">Define Footer: </span></td> + </tr> +<tr> +<td width="30%">Footer Line 1: </td> +<td width="70%"><input name="text3" type="text" value="<?= $t['text3']?>"/> +</td> +</tr> +<tr> + <td> </td> + <td>e.g. Shahrahe Quaid-e-Azam Allama Iqbal Campus ( Old Campus ) Lahore </td> +</tr> +<tr> +<td width="30%">Footer Line 2: </td> +<td width="70%"><input name="text4" type="text" value="<?= $t['text4']?>"></td> +</tr> + +<tr> + <td></td> + <td>e.g. Contact # +92-111-923-923</td> +</tr> +<tr> +<td></td> +<td><input name="button1" value="Save" type="submit" /></td> + +</tr> +</table> + +</form> + + </body> +</html> Modified: logicampus/trunk/src/logicreate/services/administration/templates/main_main.html =================================================================== --- logicampus/trunk/src/logicreate/services/administration/templates/main_main.html 2009-07-29 13:43:42 UTC (rev 1303) +++ logicampus/trunk/src/logicreate/services/administration/templates/main_main.html 2009-08-05 10:50:00 UTC (rev 1304) @@ -120,7 +120,9 @@ <a href="<?=APP_URL?>examschedule">Exam Scheduling</a> | <a href="<?=APP_URL?>seminarorientation/">Seminar and Orientation Scheduling</a> | <a href="<?=APP_URL?>textbookmgr">Textbook Manager</a> | - <a href="<?=APP_URL?>remotetest">Remote Test Administration</a> + <a href="<?=APP_URL?>remotetest">Remote Test Administration</a> | + <a href="<?=APP_URL?>administration/getTranscriptTemplate/">Define Transcript Template</a> | + <a href="<?=APP_URL?>administration/transcript/event=generateStudentTranscript/">View Transcript</a> </td> </tr> Added: logicampus/trunk/src/logicreate/services/administration/templates/showTranscriptTemplate.html =================================================================== --- logicampus/trunk/src/logicreate/services/administration/templates/showTranscriptTemplate.html (rev 0) +++ logicampus/trunk/src/logicreate/services/administration/templates/showTranscriptTemplate.html 2009-08-05 10:50:00 UTC (rev 1304) @@ -0,0 +1,33 @@ +<?=$t['sectionheader'];?> +<!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 Jun 16, 2009 + * + * To change the template for this generated file go to + * Window - Preferences - PHPeclipse - PHP - Code Templates +--> + <head> + <title> </title> + </head> + <body> + <form> + <!--<input name="" type="image" src="<?= $t['image']; ?>" />--> + <img src="<?= $t['image']; ?> " /> + <table width="100%"> + <table width="50%"> <tr><td></td></tr></table> + + <tr> + <td> </td> + </tr> + <tr> + <td><!-- <? echo $t['image'];?> --> </td> + + </tr> + </table> + + </form> + </body> +</html> Added: logicampus/trunk/src/logicreate/services/administration/templates/transcript.html =================================================================== --- logicampus/trunk/src/logicreate/services/administration/templates/transcript.html (rev 0) +++ logicampus/trunk/src/logicreate/services/administration/templates/transcript.html 2009-08-05 10:50:00 UTC (rev 1304) @@ -0,0 +1,120 @@ + +<!-- + * Created on Jun 18, 2009 + * + * To change the template for this generated file go to + * Window - Preferences - PHPeclipse - PHP - Code Templates + +--> + +<? if ($t['presentation'] == "Yes") {} else{?> + +<? echo $t['sectionheader']; }?> + + + + <head> + <title> </title> + </head> + <body> + <? + + $semesterList = $t['semesterList']; + $resultCourses = $t['resultCourses']; + $semesterClasses = $t['semesterClasses']; + $semesterList = $t['semesterList']; + $semesterTermList = $t['semesterTermList']; + $courseIdList = $t['courseIdList']; + $courseNameList = $t['courseNameList']; + $courseNumberList = $t['courseNumberList']; + ?> + <form> + <div align="center"> + + <table> + <tr> + <td> + + </td> + </tr> + + </table> + + <table width="50%" border="0"> + <tr> + <td width="50"><img src="<?php echo IMAGES_URL.$t['imgLocation']; ?>" width="200%" height="150%" /></td> + + <td rowspan="2" align="center" ><b><? echo $t['text1']; ?></b> + <br/> + <b> <? echo $t['text2']; ?></b></td> + </table> + <table width="50%"> + <tr> + <tr> + <td align="right"> </td> + <td> </td> + <td align="right">Dated : </td> + <td><? echo date("d M, Y");?> </td> + + </tr> <td width align="right"> First Name : </td> + <td> <? echo $t['firstName']; ?> </td> + <td align="right">Last Name : </td> + <td > <? echo $t['lastName']; ?> </td> + </tr> + + + + </table> + + <table width="50%" border="1"> + <? + foreach($semesterList as $sl){ + ?> + <tr bgcolor="#7785FD" style="color:#FFFFFF; background-color:#7785FD "> + <td colspan="3" > Semester + <? echo $semesterTermList[$sl]; ?> </td> + </tr> + + <tr> + <td width="22%"><b>Course Number </b></td> + <td width="43%"><b>Course Name</b></td> + <td width="35%"><b>Marks Obtained</b></td> + + </tr> + + <? foreach($semesterClasses[$sl] as $sc){ + ?> + <tr> + + <td> <? echo $courseNumberList[$courseIdList[$sc]]; ?> </td> + <td> <? echo $courseNameList[$courseIdList[$sc]]; ?> </td> + <td> <? echo $resultCourses[$sc]; ?>%</td> + + </tr> + <? } ?> + + <? } ?> +</table> + +<table border="1" width="50%"> + <tr> + <td align="center"><? echo $t['text3']; ?> + <br/> <? echo $t['text4']; ?> </td> + </tr> +</table> +<br/> +<br/> +<br/> +<table width="50%"> + <tr> + <td align="left">Issuing Authority : _____________________________</td> + + </tr> +</table> + + +<input type="hidden" name="studentId" id="studentId" value="<?= $t['studentId']; ?>"> +</div> +</form> + </body> +</html> Added: logicampus/trunk/src/logicreate/services/administration/transcript.lcp =================================================================== --- logicampus/trunk/src/logicreate/services/administration/transcript.lcp (rev 0) +++ logicampus/trunk/src/logicreate/services/administration/transcript.lcp 2009-08-05 10:50:00 UTC (rev 1304) @@ -0,0 +1,171 @@ +<?php +/* + * Created on Jun 18, 2009 + * + * To change the template for this generated file go to + * Window - Preferences - PHPeclipse - PHP - Code Templates + */ +include_once(LIB_PATH.'datagrid.php'); +include_once(LIB_PATH."LC_html.php"); +include_once(LIB_PATH.'semesterObj.php'); +include_once(LIB_PATH.'SiteForms.php'); + +class transcript extends AdminService { + +var $presentor = "htmlPresentation"; + //var $authorizer = 'ServiceMapAuth'; + var $a_semester_code = array(); + var $a_semester = array(); + + // Links + var $sectionTitle = 'Semster Manager'; + var $navlinks = array( + 'Administration Home' => '', + ); + var $applinks = array( + 'Printer Friendly' => 'Printer Friendly/' + ); + + /* + * Semester terms is used to get the literal meaning of each code. + * If you wish to add additional semester terms to the system, you + * MUST add them to this array. For example, if you wanted to add + * Summer1 and Summer2, add them here first + */ + + var $semesterTerms = array("SU"=>"Summer", "SP"=>"Spring", "FA"=>"Fall", "WI"=>"Winter" + ,'S1'=> 'Summer I', 'S2'=>'Summer II', 'WM'=>'Winter Mini', 'FM'=>'Fall Mini', 'PM'=>'Spring Mini', 'SM'=>'Summer Mini' + ); + + + function run($db,&$u,&$lc,&$t) + { + + $lc->templateName = 'transcript'; + $student_id = $lc->postvars['studentId']; + + if ( $lc->getvars['print'] ) { + $this->presentor = 'emptyPresentation'; + //$this->presentor = 'htmlPresentation'; + $t['presentation'] = "Yes"; + $student_id = $lc->getvars['id']; + }else{ + $this->applinks['Printer Friendly'] = 'transcript/print=yes/id='.$student_id; + } + + $db->query("select * from transcript_template"); + $db->nextRecord(); + + $t['text1'] = $db->record['headerLine1']; + $t['text2'] = $db->record['headerLine2']; + $t['text3'] = $db->record['footerLine1']; + $t['text4'] = $db->record['footerLine2']; + $t['imgLocation'] = $db->record['imageLocation']; + + $classIDList = array();//to hold the list of classes taken by the student + $courseIdList = array();// to hold the courseIds against the classes student have taken + $semesterList = array();// will hold the number of semesters student have taken so far + $semesterTermList = array();// will hold the particular name of the semester + $semesterClasses = array(array());// will hold the record of each class in a particular semester + + $db->query("select distinct semester_id from class_enrollment where student_id = $student_id"); + while($db->nextRecord()) + { + array_push($semesterList ,$db->record['semester_id']); + } + + $t['semesterList'] = $semesterList ; + + $classMarks = array(); + foreach ($semesterList as $sl ) + { + $db->query("select semesterTerm, dateCensus from semesters where id_semesters = $sl"); + $db->nextRecord(); + $semesterTermList[$sl] = $db->record['semesterTerm'].' '.substr($db->record['dateCensus'],0,4); + } + + $t['semesterTermList'] = $semesterTermList; + + foreach ($semesterList as $sl ) + { + $db->query("select class_id from class_enrollment where semester_id = $sl and student_id = $student_id "); + $i=0;// iterator to push id_classes in each semester from index 0. + while ($db->nextRecord()) + { + $semesterClasses[$sl][$i] = $db->record['class_id'] ; + $i++; + } + } + + $t['semesterList'] = $semesterList; + $t['semesterClasses'] = $semesterClasses; + + /** + * getting the grades scored by the student from the previous classes + * */ + foreach($semesterList as $c ){ + foreach($semesterClasses[$c] as $r){ + $db->query("select (sum(score)/tot.total)*100 as score from class_gradebook_val, (SELECT sum(total_points) AS total FROM class_gradebook_entries WHERE id_classes = '$r' ) AS tot" . + " where id_classes = $r and student_id =$student_id "); + $db->nextRecord(); + $resultCourses[$r] = sprintf("%0.2f",$db->record['score']); + } + } + $t['resultCourses'] = $resultCourses; + + + /** + * + * getting the name of the courses on the bases of class id + * + * i have put the courseIdList on the bases of the classIds + * + * */ + foreach($semesterList as $sl ){ + foreach($semesterClasses[$sl] as $sc){ + + $db->query("select distinct id_courses from classes where id_classes = $sc "); + $db->nextRecord(); + + $courseIdList[$sc] = $db->record['id_courses']; + } + } + $t['courseIdList'] = $courseIdList; + + foreach($semesterList as $sl ){ + foreach($semesterClasses[$sl] as $sc){ + + $db->query("select distinct courseName, courseNumber from courses where id_courses = $courseIdList[$sc]"); + $db->nextRecord(); + + $courseNameList[$courseIdList[$sc]] = $db->record['courseName']; + $courseNumberList[$courseIdList[$sc]] = $db->record['courseNumber']; + + } + } + + $t['courseNameList'] = $courseNameList; + $t['courseNumberList'] = $courseNumberList; + $t['classIDList'] = $classIDList; + $t['classMarks'] = $classMarks; + + + + $db->query("select firstname , lastname from profile where username = '$student_id'"); + $db->nextRecord(); + $firstName = $db->record['firstname']; + $lastName = $db->record['lastname']; + + $t['firstName'] = $firstName ; + $t['lastName'] = $lastName ; + + }// end of main function + + +function generateStudentTranscriptRun($db,&$u,&$lc,&$t) +{ + $lc->templateName = 'generateStudentTranscript'; +} +}// end of class + +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |