<script>
 Ext.onReady(function(){

    Ext.QuickTips.init();

    // turn on validation errors beside the field globally
    Ext.form.Field.prototype.msgTarget = 'side';

    var bd = Ext.getBody();
/*
     * ================  Administration de la presentation de l'entreprise =======================
     */
 


    var top = new Ext.FormPanel({
	    applyTo:'presentation',
        labelAlign: 'top',
        frame:true,
        title: 'Administration de la presentation de l\'entreprise',
        bodyStyle:'padding:5px 5px 0',
        width: 600,
		defaults: {width: '100%'},
       // method: 'POST', // 1
       // url: 'http://localhost/touatcomK/admin/editpresentation/oussa', // 2
        items: [{
            xtype:'htmleditor',
            id:'description',
			name:'presentation',
            fieldLabel:'Presentation',
            height:200,
            anchor:'98%',
			value:'<?php foreach ($articles as $article) :  echo $article['text']; endforeach; ?>'  
        }],

        buttons: [{
				text: 'Enregistrer',
				handler: function(btn, eventObj) { // 4
				var formPanel = btn.findParentByType('form'); // 5
				var form = formPanel.getForm(); // 6
				if(form.isValid()) { // 7
				var txt =top.getForm().findField('presentation').getValue();
                               form.submit({            //similaire ‡ la mEthode post 
							   
													url:'<?php echo URL::site()."admin/editpresentation"; ?>',
                                                    method: 'POST',       
                                                    reset: false            //pour ne pas reseter les formulaires en cas d'Echec
                                                  });    //fin du submit
				 Ext.Msg.alert('Success', txt);
						
			
 }
 } 	
		
}]


    });

    top.render(document.body);

});
</script>


<div class="container_12">
		         	         
<?php $nom_utilisateur = session::instance()->get('nom_utilisateur');
    if($nom_utilisateur==''){
	echo "vous devez vous identifier pour acceder a cette page <br/><p>";
 echo form::open('/page/login'); 
  echo form::label('username', 'Nom &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'); 
  echo form::input('username'); 
  echo form::label('password', ' Mot de passe &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'); 
  echo form::password('password'); 
  echo '  ';  ?>
  <input type="submit" class="button" value="Connexion"><em></em>
 <?php
 echo form::close();
echo "<p>";
												
 }else{ ?>


		         	         	   
                       
                             <center> <div id="presentation"> </div>
                           </div>
                       </center>
		         	 
		         	  

<?php
}

?>

</div><!--the end of wrapper-->

