コード例 #1
0
 public function checkCpfDuplicity($cpf_to_check)
 {
     $exists = $this->loadedModel->getObjects(array("fields" => "nome_completo", "where" => "CPF = '" . $cpf_to_check . "'"));
     if (count($exists)) {
         AlertMessage::display(array('type' => AlertMessage::ERROR, 'message' => 'Este <b>CPF</b> já existe dentro do sistema com o <b>Nome</b> de: <b>' . $exists[0]["nome_completo"] . '</b>'));
     } else {
         echo "";
     }
 }
コード例 #2
0
 public function add($processed = array())
 {
     $this->load->database();
     foreach ($processed as $field_name => $field_value) {
         $this->db->set($field_name, $field_value);
     }
     /*echo $this->db->get_compiled_insert($this->getTable());
     		SystemHelper::continuePopupWindow();
     		exit;*/
     if ($this->debugMode) {
         AlertMessage::display(array('type' => AlertMessage::INFO, 'icon' => 'fa fa-bug', 'message' => '<b>SQL Debug:</b> <br><br>' . $this->db->get_compiled_insert($this->getTable(), false)));
     }
     if (!$this->checkExists($processed)) {
         $try_insert = @$this->db->insert($this->getTable());
         if ($try_insert) {
             $this->_generated_inserted_id = $this->db->insert_id($this->getTable());
             $this->last_runned_sql = $this->db->last_query();
             $this->db->close();
             return true;
         } else {
             $this->last_runned_sql = $this->db->last_query();
             throw new Exception("Desculpe, não foi possivel adicionar o item. Algum problema ocorreu, possivelmente uma duplicidade de cadastro. Favor verifique.");
             $this->db->close();
             return false;
         }
     }
 }
コード例 #3
0
 public function update($FORMDATA, $optionals = array())
 {
     $PROCESSED_INPUT = $this->beforeUpdate($FORMDATA);
     try {
         if ($this->loadedModel->update($PROCESSED_INPUT)) {
             $this->loadObjectDataFields();
             $this->afterUpdate();
             if (isset($optionals["noAlert"]) && $optionals['noAlert']) {
                 return true;
             }
             AlertMessage::display(array('type' => AlertMessage::SUCCESS, 'message' => 'Atualizado com sucesso', 'icon' => 'ls-ico-checkmark'));
             return true;
         }
     } catch (Exception $ex) {
         AlertMessage::display(array('type' => AlertMessage::ERROR, 'message' => $this->setLastError($ex) . " <br>SQL: " . $this->loadedModel->getLastSQL(), 'icon' => 'ls-ico-close'));
         SystemHelper::preventPopupResultClosing();
         return false;
     }
 }
コード例 #4
0
 public function processEdit($user_id)
 {
     if ($this->input->post("PERMISSION")) {
         foreach ($this->loadedModel->getObjects(array("where" => "usuario_id = '" . $user_id . "'")) as $index => $perm) {
             if (!isset($this->input->post("PERMISSION")[$perm["nome_permissao"]])) {
                 $this->loadedModel->remove_where(array("usuario_id" => $user_id, "nome_permissao" => $perm["nome_permissao"]));
             }
         }
         foreach ($this->input->post("PERMISSION") as $index => $permName) {
             if (!empty($permName) && !self::havePermission($permName, $user_id)) {
                 $this->loadedModel->add(array("nome_permissao" => $permName, "usuario_id" => $user_id));
             }
         }
     } else {
         $this->loadedModel->remove_where(array("usuario_id" => $user_id));
     }
     AlertMessage::display(array('type' => AlertMessage::SUCCESS, 'icon' => 'ls-ico-checkmark', 'msg' => 'Permissões atualizadas com sucesso!'));
 }
コード例 #5
0
		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
		<link rel="icon" type="favicon" type="image/x-icon" href="<?php 
echo ROOT_PATH . "assets/images/easycasting.ico";
?>
">
		<meta name="viewport" content="user-scalable=no,width=device-width, initial-scale=1"/>
	</head>
	<body>
		<div class="loginContainer">
			<div class="loginLogo"><img src='assets/images/logoMenu.png' width="" height=""></img></div>
			<div class="loginForm">
				<span>Autênticação de usuário</span>
				<?php 
if (!empty($error_msg)) {
    echo "<br><br>";
    AlertMessage::display(array('type' => AlertMessage::ERROR, 'icon' => 'ls-ico-user', 'style' => 'margin-bottom:0;', 'msg' => $error_msg));
}
?>
				
				<form method="post" action="doLogin">
					<?php 
SystemHelper::addTextfield(array('label' => 'Usuário', 'placeholder' => 'Informe seu usuário', 'name' => 'login_username'));
SystemHelper::addPasswordfield(array('label' => 'Senha', 'style' => 'margin-bottom:10px', 'placeholder' => 'Informe sua senha', 'name' => 'login_password'));
?>
					
					<div class="loginFormButtons">
						<?php 
SystemHelper::addSubmitButton(array('label' => 'Entrar', 'icon' => 'fa fa-sign-in'));
?>
					</div>
				</form>