Fixed some typos

This commit is contained in:
bobopinna 2005-05-02 06:49:03 +00:00
parent e3cc2a8084
commit ae377545b7
5 changed files with 62 additions and 77 deletions

View File

@ -10,8 +10,9 @@ CREATE TABLE prefix_scorm (
version varchar(9) NOT NULL default '', version varchar(9) NOT NULL default '',
maxgrade float(3) NOT NULL default '0', maxgrade float(3) NOT NULL default '0',
grademethod tinyint(2) NOT NULL default '0', grademethod tinyint(2) NOT NULL default '0',
launch int(10) unsigned NOT NULL default 0, launch int(10) unsigned NOT NULL default '0',
summary text NOT NULL, summary text NOT NULL,
browsemode tinyint(2) NOT NULL default '0',
auto tinyint(1) unsigned NOT NULL default '0', auto tinyint(1) unsigned NOT NULL default '0',
timemodified int(10) unsigned NOT NULL default '0', timemodified int(10) unsigned NOT NULL default '0',
PRIMARY KEY (id), PRIMARY KEY (id),

View File

@ -11,6 +11,7 @@ CREATE TABLE prefix_scorm (
grademethod integer NOT NULL default '0', grademethod integer NOT NULL default '0',
launch integer NOT NULL default '0', launch integer NOT NULL default '0',
summary text NOT NULL default '', summary text NOT NULL default '',
browsemode integer NOT NULL default '0',
auto integer NOT NULL default '0', auto integer NOT NULL default '0',
timemodified integer NOT NULL default '0' timemodified integer NOT NULL default '0'
); );

View File

@ -162,80 +162,57 @@ function scorm_grades($scormid) {
if (!$scorm = get_record('scorm', 'id', $scormid)) { if (!$scorm = get_record('scorm', 'id', $scormid)) {
return NULL; return NULL;
} }
if (!$scoes = get_records('scorm_scoes','scorm',$scormid)) {
return NULL;
}
if ($scorm->grademethod == VALUESCOES) { if ($scorm->grademethod == VALUESCOES) {
if (!$return->maxgrade = count_records_select('scorm_scoes',"scorm='$scormid' AND launch<>''")) { if (!$return->maxgrade = count_records_select('scorm_scoes',"scorm='$scormid' AND launch<>''")) {
return NULL; return NULL;
} }
} else {
$return->maxgrade = $scorm->maxgrade;
}
$return->grades = NULL; $return->grades = NULL;
if ($scousers=get_records_select('scorm_scoes_track', "scormid='$scormid' GROUP BY userid")) { if ($scousers=get_records_select('scorm_scoes_track', "scormid='$scormid' GROUP BY userid")) {
foreach ($scousers as $scouser) { foreach ($scousers as $scouser) {
$userdata=get_records_select('scorm_scoes_track',"scormid='$scormid' AND userid='$scouser->userid' AND element='cmi_core_lesson_status'"); $scores = NULL;
$scores->completed=0; $scores->scoes = 0;
$scores->browsed=0; $scores->values = 0;
$scores->incomplete=0; $scores->max = 0;
$scores->failed=0; $scores->sum = 0;
$scores->notattempted=0;
$result='';
$data = current($userdata);
foreach ($userdata as $data) {
if ($data->value=='passed')
$scores->completed++;
else
$scores->{scorm_remove_spaces($data->value)}++;
}
if ($scores->completed)
$result.='<img src="'.$CFG->wwwroot.'/mod/scorm/pix/completed.gif" alt="'.get_string('completed','scorm').'" title="'.get_string('completed','scorm').'" /> '.$scores->completed;
if ($scores->incomplete)
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/incomplete.gif\" alt=\"".get_string('incomplete','scorm')."\" title=\"".get_string('incomplete','scorm')."\" /> $scores->incomplete ";
if ($scores->failed)
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/failed.gif\" alt=\"".get_string('failed','scorm')."\" title=\"".get_string('failed','scorm')."\" /> $scores->failed ";
if ($scores->browsed)
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/browsed.gif\" alt=\"".get_string('browsed','scorm')."\" title=\"".get_string('browsed','scorm')."\" /> $scores->browsed ";
if ($scores->notattempted)
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/notattempted.gif\" alt=\"".get_string('notattempted','scorm')."\" title=\"".get_string('notattempted','scorm')."\" /> $scores->notattempted ";
$return->grades[$scouser->userid]=$result; foreach ($scoes as $sco) {
$userdata=scorm_get_tracks($sco->id, $scouser->userid);
if (($userdata->status == 'completed') || ($userdata->status == 'passed')) {
$scores->scoes++;
} }
if (!empty($userdata->score_raw)) {
$scores->values++;
$scores->sum += $userdata->score_raw;
$scores->max = ($userdata->score_raw > $scores->max)?$userdata->score_raw:$scores->max;
} }
} else {
$grades = get_records_select('scorm_scoes_track', "scormid=$scormid AND element='cmi_core_score_raw' AND value<>''",'','id,userid,value');
//$grades = get_records_menu("scorm_scoes_track", "scormid",$scormid,"","userid,cmi_core_score_raw");
$valutations = array();
foreach ($grades as $grade) {
if (!isset($valutations[$grade->userid])) {
if ($scorm->grademethod == VALUEAVERAGE) {
$values = array();
$values[$grade->userid]->grade = 0;
$values[$grade->userid]->values = 0;
}
$valutations[$grade->userid] = 0;
} }
switch ($scorm->grademethod) { switch ($scorm->grademethod) {
case VALUEHIGHEST: case VALUEHIGHEST:
if ($grade->value > $valutations[$grade->userid]) { $return->grades[$scouser->userid] = $scores->max;
$valutations[$grade->userid] = $grade->value;
}
break; break;
case VALUEAVERAGE: case VALUEAVERAGE:
$values[$grade->userid]->grade += $grade->value; if ($score->values > 0) {
$values[$grade->userid]->values++; $return->grades[$scouser->userid] = $scores->sum/$scores->values;
} else {
$return->grades[$scouser->userid] = 0;
}
break; break;
case VALUESUM: case VALUESUM:
$valutations[$grade->userid] += $grade->value; $return->grades[$scouser->userid] = $scores->sum;
break;
case VALUESCOES:
$return->grades[$scouser->userid] = $scores->scoes;
break; break;
} }
} }
if ($scorm->grademethod == VALUEAVERAGE) {
foreach($values as $userid => $value) {
$valutations[$userid] = $value->grade/$value->values;
}
}
//print_r($grades);
$return->grades = $valutations;
$return->maxgrade = $scorm->maxgrade;
} }
return $return; return $return;
} }

