| 1 | <script type="text/javascript">
|
|---|
| 2 | $(document).ready(function(){
|
|---|
| 3 |
|
|---|
| 4 | var timeValue;
|
|---|
| 5 | var meas;
|
|---|
| 6 | var meas2;
|
|---|
| 7 | var getTableId;
|
|---|
| 8 | window.cnt=0;
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 | //-------------------------------- fetch----------------------------//
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 | //-----------------------------------------------//
|
|---|
| 18 | //end fetch
|
|---|
| 19 |
|
|---|
| 20 | //------------------------------------------------//
|
|---|
| 21 | var x = 0;
|
|---|
| 22 |
|
|---|
| 23 | <?php
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 | include '../include/factdb.php';
|
|---|
| 27 | $day = $_GET['days'];
|
|---|
| 28 | $days = Date('Y-m-d',strtotime($day));
|
|---|
| 29 | ?>
|
|---|
| 30 | //alert('<?php echo $day; ?>');
|
|---|
| 31 |
|
|---|
| 32 | <?php
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 | $fetch = mysql_query("SELECT * FROM schedule") or die(mysql_error());
|
|---|
| 36 |
|
|---|
| 37 | while($rows = mysql_fetch_array($fetch)){
|
|---|
| 38 | $timestamp=strtotime($rows['fLastUpdate']);
|
|---|
| 39 | $timestamp2 = date('Y-m-d',$timestamp);
|
|---|
| 40 | $date_time = date('H:i',$timestamp);
|
|---|
| 41 | //$time_new = $date_time->format('H:i:s')
|
|---|
| 42 | if($days == $timestamp2){
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 | ?>
|
|---|
| 46 | cnt++;
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 | var table = document.createElement("table");
|
|---|
| 51 | table.setAttribute('id',"table"+cnt);
|
|---|
| 52 | table.setAttribute('width','100%');
|
|---|
| 53 | var tr = document.createElement('tr');
|
|---|
| 54 | var td3=document.createElement('td');
|
|---|
| 55 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
|---|
| 56 | td3.appendChild(
|
|---|
| 57 | input = document.createElement("input"),
|
|---|
| 58 | input.setAttribute("type","time"),
|
|---|
| 59 | input.setAttribute("id","Time"+cnt),
|
|---|
| 60 | input.setAttribute("max","24"),
|
|---|
| 61 | input.setAttribute("min","1"),
|
|---|
| 62 | input.setAttribute("required",true),
|
|---|
| 63 | input.setAttribute("value",'<?php echo $date_time; ?>')
|
|---|
| 64 |
|
|---|
| 65 | );
|
|---|
| 66 | td3.appendChild(
|
|---|
| 67 | button=document.createElement('input'),
|
|---|
| 68 | button.setAttribute('type','button'),
|
|---|
| 69 | button.setAttribute('value','[+]'),
|
|---|
| 70 | button.setAttribute('id','btnAddTime'),
|
|---|
| 71 | button.onclick=function(){
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 | if($('#Time1').val() != ""){ var splitting = $('#Time1').val().split(':'); var add = 01;
|
|---|
| 76 |
|
|---|
| 77 | timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1];
|
|---|
| 78 |
|
|---|
| 79 | function pad(number, length) {
|
|---|
| 80 |
|
|---|
| 81 | var str = '' + number;
|
|---|
| 82 | while (str.length < length) {
|
|---|
| 83 | str = '0' + str;
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| 86 | return str;
|
|---|
| 87 |
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split1(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 | }
|
|---|
| 94 | );
|
|---|
| 95 | var td=document.createElement('td');
|
|---|
| 96 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 97 | td.appendChild(
|
|---|
| 98 | sourcecbo= document.createElement('select'),
|
|---|
| 99 | sourcecbo.setAttribute('id','source'+cnt),
|
|---|
| 100 | <?php
|
|---|
| 101 | $source=mysql_query("SELECT*FROM source");
|
|---|
| 102 | while($rowsource=mysql_fetch_array($source))
|
|---|
| 103 | {
|
|---|
| 104 | ?>
|
|---|
| 105 | sourcecbo.appendChild(
|
|---|
| 106 | option=document.createElement('option'),
|
|---|
| 107 |
|
|---|
| 108 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 109 | <?php if($rows['fSourceKey'] == $rowsource['fSourceKEY']){ echo"option.setAttribute('selected',true),"; } ?>
|
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 | ),
|
|---|
| 116 | <?php
|
|---|
| 117 | }
|
|---|
| 118 | ?>
|
|---|
| 119 | sourcecbo.setAttribute('id','source'+cnt)
|
|---|
| 120 |
|
|---|
| 121 | );
|
|---|
| 122 | var td1=document.createElement('td');
|
|---|
| 123 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 124 | td1.appendChild(
|
|---|
| 125 | measurementcbo= document.createElement('select'),
|
|---|
| 126 | measurementcbo.setAttribute('id','measurement'+cnt),
|
|---|
| 127 | <?php
|
|---|
| 128 | $measure=mysql_query("SELECT*FROM measurement");
|
|---|
| 129 | while($rowmeasure=mysql_fetch_array($measure))
|
|---|
| 130 | {
|
|---|
| 131 | ?>
|
|---|
| 132 | measurementcbo.appendChild(
|
|---|
| 133 | option=document.createElement('option'),
|
|---|
| 134 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
|---|
| 135 |
|
|---|
| 136 | <?php if($rows['fMeasurementTypeKey']==$rowmeasure['fMeasurementKey']){ echo "option.setAttribute('selected',true),";} ?>
|
|---|
| 137 |
|
|---|
| 138 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 139 | ),
|
|---|
| 140 | <?php
|
|---|
| 141 | }
|
|---|
| 142 | ?>
|
|---|
| 143 | measurementcbo.setAttribute('id','measurement'+cnt)
|
|---|
| 144 | );
|
|---|
| 145 | td1.appendChild(
|
|---|
| 146 | button=document.createElement('input'),
|
|---|
| 147 | button.setAttribute('type','button'),
|
|---|
| 148 | button.setAttribute('value','[+]'),
|
|---|
| 149 | button.setAttribute('id','btnAddTime'),
|
|---|
| 150 | button.onclick=function(){
|
|---|
| 151 | if($('#Time1').val() != ""){ timeValue = $('#Time1').val(); meas = "hidden"; meas2 = true; getTableId = '#table'+cnt; split1(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 | }
|
|---|
| 155 | );
|
|---|
| 156 | var td2=document.createElement('td');
|
|---|
| 157 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 158 | td2.appendChild(
|
|---|
| 159 | input = document.createElement('input'),
|
|---|
| 160 | input.setAttribute('type','text'),
|
|---|
| 161 | input.setAttribute('id','txtData'+cnt),
|
|---|
| 162 | input.setAttribute('value','<?php echo $rows['fData']; ?>')
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 | );
|
|---|
| 166 | var td4=document.createElement('td');
|
|---|
| 167 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 168 | td4.appendChild(
|
|---|
| 169 | button = document.createElement('input'),
|
|---|
| 170 | button.setAttribute("type",'button'),
|
|---|
| 171 | button.setAttribute('id','btnSplit'),
|
|---|
| 172 | button.setAttribute('value','Split'),
|
|---|
| 173 | button.onclick= function()
|
|---|
| 174 | {
|
|---|
| 175 |
|
|---|
| 176 | if($('#Time1').val() != ""){ var splitting = $('#Time1').val().split(':'); var add = 30;
|
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 | timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2);
|
|---|
| 180 |
|
|---|
| 181 | function pad(number, length) {
|
|---|
| 182 |
|
|---|
| 183 | var str = '' + number;
|
|---|
| 184 | while (str.length < length) {
|
|---|
| 185 | str = '0' + str;
|
|---|
| 186 | }
|
|---|
| 187 |
|
|---|
| 188 | return str;
|
|---|
| 189 |
|
|---|
| 190 | };
|
|---|
| 191 |
|
|---|
| 192 | meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split1(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 | }
|
|---|
| 197 | );
|
|---|
| 198 | td4.appendChild(
|
|---|
| 199 | button=document.createElement('input'),
|
|---|
| 200 | button.setAttribute('type','button'),
|
|---|
| 201 | button.setAttribute('value','Delete'),
|
|---|
| 202 | button.setAttribute('id','btnDelete'),
|
|---|
| 203 | button.onclick=function(){
|
|---|
| 204 | $('#table'+cnt).remove();
|
|---|
| 205 | }
|
|---|
| 206 | );
|
|---|
| 207 |
|
|---|
| 208 | tr.appendChild(td3);
|
|---|
| 209 | tr.appendChild(td1);
|
|---|
| 210 | tr.appendChild(td);
|
|---|
| 211 |
|
|---|
| 212 | tr.appendChild(td2);
|
|---|
| 213 | tr.appendChild(td4);
|
|---|
| 214 | table.appendChild(tr);
|
|---|
| 215 |
|
|---|
| 216 | $('#TableH1').append(table);
|
|---|
| 217 |
|
|---|
| 218 | <?php
|
|---|
| 219 | }
|
|---|
| 220 | }
|
|---|
| 221 | ?>
|
|---|
| 222 |
|
|---|
| 223 | if(cnt==0){
|
|---|
| 224 | var table = document.createElement("table");
|
|---|
| 225 | table.setAttribute('id',"table2");
|
|---|
| 226 | table.setAttribute('width','100%');
|
|---|
| 227 | var tr = document.createElement('tr');
|
|---|
| 228 | tr.setAttribute('id','');
|
|---|
| 229 | tr.setAttribute('class','');
|
|---|
| 230 | var td3=document.createElement('td');
|
|---|
| 231 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
|---|
| 232 | td3.appendChild(
|
|---|
| 233 | input = document.createElement("input"),
|
|---|
| 234 | input.setAttribute("type","time"),
|
|---|
| 235 | input.setAttribute("id","Time1"),
|
|---|
| 236 | input.setAttribute("max","24"),
|
|---|
| 237 | input.setAttribute("min","1"),
|
|---|
| 238 | input.setAttribute("required",true)
|
|---|
| 239 | );
|
|---|
| 240 | td3.appendChild(
|
|---|
| 241 | button=document.createElement('input'),
|
|---|
| 242 | button.setAttribute('type','button'),
|
|---|
| 243 | button.setAttribute('value','[+]'),
|
|---|
| 244 | button.setAttribute('id','btnAddTime'),
|
|---|
| 245 | button.onclick=function(){
|
|---|
| 246 | if($('#Time2').val() != ""){ var splitting = $('#Time2').val().split(':'); var add = 01;
|
|---|
| 247 |
|
|---|
| 248 | timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1];
|
|---|
| 249 |
|
|---|
| 250 | function pad(number, length) {
|
|---|
| 251 |
|
|---|
| 252 | var str = '' + number;
|
|---|
| 253 | while (str.length < length) {
|
|---|
| 254 | str = '0' + str;
|
|---|
| 255 | }
|
|---|
| 256 |
|
|---|
| 257 | return str;
|
|---|
| 258 |
|
|---|
| 259 | }; meas = "name"; meas2 = "time"; getTableId = '#table1'; split(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 260 |
|
|---|
| 261 |
|
|---|
| 262 | }
|
|---|
| 263 | );
|
|---|
| 264 | var td=document.createElement('td');
|
|---|
| 265 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 266 | td.appendChild(
|
|---|
| 267 | sourcecbo= document.createElement('select'),
|
|---|
| 268 | sourcecbo.setAttribute('id','source1'),
|
|---|
| 269 | <?php
|
|---|
| 270 | $source=mysql_query("SELECT*FROM source");
|
|---|
| 271 | while($rowsource=mysql_fetch_array($source))
|
|---|
| 272 | {
|
|---|
| 273 | ?>
|
|---|
| 274 | sourcecbo.appendChild(
|
|---|
| 275 | option=document.createElement('option'),
|
|---|
| 276 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 277 | option.setAttribute('selected',true),
|
|---|
| 278 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 279 |
|
|---|
| 280 | ),
|
|---|
| 281 | <?php
|
|---|
| 282 | }
|
|---|
| 283 | ?>
|
|---|
| 284 | sourcecbo.setAttribute('id','source1')
|
|---|
| 285 |
|
|---|
| 286 | );
|
|---|
| 287 | var td1=document.createElement('td');
|
|---|
| 288 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 289 | td1.appendChild(
|
|---|
| 290 | measurementcbo= document.createElement('select'),
|
|---|
| 291 | measurementcbo.setAttribute('id','measurement1'),
|
|---|
| 292 | <?php
|
|---|
| 293 | $measure=mysql_query("SELECT*FROM measurement");
|
|---|
| 294 | while($rowmeasure=mysql_fetch_array($measure))
|
|---|
| 295 | {
|
|---|
| 296 | ?>
|
|---|
| 297 | measurementcbo.appendChild(
|
|---|
| 298 | option=document.createElement('option'),
|
|---|
| 299 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
|---|
| 300 | option.setAttribute('selected',true),
|
|---|
| 301 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 302 | ),
|
|---|
| 303 | <?php
|
|---|
| 304 | }
|
|---|
| 305 | ?>
|
|---|
| 306 | measurementcbo.setAttribute('id','measurement1')
|
|---|
| 307 | );
|
|---|
| 308 | td1.appendChild(
|
|---|
| 309 | button=document.createElement('input'),
|
|---|
| 310 | button.setAttribute('type','button'),
|
|---|
| 311 | button.setAttribute('value','[+]'),
|
|---|
| 312 | button.setAttribute('id','btnAddTime'),
|
|---|
| 313 | button.onclick=function(){
|
|---|
| 314 | if($('#Time2').val() != ""){ timeValue = $('#Time2').val(); meas = "hidden"; meas2 = true; getTableId = '#table1'; split(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 315 |
|
|---|
| 316 |
|
|---|
| 317 | }
|
|---|
| 318 | );
|
|---|
| 319 | var td2=document.createElement('td');
|
|---|
| 320 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 321 | td2.appendChild(
|
|---|
| 322 | input = document.createElement('input'),
|
|---|
| 323 | input.setAttribute('type','text'),
|
|---|
| 324 | input.setAttribute('id','txtData1')
|
|---|
| 325 |
|
|---|
| 326 | );
|
|---|
| 327 | var td4=document.createElement('td');
|
|---|
| 328 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 329 | td4.appendChild(
|
|---|
| 330 | button = document.createElement('input'),
|
|---|
| 331 | button.setAttribute("type",'button'),
|
|---|
| 332 | button.setAttribute('id','btnSplit'),
|
|---|
| 333 | button.setAttribute('value','Split'),
|
|---|
| 334 | button.onclick= function()
|
|---|
| 335 | {
|
|---|
| 336 | if($('#Time2').val() != ""){ var splitting = $('#Time2').val().split(':'); var add = 30;
|
|---|
| 337 |
|
|---|
| 338 | timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2);
|
|---|
| 339 |
|
|---|
| 340 | function pad(number, length) {
|
|---|
| 341 |
|
|---|
| 342 | var str = '' + number;
|
|---|
| 343 | while (str.length < length) {
|
|---|
| 344 | str = '0' + str;
|
|---|
| 345 | }
|
|---|
| 346 |
|
|---|
| 347 | return str;
|
|---|
| 348 |
|
|---|
| 349 | }
|
|---|
| 350 |
|
|---|
| 351 | meas = "name"; meas2 = "time"; getTableId = '#table1'; split(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 352 |
|
|---|
| 353 | }
|
|---|
| 354 | );
|
|---|
| 355 | td4.appendChild(
|
|---|
| 356 | button=document.createElement('input'),
|
|---|
| 357 | button.setAttribute('type','button'),
|
|---|
| 358 | button.setAttribute('value','Delete'),
|
|---|
| 359 | button.setAttribute('id','btnDelete'),
|
|---|
| 360 | button.onclick=function(){
|
|---|
| 361 | $('#table1').remove();
|
|---|
| 362 |
|
|---|
| 363 | }
|
|---|
| 364 | );
|
|---|
| 365 |
|
|---|
| 366 | tr.appendChild(td3);
|
|---|
| 367 | tr.appendChild(td1);
|
|---|
| 368 | tr.appendChild(td);
|
|---|
| 369 |
|
|---|
| 370 | tr.appendChild(td2);
|
|---|
| 371 | tr.appendChild(td4);
|
|---|
| 372 | table.appendChild(tr);
|
|---|
| 373 |
|
|---|
| 374 | $('#TableH1').append(table);
|
|---|
| 375 |
|
|---|
| 376 | var table = document.createElement("table");
|
|---|
| 377 | table.setAttribute('id',"table1");
|
|---|
| 378 | table.setAttribute('width','100%');
|
|---|
| 379 | var tr = document.createElement('tr');
|
|---|
| 380 | tr.setAttribute('id','');
|
|---|
| 381 | tr.setAttribute('class','');
|
|---|
| 382 | var td3=document.createElement('td');
|
|---|
| 383 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
|---|
| 384 | td3.appendChild(
|
|---|
| 385 | input = document.createElement("input"),
|
|---|
| 386 | input.setAttribute("type","time"),
|
|---|
| 387 | input.setAttribute("id","Time2"),
|
|---|
| 388 | input.setAttribute("max","24"),
|
|---|
| 389 | input.setAttribute("min","1"),
|
|---|
| 390 | input.setAttribute("required",true)
|
|---|
| 391 | );
|
|---|
| 392 | td3.appendChild(
|
|---|
| 393 | button=document.createElement('input'),
|
|---|
| 394 | button.setAttribute('type','button'),
|
|---|
| 395 | button.setAttribute('value','[+]'),
|
|---|
| 396 | button.setAttribute('id','btnAddTime'),
|
|---|
| 397 | button.onclick=function(){
|
|---|
| 398 | if($('#Time2').val() != ""){ var splitting = $('#Time2').val().split(':'); var add = 01;
|
|---|
| 399 |
|
|---|
| 400 | timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1];
|
|---|
| 401 |
|
|---|
| 402 | function pad(number, length) {
|
|---|
| 403 |
|
|---|
| 404 | var str = '' + number;
|
|---|
| 405 | while (str.length < length) {
|
|---|
| 406 | str = '0' + str;
|
|---|
| 407 | }
|
|---|
| 408 |
|
|---|
| 409 | return str;
|
|---|
| 410 |
|
|---|
| 411 | }; meas = "name"; meas2 = "time"; getTableId = '#table1'; split(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 412 |
|
|---|
| 413 |
|
|---|
| 414 | }
|
|---|
| 415 | );
|
|---|
| 416 | var td=document.createElement('td');
|
|---|
| 417 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 418 | td.appendChild(
|
|---|
| 419 | sourcecbo= document.createElement('select'),
|
|---|
| 420 | sourcecbo.setAttribute('id','source2'),
|
|---|
| 421 | <?php
|
|---|
| 422 | $source=mysql_query("SELECT*FROM source");
|
|---|
| 423 | while($rowsource=mysql_fetch_array($source))
|
|---|
| 424 | {
|
|---|
| 425 | ?>
|
|---|
| 426 | sourcecbo.appendChild(
|
|---|
| 427 | option=document.createElement('option'),
|
|---|
| 428 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 429 | option.setAttribute('selected',true),
|
|---|
| 430 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 431 |
|
|---|
| 432 | ),
|
|---|
| 433 | <?php
|
|---|
| 434 | }
|
|---|
| 435 | ?>
|
|---|
| 436 | sourcecbo.setAttribute('id','source2')
|
|---|
| 437 |
|
|---|
| 438 | );
|
|---|
| 439 | var td1=document.createElement('td');
|
|---|
| 440 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 441 | td1.appendChild(
|
|---|
| 442 | measurementcbo= document.createElement('select'),
|
|---|
| 443 | measurementcbo.setAttribute('id','measurement2'),
|
|---|
| 444 | <?php
|
|---|
| 445 | $measure=mysql_query("SELECT*FROM measurement");
|
|---|
| 446 | while($rowmeasure=mysql_fetch_array($measure))
|
|---|
| 447 | {
|
|---|
| 448 | ?>
|
|---|
| 449 | measurementcbo.appendChild(
|
|---|
| 450 | option=document.createElement('option'),
|
|---|
| 451 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
|---|
| 452 | option.setAttribute('selected',true),
|
|---|
| 453 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 454 | ),
|
|---|
| 455 | <?php
|
|---|
| 456 | }
|
|---|
| 457 | ?>
|
|---|
| 458 | measurementcbo.setAttribute('id','measurement2')
|
|---|
| 459 | );
|
|---|
| 460 | td1.appendChild(
|
|---|
| 461 | button=document.createElement('input'),
|
|---|
| 462 | button.setAttribute('type','button'),
|
|---|
| 463 | button.setAttribute('value','[+]'),
|
|---|
| 464 | button.setAttribute('id','btnAddTime'),
|
|---|
| 465 | button.onclick=function(){
|
|---|
| 466 | if($('#Time2').val() != ""){ timeValue = $('#Time2').val(); meas = "hidden"; meas2 = true; getTableId = '#table1'; split(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 467 |
|
|---|
| 468 |
|
|---|
| 469 | }
|
|---|
| 470 | );
|
|---|
| 471 | var td2=document.createElement('td');
|
|---|
| 472 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 473 | td2.appendChild(
|
|---|
| 474 | input = document.createElement('input'),
|
|---|
| 475 | input.setAttribute('type','text'),
|
|---|
| 476 | input.setAttribute('id','txtData2')
|
|---|
| 477 |
|
|---|
| 478 | );
|
|---|
| 479 | var td4=document.createElement('td');
|
|---|
| 480 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 481 | td4.appendChild(
|
|---|
| 482 | button = document.createElement('input'),
|
|---|
| 483 | button.setAttribute("type",'button'),
|
|---|
| 484 | button.setAttribute('id','btnSplit'),
|
|---|
| 485 | button.setAttribute('value','Split'),
|
|---|
| 486 | button.onclick= function()
|
|---|
| 487 | {
|
|---|
| 488 | if($('#Time2').val() != ""){ var splitting = $('#Time2').val().split(':'); var add = 30;
|
|---|
| 489 |
|
|---|
| 490 | timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2);
|
|---|
| 491 |
|
|---|
| 492 | function pad(number, length) {
|
|---|
| 493 |
|
|---|
| 494 | var str = '' + number;
|
|---|
| 495 | while (str.length < length) {
|
|---|
| 496 | str = '0' + str;
|
|---|
| 497 | }
|
|---|
| 498 |
|
|---|
| 499 | return str;
|
|---|
| 500 |
|
|---|
| 501 | }
|
|---|
| 502 |
|
|---|
| 503 | meas = "name"; meas2 = "time"; getTableId = '#table1'; split(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 504 |
|
|---|
| 505 | }
|
|---|
| 506 | );
|
|---|
| 507 | td4.appendChild(
|
|---|
| 508 | button=document.createElement('input'),
|
|---|
| 509 | button.setAttribute('type','button'),
|
|---|
| 510 | button.setAttribute('value','Delete'),
|
|---|
| 511 | button.setAttribute('id','btnDelete'),
|
|---|
| 512 | button.onclick=function(){
|
|---|
| 513 | $('#table1').remove();
|
|---|
| 514 |
|
|---|
| 515 | }
|
|---|
| 516 | );
|
|---|
| 517 |
|
|---|
| 518 | tr.appendChild(td3);
|
|---|
| 519 | tr.appendChild(td1);
|
|---|
| 520 | tr.appendChild(td);
|
|---|
| 521 |
|
|---|
| 522 | tr.appendChild(td2);
|
|---|
| 523 | tr.appendChild(td4);
|
|---|
| 524 | table.appendChild(tr);
|
|---|
| 525 |
|
|---|
| 526 | $('#TableH1').append(table);
|
|---|
| 527 |
|
|---|
| 528 |
|
|---|
| 529 | }
|
|---|
| 530 | var meas;
|
|---|
| 531 | var timeValue;
|
|---|
| 532 | var pad;
|
|---|
| 533 | if(cnt==0){ cnt=2; }
|
|---|
| 534 | function split()
|
|---|
| 535 | {
|
|---|
| 536 |
|
|---|
| 537 | cnt++;
|
|---|
| 538 | var table = document.createElement("table");
|
|---|
| 539 | table.setAttribute('id',"table"+cnt);
|
|---|
| 540 | table.setAttribute('width','100%');
|
|---|
| 541 | var tr = document.createElement('tr');
|
|---|
| 542 | tr.setAttribute('id','');
|
|---|
| 543 | tr.setAttribute('class','');
|
|---|
| 544 |
|
|---|
| 545 | var td3=document.createElement('td');
|
|---|
| 546 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
|---|
| 547 | td3.setAttribute('class','first');
|
|---|
| 548 |
|
|---|
| 549 | td3.appendChild(
|
|---|
| 550 | input = document.createElement("input"),
|
|---|
| 551 | input.setAttribute("type","time"),
|
|---|
| 552 | input.setAttribute("id","Time"+cnt),
|
|---|
| 553 | input.setAttribute("max","24"),
|
|---|
| 554 | input.setAttribute("min","1"),
|
|---|
| 555 | input.setAttribute("required",true),
|
|---|
| 556 | input.setAttribute(meas,meas2),
|
|---|
| 557 | input.setAttribute("value",timeValue)
|
|---|
| 558 |
|
|---|
| 559 | );
|
|---|
| 560 | td3.appendChild(
|
|---|
| 561 | button=document.createElement('input'),
|
|---|
| 562 | button.setAttribute('type','button'),
|
|---|
| 563 | button.setAttribute('value','[+]'),
|
|---|
| 564 | button.setAttribute('id','btnAddTime'),
|
|---|
| 565 | button.setAttribute(meas,meas2),
|
|---|
| 566 | button.onclick=function(){
|
|---|
| 567 | if($('#Time'+cnt).val() != ""){var splitting = $('#Time'+cnt).val().split(':'); var add = 01;
|
|---|
| 568 |
|
|---|
| 569 | timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1];
|
|---|
| 570 |
|
|---|
| 571 | function pad(number, length) {
|
|---|
| 572 |
|
|---|
| 573 | var str = '' + number;
|
|---|
| 574 | while (str.length < length) {
|
|---|
| 575 | str = '0' + str;
|
|---|
| 576 | }
|
|---|
| 577 |
|
|---|
| 578 | return str;
|
|---|
| 579 |
|
|---|
| 580 | } meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split1(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 581 |
|
|---|
| 582 |
|
|---|
| 583 | }
|
|---|
| 584 | );
|
|---|
| 585 |
|
|---|
| 586 | var td=document.createElement('td');
|
|---|
| 587 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 588 | td.appendChild(
|
|---|
| 589 | sourcecbo= document.createElement('select'),
|
|---|
| 590 | sourcecbo.setAttribute('id','source'+cnt),
|
|---|
| 591 | <?php
|
|---|
| 592 | $source=mysql_query("SELECT*FROM source");
|
|---|
| 593 | while($rowsource=mysql_fetch_array($source))
|
|---|
| 594 | {
|
|---|
| 595 | ?>
|
|---|
| 596 | sourcecbo.appendChild(
|
|---|
| 597 | option=document.createElement('option'),
|
|---|
| 598 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 599 | option.setAttribute('selected',true),
|
|---|
| 600 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 601 |
|
|---|
| 602 | ),
|
|---|
| 603 | <?php
|
|---|
| 604 | }
|
|---|
| 605 | ?>
|
|---|
| 606 | sourcecbo.setAttribute('id','source'+cnt)
|
|---|
| 607 |
|
|---|
| 608 | );
|
|---|
| 609 | var td1=document.createElement('td');
|
|---|
| 610 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 611 | td1.appendChild(
|
|---|
| 612 | measurementcbo= document.createElement('select'),
|
|---|
| 613 | measurementcbo.setAttribute('id','measurement'+cnt),
|
|---|
| 614 | <?php
|
|---|
| 615 | $measure=mysql_query("SELECT*FROM measurement");
|
|---|
| 616 | while($rowmeasure=mysql_fetch_array($measure))
|
|---|
| 617 | {
|
|---|
| 618 | ?>
|
|---|
| 619 | measurementcbo.appendChild(
|
|---|
| 620 | option=document.createElement('option'),
|
|---|
| 621 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
|---|
| 622 | option.setAttribute('selected',true),
|
|---|
| 623 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 624 | ),
|
|---|
| 625 | <?php
|
|---|
| 626 | }
|
|---|
| 627 | ?>
|
|---|
| 628 | measurementcbo.setAttribute('id','measurement'+cnt)
|
|---|
| 629 | );
|
|---|
| 630 | td1.appendChild(
|
|---|
| 631 | button=document.createElement('input'),
|
|---|
| 632 | button.setAttribute('type','button'),
|
|---|
| 633 | button.setAttribute('value','[+]'),
|
|---|
| 634 | button.setAttribute('id','btnAddTime'),
|
|---|
| 635 | button.onclick=function(){
|
|---|
| 636 |
|
|---|
| 637 | if($('#Time'+cnt).val() != "")
|
|---|
| 638 | {
|
|---|
| 639 | timeValue = $('#Time'+cnt).val();
|
|---|
| 640 | meas = "hidden";
|
|---|
| 641 | meas2 = true;
|
|---|
| 642 | getTableId = '#table'+cnt;
|
|---|
| 643 | split1();
|
|---|
| 644 | }
|
|---|
| 645 | else
|
|---|
| 646 | {
|
|---|
| 647 | alert("please enter value for time to add measurement");
|
|---|
| 648 | }
|
|---|
| 649 |
|
|---|
| 650 |
|
|---|
| 651 | }
|
|---|
| 652 | );
|
|---|
| 653 |
|
|---|
| 654 | var td2=document.createElement('td');
|
|---|
| 655 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 656 | td2.appendChild(
|
|---|
| 657 | input = document.createElement('input'),
|
|---|
| 658 | input.setAttribute('type','text'),
|
|---|
| 659 | input.setAttribute('id','txtData'+cnt)
|
|---|
| 660 |
|
|---|
| 661 | );
|
|---|
| 662 | var td4=document.createElement('td');
|
|---|
| 663 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 664 | td4.appendChild(
|
|---|
| 665 | button = document.createElement('input'),
|
|---|
| 666 | button.setAttribute("type",'button'),
|
|---|
| 667 | button.setAttribute('id','btnSplit'),
|
|---|
| 668 | button.setAttribute('value','Split'),
|
|---|
| 669 | button.onclick=function(){
|
|---|
| 670 | if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 30;
|
|---|
| 671 |
|
|---|
| 672 | timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2);
|
|---|
| 673 |
|
|---|
| 674 | function pad(number, length) {
|
|---|
| 675 |
|
|---|
| 676 | var str = '' + number;
|
|---|
| 677 | while (str.length < length) {
|
|---|
| 678 | str = '0' + str;
|
|---|
| 679 | }
|
|---|
| 680 |
|
|---|
| 681 | return str;
|
|---|
| 682 |
|
|---|
| 683 | }
|
|---|
| 684 |
|
|---|
| 685 | meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 686 | }
|
|---|
| 687 | );
|
|---|
| 688 | td4.appendChild(
|
|---|
| 689 | button=document.createElement('input'),
|
|---|
| 690 | button.setAttribute('type','button'),
|
|---|
| 691 | button.setAttribute('value','Delete'),
|
|---|
| 692 | button.setAttribute('id','btnDelete'),
|
|---|
| 693 | button.onclick=function(){
|
|---|
| 694 | $('#table'+cnt).remove();
|
|---|
| 695 | cnt--;
|
|---|
| 696 | }
|
|---|
| 697 | );
|
|---|
| 698 |
|
|---|
| 699 | tr.appendChild(td3);
|
|---|
| 700 | tr.appendChild(td1);
|
|---|
| 701 | tr.appendChild(td);
|
|---|
| 702 |
|
|---|
| 703 | tr.appendChild(td2);
|
|---|
| 704 | tr.appendChild(td4);
|
|---|
| 705 | table.appendChild(tr);
|
|---|
| 706 |
|
|---|
| 707 | $(table).insertAfter($(getTableId));
|
|---|
| 708 |
|
|---|
| 709 |
|
|---|
| 710 |
|
|---|
| 711 | }
|
|---|
| 712 | function split1()
|
|---|
| 713 | {
|
|---|
| 714 |
|
|---|
| 715 | cnt++;
|
|---|
| 716 | var table = document.createElement("table");
|
|---|
| 717 | table.setAttribute('id',"table"+cnt);
|
|---|
| 718 | table.setAttribute('width','100%');
|
|---|
| 719 | var tr = document.createElement('tr');
|
|---|
| 720 | tr.setAttribute('id','');
|
|---|
| 721 | tr.setAttribute('class','');
|
|---|
| 722 |
|
|---|
| 723 | var td3=document.createElement('td');
|
|---|
| 724 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
|---|
| 725 | td3.setAttribute('class','first');
|
|---|
| 726 | td3.appendChild(
|
|---|
| 727 | input = document.createElement("input"),
|
|---|
| 728 | input.setAttribute("type","time"),
|
|---|
| 729 | input.setAttribute("id","Time"+cnt),
|
|---|
| 730 | input.setAttribute("max","24"),
|
|---|
| 731 | input.setAttribute("min","1"),
|
|---|
| 732 | input.setAttribute("required",true),
|
|---|
| 733 | input.setAttribute(meas,meas2),
|
|---|
| 734 | input.setAttribute("value",timeValue)
|
|---|
| 735 | );
|
|---|
| 736 | td3.appendChild(
|
|---|
| 737 | button=document.createElement('input'),
|
|---|
| 738 | button.setAttribute('type','button'),
|
|---|
| 739 | button.setAttribute('value','[+]'),
|
|---|
| 740 | button.setAttribute('id','btnAddTime'),
|
|---|
| 741 | button.setAttribute(meas,meas2),
|
|---|
| 742 | button.onclick=function(){
|
|---|
| 743 | if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 01;
|
|---|
| 744 |
|
|---|
| 745 | timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1];
|
|---|
| 746 |
|
|---|
| 747 | function pad(number, length) {
|
|---|
| 748 |
|
|---|
| 749 | var str = '' + number;
|
|---|
| 750 | while (str.length < length) {
|
|---|
| 751 | str = '0' + str;
|
|---|
| 752 | }
|
|---|
| 753 |
|
|---|
| 754 | return str;
|
|---|
| 755 |
|
|---|
| 756 | } meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split1(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 757 |
|
|---|
| 758 |
|
|---|
| 759 | }
|
|---|
| 760 | );
|
|---|
| 761 |
|
|---|
| 762 | var td=document.createElement('td');
|
|---|
| 763 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 764 | td.appendChild(
|
|---|
| 765 | sourcecbo= document.createElement('select'),
|
|---|
| 766 | sourcecbo.setAttribute('id','source'+cnt),
|
|---|
| 767 | <?php
|
|---|
| 768 | $source=mysql_query("SELECT*FROM source");
|
|---|
| 769 | while($rowsource=mysql_fetch_array($source))
|
|---|
| 770 | {
|
|---|
| 771 | ?>
|
|---|
| 772 | sourcecbo.appendChild(
|
|---|
| 773 | option=document.createElement('option'),
|
|---|
| 774 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 775 | option.setAttribute('selected',true),
|
|---|
| 776 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 777 |
|
|---|
| 778 | ),
|
|---|
| 779 | <?php
|
|---|
| 780 | }
|
|---|
| 781 | ?>
|
|---|
| 782 | sourcecbo.setAttribute('id','source'+cnt)
|
|---|
| 783 |
|
|---|
| 784 | );
|
|---|
| 785 | var td1=document.createElement('td');
|
|---|
| 786 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 787 |
|
|---|
| 788 | td1.appendChild(
|
|---|
| 789 | measurementcbo= document.createElement('select'),
|
|---|
| 790 | measurementcbo.setAttribute('id','measurement'+cnt),
|
|---|
| 791 | <?php
|
|---|
| 792 | $measure=mysql_query("SELECT*FROM measurement");
|
|---|
| 793 | while($rowmeasure=mysql_fetch_array($measure))
|
|---|
| 794 | {
|
|---|
| 795 | ?>
|
|---|
| 796 | measurementcbo.appendChild(
|
|---|
| 797 | option=document.createElement('option'),
|
|---|
| 798 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
|---|
| 799 | option.setAttribute('selected',true),
|
|---|
| 800 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 801 | ),
|
|---|
| 802 | <?php
|
|---|
| 803 | }
|
|---|
| 804 | ?>
|
|---|
| 805 | measurementcbo.setAttribute('id','measurement'+cnt)
|
|---|
| 806 | );
|
|---|
| 807 | td1.appendChild(
|
|---|
| 808 | button=document.createElement('input'),
|
|---|
| 809 | button.setAttribute('type','button'),
|
|---|
| 810 | button.setAttribute('value','[+]'),
|
|---|
| 811 | button.setAttribute('id','btnAddTime'),
|
|---|
| 812 | button.onclick=function(){
|
|---|
| 813 |
|
|---|
| 814 | if($('#Time'+cnt).val() != ""){ timeValue = $('#Time'+cnt).val(); meas = "hidden"; meas2 = true; getTableId = '#table'+cnt; split1(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 815 |
|
|---|
| 816 |
|
|---|
| 817 | }
|
|---|
| 818 | );
|
|---|
| 819 |
|
|---|
| 820 | var td2=document.createElement('td');
|
|---|
| 821 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 822 | td2.appendChild(
|
|---|
| 823 | input = document.createElement('input'),
|
|---|
| 824 | input.setAttribute('type','text'),
|
|---|
| 825 | input.setAttribute('id','txtData'+cnt)
|
|---|
| 826 |
|
|---|
| 827 | );
|
|---|
| 828 | var td4=document.createElement('td');
|
|---|
| 829 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 830 | td4.appendChild(
|
|---|
| 831 | button = document.createElement('input'),
|
|---|
| 832 | button.setAttribute("type",'button'),
|
|---|
| 833 | button.setAttribute('id','btnSplit'),
|
|---|
| 834 | button.setAttribute('value','Split'),
|
|---|
| 835 | button.onclick=function(){
|
|---|
| 836 | if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 30;
|
|---|
| 837 |
|
|---|
| 838 | timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2);
|
|---|
| 839 |
|
|---|
| 840 | function pad(number, length) {
|
|---|
| 841 |
|
|---|
| 842 | var str = '' + number;
|
|---|
| 843 | while (str.length < length) {
|
|---|
| 844 | str = '0' + str;
|
|---|
| 845 | }
|
|---|
| 846 |
|
|---|
| 847 | return str;
|
|---|
| 848 |
|
|---|
| 849 | }
|
|---|
| 850 |
|
|---|
| 851 | meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 852 | }
|
|---|
| 853 | );
|
|---|
| 854 | td4.appendChild(
|
|---|
| 855 | button=document.createElement('input'),
|
|---|
| 856 | button.setAttribute('type','button'),
|
|---|
| 857 | button.setAttribute('value','Delete'),
|
|---|
| 858 | button.setAttribute('id','btnDelete'),
|
|---|
| 859 | button.onclick=function(){
|
|---|
| 860 | $('#table'+cnt).remove();
|
|---|
| 861 | cnt--;
|
|---|
| 862 | });
|
|---|
| 863 |
|
|---|
| 864 | tr.appendChild(td3);
|
|---|
| 865 | tr.appendChild(td1);
|
|---|
| 866 | tr.appendChild(td);
|
|---|
| 867 |
|
|---|
| 868 | tr.appendChild(td2);
|
|---|
| 869 | tr.appendChild(td4);
|
|---|
| 870 | table.appendChild(tr);
|
|---|
| 871 |
|
|---|
| 872 | $(table).insertAfter($(getTableId));
|
|---|
| 873 | }
|
|---|
| 874 |
|
|---|
| 875 | });
|
|---|
| 876 | </script> |
|---|