/** * Add all fields to a slot. The Fields contain also LEFT and RIGHT to set them to the right column * in the overview * * @param int $slot_id, id of the slot * @return array $result, Slotdata */ public function buildFields($slot_id) { $fields = DocumenttemplateFieldTable::instance()->getAllFieldsBySlotId($slot_id); $result = array(); $a = 0; $assign = 'LEFT'; $colCounter = 1; foreach($fields as $field) { $fieldItem = $field->getField()->toArray(); $result[$a]['id'] = $field->getId(); $result[$a]['field_name'] = $fieldItem[0]['title']; $result[$a]['type'] = $fieldItem[0]['type']; $result[$a]['writeprotected'] = $fieldItem[0]['writeprotected']; $result[$a]['color'] = $fieldItem[0]['color']; $result[$a]['field_id'] = $fieldItem[0]['id']; $result[$a]['assign'] = $assign; $result[$a++]['items'] = $this->buildItems($fieldItem[0]['id'], $fieldItem[0]['type']); if($colCounter == 0) { $colCounter = 1; $assign = 'LEFT'; } else { $colCounter = 0; $assign = 'RIGHT'; } } return $result; }
/** * Load all fields for a slot * @param int $slot_id, slot id * @return array $result */ public function buildFields($slot_id) { $result = array(); $a = 0; $fields = DocumenttemplateFieldTable::instance()->getAllFieldsBySlotId($slot_id); foreach($fields as $item) { $fieldname = $item->getField(); $result[$a]['id'] = $item->getId(); $result[$a]['title'] = $fieldname[0]->getTitle(); $result[$a]['slot_id'] = $item->getDocumenttemplateslotId(); $result[$a++]['field_id'] = $item->getFieldId(); } return $result; }