public function isIbanUnique($attribute) { $sql = "SELECT * FROM clienti WHERE iban=:param"; $param = array(":param" => $this->{$attribute}); $iban_searched = Clienti::model()->findBySql($sql, $param); //CVarDumper::dump($a,2,true);die(); if ($iban_searched['iban'] === $this->{$attribute}) { $this->addError($attribute, 'Iban esistente!'); return false; } else { return true; } }
public function actionClientiEFornitori($c, $f) { $criteria = new CDbCriteria(); //$criteria->with=array('rl_aziende_clienti'); $cliente_searched = Clienti::model()->findByPk($c); $fornitore_searched = Fornitori::model()->findByPk($f); //$clientifedeli= Clienti::model()->malpag()->findAll(); $clientifedeli = TipoOrdine::model()->findAll(); //PROVA METODO FINDALLBYSQL!!! (funzionante) //$sql="SELECT * FROM fornitori WHERE id_fornitore=:param"; //$param=array(":param"=>$f); //$prova= Fornitori::model()->findAllBySql($sql,$param); //CVarDumper::dump($prova,10, true); die(); $fornitori = Fornitori::model()->findAll(); $this->render("esercizio3", array('fornitori' => $fornitori, 'clienti' => $clientifedeli, 'cliente_searched' => $cliente_searched, 'fornitore_searched' => $fornitore_searched)); }
function login() { $email = $_POST["username"]; $password = $_POST["password"]; $sessionid = $_POST["sessionid"]; if (trim($email) != "" and $password != "") { $clienti = new Clienti(); $arrCl = $clienti->getAll(" and cl_email='" . $email . "' and cl_password='******'"); if (count($arrCl) == 0) { print 0; } else { $_SESSION["idCliente"] = $arrCl[0]["cl_id"]; //se è un rivenditore, salvo il gruppo if ($arrCl[0]["cl_fkrivenditore"] != 0) { $_SESSION["rivenditore"] = $arrCl[0]["cl_fkrivenditore"]; } //aggiorno il carrello $objCar = new Carrello(); $objCar->updateUtente($sessionid, $_SESSION["idCliente"]); $objCar->updateSession($sessionid, $_SESSION["idCliente"]); print 1; } } else { print 0; } }
public function actionAjax() { $request = trim($_GET['query']); if ($request != '') { $model = Clienti::model()->findAll(array("condition" => "ragione_sociale like '{$request}%'")); foreach ($model as $get) { $value = $get->ragione_sociale; $id = $get->id_cliente; $data[] = array('value' => $value, 'id' => $id, 'label' => $get['id_cliente'], 'template' => $get['ragione_sociale'], 'extra' => array()); // return value from autocomplete } // CVarDumper::dump($data, 10, true); // die(); //$this->layout='empty'; echo json_encode($data); } Yii::app()->end(); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Clienti the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Clienti::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php //controllo se si sta facendo un inserimento if (isset($_POST["save"]) and $_POST["save"] == "si") { $nome = $_POST["nome"]; $cognome = $_POST["cognome"]; $email = $_POST["email"]; $partitaiva = $_POST["partitaiva"]; $azienda = $_POST["azienda"]; $sito = $_POST["sito"]; $telefono = $_POST["telefono"]; $rivenditore = $_POST["rivenditore"]; $object = new Clienti(); $id = aggiusta_post($_GET["id"]); //controllo che la mail sia univoca $arrCl = $object->getAll(" and cl_email='" . trim(aggiusta_post($email)) . "' and cl_id<>" . $id); $numCl = count($arrCl); if ($numCl != 0) { $strPar = "errore=mail"; } else { $object->update($id, $nome, $cognome, $email, $partitaiva, $azienda, $sito, $telefono, $rivenditore); $strPar = "ins=si"; //se è stato confermata la richiesta di un rivenditore, mando la mail if ($_SESSION["tipo"] == 2) { if ($array["cl_lingua"] == "ita") { require ROOT_APATH . "config/lingue/italiano.php"; } else { require ROOT_APATH . "config/lingue/inglese.php"; } if ($array["cl_fkrivenditore"] == 0 and $rivenditore != 0) { $bodyMsg = file_get_contents('../tpl_mail/' . $array["cl_lingua"] . '/conferma_rivenditore.html');