public function before() { parent::before(); // Load list of aircraft here $this->aircraft_models = Model_Aircraft::find('all'); $this->aircraft_options = ['_new' => 'Create new aircraft']; foreach ($this->aircraft_models as $aircraft_model) { $this->aircraft_options[$aircraft_model->id] = $aircraft_model->name; } }
public function before() { parent::before(); $this->requested_aircraft = Model_Aircraft::find($this->id, ['related' => ['aircraft_arms']]); $this->requested_aircraft === null ? $this->requested_aircraft = Model_Aircraft::forge() : null; // Pull out cg limits foreach ($this->requested_aircraft->aircraft_arms as $aircraft_arm) { if ($aircraft_arm->type === 'maxweight') { $cells = [View::forge('widgets/tablewithactions/row/cell', ['cell_content' => Form::input('_position', $aircraft_arm->position, ['class' => 'form-control', 'disabled'])], false), View::forge('widgets/tablewithactions/row/cell', ['cell_content' => Form::input('_value', $aircraft_arm->value, ['class' => 'form-control', 'disabled']) . Form::hidden('_type', 'maxweight') . Form::hidden('_name', 'limit')], false)]; $this->cglimits_table_rows[] = View::forge('widgets/tablewithactions/row', ['cells' => $cells, 'id' => $aircraft_arm->id, 'duplicate_action' => false]); } else { if ($aircraft_arm->type === 'arm') { $cells = [View::forge('widgets/tablewithactions/row/cell', ['cell_content' => Form::input('_name', $aircraft_arm->name, ['class' => 'form-control', 'disabled'])], false), View::forge('widgets/tablewithactions/row/cell', ['cell_content' => Form::input('_position', $aircraft_arm->position, ['class' => 'form-control', 'disabled'])], false), View::forge('widgets/tablewithactions/row/cell', ['cell_content' => Form::input('_value', $aircraft_arm->value, ['class' => 'form-control', 'disabled']) . Form::hidden('_type', 'arm')], false)]; $this->arms_table_rows[] = View::forge('widgets/tablewithactions/row', ['cells' => $cells, 'id' => $aircraft_arm->id, 'duplicate_action' => false]); } } } }