<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>

        <title>TIDANS - Login</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


            <!-- blueprint CSS framework -->
            <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/screen.css" media="screen, projection" />
            <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/print.css" media="print" />
            <!--[if IE ]>
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/ie.css" media="screen, projection" />
	<![endif]-->

            <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css" />
            <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/form.css" />
            <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->baseUrl . '/css/login/css/'; ?>style.css" />
	    <style>
		.nobold{
		    font-weight: normal !important;
		}
	    </style>

    </head>
    <body>
	<?php	  
	    if (!Yii::app()->user->isGuest) {
		$this->redirect(Yii::app()->user->returnUrl);
	    }

	    $this->pageTitle = Yii::app()->name . ' - Login';
	    $this->breadcrumbs = array(
		'Login',
	    );
	?>

    	<div class="warper">

    	    <div class="header">
    		<img src="<?php echo Yii::app()->baseUrl ?>/css/images/header-image.jpg" class="image_header" />
    	    </div>
    	    <div class="header_logo">
    		<img src="<?php echo Yii::app()->baseUrl ?>/css/login/img/header_logo.png" />
    	    </div>
    	    <div class="header_logo2">
    		<img src="<?php echo Yii::app()->baseUrl ?>/css/images/slb_logo.png" />
    	    </div>

    	    <div class="midler">

    		<div class="log_in">

                             <!--     <div class="welcom_msg"><?php echo yii::t('default', 'Welcome To'); ?> <p style="color: #143A6B; display: inline">The Life Support Management System</p></div> -->

		    <?php if (Yii::app()->user->hasFlash('error')) {
		    ?>
    		    <div class="flash-error" style="width: 80%;">
			<?php echo Yii::app()->user->getFlash('error'); ?>
		    </div>
		    <?php } ?>

		    <?php
		    $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
				'id' => 'login-form',
				'enableClientValidation' => true,
				'clientOptions' => array(
				    'validateOnSubmit' => true,
				),
			    ));

		    echo '<div class="row error my_label">';
		    echo $form->textFieldControlGroup($model, 'username', array('class' => 'user_name_value'));
		    echo '</div>';
		    echo '<div class="row error my_label">';
		    echo $form->passwordFieldControlGroup($model, 'password', array('class' => 'password_value'));
		    echo '</div>';
		    ?>

		    <div class="row buttons">
			<?php echo CHtml::submitButton('Login', array('class' => 'login_btn')); ?>
                    </div>
		    <div>
			<?php echo CHtml::link('Public Dashboard', array('dashboardReport/view'), array('class' => 'dashbaord_link')); ?>
                    </div>

		    <?php $this->endWidget(); ?>
    		</div>

    	    </div>
    	    <p class="footer">
    		<br/><br/>
		<?php echo Yii::t('default', "TIDANS  v 4.0.0 - Copyright Schlumberger 2014 | Schlumberger Project Manager:") ?> <font style="color: #02356a">Majd Ayoubi</font>
			<br/>
		<?php echo Yii::t('default', "Powered By") . ":" ?> <a href="#" style="color: orange;" onclick="window.open('http://www.FlexSolution.biz','_blank');">Flex Solutions</a>
            </p>
        </div>
    </body>
</html>

<script>

    var password_error =  document.getElementById("LoginForm_password_em_");
    var span = document.createElement('span');
    span.textContent = ' '+ password_error.innerHTML;
    span.setAttribute('class', 'help-block nobold');

    var password_label = document.getElementById("LoginForm_password").parentNode.previousSibling;
    if( password_error != null &&  password_error != undefined){
	password_label.appendChild(span);
	password_error.remove();
    }


    var username_error =  document.getElementById("LoginForm_username_em_");
    var usernamespan = document.createElement('span');
    usernamespan.textContent = ' '+ username_error.innerHTML;
    usernamespan.setAttribute('class', 'help-block nobold');

    var username_label = document.getElementById("LoginForm_username").parentNode.previousSibling;
    if( username_error != null &&  username_error != undefined){
	username_label.appendChild(usernamespan);
	username_error.remove();
    }

</script>