1: <?php
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: class SequenceView extends AlphaView {
49: 50: 51: 52: 53: 54:
55: private static $logger = null;
56:
57: 58: 59: 60: 61: 62: 63:
64: protected function __construct($BO) {
65: self::$logger = new Logger('SequenceView');
66: self::$logger->debug('>>__construct(BO=['.var_export($BO, true).'])');
67:
68: parent::__construct($BO);
69:
70: self::$logger->debug('<<__construct');
71: }
72:
73: 74: 75: 76: 77: 78:
79: public function listView($fields=array()) {
80: self::$logger->debug('>>listView(fields=['.var_export($fields, true).'])');
81:
82: if(method_exists($this, 'before_listView_callback'))
83: $this->before_listView_callback();
84:
85: global $config;
86:
87:
88: $fields['formAction'] = $_SERVER['REQUEST_URI'];
89:
90:
91: $reflection = new ReflectionClass(get_class($this->BO));
92: $properties = array_keys($reflection->getDefaultProperties());
93: $fields['colCount'] = 1+count(array_diff($properties, $this->BO->getDefaultAttributes(), $this->BO->getTransientAttributes()));
94:
95:
96: $properties = $reflection->getProperties();
97:
98: $html = '';
99:
100: $html .= '<tr>';
101: foreach($properties as $propObj) {
102: $propName = $propObj->name;
103:
104:
105: $property = $this->BO->getPropObject($propName);
106: if(!($property instanceof String && $property->checkIsPassword())) {
107: if (!in_array($propName, $this->BO->getDefaultAttributes()) && !in_array($propName, $this->BO->getTransientAttributes())) {
108: $html .= ' <th>'.$this->BO->getDataLabel($propName).'</th>';
109: }
110: if ($propName == 'OID')
111: $html .= ' <th>'.$this->BO->getDataLabel($propName).'</th>';
112: }else{
113: $fields['colCount'] = $fields['colCount']-1;
114: }
115: }
116: $html .= '</tr><tr>';
117:
118: $fields['formHeadings'] = $html;
119:
120: $html = '';
121:
122:
123: foreach($properties as $propObj) {
124: $propName = $propObj->name;
125:
126: $property = $this->BO->getPropObject($propName);
127: if(!($property instanceof String && $property->checkIsPassword())) {
128: if (!in_array($propName, $this->BO->getDefaultAttributes()) && !in_array($propName, $this->BO->getTransientAttributes())) {
129: $propClass = get_class($this->BO->getPropObject($propName));
130:
131: if ($propClass == 'Text') {
132: $text = htmlentities($this->BO->get($propName));
133: if(strlen($text) > 70)
134: $html .= ' <td> '.substr($text, 0, 70).'...</td>';
135: else
136: $html .= ' <td> '.$text.'</td>';
137: }elseif($propClass == 'DEnum') {
138: $html .= ' <td> '.$this->BO->getPropObject($propName)->getDisplayValue().'</td>';
139: }else{
140: $html .= ' <td> '.$this->BO->get($propName).'</td>';
141: }
142: }
143: if ($propName == 'OID')
144: $html .= ' <td> '.$this->BO->getOID().'</td>';
145: }
146: }
147: $html .= '</tr>';
148:
149: $fields['formFields'] = $html;
150:
151:
152: if(strpos($_SERVER['REQUEST_URI'], '/tk/') !== false) {
153: $button = new Button("document.location = '".FrontController::generateSecureURL('act=Detail&bo='.get_class($this->BO).'&oid='.$this->BO->getOID())."';", 'View', 'viewBut');
154: $fields['viewButton'] = $button->render();
155: }else{
156: $button = new Button("document.location = '".$this->BO->get('URL')."';", 'View', 'viewBut');
157: $fields['viewButton'] = $button->render();
158: }
159:
160:
161: $fields['adminButtons'] = '';
162:
163:
164: $fields['formSecurityFields'] = $this->renderSecurityFields();
165:
166: $this->loadTemplate($this->BO, 'list', $fields);
167:
168: if(method_exists($this, 'after_listView_callback'))
169: $this->after_listView_callback();
170:
171: self::$logger->debug('<<listView');
172: }
173:
174: 175: 176: 177: 178: 179:
180: public function detailedView($fields=array()) {
181: self::$logger->debug('>>detailedView(fields=['.var_export($fields, true).'])');
182:
183: if(method_exists($this, 'before_detailedView_callback'))
184: $this->before_detailedView_callback();
185:
186: global $config;
187:
188:
189: $fields['OIDLabel'] = $this->BO->getDataLabel('OID');
190: $fields['OID'] = $this->BO->getOID();
191:
192:
193: $fields['formFields'] = $this->renderAllFields('view');
194:
195:
196: $button = new Button('history.back()', 'Back', 'backBut');
197: $fields['backButton'] = $button->render();
198:
199: $fields['adminButtons'] = '';
200:
201: $this->loadTemplate($this->BO, 'detail', $fields);
202:
203: if(method_exists($this, 'after_detailedView_callback'))
204: $this->after_detailedView_callback();
205:
206: self::$logger->debug('<<detailedView');
207: }
208: }
209:
210: ?>