public function articleAction()
 {
     $ns = new Zend_Session_Namespace('user');
     $sell = new Application_Model_Sell();
     $images = new Application_Model_Image();
     if (empty($ns->data)) {
         $this->_redirect($this->view->url(array('controller' => 'index', 'action' => 'error', 'type' => 'page'), null, true));
     }
     if ($this->_request->isPost()) {
         if ($this->_getParam('type') == 'ajout') {
             $title = $_POST['productTitle'];
             // image data
             $image = @file_get_contents($_FILES['image']['tmp_name']);
             $nameImage = $_FILES['image']['name'];
             // sell data
             $quantity = $_POST['productQuantite'];
             $category = $_POST['sous-rubrique-hidden'];
             $price = $_POST['productPrix'];
             $descritptionCourt = $_POST['productDescritptionCourte'];
             $descritption = $_POST['descritption'];
             $idUser = $ns->data['id_user'];
             // recuperation de idSell après insertion
             $idSell = $sell->addSell($title, $quantity, $category, $price, $descritptionCourt, $descritption, $idUser);
             // insertion de l'image grace a l'idSell
             $ResultImage = $images->addImage($idSell, $image, $nameImage);
             if ($ResultImage == true) {
                 $this->_redirect($this->view->url(array('controller' => 'user', 'action' => 'article', 'message' => 'done'), null, true));
             }
         }
         if ($this->_getParam('type') == 'update') {
             $idSell = $_POST['idSell'];
             $quantity = $_POST['quantity'];
             $price = $_POST['price'];
             $sell->updatePriceQuantity($quantity, $price, $idSell);
             $this->view->message = "Modification(s) sauvegard�(s)";
         }
     }
     $commande = new Application_Model_Command();
     $commandeline = new Application_Model_Commandline();
     //Les produits de l'utilisateur achetés par d'autre clients.
     //$this->view->commande = $commande->getIdCommand($ns->data['id_user']);
     // Achat du client
     $tabCommand = $commande->getIdCommand($ns->data['id_user']);
     $this->view->command = $tabCommand;
     $this->view->commandeLine = $commandeline->getCommmandLine($tabCommand);
     //var_dump($this->view->commandeLine); die;
     $sell = new Application_Model_Sell();
     $images = new Application_Model_Image();
     $categorys = new Application_Model_Category();
     $user = new Application_Model_User();
     //Historique des vente effectué par un vendeur : Visualisation des commandes des clients
     $idProduct = $sell->getIdProductBySeller($ns->data['id_user']);
     $Commande = $commandeline->getCommandLineByArrayIdProduct($idProduct, true);
     $detailCommand = $commandeline->getCommandLineByArrayIdProduct($idProduct);
     $this->view->commandVente = $Commande;
     $complementCommand = $commandeline->getCommandLineByArrayIdProduct($idProduct);
     $this->view->complementCommande = $complementCommand;
     $this->view->detailCommand = $detailCommand;
     $infoUser = $user->getUserByCommandLine($Commande);
     $this->view->infoBuyer = $infoUser;
     $this->view->category = $categorys->getRubrique();
     $this->view->souscategory = $categorys->getSousRubrique();
     $table = $sell->getUserSell($ns->data['id_user']);
     foreach ($table as &$value) {
         $value['image'] = base64_encode($value['image']);
         $value['name_image'] = pathinfo($table['name_image'], PATHINFO_EXTENSION);
     }
     $this->view->articles = $table;
 }