예제 #1
0
     $tab_ids = ItemManager::getListIdsByFlotte($id, 'array');
     foreach ($tab_ids as $row) {
         $tab_items[][] = ItemManager::get($row);
     }
     if (!empty($tab_items)) {
         $obj_page->setData('items', $tab_items);
     }
     $obj_page->setAppelAjax(true);
     $obj_page->setUrlPage('flotte/flotte_items');
 } else {
     if ($http_request['act'] == "ajout_item_flotte") {
         $id = intval($http_request['id']);
         $id_item = intval($http_request['id_item']);
         $tab_item_flotte = ItemManager::getListIdsByFlotte($id, 'array');
         if (!is_null($obj_flotte = FlotteManager::get($id))) {
             $obj_membre = MembreManager::get($obj_flotte->getAmiral());
             if (!is_null($obj_article = ArticleBoutiqueManager::get($id_item))) {
                 if ($obj_article->getType() == 7) {
                     if (in_array($obj_article->getId(), $tab_item_flotte)) {
                         setFlashData('message', "La flotte possède déja l'élément <a style='color:blue' href=#{$id_item}>{$id_item}</a>");
                     } else {
                         $obj_flotte->setTotalReputation($obj_flotte->getTotalReputation() + $obj_article->getReputation());
                         FlotteManager::updateBdd($obj_flotte);
                         $tab_article = ArticleBoutiqueManager::getListLiaison($obj_article);
                         foreach ($tab_article as $obj_article_temp) {
                             // on note l'achat dans boutique_t
                             if (ItemManager::insertItemFlotte($obj_article_temp->getId(), $obj_flotte->getId(), $obj_membre->getId())) {
                                 if ($obj_article_temp->getReputation() > 0) {
                                     configurerTraduction($obj_membre->getLangue());
                                     // Actualité de la flotte
                                     $obj_message = new FlotteActualite();
     $obj_page->setData('message', getFlashData('message'));
     $obj_page->setUrlPage('service_client/service_client_detail');
 } else {
     if ($http_request['act'] == 'repondre') {
         if (isset($http_request['id']) && !empty($http_request['id'])) {
             $id = intval($http_request['id']);
             if (isset($http_request['reponse']) && !empty($http_request['reponse']) && isset($http_request['sujet_reponse']) && !empty($http_request['sujet_reponse'])) {
                 $reponse = $http_request['reponse'];
                 $sujet_reponse = $http_request['sujet_reponse'];
                 if (!is_null($obj_question = ServiceClientManager::get($id))) {
                     $obj_question->setDateReponse(now());
                     $obj_question->setReponse($reponse);
                     $tab_retour = ServiceClientManager::updateBdd($obj_question);
                     if (!$tab_retour[0]) {
                         /* TRADUCTION ************/
                         $obj_membre = MembreManager::get($obj_question->getIdMembre());
                         configurerTraduction($obj_membre->getLangue(), '../');
                         //                    if(!in_array($obj_membre->getLangue(), Config::get('tab_lang'))) {
                         //                        $lang = Config::get('lang_defaut');
                         //                    } else {
                         //                        $lang = $obj_membre->getLangue();
                         //                    }
                         //                    define('LANG_APP', $lang);
                         //                    require_once Config::get('fichier_langue');
                         /*************************/
                         $obj_message = new MessageCompte();
                         $contenu = tradTxt("Votre question :") . ' ' . $obj_question->getQuestion();
                         $contenu .= ' <br/><br/> ' . tradTxt("Notre réponse :") . ' ' . nl2br($reponse);
                         $obj_message->setContenu($contenu);
                         //$obj_message->setDateEnvoi($date); // défini dans l'insert
                         $obj_message->setIdMembre($obj_question->getIdMembre());