Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

New course format SCORM

  • Loading branch information...
commit 0dd957ed3d3a5a6bc8d5ed1eb625faa3a134ca4b 1 parent b5127f1
authored June 27, 2005
12  course/format/scorm/config.php
... ...
@@ -0,0 +1,12 @@
  1
+<?php //$Id$
  2
+//
  3
+// Optional course format configuration file
  4
+//
  5
+// This file contains any specific configuration settings for the
  6
+// social format.
  7
+//
  8
+// The default blocks layout for this course format:
  9
+    $format['defaultblocks'] = 'participants,social_activities,admin,course_list:'.
  10
+                               'news_items,recent_activity,calendar_upcoming';
  11
+
  12
+?>
173  course/format/scorm/format.php
... ...
@@ -0,0 +1,173 @@
  1
+<?php // $Id$
  2
+      // format.php - course format featuring scorm player
  3
+      //              included from view.php
  4
+
  5
+    require_once("$CFG->dirroot/mod/forum/lib.php");
  6
+
  7
+    require_once($CFG->dirroot.'/mod/scorm/lib.php');
  8
+    echo '<style type="text/css">';
  9
+    require_once($CFG->dirroot.'/mod/scorm/styles.php');
  10
+    echo '</style>';
  11
+
  12
+    // Bounds for block widths
  13
+    define('BLOCK_L_MIN_WIDTH', 100);
  14
+    define('BLOCK_L_MAX_WIDTH', 210);
  15
+    define('BLOCK_R_MIN_WIDTH', 100);
  16
+    define('BLOCK_R_MAX_WIDTH', 210);
  17
+
  18
+    optional_variable($preferred_width_left,  blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]));
  19
+    optional_variable($preferred_width_right, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]));
  20
+    $preferred_width_left = min($preferred_width_left, BLOCK_L_MAX_WIDTH);
  21
+    $preferred_width_left = max($preferred_width_left, BLOCK_L_MIN_WIDTH);
  22
+    $preferred_width_right = min($preferred_width_right, BLOCK_R_MAX_WIDTH);
  23
+    $preferred_width_right = max($preferred_width_right, BLOCK_R_MIN_WIDTH);
  24
+
  25
+    $strgroups  = get_string('groups');
  26
+    $strgroupmy = get_string('groupmy');
  27
+    $strupdate = get_string('update');
  28
+    $strscorm = get_string('modulename','scorm');
  29
+    $editing    = $PAGE->user_is_editing();
  30
+
  31
+    echo '<table id="layout-table" cellspacing="0">';
  32
+    echo '<tr>';
  33
+
  34
+    if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) {
  35
+        echo '<td style="width: '.$preferred_width_left.'px;" id="left-column">';
  36
+        blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
  37
+        echo '</td>';
  38
+    }
  39
+
  40
+    echo '<td id="middle-column">';
  41
