Fixed the upgrade from 1.6.x. The role->shortname field was not being created.
[moodle.git] / mod / scorm / datamodels / suspend.php
CommitLineData
dc383b6f 1<?php\r
2 require_once('../../config.php');\r
3 require_once('locallib.php');\r
4\r
5 $id = required_param('id', PARAM_INT); // course ID\r
6 $scormid = required_param('scorm', PARAM_INT); // scorm ID\r
7 $scoid = required_param('sco', PARAM_INT); // suspend sco ID\r
8 $userid = required_param('userid', PARAM_INT); // user ID\r
9\r
10 $attempt = scorm_get_last_attempt($scormid,$userid);\r
11 $statistic = get_record('scorm_statistic',"scormid",$scormid,"userid",$userid);\r
12 $statisticInput->accesstime = $statistic->accesstime;\r
13 $statisticInput->durationtime = $statistic->durationtime + time()- $statistic->accesstime;\r
14 $statisticInput->status = 'suspend';\r
15 $statisticInput->attemptnumber = $attempt;\r
16 $statisticInput->scormid = $statistic->scormid;\r
17 $statisticInput->userid = $statistic->userid; \r
18 $statisticid = scorm_insert_statistic($statisticInput);\r
19\r
20 $result = scorm_insert_trackmodel($userid, $scormid, $scoid,$attempt);\r
21 if ($result) {\r
22 echo "<script language='Javascript' type='text/javascript'>";\r
23 echo "location.href='".$CFG->wwwroot." /course/view.php?id=".$id."';"; \r
24 echo "</script>";\r
25 } else {\r
26 echo "Suspend failed";\r
27 }\r
28?>\r
29\r