MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mareacontainer.class
Ir para a documentação deste ficheiro.
1<?php
3{
4 var $top = array();
5 var $left = array();
6 var $center = array();
7 var $right = array();
8 var $bottom = array();
9
10 function __construct($name = null)
11 {
12 parent::__construct($name);
13 }
14
15 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
16 # Adds an element at the specified position
17 #---------------------------------------------------------------------
18 function AddElement($element, $where = 'center')
19 {
20 global $MIOLO;
21
22 if ($where == 'top')
23 {
24 $this->top[] = $element;
25 }
26 else if ($where == 'left')
27 {
28 $this->left[] = $element;
29 }
30 else if ($where == 'center')
31 {
32 $this->center[] = $element;
33 }
34 else if ($where == 'right')
35 {
36 $this->right[] = $element;
37 }
38 else if ($where == 'bottom')
39 {
40 $this->bottom[] = $element;
41 }
42 else
43 {
44 $MIOLO->Error("Container: Illegal positioning '$where' parameter!");
45 }
46 }
47
48 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
49 # Obtains the number of table rows
50 #---------------------------------------------------------------------
51 function GetRowCount()
52 {
53 $num_rows = 0;
54
55 if ($this->top)
56 {
57 $num_rows++;
58 }
59
60 if ($this->left || $this->center || $this->right)
61 {
62 $num_rows++;
63 }
64
65 if ($this->bottom)
66 {
67 $num_rows++;
68 }
69
70 return $num_rows;
71 }
72
73 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
74 # Obtains the number of table columns
75 #---------------------------------------------------------------------
76 function GetColumnCount()
77 {
78 $num_cols = 0;
79
80 if ($this->left)
81 {
82 $num_cols++;
83 }
84
85 if ($this->center)
86 {
87 $num_cols++;
88 }
89
90 if ($this->right)
91 {
92 $num_cols++;
93 }
94
95 if (!$num_cols)
96 {
97 if ($this->top)
98 {
99 $num_cols++;
100 }
101 else if ($this->bottom)
102 {
103 $num_cols++;
104 }
105 }
106
107 return $num_cols;
108 }
109
110 #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
111 # Generate HTML
112 #----------------------------------------------------------------------
113 function GenerateInner()
114 {
115 $num_rows = $this->GetRowCount();
116 $num_cols = $this->GetColumnCount();
117
118 if ($num_rows && $num_cols)
119 {
120 $table = new MSimpleTable($obj->name);
121 $table->SetAttribute('width', '100%');
122 $table->SetCell(0, 0, $this->top, "align=\"center\" colspan=$num_rows");
123 $table->SetCell(1, 0, $this->left, "align=\"center\" valign=\"top\"");
124 $table->SetCell(1, 1, $this->center, "align=\"center\" valign=\"top\" width=\"100%\"");
125 $table->SetCell(1, 2, $this->right, "align=\"center\" valign=\"top\"");
126 $table->SetCell(2, 0, $this->bottom, "align=\"center\" colspan=$num_rows");
127 $this->inner = $table;
128 }
129 }
130}
131?>
AddElement($element, $where='center')
__construct($name=null)