public function getTermsOfService() { $termos = Configuracao::where('param', 'termos')->first(); if (Session::get('lang') == 'pt') { $termos = $termos->text_br; } else { $termos = $termos->text_en; } return View::make('paginas.termos', compact('termos')); }
public function all($id) { $sql = "SELECT * FROM `configuracao` WHERE `cliente_idcliente`= {$id};"; $vai = new MySQLDB(); $result = $vai->ExecuteQuery($sql); while ($dados = mysql_fetch_array($result)) { $cliente = new Configuracao(); $cliente->setid(array("id" => $dados["id"])); $cliente->setemail(array("email" => $dados["email"])); $cliente->setemailnews(array("emailnews" => $dados["emailnews"])); $cliente->setsmtp(array("smtp" => $dados["smtp"])); $cliente->setbdbackup(array("bdbackup" => $dados["bdbackup"])); $cliente->setfilebackup(array("filebackup" => $dados["filebackup"])); $cliente->setsmtppass(array("smtppass" => $dados["smtppass"])); $cliente->setcliente_idcliente(array("cliente_idcliente" => $dados["cliente_idcliente"])); $arr[] = $cliente; } return $arr; }
public function postIndex() { if (Input::has('cotacao_dolar') && Input::has('cotacao_euro')) { $cotacao_dolar = Configuracao::where('param', 'cotacao_dolar')->first(); $cotacao_dolar->valor = Input::get('cotacao_dolar'); $cotacao_dolar->save(); $cotacao_euro = Configuracao::where('param', 'cotacao_euro')->first(); $cotacao_euro->valor = Input::get('cotacao_euro'); $cotacao_euro->save(); $sobre = Configuracao::where('param', 'sobre')->first(); $sobre->text_br = Input::get('sobre_br'); $sobre->text_en = Input::get('sobre_en'); $sobre->save(); $termos = Configuracao::where('param', 'termos')->first(); $termos->text_br = Input::get('termos_br'); $termos->text_en = Input::get('termos_en'); $termos->save(); return Redirect::back()->with('success', array('Valores atualizados.')); } else { return Redirect::back()->with('danger', array('Nenhum valor inserido no campo.')); } }
/** * API Method inserts a new Configuracao record and render response as JSON */ public function Create() { try { $json = json_decode(RequestUtil::GetBody()); if (!$json) { throw new Exception('The request body does not contain valid JSON'); } $configuracao = new Configuracao($this->Phreezer); // TODO: any fields that should not be inserted by the user should be commented out // this is an auto-increment. uncomment if updating is allowed // $configuracao->IdConfiguracao = $this->SafeGetVal($json, 'idConfiguracao'); $configuracao->NomeInstituicao = $this->SafeGetVal($json, 'nomeInstituicao'); $configuracao->ImagemLogo = $this->SafeGetVal($json, 'imagemLogo'); $configuracao->Cnpj = $this->SafeGetVal($json, 'cnpj'); $configuracao->Telefone = $this->SafeGetVal($json, 'telefone'); $configuracao->Validate(); $errors = $configuracao->GetValidationErrors(); if (count($errors) > 0) { $this->RenderErrorJSON('Verifique erros no preenchimento do formulário', $errors); } else { $configuracao->Save(); $this->RenderJSON($configuracao, $this->JSONPCallback(), true, $this->SimpleObjectParams()); } } catch (Exception $ex) { $this->RenderExceptionJSON($ex); } }
/** * Armazena na "sessao" os dados de configuração padrao * @access public */ function setup() { global $configuracao; parent::setup(); $configuracao['padrao'] = 'Definicoes padrao para pre-preenchimento de campos'; }