dokeos-exercise
[ class tree: dokeos-exercise ] [ index: dokeos-exercise ] [ all elements ]

Source for file exercice.php

Documentation is available at exercice.php

  1. <?php
  2. /*
  3.     DOKEOS - elearning and course management software
  4.  
  5.     For a full list of contributors, see documentation/credits.html
  6.  
  7.     This program is free software; you can redistribute it and/or
  8.     modify it under the terms of the GNU General Public License
  9.     as published by the Free Software Foundation; either version 2
  10.     of the License, or (at your option) any later version.
  11.     See "documentation/licence.html" more details.
  12.  
  13.     Contact:
  14.         Dokeos
  15.         Rue du Corbeau, 108
  16.         B-1030 Brussels - Belgium
  17.         info@dokeos.com
  18. */
  19.  
  20.  
  21. /**
  22. *    Exercise list: This script shows the list of exercises for administrators and students.
  23. *    @package dokeos.exercise
  24. *    @author Olivier Brouckaert, original author
  25. *    @author Denes Nagy, HotPotatoes integration
  26. *    @author Wolfgang Schneider, code/html cleanup
  27. *     @version $Id:exercice.php 12269 2007-05-03 14:17:37Z elixir_julian $
  28. */
  29.  
  30.  
  31. // name of the language file that needs to be included
  32. $language_file='exercice';
  33.  
  34. require_once('../inc/global.inc.php');
  35. $this_section=SECTION_COURSES;
  36.  
  37. $show=(isset($_GET['show']&& $_GET['show'== 'result')?'result':'test'// moved down to fix bug: http://www.dokeos.com/forum/viewtopic.php?p=18609#18609
  38.  
  39. /*
  40. -----------------------------------------------------------
  41.     Libraries
  42. -----------------------------------------------------------
  43. */
  44. require_once('exercise.class.php');
  45. require_once('question.class.php');
  46. require_once('answer.class.php');
  47. require_once(api_get_path(LIBRARY_PATH).'fileManage.lib.php');
  48. require_once(api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
  49. require_once('hotpotatoes.lib.php');
  50. require_once(api_get_path(LIBRARY_PATH).'document.lib.php');
  51. include(api_get_path(LIBRARY_PATH).'mail.lib.inc.php');
  52. include(api_get_path(LIBRARY_PATH).'usermanager.lib.php');
  53.  
  54. /*
  55. -----------------------------------------------------------
  56.     Constants and variables
  57. -----------------------------------------------------------
  58. */
  59. $is_allowedToEdit api_is_allowed_to_edit();
  60. $is_tutor api_is_allowed_to_edit(true);
  61.  
  62. $TBL_USER                  Database::get_main_table(TABLE_MAIN_USER);
  63. $TBL_DOCUMENT              Database::get_course_table(TABLE_DOCUMENT);
  64. $TBL_ITEM_PROPERTY      Database::get_course_table(TABLE_ITEM_PROPERTY);
  65. $TBL_EXERCICE_QUESTION    Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
  66. $TBL_EXERCICES            Database::get_course_table(TABLE_QUIZ_TEST);
  67. $TBL_QUESTIONS            Database::get_course_table(TABLE_QUIZ_QUESTION);
  68. $TBL_TRACK_ATTEMPT        Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
  69.  
  70. // document path
  71. $documentPathapi_get_path(SYS_COURSE_PATH).$_course['path']."/document";
  72. // picture path
  73. $picturePath=$documentPath.'/images';
  74. // audio path
  75. $audioPath=$documentPath.'/audio';
  76.  
  77. // hotpotatoes
  78. $uploadPath DIR_HOTPOTATOES//defined in main_api
  79. $exercicePath api_get_self();
  80. $exfile explode('/',$exercicePath);
  81. $exfile strtolower($exfile[sizeof($exfile)-1]);
  82. $exercicePath substr($exercicePath,0,strpos($exercicePath,$exfile));
  83. $exercicePath $exercicePath."exercice.php";
  84.  
  85.  
  86. // maximum number of exercises on a same page
  87. $limitExPage=50;
  88.  
  89. // Clear the exercise session
  90. if(isset($_SESSION['objExercise']))        api_session_unregister('objExercise');        }
  91. if(isset($_SESSION['objQuestion']))        api_session_unregister('objQuestion');        }
  92. if(isset($_SESSION['objAnswer']))        api_session_unregister('objAnswer');        }
  93. if(isset($_SESSION['questionList']))    api_session_unregister('questionList');    }
  94. if(isset($_SESSION['exerciseResult']))    api_session_unregister('exerciseResult');    }
  95.  
  96. //general POST/GET/SESSION/COOKIES parameters recovery
  97. if empty $origin ) ) {
  98.     $origin     $_REQUEST['origin'];
  99. }
  100. if empty ($choice ) ) {
  101.     $choice     $_REQUEST['choice'];
  102. }
  103. if empty $hpchoice ) ) {
  104.     $hpchoice   $_REQUEST['hpchoice'];
  105. }
  106. if empty ($exerciseId ) ) {
  107.     $exerciseId Database::escape_string($_REQUEST['exerciseId']);
  108. }
  109. if empty $file ) ) {
  110.     $file   Database::escape_string($_REQUEST['file']);
  111. }
  112. $learnpath_id Database::escape_string($_REQUEST['learnpath_id']);
  113. $learnpath_item_id Database::escape_string($_REQUEST['learnpath_item_id']);
  114. $page Database::escape_string($_REQUEST['page']);
  115.  
  116. if($origin == 'learnpath'){
  117.     $show 'result';
  118. }
  119. $htmlHeadXtra[]='<style type="text/css">
  120. <!--
  121. a.invisible
  122. {
  123.     color: #999999;
  124. }
  125.  
  126. a.invisible:visited
  127. {
  128.     color: #999999;
  129. }
  130.  
  131. a.invisible:active
  132. {
  133.     color: #999999;
  134. }
  135.  
  136. a.invisible:hover
  137. {
  138.     color: #999999;
  139. }
  140. -->
  141. </style>';
  142.  
  143. if ($show=='result' && $_REQUEST['comments']=='update' && ($is_allowedToEdit || $is_tutor))
  144. {
  145.     $id  $_GET['exeid'];
  146.     $emailid $_GET['emailid'];
  147.     $test  $_GET['test'];
  148.     $from $_SESSION['_user']['mail'];
  149.     $from_name $_SESSION['_user']['firstName']." ".$_SESSION['_user']['lastName'];
  150.     $url api_get_path(WEB_CODE_PATH).'exercice/exercice.php?'.api_get_cidreq().'&show=result';
  151.  
  152.     foreach ($_POST as $key=>$v)
  153.     {
  154.         $keyexp explode('_',$key);
  155.         if ($keyexp[0== "marks")
  156.         {
  157.             $sql "select question from $TBL_QUESTIONS where id = '$keyexp[1]'";
  158.             $result =api_sql_query($sql__FILE____LINE__);
  159.             $ques_name mysql_result($result,0,"question");
  160.  
  161.             $query "update $TBL_TRACK_ATTEMPT set marks = '$v' where question_id = $keyexp[1] and exe_id=$id";
  162.             api_sql_query($query__FILE____LINE__);
  163.  
  164.             $qry 'SELECT sum(marks) as tot
  165.                     FROM '.$TBL_TRACK_ATTEMPT.' where exe_id = '.intval($id).'
  166.                     GROUP BY question_id';
  167.  
  168.             $res api_sql_query($qry,__FILE__,__LINE__);
  169.             $tot mysql_result($res,0,'tot');
  170.  
  171.             $totquery "update $TBL_TRACK_EXERCICES set exe_result = $tot where exe_Id=$id";
  172.             api_sql_query($totquery__FILE____LINE__);
  173.  
  174.         }
  175.         else
  176.         {
  177.           $query "update $TBL_TRACK_ATTEMPT set teacher_comment = '$v' where question_id = $keyexp[1] and exe_id = $id ";
  178.            api_sql_query($query__FILE____LINE__);
  179.         }
  180.  
  181.     }
  182.  
  183.     $qry 'SELECT DISTINCT question_id, marks
  184.             FROM '.$TBL_TRACK_ATTEMPT.' where exe_id = '.intval($id).'
  185.             GROUP BY question_id';
  186.  
  187.     $res api_sql_query($qry,__FILE__,__LINE__);
  188.     $tot 0;
  189.     while($row Database::fetch_array($res,'ASSOC'))
  190.     {
  191.         $tot += $row ['marks'];
  192.     }
  193.  
  194.     $totquery "update $TBL_TRACK_EXERCICES set exe_result = $tot where exe_Id=$id";
  195.  
  196.     api_sql_query($totquery__FILE____LINE__);
  197.     $subject get_lang('ExamSheetVCC');
  198.     $htmlmessage '<html>'.
  199.                 '<head>' .
  200.                 '<style type="text/css">' .
  201.                 '<!--' .
  202.                 '.body{' .
  203.                 'font-family: Verdana, Arial, Helvetica, sans-serif;' .
  204.                 'font-weight: Normal;' .
  205.                 'color: #000000;' .
  206.                 '}' .
  207.                 '.style8 {font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; color: #006699; }' .
  208.                 '.style10 {' .
  209.                 '    font-family: Verdana, Arial, Helvetica, sans-serif;' .
  210.                 '    font-size: 12px;' .
  211.                 '    font-weight: bold;' .
  212.                 '}' .
  213.                 '.style16 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }' .
  214.                 '-->' .
  215.                 '</style>' .
  216.                 '</head>' .
  217.                 '<body>' .
  218.                 '<div>' .
  219.                 '  <p>'.get_lang('DearStudentEmailIntroduction').'</p>' .
  220.                 '  <p class="style10"> '.get_lang('AttemptVCC').' </p>' .
  221.                 '  <table width="417">' .
  222.                 '    <tr>' .
  223.                 '      <td width="229" valign="top" bgcolor="E5EDF8">&nbsp;&nbsp;<span class="style10">'.get_lang('Question').'</span></td>' .
  224.                 '      <td width="469" valign="top" bgcolor="#F3F3F3"><span class="style16">#ques_name#</span></td>' .
  225.                 '    </tr>' .
  226.                 '    <tr>' .
  227.                 '      <td width="229" valign="top" bgcolor="E5EDF8">&nbsp;&nbsp;<span class="style10">'.get_lang('Exercice').'</span></td>' .
  228.                 '       <td width="469" valign="top" bgcolor="#F3F3F3"><span class="style16">#test#</span></td>' .
  229.                 '    </tr>' .
  230.                 '  </table>' .
  231.                 '  <p>'.get_lang('ClickLinkToViewComment').' <a href="#url#">#url#</a><br />' .
  232.                 '    <br />' .
  233.                 '  '.get_lang('Regards').' </p>' .
  234.                 '  </div>' .
  235.                 '  </body>' .
  236.                 '  </html>';
  237.     $message '<p>'.sprintf(get_lang('AttemptVCCLong'),$test).' <A href="#url#">#url#</A></p><br />';
  238.     $messstr_replace("#test#",$test,$message);
  239.     //$message= str_replace("#ques_name#",$ques_name,$mess);
  240.     $message str_replace("#url#",$url,$mess);
  241.     $mess stripslashes($message);
  242.     $headers  " MIME-Version: 1.0 \r\n";
  243.     $headers .= "User-Agent: Dokeos/1.6";
  244.     $headers .= "Content-Transfer-Encoding: 7bit";
  245.     $headers .= 'From: '.$from_name.' <'.$from.'>' "\r\n";
  246.     $headers="From:$from_name\r\nReply-to: $to\r\nContent-type: text/html; charset=".($charset?$charset:'ISO-8859-15');
  247.     //mail($emailid, $subject, $mess,$headers);
  248.  
  249.     api_mail_html($emailid$emailid$subject$mess$from_name$from);
  250.     
  251.  
  252.     if(in_array($originarray('tracking_course','user_course'))){
  253.         //Redirect to the reporting        
  254.         header('location: ../mySpace/myStudents.php?origin='.$origin.'&student='.$_GET['student'].'&details=true&course='.$_GET['course']);
  255.     }
  256. }
  257.  
  258. if($show!='result')
  259. {
  260.     $nameTools=get_lang('Exercices');
  261. }
  262. else
  263. {
  264.     if($is_allowedToEdit || $is_tutor)
  265.     {
  266.         $nameTools=get_lang('StudentScore');
  267.         $interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices'));
  268.     }
  269.     else
  270.     {
  271.         $nameTools=get_lang('YourScore');
  272.         $interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices'));
  273.     }
  274. }
  275.  
  276. // need functions of statsutils lib to display previous exercices scores
  277. include_once(api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php');
  278.  
  279. if($is_allowedToEdit && !empty($choice&& $choice == 'exportqti2')
  280. {
  281.     require_once('export/qti2/qti2_export.php');
  282.     $export export_exercise($exerciseId,true);
  283.  
  284.     require_once(api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php');
  285.     $garbage_path api_get_path(GARBAGE_PATH);
  286.     $temp_dir_short uniqid();
  287.     $temp_zip_dir $garbage_path."/".$temp_dir_short;
  288.     if(!is_dir($temp_zip_dir)) mkdir($temp_zip_dir);
  289.     $temp_zip_file $temp_zip_dir."/".md5(time()).".zip";
  290.     $temp_xml_file $temp_zip_dir."/qti2export_".$exerciseId.'.xml';
  291.     file_put_contents($temp_xml_file,$export);
  292.     $zip_folder=new PclZip($temp_zip_file);    
  293.     $zip_folder->add($temp_zip_dirPCLZIP_OPT_REMOVE_PATH$temp_zip_dir);
  294.     $name 'qti2_export_'.$exerciseId.'.zip';
  295.     
  296.     //DocumentManager::string_send_for_download($export,true,'qti2export_'.$exerciseId.'.xml');
  297.     DocumentManager::file_send_for_download($temp_zip_file,true,$name);
  298.     unlink($temp_zip_file);
  299.     unlink($temp_xml_file);
  300.     rmdir($temp_zip_dir);
  301.     exit()//otherwise following clicks may become buggy
  302. }
  303. if(!empty($_POST['export_user_fields']))
  304. {
  305.     switch($_POST['export_user_fields'])
  306.     {
  307.         case 'export_user_fields':
  308.             $_SESSION['export_user_fields'true;
  309.             break;
  310.         case 'do_not_export_user_fields':
  311.         default:
  312.             $_SESSION['export_user_fields'false;
  313.             break;
  314.     }
  315. }
  316. if(!empty($_POST['export_report']&& $_POST['export_report'== 'export_report')
  317. {
  318.     {
  319.         $user_id null;
  320.         if(empty($_SESSION['export_user_fields'])) $_SESSION['export_user_fields'false;
  321.         if(!$is_allowedToEdit and !$is_tutor)
  322.         {
  323.             $user_id api_get_user_id();
  324.         }
  325.         require_once('exercise_result.class.php');
  326.         switch($_POST['export_format'])
  327.         {
  328.             case 'xls':
  329.                 $export new ExerciseResult();
  330.                 $export->exportCompleteReportXLS($documentPath$user_id$_SESSION['export_user_fields']);
  331.                 exit;
  332.                 break;
  333.             case 'csv':
  334.             default:
  335.                 $export new ExerciseResult();
  336.                 $export->exportCompleteReportCSV($documentPath$user_id$_SESSION['export_user_fields']);
  337.                 exit;
  338.                 break;
  339.         }
  340.     }
  341.     else
  342.     {
  343.         api_not_allowed(true);
  344.     }
  345. }
  346.  
  347. if ($origin != 'learnpath')
  348. {
  349.     //so we are not in learnpath tool
  350.     Display::display_header($nameTools,"Exercise");
  351.     if(isset($_GET['message']))
  352.     {
  353.         if (in_array($_GET['message']array('ExerciseEdited')))
  354.         {
  355.             Display::display_confirmation_message(get_lang($_GET['message']));
  356.         }
  357.     }
  358.  
  359. }
  360. else
  361. {
  362.     echo '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CODE_PATH).'css/default.css"/>';
  363. }
  364.  
  365. // used for stats
  366. include_once(api_get_path(LIBRARY_PATH).'events.lib.inc.php');
  367.  
  368.  
  369.  
  370.  
  371. // selects $limitExPage exercises at the same time
  372. $from=$page*$limitExPage;
  373. $sql="SELECT count(id) FROM $TBL_EXERCICES";
  374. $res api_sql_query($sql,__FILE__,__LINE__);
  375. list($nbrexercDatabase::fetch_array($res);
  376.  
  377. HotPotGCt($documentPath,1,$_user['user_id']);
  378.  
  379. // only for administrator
  380.  
  381. if($is_allowedToEdit)
  382. {
  383.  
  384.     if(!empty($choice))
  385.     {
  386.         // construction of Exercise
  387.         $objExerciseTmp=new Exercise();
  388.  
  389.         if($objExerciseTmp->read($exerciseId))
  390.         {
  391.             switch($choice)
  392.             {
  393.                 case 'delete':    // deletes an exercise
  394.                                 $objExerciseTmp->delete();
  395.                                 Display::display_confirmation_message(get_lang('ExerciseDeleted'));
  396.                                 break;
  397.                 case 'enable':  // enables an exercise
  398.                                 $objExerciseTmp->enable();
  399.                                 $objExerciseTmp->save();
  400.  
  401.                                 // "WHAT'S NEW" notification: update table item_property (previously last_tooledit)
  402.                                 api_item_property_update($_courseTOOL_QUIZ$exerciseId"QuizAdded"$_user['user_id']);
  403.  
  404.                                 Display::display_confirmation_message(get_lang('VisibilityChanged'));
  405.  
  406.                                 break;
  407.                 case 'disable'// disables an exercise
  408.                                 $objExerciseTmp->disable();
  409.                                 $objExerciseTmp->save();
  410.                                 Display::display_confirmation_message(get_lang('VisibilityChanged'));
  411.                                 break;
  412.                 case 'disable_results' //disable the results for the learners
  413.                                 $objExerciseTmp->disable_results();
  414.                                 $objExerciseTmp->save();
  415.                                 Display::display_confirmation_message(get_lang('ResultsDisabled'));
  416.                                 break;
  417.                 case 'enable_results' //disable the results for the learners
  418.                                 $objExerciseTmp->enable_results();
  419.                                 $objExerciseTmp->save();
  420.                                 Display::display_confirmation_message(get_lang('ResultsEnabled'));
  421.                                 break;
  422.             }
  423.         }
  424.  
  425.         // destruction of Exercise
  426.         unset($objExerciseTmp);
  427.     }
  428.  
  429.     //$sql="SELECT id,title,type,active FROM $TBL_EXERCICES ORDER BY title LIMIT $from,".($limitExPage+1);
  430.     //$result=api_sql_query($sql,__FILE__,__LINE__);
  431.  
  432.  
  433.     if(!empty($hpchoice))
  434.     {
  435.         switch($hpchoice)
  436.         {
  437.                 case 'delete':    // deletes an exercise
  438.                     $imgparams array();
  439.                     $imgcount 0;
  440.                     GetImgParams($file,$documentPath,$imgparams,$imgcount);
  441.                     $fld GetFolderName($file);
  442.                     for($i=0;$i $imgcount;$i++)
  443.                     {
  444.                             my_delete($documentPath.$uploadPath."/".$fld."/".$imgparams[$i]);
  445.                             update_db_info("delete"$uploadPath."/".$fld."/".$imgparams[$i]);
  446.                     }
  447.  
  448.                     if my_delete($documentPath.$file))
  449.                     {
  450.                         update_db_info("delete"$file);
  451.                     }
  452.                     my_delete($documentPath.$uploadPath."/".$fld."/");
  453.                     break;
  454.                 case 'enable':  // enables an exercise
  455.                     $newVisibilityStatus "1"//"visible"
  456.                     $query "SELECT id FROM $TBL_DOCUMENT WHERE path='$file'";
  457.                     $res api_sql_query($query,__FILE__,__LINE__);
  458.                     $row Database::fetch_array($res'ASSOC');
  459.                     api_item_property_update($_courseTOOL_DOCUMENT$row['id']'visible'$_user['user_id']);
  460.                     //$dialogBox = get_lang('ViMod');
  461.  
  462.                             break;
  463.                 case 'disable'// disables an exercise
  464.                     $newVisibilityStatus "0"//"invisible"
  465.                     $query "SELECT id FROM $TBL_DOCUMENT WHERE path='$file'";
  466.                     $res api_sql_query($query,__FILE__,__LINE__);
  467.                     $row Database::fetch_array($res'ASSOC');
  468.                     api_item_property_update($_courseTOOL_DOCUMENT$row['id']'invisible'$_user['user_id']);
  469.                     #$query = "UPDATE $TBL_DOCUMENT SET visibility='$newVisibilityStatus' WHERE path=\"".$file."\""; //added by Toon
  470.                     #api_sql_query($query,__FILE__,__LINE__);
  471.                     //$dialogBox = get_lang('ViMod');
  472.                     break;
  473.                 default:
  474.                     break;
  475.         }
  476.     }
  477.  
  478.     if($show == 'test')
  479.     {
  480.         $sql="SELECT id,title,type,active,description, results_disabled FROM $TBL_EXERCICES WHERE active<>'-1' ORDER BY title LIMIT $from,".($limitExPage+1);
  481.         $result=api_sql_query($sql,__FILE__,__LINE__);
  482.     }
  483. }
  484. // only for students
  485. elseif($show == 'test')
  486. {
  487.     $sql="SELECT id,title,type,description, results_disabled FROM $TBL_EXERCICES WHERE active='1' ORDER BY title LIMIT $from,".($limitExPage+1);
  488.     $result=api_sql_query($sql,__FILE__,__LINE__);
  489. }
  490.  
  491.  
  492. if($show == 'test'){
  493.  
  494.     $nbrExercises=Database::num_rows($result);
  495.  
  496.     echo '<table border="0" align="center" cellpadding="2" cellspacing="2" width="100%">'.
  497.         '<tr>';
  498.  
  499.     if (($is_allowedToEditand ($origin != 'learnpath'))
  500.     {
  501.         echo '<td width="50%" nowrap="nowrap">'.
  502.             '<img src="../img/new_test.gif" alt="new test" align="absbottom">&nbsp;<a href="exercise_admin.php?'.api_get_cidreq().'">'.get_lang('NewEx').'</a>'.
  503.             ' | <img src="../img/jqz.jpg" alt="HotPotatoes" valign="ABSMIDDLE">&nbsp;<a href="hotpotatoes.php">'.get_lang('ImportHotPotatoesQuiz').'</a>'.
  504.             '</td>'.
  505.             '<td width="50%" align="right">';
  506.     }
  507.     else
  508.     {
  509.         echo '<td align="right">';
  510.     }
  511.  
  512.     //get HotPotatoes files (active and inactive)
  513.     $res api_sql_query ("SELECT *
  514.                     FROM $TBL_DOCUMENT
  515.                     WHERE
  516.                     path LIKE '".$uploadPath."/%/%'",__FILE__,__LINE__);
  517.     $nbrTests Database::num_rows($res);
  518.     $res api_sql_query ("SELECT *
  519.                     FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip
  520.                     WHERE  d.id = ip.ref
  521.                     AND ip.tool = '".TOOL_DOCUMENT."'
  522.                     AND d.path LIKE '".$uploadPath."/%/%'
  523.                     AND ip.visibility='1'"__FILE__,__LINE__);
  524.     $nbrActiveTests Database::num_rows($res);
  525.  
  526.     if($is_allowedToEdit)
  527.     {//if user is allowed to edit, also show hidden HP tests
  528.         $nbrHpTests $nbrTests;
  529.     }else
  530.     {
  531.         $nbrHpTests $nbrActiveTests;
  532.     }
  533.     $nbrNextTests $nbrexerc-$nbrHpTests-(($page*$limitExPage));
  534.  
  535.  
  536.     //show pages navigation link for previous page
  537.     if($page)
  538.     {
  539.         echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&page=".($page-1)."\">&lt;&lt; ",get_lang("PreviousPage")."</a> | ";
  540.     }
  541.     elseif($nbrExercises+$nbrNextTests $limitExPage)
  542.     {
  543.         echo "&lt;&lt; ",get_lang("PreviousPage")." | ";
  544.     }
  545.  
  546.     //show pages navigation link for previous page
  547.     if($nbrExercises+$nbrNextTests $limitExPage)
  548.     {
  549.         echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&page=".($page+1)."\">&gt;&gt; ",get_lang("NextPage")."</a>";
  550.  
  551.     }
  552.     elseif($page)
  553.     {
  554.         echo get_lang("NextPage"" &gt;&gt;";
  555.     }
  556.  
  557.     echo '</td>',
  558.             '</tr>',
  559.             '</table>';
  560.  
  561. ?>
  562. <table class="data_table">
  563.   <?php
  564.     if (($is_allowedToEditand ($origin != 'learnpath'))
  565.     {
  566.     ?>
  567.   <tr class="row_odd">
  568.     <th colspan="2"><?php echo get_lang("ExerciseName");?></th>
  569.      <th><?php echo get_lang("Description");?></th>
  570.      <th><?php echo get_lang('Export');?></th>
  571.      <th><?php echo get_lang("Modify");?></th>
  572.  
  573.   </tr>
  574.   <?php
  575.     }
  576.   else
  577.     {
  578.      ?> <tr bgcolor="#e6e6e6">
  579.      <th><?php echo get_lang("ExerciseName");?></th>
  580.      <th><?php echo get_lang("Description");?></th>
  581.      <th><?php echo get_lang("State");?></th>
  582.  
  583.   </tr>
  584.     <?php }
  585.  
  586.     // show message if no HP test to show
  587.     if(!($nbrExercises+$nbrHpTests) )
  588.     {
  589.     ?>
  590.   <tr>
  591.     <td <?php echo ($is_allowedToEdit?'colspan="5"':'colspan="3"')?>><?php echo get_lang("NoEx")?></td>
  592.   </tr>
  593.   <?php
  594.     }
  595.  
  596.     $i=1;
  597.  
  598.     // while list exercises
  599.  
  600.     if ($origin != 'learnpath'
  601.     {
  602.           //avoid sending empty parameters
  603.           $myorigin (empty($origin)?'':'&origin='.$origin);
  604.           $mylpid (empty($learnpath_id)?'':'&learnpath_id='.$learnpath_id);
  605.           $mylpitemid (empty($learnpath_item_id)?'':'&learnpath_item_id='.$learnpath_item_id);
  606.         while($row=Database::fetch_array($result))
  607.         {
  608.  
  609.             if($i%2==0$s_class="row_odd"else $s_class="row_even";
  610.             echo '<tr class="'.$s_class.'">'."\n";
  611.  
  612.             // prof only
  613.             if($is_allowedToEdit)
  614.             {
  615.                 ?>
  616.           <td width="27%" colspan="2">
  617.           <table border="0" cellpadding="0" cellspacing="0" width="100%">
  618.             <tr>
  619.               <td width="30" align="left"><img src="../img/quiz.gif"></td>
  620.               <td width="15" valign="left" align="center"><?php echo ($i+($page*$limitExPage)).'.'?></td>
  621.               <?php $row['title']=api_parse_tex($row['title'])?>
  622.               <td>
  623.                   <a href="exercice_submit.php?<?php echo api_get_cidreq().$myorigin.$mylpid.$mylpitemid?>&exerciseId=<?php echo $row['id']?><?php if(!$row['active']echo 'class="invisible"'?>><?php echo $row['title']?></a>
  624.               </td>
  625.             </tr>
  626.           </table>
  627.           </td>
  628.           <td width="8%" align="center"> <?php
  629.           $exid $row['id'];
  630.           $sqlquery "SELECT count(*) FROM $TBL_EXERCICE_QUESTION WHERE exercice_id = '$exid'";
  631.           $sqlresult =api_sql_query($sqlquery);
  632.           $rowi mysql_result($sqlresult,0);
  633.           echo $rowi.' '.strtolower(get_lang(($rowi>1?'Questions':'Question'))).'</td>';
  634.             echo '<td width="5%" align="center"><a href="exercice.php?choice=exportqti2&exerciseId='.$row['id'].'"><img src="../img/export.png" border="0" title="IMS/QTI" /></a></td>';
  635.             ?>
  636.            <td width="12%" align="center">
  637.            <a href="exercise_admin.php?modifyExercise=yes&exerciseId=<?php echo $row['id']?>"> <img src="../img/edit.gif" border="0" title="<?php echo htmlentities(get_lang('Modify'),ENT_QUOTES,$charset)?>" alt="<?php echo htmlentities(get_lang('Modify'),ENT_QUOTES,$charset)?>" /></a>
  638.            <a href="admin.php?exerciseId=<?php echo $row['id']?>"><img src="../img/wizard_small.gif" border="0" title="<?php echo htmlentities(get_lang('Build'),ENT_QUOTES,$charset)?>" alt="<?php echo htmlentities(get_lang('Build'),ENT_QUOTES,$charset)?>" /></a>
  639.            <a href="exercice.php?choice=delete&exerciseId=<?php echo $row['id']?>" onclick="javascript:if(!confirm('<?php echo addslashes(htmlentities(get_lang('AreYouSureToDelete'),ENT_QUOTES,$charset))echo " ".$row['title']echo "?"?>')) return false;"> <img src="../img/delete.gif" border="0" alt="<?php echo htmlentities(get_lang('Delete'),ENT_QUOTES,$charset)?>" /></a>
  640.         <?php
  641.                 // if active
  642.                 if($row['active'])
  643.                 {
  644.                     ?>
  645.       <a href="exercice.php?choice=disable&page=<?php echo $page?>&exerciseId=<?php echo $row['id']?>"> <img src="../img/visible.gif" border="0" alt="<?php echo htmlentities(get_lang('Deactivate'),ENT_QUOTES,$charset)?>" /></a>
  646.     <?php
  647.                 }
  648.                 // else if not active
  649.                 else
  650.                 {
  651.                     ?>
  652.       <a href="exercice.php?choice=enable&page=<?php echo $page?>&exerciseId=<?php echo $row['id']?>"> <img src="../img/invisible.gif" border="0" alt="<?php echo htmlentities(get_lang('Activate'),ENT_QUOTES,$charset)?>" /></a>
  653.     <?php
  654.                 }
  655.                 
  656.                 if($row['results_disabled'])
  657.                     echo '<a href="exercice.php?choice=enable_results&page='.$page.'&exerciseId='.$row['id'].'" title="'.get_lang('EnableResults').'" alt="'.get_lang('EnableResults').'"><img src="../img/lp_quiz_na.gif" border="0" alt="'.htmlentities(get_lang('EnableResults'),ENT_QUOTES,$charset).'" /></a>';
  658.                 else
  659.                     echo '<a href="exercice.php?choice=disable_results&page='.$page.'&exerciseId='.$row['id'].'" title="'.get_lang('DisableResults').'" alt="'.get_lang('DisableResults').'"><img src="../img/lp_quiz.gif" border="0" alt="'.htmlentities(get_lang('DisableResults'),ENT_QUOTES,$charset).'" /></a>';
  660.                 
  661.                 echo "</td>";
  662.                 echo "</tr>\n";
  663.  
  664.             }
  665.             // student only
  666.             else
  667.             {
  668.                 ?>
  669.       <td width="40%"><table border="0" cellpadding="0" cellspacing="0" width="100%">
  670.           <tr>
  671.             <td width="20" valign="top" align="right"><?php echo ($i+($page*$limitExPage)).'.'?></td>
  672.             <td width="1">&nbsp;</td>
  673.             <?php $row['title']=api_parse_tex($row['title']);?>
  674.             <td><a href="exercice_submit.php?<?php echo api_get_cidreq().$myorigin.$mylpid.$myllpitemid?>&exerciseId=<?php echo $row['id']?>"><?php echo $row['title']?></a></td>
  675.  
  676.             </tr>
  677.     </table></td>
  678.      <td align="center"> <?php
  679.   $exid $row['id'];
  680.   $sqlquery "SELECT count(*) FROM $TBL_EXERCICE_QUESTION WHERE exercice_id = '$exid'";
  681.   $sqlresult =api_sql_query($sqlquery);
  682.   $rowi mysql_result($sqlresult,0);
  683.   echo ($rowi>1?get_lang('Questions'):get_lang('Question'))?> </td>
  684.  
  685.     <td align="center"><?php
  686.         $eid $row['id'];
  687.     $uidapi_get_user_id();
  688.     //this query might be improved later on by ordering by the new "tms" field rather than by exe_id
  689.     $qry "select * from $TBL_TRACK_EXERCICES where exe_exo_id = $eid and exe_user_id = $uid and exe_cours_id = '".api_get_course_id()."' ORDER BY exe_id DESC";    
  690.     $qryres api_sql_query($qry);
  691.     $num Database::num_rows($qryres);
  692.     if($num>0)
  693.     {
  694.         $row Database::fetch_array($qryres);
  695.         $percentage 0;
  696.         if($row['exe_weighting'!= 0)
  697.         {
  698.             $percentage ($row['exe_result']/$row['exe_weighting'])*100;
  699.         }
  700.         echo get_lang('Attempted').' ('.get_lang('Score').':';
  701.         printf("%1.2f\n",$percentage);
  702.         echo " %)";
  703.     }
  704.     else
  705.     {
  706.         echo get_lang('NotAttempted');
  707.     }
  708.     ?></td>
  709.   </tr>
  710.  
  711.   <?php
  712.             }
  713.  
  714.             // skips the last exercise, that is only used to know if we have or not to create a link "Next page"
  715.             if($i == $limitExPage)
  716.             {
  717.                 break;
  718.             }
  719.  
  720.             $i++;
  721.             
  722.         }    // end while()
  723.  
  724.         $ind $i;
  725.  
  726.  
  727.         if (($from+$limitExPage-1)>$nbrexerc)
  728.         {
  729.             if($from>$nbrexerc)
  730.             {
  731.                 $from $from $nbrexerc;
  732.                   $to $limitExPage;
  733.             }
  734.             else
  735.             {
  736.                 $to $limitExPage-($nbrexerc-$from);
  737.                 $from 0;
  738.             }
  739.         }
  740.         else{
  741.             $to $limitExPage;
  742.         }
  743.         
  744.         if($is_allowedToEdit)
  745.         {
  746.             $sql "SELECT d.path as path, d.comment as comment, ip.visibility as visibility
  747.                 FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip
  748.                             WHERE   d.id = ip.ref AND ip.tool = '".TOOL_DOCUMENT."' AND
  749.                              (d.path LIKE '%htm%')
  750.                             AND   d.path  LIKE '".$uploadPath."/%/%' LIMIT $from,$to"// only .htm or .html files listed
  751.         }
  752.         else
  753.         {
  754.             $sql "SELECT d.path as path, d.comment as comment, ip.visibility as visibility
  755.                 FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip
  756.                                 WHERE d.id = ip.ref AND ip.tool = '".TOOL_DOCUMENT."' AND
  757.                                  (d.path LIKE '%htm%')
  758.                                 AND   d.path  LIKE '".$uploadPath."/%/%' AND ip.visibility='1' LIMIT $from,$to";
  759.         }
  760.  
  761.         $result api_sql_query ($sql,__FILE__,__LINE__);
  762.         
  763.         while($row Database::fetch_array($result'ASSOC'))
  764.         {
  765.             $attribute['path'      ][$row['path'      ];
  766.             $attribute['visibility'][$row['visibility'];
  767.             $attribute['comment'   ][$row['comment'   ];
  768.         }
  769.         $nbrActiveTests 0;
  770.         if(is_array($attribute['path']))
  771.         {
  772.             while(list($key,$patheach($attribute['path']))
  773.             {
  774.                 list($a,$vis)=each($attribute['visibility']);
  775.                 if (strcmp($vis,"1")==0)
  776.                 $active=1;}
  777.                 else
  778.                 $active=0;}
  779.                 echo "<tr>\n";
  780.  
  781.                 $title GetQuizName($path,$documentPath);
  782.                 if ($title =='')
  783.                 {
  784.                     $title GetFileName($path);
  785.                 }
  786.                 // prof only
  787.                 if($is_allowedToEdit)
  788.                 {
  789.                     /************/
  790.                     ?>
  791.   <td width="27%" colspan="2">
  792.   <table border="0" cellpadding="0" cellspacing="0" width="100%">
  793.     <tr>
  794.       <td width="30" align="left"><img src="../img/jqz.jpg" alt="HotPotatoes" /></td>
  795.        <td width="15" align="center"><?php echo ($ind+($page*$limitExPage)).'.'?></td>
  796.        <td><a href="showinframes.php?file=<?php echo $path?>&cid=<?php echo $_course['official_code'];?>&uid=<?php echo $_user['user_id'];?><?php if(!$activeecho 'class="invisible"'?>><?php echo $title?></a></td>
  797.     </tr>
  798.   </table></td>
  799.   <td></td><td></td>
  800.       <td width="12%" align="center"><a href="adminhp.php?hotpotatoesName=<?php echo $path?>"> <img src="../img/edit.gif" border="0" alt="<?php echo htmlentities(get_lang('Modify'),ENT_QUOTES,$charset)?>" /></a>
  801.        <img src="../img/wizard_gray_small.gif" border="0" title="<?php echo htmlentities(get_lang('Build'),ENT_QUOTES,$charset)?>" alt="<?php echo htmlentities(get_lang('Build'),ENT_QUOTES,$charset)?>" />
  802.   <a href="<?php echo $exercicePath?>?hpchoice=delete&file=<?php echo $path?>" onclick="javascript:if(!confirm('<?php echo addslashes(htmlentities(get_lang('AreYouSure'),ENT_QUOTES,$charset).$title."?")?>')) return false;"><img src="../img/delete.gif" border="0" alt="<?php echo htmlentities(get_lang('Delete'),ENT_QUOTES,$charset)?>" /></a>
  803.     <?php
  804.                     // if active
  805.                     if($active)
  806.                     {
  807.                         $nbrActiveTests $nbrActiveTests 1;
  808.                         ?>
  809.       <a href="<?php echo $exercicePath?>?hpchoice=disable&page=<?php echo $page?>&file=<?php echo $path?>"><img src="../img/visible.gif" border="0" alt="<?php echo htmlentities(get_lang('Deactivate'),ENT_QUOTES,$charset)?>" /></a>
  810.     <?php
  811.                     }
  812.                     // else if not active
  813.                     else
  814.                     {
  815.                         ?>
  816.     <a href="<?php echo $exercicePath?>?hpchoice=enable&page=<?php echo $page?>&file=<?php echo $path?>"><img src="../img/invisible.gif" border="0" alt="<?php echo htmlentities(get_lang('Activate'),ENT_QUOTES,$charset)?>" /></a>
  817.     <?php
  818.                     }
  819.                     echo '<img src="../img/lp_quiz_na.gif" border="0" alt="" />';
  820.                 /****************/
  821.                 ?></td>
  822.       <?php }
  823.                 // student only
  824.                 else
  825.                 {
  826.                     if ($active==1)
  827.                     {
  828.                         $nbrActiveTests $nbrActiveTests 1;
  829.                         ?>
  830.     <td width="40%"><table border="0" cellpadding="0" cellspacing="0" width="100%">
  831.  
  832.         <td width="20" align="right"><?php echo ($ind+($page*$limitExPage)).'.'?><!--<img src="../img/jqz.jpg" alt="HotPotatoes" />--></td>
  833.        <td width="1">&nbsp;</td>
  834.         <td><a href="showinframes.php?<?php echo api_get_cidreq()."&file=".$path."&cid=".$_course['official_code']."&uid=".$_user['user_id'].'"'if(!$activeecho 'class="invisible"'?>"><?php echo $title;?></a></td>
  835.  
  836.      </tr>
  837.     </table></td>
  838.   </tr>
  839.   <?php
  840.                     }
  841.                 }
  842.                 ?>
  843.   <?php
  844.                 if($ind == $limitExPage)
  845.                 {
  846.                     break;
  847.                 }
  848.                 if($is_allowedToEdit)
  849.                 {
  850.                     $ind++;
  851.                 }
  852.                 else
  853.                 {
  854.                     if ($active==1)
  855.                     {
  856.                         $ind++;
  857.                     }
  858.                 }
  859.             }
  860.         }
  861.  
  862.  
  863.     //end if ($origin != 'learnpath') {
  864.     ?>
  865. </table>
  866. <?php
  867. }else{
  868.     if($origin != 'learnpath'){
  869.         echo '<a href="'.api_add_url_param($_SERVER['REQUEST_URI'],'show=test').'">&lt;&lt; '.get_lang('Back').'</a>';
  870.     }
  871. }// end if($show == 'test')
  872.  
  873. /*****************************************/
  874. /* Exercise Results (uses tracking tool) */
  875. /*****************************************/
  876.  
  877. // if tracking is enabled
  878. if($_configuration['tracking_enabled'])
  879. {
  880.  
  881.     if($show == 'result')
  882.     {
  883.  
  884.  
  885.         // the form
  886.         {
  887.             echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?show='.Security::remove_XSS($_GET['show']).'">';
  888.             echo '<input type="hidden" name="export_report" value="export_report">';
  889.             echo '<input type="hidden" name="export_format" value="csv">';
  890.             echo '</form>';
  891.             echo '<form id="form1b" name="form1b" method="post" action="'.api_get_self().'?show='.Security::remove_XSS($_GET['show']).'">';
  892.             echo '<input type="hidden" name="export_report" value="export_report">';
  893.             echo '<input type="hidden" name="export_format" value="xls">';
  894.             echo '</form>';
  895.             echo '<form id="form1c" name="form1c" method="post" action="'.api_get_self().'?show='.Security::remove_XSS($_GET['show']).'">';
  896.             if($_SESSION['export_user_fields']==false)
  897.             {
  898.                 $alt get_lang('ExportWithUserFields');
  899.                 echo '<input type="hidden" name="export_user_fields" value="export_user_fields">';
  900.             }
  901.             else
  902.             {
  903.                 $alt get_lang('ExportWithoutUserFields');
  904.                 echo '<input type="hidden" name="export_user_fields" value="do_not_export_user_fields">';
  905.             }
  906.             echo '</form>';
  907.             echo '<a class="quiz_export_link" href="#" onclick="document.form1a.submit();"><img align="absbottom" src="'.api_get_path(WEB_IMG_PATH).'excel.gif" alt="'.get_lang('ExportAsCSV').'">&nbsp;'.get_lang('ExportAsCSV').'</a>';
  908.             echo '<a class="quiz_export_link" href="#" onclick="document.form1b.submit();"><img align="absbottom" src="'.api_get_path(WEB_IMG_PATH).'excel.gif" alt="'.get_lang('ExportAsXLS').'">&nbsp;'.get_lang('ExportAsXLS').'</a>';
  909.             echo '<a class="quiz_export_link" href="#" onclick="document.form1c.submit();"><img align="absbottom" src="'.api_get_path(WEB_IMG_PATH).'synthese_view.gif" alt="'.$alt.'">&nbsp;'.$alt.'</a>';
  910.             echo '<br /><br />';        
  911.         }
  912.         ?>
  913.  
  914.         <table class="data_table">
  915.          <tr class="row_odd">
  916.           <?php if($is_allowedToEdit || $is_tutor)?>
  917.           <th><?php echo get_lang("User")?></th><?php endif?>
  918.           <th><?php echo get_lang("Exercice")?></th>
  919.           <th><?php echo get_lang("Date")?></th>
  920.           <th><?php echo get_lang("Result")?></th>
  921.           <th><?php echo (($is_allowedToEdit||$is_tutor)?get_lang("CorrectTest"):get_lang("ViewTest"))?></th>
  922.  
  923.  
  924.          </tr>
  925.  
  926.         <?php
  927.         if($is_allowedToEdit || $is_tutor)
  928.         {
  929.             //get all results (ourself and the others) as an admin should see them
  930.             //AND exe_user_id <> $_user['user_id']  clause has been removed
  931.             $sql="SELECT CONCAT(lastname,' ',firstname),ce.title, te.exe_result ,
  932.                         te.exe_weighting, UNIX_TIMESTAMP(te.exe_date),te.exe_id,email
  933.                   FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES AS te, $TBL_USER AS user
  934.                   WHERE te.exe_exo_id = ce.id AND user_id=te.exe_user_id AND te.exe_cours_id='$_cid'
  935.                   ORDER BY te.exe_cours_id ASC, ce.title ASC, te.exe_date ASC";
  936.  
  937.             $hpsql="SELECT CONCAT(tu.lastname,' ',tu.firstname), tth.exe_name,
  938.                         tth.exe_result , tth.exe_weighting, UNIX_TIMESTAMP(tth.exe_date)
  939.                     FROM $TBL_TRACK_HOTPOTATOES tth, $TBL_USER tu
  940.                     WHERE  tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '".$_cid."'
  941.                     ORDER BY tth.exe_cours_id ASC, tth.exe_date ASC";
  942.  
  943.         }
  944.         else
  945.         // get only this user's results
  946.               $sql="SELECT '',ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date),te.exe_id
  947.                   FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES AS te
  948.                   WHERE te.exe_exo_id = ce.id AND te.exe_user_id='".$_user['user_id']."' AND te.exe_cours_id='$_cid'  AND results_disabled=0
  949.                   ORDER BY te.exe_cours_id ASC, ce.title ASC, te.exe_date ASC";
  950.  
  951.             $hpsql="SELECT '',exe_name, exe_result , exe_weighting, UNIX_TIMESTAMP(exe_date)
  952.                     FROM $TBL_TRACK_HOTPOTATOES
  953.                     WHERE exe_user_id = '".$_user['user_id']."' AND exe_cours_id = '".$_cid."'
  954.                     ORDER BY exe_cours_id ASC, exe_date ASC";
  955.  
  956.         }
  957.  
  958.         $results=getManyResultsXCol($sql,7);
  959.         $hpresults=getManyResultsXCol($hpsql,5);
  960.  
  961.         $NoTestRes 0;
  962.         $NoHPTestRes 0;
  963.         //Print the results of tests
  964.         if(is_array($results))
  965.         {
  966.             for($i 0$i sizeof($results)$i++)
  967.             {
  968.                 $id $results[$i][5];
  969.                 $mailid $results[$i][6];
  970.                 $user $results[$i][0];
  971.                 $test $results[$i][1];
  972.                 $dt strftime($dateTimeFormatLong,$results[$i][4]);
  973.                 $res $results[$i][2];
  974.                 echo '<tr';
  975.                 if($i%2==0echo 'class="row_odd"'else echo 'class="row_even"';
  976.                 echo '>';
  977.                 if($is_allowedToEdit || $is_tutor)
  978.                 {
  979.                     $user $results[$i][0];
  980.                     echo '<td>'.$user.'</td>';
  981.                 }
  982.                 echo '<td>'.$test.'</td>';
  983.                 echo '<td>'.format_locale_date(get_lang('dateTimeFormatLong'),$results[$i][4]).'</td>';
  984.                   echo '<td>'.round(($res/($results[$i][3]!=0?$results[$i][3]:1))*100).'% ('.$res.' / '.$results[$i][3].')</td>';
  985.                 echo '<td>'.(($is_allowedToEdit||$is_tutor)?"<a href='exercise_show.php?user=$user&dt=$dt&res=$res&id=$id&email=$mailid'>".get_lang("Edit")."</a>":"<a href='exercise_show.php?dt=$dt&res=$res&id=$id'>".get_lang('Show')."</a>").'</td>';
  986.                 echo '</tr>';
  987.             }
  988.         }
  989.         else
  990.         {
  991.                 $NoTestRes 1;
  992.         }
  993.         // Print the Result of Hotpotatoes Tests
  994.         if(is_array($hpresults))
  995.         {
  996.             for($i 0$i sizeof($hpresults)$i++)
  997.             {
  998.                 $title GetQuizName($hpresults[$i][1],$documentPath);
  999.                 if ($title =='')
  1000.                 {
  1001.                     $title GetFileName($hpresults[$i][1]);
  1002.                 }
  1003.                 echo '<tr>';
  1004.                 if($is_allowedToEdit)
  1005.                 {
  1006.                     echo '<td class="content">'.$hpresults[$i][0].'</td>';
  1007.                 }
  1008.                 echo '<td class="content">'.$title.'</td>';
  1009.                 echo '<td class="content">'.strftime($dateTimeFormatLong,$hpresults[$i][4]).'</td>';
  1010.                 echo '<td class="content">'.round(($hpresults[$i][2]/($hpresults[$i][3]!=0?$hpresults[$i][3]:1))*100).'% ('.$hpresults[$i][2].' / '.$hpresults[$i][3].')</td>';
  1011.                 echo '<td></td>'//there is no possibility to edit the results of a Hotpotatoes test
  1012.                 echo '</tr>';
  1013.             }
  1014.         }
  1015.         else
  1016.         {
  1017.             $NoHPTestRes 1;
  1018.         }
  1019.  
  1020.  
  1021.  
  1022.         if ($NoTestRes==&& $NoHPTestRes==1)
  1023.         {
  1024.         ?>
  1025.  
  1026.          <tr>
  1027.           <td colspan="5"><?php echo get_lang("NoResult")?></td>
  1028.          </tr>
  1029.  
  1030.         <?php
  1031.         }
  1032.  
  1033.         ?>
  1034.  
  1035.         </table>
  1036.  
  1037.         <?php
  1038.     }else{
  1039.  
  1040.         echo '<p><img src="'.api_get_path(WEB_IMG_PATH).'show_test_results.gif" align="absbottom">&nbsp;<a href="'.api_add_url_param($_SERVER['REQUEST_URI'],'show=result').'">'.get_lang("Results").' &gt;&gt;</a></p>';
  1041.  
  1042.     }// end if($show == 'result')
  1043.  
  1044. }// end if tracking is enabled
  1045.  
  1046. if ($origin != 'learnpath'//so we are not in learnpath tool
  1047. else 
  1048. {
  1049.     ?>
  1050.     <link rel="stylesheet" type="text/css" href="<?php echo $clarolineRepositoryWeb ?>css/default.css" />
  1051.     <?php
  1052. }
  1053. ?>

Documentation generated on Thu, 12 Jun 2008 13:24:33 -0500 by phpDocumentor 1.4.1