diff --git a/html/inc/bolt.inc b/html/inc/bolt.inc
index 5c0ba3019a..68324de8cf 100644
--- a/html/inc/bolt.inc
+++ b/html/inc/bolt.inc
@@ -30,6 +30,7 @@ abstract class BoltUnit {
public $title;
// Optional; used when showing course history outline.
public $is_item;
+ public $attrs; // course-defined
abstract function walk(&$iter, $incr, &$frac_done);
// multi-purpose function for traversing a course.
@@ -47,7 +48,7 @@ abstract class BoltUnit {
class BoltItem extends BoltUnit {
public $filename;
public $query_string;
- function __construct($filename, $title) {
+ function __construct($filename, $title, $attrs) {
$p = strpos($filename, '?');
if ($p === false) {
$this->filename = $filename;
@@ -59,6 +60,7 @@ class BoltItem extends BoltUnit {
$this->name = $filename;
$this->title = $title;
$this->is_item = true;
+ $this->attrs = $attrs;
}
function begin() {
return array(new BoltFrame($this));
@@ -108,12 +110,13 @@ class BoltExercise extends BoltItem {
//
class BoltSet extends BoltUnit {
public $units;
- function __construct($name, $units, $ntoshow) {
+ function __construct($name, $units, $ntoshow, $attrs) {
$this->name = $name;
$this->is_item = false;
$this->units = $units;
$this->ntoshow = $ntoshow;
$this->ordered = false;
+ $this->attrs = $attrs;
}
// restart this unit - set its state record to an initial state
@@ -252,6 +255,10 @@ function filename($n) {
return array('filename', $n);
}
+function attrs($n) {
+ return array('attrs', $n);
+}
+
function callback($n) {
return array('callback', $n);
}
@@ -259,12 +266,15 @@ function callback($n) {
function lesson() {
$filename = "";
$title = "";
+ $attrs = null;
+
$args = func_get_args();
foreach ($args as $arg) {
if (is_array($arg)) {
switch ($arg[0]) {
case 'title': $title = $arg[1]; break;
case 'filename': $filename = $arg[1]; break;
+ case 'attrs': $attrs = $arg[1]; break;
default: echo "Unrecognized lesson parameter: ", $arg[0], "\n"; break;
}
} else {
@@ -277,12 +287,14 @@ function lesson() {
if (!$filename) {
error_page("Missing filename in lesson");
}
- return new BoltLesson($filename, $title);
+ return new BoltLesson($filename, $title, $attrs);
}
function exercise() {
$filename = "";
$title = "";
+ $attrs = null;
+
$args = func_get_args();
$callback = null;
foreach ($args as $arg) {
@@ -290,6 +302,7 @@ function exercise() {
switch ($arg[0]) {
case 'title': $title = $arg[1]; break;
case 'filename': $filename = $arg[1]; break;
+ case 'attrs': $attrs = $arg[1]; break;
case 'callback': $callback = $arg[1]; break;
default: echo "Unrecognized exercise parameter: ", $arg[0], "\n"; break;
}
@@ -301,7 +314,7 @@ function exercise() {
if (!$filename) {
error_page("Missing filename in lesson");
}
- return new BoltExercise($filename, $title, $callback);
+ return new BoltExercise($filename, $title, $attrs, $callback);
}
require_once('../inc/bolt_seq.inc');
diff --git a/html/inc/bolt_rnd.inc b/html/inc/bolt_rnd.inc
index 35bd7c030d..07583af2f9 100644
--- a/html/inc/bolt_rnd.inc
+++ b/html/inc/bolt_rnd.inc
@@ -18,8 +18,8 @@
class BoltRandom extends BoltSet {
public $units;
- function __construct($name, $units, $number) {
- parent::__construct($name, $units, $number);
+ function __construct($name, $units, $number, $attrs) {
+ parent::__construct($name, $units, $number, $attrs);
}
function order(&$iter) {
@@ -49,12 +49,14 @@ function random() {
$units = array();
$name = "";
$number = 0;
+ $attrs = null;
foreach ($args as $arg) {
if (is_array($arg)) {
switch ($arg[0]) {
case 'name': $name = $arg[1]; break;
case 'title': $title = $arg[1]; break;
case 'number': $number = $arg[1]; break;
+ case 'attrs': $attrs = $arg[1]; break;
default: echo "Unrecognized array arg: ", $arg[0], "\n"; break;
}
} else if (is_object($arg)) {
@@ -67,7 +69,7 @@ function random() {
}
}
if ($number == 0) $number = count($units);
- return new BoltRandom($name, $units, $number);
+ return new BoltRandom($name, $units, $number, $attrs);
}
?>
diff --git a/html/inc/bolt_select.inc b/html/inc/bolt_select.inc
index 5e982ba9fe..29f4d5f0b4 100644
--- a/html/inc/bolt_select.inc
+++ b/html/inc/bolt_select.inc
@@ -24,9 +24,9 @@ function select_cmp($a, $b) {
class BoltSelect extends BoltSet {
public $valuator;
- function __construct($name, $units, $valuator) {
+ function __construct($name, $units, $valuator, $attrs) {
$this->valuator = $valuator;
- parent::__construct($name, $units, 1);
+ parent::__construct($name, $units, 1, $attrs);
}
function order() {
@@ -60,12 +60,14 @@ function select() {
$args = func_get_args();
$units = array();
$name = "";
+ $attrs = null;
foreach ($args as $arg) {
if (is_array($arg)) {
switch ($arg[0]) {
case 'name': $name = $arg[1]; break;
case 'title': $title = $arg[1]; break;
case 'valuator': $valuator = $arg[1]; break;
+ case 'attrs': $attrs = $arg[1]; break;
default: echo "Unrecognized array arg: ", $arg[0], "\n"; break;
}
} else if (is_object($arg)) {
@@ -80,7 +82,7 @@ function select() {
if (!$valuator) {
error_page("missing valuator");
}
- return new BoltSelect($name, $units, $valuator);
+ return new BoltSelect($name, $units, $valuator, $attrs);
}
?>
diff --git a/html/inc/bolt_seq.inc b/html/inc/bolt_seq.inc
index 0707d8e879..b712535613 100644
--- a/html/inc/bolt_seq.inc
+++ b/html/inc/bolt_seq.inc
@@ -17,8 +17,8 @@
// along with BOINC. If not, see .
class BoltSequence extends BoltSet {
- function __construct($name, $units) {
- parent::__construct($name, $units, count($units));
+ function __construct($name, $units, $attrs) {
+ parent::__construct($name, $units, count($units), $attrs);
}
function order() {
@@ -39,11 +39,13 @@ function sequence() {
$args = func_get_args();
$units = array();
$name = "";
+ $attrs = null;
foreach ($args as $arg) {
if (is_array($arg)) {
switch ($arg[0]) {
case 'name': $name = $arg[1]; break;
case 'title': $title = $arg[1]; break;
+ case 'attrs': $attrs = $arg[1]; break;
default: echo "Unrecognized array arg: ", $arg[0], "\n"; break;
}
} else if (is_object($arg)) {
@@ -55,7 +57,7 @@ function sequence() {
}
}
}
- return new BoltSequence($name, $units);
+ return new BoltSequence($name, $units, $attrs);
}
?>
diff --git a/html/inc/bolt_xset.inc b/html/inc/bolt_xset.inc
index 6cebd13fa1..cfb0fa8e75 100644
--- a/html/inc/bolt_xset.inc
+++ b/html/inc/bolt_xset.inc
@@ -20,10 +20,12 @@ class BoltExerciseSet extends BoltRandom {
public $repeats;
public $refresh;
public $callback;
+
function __construct(
- $name, $units, $number, $repeats, $refresh, $callback
+ $name, $units, $number, $repeats, $refresh, $attrs, $callback
) {
- parent::__construct($name, $units, $number);
+ parent::__construct($name, $units, $number, $attrs);
+
$this->repeats = $repeats;
$this->refresh = $refresh;
$this->callback = $callback;
@@ -168,12 +170,14 @@ function exercise_set() {
$callback = null;
$name = "";
$number = 0;
+ $attrs = null;
foreach ($args as $arg) {
if (is_array($arg)) {
switch ($arg[0]) {
case 'name': $name = $arg[1]; break;
case 'title': $title = $arg[1]; break;
case 'number': $number = $arg[1]; break;
+ case 'attrs': $attrs = $arg[1]; break;
case 'callback': $callback = $arg[1]; break;
default: echo "Unrecognized array arg: ", $arg[0], "\n"; break;
}
@@ -191,9 +195,10 @@ function exercise_set() {
echo "Unexpected arg to exercise_set(): "; print_r($arg);
}
}
+
if ($number == 0) $number = count($units);
return new BoltExerciseSet(
- $name, $units, $number, $repeats, $refresh, $callback
+ $name, $units, $number, $repeats, $refresh, $attrs, $callback
);
}