<?php
require_once 'application/class/class_ManageSession.php';

global $connecteur;

$action = getValue('action');
$no_ao = getValue('no_ao');
$code_fou = getValue('code_fou');
$type_fg = getValue('type_fg');
$c_v = getValue('c_v');
$no_po = getValue('no_po');
$dte_rep = getValue('dte_rep');
$dte_ao = getValue('dte_ao');
$mode = getValue('mode');

switch ($action) {
    case AO_Panier_detail_split_ligne::actionAffichePopup:
        $popup = new AO_Panier_detail_split_ligne($no_ao, $no_po, $code_fou, $type_fg, $dte_rep, $c_v, $dte_ao, $mode);
        $xslt = new GenXslt(true);
        $array = $popup->buildXml($action);
        echo $xslt->XslHtml(AO_Panier_detail_split_ligne::fichierXsl, $array);
        break;
    
    case AO_Panier_detail_split_ligne::changeMode:
        $popup = new AO_Panier_detail_split_ligne($no_ao, $no_po, $code_fou, $type_fg, $dte_rep, $c_v, $dte_ao, $mode);
        $xslt = new GenXslt(true);
        $array = array();
        $array['lignes'] = $popup->buildXmlLignes();
        $array['action'] = $action;
        $array['mode'] = $mode;
        
        // On rafraîchit le tableau
        $html = $xslt->XslHtml(AO_Panier_detail_split_ligne::fichierXsl, $array);
        Affichage::innerHTML(AO_Panier_detail_split_ligne::id_div_tableau, $html);
        
        // On rafraîchit le bouton
        if (AO_Panier_detail_split_ligne::modeDetaille == $mode) {
            Affichage::displayElement(AO_Panier_detail_split_ligne::id_div_mode_synthe, true);
            Affichage::displayElement(AO_Panier_detail_split_ligne::id_div_mode_detail, false);
        } else {
            Affichage::displayElement(AO_Panier_detail_split_ligne::id_div_mode_synthe, false);
            Affichage::displayElement(AO_Panier_detail_split_ligne::id_div_mode_detail, true);
        }
        break;
}