+    if ($scorms = get_all_instances_in_course("scorm", $course)) {
  42
+        // The SCORM with the least id is the course SCORM  
  43
+        $scorm = current($scorms);
  44
+        if (! $cm = get_coursemodule_from_instance('scorm', $scorm->id, $course->id)) {
  45
+            error("Course Module ID was incorrect");
  46
+        }
  47
+
  48
+        $headertext = '<table width="100%"><tr><td><div class="title">'.get_string('scormcourse','scorm').': <b>'.$scorm->name.'</b>';
  49
+        if (isteacher($course->id) || isadmin()) {
  50
+            $reportlink = '';
  51
+            $trackedusers = get_record('scorm_scoes_track', 'scormid', $scorm->id, '', '', '', '', 'count(distinct(userid)) as c');
  52
+            if ($trackedusers->c > 0) {
  53
+                $reportlink = '<div class="reportlink">'.
  54
+                              '<a target="'.$CFG->framename.'" href="'.$CFG->wwwroot.'/mod/scorm/report.php?id='.$cm->id.'">'.
  55
+                               get_string('viewallreports','scorm',$trackedusers->c).'</a></div>';
  56
+            } else {
  57
+                $reportlink = '<div class="reportlink">'.get_string('noreports','scorm').'</div>';
  58
+            }
  59
+            if (isediting($course->id)) {
  60
+                // Display update scorm icon
  61
+                $path = $CFG->wwwroot.'/course';
  62
+                $headertext .= '<span class="commands">'.
  63
+                        '<a title="'.$strupdate.'" href="'.$path.'/mod.php?update='.$cm->id.'&amp;sesskey='.sesskey().'">'.
  64
+                        '<img src="'.$CFG->pixpath.'/t/edit.gif" hspace="2" height="11" width="11" border="0" alt="'.$strupdate.'" /></a></span>';
  65
+            }
  66
+            // Display report link
  67
+            $headertext .= '</div></td><td>'.$reportlink;
  68
+        } else {
  69
+            $headertext .= '</div>';
  70
+        }
  71
+        $headertext .= '</td></tr><tr><td>'.$scorm->summary.'</td></tr></table>';
  72
+        print_simple_box($headertext,'','100%');
  73
+?>
  74
+        <?php print_simple_box_start('center','100%'); ?>
  75
+        <div class="structurehead"><?php print_string('coursestruct','scorm') ?></div>
  76
+        <?php
  77
+            $organization = $scorm->launch;
  78
+            if ($orgs = get_records_select_menu('scorm_scoes',"scorm='$scorm->id' AND organization='' AND launch=''",'id','id,title')) {
  79
+                if (count($orgs) > 1) {
  80
+                    if (isset($_POST['organization'])) {
  81
+                        $organization = $_POST['organization'];
  82
+                    }
  83
+         ?>
  84
+            <div class='center'>
  85
+		    <?php print_string('organizations','scorm') ?>
  86
+                <form name='changeorg' method='post' action='view.php?id=<?php echo $cm->id ?>'>
  87
+                    <?php choose_from_menu($orgs, 'organization', "$organization", '','submit()') ?>
  88
+                </form>
  89
+            </div>
  90
+         <?php
  91
+                }
  92
+            }
  93
+            $orgidentifier = '';
  94
+            if ($org = get_record('scorm_scoes','id',$organization)) {
  95
+                if (($org->organization == '') && ($org->launch == '')) {
  96
+                    $orgidentifier = $org->identifier;
  97
+                } else {
  98
+                    $orgidentifier = $org->organization;
  99
+                }
  100
+            }
  101
+         ?>
  102
+         <?php $incomplete = scorm_display_structure($scorm,'structlist',$orgidentifier); ?>
  103
+         <?php print_simple_box_end(); ?>
  104
+              <div class="center">
  105
+              <form name="theform" method="post" action="<?php echo $CFG->wwwroot ?>/mod/scorm/playscorm.php?id=<?php echo $cm->id ?>">
  106
+              <?php
  107
+                  if ($scorm->browsemode == 1) {
  108
+                      print_string("mode","scorm");
  109
+                      echo ': <input type="radio" id="b" name="mode" value="browse" /><label for="b">'.get_string('browse','scorm').'</label>'."\n";
  110
+                      if ($incomplete === true) {
  111
+                          echo '<input type="radio" id="n" name="mode" value="normal" checked="checked" /><label for="n">'.get_string('normal','scorm')."</label>\n";
  112
+                      } else {
  113
+                          echo '<input type="radio" id="r" name="mode" value="review" checked="checked" /><label for="r">'.get_string('review','scorm')."</label>\n";
  114
+                      }
  115
+                  } else {
  116
+                      if ($incomplete === true) {
  117
+                          echo '<input type="hidden" name="mode" value="normal" />'."\n";
  118
+                      } else {
  119
+                          echo '<input type="hidden" name="mode" value="review" />'."\n";
  120
+                      }
  121
+                  }
  122
+              ?>
  123
+              <br />
  124
+              <input type="hidden" name="scoid" />
  125
+              <input type="hidden" name="currentorg" value="<?php echo $orgidentifier ?>" />
  126
+              <input type="submit" value="<? print_string('entercourse','scorm') ?>" />
  127
+              </form>
  128
+          </div>
  129
+          <script language="javascript" type="text/javascript">
  130
+          <!--
  131
+              function playSCO(scoid) {
  132
+                  document.theform.scoid.value = scoid;
  133
+                  document.theform.submit();
  134
+              }
  135
+
  136
+              function expandCollide(which,list) {
  137
+                  var nn=document.ids?true:false
  138
+                  var w3c=document.getElementById?true:false
  139
+                  var beg=nn?"document.ids.":w3c?"document.getElementById(":"document.all.";
  140
+                  var mid=w3c?").style":".style";
  141
+
  142
+                  if (eval(beg+list+mid+".display") != "none") {
  143
+                      which.src = "<?php echo $CFG->wwwroot ?>/mod/scorm/pix/plus.gif";
  144
+                      eval(beg+list+mid+".display='none';");
  145
+                  } else {
  146
+                      which.src = "<?php echo $CFG->wwwroot ?>/mod/scorm/pix/minus.gif";
  147
+                      eval(beg+list+mid+".display='block';");
  148
+                  }
  149
+              }
  150
+          -->
  151
+          </script>
  152
+<?php
  153
+    } else {
  154
+        if (isteacheredit($course->id)) {
  155
+            // Create a new scorm activity
  156
+	        redirect('mod.php?id='.$course->id.'&amp;section=0&sesskey='.sesskey().'&amp;add=scorm');
  157
+        } else {
  158
+            notify('Could not find a SCORM course here');
  159
+        }
  160
+    }
  161
+    echo '</td>';
  162
+
  163
+    // The right column
  164
+    if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) {
  165
+        echo '<td style="width: '.$preferred_width_right.'px;" id="right-column">';
  166
+        blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
  167
+        echo '</td>';
  168
+    }
  169
+
  170
+    echo '</tr>';
  171
+    echo '</table>';
  172
+
  173
+?>

0 notes on commit 0dd957e

Please sign in to comment.
Something went wrong with that request. Please try again.