예제 #1
0
    /**
     * 
     * Método que executa uma Action
     * @param Action $action Action a ser executada
     * 
     */
    public static function mountAction($action)
    {
        $args = Proxy::mountForm();
        if ($action) {
            $access = ACL::checkProfile($action->getPermissions());
            if ($access) {
                try {
                    ?>
					<script language="javascript">
					function load(i) {
						document.getElementById("bar").style.width=i;
					};
					</script>						
					<div class='container'>
						<div class='row span5 offset3'>
							<div class="progress progress-striped active">
								<div id='bar' class="bar" style="width: 0%;"></div>
							</div>
						</div>
					</div>
					<?php 
                    $action->run($args);
                    if ($action->hasMessage()) {
                        SessionManager::setKey('bodymsg', $action->getMessage());
                        SessionManager::setKey('bodymsgtype', $action->getMessageType());
                    }
                    if ($action->hasPopup()) {
                        SessionManager::setKey('popup', $action->getPopup());
                    }
                    Forward::go($action->getForward());
                } catch (Exception $e) {
                    SessionManager::setKey('bodymsg', "[ERRO] " . $e->getMessage());
                    SessionManager::setKey('bodymsgtype', Constants::$_MSG_ERRO);
                    Forward::go(Forward::$_BACK);
                }
            }
        }
    }