Changeset 17705 for trunk/FACT++/www/schedule
- Timestamp:
- 04/28/14 11:17:30 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/www/schedule/save.php
r17701 r17705 130 130 } 131 131 132 // ================================================================ 133 134 $db = mysql_connect($dbhost,$dbuser,$dbpass); 135 if (!$db) 136 die(mysql_error()); 137 138 if (!mysql_select_db($dbname, $db)) 139 die(mysql_error()); 140 141 $query = "SELECT * FROM measurement"; 142 143 $sql = mysql_query($query); 144 if (!$sql) 145 die(mysql_error()); 146 147 $measurements = array(); 148 while($row = mysql_fetch_assoc($sql)) 149 $measurements[$row['fMeasurementKey']] = $row; 150 132 151 // ---------------------------------------------------------------- 133 152 … … 144 163 { 145 164 $t = $row[0]; // time 146 $m = $row[1]; // measurement 147 $s = $row[2]; // source 148 $v = $row[3]; // value 149 150 // If there is a time set, remember the time, if not 151 // this is just a measurement within an observation 152 // so duplicate the time 165 166 // If there is a time set (first task in an observation), 167 // remember the time, if not this is just a measurement 168 // within an observation so duplicate the time 153 169 if (!isset($t)) 154 170 { … … 173 189 else 174 190 { 191 // Check all but the last task in a measurement whether 192 // the are not unlimited 193 if ($last==$t) 194 { 195 if ($measurements[$m]['fIsUnlimited']==true) 196 die("Unlimited task '".$measurements[$m]['fMeasurement']."' detected before end of observation\n[".$last."|".($id-1)."]"); 197 } 198 175 199 if ($last>$t) 176 200 die("Times not sequential\n[".$last."|".$t."]"); 177 201 $last = $t; 178 202 } 203 204 $m = $row[1]; // measurement 205 $s = $row[2]; // source 206 $v = $row[3]; // value 207 208 if ($measurements[$m]['fNeedsSource']==true && $s==0) 209 die("Task '".$measurements[$m]['fMeasurement']."' needs source.\n[".$t."|".$id."]"); 210 if ($measurements[$m]['fNeedsSource']!=true && $s>0) 211 die("Task '".$measurements[$m]['fMeasurement']."' must not have source.\n[".$t."|".$id."]"); 179 212 180 213 // Compile query … … 222 255 // ================================================================ 223 256 224 $db = mysql_connect($dbhost,$dbuser,$dbpass);225 if (!$db)226 die(mysql_error());227 228 if (!mysql_select_db($dbname, $db))229 die(mysql_error());230 231 257 foreach ($queries as $query) 232 258 if (!mysql_query($query))
Note:
See TracChangeset
for help on using the changeset viewer.