/** * @name exportProduitCaracteristique($pParam) * @return CSV * @desc Retourne la liste des produits liés à la caracteristique */ public function exportProduitCaracteristique($pParam) { $lVr = CaracteristiqueValid::validDelete($pParam); if ($lVr->getValid()) { $lCaracteristique = CaracteristiqueManager::select($pParam['id']); $lProduits = ListeProduitCaracteristiqueViewManager::select($pParam['id']); $lCSV = new CSV(); $lTitre = str_replace(" ", "_", $lCaracteristique->getNom()); $lCSV->setNom($lTitre . '_:_Liste_des_produits.csv'); // Le Nom // L'entete $lEntete = array("Nom du Produit"); $lCSV->setEntete($lEntete); $lContenuTableau = array(); foreach ($lProduits as $lProduit) { array_push($lContenuTableau, array($lProduit->getNproNom())); } $lCSV->setData($lContenuTableau); // Export en CSV $lCSV->output(); } return $lVr; }
/** * @name recherche( $pTypeRecherche, $pTypeCritere, $pCritereRecherche, $pTypeTri, $pCritereTri ) * @param string nom de la table * @param string Le type de critère de recherche * @param array(string) champs à récupérer dans la table * @param array(array(string, object)) Dictionnaire(champ, valeur)) contenant les champs à filtrer ainsi que la valeur du filtre * @param array(array(string, string)) Dictionnaire(champ, sens) contenant les tris à appliquer * @return array(ListeProduitCaracteristiqueViewVO) * @desc Récupères les lignes de la table selon le critère de recherche puis trie et renvoie la liste de résultat sous forme d'une collection de ListeProduitCaracteristiqueViewVO */ public static function recherche($pTypeRecherche, $pTypeCritere, $pCritereRecherche, $pTypeTri, $pCritereTri) { // Initialisation du Logger $lLogger =& Log::singleton('file', CHEMIN_FICHIER_LOGS); $lLogger->setMask(Log::MAX(LOG_LEVEL)); // Préparation de la requète $lChamps = array(CaracteristiqueProduitManager::CHAMP_CARACTERISTIQUEPRODUIT_ID_CARACTERISTIQUE . "," . CaracteristiqueProduitManager::CHAMP_CARACTERISTIQUEPRODUIT_ID . "," . NomProduitManager::CHAMP_NOMPRODUIT_ID . "," . NomProduitManager::CHAMP_NOMPRODUIT_NOM); // Préparation de la requète de recherche $lRequete = DbUtils::prepareRequeteRecherche(ListeProduitCaracteristiqueViewManager::VUE_LISTEPRODUITCARACTERISTIQUE, $lChamps, $pTypeRecherche, $pTypeCritere, $pCritereRecherche, $pTypeTri, $pCritereTri); $lListeListeProduitCaracteristique = array(); if ($lRequete !== false) { $lLogger->log("Execution de la requete : " . $lRequete, PEAR_LOG_DEBUG); // Maj des logs $lSql = Dbutils::executerRequete($lRequete); if (mysql_num_rows($lSql) > 0) { while ($lLigne = mysql_fetch_assoc($lSql)) { array_push($lListeListeProduitCaracteristique, ListeProduitCaracteristiqueViewManager::remplir($lLigne[CaracteristiqueProduitManager::CHAMP_CARACTERISTIQUEPRODUIT_ID_CARACTERISTIQUE], $lLigne[CaracteristiqueProduitManager::CHAMP_CARACTERISTIQUEPRODUIT_ID], $lLigne[NomProduitManager::CHAMP_NOMPRODUIT_ID], $lLigne[NomProduitManager::CHAMP_NOMPRODUIT_NOM])); } } else { $lListeListeProduitCaracteristique[0] = new ListeProduitCaracteristiqueViewVO(); } return $lListeListeProduitCaracteristique; } $lListeListeProduitCaracteristique[0] = new ListeProduitCaracteristiqueViewVO(); return $lListeListeProduitCaracteristique; }