put a div inside a function in php

-1

I have this command that does the check in the database and verifies that the user is blocked, in case it shows an error message, if it is not locked it continues the normal execution. What I am wanting is when he does the check change the error message to a box, that when the user clicks the login button and if it is locked will appear that box.

Follow the "box" code:

<div id="mod-danger" tabindex="-1" role="dialog" class="modal fade">
                <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" data-dismiss="modal" aria-hidden="true" class="close"><span class="mdi mdi-close"></span></button>
                    </div>
                    <div class="modal-body">
                    <div class="text-center">
                        <div class="text-danger"><span class="modal-main-icon mdi mdi-close-circle-o"></span></div>
                        <h3>Atenção!</h3>
                        <p><h1>Usuario Bloqueado</h1><br><h2>PorFavor contatar algum adm para resolver.</h2></p>
                        <div class="xs-mt-50">
                        </div>
                    </div>
                    </div>
                    <div class="modal-footer"></div>
                </div>
                </div>

</div>

and I want to put this div in that function where it checks the lock

public function bloqueado(){
    $model = self::findByUsuLogin($this->usu_login);


    if ($model->usu_block){
         $this->addError('usu_login', "Usuario Bloqueado, por favor entrar em contato com algum adm.");
        return false;
    }else{
        return true;
    }
}

I want to change the error message that appears that is this for this screen with error message

If anyone can help me I would be grateful.

    
asked by anonymous 19.10.2018 / 20:14

1 answer

0

As there are not enough elements to reproduce your code, I did it with a simple conditional to show the error message screen

    $model="bloqueado";
    
    if ($model=="bloqueado"){
         $("#mod-danger").modal('show');
        //return false;
    }else{
        //return true;
    }
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><scriptsrc="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<div id="mod-danger" tabindex="-1" role="dialog" class="modal fade">
   <div class="modal-dialog">
     <div class="modal-content">
        <div class="modal-header">
           <button type="button" data-dismiss="modal" aria-hidden="true" class="close"><span class="mdi mdi-close"></span></button>
        </div>
        <div class="modal-body">
            <div class="text-center">
                <div class="text-danger"><span class="modal-main-icon mdi mdi-close-circle-o"></span></div>
                <h3>Atenção!</h3>
                <p><h1>Usuario Bloqueado</h1><br><h2>PorFavor contatar algum adm para resolver.</h2></p>
                <div class="xs-mt-50"></div>
            </div>
        </div>
        <div class="modal-footer"></div>
    </div>
</div>
</div>
    
20.10.2018 / 03:35