コード例 #1
0
 public function updateAction()
 {
     $request = $this->getRequest();
     if ($request->isPost() && $this->formUpdate->isValid($request->getParams())) {
         $table = new ValueList();
         $formValues = $this->formUpdate->getValues();
         foreach ($formValues as $key => $value) {
             if ($this->formKeyHasValue($key, $value)) {
                 //search for data sets with NULL values - e.g. old data sets before introduction of new attributes - isn't possible at the moment
                 //process possible meta data attributes
                 if (substr_compare($key, 'VALI_', 0, 4, TRUE) == 0) {
                     $keyVaLiId = substr($key, 5);
                     $data = array(ValueList::COL_NAME => $value, ValueList::COL_VALUE => $value);
                     $table->update($data, ValueList::COL_ID . '=' . intval($keyVaLiId));
                 }
             }
         }
         $this->redirectTo();
     } else {
         $this->view->formAdd = $this->formAdd;
         $this->view->formUpdate = $this->formUpdate;
         $this->render('edit');
     }
 }