示例#1
0
文件: Login.php 项目: reytuty/facil
 public function check()
 {
     //busca o post
     $login = DataHandler::getValueByArrayIndex($_POST, "login");
     $password = DataHandler::getValueByArrayIndex($_POST, "password");
     //iniciando o retorno padrao em http client ajax
     $returnResult = new ReturnResultVO();
     //se não validar retornar erro
     if (!Validation::blank($password, 1) && !Validation::blank($login, 1)) {
         $returnResult->success = 0;
         $returnResult->message = "Envie Login e Senha";
     } else {
         //cadastra o usuario e os detalhes do mesmo
         $DAO = UserDetailDAO::getInstance();
         $ReturnDataVO = $DAO->checkLogin($login, $password);
         //print_r($ReturnDataVO);
         if ($ReturnDataVO->success && count($ReturnDataVO->result) > 0) {
             if ($ReturnDataVO->result[0]->user_type_id == Config::ADMIN_USER_TYPE_ID || $ReturnDataVO->result[0]->user_type_id == Config::DEVELOPER_USER_TYPE_ID) {
                 UserClient::setId($ReturnDataVO->result[0]->id);
                 UserClient::setTypeId($ReturnDataVO->result[0]->user_type_id);
                 UserClient::setActiveTime(time());
                 //setando sucesso true caso tenha dado certo
                 $returnResult->success = $ReturnDataVO->success;
                 $returnResult->message = "sucesso ao logar";
             } else {
                 //print_r($ReturnDataVO);
                 $returnResult->success = 0;
                 $returnResult->message = "Usuario sem permissão!";
             }
         } else {
             //print_r($ReturnDataVO);
             $returnResult->success = 0;
             $returnResult->message = "Erro ao Logar!";
         }
     }
     //Debug::print_r($returnResult); exit();
     if ($returnResult->success) {
         if ($this->to != "") {
             Navigation::redirect($this->to);
         } else {
             Navigation::redirect("backend");
         }
     } else {
         return $this->init($returnResult);
     }
 }
示例#2
0
文件: Login.php 项目: reytuty/facil
 public function check()
 {
     //busca o post
     $login = DataHandler::getValueByArrayIndex($_POST, "login");
     $password = DataHandler::getValueByArrayIndex($_POST, "password");
     //iniciando o retorno padrao em http client ajax
     $returnResult = new ReturnResultVO();
     //se não validar retornar erro
     if (!Validation::blank($password, 1) && !Validation::blank($login, 1)) {
         $returnResult->success = 0;
         $returnResult->addMessage("Envie Login e Senha");
     } else {
         //cadastra o usuario e os detalhes do mesmo
         $DAO = UserDetailDAO::getInstance();
         $ReturnDataVO = $DAO->checkLogin($login, $password);
         if ($ReturnDataVO->success && count($ReturnDataVO->result) > 0) {
             UserClient::setId($ReturnDataVO->result[0]->id);
             UserClient::setTypeId($ReturnDataVO->result[0]->user_type_id);
             UserClient::setActiveTime(time());
             //setando sucesso true caso tenha dado certo
             $returnResult->success = $ReturnDataVO->success;
             $message_success = file_get_contents(Config::getAsset("templates/login_sucesso.txt"));
             $returnResult->addMessage($message_success);
         } else {
             //print_r($ReturnDataVO);
             $returnResult->success = 0;
             $returnResult->addMessage("Erro ao Logar!");
         }
     }
     if ($returnResult->success) {
         if ($this->to != "") {
             Navigation::redirect($this->to);
         }
     }
     echo $returnResult->toJson();
     exit;
 }
示例#3
0
 /**
  * inicia interloginnte a DAO
  * @return void
  */
 public function startDAO()
 {
     $this->DAO = UserDetailDAO::getInstance();
 }
示例#4
0
 /**
  * @return UserDAO
  */
 public function getUserDAO()
 {
     if (!self::$_userDAO) {
         self::$_userDAO = new UserDAO();
     }
     return self::$_userDAO;
 }
示例#5
0
文件: User.php 项目: reytuty/facil
 public function delete()
 {
     $ReturnResultVO = new ReturnResultVO();
     $ReturnResultVO->success = FALSE;
     if (DataHandler::getValueByArrayIndex($this->arrayVariable, "id")) {
         $id = DataHandler::getValueByArrayIndex($this->arrayVariable, "id");
         $this->UserDatailDAO = UserDetailDAO::getInstance();
         $ReturnDataVO = $this->UserDatailDAO->delete($id);
         $ReturnResultVO->success = $ReturnDataVO->success;
         $ReturnResultVO->result = $ReturnDataVO->result;
     }
     echo $ReturnResultVO->toJson();
     exit;
 }
示例#6
0
 public function excel()
 {
     $this->NewsletterDAO = NewsletterDAO::getInstance();
     if (false) {
         $this->NewsletterDAO = new NewsletterDAO();
         $UserDetailDAO = new UserDetailDAO();
     }
     $UserDetailDAO = UserDetailDAO::getInstance();
     //iniciando o retorno padrao em http result
     $returnResult = new HttpResult();
     //fazendo o que precisa fazer para ter os dados
     $ReturnDataUserVO = $UserDetailDAO->select(UserDetailDAO::RETURN_STD_OBJECT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL);
     if ($ReturnDataUserVO->success) {
         //			Debug::print_r($ReturnDataUserVO);
         $tempCount = $ReturnDataUserVO->count_total;
     }
     $ReturnDataNewsletterVO = $this->NewsletterDAO->select(NewsletterDAO::RETURN_STD_OBJECT, NULL, 1, NULL);
     if ($ReturnDataNewsletterVO->success) {
         //			Debug::print_r($ReturnDataNewsletterVO);
         $tempCount = $tempCount + $ReturnDataNewsletterVO->count_total;
     }
     //Debug::print_r($ReturnDataVO);
     $html[] = "<table><tr><td>email</td><td>data</td></tr></table>";
     foreach ($ReturnDataNewsletterVO->result as $newsVO) {
         $html[] = "<table><tr><td>{$newsVO->email}</td><td>{$newsVO->date}</td></tr></table>";
     }
     foreach ($ReturnDataUserVO->result as $userVO) {
         $html[] = "<table><tr><td>{$userVO->email}</td><td>{$userVO->registred}</td></tr></table>";
     }
     $arquivo = Config::getRootPath("view/newsletter/excel.xls");
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");
     header("Cache-Control: no-cache, must-revalidate");
     header("Pragma: no-cache");
     header("Content-type: application/x-msexcel");
     header("Content-Disposition: attachment; filename={$arquivo}");
     header("Content-Description: PHP Generated Data");
     for ($i = 0; $i <= count($html); $i++) {
         if (isset($html[$i])) {
             echo $html[$i];
         }
     }
     exit;
 }