protected function fillObject($data) { $object = parent::fillObject($data); $model = new processedmealoptionsetModel(); $optionset = $model->getfromId($object->getOptionsetid()); if (count($optionset) == 1) { $optionset = $optionset[0]; $object->setOptionset($optionset->getName()); $object->setOptionsettype($optionset->getOptionsettypeid()); } return $object; }
public function addoptionoptionsetlink($parameters) { if (isset($parameters['id'])) { $model = new mealoptionoptionsetModel(); $link = new mealoptionoptionsetObject(); $link->setOptionsetid($parameters['id']); $link->setOptionid($parameters['optionid']); $model->save($link); $gridcontroller = new mygridController(); $gridcontroller->reloadgrid('optionoptionset'); } else { $view = new ui($this); $grid = new mygrid('addoptionsets'); $grid->setModel(new processedmealoptionsetModel()); $grid->setDefaultorder(array('fields' => array('name'), 'type' => 'ASC')); $grid->setDefaultpagesize(10); $grid->setDefaultconditions(''); //$grid->registerAddrequest('mycafetaria', 'editoptionset',array('title' => 'Optiegroup toevoegen')); $grid->registerEditrequest('mycafetaria', 'editoptionset', array('id' => '{id}', 'title' => 'Optiegroup aanpassen')); //$grid->registerDeleterequest('mycafetaria', 'deleteoptionset',array('id' => '{id}','title' => 'Optiegroup verwijderen')); $grid->registerRequest('name', 'mycafetaria', 'addoptionoptionsetlink', array_merge(array('id' => '{id}'), $parameters)); $view->assign('optionsets', $grid); return $view->fetch($parameters['viewprefix'] . 'mycafetaria_addoptionoptionsetlink.tpl'); } }