-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTedds-PHP.php
3173 lines (2737 loc) · 117 KB
/
Tedds-PHP.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
ini_set('max_execution_time',300);//to pervent time error//changed to account for huge processing rates of the new files
// Function that checks whether the data are the on-screen text.
// It works in the following way:
// an array arrfailAt stores the control words for the current state of the stack, which show that
// input data are something else than plain text.
// For example, there may be a description of font or color palette etc.
function rtf_isPlainText($s) {
$arrfailAt = array("*", "fonttbl", "colortbl", "datastore", "themedata");
for ($i = 0; $i < count($arrfailAt); $i++)
if (!empty($s[$arrfailAt[$i]]))
return false;
return true;
}
function rtf2text($filename) {
//echo "<h1>" . $filename . "</h1>";
// Read the data from the input file.
$text = file_get_contents($filename);
if (!strlen($text))
return "";
return rtfStr2text($text);
}
function rtfStr2text($text) {
// Create empty stack array.
$document = "";
$stack = array();
$j = -1;
// Read the data character-by- character…
for ($i = 0, $len = strlen($text); $i < $len; $i++) {
$c = $text[$i];
// Depending on current character select the further actions.
switch ($c) {
// the most important key word backslash
case "\\":
// read next character
$nc = $text[$i + 1];
// If it is another backslash or nonbreaking space or hyphen,
// then the character is plain text and add it to the output stream.
if ($nc == '\\' && rtf_isPlainText($stack[$j]))
$document .= '\\';
elseif ($nc == '~' && rtf_isPlainText($stack[$j]))
$document .= ' ';
elseif ($nc == '_' && rtf_isPlainText($stack[$j]))
$document .= '-';
// If it is an asterisk mark, add it to the stack.
elseif ($nc == '*')
$stack[$j]["*"] = true;
// If it is a single quote, read next two characters that are the hexadecimal notation
// of a character we should add to the output stream.
elseif ($nc == "'") {
$hex = substr($text, $i + 2, 2);
if (rtf_isPlainText($stack[$j]))
$document .= html_entity_decode("&#" . hexdec($hex) . ";");
//Shift the pointer.
$i += 2;
// Since, we’ve found the alphabetic character, the next characters are control word
// and, possibly, some digit parameter.
} elseif ($nc >= 'a' && $nc <= 'z' || $nc >= 'A' && $nc <= 'Z') {
$word = "";
$param = null;
// Start reading characters after the backslash.
for ($k = $i + 1, $m = 0; $k < strlen($text); $k++, $m++) {
$nc = $text[$k];
// If the current character is a letter and there were no digits before it,
// then we’re still reading the control word. If there were digits, we should stop
// since we reach the end of the control word.
if ($nc >= 'a' && $nc <= 'z' || $nc >= 'A' && $nc <= 'Z') {
if (empty($param))
$word .= $nc;
else
break;
// If it is a digit, store the parameter.
} elseif ($nc >= '0' && $nc <= '9')
$param .= $nc;
// Since minus sign may occur only before a digit parameter, check whether
// $param is empty. Otherwise, we reach the end of the control word.
elseif ($nc == '-') {
if (empty($param))
$param .= $nc;
else
break;
}
else
break;
}
// Shift the pointer on the number of read characters.
$i += $m - 1;
// Start analyzing what we’ve read. We are interested mostly in control words.
$toText = "";
switch (strtolower($word)) {
// If the control word is "u", then its parameter is the decimal notation of the
// Unicode character that should be added to the output stream.
// We need to check whether the stack contains \ucN control word. If it does,
// we should remove the N characters from the output stream.
case "u":
$toText .= html_entity_decode("&#x" . dechex($param) . ";");
$ucDelta = @$stack[$j]["uc"];
if ($ucDelta > 0)
$i += $ucDelta;
break;
// Select line feeds, spaces and tabs.
case "par": case "page": case "column": case "line": case "lbr":
$toText .= "\n";
break;
case "emspace": case "enspace": case "qmspace":
$toText .= " ";
break;
case "tab": $toText .= "\t";
break;
// Add current date and time instead of corresponding labels.
case "chdate": $toText .= date("m.d.Y");
break;
case "chdpl": $toText .= date("l, j F Y");
break;
case "chdpa": $toText .= date("D, j M Y");
break;
case "chtime": $toText .= date("H:i:s");
break;
// Replace some reserved characters to their html analogs.
case "emdash": $toText .= html_entity_decode("—");
break;
case "endash": $toText .= html_entity_decode("–");
break;
case "bullet": $toText .= html_entity_decode("•");
break;
case "lquote": $toText .= html_entity_decode("‘");
break;
case "rquote": $toText .= html_entity_decode("’");
break;
case "ldblquote": $toText .= html_entity_decode("«");
break;
case "rdblquote": $toText .= html_entity_decode("»");
break;
// Add all other to the control words stack. If a control word
// does not include parameters, set ¶m to true.
default:
$stack[$j][strtolower($word)] = empty($param) ? true : $param;
break;
}
// Add data to the output stream if required.
$stackTest = "cf1";
if (rtf_isPlainText($stack[$j])) {
$document .= $toText;
}
}
$i++;
break;
// If we read the opening brace {, then new subgroup starts and we add
// new array stack element and write the data from previous stack element to it.
case "{":
array_push($stack, $stack[$j++]);
break;
// If we read the closing brace }, then we reach the end of subgroup and should remove
// the last stack element.
case "}":
array_pop($stack);
$j--;
break;
// Skip “trash”.
case '\0': case '\r': case '\f': case '\n': break;
// Add other data to the output stream if required.
default:
if (rtf_isPlainText($stack[$j]))
$document .= $c;
break;
}
}
// Return result.
return $document;
}
function msWord2Text($userDoc) {
$iLineTeller = 0;
$sPreviousLine = "";
$line = file_get_contents($userDoc);
$lines = explode(chr(0x0D), $line);
$outtext = "";
foreach ($lines as $thisline) {
$pos = strpos($thisline, chr(0x00));
$stringlengte = strlen($thisline);
if (($pos !== FALSE) || ($stringlengte == 0)) {
//print("$thisline\n");
} else {
//first line bug...
if ($iLineTeller == 0) {
$lastpos = strrpos($sPreviousLine, chr(0x00));
$sTekst = substr($sPreviousLine, $lastpos, strlen($sPreviousLine) - $lastpos);
$outtext .= $sTekst . "\n";
}
$outtext .= $thisline . "\n";
$iLineTeller++;
}
if ($stringlengte != 0)
$sPreviousLine = $thisline;
}
$outtext = preg_replace("/[^a-zA-Z0-9\s\,\.\-\n\r\é\è\ç\ë\à\'\:\t@\/\_\(\)]/", "", $outtext);
return $outtext;
}
function process_file_ajax($file) {
/*
* Begin set of variables to match.
*/
$structure_type = "";
$var_db_02_beam_material_type = "";
$var_db_03_beam_num_spans = 0;
$var_db_04_beam_length = 0;
$var_db_04b_beam_moment = 0;
$var_db_05_beam_reaction = 0;
$var_db_06_beam_width = 0;
$var_db_07_beam_depth = 0;
$var_db_08_beam_weigth = 0;
//beam
$var_db_03_beam_num_spans = 0;
$var_db_04_beam_length = array();;//array
$var_db_04b_beam_moment = array();
$var_db_05_beam_reaction = array();
$var_db_06_beam_width = 0;
$var_db_07_beam_depth = 0;
$var_db_08_beam_weigth = 0;
//pad
$structure_type=0;
$pad_number_of_columns=0;
$pad_allowable_bearing_pressure=0;
$pad_axial_load_permanent=array();
$pad_axial_load_varable=array();
$padLength=0;
$padWidth=0;
$padDepth=0;
$padWeight=0;
$padCod=0;
//Reatingf wall
$structure_type=0;
$retaining_wall_material_type=0;
$retaining_wall_surcharge=0;
$retaining_wall_allowable_bearing_pressure=0;
$retaining_wall_height_water=0;
$retaining_wall_height_soil=0;
$base_thickness=0;
$base_length=0;
$wall_thickness=0;
$retaining_wall_code_of_practice=0;
$var_db_09_calc_sigmav = "";
$var_db_10_calc_sigmah = "";
$var_db_11_calc_num_reactions = 0;
$var_db_12_material_name = "";
$var_db_13_mod_elasticity = 0;
$var_db_14_area = 0;
$var_db_15_volume = 0;
$var_db_16_density = 0;
$var_db_17_weight = 0;
$var_db_18_compression_strength = 0;
$var_db_19_strength_class = "";
$var_db_20_material2_name = "";
$var_db_21_area_r = 0;
$var_db_22_area_s = 0;
$var_db_23_area_sr = 0;
$var_db_24_area_material_2 = 0;
$var_db_25_volume_material_2 = 0;
$var_db_26_density_material_2 = 0;
$var_db_27_weight_material_2 = 0;
$var_db_28_yield_strength_material_2 = 0;
$var_db_29_ratio = 0;
$var06_sigmav_dead = "";
$var07_sigmav_live = "";
/*
* End set of variables to match.
*/
$plainTextDocExtra = msWord2Text($file);
$plainTextDoc = rtf2text($file);
//echo $plainTextDoc;
echo "got here";//Tedds calcualtion version not in retaining walls $plain text doc???"?
//AC1027
if (strpos($plainTextDoc, 'Tedds calculation version') !== false ||strpos($plainTextDoc, 'TEDDS calculation version') !== false||strpos($plainTextDoc, 'New Member Unique Data') !== false ||strpos($plainTextDoc, 'TEDDS calculation version') !== false ||
strpos($plainTextDoc, 'Retaining walls') !== false ) {//written differnetly for retaining wall
//echo 'Number of lines: ' . substr_count($plainTextDoc, "\n") . '<br/>';
$lines = explode("\n", $plainTextDoc);
$linesExtra = explode("\n", $plainTextDocExtra);//trying to get it working with master
echo"got here 2";
echo $lines;
//echo $linesExtra;
$linesCount = count($lines);
$linesExtraCount = count($linesExtra);
$currLineIndex = 0;
echo $linesCount;
echo $LinesExtraCount;
if ($currLineIndex < $linesCount) {
echo "got here 3";// gets here in
$tempVar02 = "";
while (($currLineIndex < $linesCount) && (strpos($lines[$currLineIndex], 'RC ') == false)) {
$currLineIndex++;
}
if ($currLineIndex < $linesCount) {
while (($currLineIndex < $linesCount) && (strpos($lines[$currLineIndex], 'TEDDS calculation version') == false)) {
if (strpos($lines[$currLineIndex], 'TEDDS calculation version') == false) {
$tempVar02 = $tempVar02 . $lines[$currLineIndex];
}
$currLineIndex++;
}
if ($currLineIndex < $linesCount) {
$var_db_01_file_type = $lines[$currLineIndex];
}
}
$tempVar02a = substr($tempVar02, strpos($tempVar02, "RC ", 0));
$structure_type = substr(substr($tempVar02a, 0, strpos($tempVar02a, "analysis", 0)), 2);
$test="DDF";
$test=$structure_type;
echo $structure_type;
$currLineIndex=0;
//choseing what code to run beam pad wall etc
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'foundation') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'foundation') == true){
echo"its working";
$decider=2;//why does it only work up here????
}
echo "this the desider <br>";
echo $decider;
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Stem type') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Stem type') == true){
echo"its working";
$decider=3;//why does it only work up here????
}
echo "this the desider <br>";
echo "this the desider <br>";
echo $decider;
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Depth of cover') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Depth of cover') == true){
echo"its working";
$decider=9;//why does it only work up here????
}
echo "this the desider <br>";
///start here 10/09/2013
//for a twoway slab
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Outer sagging steel') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Outer sagging steel') == true){
echo"its working";
$decider=4;//why does it only work up here????//for the one way slab
}
//one way slab
echo "as";
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Span of slab in x') == false)&&($currLineIndex < $linesCount)) {//come back to this need to get differance between one way and two way
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Span of slab in x') == true){
echo"its working";
$decider=6;//why does it only work up here????
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Column width') == false)&&($currLineIndex < $linesCount)) {//come back to this need to get differance between one way and two way
$currLineIndex++;//do this tomoro for a mason column ec 01/10/2013
}
echo $currLineIndex;
echo $linesCount;
if(strpos($lines[$currLineIndex], 'Column width') == true){//might not w
echo"Mason column bc";//need o change this for the other columns
$decider=7;//why does it only work up here????
echo "inside";
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Width of column') == false)&&($currLineIndex < $linesCount)) {//come back to this need to get differance between one way and two way
$currLineIndex++;//for ec
}
echo $currLineIndex;
echo $linesCount;//start here tomoro
if(strpos($lines[$currLineIndex], 'Width of column') == true){//might not w
echo"Mason column ec";//need o change this for the other columns
$decider=10;//why does it only work up here????
echo "inside";
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Column section') == false)&&($currLineIndex < $linesCount)) {//come back to this need to get differance between one way and two way
$currLineIndex++;
}
echo $currLineIndex;
echo $linesCount;
if(strpos($lines[$currLineIndex], 'Column section') == true){//might not w
echo"steel column";//need o change this for the other columns
$decider=8;//why does it only work up here????
echo "inside";
}
$currLineIndex=0;//delect one at top later
while((strpos($lines[$currLineIndex], 'foundation') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'foundation') == true){
echo"its working";
$decider=2;//why does it only work up here????
}
$currLineIndex=0;//delect one at top later
while((strpos($lines[$currLineIndex], 'Length of pad') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Length of pad') == true){
echo"Pad foundation bs";
$decider=11;//why does it only work up here????
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Section type') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Section type') == true){
echo "hanged";
$decider=12;
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Design moment') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Design moment') == true){
echo "its in here";
$decider=13;
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Number of piles') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Number of piles') == true){
echo "its in here";
$decider=14;
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Joist breadth') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Joist breadth') == true){
echo "its in here";
$decider=15;
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Depth to tension steel') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Depth to tension steel') == true){//Might need to change this//wont scan brakets??
echo "its in here";
$decider=16;
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Number of piles') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Number of piles') == true){
echo "its in here";
$decider=14;
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Length of shorter side of slab') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Length of shorter side of slab') == true){//Might need to change this//wont scan brakets??
echo "its in here";
$decider=17;
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Category of manufacturing ') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Category of manufacturing ') == true){//Might need to change this//wont scan brakets??
echo "Category of manufacturing ";
$decider=18;
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Stud breadth') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Stud breadth') == true){//Might need to change this//wont scan brakets??
echo "Stud design timber ";
$decider=19;
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Panel height') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Panel height') == true){//need to edit this
echo"its working";
$decider=20;//why does it only work up here????//for the one way slab
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'E factor') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'E factor') == true){//may have to change
echo"its working";
$decider=20;//why does it only work up here????//for the one way slab
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'cover to top') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex],'cover to top') == true){// IF BECOMES PROBLEM MAKE ONE FOR BEAM THEN MAKE SUB SEARHERS FOR MATERIAL MAYBE?
echo "its in here";
$decider=1;
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Stem type') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}
if(strpos($lines[$currLineIndex], 'Stem type') == true){
echo"its working";
$decider=3;//why does it only work up here????
}//NB change tomoro make sure it reads into this one for ec retaing wall and bs for the other one
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'First support') == false)&&($currLineIndex < $linesCount)) {//come back to this need to get differance between one way and two way
$currLineIndex++;
}//this is for one way
if(strpos($lines[$currLineIndex], 'First support') == true){
echo"its working";
$decider=5;//why does it only work up here????
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Outer sagging steel') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}//for two way spanni
if(strpos($lines[$currLineIndex], 'Outer sagging steel') == true){
echo"its working";//for the two
$decider=4;//why does it only work up here????//for the one way slab
}
$currLineIndex=0;
while((strpos($lines[$currLineIndex], 'Type of slab') == false)&&($currLineIndex < $linesCount)) {
$currLineIndex++;
}//for two way spanni
if(strpos($lines[$currLineIndex], 'Type of slab') == true){
echo"its working";//for the two
$decider=25;//why does it only work up here????//for the one way slab//ec version
}
echo "this the desider <br>";
echo $decider;
// echo "here we are";
if($decider=="1"){
echo "Material type=Concrete <br>
Structural type= beam<br>";
$var_db_01_structure_type = "Beam";
$var_db_02_beam_material_type = "Concrete";
while (($currLineIndex < $linesCount) && (strpos($lines[$currLineIndex], 'Support conditions') == false)) {
$currLineIndex++;
}
//this is a comment
if ($currLineIndex < $linesCount) {
while (($currLineIndex < $linesCount) && (strpos($lines[$currLineIndex], 'Maximum') == false)) {
$currLineIndex++;
if ((strpos($lines[$currLineIndex], 'Support A') == true) ||
(strpos($lines[$currLineIndex], 'Support B') == true) ||
(strpos($lines[$currLineIndex], 'Support C') == true) ||
(strpos($lines[$currLineIndex], 'Support D') == true) ||
(strpos($lines[$currLineIndex], 'Support E') == true) ||
(strpos($lines[$currLineIndex], 'Support F') == true)) {
$var_db_11_calc_num_reactions++;
}
}
}
//beam
$var_db_03_beam_num_spans = 0;
$var_db_04_beam_length = array();;//array
$var_db_04b_beam_moment = array();
$var_db_05_beam_reaction = array();
$var_db_06_beam_width = 0;
$var_db_07_beam_depth = 0;
$var_db_08_beam_weigth = 0;
$structure_type=0;
//pad
$pad_number_of_columns=0;
$pad_allowable_bearing_pressure=0;
$pad_axial_load_permanent=array();
$pad_axial_load_varable=array();
$padLength=0;
$padWidth=0;
$padDepth=0;
$padWeight=0;
$padCod=0;
//column
$columnMaterialType=0;
$columnLength=0;
$column_axial_load_permanant=0;
$column_axial_load_varable=0;
$columnWidth=0;
$columnDepth=0;
$columnWeight=0;
$column_cod=0;
//retaining wall
$retaining_wall_material_type=0;
$retaining_wall_surcharge=0;
$retaining_wall_allowable_bearing_pressure=0;
$retaining_wall_height_water=0;
$retaining_wall_height_soil=0;
$base_thickness=0;
$base_length=0;
$wall_thickness=0;
$retaining_wall_code_of_practice=0;
// echo "This the correct number of spans<br>";
// echo "noOfSpans";
// $noOfSpans=$var_db_11_calc_num_reactions-1;
// echo $noOfSpans;
// $counter=($var_db_11_calc_num_reactions*2)-1;
//wont work for an over hang willl give 11 for b and a anyway
$currLineIndex = 0;
$tempWidth = "";
while (($currLineIndex < $linesExtraCount) && (strpos($linesExtra[$currLineIndex], 'Maximum moment ') == false)) {//try 3 equals
$currLineIndex++;
}
// echo"tester <br>";
//echo $currLineIndex;
//echo "<br> be here";
// echo $linesExtraCount;
// echo "<br>";
if ($currLineIndex < $linesExtraCount) {
while (($currLineIndex < $linesExtraCount) && (strpos($linesExtra[$currLineIndex], 'k') == false)) {
$tempWidth = $tempWidth . $linesExtra[$currLineIndex];
$currLineIndex++;
echo "2";
}
$tempWidth = $tempWidth . $linesExtra[$currLineIndex];
if (strpos( $tempWidth, 'Support Asectd') == true) //had to write them like this
{
$var_db_11_calc_num_reactions++;
//echo "get in there a";
}
if(strpos( $tempWidth, 'Support Bsectd') == true){
$var_db_11_calc_num_reactions++;
// echo "get in there b";
}
if(strpos( $tempWidth, 'Support Csectd') == true){
$var_db_11_calc_num_reactions++;
// echo "get in there c";
}
if(strpos( $tempWidth, 'Support Dsectd') == true){
$var_db_11_calc_num_reactions++;
// echo "get in there d";
}
if(strpos( $tempWidth, 'Support Esectd') == true){
$var_db_11_calc_num_reactions++;
// echo "get in there e";
}
if(strpos( $tempWidth, 'Support Fsectd') == true){
$var_db_11_calc_num_reactions++;
// echo "get in there f";
}
}
echo "<br>No of Reactions =";
echo $var_db_11_calc_num_reactions;
echo "<br>noOfSpans =";
$noOfSpans=$var_db_11_calc_num_reactions-1;
echo $noOfSpans;
$var_db_03_beam_num_spans = $noOfSpans;
$counter=($var_db_11_calc_num_reactions*2)-1;
//FOR THE MOMENTS MAX
echo"tester <br>";
echo "<br>";
echo "<br>";
$pos1=strpos($tempWidth, "Maximum moment", 0);
$tempWidth = substr($tempWidth, $pos1);
$i=1;
for($x=0;$x<$counter;$x++){
$pos2=strpos($tempWidth, "Maximum moment",$pos1+strlen("Maximum moment"));
$tempWidth2 = substr($tempWidth, $pos2);
$pos1=$pos2;
echo "<br>";
//echo $pos2;
echo"Moments $i=";
$var_db_03_width1 = intval(strrchr(substr($tempWidth2, 0, strpos($tempWidth2, " k", 0)), ' '));
echo $var_db_03_width1;
//add to array for beam array_unshift($a,"blue");
// $var_db_04b_beam_moment;
// array_unshift( $var_db_04b_beam_moment,$var_db_03_width1);
array_push($var_db_04b_beam_moment, $var_db_03_width1);
$i=$i+1;
}
echo "<br> This is the arrayBeam<br>";
// implode ( ‘,’, array_values($var_db_04b_beam_moment));
print_r($var_db_04b_beam_moment);
// echo $var_db_04b_beam_moment;
//works
//$pos2=strpos($tempWidth, "Maximum moment",$pos1+strlen("Maximum moment"));
// $pos3=strpos($tempWidth, "Maximum moment",$pos2+strlen("Maximum moment"));
// $tempWidth2 = substr($tempWidth, $pos1);
// $var_db_03_width1 = intval(strrchr(substr($tempWidth2, 0, strpos($tempWidth2, " k", 0)), ' '));
echo "<br>";
echo"stop";
$currLineIndex = 0;//here
$tempWidth = "hello";
while (($currLineIndex < $linesExtraCount) && (stristr($linesExtra[$currLineIndex], 'reaction at support a') === false)) {//Wont work with a???
$currLineIndex++;
}
// echo $currLineIndex;
// echo $linesExtraCount;
if ($currLineIndex < $linesExtraCount) {
while (($currLineIndex < $linesExtraCount) && (strpos($linesExtra[$currLineIndex], " k") == false)) {
$tempWidth = $tempWidth . $linesExtra[$currLineIndex];
$currLineIndex++;
}
echo "Space";
$tempWidth = $tempWidth . $linesExtra[$currLineIndex];
}
$pos1=strpos($tempWidth, "Maximum reaction at support ", 0);
$tempWidth = substr($tempWidth, $pos1);
$var_db_03_width1 = intval(strrchr(substr($tempWidth, 0, strpos($tempWidth2, " k", 0)), ' '));
echo $var_db_03_width1;
// array_push($var_db_05_beam_reaction, $var_db_03_width1);
// $var_db_05_beam_reaction
$i=1;
for($x=0;$x<$var_db_11_calc_num_reactions;$x++){
$pos2=strpos($tempWidth, "Maximum reaction at support ",$pos1+strlen("Maximum reaction at support "));
$tempWidth2 = substr($tempWidth, $pos2);
$pos1=$pos2;
echo "<br>";
// echo"flkhggfdf";
// echo $pos2;
echo"Reaction $i=";
$var_db_03_width1 = intval(strrchr(substr($tempWidth2, 0, strpos($tempWidth2, " k", 0)), ' '));
echo $var_db_03_width1;
array_push($var_db_05_beam_reaction, $var_db_03_width1);
$i=$i+1;
echo "<br>";
}
print_r($var_db_05_beam_reaction);
// echo $var06_sigmav_dead;
$currLineIndex = 0;
while ($currLineIndex < $linesCount) {
while (($currLineIndex < $linesCount) && (strpos($lines[$currLineIndex], 'Unfactored live load reaction at support') == false)) {
$currLineIndex++;
}
if ($currLineIndex < $linesCount) {
$currLineIndex++;
while (($currLineIndex < $linesCount) && (strpos($lines[$currLineIndex], 'Unfactored live load reaction at support') == false) && (strpos($lines[$currLineIndex], 'Rectangular section details') == false)) {
if ((strpos($lines[$currLineIndex], 'Unfactored live load reaction at support') == false) && (strpos($lines[$currLineIndex], 'Rectangular section details') == false)) {
$var07_sigmav_live = $var07_sigmav_live . $lines[$currLineIndex];
}
$currLineIndex++;
}
}
}
//in here
//between here
$currLineIndex = 0;
$tempWidth = "";
while (($currLineIndex < $linesExtraCount) && (strpos($linesExtra[$currLineIndex], 'ection width') == false)) {
$currLineIndex++;
}
if ($currLineIndex < $linesExtraCount) {
// echo "1";
while (($currLineIndex < $linesExtraCount) && (strpos($linesExtra[$currLineIndex], 'mm') == false)) {
$tempWidth = $tempWidth . $linesExtra[$currLineIndex];
$currLineIndex++;
// echo "2";
}
// echo $currLineIndex;
$tempWidth = $tempWidth . $linesExtra[$currLineIndex];
}
$tempWidth2 = substr($tempWidth, strpos($tempWidth, "ection width", 0));
$var_db_03_width = intval(strrchr(substr($tempWidth2, 0, strpos($tempWidth2, " mm", 0)), ' '));
Echo "Width is = ";
echo $var_db_03_width;
//echo"stop";
$currLineIndex = 0;
$tempDepth = "";
while (($currLineIndex < $linesExtraCount) && (strpos($linesExtra[$currLineIndex], 'ection depth') == false)) {
$currLineIndex++;
}
if ($currLineIndex < $linesExtraCount) {
while (($currLineIndex < $linesExtraCount) && (strpos($linesExtra[$currLineIndex], 'mm') == false)) {
$tempDepth = $tempDepth . $linesExtra[$currLineIndex];
$currLineIndex++;
}
$tempDepth = $tempDepth . $linesExtra[$currLineIndex];
}
$tempDepth2 = substr($tempDepth, strpos($tempDepth, "ection depth", 0));
$var_db_04_depth = intval(strrchr(substr($tempDepth2, 0, strpos($tempDepth2, " mm", 0)), ' '));
echo "Depth is equal to = ";
echo $var_db_04_depth;
$var_db_07_beam_depth= $var_db_04_depth;
// here for d start here on monday
$currLineIndex = 0;
$tempDepth = "";
while (($currLineIndex < $linesExtraCount) && (strpos($linesExtra[$currLineIndex], 'midspan moment') == false)) {
$currLineIndex++;
}
if ($currLineIndex < $linesExtraCount) {
while (($currLineIndex < $linesExtraCount) && (strpos($linesExtra[$currLineIndex], 'mm') == false)) {
$tempDepth = $tempDepth . $linesExtra[$currLineIndex];
$currLineIndex++;
}
$tempDepth = $tempDepth . $linesExtra[$currLineIndex];
}
$pos1=strpos($tempDepth, "midspan moment",0);
$pos2 =strpos($tempDepth, " h - csub",0);
$pos3=strpos($tempDepth, "Lsub s1",0);
$tempDepth2 = substr($tempDepth, $pos1);//gets
$tempDepth3 = substr($tempDepth, $pos2);//gets depth 1
$tempDepth4=substr($tempDepth, $pos3);//wont read tempdepth 3!!!!
// echo $currLineIndex;
// echo $linesExtraCount;
// echo"Starts here";
// echo "here we are <br>";
$var_db_04_depth123 = intval(strrchr(substr($tempDepth2, 0, strpos($tempDepth2, " mm", 0)), ' '));
echo "<br>This is the depth to tension reinforcement <br>";
echo $var_db_04_depth123;//got it///d1
//below works!
// echo $tempDepth3;
//echo $tempDepth4;
$var_db_04_depth = floatval(strrchr(substr($tempDepth4, 0, strpos($tempDepth4, "par pardplain ltrpars62qr li357ri0sl319slmult1", 0)), ' '));
echo "<br>This is the allowable span/depth<br>";
echo $var_db_04_depth;//go
$Lenghtone=$var_db_04_depth*$var_db_04_depth123*.001;//round to 3 decimal places its off by .3 of a mm
echo "<br> Length 1 = ";
echo $Lenghtone;
array_push($var_db_04_beam_length, $Lenghtone);
//$var_db_04_beam_length;
$noOfSpans;//start here do loop??
//getting d2 for the second length//01/09/2013//199
$i=2;
echo "<br>";
echo $currLineIndex;
for($x=0;$x<$noOfSpans-1;$x++)
{
$tempDepth="";
$currLineIndex=$currLineIndex+4;//search thing is really buggy
//echo $currLineIndex;
// echo $linesExtraCount;
$tempDepth = $tempDepth . $linesExtra[$currLineIndex];
$pos1=strpos($tempDepth, "midspan moment",0);
$pos2 =strpos($tempDepth, " h - csub",0);
$pos3=strpos($tempDepth, "Lsub s",0);
$tempDepth2 = substr($tempDepth, $pos1);//gets
$tempDepth3 = substr($tempDepth, $pos2);//gets depth 1
$tempDepth4=substr($tempDepth, $pos3);
//echo $tempDepth4;
// echo "<br> Check 2 <br>";
//echo $tempDepth;
$var_db_04_depth123 = intval(strrchr(substr($tempDepth, 0, strpos($tempDepth, " mm", 0)), ' '));
echo " This is the depth to reinforcement<br>";
echo $var_db_04_depth123;
echo "<br>";
$var_db_04_depth12 = floatval(strrchr(substr($tempDepth4, 0, strpos($tempDepth4, "par pardplain ltrpars62qr li357ri0sl319slmult1", 0)), ' '));//that space makes it work
echo "<br>This allowable span/depth<br>";
echo $var_db_04_depth12;
$Lenght2=$var_db_04_depth12*$var_db_04_depth123*.001;
echo"<br>Length $i =";
echo $Lenght2;
array_push($var_db_04_beam_length, $Lenght2);
echo "<br>";
$i=$i+1;
}
// over here
print_r($var_db_04_beam_length);
$currLineIndex = 0;
$tempFlangeWidth = "";
while (($currLineIndex < $linesExtraCount) && (strpos($linesExtra[$currLineIndex], 'ection depth') == false)) {
$currLineIndex++;
}
if ($currLineIndex < $linesExtraCount) {
while (($currLineIndex < $linesExtraCount) && (strpos($linesExtra[$currLineIndex], 'mm') == false)) {
$tempDepth = $tempDepth . $linesExtra[$currLineIndex];
$currLineIndex++;
}
$tempDepth = $tempDepth . $linesExtra[$currLineIndex];
}
$pos1=strpos($tempDepth, "ection depth",0);
$pos2 =strpos($tempDepth, "ection width",0);
$tempDepth2 = substr($tempDepth, $pos1);//gets
$tempDepth3 = substr($tempDepth, $pos2);//gets depth 1
$var_db_04_depth1234 = intval(strrchr(substr($tempDepth2, 0, strpos($tempDepth2, " mm", 0)), ' '));
echo "This is the depth <br>";
echo $var_db_04_depth1234;
echo "<br>";
$var_db_04_depth123 = intval(strrchr(substr($tempDepth3, 0, strpos($tempDepth3, " mm", 0)), ' '));
echo "This is the Width <br>";
echo $var_db_04_depth123;
echo "<br>";
$var_db_06_beam_width=$var_db_04_depth123;
echo "this is the weight in Kn/m";
$weight=(($var_db_04_depth1234*$var_db_04_depth123)/1000)*24;
echo $weight;
$var_beam_weight=$weight;
echo "<br>";
//this is the one
}
///Big break end of concrete beam
if($decider=="12"){
//why isnt it reading it???//why do I need it up here??
// echo "got here";
echo "Material= Steel<br>Sturtural Type=Beam<br>";
echo "<br>";
$var_db_02_beam_material_type="Steel";
$var_db_03_beam_num_spans = 0;
//$var_db_04_beam_length = array();;//array
$MaxMoments=array();
// $var_db_04b_beam_moment = array();
// $var_db_05_beam_reaction = array();
$MinMoments=array(); //start here tomoro03/02/2014
$var_db_06_beam_width = 0;
$var_db_07_beam_depth = 0;