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