View File

@ -41,8 +41,7 @@
} }
?> ?>
<script type="text/javascript" src="<?php p($CFG->wwwroot) ?>/mod/scorm/request.js" > <script type="text/javascript" src="<?php p($CFG->wwwroot) ?>/mod/scorm/request.js" ></script>
</script>
<script type="text/javascript"> <script type="text/javascript">
function validate_scorm(theform,filename) { function validate_scorm(theform,filename) {
//alert(filename); //alert(filename);
@ -98,6 +97,14 @@
return false; return false;
} }
} }
function checkmethod (grademethod,maxgrade) {
if (grademethod.options[grademethod.selectedIndex].value == 0) {
maxgrade.disabled=true;
} else {
maxgrade.disabled=false;
}
}
</script> </script>
<form name="form" method="post" action="mod.php" onsubmit="return validate_scorm(document.form,document.form.reference.value);"> <form name="form" method="post" action="mod.php" onsubmit="return validate_scorm(document.form,document.form.reference.value);">
@ -139,7 +146,7 @@
<td align="right"><b><?php print_string("grademethod", "scorm") ?>:</b></td> <td align="right"><b><?php print_string("grademethod", "scorm") ?>:</b></td>
<td> <td>
<?php <?php
choose_from_menu($SCORM_GRADE_METHOD, "grademethod", "$form->grademethod", ""); choose_from_menu($SCORM_GRADE_METHOD, 'grademethod', "$form->grademethod", '','checkmethod(this,document.form.maxgrade);');
helpbutton("grademethod", get_string("grademethod","scorm"), "scorm"); helpbutton("grademethod", get_string("grademethod","scorm"), "scorm");
?> ?>
</td> </td>
@ -151,9 +158,9 @@
for ($i=100; $i>=1; $i--) { for ($i=100; $i>=1; $i--) {
$grades[$i] = $i; $grades[$i] = $i;
} }
$disabled = $form->grademethod=='0';
choose_from_menu($grades, "maxgrade", "$form->maxgrade", ""); choose_from_menu($grades, 'maxgrade', "$form->maxgrade", '','','0',false,$disabled);
helpbutton("maxgrade", get_string("maximumgrade"), "scorm"); helpbutton('maxgrade', get_string('maximumgrade'), 'scorm');
?> ?>
</td> </td>
</tr> </tr>
@ -185,8 +192,6 @@
<input type="hidden" name="datadir" value="<?php p($form->datadir) ?>" /> <input type="hidden" name="datadir" value="<?php p($form->datadir) ?>" />
<input type="hidden" name="pkgtype" value="<?php p($form->pkgtype) ?>" /> <input type="hidden" name="pkgtype" value="<?php p($form->pkgtype) ?>" />
<input type="hidden" name="launch" value="<?php p($form->launch) ?>" /> <input type="hidden" name="launch" value="<?php p($form->launch) ?>" />
<!-- <input type="hidden" name="maxgrade" value="<?php p($form->maxgrade) ?>" />
<input type="hidden" name="grademethod" value="<?php p($form->grademethod) ?>" />-->
<input type="hidden" name="course" value="<?php p($form->course) ?>" /> <input type="hidden" name="course" value="<?php p($form->course) ?>" />
<input type="hidden" name="sesskey" value="<?php p($form->sesskey) ?>" /> <input type="hidden" name="sesskey" value="<?php p($form->sesskey) ?>" />

View File

@ -91,6 +91,7 @@
foreach ($scousers as $scouser) { foreach ($scousers as $scouser) {
if ($userdata = scorm_get_user_data($scouser->userid)) { if ($userdata = scorm_get_user_data($scouser->userid)) {
$row = '';
$row[] = print_user_picture($scouser->userid, $course->id, $userdata->picture, false, true); $row[] = print_user_picture($scouser->userid, $course->id, $userdata->picture, false, true);
$row[] = "<a href=\"$CFG->wwwroot/user/view.php?id=$scouser->userid&course=$course->id\">". $row[] = "<a href=\"$CFG->wwwroot/user/view.php?id=$scouser->userid&course=$course->id\">".
"$userdata->firstname $userdata->lastname</a>"; "$userdata->firstname $userdata->lastname</a>";