@@ -240,6 +240,10 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | class BoltFitbField { |
| 242 | 242 | public $textarea, $nrows, $ncols; |
| 243 | + |
|
| 244 | + /** |
|
| 245 | + * @param boolean $textarea |
|
| 246 | + */ |
|
| 243 | 247 | function __construct($textarea, $nrows, $ncols) { |
| 244 | 248 | $this->textarea = $textarea; |
| 245 | 249 | $this->nrows = $nrows; |
@@ -258,6 +262,10 @@ discard block |
||
| 258 | 262 | class BoltFitbAnswer { |
| 259 | 263 | public $type; // 0=constant, 1=regexp, 2=func |
| 260 | 264 | public $ans; |
| 265 | + |
|
| 266 | + /** |
|
| 267 | + * @param integer $type |
|
| 268 | + */ |
|
| 261 | 269 | function __construct($type, $ans) { |
| 262 | 270 | $this->type = $type; |
| 263 | 271 | $this->ans = $ans; |
@@ -52,6 +52,9 @@ |
||
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | +/** |
|
| 56 | + * @param string $n |
|
| 57 | + */ |
|
| 55 | 58 | function valuator($n) { |
| 56 | 59 | return array('valuator', $n); |
| 57 | 60 | } |
@@ -45,6 +45,9 @@ discard block |
||
| 45 | 45 | return "../bolt_snap/compare_snapshot_$x"; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | +/** |
|
| 49 | + * @param null|integer $dur |
|
| 50 | + */ |
|
| 48 | 51 | function write_compare_snapshot($course_id, $select_name, $xset_name, $dur) { |
| 49 | 52 | $now = time(); |
| 50 | 53 | $start = $now - $dur*86400; |
@@ -127,6 +130,9 @@ discard block |
||
| 127 | 130 | return "../bolt_snap/map_snapshot_".$course_id; |
| 128 | 131 | } |
| 129 | 132 | |
| 133 | +/** |
|
| 134 | + * @param null|integer $dur |
|
| 135 | + */ |
|
| 130 | 136 | function write_map_snapshot($course_id, $dur) { |
| 131 | 137 | $now = time(); |
| 132 | 138 | $start = $now - $dur*86400; |
@@ -23,6 +23,9 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | // get names of units of a given type |
| 25 | 25 | |
| 26 | +/** |
|
| 27 | + * @param string $type |
|
| 28 | + */ |
|
| 26 | 29 | function units_of_type($unit, $type) { |
| 27 | 30 | $names = array(); |
| 28 | 31 | if (get_class($unit) == $type) { |
@@ -118,6 +121,10 @@ discard block |
||
| 118 | 121 | |
| 119 | 122 | //////////// graph drawing |
| 120 | 123 | |
| 124 | +/** |
|
| 125 | + * @param integer $n |
|
| 126 | + * @param integer $width |
|
| 127 | + */ |
|
| 121 | 128 | function compare_bar($title, $n, $width, $lo, $hi) { |
| 122 | 129 | $x1 = $width*$lo; |
| 123 | 130 | $x2 = $width*($hi-$lo); |
@@ -137,6 +144,9 @@ discard block |
||
| 137 | 144 | "; |
| 138 | 145 | } |
| 139 | 146 | |
| 147 | +/** |
|
| 148 | + * @param integer $width |
|
| 149 | + */ |
|
| 140 | 150 | function compare_bar_insuff($title, $width) { |
| 141 | 151 | return " |
| 142 | 152 | <tr> |
@@ -150,6 +160,10 @@ discard block |
||
| 150 | 160 | "; |
| 151 | 161 | } |
| 152 | 162 | |
| 163 | +/** |
|
| 164 | + * @param integer[] $x |
|
| 165 | + * @param integer $width |
|
| 166 | + */ |
|
| 153 | 167 | function outcome_graph($x, $width) { |
| 154 | 168 | $n = $x[0]+$x[1]+$x[2]; |
| 155 | 169 | if (!$n) return empty_cell(); |
@@ -182,6 +196,9 @@ discard block |
||
| 182 | 196 | return $s; |
| 183 | 197 | } |
| 184 | 198 | |
| 199 | +/** |
|
| 200 | + * @param integer $w |
|
| 201 | + */ |
|
| 185 | 202 | function time_graph($t, $w) { |
| 186 | 203 | if ($t == 0) return "<td>---</td>"; |
| 187 | 204 | $x = (log10($t)+2)*$w/4; |
@@ -193,6 +210,10 @@ discard block |
||
| 193 | 210 | </td>"; |
| 194 | 211 | } |
| 195 | 212 | |
| 213 | +/** |
|
| 214 | + * @param integer $t |
|
| 215 | + * @param integer $w |
|
| 216 | + */ |
|
| 196 | 217 | function score_graph($t, $w) { |
| 197 | 218 | if ($t == 0) return "<td>---</td>"; |
| 198 | 219 | $x = $t*$w; |
@@ -22,6 +22,9 @@ discard block |
||
| 22 | 22 | public $weight; |
| 23 | 23 | public $callback; |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param null|BoltRefresh $refresh |
|
| 27 | + */ |
|
| 25 | 28 | function __construct( |
| 26 | 29 | $name, $units, $number, $repeats, $refresh, $attrs, $callback, $weight |
| 27 | 30 | ) { |
@@ -156,10 +159,16 @@ discard block |
||
| 156 | 159 | define('REPEAT', 2); |
| 157 | 160 | define('NEXT', 4); |
| 158 | 161 | |
| 162 | +/** |
|
| 163 | + * @param integer $f |
|
| 164 | + */ |
|
| 159 | 165 | function repeat($s, $u, $f) { |
| 160 | 166 | return new BoltRepeat($s, $u, $f); |
| 161 | 167 | } |
| 162 | 168 | |
| 169 | +/** |
|
| 170 | + * @param integer[] $a |
|
| 171 | + */ |
|
| 163 | 172 | function refresh($a) { |
| 164 | 173 | return new BoltRefresh($a); |
| 165 | 174 | } |
@@ -38,6 +38,9 @@ |
||
| 38 | 38 | return $job->insert($clause); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | +/** |
|
| 42 | + * @param string $name |
|
| 43 | + */ |
|
| 41 | 44 | function bossa_batch_create($appid, $name, $calibration) { |
| 42 | 45 | $now = time(); |
| 43 | 46 | $c = $calibration?"1":"0"; |
@@ -59,6 +59,9 @@ discard block |
||
| 59 | 59 | return $path; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | +/** |
|
| 63 | + * @param string $dir |
|
| 64 | + */ |
|
| 62 | 65 | function disk_usage($dir) { |
| 63 | 66 | $usage=0; |
| 64 | 67 | if ($handle=@opendir($dir)) { |
@@ -76,6 +79,10 @@ discard block |
||
| 76 | 79 | return $usage; |
| 77 | 80 | } |
| 78 | 81 | |
| 82 | +/** |
|
| 83 | + * @param integer $max_age |
|
| 84 | + * @param string $dir |
|
| 85 | + */ |
|
| 79 | 86 | function clean_cache($max_age, $dir) { |
| 80 | 87 | $start_dir = getcwd(); |
| 81 | 88 | if (!chdir($dir)) { |
@@ -116,6 +123,9 @@ discard block |
||
| 116 | 123 | clean_cache($x, "../cache"); |
| 117 | 124 | } |
| 118 | 125 | |
| 126 | +/** |
|
| 127 | + * @param string $path |
|
| 128 | + */ |
|
| 119 | 129 | function cache_need_to_regenerate($path, $max_age){ |
| 120 | 130 | $regenerate = false; |
| 121 | 131 | $request = apache_request_headers(); |
@@ -139,6 +149,9 @@ discard block |
||
| 139 | 149 | } |
| 140 | 150 | |
| 141 | 151 | // Returns cached data or false if nothing was found |
| 152 | +/** |
|
| 153 | + * @param integer $max_age |
|
| 154 | + */ |
|
| 142 | 155 | function get_cached_data($max_age, $params=""){ |
| 143 | 156 | global $no_cache; |
| 144 | 157 | |
@@ -253,6 +266,10 @@ discard block |
||
| 253 | 266 | } |
| 254 | 267 | } |
| 255 | 268 | |
| 269 | +/** |
|
| 270 | + * @param integer $max_age |
|
| 271 | + * @param string $data |
|
| 272 | + */ |
|
| 256 | 273 | function set_cached_data($max_age, $data, $params=""){ |
| 257 | 274 | // for the benefit of hackers |
| 258 | 275 | if (strstr($params, "..")) { |
@@ -37,6 +37,9 @@ |
||
| 37 | 37 | $ops = number_format($ops, 2); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | +/** |
|
| 41 | + * @param boolean $bolden |
|
| 42 | + */ |
|
| 40 | 43 | function credit_string($credit, $bolden) { |
| 41 | 44 | $cobbs = number_format($credit, 0); |
| 42 | 45 | |
@@ -69,6 +69,10 @@ discard block |
||
| 69 | 69 | function _mysql_fetch_row($r) { |
| 70 | 70 | return mysqli_fetch_row($r); |
| 71 | 71 | } |
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * @param resource $r |
|
| 75 | + */ |
|
| 72 | 76 | function _mysql_fetch_assoc($r) { |
| 73 | 77 | return mysqli_fetch_assoc($r); |
| 74 | 78 | } |
@@ -132,6 +136,10 @@ discard block |
||
| 132 | 136 | function _mysql_fetch_row($r) { |
| 133 | 137 | return mysql_fetch_row($r); |
| 134 | 138 | } |
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * @param resource $r |
|
| 142 | + */ |
|
| 135 | 143 | function _mysql_fetch_assoc($r) { |
| 136 | 144 | return mysql_fetch_assoc($r); |
| 137 | 145 | } |