| Conditions | 9 |
| Paths | 4 |
| Total Lines | 43 |
| Code Lines | 26 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 12 | public function view() |
||
| 13 | { |
||
| 14 | $sort = General::sanitize($_REQUEST['sort']); |
||
| 15 | if (empty($sort)) { |
||
| 16 | $sort = 'sortorder'; |
||
| 17 | } |
||
| 18 | $sections = SectionManager::fetch(null, 'ASC', $sort); |
||
| 19 | $options = array(); |
||
| 20 | |||
| 21 | if (is_array($sections) && !empty($sections)) { |
||
| 22 | foreach ($sections as $section) { |
||
| 23 | $section_fields = $section->fetchFields(); |
||
| 24 | |||
| 25 | if (!is_array($section_fields)) { |
||
| 26 | continue; |
||
| 27 | } |
||
| 28 | |||
| 29 | $fields = array(); |
||
| 30 | |||
| 31 | foreach ($section_fields as $f) { |
||
| 32 | if ($f->canPrePopulate()) { |
||
| 33 | $fields[] = array( |
||
| 34 | 'id' => $f->get('id'), |
||
| 35 | 'name' => $f->get('label'), |
||
| 36 | 'handle' => $f->get('element_name'), |
||
| 37 | 'type' => $f->get('type') |
||
| 38 | ); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | if (!empty($fields)) { |
||
| 43 | $options[] = array( |
||
| 44 | 'id' => $section->get('id'), |
||
| 45 | 'name' => $section->get('name'), |
||
| 46 | 'handle' => $section->get('handle'), |
||
| 47 | 'fields' => $fields |
||
| 48 | ); |
||
| 49 | } |
||
| 50 | } |
||
| 51 | } |
||
| 52 | |||
| 53 | $this->_Result['sections'] = $options; |
||
| 54 | } |
||
| 55 | } |
||
| 56 |