protected function saveAccount() { $this->mTemplate->sSectionTitle = $this->getLang('section_title_settings_saving'); $sName = $this->post('name'); $sTime = $this->post('day_end'); $fMaxPrice = $this->post('max_price'); $iEmployeePercent = $this->post('employee_percent'); $sCss = $this->post('css'); $oValidator = new Module_Validator(); $oValidator->field('company_name', $sName)->rules('required|hsc'); $oValidator->field('order_end_time', $sTime)->rules('required'); $oValidator->field('max_price_of_meal', $fMaxPrice)->rules('required|tofloat'); $oValidator->field('employee_cost', $iEmployeePercent)->rules('required|toint'); if ($oValidator->validate()) { // zapisujemy ustawienia $oAccaount = new Model_Account($this->oCurrentUser->account_id); $oAccaount->getRow(); $oAccaount->name = $sName; $oAccaount->day_end = $sTime; $oAccaount->max_price = $fMaxPrice; $oAccaount->employee_percent = $iEmployeePercent; $oAccaount->css = $sCss; if ($oAccaount->save()) { $aMeta = $this->mTemplate->aMeta; $aMeta[] = '<meta http-equiv="refresh" content="1;url=' . $this->mTemplate->anchor() . '" />'; $this->mTemplate->aMeta = $aMeta; $this->mTemplate->content = $this->getLang('save_settings_successfull'); return true; } else { return $this->getLang('save_settings_failed'); } } else { $aErrors = $oValidator->getError(); foreach ($aErrors as $sField => $aError) { $sMsg .= '<br />' . $this->getLang($aError['msg'], $this->getLang($sField)); } return $sMsg; } }