Current File : /home/k/a/r/karenpetzb/www/items/category/application.tar
models/UserGuest.php000060400000000170150710367660010473 0ustar00<?php
class UserGuest extends Zend_Db_Table
{
    protected $_name = 'user_guest';
    protected $_primary = 'ID';

}
?>models/CodeIntern.php000060400000000173150710367660010602 0ustar00<?php
class CodeIntern extends Zend_Db_Table
{
    protected $_name = 'user_cintern';
    protected $_primary = 'ID';

}
?>models/FichierExcel.php000060400000001550150710367660011102 0ustar00<?php
class FichierExcel {

	private $csv = Null;
	/**
	 * Cette ligne permet de cr�er les colonnes du fichers Excel
	 * Cette fonction est totalement faculative, on peut faire la m�me chose avec la
	 * fonction insertion, c'est juste une clart� pour moi
	 */
	function Colonne($file) {

		$this->csv.=$file."\n";
		return $this->csv;

	}

	/**
	 * Insertion des lignes dans le fichiers Excel, il faut introduire les donn�es sous formes de chaines
	 * de caract�re.
	 * Attention a s�parer avec une virgule.
	 */
	function Insertion($file){
		$this->csv.=$file."\r\n";
		return $this->csv;
	}

	/**
	 * fonction de sortie du fichier avec un nom sp�cifique.
	 *
	 */
	function output($NomFichier){
		
		header('Content-type: text/csv; charset=ISO-8859-1');
		header('Content-Disposition: attachment; filename='.$NomFichier.'.csv');
		
		print $this->csv;
		exit;

	}
}

?>
models/OptionList.php000060400000001713150710367660010655 0ustar00<?php
class OptionList extends Zend_Db_Table
{
    protected $_name = 'optionlist';
    protected $_primary = 'ID';

    
    public function getAll() {
		$result = $this->select()->order('NAME ASC')->query()->fetchAll();
		$options = array();
		foreach ($result as $option) { 
			$itemOL = new ItemOptionList();
			$itemOL->init($option);
			array_push($options, $itemOL);
		}
		return $options;
	}
    
    public function getByIdProduct($id) {
    	$select = 'SELECT ol.*
				FROM product p 
				LEFT JOIN optionlist AS ol ON p.ONSELECT_IDOPTION = ol.ID 
				WHERE p.ID = '.$id ;  
		$result = $this->getAdapter()->fetchRow($select);  
		if (!empty($result)) {
			$itemOL = new ItemOptionList();
			$itemOL->init($result); 
			return $itemOL;
		} 
		return array();
	}
	 
	public function getProductByIdOption($id) {
		$select = 'SELECT * FROM product WHERE ONSELECT_IDOPTION = '.$id ; 
		return $this->getAdapter()->fetchAll($select); 
	}
	
	
	
	
    
		
		
    
}
?>models/AnnonceRight.php000060400000001073150710367660011127 0ustar00<?php
class AnnonceRight extends Zend_Db_Table
{
    protected $_name = 'annonce_right';
    protected $_primary = 'ID';

    public function getAnnonces() {
    	return $this->select()->where('isSHOW = 0')->order('NOM ASC')->query()->fetchAll();
	}
	

    public function getAllAnnonces() {
    	return $this->select()->order('NOM ASC')->query()->fetchAll();
	}
	
 	public function getAnnoncesByShow($idCat) {
 		return $this->select()->where('isSHOW = 0')->where("ID_CATS LIKE '%:".$idCat.":%' OR ID_CATS LIKE '%:0:%' ")->order('NOM ASC')->query()->fetchAll();
 	}
}
?>models/FAQ.php000060400000002135150710367660007157 0ustar00<?php
class FAQ extends Zend_Db_Table
{
    protected $_name = 'faq';
    protected $_primary = 'ID';

    public function getLists() {
    	$sql = "
				SELECT f.ID ID, f.QUESTION QUESTION, f.REPONSE REPONSE, f.POSITION POSITION, 
				f.TYPE IDTYPE, ft.NOM NOMTYPE
				FROM faq f
				JOIN faq_type ft ON f.TYPE = ft.ID 
				WHERE f.isACTIVE = 1
				AND ft.isACTIVE = 1
				ORDER BY ft.NOM, f.POSITION ASC";
		$results = $this->getAdapter()->fetchAll($sql);
		return $results;
	}
	
	public function getListsAll() {
    	$sql = "
				SELECT f.ID ID, f.QUESTION QUESTION, f.REPONSE REPONSE, f.POSITION POSITION, 
				f.TYPE IDTYPE, ft.NOM NOMTYPE, f.isACTIVE isACTIVEFAQ, ft.isACTIVE isACTIVETYPE
				FROM faq f
				JOIN faq_type ft ON f.TYPE = ft.ID 
				ORDER BY ft.NOM, f.POSITION ASC";
		$results = $this->getAdapter()->fetchAll($sql);
		return $results;
	}
	
	public function isTypeExist($idType){
    	$sql = "
				SELECT f.ID ID
				FROM faq f
				WHERE f.TYPE = ".$idType;
		$results = $this->getAdapter()->fetchRow($sql);
		if (isset($results) && !empty($results)) {
			return true;
		}
		return false;
	}
}
?>models/FichierText.php000060400000001512150710367660010764 0ustar00<?php
class FichierText {

	private $csv = Null;
	/**
	 * Cette ligne permet de cr�er les colonnes du fichers Excel
	 * Cette fonction est totalement faculative, on peut faire la m�me chose avec la
	 * fonction insertion, c'est juste une clart� pour moi
	 */
	function Colonne($file) {

		$this->csv.=$file."\n";
		return $this->csv;

	}

	/**
	 * Insertion des lignes dans le fichiers Excel, il faut introduire les donn�es sous formes de chaines
	 * de caract�re.
	 * Attention a s�parer avec une virgule.
	 */
	function Insertion($file){

		$this->csv.=$file."\n";
		return $this->csv;
	}

	/**
	 * fonction de sortie du fichier avec un nom sp�cifique.
	 *
	 */
	function output($NomFichier){
		header("Content-Type: plain/text");
		header("Content-Disposition: Attachment; filename=$NomFichier.txt");
		print $this->csv;
		exit;

	}
}

?>
models/AnnonceCms.php000060400000001524150710367660010575 0ustar00<?php
class AnnonceCms extends Zend_Db_Table
{
    protected $_name = 'annonce_cms';
    protected $_primary = 'ID';

    public function getAnnonces() {
    	return $this->select()->where('isSHOW = 0')->order('POSITION ASC')->order('NOM ASC')->query()->fetchAll();
	}
	

    public function getAllAnnonces() {
    	return $this->select()->order('POSITION ASC')->order('NOM ASC')->query()->fetchAll();
	}

    public function getAllAnnoncesByCategory($idCat) {
    	return $this->select()->where("ID_CATS LIKE '%:".$idCat.":%' OR ID_CATS LIKE '%:0:%' ")->order('POSITION ASC')->order('NOM ASC')->query()->fetchAll();
 	}
	
 	public function getAnnoncesByShow($idCat) {
 		return $this->select()->where('isSHOW = 0')->where("ID_CATS LIKE '%:".$idCat.":%' OR ID_CATS LIKE '%:0:%' ")->order('POSITION ASC')->order('NOM ASC')->query()->fetchAll();
 	}
}
?>models/PromoGift.php000060400000000170150710367660010453 0ustar00<?php
class PromoGift extends Zend_Db_Table
{
    protected $_name = 'promo_gift';
    protected $_primary = 'ID';

}
?>models/CodeReduction.php000060400000002524150710367660011301 0ustar00<?php
class CodeReduction extends Zend_Db_Table
{
	protected $_name = 'promo_codereduction';
	protected $_primary = 'ID';

	public function getAllCodes() {
	    return $this->select()->order('DATESTART DESC')->query()->fetchAll();
	
	}
	
	public function getCodeBy($code) {
		return $this->select()->where('CODE = ?',$code)->order('DATESTART DESC')->query()->fetch();
	
	}
	
	public function getVerifyCodeBy($code) {
		$date = new Zend_Date();
		$select = "
				SELECT *
				FROM promo_codereduction
				WHERE isACTIF = 1
				AND CODE = '".$code."'
				AND DATESTART <= '".$date->toString('YYYY-MM-dd')."'
				AND DATEEND >= '".$date->toString('YYYY-MM-dd')."'";
		$results = $this->getAdapter()->fetchAll($select);
		
		$resultCode = array();
		if (isset($results) && !empty($results)) {
			foreach ($results as $result) {
				$resultCode['PRODUITREF'] = $result['PRODUITREF'];
				$resultCode['PRODUITNBR'] = $result['PRODUITNBR'];
				$resultCode['CMDTOTAL'] = $result['CMDTOTAL'];
				$resultCode['CODE'] = $result['CODE'];
				$resultCode['LIBELLE'] = $result['LIBELLE'];
				$resultCode['DATESTART'] = $result['DATESTART'];
				$resultCode['DATEEND'] = $result['DATEEND'];
				$resultCode['isACTIF'] = $result['isACTIF'];
				$resultCode['EURO'] = $result['EURO'];
				$resultCode['POUR'] = $result['POUR'];
				break;
			}
		}
		return $resultCode;
	}	
}
?>models/ProductChild.php000060400000010420150710367660011130 0ustar00<?php
class ProductChild extends Zend_Db_Table
{
	protected $_name = 'productchild';
	protected $_primary = 'ID';

	public function getProductChildsByIdProduct($id) {
		$select = "
					SELECT pc.ID ID ,pc.REFERENCE REFERENCE,pc.DESIGNATION DESIGNATION,pc.PRIX PRIX, pc.isPROMO isPROMO ,
					pco.VALUE OPTIONVALUE, pco.IDOPTION OPTIONID, pc.IMAGEPROMO IMAGEPROMO,pc.isDEVIS isDEVIS, pc.QUANTITYMIN QUANTITYMIN
					, p.NAVNOM PRODUCTNAVNOM, p.NOM PRODUCTNOM, p.ID PRODUCTID, p.isQTEPRIXACTIVE isQTEPRIXACTIVE, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
					, pc.POINTFIDELITE  POINTFIDELITE 
                    FROM productchild AS pc
					LEFT JOIN productchild_option AS pco ON pc.ID = pco.IDPRODUCTCHILD
					LEFT JOIN product AS p ON pc.IDPRODUCT = p.ID
			        LEFT JOIN category c ON p.IDCATEGORY = c.ID
					WHERE pc.IDPRODUCT = ".$id." 
					ORDER BY REFERENCE ASC
					";  
		return $this->getAdapter()->fetchAll($select);
	}


	public function getChildsByIdProduct($id) {
		$select = "
						SELECT pc.ID ID ,pc.REFERENCE REFERENCE, pc.POIDS POIDS, pc.DESIGNATION DESIGNATION ,pc.PRIX PRIX,pc.ETATSTOCK ETATSTOCK,
							pc.isPROMO isPROMO,pc.isDEVIS isDEVIS,pc.QUANTITYMIN QUANTITYMIN,
						pco.VALUE VALUE,pco.ID IDCHILD, pco.IDOPTION IDOPTION, pc.IMAGEPROMO IMAGEPROMO, pc.isFRANCODENIED isFRANCODENIED,
                        pc.POINTFIDELITE  POINTFIDELITE 
							FROM productchild AS pc
						LEFT JOIN productchild_option AS pco ON pc.ID = pco.IDPRODUCTCHILD
						WHERE pc.IDPRODUCT = ".$id; 
		return $this->getAdapter()->fetchAll($select);
	} 

	public function isChildReferenceExist($reference) {
		$select = "
				SELECT COUNT(pc.ID) NBR
				FROM productchild pc 
				WHERE pc.REFERENCE LIKE '".$reference."'"; 

		$result = $this->getAdapter()->fetchRow($select);

		if ($result['NBR'] == 0) {
			return false;
		}
		return true;
	}
	
	public function getChildInfo($idChild) {
		$sql = "
			SELECT p.NOM NOM, p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.ID IDPRODUCT, pic.URL URL, p.STOCK STOCK,
			pc.DESIGNATION DESIGNATION, pc.REFERENCE REFERENCE, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS, pc.POINTFIDELITE  POINTFIDELITE 
			FROM productchild pc
			LEFT JOIN product p ON p.ID = pc.IDPRODUCT
			LEFT JOIN category c ON p.IDCATEGORY = c.ID
			LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
			WHERE pc.ID = ".$idChild."
			AND p.isACTIVE = 0
			AND pic.POSITION = 1
			";
		return $this->getAdapter()->fetchRow($sql);
	}

	public function getChildsInfoByListId($stringTemp) {
		$sql = "
			SELECT p.NOM NOM,p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.ID IDPRODUCT, pic.URL URL,p.isPROMO isPROMO, pc.DESIGNATION DESIGNATION, p.STOCK STOCK,
			pc.ID IDCHILD, pc.REFERENCE REFERENCE, pc.isDEVIS isDEVIS, pc.isPROMO isPROMOCHILD, pc.PRIX PRIX, p.DATEPROMO DATEPROMO,
			p.IDCATEGORY IDCATEGORY, p.IDBREND IDBREND, p.isSHOWBREND isSHOWBREND, pc.QUANTITYMIN QUANTITYMIN, pc.POIDS POIDS, pc.isFRANCODENIED isFRANCODENIED, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
			,pc.POINTFIDELITE  POINTFIDELITE 
            FROM productchild pc
			LEFT JOIN product p ON pc.IDPRODUCT = p.ID
			LEFT JOIN category c ON p.IDCATEGORY = c.ID
			LEFT JOIN picture pic ON p.ID = pic.IDPRODUCT
			WHERE pc.ID IN ( ".$stringTemp." )
			AND p.isACTIVE = 0
			AND pic.POSITION = 1";
		return $this->getAdapter()->fetchAll($sql);
	}

	public function getChildsInfoByListProductId($idProduct) {
		$sql = "
			SELECT p.NOM NOM,p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.ID IDPRODUCT, pic.URL URL,p.isPROMO isPROMO, pc.DESIGNATION DESIGNATION, p.STOCK STOCK,
			pc.ID IDCHILD, pc.REFERENCE REFERENCE, pc.isDEVIS isDEVIS, pc.isPROMO isPROMOCHILD, pc.PRIX PRIX, p.DATEPROMO DATEPROMO,
			p.IDCATEGORY IDCATEGORY, p.IDBREND IDBREND, p.isSHOWBREND isSHOWBREND, pc.QUANTITYMIN QUANTITYMIN, pc.POIDS POIDS, pc.isFRANCODENIED isFRANCODENIED, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
			, pc.POINTFIDELITE  POINTFIDELITE 
            FROM productchild pc
			LEFT JOIN product p ON pc.IDPRODUCT = p.ID
			LEFT JOIN category c ON p.IDCATEGORY = c.ID
			LEFT JOIN picture pic ON p.ID = pic.IDPRODUCT
			WHERE p.ID = ".$idProduct;
		return $this->getAdapter()->fetchAll($sql);
	}
	
	public function getChildPriceByIdChild($idChild) {
		$sql = "
			SELECT pc.PRIX PRIX 
			FROM productchild pc 
			WHERE pc.ID = ".$idChild;
		return $this->getAdapter()->fetchRow($sql);
	}

}
?>models/PromoFront.php000060400000001370150710367660010655 0ustar00<?php
class PromoFront extends Zend_Db_Table
{
    protected $_name = 'promo_front';
    protected $_primary = 'ID';

    public function getListPromo() {
    	$listFrontSQL = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.PRIX PRIX,
				p.isPROMO isPROMO, pic.URL URL, sb.BREND BREND, pf.REFERENCE REFERENCE, p.IDCATEGORY IDCATEGORY
				FROM promo_front AS pf
				LEFT JOIN productchild pc ON pc.REFERENCE = pf.REFERENCE
				LEFT JOIN product p ON p.ID = pc.IDPRODUCT
				LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
				LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
				WHERE pic.POSITION = pc.IMAGEPROMO
				AND p.isACTIVE = 0
				ORDER BY pf.POSITION ASC";
		return $this->getAdapter()->fetchAll($listFrontSQL);
    }
}
?>models/Category2.php000060400000042203150710367660010407 0ustar00<?php
class Category2 extends Zend_Db_Table
{
	protected $_name = 'category2';
	protected $_primary = 'ID';

    public function updateTreeInLineAsPathOfChilds($idParent, $updateCurrent) { 
        
        $i = 0;
        if ($updateCurrent){
            $sqlCurrent = "SELECT c.ID ID, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS, c.IDPARENT IDPARENT, c.NAVNOM NAVNOM FROM category2 c WHERE c.ID = ".$idParent." ORDER BY c.NOM ASC ";
            $dataCurrent = $this->getAdapter()->fetchRow($sqlCurrent);  
            if ($dataCurrent) {
                $dataCurrent['NAVNOM_URLPARENTS'] = $this->getTreeInLineAsPathOf($idParent);
                $this->update($dataCurrent, 'ID = '.$idParent);
                $i++;
            }
        }
        
        $sql = "SELECT c.ID ID, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS, c.IDPARENT IDPARENT, c.NAVNOM NAVNOM FROM category2 c WHERE c.IDPARENT = ".$idParent." ORDER BY c.NOM ASC ";
        $cats =  $this->getAdapter()->fetchAll($sql);
        foreach($cats as $row)
        { 
            $row['NAVNOM_URLPARENTS'] = $this->getTreeInLineAsPathOf($row['ID']);
            $this->update($row, 'ID = '.$row['ID']);
            
            $i += $this->updateTreeInLineAsPathOfChilds($row['ID'], false);            
            $i++;
        }   
        return $i;
    }
	
	public function generateAllCategoriesMenu($idCat) {
		$dataResult = $this->computeCategoryChildToArray($idCat, 0);
		return $dataResult;
	}

	private function computeCategoryChildsOneArray($idParent, $result) {
		$dataChilds = $this->getCategoryByParent($idParent);

		$dataResult = array(
			'PARENT' => $idParent,
			'CHILDS' => $dataChilds
		);
		array_push($result, $dataResult);
		if (!empty($dataChilds) && sizeof($dataChilds) > 0) {
			foreach($dataChilds as $row) { 
				$result = $this->computeCategoryChildsOneArray($row['ID'], $result);
			}
		}
		return $result;
	}

	private function computeCategoryChildToArray($idParent, $level) {
		$dataChilds = $this->getCategoryByParent($idParent);  
		if (!empty($dataChilds) && sizeof($dataChilds) > 0) { 
			$dataReturn = array(); 
			foreach($dataChilds as $row) {                 
				$data = array(
					'CHILDS' => $this->computeCategoryChildToArray($row['ID'], $level + 1),
					'CATEGORIE' => $row,
					'LEVEL' => $level
				);
				array_push($dataReturn, $data);
			} 
			return $dataReturn;
		} else { return array(); }
	}

	private function getCategoryByParent($idParent) {
		$sql = "SELECT c.ID ID, c.NOM NOM, c.URL URL, c.NAVNOM NAVNOM,c.DESCRIPTION DESCRIPTION, c.isACTIVE isACTIVE, c.IDPARENT IDPARENT, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS FROM category2 c WHERE c.IDPARENT = ".$idParent." AND c.isACTIVE = 1";
		if ($idParent == 0) {
			$sql .= " ORDER BY c.ID ASC";
		} else {
			$sql .= " ORDER BY c.NOM ASC";
		} 
		return $this->getAdapter()->fetchAll($sql);
	}

	/**
     *
     * Getters
     *
     */
	public function getParentFirstOf($idCat) {
		$sql = "SELECT DISTINCT c0.ID ID, c0.NOM NOM, c0.IDPARENT IDPARENT , c0.NAVNOM NAVNOM
				FROM category2 AS c0
				LEFT JOIN category2 AS c1 ON c1.IDPARENT = c0.ID
				LEFT JOIN category2 AS c2 ON c2.IDPARENT = c1.ID
				LEFT JOIN category2 AS c3 ON c3.IDPARENT = c2.ID 
				LEFT JOIN category2 AS c4 ON c4.IDPARENT = c3.ID 
				LEFT JOIN category2 AS c5 ON c5.IDPARENT = c4.ID 
				LEFT JOIN category2 AS c6 ON c6.IDPARENT = c5.ID 
				LEFT JOIN category2 AS c7 ON c7.IDPARENT = c6.ID 
				LEFT JOIN category2 AS c8 ON c8.IDPARENT = c7.ID 
				LEFT JOIN category2 AS c9 ON c9.IDPARENT = c8.ID 
				LEFT JOIN category2 AS c10 ON c10.IDPARENT = c9.ID 
				WHERE ( c0.ID = ".$idCat."  
				OR c1.ID = ".$idCat." 
				OR c2.ID = ".$idCat." 
				OR c3.ID = ".$idCat." 
				OR c4.ID = ".$idCat." 
				OR c5.ID = ".$idCat." 
				OR c6.ID = ".$idCat." 
				OR c7.ID = ".$idCat." 
				OR c8.ID = ".$idCat." 
				OR c9.ID = ".$idCat." 
				OR c10.ID = ".$idCat." )
				ORDER BY c0.IDPARENT ASC 
				";
        
		return $this->getAdapter()->fetchRow($sql);
	}
    
    public function getTreeInLineAsPathOf($idCat) {
		$sql = "SELECT DISTINCT c0.ID ID, c0.NOM NOM, c0.IDPARENT IDPARENT , c0.NAVNOM NAVNOM, c0.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
				FROM category2 AS c0
				LEFT JOIN category2 AS c1 ON c1.IDPARENT = c0.ID
				LEFT JOIN category2 AS c2 ON c2.IDPARENT = c1.ID
				LEFT JOIN category2 AS c3 ON c3.IDPARENT = c2.ID 
				LEFT JOIN category2 AS c4 ON c4.IDPARENT = c3.ID 
				LEFT JOIN category2 AS c5 ON c5.IDPARENT = c4.ID 
				LEFT JOIN category2 AS c6 ON c6.IDPARENT = c5.ID 
				LEFT JOIN category2 AS c7 ON c7.IDPARENT = c6.ID 
				LEFT JOIN category2 AS c8 ON c8.IDPARENT = c7.ID 
				LEFT JOIN category2 AS c9 ON c9.IDPARENT = c8.ID 
				LEFT JOIN category2 AS c10 ON c10.IDPARENT = c9.ID 
				WHERE ( c0.ID = ".$idCat."  
				OR c1.ID = ".$idCat." 
				OR c2.ID = ".$idCat." 
				OR c3.ID = ".$idCat." 
				OR c4.ID = ".$idCat." 
				OR c5.ID = ".$idCat." 
				OR c6.ID = ".$idCat." 
				OR c7.ID = ".$idCat." 
				OR c8.ID = ".$idCat." 
				OR c9.ID = ".$idCat." 
				OR c10.ID = ".$idCat." )
				ORDER BY c0.IDPARENT ASC 
				";      
		$mylinks = array();
		$links = $this->getAdapter()->fetchAll($sql);

        $result = $links[0]['NAVNOM'];
        
        if ($links[0]['IDPARENT'] == 0) {
            $result = $links[0]['NAVNOM_URLPARENTS'];
        }
        
		$mylinks[0]['ID'] = $links[0]['ID'];
		$j=0;
		for ($i=1;$i<sizeof($links);$i++) {
			foreach ($links as $link) {
				if($link['IDPARENT'] == $mylinks[$j]['ID'] && $link['ID'] != $idCat) {
					$mylinks[$i]['ID'] = $link['ID'];
					$result .= "/".$link['NAVNOM'];
					$j++;
					break;
				}
			}
		}
		return $result;
	}
    
	public function getTreeInLineOf($idCat) {
		$sql = "SELECT DISTINCT c0.ID ID, c0.NOM NOM, c0.IDPARENT IDPARENT , c0.NAVNOM NAVNOM, c0.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
				FROM category2 AS c0
				LEFT JOIN category2 AS c1 ON c1.IDPARENT = c0.ID
				LEFT JOIN category2 AS c2 ON c2.IDPARENT = c1.ID
				LEFT JOIN category2 AS c3 ON c3.IDPARENT = c2.ID 
				LEFT JOIN category2 AS c4 ON c4.IDPARENT = c3.ID 
				LEFT JOIN category2 AS c5 ON c5.IDPARENT = c4.ID 
				LEFT JOIN category2 AS c6 ON c6.IDPARENT = c5.ID 
				LEFT JOIN category2 AS c7 ON c7.IDPARENT = c6.ID 
				LEFT JOIN category2 AS c8 ON c8.IDPARENT = c7.ID 
				LEFT JOIN category2 AS c9 ON c9.IDPARENT = c8.ID 
				LEFT JOIN category2 AS c10 ON c10.IDPARENT = c9.ID 
				WHERE ( c0.ID = ".$idCat."  
				OR c1.ID = ".$idCat." 
				OR c2.ID = ".$idCat." 
				OR c3.ID = ".$idCat." 
				OR c4.ID = ".$idCat." 
				OR c5.ID = ".$idCat." 
				OR c6.ID = ".$idCat." 
				OR c7.ID = ".$idCat." 
				OR c8.ID = ".$idCat." 
				OR c9.ID = ".$idCat." 
				OR c10.ID = ".$idCat." )
				ORDER BY c0.IDPARENT ASC 
				";
		$mylinks = array();
		$links = $this->getAdapter()->fetchAll($sql);

		$mylinks[0]['ID'] = $links[0]['ID'];
		$mylinks[0]['NOM'] = $links[0]['NOM'];
		$mylinks[0]['IDPARENT'] = $links[0]['IDPARENT'];
		$mylinks[0]['NAVNOM'] = $links[0]['NAVNOM'];
		$mylinks[0]['NAVNOM_URLPARENTS'] = $links[0]['NAVNOM_URLPARENTS'];
		$j=0;
		for ($i=1;$i<sizeof($links);$i++) {
			foreach ($links as $link) {
				if($link['IDPARENT'] == $mylinks[$j]['ID']) {
					$mylinks[$i]['ID'] = $link['ID'];
					$mylinks[$i]['NOM'] = $link['NOM'];
					$mylinks[$i]['IDPARENT'] = $link['IDPARENT'];
					$mylinks[$i]['NAVNOM'] = $link['NAVNOM'];
					$mylinks[$i]['NAVNOM_URLPARENTS'] = $link['NAVNOM_URLPARENTS'];
					$j++;
					break;
				}
			}
		}
		return $mylinks;
	}
	public function getTreeCatsOfParent($idCat) {
        
		$sql = "SELECT c0.NOM NOM0, c1.NOM NOM1,
						c0.URL URL0, c1.URL URL1,
						c0.ID ID0, c1.ID ID1,
						c0.isACTIVE isACTIVE0, c1.isACTIVE isACTIVE1,
						c0.IDPARENT IDPARENT0, c1.IDPARENT IDPARENT1,
						c0.NAVNOM NAVNOM0, c1.NAVNOM NAVNOM1,
						c0.DESCRIPTION DESCRIPTION0, c1.DESCRIPTION DESCRIPTION1,
						c0.NAVNOM_URLPARENTS NAVNOM_URLPARENTS0, c1.NAVNOM_URLPARENTS NAVNOM_URLPARENTS1
				FROM category2 AS c0
				LEFT JOIN category2 AS c1 ON c1.IDPARENT = c0.ID
				WHERE c0.IDPARENT = ".$idCat."
				ORDER BY c0.ID,c1.ID ASC;
				";
		$results = $this->getAdapter()->fetchAll($sql);
        
		$listCat = array();
		$i = 0;
		$j = 0;
		$idParent = 0;
		$isNew = true;
		$isFirst = true;
		foreach($results as $row) {
			if ($row['ID0'] != $idParent) {
				$idParent = $row['ID0'];
				$isNew = true;
				$i++;
				$j = 0 ;
				if ($isFirst) {$i = 0; $isFirst = false;}
			} else {
				$isNew = false;
			}
			if ($isNew) {
				if ($row['isACTIVE0'] == true) {
					$listCat[$i]['NOM'] = $row['NOM0'];
					$listCat[$i]['ID'] = $row['ID0'];
					$listCat[$i]['URL'] = $row['URL0'];
					$listCat[$i]['NAVNOM'] = $row['NAVNOM0'];
					$listCat[$i]['DESCRIPTION'] = $row['DESCRIPTION0'];
					$listCat[$i]['isACTIVE'] = $row['isACTIVE0'];
					$listCat[$i]['NAVNOM_URLPARENTS'] = $row['NAVNOM_URLPARENTS0'];
					$listCat[$i]['SUBS'] = array();
				}
			}

			if ($row['isACTIVE1'] == true) {
				$listCat[$i]['SUBS'][$j]['NOM'] = $row['NOM1'];
				$listCat[$i]['SUBS'][$j]['ID'] = $row['ID1'];
				$listCat[$i]['SUBS'][$j]['URL'] = $row['URL1'];
				$listCat[$i]['SUBS'][$j]['DESCRIPTION'] = $row['DESCRIPTION1'];
				$listCat[$i]['SUBS'][$j]['NAVNOM'] = $row['NAVNOM1'];
				$listCat[$i]['SUBS'][$j]['isACTIVE'] = $row['isACTIVE1'];
				$listCat[$i]['SUBS'][$j]['NAVNOM_URLPARENTS'] = $row['NAVNOM_URLPARENTS1'];
				$j++;
			}
		}
		return $listCat;
        
	}
	public function getTreeCatsOf($idCat) {
		$sql = "SELECT c0.NOM NOM0, c1.NOM NOM1,
						c0.NAVTITRENOM NAVTITRENOM0, c1.NAVTITRENOM NAVTITRENOM1,
						c0.NAVDESCRIPTION NAVDESC0, c1.NAVDESCRIPTION NAVDESC1,
						c0.URL URL0, c1.URL URL1,
						c0.ID ID0, c1.ID ID1,
						c0.IDPARENT IDPARENT0, c1.IDPARENT IDPARENT1,
						c0.NAVNOM NAVNOM0, c1.NAVNOM NAVNOM1,
						c0.DESCRIPTION DESCRIPTION0, c1.DESCRIPTION DESCRIPTION1,
						c0.KEYWORDS KEYWORDS0, c1.KEYWORDS KEYWORDS1,
						c0.CHOICEURL CHOICEURL0, c1.CHOICEURL CHOICEURL1,
						c0.CHOICEDOC CHOICEDOC0, c1.CHOICEDOC CHOICEDOC1,
						c0.isACTIVE isACTIVE0, c1.isACTIVE isACTIVE1,
						c0.NAVNOM_URLPARENTS NAVNOM_URLPARENTS0, c1.NAVNOM_URLPARENTS NAVNOM_URLPARENTS1,
						(Select count(1) from product as p where p.idcategory = c1.id and p.isactive = 0) NBPRODUCT
				FROM category2 AS c0
				LEFT JOIN category2 AS c1 ON c1.IDPARENT = c0.ID
				WHERE c0.ID = ".$idCat."  
				ORDER BY c0.NOM,c1.NOM ASC;
				";
		$results = $this->getAdapter()->fetchAll($sql);
		$listCat = array();
		$j = 0;
		$isNew = true;
		foreach($results as $row) {
			if ($isNew == true) {
				$listCat['NOM'] = $row['NOM0'];
				$listCat['NAVTITRENOM'] = $row['NAVTITRENOM0'];
				$listCat['NAVDESCRIPTION'] = $row['NAVDESC0'];
				$listCat['ID'] = $row['ID0'];
				$listCat['URL'] = $row['URL0'];
				$listCat['NAVNOM'] = $row['NAVNOM0'];
				$listCat['KEYWORDS'] = $row['KEYWORDS0'];
				$listCat['DESCRIPTION'] = $row['DESCRIPTION0'];
				$listCat['CHOICEURL'] = $row['CHOICEURL0'];
				$listCat['CHOICEDOC'] = $row['CHOICEDOC0'];
				$listCat['isACTIVE'] = $row['isACTIVE0'];
				$listCat['NAVNOM_URLPARENTS'] = $row['NAVNOM_URLPARENTS0'];
				$listCat['IDPARENT'] = $row['IDPARENT0'];
				$listCat['SUBS'] = array();
				if (!empty($row['isACTIVE1']) && $row['isACTIVE1'] == true) {
					if (!empty($row['NOM1'])) {
						$listCat['SUBS'][$j]['NOM'] = $row['NOM1'];
						$listCat['SUBS'][$j]['NAVTITRENOM'] = $row['NAVTITRENOM1'];
						$listCat['SUBS'][$j]['NAVDESCRIPTION'] = $row['NAVDESC1'];
						$listCat['SUBS'][$j]['ID'] = $row['ID1'];
						$listCat['SUBS'][$j]['URL'] = $row['URL1'];
						$listCat['SUBS'][$j]['DESCRIPTION'] = $row['DESCRIPTION1'];
						$listCat['SUBS'][$j]['KEYWORDS'] = $row['KEYWORDS1'];
						$listCat['SUBS'][$j]['NAVNOM'] = $row['NAVNOM1'];
						$listCat['SUBS'][$j]['CHOICEURL'] = $row['CHOICEURL1'];
						$listCat['SUBS'][$j]['CHOICEDOC'] = $row['CHOICEDOC1'];
						$listCat['SUBS'][$j]['isACTIVE'] = $row['isACTIVE1'];
						$listCat['SUBS'][$j]['NAVNOM_URLPARENTS'] = $row['NAVNOM_URLPARENTS1'];
						$listCat['SUBS'][$j]['NBPRODUCT'] = $row['NBPRODUCT'];
						$listCat['SUBS'][$j]['IDPARENT'] = $row['IDPARENT1'];
						$j++;
					}
				}
				$isNew = false;
			} else {
				if (!empty($row['isACTIVE1']) && $row['isACTIVE1'] == true) {
					$listCat['SUBS'][$j]['NOM'] = $row['NOM1'];
					$listCat['SUBS'][$j]['NAVTITRENOM'] = $row['NAVTITRENOM1'];
					$listCat['SUBS'][$j]['NAVDESCRIPTION'] = $row['NAVDESC1'];
					$listCat['SUBS'][$j]['ID'] = $row['ID1'];
					$listCat['SUBS'][$j]['URL'] = $row['URL1'];
					$listCat['SUBS'][$j]['DESCRIPTION'] = $row['DESCRIPTION1'];
					$listCat['SUBS'][$j]['KEYWORDS'] = $row['KEYWORDS1'];
					$listCat['SUBS'][$j]['NAVNOM'] = $row['NAVNOM1'];
					$listCat['SUBS'][$j]['CHOICEURL'] = $row['CHOICEURL1'];
					$listCat['SUBS'][$j]['CHOICEDOC'] = $row['CHOICEDOC1'];
					$listCat['SUBS'][$j]['isACTIVE'] = $row['isACTIVE1'];
					$listCat['SUBS'][$j]['NAVNOM_URLPARENTS'] = $row['NAVNOM_URLPARENTS1'];
					$listCat['SUBS'][$j]['NBPRODUCT'] = $row['NBPRODUCT'];
					$listCat['SUBS'][$j]['IDPARENT'] = $row['IDPARENT1'];
					$j++;
				}
			}

		}
		return $listCat;
	}

	public function getAllCategoriesByID ($idParent) {
		$sql = "
		SELECT c0.NOM NOM0, c1.NOM NOM1, c2.NOM NOM2, c3.NOM NOM3, c4.NOM NOM4, c5.NOM NOM5, 
				c6.NOM NOM6, c7.NOM NOM7, c8.NOM NOM8, c9.NOM NOM9, c10.NOM NOM10,
				c0.isACTIVE isACTIVE0, c1.isACTIVE isACTIVE1, c2.isACTIVE isACTIVE2, c3.isACTIVE isACTIVE3, c4.isACTIVE isACTIVE4, c5.isACTIVE isACTIVE5, 
				c6.isACTIVE isACTIVE6, c7.isACTIVE isACTIVE7, c8.isACTIVE isACTIVE8, c9.isACTIVE isACTIVE9, c10.isACTIVE isACTIVE10,
				c0.URL URL0, c1.URL URL1, c2.URL URL2, c3.URL URL3, c4.URL URL4, c5.URL URL5, 
				c6.URL URL6, c7.URL URL7, c8.URL URL8, c9.URL URL9, c10.URL URL10,
				c0.ID ID0, c1.ID ID1, c2.ID ID2, c3.ID ID3, c4.ID ID4, c5.ID ID5, 
				c6.ID ID6, c7.ID ID7, c8.ID ID8, c9.ID ID9, c10.ID ID10,
				c0.IDPARENT IDPARENT0, c1.IDPARENT IDPARENT1, c2.IDPARENT IDPARENT2, c3.IDPARENT IDPARENT3, c4.IDPARENT IDPARENT4, c5.IDPARENT IDPARENT5, 
				c6.IDPARENT IDPARENT6, c7.IDPARENT IDPARENT7, c8.IDPARENT IDPARENT8, c9.IDPARENT IDPARENT9, c10.IDPARENT IDPARENT10
		FROM category2 AS c0
		LEFT JOIN category2 AS c1 ON c1.IDPARENT = c0.ID
		LEFT JOIN category2 AS c2 ON c2.IDPARENT = c1.ID
		LEFT JOIN category2 AS c3 ON c3.IDPARENT = c2.ID 
		LEFT JOIN category2 AS c4 ON c4.IDPARENT = c3.ID 
		LEFT JOIN category2 AS c5 ON c5.IDPARENT = c4.ID 
		LEFT JOIN category2 AS c6 ON c6.IDPARENT = c5.ID 
		LEFT JOIN category2 AS c7 ON c7.IDPARENT = c6.ID 
		LEFT JOIN category2 AS c8 ON c8.IDPARENT = c7.ID 
		LEFT JOIN category2 AS c9 ON c9.IDPARENT = c8.ID 
		LEFT JOIN category2 AS c10 ON c10.IDPARENT = c9.ID 
		WHERE c0.IDPARENT = ".$idParent."
		ORDER BY c0.ID,c1.NOM,c2.NOM,c3.NOM,c4.NOM,c5.NOM,c6.NOM,c7.NOM,c8.NOM,c9.NOM,c10.NOM ASC;
    	"; 
		return $this->getAdapter()->fetchAll($sql);
	}
	
    public function getAllCategoriesIDByID ($idParent) {
		$sql = "
		SELECT c0.ID ID0, c1.ID ID1, c2.ID ID2, c3.ID ID3, c4.ID ID4, c5.ID ID5, 
				c6.ID ID6, c7.ID ID7, c8.ID ID8, c9.ID ID9, c10.ID ID10
		FROM category2 AS c0
		LEFT JOIN category2 AS c1 ON c1.IDPARENT = c0.ID
		LEFT JOIN category2 AS c2 ON c2.IDPARENT = c1.ID
		LEFT JOIN category2 AS c3 ON c3.IDPARENT = c2.ID 
		LEFT JOIN category2 AS c4 ON c4.IDPARENT = c3.ID 
		LEFT JOIN category2 AS c5 ON c5.IDPARENT = c4.ID 
		LEFT JOIN category2 AS c6 ON c6.IDPARENT = c5.ID 
		LEFT JOIN category2 AS c7 ON c7.IDPARENT = c6.ID 
		LEFT JOIN category2 AS c8 ON c8.IDPARENT = c7.ID 
		LEFT JOIN category2 AS c9 ON c9.IDPARENT = c8.ID 
		LEFT JOIN category2 AS c10 ON c10.IDPARENT = c9.ID 
		WHERE c0.IDPARENT = ".$idParent;   
		return $this->getAdapter()->fetchAll($sql);
	}
    
	public function getIdCatFromProductId($idProd) {
		$sql = "
		SELECT p.IDCATEGORY ID
		FROM product AS p
		WHERE p.ID = ".$idProd;
		$data = $this->getAdapter()->fetchRow($sql);
		return $data['ID'];
	}
	
	public function getAllSubsIDByIDToString($idCat) {
        if ($idCat != null && (int)$idCat > 0) {
		    $listCat = $this->getAllCategoriesIDByID($idCat);
		    $listTemp = array();
		    $value = 'ID';
		    $listCatString = $idCat;
		
		    //list of sub cats
		    foreach ($listCat as $row) {
			    for ($level=0 ; $level<11; $level++) {
				    if ((!isset($listTemp[$value.$level]) || $listTemp[$value.$level] != $row[$value.$level]) && $row[$value.$level] != null) {
					    $listTemp[$value.$level] = $row[$value.$level];
					    if ($listCatString !="") {
						    $listCatString .= ' ,'.$row[$value.$level];
					    } else {
						    $listCatString = $row[$value.$level];
					    }
				    } 
			    }
		    }
		    return $listCatString;
        }
        return "";
	}


	public function getAllCategoriesProperties() {
		$sql = "SELECT c.ID ID, c.NOM NOM, c.URL URL, c.NAVNOM NAVNOM, c.isACTIVE isACTIVE FROM category2 c ORDER BY c.NOM ASC ";
		$cats = $this->getAdapter()->fetchAll($sql);
		$data = array();
		foreach($cats as $row)
		{
			$data[$row['ID']] = array(
				'ID' => $row['ID'],
				'NOM' => $row['NOM'],
				'URL' => $row['URL'],
				'NAVNOM' => $row['NAVNOM'],
				'isACTIVE' => $row['isACTIVE']
			);
		}
		return $data;
	}

	private function getCategoryById($idCat) {
		$sql = "SELECT c.ID ID, c.NOM NOM, c.URL URL, c.NAVNOM NAVNOM FROM category2 c WHERE c.ID = ".$idCat." ORDER BY c.NOM ASC";
		$cats = $this->getAdapter()->fetchAll($sql);
		$data = array();
		foreach ($cats AS $row) {
			$data[$row['ID']] = $row['NOM'];
		}
		return $data;
	} 
}
?>models/AnnonceLeft.php000060400000001071150710367660010742 0ustar00<?php
class AnnonceLeft extends Zend_Db_Table
{
    protected $_name = 'annonce_left';
    protected $_primary = 'ID';

    public function getAnnonces() {
    	return $this->select()->where('isSHOW = 0')->order('NOM ASC')->query()->fetchAll();
	}
	

    public function getAllAnnonces() {
    	return $this->select()->order('NOM ASC')->query()->fetchAll();
	}
	
 	public function getAnnoncesByShow($idCat) {
 		return $this->select()->where('isSHOW = 0')->where("ID_CATS LIKE '%:".$idCat.":%' OR ID_CATS LIKE '%:0:%' ")->order('NOM ASC')->query()->fetchAll();
 	}
}
?>models/Picture.php000060400000000432150710367660010161 0ustar00<?php
class Picture extends Zend_Db_Table
{
    protected $_name = 'picture';
    protected $_primary = 'ID';

	public function getAllByIdProduct($id) {
    	return $this->select()->where('IDPRODUCT = '.$id)->order('POSITION ASC')->query()->fetchAll();
   }
    
    
    
    
}
?>models/PromoUser.php000060400000006536150710367660010514 0ustar00<?php
class PromoUser extends Zend_Db_Table
{
    protected $_name = 'promo_user';
    protected $_primary = 'ID';
    
 	/*
	 * Remise selon la marque et l'user
	 */
    public function getRemiseByMarque($idbrend, $iduser) {  try {
   		return $this->select()->where("USERIDBREND = ?", $iduser)->where("USERBRENDID = ?", $idbrend)->query()->fetch();
   		} catch (Zend_Exception $e) { return array(); }
    } 
    public function getRemiseByMarqueFull($iduser) {  try {
    	$sql = "SELECT u.NOM NOM,u.ID IDUSER, u.PRENOM PRENOM, 
				pu.ID ID, pu.REMISEEURO REMISEEURO, pu.REMISEPOUR REMISEPOUR, pu.USERIDBREND USERIDBREND, pu.USERBRENDID USERBRENDID, sb.BREND BREND, sb.IDSUPPLIER IDSUPPLIER
				FROM promo_user AS pu
				LEFT JOIN user AS u ON u.ID = pu.USERIDBREND
				LEFT JOIN supplier_brend AS sb ON sb.ID = pu.USERBRENDID
				WHERE pu.USERIDBREND IS NOT NULL
				AND pu.USERBRENDID IS NOT NULL
				AND u.ID = ".$iduser."
				ORDER BY u.NOM, u.PRENOM ASC";
		return $this->getAdapter()->fetchAll($sql); 
   		} catch (Zend_Exception $e) { return array(); }
    } 
    
 	/*
	 * Remise selon la marque et le code intern
	 */
    public function getRemiseByCodeInternMarque($idbrend, $codeintern) { try {
    	return $this->select()->where("CINTERNIDBREND = ?", $codeintern)->where("CINTERNBRENDID = ?", $idbrend)->query()->fetch();
   		} catch (Zend_Exception $e) { return array(); }
    } 
 	public function getRemiseByCodeInternMarqueFull($codeintern) { try {  
    	$sql = "SELECT pu.ID ID, pu.REMISEEURO REMISEEURO, pu.REMISEPOUR REMISEPOUR, uci.LABEL LABELINTERN, uci.CODE CODEINTERN,
			pu.CINTERNIDBREND CINTERNIDBREND, sb.BREND BREND, pu.CINTERNBRENDID CINTERNBRENDID, sb.IDSUPPLIER IDSUPPLIER, u.ID IDUSER
				FROM promo_user AS pu
				LEFT JOIN user_cintern AS uci ON uci.ID = pu.CINTERNIDBREND
				LEFT JOIN user AS u ON u.CODEINTERN = pu.CINTERNIDBREND
				LEFT JOIN supplier_brend AS sb ON sb.ID = pu.CINTERNBRENDID
				WHERE pu.CINTERNIDBREND IS NOT NULL 
				AND pu.CINTERNBRENDID IS NOT NULL 
				AND pu.CINTERNIDBREND = '".$codeintern."' 
				ORDER BY uci.CODE,sb.BREND ASC"; 
		return $this->getAdapter()->fetchAll($sql);
   		} catch (Zend_Exception $e) { return array(); }
 	}
 	/*
	 * Remise selon la date d'inscription
	 */
    public function getRemiseByDateInscription() { try {  
    	return $this->select()->where('isDATEINSCR IS NOT NULL AND isDATEINSCR = 0')->query()->fetch();
   		} catch (Zend_Exception $e) { return array(); }
    }

 	/*
	 * Remise selon l'id de l'user
	 */
    public function getRemiseByUserID($id) { try {  
    	return $this->select()->where('IDUSER IS NOT NULL AND IDUSER = ?', $id)->query()->fetch();
   		} catch (Zend_Exception $e) { return array(); }
    }
    public function getRemiseByUserIDFull($id) { try {
    	$sql = "SELECT u.NOM NOM,u.ID IDUSER, u.PRENOM PRENOM, 
				pu.ID ID, pu.REMISEEURO REMISEEURO, pu.REMISEPOUR REMISEPOUR
				FROM promo_user AS pu
				LEFT JOIN user AS u ON pu.IDUSER = u.ID
				WHERE pu.IDUSER IS NOT NULL
				AND u.ID = ".$id;  
    	return $this->getAdapter()->fetchRow($sql);
   		} catch (Zend_Exception $e) { return array(); }
    }
 	/*
	 * Remise pour la premiere commande
	 */
    public function getRemiseByIsFirstCommand() { try {  
    	return $this->select()->where('isFIRSTCMD IS NOT NULL AND isFIRSTCMD = 0')->query()->fetch();
   		} catch (Zend_Exception $e) { return array(); }
    }

    
    
    
}
?>models/UserNewsletter.php000060400000000202150710367660011534 0ustar00<?php
class UserNewsletter extends Zend_Db_Table
{
    protected $_name = 'user_newsletter';
    protected $_primary = 'ID';

}
?>models/FooterContent.php000060400000000200150710367660011330 0ustar00<?php
class FooterContent extends Zend_Db_Table
{
    protected $_name = 'footer_content';
    protected $_primary = 'ID';

}
?>models/ParamIp.php000060400000000172150710367660010100 0ustar00<?php
class ParamIp extends Zend_Db_Table
{
    protected $_name = 'admin_param_ip';
    protected $_primary = 'ID';

}
?>models/Admin.php000060400000000164150710367660007600 0ustar00<?php
class Admin extends Zend_Db_Table
{
    protected $_name = 'user_admin';
    protected $_primary = 'ID';

}
?>models/ProductOption.php000060400000000661150710367660011363 0ustar00<?php
class ProductOption extends Zend_Db_Table
{
    protected $_name = 'product_option';
    protected $_primary = 'ID';

	public function getOptionsByIdProduct($id) {
    	$select = "
						SELECT po.ID ID, o.NOM NOMOPTION, po.IDOPTION IDOPTION
						FROM product_option AS po
						LEFT JOIN `option` AS o ON o.ID = po.IDOPTION
						WHERE po.IDPRODUCT = ".$id;
    	return $this->getAdapter()->fetchAll($select);
    }
    
}
?>models/ProductAccessoire.php000060400000007521150710367660012175 0ustar00<?php
class ProductAccessoire extends Zend_Db_Table
{
    protected $_name = 'product_acc';
    protected $_primary = 'ID';
    
    
    public function getAccessoiresByProductIDOld($id, $triSql) {
    	$results = array();
    	try { 
    		$select = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM PRODNAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
							p.isPROMO isPROMO, pic.URL URL, sb.BREND BREND, sb.URL BRENDURL, COUNT(pc.REFERENCE) NBREFERENCE, 
							c.NAVNOM CATNAVNOM, p.isSHOWBREND isSHOWBREND, p.KEYWORDS KEYWORDS_PROD, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS,
                            c.NOM CATNOM, p.BOOSTED_BESTSELLER BOOSTED_BESTSELLER
							FROM product_acc pa
							LEFT JOIN product AS p ON pa.IDACCESSOIRE = p.ID 
							LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
							LEFT JOIN category c ON c.ID = p.IDCATEGORY 
							LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
							LEFT JOIN productchild pc ON pc.IDPRODUCT = p.ID 
							WHERE pa.IDPRODUCT = ".$id." 
							AND p.isACTIVE = 0
							AND pic.POSITION = 1
							GROUP BY ID
							ORDER BY ".$triSql;
    		
			$results = $this->getAdapter()->fetchAll($select);
    	} catch (Zend_Exception $e) { }
    	return $results;
    }
    
	public function getAccessoiresByProductID($id, $triSql) {
    	$results = array();
    	try {  
    		$select = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM PRODNAVNOM,pic.URL URL,
    						pc.REFERENCE REFERENCE, pc.DESIGNATION DESIGNATION, 
    						pa.ID IDACCESSOIRE , c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
                            , p.BOOSTED_BESTSELLER BOOSTED_BESTSELLER
							FROM product_acc pa
							LEFT JOIN productchild pc ON pa.REFACCESSOIRE = pc.REFERENCE
							LEFT JOIN product AS p ON pc.IDPRODUCT = p.ID 
							LEFT JOIN category c ON c.ID = p.IDCATEGORY 
							LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
							WHERE pa.IDPRODUCT = ".$id."  
							AND pic.POSITION = 1
							ORDER BY ".$triSql;
    		
			$results = $this->getAdapter()->fetchAll($select);
    	} catch (Zend_Exception $e) { }
    	return $results;
    } 
    
	public function getAccessoiresOptionsByProductID($id) {
    	$results = array();
    	try {  
    		// meme select que ProductChild->getProductChildsByIdProduct sauf que l'on recupere les accessoires
    		$select = "SELECT pc.ID ID ,pc.REFERENCE REFERENCE,pc.DESIGNATION DESIGNATION,pc.PRIX PRIX, pc.isPROMO isPROMO ,
					pco.VALUE OPTIONVALUE, pco.IDOPTION OPTIONID, pc.IMAGEPROMO IMAGEPROMO,pc.isDEVIS isDEVIS, pc.QUANTITYMIN QUANTITYMIN
					, p.NAVNOM PRODUCTNAVNOM, p.NOM PRODUCTNOM, p.ID PRODUCTID, p.isQTEPRIXACTIVE isQTEPRIXACTIVE, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
                    , p.BOOSTED_BESTSELLER BOOSTED_BESTSELLER
					FROM product_acc pa
					LEFT JOIN productchild AS pc ON pa.REFACCESSOIRE = pc.REFERENCE
					LEFT JOIN productchild_option AS pco ON pc.ID = pco.IDPRODUCTCHILD
					LEFT JOIN product AS p ON pc.IDPRODUCT = p.ID
					LEFT JOIN category c ON c.ID = p.IDCATEGORY 
					WHERE pa.IDPRODUCT = ".$id;  
			$results = $this->getAdapter()->fetchAll($select);
    	} catch (Zend_Exception $e) { } 
    	return $results;
    } 
    
    
    public function insertAccessoire($idproduct, $refaccessoire) {
    	try {
    		$select = " 
				SELECT COUNT(pa.ID) NBR
				FROM product_acc pa 
				WHERE pa.IDPRODUCT = ".$idproduct."
				AND pa.REFACCESSOIRE LIKE '".$refaccessoire."'"; 
			 
    		$result = $this->getAdapter()->fetchRow($select);
    		
    		if ($result['NBR'] == 0) { 
	    		$data = array (
	    			'IDPRODUCT' => $idproduct,
	    			'REFACCESSOIRE' => $refaccessoire
	    		);
    			$this->insert($data);
    			return true;
    		} 
    	} catch (Zend_Exception $e) { }
    	return false;
    }

    public function deleteAccessoire($idaccessoire) {
    	try {  
    		$this->delete("ID = ".$idaccessoire); 
    	} catch (Zend_Exception $e) { }
    }
    
 
}
?>models/ProductChildQte.php000060400000005763150710367660011620 0ustar00<?php
class ProductChildQte extends Zend_Db_Table
{
	protected $_name = 'productchild_qte';
	protected $_primary = 'ID';

	public function getCurrentLowestPrice($id, $price) { 
		try {
			$select = "SELECT MIN(pcq.PRIX) PRIX			 
					FROM productchild_qte AS pcq
					LEFT JOIN productchild AS pc ON pcq.IDPRODUCTCHILD = pc.ID
					LEFT JOIN product AS p ON pc.IDPRODUCT = p.ID 
					WHERE pcq.IDPRODUCTCHILD = ".$id."
					AND p.isQTEPRIXACTIVE = ".true;
			$result = $this->getAdapter()->fetchRow($select); 
			if (isset($result) && !empty($result) && $result['PRIX'] > 0) { return $result['PRIX']; }
		} catch (Zend_Exception $e) { } 
   		return $price;
	}
	
	public function getCurrentPrice($id, $qte, $price) { 
		try {
			$select = "SELECT pcq.PRIX PRIX			 
					FROM productchild_qte AS pcq
					LEFT JOIN productchild AS pc ON pcq.IDPRODUCTCHILD = pc.ID
					LEFT JOIN product AS p ON pc.IDPRODUCT = p.ID 
					WHERE pcq.IDPRODUCTCHILD = ".$id."
					AND pcq.MIN <= ".$qte."
					AND pcq.MAX >= ".$qte."
					AND p.isQTEPRIXACTIVE = ".true;
			$result = $this->getAdapter()->fetchRow($select); 
			if (isset($result) && !empty($result)) { return $result['PRIX']; }
		} catch (Zend_Exception $e) { } 
   		return $price;
	}
	
	public function getQteByItem($id) {
		$select = "SELECT COUNT(pcq.ID) NBR				
					FROM productchild_qte AS pcq 
					WHERE pcq.IDPRODUCTCHILD = ".$id;
		$result = $this->getAdapter()->fetchRow($select); 
		return $result['NBR'];
	}
	
	public function getAllActiveByItem($id) { 
		$select = "SELECT pc.REFERENCE REFERENCE,pc.DESIGNATION DESIGNATION,
					pcq.MIN MIN, pcq.MAX MAX, pcq.ID ID, pcq.PRIX PRIX					
					FROM productchild_qte AS pcq
					LEFT JOIN productchild AS pc ON pcq.IDPRODUCTCHILD = pc.ID
					LEFT JOIN product AS p ON pc.IDPRODUCT = p.ID 
					WHERE pcq.IDPRODUCTCHILD = ".$id." 
					AND p.isQTEPRIXACTIVE = ".true." 
					ORDER BY REFERENCE ASC, MIN ASC ";  
		return $this->getAdapter()->fetchAll($select);
	}  

	public function isPrixDegressifByProductID($id) {
		$select = "SELECT pc.REFERENCE REFERENCE,pc.DESIGNATION DESIGNATION,
					pcq.MIN MIN, pcq.MAX MAX, pcq.ID ID, pcq.PRIX PRIX,
					p.isQTEPRIXACTIVE isQTEPRIXACTIVE 				
					FROM productchild_qte AS pcq
					LEFT JOIN productchild AS pc ON pcq.IDPRODUCTCHILD = pc.ID
					LEFT JOIN product AS p ON pc.IDPRODUCT = p.ID
					WHERE p.ID = ".$id."  
					AND p.isQTEPRIXACTIVE = ".true." 
					ORDER BY REFERENCE ASC, MIN ASC ";  
		$result = $this->getAdapter()->fetchAll($select);
		if (!empty($result)) { return true; }
		return false;
	}
	
	public function getAllByProduct($id) {
		$select = "SELECT pc.REFERENCE REFERENCE,pc.DESIGNATION DESIGNATION,
					pcq.MIN MIN, pcq.MAX MAX, pcq.ID ID, pcq.PRIX PRIX,
					p.isQTEPRIXACTIVE isQTEPRIXACTIVE 				
					FROM productchild_qte AS pcq
					LEFT JOIN productchild AS pc ON pcq.IDPRODUCTCHILD = pc.ID
					LEFT JOIN product AS p ON pc.IDPRODUCT = p.ID
					WHERE p.ID = ".$id."  
					ORDER BY REFERENCE ASC, MIN ASC ";  
		return $this->getAdapter()->fetchAll($select);
	}
 
}
	 
?>models/LogDefault.php000060400000000172150710367660010575 0ustar00<?php
class LogDefault extends Zend_Db_Table
{
    protected $_name = 'log_default';
    protected $_primary = 'ID';

}
?>models/Option.php000060400000000161150710367660010015 0ustar00<?php
class Option extends Zend_Db_Table
{
    protected $_name = 'option';
    protected $_primary = 'ID';

}
?>models/utils/ItemCaddyType.php000060400000007122150710367660012416 0ustar00<?php
class ItemCaddyType {
	var $id;
	var $qte;

	var $idProduit;
	var $idChild;
	var $idBrend;
	var $nom;
	var $descshort;
	var $navnom;
	var $navnom_urlparents;
	var $url;
	var $designation;
	var $stock = 1;
	var $isAccessoire = 'N';
    var $selectedOption = ""; 

	var $remise_euro = 0;
	var $remise_pour = 0;
	var $isActif;
	var $reference;
	var $idcategory;
	var $promo_date; 

	var $isDevis;
	var $prix;
	var $qte_min;
	
	
	var $isPromoCaddyType = false;

	function ItemCaddyType() { }

	function getItemInfo($id, $qte, $selectedOption) {
		$userCaddyType = new UserCaddyType();
		$result = $userCaddyType->getArticleByCaddyId($id);
			
		$this->id = $id;
		$this->idChild = $result['IDCHILD'];
		$this->idBrend = $result['IDBREND'];
		$this->qte = $qte;
		$this->idProduit = $result['IDPRODUCT'];
		$this->nom = $result['NOM'];
		$this->descshort = $result['DESCSHORT'];
		$this->navnom = $result['NAVNOM'];
		$this->url = $result['URL'];
		$this->designation = $result['DESIGNATION'];
		$this->stock = $result['STOCK'];

		$this->remise_euro = $result['REMISEEURO'];
		$this->remise_pour = $result['REMISEPOUR'];
		$this->isActif = $result['isCADDYTYPE_ACTIF'];

		$this->reference = $result['REFERENCE'];
		$this->idcategory = $result['IDCATEGORY'];
		$this->promo_date = $result['DATEPROMO'];
		
		$this->isDevis = $result['isDEVIS'];
		$this->prix = $result['PRIX'];
		$this->qte_min = $result['QUANTITYMIN']; 
		$this->selectedOption = $selectedOption;
	}

	public function setLineInfo($result, $qte) {
		$this->id = $result['CADDYTYPEID'];
		$this->idChild = $result['IDCHILD'];
		$this->idBrend = $result['IDBREND'];
		$this->qte = $qte;
		$this->idProduit = $result['IDPRODUCT'];
		$this->nom = $result['NOM'];
		$this->descshort = $result['DESCSHORT'];
		$this->navnom = $result['NAVNOM'];
		$this->navnom_urlparents = $result['NAVNOM_URLPARENTS'];
		$this->url = $result['URL'];
		$this->designation = $result['DESIGNATION'];
		$this->stock = $result['STOCK'];

		$this->remise_euro = $result['REMISEEURO'];
		$this->remise_pour = $result['REMISEPOUR'];
		$this->isActif = $result['isCADDYTYPE_ACTIF'];

		$this->reference = $result['REFERENCE'];
		$this->idcategory = $result['IDCATEGORY'];
		$this->promo_date = $result['DATEPROMO'];
		
		$this->isDevis = $result['isDEVIS'];
		$this->prix = $result['PRIX'];
		$this->qte_min = $result['QUANTITYMIN']; 
		
		$selectedOption_tmp = '';
		$optionList = new OptionList();
		$item_optionsByList = $optionList->getByIdProduct($result['IDPRODUCT']);
		if (!empty($item_optionsByList) && !empty($item_optionsByList->values)) {
			foreach($item_optionsByList->values as $currentOption) {	
				$selectedOption_tmp = $currentOption;
				break;
			}
		}	 
		$this->selectedOption = $selectedOption_tmp;
	}

	public function isActif() {
		if($this->isActif == 'Y') { return true ;}
		return false;
	}

	public function isPromo() {
		if ($this->remise_euro > 0 || $this->remise_pour > 0) {  return true; }
		return false;
	}

	public function setRemise($euro, $pour) {
		if ($euro > 0) { $this->remise_euro = $euro; }
		else if ($pour > 0) { $this->remise_pour = $pour; }
	}

	public function isRemiseChanged() {
		if ($this->remise_euro > 0 || $this->remise_pour > 0) { return true; }
		return false;
	}

	public function isSurDevis() {
		if ($this->isDevis == 0) { return true; }
		return false;
	}

	public function getPrixAfterRemise() {
		if ($this->remise_euro > 0) {
			return sprintf("%.2f",$this->prix - $this->remise_euro);
		} else if ($this->remise_pour > 0) {
			return sprintf("%.2f",$this->prix - (($this->prix * $this->remise_pour) / 100));
		}
		return sprintf("%.2f",$this->prix);
	}

}

?>
models/utils/Facture.php000060400000011200150710367660011272 0ustar00<?php
class Facture {
 
	var $facture_fidelite_lines;
	var $facture_lines;
	var $code_reduction; 
	var $livraison;

	var $remise_command_euro = 0;
	var $remise_command_pour = 0;
	var $date_start;

	var $total_poids = 0;
	var $isAncienPoids = false;
	var $isFrancoDenied = false;
	var $isCodeReduction_Product = false;

	var $total_HT_HR = 0;
	var $total_remise = 0;
	var $total_HT = 0;
	var $total_frais_port = 0;
	var $total_frais_port_pour = 0;
	var $total_HT_FP = 0;
	var $total_TVA = 0;
	var $total_TTC = 0;

	var $resteFrancoLiv;
	
	//Dans le casdes caddyType
	var $user_nom;
	var $user_prenom;
	var $user_id;
	  
	function Facture() {
		$this->facture_lines = array();
		$this->facture_fidelite_lines = array();
		$this->code_reduction = array();
		$this->livraison = array();
		 
		$this->setDateStart();
	}

	 
	public function changeTVA($newTVA) {
		$this->tva = $newTVA;
		$this->total_TVA = $this->getPrixTotalTVA(false);
		$this->total_TTC = $this->getPrixTotalTTC(false);
	}

	public function isFactureValid($type) {
		if (isset($this->facture_lines) && !empty($this->facture_lines)) { return true; }
		return false;
	}

	public function checkCodeReductionProduct($reference, $qte) {
		if (isset($this->code_reduction) && !empty($this->code_reduction)) {
			if (($reference == $this->code_reduction['PRODUITREF']) && ($qte >= $this->code_reduction['PRODUITNBR'])) {
				$this->isCodeReduction_Product = true;
			}
		}
	}

	public function getPrixCodeReduction() {
		if (isset($this->code_reduction) && !empty($this->code_reduction) && $this->code_reduction['isACTIF'] == 1 ) {
			if ($this->code_reduction['EURO'] > 0) {
				return sprintf("%.2f",$this->code_reduction['EURO']);
			}
			if ($this->code_reduction['POUR'] > 0) {
				return ($this->total_HT_HR * $this->code_reduction['POUR']) / 100;
			}
		}
		return 0;
	}

	public function getPrixRemise() {
		$result = 0;
		if ($this->remise_command_euro > 0) { $result = $this->remise_command_euro; }
		if ($this->remise_command_pour > 0) { $result += ($this->total_HT_HR * $this->remise_command_pour) / 100; }
		return sprintf("%.2f",$result);
	}

	public function getPrixTotalHT() {
		$prixRemise = $this->getPrixRemise();
		if ($prixRemise >= $this->total_HT_HR) {
			$this->remise_command_euro = 0;
			$this->remise_command_pour = 0;
			$prixRemise = 0;
		}
		return sprintf("%.2f",$this->total_HT_HR - $prixRemise);
	}

	public function getPrixTotalHT_FP($isShow) {
		if ($isShow) { return sprintf("%.2f",$this->total_HT + $this->total_frais_port, 2, ',', ' '); }
		return sprintf("%.2f",$this->total_HT + $this->total_frais_port);
	}

	public function getPrixTotalTVA($isShow) {
		if ($isShow) { return sprintf("%.2f", ($this->getPrixTotalHT_FP(false) * $this->getCurrentTva($this->date_start)) / 100, 2, ',', ' '); }
		return sprintf("%.2f", ($this->getPrixTotalHT_FP(false) * $this->getCurrentTva($this->date_start)) / 100);
	}

	public function getPrixTotalTTC($isShow) {
		if ($isShow) { return sprintf("%.2f", $this->getPrixTotalHT_FP(false) + $this->getPrixTotalTVA(false) , 2, ',', ' '); }
		return sprintf("%.2f", $this->getPrixTotalHT_FP(false) + $this->getPrixTotalTVA(false));
	}

	public function getNbArticles() {
		if (isset($this->facture_lines) && !empty($this->facture_lines)) { return count($this->facture_lines); }
		return 0;
	} 
	public function addLine($line) { 
		array_push($this->facture_lines, $line); 
	}
	public function addFideliteLine($line) { 
		array_push($this->facture_fidelite_lines, $line); 
	}

	public function toArray() {	}

	private function setDateStart() {
		$date = new Zend_Date();
		$this->date_start = $date->toString('YYYY-MM-dd HH:mm:ss');
	}
	
	private function getCurrentTva($datevalue) {
		$date = new Zend_Date();
		$date->set($datevalue);
		$result = 20;
		if (intval($date->toString('YYYY')) < 2014) {
			$result = 19.60;
		}
		return $result;
	}
	
	public function computeFactureTVA(&$facture, $paysLivraison) {
		$resultTVA = $this->getCurrentTva($facture['DATESTART']);
		
		try {
			/*if (isset($paysLivraison) && !empty($paysLivraison)) {
			 if (strcasecmp($paysLivraison, "FRANCE") != 0) {
			$resultTVA = 0;
			}
			}*/
			if (isset($facture) && !empty($facture)) {
				$facture['TVA'] = $resultTVA;
				$facture['PRIXTOTALTVA'] = sprintf("%.2f", $facture['PRIXTOTALHTFP'] * $facture['TVA']) / 100;
				
			}
		} catch(Zend_Exception $e) { }
	}
    
    public function isCarteFidelitePointsValid($sumOfUser) {
        return $this->getCarteFidelitePointsTotal() <= $sumOfUser;
    }
    public function getCarteFidelitePointsTotal() {
        $total = 0;
		foreach ($this->facture_fidelite_lines as $item) {
            $total += $item->fidelite_nbpoint;
        }
        return $total;
    }
	
}

?>models/utils/CaddyFidelite.php000060400000001341150710367660012400 0ustar00<?php
class CaddyFidelite {
	var $items = array(); 

	function CaddyFidelite() {
		$this->items = array(); 
	}
    
	function removeItem($idfidelite){
        $newItems = array(); 
        foreach($this->items as $item) { 
			if ($item->idFidelite != $idfidelite) {
			    array_push($newItems, $item);
			} 
		}  
        $this->items = $newItems;
    }
	function addItem($idfidelite){
		$currentItem = false;  
		foreach($this->items as $item) { 
			if ($item->idFidelite == $idfidelite) {
				$currentItem = true;  
			} 
		}    
		if ($currentItem == false) {
			$item = new ItemFidelite();
			$item->getItemInfo($idfidelite);
            if (!empty($item->nom)) {
			    array_push($this->items, $item);
            }
		} 
	} 
}

?>models/utils/Caddy.php000060400000011435150710367660010737 0ustar00<?php
class Caddy {
	var $items;
	var $itemsCaddyType;

	function Caddy() {
		$this->items = array();
		$this->itemsCaddyType = array();
	}
	
	private function getStorage() {
		$registry = Zend_Registry::getInstance();
		$setting = $registry->get('setting');
		return new Zend_Auth_Storage_Session($setting->session_storage);
	}
	
	function getTotalSize() {
		$result = 0;
        
		if (isset($this->items) && !empty($this->items)) { $result += sizeof($this->items); }
		
		$auth = Zend_Auth::getInstance();
		$auth->setStorage($this->getStorage());
		$storage = $auth->getStorage()->read(); 
		if ($auth->hasIdentity() && isset($storage['user']) && $storage['user']['iscaddytype'] == 'Y') {
			if (isset($this->itemsCaddyType) && !empty($this->itemsCaddyType)) { $result += sizeof($this->itemsCaddyType); }
		} 
		return $result;
	}

	function cleanUp() {
		$this->items = array();
		$this->itemsCaddyType = array();
	}

	function addItemToCaddy($idChild, $qteChild, $isAccessoire, $selectedOption){
		$currentItem = false;  
		foreach($this->items as $key => $item) { 
			if ($item->idChild == $idChild && $item->selectedOption == $selectedOption) {
				$item->qteChild = $qteChild; 
				$currentItem = true;  
			} 
		}    
		if ($currentItem == false) {
			$item = new Item();
			$item->getItemInfo($idChild, $qteChild, $isAccessoire, $selectedOption);
			array_push($this->items, $item);
		} 
	}
	function addItemToCaddyType($idCaddyType, $qte, $selectedOption){
		$currentItem = false;
		foreach($this->itemsCaddyType as $item) {
			if ($item->id == $idCaddyType && $item->selectedOption == $selectedOption) {
				$item->qte = $qte;
				$currentItem = true;
				break;
			}
		}
		if ($currentItem == false) {
			$itemCaddyType = new ItemCaddyType();
			$itemCaddyType->getItemInfo($idCaddyType, $qte, $selectedOption);
			array_push($this->itemsCaddyType, $itemCaddyType);
		}
	}
	function delItemToCaddyType($idCaddyType, $selectedOption){
		$currentKey = -1;
		foreach($this->itemsCaddyType as $key => $item) {
			if ($item->id == $idCaddyType && $item->selectedOption == $selectedOption) {
				$currentKey = $key; 
				break;
			}
		}
		if ($currentKey != -1) { unset($this->itemsCaddyType[$currentKey]); }
		if (!is_array($this->itemsCaddyType)) {  $this->itemsCaddyType = array(); }
		$tmp = $this->itemsCaddyType;
		$this->itemsCaddyType = array_values($tmp); 
	}

	function delItemToCaddy($idChild, $selectedOption){
		$currentKey = -1; 
		foreach($this->items as $key => $item) {
			if ($item->idChild == $idChild && $item->selectedOption == $selectedOption) {
				$currentKey = $key;
				break;
			}
		} 
		if ($currentKey != -1) { unset($this->items[$currentKey]); }
		if (!is_array($this->items)) {  $this->items = array(); }
		$tmp = $this->items;
		$this->items = array_values($tmp);
	}
	
	function delItemToCaddyByKey($currentKey){  
		if ($currentKey != -1) { unset($this->items[$currentKey]); }
		if (!is_array($this->items)) {  $this->items = array(); }
		$tmp = $this->items;
		$this->items = array_values($tmp);
	}

	function getQuantity($idChild) {
		if (!empty($this->items)) {
			foreach($this->items as $item) {
				if ($item->idChild == $idChild) {
					return $item->qteChild;
				}
			}
		}
		return 0;
	}

	function getItemById($idChild) {
		foreach($this->items as $item) {
			if ($item->idChild == $idChild) {
				return $item;
			}
		}
		return null;
	}

	function getItemByIdAndOption($idChild, $selectedOption) {
		foreach($this->items as $item) {
			if ($item->idChild == $idChild && $item->selectedOption == $selectedOption) {
				return $item;
			}
		}
		return null;
	}

	function getItemCaddyTypeByIdChild($idChild) {
		foreach($this->itemsCaddyType as $item) {
			if ($item->idChild == $idChild) {
				return $item;
			}
		}
		return null;
	}

	function getItemCaddyTypeByIdChildAndOption($idChild, $selectedOption) {
		foreach($this->itemsCaddyType as $item) {
			if ($item->idChild == $idChild && $item->selectedOption == $selectedOption) {
				return $item;
			}
		}
		return null;
	}

	function getCaddyTemp($userId) {

		$this->items = array();
		$caddyTemp = new CaddyTemp();
		$resultCaddy = $caddyTemp->findCaddyByUser($userId);

		if (isset($resultCaddy) && !empty($resultCaddy)) {
			foreach ($resultCaddy AS $row) {
				$item = new Item();

				$item->idChild = $row['CHILDID'];
				$item->qteChild = $row['CHILDQUANTITY'];
				$item->idProduit = $row['PRODUCTID'];
				$item->nom = $row['PRODUCTNOM'];
				$item->descshort = $row['DESCSHORT'];
				$item->navnom = $row['NAVNOM'];
				$item->url = $row['URL'];
				$item->designation = $row['DESIGNATION'];
				$item->isAccessoire = $row['isACCESSOIRE'];
				$item->selectedOption = $row['SELECTEDOPTION'];
				$item->stock = 1;

				array_push($this->items, $item);
			}
		}
	}

	function showCaddy() {
		foreach($this->items as $item) {
			print $item->toString()."<br/>";
		}
	}
}

?>models/utils/PromoCalculator.php000060400000032374150710367660013026 0ustar00<?php
class PromoCalculator {
	var $promoProduct;
	var $promoUser;
	var $promoCommand;

	function PromoCalculator() {
		$this->promoProduct = new PromoProduct();
		$this->promoUser = new PromoUser();
		$this->promoCommand = new PromoCommand();
	}

	public function calculEuro($prix, $remise) { return $prix - $remise; }
	public function calculPour($prix, $remise) { return $prix - (($prix * $remise) / 100); }
	public function isRemise() {

	}
	/*
	 * REMISES SUR PRODUITS
	 */

	/*
	 * Calcul du prix de la promotion selon la reference d'un produit
	 */
	private function computePrixProductByReference($factureLine) {
		if ($factureLine->isPromo()) {
			$myPromo = $this->promoProduct->getRemiseByProductReference($factureLine->item_reference);
			if ($myPromo['REMISEEURO'] > 0) {
				$factureLine->remise_euro = $myPromo['REMISEEURO'];
				//$prixPromo = $this->calculEuro($factureLine->item_prix, $myPromo['REMISEEURO']);
				//$factureLine->setPrixPromo($prixPromo);
			}
			if ($myPromo['REMISEPOUR'] > 0) {
				//$prixPromo = $this->calculPour($factureLine->item_prix, $myPromo['REMISEPOUR']);
				//$factureLine->setPrixPromo($prixPromo);
				$factureLine->remise_pour = $myPromo['REMISEPOUR'];
			}
			$factureLine->checkPrixPromo();
		}
	}

	/*
	 * Calcul du prix de la promotion selon la marque d'un produit
	 */
	private function computePrixProductByMarque($factureLine) {
		$myPromo = $this->promoProduct->getRemiseByProductBrend($factureLine->product_brend_id);
		if ($myPromo) {
			if ($myPromo['REMISEEURO'] > 0) {
				$factureLine->remise_euro = $myPromo['REMISEEURO'];
			}
			if ($myPromo['REMISEPOUR'] > 0) {
				$factureLine->remise_pour = $myPromo['REMISEPOUR'];
			}
			$factureLine->checkPrixPromo();
		}
	}


	/*
	 * Calcul du prix de la promotion selon la gamme d'un produit
	 */
	private function computePrixProductByCategory($factureLine) {
		$myPromo = $this->promoProduct->getRemiseByProductCategory($factureLine->product_category_id);
		if ($myPromo) {
			if ($myPromo['REMISEEURO'] > 0) {
				$factureLine->remise_euro = $myPromo['REMISEEURO'];
			}
			if ($myPromo['REMISEPOUR'] > 0) {
				$factureLine->remise_pour = $myPromo['REMISEPOUR'];
			}
			$factureLine->checkPrixPromo();
		}
	}

	/*
	 * Calcul du prix de la promotion d'un produit selon un nombre achete
	 */
	private function computePrixProductByQte($factureLine, $facture_lines) {
		$myPromo = $this->promoProduct->getRemisesByProductQte($factureLine->item_reference, $factureLine->item_qte);
		if ($myPromo) {
			foreach ($facture_lines AS $line) {
				foreach ($myPromo AS $promo) {
					if (($line->item_reference == $promo['CHILDREFBUY']) &&
					($line->item_qte >= $promo['CHILDREFBUYNB']) ) {
						if ($promo['REMISEEURO'] > 0) {
							$factureLine->remise_items = array(
								'NB' => $promo['CHILDREFPROMONB'],
								'REF' => $promo['CHILDREFPROMO'],
								'REMISE_EURO' => $promo['REMISEEURO'],
								'REMISE_POUR' => 0

							);
						}
						if ($promo['REMISEPOUR'] > 0) {
							$factureLine->remise_items = array(
								'NB' => $promo['CHILDREFPROMONB'],
								'REF' => $promo['CHILDREFPROMO'],
								'REMISE_POUR' => $promo['REMISEPOUR'],
								'REMISE_EURO' => 0 
							);
						}
					}
				}
			}
		}
	}

	/*
	 * Calcul du prix de la promotion selon la date d'un produit
	 */
	private function computePrixProductByDateBetween($factureLine) {
		$myPromo = $this->promoProduct->getRemiseByProductDateBetween($factureLine->product_promo_date);
		if ($myPromo) {
			if ($myPromo['REMISEEURO'] > 0) {
				$factureLine->remise_euro = $myPromo['REMISEEURO'];
			}
			if ($myPromo['REMISEPOUR'] > 0) {
				$factureLine->remise_pour = $myPromo['REMISEPOUR'];
			}
			$factureLine->checkPrixPromo();
		}
	}


	/*
	 * Calcul du prix de la remise selon la marque et l'user
	 */
	private function computePrixUserByMarque($factureLine, $userId) {
		$myPromo = $this->promoUser->getRemiseByMarque($factureLine->product_brend_id, $userId);
		if ($myPromo) {
			if ($myPromo['REMISEEURO'] > 0) {
				$factureLine->remise_euro = $myPromo['REMISEEURO'];
			}
			if ($myPromo['REMISEPOUR'] > 0) {
				$factureLine->remise_pour = $myPromo['REMISEPOUR'];
			}
			$factureLine->checkPrixPromo();
		}
	}

	/*
	 * Calcul du prix de la remise selon le code interne et la marque
	 */
	private function computePrixUserByCodeInternMarque($factureLine, $codeIntern) {
		$myPromo = $this->promoUser->getRemiseByCodeInternMarque($factureLine->product_brend_id, $codeIntern);
		if ($myPromo) {
			if ($myPromo['REMISEEURO'] > 0) {
				$factureLine->remise_euro = $myPromo['REMISEEURO'];
			}
			if ($myPromo['REMISEPOUR'] > 0) {
				$factureLine->remise_pour = $myPromo['REMISEPOUR'];
			}
			$factureLine->checkPrixPromo();
		}
	}


	/*
	 * REMISES GLOBALES
	 */

	/*
	 * Calcul du prix de la remise de la commande selon un nombre de produits
	 *
	 * CUMUL
	 */
	private function computePrixCommandByProductQte($factureLine, $facture) {
		$myPromo = $this->promoCommand->getRemiseCommandByProductQte($factureLine->item_reference, $factureLine->item_qte);
		if ($myPromo) {
			if ($myPromo['REMISEEURO'] > 0) {
				$facture->remise_command_euro += $myPromo['REMISEEURO'];
			}
			if ($myPromo['REMISEPOUR'] > 0) {
				$facture->remise_command_pour += $myPromo['REMISEPOUR'];
			}
		}
	}

	/*
	 * Calcul du prix de la remise de la commande selon le TOTAL HT
	 *
	 * CUMUL
	 */
	private function computePrixCommandByTotalHT($facture) {
		$myPromo = $this->promoCommand->getRemiseCommandByTotalHT($facture->total_HT_HR);
		if ($myPromo) {
			if ($myPromo['REMISEEURO'] > 0) {
				$facture->remise_command_euro += $myPromo['REMISEEURO'];
			}
			if ($myPromo['REMISEPOUR'] > 0) {
				$facture->remise_command_pour += $myPromo['REMISEPOUR'];
			}
		}
	}

	/*
	 * Calcul du prix de la remise de toute les commandes
	 *
	 * CUMUL
	 */
	private function computePrixCommandByAll($facture) {
		$myPromo = $this->promoCommand->getRemiseCommandByAll();
		if ($myPromo) {
			if ($myPromo['REMISEEURO'] > 0) {
				$facture->remise_command_euro += $myPromo['REMISEEURO'];
			}
			if ($myPromo['REMISEPOUR'] > 0) {
				$facture->remise_command_pour += $myPromo['REMISEPOUR'];
			}
		}
	}

	/*
	 * Calcul du prix de la remise de la commande selon la date anniversaire
	 *
	 * CUMUL
	 */
	private function computePrixUserByDateInscription($facture, $dateInsc) {
		$myPromo = $this->promoUser->getRemiseByDateInscription();
		if ($myPromo) {
			$date = new Zend_Date();
			$userDate = new Zend_Date(strtotime($dateInsc));
			if (($userDate->toString("MM") -  $date->toString("MM")) < 2 &&
			($userDate->toString("MM") -  $date->toString("MM")) > -2) {
					
				if ($myPromo['REMISEEURO'] > 0) {
					$facture->remise_command_euro += $myPromo['REMISEEURO'];
				}
				if ($myPromo['REMISEPOUR'] > 0) {
					$facture->remise_command_pour += $myPromo['REMISEPOUR'];
				}
			}
		}
	}


	/*
	 * Calcul du prix de la remise de la commande selon l'user
	 *
	 * CUMUL
	 */
	private function computePrixUserByUser($facture, $userID) {
		$myPromo = $this->promoUser->getRemiseByUserID($userID);
		if ($myPromo) {
			if ($myPromo['REMISEEURO'] > 0) {
				$facture->remise_command_euro += $myPromo['REMISEEURO'];
			}
			if ($myPromo['REMISEPOUR'] > 0) {
				$facture->remise_command_pour += $myPromo['REMISEPOUR'];
			}
		}
	}

	/*
	 * Calcul du prix de la remise de la commande si c'est la premiere
	 *
	 * CUMUL
	 */
	private function computePrixUserByIsFirstCommand($facture, $userID) {
		$myPromo = $this->promoUser->getRemiseByIsFirstCommand();
		if ($myPromo) {
			$commande = new Command();
			if (!$commande->isAlreadyBuySomething($userID)) {
				if ($myPromo['REMISEEURO'] > 0) {
					$facture->remise_command_euro += $myPromo['REMISEEURO'];
				}
				if ($myPromo['REMISEPOUR'] > 0) {
					$facture->remise_command_pour += $myPromo['REMISEPOUR'];
				}
			}
		}
	}

	/*
	 * Calcul du prix du code de reduction pour un produit
	 *
	 * UNIQUE
	 */
	private function computePrixCodeReduction($facture) {
		if (isset($facture->code_reduction) && !empty($facture->code_reduction)) {
			$codeReduction = new CodeReduction();
			$myPromo = $codeReduction->getVerifyCodeBy($facture->code_reduction['CODE']);
			if ($myPromo) {
				$facture->code_reduction = $myPromo;
				if ($facture->isCodeReduction_Product) {
					if (isset($myPromo) && !empty($myPromo) && $myPromo['isACTIF'] == 1 ) {
						if ($myPromo['EURO'] > 0) {
							$facture->remise_command_euro = $myPromo['EURO'];
						}
						if ($myPromo['POUR'] > 0) {
							$facture->remise_command_pour = $myPromo['POUR'];
						}
					}
				} else {
					if ($facture->total_HT_HR >= $myPromo['CMDTOTAL'] && $myPromo['CMDTOTAL'] > 0) {
						if ($myPromo['EURO'] > 0) {
							$facture->remise_command_euro = $myPromo['EURO'];
						}
						if ($myPromo['POUR'] > 0) {
							$facture->remise_command_pour = $myPromo['POUR'];
						}
					}
				}
				$facture->code_reduction['EURO'] = $facture->getPrixCodeReduction();
			} else { $facture->code_reduction = array(); }
		}
	}

	/*
	 * Calcul du prix restant a payer de la commande pour validation
	 *
	 * Return prix restant a payer
	 */
	public function getPrixCommandValidation($facture) {
		$result = 0;
		$myPromo = $this->promoCommand->getCommandValid();
		if ($myPromo) {
			$total_HT = $facture->getPrixTotalHT();
			if ($total_HT < $myPromo['MONTANTVALID']) {
				$result = sprintf("%.2f", $myPromo['MONTANTVALID'] - $total_HT);
			}
		}
		return $result;
	}
	public function isCommandValid($prixHT) {
		$myPromo = $this->promoCommand->getCommandValid();
		if ($myPromo) {
			if ($prixHT < $myPromo['MONTANTVALID']) {  return false ; }
		}
		return true;
	}



	public function computeAllPromos($facture, $user) {
		foreach ($facture->facture_lines AS $item) {
			if (!$item->isCaddyType) {
				if ($item->isSurDevis()) {
					$item->item_prix = 0;
				} else {
					$this->computePrixProductByReference($item);
					if (!$item->isRemiseChanged()) { $this->computePrixProductByMarque($item); }
					if (!$item->isRemiseChanged()) { $this->computePrixProductByCategory($item); }
					if (!$item->isRemiseChanged()) { $this->computePrixProductByQte($item, $facture->facture_lines); }
					if (!$item->isRemiseChanged()) { $this->computePrixProductByDateBetween($item); }


					if (isset($user) && !empty($user)) {
						$userId = $user['id'];
						$codeIntern = $user['cintern'];

						if (!empty($codeIntern)) { $this->computePrixUserByCodeInternMarque($item, $codeIntern); }
						if (!$item->isRemiseChanged()) { $this->computePrixUserByMarque($item, $userId); }
					}

					$this->computePrixCommandByProductQte($item, $facture);

					if (!empty($facture->code_reduction) && isset($facture->code_reduction['PRODUITREF']) && !empty($facture->code_reduction['PRODUITREF'])) {
						$facture->checkCodeReductionProduct($item->item_reference, $item->item_qte);
					}

					$poidsCurrent = $item->getPoidsTotal();
					if ($poidsCurrent > 0) { $facture->total_poids += $poidsCurrent ;
					} else { $facture->isAncienPoids = true;  }

					if ($item->isFrancoDenied()) { $facture->isFrancoDenied = true; }

					$facture->total_HT_HR += $item->getPrixTotalHT(true);
				}
			}
		}

		$this->computePrixCommandByTotalHT($facture);
		$this->computePrixCommandByAll($facture);
			
		if (isset($user) && !empty($user)) {
			$this->computePrixUserByDateInscription($facture, $user['dateinsc']);

			$this->computePrixUserByUser($facture, $user['id']);

			$this->computePrixUserByIsFirstCommand($facture, $user['id']);
		}
			
		$this->computePrixCodeReduction($facture);
	}

	public function computeItemsPromosCaddyType($caddyItems, $user) {
		foreach ($caddyItems AS $item) {
			if (!$item->isPromo()) {
				$promoProduct = new PromoProduct();
				$promoUser = new PromoUser();

				$myPromo = $promoProduct->getRemiseByProductReference($item->reference);
				if ($myPromo) { $item->setRemise($myPromo['REMISEEURO'], $myPromo['REMISEPOUR']); }
 
				if (!$item->isRemiseChanged()) { 
					$myPromo = $promoProduct->getRemiseByProductBrend($item->idBrend);
					if ($myPromo) { $item->setRemise($myPromo['REMISEEURO'], $myPromo['REMISEPOUR']); }
				}

				if (!$item->isRemiseChanged()) {
					$myPromo = $promoProduct->getRemiseByProductCategory($item->idcategory);
					if ($myPromo) { $item->setRemise($myPromo['REMISEEURO'], $myPromo['REMISEPOUR']); }
				}
				if (!$item->isRemiseChanged()) {
					$myPromo = $promoProduct->getRemisesByProductQte($item->reference, $item->qte);
					if ($myPromo) {
						foreach ($caddyItems AS $line) {
							foreach ($myPromo AS $promo) {
								if (($line->reference == $promo['CHILDREFBUY']) &&
								($line->qte >= $promo['CHILDREFBUYNB']) ) {
									$item->setRemise($promo['REMISEEURO'], $promo['REMISEPOUR']);
								}
							}
						}
					}
				}
				if (!$item->isRemiseChanged()) {
					$myPromo = $promoProduct->getRemiseByProductDateBetween($item->promo_date);
					if ($myPromo) { $item->setRemise($myPromo['REMISEEURO'], $myPromo['REMISEPOUR']); }
				}
				if (isset($user) && !empty($user)) {
					$userId = $user['id'];
					$codeIntern = $user['cintern'];

					if (!empty($codeIntern)) {
						$myPromo = $promoUser->getRemiseByCodeInternMarque($item->idBrend, $codeIntern);
						if ($myPromo) { $item->setRemise($myPromo['REMISEEURO'], $myPromo['REMISEPOUR']); }
					}
					if (!$item->isRemiseChanged()) {
						$myPromo = $promoUser->getRemiseByMarque($item->idBrend, $userId);
						if ($myPromo) { $item->setRemise($myPromo['REMISEEURO'], $myPromo['REMISEPOUR']); }
					}
				}
			}
		}
	}
}
?>models/utils/Item.php000060400000002723150710367660010611 0ustar00<?php 
class Item {
    var $idProduit;
    var $idChild;
    var $qteChild;
    var $nom;
    var $descshort;
    var $navnom;
    var $url;
    var $designation;
    var $stock = 1;
    var $isAccessoire = 'N'; 
    var $selectedOption = "";
     
    function Item() { }
    
    function getItemInfo($idChild, $qteChild, $isAccessoire, $selectedOption) {
    	$sql = "
			SELECT p.NOM NOM, p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.ID IDPRODUCT, pic.URL URL, pc.DESIGNATION DESIGNATION, p.STOCK STOCK
			FROM productchild pc
			LEFT JOIN product p ON p.ID = pc.IDPRODUCT
			LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
			WHERE pc.ID = ".$idChild."
			AND p.isACTIVE = 0
			AND pic.POSITION = 1
			";
			$productChild = new ProductChild();
			$result = $productChild->getAdapter()->fetchRow($sql);
			 
			$this->idChild = $idChild;
			$this->qteChild = $qteChild;
			$this->idProduit = $result['IDPRODUCT'];
			$this->nom = $result['NOM'];
			$this->descshort = $result['DESCSHORT'];
			$this->navnom = $result['NAVNOM'];
			$this->url = $result['URL'];
			$this->designation = $result['DESIGNATION'];
			$this->stock = $result['STOCK'];
			$this->isAccessoire = $isAccessoire;
			$this->selectedOption = $selectedOption;
    }
    
    public function toString() {
    	return $this->nom." - ".$this->idChild." : ".$this->qteChild."<br>";
    }
    
    public function isItemAccessoire() {
    	if ($this->isAccessoire == "Y") { return true; }
    	return false;
    }
}

?>
models/utils/UploadHandler.php000060400000027061150710367660012437 0ustar00<?php

/**
 * Do not use or reference this directly from your client-side code.
 * Instead, this should be required via the endpoint.php or endpoint-cors.php
 * file(s).
 */

class UploadHandler {

    public $allowedExtensions = array();
    public $sizeLimit = null;
    public $inputName = 'qqfile';
    public $chunksFolder = 'chunks';

    public $chunksCleanupProbability = 0.001; // Once in 1000 requests on avg
    public $chunksExpireIn = 604800; // One week

    protected $uploadName;

    /**
     * Get the original filename
     */
    public function getName(){
        if (isset($_REQUEST['qqfilename']))
            return $_REQUEST['qqfilename'];

        if (isset($_FILES[$this->inputName]))
            return $_FILES[$this->inputName]['name'];
    }

    public function getInitialFiles() {
        $initialFiles = array();

        for ($i = 0; $i < 5000; $i++) {
            array_push($initialFiles, array("name" => "name" + $i, uuid => "uuid" + $i, thumbnailUrl => "/test/dev/handlers/vendor/fineuploader/php-traditional-server/fu.png"));
        }

        return $initialFiles;
    }

    /**
     * Get the name of the uploaded file
     */
    public function getUploadName(){
        return $this->uploadName;
    }

    public function combineChunks($uploadDirectory, $name = null) {
        $uuid = $_POST['qquuid'];
        if ($name === null){
            $name = $this->getName();
        }
        $targetFolder = $this->chunksFolder.DIRECTORY_SEPARATOR.$uuid;
        $totalParts = isset($_REQUEST['qqtotalparts']) ? (int)$_REQUEST['qqtotalparts'] : 1;

        $targetPath = join(DIRECTORY_SEPARATOR, array($uploadDirectory, $uuid, $name));
        $this->uploadName = $name;

        if (!file_exists($targetPath)){
            mkdir(dirname($targetPath));
        }
        $target = fopen($targetPath, 'wb');

        for ($i=0; $i<$totalParts; $i++){
            $chunk = fopen($targetFolder.DIRECTORY_SEPARATOR.$i, "rb");
            stream_copy_to_stream($chunk, $target);
            fclose($chunk);
        }

        // Success
        fclose($target);

        for ($i=0; $i<$totalParts; $i++){
            unlink($targetFolder.DIRECTORY_SEPARATOR.$i);
        }

        rmdir($targetFolder);

        if (!is_null($this->sizeLimit) && filesize($targetPath) > $this->sizeLimit) {
            unlink($targetPath);
            http_response_code(413);
            return array("success" => false, "uuid" => $uuid, "preventRetry" => true);
        }

        return array("success" => true, "uuid" => $uuid);
    }

    /**
     * Process the upload.
     * @param string $uploadDirectory Target directory.
     * @param string $name Overwrites the name of the file.
     */
    public function handleUpload($uploadDirectory, $name = null){

        if (is_writable($this->chunksFolder) &&
            1 == mt_rand(1, 1/$this->chunksCleanupProbability)){

            // Run garbage collection
            $this->cleanupChunks();
        }

        // Check that the max upload size specified in class configuration does not
        // exceed size allowed by server config
        if ($this->toBytes(ini_get('post_max_size')) < $this->sizeLimit ||
            $this->toBytes(ini_get('upload_max_filesize')) < $this->sizeLimit){
            $neededRequestSize = max(1, $this->sizeLimit / 1024 / 1024) . 'M';
            return array('error'=>"Server error. Increase post_max_size and upload_max_filesize to ".$neededRequestSize);
        }

        if ($this->isInaccessible($uploadDirectory)){
            return array('error' => "Server error. Uploads directory isn't writable");
        }

        $type = $_SERVER['CONTENT_TYPE'];
        if (isset($_SERVER['HTTP_CONTENT_TYPE'])) {
            $type = $_SERVER['HTTP_CONTENT_TYPE'];
        }

        if(!isset($type)) {
            return array('error' => "No files were uploaded.");
        } else if (strpos(strtolower($type), 'multipart/') !== 0){
            return array('error' => "Server error. Not a multipart request. Please set forceMultipart to default value (true).");
        }

        // Get size and name
        $file = $_FILES[$this->inputName];
        $size = $file['size'];
        if (isset($_REQUEST['qqtotalfilesize'])) {
            $size = $_REQUEST['qqtotalfilesize'];
        }

        if ($name === null){
            $name = $this->getName();
        }

        // Validate name
        if ($name === null || $name === ''){
            return array('error' => 'File name empty.');
        }

        // Validate file size
        if ($size == 0){
            return array('error' => 'File is empty.');
        }

        if (!is_null($this->sizeLimit) && $size > $this->sizeLimit) {
            return array('error' => 'File is too large.', 'preventRetry' => true);
        }

        // Validate file extension
        $pathinfo = pathinfo($name);
        $ext = isset($pathinfo['extension']) ? $pathinfo['extension'] : '';

        if($this->allowedExtensions && !in_array(strtolower($ext), array_map("strtolower", $this->allowedExtensions))){
            $these = implode(', ', $this->allowedExtensions);
            return array('error' => 'File has an invalid extension, it should be one of '. $these . '.');
        }

        // Save a chunk
        $totalParts = isset($_REQUEST['qqtotalparts']) ? (int)$_REQUEST['qqtotalparts'] : 1;

        $uuid = $_REQUEST['qquuid'];
        if ($totalParts > 1){
        # chunked upload

            $chunksFolder = $this->chunksFolder;
            $partIndex = (int)$_REQUEST['qqpartindex'];

            if (!is_writable($chunksFolder) && !is_executable($uploadDirectory)){
                return array('error' => "Server error. Chunks directory isn't writable or executable.");
            }

            $targetFolder = $this->chunksFolder.DIRECTORY_SEPARATOR.$uuid;

            if (!file_exists($targetFolder)){
                mkdir($targetFolder);
            }

            $target = $targetFolder.'/'.$partIndex;
            $success = move_uploaded_file($_FILES[$this->inputName]['tmp_name'], $target);

            return array("success" => $success, "uuid" => $uuid, "uploadName" => $name);

        }
        else {
        # non-chunked upload

            $target = join(DIRECTORY_SEPARATOR, array($uploadDirectory, $uuid, $name));
	
            if ($target){
                $this->uploadName = basename($target);

                if (!is_dir(dirname($target))){
                    mkdir(dirname($target));
                }
                if (move_uploaded_file($file['tmp_name'], $target)){
                    return array('success'=> true, "uuid" => $uuid, "uploadName" => $name);
                }
            }

            return array('error'=> 'Could not save uploaded file.' .
                'The upload was cancelled, or server error encountered : '.$target. ' Name : '.$name);
        }
    }

    /**
     * Process a delete.
     * @param string $uploadDirectory Target directory.
     * @params string $name Overwrites the name of the file.
     *
     */
    public function handleDelete($uploadDirectory, $name=null)
    {
        if ($this->isInaccessible($uploadDirectory)) {
            return array('error' => "Server error. Uploads directory isn't writable" . ((!$this->isWindows()) ? " or executable." : "."));
        }

        $targetFolder = $uploadDirectory;
        $url = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
        $tokens = explode('/', $url);
        $uuid = $tokens[sizeof($tokens)-1];

        $target = join(DIRECTORY_SEPARATOR, array($targetFolder, $uuid));

        if (is_dir($target)){
            $this->removeDir($target);
            return array("success" => true, "uuid" => $uuid);
        } else {
            return array("success" => false,
                "error" => "File not found! Unable to delete.".$url,
                "path" => $uuid
            );
        }

    }

    /**
     * Returns a path to use with this upload. Check that the name does not exist,
     * and appends a suffix otherwise.
     * @param string $uploadDirectory Target directory
     * @param string $filename The name of the file to use.
     */
    protected function getUniqueTargetPath($uploadDirectory, $filename)
    {
        // Allow only one process at the time to get a unique file name, otherwise
        // if multiple people would upload a file with the same name at the same time
        // only the latest would be saved.

        if (function_exists('sem_acquire')){
            $lock = sem_get(ftok(__FILE__, 'u'));
            sem_acquire($lock);
        }

        $pathinfo = pathinfo($filename);
        $base = $pathinfo['filename'];
        $ext = isset($pathinfo['extension']) ? $pathinfo['extension'] : '';
        $ext = $ext == '' ? $ext : '.' . $ext;

        $unique = $base;
        $suffix = 0;

        // Get unique file name for the file, by appending random suffix.

        while (file_exists($uploadDirectory . DIRECTORY_SEPARATOR . $unique . $ext)){
            $suffix += rand(1, 999);
            $unique = $base.'-'.$suffix;
        }

        $result =  $uploadDirectory . DIRECTORY_SEPARATOR . $unique . $ext;

        // Create an empty target file
        if (!touch($result)){
            // Failed
            $result = false;
        }

        if (function_exists('sem_acquire')){
            sem_release($lock);
        }

        return $result;
    }

    /**
     * Deletes all file parts in the chunks folder for files uploaded
     * more than chunksExpireIn seconds ago
     */
    protected function cleanupChunks(){
        foreach (scandir($this->chunksFolder) as $item){
            if ($item == "." || $item == "..")
                continue;

            $path = $this->chunksFolder.DIRECTORY_SEPARATOR.$item;

            if (!is_dir($path))
                continue;

            if (time() - filemtime($path) > $this->chunksExpireIn){
                $this->removeDir($path);
            }
        }
    }

    /**
     * Removes a directory and all files contained inside
     * @param string $dir
     */
    protected function removeDir($dir){
        foreach (scandir($dir) as $item){
            if ($item == "." || $item == "..")
                continue;

            if (is_dir($item)){
                $this->removeDir($item);
            } else {
                unlink(join(DIRECTORY_SEPARATOR, array($dir, $item)));
            }

        }
        rmdir($dir);
    }

    /**
     * Converts a given size with units to bytes.
     * @param string $str
     */
    protected function toBytes($str){
        $val = trim($str);
        $last = strtolower($str[strlen($str)-1]);
        switch($last) {
            case 'g': $val *= 1024;
            case 'm': $val *= 1024;
            case 'k': $val *= 1024;
        }
        return $val;
    }

    /**
     * Determines whether a directory can be accessed.
     *
     * is_executable() is not reliable on Windows prior PHP 5.0.0
     *  (http://www.php.net/manual/en/function.is-executable.php)
     * The following tests if the current OS is Windows and if so, merely
     * checks if the folder is writable;
     * otherwise, it checks additionally for executable status (like before).
     *
     * @param string $directory The target directory to test access
     */
    protected function isInaccessible($directory) {
        $isWin = $this->isWindows();
        $folderInaccessible = ($isWin) ? !is_writable($directory) : ( !is_writable($directory) && !is_executable($directory) );
        return $folderInaccessible;
    }

    /**
     * Determines is the OS is Windows or not
     *
     * @return boolean
     */

    protected function isWindows() {
    	$isWin = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
    	return $isWin;
    }

}
models/utils/FactureLine.php000060400000013762150710367660012121 0ustar00<?php

class FactureLine {
	var $is_fidelite = false;
	var $fidelite_nom;
	var $fidelite_nbpoint;    
	var $fidelite_id;    
    
	var $product_id;
	var $product_nom;
	var $product_descshort;
	var $product_navnom;
	var $product_navnom_urlparents;
	var $product_url;
	var $product_isPromo;
	var $product_brend_id;
	var $product_isBrend;
	var $product_category_id;
	var $product_promo_date;

	var $item_id;
	var $item_reference;
	var $item_qte;
	var $item_qte_min;
	var $item_designation;
	var $item_stock;
	var $item_poids;
	var $item_isAccessoire;
	var $item_isPromo;
	var $item_isDevis;
	var $item_isFrancoDenied;
	var $item_selectedOption = "";
	var $item_optionsByList;
	var $item_nbpointfidelite;

	var $item_prix;
	var $remise_euro = 0;
	var $remise_pour = 0;

	//Remise sur un certain nombre d'articles
	var $remise_items;
	
	//Si c'est une ligne du caddy type
	var $isCaddyType = false;
	var $caddytype_id = 0;
	var $caddytype_isActif;
	var $caddytype_qte_total = 0;


	function FactureLine() { $this->remise_items = array(); }

	public function isRemiseChanged() {
		if ($this->remise_euro > 0 || $this->remise_pour > 0) { return true; }
		return false;
	}
	
	public function getPrixRemise() {
		if ($this->remise_euro > 0) {
			return sprintf("%.2f", $this->remise_euro);
		} else if ($this->remise_pour > 0) {
			return sprintf("%.2f",($this->item_prix * $this->remise_pour) / 100);
		}
		return 0;
	}

	public function getPrixAfterRemise() {
		if ($this->remise_euro > 0) {
			return sprintf("%.2f",$this->item_prix - $this->remise_euro);
		} else if ($this->remise_pour > 0) {
			return sprintf("%.2f",$this->item_prix - (($this->item_prix * $this->remise_pour) / 100));
		}
		return sprintf("%.2f",$this->item_prix);
	}
	public function getPrixAfterRemiseOfItems() {
		if (!empty($this->remise_items)) {
			if ($this->remise_items['REMISE_EURO'] > 0) {
				return sprintf("%.2f",$this->item_prix - $this->remise_items['REMISE_EURO']);
			} else if ($this->remise_items['REMISE_POUR'] > 0) {
				return sprintf("%.2f",$this->item_prix - (($this->item_prix * $this->remise_items['REMISE_POUR']) / 100));
			}
		}
		return sprintf("%.2f",$this->item_prix);
	}

	public function getPrixTotalHT($isRemise) {
		$result = 0;
		if ($isRemise) {
			 //Pour les autres remises
			$prixAfter = $this->getPrixAfterRemise();
			$prixTotalAfter = $prixAfter * $this->item_qte;
			
			$result = $prixTotalAfter;
			//Pour la promotion X selon Y avec des qtes
			if (!empty($this->remise_items)) {
				$prixAfterSome = $this->getPrixAfterRemiseOfItems(); 
				if ($this->item_qte >= $this->remise_items['NB']) {
					$prixTotalAfterSome = ($prixAfterSome * $this->remise_items['NB']) + (($this->item_qte - $this->remise_items['NB']) * $this->item_prix);
				} 
				
				if ($prixTotalAfterSome < $prixTotalAfter) { $result = $prixTotalAfterSome; }
			} 
			return sprintf("%.2f",$result); 
		}
		return sprintf("%.2f",$this->item_prix * $this->item_qte);
	}

	public function checkPrixPromo() {
		if ($this->isRemiseChanged()) { 
			$this->product_isPromo = 0;
			$this->item_isPromo = 0; 
		}  else {
			$this->product_isPromo = 1;
			$this->item_isPromo = 1;
		}
	}

	public function getPoidsTotal() {
		return ((int)$this->item_poids) * $this->item_qte;
	}

	public function setLineInfo($row, $qte, $isAcc) {
		$this->product_id = $row['IDPRODUCT'];
		$this->product_nom = $row['NOM'];
		$this->product_descshort = $row['DESCSHORT'];
		$this->product_navnom = $row['NAVNOM'];
		$this->product_navnom_urlparents = $row['NAVNOM_URLPARENTS'];
		$this->product_url = $row['URL'];
		$this->product_isPromo = $row['isPROMO'];
		$this->product_brend_id = $row['IDBREND'];
		$this->product_isBrend = $row['isSHOWBREND'];
		$this->product_category_id = $row['IDCATEGORY'];
		$this->product_promo_date = $row['DATEPROMO'];
			
		$this->item_id = $row['IDCHILD'];
		$this->item_reference = $row['REFERENCE'];
		$this->item_designation = $row['DESIGNATION'];
		$this->item_stock  = $row['STOCK'];
		$this->item_isPromo  = $row['isPROMOCHILD'];
		$this->item_isDevis  = $row['isDEVIS'];
		$this->item_poids  = $row['POIDS'];
		$this->item_isFrancoDenied  = $row['isFRANCODENIED'];
		$this->item_qte_min  = $row['QUANTITYMIN'];
			
		/*Recuperation du prix degressif*/
		$productChildQte = new ProductChildQte();
		$currentPrice = $productChildQte->getCurrentPrice($row['IDCHILD'], $qte, $row['PRIX']);
		$this->item_prix = sprintf("%.2f",$currentPrice);
		//$this->item_prix = sprintf("%.2f",$row['PRIX']);
			
		$this->item_qte = $qte;
		$this->item_isAccessoire = $isAcc;
		
		$optionList = new OptionList();
		$this->item_optionsByList = $optionList->getByIdProduct($row['IDPRODUCT']);
		$this->item_nbpointfidelite  = $row['POINTFIDELITE'];
	}

	public function toString() {
		return $this->product_nom." - ".$this->item_id." : ".$this->item_qte."<br>";
	}

	public function isAccessoire() {
		if ($this->isAccessoire == "Y") { return true; }
		return false;
	}
	public function isPromo() {
		if ($this->item_isPromo == 0) { return true; }
		return false;
	}
	public function setPromo($value) {
		if ($value) {$this->item_isPromo = 0; } 
		else {$this->item_isPromo = 1;} 
	}
	public function setPromoCaddyType($value) {
		if ($value) {
			$this->item_isPromo = 0; 
			$this->isCaddyType = true;
			$this->item_isDevis = 1; 
		}  else {
			$this->isCaddyType = false;
			$this->caddytype_id = 0; 
		} 
	}
	 			
	public function isSurDevis() {
		if ($this->item_isDevis == 0) { return true; }
		return false;
	}
	public function isBrend() {
		if ($this->product_isBrend == 0) { return true; }
		return false;
	}
	public function isFrancoDenied() {
		if ($this->item_isFrancoDenied == 0) { return true; }
		return false;
	}
	
	public function isCaddyTypeActif() {
		if ($this->isCaddyType && $this->caddytype_isActif == 'Y') { return  true;}
		return false;
	}
    
	public function setFideliteGift($row) {
        $this->is_fidelite = true;
		$this->fidelite_nom = $row->nom;
		$this->fidelite_nbpoint = $row->nbpoint;
		$this->fidelite_id = $row->idFidelite;
    }
	public function isFideliteGift() {
		return $this->is_fidelite;
	}
}

?>
models/utils/ItemFidelite.php000060400000000755150710367660012262 0ustar00<?php 
class ItemFidelite { 
    var $idFidelite; 
    var $nom;  
    var $nbpoint; 
     
    function ItemFidelite() { }
    
    function getItemInfo($idfidelite) {
        $carteFidelite = new CarteFidelite();
        $result = $carteFidelite->getInfosEnableById($idfidelite);
        if (isset($result) && !empty($result)) {
            $this->nom = $result['TITRE'];
		    $this->nbpoint = $result['POINTFIDELITE'];
            $this->idFidelite = $result['ID'];
        }
    } 
}

?>
models/utils/ItemOptionList.php000060400000001165150710367660012635 0ustar00<?php
class ItemOptionList { 
	var $id;
	var $name;
	var $values; 
	var $valuesString;

	function ItemOptionList() {
		$this->name = '';
		$this->values = array();
	} 
	function init($option) {
		if (!empty($option)) {  
			$valeurs = explode("::", $option['VALUE']); 
		 	$this->id = $option['ID'];
		 	$this->name = $option['NAME'];
		 	$this->valuesString = $option['VALUE'];
		 	foreach ($valeurs as $opt) {  array_push($this->values, $opt); } 
		} 
	} 
	function valuesHTML() {
		$result = '';
		if (!empty($this->values)) {  
		 	foreach ($this->values as $opt) { $result .= $opt.'<br/>';} 
		} 
		return $result;
	} 
}

?>models/ProductCategory2.php000060400000006135150710367660011754 0ustar00<?php
class ProductCategory2 extends Zend_Db_Table
{
	protected $_name = 'category2_product';
	protected $_primary = 'ID';
 
	public function getProductsByCategoryID($id) {
		$select = "SELECT p.*, cp2.ID IDPRODCAT2, pic.URL URL
				FROM category2_product cp2
				LEFT JOIN product AS p ON cp2.IDPRODUCT = p.ID
				LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID
				WHERE cp2.IDCATEGORY = ".$id." AND p.isACTIVE = 0
				AND pic.POSITION = 1"; 
		return $this->getAdapter()->fetchAll($select);
	}
	
	public function getAllProductsByCategoryID($id) {
		$select = "SELECT p.*, cp2.ID IDPRODCAT2
				FROM category2_product cp2
				LEFT JOIN product AS p ON cp2.IDPRODUCT = p.ID
				WHERE cp2.IDCATEGORY = ".$id;
		
		return $this->getAdapter()->fetchAll($select);
	}
	
	public function getAllProductsInfoByCategoryID($id, $triSql) { 
		$select = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM PRODNAVNOM,p.NAVTITRE NAVTITRE, p.NAVDESC NAVDESC, p.DESCRIPTIONSHORT DESCSHORT, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
							p.isPROMO isPROMO, pic.URL URL, sb.BREND BREND, sb.ID BRENDID, sb.URL BRENDURL, COUNT(pc.REFERENCE) NBREFERENCE, 
							c.NAVNOM CATNAVNOM, c.ID CATID, p.isSHOWBREND isSHOWBREND, p.KEYWORDS KEYWORDS_PROD,
							p.IDCATEGORY_DUP1 IDCATEGORY_DUP1,	p.IDCATEGORY_DUP2 IDCATEGORY_DUP2, p.IDCATEGORY_DUP3 IDCATEGORY_DUP3, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS	,						
							c.NOM CATNOM, p.BOOSTED_BESTSELLER BOOSTED_BESTSELLER
                            FROM category2_product cp2
							LEFT JOIN product AS p ON cp2.IDPRODUCT = p.ID
							LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
							LEFT JOIN category2 c ON c.ID = cp2.IDCATEGORY  
							LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
							LEFT JOIN productchild pc ON pc.IDPRODUCT = p.ID
							WHERE cp2.IDCATEGORY = ".$id." 
							AND p.isACTIVE = 0
							AND pic.POSITION = 1
							GROUP BY ID
							ORDER BY ".$triSql; 
		return $this->getAdapter()->fetchAll($select);
	}
		 
	public function getAllProductsByCategoryIDList($listIds) {
		$select = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM PRODNAVNOM,p.NAVTITRE NAVTITRE, p.NAVDESC NAVDESC, p.DESCRIPTIONSHORT DESCSHORT, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
							p.isPROMO isPROMO, pic.URL URL, sb.BREND BREND, sb.ID BRENDID, sb.URL BRENDURL, COUNT(pc.REFERENCE) NBREFERENCE, 
							c.ID CATID, p.isSHOWBREND isSHOWBREND, p.KEYWORDS KEYWORDS_PROD,
							p.IDCATEGORY_DUP1 IDCATEGORY_DUP1,	p.IDCATEGORY_DUP2 IDCATEGORY_DUP2, p.IDCATEGORY_DUP3 IDCATEGORY_DUP3 
							FROM category2_product c 
							LEFT JOIN product p ON c.IDPRODUCT = p.ID
							LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
							LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
							LEFT JOIN productchild pc ON pc.IDPRODUCT = p.ID
				WHERE c.IDCATEGORY IN (".$listIds.") 
				AND p.isACTIVE = 0
				AND pic.POSITION = 1"; 
		return $this->getAdapter()->fetchAll($select);
	}
	 
	public function getAllCategoriesByProductID($id) {
		$select = "SELECT c2.*, cp2.ID IDPRODCAT2
				FROM category2_product cp2
				LEFT JOIN category2 AS c2 ON cp2.IDCATEGORY = c2.ID
				WHERE cp2.IDPRODUCT = ".$id;
		
		return $this->getAdapter()->fetchAll($select);
	}
	
	 
}
?>models/ClickStats.php000060400000002136150710367660010615 0ustar00<?php
class ClickStats extends Zend_Db_Table
{
    protected $_name = 'click_stats';
    protected $_primary = 'ID';
	
	public function getIPStats() {
		$select = "
				SELECT c.IP Ip, c.SOURCE Source, COUNT(c.SOURCE) NbSource
				FROM click_stats AS c
				GROUP BY c.IP, c.SOURCE
				ORDER BY NbSource DESC;";
		return $this->getAdapter()->fetchAll($select);
	}
	
	public function getSourceStats() {
		$select = "
				SELECT c.SOURCE Source, COUNT(c.SOURCE) NbSource
				FROM click_stats AS c
				GROUP BY c.SOURCE
				ORDER BY c.SOURCE ASC;";
		
		return $this->getAdapter()->fetchAll($select);
	}
	

	
	public function getClickDetail() {
		$select = "
				SELECT c.IP IP,c.DATEINSERT DATEINSERT, c.SOURCE SOURCE, c.URL URL, COUNT(c.URL) NbURL
				FROM click_stats AS c
				GROUP BY IP, URL
				ORDER BY c.URL ASC;";
		
		return $this->getAdapter()->fetchAll($select);
	}
	

	
	public function getProductDetail() {
		$select = "
				SELECT c.SOURCE SOURCE, c.URL URL, COUNT(c.URL) NbURL
				FROM click_stats AS c
				GROUP BY URL
				ORDER BY NbURL DESC;";
		
		return $this->getAdapter()->fetchAll($select);
	}
}
?>models/ProductChildFTFDS.php000060400000000703150710367660011722 0ustar00<?php
class ProductChildFTFDS extends Zend_Db_Table
{
    protected $_name = 'productchild_ftfds';
    protected $_primary = 'ID';

	public function getFTFDSByIdProduct($id) {
    	$select = "
						SELECT pcftfds.ID_CHILD ID_CHILD ,pcftfds.URL URL
							FROM productchild_ftfds AS pcftfds 
						LEFT JOIN productchild AS pc ON pcftfds.ID_CHILD = pc.ID
						WHERE pc.IDPRODUCT = ".$id;
    	return $this->getAdapter()->fetchAll($select);
    }
}
?>models/PromoCommand.php000060400000002251150710367660011142 0ustar00<?php
class PromoCommand extends Zend_Db_Table
{
    protected $_name = 'promo_command';
    protected $_primary = 'ID';

	/*
	 * Remise selon le nombre de produits
	 */
    public function getRemiseCommandByProductQte($reference, $qte) {   try {
    	return $this->select()->where("CHILDREFERENCE = ?", $reference)->where("CHILDNBR <= ?", $qte)->query()->fetch(); 
   		} catch (Zend_Exception $e) { return array(); }
    }
    
    /*
	 * Remise selon le TOTAL HT
	 */
    public function getRemiseCommandByTotalHT($totalHT) { try {
    	return $this->select()->where("MONTANTEQUAL < ?", $totalHT)->order('MONTANTEQUAL DESC')->query()->fetch(); 
   		} catch (Zend_Exception $e) { return array(); }
    }
     
    /*
	 * Remise de toute les commandes
	 */
    public function getRemiseCommandByAll() { try {
    	return $this->select()->where("isALL IS NOT NULL")->query()->fetch();  
   		} catch (Zend_Exception $e) { return array(); }
    }
     
    /*
	 * Si la commande est valid
	 */
    public function getCommandValid() { try {
    	return $this->select()->where('MONTANTVALID IS NOT NULL')->query()->fetch();  
   		} catch (Zend_Exception $e) { return array(); }
    }
     
}
?>models/LogAdmin.php000060400000000166150710367660010244 0ustar00<?php
class LogAdmin extends Zend_Db_Table
{
    protected $_name = 'log_admin';
    protected $_primary = 'ID';

}
?>models/AnnonceFrontHeader.php000060400000000600150710367660012246 0ustar00<?php
class AnnonceFrontHeader extends Zend_Db_Table
{
    protected $_name = 'annonce_front_header';
    protected $_primary = 'ID';

    public function getAnnonces() {
    	return $this->select()->where('isSHOW = 0')->order('NOM ASC')->query()->fetchAll();
	}
	

    public function getAllAnnonces() {
    	return $this->select()->order('NOM ASC')->query()->fetchAll();
	}
	
	
}
?>models/StatsSearch.php000060400000000617150710367660010777 0ustar00<?php
class StatsSearch extends Zend_Db_Table
{
    protected $_name = 'stats_search';
    protected $_primary = 'ID';


public function statsKeyWordYear() {
		$sql = "SELECT COUNT( 1 ) AS NB, VALUE
				FROM stats_search
				WHERE DATE( DATESTART ) >= DATE(  '".date('Y')."-01-01' ) 
				GROUP BY VALUE
				ORDER BY NB DESC 
				LIMIT 0 , 30";
		return $this->getAdapter()->fetchAll($sql);
	}
	
}
?>models/BlogCategory.php000060400000003517150710367660011136 0ustar00<?php
class BlogCategory extends Zend_Db_Table
{
    protected $_name = 'blogs_categories';
    protected $_primary = 'id'; 

    public function AllCategories($idParent) {

        $sql = "
		SELECT c0.title title0, c1.title title1, c2.title title2,
				c0.is_close is_close0, c1.is_close is_close1, c2.is_close is_close2,
				c0.is_publish is_publish0, c1.is_publish is_publish1, c2.is_publish is_publish2,
				c0.id id0, c1.id id1, c2.id id2,
				c0.id_parent id_parent0, c1.id_parent id_parent1, c2.id_parent id_parent2
		FROM blogs_categories AS c0
		LEFT JOIN blogs_categories AS c1 ON c1.id_parent = c0.ID
		LEFT JOIN blogs_categories AS c2 ON c2.id_parent = c1.ID
		WHERE c0.id_parent = ".$idParent."
		ORDER BY c0.id ,c1.id, c2.id ASC; "; 
		return $this->getAdapter()->fetchAll($sql);

    }
    public function getAllActivesCategories($id) {  
    	return $this->select()->where("is_publish = ?", 1)->where("id_parent = ?", $id) 
        ->order('title ASC')->query()->fetchAll(); 
	}  

         /*
    public function search($data) {  
        $title = empty($data['title']) ? "%" : "%".$data['title']."%";
    	return $this->select()->where("type = ?", $data['type'])->where("title like ?", $title)     
        ->where("is_publish = ?", $data['is_publish'])
        ->where("is_close = ?", $data['is_close'])
        ->order('title ASC')->query()->fetchAll(); 
	} 
     
    public function getAllActivesSubjects() {  
    	return $this->select()->where("type = ?", 2)->where("is_publish = ?", true)   
        ->order('title ASC')->query()->fetchAll(); 
	}   
    public function categoriesAll() {  
    	return $this->select()->where("type = ?", 1)->order('title ASC')->query()->fetchAll(); 
	}  
    public function subjectsAll() {  
    	return $this->select()->where("type = ?", 2)->order('title ASC')->query()->fetchAll(); 
	}  */
    
    
    
}
?>models/LivraisonPoids.php000060400000002322150710367660011513 0ustar00<?php
class LivraisonPoids extends Zend_Db_Table
{
    protected $_name = 'livraison_poids';
    protected $_primary = 'ID';

    public function getLists() {
    	return $this->select()->order('FROM ASC')->query()->fetchAll();
	}
	
	public function getGoodPrice($type, $poidsTotal) {
		$myresult = array();
		try {
			$sql = "
				SELECT lp.PRICE PRICE, lt.CMDFRANCO CMDFRANCO, lt.NOM NOMLIV
				FROM livraison_poids lp
				LEFT JOIN livraison_type lt ON lt.ID = lp.TYPE 
				WHERE lp.TYPE = ".$type."
				AND lp.FROM <= ".$poidsTotal."
				AND lp.TO >= ".$poidsTotal;
			$results = $this->getAdapter()->fetchAll($sql);
			if (isset($results) && !empty($results)) {
				foreach ($results as $result) {
					$myresult['PRICE'] = $result['PRICE'];
					$myresult['CMDFRANCO'] = $result['CMDFRANCO'];
					$myresult['NOMLIV'] = $result['NOMLIV'];
					break;
				}
			} else {
				$sql = "
					SELECT lt.CMDFRANCO CMDFRANCO, lt.NOM NOMLIV
					FROM livraison_type lt
					WHERE lt.ID = ".$type;
				$result = $this->getAdapter()->fetchRow($sql);
				$myresult['PRICE'] = 0;
				$myresult['CMDFRANCO'] = $result['CMDFRANCO'];
				$myresult['NOMLIV'] = $result['NOMLIV'];
			}
		} catch (Zend_Exception $e) {}
		return $myresult;
	}
}
?>models/PromoProduct.php000060400000003034150710367660011204 0ustar00<?php
class PromoProduct extends Zend_Db_Table
{
    protected $_name = 'promo_productchild';
    protected $_primary = 'ID';

    /*
	 * Promotion selon la reference d'un produit
	 */
    public function getRemiseByProductReference($reference) { 
    	try { return $this->select()->where("REFERENCE = ?", $reference)->query()->fetch();
    	} catch (Zend_Exception $e) { return array(); }
	}
    
    /*
	 * Promotion selon la marque d'un produit
	 */
    public function getRemiseByProductBrend($idbrend) {   
		try {
    		return $this->select()->where("IDBREND = ?", $idbrend)->query()->fetch();
   		} catch (Zend_Exception $e) { return array(); }
    }
    
    /*
	 * Promotion selon la category d'un produit
	 */
    public function getRemiseByProductCategory($idcategory) {  
    	try { return $this->select()->where("IDCATEGORY = ?", $idcategory)->query()->fetch();
   		} catch (Zend_Exception $e) { return array(); }
    } 
    
    /*
	 * Promotion selon la qte d'un produit
	 */
    public function getRemisesByProductQte($reference, $qte) {
    	try { return $this->select()->where("CHILDREFPROMO = ?", $reference)->where("CHILDREFPROMONB <= ?", $qte)->query()->fetchAll();
   		} catch (Zend_Exception $e) { return array(); } 
	 }
    
    /*
	 * Promotion selon la date de promotion d'un produit
	 */
    public function getRemiseByProductDateBetween($date) {
    	try { return $this->select()->where("DATEPROMOSTART <= ?", $date)->where("DATEPROMOEND >= ?", $date)->query()->fetch(); 
   		} catch (Zend_Exception $e) { return array(); }
	 }
}
?>models/AnnonceGallerie.php000060400000001205150710367660011573 0ustar00<?php
class AnnonceGallerie extends Zend_Db_Table
{
    protected $_name = 'annonce_gallery';
    protected $_primary = 'ID';

    public function getAnnonces() {
    	return $this->select()->where('isSHOW = 0')->order('POSITION ASC')->order('NOM ASC')->query()->fetchAll();
	}
	

    public function getAllAnnonces() {
    	return $this->select()->order('POSITION ASC')->order('NOM ASC')->query()->fetchAll();
	}
	
 	public function getAnnoncesByShow($idCat) {
 		return $this->select()->where('isSHOW = 0')->where("ID_CATS LIKE '%:".$idCat.":%' OR ID_CATS LIKE '%:0:%' ")->order('POSITION ASC')->order('NOM ASC')->query()->fetchAll();
 	}
}
?>models/User.php000060400000000607150710367660007470 0ustar00<?php
class User extends Zend_Db_Table
{
    protected $_name = 'user';
    protected $_primary = 'ID';

 	public function getUserByID($userID) {   
    	$result = $this->select()->where("ID = ?", $userID)->query()->fetch();	
        
        $carteFidelite = new CarteFidelite();
        $result['POINTFIDELITE'] = $carteFidelite->getInfosByUser($userID);
        return $result;
    }
}
?>models/UserCaddyType.php000060400000020117150710367660011275 0ustar00<?php
class UserCaddyType extends Zend_Db_Table
{
	protected $_name = 'user_caddytype';
	protected $_primary = 'ID';

	/*
	 * Recupere le caddy
	 */
	public function getCaddyTypeByUser($iduser) {
		return $this->select()->where("USERID = ?", $iduser)->query()->fetchAll();
	}

	public function getArticleByCaddyIdList($idList) {
		$sql = "SELECT uct.ID CADDYTYPEID, uct.REFERENCE REFERENCE, uct.USERID USERID, uct.REMISEEURO REMISEEURO, uct.REMISEPOUR REMISEPOUR, uct.isACTIF isCADDYTYPE_ACTIF,
    			u.NOM USERNOM, u.PRENOM USERPRENOM, 
    			pc.ID IDCHILD, pc.isDEVIS isDEVIS, pc.isPROMO isPROMOCHILD, pc.PRIX PRIX, pc.DESIGNATION DESIGNATION, 
    			pc.QUANTITYMIN QUANTITYMIN, pc.POIDS POIDS, pc.isFRANCODENIED isFRANCODENIED,
				p.NOM NOM,p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.ID IDPRODUCT, pic.URL URL,p.isPROMO isPROMO,
    			p.STOCK STOCK, p.IDCATEGORY IDCATEGORY, p.IDBREND IDBREND, p.isSHOWBREND isSHOWBREND, p.DATEPROMO DATEPROMO, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS,
				pc.POINTFIDELITE POINTFIDELITE 
                FROM user_caddytype AS uct
				LEFT JOIN user AS u ON uct.USERID = u.ID 
				LEFT JOIN productchild AS pc ON uct.REFERENCE = pc.REFERENCE
				LEFT JOIN product p ON pc.IDPRODUCT = p.ID
				LEFT JOIN category c ON p.IDCATEGORY= c.ID
				LEFT JOIN picture pic ON pc.IDPRODUCT = pic.IDPRODUCT
				WHERE uct.ID IN (".$idList.") 
				AND pic.POSITION = 1
				AND uct.isACTIF = 'Y' 
				AND p.isACTIVE = 0 
				ORDER BY uct.REFERENCE ASC";   
		return $this->getAdapter()->fetchAll($sql);
	}


	public function getArticleByCaddyId($id) {
		$sql = "SELECT uct.ID CADDYTYPEID, uct.REFERENCE REFERENCE, uct.USERID USERID, uct.REMISEEURO REMISEEURO, uct.REMISEPOUR REMISEPOUR, uct.isACTIF isCADDYTYPE_ACTIF,
    			u.NOM USERNOM, u.PRENOM USERPRENOM, 
    			pc.ID IDCHILD, pc.isDEVIS isDEVIS, pc.isPROMO isPROMOCHILD, pc.PRIX PRIX, pc.DESIGNATION DESIGNATION, 
    			pc.QUANTITYMIN QUANTITYMIN, pc.POIDS POIDS, pc.isFRANCODENIED isFRANCODENIED,
				p.NOM NOM,p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.ID IDPRODUCT, pic.URL URL,p.isPROMO isPROMO,
    			p.STOCK STOCK, p.IDCATEGORY IDCATEGORY, p.IDBREND IDBREND, p.isSHOWBREND isSHOWBREND, p.DATEPROMO DATEPROMO, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
				,pc.POINTFIDELITE POINTFIDELITE 
                FROM user_caddytype AS uct
				LEFT JOIN user AS u ON uct.USERID = u.ID 
				LEFT JOIN productchild AS pc ON uct.REFERENCE = pc.REFERENCE
				LEFT JOIN product p ON pc.IDPRODUCT = p.ID
			    LEFT JOIN category c ON p.IDCATEGORY = c.ID
				LEFT JOIN picture pic ON pc.IDPRODUCT = pic.IDPRODUCT
				WHERE uct.ID = ".$id." 
				AND pic.POSITION = 1
				AND uct.isACTIF = 'Y' 
				AND p.isACTIVE = 0
				ORDER BY uct.REFERENCE ASC"; 
		return $this->getAdapter()->fetchRow($sql);
	}

	public function getCaddyTypeByUserFull($iduser) {
		$sql = "SELECT uct.ID CADDYTYPEID, uct.REFERENCE REFERENCE, uct.USERID USERID, uct.REMISEEURO REMISEEURO, uct.REMISEPOUR REMISEPOUR, uct.isACTIF isCADDYTYPE_ACTIF,
    			u.NOM USERNOM, u.PRENOM USERPRENOM, 
    			pc.ID IDCHILD, pc.isDEVIS isDEVIS, pc.isPROMO isPROMOCHILD, pc.PRIX PRIX, pc.DESIGNATION DESIGNATION, 
    			pc.QUANTITYMIN QUANTITYMIN, pc.POIDS POIDS, pc.isFRANCODENIED isFRANCODENIED,
				p.NOM NOM,p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.ID IDPRODUCT, pic.URL URL,p.isPROMO isPROMO,
    			p.STOCK STOCK, p.IDCATEGORY IDCATEGORY, p.IDBREND IDBREND, p.isSHOWBREND isSHOWBREND, p.DATEPROMO DATEPROMO, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
				,pc.POINTFIDELITE POINTFIDELITE 
                FROM user_caddytype AS uct
				LEFT JOIN user AS u ON uct.USERID = u.ID 
				LEFT JOIN productchild AS pc ON uct.REFERENCE = pc.REFERENCE
				LEFT JOIN product p ON pc.IDPRODUCT = p.ID
			    LEFT JOIN category c ON p.IDCATEGORY = c.ID
				LEFT JOIN picture pic ON pc.IDPRODUCT = pic.IDPRODUCT
				WHERE uct.USERID = ".$iduser." 
				AND pic.POSITION = 1
				ORDER BY uct.REFERENCE ASC"; 
		return $this->getAdapter()->fetchAll($sql);
	}
	public function getCaddyTypeActiveByUserFull($iduser) { 
		$sql = "SELECT uct.ID CADDYTYPEID, uct.REFERENCE REFERENCE, uct.USERID USERID, uct.REMISEEURO REMISEEURO, uct.REMISEPOUR REMISEPOUR, uct.isACTIF isCADDYTYPE_ACTIF,
    			u.NOM USERNOM, u.PRENOM USERPRENOM, 
    			pc.ID IDCHILD, pc.isDEVIS isDEVIS, pc.isPROMO isPROMOCHILD, pc.PRIX PRIX, pc.DESIGNATION DESIGNATION, 
    			pc.QUANTITYMIN QUANTITYMIN, pc.POIDS POIDS, pc.isFRANCODENIED isFRANCODENIED,
				p.NOM NOM,p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.ID IDPRODUCT, pic.URL URL,p.isPROMO isPROMO,
    			p.STOCK STOCK, p.IDCATEGORY IDCATEGORY, p.IDBREND IDBREND, p.isSHOWBREND isSHOWBREND, p.DATEPROMO DATEPROMO, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
				,pc.POINTFIDELITE POINTFIDELITE 
                FROM user_caddytype AS uct
				LEFT JOIN user AS u ON uct.USERID = u.ID 
				LEFT JOIN productchild AS pc ON uct.REFERENCE = pc.REFERENCE
				LEFT JOIN product p ON pc.IDPRODUCT = p.ID
			    LEFT JOIN category c ON p.IDCATEGORY = c.ID
				LEFT JOIN picture pic ON pc.IDPRODUCT = pic.IDPRODUCT
				WHERE uct.USERID = ".$iduser." 
				AND pic.POSITION = 1
				AND uct.isACTIF = 'Y'
				AND p.isACTIVE = 0 
				ORDER BY uct.REMISEEURO DESC,uct.REMISEPOUR DESC "; 
		return $this->getAdapter()->fetchAll($sql);
	}

	public function computeCaddyTypeByUser($iduser, $isQteTotal) {
		$results = $this->getCaddyTypeByUserFull($iduser);
		if ($results) {
			$facture = new Facture();
			$command = new Command();
			foreach ($results as $row) {
				if (empty($facture->user_id)) {
					$facture->user_id = $row['USERID'];
					$facture->user_nom = $row['USERNOM'];
					$facture->user_prenom = $row['USERPRENOM'];
				}
					
				$factureLine = new FactureLine();
				$factureLine->setLineInfo($row, 0, "N");
				$factureLine->isCaddyType = true;
				$factureLine->caddytype_id = $row['CADDYTYPEID'];
				$factureLine->caddytype_isActif = $row['isCADDYTYPE_ACTIF'];
				if ($isQteTotal) {
					$factureLine->caddytype_qte_total = $command->getTotalQteByReferenceAndUser($iduser, $factureLine->item_reference);
				}

				if ($row['REMISEEURO'] > 0) { $factureLine->remise_euro = $row['REMISEEURO']; $factureLine->setPromo(true);}
				else if ($row['REMISEPOUR'] > 0) { $factureLine->remise_pour = $row['REMISEPOUR']; $factureLine->setPromo(true);}
				else {$factureLine->setPromo(false);}

				$facture->addLine($factureLine);
			}
			return $facture;
		}
		return false;
	}

	public function computeFrontCaddyTypeByUser($user, $caddy, $isPromo) {
		$results = $this->getCaddyTypeActiveByUserFull($user['id']);
		if ($results) {
			$itemsListType = array();
			foreach ($results as $row) {
				$itemCaddyType = new ItemCaddyType();
				$itemCaddyType->setLineInfo($row, 0);
				
				if ($itemCaddyType->isPromo()) {
					$itemCaddyType->isPromoCaddyType = true;
					if (!empty($caddy) && !empty($caddy->itemsCaddyType)) {
						foreach ($caddy->itemsCaddyType as $caddyLine) {
							if ($caddyLine->id == $row['CADDYTYPEID']) {
								$itemCaddyType->qte = $caddyLine->qte;
								break;
							}
						}
					}
				} else {
					//On recup la qte du caddy normal
					if (!empty($caddy) && !empty($caddy->items)) {
						foreach ($caddy->items as $caddyLine) {
							if ($caddyLine->idChild == $row['IDCHILD']) {
								$itemCaddyType->qte = $caddyLine->qteChild;
								break;
							}
						}
					}
				}
				array_push($itemsListType, $itemCaddyType);
			}
				
			if ($isPromo && isset($itemsListType) && !empty($itemsListType)) {
				$promo = new PromoCalculator();
				$promo->computeItemsPromosCaddyType($itemsListType, $user);
			}
			return $itemsListType;
		}
		return false;
	}

	public function addNewUserItem($reference, $userid) {
		if (!empty($reference) &&  (int)$userid > 0 ) {
			if (!$this->isReferenceExist($reference, $userid)) {
				$data = array (
 		 						'REFERENCE' => $reference,
								'USERID' => $userid,
								'REMISEEURO' => 0,
						 		'REMISEPOUR' => 0,
						 		'isACTIF' => 'Y' 
						 		);
						 		$this->insert($data);
			}
		}
	}

	public function isReferenceExist($reference, $userid) {
		$result = $this->select()->where("USERID = ?", $userid)->where("REFERENCE = ?", $reference)->query()->fetch();
		if ($result) { return true; }
		return false;
	}
}
?>models/PaypalPaiement.php000060400000000202150710367660011452 0ustar00<?php
class PaypalPaiement extends Zend_Db_Table
{
    protected $_name = 'paiement_paypal';
    protected $_primary = 'ID';

}
?>models/KeyMap.php000060400000023301150710367660007734 0ustar00<?php
class KeyMap extends Zend_Db_Table
{
    protected $_name = 'key_map';
    protected $_primary = 'ID';

	public function getKeyCleaned($words, $nb) {
		$result = explode(",", $words);
		return array_slice($result, 0, $nb, true);
	}

    public function getKeyByPositionAndCatId($idCat, $listIds) {    
    	$selectCat = "
				SELECT c.NOM CAT_NOM, c.NAVNOM CAT_NAVNOM, c.DESCRIPTION CAT_DESCRIPTION, c.ID CAT_ID, c.KEYWORDS KEYWORDS, c.NAVNOM_URLPARENTS CAT_NAVNOM_URLPARENTS
				FROM category AS c
				WHERE c.ID IN (".$listIds.")
				GROUP BY c.ID
				LIMIT 0 , 10;";
    	$result =  $this->getAdapter()->fetchAll($selectCat);
    	

    	$catIds = explode(",", $listIds);
    	if (sizeof($catIds) == 1) {
    		$selectProd = "
				SELECT c.NOM CAT_NOM, c.NAVNOM CAT_NAVNOM, c.DESCRIPTION CAT_DESCRIPTION, c.ID CAT_ID, p.KEYWORDS KEYWORDS,
				p.NAVNOM PROD_NAVNOM, p.ID PROD_ID, c.NAVNOM_URLPARENTS CAT_NAVNOM_URLPARENTS
    				FROM category AS c
				LEFT JOIN product AS p ON p.IDCATEGORY = c.ID
    			WHERE c.ID = ".$idCat." 
				LIMIT 0 , 10;";
    		$result2 = $this->getAdapter()->fetchAll($selectProd);
    		$result = array_merge((array)$result, (array)$result2);
    	}
    	return $result;
    }
    
	public function getAllByPOSITION() {
		$selectCat = "
				SELECT k.ID ID, k.CATID CATID, k.POSITION POSITION, k.SIZE SIZE,k.COLOR COLOR, k.TYPE TYPE, k.isSHOW isSHOW,
				c.NOM CAT_NOM, c.NAVNOM CAT_NAVNOM, c.DESCRIPTION CAT_DESCRIPTION
				FROM key_map AS k
				LEFT JOIN category AS c ON c.ID = k.CATID
				WHERE k.isSHOW = 1 AND 
				k.TYPE = 'CAT'
				ORDER BY k.POSITION ASC
				LIMIT 0 , 20;";
		
		$selectBrend = "
				SELECT k.ID ID, k.BRENDID BRENDID, k.POSITION POSITION, k.SIZE SIZE,k.COLOR COLOR, k.TYPE TYPE, k.isSHOW isSHOW,
				b.BREND BREND_NOM
				FROM key_map AS k
				LEFT JOIN supplier_brend AS b ON b.ID = k.BRENDID
				WHERE k.isSHOW = 1 AND 
				k.TYPE = 'BREND'
				ORDER BY k.POSITION ASC
				LIMIT 0 , 20;";

			$listCat = $this->getAdapter()->fetchAll($selectCat);
			
			$listMap = array();
			$i = 0;	
					
			foreach ($listCat as $row) {
				$listMap[$i]['ID'] = $row['ID'];
				$listMap[$i]['CATID'] = $row['CATID'];
				$listMap[$i]['SIZE'] = $row['SIZE'];
				$listMap[$i]['TYPE'] = $row['TYPE'];
				$listMap[$i]['isSHOW'] = $row['isSHOW'];
				$listMap[$i]['COLOR'] = $row['COLOR'];
				$listMap[$i]['CAT_NAVNOM'] = $row['CAT_NAVNOM'];
				$listMap[$i]['CAT_DESCRIPTION'] = $row['CAT_DESCRIPTION'];
				$listMap[$i]['TITRE'] = $row['CAT_NOM'];
				$i++;
			}
			
			$listBrend = $this->getAdapter()->fetchAll($selectBrend);
			foreach ($listBrend as $row) {
				$listMap[$i]['ID'] = $row['ID'];
				$listMap[$i]['BRENDID'] = $row['BRENDID'];
				$listMap[$i]['SIZE'] = $row['SIZE'];
				$listMap[$i]['TYPE'] = $row['TYPE'];
				$listMap[$i]['COLOR'] = $row['COLOR'];
				$listMap[$i]['isSHOW'] = $row['isSHOW'];
				$listMap[$i]['TITRE'] = $row['BREND_NOM'];
				$i++;
			}
		return $listMap;
	}
	
public function getAllByCAT() {
		$select = "
				SELECT k.ID ID, k.CATID CATID, k.POSITION POSITION,k.COLOR COLOR, k.SIZE SIZE, k.TYPE TYPE, k.isSHOW isSHOW, k.VIEW VIEW,
				c.NOM CAT_NOM, c.NAVNOM CAT_NAVNOM, c.DESCRIPTION CAT_DESCRIPTION
				FROM key_map AS k
				LEFT JOIN category AS c ON c.ID = k.CATID
				ORDER BY c.NOM ASC";
		
			$listTemp = $this->getAdapter()->fetchAll($select);
			
			$listMap = array();
			foreach ($listTemp as $row) {
					$listMap[$row['CATID']]['ID'] = $row['ID'];
					$listMap[$row['CATID']]['CATID'] = $row['CATID'];
					$listMap[$row['CATID']]['POSITION'] = $row['POSITION'];
					$listMap[$row['CATID']]['SIZE'] = $row['SIZE'];
					$listMap[$row['CATID']]['TYPE'] = $row['TYPE'];
					$listMap[$row['CATID']]['isSHOW'] = $row['isSHOW'];
					$listMap[$row['CATID']]['COLOR'] = $row['COLOR'];
					$listMap[$row['CATID']]['VIEW'] = $row['VIEW'];
					$listMap[$row['CATID']]['CAT_NOM'] = $row['CAT_NOM'];
					$listMap[$row['CATID']]['CAT_NAVNOM'] = $row['CAT_NAVNOM'];
					$listMap[$row['CATID']]['CAT_DESCRIPTION'] = $row['CAT_DESCRIPTION'];
			}
			return $listMap;
	}
	

public function getAllByBREND() {
		$select = "
				SELECT k.ID ID, k.BRENDID BRENDID, k.POSITION POSITION,k.COLOR COLOR, k.SIZE SIZE, k.TYPE TYPE, k.isSHOW isSHOW, k.VIEW VIEW,
				b.BREND BREND_NOM
				FROM key_map AS k
				LEFT JOIN supplier_brend AS b ON b.ID = k.BRENDID
				ORDER BY b.BREND ASC;";
		
			$listTemp = $this->getAdapter()->fetchAll($select);
			
			$listMap = array();
			foreach ($listTemp as $row) {					
					$listMap[$row['BRENDID']]['ID'] = $row['ID'];
					$listMap[$row['BRENDID']]['BRENDID'] = $row['BRENDID'];
					$listMap[$row['BRENDID']]['POSITION'] = $row['POSITION'];
					$listMap[$row['BRENDID']]['SIZE'] = $row['SIZE'];
					$listMap[$row['BRENDID']]['TYPE'] = $row['TYPE'];
					$listMap[$row['BRENDID']]['COLOR'] = $row['COLOR'];
					$listMap[$row['BRENDID']]['VIEW'] = $row['VIEW'];
					$listMap[$row['BRENDID']]['isSHOW'] = $row['isSHOW'];
					$listMap[$row['BRENDID']]['BREND_NOM'] = $row['BREND_NOM'];
			}
			return $listMap;
	}

public function getKeyByCatID($catID) {
		$select = "
				SELECT k.ID ID, k.CATID CATID, k.BRENDID BRENDID,k.COLOR COLOR, k.POSITION POSITION, k.SIZE SIZE, k.TYPE TYPE, k.isSHOW isSHOW,
				c.NOM CAT_NOM, c.NAVNOM CAT_NAVNOM, c.DESCRIPTION CAT_DESCRIPTION
				FROM key_map AS k
				LEFT JOIN category AS c ON c.ID = k.CATID
				WHERE k.CATID = ".$catID." 
				ORDER BY c.NOM ASC";

			$key = $this->getAdapter()->fetchRow($select);
						
			return $key;
	}
public function getKeyByBrendID($brendID) {
		$select = "
				SELECT k.ID ID, k.BRENDID BRENDID,k.COLOR COLOR, k.POSITION POSITION, k.SIZE SIZE, k.TYPE TYPE, k.isSHOW isSHOW,
				b.BREND BREND_NOM
				FROM key_map AS k
				LEFT JOIN supplier_brend AS b ON b.ID = k.BRENDID
				WHERE k.BRENDID = ".$brendID." 
				ORDER BY b.BREND ASC";

			$key = $this->getAdapter()->fetchRow($select);
			
			return $key;
	}

	private function computeKeySize($view) {
		if ($view < 1000) { return 10; }
		if ($view < 1500) { return 15; }
		if ($view < 2000) { return 20; }
		if ($view < 2500) { return 25; }
		if ($view < 3000) { return 30; }
		if ($view < 3500) { return 35; }
		return 40;
	}
	
	private function computeUrl() {
		
		    $controllerName = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
            $actionName = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
            $paramArray = Zend_Controller_Front::getInstance()->getRequest()->getParams();
            $params = '';
            $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
            foreach($paramArray as $key => $value) {
                if($key <> "module" && $key <> "controller" && $key <> "action") {
                    $params .= $key . "/" . $value . "/";
                }
            }
            $url = $baseUrl."/" . $controllerName . "/" . $actionName . "/" . $params;
            
            return $url;	
	}
	
	private function computeSource() {
		
		    $paramArray = Zend_Controller_Front::getInstance()->getRequest()->getParams();
            $source = '';
            foreach($paramArray as $key => $value) {
                if ($key == "source") {
                	$source = $value;
                }
            }
            $result = 'Lien Direct';
            if ($source == 'hellopro') {
            	$result = "Redirection : Hello Pro";
            } 
            return $result;	
	}
	
	private function isIpBan($ip) {
		$paramIp = new ParamIp();
		$sql = "SELECT * FROM admin_param_ip WHERE isBAN = 1 AND IP = '".$ip."'";
		$result = $paramIp->getAdapter()->fetchAll($sql);
		
		if (!empty($result)) {
			return true;
		} 
		return false;
	}
private function logMe($message , $level) {
		$loggerDefault = Zend_Registry::get('loggerDefault');
		if ($level == 'info') {
			$loggerDefault->info($message);
		} elseif ($level == 'err') {
			$loggerDefault->err($message);
		} elseif ($level == 'warn') {
			$loggerDefault->warn($message);
		} elseif ($level == 'crit') {
			$loggerDefault->crit($message);
		}
	}
	
	public function updateCatEntry($catId) {
		$currentIp = $_SERVER['REMOTE_ADDR'];
		if (!$this->isIpBan($currentIp)) {	
			$select = "SELECT k.VIEW VIEW FROM key_map AS k WHERE k.CATID = ".$catId;
			$result = $this->getAdapter()->fetchRow($select);
			$view = ((int)$result['VIEW'])+1;
			//$size = $this->computeKeySize($view);
			$url = $this->computeUrl();
			
			$date = new Zend_Date();
			
			//$this->logMe("Click Cat : IP : ".$currentIp." <br> VIEW : ".$view." <br>  URL : ".$url." <br> DATE : ".$date->toString('YYYY-MM-dd HH:mm:ss')." <br> IDCAT : ".$catId,'info');
						
			if (!empty($result)) {
				$data = array(
		          'VIEW'  => $view
				   //'SIZE' => $size
		      	);
		        $this->getAdapter()->update('key_map', $data, 'CATID = '.$catId);
			}
			
			$clickStats = new ClickStats();
			$data = array(
		          'URL'  => $url,
				   'IP' => $currentIp,
					'DATEINSERT' => $date->toString('YYYY-MM-dd HH:mm:ss'),
					'SOURCE' => $this->computeSource()
		      	);
			$clickStats->insert($data);
		}
	}
	
	public function updateBrendEntry($brendId) {
		
		$currentIp = $_SERVER['REMOTE_ADDR'];
		if (!$this->isIpBan($currentIp)) {	
		
		$select = "SELECT k.VIEW VIEW FROM key_map AS k WHERE k.BRENDID = ".$brendId;
		$result = $this->getAdapter()->fetchRow($select);
		$view = ((int)$result['VIEW'])+1;
		//$size = $this->computeKeySize($view);
		
		$url = $this->computeUrl();
			$date = new Zend_Date();
		//$this->logMe("Click Brend : IP : ".$currentIp." <br> VIEW : ".$view." <br>  URL : ".$url." <br> DATE : ".$date->toString('YYYY-MM-dd HH:mm:ss')." <br> IDBREND : ".$brendId,'info');
			
		
		if (!empty($result)) {
			$data = array(
	          'VIEW'      => $view
			  // 'SIZE' => $size
	      	);
	        $this->getAdapter()->update('key_map', $data, 'BRENDID = '.$brendId);
		}
		}
	}
	
}
?>models/ProductAnnexe.php000060400000003546150710367660011336 0ustar00<?php
class ProductAnnexe extends Zend_Db_Table
{
	protected $_name = 'product_annexe';
	protected $_primary = 'ID';

	public function getAnnexesByProductID($id, $triSql) {
		$results = array();
		try {
			$select = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM NAVNOM,p.NAVTITRE NAVTITRE, p.NAVDESC NAVDESC, p.DESCRIPTIONSHORT DESCSHORT, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
							p.isPROMO isPROMO, pic.URL URL, sb.BREND BREND, sb.URL BRENDURL, COUNT(pc.REFERENCE) NBREFERENCE, 
							c.NAVNOM CATNAVNOM, p.isSHOWBREND isSHOWBREND, p.KEYWORDS KEYWORDS_PROD, c.ID CATID, sb.ID BRENDID, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS,
                            c.NOM CATNOM, p.BOOSTED_BESTSELLER BOOSTED_BESTSELLER 
							FROM product_annexe pa
							LEFT JOIN product AS p ON pa.IDANNEXE = p.ID 
							LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
							LEFT JOIN category c ON c.ID = p.IDCATEGORY 
							LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
							LEFT JOIN productchild pc ON pc.IDPRODUCT = p.ID 
							WHERE pa.IDPRODUCT = ".$id." 
							AND p.isACTIVE = 0
							AND pic.POSITION = 1
							GROUP BY ID
							ORDER BY ".$triSql;

			$results = $this->getAdapter()->fetchAll($select);
		} catch (Zend_Exception $e) { }
		return $results;
	}

	public function insertAnnexe($idproduct, $idannexe) {
		try {
			$select = "
				SELECT COUNT(pa.ID) NBR
				FROM product_annexe pa 
				WHERE pa.IDPRODUCT = ".$idproduct."
				AND pa.IDANNEXE = ".$idannexe; 
				
			$result = $this->getAdapter()->fetchRow($select);

			if ($result['NBR'] == 0) {
				$data = array (
	    			'IDPRODUCT' => $idproduct,
	    			'IDANNEXE' => $idannexe
				);
				$this->insert($data);
			}
		} catch (Zend_Exception $e) { }
	}

	public function deleteAnnexe($idproduct, $idannexe) {
		try {
			$this->delete("IDPRODUCT = ".$idproduct." AND IDANNEXE = ".$idannexe);
		} catch (Zend_Exception $e) { }
	}
}
?>models/AnnonceFooter.php000060400000000552150710367660011311 0ustar00<?php
class AnnonceFooter extends Zend_Db_Table
{
    protected $_name = 'annonce_footer';
    protected $_primary = 'ID';

    public function getAnnoncesByShow($isShow, $controller) {
    	return $this->select()->where('isSHOW = '.$isShow)->where("CONT_NAME LIKE '%".$controller."%' ")->order('isSHOW ASC')->order('TITRE ASC')->query()->fetchAll();
	}
	
	
}
?>models/CarteFidelite.php000060400000006775150710367660011272 0ustar00<?php
class CarteFidelite extends Zend_Db_Table
{
    protected $_name = 'carte_fidelite';
    protected $_primary = 'ID';

    public function getAnnoncesByShow($isShow) {
    	return $this->select()->where('isSHOW = '.$isShow)->order('isSHOW ASC')->order('POINTFIDELITE ASC')->query()->fetchAll();
	}
    
    public function isAnnonceAvailableForUser($iduser, $idFidelite) {
        $infoUser = $this->getInfosByUser($iduser);
        $sql = "select count(*) TOTAL from carte_fidelite cf
        where cf.POINTFIDELITE <= ".$infoUser['POINTFIDELITETOTAL']." 
        and cf.isSHOW = 1 
        and cf.ID = ".$idFidelite." 
        order by cf.POINTFIDELITE asc";
		$result = $this->getAdapter()->fetchRow($sql);
        if (isset($result) && $result['TOTAL'] > 0) {return true;}        
        return false;
	}
    
    public function getAnnoncesByAvailability($iduser) {
        $infoUser = $this->getInfosByUser($iduser);
        $sql = "select cf.* from carte_fidelite cf
        where cf.POINTFIDELITE <= ".$infoUser['POINTFIDELITETOTAL']." 
        and cf.isSHOW = 1 
        order by cf.POINTFIDELITE asc";
		return $this->getAdapter()->fetchAll($sql);
	}
    
    public function getAnnoncesByAvailabilityWithoutCurrent($iduser) {
        $infoUser = $this->getInfosByUser($iduser);
        $sql = "select cf.* from carte_fidelite cf
        where cf.POINTFIDELITE > ".$infoUser['POINTFIDELITETOTAL']." 
        and cf.isSHOW = 1 
        order by cf.POINTFIDELITE asc";
		return $this->getAdapter()->fetchAll($sql);
	}
    
    public function getInfosByUser($userID) {
        $sql = "SELECT IFNULL(sum(cf.NBPOINT), 0) POINTFIDELITETOTAL, count(1) NBPRODUCTTOTAL 
        FROM command_fidelite  as cf 
        LEFT JOIN command as c on c.id = cf.idcommand
        WHERE c.iduser = ".$userID;
        
        $sqlProd = "SELECT IFNULL(sum(cp.POINTFIDELITE), 0) POINTFIDELITETOTAL, IFNULL(sum(cp.POINTFIDELITESUM), 0) POINTFIDELITESUMTOTAL
        FROM command  as c
        LEFT JOIN command_product as cp on c.id = cp.idcommand 
        WHERE cp.POINTFIDELITE > 0
        and  c.iduser = ".$userID;
		
        $resultUser = $this->getAdapter()->fetchRow($sql);
        $resultProd = $this->getAdapter()->fetchRow($sqlProd);
        
        $result = array();
        if ($this->isSumOfProducts()) {
            $result['POINTFIDELITETOTAL'] = $resultProd['POINTFIDELITESUMTOTAL'] - $resultUser['POINTFIDELITETOTAL'];
        } else {
            $result['POINTFIDELITETOTAL'] = $resultProd['POINTFIDELITETOTAL'] - $resultUser['POINTFIDELITETOTAL'];
        }
        if ($result['POINTFIDELITETOTAL'] < 0) {
            $result['POINTFIDELITETOTAL'] = 0;
        }
        $result['NBPRODUCTTOTAL'] = $resultUser['NBPRODUCTTOTAL'];
        return $result;
	}
    
    
    public function getCommandUserCarteFidelite($id) {
        $sql = "SELECT c.* 
        FROM command c 
		INNER JOIN command_product AS cp ON cp.IDCOMMAND = c.ID 
		INNER JOIN command_fidelite AS cf ON cf.IDCOMMAND = c.ID 
        WHERE c.IDUSER = ".$id."
        GROUP BY c.id
        ORDER BY c.DATESTART desc";       
        return $this->getAdapter()->fetchAll($sql);
    }
    
    private function isSumOfProducts() {
        $registry = Zend_Registry::getInstance();
		$setting = $registry->get('setting');
        return $setting->carte_fidelite_sum_product_enabled;
    }
    
    public function getInfosEnableById($idFidelite) {
        $sql = "SELECT * FROM carte_fidelite WHERE id = ".$idFidelite." AND isSHOW = 1";
		return $this->getAdapter()->fetchRow($sql);
	}
    
    
}
?>models/CaddyTemp.php000060400000000605150710367660010422 0ustar00<?php
class CaddyTemp extends Zend_Db_Table
{
	protected $_name = 'caddy_temp';
	protected $_primary = 'ID';
	 
	public function findCaddyByUser($idUser) {
		$select = "SELECT ct.* FROM caddy_temp ct
				LEFT JOIN product AS p ON p.ID = ct.PRODUCTID
				WHERE USERID = ".$idUser."
				AND p.isACTIVE = 0
				ORDER BY DATEINS ASC";  
		return $this->getAdapter()->fetchAll($select);
	}
}
?>models/OptionProfil.php000060400000000477150710367660011203 0ustar00<?php
class OptionProfil extends Zend_Db_Table
{
    protected $_name = 'optionprofil';
    protected $_primary = 'ID';

	public function getProfils() {
		$select = "
				SELECT p.ID ID, p.NOM NOM, p.OPTS OPTS
				FROM optionprofil AS p
				ORDER BY NOM ASC;";
		return $this->getAdapter()->fetchAll($select);
	}
	
}
?>models/CommandFidelite.php000060400000000206150710367660011571 0ustar00<?php
class CommandFidelite extends Zend_Db_Table
{
    protected $_name = 'command_fidelite';
    protected $_primary = 'ID';
 	
}
?>models/BotDetector.php000060400000001521150710367660010764 0ustar00<?php  
class BotDetector {
	var $name;
	var $bot_list;

	function BotDetector() { 
		$this->bot_list = array("Teoma", "alexa", "froogle", "Gigabot", "inktomi",
					"looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory",
					"Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot",
					"crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp",
					"msnbot", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz",
					"Baiduspider", "Feedfetcher-Google", "TechnoratiSnoop", "Rankivabot",
					"Mediapartners-Google", "Sogou web spider", "WebAlta Crawler",
					"VoilaBot", "bingbot", "bot", "spider");  
	}

	public function isBot($User_Agent){  
		$result = 'ERROR';
		foreach($this->bot_list as $bot) { 
			if(preg_match("/".$bot."/i", $User_Agent)) { 
				$result = $bot; 
				break;
			}
		} 
		return $result; 
	} 
}

?>models/BlogComment.php000060400000003153150710367660010757 0ustar00<?php
class BlogComment extends Zend_Db_Table
{
    protected $_name = 'blogs_comments';
    protected $_primary = 'id'; 
        
    public function search($data) {  
        $select = " SELECT b.*, c.title category_name
				FROM blogs_comments b
				LEFT JOIN blogs_subjects AS s ON s.id = b.id_subject 
				LEFT JOIN blogs_categories AS c ON c.id = s.id_category
				WHERE "; 
        $select .= " b.is_publish = ".$data['is_publish'];     
        $select .= " AND c.is_close = ".$data['is_close'];     
        $select .= " AND s.is_close = ".$data['is_close'];    
         
        if (!empty($data['message'])) {   
            $select .= " AND b.message like '%".$data['message']."%'";    
        }
        
        $id_category =0;
        if ($data['id_subject'] > 0) {
            $id_category = $data['id_subject'];
        }     
        if ($id_category > 0) { 
            $select .= " AND b.id_subject = ".$id_category;
        } 
        $select .= " ORDER BY b.date_updated desc";  
		return $this->getAdapter()->fetchAll($select);
	}      

    public function AllCommentsBy($id) {  
        $select = " SELECT b.*, c.title category_name, c.is_close is_close_category, s.is_close is_close_subject
				FROM blogs_comments b
				LEFT JOIN blogs_subjects AS s ON s.id = b.id_subject 
				LEFT JOIN blogs_categories AS c ON c.id = s.id_category
				WHERE "; 
        $select .= " b.id_subject = ".$id;   
        $select .= " AND b.is_publish = 1";   
        $select .= " AND c.is_publish = 1";    
        $select .= " ORDER BY b.date_updated DESC ";  
		return $this->getAdapter()->fetchAll($select);
	}   

    
    
}
?>models/BlogSubject.php000060400000002711150710367660010753 0ustar00<?php
class BlogSubject extends Zend_Db_Table
{
    protected $_name = 'blogs_subjects';
    protected $_primary = 'id'; 
    
    public function AllSubjects() {
        $select = " SELECT b.*, c.title category_name
				FROM blogs_subjects b
				LEFT JOIN blogs_categories AS c ON c.id = b.id_category 
				 ORDER BY category_name ASC, b.title ASC "; 

		return $this->getAdapter()->fetchAll($select);
    }

    public function getPostBySearch($data) {  
      $select = " SELECT b.*, c.title category_name
				FROM blogs_subjects b
				LEFT JOIN blogs_categories AS c ON c.id = b.id_category 
				WHERE  b.is_close = ".$data['is_close']; 
        $select .= " AND b.is_publish = ".$data['is_publish']; 
        if ($data['id_category'] > 0) { 
            $select .= " AND b.id_category = ".$data['id_category'] ;
        }       
        if (!empty($data['title'])) {
            $select .= " AND b.title like '%".$data['title']."%'";
        }
        $select .= " ORDER BY b.date_updated DESC "; 

		return $this->getAdapter()->fetchAll($select);
	}    
    public function AllSubjectsBy($id) { 
            $select = " SELECT b.*, c.title category_name
				FROM blogs_subjects b
				LEFT JOIN blogs_categories AS c ON c.id = b.id_category 
                WHERE b.id_category = ".$id."
                AND c.is_publish = 1
                AND b.is_publish = 1
				 ORDER BY category_name ASC, b.title ASC "; 
		return $this->getAdapter()->fetchAll($select);
    } 
    
}
?>models/AnnonceContent.php000060400000000455150710367660011467 0ustar00<?php
class AnnonceContent extends Zend_Db_Table
{
    protected $_name = 'annonce_content';
    protected $_primary = 'ID';

    public function getAnnoncesByShow($isShow) {
    	return $this->select()->where('isSHOW = '.$isShow)->order('isSHOW ASC')->order('TITRE ASC')->query()->fetchAll();
	}
}
?>models/Command.php000060400000042175150710367660010136 0ustar00<?php
class Command extends Zend_Db_Table
{
	protected $_name = 'command';
	protected $_primary = 'ID';
    
    public function getCommandAsFacture($id) {
    $sql = "
					SELECT c.REFERENCE REFERENCE,c.ID ID, c.PRIXTOTALTTC TOTALTTC,c.PRIXTOTALHTFP TOTALHTFP, c.PRIXFRAISPORTPOUR FRAISPORTPOUR, c.PRIXFRAISPORT FRAISPORT,  c.PRIXTOTALHT TOTALHT, c.PRIXTOTALHTHR TOTALHTHR, c.PRIXREMISEEUR REMISEEUR,
					c.STATUT STATUT , c.DATESTART DATESTART,c.DATEEND DATEEND, c.LIV_RAISONSOCIAL LIVRAISONSOCIAL, c.LIV_ADRESSE LIVADRESSE, c.LIV_CP LIVCP, c.LIV_VILLE LIVVILLE, 
					c.LIV_PAYS LIVPAYS, c.FACT_RAISONSOCIAL FACTRAISONSOCIAL, c.FACT_ADRESSE FACTADRESSE, c.FACT_CP FACTCP , c.FACT_VILLE FACTVILLE , c.FACT_PAYS FACTPAYS, c.PAYMENT_STATUS PAYMENT_STATUS,c.TXN_ID TXN_ID, 
					cp.CHILDID CHILDID, cp.CHILDREF CHILDREF,cp.CHILDisPROMO CHILDisPROMO,cp.CHILDisDEVIS CHILDisDEVIS, cp.CHILDPRIX CHILDPRIX, cp.CHILDQUANTITY CHILDQUANTITY, cp.CHILDPROMOPRIX CHILDPROMOPRIX, cp.CHILDPRIXTOTAL CHILDPRIXTOTAL, cp.CHILDPRIXREMISE CHILDPRIXREMISE,
					cp.CHILDREMISEPRIXTAUXE CHILDREMISEPRIXTAUXE, cp.CHILDREMISEPRIXTAUXP CHILDREMISEPRIXTAUXP,
					p.ID PRODUCTID, p.NOM PRODUCTNOM, p.NAVNOM PRODUCTNAVNOM, pc.DESIGNATION DESIGNATION, p.STOCK STOCK,
					c.USER_NOM USERNOM, c.USER_PRENOM USERPRENOM, c.USER_TEL USERTEL, c.USER_FAX USERFAX, c.USER_EMAIL USEREMAIL, c.USER_MODEPAIEMENT USERMODEPAIEMENT, c.USER_NUMCOMPTE USERNUMCOMPTE,
					c.LIV_NOM LIV_NOM, c.CODEREDUCTION CODEREDUCTION, c.IDUSER IDUSER,
					cp.SELECTEDOPTION SELECTEDOPTION, c.USER_MODEPAIEMENT_TYPE USER_MODEPAIEMENT_TYPE, c.USER_MODEPAIEMENT_LABEL USER_MODEPAIEMENT_LABEL, c.DELIVERY_TRACKINGLINK DELIVERY_TRACKINGLINK,
                    c.DELIVERY_TRACKINGNUMBER DELIVERY_TRACKINGNUMBER, cat.NAVNOM_URLPARENTS NAVNOM_URLPARENTS, cp.ID IDLINE
					FROM command c 
					LEFT JOIN command_product AS cp ON cp.IDCOMMAND = c.ID 
					LEFT JOIN product AS p ON p.ID = cp.PRODUCTID
					LEFT JOIN category AS cat ON p.IDCATEGORY = cat.ID
					LEFT JOIN productchild AS pc ON pc.ID = cp.CHILDID
					WHERE c.ID = ".$id."
					ORDER BY pc.REFERENCE ASC
					";

        $resultCommande = $this->getAdapter()->fetchAll($sql);
        $myCommand = array();
        $myCommand['CADDY'] = array();
        $myCommand['CADDYFIDELITE'] = array();
        $i = 0;
        $idCommand = 0;

        foreach ($resultCommande AS $row) {
            if ($i == 0) {

                $myCommand['REFERENCE'] = $row['REFERENCE'];
                $myCommand['ID'] = $row['ID'];
                $idCommand = $row['ID'];
                
                $myCommand['PRIXTOTALTTC'] = sprintf("%.2f", $row['TOTALTTC']);
                $myCommand['PRIXTOTALHTFP'] = sprintf("%.2f", $row['TOTALHTFP']);
                $myCommand['PRIXFRAISPORTPOUR'] = $row['FRAISPORTPOUR'];
                $myCommand['PRIXFRAISPORT'] = sprintf("%.2f", $row['FRAISPORT']);
                $myCommand['PRIXTOTALHT'] = sprintf("%.2f", $row['TOTALHT']);
                $myCommand['PRIXTOTALHTHR'] = sprintf("%.2f", $row['TOTALHTHR']);
                $myCommand['PRIXREMISEEUR'] = sprintf("%.2f", $row['REMISEEUR']);
                $myCommand['DATESTART'] = $row['DATESTART'];
                $myCommand['DELIVERY_TRACKINGLINK'] = $row['DELIVERY_TRACKINGLINK'];
                $myCommand['DELIVERY_TRACKINGNUMBER'] = $row['DELIVERY_TRACKINGNUMBER'];

                $myCommand = $this->computeFactureTVA($myCommand, $row['LIVPAYS']);

                $myCommand['PAYMENT_STATUS'] = $row['PAYMENT_STATUS'];
                $myCommand['TXN_ID'] = $row['TXN_ID'];
                $myCommand['STATUT'] = $row['STATUT'];
                $myCommand['DATEEND'] = $row['DATEEND'];
                $myCommand['LIV_RAISONSOCIAL'] = $row['LIVRAISONSOCIAL'];
                $myCommand['LIV_ADRESSE'] = $row['LIVADRESSE'];
                $myCommand['LIV_CP'] = $row['LIVCP'];
                $myCommand['LIV_VILLE'] = $row['LIVVILLE'];
                $myCommand['LIV_PAYS'] = $row['LIVPAYS'];
                $myCommand['FACT_RAISONSOCIAL'] = $row['FACTRAISONSOCIAL'];
                $myCommand['FACT_ADRESSE'] = $row['FACTADRESSE'];
                $myCommand['FACT_CP'] = $row['FACTCP'];
                $myCommand['FACT_VILLE'] = $row['FACTVILLE'];
                $myCommand['FACT_PAYS'] = $row['FACTPAYS'];
                $myCommand['USER_NOM'] = $row['USERNOM'];
                $myCommand['USER_PRENOM'] = $row['USERPRENOM'];
                $myCommand['USER_TEL'] = $row['USERTEL'];
                $myCommand['USER_FAX'] = $row['USERFAX'];
                $myCommand['USER_EMAIL'] = $row['USEREMAIL'];
                $myCommand['USER_ID'] = $row['IDUSER'];

                $myCommand['USER_NUMCOMPTE'] = $row['USERNUMCOMPTE'];
                $myCommand['USER_MODEPAIEMENT'] = $row['USERMODEPAIEMENT'];
                $myCommand['LIV_NOM'] = $row['LIV_NOM'];
                $myCommand['CODEREDUCTION'] = $row['CODEREDUCTION'];
                $myCommand['USER_MODEPAIEMENT_TYPE'] = $row['USER_MODEPAIEMENT_TYPE'];
                $myCommand['USER_MODEPAIEMENT_LABEL'] = $row['USER_MODEPAIEMENT_LABEL'];
            }

            $myCommand['CADDY'][$i]['IDLINE'] = $row['IDLINE'];
            $myCommand['CADDY'][$i]['ID'] = $row['CHILDID'];
            $myCommand['CADDY'][$i]['REFERENCE'] = $row['CHILDREF'];
            $myCommand['CADDY'][$i]['DESIGNATION'] = $row['DESIGNATION'];
            $myCommand['CADDY'][$i]['isPROMO'] = $row['CHILDisPROMO'];
            $myCommand['CADDY'][$i]['isDEVIS'] = $row['CHILDisDEVIS'];
            $myCommand['CADDY'][$i]['PRIX'] = sprintf("%.2f", $row['CHILDPRIX']);
            $myCommand['CADDY'][$i]['QUANTITY'] = $row['CHILDQUANTITY'];
            $myCommand['CADDY'][$i]['PROMOPRIX'] = sprintf("%.2f", $row['CHILDPROMOPRIX']);
            $myCommand['CADDY'][$i]['PRIXTOTAL'] = sprintf("%.2f", $row['CHILDPRIXTOTAL']);
            $myCommand['CADDY'][$i]['REMISEPRIX'] = sprintf("%.2f", $row['CHILDPRIXREMISE']);
            $myCommand['CADDY'][$i]['REMISEPRIXTAUXE'] = sprintf("%.2f", $row['CHILDREMISEPRIXTAUXE']);
            $myCommand['CADDY'][$i]['REMISEPRIXTAUXP'] = $row['CHILDREMISEPRIXTAUXP'];
            $myCommand['CADDY'][$i]['PRODUCTID'] = $row['PRODUCTID'];
            $myCommand['CADDY'][$i]['PRODUCTNOM'] = $row['PRODUCTNOM'];
            $myCommand['CADDY'][$i]['STOCK'] = $row['STOCK'];
            $myCommand['CADDY'][$i]['SELECTEDOPTION'] = $row['SELECTEDOPTION'];

            $myCommand['CADDY'][$i]['NAVPRODUCTNOM'] = $row['PRODUCTNAVNOM'];
            $myCommand['CADDY'][$i]['NAVNOM_URLPARENTS'] = $row['NAVNOM_URLPARENTS'];

            $i++;
        }
        
        $i = 0;
		$resultCommandeFidelite = $this->findCommandFideliteByUserAndRef($idCommand);
		foreach ($resultCommandeFidelite AS $row) {
			$myCommand['CADDYFIDELITE'][$i]['IDFIDELITE'] = $row['IDFIDELITE'];
			$myCommand['CADDYFIDELITE'][$i]['NOM'] = $row['NOM'];
			$myCommand['CADDYFIDELITE'][$i]['NBPOINT'] = $row['NBPOINT'];
            $i++;
        }
                    
        return $myCommand;
    }
    
	private function computeFactureTVA($facture, $paysLivraison) {
		$fact = new Facture();
		$fact->computeFactureTVA($facture, $paysLivraison);
		return $facture;
	}


	/*
	 * STATISTIQUES 
	 * */
	public function statsBestSellForYear() {
		$sql = "SELECT p.NOM AS PROD_NOM, pc.REFERENCE AS REFERENCE, cat.NOM AS CAT_NOM, COUNT( 1 ) AS NB_CMD, SUM( cp.CHILDPRIXTOTAL ) AS TOTAL, SUM( cp.CHILDQUANTITY ) AS NB
				FROM command c
				LEFT JOIN command_product AS cp ON cp.IDCOMMAND = c.ID
				LEFT JOIN product AS p ON p.ID = cp.PRODUCTID
				LEFT JOIN category AS cat ON p.IDCATEGORY = cat.ID
				LEFT JOIN productchild AS pc ON pc.ID = cp.CHILDID
				WHERE DATE( c.DATESTART ) >= DATE(  '".date('Y')."-01-01' ) 
                AND c.STATUT <> 0 
				GROUP BY pc.REFERENCE
				ORDER BY TOTAL DESC 
				LIMIT 0 , 10";
		return $this->getAdapter()->fetchAll($sql);
	}
	public function statsBestSellForMonth() {
		$sql = "SELECT p.NOM AS PROD_NOM, pc.REFERENCE AS REFERENCE, cat.NOM AS CAT_NOM, COUNT( 1 ) AS NB_CMD, SUM( cp.CHILDPRIXTOTAL ) AS TOTAL, SUM( cp.CHILDQUANTITY ) AS NB
				FROM command c
				LEFT JOIN command_product AS cp ON cp.IDCOMMAND = c.ID
				LEFT JOIN product AS p ON p.ID = cp.PRODUCTID
				LEFT JOIN category AS cat ON p.IDCATEGORY = cat.ID
				LEFT JOIN productchild AS pc ON pc.ID = cp.CHILDID
				WHERE DATE( c.DATESTART ) >= DATE(  '".date('Y')."-".date('m')."-01' ) 
                AND c.STATUT <> 0 
				GROUP BY pc.REFERENCE
				ORDER BY TOTAL DESC 
				LIMIT 0 , 10";
		return $this->getAdapter()->fetchAll($sql);
	}
	
	public function statsNbProductYear() {
		$sql = "SELECT p.NOM AS PROD_NOM, pc.REFERENCE AS REFERENCE, cat.NOM AS CAT_NOM, COUNT( 1 ) AS NB_CMD, SUM( cp.CHILDPRIXTOTAL ) AS TOTAL, SUM( cp.CHILDQUANTITY ) AS NB
				FROM command c
				LEFT JOIN command_product AS cp ON cp.IDCOMMAND = c.ID
				LEFT JOIN product AS p ON p.ID = cp.PRODUCTID
				LEFT JOIN category AS cat ON p.IDCATEGORY = cat.ID
				LEFT JOIN productchild AS pc ON pc.ID = cp.CHILDID
				WHERE DATE( c.DATESTART ) >= DATE(  '".date('Y')."-01-01' ) 
                AND c.STATUT <> 0 
				GROUP BY pc.REFERENCE
				ORDER BY NB DESC 
				LIMIT 0 , 10";
		return $this->getAdapter()->fetchAll($sql);
	}
	
	public function statsNbProductMonth() {
		$sql = "SELECT p.NOM AS PROD_NOM, pc.REFERENCE AS REFERENCE, cat.NOM AS CAT_NOM, COUNT( 1 ) AS NB_CMD, SUM( cp.CHILDPRIXTOTAL ) AS TOTAL, SUM( cp.CHILDQUANTITY ) AS NB
				FROM command c
				LEFT JOIN command_product AS cp ON cp.IDCOMMAND = c.ID
				LEFT JOIN product AS p ON p.ID = cp.PRODUCTID
				LEFT JOIN category AS cat ON p.IDCATEGORY = cat.ID
				LEFT JOIN productchild AS pc ON pc.ID = cp.CHILDID
				WHERE DATE( c.DATESTART ) >= DATE(  '".date('Y')."-".date('m')."-01' ) 
                AND c.STATUT <> 0 
				GROUP BY pc.REFERENCE
				ORDER BY NB DESC 
				LIMIT 0 , 10";
		return $this->getAdapter()->fetchAll($sql);
	}
	
	public function statsCategoryCmdYear() {
		$sql = "SELECT cat.NOM AS CAT_NOM, COUNT( 1 ) AS NB_CMD, SUM( cp.CHILDPRIXTOTAL ) AS TOTAL
				FROM command c
				LEFT JOIN command_product AS cp ON cp.IDCOMMAND = c.ID
				LEFT JOIN product AS p ON p.ID = cp.PRODUCTID
				LEFT JOIN category AS cat ON p.IDCATEGORY = cat.ID
				LEFT JOIN productchild AS pc ON pc.ID = cp.CHILDID
				WHERE DATE( c.DATESTART ) >= DATE(  '".date('Y')."-01-01' ) 
                AND c.STATUT <> 0 
				GROUP BY CAT_NOM
				ORDER BY NB_CMD DESC 
				LIMIT 0 , 10";
		return $this->getAdapter()->fetchAll($sql);
	}
	
	public function statsCategoryCmdMonth() {
		$sql = "SELECT cat.NOM AS CAT_NOM, COUNT( 1 ) AS NB_CMD, SUM( cp.CHILDPRIXTOTAL ) AS TOTAL
				FROM command c
				LEFT JOIN command_product AS cp ON cp.IDCOMMAND = c.ID
				LEFT JOIN product AS p ON p.ID = cp.PRODUCTID
				LEFT JOIN category AS cat ON p.IDCATEGORY = cat.ID
				LEFT JOIN productchild AS pc ON pc.ID = cp.CHILDID
				WHERE DATE( c.DATESTART ) >= DATE(  '".date('Y')."-".date('m')."-01' ) 
                AND c.STATUT <> 0 
				GROUP BY CAT_NOM
				ORDER BY NB_CMD DESC 
				LIMIT 0 , 10";
		return $this->getAdapter()->fetchAll($sql);
	}
	
	/*-------------------------------------------*/
	
	public function deleteDevisByUser($idUser, $idDevis) { 	
		if ($this->isExistDevisOrCommand($idUser, $idDevis)) {
			$commandProduct = new CommandProduct(); 
			$commandProduct->delete('IDCOMMAND = '.$idDevis); 
			$this->delete('ID = '.$idDevis); 
			return 'OK';
		} else { return 'USER';}
		return 'NOK';
	}
	
	private function isExistDevisOrCommand($idUser, $idDevisCommand) {
		$sql = "SELECT COUNT(c.id) NBR FROM command c  
				WHERE c.IDUSER = ".$idUser." 
				AND c.ID = ".$idDevisCommand;  
		$result = $this->getAdapter()->fetchRow($sql);  
		if (isset($result) && !empty($result) && $result['NBR'] > 0) { return true; }
		return false;
	}
	
	public function findCommandsByUser($idUser) {  
		$select = "SELECT c.* FROM command c
				WHERE c.STATUT IN (1, 2, 3, 4) 
				AND c.IDUSER = ".$idUser." 
				ORDER BY DATESTART DESC";
		return $this->getAdapter()->fetchAll($select);
	}
	public function findDevisByUser($idUser) {  
		$select = "SELECT c.* FROM command c
				WHERE c.STATUT IN (10, 11) 
				AND c.IDUSER = ".$idUser." 
				ORDER BY DATESTART DESC";
		return $this->getAdapter()->fetchAll($select);
	}
	
	public function findCommandsByMultiSearch($isValidating, $search) {
		$select = "SELECT c.* FROM command c WHERE "; 
		if ($isValidating) {
			$select .= " STATUT = 0 ";
		} else {
			$select .= " STATUT <> 0 ";
		}
		$select .= " AND (REFERENCE LIKE '%".$search."%' "; 
		$select .= " OR USER_NOM LIKE '%".$search."%' "; 
		$select .= " OR USER_PRENOM LIKE '%".$search."%' "; 
		$select .= " OR USER_EMAIL LIKE '%".$search."%' )"; 
		return $this->getAdapter()->fetchAll($select);
	}
	
	public function findCommandsByStatut($statut, $order) {
		$select = "SELECT c.* FROM command c
				WHERE STATUT = ".$statut." 
				ORDER BY ".$order;
		return $this->getAdapter()->fetchAll($select);
	}
	
	public function findCommandFideliteByUserAndRef($idCommand) {
		$sql = "
					SELECT cf.*
					FROM command_fidelite AS cf 
					WHERE cf.IDCOMMAND = ".$idCommand." 
					ORDER BY cf.NBPOINT ASC
					";

		return $this->getAdapter()->fetchAll($sql);
	}
    
	public function findCommandByUserAndRef($idUser, $ref) {
		$sql = "
					SELECT c.REFERENCE REFERENCE,c.ID ID, c.PRIXTOTALTTC TOTALTTC,c.PRIXTOTALHTFP TOTALHTFP, c.PRIXFRAISPORTPOUR FRAISPORTPOUR, c.PRIXFRAISPORT FRAISPORT,  c.PRIXTOTALHT TOTALHT, c.PRIXTOTALHTHR TOTALHTHR, c.PRIXREMISEEUR REMISEEUR,
					c.STATUT STATUT , c.DATESTART DATESTART, c.LIV_RAISONSOCIAL LIVRAISONSOCIAL, c.LIV_ADRESSE LIVADRESSE, c.LIV_CP LIVCP, c.LIV_VILLE LIVVILLE, 
					c.LIV_PAYS LIVPAYS, c.FACT_RAISONSOCIAL FACTRAISONSOCIAL, c.FACT_ADRESSE FACTADRESSE, c.FACT_CP FACTCP , c.FACT_VILLE FACTVILLE , c.FACT_PAYS FACTPAYS, 
					cp.CHILDID CHILDID, cp.CHILDREF CHILDREF,cp.CHILDisPROMO CHILDisPROMO,cp.CHILDisDEVIS CHILDisDEVIS, cp.CHILDPRIX CHILDPRIX, cp.CHILDQUANTITY CHILDQUANTITY, cp.CHILDPROMOPRIX CHILDPROMOPRIX, cp.CHILDPRIXTOTAL CHILDPRIXTOTAL, cp.CHILDPRIXREMISE CHILDPRIXREMISE, pc.DESIGNATION DESIGNATION,
					cp.CHILDREMISEPRIXTAUXE CHILDREMISEPRIXTAUXE, cp.CHILDREMISEPRIXTAUXP CHILDREMISEPRIXTAUXP,
					p.ID PRODUCTID, p.NOM PRODUCTNOM,p.NAVNOM PRODUCTNAVNOM,  p.STOCK STOCK,
					c.USER_NOM USERNOM, c.USER_PRENOM USERPRENOM, c.USER_TEL USERTEL, c.USER_FAX USERFAX, c.USER_EMAIL USEREMAIL, c.USER_MODEPAIEMENT USERMODEPAIEMENT, c.USER_NUMCOMPTE USERNUMCOMPTE, 
					c.LIV_NOM LIV_NOM, c.CODEREDUCTION CODEREDUCTION,
					cp.SELECTEDOPTION SELECTEDOPTION, c.USER_MODEPAIEMENT_TYPE USER_MODEPAIEMENT_TYPE, c.USER_MODEPAIEMENT_LABEL USER_MODEPAIEMENT_LABEL, cat.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
					FROM command c 
					LEFT JOIN command_product AS cp ON cp.IDCOMMAND = c.ID 
					LEFT JOIN product AS p ON p.ID = cp.PRODUCTID
			        LEFT JOIN category cat ON p.IDCATEGORY = cat.ID
					LEFT JOIN productchild AS pc ON pc.ID = cp.CHILDID
					WHERE c.IDUSER = ".$idUser." 
					AND c.REFERENCE = '".$ref."'
					ORDER BY pc.REFERENCE ASC
					";

		return $this->getAdapter()->fetchAll($sql);
	}
	

	public function findCommandCaddyRetrieve($idUser, $ref) {
		$sql = "
					SELECT c.REFERENCE REFERENCE,c.ID ID, 
					c.LIV_RAISONSOCIAL LIVRAISONSOCIAL, c.LIV_ADRESSE LIVADRESSE, c.LIV_CP LIVCP, c.LIV_VILLE LIVVILLE, 
					c.LIV_PAYS LIVPAYS, c.FACT_RAISONSOCIAL FACTRAISONSOCIAL, c.FACT_ADRESSE FACTADRESSE, c.FACT_CP FACTCP , c.FACT_VILLE FACTVILLE , c.FACT_PAYS FACTPAYS, 
					cp.CHILDID CHILDID, cp.CHILDREF CHILDREF,cp.CHILDisPROMO CHILDisPROMO,cp.CHILDisDEVIS CHILDisDEVIS, cp.CHILDPRIX CHILDPRIX, cp.CHILDQUANTITY CHILDQUANTITY, cp.CHILDPROMOPRIX CHILDPROMOPRIX, cp.CHILDPRIXTOTAL CHILDPRIXTOTAL, cp.CHILDPRIXREMISE CHILDPRIXREMISE, pc.DESIGNATION DESIGNATION,
					cp.CHILDREMISEPRIXTAUXE CHILDREMISEPRIXTAUXE, cp.CHILDREMISEPRIXTAUXP CHILDREMISEPRIXTAUXP,
					p.ID PRODUCTID, p.NOM PRODUCTNOM, p.NAVNOM PRODUCTNAVNOM, p.DESCRIPTIONSHORT DESCSHORT, pic.URL URL, p.STOCK STOCK, 
					c.USER_NOM USERNOM, c.USER_PRENOM USERPRENOM, c.USER_TEL USERTEL, c.USER_FAX USERFAX, c.USER_EMAIL USEREMAIL, c.USER_MODEPAIEMENT USERMODEPAIEMENT, c.USER_NUMCOMPTE USERNUMCOMPTE, 
					c.LIV_NOM LIV_NOM, cp.SELECTEDOPTION SELECTEDOPTION, cat.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
					FROM command c 
					LEFT JOIN command_product AS cp ON cp.IDCOMMAND = c.ID 
					LEFT JOIN product AS p ON p.ID = cp.PRODUCTID
			        LEFT JOIN category cat ON p.IDCATEGORY = cat.ID
					LEFT JOIN productchild AS pc ON pc.ID = cp.CHILDID
					LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
					WHERE c.IDUSER = ".$idUser." 
					AND c.REFERENCE = '".$ref."'
					AND pic.POSITION = 1
					ORDER BY pc.REFERENCE ASC
					"; 
		return $this->getAdapter()->fetchAll($sql);
	} 
	
	public function isAlreadyBuySomething($userID) { 
		$result = $this->select()->where('IDUSER =  ?', $userID)->where('STATUT IN (?)', array(2, 3))->query()->fetch();
		if ($result) { return true ; }
		return false;
    }
    
    
	public function getTotalQteByReferenceAndUser($idUser, $reference) {
		$sql = "SELECT SUM(cp.CHILDQUANTITY) NBR
					FROM command c 
					LEFT JOIN command_product AS cp ON c.ID = cp.IDCOMMAND  
					WHERE c.IDUSER = ".$idUser." 
					AND cp.CHILDREF = '".$reference."'
					AND c.STATUT IN (2 , 3)";  
		$result = $this->getAdapter()->fetchRow($sql);
		if ((int)$result['NBR'] > 0) { return $result['NBR']; } 
		return 0;
	}
	
}
?>models/LivraisonType.php000060400000001272150710367660011361 0ustar00<?php
class LivraisonType extends Zend_Db_Table
{
    protected $_name = 'livraison_type';
    protected $_primary = 'ID';

    public function getTypes() {
    	return $this->select()->order('NOM ASC')->query()->fetchAll();
	}

	public function getInfoById($type) {
		$myresult = array();
		try {
			$sql = "
				SELECT lt.CMDFRANCO CMDFRANCO, lt.NOM NOMLIV, lt.ID ID
				FROM livraison_type lt
				WHERE lt.ID = ".$type;
			$result = $this->getAdapter()->fetchRow($sql); 
			if (!empty($result)) {
				$myresult['CMDFRANCO'] = $result['CMDFRANCO'];
				$myresult['NOMLIV'] = $result['NOMLIV'];
				$myresult['ID'] = $result['ID'];
			}
		} catch (Zend_Exception $e) {}
		return $myresult;
	}
}
?>models/AnnonceGallery.php000060400000001540150710367660011450 0ustar00<?php
class AnnonceGallery extends Zend_Db_Table
{
    protected $_name = 'annonce_gallery';
    protected $_primary = 'ID';

    public function getAnnonces() {
    	return $this->select()->where('isSHOW = 0')->order('POSITION ASC')->order('NOM ASC')->query()->fetchAll();
	}
	

    public function getAllAnnonces() {
    	return $this->select()->order('POSITION ASC')->order('NOM ASC')->query()->fetchAll();
	}
    
    public function getAllAnnoncesByCategory($idCat) {
    	return $this->select()->where("ID_CATS LIKE '%:".$idCat.":%' OR ID_CATS LIKE '%:0:%' ")->order('POSITION ASC')->order('NOM ASC')->query()->fetchAll();
 	}
	
 	public function getAnnoncesByShow($idCat) {
 		return $this->select()->where('isSHOW = 0')->where("ID_CATS LIKE '%:".$idCat.":%' OR ID_CATS LIKE '%:0:%' ")->order('POSITION ASC')->order('NOM ASC')->query()->fetchAll();
 	}
}
?>models/FAQType.php000060400000000535150710367660010023 0ustar00<?php
class FAQType extends Zend_Db_Table
{
    protected $_name = 'faq_type';
    protected $_primary = 'ID';

    public function getTypes() {
    	return $this->select()->where('isACTIVE', 1)->order('NOM ASC')->query()->fetchAll();
	}
    public function getTypesAll() {
    	return $this->select()->order('NOM ASC')->query()->fetchAll();
	}
}
?>models/Product.php000060400000047076150710367660010205 0ustar00<?php
class Product extends Zend_Db_Table
{
	protected $_name = 'product';
	protected $_primary = 'ID';

	public function updateByCategory($idCategory, $data) {
		return $this->update($data, 'IDCATEGORY = '.$idCategory);
	}
  
	private function getProductForIndexationFull($id) {
		$select = "
				SELECT p.ID ID, p.NOM NOM, p.NAVNOM NAVNOM,p.NAVTITRE NAVTITRE, p.NAVDESC NAVDESC,p.KEYWORDS KEYWORDS, p.DESCRIPTIONSHORT DESCSHORT, p.DESCRIPTIONLONG DESCLONG, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
				p.DOCNAME DOCNAME, p.DOCURL DOCURL, p.IDBREND IDBREND, p.STOCK STOCK,
				p.isPROMO isPROMO, pic.URL URL, sb.BREND BREND, sb.URL BRENDURL, p.IDCATEGORY IDCATEGORY,
				p.DESCRIPTIONTECH DESCTECH, p.DESCRIPTIONNORME DESCNORME, p.isSHOWBREND isSHOWBREND,
				o.NOM NOMOPTION, o.ID IDOPTION,  p.isQTEPRIXACTIVE isQTEPRIXACTIVE, p.ONSELECT_IDOPTION ONSELECT_IDOPTION , 
                c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS, c.NAVNOM CATNAVNOM, c.NOM CATNOM, p.BOOSTED_BESTSELLER BOOSTED_BESTSELLER
				FROM product p
				LEFT JOIN product_option AS po ON po.IDPRODUCT = p.ID
				LEFT JOIN category c ON c.ID = p.IDCATEGORY 
				LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
				LEFT JOIN `option` AS o ON o.ID = po.IDOPTION
				LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
				WHERE p.ID = ".$id."
				AND p.isACTIVE = 0
				"; 
		return $this->getAdapter()->fetchAll($select);
	}

    /* SITE */
	public function calculateLowestPrice($idProduct) {
		$myFacture = new Facture();
		
		
		$productChild = new ProductChild();
		$productChildQte = new ProductChildQte();
		
		
		$results = $productChild->getChildsInfoByListProductId($idProduct);
		$lastPrice = null;
		$lastFactureLine = null;
		foreach ($results AS $row) {
			$factureLine = new FactureLine();
			$factureLine->setLineInfo($row, 1, 0);
			
			$currentPrice = $productChildQte->getCurrentLowestPrice($row['IDCHILD'], $row['PRIX']);
			$factureLine->item_prix = sprintf("%.2f",$currentPrice);		
			$factureLine->setPromoCaddyType(false);
		
			if ($lastFactureLine == null || $factureLine->item_prix < $lastFactureLine->item_prix) {
				$lastFactureLine = $factureLine;
			}
			
		}
		if ($lastFactureLine != null) {
			$myFacture->addLine($lastFactureLine); 
			
			$promo = new PromoCalculator();
			$promo->computeAllPromos($myFacture, null);
				 
			return $myFacture->getPrixTotalHT();
		}
		return sprintf("%.2f",0);		
	}
	
	public function getProductById($id) {
		$select = "
				SELECT p.ID ID, p.NOM NOM, p.NAVNOM NAVNOM,p.NAVTITRE NAVTITRE, p.NAVDESC NAVDESC,p.KEYWORDS KEYWORDS, p.DESCRIPTIONSHORT DESCSHORT, p.DESCRIPTIONLONG DESCLONG, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
				p.DOCNAME DOCNAME, p.DOCURL DOCURL, p.IDBREND IDBREND, p.STOCK STOCK,
				p.isPROMO isPROMO, pic.URL URL, sb.BREND BREND, sb.URL BRENDURL, p.IDCATEGORY IDCATEGORY,
				p.DESCRIPTIONTECH DESCTECH, p.DESCRIPTIONNORME DESCNORME, p.isSHOWBREND isSHOWBREND,
				o.NOM NOMOPTION, o.ID IDOPTION,  p.isQTEPRIXACTIVE isQTEPRIXACTIVE, p.ONSELECT_IDOPTION ONSELECT_IDOPTION , 
                c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS, c.NAVNOM CATNAVNOM, c.NOM CATNOM, p.BOOSTED_BESTSELLER BOOSTED_BESTSELLER
				FROM product p
				LEFT JOIN product_option AS po ON po.IDPRODUCT = p.ID
				LEFT JOIN category c ON c.ID = p.IDCATEGORY 
				LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
				LEFT JOIN `option` AS o ON o.ID = po.IDOPTION
				LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
				WHERE p.ID = ".$id." 
				AND p.isACTIVE = 0
				"; 
		return $this->getAdapter()->fetchAll($select);
	}

	public function getProductsByIdCategory($id, $triSql) {

		$select = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM PRODNAVNOM,p.NAVTITRE NAVTITRE, p.NAVDESC NAVDESC, p.DESCRIPTIONSHORT DESCSHORT, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
							p.isPROMO isPROMO, pic.URL URL, sb.BREND BREND, sb.ID BRENDID, sb.URL BRENDURL, COUNT(pc.REFERENCE) NBREFERENCE, 
							c.NAVNOM CATNAVNOM, c.ID CATID, p.isSHOWBREND isSHOWBREND, p.KEYWORDS KEYWORDS_PROD,
							p.IDCATEGORY_DUP1 IDCATEGORY_DUP1,	p.IDCATEGORY_DUP2 IDCATEGORY_DUP2, p.IDCATEGORY_DUP3 IDCATEGORY_DUP3, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS,
							c.NOM CATNOM, p.BOOSTED_BESTSELLER BOOSTED_BESTSELLER
							FROM product p
							LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
							LEFT JOIN category c ON c.ID = p.IDCATEGORY 
							LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
							LEFT JOIN productchild pc ON pc.IDPRODUCT = p.ID
							WHERE (p.IDCATEGORY = ".$id." OR
							p.IDCATEGORY_DUP1 = ".$id." OR
							p.IDCATEGORY_DUP2 = ".$id." OR
							p.IDCATEGORY_DUP3 = ".$id." )
							AND p.isACTIVE = 0
							AND p.STOCK <> 4
							AND pic.POSITION = 1
							GROUP BY ID
							ORDER BY ".$triSql; 
		return $this->getAdapter()->fetchAll($select);
	}

	public function getBoostedHome($user) {

		$select = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM PRODNAVNOM,p.NAVTITRE NAVTITRE, p.NAVDESC NAVDESC, p.DESCRIPTIONSHORT DESCSHORT, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
							p.isPROMO isPROMO, pic.URL URL, sb.BREND BREND, sb.ID BRENDID, sb.URL BRENDURL, COUNT(pc.REFERENCE) NBREFERENCE, 
							c.NAVNOM CATNAVNOM, c.ID CATID, p.isSHOWBREND isSHOWBREND, p.KEYWORDS KEYWORDS_PROD,
							p.IDCATEGORY_DUP1 IDCATEGORY_DUP1,	p.IDCATEGORY_DUP2 IDCATEGORY_DUP2, p.IDCATEGORY_DUP3 IDCATEGORY_DUP3, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS,
							c.NOM CATNOM, p.BOOSTED_BESTSELLER BOOSTED_BESTSELLER
							FROM product p
							LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
							LEFT JOIN category c ON c.ID = p.IDCATEGORY 
							LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
							LEFT JOIN productchild pc ON pc.IDPRODUCT = p.ID
							WHERE p.isACTIVE = 0
							AND pic.POSITION = 1
							AND p.BOOSTED_HOME > 0 
							GROUP BY ID
							ORDER BY p.BOOSTED_HOME asc, p.PRIX asc"; 
		$data =  $this->getAdapter()->fetchAll($select);
        return $this->computeProductListToShow($data, $user);        
	}

	public function getAllTreeSubProductsByCatId($id) {
		$category = new Category(); 
		$listIds = $category->getAllSubsIDByIDToString($id);  
		if (!empty($listIds)) {
			$select = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM PRODNAVNOM,p.NAVTITRE NAVTITRE, p.NAVDESC NAVDESC, p.DESCRIPTIONSHORT DESCSHORT, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
							p.isPROMO isPROMO, pic.URL URL, sb.BREND BREND, sb.ID BRENDID, sb.URL BRENDURL, COUNT(pc.REFERENCE) NBREFERENCE, 
							c.NAVNOM CATNAVNOM, c.ID CATID, p.isSHOWBREND isSHOWBREND, p.KEYWORDS KEYWORDS_PROD,
							p.IDCATEGORY_DUP1 IDCATEGORY_DUP1,	p.IDCATEGORY_DUP2 IDCATEGORY_DUP2, p.IDCATEGORY_DUP3 IDCATEGORY_DUP3 , c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS,
							c.NOM CATNOM, p.BOOSTED_BESTSELLER BOOSTED_BESTSELLER
							FROM product p
							LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
							LEFT JOIN category c ON c.ID = p.IDCATEGORY 
							LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
							LEFT JOIN productchild pc ON pc.IDPRODUCT = p.ID
							WHERE p.IDCATEGORY IN (".$listIds.")
							AND p.isACTIVE = 0
							AND p.STOCK <> 4
							AND pic.POSITION = 1
							GROUP BY ID
							ORDER BY CATNOM ASC
							LIMIT 0 , 30;"; 
			return $this->getAdapter()->fetchAll($select);
		}
		return array();
	}

	public function getAllProductsBestSellerByCatId($id) {
    
        $category = new Category();
        $idCats = $category->getListIdFromParent($id);
     
        $select = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM PRODNAVNOM,p.NAVTITRE NAVTITRE, p.NAVDESC NAVDESC, p.DESCRIPTIONSHORT DESCSHORT, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
					p.isPROMO isPROMO, pic.URL URL, sb.BREND BREND, sb.ID BRENDID, sb.URL BRENDURL, '0' as NBREFERENCE, 
					c.NAVNOM CATNAVNOM, c.ID CATID, p.isSHOWBREND isSHOWBREND, p.KEYWORDS KEYWORDS_PROD,
					p.IDCATEGORY_DUP1 IDCATEGORY_DUP1,	p.IDCATEGORY_DUP2 IDCATEGORY_DUP2, p.IDCATEGORY_DUP3 IDCATEGORY_DUP3 , c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS,
                    c.NOM CATNOM, p.BOOSTED_BESTSELLER BOOSTED_BESTSELLER
					FROM product p
					LEFT JOIN picture pic ON p.ID = pic.IDPRODUCT
					LEFT JOIN category c ON p.IDCATEGORY  = c.ID 
					LEFT JOIN supplier_brend sb ON p.IDBREND =  sb.ID 
					LEFT JOIN productchild pc ON p.ID = pc.IDPRODUCT
					WHERE p.IDCATEGORY in (".$idCats.") 
					AND p.isACTIVE = 0
					AND p.STOCK <> 4
					AND pic.POSITION = 1 
                    GROUP BY ID
					ORDER BY BOOSTED_BESTSELLER ASC, p.PRIX ASC
					LIMIT 0 , 12";   
		return $this->getAdapter()->fetchAll($select);
	}

	public function getProductsBySearch($keyTemp) {
		$keys = '';
		$keys = explode(" ",$keyTemp);
		$sql = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM PRODNAVNOM,p.NAVTITRE NAVTITRE, p.NAVDESC NAVDESC, p.DESCRIPTIONSHORT DESCSHORT, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
							p.isPROMO isPROMO, pic.URL URL, sb.BREND BREND, sb.ID BRENDID, sb.URL BRENDURL, COUNT(pc.REFERENCE) NBREFERENCE, 
							c.NAVNOM CATNAVNOM, c.ID CATID, p.isSHOWBREND isSHOWBREND, p.KEYWORDS KEYWORDS_PROD,
							p.IDCATEGORY_DUP1 IDCATEGORY_DUP1,	p.IDCATEGORY_DUP2 IDCATEGORY_DUP2, p.IDCATEGORY_DUP3 IDCATEGORY_DUP3, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS,
							c.NOM CATNOM, p.BOOSTED_BESTSELLER BOOSTED_BESTSELLER
							FROM product p
							LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
							LEFT JOIN category c ON c.ID = p.IDCATEGORY 
							LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
							LEFT JOIN productchild pc ON pc.IDPRODUCT = p.ID		
			WHERE ";
		if ($keys!='') {
			$sql .= " (";
			$sql .= $this->computeStatementSearch($keys, "p.NOM");
			$sql .= " OR ";
			$sql .= $this->computeStatementSearch($keys, "p.DESCRIPTIONSHORT");
			$sql .= " OR ";
			$sql .= " p.KEYWORDS LIKE '%".$keyTemp."%' ";
			$sql .= " OR ";
			$sql .= $this->computeStatementSearch($keys, "pc.REFERENCE");
			$sql .= " ) AND ";
		}
		$sql .= " p.isACTIVE = 0
                AND p.STOCK <> 4
				AND pic.POSITION = 1
				GROUP BY p.ID
				ORDER BY p.NOM ASC";
		
		return $this->getAdapter()->fetchAll($sql);
	}
	

	private function computeStatementSearch($keys, $attribut) {
		$sqlProduct = " ".$attribut." LIKE '";
		foreach ($keys as $key) {
			$sqlProduct .= "%".$key."%";
		}
		$sqlProduct .= "'";
		return $sqlProduct;
	
	}
	
	public function isInCategorySubsidiaire($idProduct,$idCat) {
		$category = new Category2(); 		
		$sql = "(SELECT cp.IDCATEGORY FROM category2_product cp WHERE cp.IDPRODUCT = ".$idProduct.")";
		$sqlParentFirst = "SELECT DISTINCT c0.ID ID
				FROM category2 AS c0
				LEFT JOIN category2 AS c1 ON c1.IDPARENT = c0.ID
				LEFT JOIN category2 AS c2 ON c2.IDPARENT = c1.ID
				LEFT JOIN category2 AS c3 ON c3.IDPARENT = c2.ID 
				LEFT JOIN category2 AS c4 ON c4.IDPARENT = c3.ID 
				LEFT JOIN category2 AS c5 ON c5.IDPARENT = c4.ID 
				LEFT JOIN category2 AS c6 ON c6.IDPARENT = c5.ID 
				LEFT JOIN category2 AS c7 ON c7.IDPARENT = c6.ID 
				LEFT JOIN category2 AS c8 ON c8.IDPARENT = c7.ID 
				LEFT JOIN category2 AS c9 ON c9.IDPARENT = c8.ID 
				LEFT JOIN category2 AS c10 ON c10.IDPARENT = c9.ID 
				WHERE ( c0.ID = ".$idCat."  
				OR c1.ID = ".$idCat." 
				OR c2.ID = ".$idCat." 
				OR c3.ID = ".$idCat." 
				OR c4.ID = ".$idCat." 
				OR c5.ID = ".$idCat." 
				OR c6.ID = ".$idCat." 
				OR c7.ID = ".$idCat." 
				OR c8.ID = ".$idCat." 
				OR c9.ID = ".$idCat." 
				OR c10.ID = ".$idCat." )
				AND (c0.ID in ".$sql." 
				OR c1.ID in ".$sql." 
				OR c2.ID in ".$sql." 
				OR c3.ID in ".$sql." 
				OR c4.ID in ".$sql." 
				OR c5.ID in ".$sql." 
				OR c6.ID in ".$sql." 
				OR c7.ID in ".$sql." 
				OR c8.ID in ".$sql." 
				OR c9.ID in ".$sql." 
				OR c10.ID in ".$sql." )
				ORDER BY c0.IDPARENT ASC";
		$list = $category->fetchRow($sqlParentFirst);  		 
		return empty($list) ? false : true;
	}


	public function getAllTreeSubProductsByCatIdForPromotion($idCat) {
		$category = new Category2(); 
		$listIds = $category->getAllSubsIDByIDToString($idCat);  
		if (!empty($listIds)) {
			$productCategory = new ProductCategory2();
			return $productCategory->getAllProductsByCategoryIDList($listIds);
		}
		return array();
	}
	
	public function getProductsByIdCategoryForPromotion($id, $triSql) {
		$productCategory = new ProductCategory2();
		return $productCategory->getAllProductsInfoByCategoryID($id, $triSql);
	}
	
	private function computeProductListToShow($list, $user) {
		try {
			$listProducts = array();
			$metakeywords = '';

			$isAllPromos = false;
			$currentPromoAll = array();
			$currentPromo = array();
			$listUserCodeInternIdBrendFound = array();
			$listUserCodeInternIdBrends = array();
			$listIdBrendFound = array();
			$listUserIdBrendFound = array();
			$listUserIdBrends = array();
			$listIdBrends = array();
			$promoCalculator = new PromoCalculator();
			$promoProduct = new PromoProduct();
			$promoUser = new PromoUser();
			$product= new Product();

			if (!empty($list)) {
				$idCategory = $list[0]['CATID'];
				$myPromo = $promoProduct->getRemiseByProductCategory($idCategory);
				if ($this->isPromoActive($myPromo)) { $isAllPromos = true; $currentPromoAll = $myPromo; }
			}
			$productChildQte = new ProductChildQte();

			foreach ($list AS $row) {
				$currentProduct = array();
				$currentProduct['ID'] = $row['ID'];
				$currentProduct['NOM'] = $row['NOM'];
				//$currentProduct['DESCSHORT'] = $this->cutString($row['DESCSHORT'], 80);
				$currentProduct['DESCSHORT'] = $row['DESCSHORT'];
				$currentProduct['URL'] = $row['URL'];
				$currentProduct['BREND'] = $row['BREND'];
				$currentProduct['isSHOWBREND'] = $row['isSHOWBREND'];
				$currentProduct['BRENDURL'] = $row['BRENDURL'];
				$currentProduct['NBREFERENCE'] = $row['NBREFERENCE'];
				$currentProduct['isDEVISPRODUCT'] = $row['isDEVISPRODUCT'];
                $currentProduct['NAVNOM_URLPARENTS'] = $this->computeUrlNavigationParent($row);
				$currentProduct['BOOSTED_BESTSELLER'] = $row['BOOSTED_BESTSELLER'];

				if (isset($row['NAVNOM'])) {
					$navnom = $row['NAVNOM'];
				} else {
					$navnom = $row['PRODNAVNOM'];
				}

				$currentProduct['NAVNOM'] = $this->verifyNavigationString($navnom, $row['NOM'], '');

				$currentProduct['NAVTITRE'] = $row['NAVTITRE'];
				$currentProduct['NAVDESC'] = $row['NAVDESC'];

				$isFirst = false;

				if (empty($metakeywords)) {
					$metakeywords .= $row['KEYWORDS_PROD'];
				} else {
					$metakeywords .= ','.$row['KEYWORDS_PROD'];
				}

				$currentProduct['isPROMO'] = $row['isPROMO'];
				$currentProduct['PRIX'] = $row['PRIX'];

				/*
                 * PRIX DEGRESSIF
                 */
				$currentProduct['isPRIXDEGRESSIF'] = $productChildQte->isPrixDegressifByProductID($row['ID']);
                
				/*
                 * CALCUL PROMO
                 */
				$idBrend = $row['BRENDID'];

				if (!in_array($idBrend, $listIdBrends, true)) {
					$myPromo = $promoProduct->getRemiseByProductBrend($idBrend);
					array_push($listIdBrends, $idBrend);
					if ($this->isPromoActive($myPromo)) { array_push($listIdBrendFound, array('ID' => $idBrend, 'PROMO' => $myPromo)); }
				}
				if ($row['isPROMO'] == 1) {
					$isRemise = false;
					if (in_array($idBrend, $listIdBrends, true)) {
						foreach ($listIdBrendFound as $brendPromos) {
							if ($brendPromos['ID'] == $idBrend) {
								$currentProduct['isPROMO'] = 0;
								$currentPromo = $brendPromos['PROMO'];
								if ($currentPromo['REMISEEURO'] > 0) {
									$currentProduct['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromo['REMISEEURO']);
									$isRemise = true;
								}
								if ($currentPromo['REMISEPOUR'] > 0) {
									$currentProduct['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromo['REMISEPOUR']);
									$isRemise = true;
								}
								break;
							}
						}
					}
					if ($isAllPromos && !empty($currentPromoAll) && !$isRemise ) {
						$currentProduct['isPROMO'] = 0;
						if ($currentPromoAll['REMISEEURO'] > 0) {
							$currentProduct['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromoAll['REMISEEURO']);
						}
						if ($currentPromoAll['REMISEPOUR'] > 0) {
							$currentProduct['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromoAll['REMISEPOUR']);
						}
					}
				}
				if (isset($user) && !empty($user)) {
					$userId = $user['id'];
					$codeIntern = $user['cintern'];
					$isRemise = false;

					if (!empty($codeIntern)) {
						if (!in_array($idBrend.'-'.$codeIntern, $listUserCodeInternIdBrends, true)) {
							$myPromo = $promoUser->getRemiseByCodeInternMarque($idBrend, $codeIntern);
							array_push($listUserCodeInternIdBrends, $idBrend.'-'.$codeIntern);
							if ($this->isPromoActive($myPromo)) { array_push($listUserCodeInternIdBrendFound, array('ID' => $idBrend, 'CODE' => $codeIntern, 'PROMO' => $myPromo)); }
						}
						if (in_array($idBrend.'-'.$codeIntern, $listUserCodeInternIdBrends, true)) {
							foreach ($listUserCodeInternIdBrendFound as $brendPromos) {
								if ($brendPromos['ID'] == $idBrend && $brendPromos['CODE'] == $codeIntern ) {
									$currentProduct['isPROMO'] = 0;
									$currentPromo = $brendPromos['PROMO'];
									if ($currentPromo['REMISEEURO'] > 0) {
										$currentProduct['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromo['REMISEEURO']);
										$isRemise = true;
									}
									if ($currentPromo['REMISEPOUR'] > 0) {
										$currentProduct['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromo['REMISEPOUR']);
										$isRemise = true;
									}
									break;
								}
							}
						}
					}
					if (!$isRemise) {
						if (!in_array($idBrend, $listUserIdBrends, true)) {
							$myPromo = $promoUser->getRemiseByMarque($idBrend, $userId);
							array_push($listUserIdBrends, $idBrend);
							if ($this->isPromoActive($myPromo)) { array_push($listUserIdBrendFound, array('ID' => $idBrend, 'PROMO' => $myPromo)); }
						}
						if (in_array($idBrend, $listUserIdBrends, true)) {
							foreach ($listUserIdBrendFound as $brendPromos) {
								if ($brendPromos['ID'] == $idBrend) {
									$currentProduct['isPROMO'] = 0;
									$currentPromo = $brendPromos['PROMO'];
									if ($currentPromo['REMISEEURO'] > 0) {
										$currentProduct['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromo['REMISEEURO']);
										$isRemise = true;
									}
									if ($currentPromo['REMISEPOUR'] > 0) {
										$currentProduct['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromo['REMISEPOUR']);
										$isRemise = true;
									}
									break;
								}
							}
						}
					}
				}


				if ($currentProduct['PRIX'] <= 0 ) { $currentProduct['PRIX'] = $row['PRIX']; }
                
				$currentProduct['PRIXLOWEST'] = $product->calculateLowestPrice($currentProduct['ID']);
				array_push($listProducts, $currentProduct);
			}
			return $result = array( 'PRODUCTS' => $listProducts, 'META_KEY' =>  $metakeywords);
		}
        catch (Zend_Exception $e) {
		}
		return $result = array( 'PRODUCTS' => array(), 'META_KEY' =>  '');
	}
	

	private function isPromoActive($myPromo) {
		if ($myPromo) {
			if ($myPromo['REMISEEURO'] > 0) { return true; }
			if ($myPromo['REMISEPOUR'] > 0) { return true; }
		}
		return false;
	}
    
    
    
    private function computeUrlNavigationParent($row) {
        return $row['NAVNOM_URLPARENTS']."/".$row['CATNAVNOM'];
    }
    
    

	protected function verifyNavigationString($navnom, $nom, $suffix) {
		if (empty($navnom)) {
			return $suffix.$this->generateNavigationString($nom);
		} else {
			$filter = new Zend_Filter_Word_DashToSeparator();
			$navnom = $filter->filter($navnom);
			return $suffix.$this->generateNavigationString($navnom);
		}
	}

	protected function generateNavigationString($value) {
		$filter = new Zend_Filter();
		$filter->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim())
		->addFilter(new Zend_Filter_StringToLower())
		->addFilter(new Zend_Filter_CustomAccent())
		->addFilter(new Zend_Filter_Word_SeparatorToDash());
		$result = $filter->filter($value);
        
        return preg_replace('/[^A-Za-z0-9\-\/]/', '', $result);
	}
}
	 
?>models/SupplierBrend.php000060400000002226150710367660011327 0ustar00<?php
class SupplierBrend extends Zend_Db_Table
{
    protected $_name = 'supplier_brend';
    protected $_primary = 'ID';

    
    
    public function getAllBrends() {
		$sql = "SELECT sb.BREND BREND, sb.URL URL, sb.ID IDBREND, s.DESCRIPTIONSHORT DESCRIPTIONSHORT, s.DESCRIPTIONLONG DESCRIPTIONLONG
				FROM supplier_brend sb
                LEFT JOIN supplier AS s ON s.ID = sb.IDSUPPLIER";
		return $this->getAdapter()->fetchAll($sql);
	}
    
    public function getAllShowableBrends() {
		$sql = "SELECT sb.BREND BREND, sb.URL URL, sb.ID IDBREND, s.DESCRIPTIONSHORT DESCRIPTIONSHORT, s.DESCRIPTIONLONG DESCRIPTIONLONG
				FROM supplier_brend sb
                LEFT JOIN supplier AS s ON s.ID = sb.IDSUPPLIER
                WHERE IS_SHOW_BREND_PAGE = 1";
		return $this->getAdapter()->fetchAll($sql);
	}
    
    
    public function getBrendByID($id) {
		$sql = "SELECT sb.BREND BREND, sb.URL URL, sb.ID IDBREND, s.DESCRIPTIONSHORT DESCRIPTIONSHORT, s.DESCRIPTIONLONG DESCRIPTIONLONG
				FROM supplier_brend sb
                LEFT JOIN supplier AS s ON s.ID = sb.IDSUPPLIER
                WHERE sb.ID = ".$id;
		return $this->getAdapter()->fetchRow($sql);
	}
}
?>models/Category.php000060400000047714150710367660010341 0ustar00<?php
class Category extends Zend_Db_Table
{
	protected $_name = 'category';
	protected $_primary = 'ID';

    
    public function getListIdFromParent($idCat) {
    
        $sql = "SELECT c0.ID ID, c1.ID ID1, c2.ID ID2, c3.ID ID3, c4.ID ID4
				    FROM category AS c0
				    LEFT JOIN category AS c1 ON c1.IDPARENT = c0.ID
				    LEFT JOIN category AS c2 ON c2.IDPARENT = c1.ID
				    LEFT JOIN category AS c3 ON c3.IDPARENT = c2.ID 
				    LEFT JOIN category AS c4 ON c4.IDPARENT = c3.ID 
				    WHERE (c0.ID = ".$idCat."  
				    OR c1.ID = ".$idCat." 
				    OR c2.ID = ".$idCat." 
				    OR c3.ID = ".$idCat." 
				    OR c4.ID = ".$idCat.")"; 
	    $result = $idCat;
	    $catsAllCheck = "/".$idCat."/";
	    $list = $this->getAdapter()->fetchAll($sql);
        foreach ($list as $cat) {
            if (!empty($cat['ID']) && strpos($catsAllCheck,"/".$cat['ID']."/") === false) {
		        $result .= ",".$cat['ID'];
                $catsAllCheck .= "/".$cat['ID']."/";
            }
            if (!empty($cat['ID1']) && strpos($catsAllCheck,"/".$cat['ID1']."/") === false) {
		        $result .= ",".$cat['ID1'];
                $catsAllCheck .= "/".$cat['ID1']."/";
            }
            if (!empty($cat['ID2']) && strpos($catsAllCheck,"/".$cat['ID2']."/") === false) {
		        $result .= ",".$cat['ID2'];
                $catsAllCheck .= "/".$cat['ID2']."/";
            }
            if (!empty($cat['ID3']) && strpos($catsAllCheck,"/".$cat['ID3']."/") === false) {
		        $result .= ",".$cat['ID3'];
                $catsAllCheck .= "/".$cat['ID3']."/";
            }
            if (!empty($cat['ID4']) && strpos($catsAllCheck,"/".$cat['ID4']."/") === false) {
		        $result .= ",".$cat['ID4'];
                $catsAllCheck .= "/".$cat['ID4']."/";
            }
	    }
        return $result;
    }
    public function updateTreeInLineAsPathOfChilds($idParent, $updateCurrent) { 
        
        $i = 0;
        if ($updateCurrent){
            $sqlCurrent = "SELECT c.* FROM category c WHERE c.ID = ".$idParent." ORDER BY c.NOM ASC ";
            $dataCurrent = $this->getAdapter()->fetchRow($sqlCurrent);  
            if ($dataCurrent) {
                $dataCurrent['NAVNOM_URLPARENTS'] = $this->getTreeInLineAsPathOf($idParent);
                $this->update($dataCurrent, 'ID = '.$idParent);
                $i++;
            }
        }
        
        $sql = "SELECT c.* FROM category c WHERE c.IDPARENT = ".$idParent." ORDER BY c.NOM ASC ";
        $cats =  $this->getAdapter()->fetchAll($sql);
        foreach($cats as $row)
        { 
            $row['NAVNOM_URLPARENTS'] = $this->getTreeInLineAsPathOf($row['ID']);
            $this->update($row, 'ID = '.$row['ID']);
            
            $i += $this->updateTreeInLineAsPathOfChilds($row['ID'], false);            
            $i++;
        }   
        return $i;
    }

	public function generateAllCategoriesMenu($idCat) {
		$dataResult = $this->computeCategoryChildToArray($idCat, 0);
		return $dataResult;
	}

	private function computeCategoryChildsOneArray($idParent, $result) {
		$dataChilds = $this->getCategoryByParent($idParent);

		$dataResult = array(
			'PARENT' => $idParent,
			'CHILDS' => $dataChilds
		);
		array_push($result, $dataResult);
		if (!empty($dataChilds) && sizeof($dataChilds) > 0) {
			foreach($dataChilds as $row) { 
				$result = $this->computeCategoryChildsOneArray($row['ID'], $result);
			}
		}
		return $result;
	}

	private function computeCategoryChildToArray($idParent, $level) {
		$dataChilds = $this->getCategoryByParent($idParent);  
		if (!empty($dataChilds) && sizeof($dataChilds) > 0) { 
			$dataReturn = array(); 
			foreach($dataChilds as $row) {                 
				$data = array(
					'CHILDS' => $this->computeCategoryChildToArray($row['ID'], $level + 1),
					'CATEGORIE' => $row,
					'LEVEL' => $level
				);
				array_push($dataReturn, $data);
			} 
			return $dataReturn;
		} else { return array(); }
	}

	private function getCategoryByParent($idParent) {
		$sql = "SELECT c.* FROM category c WHERE c.IDPARENT = ".$idParent." AND c.isACTIVE = 1";

		if ($idParent == 0) {
			$sql .= " ORDER BY c.POSITION ASC, c.ID ASC";
		} else {
			$sql .= " ORDER BY c.POSITION ASC, c.NOM ASC";
		} 
		return $this->getAdapter()->fetchAll($sql);
	}

	/**
	 *
	 * Getters
	 *
	 */
	public function getParentFirstOf($idCat) {
		$sql = "SELECT DISTINCT c0.ID ID, c0.NOM NOM, c0.IDPARENT IDPARENT , c0.NAVNOM NAVNOM
				FROM category AS c0
				LEFT JOIN category AS c1 ON c1.IDPARENT = c0.ID
				LEFT JOIN category AS c2 ON c2.IDPARENT = c1.ID
				LEFT JOIN category AS c3 ON c3.IDPARENT = c2.ID 
				LEFT JOIN category AS c4 ON c4.IDPARENT = c3.ID 
				LEFT JOIN category AS c5 ON c5.IDPARENT = c4.ID 
				LEFT JOIN category AS c6 ON c6.IDPARENT = c5.ID 
				LEFT JOIN category AS c7 ON c7.IDPARENT = c6.ID 
				LEFT JOIN category AS c8 ON c8.IDPARENT = c7.ID 
				LEFT JOIN category AS c9 ON c9.IDPARENT = c8.ID 
				LEFT JOIN category AS c10 ON c10.IDPARENT = c9.ID 
				WHERE ( c0.ID = ".$idCat."  
				OR c1.ID = ".$idCat." 
				OR c2.ID = ".$idCat." 
				OR c3.ID = ".$idCat." 
				OR c4.ID = ".$idCat." 
				OR c5.ID = ".$idCat." 
				OR c6.ID = ".$idCat." 
				OR c7.ID = ".$idCat." 
				OR c8.ID = ".$idCat." 
				OR c9.ID = ".$idCat." 
				OR c10.ID = ".$idCat." )
				ORDER BY c0.IDPARENT ASC 
				";
			
		return $this->getAdapter()->fetchRow($sql);
	}
    
    public function getTreeInLineAsPathOf($idCat) {
		$sql = "SELECT DISTINCT c0.ID ID, c0.NOM NOM, c0.IDPARENT IDPARENT , c0.NAVNOM NAVNOM, c0.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
				FROM category AS c0
				LEFT JOIN category AS c1 ON c1.IDPARENT = c0.ID
				LEFT JOIN category AS c2 ON c2.IDPARENT = c1.ID
				LEFT JOIN category AS c3 ON c3.IDPARENT = c2.ID 
				LEFT JOIN category AS c4 ON c4.IDPARENT = c3.ID 
				LEFT JOIN category AS c5 ON c5.IDPARENT = c4.ID 
				LEFT JOIN category AS c6 ON c6.IDPARENT = c5.ID 
				LEFT JOIN category AS c7 ON c7.IDPARENT = c6.ID 
				LEFT JOIN category AS c8 ON c8.IDPARENT = c7.ID 
				LEFT JOIN category AS c9 ON c9.IDPARENT = c8.ID 
				LEFT JOIN category AS c10 ON c10.IDPARENT = c9.ID 
				WHERE ( c0.ID = ".$idCat."  
				OR c1.ID = ".$idCat." 
				OR c2.ID = ".$idCat." 
				OR c3.ID = ".$idCat." 
				OR c4.ID = ".$idCat." 
				OR c5.ID = ".$idCat." 
				OR c6.ID = ".$idCat." 
				OR c7.ID = ".$idCat." 
				OR c8.ID = ".$idCat." 
				OR c9.ID = ".$idCat." 
				OR c10.ID = ".$idCat." )
				ORDER BY c0.IDPARENT ASC 
				"; 

		$mylinks = array();
		$links = $this->getAdapter()->fetchAll($sql);

        if (empty($links)) {
            return '';
        }

        $result = $links[0]['NAVNOM'];
        
        if ($links[0]['IDPARENT'] == 0) {
            $result = $links[0]['NAVNOM_URLPARENTS'];
        }
        
		$mylinks[0]['ID'] = $links[0]['ID'];
		$j=0;
		for ($i=1;$i<sizeof($links);$i++) {
			foreach ($links as $link) {
				if($link['IDPARENT'] == $mylinks[$j]['ID'] && $link['ID'] != $idCat) {
					$mylinks[$i]['ID'] = $link['ID'];                    
                    $result .= "/".$link['NAVNOM'];                    
					$j++;
					break;
				}
			}
		}
		return $result;
	}
    
	public function getTreeInLineOf($idCat) {
		$sql = "SELECT DISTINCT c0.*
				FROM category AS c0
				LEFT JOIN category AS c1 ON c1.IDPARENT = c0.ID
				LEFT JOIN category AS c2 ON c2.IDPARENT = c1.ID
				LEFT JOIN category AS c3 ON c3.IDPARENT = c2.ID 
				LEFT JOIN category AS c4 ON c4.IDPARENT = c3.ID 
				LEFT JOIN category AS c5 ON c5.IDPARENT = c4.ID 
				LEFT JOIN category AS c6 ON c6.IDPARENT = c5.ID 
				LEFT JOIN category AS c7 ON c7.IDPARENT = c6.ID 
				LEFT JOIN category AS c8 ON c8.IDPARENT = c7.ID 
				LEFT JOIN category AS c9 ON c9.IDPARENT = c8.ID 
				LEFT JOIN category AS c10 ON c10.IDPARENT = c9.ID 
				WHERE ( c0.ID = ".$idCat."  
				OR c1.ID = ".$idCat." 
				OR c2.ID = ".$idCat." 
				OR c3.ID = ".$idCat." 
				OR c4.ID = ".$idCat." 
				OR c5.ID = ".$idCat." 
				OR c6.ID = ".$idCat." 
				OR c7.ID = ".$idCat." 
				OR c8.ID = ".$idCat." 
				OR c9.ID = ".$idCat." 
				OR c10.ID = ".$idCat." )
				ORDER BY c0.IDPARENT ASC 
				";
		$mylinks = array();
		$links = $this->getAdapter()->fetchAll($sql);

		$mylinks[0]['ID'] = $links[0]['ID'];
		$mylinks[0]['NOM'] = $links[0]['NOM'];
		$mylinks[0]['IDPARENT'] = $links[0]['IDPARENT'];
		$mylinks[0]['NAVNOM'] = $links[0]['NAVNOM'];
		$mylinks[0]['NAVNOM_URLPARENTS'] = $links[0]['NAVNOM_URLPARENTS'];
		$j=0;
		for ($i=1;$i<sizeof($links);$i++) {
			foreach ($links as $link) {
				if($link['IDPARENT'] == $mylinks[$j]['ID']) {
					$mylinks[$i]['ID'] = $link['ID'];
					$mylinks[$i]['NOM'] = $link['NOM'];
					$mylinks[$i]['IDPARENT'] = $link['IDPARENT'];
					$mylinks[$i]['NAVNOM'] = $link['NAVNOM'];
					$mylinks[$i]['NAVNOM_URLPARENTS'] = $link['NAVNOM_URLPARENTS'];
					$j++;
					break;
				}
			}
		}
		return $mylinks;
	}
	public function getTreeCatsOfParent($idCat) {
			
		$sql = "SELECT c0.NOM NOM0, c1.NOM NOM1,
						c0.URL URL0, c1.URL URL1,
						c0.URL_SLIDE URLSLIDE0, c1.URL_SLIDE URLSLIDE1,
						c0.ID ID0, c1.ID ID1,
						c0.isACTIVE isACTIVE0, c1.isACTIVE isACTIVE1,
						c0.IDPARENT IDPARENT0, c1.IDPARENT IDPARENT1,
						c0.NAVNOM NAVNOM0, c1.NAVNOM NAVNOM1,
						c0.DESCRIPTION DESCRIPTION0, c1.DESCRIPTION DESCRIPTION1,
						c0.DESCRIPTIONLONG DESCRIPTIONLONG0, c1.DESCRIPTIONLONG DESCRIPTIONLONG1,
						c0.NAVNOM_URLPARENTS NAVNOM_URLPARENTS0, c1.NAVNOM_URLPARENTS NAVNOM_URLPARENTS1
				FROM category AS c0
				LEFT JOIN category AS c1 ON c1.IDPARENT = c0.ID
				WHERE c0.IDPARENT = ".$idCat."
				ORDER BY c0.ID,c1.ID ASC;
				";
		$results = $this->getAdapter()->fetchAll($sql);
			
		$listCat = array();
		$i = 0;
		$j = 0;
		$idParent = 0;
		$isNew = true;
		$isFirst = true;
		foreach($results as $row) {
			if ($row['ID0'] != $idParent) {
				$idParent = $row['ID0'];
				$isNew = true;
				$i++;
				$j = 0 ;
				if ($isFirst) {$i = 0; $isFirst = false;}
			} else {
				$isNew = false;
			}
			if ($isNew) {
				if ($row['isACTIVE0'] == true) {
					$listCat[$i]['NOM'] = $row['NOM0'];
					$listCat[$i]['ID'] = $row['ID0'];
					$listCat[$i]['URL'] = $row['URL0'];
					$listCat[$i]['URL_SLIDE'] = $row['URLSLIDE0'];
					$listCat[$i]['NAVNOM'] = $row['NAVNOM0'];
					$listCat[$i]['DESCRIPTION'] = $row['DESCRIPTION0'];
					$listCat[$i]['DESCRIPTIONLONG'] = $row['DESCRIPTIONLONG0'];
					$listCat[$i]['isACTIVE'] = $row['isACTIVE0'];
					$listCat[$i]['NAVNOM_URLPARENTS'] = $row['NAVNOM_URLPARENTS0'];
					$listCat[$i]['SUBS'] = array();
				}
			}

			if ($row['isACTIVE1'] == true) {
				$listCat[$i]['SUBS'][$j]['NOM'] = $row['NOM1'];
				$listCat[$i]['SUBS'][$j]['ID'] = $row['ID1'];
				$listCat[$i]['SUBS'][$j]['URL'] = $row['URL1'];
				$listCat[$i]['SUBS'][$j]['URL_SLIDE'] = $row['URLSLIDE1'];
				$listCat[$i]['SUBS'][$j]['DESCRIPTION'] = $row['DESCRIPTION1'];
				$listCat[$i]['SUBS'][$j]['DESCRIPTIONLONG'] = $row['DESCRIPTIONLONG1'];
				$listCat[$i]['SUBS'][$j]['NAVNOM'] = $row['NAVNOM1'];
				$listCat[$i]['SUBS'][$j]['isACTIVE'] = $row['isACTIVE1'];
				$listCat[$i]['SUBS'][$j]['NAVNOM_URLPARENTS'] = $row['NAVNOM_URLPARENTS1'];
				$j++;
			}
		}
		return $listCat;
			
	}
    
    private function getTreeCatsOfWithLevelCompute(&$listCat, $row, $index) {
        $listCat['NOM'] = $row["NOM".$index];
		$listCat['NAVTITRENOM'] = $row['NAVTITRENOM'.$index];
		$listCat['NAVDESCRIPTION'] = $row['NAVDESC'.$index];
		$listCat['ID'] = $row['ID'.$index];
		$listCat['URL'] = $row['URL'.$index];
		$listCat['URL_SLIDE'] = $row['URLSLIDE'.$index];
		$listCat['NAVNOM'] = $row['NAVNOM'.$index];
		$listCat['KEYWORDS'] = $row['KEYWORDS'.$index];
		$listCat['DESCRIPTION'] = $row['DESCRIPTION'.$index];
		$listCat['DESCRIPTIONLONG'] = $row['DESCRIPTIONLONG'.$index];
		$listCat['DESCRIPTIONSHORT'] = $row['DESCRIPTIONSHORT'.$index];
		$listCat['CHOICEURL'] = $row['CHOICEURL'.$index];
		$listCat['CHOICEDOC'] = $row['CHOICEDOC'.$index];
		$listCat['isACTIVE'] = $row['isACTIVE'.$index];
		$listCat['IDPARENT'] = $row['IDPARENT'.$index];
		$listCat['NAVNOM_URLPARENTS'] = $row['NAVNOM_URLPARENTS'.$index];
		$listCat['NBPRODUCT'] = $row['NBPRODUCT'];
    }
    
    
	public function getTreeCatsOfWithLevel($idCat, $isSubLevels) {
        $sql = "SELECT c0.NOM NOM0, c1.NOM NOM1,
						c0.NAVTITRENOM NAVTITRENOM0, c1.NAVTITRENOM NAVTITRENOM1,
						c0.NAVDESCRIPTION NAVDESC0, c1.NAVDESCRIPTION NAVDESC1,
						c0.URL URL0, c1.URL URL1,
						c0.URL_SLIDE URLSLIDE0, c1.URL_SLIDE URLSLIDE1,
						c0.ID ID0, c1.ID ID1,
						c0.IDPARENT IDPARENT0, c1.IDPARENT IDPARENT1,
						c0.NAVNOM NAVNOM0, c1.NAVNOM NAVNOM1,
						c0.DESCRIPTION DESCRIPTION0, c1.DESCRIPTION DESCRIPTION1,
						c0.DESCRIPTIONLONG DESCRIPTIONLONG0, c1.DESCRIPTIONLONG DESCRIPTIONLONG1,
						c0.DESCRIPTIONSHORT DESCRIPTIONSHORT0, c1.DESCRIPTIONSHORT DESCRIPTIONSHORT1,
						c0.KEYWORDS KEYWORDS0, c1.KEYWORDS KEYWORDS1,
						c0.CHOICEURL CHOICEURL0, c1.CHOICEURL CHOICEURL1,
						c0.CHOICEDOC CHOICEDOC0, c1.CHOICEDOC CHOICEDOC1,
						c0.isACTIVE isACTIVE0, c1.isACTIVE isACTIVE1,
						c0.NAVNOM_URLPARENTS NAVNOM_URLPARENTS0, c1.NAVNOM_URLPARENTS NAVNOM_URLPARENTS1,
						(Select count(1) from product as p where p.idcategory = c1.id and p.isactive = 0) NBPRODUCT";
				
        if ($isSubLevels) {
            $sql .= ", c2.NOM NOM2,
                    c2.NAVTITRENOM NAVTITRENOM2, 
                    c2.NAVDESCRIPTION NAVDESC2, 
                    c2.URL URL2, 
                    c2.URL_SLIDE URLSLIDE2, 
                    c2.ID ID2,  
                    c2.IDPARENT IDPARENT2, 
                    c2.NAVNOM NAVNOM2,  
                    c2.DESCRIPTION DESCRIPTION2,  
                    c2.DESCRIPTIONLONG DESCRIPTIONLONG2, 
                    c2.DESCRIPTIONSHORT DESCRIPTIONSHORT2, 
                    c2.KEYWORDS KEYWORDS2, 
                    c2.CHOICEURL CHOICEURL2, 
                    c2.CHOICEDOC CHOICEDOC2, 
                    c2.isACTIVE isACTIVE2, 
                    c2.NAVNOM_URLPARENTS NAVNOM_URLPARENTS2
                FROM category AS c0
				LEFT JOIN category AS c1 ON c1.IDPARENT = c0.ID
				LEFT JOIN category AS c2 ON c2.IDPARENT = c1.ID
				WHERE c0.ID = ".$idCat."  
				ORDER BY c0.POSITION ASC,c1.POSITION,c2.POSITION ASC;
				";
        } else {
            $sql .= " FROM category AS c0
				LEFT JOIN category AS c1 ON c1.IDPARENT = c0.ID
				WHERE c0.ID = ".$idCat."  
				ORDER BY c0.POSITION ASC,c1.POSITION ASC;
				";
        }
         
		$results = $this->getAdapter()->fetchAll($sql);
		$listCat = array();
		$listCat['SUBS'] = array();
		$j = -1;
        $k = -1;
        $lastLvl0 = 0;
        $lastLvl1 = 0;
        $lastLvl2 = 0;
		foreach($results as $row) {
            if ($lastLvl0 != $row['ID0']) {
                $this->getTreeCatsOfWithLevelCompute($listCat, $row, "0");
                $lastLvl0 = $row['ID0'];
            }
                
			if (!empty($row['isACTIVE1']) && $row['isACTIVE1'] == true && !empty($row['NOM1'])) {
                if ($lastLvl1 != $row['ID1']) {
				    $j++; 
                    $listCat['SUBS'][$j] = array();
                    $this->getTreeCatsOfWithLevelCompute($listCat['SUBS'][$j], $row, "1");
                    $lastLvl1 = $row['ID1'];
                }
                if ($isSubLevels && $lastLvl2 != $row['ID2']) {
                    if (!empty($row['isACTIVE2']) && $row['isACTIVE2'] == true && !empty($row['NOM2'])) {
                        $k++;
				        $listCat['SUBS'][$j]['SUBS'][$k] = array();
                        $this->getTreeCatsOfWithLevelCompute($listCat['SUBS'][$j]['SUBS'][$k], $row, "2");
                        $lastLvl2 = $row['ID2'];
                    }
                }
			}
		}
		return $listCat;
    }
    
	public function getTreeCatsOf($idCat) {
		return $this->getTreeCatsOfWithLevel($idCat, false);
	}

	public function getAllCategoriesByID ($idParent) {
		$sql = "
		SELECT c0.NOM NOM0, c1.NOM NOM1, c2.NOM NOM2, c3.NOM NOM3, c4.NOM NOM4, c5.NOM NOM5, 
				c6.NOM NOM6, c7.NOM NOM7, c8.NOM NOM8, c9.NOM NOM9, c10.NOM NOM10,
				c0.isACTIVE isACTIVE0, c1.isACTIVE isACTIVE1, c2.isACTIVE isACTIVE2, c3.isACTIVE isACTIVE3, c4.isACTIVE isACTIVE4, c5.isACTIVE isACTIVE5, 
				c6.isACTIVE isACTIVE6, c7.isACTIVE isACTIVE7, c8.isACTIVE isACTIVE8, c9.isACTIVE isACTIVE9, c10.isACTIVE isACTIVE10,
				c0.URL URL0, c1.URL URL1, c2.URL URL2, c3.URL URL3, c4.URL URL4, c5.URL URL5, 
				c6.URL URL6, c7.URL URL7, c8.URL URL8, c9.URL URL9, c10.URL URL10,
				c0.ID ID0, c1.ID ID1, c2.ID ID2, c3.ID ID3, c4.ID ID4, c5.ID ID5, 
				c6.ID ID6, c7.ID ID7, c8.ID ID8, c9.ID ID9, c10.ID ID10,
				c0.IDPARENT IDPARENT0, c1.IDPARENT IDPARENT1, c2.IDPARENT IDPARENT2, c3.IDPARENT IDPARENT3, c4.IDPARENT IDPARENT4, c5.IDPARENT IDPARENT5, 
				c6.IDPARENT IDPARENT6, c7.IDPARENT IDPARENT7, c8.IDPARENT IDPARENT8, c9.IDPARENT IDPARENT9, c10.IDPARENT IDPARENT10
		FROM category AS c0
		LEFT JOIN category AS c1 ON c1.IDPARENT = c0.ID
		LEFT JOIN category AS c2 ON c2.IDPARENT = c1.ID
		LEFT JOIN category AS c3 ON c3.IDPARENT = c2.ID 
		LEFT JOIN category AS c4 ON c4.IDPARENT = c3.ID 
		LEFT JOIN category AS c5 ON c5.IDPARENT = c4.ID 
		LEFT JOIN category AS c6 ON c6.IDPARENT = c5.ID 
		LEFT JOIN category AS c7 ON c7.IDPARENT = c6.ID 
		LEFT JOIN category AS c8 ON c8.IDPARENT = c7.ID 
		LEFT JOIN category AS c9 ON c9.IDPARENT = c8.ID 
		LEFT JOIN category AS c10 ON c10.IDPARENT = c9.ID 
		WHERE c0.IDPARENT = ".$idParent."
		ORDER BY c0.ID,c1.POSITION,c2.POSITION,c3.POSITION,c4.POSITION,c5.POSITION,c6.POSITION,c7.POSITION,c8.POSITION,c9.POSITION,c10.POSITION ASC;
    	"; 
		return $this->getAdapter()->fetchAll($sql);
	}
	
public function getAllCategoriesIDByID ($idParent) {
		$sql = "
		SELECT c0.ID ID0, c1.ID ID1, c2.ID ID2, c3.ID ID3, c4.ID ID4, c5.ID ID5, 
				c6.ID ID6, c7.ID ID7, c8.ID ID8, c9.ID ID9, c10.ID ID10
		FROM category AS c0
		LEFT JOIN category AS c1 ON c1.IDPARENT = c0.ID
		LEFT JOIN category AS c2 ON c2.IDPARENT = c1.ID
		LEFT JOIN category AS c3 ON c3.IDPARENT = c2.ID 
		LEFT JOIN category AS c4 ON c4.IDPARENT = c3.ID 
		LEFT JOIN category AS c5 ON c5.IDPARENT = c4.ID 
		LEFT JOIN category AS c6 ON c6.IDPARENT = c5.ID 
		LEFT JOIN category AS c7 ON c7.IDPARENT = c6.ID 
		LEFT JOIN category AS c8 ON c8.IDPARENT = c7.ID 
		LEFT JOIN category AS c9 ON c9.IDPARENT = c8.ID 
		LEFT JOIN category AS c10 ON c10.IDPARENT = c9.ID 
		WHERE c0.IDPARENT = ".$idParent;   
		return $this->getAdapter()->fetchAll($sql);
	}
 
	public function getIdCatFromProductId($idProd) {
		$sql = "
		SELECT p.IDCATEGORY ID
		FROM product AS p
		WHERE p.ID = ".$idProd;
		$data = $this->getAdapter()->fetchRow($sql);
		return $data['ID'];
	}
	
	public function getAllSubsIDByIDToString($idCat) {
        if ($idCat != null && (int)$idCat > 0) {
		    $listCat = $this->getAllCategoriesIDByID($idCat);
		    $listTemp = array();
		    $value = 'ID';
		    $listCatString = $idCat;
		
		    //list of sub cats
		    foreach ($listCat as $row) {
			    for ($level=0 ; $level<11; $level++) {
				    if ((!isset($listTemp[$value.$level]) || $listTemp[$value.$level] != $row[$value.$level]) && $row[$value.$level] != null) {
					    $listTemp[$value.$level] = $row[$value.$level];
					    if ($listCatString !="") {
						    $listCatString .= ' ,'.$row[$value.$level];
					    } else {
						    $listCatString = $row[$value.$level];
					    }
				    } 
			    }
		    }
		    return $listCatString;
        } 
        return "";
	}


	public function getAllCategoriesProperties() {
		$sql = "SELECT c.* FROM category c ORDER BY c.NOM ASC ";
		$cats = $this->getAdapter()->fetchAll($sql);
		$data = array();
		foreach($cats as $row)
		{
			$data[$row['ID']] = array(
				'ID' => $row['ID'],
				'NOM' => $row['NOM'],
				'URL' => $row['URL'],
				'NAVNOM' => $row['NAVNOM'],
				'isACTIVE' => $row['isACTIVE']
			);
		}
		return $data;
	}

	private function getCategoryById($idCat) {
		$sql = "SELECT c.* FROM category c WHERE c.ID = ".$idCat." ORDER BY c.NOM ASC";
		$cats = $this->getAdapter()->fetchAll($sql);
		$data = array();
		foreach ($cats AS $row) {
			$data[$row['ID']] = $row['NOM'];
		}
		return $data;
	}
     
    public function canBeMigrate($id) {
    	$sql = "
		SELECT count(*) TOTAL
		FROM category AS c
		WHERE c.isACTIVE = 0 AND c.IDPARENT = ".$id;
		$data = $this->getAdapter()->fetchRow($sql); 
    	return (int)$data['TOTAL'] == 0;
	}
    
}
?>models/CommandProduct.php000060400000000204150710367660011462 0ustar00<?php
class CommandProduct extends Zend_Db_Table
{
    protected $_name = 'command_product';
    protected $_primary = 'ID';
 	
}
?>models/KeyWord.php000060400000001437150710367660010140 0ustar00<?php
class KeyWord extends Zend_Db_Table
{
    protected $_name = 'key_word';
    protected $_primary = 'ID';

    public function getLists() {
    	return $this->select()->order('KEYWORD ASC')->query()->fetchAll();
	}
	 
	public function isExist($word) {  
		$sql = "
			SELECT k.*
			FROM key_word k 
			WHERE k.KEYWORD = '".$word."'";
		$results = $this->getAdapter()->fetchAll($sql);
		if (isset($results) && !empty($results)) { return true; }
		return false;
	}
	
	public function findByKeyword($word) {  
		$sql = "
			SELECT k.KEYWORD as KEYWORD
			FROM key_word k 
			WHERE k.KEYWORD LIKE '%".$word."%'
			LIMIT 20";
		$results = $this->getAdapter()->fetchAll($sql);
		$result = array();
		foreach ($results as $row) {
			array_push($result, $row['KEYWORD']);
		} 
		return $result;
	}
}
?>models/ProductChildOption.php000060400000000212150710367660012317 0ustar00<?php
class ProductChildOption extends Zend_Db_Table
{
    protected $_name = 'productchild_option';
    protected $_primary = 'ID';

}
?>models/Pays.php000060400000000473150710367660007467 0ustar00<?php
class Pays extends Zend_Db_Table
{
    protected $_name = 'pays_fr';
    protected $_primary = 'ID';
	
	public function getPaysFR() {
		$select = "SELECT p.ID ID, p.PAYS PAYS, p.CODE CODE, p.LOCAL LOCAL
				FROM pays_fr AS p
				ORDER BY PAYS ASC;";
		
		return $this->getAdapter()->fetchAll($select);
	}
}
?>models/CategoryTypeTri.php000060400000002313150710367660011644 0ustar00<?php
class CategoryTypeTri extends Zend_Db_Table
{
    protected $_name = 'category_type_tri';
    protected $_primary = 'ID';
 
    public function getListTriByCategory($idcat) { 
    	try { return $this->select()->where("IDCATEGORY = ?", $idcat)->query()->fetchAll();
    	} catch (Zend_Exception $e) { return array(); }
	}
	
	public function getListTriByCategoryInOneRow($idcat) {
		try { 
			$list = $this->getListTriByCategory($idcat);
			if (!empty($list)) { 
				$data = array();
				foreach ($list as $row) {
					if (!empty($row['TITRE'])) { $data['TITRE_'.$row['TYPE'].'_'.$row['IDTRI']] = $row['TITRE']; }
					if (!empty($row['DESCRIPTION'])) { $data['DESC_'.$row['TYPE'].'_'.$row['IDTRI']] = $row['DESCRIPTION']; }
					if (!empty($row['KEYWORDS'])) { $data['KEYWORD_'.$row['TYPE'].'_'.$row['IDTRI']] = $row['KEYWORDS']; } 
				}
				return $data;
			}
    	} catch (Zend_Exception $e) { return array(); }
    	return array();
	} 
	
	public function getInfoByCatTypeTri($idcat, $type, $idtri) {
		try {  
			return $this->select()->where("IDCATEGORY = ?", $idcat)
			->where("TYPE = ?", $type)
			->where("IDTRI = ?", $idtri)
			->query()->fetch(); 
		} catch (Zend_Exception $e) { return array(); }
	}
     
}
?>models/Supplier.php000060400000000165150710367660010354 0ustar00<?php
class Supplier extends Zend_Db_Table
{
    protected $_name = 'supplier';
    protected $_primary = 'ID';

}
?>modules/backoffice/controllers/StatisticController.php000060400000022673150710367660017403 0ustar00<?php

class Backoffice_StatisticController extends Modules_Backoffice_Controllers_MainController
{

	function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "Logs";
		$this->isConnectedWithRole('isStats');  
	}
	function indexAction()
	{
		$this->_forward('/');

	}

	function logdefaultcleanAction() {
		$logDefault = new LogDefault();
		$logDefault->delete("1=1");
		$this->_forward('logdefault');
	}
	function logadmincleanAction() {
		$logAdmin = new LogAdmin();
		$logAdmin->delete("1=1");
		$this->_forward('logadmin');
	}
	function statsAction() {
		try {
			$this->view->titlePage = "Logs des administrateurs";
			$this->view->currentMenu = "Stats";

			$command = new Command();
			$this->view->statsBestSellYear = $command->statsBestSellForYear();
			$this->view->statsBestSellMonth = $command->statsBestSellForMonth();
			$this->view->statsNbProductYear = $command->statsNbProductYear();
			$this->view->statsNbProductMonth = $command->statsNbProductMonth();
			$this->view->statsCategoryCmdYear = $command->statsCategoryCmdYear();
			$this->view->statsCategoryCmdMonth = $command->statsCategoryCmdMonth();
			
			$statsSearch = new StatsSearch();
			$this->view->statsKeyWordYear = $statsSearch->statsKeyWordYear();
			
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = $e->getMessage();
		}
			
	}
	
	function logadminAction() {
		try {
			$this->view->titlePage = "Logs des administrateurs";
			$this->view->currentMenu = "Logs";
			$adminNamespace = $this->getSession();

			//Gestion des tris
			$table = 'DATE_LOG';
			$tri = 'DESC';

			if ($this->_request->getParam('col'))
			{
				$adminNamespace->triAdminCol_logadmin = $this->_request->getParam('col');
				($adminNamespace->triAdminSens_logadmin == 'ASC') ? $adminNamespace->triAdminSens_logadmin = 'DESC' : $adminNamespace->triAdminSens_logadmin = 'ASC';
			}
			if (isset($adminNamespace->triAdminCol_logadmin)) {
				$table = $adminNamespace->triAdminCol_logadmin;
				$tri = $adminNamespace->triAdminSens_logadmin;
			}
			
			if (!isset($adminNamespace->triAdminNumber_logadmin)) {
				$adminNamespace->triAdminNumber_logadmin = 100;
			}
			if ($this->_request->getParam('nb')) {
				$adminNamespace->triAdminNumber_logadmin = $this->_request->getParam('nb');
			}
			$paginationNumber = $adminNamespace->triAdminNumber_logadmin;
			
			$logAdmin = new LogAdmin();
			$listlogs = $logAdmin->select()->order($table.' '.$tri);
			
			$this->setPaginator($listlogs, $this->_getParam('page',1), $paginationNumber);
		
		
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = $e->getMessage();
		}
			
	}

	function logdefaultAction() {
		try {
			$this->view->titlePage = "Logs des utilisateurs";
			$this->view->currentMenu = "Logs";
			$adminNamespace = $this->getSession();
				
			//Gestion des tris
			$table = 'DATE_LOG';
			$tri = 'DESC';

			if ($this->_request->getParam('col'))
			{
				$adminNamespace->triAdminCol_logdefault = $this->_request->getParam('col');
				($adminNamespace->triAdminSens_logdefault == 'ASC') ? $adminNamespace->triAdminSens_logdefault = 'DESC' : $adminNamespace->triAdminSens_logdefault = 'ASC';
			}
			if (isset($adminNamespace->triAdminCol_logdefault)) {
				$table = $adminNamespace->triAdminCol_logdefault;
				$tri = $adminNamespace->triAdminSens_logdefault;
			}
				 
			if (!isset($adminNamespace->triAdminNumber_logdefault)) {
				$adminNamespace->triAdminNumber_logdefault = 100;
			}
			if ($this->_request->getParam('nb')) {
				$adminNamespace->triAdminNumber_logdefault = $this->_request->getParam('nb');
			}
			$paginationNumber = $adminNamespace->triAdminNumber_logdefault;
			
			$logDefault = new LogDefault();
			$listlogs = $logDefault->select()->order($table.' '.$tri);
			
			$this->setPaginator($listlogs, $this->_getParam('page',1), $paginationNumber);
		 
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = $e->getMessage();
		}
			
	}
	 
	function searchkeyAction() {
	try {
			$this->view->titlePage = "Liste des recherches";
			$adminNamespace = $this->getSession();
				
			//Gestion des tris
			$table = 'DATESTART';
			$tri = 'DESC';

			if ($this->_request->getParam('col'))
			{
				$adminNamespace->triAdminCol_logsearch = $this->_request->getParam('col');
				($adminNamespace->triAdminSens_logsearch == 'ASC') ? $adminNamespace->triAdminSens_logsearch = 'DESC' : $adminNamespace->triAdminSens_logsearch = 'ASC';
			}
			if (isset($adminNamespace->triAdminCol_logsearch)) {
				$table = $adminNamespace->triAdminCol_logsearch;
				$tri = $adminNamespace->triAdminSens_logsearch;
			}
			
			if (!isset($adminNamespace->triAdminNumber_logsearch)) {
				$adminNamespace->triAdminNumber_logsearch = 100;
			}
			
			if ($this->_request->getParam('nb')) {
				$adminNamespace->triAdminNumber_logsearch = $this->_request->getParam('nb');
			}
			 
			$paginationNumber = $adminNamespace->triAdminNumber_logsearch;
			
			$statsSearch = new StatsSearch();
			$listlogs = $statsSearch->select()->order($table.' '.$tri);
			 
			$this->setPaginator($listlogs, $this->_getParam('page',1), $paginationNumber);
		  
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = $e->getMessage();
		}
	}

	function keymapAction() {
	try {
			$this->view->titlePage = "Carte des mots cl�s";
			$adminNamespace = $this->getSession();
			
			$keymap = new KeyMap();
			$this->view->listMapCat = $keymap->getAllByCAT();
			$this->view->listMapBrend = $keymap->getAllByBREND();
			
			$categorie = new Category();
			$select = $categorie->select()->order('NOM ASC');
			$this->view->listCat = $categorie->fetchAll($select);
			
			$brend = new SupplierBrend();
			$select = $brend->select()->order('BREND ASC');
			$this->view->listBrend = $brend->fetchAll($select);
			
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = $e->getMessage();
		}
	}
	
	function keymapcateditAction() {
		try {
			if ($this->_request->isPost()) {
					
				$params = $this->_request->getPost();
				$catId = (int) $params['catId'];
				$color = 'DEFAULT';
				if (!empty($params['colorKey'])) {
					$color = $params['colorKey'];
				}
								
				if ($catId > 0) {
					$keymap = new KeyMap();
					$key = $keymap->getKeyByCatID($catId);
					if (isset($key) && $key != null && !empty($key['CAT_NOM'])) {
						$data = array (
				 		'SIZE' => $params['sizeKey'],
				 		'POSITION' => $params['positionKey'],
						'TYPE' => 'CAT',
						'COLOR' => $color
						);
						$keymap->update($data, 'ID = '.$key['ID']);
					} else {
						$data = array (
						'CATID' => $catId,
				 		'SIZE' => $params['sizeKey'],
				 		'POSITION' => $params['positionKey'],
						'TYPE' => 'CAT',
						'COLOR' => $color
						);
						$keymap->insert($data);
					}
				}
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = $e->getMessage();
		}
		$this->_forward('/keymap');
	}
	
function keymapbrendeditAction() {
	try {
			if ($this->_request->isPost()) {
						
				$params = $this->_request->getPost();
				$brendId = (int) $params['brendId'];
				$color = 'DEFAULT';
				if (!empty($params['colorKey'])) {
					$color = $params['colorKey'];
				}
				
				if ($brendId > 0) {
					$keymap = new KeyMap();
					$key = $keymap->getKeyByBrendID($brendId);
					
					if (isset($key) && $key != null && !empty($key['BREND_NOM'])) {
						
						$data = array (
				 		'SIZE' => $params['sizeKey'],
				 		'POSITION' => $params['positionKey'],
						'TYPE' => 'BREND',
						'COLOR' => $color
						);
						$keymap->update($data, 'ID = '.$key['ID']);
					} else {
						$data = array (
						'BRENDID' => $brendId,
				 		'SIZE' => $params['sizeKey'],
				 		'POSITION' => $params['positionKey'],
						'TYPE' => 'BREND',
						'COLOR' => $color
						);
						$keymap->insert($data);
					}
				}
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = $e->getMessage();
		}
		$this->_forward('/keymap');
	}
	

function keymapshowAction()
	{
		if ($this->_request->isPost()) {
				
			$params = $this->_request->getPost();
			
			if ($params['keyType'] == 'CAT') {
				$id = $params['catIdShow'];
			} else {
				$id = $params['brendIdShow'];
			}
			$data = array('isSHOW' => $params['showvalue']); 
			
			try {
				if ( $id > 0) {
					$keymap = new KeyMap();
					if ($params['keyType'] == 'CAT') {
						$keymap->update($data, 'CATID = '.$id);
					} else {
						$keymap->update($data, 'BRENDID = '.$id);
					}
				}
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
				$this->_forward('/keymap');
			}
		}
		$this->_forward('/keymap');
	}
	
	function clickstatsipAction() {
		try {
			$this->view->titlePage = "Statistiques des clicks";
			
			$clickStats = new ClickStats();
			$this->view->listSource = $clickStats->getSourceStats();
			
			$listIp = $clickStats->getIPStats();
			
			$this->view->listIp = $listIp;
			
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = $e->getMessage();
		}
	}
	
	function clickstatsproductAction() {
		try {
			$this->view->titlePage = "Statistiques des clicks";
			
			$clickStats = new ClickStats();
			$this->view->listClick = $clickStats->getProductDetail();
			
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = $e->getMessage();
		}
	}
}

	
?>modules/backoffice/controllers/CommandController.php000060400000036473150710367660017015 0ustar00<?php
class Backoffice_CommandController extends Modules_Backoffice_Controllers_MainController
{

	function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "Command";
		$this->isConnectedWithRole('isCommand');  
	}
	function indexAction()
	{
		$this->_forward('/listcommand');

	}
	function searchAction()
	{
		try {
			$this->view->titlePage = "Rechercher une commande";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$startSearch = false;

			$isCheckedValidating = false;
			$searchValue = "";
			if ($this->_request->isPost()) {
				$post = $this->_request->getPost();
				$filter = new Zend_Filter();
				$filter	->addFilter(new Zend_Filter_StripTags())
				->addFilter(new Zend_Filter_StringTrim());
				$searchValue = $filter->filter($post['searchValue']);
				if (isset($post['searchType'])) {
					$isCheckedValidating = true;
				}
				$startSearch = true;
			} 

			//Gestion des tris
			$titlePage = "";
			$listcommand = array();
			if ($startSearch) {
                $adminNamespace = $this->getSession();                
                $adminNamespace->cmdSearchValue = $searchValue;
                $adminNamespace->cmdSearchValidating = $isCheckedValidating;
                
				//Appel model pour listing				
				$command = new Command();
				$titlePage .= " : ".$searchValue;
				$listcommand = $command->findCommandsByMultiSearch($isCheckedValidating, $searchValue);
			}
					
			$this->view->titlePage .= $titlePage; 
			$this->view->listcommand = $listcommand;
			$this->view->searchType = $isCheckedValidating;
			$this->view->searchValue = $searchValue;
		} catch (Zend_Exception $e) { $this->errorHandler($e); $this->view->messageError = $e->getMessage(); }
	}

	function listAction()
	{
		$this->view->titlePage = "Gestion des commandes";
		$adminNamespace = $this->getSession();
			
		//Gestion des tris
		$table = 'STATUT';
		$tri = 'ASC';

		if ($this->_request->getParam('col'))
		{
			$adminNamespace->triCmdCol = $this->_request->getParam('col');
			($adminNamespace->triCmdSens == 'ASC') ? $adminNamespace->triCmdSens = 'DESC' : $adminNamespace->triCmdSens = 'ASC';
		}
		if (isset($adminNamespace->triCmdCol)) {
			$table = $adminNamespace->triCmdCol;
			$tri = $adminNamespace->triCmdSens;
		}
			
		//Appel model pour listing
		$command = new Command();
		$select = $command->select()->where('STATUT <> 0 AND isARCHIVE = 1')->order($table.' '.$tri);
			
		$this->view->listcommand = $command->fetchAll($select);
			
	}

	function listcommandAction()
	{
		$this->view->titlePage = "Gestion des commandes";
		$adminNamespace = $this->getSession();
			
		//Gestion des tris
		$table = 'STATUT';
		$tri = 'ASC';

		if ($this->_request->getParam('col'))
		{
			$adminNamespace->triCmdCol = $this->_request->getParam('col');
			($adminNamespace->triCmdSens == 'ASC') ? $adminNamespace->triCmdSens = 'DESC' : $adminNamespace->triCmdSens = 'ASC';
		}
		if (isset($adminNamespace->triCmdCol)) {
			$table = $adminNamespace->triCmdCol;
			$tri = $adminNamespace->triCmdSens;
		}
			
		//Appel model pour listing
		$command = new Command();
		$select = $command->select()->where('isARCHIVE = 1 AND STATUT IN (1, 2, 3, 4)')->order($table.' '.$tri);
			
		$this->view->listcommand = $command->fetchAll($select);
			
	}

	function listdevisAction()
	{
		$this->view->titlePage = "Gestion des devis";
		$adminNamespace = $this->getSession();
			
		//Gestion des tris
		$table = 'STATUT';
		$tri = 'ASC';

		if ($this->_request->getParam('col'))
		{
			$adminNamespace->triCmdCol = $this->_request->getParam('col');
			($adminNamespace->triCmdSens == 'ASC') ? $adminNamespace->triCmdSens = 'DESC' : $adminNamespace->triCmdSens = 'ASC';
		}
		if (isset($adminNamespace->triCmdCol)) {
			$table = $adminNamespace->triCmdCol;
			$tri = $adminNamespace->triCmdSens;
		}
			
		//Appel model pour listing
		$command = new Command();
		$select = $command->select()->where('isARCHIVE = 1 AND STATUT IN (10, 11)')->order($table.' '.$tri);
			
		$this->view->listcommand = $command->fetchAll($select);
			
	}

	//Same as UserController, module default
	private function computeFactureTVA($facture, $paysLivraison) {
		$fact = new Facture();
		$fact->computeFactureTVA($facture, $paysLivraison);
		return $facture;
	}

	function editAction() {
try {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		$command = new Command();
		if($this->getRequest()->isPost()) {
			$id = (int)$this->_request->getPost('idcmd');
			$statut = (int)$this->_request->getPost('statut');
			$delivery_trackinglink = $this->_request->getPost('delivery_trackinglink');
			$delivery_trackingnumber = $this->_request->getPost('delivery_trackingnumber');
                        
			if ($id > 0 && $statut>0) {
				try {
					if ($statut == 3 || $statut == 11) {
						$date = new Zend_Date();
						$data = array ( 'STATUT' => $statut, 'DATEEND' => $date->toString('YYYY-MM-dd HH:mm:ss') );

					} else {
						$data = array ( 'STATUT' => $statut, 'DATEEND' => '0000-00-00 00:00:00');
					}
                    if (isset($delivery_trackinglink) && !empty($delivery_trackinglink) &&
                        isset($delivery_trackingnumber) && !empty($delivery_trackingnumber)) {
                        $data['DELIVERY_TRACKINGLINK'] = $delivery_trackinglink;
                        $data['DELIVERY_TRACKINGNUMBER'] = $delivery_trackingnumber;
                    }
                    
					$command->update($data, 'ID = '.$id);
					$this->view->messageSuccess = "Le statut a �t� modifi�";
					$this->log("Le statut a �t� modifi� : ".$id,'info');
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}

		if ($this->getRequest()->getParam('id') && (int)$this->getRequest()->getParam('id')>0) {
			$id = (int)$this->getRequest()->getParam('id');
		}
		$isExist = $command->fetchRow("ID = ".$id);
		if ($isExist) {			 
        
			$myCommand = $command->getCommandAsFacture($id);
            $this->view->facture = $myCommand;
			$titlePage = "Modifier une commande";

			switch ($myCommand['STATUT']) {
				case 10 :
					$titlePage = "Modifier un devis";
					break;
				case 11 :
					$titlePage = "Modifier un devis";
					break;
			}

			$this->view->titlePage = $titlePage;
		}        
		} catch (Zend_Exception $e) { $this->log($e->getMessage(), 'err'); }
	} 
    
	function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$command = new Command();
					$commandProduct = new CommandProduct();

					$commandProduct->delete('IDCOMMAND = '.$id);

					$command->delete('ID = '.$id);

					$this->view->messageSuccess = "La commande a �t� supprim�e ";
					$this->log("La commande a �t� supprim�e",'info');
                    
                    $adminNamespace = $this->getSession();    
                    if (isset($adminNamespace->cmdSearchValue) && isset($adminNamespace->cmdSearchValidating)) {
                        $isCheckedValidating = $adminNamespace->cmdSearchValidating;
                        $searchValue = $adminNamespace->cmdSearchValue;
                        
                        //Gestion des tris 
                        $listcommand = array(); 
                        //Appel model pour listing			 
                        $titlePage = "Rechercher une commande : ".$searchValue;
                        $listcommand = $command->findCommandsByMultiSearch($isCheckedValidating, $searchValue);	         
                        
                        $this->view->titlePage .= $titlePage; 
                        $this->view->listcommand = $listcommand;
                        $this->view->searchType = $isCheckedValidating;
                        $this->view->searchValue = $searchValue;
                    } 
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
        $this->render('search');

	}
	
	function ajaxdelcommandAction() { 
		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					
					$command = new Command();
					$commandProduct = new CommandProduct(); 
					$commandProduct->delete('IDCOMMAND = '.$id); 
					$command->delete('ID = '.$id); 
					$this->view->messageSuccess = "SUCCESS";
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "ERROR";
				}
			}
		}  
		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render('ajaxmessage');
	}

	function delcommandAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$command = new Command();
					$commandProduct = new CommandProduct();

					$commandProduct->delete('IDCOMMAND = '.$id);

					$command->delete('ID = '.$id);

					$this->view->messageSuccess = "La commande a �t� supprim�e ";

					$this->log("La commande a �t� supprim�e",'info');
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/listcommand');

	}

	function deldevisAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$command = new Command();
					$commandProduct = new CommandProduct();

					$commandProduct->delete('IDCOMMAND = '.$id);

					$command->delete('ID = '.$id);

					$this->view->messageSuccess = "Le devis a �t� supprim� ";

					$this->log("Le devis a �t� supprim�",'info');
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/listdevis');

	}

	function archiveAction() {
		if($this->getRequest()->isPost()) {
			$checkBoxValues = $this->_request->getPost('checkBoxValues');
			$checkBoxValues = substr($checkBoxValues, 0, -1);
			try {
				if (!empty($checkBoxValues)) {
					$command = new Command();

					$data = array ( 'isARCHIVE' => 0);
					$command->update($data, 'ID in ('.$checkBoxValues.')');

					$this->log("Les commandes ont �t� archiv�es "+$checkBoxValues,'info');
				}
			} catch (Zend_Exception $e) {
				$this->log($e->getMessage(),'err');
			}
		}
		$this->_forward('/listcommand');
	}
	function archivecommandAction() {
		if($this->getRequest()->isPost()) {
			$checkBoxValues = $this->_request->getPost('checkBoxValues');
			$checkBoxValues = substr($checkBoxValues, 0, -1);
			try {
				if (!empty($checkBoxValues)) {
					$command = new Command();

					$data = array ( 'isARCHIVE' => 0);
					$command->update($data, 'ID in ('.$checkBoxValues.')');

					$this->log("Les commandes ont �t� archiv�es "+$checkBoxValues,'info');
				}
			} catch (Zend_Exception $e) {
				$this->log($e->getMessage(),'err');
			}
		}
		$this->_forward('/listcommand');
	}
	function archivedevisAction() {
		if($this->getRequest()->isPost()) {
			$checkBoxValues = $this->_request->getPost('checkBoxValues');
			$checkBoxValues = substr($checkBoxValues, 0, -1);
			try {
				if (!empty($checkBoxValues)) {
					$command = new Command();

					$data = array ( 'isARCHIVE' => 0);
					$command->update($data, 'ID in ('.$checkBoxValues.')');

					$this->log("Les devis ont �t� archiv�es "+$checkBoxValues,'info');
				}
			} catch (Zend_Exception $e) {
				$this->log($e->getMessage(),'err');
			}
		}
		$this->_forward('/listdevis');
	}
    
	function deliverymailAction() {
        $id = 0;
		if ($this->getRequest()->getParam('id') && (int)$this->getRequest()->getParam('id')>0) {
			$id = (int)$this->getRequest()->getParam('id');
		}

        if ($id > 0) {
            $command = new Command();
            $isExist = $command->fetchRow("ID = ".$id);
            if ($isExist) {			
                $facture = $command->getCommandAsFacture($id);
                $this->view->facture =$facture;     
                
                if (isset($facture['DELIVERY_TRACKINGLINK']) && !empty($facture['DELIVERY_TRACKINGLINK']) &&
                    isset($facture['DELIVERY_TRACKINGNUMBER']) && !empty($facture['DELIVERY_TRACKINGNUMBER'])) {
                    
                    try {
                        $view = new Zend_View();
                        $view->addScriptPath('../application/modules/backoffice/views/scripts/command/');
                        $view->assign("facture",$facture);
                        $body = $view->render("facture_deliverytrack.phtml");
                        $from =  $this->serviceClient_Mail;
                        $objet = "Votre commande : ".$facture['REFERENCE'];
                        $to = $facture['USER_EMAIL'];

                        $mail = new Zend_Mail();
                        $mail->setBodyHtml($body);
                        $mail->setFrom($from, $this->siteName);
                        $mail->addTo($to);
                        $mail->setSubject($objet);
                        $mail->send();
					    $this->view->messageSuccess = "L'email de suivi de livraison a �t� envoy� a : ".$to;
                        $this->log("L'email de suivi de livraison a �t� envoy� a : ".$to,'info');
                    }
                    catch (Zend_Exception $e) {
                        $this->log($e->getMessage(),'err');
                    }
                } else {
					$this->view->messageError = "Vous devez valider l'ajout du lien de suivi de livraison";
                }
            }
        } 
        $this->view->titlePage = "Modifier une commande";
        $this->render("edit");
	}
    
    
	function traitementmailAction() {
        $id = 0;
		if ($this->getRequest()->getParam('id') && (int)$this->getRequest()->getParam('id')>0) {
			$id = (int)$this->getRequest()->getParam('id');
		}

        if ($id > 0) {
            $command = new Command();
            $isExist = $command->fetchRow("ID = ".$id);
            if ($isExist) {			
                $facture = $command->getCommandAsFacture($id);
                $this->view->facture =$facture;     
                 
                try {
                    $view = new Zend_View();
                    $view->addScriptPath('../application/modules/backoffice/views/scripts/command/');
                    $view->assign("facture",$facture);
                    $body = $view->render("facture_traitementinprogress.phtml");
                    $from =  $this->serviceClient_Mail;
                    $objet = "Votre commande : ".$facture['REFERENCE'];
                    $to = $facture['USER_EMAIL'];

                    $mail = new Zend_Mail();
                    $mail->setBodyHtml($body);
                    $mail->setFrom($from, $this->siteName);
                    $mail->addTo($to);
                    $mail->setSubject($objet);
                    $mail->send();
					$this->view->messageSuccess = "L'email de la commande en cours de traitement a �t� envoy� a : ".$to;
                    $this->log("L'email de la commande en cours de traitement a �t� envoy� a : ".$to,'info');
                }
                catch (Zend_Exception $e) {
                    $this->log($e->getMessage(),'err');
                } 
            }
        } 
        $this->view->titlePage = "Modifier une commande";
        $this->render("edit");
	}
}
?>modules/backoffice/controllers/ProductController.php000060400000264177150710367660017063 0ustar00<?php
class Backoffice_ProductController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "Product";

		$this->isConnectedWithRole('isProduct'); 
	}
	public function indexAction()
	{
		$this->_forward('/list');

	}
    
    private function indexproductById($id) {
       try {    
			if ($id > 0) {
                try
                {      
                    if (empty($this->FeatureElasticSearchWsdl) || empty($this->FeatureElasticSearchUsername) || empty($this->FeatureElasticSearchKey)) {
		                return ;
                    }
                    $soapClient = $this->getSoapClient($this->FeatureElasticSearchWsdl);
                    $request = $this->getSoapHeader($this->FeatureElasticSearchUsername, $this->FeatureElasticSearchKey);
                    $request->ProductId = $id;
                
                    $parameters = new stdClass();
                    $parameters->request = $request;
                    $soapClient->PushProduct($parameters);
                    $soapClient = null; 
                }
                catch (SoapFault $fault)
                {
					$this->log('SOAP : indexproductById : '.$fault->faultcode.' '.$fault->faultstring,'err'); 
                }   
            }
		}
        catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err'); 
		}  
    }
    
    public function indexproductAction() {
       try {    
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
                $soapClient = $this->getSoapClient($this->FeatureElasticSearchWsdl);
                $result = new stdClass();
                try
                {     
                    $request = $this->getSoapHeader($this->FeatureElasticSearchUsername, $this->FeatureElasticSearchKey);
                    $request->ProductId = $id;
                
                    $parameters = new stdClass();
                    $parameters->request = $request;
                    $result = $soapClient->PushProduct($parameters);
                }
                catch (SoapFault $fault)
                {
					$this->log('SOAP : indexProductAction : '.$fault->faultcode.' '.$fault->faultstring,'err'); 
                }
                $soapClient = null;    
            }
		}
        catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err'); 
		} 
		$this->_forward('/edit');
    }
	 
	public function uploadpicsAction() {
		if(!empty($_FILES['file']) && !empty($_FILES['file']['name'])) {
			$nomOrigine = $_FILES['file']['name'];
			$elementsChemin = pathinfo($nomOrigine);
			$extensionFichier = strtolower($elementsChemin['extension']);
			$extensionsAutorisees = array("jpeg", "jpg", "gif", "png");
			if (!(in_array($extensionFichier, $extensionsAutorisees))) {
				$this->view->messageError = "Le fichier n'a pas l'extension attendue";
			} else {
				// Copie dans le repertoire du script avec un nom
				$repertoireDestination = 'items/product/'.$this->_request->getParam('idcat').'/';
				$this->checkDirectoryExist($repertoireDestination);
				
				/*$date = new Zend_Date();					
				$nomDestination = $date->toString('dd-MM-YYYY_HH-mm-ss').".".$extensionFichier;*/
                
				$nomDestination = $this->generateNavigationString($elementsChemin['filename']).".".$extensionFichier;
                $fileoriginal = $repertoireDestination.$nomDestination;
                
				$adminNamespace = $this->getSession();
				if (move_uploaded_file($_FILES["file"]["tmp_name"],$fileoriginal)) {
					try {
						$picture = new Picture();
						$data = array (
					 		'URL' => $fileoriginal,
					 		'IDPRODUCT' => $this->_request->getParam('id'),
							'POSITION' => $adminNamespace->imgPosDefault
						);
						$picture->insert($data);

						$messageSuccess = "L'image a �t� ajout�e";
                        
                        //Resize picture
                        $info = getimagesize($fileoriginal) ;
                        list($width_old, $height_old) = $info;
                        $maxwidth = $this->FeaturePictureResizeWidth;
                        $maxheight = $this->FeaturePictureResizeHeight;
                            
                        if ($width_old > $maxwidth || $height_old > $maxheight) {     
                            Utils_Tool::smart_resize_image($fileoriginal , null, $maxwidth , $maxheight , true , $fileoriginal , true , false ,50 );
                            $messageSuccess .= " et redimensionn�e.";
                        }  
                           
                        $this->view->messageSuccess = $messageSuccess; 
					} catch (Exception $e) {
						$this->view->messageError = $e->getMessage();
					}
				} else {
					$this->view->messageError = "Le fichier n'a pas �t� upload�";
				}
			}
		}
		$this->_forward('/edit');
	}

	public function editpictureAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->isPost()) {
			$params = $this->_request->getPost();
			try {
				$picture = new Picture();
				for ($i=0; $i<$params['nbrImg']; $i++) {
					$data = array (
					 		'POSITION' => $params['position'.$i],
					 		'STRING1' => $params['string1_'.$i],
					 		'STRING2' => $params['string2_'.$i]
					);
					$picture->update($data,'ID = '.$params['id'.$i]);
				}
				$this->view->messageSuccess = "Les images ont �t� modifi�es";

			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
		$this->_forward('/edit');

	}
	public function setpictureAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->isPost()) {
			$params = $this->_request->getPost();
			try {
				$picture = new Picture();
				$adminNamespace = $this->getSession();
				$data = array (
					 		'URL' => $params['picture'],
					 		'IDPRODUCT' => $this->_request->getParam('id'),
							'POSITION' => $adminNamespace->imgPosDefault,
					 		'STRING1' => '',
					 		'STRING2' => ''
							
					 		);
					 		$picture->insert($data);
					 		$this->view->messageSuccess = "Les images ont �t� modifi�es";
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
		$this->_forward('/edit');

	}
	public function delpictureAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('pic')) {
			$id = (int)$this->_request->getParam('pic');
			if ($id > 0) {
				try {
					$picture = new Picture();
					$picture->delete('ID = '.$id);

					$this->view->messageSuccess = "L'image a �t� supprim�e";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/edit');

	}
	public function erasepictureAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->isPost()) {
			$params = $this->_request->getPost();
			try {
				$product = new Product();
				$sql = "
						SELECT p.NOM NOM, p.ID ID 
						FROM product AS p
						LEFT JOIN picture AS pic ON pic.IDPRODUCT = p.ID
						WHERE pic.URL = '".$params['picture']."' 
						AND p.ID <> ".$params['id'];
				$isExistProduct = $product->getAdapter()->fetchRow($sql);

				$pic = new Picture();
				if (!$isExistProduct) {
					unlink($params['picture']);
					$this->view->messageSuccess = "L'image a �t� supprim�e definitivement";
				} else {
					if ($isExistProduct['ID'] == $params['id']) {
						unlink($params['picture']);
						$pic->delete('URL LIKE ?',$params['picture']);
						$this->view->messageSuccess = "L'image a �t� supprim�e definitivement";
					} else {
						$this->view->messageError = "L'image est utilis�e par : ".$isExistProduct['NOM'];
					}
				}

			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
		$this->_forward('/edit');

	}
	public function searchAction()
	{
		$this->view->titlePage = "Recherche avanc�e des produits";

		$supplierBrend = new SupplierBrend();
		$this->view->listbrend = $supplierBrend->fetchAll($supplierBrend->select()->order('BREND ASC'));

		$adminNamespace = $this->getSession();
			
		$option = new Option();
		$this->view->listoption = $option->fetchAll();
		$this->view->listSearch = array();
		if ($this->_request->isPost() || isset($adminNamespace->searchCategory)) {

			$params = $this->_request->getParams();

			$filter = new Zend_Filter_StringTrim();

			$nomtemp = $filter->filter($params['search']);

			if (empty($nomtemp)) { $nomtemp = '%'; } else { $nomtemp = '%'.$nomtemp.'%'; }
			if (!empty($params['prixMin']) && !empty($params['prixMax'])) { $params['prix'] = 'BETWEEN '.(float)$params['prixMin'].' AND '.(float)$params['prixMax'] ; }
			
			$product = new Product();
			$select = "
				SELECT DISTINCT p.NOM NOM, p.DESCRIPTIONSHORT DESCRIPTIONSHORT, p.PRIX PRIX, p.ID ID, p.isACTIVE isACTIVE, p.isPROMO isPROMO
				FROM product AS p
				LEFT JOIN productchild AS pc ON pc.IDPRODUCT = p.ID
				LEFT JOIN productchild_option AS pco ON pco.IDPRODUCTCHILD = pc.ID
				LEFT JOIN product_option AS po ON po.IDPRODUCT = p.ID ";
			if (!empty($params['image']) && $params['image']==0) { $select .= "LEFT JOIN picture AS pic ON pic.IDPRODUCT = p.ID "; }
			
			$select .= "WHERE (p.NOM LIKE '".$nomtemp."' OR pc.REFERENCE LIKE '".$nomtemp."' OR pc.DESIGNATION LIKE '".$nomtemp."') ";
			// Requete trop longue avec : OR p.DESCRIPTIONSHORT LIKE '".$nomtemp."' OR p.DESCRIPTIONTECH LIKE '".$nomtemp."' OR p.DESCRIPTIONLONG LIKE '".$nomtemp."' OR p.DESCRIPTIONNORME LIKE '".$nomtemp."'
		
			if (!empty($params['prixMin']) && !empty($params['prixMax'])) { $select .= "AND (pc.PRIX >= ".$params['prixMin']." AND p.PRIX <= ".$params['prixMax'].") "; }
			if (!empty($params['prixMin']) && empty($params['prixMax'])) { $select .= "AND pc.PRIX >= ".$params['prixMin']." "; }
			if (empty($params['prixMin']) && !empty($params['prixMax'])) { $select .= "AND pc.PRIX <= ".$params['prixMax']." "; }			
			if (!empty($params['image']) && $params['image']==0) { $select .= "AND pic.POSITION = 1 "; }
			if (!empty($params['image']) && $params['image']==1) { $select .= "AND NOT EXISTS ( SELECT * FROM picture pic WHERE pic.IDPRODUCT = p.ID AND pic.POSITION = 1) "; }			
			if (!empty($params['idcategorySearch']) && $params['idcategorySearch']!='All') { $select .= "AND p.IDCATEGORY = ".$params['idcategorySearch'].' '; }
			if (!empty($params['active']) && $params['active']!=2) { $select .= "AND p.isACTIVE LIKE '".$params['active']."' "; }
			if (!empty($params['activePromo']) && $params['activePromo']!=2) { $select .= "AND p.isPROMO LIKE '".$params['activePromo']."' "; }
			if (!empty($params['idbrend']) && $params['idbrend']!='All') { $select .= "AND p.IDBREND = ".$params['idbrend']." "; }
			if (!empty($params['etatstock']) && $params['etatstock']!=3) { $select .= "AND pc.ETATSTOCK LIKE '".$params['etatstock']."' "; }
			if (!empty($params['optionId']) && $params['optionId']!='All') { $select .= "AND pco.IDOPTION LIKE '".$params['optionId']."' "; }
			if (!empty($params['optionValue'])) { $select .= "AND pco.VALUE LIKE '".$params['optionValue']."' "; }

			$select .= "ORDER BY NOM ASC";
			
			try {
				$picture = new Picture();
				$sql = $picture->fetchAll('POSITION = 1');
				$listpics = array();
				foreach ($sql as $row) {
					$listpics[$row['IDPRODUCT']] = $row['URL'];
				}
				$this->view->listproductpicture = $listpics;
					
				$listTemp = $product->getAdapter()->fetchAll($select);
				$this->view->listSearch = $listTemp;
				if ($nomtemp == '%') {
					$nomtemp = '';
				}
				$params['search'] = $filter->filter($params['search']);
				if (!empty($params['search']) && empty($params['idcategorySearch'])) {
					$params = array (
				 		'search' => $params['search'],
				 		'prixMin' => '',
				 		'prixMax' => '',
				 		'active' => '2',
				 		'image' => '2',
				 		'activePromo' => '2',
				 		'idbrend' => 'All',
				 		'etatstock' => '3',
				 		'optionId' => 'All',
				 		'optionValue' => '',
				 		'idcategorySearch' => 'All'
				 		);	
				}
				
				$this->view->populateForm = $params;

				$this->view->messageSuccess = count($listTemp).' Resultats';
				$this->view->messageError = "";

			} catch (Exception $e) {
				$this->log($e->getMessage(),'err');
				$this->view->messageSuccess = "";
				$this->view->messageError = $e->getMessage().' <br><br>'.$select;
			}
		} else {

			$params = array (
			 		'search' => '',
			 		'prixMin' => '',
			 		'prixMax' => '',
			 		'active' => '2',
			 		'image' => '2',
			 		'activePromo' => '2',
			 		'idbrend' => 'All',
			 		'etatstock' => '3',
			 		'optionId' => 'All',
			 		'optionValue' => '',
			 		'idcategorySearch' => 'All'
			 		);
			 		$this->view->populateForm = $params ;
		}
	}

	public function listAction()
	{
		$this->view->titlePage = "Rechercher des produits";
		$adminNamespace = $this->getSession();
			
		//Gestion des tris
		$table = 'NOM';
		$tri = 'ASC';
		$this->view->searchCategory = 0;
		$this->view->listproducts = array();
		if ($this->_request->isPost() || isset($adminNamespace->searchCategory)) {
			if ($this->_request->getParam('categorySearch') != null) {
				$adminNamespace->searchCategory = $this->_request->getParam('categorySearch');
				
				$adminNamespace->searchCategoryActive = "1";
				if ($this->_request->getParam('isActive') != null) {
					$adminNamespace->searchCategoryActive = "0";
				}
			}
			$isActive = $adminNamespace->searchCategoryActive;
			$id = $adminNamespace->searchCategory;
			$this->view->searchCategory = $id;
			$this->view->searchCategoryActive = $adminNamespace->searchCategoryActive;

			//Appel model pour listing

			$category = new Category();
			$select = "
				SELECT c0.ID ID0, c1.ID ID1, c2.ID ID2, c3.ID ID3, c4.ID ID4, c5.ID ID5, 
						c6.ID ID6, c7.ID ID7, c8.ID ID8, c9.ID ID9, c10.ID ID10
				FROM category AS c0
				LEFT JOIN category AS c1 ON c1.IDPARENT = c0.ID
				LEFT JOIN category AS c2 ON c2.IDPARENT = c1.ID
				LEFT JOIN category AS c3 ON c3.IDPARENT = c2.ID 
				LEFT JOIN category AS c4 ON c4.IDPARENT = c3.ID 
				LEFT JOIN category AS c5 ON c5.IDPARENT = c4.ID 
				LEFT JOIN category AS c6 ON c6.IDPARENT = c5.ID 
				LEFT JOIN category AS c7 ON c7.IDPARENT = c6.ID 
				LEFT JOIN category AS c8 ON c8.IDPARENT = c7.ID 
				LEFT JOIN category AS c9 ON c9.IDPARENT = c8.ID 
				LEFT JOIN category AS c10 ON c10.IDPARENT = c9.ID 
				WHERE c0.ID = ".$id;

			$listTemp = $category->getAdapter()->fetchAll($select);
			$listTemp2 = array();
			$listCat = "";

			foreach ($listTemp as $row) {
				for ($level=0 ; $level<11; $level++) {
					if ((!isset($listTemp2['ID'.$level]) || $listTemp2['ID'.$level] != $row['ID'.$level]) && $row['ID'.$level] != null) {
						$listTemp2['ID'.$level] = $row['ID'.$level];
						if ($listCat!="") {
							$listCat .= ' ,'.$row['ID'.$level];
						} else {
							$listCat = $row['ID'.$level];
						}
					}
				}
			}

			$select = "SELECT ID, NOM, DESCRIPTIONSHORT, PRIX, isACTIVE, isPROMO, IDCATEGORY
			FROM product 
			WHERE IDCATEGORY IN (".$listCat.")
			AND isACTIVE = ".$isActive."
			ORDER BY NOM ASC"; 
 
			$product = new Product();
			$listprods = $product->getAdapter()->fetchAll($select);

			$this->view->messageSuccess = sizeof($listprods)." resultats";
			$picture = new Picture();
			$sql = $picture->fetchAll('POSITION = 1');
			$listpics = array();
			foreach ($sql as $row) {
				$listpics[$row['IDPRODUCT']] = $row['URL'];
			}
			$this->view->listproductpicture = $listpics;
			$this->view->listproducts = $listprods;
		}
	}

	public function editlistAction () {
		if ($this->_request->isPost()) {
			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));

			//get the form params
			$params = $this->_request->getPost();


			$data = array (
			 		'NOM' => $filter->filter($params['nom']),
			 		'DESCRIPTIONSHORT' => $filter->filter($params['descshort']),
			 		'PRIX' => $filter->filter($params['prix'])
			);

			if ($validator->isValid($data['NOM']) &&
			$validator->isValid($data['DESCRIPTIONSHORT']) &&
			$validator->isValid($data['PRIX'])
			) {
					
				try {
					$product = new Product();
					$product->update($data, 'ID = '.$params['productid']);

					$this->view->messageSuccess = "Le produit a �t� mis a jour";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
					$this->_forward('/list');
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('/list');

	}

	public function addAction()
	{
			
		$this->view->titlePage = "Ajouter un produit";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

			
		$supplierBrend = new SupplierBrend();
		$this->view->listbrend = $supplierBrend->fetchAll($supplierBrend->select()->order('BREND ASC'));

			
		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			//get the form params
			$params = $this->_request->getPost();

			$date = new Zend_Date();

			$navtemp = $filter->filter($params['nom']);
			$navnom =  $this->generateNavigationString($navtemp);
			$keywords =  $this->generateKeyWords($navtemp);

			$data = array (
			 		'NOM' => $navtemp,
			 		'NAVNOM' => $navnom,
			 		'KEYWORDS' => $keywords,
					'NAVTITRE' => $navtemp,
					'NAVDESC' => $params['descshort'],
			 		'DESCRIPTIONSHORT' => $params['descshort'],
			 		'DESCRIPTIONLONG' => $params['desclong'],
			 		'PRIX' => $filter->filter($params['prix']),
			 		'isACTIVE' => $filter->filter($params['active']),
					'DATEPROMO' => $date->toString('YYYY-MM-dd'),
			 		'isPROMO' => '1',
			 		'IDBREND' => $filter->filter($params['idbrend']),
			 		'IDCATEGORY' => $filter->filter($params['idcategory'])
			);

			if ($validator->isValid($data['NOM']) &&
			$validator->isValid($data['NAVNOM']) &&
			$validator->isValid($data['DESCRIPTIONSHORT']) &&
			$validator->isValid($data['DESCRIPTIONLONG']) &&
			$validator->isValid($data['PRIX'])
			) {
				if ($data['IDBREND'] != 0) {
					try {
						$product = new Product();
						$product->insert($data);
							
						$this->view->messageSuccess = "Le produit a �t� ajout�";
							
						$lastId = $product->getAdapter()->lastInsertId();
						$this->_redirect('/backoffice/product/edit/showProduct/'.$lastId);
							
					} catch (Zend_Exception $e) {
						$this->log($e->getMessage(), 'err');
						$this->view->populateForm = $data;
					}
				} else {
					$this->view->messageError = "S�l�ctionner une marque";

					$this->view->populateForm = $data;
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
				$this->view->populateForm = $data;
			}

		} else {
			$temp = array (
		 			'NOM' => '',
			 		'DESCRIPTIONSHORT' => '',
			 		'DESCRIPTIONLONG' => '',
			 		'PRIX' => '',
			 		'IDBREND' => '',
			 		'IDCATEGORY' => '',
			 		'isACTIVE' => '1',
			 		'isPROMO' => '1'
			 		);
			 		$this->view->populateForm = $temp;
		}
	}

    private function computeUrlNavigationParent($row) {
        return $row['NAVNOM_URLPARENTS']."/".$row['NAVNOM'];
    }
    
	public function editAction()
	{
		try {
			$this->view->titlePage = "Modifier un Produit";
			$isProcuctEnable = true;
	
			$supplierBrend = new SupplierBrend();
			$this->view->listbrend = $supplierBrend->fetchAll($supplierBrend->select()->order('BREND ASC'));
	
			$option = new Option();
			$this->view->listoption = $option->select()->order('NOM ASC')->query()->fetchAll();
	
			$optionList = new OptionList();
			$this->view->optionsbylist = $optionList->getAll();
					
			$category2 = new Category2();
			$this->view->listallcategories2 = $category2->getAllCategoriesByID(0);
				
			$adminNamespace = $this->getSession();
	
			$id = 0;
	
			if ((int)$this->_request->getParam('showProduct') != null) {
				$id = (int)$this->_request->getParam('showProduct');
			}  else if ((int)$this->_request->getParam('id') != null) {
				$id = (int)$this->_request->getParam('id');
			}
			if ($id > 0) {
				$picture = new Picture();
				$listPicture = $picture->fetchAll('IDPRODUCT = '.$id);
				$this->view->listPicture = $listPicture;
				
				$productChildQte = new ProductChildQte();
				$this->view->productChildQte = $productChildQte->getAllByProduct($id);
	
				$product = new Product();	
				$row = $product->fetchRow('ID = '.$id);
				if ($row) {
	
					$currentProduct = $row->toArray();  
					$currentProduct['ONSELECT_OPTION'] = $optionList->getByIdProduct($id);
					$currentProduct['PRIXLOWEST'] = $product->calculateLowestPrice($id);
                                        
                    $category = new Category();
                    $currentCategory = $category->fetchRow('ID = '.$currentProduct['IDCATEGORY']);
					$currentProduct['NAVNOM_URLPARENTS'] = $this->computeUrlNavigationParent($currentCategory);
                    
					$this->view->populateForm = $currentProduct;
	
					
					if ($currentProduct['isACTIVE'] == 1) {
						$isProcuctEnable = false;
					}
                    $isProductOutOfStock = false;
					if ($currentProduct['STOCK'] == 4) {
						$isProductOutOfStock = true;
					}
	
					$productCategory = new ProductCategory2();
					$this->view->productCategories = $productCategory->getAllCategoriesByProductID($id);
	
					if ($listPicture->count()<1) {
						$this->view->messageError = "Aucune image n'est configur�e";
						$adminNamespace->imgPosDefault = 1;
						$isProcuctEnable = false;
					} else {
						$isOK = false;
						foreach ($listPicture as $pic) {
							if ($pic->POSITION == 1) {
								$isOK = true;
								break;
							}
						}
						if (!$isOK) {
							$this->view->messageError = "L'image principale n'est pas d�finie (1)";
							$adminNamespace->imgPosDefault = 1;
							//$isProcuctEnable = false;
						} else {
							$adminNamespace->imgPosDefault = $listPicture->count() + 1;
	
						}
	
					}
	
					$this->view->isProcuctEnable = $isProcuctEnable; 
					$this->view->isProductOutOfStock = $isProductOutOfStock; 
                    
					$productOption = new ProductOption();
					$this->view->listproductoption = $productOption->getOptionsByIdProduct($id);
	
					 
					$productChild = new ProductChild();
					$listProduct = $productChild->getChildsByIdProduct($id);
	
					$listChild = array(); 
					for ($i = 0; $i<sizeof($listProduct); $i++) {
						$listChild[$listProduct[$i]['ID']]['ID'] = $listProduct[$i]['ID'];
						$listChild[$listProduct[$i]['ID']]['REFERENCE'] = $listProduct[$i]['REFERENCE'];
						$listChild[$listProduct[$i]['ID']]['POIDS'] = $listProduct[$i]['POIDS'];
						$listChild[$listProduct[$i]['ID']]['DESIGNATION'] = $listProduct[$i]['DESIGNATION'];
						$listChild[$listProduct[$i]['ID']]['PRIX'] = $listProduct[$i]['PRIX'];
						$listChild[$listProduct[$i]['ID']]['ETATSTOCK'] = $listProduct[$i]['ETATSTOCK'];
						$listChild[$listProduct[$i]['ID']]['isDEVIS'] = $listProduct[$i]['isDEVIS'];
						$listChild[$listProduct[$i]['ID']]['isFRANCODENIED'] = $listProduct[$i]['isFRANCODENIED'];
						$listChild[$listProduct[$i]['ID']]['QUANTITYMIN'] = $listProduct[$i]['QUANTITYMIN'];
						$listChild[$listProduct[$i]['ID']]['isPROMO'] = $listProduct[$i]['isPROMO'];
						$listChild[$listProduct[$i]['ID']]['POINTFIDELITE'] = $listProduct[$i]['POINTFIDELITE'];
	  
						$listChild[$listProduct[$i]['ID']]['IMAGEPROMO'] = $listProduct[$i]['IMAGEPROMO'];
	
						$listChild[$listProduct[$i]['ID']]['OPTION_VALUE_'.$listProduct[$i]['IDOPTION']] = $listProduct[$i]['VALUE'];
						$listChild[$listProduct[$i]['ID']]['OPTION_ID_'.$listProduct[$i]['IDOPTION']] = $listProduct[$i]['IDCHILD'];
					 
					}
					$this->view->listChild = $listChild; 
	
					$childFTFDS = new ProductChildFTFDS();
					$listFTFDS = $childFTFDS->getFTFDSByIdProduct($id);
					$this->view->listFTFDS = $listFTFDS;
	
	
					$productAccessoire = new ProductAccessoire();
					$listAccessoires = $productAccessoire->getAccessoiresByProductID($id, 'pa.REFACCESSOIRE ASC');
					$this->view->listAccessoires = $listAccessoires;
	
					$productAnnexe = new ProductAnnexe();
					$listAnnexes = $productAnnexe->getAnnexesByProductID($id, 'NOM ASC');;
					$this->view->listAnnexes = $listAnnexes;
	
					$this->view->currentProduct = $id;
	
	
					$paramsXML = array(
					'PRODUCT' => $currentProduct,  
				 	'PICS'=> $listPicture, 
					);
					$this->view->siteMapShow = $this->generateSiteMapShow($paramsXML, $currentProduct['NAVNOM_URLPARENTS']);
				} else {
					$this->_forward('/list');
				}
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err'); 
		}
	}

	private function generateSiteMapShow($params, $navParentUrl) {
		$navnoms = array();
		$product = $params['PRODUCT'];

		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		array_push($navnoms, str_replace("page/","",$filter->filter($product['NAVNOM'])));
		array_push($navnoms, str_replace("page/","",$filter->filter($product['CUSTOM_NAVNOM1'])));
		array_push($navnoms, str_replace("page/","",$filter->filter($product['CUSTOM_NAVNOM2'])));
		array_push($navnoms, str_replace("page/","",$filter->filter($product['CUSTOM_NAVNOM3'])));
			
		$br = "<br/>";
		$tab = "&nbsp;&nbsp;&nbsp;";
		$tab2 = $tab.$tab.$tab;
		$url = "";

		foreach ($navnoms as $navnom) {
			if (!empty($navnom)) {
				$url .= $br.htmlentities("<url>");
				$url .= $br.$tab;
				$url .= htmlentities("<loc>".$this->baseUrl_SiteCommerceUrl."/".Utils_Tool::getFormattedUrlProduct($navParentUrl, $navnom, $product['ID'])."</loc>");
				$url .= $br;
				foreach($params['PICS'] as $row) {
					$url .= $tab.htmlentities("<image:image>");
					$url .= $br.$tab2;
					$url .= htmlentities("<image:loc>".$this->baseUrl_SiteCommerceUrl."/".$row['URL']."</image:loc>");

					if (!empty($row['STRING1'])) {
						$url .= $br.$tab2;
						$url .= htmlentities("<image:title>".$row['STRING1']."</image:title>");
					}

					if (!empty($row['STRING2'])) {
						$url .= $br.$tab2;
						$url .= htmlentities("<image:caption>".$row['STRING2']."</image:caption>");
					}
					$url .= $br.$tab;
					$url .= htmlentities("</image:image>");
					$url .= $br;
				}
				$url .= htmlentities("</url>");
			}
		}

		return $url;
	}

	public function editproductAction()
	{

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			//valideurs pour les chaines
			$validator2 = new Zend_Validate();
			$validator2 -> addValidator(new Zend_Validate_NotEmpty());

			//get the form params
			$params = $this->_request->getPost();

			$isDevisProduct = 1;
			if (isset($params['devisonproduct']) && $params['devisonproduct']) {
				$isDevisProduct = 0;
			}

			$data = array (
			 		'NOM' => $filter->filter($params['nom']), 
			 		'DESCRIPTIONSHORT' => $params['descshort'],
			 		'DESCRIPTIONLONG' => $params['desclong'],
			 		'DESCRIPTIONTECH' => $params['desctech'],
			 		'DESCRIPTIONNORME' => $params['descnorme'],
			 		'PRIX' => $filter->filter($params['prix']),
			 		'isACTIVE' => $filter->filter($params['active']),
			 		'IDCATEGORY' => (int)$filter->filter($params['idcategory']),
			 		'DATEPROMO' => $params['sd'],
			 		'ID' => $filter->filter($params['id']),
			 		'IDBREND' => $filter->filter($params['idbrend']),
					'isSHOWBREND' => $filter->filter($params['showbrend']),
					'isDEVIS' => $isDevisProduct,
					'STOCK' => (int)$params['stock'] ,
					'BOOSTED_HOME' => (int)$params['boostedhome'],
					'BOOSTED_BESTSELLER' => (int)$params['boostedbestseller']
			);


			if ($validator->isValid($data['NOM']) &&
			$validator->isValid($data['DESCRIPTIONSHORT']) &&
			$validator->isValid($data['DESCRIPTIONLONG']) &&
			$validator2->isValid($data['PRIX'])
			) {
				try {

					$product = new Product();
					$product->update($data, 'ID = '.$data['ID']);

					$this->view->messageSuccess = "Le produit a �t� modifi�";

					$this->log("Le produit a �t� modifi� : ".$data['ID'],'info');
                    $this->indexproductById($data['ID']);
                
				} catch (Zend_Exception $e) {

					$this->log($e->getMessage(),'err');
					$this->view->messageError = "V�rifier les param�tres";

					$this->view->populateForm = $data;
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError =  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('/edit');
	}

	public function editproductcategoriesAction()
	{

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));

			//valideurs pour les chaines
			$validator2 = new Zend_Validate();
			$validator2 -> addValidator(new Zend_Validate_NotEmpty());

			//get the form params
			$params = $this->_request->getPost();

			try {
				$id = (int) $params['id'];
				$data = array (
				 		'ID' => $id,
				 		'IDCATEGORY_DUP1' => (int)$filter->filter($params['idcategory_duplicat1']),
				 		'IDCATEGORY_DUP2' => (int)$filter->filter($params['idcategory_duplicat2']),
				 		'IDCATEGORY_DUP3' => (int)$filter->filter($params['idcategory_duplicat3']) 
				);

				$product = new Product();
				$product->update($data, 'ID = '.$id);

				if (!empty($params['idcategory_promosolde'])) {
					$productCategory = new ProductCategory2();
					$productCategory->delete('IDPRODUCT = '.$id);
					foreach ($params['idcategory_promosolde'] as $row) {
						if ((int)$row > 0) {
							$dataTemp = array ('IDPRODUCT' => $id, 'IDCATEGORY' => (int)$row);
							$productCategory->insert($dataTemp);
						}
					}
				}
					
				$this->view->messageSuccess = "Les cat�gories ont �t� modifi�es";

				$this->log("Les cat�gories ont �t� modifi�es : ".$id,'info');
			} catch (Zend_Exception $e) {

				$this->log($e->getMessage(),'err');
				$this->view->messageError = "Les cat�gories n'ont pas �t� modifi�es";

				$this->view->populateForm = $data;
			}
		}
		$this->_forward('/edit');
	}

	public function editproductkeywordscleanAction()
	{

		$this->view->messageSuccess = "";
		$this->view->messageError = "";


		//get the form params
		$id = (int)$this->_request->getParam('id');

		$data = array ( 'KEYWORDS' => ''  );
			
		try {
			if ($id > 0) {
				$product = new Product();
				$product->update($data, 'ID = '.$id);

				$this->view->messageSuccess = "Les mots cl�s ont �t� modifi�s";

				$this->log("Les mots cl�s ont �t� modifi�s : ".$id,'info');
			}
		} catch (Zend_Exception $e) {

			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Les mots cl�s n'ont pas �t� modifi�s";
		}

		$this->_forward('/edit');
	}

	public function editproductkeywordsAction()
	{
		try {
			$this->view->messageSuccess = "";
			$this->view->messageError = "";

			if ($this->_request->isPost()) {

				//valideurs pour les chaines
				$validator = new Zend_Validate();
				$validator -> addValidator(new Zend_Validate_NotEmpty())
				-> addValidator(new Zend_Validate_StringLength(3));

				//get the form params
				$params = $this->_request->getPost();

				$keywords =  $this->generateKeyWords($params['nom']);

				$data = array ( 'KEYWORDS' => $keywords  );

				if ($validator->isValid($data['KEYWORDS']))  {
					$id = (int)$params['id'];
					if ($id > 0) {
						$product = new Product();
						$product->update($data, 'ID = '.$id);

						$this->view->messageSuccess = "Les mots cl�s ont �t� modifi�s";

						$this->log("Les mots cl�s ont �t� modifi�s : ".$id,'info');
					}
				} else {
					foreach ($validator->getErrors() as $errorCode) {
						$this->view->messageError .=  $this->getErrorValidator($errorCode);
					}
				}
			}
		} catch (Zend_Exception $e) {

			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Les mots cl�s n'ont pas �t� modifi�s";
		}
		$this->_forward('/edit');
	}

	public function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$product = new Product();
					$productOtion = new ProductOption();
					$productChild = new ProductChild();
					$productChildOption = new ProductChildOption();
					$productAccessoire = new ProductAccessoire();
					$picture = new Picture();

					$childs = $productChild->fetchAll('IDPRODUCT = '.$id);

					foreach ($childs as $row) {
						$productChildOption->delete('IDPRODUCTCHILD = '.$row->ID);
						$productAccessoire->delete('REFACCESSOIRE = "'.$row->REFERENCE.'"');
					}
					$productChild->delete('IDPRODUCT = '.$id);
					$picture->delete('IDPRODUCT = '.$id);
					$productOtion->delete('IDPRODUCT = '.$id);
					$product->delete('ID = '.$id);

					$this->view->messageSuccess = "Le produit a �t� supprim�";

					$this->log("Le produit a �t� supprim�",'info');
				} catch (Zend_Exception $e) {

					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');

	}

	public function editchildAction()
	{
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));

			//valideurs pour les chaines
			$validator2 = new Zend_Validate();
			$validator2 -> addValidator(new Zend_Validate_NotEmpty());

			//get the form params
			$params = $this->_request->getPost();

			$date = new Zend_Date();

			$isDevisPrice = 1;
			if (isset($params['devisprice']) && $params['devisprice']) {
				$isDevisPrice = 0;
			}

			$quantiteMin = (int)$params['quantiteMin'];
			if ($quantiteMin == 0) {
				$quantiteMin = 1;
			}

			$dataChild = array (
			 		'REFERENCE' => $filter->filter($params['reference']),
			 		'DESIGNATION' => $filter->filter($params['designation']),
			 		'PRIX' => $filter->filter($params['prixNormal']),
			 		'ETATSTOCK' => $filter->filter($params['etatstock']),
			 		'QUANTITYMIN' => $filter->filter($quantiteMin),
					'isDEVIS' => $isDevisPrice,
			 		'IMAGEPROMO' => $filter->filter($params['imagePromo']),
			 		'DATEMODIF' => $date->toString('YYYY-MM-dd HH:mm:ss'),
			 		'IDPRODUCT' => (int)$this->_request->getParam('id')
			);
			$listOption = unserialize($params['listOption']);

			if ($validator->isValid($dataChild['REFERENCE']) &&
			$validator2->isValid($dataChild['PRIX'])&&
			$validator->isValid($dataChild['DESIGNATION'])
			) {

				try {
					$productChild = new ProductChild();
					$productChild->update($dataChild, 'ID = '.$params['idchild']);

					$productChildOption = new ProductChildOption();
					foreach ($listOption as $option) {
						$dataOption = array (
						 		'IDPRODUCTCHILD' => $params['idchild'],
						 		'IDOPTION' => $option,
						 		'VALUE' => $params['option'.$option]
						);
						$isOk = $productChildOption->update($dataOption,'IDPRODUCTCHILD = '.$params['idchild'].' AND IDOPTION = '.$option);
						if (!$isOk) {

							$productChildOption->delete('IDPRODUCTCHILD = '.$params['idchild'].' AND IDOPTION = '.$option);
							$productChildOption->insert($dataOption);
						}
					}


					$this->view->messageSuccess = "Le produit a ete modifie";

					$this->log("Le produit child a ete modifie : ".$params['idchild'],'info');
                    
				} catch (Zend_Exception $e) {

					$this->log($e->getMessage(),'err');
					$this->view->messageError = "La r�f�rence existe d�ja";

					$this->view->populateChild = $dataChild;
					$this->_forward('/edit');
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
				$this->view->populateChild = $dataChild;
			}

		}
		$this->_forward('/edit');
	}
	public function editchildsAction()
	{
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//get the form params
			$params = $this->_request->getPost();

			for ($index = 0; $index < $params['nbRows']; $index++) {
				if (isset($params[$index."reference"]) && !empty($params[$index."reference"]) &&
				isset($params[$index."designation"]) && !empty($params[$index."designation"])
				) {
					$optionsValues = array();
					$listOption = unserialize($params['listOption']);
					foreach ($listOption as $option) {
						$optionsValues['option'.$option] = $params[$index."option".$option];
					}
					$isDevisPrice = 1;
					if (isset($params[$index.'devisprice']) && $params[$index.'devisprice']) {
						$isDevisPrice = 0;
					}

					$isFrancoDenied = 1;
					if (isset($params[$index.'francodenied']) && $params[$index.'francodenied']) {
						$isFrancoDenied = 0;
					}

					$this->editSingleChild($index,
					$params,
					$isDevisPrice,
					$isFrancoDenied,
					$listOption,
					$optionsValues,
					(int)$this->_request->getParam('id'));
				}
			}


		}
		$this->_forward('/edit');
	}
	private function editSingleChild($line, $paramsRequest,  $isDevisPrice,$isFrancoDenied,  $listOption, $optionsValues, $idProduct) {

		$idChild = $paramsRequest[$line.'idchild'];
		$quantity = $paramsRequest[$line.'quantiteMin'];
		$reference = $paramsRequest[$line.'reference'];
		$poids = $paramsRequest[$line.'poids'];
		$designation = $paramsRequest[$line.'designation'];
		$prixNormal =$paramsRequest[$line.'prixNormal'] ;
		$etatstock = $paramsRequest[$line.'etatstock'];
		$imagePromo = $paramsRequest[$line.'imagePromo'];

        $pointFidelite = 0;
        if (isset($paramsRequest[$line.'pointFidelite'])) {
            $pointFidelite = (int)$paramsRequest[$line.'pointFidelite'];
        }

		//filtres pour changer les chaines
		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		//valideurs pour les chaines
		$validator = new Zend_Validate();
		$validator -> addValidator(new Zend_Validate_NotEmpty())
		-> addValidator(new Zend_Validate_StringLength(3));

		//valideurs pour les chaines
		$validator2 = new Zend_Validate();
		$validator2 -> addValidator(new Zend_Validate_NotEmpty());

		$quantiteMin = (int)$quantity;
		if ($quantiteMin == 0) {
			$quantiteMin = 1;
		}
		$date = new Zend_Date();
		$adminNamespace = $this->getSession();
		$dataChildReturn = array (
		$line.'REFERENCE' => $filter->filter($reference),
		$line.'POIDS' => $filter->filter($poids),
		$line.'DESIGNATION' => $designation,
		$line.'PRIX' => $filter->filter($prixNormal),
		$line.'ETATSTOCK' => $filter->filter($etatstock),
		$line.'QUANTITYMIN' => $filter->filter($quantiteMin),
		$line.'isDEVIS' => $isDevisPrice,
		$line.'isFRANCODENIED' => $isFrancoDenied,
		$line.'IMAGEPROMO' => $filter->filter($imagePromo),
		$line.'DATEMODIF' => $date->toString('YYYY-MM-dd HH:mm:ss'),
		$line.'IDPRODUCT' => $idProduct,
		$line.'POINTFIDELITE' => $pointFidelite
		);

		$dataChild = array (
		 		'REFERENCE' => $filter->filter($reference),
		 		'POIDS' => $filter->filter($poids),
		 		'DESIGNATION' => $designation,
		 		'PRIX' => $filter->filter($prixNormal),
		 		'ETATSTOCK' => $filter->filter($etatstock),
		 		'QUANTITYMIN' => $filter->filter($quantiteMin),
		 		'isDEVIS' => $isDevisPrice,
		 		'isFRANCODENIED' => $isFrancoDenied,
		 		'IMAGEPROMO' => $filter->filter($imagePromo),
		 		'DATEMODIF' => $date->toString('YYYY-MM-dd HH:mm:ss'),
		 		'IDPRODUCT' => $idProduct ,
		 		'POINTFIDELITE' => $pointFidelite 
		);

		if ($validator->isValid($dataChild['REFERENCE']) &&
		$validator2->isValid($dataChild['PRIX'])&&
		$validator->isValid($dataChild['DESIGNATION'])
		) {
			try {

				$productChild = new ProductChild();
				$productChild->update($dataChild, 'ID = '.$idChild);

				$productChildOption = new ProductChildOption();
				foreach ($listOption as $option) {
					$dataOption = array (
					 		'IDPRODUCTCHILD' => $idChild,
					 		'IDOPTION' => $option,
					 		'VALUE' => $optionsValues['option'.$option]
					);
					$isOk = $productChildOption->update($dataOption,'IDPRODUCTCHILD = '.$idChild.' AND IDOPTION = '.$option);
					if (!$isOk) {
						$productChildOption->delete('IDPRODUCTCHILD = '.$idChild.' AND IDOPTION = '.$option);
						$productChildOption->insert($dataOption);
					}
				}
					
				$this->view->messageSuccess = "Le produit a �t� modifi�";
                $this->indexproductById($idProduct);
                
				return true;
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = "La r�f�rence existe d�ja";
				$this->view->populateChild = $dataChildReturn;
			}
		} else {
			foreach ($validator->getErrors() as $errorCode) {
				$this->view->messageError .=  $this->getErrorValidator($errorCode);
			}
			$this->view->populateChild = $dataChildReturn;
		}
		return false;
	}
	public function delchildAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('idchild')) {
			$idchild = (int)$this->_request->getParam('idchild');
			$id = (int)$this->_request->getParam('id');
			if ($idchild > 0 && $id > 0) {
				try {
					$childFTFDS = new ProductChildFTFDS();
					$child = $childFTFDS->fetchRow('ID_CHILD = '.$idchild);
					
					if (!$child) {
							$productChild = new ProductChild();
	
							$productChild->delete('ID = '.$idchild);
	
							$productChildOption = new ProductChildOption();
	
							$productChildOption->delete('IDPRODUCTCHILD = '.$idchild);
	
							$this->view->messageSuccess = "Le produit a �t� supprim�";
					} else {
						$this->view->messageError = "Un document est associ�e a ce produit, vous devez la supprimer avant de supprimer le produit";
					}


				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/edit');

	}
	public function addchildAction()
	{
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));

			//valideurs pour les chaines
			$validator2 = new Zend_Validate();
			$validator2 -> addValidator(new Zend_Validate_NotEmpty());

			//get the form params
			$params = $this->_request->getPost();

			$date = new Zend_Date();

			$adminNamespace = $this->getSession();

			$isDevisPrice = 1;
			if (isset($params['devisprice']) && $params['devisprice']) {
				$isDevisPrice = 0;
			}
			$quantiteMin = (int)$params['quantiteMin'];
			if ($quantiteMin == 0) {
				$quantiteMin = 1;
			}

			$dataChild = array (
			 		'REFERENCE' => $filter->filter($params['reference']),
			 		'DESIGNATION' => $filter->filter($params['designation']),
			 		'PRIX' => $filter->filter($params['prixNormal']),
			 		'ETATSTOCK' => $filter->filter($params['etatstock']),
			 		'QUANTITYMIN' => $filter->filter($quantiteMin),
			 		'isDEVIS' => $isDevisPrice,
			 		'IMAGEPROMO' => $filter->filter($params['imagePromo']),
			 		'DATEMODIF' => $date->toString('YYYY-MM-dd HH:mm:ss'),
			 		'IDPRODUCT' => (int)$this->_request->getParam('id')
			);
			$listOption = unserialize($params['listOption']);

			if ($validator->isValid($dataChild['REFERENCE']) &&
			$validator2->isValid($dataChild['PRIX'])&&
			$validator->isValid($dataChild['DESIGNATION'])
			) {

				try {
					$productChild = new ProductChild();
					$productChild->insert($dataChild);

					$lastid = $productChild->getAdapter()->lastInsertId();

					$productChildOption = new ProductChildOption();
					foreach ($listOption as $option) {
						$dataOption = array (
						 		'IDPRODUCTCHILD' => $lastid,
						 		'IDOPTION' => $option,
						 		'VALUE' => $params['option'.$option]
						);
						$productChildOption->insert($dataOption);
					}


					$this->view->messageSuccess = "Le produit a �t� ajout�";

				} catch (Zend_Exception $e) {

					$this->view->messageError = "La r�f�rence existe d�j�";

					$this->log($e->getMessage(),'err');
					$this->view->populateChild = $dataChild;
					$this->_forward('/edit');
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
				$this->view->populateChild = $dataChild;
			}

		}
		$this->_forward('/edit');
	}
	public function addchildsAction()
	{
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//get the form params
			$params = $this->_request->getPost();
			for ($index = 0; $index < 2; $index++) {
				try {
					if (isset($params[$index."reference"]) && !empty($params[$index."reference"]) &&
					isset($params[$index."designation"]) && !empty($params[$index."designation"])
					) {
						$optionsValues = array();
						$listOption = unserialize($params['listOption']);
						foreach ($listOption as $option) {
							$optionsValues['option'.$option] = $params[$index."option".$option];
						}
						$isDevisPrice = 1;
						if (isset($params[$index.'devisprice']) && $params[$index.'devisprice']) {
							$isDevisPrice = 0;
						}
						$this->addSingleChild($index, $isDevisPrice,
						$params[$index.'quantiteMin'],
						$params[$index.'reference'],
						$params[$index.'poids'],
						$params[$index.'designation'],
						$params[$index.'prixNormal'],
						$params[$index.'etatstock'],
						$params[$index.'imagePromo'],
						$listOption,
						$optionsValues,
						(int)$this->_request->getParam('id'));
					}
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "V�rifier les param�tres";
				}
			}


		}
		$this->_forward('/edit');
	}

	private function addSingleChild($line, $isDevisPrice, $quantity, $reference, $poids, $designation, $prixNormal, $etatstock, $imagePromo, $listOption, $optionsValues, $idProduct) {

		//filtres pour changer les chaines
		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		//valideurs pour les chaines
		$validator = new Zend_Validate();
		$validator -> addValidator(new Zend_Validate_NotEmpty())
		-> addValidator(new Zend_Validate_StringLength(3));

		//valideurs pour les chaines
		$validator2 = new Zend_Validate();
		$validator2 -> addValidator(new Zend_Validate_NotEmpty());

		$quantiteMin = (int)$quantity;
		if ($quantiteMin == 0) {
			$quantiteMin = 1;
		}
		$date = new Zend_Date();
		$adminNamespace = $this->getSession();
		$dataChildReturn = array (
		$line.'REFERENCE' => $filter->filter($reference),
		$line.'POIDS' => $filter->filter($poids),
		$line.'DESIGNATION' => $filter->filter($designation),
		$line.'PRIX' => $filter->filter($prixNormal),
		$line.'ETATSTOCK' => $filter->filter($etatstock),
		$line.'QUANTITYMIN' => $filter->filter($quantiteMin),
		$line.'isDEVIS' => $isDevisPrice,
		$line.'IMAGEPROMO' => $filter->filter($imagePromo),
		$line.'DATEMODIF' => $date->toString('YYYY-MM-dd HH:mm:ss'),
		$line.'IDPRODUCT' => $idProduct
		);
		
		$poids = $filter->filter($poids);
		if (empty($poids)) { $poids = 0; }
		
		$quantiteMin = $filter->filter($quantiteMin);
		if (empty($quantiteMin)) {	$quantiteMin = 1;	}
		
		$imagePromo = $filter->filter($imagePromo);
		if (empty($imagePromo)) { $imagePromo = 0; }

		$dataChild = array (
		 		'REFERENCE' => $filter->filter($reference),
		 		'POIDS' => $poids,
		 		'DESIGNATION' => $filter->filter($designation),
		 		'PRIX' => $filter->filter($prixNormal),
		 		'ETATSTOCK' => $filter->filter($etatstock),
		 		'QUANTITYMIN' => $quantiteMin,
		 		'isDEVIS' => $isDevisPrice,
		 		'IMAGEPROMO' => $imagePromo,
		 		'DATEMODIF' => $date->toString('YYYY-MM-dd HH:mm:ss'),
		 		'IDPRODUCT' => $idProduct
		);

		if ($validator->isValid($dataChild['REFERENCE']) &&
		$validator2->isValid($dataChild['PRIX'])&&
		$validator->isValid($dataChild['DESIGNATION'])
		) {
			try {
				$productChild = new ProductChild();
				if (!$productChild->isChildReferenceExist($dataChild['REFERENCE'])){
					$productChild->insert($dataChild);
	
					$lastid = $productChild->getAdapter()->lastInsertId();
	
					$productChildOption = new ProductChildOption();
					foreach ($listOption as $option) {
						$dataOption = array (
						 		'IDPRODUCTCHILD' => $lastid,
						 		'IDOPTION' => $option,
						 		'VALUE' => $optionsValues['option'.$option]
						);
						$productChildOption->insert($dataOption);
					}
					$this->view->messageSuccess = "Le produit a �t� ajout�";
					return true;
				} else {
					$this->view->populateChild = $dataChildReturn;
					$this->view->messageError = "La r�f�rence existe d�ja";
					return false;
				}
			} catch (Zend_Exception $e) {
				$this->log($e->getMessage(),'err');
				$this->view->messageError = "La r�f�rence existe d�ja";
				$this->view->populateChild = $dataChildReturn;
			}
		} else {
			foreach ($validator->getErrors() as $errorCode) {
				$this->view->messageError =  $this->getErrorValidator($errorCode);
			}
			foreach ($validator2->getErrors() as $errorCode) {
				$this->view->messageError =  $this->getErrorValidator($errorCode);
			}
			$this->view->populateChild = $dataChildReturn;
		}
		return false;
	}

	public function addproductoptionAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {
			$params = $this->_request->getPost();

			$data = array (
			 		'IDPRODUCT' => (int)$this->_request->getParam('id'),
			 		'IDOPTION' => $params['idoption']
			);

			try {
				$product = new Product();
				$sql = 'SELECT p.NOM
					FROM product p 
					LEFT JOIN product_option AS po ON po.IDPRODUCT = p.ID
					WHERE p.ID = '.$data['IDPRODUCT'].'
					AND po.IDOPTION = '.$data['IDOPTION'];

				$isExistOption = $product->getAdapter()->fetchRow($sql);

				if (!$isExistOption) {

					$productOption = new ProductOption();

					$productOption->insert($data);

					$this->view->messageSuccess = "L'option a �t� ajout�e";
				} else {
					$this->view->messageError = "L'option existe d�ja";
				}
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
		$this->_forward('/edit');
	}
	public function delproductoptionAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		$adminNamespace = $this->getSession();
		if($this->_request->getParam('idopt')) {
			$idopt = (int)$this->_request->getParam('idopt');
			$id = (int)$this->_request->getParam('id');
			if ($idopt > 0 && $id > 0) {
				try {

					$productOption = new ProductOption();
					$productChildOption = new ProductChildOption();
					$productOption->delete('IDOPTION = '.$idopt.' AND IDPRODUCT = '.$id);

					$sql = "
		    			 DELETE pco 
		    			 FROM productchild_option AS pco 
		    			 LEFT JOIN productchild AS pc ON pc.ID = pco.IDPRODUCTCHILD
						WHERE pco.IDOPTION = ".$idopt." 
						AND pc.IDPRODUCT = ".$id;

					$productChildOption->getAdapter()->query($sql);


					$this->view->messageSuccess = "L'option a �t� supprim�e";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/edit');
	}

	public function optionprofilAction() {
		$this->view->titlePage = "Listing des Profils d'options";
		if ($this->_request->isPost() && (int)$this->_request->getParam('id') ==0) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			$options = $params['profilOptions'];
			$optionValues = "";
			foreach ($options as $idOption) {
				$optionValues .= $idOption.";";
			}
			$data = array (
			 		'NOM' => $filter->filter($params['nom']),
					'OPTS' => $optionValues
			);

			if ($validator->isValid($data['NOM'])) {

				try {
					$optionProfil = new OptionProfil();
					$optionProfil->insert($data);

					$this->view->messageSuccess = "Le profil a �t� ajout�";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');

					$this->view->messageError = "Le profil existe d�ja";

				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}

		}

		$option = new Option();
		$listOptions = $option->select()->order('NOM ASC')->query()->fetchAll();
		$this->view->listoption = $listOptions;

		$optionProfil = new OptionProfil();
		$this->view->listprofils = $optionProfil->getProfils();
	}
	public function optionprofildelAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$optionProfil = new OptionProfil();

					$optionProfil->delete('ID = '.$id);

					$this->view->messageSuccess = "Le profil a �t� supprim�";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
					$this->_forward('/optionprofil');
				}
			}
		}
		$this->_forward('/optionprofil');
	}

	public function optionAction() {
		$this->view->titlePage = "Gestion des caract�ristiques du produit";
		$this->view->currentMenu = "Option";

		if ($this->_request->isPost() && (int)$this->_request->getParam('id') ==0) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			//get the form params
			$params = $this->_request->getPost();

			$data = array (
			 		'NOM' => $filter->filter($params['nom'])
			);

			if ($validator->isValid($data['NOM'])) {

				try {
					$option = new Option();
					$option->insert($data);

					$this->view->messageSuccess = "La caract�ristique a �t� ajout�e";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "La caract�ristique existe d�ja";

				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}

		}
		$option = new Option();
		$this->view->listoption = $option->select()->order('NOM ASC')->query()->fetchAll();

	}
	public function optioneditAction()
	{
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			//get the form params
			$params = $this->_request->getPost();

			$data = array (
			 		'NOM' => $filter->filter($params['nom']),
			 		'ID' => $filter->filter($params['id'])
			);

			if ($validator->isValid($data['NOM'])
			) {

				try {
					$option = new Option();
					$option->update($data, 'ID = '.$data['ID']);

					$this->view->messageSuccess = "La caract�ristique a �t� modifi�e";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "La caract�ristique existe d�j�";

					$this->_forward('option');
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('option');
	}
	public function optiondelAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$product = new Product();
					$sql = 'SELECT p.NOM
					FROM product p 
					LEFT JOIN productchild AS pc ON pc.IDPRODUCT = p.ID
					LEFT JOIN productchild_option AS pco ON pco.IDPRODUCTCHILD = pc.ID
					WHERE pco.IDOPTION = '.$id ;
					$isExistProduct = $product->getAdapter()->fetchRow($sql);

					if (!$isExistProduct) {

						$option = new Option();

						$option->delete('ID = '.$id);

						$this->view->messageSuccess = "La caract�ristique a �t� supprim�e";
					} else {
						$this->view->messageError = "La caract�ristique est utilis�e par : <b>".$isExistProduct['NOM']."</b>";
					}
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
					$this->_forward('/option');
				}
			}
		}
		$this->_forward('/option');
	}

	public function editftfdsAction() {

		$params = $this->_request->getPost();

		if(!empty($params['idchild_ftfds']) && !empty($_FILES['file_ftfds']) && !empty($_FILES['file_ftfds']['name'])) {
			$nomOrigine = $_FILES['file_ftfds']['name'];
			$elementsChemin = pathinfo($nomOrigine);
			$extensionFichier = strtolower($elementsChemin['extension']);
			$extensionsAutorisees = array("pdf");
			if (!(in_array($extensionFichier, $extensionsAutorisees))) {
				$this->view->messageError = "Le fichier n'a pas l'extension attendue";
			} else {
				// Copie dans le repertoire du script avec un nom
				// incluant l'heure a la seconde pres
				$repertoireDestination = 'items/ftfds/';
				$this->checkDirectoryExist($repertoireDestination);
				
				$nomDestination = $params['idchild_ftfds'].".".$extensionFichier;

				if (move_uploaded_file($_FILES["file_ftfds"]["tmp_name"],$repertoireDestination.$nomDestination)) {
					try {
						$childFTFDS = new ProductChildFTFDS();
						$data = array (
					 		'URL' => $repertoireDestination.$nomDestination,
					 		'ID_CHILD' => $params['idchild_ftfds']
						);
						$childFTFDS->insert($data);
						$this->view->messageSuccess = "Le document a �t� ajout�e ";
					} catch (Exception $e) {
						$this->view->messageError = $e->getMessage();
					}
				} else {
					$this->view->messageError = "Le fichier n'a pas �t� upload�";
				}
			}
		} else {
			$this->view->messageError = "Veuillez s�lectionner un document au format pdf";
		}

		$this->_forward('/edit');
	}

	public function delftfdsAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('idchild')) {
			$idchild = (int)$this->_request->getParam('idchild');
			if ($idchild > 0) {
				try {
					$childFTFDS = new ProductChildFTFDS();
					$child = $childFTFDS->fetchRow('ID_CHILD = '.$idchild);
					$childFTFDS->delete('ID_CHILD = '.$idchild);
					unlink($child['URL']);
					$this->view->messageSuccess = "Le document a �t� supprim�e";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/edit');
	}


	public function editdocAction() {

		$params = $this->_request->getPost();

		if(!empty($params['docname_product']) && !empty($_FILES['file_doc']) && !empty($_FILES['file_doc']['name'])) {
			$nomOrigine = $_FILES['file_doc']['name'];
			$elementsChemin = pathinfo($nomOrigine);
			$extensionFichier = strtolower($elementsChemin['extension']);
			$extensionsAutorisees = array("pdf");
			if (!(in_array($extensionFichier, $extensionsAutorisees))) {
				$this->view->messageError = "Le fichier n'a pas l'extension attendue";
			} else {
				// Copie dans le repertoire du script avec un nom
				// incluant l'heure a la seconde pres
				$repertoireDestination = 'items/doc/';
				$this->checkDirectoryExist($repertoireDestination);
				
				$nomDestination = $params['docid_product'].".".$extensionFichier;

				if (move_uploaded_file($_FILES["file_doc"]["tmp_name"],$repertoireDestination.$nomDestination)) {
					try {
						$product = new Product();
						$data = array (
					 		'DOCURL' => $repertoireDestination.$nomDestination,
					 		'DOCNAME' => $params['docname_product']
						);
						$product->update($data, "ID = ".$params['docid_product']);
						$this->view->messageSuccess = "Le document a �t� ajout� ";
					} catch (Exception $e) {
						$this->view->messageError = $e->getMessage();
					}
				} else {
					$this->view->messageError = "Le fichier n'a pas �t� upload�";
				}
			}
		} else {
			$this->view->messageError = "Veuillez s�lectionner un document au format pdf";
		}

		$this->_forward('/edit');
	}

	public function deldocAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$product = new Product();
					$row = $product->fetchRow('ID = '.$id)->toArray();
					$docurl = $row['DOCURL'];
					unlink($docurl);
					$data = array (
					 		'DOCURL' => "",
					 		'DOCNAME' => ""
					 		);
					 		$product->update($data, "ID = ".$id);
					 		$this->view->messageSuccess = "Le document a �t� supprim�";
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/edit');
	}



	public function livraisonAction() {
		$this->view->titlePage = "Configuration de la livraison";

		$livraison_type = new LivraisonType();
		$this->view->livraisontypes = $livraison_type->getTypes();

		$livraison_poids = new LivraisonPoids();
		$this->view->livraisonpoids = $livraison_poids->getLists();
	}

	public function addlivraisontypeAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			$data = array (
			 		'NOM' => $filter->filter($params['livraison_nom']),
			 		'CMDFRANCO' => $filter->filter($params['livraison_franco'])
			);

			if ($validator->isValid($data['NOM'])
			) {

				try {
					$livraison_type = new LivraisonType();
					$livraison_type->insert($data);

					$this->view->messageSuccess = "Le type de livraison a �t� ajout�";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "Le type de livraison existe d�ja";

					$this->_forward('/livraison');
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('/livraison');
	}

	public function dellivraisontypeAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$livraison_type = new LivraisonType();
					$livraison_poids = new LivraisonPoids();
					$livraison_type->delete("ID = ".$id);
					$livraison_poids->delete("TYPE = ".$id);
					$this->view->messageSuccess = "Le type de livraison a �t� supprim�";
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/livraison');
	}

	public function editlivraisontypeAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			$data = array (
			 		'NOM' => $filter->filter($params['livraison_nom']),
			 		'CMDFRANCO' => $filter->filter($params['livraison_franco'])
			);

			if ($validator->isValid($data['NOM'])
			) {

				try {
					$livraison_type = new LivraisonType();
					$livraison_type->update($data, "ID = ".$params['livraison_id']);

					$this->view->messageSuccess = "Le type de livraison a �t� modifi�";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "Le type de livraison n'a pas �t� modifi�";

					$this->_forward('/livraison');
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('/livraison');
	}

	public function addlivraisonpoidsAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			if (isset($params['livraison_poids_type'])) {
				$data = array (
				 		'TO' => floatval($params['livraison_poids_to']),
				 		'FROM' => floatval($params['livraison_poids_from']),
				 		'TYPE' => floatval($params['livraison_poids_type']),
				 		'PRICE' => floatval($params['livraison_poids_price'])
				);
				if ($data['TO'] > 0 && $data['TYPE'] > 0) {

					try {
						$livraison_poids = new LivraisonPoids();
						$livraison_poids->insert($data);

						$this->view->messageSuccess = "Le poids de la livraison a �t� ajout�";

					} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
						$this->view->messageError = "Le poids de la livraison n'a pas �t� ajout�";
						$this->_forward('/livraison');
					}
				} else {
					$this->view->messageError = "Le poids de la livraison n'a pas �t� ajout�";
					$this->_forward('/livraison');
				}
			}

		}
		$this->_forward('/livraison');
	}

	public function editlivraisonpoidsAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			$data = array (
			 		'TO' => floatval($params['livraison_poids_to']),
			 		'FROM' => floatval($params['livraison_poids_from']),
			 		'TYPE' => floatval($params['livraison_poids_type']),
			 		'PRICE' => floatval($params['livraison_poids_price'])
			);

			if ($data['TO'] > 0 && $data['TYPE'] > 0 ) {

				try {
					$livraison_poids = new LivraisonPoids();
					$livraison_poids->update($data, "ID = ".$params['livraison_poids_id']);

					$this->view->messageSuccess = "Le poids de la livraison a �t� modifi�";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "Le poids de la livraison n'a pas �t� modifi�";

					$this->_forward('/livraison');
				}
			} else {
				$this->view->messageError = "Le poids de la livraison n'a pas �t� modifi�";

				$this->_forward('/livraison');
			}
		}
		$this->_forward('/livraison');
	}

	public function dellivraisonpoidsAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$livraison_poids = new LivraisonPoids();
					$livraison_poids->delete("ID = ".$id);
					$this->view->messageSuccess = "Le poids de la livraison a �t� supprim�";
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/livraison');
	}

	public function livraisoncatAction(){
		$this->view->titlePage = "Configuration g�n�ralis�e du poids";

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {
			//get the form params
			try {
					
				$params = $this->_request->getPost();

				if (isset($params["livraison_poids_id"]) && !empty($params["livraison_poids_id"])) {
					$listCatId = array();
					$listCatId = $params['livraison_poids_id'];
					$productChild = new ProductChild();
					foreach ($listCatId as $catId) {
						if (isset($params["livraison_poids_".$catId]) && !empty($params["livraison_poids_".$catId]) && $params["livraison_poids_".$catId] > 0) {
							$sql = "UPDATE productchild, product SET productchild.poids=".floatval($params["livraison_poids_".$catId])." WHERE productchild.idproduct=product.id AND product.idcategory=".$catId;
							$productChild->getAdapter()->query($sql);
						}
					}
					$this->view->messageSuccess = "Les produits ont �t� mis a jour";
				}
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
	}

	public function keywordsengineAction() {
		$this->view->titlePage = "Configuration des mots cl�s";

		$keyword = new KeyWord();
		$listkeywords = $keyword->getLists();

		$this->setPaginator($listkeywords, $this->_getParam('page',1), 50);

	}


	public function keywordsengineresetAction() {
		try {
			$product = new Product();
			$sql = "SELECT KEYWORDS FROM product" ;
			$keyProducts = $product->getAdapter()->fetchAll($sql);
			$filter = new Zend_Filter();
			$filter->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_StringToLower());

			$keys = array();
			foreach ($keyProducts as $row) {
				$keyArray = preg_split("/[\s]*[,][\s]*/", $row['KEYWORDS']);
				for ($index = 0; $index < sizeof($keyArray); $index++) {
					$keyTemp = $filter->filter($keyArray[$index]);
					if (!in_array($keyTemp, $keys) && !empty($keyTemp)) {
						array_push($keys, $keyTemp);
					}
				}
			}

			$keyword = new KeyWord();
			for ($index = 0; $index < sizeof($keys); $index++) {
				try {
					$data = array( "KEYWORD" => $keys[$index] );
					$keyword->insert($data);
				} catch (Zend_Exception $e) { }
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
		}
		$this->_forward('/keywordsengine');
	}


	public function addkeywordsengineAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringToLower())
			->addFilter(new Zend_Filter_CustomAlnum(array('allowwhitespace' => true)));


			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			//get the form params
			$params = $this->_request->getPost();

			if (isset($params['keyword']) && $validator->isValid($params['keyword'])) {
				$data = array (
				 		'KEYWORD' => $filter->filter($params['keyword'])
				);
				$keyword = new KeyWord();
				if (!$keyword->isExist($data['KEYWORD'])) {
					try {
						$keyword->insert($data);

						$this->view->messageSuccess = "Le mot cl� a �t� ajout�";

					} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
						$this->view->messageError = "Le mot cl� n'a pas �t� ajout�";
					}
				} else {
					$this->view->messageError = "Le mot cl� existe";
				}
			} else {
				$this->view->messageError = "Le mot cl� n'a pas �t� ajout�";
			}

		}
		$this->_forward('/keywordsengine');
	}
	public function editkeywordsengineAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringToLower())
			->addFilter(new Zend_Filter_CustomAlnum(array('allowwhitespace' => true)));


			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			//get the form params
			$params = $this->_request->getPost();

			$data = array (
			 		'KEYWORD' => $filter->filter($params['keyword'])
			);

			try {
				$keyword = new KeyWord();
				$result = $keyword->update($data, "ID = ".$params['keyword_id']);

				if ($result) {
					$this->view->messageSuccess = "Le mot cl� a �t� modifi�";
				} else {
					$this->view->messageError = "Le mot cl� existe";
				}
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = "Le mot cl� n'a pas �t� modifi�";
			}
		}
		$this->_forward('/keywordsengine');
	}

	public function delkeywordsengineAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$keyword = new KeyWord();
					$keyword->delete("ID = ".$id);
					$this->view->messageSuccess = "Le mot cl� a �t� supprim�";
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/keywordsengine');
	}


	public function ajaxautocompletekeywordAction() {
		$result = array();
		try {
			if ($this->getRequest()->isPost()) {
				$filter = new Zend_Filter();
				$filter->addFilter(new Zend_Filter_StringTrim())
				->addFilter(new Zend_Filter_StripTags())
				->addFilter(new Zend_Filter_StringToLower())
				->addFilter(new Zend_Filter_CustomAlnum(array('allowwhitespace' => true)));

				$keyword = new KeyWord();
				$key = $filter->filter(utf8_decode($this->getRequest()->getPost('search')));

				$result = $keyword->findByKeyword($key);
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
		}
		$this->view->messageSuccess = serialize($result);

		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render('ajaxvalue');
	}

	public function ajaxautocompletekeywordinsertAction() {
		$currentKeywords = "";
		$idproduct = 0;

		if ($this->getRequest()->isPost()) {
			try {
				$filter = new Zend_Filter();
				$filter->addFilter(new Zend_Filter_StringTrim())
				->addFilter(new Zend_Filter_StripTags())
				->addFilter(new Zend_Filter_StringToLower())
				->addFilter(new Zend_Filter_CustomAlnum(array('allowwhitespace' => true)));

				$key = $filter->filter(utf8_decode($this->getRequest()->getPost('search')));
				$idproduct = (int)$this->getRequest()->getPost('idproduct');

				$validator = new Zend_Validate();
				$validator -> addValidator(new Zend_Validate_NotEmpty());

				if ($validator->isValid($key) && $idproduct > 0) {
					$product = new Product();
					$row = $product->fetchRow('ID = '.$idproduct)->toArray();

					if (empty($row['KEYWORDS'])) {
						$currentKeywords = $key;
					} else {
						$currentKeywords = $row['KEYWORDS'].",".$key;
					}
					$data = array( "KEYWORDS" => $currentKeywords);
					$product->update($data, 'ID = '.$idproduct);
				}
			} catch (Zend_Exception $e) { 
					$this->log($e->getMessage(),'err');}
		}

		if (!empty($currentKeywords)) {
			$this->view->messageSuccess = $currentKeywords;
		} else {
			if ($idproduct > 0) {
				$product = new Product();
				$row = $product->fetchRow('ID = '.$idproduct)->toArray();
				$this->view->messageSuccess = $row['KEYWORDS'];
			}
		}

		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render('ajaxvalue');
	}

	public function autocompletekeywordaddAction() {
		$currentKeywords = "";
		$idproduct = 0;

		if ($this->getRequest()->isPost()) {
			try {
				$filter = new Zend_Filter();
				$filter->addFilter(new Zend_Filter_StringTrim())
				->addFilter(new Zend_Filter_StripTags())
				->addFilter(new Zend_Filter_StringToLower())
				->addFilter(new Zend_Filter_CustomAlnum(array('allowwhitespace' => true)));


				$key = $filter->filter($this->getRequest()->getPost('keywords_list'));
				$idproduct = (int)$this->getRequest()->getPost('id');

				$validator = new Zend_Validate();
				$validator -> addValidator(new Zend_Validate_NotEmpty());

				if ($validator->isValid($key) && $idproduct > 0) {
					$keyword = new KeyWord();
					if (!$keyword->isExist($key)) {
						$data = array( "KEYWORD" => $key);
						$keyword->insert($data);
					}
					$product = new Product();
					$row = $product->fetchRow('ID = '.$idproduct)->toArray();

					if (empty($row['KEYWORDS'])) {
						$currentKeywords = $key;
					} else {
						$currentKeywords = $row['KEYWORDS'].",".$key;
					}
					$data = array( "KEYWORDS" => $currentKeywords);
					$product->update($data, 'ID = '.$idproduct);
					$this->view->messageSuccess = "Le mot cl� a �t� ajout�";
				}
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = "Le mot cl� n'a pas �t� ajout�";
			}
		}
		$this->_forward('/edit');
	}

	public function ajaxproductaccessoirelistbycatAction() {
		try {
			if ($this->getRequest()->isPost()) {
				$idcat = (int) $this->getRequest()->getPost('idcategory');
				$idcurrentproduct = (int) $this->getRequest()->getPost('idproduct');

				$product = new Product();
				$listproducts = $product->getProductsByIdCategory($idcat, 'NOM ASC');
				$this->view->listProducts = $listproducts;
				$this->view->currentProduct = $idcurrentproduct;

				$productAccessoire = new ProductAccessoire();
				$this->view->listAccessoires = $productAccessoire->getAccessoiresByProductID($idcurrentproduct, 'pa.REFACCESSOIRE ASC');;
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
		}
		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render('ajaxaccessoireproductlist');
	}


	public function addproductaccessoireAction() {
		$productAccessoire = new ProductAccessoire();
		$productChild = new ProductChild();
		try {
			if ($this->getRequest()->isPost()) {
				$params = $this->_request->getPost();
				$idproduct = (int) $params['id'];
				$refaccessoire = $params['reference_acc'];
				if ($idproduct > 0 && !empty($refaccessoire) ) {
					if ($productChild->isChildReferenceExist($params['reference_acc'])) {
						$isOk = $productAccessoire->insertAccessoire($idproduct, $refaccessoire);
						if ($isOk) {
							$this->view->messageSuccess = "L'accessoire a �t� ajout�";
						} else {
							$this->view->messageError = "L'accessoire n'a pas �t� ajout�, il est d�j� pr�sent pour ce produit";
						}
					} else {
						$this->view->messageError = "La r�f�rence n'existe pas";
					}

				}
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
		}
		$this->_forward('/edit');
	}

	public function ajaxdelproductaccessoireAction() {
		$productAccessoire = new ProductAccessoire();
		try {
			if ($this->getRequest()->isPost()) {
				$params = $this->_request->getPost();
				$idAccessoire = (int) $params['idAccessoire'];
				$idproduct = (int) $params['idproduct'];
				if ($idAccessoire > 0 ) {
					$productAccessoire->deleteAccessoire($idAccessoire);
				}
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
		}
		$listAccessoires = $productAccessoire->getAccessoiresByProductID($idproduct, 'pa.REFACCESSOIRE ASC');
		$this->view->listAccessoires = $listAccessoires ;
		$this->view->currentProduct = $idproduct;
			
		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render('ajaxaccessoirelist');
	}

	public function ajaxproductannexelistbycatAction() {
		try {
			if ($this->getRequest()->isPost()) {
				$idcat = (int) $this->getRequest()->getPost('idcategory');
				$idcurrentproduct = (int) $this->getRequest()->getPost('idproduct');

				$product = new Product();
				$listproducts = $product->getProductsByIdCategory($idcat, 'NOM ASC');
				$this->view->listProducts = $listproducts;
				$this->view->currentProduct = $idcurrentproduct;

				$productAnnexe = new ProductAnnexe();
				$this->view->listAnnexes = $productAnnexe->getAnnexesByProductID($idcurrentproduct, 'NOM ASC');;
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
		}
		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render('ajaxannexeproductlist');
	}

	public function ajaxaddproductannexeAction() {
		$productAnnexe = new ProductAnnexe();
		try {
			if ($this->getRequest()->isPost()) {
				$params = $this->_request->getPost();
				$idproduct = (int) $params['idproduct'];
				$idannexe = (int) $params['idannexe'];
				if ($idproduct > 0 && $idannexe > 0 && ($idproduct != $idannexe)) {
					$productAnnexe->insertAnnexe($idproduct, $idannexe);
				}
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
		}
		$listproducts = $productAnnexe->getAnnexesByProductID($idproduct, 'NOM ASC');
		$this->view->listProducts = $listproducts;
		$this->view->listAnnexes = $listproducts;
		$this->view->currentProduct = $idproduct;
			
		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render('ajaxannexeproductlist');
	}

	public function ajaxdelproductannexeAction() {
		$productAnnexe = new ProductAnnexe();
		try {
			if ($this->getRequest()->isPost()) {
				$params = $this->_request->getPost();
				$idproduct = (int) $params['idproduct'];
				$idannexe = (int) $params['idannexe'];
				if ($idproduct > 0 && $idannexe > 0 && ($idproduct != $idannexe)) {
					$productAnnexe->deleteAnnexe($idproduct, $idannexe);
				}
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
		}
		$listproducts = $productAnnexe->getAnnexesByProductID($idproduct, 'NOM ASC');
		$this->view->listProducts = $listproducts;
		$this->view->listAnnexes = $listproducts;
		$this->view->currentProduct = $idproduct;
			
		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render('ajaxannexeproductlist');
	}

	public function editnavheaderAction () {
		try {
			if ($this->getRequest()->isPost()) {
				$params = $this->_request->getPost();

				$filter = new Zend_Filter();
				$filter	->addFilter(new Zend_Filter_StripTags())
				->addFilter(new Zend_Filter_StringTrim());

				$filter2 = new Zend_Filter();
				$filter2->addFilter(new Zend_Filter_StringTrim())
				->addFilter(new Zend_Filter_StripTags())
				->addFilter(new Zend_Filter_StringToLower())
				->addFilter(new Zend_Filter_CustomAlnum(array('allowwhitespace' => true)));


				$key = $params['keywords_list'];
				$keyToAdd = "";
				
				$keyArray = explode(",", $key);
				
				$keyword = new KeyWord();
				for ($index = 0; $index < sizeof($keyArray); $index++) {
					$keyTemp = $filter2->filter($keyArray[$index]);		
					$keyTemp = $filter->filter($keyTemp);	
					if (!empty($keyTemp)) {
						if (empty($keyToAdd)) {
							$keyToAdd = $keyTemp;
						} else {
							$keyToAdd .=", ".$keyTemp;
						}
						if (!$keyword->isExist($keyTemp)) {
							$data = array( "KEYWORD" => $keyTemp);
							$keyword->insert($data);
						}
					}
				}
				$data = array (
					'NAVTITRE' => $filter->filter($params['navtitre']),
					'NAVDESC' => $filter->filter($params['navdesc']),
					'KEYWORDS' => $keyToAdd
				);
				$product = new Product();
				$product->update($data, 'ID = '.(int) $params['id']);
                $this->indexproductById((int) $params['id']);
			}				
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
		}
		$this->_forward('/edit');
	}

	public function editcustomnavnomAction() {
		try {
			if ($this->getRequest()->isPost()) {
				$params = $this->_request->getPost();

				$filter = new Zend_Filter();
				$filter	->addFilter(new Zend_Filter_StripTags())
				->addFilter(new Zend_Filter_StringTrim());
				//valideurs pour les chaines
				$validator = new Zend_Validate();
				$validator -> addValidator(new Zend_Validate_NotEmpty())
				-> addValidator(new Zend_Validate_StringLength(3));
					
				$data = array (
					'NAVNOM' => $this->verifyNavigationString($filter->filter($params['navnom']), $params['nom'], ''), 
					'CUSTOM_NAVNOM1' => $filter->filter($params['navnom_custom1']),
					'CUSTOM_NAVNOM2' => $filter->filter($params['navnom_custom2']),
					'CUSTOM_NAVNOM3' => $filter->filter($params['navnom_custom3'])
				);
					
				if ($validator->isValid($data['NAVNOM'])) {
					for ($index = 1; $index < 4; $index++) {
						if (!empty($data['CUSTOM_NAVNOM'.$index])) {
							$data['CUSTOM_NAVNOM'.$index] = $this->verifyNavigationString($data['CUSTOM_NAVNOM'.$index], $data['CUSTOM_NAVNOM'.$index], '');
						}
					}
					$product = new Product();
					$product->update($data, 'ID = '.(int) $params['id']);

                    $this->indexproductById((int) $params['id']);
					$this->view->messageSuccess = "Le nom de navigation a �t� modifi�";
				} else {
					$this->view->messageError = "Le nom de navigation n'a pas �t� modifi�";
				}
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
			$this->view->messageError = "Le nom de navigation n'a pas �t� modifi�";
		}
		$this->_forward('/edit');
	}
	
	public function addchildqteprixAction() {
		try {
			if ($this->_request->isPost()) { 
				//filtres pour changer les chaines
				$filter = new Zend_Filter();
				$filter	->addFilter(new Zend_Filter_StripTags())
				->addFilter(new Zend_Filter_StringTrim());
	 
				$params = $this->_request->getPost();
				$min = (int) $params['min'];
				$max = (int) $params['max'];
				$prix = $filter->filter($params['prix']);
				$item_id = (int) $params['item_id'];
				
				if (isset($params['maxend'])) {
					$maxend = $params['maxend'];
					if ($maxend) { $max = 999999999; }
				} 
				
				if ($min > 0 && $max > 0 && $prix > 0 && $item_id > 0) {
					if ($min < $max) {
						$dataQte = array (
						 		'MIN' => $min,
						 		'MAX' => $max,
						 		'PRIX' => $prix,
						 		'IDPRODUCTCHILD' => $item_id 
						); 
						$productChildQte = new ProductChildQte();
						$productChildQte->insert($dataQte);
						$this->view->messageSuccess = "Le prix d�gressif a �t� ajout�";
					} else { $this->view->messageError = "V�rifier les quantit�s"; }
				} else { $this->view->messageError = "V�rifier les param�tres"; }
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
			$this->view->messageError = "Le prix d�gressif n'a pas �t� ajout�";
		}
		$this->_forward('/edit');
	} 
	
	public function delchildqteprixAction() {
		try {
			if($this->_request->getParam('item_id')) {
				$id = (int)$this->_request->getParam('item_id');
				if ($id > 0) {
					$productChildQte = new ProductChildQte();
					$isDeleted = $productChildQte->delete('ID = '.$id); 
					if ($isDeleted) {
						$this->view->messageSuccess = "Le prix d�gressif a �t� supprim�";
					} else {
						$this->view->messageError = "Le prix d�gressif n'a pas �t� supprim�";
					} 
				}
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
			$this->view->messageError = "Le prix d�gressif n'a pas �t� supprim�";
		}
		$this->_forward('/edit');
	} 
	public function editchildqteprixactivationAction() {
		try {
			if ($this->_request->isPost()) {
				$params = $this->_request->getPost(); 
				
				$isActive = 0;
				if (isset($params['activateItemPrix'])) { $isActive = 1; }  
				
				$id = (int)$params['id'];  
				if ($id > 0) {
					$data = array (
						'isQTEPRIXACTIVE' => $isActive 
					);
					$product = new Product();
					$isUpdated = $product->update($data, 'ID = '.$id); 
					if ($isUpdated > 0) {
						$this->view->messageSuccess = "Le prix d�gressif a �t� modifi�";
					} else {
						$this->view->messageError = "Le prix d�gressif n'a pas �t� modifi�";
					} 
                    $this->indexproductById($id);
				} 
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
			$this->view->messageError = "Le prix d�gressif n'a pas �t� modifi�";
		}
		$this->_forward('/edit');
	} 
	
	public function addcaracteristiquelistAction() {
		try {
			if ($this->_request->isPost()) {
				$params = $this->_request->getPost(); 
				 
				$idoption = (int)$params['idoption'];   
				$id = (int)$params['id'];  
				if ($idoption > 0 && $id > 0) {
					$data = array (
						'ONSELECT_IDOPTION' => $idoption 
					);
					$product = new Product();
					$isUpdated = $product->update($data, 'ID = '.$id); 
					if ($isUpdated > 0) {
						$this->view->messageSuccess = "La liste des caract�ristiques a �t� modifi�";
					} else {
						$this->view->messageError = "La liste des caract�ristiques n'a pas �t� modifi�";
					} 
				} 
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
			$this->view->messageError = "La liste des caract�ristiques n'a pas �t� modifi�";
		}
		$this->_forward('/edit');
	} 
	
	public function delcaracteristiquelistAction() {
		try {
			if($this->_request->getParam('id')) {
				$id = (int)$this->_request->getParam('id');
				if ($id > 0) {
					$data = array (
						'ONSELECT_IDOPTION' => 0 
					);
					$product = new Product();
					$isUpdated = $product->update($data, 'ID = '.$id); 
					if ($isUpdated > 0) {
						$this->view->messageSuccess = "La liste des caract�ristiques a �t� modifi�";
					} else {
						$this->view->messageError = "La liste des caract�ristiques n'a pas �t� modifi�";
					} 
				}
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
			$this->view->messageError = "La liste des caract�ristiques n'a pas �t� modifi�";
		}
		$this->_forward('/edit');
	} 
	
}
?>modules/backoffice/controllers/ErrorController.php000060400000001737150710367660016523 0ustar00<?php

class Backoffice_ErrorController extends Zend_Controller_Action
{

	public function errorAction()
	{
		$errors = $this->_getParam('error_handler');
		$this->initLog();
		$this->log("Une erreure est survenue : ".$errors,'crit');
		$this->_redirect('/backoffice');
	}


	private function initLog() {
		$registry = Zend_Registry::getInstance();
		$loggerAdmin = $registry->get('loggerAdmin');

		$controller = Zend_Controller_Front::getInstance()->getRequest();
		$loggerAdmin->setEventItem('controller', $controller->getControllerName().'::'.$controller->getActionName());
			
		$registry->set('loggerAdmin', $loggerAdmin);
	}

	private function log($message , $level) {
		$loggerAdmin = Zend_Registry::get('loggerAdmin');
		if ($level == 'info') {
			$loggerAdmin->info($message);
		} elseif ($level == 'err') {
			$loggerAdmin->err($message);
		} elseif ($level == 'warn') {
			$loggerAdmin->warn($message);
		} elseif ($level == 'crit') {
			$loggerAdmin->crit($message);
		}
	}
}
?>modules/backoffice/controllers/MaintenanceController.php000060400000073461150710367660017657 0ustar00<?php

class Backoffice_MaintenanceController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "Scripts";
		$this->isConnectedWithRole('isMaintenance'); 
	}
	public function indexAction()
	{

	} 
	/*
     * Image de produits - Redimmensionnement de l'image
     */
	public function resizepictureAction()
	{
       try {  
       
            echo "------------ PRODUITS ------------<br />";
           for($i = 0; $i < 500; $i++) {
                $dirname = 'items/product/'.$i;
                $this->resizepictureofdirectory($dirname);
           }
             
            echo "------------ CATEGORIES ------------<br />";
           for($i = 0; $i < 500; $i++) {
                $dirname = 'items/category/'.$i;
                $this->resizepictureofdirectory($dirname);
           }
             
            echo "------------ CATEGORIES SUBSIDIAIRES ------------<br />";
           for($i = 0; $i < 500; $i++) {
                $dirname = 'items/category2/'.$i;
                $this->resizepictureofdirectory($dirname);
           }
             
            echo "------------ FOURNISSEURS ------------<br />";
            $dirname = 'items/supplier';
            $this->resizepictureofdirectory($dirname);
       
        }
        catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Erreur de script : ".$e->getMessage();
		}
		$this->render('message');
	} 
    
    private function resizepictureofdirectory($dirname)
	{
            $maxwidth = $this->FeaturePictureResizeWidth;
            $maxheight = $this->FeaturePictureResizeHeight;
           if (is_dir($dirname)) {
		        $dir_handle = opendir($dirname);
		        if (!isset($dir_handle)) {
		            return false;
                }
		        while($file = readdir($dir_handle)) {
			        if ($file != "." && $file != "..") {
                        $fileoriginal = $dirname."/".$file;
				        if (is_dir($fileoriginal)) {
                            $this->resizepictureofdirectory($fileoriginal);
                        } else {
                            
                            $info = getimagesize($fileoriginal) ;
                            list($width_old, $height_old) = $info;
                            
                            if ($width_old > $maxwidth || $height_old > $maxheight) {
                                echo "Redimensionnement de l'image : ".$fileoriginal." (Width : Old - ".$width_old." Max - ".$maxwidth.", Height : Old - ".$height_old." Max - ".$maxheight.")<br />";
                               Utils_Tool::smart_resize_image($fileoriginal , null, $maxwidth , $maxheight , true , $fileoriginal , true , false ,50 );
                            }
    
                        }
			        }
		        }
           }
    }
	/*
     * Image de produits - Renommage des nom de type date
     */
    
    function cleanproductimagenamedeterminename($row){        
        $newName = "";    
        if (empty($newName) && !empty($row['STRING1']) && !file_exists($repertoireDestination."/".$this->generateNavigationString($row['STRING1']).".".$extension)) {
            $newName = $this->generateNavigationString($row['STRING1']);
        } else if (empty($newName) && !empty($row['STRING2']) && !file_exists($repertoireDestination."/".$this->generateNavigationString($row['STRING2']).".".$extension)) {
            $newName = $this->generateNavigationString($row['STRING2']);
        } else if (empty($newName) && !empty($row['CUSTOM_NAVNOM1']) && !file_exists($repertoireDestination."/".$row['CUSTOM_NAVNOM1'].".".$extension)) {
            $newName = $row['CUSTOM_NAVNOM1'];
        } else if (empty($newName) && !empty($row['NAVNOM']) && !file_exists($repertoireDestination."/".$row['NAVNOM'].".".$extension)) {
            $newName = $row['NAVNOM'];
        }
    }
    
	function cleanproductimagenameAction()
	{
        $pattern = "/items\/product\/[0-9]*\/[0-9]{2}-[0-9]{2}-[0-9]{4}_[0-9]{2}-[0-9]{2}-[0-9]{2}.\w*/";
        
        $i = 0;
        try {
            $picture = new Picture();
            $sqlDoublon = "SELECT COUNT(*) AS nbr_doublon, p.URL AS URL FROM picture p GROUP BY p.URL HAVING COUNT(*) > 1";    
            $datas = $picture->getAdapter()->fetchAll($sqlDoublon);
            foreach($datas as $row)
            {
                $urlToUpdate = $row['URL'];
                
                if (preg_match($pattern, $urlToUpdate, $match) && file_exists($_SERVER['DOCUMENT_ROOT']."/".$urlToUpdate)) {
                    
                    $sqlPicDoublon = "SELECT pic.STRING1 AS STRING1, p.NAVNOM AS NAVNOM, pic.STRING2 AS STRING2, p.CUSTOM_NAVNOM1 AS CUSTOM_NAVNOM1, p.ID AS ID,pic.ID AS IDPICTURE, pic.URL AS URL FROM picture pic LEFT JOIN product AS p ON p.ID = pic.IDPRODUCT LEFT JOIN category AS c ON c.ID = p.IDCATEGORY WHERE pic.URL='".$urlToUpdate."' order by p.IDCATEGORY";
                    
                    $datasDoublons = $picture->getAdapter()->fetchAll($sqlPicDoublon);
                    
                    $newName = "";   
                    
                    foreach($datasDoublons as $rowDoublon)
                    {
                        $repertoireDestination = substr($urlToUpdate, 0, strrpos($urlToUpdate, '/'));
                        
                        $elementsChemin = pathinfo($urlToUpdate);
                        $extension = strtolower($elementsChemin['extension']);
                           
                        if (empty($newName) && !empty($rowDoublon['STRING1']) && !file_exists($repertoireDestination."/".$this->generateNavigationString($rowDoublon['STRING1']).".".$extension)) {
                            $newName = $this->generateNavigationString($rowDoublon['STRING1']);
                        } else if (empty($newName) && !empty($rowDoublon['STRING2']) && !file_exists($repertoireDestination."/".$this->generateNavigationString($rowDoublon['STRING2']).".".$extension)) {
                            $newName = $this->generateNavigationString($rowDoublon['STRING2']);
                        } else if (empty($newName) && !empty($rowDoublon['CUSTOM_NAVNOM1']) && !file_exists($repertoireDestination."/".$rowDoublon['CUSTOM_NAVNOM1'].".".$extension)) {
                            $newName = $rowDoublon['CUSTOM_NAVNOM1'];
                        } else if (empty($newName) && !empty($rowDoublon['NAVNOM']) && !file_exists($repertoireDestination."/".$rowDoublon['NAVNOM'].".".$extension)) {
                            $newName = $rowDoublon['NAVNOM'];
                        }
                        
                        if (!empty($newName)) {
                            $repertoireDestination = $repertoireDestination."/".$newName.".".$extension;
                            if (!file_exists($repertoireDestination)) {
                                rename($_SERVER['DOCUMENT_ROOT']."/".$urlToUpdate, $_SERVER['DOCUMENT_ROOT']."/".$repertoireDestination);
                            }
                            
                            $data = array();
                            $data['URL'] = $repertoireDestination;
                            $picture->update($data, 'ID = '.$rowDoublon['IDPICTURE']);                       
                            
                            $i++;
                            echo "Ancien : ".$urlToUpdate." => Nouveau : ".$repertoireDestination." => ID : ".$rowDoublon['IDPICTURE']."<br />";
                            
                        }
                    }
                }
            }
            $sql = "SELECT pic.STRING1 AS STRING1, p.NAVNOM AS NAVNOM, pic.STRING2 AS STRING2, p.CUSTOM_NAVNOM1 AS CUSTOM_NAVNOM1, p.ID AS ID,pic.ID AS IDPICTURE, pic.URL AS URL FROM picture pic LEFT JOIN product AS p ON p.ID = pic.IDPRODUCT LEFT JOIN category AS c ON c.ID = p.IDCATEGORY order by p.IDCATEGORY";
            $datas = $picture->getAdapter()->fetchAll($sql);
            foreach($datas as $row)
            { 
                $urlToUpdate = $row['URL'];
                               
                if (preg_match($pattern, $urlToUpdate, $match) && file_exists($_SERVER['DOCUMENT_ROOT']."/".$urlToUpdate)) {
                                    
                    $repertoireDestination = substr($urlToUpdate, 0, strrpos($urlToUpdate, '/'));
                    
                    $elementsChemin = pathinfo($urlToUpdate);
                    $extension = strtolower($elementsChemin['extension']);
                    
                    $newName = "";    
                    if (empty($newName) && !empty($row['STRING1']) && !file_exists($repertoireDestination."/".$this->generateNavigationString($row['STRING1']).".".$extension)) {
                        $newName = $this->generateNavigationString($row['STRING1']);
                    } else if (empty($newName) && !empty($row['STRING2']) && !file_exists($repertoireDestination."/".$this->generateNavigationString($row['STRING2']).".".$extension)) {
                        $newName = $this->generateNavigationString($row['STRING2']);
                    } else if (empty($newName) && !empty($row['CUSTOM_NAVNOM1']) && !file_exists($repertoireDestination."/".$row['CUSTOM_NAVNOM1'].".".$extension)) {
                        $newName = $row['CUSTOM_NAVNOM1'];
                    } else if (empty($newName) && !empty($row['NAVNOM']) && !file_exists($repertoireDestination."/".$row['NAVNOM'].".".$extension)) {
                        $newName = $row['NAVNOM'];
                    }
                    
                    if (!empty($newName)) {
                        $repertoireDestination = $repertoireDestination."/".$newName.".".$extension;
                        
                        rename($_SERVER['DOCUMENT_ROOT']."/".$urlToUpdate, $_SERVER['DOCUMENT_ROOT']."/".$repertoireDestination);
                        
                        $data = array();
                        $data['URL'] = $repertoireDestination;
                        $picture->update($data, 'ID = '.$row['IDPICTURE']);                       
                        
                        $i++;
                        echo "Ancien : ".$urlToUpdate." => Nouveau : ".$repertoireDestination." => ID : ".$row['IDPICTURE']."<br />";
                        
                    }
                } 
            }
			$this->view->messageSuccess = $i." SUCCESS";
        }
        catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Erreur de script : ".$e->getMessage();
		}
		$this->render('message');
    }
    
	/*
     * Image de cat�gories subsidiaire - Renommage des nom de type date
     */    
	function cleancategorysubsimagenameAction()
	{
        $pattern = "/items\/category2\/[0-9]*\/[0-9]{2}-[0-9]{2}-[0-9]{4}_[0-9]{2}-[0-9]{2}-[0-9]{2}.\w*/";
        
        $i = 0;
        try {
            $category = new Category2();
            $sqlDoublon = "SELECT COUNT(*) AS nbr_doublon, c.URL AS URL FROM category2 c GROUP BY c.URL HAVING COUNT(*) > 1";    
            $datas = $category->getAdapter()->fetchAll($sqlDoublon);
            foreach($datas as $row)
            {
                $urlToUpdate = $row['URL'];
                
                if (preg_match($pattern, $urlToUpdate, $match) && file_exists($_SERVER['DOCUMENT_ROOT']."/".$urlToUpdate)) {
                    
                    $sqlPicDoublon = "SELECT c.URL AS URL, c.ID AS ID, c.NAVNOM AS NAVNOM FROM category2 AS c WHERE c.URL='".$urlToUpdate."'";
                    
                    $datasDoublons = $category->getAdapter()->fetchAll($sqlPicDoublon);
                    
                    $newName = "";   
                    
                    foreach($datasDoublons as $rowDoublon)
                    {
                        $repertoireDestination = substr($urlToUpdate, 0, strrpos($urlToUpdate, '/'));
                        
                        $elementsChemin = pathinfo($urlToUpdate);
                        $extension = strtolower($elementsChemin['extension']);
                        
                        if (empty($newName)) {
                            $newName = $rowDoublon['NAVNOM'];
                        }  
                        
                        if (!empty($newName)) {
                            $repertoireDestination = $repertoireDestination."/".$newName.".".$extension;
                            if (!file_exists($repertoireDestination)) {
                              rename($_SERVER['DOCUMENT_ROOT']."/".$urlToUpdate, $_SERVER['DOCUMENT_ROOT']."/".$repertoireDestination);
                            }
                            
                            $data = array();
                            $data['URL'] = $repertoireDestination;
                            $category->update($data, 'ID = '.$rowDoublon['ID']);                       
                            
                            $i++;
                            echo "Ancien : ".$urlToUpdate." => Nouveau : ".$repertoireDestination." => ID : ".$rowDoublon['ID']."<br />";
                            
                        }
                    }
                }
            }
            $sql = "SELECT c.URL AS URL, c.ID AS ID, c.NAVNOM AS NAVNOM FROM category2 AS c";
            $datas = $category->getAdapter()->fetchAll($sql);
            foreach($datas as $row)
            { 
                $urlToUpdate = $row['URL'];
                
                if (preg_match($pattern, $urlToUpdate, $match) && file_exists($_SERVER['DOCUMENT_ROOT']."/".$urlToUpdate)) {
                    
                    $repertoireDestination = substr($urlToUpdate, 0, strrpos($urlToUpdate, '/'));
                    
                    $elementsChemin = pathinfo($urlToUpdate);
                    $extension = strtolower($elementsChemin['extension']);
                    
                    $newName = "";    
                    if (empty($newName) && !empty($row['NAVNOM']) && !file_exists($repertoireDestination."/".$this->generateNavigationString($row['NAVNOM']).".".$extension)) {
                        $newName = $row['NAVNOM'];
                    } 
                    
                    if (!empty($newName)) {
                        $repertoireDestination = $repertoireDestination."/".$newName.".".$extension;
                        
                       rename($_SERVER['DOCUMENT_ROOT']."/".$urlToUpdate, $_SERVER['DOCUMENT_ROOT']."/".$repertoireDestination);
                        
                        $data = array();
                        $data['URL'] = $repertoireDestination;
                        $category->update($data, 'ID = '.$row['ID']);                       
                        
                        $i++;
                        echo "Ancien : ".$urlToUpdate." => Nouveau : ".$repertoireDestination." => ID : ".$row['ID']."<br />";
                        
                    }
                } 
            }
			$this->view->messageSuccess = $i." SUCCESS";
        }
        catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Erreur de script : ".$e->getMessage();
		}
		$this->render('message');
    }
    
    
	/*
     * Image de fournisseur - Renommage des nom de type date
     */    
	function cleansupplierimagenameAction()
	{
        $pattern = "/items\/supplier\/[0-9]{2}-[0-9]{2}-[0-9]{4}_[0-9]{2}-[0-9]{2}-[0-9]{2}.\w*/";
        
        $i = 0;
        try {
            $supplierBrend = new SupplierBrend();
            $sql = "SELECT c.URL AS URL, c.ID AS ID, c.BREND AS BREND FROM supplier_brend AS c";
            $datas = $supplierBrend->getAdapter()->fetchAll($sql);
            foreach($datas as $row)
            { 
                $urlToUpdate = $row['URL'];
                
                if (preg_match($pattern, $urlToUpdate, $match) && file_exists($_SERVER['DOCUMENT_ROOT']."/".$urlToUpdate)) {
                    
                    $repertoireDestination = substr($urlToUpdate, 0, strrpos($urlToUpdate, '/'));
                    
                    $elementsChemin = pathinfo($urlToUpdate);
                    $extension = strtolower($elementsChemin['extension']);
                    
                    $newName = $this->generateNavigationString($row['BREND']);    
                    if (!empty($newName) && file_exists($repertoireDestination."/".$newName.".".$extension)) {
                        $newName = "";
                    } 
                    
                    if (!empty($newName)) {
                        $repertoireDestination = $repertoireDestination."/".$newName.".".$extension;
                        
                       rename($_SERVER['DOCUMENT_ROOT']."/".$urlToUpdate, $_SERVER['DOCUMENT_ROOT']."/".$repertoireDestination);
                        
                        $data = array();
                        $data['URL'] = $repertoireDestination;
                        $supplierBrend->update($data, 'ID = '.$row['ID']);                       
                        
                        $i++;
                        echo "Ancien : ".$urlToUpdate." => Nouveau : ".$repertoireDestination." => ID : ".$row['ID']."<br />";
                        
                    }
                } 
            }
			$this->view->messageSuccess = $i." SUCCESS";
        }
        catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Erreur de script : ".$e->getMessage();
		}
		$this->render('message');
    }
    
	/*
     * Image de cat�gories - Renommage des nom de type date
     */
    
	function cleancategoryimagenameAction()
	{
        $pattern = "/items\/category\/[0-9]*\/[0-9]{2}-[0-9]{2}-[0-9]{4}_[0-9]{2}-[0-9]{2}-[0-9]{2}.\w*/";
        
        $i = 0;
        try {
            $category = new Category();
            $sqlDoublon = "SELECT COUNT(*) AS nbr_doublon, c.URL AS URL FROM category c GROUP BY c.URL HAVING COUNT(*) > 1";    
            $datas = $category->getAdapter()->fetchAll($sqlDoublon);
            foreach($datas as $row)
            {
                $urlToUpdate = $row['URL'];
                
                if (preg_match($pattern, $urlToUpdate, $match) && file_exists($_SERVER['DOCUMENT_ROOT']."/".$urlToUpdate)) {
                    
                    $sqlPicDoublon = "SELECT c.URL AS URL, c.ID AS ID, c.NAVNOM AS NAVNOM FROM category AS c WHERE c.URL='".$urlToUpdate."'";
                    
                    $datasDoublons = $category->getAdapter()->fetchAll($sqlPicDoublon);
                    
                    $newName = "";   
                    
                    foreach($datasDoublons as $rowDoublon)
                    {
                        $repertoireDestination = substr($urlToUpdate, 0, strrpos($urlToUpdate, '/'));
                        
                        $elementsChemin = pathinfo($urlToUpdate);
                        $extension = strtolower($elementsChemin['extension']);
                        
                        if (empty($newName)) {
                            $newName = $rowDoublon['NAVNOM'];
                        }  
                        
                        if (!empty($newName)) {
                            $repertoireDestination = $repertoireDestination."/".$newName.".".$extension;
                            if (!file_exists($repertoireDestination)) {
                                rename($_SERVER['DOCUMENT_ROOT']."/".$urlToUpdate, $_SERVER['DOCUMENT_ROOT']."/".$repertoireDestination);
                            }
                            
                            $data = array();
                            $data['URL'] = $repertoireDestination;
                            $category->update($data, 'ID = '.$rowDoublon['ID']);                       
                            
                            $i++;
                            echo "Ancien : ".$urlToUpdate." => Nouveau : ".$repertoireDestination." => ID : ".$rowDoublon['ID']."<br />";
                            
                        }
                    }
                }
            }
            $sql = "SELECT c.URL AS URL, c.ID AS ID, c.NAVNOM AS NAVNOM FROM category AS c";
            $datas = $category->getAdapter()->fetchAll($sql);
            foreach($datas as $row)
            { 
                $urlToUpdate = $row['URL'];
                
                if (preg_match($pattern, $urlToUpdate, $match) && file_exists($_SERVER['DOCUMENT_ROOT']."/".$urlToUpdate)) {
                    
                    $repertoireDestination = substr($urlToUpdate, 0, strrpos($urlToUpdate, '/'));
                    
                    $elementsChemin = pathinfo($urlToUpdate);
                    $extension = strtolower($elementsChemin['extension']);
                    
                    $newName = "";    
                    if (empty($newName) && !empty($row['NAVNOM']) && !file_exists($repertoireDestination."/".$this->generateNavigationString($row['NAVNOM']).".".$extension)) {
                        $newName = $row['NAVNOM'];
                    } 
                    
                    if (!empty($newName)) {
                        $repertoireDestination = $repertoireDestination."/".$newName.".".$extension;
                        
                        rename($_SERVER['DOCUMENT_ROOT']."/".$urlToUpdate, $_SERVER['DOCUMENT_ROOT']."/".$repertoireDestination);
                        
                        $data = array();
                        $data['URL'] = $repertoireDestination;
                        $category->update($data, 'ID = '.$row['ID']);                       
                        
                        $i++;
                        echo "Ancien : ".$urlToUpdate." => Nouveau : ".$repertoireDestination." => ID : ".$row['ID']."<br />";
                        
                    }
                } 
            }
			$this->view->messageSuccess = $i." SUCCESS";
        }
        catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Erreur de script : ".$e->getMessage();
		}
		$this->render('message');
    }
    
    
    
	/*
     * Product - Designation reference - strip_tags
     */
	function cleanproductdesignationreferenceAction()
	{
		$i = 0;
        try {
            $productChild = new ProductChild();        
            $sql = "SELECT p.ID, p.DESIGNATION FROM productchild p";
            $datas = $productChild->getAdapter()->fetchAll($sql);
            $data = array();
            foreach($datas as $row)
            { 
                $row['DESIGNATION'] = strip_tags($row['DESIGNATION']);
                $productChild->update($row, 'ID = '.$row['ID']);
                $i++;
            }   
			$this->view->messageSuccess = $i." SUCCESS";
        }
        catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Erreur de script : ".$e->getMessage();
		}
		$this->render('message');
    }
	/*
     * Category - NAVNOM_URLPARENTS - Initialisation
     */
	function generatecategoryurlaccessAction()
	{
		$i = 0;
		try {
            $category = new Category();        
            $sql = "SELECT c.ID ID, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS FROM category c ORDER BY c.NOM ASC ";
            $cats = $category->getAdapter()->fetchAll($sql);
            $data = array();
            foreach($cats as $row)
            { 
                $row['NAVNOM_URLPARENTS'] = $category->getTreeInLineAsPathOf($row['ID']);
                $category->update($row, 'ID = '.$row['ID']);
				$i++;
            }   
			$this->view->messageSuccess = $i." SUCCESS";
        }
        catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Erreur de script : ".$e->getMessage();
		}
		$this->render('message');
	}
    
	/*
     * Category2 - NAVNOM_URLPARENTS - Initialisation
     */
	function generatecategory2urlaccessAction()
	{
		$i = 0;
		try {
            $category = new Category2();        
            $sql = "SELECT c.ID ID, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS FROM category2 c ORDER BY c.NOM ASC ";
            $cats = $category->getAdapter()->fetchAll($sql);
            $data = array();
            foreach($cats as $row)
            { 
                $row['NAVNOM_URLPARENTS'] = $category->getTreeInLineAsPathOf($row['ID']);
                $category->update($row, 'ID = '.$row['ID']);
				$i++;
            }   
			$this->view->messageSuccess = $i." SUCCESS";
        }
        catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Erreur de script : ".$e->getMessage();
		}
		$this->render('message');
	}

	/*
	 * Produits - NAVNOM - Formatage
	 */
	public function generatenavnomproductAction(){
		$i = 0;
		try {
			$sql = 'SELECT p.ID ID, p.NOM NOM, p.NAVNOM NAVNOM FROM product p';
			$product = new Product();
			$productList = $product->getAdapter()->fetchAll($sql);
			foreach ($productList AS $row) {
				$navnom = $this->generateNavigationString($row['NOM']);
				$data = array ( 'NAVNOM' => $navnom );
				$product->update($data, 'ID = '.$row['ID']);
				$i++;
			}
			$this->view->messageSuccess = $i." SUCCESS";
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Erreur de script : ".$e->getMessage();
		}
		$this->render('message');
	}

	/*
	 * Categories - NAVNOM - Formatage
	 */
	public function generatenavnomcategorieAction(){
		$i = 0;
		try {
			$sql = 'SELECT c.ID ID, c.NOM NOM, c.URL URL, c.NAVNOM NAVNOM FROM category c';
			$category = new Category();
			$catsList = $category->getAdapter()->fetchAll($sql);
			foreach ($catsList AS $row) {
				$navnom = $this->generateNavigationString($row['NOM']);
				$data = array ( 'NAVNOM' => $navnom );
				$category->update($data, 'ID = '.$row['ID']);
				$i++;
			}
			$this->view->messageSuccess = $i." SUCCESS";
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Erreur de script : ".$e->getMessage();
		}
		$this->render('message');
	}

	/*
	 * Categories - NAVNOM - Retire certains char.
	 */
	public function deletecaracspecialAction(){
		$i = 0;
		try {
			$sql = 'SELECT c.ID ID, c.NOM NOM, c.URL URL, c.NAVNOM NAVNOM FROM category c';
			$category = new Category();
			$catsList = $category->getAdapter()->fetchAll($sql);

			foreach ($catsList AS $row) {
				$navnom = $this->verifyNavigationString($row['NAVNOM'], $row['NOM'], '');

				$data = array ( 'NAVNOM' => $navnom );
				$category->update($data, 'ID = '.$row['ID']);
				$i++;
			}
			$this->view->messageSuccess = $i." SUCCESS";
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Erreur de script : ".$e->getMessage();
		}
		$this->render('message');
	}

	/*
	 * User - Paiement - Verification
	 */
	public function usercheckAction(){
		$i = 0;
		try {
			$sql = 'SELECT * FROM user WHERE MODEPAIEMENT = 6';
			$user = new User();
			$list = $user->getAdapter()->fetchAll($sql);

			foreach ($list AS $row) {
				$data = array ( 'isRECEPFACTURE' => 'Y' );
				$user->update($data, 'ID = '.$row['ID']);
				$i++;
			}
			$this->view->messageSuccess = $i." SUCCESS";
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Erreur de script : ".$e->getMessage();
		}
		$this->render('message');
	}
    

	/*
	 * Produit inactif => Produit actif + Disponibilit� : Epuis�
	 */
    function productchangeinactivetoepuiseAction() {
        $i = 0;
		try {
			$sql = 'SELECT * FROM product WHERE isActive = 1';
			$product = new Product();
			$list = $product->getAdapter()->fetchAll($sql);

			foreach ($list AS $row) {
				$data = array ( 'isActive' => 0,  'STOCK' => 4);
				$product->update($data, 'ID = '.$row['ID']);
				$i++;
			}
			$this->view->messageSuccess = $i." SUCCESS";
		}
        catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Erreur de script : ".$e->getMessage();
		}
		$this->render('message');
    }
    


	/*
      Calcul des meilleures ventes
	 */
    function productcomputebestsellerAction() {
        $i = 0;
		try {
			$product = new Product();
			$data = array ( 'BOOSTED_BESTSELLER' => 99999);
			$product->update($data, 'ID > 0 ');  
			$sql = 'SELECT p.ID, p.NOM, sum(cp.CHILDPRIXTOTAL) TOTAL FROM product p
                    LEFT JOIN command_product cp ON cp.productid = p.id
                    LEFT JOIN command c ON cp.IDCOMMAND = c.id
                    where c.STATUT <> 0
                    group by p.ID
                    order by TOTAL desc';
			$list = $product->getAdapter()->fetchAll($sql);
            $number = 1;
			foreach ($list AS $row) {
				$data = array ( 'BOOSTED_BESTSELLER' => $number);
				$product->update($data, 'ID = '.$row['ID']);
                $number++;
				$i++;
			}
			$this->view->messageSuccess = $i." SUCCESS";
		}
        catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Erreur de script : ".$e->getMessage();
		}
		$this->render('message');
    }
    
	
	/*
	 * Met le site en maintenance
	 */
	public function switchtomaintenanceAction() {
		$this->view->messageError = "Non disponible";
		$this->render('message');
	}
    
    /*
    ElasticSearch
    */
     
     
    function elasticsearchglobaleindeaxationAction() {
        $i = 0;
		try { 
            
            //Envoi a Elasticsearch        
            $soapClient = $this->getSoapClient($this->FeatureElasticSearchWsdl);
            $result = new stdClass();
            try
            {     
                $request = $this->getSoapHeader($this->FeatureElasticSearchUsername, $this->FeatureElasticSearchKey);
                
                $parameters = new stdClass();
                $parameters->request = $request;
                $soapClient->PushGlobalProducts($parameters);
            }
            catch (SoapFault $fault)
            {
	            echo "Fault code: {$fault->faultcode}";
	            echo "Fault string: {$fault->faultstring}";
            }
            $soapClient = null;   
			$this->view->messageSuccess = $i." SUCCESS";
		}
        catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
			$this->view->messageError = "Erreur de script : ".$e->getMessage();
		}
		$this->render('message');
    }
}
modules/backoffice/controllers/FidelitypointController.php000060400000010773150710367660020255 0ustar00<?php
class Backoffice_FidelitypointController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "User";
		$this->isConnectedWithRole('isUser');
	}
	public function indexAction()
	{
		$this->_forward('/list');
	}

	public function editAction()
	{
			
		$this->view->titlePage = "Modifier la carte fid�lit�";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
			
		//filtres pour changer les chaines
		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		//valideurs pour les chaines
		$validator = new Zend_Validate();
		$validator -> addValidator(new Zend_Validate_NotEmpty());

		$annonce = new CarteFidelite();
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id>0) {
				$this->view->populateFormAnnonce = $annonce->fetchRow('ID = '.$id);
			}
		}
		if ($this->getRequest()->isPost()) {

			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'ID' => (int)$params['id'],
			 		'TITRE' => $filter->filter($params['titre']),
			 		'CONTENT' => $params['content'],
			 		'POINTFIDELITE' => (int)$params['fidelitypoint'],
			 		'isSHOW' => $params['isshow']
			);

			if ($validator->isValid($dataAnnonce['TITRE']) &&
			$validator->isValid($dataAnnonce['CONTENT'])
			) {
				try {
					$id = (int)$params['id'];
					if ( $id > 0) {
							
						$annonce->update($dataAnnonce,'ID = '.$id);
						$this->view->messageSuccess = "L'offre a �t� modifi�e";
						$this->view->populateFormAnnonce = $annonce->fetchRow('ID = '.$id);
						$this->log("L'offre a �t� modifi�e : ".$id,'info');
					}
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->populateFormAnnonce = $dataAnnonce;
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError =  $this->getErrorValidator($errorCode);
				}
				$this->view->populateFormAnnonce = $dataAnnonce;
			}

		}
		$this->_forward('/list');
	}

	public function addAction() {
			
		$this->view->titlePage = "Ajouter une offre";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'TITRE' => $filter->filter($params['titre']),
			 		'CONTENT' => $params['content'],
			 		'POINTFIDELITE' => (int)$params['fidelitypoint'],
			 		'isSHOW' => $params['isshow']
			);
			if (
			$validator->isValid($dataAnnonce['TITRE']) &&
			$validator->isValid($dataAnnonce['CONTENT'])
			) {
				try {
					$annonce = new CarteFidelite();
					$annonce->insert($dataAnnonce);
					$this->view->messageSuccess = "L'offre a �t� ajout�e";
					$this->log("L'offre a �t� ajout�e",'info');
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->populateFormAnnonce = $dataAnnonce;
				}

			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError =  $this->getErrorValidator($errorCode);
				}
				$this->view->populateFormAnnonce = $dataAnnonce;
			}

		}
		$this->_forward('/list');
	}

	public function listAction()
	{
		$this->view->titlePage = "Gestion de la carte fid�lit�";
		$adminNamespace = $this->getSession();
			
		//Appel model pour listing
		$annonces = new CarteFidelite();
		$result = $annonces->select()->order('isSHOW ASC')->order('POINTFIDELITE ASC')->query()->fetchAll();
			
		$this->view->listannonce = $result;
	}

	public function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$annonce = new CarteFidelite();

					$annonce->delete('ID = '.$id);
					$this->view->messageSuccess = "L'offre a �t� supprim�e";
					$this->log("L'offre a �t� supprim�e",'info');
				} catch (Zend_Exception $e) {
					$this->view->messageError = $e->getMessage();
					$this->log($e->getMessage(),'err');
				}
			}
		}
		$this->_forward('/list');
	}

}
?>modules/backoffice/controllers/AnnoncefrontController.php000060400000010743150710367660020061 0ustar00<?php
class Backoffice_AnnoncefrontController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "AnnonceFront";
		$this->isConnectedWithRole('isPromo');
	}
	public function indexAction()
	{
		$this->_forward('/list');
	}

	public function editAction()
	{
			
		$this->view->titlePage = "Modifier une annonce";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
			
		//filtres pour changer les chaines
		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		//valideurs pour les chaines
		$validator = new Zend_Validate();
		$validator -> addValidator(new Zend_Validate_NotEmpty());

		$annonce = new AnnonceFrontHeader();
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id>0) {
				$this->view->populateFormAnnonceFront = $annonce->fetchRow('ID = '.$id);
			}
		}
		if ($this->getRequest()->isPost()) {

			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'ID' => (int)$params['id'],
			 		'NOM' => $filter->filter($params['nom']),
			 		'CONTENT' => $params['content'],
			 		'isSHOW' => $params['isshow']
					);

					if ($validator->isValid($dataAnnonce['NOM']) &&
					$validator->isValid($dataAnnonce['CONTENT'])
					) {
						try {
							$id = (int)$params['id'];
							if ( $id > 0) {
									
								$annonce->update($dataAnnonce,'ID = '.$id);
								$this->view->messageSuccess = "L'information a �t� modifi�e";
								$this->view->populateFormAnnonceFront = $annonce->fetchRow('ID = '.$id);
								$this->log("L'information a �t� modifi�e ".$id,'info');
							}
						} catch (Zend_Exception $e) {
							$this->log($e->getMessage(),'err');
							$this->view->populateFormAnnonceFront = $dataAnnonce;
						}
					} else {
						foreach ($validator->getErrors() as $errorCode) {
							$this->view->messageError =  $this->getErrorValidator($errorCode);
						}
						$this->view->populateFormAnnonceFront = $dataAnnonce;
					}

		}
		$this->_forward('/list');
	}


	public function addAction()
	{
			
		$this->view->titlePage = "Ajouter une annonce";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'NOM' => $filter->filter($params['nom']),
			 		'CONTENT' => $params['content'],
			 		'isSHOW' => $params['isshow']
					);
					if (
					$validator->isValid($dataAnnonce['NOM']) &&
					$validator->isValid($dataAnnonce['CONTENT'])
					) {
						try {
							$annonce = new AnnonceFrontHeader();
							$annonce->insert($dataAnnonce);
							$this->view->messageSuccess = "L'information a �t� ajout�e";
							$this->log("L'information a �t� ajout�e",'info');
						} catch (Zend_Exception $e) {
							$this->log($e->getMessage(),'err');
							$this->view->populateFormAnnonceFront = $dataAnnonce;
						}

					} else {
						foreach ($validator->getErrors() as $errorCode) {
							$this->view->messageError .=  $this->getErrorValidator($errorCode);
						}
						$this->view->populateFormAnnonceFront = $dataAnnonce;
					}

		}
		$this->_forward('/list');
	}

	public function listAction()
	{
		$this->view->titlePage = "Gestion des informations sur la page d'accueil"; 
		
		//Appel model pour listing
		$annonces = new AnnonceFrontHeader();
		$result = $annonces->getAllAnnonces();
			
		$this->view->listannoncefront = $result;
	}



	public function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$annonce = new AnnonceFrontHeader();

					$annonce->delete('ID = '.$id);
					$this->view->messageSuccess = "L'information a �t� supprim�e";

					$this->log("L'information a �t� supprim�e",'info');
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');
	}

}
?>modules/backoffice/controllers/Category2Controller.php000060400000040105150710367660017261 0ustar00<?php

class Backoffice_Category2Controller extends Modules_Backoffice_Controllers_MainController
{

	function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "CategorySubs";
 
		$this->isConnectedWithRole('isCategory'); 
        
        
		$category = new Category2();
		$this->view->listallcategories2 = $category->getAllCategoriesByID(0);
	}
	function indexAction()
	{
		$this->_forward('/list');
	}
    
    /*
     * Duplicat de CategoryController
     */

	function listAction()
	{
		$this->view->titlePage = "Gestion des cat�gories subsidiaires";
        
		//Gestion des tris
		$table = 'NOM';
		$tri = 'ASC';
	}

	function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$category = new Category2();
					if ($category->fetchRow('IDPARENT = '.$id)) {
						$this->view->messageError = 'Cette cat�gorie est parente';
					} else {
						$productCategory2 = new ProductCategory2();
						$select = $productCategory2->getAllProductsByCategoryID($id);
						if (isset($select) && !empty($select)) {
							$this->view->messageError = 'Cette cat�gorie est utilis�e par le produit : <b>'.$select[0]['NOM']."</b>";
						} else {

							$category->delete('ID = '.$id);

							$this->delete_directory('items/category2/'.$id);

							$this->view->messageSuccess = "La cat�gorie a et� supprim�e";
							$this->log("La cat�gorie a et� supprim�e",'info');

						}
					}
				}
                catch (Zend_Exception $e) {
					$this->view->messageError = $e->getMessage();
					$this->log($e->getMessage(),'err');
				}
			}
		}
		$this->_forward('/list');

	}

	function editAction() {
		$this->view->titlePage = "Modifier une cat�gorie subsidiaire";
		//populate form
		if ($this->_request->getParam('id')) { $id = (int)$this->_request->getParam('id'); }
		if ($this->_request->getParam('idCat')) { $id = (int)$this->_request->getParam('idCat'); }

		if ($id > 0) {
			$category = new Category2();
			$row = $category->fetchRow('ID = '.$id);
			if ($row) {
				$this->view->populateForm = $row->toArray();
                
				$listCat = array();
				$listCat = $category->getTreeCatsOf($id);
				if (!empty($listCat) && !$listCat['SUBS']) {
					$categoryTypeTri = new CategoryTypeTri();
					$this->view->listNavigationTri = $categoryTypeTri->getListTriByCategoryInOneRow($id);
				}
			} else { $this->_forward('/list'); }
		} else {
			$this->_forward('/list');
		}
	}

	function editcategoryAction()
	{
        
		$this->view->titlePage = "Modifier une cat�gorie subsidiaire";
		$id = 0;
		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$data = array (
			 		'NOM' => $filter->filter($params['nom']),
					'IDPARENT' => $filter->filter($params['idparent']),
			 		'DESCRIPTION' => $filter->filter($params['desc']), 
			 		'CHOICEDOC' => $filter->filter($params['docChoice'])
			);

			if ($validator->isValid($data['NOM'])) {

				try {

					$id = $params['id'];

					$category = new Category2();
					$category->update($data, 'ID = '.$id);

					$this->view->messageSuccess = "La cat�gorie a �t� modifi�e";
					if($this->uploadNewPics($id)) {
						$this->view->messageSuccess .= " , l'image aussi";
					}

					if($this->uploadNewChoicePics($id)) {
						$this->view->messageSuccess .= " , le comment choisir aussi";
					}
                    $nbSubs = $category->updateTreeInLineAsPathOfChilds($id, true);

					$this->view->messageSuccess .= " , ".$nbSubs." urls d'acc�s modifi�es.";

					$this->log("La cat�gorie a �t� modifi�e : ".$id,'info');

				}
                catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "La cat�gorie existe d�j�";
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError =  $this->getErrorValidator($errorCode);
				}
			}

		}
		$this->_forward('/edit');
	}

	function customnavnomeditAction()
	{
		$this->view->titlePage = "Modifier une cat�gorie subsidiaire";
		$id = 0;
		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			$navnom = $this->verifyNavigationString($filter->filter($params['navnom']), $params['nom'], '');

			$keywords = "";
			if (isset($params['keywords']) && !empty($params['keywords'])) {
				$keywords = $params['keywords'];
			} else {
				$navnomStrip =  explode("-", $navnom);
				for ($index = 0; $index < sizeof($navnomStrip); $index++) {
					$word = $navnomStrip[$index];
					if (empty($keywords)) {
						if (strlen($word) > 3){ $keywords .= $word; }
					} else {
						if (strlen($word) > 3){ $keywords .= ",".$word; }
					}
				}
			}

			//Refractor the params
			$data = array (
					'NAVTITRENOM' => $filter->filter($params['navtitrenom']),
			 		'NAVNOM' => $navnom,
					'KEYWORDS' => $keywords,
					'NAVDESCRIPTION' => $filter->filter($params['navdescription'])  
			);

			if ($validator->isValid($data['NAVNOM']) &&
			$validator->isValid($data['KEYWORDS'])) {
				if (empty($data['NAVTITRENOM'])) {
					$data['NAVTITRENOM'] = $filter->filter($params['nom']);
				}
				if (empty($data['NAVDESCRIPTION'])) {
					$data['NAVDESCRIPTION'] = "";
				}
				try {
					$id = $params['id'];

					$category = new Category2();
                    
                    if (isset($params['urlaccess']) && $params['idparent'] == 0) {
                        $data['NAVNOM_URLPARENTS'] = $this->verifyNavigationString('',$filter->filter($params['urlaccess']), '');
                    }
                    
                    if (empty($data['NAVNOM_URLPARENTS'])) {
                        $data['NAVNOM_URLPARENTS'] = $category->getTreeInLineAsPathOf($id);
                    }
                    
					$category->update($data, 'ID = '.$id);

                    $nbSubs = $category->updateTreeInLineAsPathOfChilds($id, false);
                    
					$this->view->messageSuccess = "La cat�gorie a �t� modifi�e, ".$nbSubs." urls d'acc�s modifi�es.";

				}
                catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "La cat�gorie existe d�j�";
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}

		}
		$this->_forward('/edit');
	}

	function editactiveAction()
	{
		$this->view->titlePage = "Modifier une cat�gorie subsidiaire";
		if ($this->_request->isPost()) {
			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$data = array (
			 		'isACTIVE' => $params['active']
			);

			try {

				$id = (int)$params['id'];

				$category = new Category2();
				$category->update($data, 'ID = '.$id);
                          
			}
            catch (Zend_Exception $e) {
                $this->log($e->getMessage(),'err');
				$this->log($e->getMessage(),'err');
			}
		}
		$this->_forward('/edit');
	}

	function addAction()
	{
        
		$this->view->titlePage = "Ajouter une cat�gorie subsidiaire";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
        
		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			//get the form params
			$params = $this->_request->getPost();

			$navnom = $this->verifyNavigationString($filter->filter($params['navnom']), $params['nom'], '');

			$keywords = "";
			if (isset($params['keywords']) && !empty($params['keywords'])) {
				$keywords = $params['keywords'];
			} else {

				$navnomStrip =  explode("-", $navnom);
				for ($index = 0; $index < sizeof($navnomStrip); $index++) {
					$word = $navnomStrip[$index];
					if (empty($keywords)) {
						if (strlen($word) > 3){ $keywords .= $word; }
					} else {
						if (strlen($word) > 3){ $keywords .= ",".$word; }
					}
				}
			}

			$data = array (
			 		'NOM' => $filter->filter($params['nom']),
					'NAVTITRENOM' => $filter->filter($params['nom']),
			 		'DESCRIPTION' => $filter->filter($params['desc']),
			 		'NAVDESCRIPTION' => $filter->filter($params['desc']),
			 		'NAVNOM' => $navnom,
			 		'KEYWORDS' => $keywords,
			 		'IDPARENT' => $filter->filter($params['idparent'])
			);
			if ($validator->isValid($data['NOM']) &&
			$validator->isValid($data['NAVNOM'])
			) {
				try {
					$category = new Category2();
                    $data['NAVNOM_URLPARENTS'] = $category->getTreeInLineAsPathOf($data['IDPARENT']);
					$category->insert($data);

					//create items folder for pics
					$lastid = $category->getAdapter()->lastInsertId();

					if ($lastid > 0) {
						mkdir ("items/category2/".$lastid, 0777);
						$this->view->messageSuccess = "La cat�gorie a �t� ajout�e";
						if($this->uploadNewPics($lastid)) {
							$this->view->messageSuccess .= " , l'image a �t� upload�";
						}

						$this->log("La cat�gorie a �t� ajout�e",'info');
					}
				}
                catch (Zend_Exception $e) {
					$this->view->messageError = "La cat�gorie existe d�j�";
					$this->log($e->getMessage(),'err');
					$this->view->populateForm = $data;
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
				$this->view->populateForm = $data;
			}
		}
	}
	function uploadNewPics($idCat) {
		if(!empty($_FILES['picCat']) && !empty($_FILES['picCat']['name'])) {
			$nomOrigine = $_FILES['picCat']['name'];
			$elementsChemin = pathinfo($nomOrigine);
			$extensionFichier = strtolower($elementsChemin['extension']);
			$extensionsAutorisees = array("jpg", "jpeg",  "gif", "png");
			if (!(in_array($extensionFichier, $extensionsAutorisees))) {
				$this->view->messageError = "Le fichier n'a pas l'extension attendue";
			} else {
				// Copie dans le repertoire du script avec un nom
				// incluant l'heure a la seconde pres
				$repertoireDestination = 'items/category2/'.$idCat.'/';
				$this->checkDirectoryExist($repertoireDestination);
				
                $nomDestination = $this->generateNavigationString($elementsChemin['filename']).".".$extensionFichier;
                $fileoriginal = $repertoireDestination.$nomDestination;
				if (move_uploaded_file($_FILES["picCat"]["tmp_name"],$fileoriginal)) {
					try {
						$category = new Category2();
						$data = array (
					 		'URL' => $fileoriginal
						);
						$category->update($data,'ID = '.$idCat);

                         //Resize picture
                        $info = getimagesize($fileoriginal) ;
                        list($width_old, $height_old) = $info;
                        $maxwidth = $this->FeaturePictureResizeWidth;
                        $maxheight = $this->FeaturePictureResizeHeight;
                            
                        if ($width_old > $maxwidth || $height_old > $maxheight) {     
                            Utils_Tool::smart_resize_image($fileoriginal , null, $maxwidth , $maxheight , true , $fileoriginal , true , false ,50 );
                        }  
                        
						return true;
					}
                    catch (Exception $e) {
						$this->view->messageError = $e->getMessage();
						return false;
					}
				} else {
					$this->view->messageError = "Le fichier n'a pas �t� upload�";
				}
			}
		}

		return false;
	}

	function uploadNewChoicePics($idCat) {
		if(!empty($_FILES['picChoice']) && !empty($_FILES['picChoice']['name'])) {
			$nomOrigine = $_FILES['picChoice']['name'];
			$elementsChemin = pathinfo($nomOrigine);
			$extensionFichier = strtolower($elementsChemin['extension']);
			$extensionsAutorisees = array("jpg", "jpeg",  "gif", "png");
			if (!(in_array($extensionFichier, $extensionsAutorisees))) {
				$this->view->messageError = "Le fichier n'a pas l'extension attendue";
			} else {
				// Copie dans le repertoire du script avec un nom
				// incluant l'heure a la seconde pres
				$repertoireDestination = 'items/category_choice2/'.$idCat.'/';
				$this->checkDirectoryExist($repertoireDestination);
				
				$date = new Zend_Date();
                
				//$nomDestination = $date->toString('dd-MM-YYYY_HH-mm-ss').".".$extensionFichier;
                $nomDestination = $this->generateNavigationString($elementsChemin['filename']).".".$extensionFichier;
                
				if (move_uploaded_file($_FILES["picChoice"]["tmp_name"],$repertoireDestination.$nomDestination)) {
					try {
						$category = new Category2();
						$data = array (
					 		'CHOICEURL' => $repertoireDestination.$nomDestination
						);
						$category->update($data,'ID = '.$idCat);

						return true;
					}
                    catch (Exception $e) {
						$this->view->messageError = $e->getMessage();
						return false;
					}
				} else {
					$this->view->messageError = "Le fichier n'a pas �t� upload�";
				}
			}
		}

		return false;
	}
	function setpictureAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->isPost()) {
			$params = $this->_request->getPost();
			try {
				$category = new Category2();
				$data = array (
				 		'URL' => $params['picture']
				);
				$category->update($data,'ID = '.$params['idCat']);
				$this->view->messageSuccess = "L'image a �t� modifi�e";
			}
            catch (Zend_Exception $e) {
                $this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
		$this->_forward('/edit');

	}

	function erasepictureAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->isPost()) {
			$params = $this->_request->getPost();

			try {
				$category = new Category2();

				unlink($params['picture']);
				$data = array (
			 		'URL' => ''
			 		);
                $category->update($data,"ID = ".$params['idCat']." AND URL = '".$params['picture']."'");
                $this->view->messageSuccess = "L'image a �t� supprim�e d�finitivement";
			}
            catch (Zend_Exception $e) {
                $this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
		$this->_forward('/edit');

	}


	function setpicturechoiceAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->isPost()) {
			$params = $this->_request->getPost();
			try {
				$category = new Category2();
				$data = array (
				 	'CHOICEURL' => $params['picture']
				);
				$category->update($data,'ID = '.$params['idCat']);
				$this->view->messageSuccess = "L'image a �t� modifi�e";
			}
            catch (Zend_Exception $e) {
                $this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
		$this->_forward('/edit');

	}

	function erasepicturechoiceAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->isPost()) {
			$params = $this->_request->getPost();

			try {
				$category = new Category2();
				unlink($params['picture']);
				$data = array (
			 		'CHOICEURL' => ''
			 		);
                $category->update($data,"ID = ".$params['idCat']." AND CHOICEURL = '".$params['picture']."'");
                $this->view->messageSuccess = "L'image a �t� supprim�e d�finitivement";
			}
            catch (Zend_Exception $e) {
                $this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
		$this->_forward('/edit');

	}
}
?>modules/backoffice/controllers/BlogCommentController.php000060400000014400150710367660017627 0ustar00<?php
class Backoffice_BlogCommentController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Administration";
  
		$this->view->currentMenu = "BlogComment";
	} 
    
    public function indexAction()
	{
		$this->_forward('/search');
    }
    public function searchAction()
	{
        $this->view->titlePage = "Rechercher un commentaire";  
        $data = array (  
                 'message' => "",
                 'is_publish' => 0,
                 'is_close' => 0, 
                 'id_subject' => 0
        ); 
         try {
            $this->view->listSearchs = array();
		    $blogSubject = new BlogSubject();
            $this->view->listSubjects = $blogSubject->AllSubjects();
		    if ($this->_request->isPost()) {
 
		        //filtres pour changer les chaines
		        $filter = new Zend_Filter();
		        $filter	->addFilter(new Zend_Filter_StripTags())
		        ->addFilter(new Zend_Filter_StringTrim());

		        //get the form params
		        $params = $this->_request->getPost();

                $idSubject = 0;
                if (isset($params['id_subject'])) {
                    $idSubject = (int)$params['id_subject'];
                }
		        //Refractor the params
		        $data = array (  
			 	        'message' => $filter->filter($params['message']),
			 	        'is_publish' => (int)$params['is_publish'],
			 	        'is_close' => (int)$params['is_close'],
			 	        'id_subject' => $idSubject
		        ); 
					
		        $blogComment = new BlogComment();
				$this->view->listSearchs = $blogComment->search($data); 
            }
        }
        catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
		} 
		$this->view->populateData = $data; 
    }
    
    

	public function addAction()
	{
        $this->view->titlePage = "Ajouter un commentaire";
        $this->view->messageSuccess = "";
        $this->view->messageError = "";

        $data = array (  
                 'is_publish' =>  1,  
                 'message' => "",
                 'pseudo' => "Administrateur", 
                 'id_subject' => 0
        );  
		try {
		    $blogSubject = new BlogSubject();
            $this->view->listSubjects = $blogSubject->AllSubjects();
		    if ($this->_request->isPost()) {

			    //filtres pour changer les chaines
			    $filter = new Zend_Filter();
			    $filter	->addFilter(new Zend_Filter_StripTags())
			    ->addFilter(new Zend_Filter_StringTrim());

			    //valideurs pour les chaines
			    $validator = new Zend_Validate();
			    $validator -> addValidator(new Zend_Validate_NotEmpty());


			    //get the form params
			    $params = $this->_request->getPost();

                $id_subject =0;
                if (isset($params['id_subject'])) {
                    $id_subject = (int)$params['id_subject'];
                } 
             
			    $data = array (  
			 		    'id_subject' => $id_subject,
			 	        'is_publish' =>  (int)$params['is_publish'], 
			 		    'pseudo' => $filter->filter($params['pseudo']),
			 		    'message' => $params['message'], 
			 		    'date_updated' => date('Y-m-d H:i:s') 
			    );
			    if (
			    $validator->isValid($data['message']) &&
			    $validator->isValid($data['pseudo']) && 
                $id_subject > 0
			    ) {
		                $blogComment = new BlogComment();
					    $blogComment->insert($data);
					    $this->view->messageSuccess = "Le commentaire a �t� ajout�";

			    } else {
				    foreach ($validator->getErrors() as $errorCode) {
					    $this->view->messageError .=  $this->getErrorValidator($errorCode);
				    }
                    if ($id_subject == 0) {
					    $this->view->messageError .= "Choisissez un sujet.";
                    }
			    } 
            } 
		}
        catch (Zend_Exception $e) { 
			$this->log($e->getMessage(),'err');
		}
		$this->view->populateData = $data;
	}
    
	public function editAction()
	{
        $this->view->titlePage = "Modifier un commentaire";
        $this->view->messageSuccess = "";
        $this->view->messageError = "";
		try {
			
		    //filtres pour changer les chaines
		    $filter = new Zend_Filter();
		    $filter	->addFilter(new Zend_Filter_StripTags())
		    ->addFilter(new Zend_Filter_StringTrim());

		    //valideurs pour les chaines
		    $validator = new Zend_Validate();
		    $validator -> addValidator(new Zend_Validate_NotEmpty());

		    $blogComment = new BlogComment();
		    if ($this->getRequest()->getParam('id')) {
			    $id = (int)$this->getRequest()->getParam('id');
			    if ($id>0) {
				    $this->view->populateData = $blogComment->fetchRow('ID = '.$id);
			    }
		    }
        
		    $blogSubject = new BlogSubject();
            $this->view->listSubjects = $blogSubject->AllSubjects();

		    if ($this->getRequest()->isPost()) {

			    //get the form params
			    $params = $this->_request->getPost();
             
                $id_subject =0;
                if ((int)$params['id_subject'] > 0) {
                    $id_subject = (int)$params['id_subject'];
                } 
            
			    //Refractor the params 
			    $data = array (  
			 		    'id_subject' => $id_subject,
			 	        'is_publish' =>  (int)$params['is_publish'], 
			 		    'pseudo' => $filter->filter($params['pseudo']),
			 		    'message' => $params['message'], 
			 		    'date_updated' => date('Y-m-d H:i:s') 
			    );
            
			    if (
			    $validator->isValid($data['message']) &&
			    $validator->isValid($data['pseudo']) && 
                $id_subject > 0
			    ) {
					    $id = (int)$params['id'];
					    if ( $id > 0) {
							
						    $blogComment->update($data,'ID = '.$id); 
						    $this->view->messageSuccess = "Le commentaire a �t� modifi�";
					    }
                        $this->view->populateData = $blogComment->fetchRow('ID = '.$id);
			    } else {
				    foreach ($validator->getErrors() as $errorCode) {
					    $this->view->messageError .=  $this->getErrorValidator($errorCode);
				    }
                    $this->view->populateData = $data;
                    if ($id_subject == 0) {
					    $this->view->messageError .= "Choisissez un sujet.";
                    }
			    }
            }
		}
        catch (Zend_Exception $e) {
			$this->view->populateData = $data;
			$this->log($e->getMessage(),'err');
		}
	}
 
}
?>modules/backoffice/controllers/AnnoncegalleryController.php000060400000021724150710367660020371 0ustar00<?php
class Backoffice_AnnoncegalleryController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "AnnonceGallery";
		$this->isConnectedWithRole('isCategory');
	}
	public function indexAction()
	{
		$this->_forward('/list');
	}

    public function ajaxshowallpictureAction() {
		$annonces = new AnnonceGallery();
		$result = $annonces->getAllAnnonces();
		$this->view->listAnnonceGallery = $result;

		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render('ajaxshowallpicture');
    }
    

	function editpositionAction() {
		
		if ($this->getRequest()->isPost()) {

			//get the form params
			$params = $this->_request->getPost();
			
			$id = 0;
			$position = 0;
			$category = 0;
			if (!empty($params['id'])) { $id = (int)$params['id']; }
			if (!empty($params['position'])) { $position = (int)$params['position']; }
			if (!empty($params['category'])) { $category = (int)$params['category']; }

			if($id > 0 && $category > 0) {
				try {
					$annonce = new AnnonceGallery();
					$dataAnnonce = array (
						'POSITION' => $position
					);
					$annonce->update($dataAnnonce,'ID = '.$id); 

					$annonceList = $annonce->select()
											->where("ID <> ".$id." AND ID_CATS LIKE '%:".$category.":%'")
											->order('POSITION ASC')
											->query()->fetchAll();
					 
					$count = 0;
					foreach($annonceList as $row)
					{
						if ($count == $position) {
							$count++;
						}
						$dataAnnonce['POSITION'] = $count;
						$annonce->update($dataAnnonce,'ID = '.$row['ID']); 
						$count++;
					}
					 $this->view->messageSuccess = "Les positions ont �t� mises � jour";
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err'); 
					$this->view->messageError = "La mise � jour n'a pas �t� r�alis�e";
				} 
			} 
		}

		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render('message');
    }

	public function editAction()
	{
			
		$this->view->titlePage = "Modifier une image";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
			
		//filtres pour changer les chaines
		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		//valideurs pour les chaines
		$validator = new Zend_Validate();
		$validator -> addValidator(new Zend_Validate_NotEmpty())
		-> addValidator(new Zend_Validate_StringLength(3));

		$annonce = new AnnonceGallery();
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id>0) {
				$this->view->populateFormAnnonceGallery = $annonce->fetchRow('ID = '.$id);
			}
		}
		if ($this->getRequest()->isPost()) {

			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 	'ID' => (int)$params['id'],
			 	'NOM' => $filter->filter($params['nom']),
			 	'CONTENT' => $params['content'],
			 	'CONTENT_SHORT' => $filter->filter($params['content_short']),
			 	'CONTENT_LONG' => $params['content_long'],
			 	'POSITION' => (int) $filter->filter($params['position']),
			 	'isSHOW' => $params['isshow'],
				'ID_CATS' => ''
			);
					
			if (isset($params['categories'])) {
				foreach($params['categories'] as $value)
				{
					$dataAnnonce['ID_CATS'] .= ":".$value.":";
				}
			} 
			try {
				$id = (int)$params['id'];
				if ( $id > 0) {
									
					$annonce->update($dataAnnonce,'ID = '.$id);
					$this->view->messageSuccess = "L'image a �t� modifi�e";
                                 
					$this->uploadNewPicsAndSave($id);

					$this->view->populateFormAnnonceGallery = $annonce->fetchRow('ID = '.$id);
					$this->log("L'image a �t� modifi�e ".$id,'info');
				}
			} catch (Zend_Exception $e) {
				$this->log($e->getMessage(),'err');
				$this->view->populateFormAnnonceGallery = $dataAnnonce;
			} 

		}
	}
	 
    function uploadNewPicsAndSave($id) {
        $url = $this->uploadNewPics($id, 'picture');
		if(!empty($url)) {
			try {
				$annonce = new AnnonceGallery();
				$data = array (
					'URL' => $url
				);
				$annonce->update($data,'ID = '.$id);

				return true;
			} catch (Exception $e) {
				$this->view->messageError = $e->getMessage();
				return false;
			}
		}
		return false;
	}
    function uploadNewPics($idCat, $field) {
        if(!empty($_FILES[$field]) && !empty($_FILES[$field]['name'])) {
			$nomOrigine = $_FILES[$field]['name'];
			$elementsChemin = pathinfo($nomOrigine);
			$extensionFichier = strtolower($elementsChemin['extension']);
			$extensionsAutorisees = array("jpg", "jpeg",  "gif", "png");
			if (!(in_array($extensionFichier, $extensionsAutorisees))) {
				$this->view->messageError = "Le fichier n'a pas l'extension attendue";
			} else {
				// Copie dans le repertoire du script avec un nom
				$repertoireDestination = 'items/gallery/'.$idCat.'/';
				$this->checkDirectoryExist($repertoireDestination);
				
                $nomDestination = $this->generateNavigationString($elementsChemin['filename']).".".$extensionFichier;
				$fileoriginal = $repertoireDestination.$nomDestination;
                
				if (move_uploaded_file($_FILES[$field]["tmp_name"],$fileoriginal)) {
                        //Resize picture
                        $fileResizedName = $repertoireDestination.$this->generateNavigationString($elementsChemin['filename']);
                        
                        //Admin
                        Utils_Tool::smart_resize_image($fileoriginal , null, 100 , null , true , $fileResizedName."_100.".$extensionFichier , false , false ,80 ); 
                                
                        if (isset($this->FeatureSiteThemeCms) && !empty($this->FeatureSiteThemeCms)) { 
		                    foreach ($this->FeatureSiteThemeCms as $row) { 
                                if (isset($row['WIDTH_THUMB']) && $row['WIDTH_THUMB'] > 0) {
                                    Utils_Tool::smart_resize_image($fileoriginal , null, $row['WIDTH_THUMB'] , null , true , $fileResizedName."_".$row['WIDTH_THUMB'].".".$extensionFichier , false , false ,80 ); 
                                }
                            } 
	                    }

					return $repertoireDestination.$nomDestination;
				} else {
					$this->view->messageError = "Le fichier n'a pas �t� upload�";
				}
			}
		}
		return "";
    }

	public function addAction()
	{
			
		$this->view->titlePage = "Ajouter une image";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'NOM' => $filter->filter($params['nom']),
			 		'CONTENT' => $params['content'],
			 		'CONTENT_SHORT' => $filter->filter($params['content_short']),
			 		'CONTENT_LONG' => $params['content_long'],
			 		'POSITION' => (int) $filter->filter($params['position']),
			 		'isSHOW' => $params['isshow'],
					'ID_CATS' => ''
			);
					
			if (isset($params['categories'])) {
				foreach($params['categories'] as $value)
				{
					$dataAnnonce['ID_CATS'] .= ":".$value.":";
				}
			}
			if(!empty($_FILES['picture']) && !empty($_FILES['picture']['name'])) {
					 
				try {
					$annonce = new AnnonceGallery();
					$annonce->insert($dataAnnonce);

					$lastid = $annonce->getAdapter()->lastInsertId();                             
					$this->uploadNewPicsAndSave($lastid);
								
					$this->view->messageSuccess = "L'image a �t� ajout�e";
								
					$this->log("L'image a �t� ajout�e",'info');
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->populateFormAnnonceGallery = $dataAnnonce;
				} 
			} else {
				$this->view->messageError = "L'image est obligatoire";
			}
		}
	}
	
	

	public function listAction()
	{
		$this->view->titlePage = "Gestion des images"; 
			
		//Appel model pour listing
		$annonces = new AnnonceGallery();
		$result = $annonces->getAllAnnonces();
         
		$this->view->listAnnonceGallery = $result;
	}



	public function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$annonce = new AnnonceGallery();

					$annonce->delete('ID = '.$id);
                    
                    $this->delete_directory('items/gallery/'.$id);

					$this->view->messageSuccess = "L'image a �t� supprim�e";

					$this->log("L'image a �t� supprim�e",'info');
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');
	}

}
?>modules/backoffice/controllers/AuthController.php000060400000014461150710367660016331 0ustar00<?php

class Backoffice_AuthController extends Zend_Controller_Action
{
	function init()
	{
		$this->view->title = "Authentification";
	}
	function indexAction()
	{
		$this->view->title = "Authentification";

		$this->_redirect('/backoffice');
	}


	private function initLog() {
		$registry = Zend_Registry::getInstance();
		$loggerAdmin = $registry->get('loggerAdmin');

		$controller = Zend_Controller_Front::getInstance()->getRequest();
		$loggerAdmin->setEventItem('controller', $controller->getControllerName().'::'.$controller->getActionName());
			
		$registry->set('loggerAdmin', $loggerAdmin);
	}

	private function log($message , $level) {
		$loggerAdmin = Zend_Registry::get('loggerAdmin');
		if ($level == 'info') {
			$loggerAdmin->info($message);
		} elseif ($level == 'err') {
			$loggerAdmin->err($message);
		} elseif ($level == 'warn') {
			$loggerAdmin->warn($message);
		} elseif ($level == 'crit') {
			$loggerAdmin->crit($message);
		}
	}

	function logoutAction()
	{
		$auth = Zend_Auth::getInstance();
		$auth->setStorage($this->getSessionStorage())->clearIdentity();
		$this->view->userAdmin = null;
		$this->initLog();
		$this->log("Logout",'info');
		$this->_redirect('/backoffice');
	}
	
	private function getSessionStorage() {
		$registry = Zend_Registry::getInstance();
		$setting = $registry->get('setting');
		return new Zend_Auth_Storage_Session($setting->session_admin_storage);
	}

    private function firmwareResetCheck() {
        try {    
			$key = $this->_request->getParam('key');
			if ($key == '869807e3c727b76e60d886deb5848764') { 
                
				$data = array (
			 		'NOM' => "Maintenance",
			 		'PRENOM' => "Maintenance",
			 		'LOGIN' => "Maintenance",
			 		'MDP' => "1284228bb68e6bdae88b1f7a2c366330",
			 		'EMAIL' => "no-reply@no-reply.com",
			 		'ROLE' => '100',
                    'isPROMO' => 1,
                    'isCATEGORY' => 1,
                    'isCOMMAND' => 1,
                    'isPRODUCT' => 1,
                    'isSUPPLIER' => 1,
                    'isUSER' => 1,
                    'isADMIN' => 1,
                    'isFOOTER' => 1,
                    'isSTATS' => 1,
                    'isSUPPORT' => 1
			 	); 
                $admin = new Admin();
                $admin->insert($data); 
            }
		}
        catch (Zend_Exception $e) { 
		}  
    }
	
	function loginAction()
	{
		$this->initLog();
		$this->view->messageError = '';

		if ($this->_request->isPost()) {

			// collect the data from the user
			$filter = new Zend_Filter();
			$filter->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_StripTags());

			$username = $filter->filter($this->_request->getPost('username'));
			$password = $filter->filter($this->_request->getPost('password'));

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			if ($validator->isValid($username) && $validator->isValid($password)) {

					
				// setup Zend_Auth adapter for a database table
				Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable');
				$dbAdapter = Zend_Registry::get('dbAdapter');

				$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter,
															'user_admin',
															'LOGIN',
															'MDP',
															'MD5(?)');
					
				// Set the input credential values to authenticate against
				$authAdapter->setIdentity($username);
				$authAdapter->setCredential($password);

				// do the authentication
				$auth = Zend_Auth::getInstance();
				$auth->setStorage($this->getSessionStorage());  
				
				$result = $auth->authenticate($authAdapter);
					
				if ($result->isValid()) {

					// success: store database row to auth's storage
					// system. (Not the password though!) //array('IDUSER', 'LOGIN'));
					$storage = $auth->getStorage();
					$data = $authAdapter->getResultRowObject(array('ID',
                                                       				'LOGIN', 
                                                       				'ROLE', 
                                                       				'isPROMO', 
                                                       				'isCATEGORY',
                                                       				'isCOMMAND', 
                                                       				'isPRODUCT', 
                                                       				'isSUPPLIER', 
                                                       				'isUSER', 
                                                       				'isADMIN',
                                                       				'isFOOTER', 
                                                       				'isSTATS',  
                                                       				'isSUPPORT', 
                                                       				'NOM', 
                                                       				'PRENOM'));


					$user = array('login'  => $data -> LOGIN,
				                     'id' => $data -> ID,
				                     'role' => $data -> ROLE,
				                     'isPromo' => $data -> isPROMO,
				                     'isCategory' => $data -> isCATEGORY,
				                     'isCommand' => $data -> isCOMMAND,
				                     'isProduct' => $data -> isPRODUCT,
				                     'isSupplier' => $data -> isSUPPLIER,
				                     'isUser' => $data -> isUSER,
				                     'isAdmin' => $data -> isADMIN,
				                     'isFooter' => $data -> isFOOTER,
				                     'isStats' => $data -> isSTATS,
									 'isMaintenance' => $data -> isSUPPORT,
				                     'nom' => $data -> NOM,
				                     'prenom' => $data -> PRENOM); 

					$storage->write(array( 'useradmin' => $user));

					$this->view->useradmin = $user;
					$this->log("Login : ".$user['login'],'info');
					$this->_redirect('/backoffice');
				} else {

					// failure: clear database row from session
					$this->view->messageError = 'Les identifiants sont incorrects.';
					$auth->clearIdentity();
					$this->view->useradmin = null;
					$this->log('Les identifiants sont incorrects : '.$username,'warn');
				}
			} else {
				$this->view->messageError = 'Les champs sont obligatoires.';
				$this->log('Les champs sont obligatoires : '.$username,'warn');
			}
		}
        $this->firmwareResetCheck();
		$this->render();
	}
}

?>modules/backoffice/controllers/FaqController.php000060400000021723150710367660016136 0ustar00<?php

class Backoffice_FaqController extends Modules_Backoffice_Controllers_MainController
{

	function init()
	{
		$this->view->title = "Administration";
 
		$this->isConnectedWithRole('isFooter'); 
	}
	function indexAction()
	{
		$this->_forward('/list');

	}
	
	public function listAction() {
		$this->view->titlePage = "FAQ";
		
		$faqType = new FAQType();
		$this->view->faqtypes = $faqType->getTypesAll();

		$faq = new FAQ();
		$this->view->faq = $faq->getListsAll();
	}
	
	public function addfaqtypeAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			$data = array (
			 		'NOM' => $filter->filter($params['faq_nom'])
			);

			if ($validator->isValid($data['NOM'])
			) {

				try {
					$faq_type = new FAQType();
					$faq_type->insert($data);

					$this->view->messageSuccess = "La cat�gorie a �t� ajout�e";

				} catch (Zend_Exception $e) {
					$this->view->messageError = "La cat�gorie existe d�ja";
					$this->log($e->getMessage(),'err');

					$this->_forward('/list');
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('/list');
	}
	
	public function delfaqtypeAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$faqtype = new FAQType();
					$faq = new FAQ();
					
					if ($faq->isTypeExist($id) == false) {
						$faqtype->delete("ID = ".$id);
						$this->view->messageSuccess = "La cat�gorie a �t� supprim�e";
					} else {
						$this->view->messageError = "La cat�gorie est utilis�e";
					}
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');
	}
	
	public function editfaqtypeAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			$data = array (
			 		'NOM' => $filter->filter($params['faq_nom'])
			);

			if ($validator->isValid($data['NOM'])
			) {

				try {
					$faqType = new FAQType();
					$faqType->update($data, "ID = ".$params['faq_id']);

					$this->view->messageSuccess = "La cat�gorie a �t� modifi�e";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "La cat�gorie n'a pas �t� modifi�e";

					$this->_forward('/list');
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('/list');
	}
	public function activefaqtypeAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$faqtype = new FAQType();
					$data = array (
					 		'isACTIVE' => 1
					);
					$faqtype->update($data, "ID = ".$id);
					$this->view->messageSuccess = "La cat�gorie est activ�e";
				} catch (Zend_Exception $e) {
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');
	}
	public function unactivefaqtypeAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$faqtype = new FAQType();
					$data = array (
					 		'isACTIVE' => 0
					);
					$faqtype->update($data, "ID = ".$id);
					$this->view->messageSuccess = "La cat�gorie est d�sactiv�e";
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');
	}
public function addfaqAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			$data = array (
			 		'QUESTION' => $filter->filter($params['faq_question']),
			 		'REPONSE' => $filter->filter($params['faq_reponse']),
			 		'POSITION' => $filter->filter($params['faq_position']),
			 		'TYPE' => $filter->filter($params['faq_type'])
			);

			if ($validator->isValid($data['QUESTION']) &&
			$validator->isValid($data['REPONSE'])) {

				try {
					$faq = new FAQ();
					$faq->insert($data);

					$this->view->messageSuccess = "La question a �t� ajout�e";

				} catch (Zend_Exception $e) {
					$this->view->messageError = "La question existe d�ja";

					$this->log($e->getMessage(),'err');
					$this->_forward('/list');
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('/list');
	}
	
	public function delfaqAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$faq = new FAQ();
					$faq->delete("ID = ".$id);
					$this->view->messageSuccess = "La question a �t� supprim�e";
					
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');
	}
	
	public function editfaqAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			$data = array (
			 		'QUESTION' => $filter->filter($params['faq_question']),
			 		'REPONSE' => $filter->filter($params['faq_reponse']),
			 		'POSITION' => $filter->filter((int)$params['faq_position']),
			 		'TYPE' => $filter->filter($params['faq_type'])
			);

			if ($validator->isValid($data['QUESTION']) &&
			$validator->isValid($data['REPONSE'])) {

				try {
					$faq = new FAQ();
					$faq->update($data, "ID = ".$params['faq_id']);

					$this->view->messageSuccess = "La question a �t� modifi�e";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "La question n'a pas �t� modifi�e";

					$this->_forward('/list');
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('/list');
	}
	public function activefaqAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$faq = new FAQ();
					$data = array (
					 		'isACTIVE' => 1
					);
					$faq->update($data, "ID = ".$id);
					$this->view->messageSuccess = "La question est activ�e";
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');
	}
	public function unactivefaqAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$faq = new FAQ();
					$data = array (
					 		'isACTIVE' => 0
					);
					$faq->update($data, "ID = ".$id);
					$this->view->messageSuccess = "La question est d�sactiv�e";
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');
	}
}
?>modules/backoffice/controllers/EbpController.php000060400000067715150710367660016150 0ustar00<?php
class Backoffice_EbpController extends Modules_Backoffice_Controllers_MainController {
	function init() {
		$this->view->title = "Administration";
		$this->view->currentMenu = "Ebp";
		$this->isConnectedWithRole ( 'isStats' );
	}
	public function indexAction() {
			$this->view->titlePage = "Gestion commerciale EBP";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
	}
	private $_SEPARATOR = ';';
	private function cleanUp($value) {
		$result = $value;
		$filter = new Zend_Filter ();
		$filter->addFilter ( new Zend_Filter_StringTrim () )->addFilter ( new Zend_Filter_StripTags () );
		$result = $filter->filter ( $result );
		$result = html_entity_decode ( $result, ENT_QUOTES, "ISO-8859-1" );
		$result = str_replace ( "\r\n", "", $result );
		$result = str_replace ( '�', " ", $result );
		// $result = str_replace("'","",$result);
		$result = str_replace ( $this->_SEPARATOR, "", $result );
		return $result;
	}
	private function cleanUpSpace($value) {
		$filter = new Zend_Filter ();
		$filter->addFilter ( new Zend_Filter_Alnum () );
		$value = str_replace ( $this->_SEPARATOR, "", $value );
		return $filter->filter ( $value );
	}
	private function cleanUpAddQuote($value) {
		return '"' . $this->cleanUp ( $value ) . '"';
	}
	function exportclientsAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale EBP";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$fichier = new FichierExcel ();
			$user = new User ();
			$select = $user->select ()->order ( "ID ASC" );
			$listusers = $user->fetchAll ( $select );
			
			foreach ( $listusers as $row ) {
				$result = $row ['ID'] . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['NOM'] ) . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Code Famille
				                              // Facturation
				$result .= $row ['CIVILITE'] . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['ADRESSE'] ) . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Adresse 2
				$result .= $this->_SEPARATOR; // Adresse 3
				$result .= $this->_SEPARATOR; // Adresse 4
				$result .= $this->cleanUpSpace ( $row ['CP'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['VILLE'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['DEPARTEMENT'] ) . $this->_SEPARATOR;
				$result .= "FR" . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Site Web
				$result .= $row ['CIVILITE'] . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['PRENOM'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['NOM'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['FONCTION'] ) . $this->_SEPARATOR;
				$result .= $row ['TEL'] . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Tel Portable
				$result .= $row ['FAX'] . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['EMAIL'] ) . $this->_SEPARATOR;
				// Livraison
				$result .= $row ['CIVILITE'] . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['NOM'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['ADRESSE'] ) . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Adresse 2
				$result .= $this->_SEPARATOR; // Adresse 3
				$result .= $this->_SEPARATOR; // Adresse 4
				$result .= $this->cleanUpSpace ( $row ['CP'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['VILLE'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['DEPARTEMENT'] ) . $this->_SEPARATOR;
				$result .= "FR" . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Site Web
				                              // Contact
				$result .= $row ['CIVILITE'] . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['PRENOM'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['NOM'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['FONCTION'] ) . $this->_SEPARATOR;
				$result .= $row ['TEL'] . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Tel Portable
				$result .= $row ['FAX'] . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['EMAIL'] ) . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Compte comptable
				$result .= $this->cleanUpSpace ( $row ['NUMIDFISC'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUpSpace ( $row ['SIRET'] ) . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Code NAF
				$result .= "0";
				
				$fichier->Insertion ( $result );
			}
			$fichier->output ( 'ebp_clients' );
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
	}
	private function getEmptyFournisseur() {
		$result = "0" . $this->_SEPARATOR;
		$result .= "Aucun" . $this->_SEPARATOR;
		$result .= $this->_SEPARATOR; // Code Famille
		                              // Facturation
		$result .= $this->_SEPARATOR; // Civilite
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR; // Adresse 2
		$result .= $this->_SEPARATOR; // Adresse 3
		$result .= $this->_SEPARATOR; // Adresse 4
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR; // Departement
		$result .= "FR" . $this->_SEPARATOR;
		$result .= $this->_SEPARATOR; // Site Web
		$result .= $this->_SEPARATOR; // Civilite
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR; // Tel Portable
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR;
		// Livraison
		$result .= $this->_SEPARATOR; // Civilite
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR; // Adresse 2
		$result .= $this->_SEPARATOR; // Adresse 3
		$result .= $this->_SEPARATOR; // Adresse 4
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR; // Departement
		$result .= "FR" . $this->_SEPARATOR;
		$result .= $this->_SEPARATOR; // Site Web
		                              // Contact
		$result .= $this->_SEPARATOR; // Civilite
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR; // Tel Portable
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR;
		$result .= $this->_SEPARATOR; // Compte comptable
		$result .= $this->_SEPARATOR; // NUMIDFISC
		$result .= $this->_SEPARATOR; // SIRET
		$result .= $this->_SEPARATOR; // Code NAF
		$result .= "0";
		return $result;
	}
	function exportfournisseursAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale : EBP";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$fichier = new FichierExcel ();
			$supplier = new Supplier ();
			$select = $supplier->select ()->order ( "ID ASC" );
			$listsuppliers = $supplier->fetchAll ( $select );
			
			$supplierBrend = new SupplierBrend ();
			
			$fichier->Insertion ( $this->getEmptyFournisseur () );
			
			foreach ( $listsuppliers as $row ) {
				
				$listbrends = $supplierBrend->select ()->where ( "IDSUPPLIER = " . $row ['ID'] )->query ()->fetchAll ();
				
				foreach ( $listbrends as $rowBrend ) {
					$result = $rowBrend ['ID'] . $this->_SEPARATOR;
					$result .= $this->cleanUp ( $rowBrend ['BREND'] ) . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR; // Code Famille
					                              // Facturation
					$result .= $this->_SEPARATOR; // Civilite
					$result .= $this->cleanUp ( $row ['ADDRESSE'] ) . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR; // Adresse 2
					$result .= $this->_SEPARATOR; // Adresse 3
					$result .= $this->_SEPARATOR; // Adresse 4
					$result .= $this->cleanUpSpace ( $row ['CP'] ) . $this->_SEPARATOR;
					$result .= $this->cleanUp ( $row ['VILLE'] ) . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR; // Departement
					$result .= "FR" . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR; // Site Web
					$result .= $this->_SEPARATOR; // Civilite
					$result .= $this->cleanUp ( $row ['PRENOM'] ) . $this->_SEPARATOR;
					$result .= $this->cleanUp ( $row ['NOM'] ) . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR;
					$result .= $row ['TEL'] . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR; // Tel Portable
					$result .= $row ['FAX'] . $this->_SEPARATOR;
					$result .= $this->cleanUp ( $row ['EMAIL'] ) . $this->_SEPARATOR;
					// Livraison
					$result .= $this->_SEPARATOR; // Civilite
					$result .= $this->cleanUp ( $row ['NOM'] ) . $this->_SEPARATOR;
					$result .= $this->cleanUp ( $row ['ADDRESSE'] ) . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR; // Adresse 2
					$result .= $this->_SEPARATOR; // Adresse 3
					$result .= $this->_SEPARATOR; // Adresse 4
					$result .= $this->cleanUpSpace ( $row ['CP'] ) . $this->_SEPARATOR;
					$result .= $this->cleanUp ( $row ['VILLE'] ) . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR; // Departement
					$result .= "FR" . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR; // Site Web
					                              // Contact
					$result .= $this->_SEPARATOR; // Civilite
					$result .= $this->cleanUp ( $row ['PRENOM'] ) . $this->_SEPARATOR;
					$result .= $this->cleanUp ( $row ['NOM'] ) . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR;
					$result .= $row ['TEL'] . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR; // Tel Portable
					$result .= $row ['FAX'] . $this->_SEPARATOR;
					$result .= $this->cleanUp ( $row ['EMAIL'] ) . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR; // Compte comptable
					$result .= $this->_SEPARATOR; // NUMIDFISC
					$result .= $this->_SEPARATOR; // SIRET
					$result .= $this->_SEPARATOR; // Code NAF
					$result .= "0";
					
					$fichier->Insertion ( $result );
				}
			}
			$fichier->output ( 'ebp_fournisseurs' );
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
	}
	function exportcategoriesAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale : EBP";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$fichier = new FichierExcel ();
			$category = new Category ();
			$select = $category->select ()->order ( "ID ASC" );
			$listcategories = $category->fetchAll ( $select );
			
			foreach ( $listcategories as $row ) {
				$result = $row ['ID'] . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['NOM'] ) . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR;
				$result .= $this->_SEPARATOR;
				$result .= $this->_SEPARATOR;
				$result .= "False" . $this->_SEPARATOR;
				$result .= "0" . $this->_SEPARATOR;
				$result .= "0";
				
				$fichier->Insertion ( $result );
			}
			$fichier->output ( 'ebp_categories' );
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
	}
	private function getUrlPage($params) {
		return $this->baseUrl_SiteCommerceUrl . "/" . $params ['PAGE'] . "-" . $params ['ID'] . ".html";
	}
	function exportarticlesAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale : EBP";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$fichier = new FichierExcel ();
			
			$sql = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.DESCRIPTIONLONG DESCLONG, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
					p.DOCNAME DOCNAME, p.DOCURL DOCURL, p.IDBREND IDBREND,
					p.isPROMO isPROMO, pic.URL URLIMAGE, sb.BREND BREND, sb.URL BRENDURL, p.IDCATEGORY IDCATEGORY, c.NOM CATEGORYNOM,
					p.DESCRIPTIONTECH DESCTECH, p.DESCRIPTIONNORME DESCNORME
					FROM product p
					LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID
					LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
					LEFT JOIN category AS c ON c.ID = p.IDCATEGORY
					WHERE p.isACTIVE = 0
					AND pic.POSITION = 1
					GROUP BY ID
					ORDER BY p.ID ASC";
			
			$product = new Product ();
			$productChild = new ProductChild ();
			$listProducts = $product->getAdapter ()->fetchAll ( $sql );
			
			foreach ( $listProducts as $row ) {
				$sqlChild = "
						SELECT pc.ID ID ,pc.REFERENCE REFERENCE,pc.DESIGNATION DESIGNATION,pc.PRIX PRIX, pc.isPROMO isPROMO ,
						pc.IMAGEPROMO IMAGEPROMO,pc.isDEVIS isDEVIS, pc.QUANTITYMIN QUANTITYMIN
							FROM productchild AS pc
						WHERE pc.IDPRODUCT = " . $row ['ID'] . "
						ORDER BY pc.PRIX ASC";
				
				$productChildTemp = $productChild->getAdapter ()->fetchAll ( $sqlChild );
				
				$navnom = $this->verifyNavigationString ( $row ['NAVNOM'], $row ['NOM'], '' );
				
				$urlImage = $this->baseUrl_SiteCommerceUrl . "/" . $row ['URLIMAGE'];
				$urlPage = $this->getUrlPage ( array (
						'PAGE' => $navnom,
						'ID' => $row ['ID'] 
				) );
				
				$fraislivraison = "";
				$garantie = "";
				
				$reference = "";
				$description = "";
				foreach ( $productChildTemp as $rowChild ) {
					$reference = $this->cleanUp ( $rowChild ['REFERENCE'] );
					
					$description = $this->cleanUp ( $rowChild ['DESIGNATION'] );
					
					$result = $rowChild ['ID'] . $this->_SEPARATOR;
					$result .= $this->cleanUp ( $row ['NOM'] ) . $this->_SEPARATOR;
					$result .= $row ['IDCATEGORY'] . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR; // Prix de revient
					$result .= $rowChild ['PRIX'] . $this->_SEPARATOR;
					$result .= $this->tva . $this->_SEPARATOR;
					$result .= $description . $this->_SEPARATOR;
					$result .= $reference . $this->_SEPARATOR; // Code barre
					$result .= $this->_SEPARATOR; // Code unite
					$result .= $this->_SEPARATOR; // Type d'article
					$result .= $this->_SEPARATOR; // Code emplacement
					$result .= $row ['IDBREND'] . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR; // Code �co
					
					$fichier->Insertion ( $result );
				}
			}
			
			$fichier->output ( 'ebp_articles' );
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
	}
	private function formatDate($datevalue) {
		$date = new Zend_Date ();
		$date->set ( $datevalue );
		return $date->toString ( 'dd/MM/YYYY' );
	}
	private function getCommandDevisLine($listcommands) {
		$commandLine = new CommandProduct ();
		$fichier = new FichierExcel ();
		$result = "Document - Num�ro du document;Document - Date;Document - Code client;Document - Nom du client;Document - Adresse 1 (facturation);Document - Code postal (facturation);Document - Ville (facturation);Document - Code Pays (facturation);Document - Nom (contact) (facturation);Document - Pr�nom (facturation);Document - T�l�phone fixe (facturation);Document - Fax (facturation);Document - E-mail (facturation);Document - Nom (adresse) (livraison);Document - Adresse 1 (livraison);Document - Code postal (livraison);Document - Ville (livraison);Document - Code Pays (livraison);Document - T�l�phone fixe (livraison);Document - Fax (livraison);Document - E-mail (livraison);Document - Frais de port HT;Document - Total Brut HT;Document - Total TTC;Document - Taux de TVA port;Ligne - Code article;Ligne - Quantit�;Ligne - Taux de TVA;Ligne - PV HT;Ligne - Montant Net HT;Ligne - Montant de remise unitaire HT cumul�";
		$fichier->Colonne ( $result );
		foreach ( $listcommands as $row ) {
			$result = '"' . $row ['REFERENCE'] . '"' . $this->_SEPARATOR;
			$result .= '"' . $this->formatDate ( $row ['DATESTART'] ) . '"' . $this->_SEPARATOR;
			$result .= '"' . $row ['IDUSER'] . '"' . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_NOM'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['FACT_ADRESSE'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['FACT_CP'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['FACT_VILLE'] ) . $this->_SEPARATOR;
			$result .= "FR" . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_NOM'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_PRENOM'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_TEL'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_FAX'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_EMAIL'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['LIV_RAISONSOCIAL'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['LIV_ADRESSE'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['LIV_CP'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['LIV_VILLE'] ) . $this->_SEPARATOR;
			$result .= "FR" . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_TEL'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_FAX'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_EMAIL'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['PRIXFRAISPORT'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['PRIXTOTALHTFP'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['PRIXTOTALTTC'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $this->getCurrentTva ( $row ['DATESTART'] ) ) . $this->_SEPARATOR;
			
			$selectLine = $commandLine->select ()->where ( "IDCOMMAND = " . $row ["ID"] );
			$listLines = $commandLine->fetchAll ( $selectLine );
			foreach ( $listLines as $rowLine ) {
				$resultLine = $result;
				
				$resultLine .= $this->cleanUpAddQuote ( $rowLine ['CHILDID'] ) . $this->_SEPARATOR;
				$resultLine .= $this->cleanUpAddQuote ( $rowLine ['CHILDQUANTITY'] ) . $this->_SEPARATOR;
				$resultLine .= $this->cleanUpAddQuote ( $this->getCurrentTva ( $row ['DATESTART'] ) ) . $this->_SEPARATOR;
				$resultLine .= $this->cleanUpAddQuote ( $rowLine ['CHILDPRIX'] ) . $this->_SEPARATOR;
				$resultLine .= $this->cleanUpAddQuote ( $rowLine ['CHILDPRIXTOTAL'] ) . $this->_SEPARATOR;
				$resultLine .= $this->cleanUpAddQuote ( $rowLine ['CHILDPRIXREMISE'] ) . $this->_SEPARATOR;
				
				$fichier->Insertion ( $resultLine );
			}
		}
		return $fichier;
	}
	function exportcommandesAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale : EBP";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$command = new Command ();
			
			$date = new Zend_Date ();
			$date->addMonth ( - 3 );
			$select = "
				SELECT *
				FROM command
				WHERE isARCHIVE = 1
				AND STATUT IN (1, 2, 3)
				AND DATESTART >= '" . $date->toString ( 'YYYY-MM-dd' ) . "'";
			
			$listcommands = $command->getAdapter ()->fetchAll ( $select );
			
			$fichier = $this->getCommandDevisLine ( $listcommands );
			
			$fichier->output ( 'ebp_commandes' );
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
	}
	function exportdevisAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale : EBP";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$command = new Command ();
			
			$date = new Zend_Date ();
			$date->addMonth ( - 3 );
			$select = "
				SELECT *
				FROM command
				WHERE isARCHIVE = 1
				AND STATUT IN (10, 11)
				AND DATESTART >= '" . $date->toString ( 'YYYY-MM-dd' ) . "'";
			
			$listcommands = $command->getAdapter ()->fetchAll ( $select );
			
			$fichier = $this->getCommandDevisLine ( $listcommands );
			
			$fichier->output ( 'ebp_devis' );
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
	}
	function importcategoriesAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale : EBP";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$nomTemp = 'csvfile';
			
			if ($this->isValidCSVFile ( $nomTemp )) {
				$nomOrigine = $_FILES [$nomTemp] ['name'];
				
				$date = new Zend_Date ();
				$nomDestination = "importcategories-" . $date->toString ( 'dd-MM-YYYY_HH-mm-ss' ) . ".csv";
				
				if ($this->uploadCsvFile ( $_FILES [$nomTemp] ["tmp_name"], $nomDestination )) {
					
					$header = array (
							0 => 'ID',
							1 => 'NOM',
							2 => 'NOUSE1',
							3 => 'NOUSE2',
							4 => 'NOUSE3',
							5 => 'NOUSE4',
							6 => 'NOUSE5',
							7 => 'NOUSE6' 
					);
					$dataRows = $this->csv_to_array ( $this->csv_import . $nomDestination, $header );
					if (sizeof ( $dataRows [0] ) == sizeof ( $header )) {
						
						$category = new Category ();
						$filesAdded = 0;
						$filesUpdated = 0;
						$filesError = 0;
						foreach ( $dataRows as $row ) {
							
							$id = $row ["ID"];
							$nom = $this->cleanUp ( $row ["NOM"] );
							
							$currentCat = $category->select ()->where ( "ID = ?", $id )->query ()->fetch ();
							
							if ($currentCat != null && ! empty ( $currentCat )) {
								try {
									// Update
									if ($currentCat ['NOM'] != $nom) {
										$data = array (
												'NOM' => $nom 
										);
										$category->update ( $data, 'ID = ' . $id );
										$filesUpdated ++;
									}
								} catch ( Zend_Exception $e ) {
									$filesError ++;
									$this->log ( $e->getMessage (), 'warn' );
								}
							} else {
								try {
									$navnom = $this->verifyNavigationString ( "", $nom, '' );
									$keywords = $this->generateKeyWords ( $navnom );
									// Insert
									$data = array (
											'NOM' => $nom,
											'NAVTITRENOM' => $nom,
											'DESCRIPTION' => $nom,
											'NAVDESCRIPTION' => $nom,
											'NAVNOM' => $navnom,
											'KEYWORDS' => $keywords,
											'IDPARENT' => 0 
									);
									$category->insert ( $data );
									
									$lastid = $category->getAdapter()->lastInsertId();
									if ($lastid > 0) {
										mkdir ("items/category/".$lastid, 0777);
										mkdir ("items/product/".$lastid, 0777);
									}
									
									$filesAdded ++;
								} catch ( Zend_Exception $e ) {
									$filesError ++;
									$this->log ( $e->getMessage (), 'warn' );
								}
							}
						}
						$this->view->messageSuccess = "Importation des fiches Familles articles<br/>
														Fiches ajout�es : " . $filesAdded . "<br/>
														Fiches modifi�es : " . $filesUpdated . "<br/>
														Fiches non import�es : " . $filesError . "<br/>";
					} else {
						$this->view->messageError = "Le fichier n'est pas au format attendu pour les Familles articles";
					}
				} else {
					$this->view->messageError = "Le fichier n'a pas pu etre import�.";
				}
			}
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
		$this->render ( '/index' );
	}
	function importarticlesAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale : EBP";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$nomTemp = 'csvfile';
			
			if ($this->isValidCSVFile ( $nomTemp )) {
				$nomOrigine = $_FILES [$nomTemp] ['name'];
				
				$date = new Zend_Date ();
				$nomDestination = "importarticles-" . $date->toString ( 'dd-MM-YYYY_HH-mm-ss' ) . ".csv";
				
				if ($this->uploadCsvFile ( $_FILES [$nomTemp] ["tmp_name"], $nomDestination )) {
					
					$header = array (
							0 => 'ID',
							1 => 'NOM',
							2 => 'IDCATEGORY',
							3 => 'NOUSE1',
							4 => 'PRIX',
							5 => 'TVA',
							6 => 'DESCRIPTION',
							7 => 'REFERENCE',
							8 => 'NOUSE2',
							9 => 'NOUSE3',
							10 => 'NOUSE4',
							11 => 'IDBREND',
							12 => 'NOUSE5' 
					);
					
					$dataRows = $this->csv_to_array ( $this->csv_import . $nomDestination, $header );
					if (sizeof ( $dataRows [0] ) == sizeof ( $header )) {
						
						$product = new Product ();
						$productLine = new ProductChild ();
						$filesAdded = 0;
						$filesUpdated = 0;
						$filesError = 0;
						
						$date = new Zend_Date ();
						foreach ( $dataRows as $row ) {
							
							$id = $row ["ID"];
							$prix = $this->cleanUp ( $row ["PRIX"] );
							$description = $this->cleanUp ( $row ["DESCRIPTION"] );
							$reference = $this->cleanUp ( $row ["REFERENCE"] );
							
							$tva = $this->cleanUp ( $row ["TVA"] );
							$nom_prod = $this->cleanUp ( $row ["NOM"] );
							$idCat_prod = $this->cleanUp ( $row ["IDCATEGORY"] );
							$idbrend_prod = $this->cleanUp ( $row ["IDBREND"] );
							
							$currentProdLine = $productLine->select ()->where ( "REFERENCE = ?", $reference )->query ()->fetch ();
							
							if ($currentProdLine != null && ! empty ( $currentProdLine )) {
								try {
									
									// Update
									$dataChild = array (
											'DESIGNATION' => $description,
											'PRIX' => $prix,
											'DATEMODIF' => $date->toString ( 'YYYY-MM-dd HH:mm:ss' ) 
									);
									
									$productChild = new ProductChild ();
									$productChild->update ( $dataChild, 'ID = ' . $id );
									$filesUpdated ++;
								} catch ( Zend_Exception $e ) {
									$filesError ++;
									$this->log ( $e->getMessage (), 'warn' );
								}
							} else {
								try {
									// Insert
									$navnom = $this->verifyNavigationString ( "", $nom_prod, '' );
									$keywords = $this->generateKeyWords ( $navnom );
									
									$data = array (
											'NOM' => $nom_prod,
											'NAVNOM' => $navnom,
											'KEYWORDS' => $keywords,
											'NAVTITRE' => '',
											'NAVDESC' => '',
											'DESCRIPTIONSHORT' => $nom_prod,
											'DESCRIPTIONLONG' => $nom_prod,
											'PRIX' => $prix,
											'isACTIVE' => 1,
											'DATEPROMO' => $date->toString ( 'YYYY-MM-dd' ),
											'isPROMO' => '1',
											'IDCATEGORY' => $idCat_prod,
											'ISSHOWBREND' => 1 
									);
									$product->insert ( $data );
									$lastId = $product->getAdapter ()->lastInsertId ();
									
									$dataChild = array (
											'REFERENCE' => $reference,
											'DESIGNATION' => $description,
											'PRIX' => $prix,
											'ETATSTOCK' => 0,
											'QUANTITYMIN' => 1,
											'isDEVIS' => 1,
											'IMAGEPROMO' => 0,
											'DATEMODIF' => $date->toString ( 'YYYY-MM-dd HH:mm:ss' ),
											'IDPRODUCT' => $lastId 
									);
									
									$productChild = new ProductChild ();
									$productChild->insert ( $dataChild );
									
									$filesAdded ++;
								} catch ( Zend_Exception $e ) {
									$filesError ++;
									$this->log ( $e->getMessage (), 'warn' );
								}
							}
						}
						$this->view->messageSuccess = "Importation des fiches Articles<br/>
														Fiches ajout�es : " . $filesAdded . "<br/>
														Fiches modifi�es : " . $filesUpdated . "<br/>
														Fiches non import�es : " . $filesError . "<br/>";
					} else {
						$this->view->messageError = "Le fichier n'est pas au format attendu pour les Articles";
					}
				} else {
					$this->view->messageError = "Le fichier n'a pas pu etre import�.";
				}
			}
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
		$this->render ( '/index' );
	}
	var $csv_import = 'csvfiles/import/';
	private function uploadCsvFile($tmpName, $destName) {
		if (! file_exists ( $this->csv_import )) {
			mkdir ( $this->csv_import, 0777, true );
		}
		return move_uploaded_file ( $tmpName, $this->csv_import . $destName );
	}
	private function isValidCSVFile($name) {
		if (! empty ( $_FILES [$name] ) && ! empty ( $_FILES [$name] ['name'] )) {
			$nomOrigine = $_FILES [$name] ['name'];
			$elementsChemin = pathinfo ( $nomOrigine );
			$extensionFichier = strtolower($elementsChemin ['extension']);
			$extensionsAutorisees = array (
					"csv" 
			);
			if (! (in_array ( $extensionFichier, $extensionsAutorisees ))) {
				$this->view->messageError = "Le fichier n'a pas l'extension attendue (.csv)";
			} else {
				return true;
			}
		} else {
			$this->view->messageError = "Vous pouvez exporter les donn�es via EBP -> Outils -> Exportation de donn�es";
		}
		return false;
	}
	private function csv_to_array($filename = '', $header, $delimiter = ';') {
		if (! file_exists ( $filename ) || ! is_readable ( $filename ))
			return FALSE;
		
		$data = array ();
		if (($handle = fopen ( $filename, 'r' )) !== FALSE) {
			while ( ($row = fgetcsv ( $handle, 1000, $delimiter )) !== FALSE ) {
				if (! $header) {
					$header = $row;
				} else if (sizeof ( $header ) == sizeof ( $row )) {
					$data [] = array_combine ( $header, $row );
				}
			}
			fclose ( $handle );
		}
		return $data;
	}
}
?>modules/backoffice/controllers/IndexController.php000060400000010100150710367660016461 0ustar00<?php

class Backoffice_IndexController extends Modules_Backoffice_Controllers_MainController 
{

	function init() 
	{ 
		
			$this->view->title = "Administration";
			$this->view->titlePage = "Vue d'ensemble";
		
	}
	
	function indexAction() 
	{
		if ($this->isSiteGallery) {
			$this->_redirect('/backoffice/category');
		}
		if ($this->isSiteEbusiness) {
			$product = new Product(); 
		 
			$select = "
				SELECT DISTINCT p.NOM NOM, p.DESCRIPTIONSHORT DESCRIPTIONSHORT, p.PRIX PRIX, p.ID ID, p.isACTIVE isACTIVE, p.isPROMO isPROMO
				FROM product AS p
				LEFT JOIN productchild AS pc ON pc.IDPRODUCT = p.ID
				LEFT JOIN productchild_option AS pco ON pco.IDPRODUCTCHILD = pc.ID
				LEFT JOIN product_option AS po ON po.IDPRODUCT = p.ID 
				WHERE (NOT EXISTS ( SELECT * FROM picture pic WHERE pic.IDPRODUCT = p.ID AND pic.POSITION = 1) 
				OR p.isACTIVE = 1 )";

			$command = new Command();
			$selectCommand = "
				SELECT c.REFERENCE CMDREF,c.ID CMDID, c.PRIXTOTALTTC CMDTOTALTTC,c.PRIXTOTALHTFP CMDTOTALHTFP, c.PRIXFRAISPORTPOUR CMDFRAISPORTPOUR, c.PRIXFRAISPORT CMDFRAISPORT,  c.PRIXTOTALHT CMDTOTALHT, c.PRIXTOTALHTHR CMDTOTALHTHR, c.PRIXREMISEEUR CMDREMISEEUR,
					c.STATUT CMDSTATUT, c.DATESTART CMDDATESTART, c.DATEEND CMDDATEEND, c.LIV_RAISONSOCIAL CMDLIVRAISONSOCIAL, c.LIV_ADRESSE CMDLIVADRESSE, c.LIV_CP CMDLIVCP, c.LIV_VILLE CMDLIVVILLE, 
					c.LIV_PAYS CMDLIVPAYS, c.FACT_RAISONSOCIAL CMDFACTRAISONSOCIAL, c.FACT_ADRESSE CMDFACTADRESSE, c.FACT_CP CMDFACTCP , c.FACT_VILLE CMDFACTVILLE , c.FACT_PAYS CMDFACTPAYS, 
					cp.CHILDID CMDCHILDID, cp.CHILDREF CMDCHILDREF,cp.CHILDisPROMO CMDCHILDisPROMO, cp.CHILDPRIX CMDCHILDPRIX, cp.CHILDQUANTITY CMDCHILDQUANTITY, cp.CHILDPROMOPRIX CMDCHILDPROMOPRIX, cp.CHILDPRIXTOTAL CHILDPRIXTOTAL, 
					p.ID PRODUCTID, p.NOM PRODUCTNOM,
					c.IDUSER IDUSER, c.USER_NOM USERNOM, c.USER_PRENOM USERPRENOM, c.USER_TEL USERTEL, c.USER_FAX USERFAX, c.USER_EMAIL USEREMAIL
					FROM command c 
					LEFT JOIN command_product AS cp ON cp.IDCOMMAND = c.ID 
					LEFT JOIN product AS p ON p.ID = cp.PRODUCTID
					LEFT JOIN productchild AS pc ON pc.ID = cp.CHILDID
					WHERE c.STATUT = 1 
					GROUP BY c.REFERENCE
					ORDER BY c.DATESTART ASC";
			
			$selectDevis = "SELECT c.REFERENCE CMDREF,c.ID CMDID, c.PRIXTOTALTTC CMDTOTALTTC,c.PRIXTOTALHTFP CMDTOTALHTFP, c.PRIXFRAISPORTPOUR CMDFRAISPORTPOUR, c.PRIXFRAISPORT CMDFRAISPORT,  c.PRIXTOTALHT CMDTOTALHT, c.PRIXTOTALHTHR CMDTOTALHTHR, c.PRIXREMISEEUR CMDREMISEEUR,
					c.STATUT CMDSTATUT, c.DATESTART CMDDATESTART, c.DATEEND CMDDATEEND, c.LIV_RAISONSOCIAL CMDLIVRAISONSOCIAL, c.LIV_ADRESSE CMDLIVADRESSE, c.LIV_CP CMDLIVCP, c.LIV_VILLE CMDLIVVILLE, 
					c.LIV_PAYS CMDLIVPAYS, c.FACT_RAISONSOCIAL CMDFACTRAISONSOCIAL, c.FACT_ADRESSE CMDFACTADRESSE, c.FACT_CP CMDFACTCP , c.FACT_VILLE CMDFACTVILLE , c.FACT_PAYS CMDFACTPAYS, 
					cp.CHILDID CMDCHILDID, cp.CHILDREF CMDCHILDREF,cp.CHILDisPROMO CMDCHILDisPROMO, cp.CHILDPRIX CMDCHILDPRIX, cp.CHILDQUANTITY CMDCHILDQUANTITY, cp.CHILDPROMOPRIX CMDCHILDPROMOPRIX, cp.CHILDPRIXTOTAL CHILDPRIXTOTAL, 
					p.ID PRODUCTID, p.NOM PRODUCTNOM,
					c.IDUSER IDUSER, c.USER_NOM USERNOM, c.USER_PRENOM USERPRENOM, c.USER_TEL USERTEL, c.USER_FAX USERFAX, c.USER_EMAIL USEREMAIL
					FROM command c 
					LEFT JOIN command_product AS cp ON cp.IDCOMMAND = c.ID 
					LEFT JOIN product AS p ON p.ID = cp.PRODUCTID
					LEFT JOIN productchild AS pc ON pc.ID = cp.CHILDID
					WHERE c.STATUT = 10 
					GROUP BY c.REFERENCE
					ORDER BY c.DATESTART ASC";
			
			try {
				$picture = new Picture();
				 $sql = $picture->fetchAll('POSITION = 1');
				 $listpics = array();
				 foreach ($sql as $row) {
				 	$listpics[$row['IDPRODUCT']] = $row['URL'];
				 }
				 $this->view->listproductpicture = $listpics;
				 
				$this->view->statlistproduct = $product->getAdapter()->fetchAll($select);
				
				$this->view->statlistcommand = $command->getAdapter()->fetchAll($selectCommand);
				
				$this->view->statlistdevis = $command->getAdapter()->fetchAll($selectDevis);
				
			} catch (Exception $e) {
				
				$this->view->messageSuccess = "";
				$this->view->messageError = $e->getMessage();
			}
		}
	}
    
}



?>modules/backoffice/controllers/UserController.php000060400000053441150710367660016347 0ustar00<?php
class Backoffice_UserController extends Modules_Backoffice_Controllers_MainController
{

	function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "User";
		$this->isConnectedWithRole('isUser');
	}
	function indexAction()
	{
		$this->_forward('/list');

	}
	function newsletterAction() {
		$this->view->titlePage = "Envoyer une newsletter";
		$userNewsletter = new UserNewsletter();
		$listUser = $userNewsletter->select()->order('EMAIL ASC')->query()->fetchAll();

		$this->view->listMail = $listUser;

		$from = $this->newsletter_Mail;
		$this->view->messageFrom = $from;

		if ($this->getRequest()->isPost()) {

			$body = $this->getRequest()->getPost('mailMessage');
			$objet = $this->getRequest()->getPost('objetMessage');
			$from = $this->getRequest()->getPost('fromMessage');

			$this->view->messageBody = $body;
			$this->view->messageObjet = $objet;
			$this->view->messageFrom = $from;

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			$validatorEmail = new Zend_Validate();
			$validatorEmail -> addValidator(new Zend_Validate_EmailAddress());

			if ($validator->isValid($body) && $validator->isValid($objet) && $validatorEmail->isValid($from)) {
					
				if ($this->getRequest()->getPost('email') == 'All') {
					foreach ($listUser as $row) {
						$mail = new Zend_Mail();
						$mess = $body;
						//$mess = $body."<br><br> Pour vous d�sinscrire � la newsletter de ".$this->siteName.", <a href='XXXXXX/user/newsletter/nltr_quit/".$row['CODE']."' >cliquer ici</a>";
						
						
						$mail->setBodyHtml($mess);
						$mail->setFrom($from, $this->siteName);
						$mail->addTo($row['EMAIL']);
						$mail->setSubject($objet);
						try {
							$mail->send();
							$this->log("Les emails ont �t� envoy�s",'info');
							$this->view->messageSuccess = "Les emails ont �t� envoy�s";
						} catch (Zend_Exception $e) {
							$this->log($e->getMessage(),'err');
							$this->view->messageError = "Les emails n'ont pas �t� envoy�s";
						}
					}

				} else {
					$isExist = $userNewsletter->fetchRow("EMAIL = '".$this->getRequest()->getPost('email')."'");
					if ($isExist) {
						$mail = new Zend_Mail();
						$mess = $body;
						$mail->setBodyHtml($mess);
						$mail->setFrom($from, $this->siteName);
						$mail->addTo($isExist['EMAIL']);
						$mail->setSubject($objet);
						try {
							$mail->send();
							$this->view->messageSuccess = "L'email a �t� envoy�";
							$this->log("L'email � �t� envoy� : ".$isExist['EMAIL'],'info');
						} catch (Zend_Exception $e) {
							$this->log($e->getMessage(),'err');
							$this->view->messageError = "L'email n'a pas �t� envoy� : ".$isExist['EMAIL'];
						}
					}
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
				foreach ($validatorEmail->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}

		}
	}

	function searchAction()
	{
		$this->view->titlePage = "Recherche avanc�e des clients";
		$adminNamespace = $this->getSession();
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		//Gestion des tris
		$table = 'NOM';
		$tri = 'ASC';

		if ($this->_request->getParam('col'))
		{
			$adminNamespace->triUserCol = $this->_request->getParam('col');
			($adminNamespace->triUserSens == 'ASC') ? $adminNamespace->triUserSens = 'DESC' : $adminNamespace->triUserSens = 'ASC';
		}
		if (isset($adminNamespace->triUserCol)) {
			$table = $adminNamespace->triUserCol;
			$tri = $adminNamespace->triUserSens;
		}
		
		$this->view->listSearch = array();
		if ($this->_request->isPost()) {
			$post = $this->_request->getPost();
			
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());
			if ($validator->isValid($post['searchValue'])) {
				$recherche = '%'.$post['searchValue'].'%';
	
				$this->view->titlePage .= " : ".$post['searchValue'];
				//Appel model pour listing
				$user = new User();
				$select = $user->select()
				->where('NOM LIKE ? ',$recherche)
				->orWhere('PRENOM LIKE ? ',$recherche)
				->orWhere('TEL LIKE ? ',$recherche)
				->orWhere('ADRESSE LIKE ? ',$recherche)
				->orWhere('EMAIL LIKE ? ',$recherche)
				->order($table.' '.$tri);
	
				$listusers = $user->fetchAll($select);
				$adminNamespace->searchUsers = $listusers;
	
				$this->view->listSearch = $listusers;
	
				if (count($listusers) == 0) {
					$this->view->messageError = "Aucun resultats";
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError =  $this->getErrorValidator($errorCode);
				}
			}
			
		} else {
			if (isset($adminNamespace->searchUsers) && !empty($adminNamespace->searchUsers)) {
				$this->view->listSearch = $adminNamespace->searchUsers;
			}
		}
	}

	function editAction() {
			
		$this->view->titlePage = "Modifier un client";
			
		$codeIntern = new CodeIntern();
		$this->view->listCodeIntern = $codeIntern->fetchAll();
			
		$id = (int)$this->_request->getParam('id');
		if ($id > 0) {
			$user = new User();
			$row = $user->getUserByID($id);
            
            $carteFidelite = new CarteFidelite();
            $this->view->listcommandfidelite = $carteFidelite->getCommandUserCarteFidelite($id);
            $this->view->userfidelite = $carteFidelite->getInfosByUser($id);
            
			$this->view->populateForm = $row;
			$this->getRemiseClient($row['ID'], $row['CODEINTERN']);

			$userCaddyType = new UserCaddyType();
			$this->view->caddyType = $userCaddyType->computeCaddyTypeByUser($row['ID'], true);
		}
	}

	function edituserAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			$validatorEmail = new Zend_Validate_EmailAddress();

			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$data = array (
			 		'ID' => $filter->filter($params['id']),
                    'NOM' => $filter->filter($params['lastname']), 
                    'PRENOM' => $filter->filter($params['firstname']),
                    'CIVILITE' => $filter->filter($params['civility']), 
                    'FONCTION' => $filter->filter($params['fct']), 
                    'RAISONSOCIAL' => $filter->filter($params['raisonsocial']), 
                    'ADRESSECOMPLETE' => $filter->filter($params['adressecomplete']),
                    'ADRESSE' => $filter->filter($params['adresse']), 
                    'CP' => $filter->filter($params['cp']), 
                    'VILLE' => $filter->filter($params['ville']), 
                    'PAYS' => $filter->filter($params['pays']),  
                    'DEPARTEMENT' => $filter->filter($params['departement']),  
                    'REGION' => $filter->filter($params['region']), 
                    'EMAIL' => $filter->filter($params['email']), 
                    'TEL' => $filter->filter($params['tel']), 
                    'FAX' => $filter->filter($params['fax']), 
                    'NUMCOMPTE' => $filter->filter($params['numcompte']),
                    'SIRET' => $filter->filter($params['siret']),
                    'NUMIDFISC' => $filter->filter($params['numidfisc']),
                    'CODEAPE' => $filter->filter($params['codeape']), 
                    'SECTACTIVITE' => $filter->filter($params['sectactivite']), 
                    'COMMENTAIRE' => $filter->filter($params['comm']), 
                    'CODEINTERN' => $filter->filter($params['cintern']), 
                    'MODEPAIEMENT' => $filter->filter($params['modepaiement']), 
                    'TYPE' => $filter->filter($params['typeuser']), 
                    'isCREDIT' => $filter->filter($params['iscredit']),
					'isRECEPFACTURE' => $filter->filter($params['isrecepfacture']));

			if ($validator->isValid($data['NOM']) &&
			$validator->isValid($data['PRENOM']) &&
			$validator->isValid($data['ADRESSE']) &&
			$validator->isValid($data['CP']) &&
			$validator->isValid($data['VILLE']) &&
			$validator->isValid($data['PAYS']) &&
			$validatorEmail->isValid($data['EMAIL'])
			) {
				try {

					$id = $data['ID'];

					if ( $id > 0) {
						$user = new User();
						$user->update($data, 'ID = '.$id);
						$this->log("Mise a jour de l'utilisateur : ".$id,'info');
					}
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "L'email existe d�j�";
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
				foreach ($validatorEmail->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}

		}
		$this->_forward('edit');
	}

	function getRemiseClient($id, $codeintern) {

		$promoUser = new PromoUser();

		$listUser = $promoUser->getRemiseByUserIDFull($id);
		if ($listUser) { $this->view->listUser = $listUser; }


		$listUserBrend = $promoUser->getRemiseByMarqueFull($id);
		if ($listUserBrend) {
			$this->view->listUserBrend = $listUserBrend;
		}


		$listCinternBrend = $promoUser->getRemiseByCodeInternMarqueFull($codeintern);
		if ($listCinternBrend) {
			$this->view->listCinternBrend = $listCinternBrend;
		}
	}
    
	function guestAction()
	{
        if ($this->FeatureProductSendDetail || $this->FeatureProductDocumentDownloadGuest) { 
    
		    $this->view->titlePage = "Gestion des invit�s";   
            
		    $userGuest = new UserGuest();
		    $select = $userGuest->select()->order('DATEINSERT desc');
			
		    $listusers = $userGuest->fetchAll($select);
			
		    $this->setPaginator($listusers, $this->_getParam('page',1), 50);
        } else {
		    $this->_forward('/list');
        }
	}

	function listAction()
	{
		$this->view->titlePage = "Gestion des clients";
		$adminNamespace = $this->getSession();
			
		//Gestion des tris
		$table = 'NOM';
		$tri = 'ASC';

		if ($this->_request->getParam('col'))
		{
			$adminNamespace->triUserCol = $this->_request->getParam('col');
			($adminNamespace->triUserSens == 'ASC') ? $adminNamespace->triUserSens = 'DESC' : $adminNamespace->triUserSens = 'ASC';
		}
		if (isset($adminNamespace->triUserCol)) {
			$table = $adminNamespace->triUserCol;
			$tri = $adminNamespace->triUserSens;
		}
			
		//Appel model pour listing
		$user = new User();
		$select = $user->select()
		->order($table.' '.$tri);
			
		$listusers = $user->fetchAll($select);
			
		$this->setPaginator($listusers, $this->_getParam('page',1), 50);
	}
	function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$user = new User();

					$user->delete('ID = '.$id);

					$this->view->messageSuccess = "L'utilisateur a ete supprime";

					$this->log("L'utilisateur a ete supprime ",'info');
				} catch (Zend_Exception $e) {

					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');

	}

	function banAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$user = new User();

					$data = array (
			 		'isBAN' => (int)$this->_request->getParam('ban'));

					$user->update($data, 'ID = '.$id);

					if ($data['isBAN']==0) {
						$this->view->messageSuccess = "L'utilisateur ne peut plus se connecter";
						$this->log("L'utilisateur ne peut plus se connecter : ".$id,'info');
					} else {
						$this->view->messageSuccess = "L'utilisateur peut se connecter";
						$this->log("L'utilisateur peut se connecter ".$id,'info');
					}

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');

	}

	function codeinterneAction() {
		$this->view->titlePage = "Gestion des codes internes";
		$codeintern = new CodeIntern();
		if ($this->_request->isPost() && (int)$this->_request->getParam('id') ==0) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			//get the form params
			$params = $this->_request->getPost();

			$data = array (
			 		'CODE' => $filter->filter($params['code']),
			 		'LABEL' => $filter->filter($params['label'])
			);

			if ($validator->isValid($data['CODE']) && $validator->isValid($data['LABEL'])) {
					
				try {

					$codeintern->insert($data);

					$this->view->messageSuccess = "Le code interne a �t� ajout�";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "Le code interne existe d�j�";

				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}

		}
		$this->view->listcodeintern = $codeintern->select()->order('CODE ASC')->query()->fetchAll();

	}
	function codeinterneeditAction()
	{
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
			
		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));

			$codeintern = new CodeIntern();

			//get the form params
			$params = $this->_request->getPost();

			$data = array (
			 		'CODE' => $filter->filter($params['code']),
			 		'LABEL' => $filter->filter($params['label']),
			 		'ID' => $filter->filter($params['id'])
			);

			if ($validator->isValid($data['CODE']) && $validator->isValid($data['LABEL'])
			) {
					
				try {
					$codeintern->update($data, 'ID = '.$data['ID']);

					$this->view->messageSuccess = "Le code interne a �t� modifi�";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "Le code interne existe d�j�";

					$this->_forward('codeinterne');
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('codeinterne');
	}
	function codeinternedelAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$codeintern = new CodeIntern();
					$sql = 'SELECT u.NOM NOM, u.PRENOM PRENOM, u.ID IDUSER, uci.ID IDCODEINTERN, uci.CODE CODEINTERN
					FROM user_cintern uci 
					LEFT JOIN user AS u ON u.CODEINTERN = uci.ID
					WHERE u.CODEINTERN = '.$id ;
					$isExistCode = $codeintern->getAdapter()->fetchRow($sql);
					if (!$isExistCode) {
							
						$codeintern->delete('ID = '.$id);

						$this->view->messageSuccess = "Le code interne a �t� supprim�";
					} else {
						$this->view->messageError = "Le code interne est utilis� par : <b>".$isExistCode['NOM']." ".$isExistCode['PRENOM']."</b>";
					}
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
					$this->_forward('codeinterne');
				}
			}
		}
		$this->_forward('codeinterne');
	}

	function panieraddAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
			
		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			$params = $this->getRequest()->getPost();
			$productChild = new ProductChild();

			$reference = $filter->filter($params['reference']);
			$remiseeuro = (int)$params['remiseeuro'];
			$remisepour = (int)$params['remisepour'];
			$id = (int)$params['id'];
			$isOK = true;
			if ($remiseeuro > 0 && $remisepour > 0) {
				$this->view->messageError = "La remise est soit en EURO, soit en POURCENTAGE. ";
				$isOK = false;
			}
			if ($remiseeuro == 0 && $remisepour == 0) {
				$this->view->messageError = "La remise est soit en EURO, soit en POURCENTAGE et est obligatoire. ";
				$isOK = false;
			}
			if (($validator->isValid($remiseeuro) || $validator->isValid($remisepour)) && $isOK == true && $validator->isValid($reference)) {
				$isExistChild = $productChild->fetchRow("REFERENCE = '".$reference."'");
				if ($isExistChild) {
					$userCaddyType = new UserCaddyType();
					$isExistCaddy =  $userCaddyType->fetchRow("REFERENCE = '".$reference."' AND USERID = ".$id);

					if ($isExistCaddy) {
						$data = array (
 		 						'REFERENCE' => $reference, 
								'REMISEEURO' => $remiseeuro,
						 		'REMISEPOUR' => $remisepour,
						 		'isACTIF' => 'Y' 
						 		);
						 		$userCaddyType->update($data, "REFERENCE = '".$reference."' AND USERID = ".$id);
					} else {
						$data = array (
 		 						'REFERENCE' => $reference,
								'USERID' => $id,
								'REMISEEURO' => $remiseeuro,
						 		'REMISEPOUR' => $remisepour,
						 		'isACTIF' => 'Y' 
						 		);
						 		$userCaddyType->insert($data);
					}


					$this->view->messageSuccess = "La r�f�rence : ".$data['REFERENCE']." a �t� ajout�e. ";
				} else {
					$this->view->messageError = "La r�f�rence : <b>".$reference."</b> n'existe pas. ";
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError =  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('/edit');
	}

	function paniereditAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
			
		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			$params = $this->getRequest()->getPost();
			$idcaddy = (int)$params['idcaddy'];
			$iduser = (int)$params['id'];
			$remiseeuro = (int)$params['remiseeuro'];
			$remisepour = (int)$params['remisepour'];

			$isOK = true;
			if ($remiseeuro > 0 && $remisepour > 0) {
				$this->view->messageError = "La remise est soit en EURO, soit en POURCENTAGE. ";
				$isOK = false;
			}
			if ($isOK == true && $idcaddy > 0) {
				$userCaddyType = new UserCaddyType();
				$data = array ('REMISEEURO' => $remiseeuro,
						 		'REMISEPOUR' => $remisepour,
						 		'isACTIF' => 'Y');
				$userCaddyType->update($data, "ID = ".$idcaddy);
				$this->view->messageSuccess = "La r�f�rence a �t� modifi�e. ";
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('/edit');
	}

	function panierdelAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		if ($this->_request->isPost()) {
			$params = $this->getRequest()->getPost();
			$idcaddy = (int)$params['idcaddy'];
			if ($idcaddy > 0) {
				try {
					$userCaddyType = new UserCaddyType();
					$result = $userCaddyType->delete("ID = ".$idcaddy);

					$this->view->messageSuccess = "L'article du panier a �t� supprim�";

					$this->log("L'article du panier a �t� supprim�",'info');
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/edit');
	}

	function panieractiveAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		if ($this->_request->isPost()) {
			$params = $this->getRequest()->getPost();
			$idcaddy = (int)$params['idcaddy'];
			if ($idcaddy > 0) {
				try {
					$userCaddyType = new UserCaddyType();
					$data = array ( 'isACTIF' => $params['isActif'] );
					$result = $userCaddyType->update($data, "ID = ".$idcaddy);

					$this->view->messageSuccess = "L'article du panier a �t� modifi�";

					$this->log("L'article du panier a �t� modifi�",'info');

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/edit');
	}

	function panieractiveallAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		if ($this->_request->isPost()) {
			$params = $this->getRequest()->getPost(); 
			$idUser = (int)$params['id'];
			if ($idUser > 0) {
				try {
					$user = new User();
					$data = array ( 'isCADDYTYPE' => $params['isActif'] );
					$result = $user->update($data, "ID = ".$idUser);

					$this->view->messageSuccess = "Les articles du panier ont �t� modifi�s";

					$this->log("Les articles du panier ont �t� modifi�s",'info');

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/edit');
	}
}
?>modules/backoffice/controllers/SupplierController.php000060400000046770150710367660017243 0ustar00<?php
class Backoffice_SupplierController extends Modules_Backoffice_Controllers_MainController
{
	
	function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "Supplier";
		$this->isConnectedWithRole('isSupplier');
	}
	function indexAction()
	{
		$this->_forward('/list');
		
	}
	function searchAction()
	{
		 $this->view->titlePage = "Rechercher un Fournisseur";
		$adminNamespace = $this->getSession();	 
	    $this->view->messageSuccess = "";
		$this->view->messageError = "";
		
	    
	    if ($this->getRequest()->isPost()) {
			$post = $this->getRequest()->getPost();
			
			
			$recherche = '%'.$post['searchValue'].'%';
			
			$this->view->titlePage .= " : ".$post['searchValue']; 
			//Appel model pour listing
			$supplier = new Supplier();
			$supplierBrend = new SupplierBrend();
			
			if ($post['searchType'] != 'BREND') {
	    		$select = $supplier->select()
	    				->where($post['searchType'].' LIKE ? ',$recherche)
	    				->order($post['searchType'].' ASC ');
	    		$listsuppliers = $supplier->fetchAll($select)->toArray();
			} else {
				$select = "SELECT s.*
					 FROM supplier AS s
						LEFT JOIN supplier_brend AS sb ON sb.IDSUPPLIER = s.ID";
						if (!empty($post['searchType'])) {
							$select .= " WHERE sb.".$post['searchType']." LIKE '".$recherche."' ";
						}
						
				$select .= " ORDER BY BREND ASC";
				$listsuppliers = $supplier->getAdapter()->fetchAll($select);
			}
			
			$this->view->listsupplierCount = count($listsuppliers);
			$this->view->listsupplier = $listsuppliers;
			
			if ($this->view->listsupplierCount == 0) {
				$this->view->messageError = "Aucun resultats";
			}
	    } 
	}
	function editbrendAction () {
		
		if ($this->getRequest()->isPost()) {
		 //get the form params
			$params = $this->getRequest()->getPost();
			//filtres pour changer les chaines
		 	$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
					->addFilter(new Zend_Filter_StringTrim());
		 	
			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
					   -> addValidator(new Zend_Validate_StringLength(2));
	
            $isShowBrendPage = (int)$params['isshowbrendpage'];
                       
			//Refractor the params
			$dataBrend = array (
			 		'BREND' => $filter->filter($params['brend']),
			 		'IS_SHOW_BREND_PAGE' => $isShowBrendPage
			);
             
			$supplierBrend = new SupplierBrend();
			$supplier = new Supplier();
			
		 	if ($validator->isValid($dataBrend['BREND'])) {
		 		
			 	try {
			 		$isExistBrend = $supplierBrend->fetchRow("BREND LIKE '".$dataBrend['BREND']."' AND ID <> ".$params['idBrend']);
		 		 	
			 		if (!$isExistBrend) {
			 			$supplierBrend->update($dataBrend, 'ID = '.$params['idBrend']);
				 	 	$this->view->messageSuccess = "La marque a �t� modif�e";
			 		} else {
			 			$this->view->messageError = "La marque existe d�j�";
			 		}
			 	
			 	} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				    $this->view->messageError = "La marque existe d�j�";
		    	 	
				}
		 	} else {		 		
			 	foreach ($validator->getErrors() as $errorCode) {
			 		 $this->view->messageError =  $this->getErrorValidator($errorCode);
			    }
		 	}
		 	$this->view->populateFormSupplier = $supplier->fetchRow('ID = '.$params['id']);
	 		$this->view->populateFormBrend = $supplierBrend->fetchAll('IDSUPPLIER = '.$params['id'])->toArray();
		 }
		 
		$this->render('/edit');	
	}
	
	
	function addbrendAction () {
		
		if ($this->getRequest()->isPost()) {
		 //get the form params
			$params = $this->getRequest()->getPost();
			//filtres pour changer les chaines
		 	$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
					->addFilter(new Zend_Filter_StringTrim());
		 	
			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
					   -> addValidator(new Zend_Validate_StringLength(2));
	
				   
			//Refractor the params
			$dataBrend = array (
			 		'BREND' => $filter->filter($params['brend']),
			 		'IDSUPPLIER' => $filter->filter($params['id']),
					'URL' => ''
			);
			$supplierBrend = new SupplierBrend();
			$supplier = new Supplier();
			
		 	if ($validator->isValid($dataBrend['BREND'])) {
		 		
			 	try {
			 		
			 		
			 		$isExistBrend = $supplierBrend->fetchRow("BREND LIKE '".$dataBrend['BREND']."'");
		 		 	
			 		if (!$isExistBrend) {
			 			if (!empty($_FILES['picture']['name'])) {
			 				$url = $this->uploadNewPicsGetURL('picture');
					 	 	 if ($url != false) {
					 	 	 	$dataBrend['URL'] = $url;
					 	 	 }
			 			}
			 			
				 	 	 $supplierBrend->insert($dataBrend);
				 	 	$this->view->messageSuccess = "La marque a �t� ajout�e";
			 		} else {
			 			$this->view->messageError = "La marque existe d�j�";
			 		}
			 	
			 	} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				    $this->view->messageError = "La marque existe d�j�";
		    	 	
				}
		 	} else {		 		
			 	foreach ($validator->getErrors() as $errorCode) {
			 		 $this->view->messageError =  $this->getErrorValidator($errorCode);
			    }
		 	}
		 	$this->view->populateFormSupplier = $supplier->fetchRow('ID = '.$params['id']);
	 		$this->view->populateFormBrend = $supplierBrend->fetchAll('IDSUPPLIER = '.$params['id'])->toArray();
		 }
		 
		$this->render('/edit');	
	}
	
	function delbrendAction() {
		
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		$supplier = new Supplier();
		$supplierBrend = new SupplierBrend();
		if ($this->getRequest()->isPost('delBrendForm')) {
		
			$params = $this->getRequest()->getPost();
			
			try {
				$product = new Product(); 	 
				
				$isExistProduct = $product->fetchRow("IDBREND = ".$params['idBrend']);
		 		 	
			 		if (!$isExistProduct) {
			    		$supplierBrend->delete('ID = '.$params['idBrend']);
			    		
			    		$this->view->messageSuccess = "La marque a �t� supprim�e";
			 		} else {
			 			$this->view->messageError = "La marque est utilis�e par un produit : <b>".$isExistProduct['NOM']."</b>";
			 		}
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
		 		$this->view->messageError = $e->getMessage();    
			}
			$this->view->populateFormSupplier = $supplier->fetchRow('ID = '.$params['id']);
	 		$this->view->populateFormBrend = $supplierBrend->fetchAll('IDSUPPLIER = '.$params['id'])->toArray();
		 }
		 
		$this->render('/edit');
	}
function editAction()
    {
    	
		$this->view->titlePage = "Modifier un fournisseur";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		 
		//filtres pour changer les chaines
		 	$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
					->addFilter(new Zend_Filter_StringTrim());
		 	
		//valideurs pour les chaines
		$validator = new Zend_Validate();
		$validator -> addValidator(new Zend_Validate_NotEmpty());
	
		$validatorEmail = new Zend_Validate_EmailAddress();
    	
		$supplier = new Supplier();	
		$supplierBrend = new SupplierBrend();

		if ($this->getRequest()->isPost() && $this->getRequest()->getPost('company')) {
		 	
			//get the form params
			$params = $this->_request->getPost();
			
			//Refractor the params
			$dataSupplier = array (
			 		'NOM' => $filter->filter($params['nom']),
			 		'PRENOM' => $filter->filter($params['prenom']),
			 		'COMPANY' => $filter->filter($params['company']),
			 		'ADDRESSE' => $filter->filter($params['address']),
			 		'CP' => $filter->filter($params['cp']),
			 		'VILLE' => $filter->filter($params['ville']),
			 		'EMAIL' => $filter->filter($params['email']),
			 		'TEL' => $filter->filter($params['tel']),
			 		'FAX' => $filter->filter($params['fax']),
			 		'DESCRIPTIONSHORT' => $filter->filter($params['descshort']),
			 		'DESCRIPTIONLONG' => $params['desclong']
			);
			
		 	if ($validator->isValid($dataSupplier['NOM']) &&
			 	$validator->isValid($dataSupplier['PRENOM']) &&
			 	$validator->isValid($dataSupplier['COMPANY']) &&
			 	$validatorEmail->isValid($dataSupplier['EMAIL']) 
		 	) {
		 		
			 	try {
			 		
			 	 $id = (int)$params['id'];
			 	 
			 	 if ( $id > 0) {
			 	 	
		 		 		$isExistSupplier = $supplier->fetchRow("COMPANY LIKE '".$dataSupplier['COMPANY']."' AND ID <> ".$id);
		 		 		
		 		 		if (!$isExistSupplier) {
				 	 		$url = $this->uploadNewPicsGetURL('picture');
					 		if ($url != false) {
						 		$dataSupplier['URL'] = $url;
						 		$supplier->update($dataSupplier,'ID = '.$id);
						 		 $this->view->messageSuccess = "Le fournisseur a �t� modifi�, l'image a �t� upload�e"; 
					 		} else {
					 			 $supplier->update($dataSupplier, 'ID = '.$id);
					 			 $this->view->messageSuccess = "Le fournisseur a �t� modifi�"; 
					 		}	
		 		 		}  else {
					 		 $this->view->messageError= "Le fournisseur existe d�j�"; 
		 		 		} 	
			 	 }
			 	} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
		    	 	$this->view->populateFormSupplier = $dataSupplier;
			    
				}
		 	} else {		 		
			 	foreach ($validator->getErrors() as $errorCode) {
			 		 $this->view->messageError =  $this->getErrorValidator($errorCode);
			    }
		 		foreach ($validatorEmail->getErrors() as $errorCode) {
			 		 $this->view->messageError =  $this->getErrorValidator($errorCode);
			    }
			   $this->view->populateFormSupplier = $dataSupplier;
		 	}
		 	
		 }
			 if ($this->getRequest()->getParam('id')) {
			 	$id = (int)$this->getRequest()->getParam('id');
			 }
	     	if ($this->getRequest()->isPost('addBrendForm') ||
				 $this->getRequest()->isPost('editSupplierForm') 
			 ) { 
				$params = $this->_request->getPost();
			 	$id = $params['id'];
			 }
		 	if ($id>0) {
		 		$this->view->populateFormSupplier = $supplier->fetchRow('ID = '.$id);
		 		$this->view->populateFormBrend = $supplierBrend->fetchAll('IDSUPPLIER = '.$id)->toArray();
		 	}
    }
    
	function addAction()
    {
    	
		$this->view->titlePage = "Ajouter un fournisseur";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		
		 if ($this->_request->isPost('addSupplierForm')) {
		 	
		 	//filtres pour changer les chaines
		 	$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
					->addFilter(new Zend_Filter_StringTrim());
		 	
			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());
			//valideurs pour FILE
			$validatorFile = new Zend_Validate();
			$validatorFile -> addValidator(new Zend_Validate_File_Exists())
					   -> addValidator(new Zend_Validate_File_IsImage());
					   
			$validatorEmail = new Zend_Validate_EmailAddress();
			 	   
			//get the form params
			$params = $this->_request->getPost();
			
			//Refractor the params
			$dataSupplier = array (
			 		'NOM' => $filter->filter($params['lastname']),
			 		'PRENOM' => $filter->filter($params['firstname']),
			 		'COMPANY' => $filter->filter($params['company']),
			 		'ADDRESSE' => $filter->filter($params['address']),
			 		'CP' => $filter->filter($params['cp']),
			 		'VILLE' => $filter->filter($params['ville']),
			 		'EMAIL' => $filter->filter($params['email']),
			 		'TEL' => $filter->filter($params['tel']),
			 		'FAX' => $filter->filter($params['fax']),
					'URL' => ''
			);
			$dataBrend = array (
			 		'BREND' => $filter->filter($params['brend']),
					'URL' => '',
					'IDSUPPLIER' => ''
			);
		 	if (
		 		$validator->isValid($dataBrend['BREND']) &&
		 		$validator->isValid($dataSupplier['NOM']) &&
			 	$validator->isValid($dataSupplier['PRENOM']) &&
			 	$validator->isValid($dataSupplier['COMPANY']) &&
			 	$validatorEmail->isValid($dataSupplier['EMAIL']) 
		 	) {
		 		 	try {
		 		 		$supplier = new Supplier();
		 		 		$supplierBrend = new SupplierBrend();
		 		 		
		 		 		$isExistBrend = $supplierBrend->fetchRow("BREND LIKE '".$dataBrend['BREND']."'");
		 		 		$isExistSupplier = $supplier->fetchRow("COMPANY LIKE '".$dataSupplier['COMPANY']."'");
		 		 		
		 		 		if (!$isExistBrend && !$isExistSupplier) {
					 		$url = $this->uploadNewPicsGetURL('picture');
					 		if ($url != false) {
						 		$dataBrend['URL'] = $url;
						 		$dataSupplier['URL'] = $url;
					 		}	
						 	 
					    	 $supplier->insert($dataSupplier);
					    	 
					    	 $lastid = $supplier->getAdapter()->lastInsertId();
					    	 $dataBrend['IDSUPPLIER'] = $lastid;
					    	 
					    	 
							 $supplierBrend->insert($dataBrend);
					    	
					    	 $this->view->messageSuccess = "Le fournisseur a �t� ajout�"; 
		 		 		} else {
		 		 			$this->view->messageError = "La marque ou le fournisseur existe d�j�"; 
					    	$this->view->populateFormSupplier = $dataSupplier;
					    	$this->view->populateFormBrend = $dataBrend;
		 		 		} 
				 	} catch (Zend_Exception $e) {
				 		
					$this->log($e->getMessage(),'err');
				    	$this->view->populateFormSupplier = $dataSupplier;
				    	$this->view->populateFormBrend = $dataBrend;
					}
		 	} else {		 		
			 	foreach ($validator->getErrors() as $errorCode) {
			 		 $this->view->messageError =  $this->getErrorValidator($errorCode);
			    }
		 		foreach ($validatorEmail->getErrors() as $errorCode) {
			 		 $this->view->messageError =  $this->getErrorValidator($errorCode);
			    }
		 		foreach ($validatorFile->getErrors() as $errorCode) {
			 		 $this->view->messageError =  $this->getErrorValidator($errorCode);
			    }
			    $this->view->populateFormSupplier = $dataSupplier;
			    $this->view->populateFormBrend = $dataBrend;
		 	}
		 	
		 }
    }
    
	function listAction()
	{
	    $this->view->titlePage = "Gestion des fournisseurs";
	    $adminNamespace = $this->getSession();	
	    
	    //Gestion des tris
    	$table = 'COMPANY';
		$tri = 'ASC';
		
	    if ($this->_request->getParam('col')) 
	    {
	    	$adminNamespace->triSupplierCol = $this->_request->getParam('col');
	    	($adminNamespace->triSupplierSens == 'ASC') ? $adminNamespace->triSupplierSens = 'DESC' : $adminNamespace->triSupplierSens = 'ASC';
	    } 
		 if (isset($adminNamespace->triSupplierCol)) {
	    	$table = $adminNamespace->triSupplierCol;
	    	$tri = $adminNamespace->triSupplierSens;
	    }
	    
	    //Appel model pour listing
		$supplier = new Supplier();
		
		$sql = "SELECT s.ID ID, s.COMPANY COMPANY,s.NOM NOM, s.PRENOM PRENOM, s.ADDRESSE ADDRESSE, s.CP CP, s.VILLE VILLE, s.EMAIL EMAIL, s.TEL TEL, s.FAX FAX,
					 s.URL URL
				FROM supplier AS s
				ORDER BY ".$table." ".$tri;
    	$result = $supplier->getAdapter()->fetchAll($sql);
	    
    	$this->view->listsupplier = $result;
	    
	}
	
	function delAction() {
		
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		
		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$product = new Product();
					$supplier = new Supplier();
					$supplierBrend = new SupplierBrend();
					
					$sql = "
						SELECT DISTINCT p.NOM NOMPRODUCT , sb.BREND BREND 
						FROM product AS p
						LEFT JOIN supplier_brend AS sb ON sb.ID = p.IDBREND
						LEFT JOIN supplier AS s ON s.ID = sb.IDSUPPLIER
						WHERE s.ID = ".$id;
					$isExistProduct = $product->getAdapter()->fetchRow($sql);
		 		 		
	 		 		if (!$isExistProduct) {
	 		 			$supplier->delete('ID = '.$id);
	    		
	 		 			$supplierBrend->delete('IDSUPPLIER = '.$id);
	    				$this->view->messageSuccess = "Le fournisseur a �t� supprim�";
	 		 		} else {
	 		 			$this->view->messageError = "La marque : <b>".$isExistProduct['BREND']."</b> poss�de des produits : <b>".$isExistProduct['NOMPRODUCT']."</b>";
			 		
	 		 		}
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
			 		$this->view->messageError = $e->getMessage();    
				}
			}
		}
		$this->_forward('/list');	
		
	}
	
function uploadNewPicsGetURL($nomTemp) {
		if(!empty($_FILES[$nomTemp]) && !empty($_FILES[$nomTemp]['name'])) {
			$nomOrigine = $_FILES[$nomTemp]['name'];
			$elementsChemin = pathinfo($nomOrigine);
			$extensionFichier = strtolower($elementsChemin['extension']);
			$extensionsAutorisees = array("jpg", "jpeg",  "gif", "png");
			if (!(in_array($extensionFichier, $extensionsAutorisees))) {
			    $this->view->messageError = "Le fichier n'a pas l'extension attendue";
			} else {    
			    // Copie dans le repertoire du script avec un nom
			    $repertoireDestination = 'items/supplier/';
				$this->checkDirectoryExist($repertoireDestination);

				$nomDestination = $this->generateNavigationString($elementsChemin['filename']).".".$extensionFichier;
                $fileoriginal = $repertoireDestination.$nomDestination;
			
			    if (move_uploaded_file($_FILES[$nomTemp]["tmp_name"],$fileoriginal)) {
			    	 	//Resize picture
                        $info = getimagesize($fileoriginal) ;
                        list($width_old, $height_old) = $info;
                        $maxwidth = $this->FeaturePictureResizeWidth;
                        $maxheight = $this->FeaturePictureResizeHeight;
                            
                        if ($width_old > $maxwidth || $height_old > $maxheight) {     
                            Utils_Tool::smart_resize_image($fileoriginal , null, $maxwidth , $maxheight , true , $fileoriginal , true , false ,50 );
                        }  
                        
						$data = array (
					 		'URL' => $fileoriginal
						);
			        	return $data['URL'];
			    	 
			    } else {
			        return false;
			    }
			}
		}
		
		return false;
	}

	
	function setpictureAction() {
		
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		
		if($this->_request->isPost()) {
			$params = $this->_request->getPost();
			$supplier = new Supplier();
			$supplierBrend = new SupplierBrend();
			try {
				$data = array (
				 		'URL' => $params['picture']
					);
					if ((int)$params['idSelected']>0) {
						$supplierBrend->update($data,'ID = '.$params['idSelected']);
		    			$this->view->messageSuccess = "L'image de la marque a �t� modifi�e";
					} else {
						$this->view->messageError = "Vous devez selectionner une marque";
					}
				
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
			 		$this->view->messageError = $e->getMessage();    
			}
			$this->view->populateFormSupplier = $supplier->fetchRow('ID = '.$params['id']);
	 		$this->view->populateFormBrend = $supplierBrend->fetchAll('IDSUPPLIER = '.$params['id'])->toArray();
		 }
		 
		$this->render('/edit');	
		
	}

	function erasepictureAction() {
		
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		
		if($this->_request->isPost()) {
			$params = $this->_request->getPost();
			$product = new Product();
			$supplier = new Supplier();
			$supplierBrend = new SupplierBrend();
			try {
				$sql = "
						SELECT DISTINCT p.NOM NOMPRODUCT , sb.BREND BREND 
						FROM product AS p
						LEFT JOIN supplier_brend AS sb ON sb.ID = p.IDBREND
						LEFT JOIN supplier AS s ON s.ID = sb.IDSUPPLIER
						WHERE sb.URL = '".$params['picture']."'";
				$isExistProduct = $product->getAdapter()->fetchRow($sql);
		 		 		
					
				if (!$isExistProduct) {
					unlink($params['picture']);
					$data = array (
			 		'URL' => ''
					);
					$supplierBrend->update($data,"URL = '".$params['picture']."'");
		    		
		    		$this->view->messageSuccess = "L'image a �t� supprim�e d�finitivement";	
				} else {	
					$this->view->messageError = "La marque : <b>".$isExistProduct['BREND']."</b> poss�de des produits : <b/>".$isExistProduct['NOMPRODUCT']."</b>";
			 		
				}
				
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
		 		$this->view->messageError = $e->getMessage();    
			}
		
			$this->view->populateFormSupplier = $supplier->fetchRow('ID = '.$params['id']);
	 		$this->view->populateFormBrend = $supplierBrend->fetchAll('IDSUPPLIER = '.$params['id'])->toArray();
		 }
		 
		$this->render('/edit');	
	}
}
?>modules/backoffice/controllers/AnnoncefooterController.php000060400000012273150710367660020227 0ustar00<?php
class Backoffice_AnnoncefooterController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Gestion des annonces en bas de page";
		$this->view->currentMenu = "AnnonceFooter";
		$this->isConnectedWithRole('isPromo');
	}
	public function indexAction()
	{
		$this->_forward('/list');
	}

	public function editAction()
	{
			
		$this->view->titlePage = "Modifier une annonce";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
			
		//filtres pour changer les chaines
		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		//valideurs pour les chaines
		$validator = new Zend_Validate();
		$validator -> addValidator(new Zend_Validate_NotEmpty())
		-> addValidator(new Zend_Validate_StringLength(3));

		$annonce = new AnnonceFooter();
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id>0) {
				$this->view->populateFormAnnonceFooter = $annonce->fetchRow('ID = '.$id);
			}
		}
		if ($this->getRequest()->isPost()) {

			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'ID' => (int)$params['id'],
			 		'TITRE' => $filter->filter($params['titre']),
			 		'CONTENT' => $params['content'],
			 		'isSHOW' => $params['isshow'],
					'CONT_NAME' => '',
					'CAT_ID' => ''
					);

					if (isset($params['controllername'])) {
						foreach($params['controllername'] as $value)
						{
							$dataAnnonce['CONT_NAME'] .= $value.";";
						}
					}
					if (isset($params['categorie'])) {
						foreach($params['categorie'] as $value)
						{
							$dataAnnonce['CAT_ID'] .= $value.";";
						}
					}

					if ($validator->isValid($dataAnnonce['TITRE']) &&
					$validator->isValid($dataAnnonce['CONTENT'])
					) {
						try {
							$id = (int)$params['id'];
							if ( $id > 0) {
									
								$annonce->update($dataAnnonce,'ID = '.$id);
								$this->view->messageSuccess = "L'annonce a �t� modifi�e";
								$this->view->populateFormAnnonceFooter = $annonce->fetchRow('ID = '.$id);
								$this->log("L'annonce a �t� modifi�e ".$id,'info');
							}
						} catch (Zend_Exception $e) {
							$this->log($e->getMessage(),'err');
							$this->view->populateFormAnnonceFooter = $dataAnnonce;
						}
					} else {
						foreach ($validator->getErrors() as $errorCode) {
							$this->view->messageError .=  $this->getErrorValidator($errorCode);
						}
						$this->view->populateFormAnnonceFooter = $dataAnnonce;
					}

		}
		$this->_forward('/list');
	}


	public function addAction()
	{
			
		$this->view->titlePage = "Ajouter une annonce";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'TITRE' => $filter->filter($params['titre']),
			 		'CONTENT' => $params['content'],
			 		'isSHOW' => $params['isshow'],
					'CONT_NAME' => '',
					'CAT_ID' => ''
					);
					if (isset($params['controllername'])) {
						foreach($params['controllername'] as $value)
						{
							$dataAnnonce['CONT_NAME'] .= $value.";";
						}
					}
					if (
					$validator->isValid($dataAnnonce['TITRE']) &&
					$validator->isValid($dataAnnonce['CONTENT'])
					) {
						try {
							$annonce = new AnnonceFooter();
							$annonce->insert($dataAnnonce);
							$this->view->messageSuccess = "L'annonce a �t� ajout�e";
							$this->log("L'annonce a �t� ajout�e",'info');
						} catch (Zend_Exception $e) {
							$this->log($e->getMessage(),'err');
							$this->view->populateFormAnnonceFooter = $dataAnnonce;
						}

					} else {
						foreach ($validator->getErrors() as $errorCode) {
							$this->view->messageError .=  $this->getErrorValidator($errorCode);
						}
						$this->view->populateFormAnnonceFooter = $dataAnnonce;
					}

		}
		$this->_forward('/list');
	}

	public function listAction()
	{
		$this->view->titlePage = "Gestion des annonces en bas de page";
			
		//Appel model pour listing
		$annonces = new AnnonceFooter();
		$result = $annonces->select()->order('isSHOW ASC')->order('TITRE ASC')->query()->fetchAll();
			
		$this->view->listannoncefooter = $result;
	}



	public function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$annonce = new AnnonceFooter();

					$annonce->delete('ID = '.$id);
					$this->view->messageSuccess = "L'annonce a �t� supprim�e";

					$this->log("L'annonce a �t� supprim�e",'info');
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');
	}

}
?>modules/backoffice/controllers/AnnonceController.php000060400000010457150710367660017012 0ustar00<?php
class Backoffice_AnnonceController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Administration";
 
		$this->isConnectedWithRole('isPromo');
	}
	public function indexAction()
	{
		$this->_forward('/list');
	}

	public function editAction()
	{
			
		$this->view->titlePage = "Modifier une Annonce";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
			
		//filtres pour changer les chaines
		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		//valideurs pour les chaines
		$validator = new Zend_Validate();
		$validator -> addValidator(new Zend_Validate_NotEmpty())
		-> addValidator(new Zend_Validate_StringLength(3));

		$annonce = new AnnonceContent();
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id>0) {
				$this->view->populateFormAnnonce = $annonce->fetchRow('ID = '.$id);
			}
		}
		if ($this->getRequest()->isPost()) {

			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'ID' => (int)$params['id'],
			 		'TITRE' => $filter->filter($params['titre']),
			 		'CONTENT' => $params['content'],
			 		'isSHOW' => $params['isshow']
			);

			if ($validator->isValid($dataAnnonce['TITRE']) &&
			$validator->isValid($dataAnnonce['CONTENT'])
			) {
				try {
					$id = (int)$params['id'];
					if ( $id > 0) {
							
						$annonce->update($dataAnnonce,'ID = '.$id);
						$this->view->messageSuccess = "L'annonce a �t� modifi�e";
						$this->view->populateFormAnnonce = $annonce->fetchRow('ID = '.$id);
					}
				} catch (Zend_Exception $e) {
					$this->view->populateFormAnnonce = $dataAnnonce;
					$this->log($e->getMessage(),'err');
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
				$this->view->populateFormAnnonce = $dataAnnonce;
			}

		}
		$this->_forward('/list');
	}

	public function addAction()
	{
			
		$this->view->titlePage = "Ajouter une Annonce";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'TITRE' => $filter->filter($params['titre']),
			 		'CONTENT' => $params['content'],
			 		'isSHOW' => $params['isshow']
			);
			if (
			$validator->isValid($dataAnnonce['TITRE']) &&
			$validator->isValid($dataAnnonce['CONTENT'])
			) {
				try {
					$annonce = new AnnonceContent();
					$annonce->insert($dataAnnonce);
					$this->view->messageSuccess = "L'annonce a �t� ajout�e";
				} catch (Zend_Exception $e) {
					$this->view->populateFormAnnonce = $dataAnnonce;
					$this->log($e->getMessage(),'err');
				}

			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
				$this->view->populateFormAnnonce = $dataAnnonce;
			}

		}
		$this->_forward('/list');
	}

	public function listAction()
	{
		$this->view->titlePage = "Listing des Annonces";
		$adminNamespace = $this->getSession();
		 
		//Appel model pour listing
		$annonces = new AnnonceContent();
		$result = $annonces->select()->order('isSHOW ASC')->order('TITRE ASC')->query()->fetchAll();
				 
		$this->view->listannonce = $result;		 
	}

	public function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$annonce = new AnnonceContent();

					$annonce->delete('ID = '.$id);
					$this->view->messageSuccess = "L'annonce a �t� supprim�e";

				} catch (Zend_Exception $e) {
					$this->view->messageError = $e->getMessage();
					$this->log($e->getMessage(),'err');
				}
			}
		}
		$this->_forward('/list');
	}

}
?>modules/backoffice/controllers/ProductglobalController.php000060400000024125150710367660020227 0ustar00<?php
class Backoffice_ProductglobalController extends Modules_Backoffice_Controllers_MainController
{

	function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "Promos";
		$this->isConnectedWithRole('isAdmin'); 
	}
	function indexAction()
	{
		$this->_forward('/list');
	}

	public function listAction() {
		$this->view->titlePage = "G�n�ralit�s";
		$promoCommand = new PromoCommand();

		$isFrais = $promoCommand->fetchAll('MONTANTFRAISCMD > 0 AND MONTANTFRAISCMD IS NOT NULL','MONTANTFRAISCMD ASC');
		if ($isFrais) {
			$this->view->remiseFrais = $isFrais;
		}
		$isValide = $promoCommand->fetchRow('MONTANTVALID > 0 AND MONTANTVALID IS NOT NULL');
		if ($isValide) {
			$this->view->validCommand = $isValide;
		}
		
		
		$supplierBrend = new SupplierBrend();
		$this->view->listbrend = $supplierBrend->fetchAll($supplierBrend->select()->order('BREND ASC'));
		
	}

	public function addpricecategoryAction() {
		if($this->_request->isPost()) {
			$params = $this->_request->getPost();
			try {
				$idCatSelected = $params['listcategory'];
				$pricesign = $params['pricesign'];
				$pricepour = $params['pricepour'];

				if ($idCatSelected != 'none') {
					$pricepour = intval($pricepour);
					if ($pricepour > 0) {
						$category = new Category();
						$dataID = "";
						if ($idCatSelected == 0) {
							$data = $category->fetchAll();
							foreach ($data as $row) {
								if ($dataID == "") {
									$dataID = $row['ID'];
								} else {
									$dataID .= " , ".$row['ID'];
								}
							}
						} else {
							$dataID = $category->getAllSubsIDByIDToString($idCatSelected);
						}

						$product = new Product();
						$productChild = new ProductChild();

						$listProducts = $product->fetchAll('IDCATEGORY IN ('.$dataID.')');
						foreach ($listProducts as $rowProduct) {
							$actualProductPrice = $rowProduct['PRIX'];
							if ($pricesign == '+') {
								$newProductPrice = $rowProduct['PRIX'] + (($rowProduct['PRIX'] * $pricepour) / 100);
							} else {
								$newProductPrice = $rowProduct['PRIX'] - (($rowProduct['PRIX'] * $pricepour) / 100);
							}
							$newProductPrice = sprintf("%.2f",$newProductPrice);
							$dataProductUpdated = array();
							$dataProductUpdated['PRIX'] = $newProductPrice;
							$product->update($dataProductUpdated,'ID = '.$rowProduct['ID']);
								
							$listChilds = $productChild->fetchAll('IDPRODUCT = '.$rowProduct['ID']);
							foreach ($listChilds as $rowChild) {
								$actualPrice = $rowChild['PRIX'];
								if ($pricesign == '+') {
									$newPrice = $rowChild['PRIX'] + (($rowChild['PRIX'] * $pricepour) / 100);
								} else {
									$newPrice = $rowChild['PRIX'] - (($rowChild['PRIX'] * $pricepour) / 100);
								}
								$newPrice = sprintf("%.2f",$newPrice);
								$dataChildUpdated = array();
								$dataChildUpdated['PRIX'] = $newPrice;
								$productChild->update($dataChildUpdated,'ID = '.$rowChild['ID']);
							}

						}

						if ($pricesign == '+') {
							$this->view->messageSuccess = "Les produits ont �t� augment�s de ".$pricesign.$pricepour." % ";
						} else {
							$this->view->messageSuccess = "Les produits ont �t� diminu�s de ".$pricesign.$pricepour." % ";
						}
					} else {
						$this->view->messageError = "Le pourcentage doit �tre sup�rieur � 0";
					}
				} else {
					$this->view->messageError = "Une cat�gorie doit �tre s�lectionn�e";
				}


			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
		$this->_forward('list');
	}

	public function addpricebrendAction() {
		if($this->_request->isPost()) {
			$params = $this->_request->getPost();
			try {
				$idBrendSelected = $params['listbrend'];
				$pricesign = $params['pricesign'];
				$pricepour = $params['pricepour'];

				if ($idBrendSelected != 'none') {
					$pricepour = intval($pricepour);
					if ($pricepour > 0) {
						
						$product = new Product();
						$productChild = new ProductChild();

						$listProducts = $product->fetchAll('IDBREND = '.$idBrendSelected);
						foreach ($listProducts as $rowProduct) {
							$actualProductPrice = $rowProduct['PRIX'];
							if ($pricesign == '+') {
								$newProductPrice = $rowProduct['PRIX'] + (($rowProduct['PRIX'] * $pricepour) / 100);
							} else {
								$newProductPrice = $rowProduct['PRIX'] - (($rowProduct['PRIX'] * $pricepour) / 100);
							}
							$newProductPrice = sprintf("%.2f",$newProductPrice);
							$dataProductUpdated = array();
							$dataProductUpdated['PRIX'] = $newProductPrice;
							$product->update($dataProductUpdated,'ID = '.$rowProduct['ID']);
								
							$listChilds = $productChild->fetchAll('IDPRODUCT = '.$rowProduct['ID']);
							foreach ($listChilds as $rowChild) {
								$actualPrice = $rowChild['PRIX'];
								if ($pricesign == '+') {
									$newPrice = $rowChild['PRIX'] + (($rowChild['PRIX'] * $pricepour) / 100);
								} else {
									$newPrice = $rowChild['PRIX'] - (($rowChild['PRIX'] * $pricepour) / 100);
								}
								$newPrice = sprintf("%.2f",$newPrice);
								$dataChildUpdated = array();
								$dataChildUpdated['PRIX'] = $newPrice;
								$productChild->update($dataChildUpdated,'ID = '.$rowChild['ID']);
							}

						}

						if ($pricesign == '+') {
							$this->view->messageSuccess = "Les produits ont �t� augment�s de ".$pricesign.$pricepour." % ";
						} else {
							$this->view->messageSuccess = "Les produits ont �t� diminu�s de ".$pricesign.$pricepour." % ";
						}
					} else {
						$this->view->messageError = "Le pourcentage doit �tre sup�rieur � 0";
					}
				} else {
					$this->view->messageError = "Une marque doit �tre s�lectionn�e";
				}


			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
		
		$this->_forward('list');
	}
	
	function commandaddAction() {
    try {
		if ($this->getRequest()->isPost()) {
	
			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());
	
			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());
	
	
			$promoCommand = new PromoCommand();
			$productChild = new ProductChild();
	
			$params = array();
			$params = $this->getRequest()->getPost();
	
			if ($params['remise'] == '5') {
				if (isset($params['montantfrais']) && (int)$params['montantfrais'] > 0 && $validator->isValid($params['montantfrais'])) {
					$isExistFrais = $promoCommand->fetchRow("MONTANTVALID IS NOT NULL");
					if ($isExistFrais) {
						$date = new Zend_Date();
	
						$data = array (
								'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
								'MONTANTVALID' => $filter->filter($params['montantfrais'])
						);
						$promoCommand->update($data,'ID = '.$isExistFrais['ID']);
	
						$this->view->messageSuccess = "La validit� de la commande a �t� modifi�e ";
	
					} else {
						$date = new Zend_Date();
	
						$data = array (
								'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
								'MONTANTVALID' => $filter->filter($params['montantfrais'])
						);
						$promoCommand->insert($data);
						$this->view->messageSuccess = "La validit� de la commande a �t� modifi�e ";
					}
				} else {
					$this->view->messageError = "Le montant de la commande doit etre sup�rieur � 0";
				}
			}
			if (isset($params['remisepour']) && isset($params['remiseeuro'])) {
					 
			    $remiseeuro = !empty($params['remiseeuro']) ? $params['remiseeuro'] : 0;
				$remisepour = (int)$params['remisepour'];
				$isOK = true;
				if ($remiseeuro > 0 && $remisepour > 0) {
					$this->view->messageError = "La remise est soit en EURO, soit en POURCENTAGE. ";
					$isOK = false;
				}
				if ($remiseeuro == 0 && $remisepour == 0) {
					$this->view->messageError = "La remise est soit en EURO, soit en POURCENTAGE et est obligatoire. ";
					$isOK = false;
				}
				if (($validator->isValid($remiseeuro) ||
						$validator->isValid($remisepour)) && $isOK == true
				) {
					switch ($params['remise']) {
						case 4 :
							if (isset($params['montantfrais']) && (int)$params['montantfrais'] > 0) {
								$isExistFrais = $promoCommand->fetchRow("MONTANTFRAISCMD IS NOT NULL AND MONTANTFRAISCMD = ".$params['montantfrais']);
								if ($isExistFrais) {
									$date = new Zend_Date();
	
									$data = array (
											'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
											'MONTANTFRAISCMD' => $filter->filter($params['montantfrais']),
											'REMISEEURO' => $remiseeuro,
											'REMISEPOUR' => $remisepour
									);
									$promoCommand->update($data,'ID = '.$isExistFrais['ID']);
	
									$this->view->messageSuccess = "Les frais de livraison sont modifi�s ";
	
								} else {
									$date = new Zend_Date();
	
									$data = array (
											'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
											'MONTANTFRAISCMD' => $filter->filter($params['montantfrais']),
											'REMISEEURO' => $remiseeuro,
											'REMISEPOUR' => $remisepour
									);
									$promoCommand->insert($data);
									$this->view->messageSuccess = "Les frais de livraison sont modifi�s ";
								}
							} else {
								$this->view->messageError = "Le montant de la commande doit etre sup�rieur � 0";
							}
							break;
						default:
							$this->_forward('command');
							break;
	
					}
				} else {
					foreach ($validator->getErrors() as $errorCode) {
						$this->view->messageError .=  $this->getErrorValidator($errorCode);
					}
				}
			}
		}
            } catch (Zend_Exception $e) {
				$this->log($e->getMessage(),'err');
			$this->view->messageError = "V�rifier les param�tres";
		}
		$this->_forward('list');
		
	}
	function commanddelAction() {
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id > 0 ) {
				$promoCommand = new PromoCommand();
				$promoCommand->delete('ID = '.$id);
				$this->view->messageSuccess = "La configuration � �t� supprim�e ";
			} else {
				$this->view->messageError = "La configuration n'a pas �t� supprim�e ";
	
			}
		}
		$this->_forward('list');
	}
}
?>modules/backoffice/controllers/AnnoncecontentController.php000060400000010654150710367660020404 0ustar00<?php
class Backoffice_AnnoncecontentController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "AnnonceContent";
		$this->isConnectedWithRole('isPromo');
	}
	public function indexAction()
	{
		$this->_forward('/list');
	}

	public function editAction()
	{
			
		$this->view->titlePage = "Modifier une annonce";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
			
		//filtres pour changer les chaines
		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		//valideurs pour les chaines
		$validator = new Zend_Validate();
		$validator -> addValidator(new Zend_Validate_NotEmpty());

		$annonce = new AnnonceContent();
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id>0) {
				$this->view->populateFormAnnonce = $annonce->fetchRow('ID = '.$id);
			}
		}
		if ($this->getRequest()->isPost()) {

			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'ID' => (int)$params['id'],
			 		'TITRE' => $filter->filter($params['titre']),
			 		'CONTENT' => $params['content'],
			 		'isSHOW' => $params['isshow']
			);

			if ($validator->isValid($dataAnnonce['TITRE']) &&
			$validator->isValid($dataAnnonce['CONTENT'])
			) {
				try {
					$id = (int)$params['id'];
					if ( $id > 0) {
							
						$annonce->update($dataAnnonce,'ID = '.$id);
						$this->view->messageSuccess = "L'annonce a �t� modifi�e";
						$this->view->populateFormAnnonce = $annonce->fetchRow('ID = '.$id);
						$this->log("L'annonce a �t� modifi�e : ".$id,'info');
					}
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->populateFormAnnonce = $dataAnnonce;
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError =  $this->getErrorValidator($errorCode);
				}
				$this->view->populateFormAnnonce = $dataAnnonce;
			}

		}
		$this->_forward('/list');
	}

	public function addAction()
	{
			
		$this->view->titlePage = "Ajouter une annonce";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'TITRE' => $filter->filter($params['titre']),
			 		'CONTENT' => $params['content'],
			 		'isSHOW' => $params['isshow']
			);
			if (
			$validator->isValid($dataAnnonce['TITRE']) &&
			$validator->isValid($dataAnnonce['CONTENT'])
			) {
				try {
					$annonce = new AnnonceContent();
					$annonce->insert($dataAnnonce);
					$this->view->messageSuccess = "L'annonce a �t� ajout�e";
					$this->log("L'annonce a �t� ajout�e",'info');
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->populateFormAnnonce = $dataAnnonce;
				}

			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError =  $this->getErrorValidator($errorCode);
				}
				$this->view->populateFormAnnonce = $dataAnnonce;
			}

		}
		$this->_forward('/list');
	}

	public function listAction()
	{
		$this->view->titlePage = "Gestion des publicit�s sur la page d'accueil";
		$adminNamespace = $this->getSession();
			
		//Appel model pour listing
		$annonces = new AnnonceContent();
		$result = $annonces->select()->order('isSHOW ASC')->order('TITRE ASC')->query()->fetchAll();
			
		$this->view->listannonce = $result;
	}

	public function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$annonce = new AnnonceContent();

					$annonce->delete('ID = '.$id);
					$this->view->messageSuccess = "L'annonce a �t� supprim�e";
					$this->log("L'annonce a �t� supprim�e",'info');
				} catch (Zend_Exception $e) {
					$this->view->messageError = $e->getMessage();
					$this->log($e->getMessage(),'err');
				}
			}
		}
		$this->_forward('/list');
	}

}
?>modules/backoffice/controllers/AdminController.php000060400000017302150710367660016455 0ustar00<?php

class Backoffice_AdminController extends Modules_Backoffice_Controllers_MainController
{

	function init()
	{
		$this->view->title = "Administration";  
		$this->view->currentMenu = "Admin";
		$this->isConnectedWithRole('isAdmin');
	}
	function indexAction()
	{
		$this->_forward('/list');

	}
	function setroleAction()
	{
		if ($this->_request->isPost()) {
				
			$params = $this->_request->getPost();
			if ($params['roletype'] == 'isPromo') { $data = array('isPROMO' => $params['rolevalue']); }
			if ($params['roletype'] == 'isCategory') { $data = array('isCATEGORY' => $params['rolevalue']); }
			if ($params['roletype'] == 'isCommand') { $data = array('isCOMMAND' => $params['rolevalue']); }
			if ($params['roletype'] == 'isProduct') { $data = array('isPRODUCT' => $params['rolevalue']); }
			if ($params['roletype'] == 'isSupplier') { $data = array('isSUPPLIER' => $params['rolevalue']); }
			if ($params['roletype'] == 'isUser') { $data = array('isUSER' => $params['rolevalue']); }
			if ($params['roletype'] == 'isAdmin') { $data = array('isADMIN' => $params['rolevalue']); }
			if ($params['roletype'] == 'isFooter') { $data = array('isFOOTER' => $params['rolevalue']); }
			if ($params['roletype'] == 'isStats') { $data = array('isSTATS' => $params['rolevalue']); }
				
			$id = $params['idadmin'];
				
			try {
				if ( $id > 0) {
					$admin = new Admin();

					$admin->update($data, 'ID = '.$id);
				}
			} catch (Zend_Exception $e) {
				$this->view->messageError = $e->getMessage();
					$this->log($e->getMessage(),'err');
				$this->_forward('/list');
			}
		}
		$this->_forward('/list');
	}
	function listAction()
	{
		$this->view->titlePage = "Gestion des administrateurs";
		$adminNamespace = $this->getSession();
	  
		//Gestion des tris
		$table = 'NOM';
		$tri = 'ASC';

		if ($this->_request->getParam('col'))
		{
			$adminNamespace->triAdminCol = $this->_request->getParam('col');
			($adminNamespace->triAdminSens == 'ASC') ? $adminNamespace->triAdminSens = 'DESC' : $adminNamespace->triAdminSens = 'ASC';
		}
		if (isset($adminNamespace->triAdminCol)) {
			$table = $adminNamespace->triAdminCol;
			$tri = $adminNamespace->triAdminSens;
		}
	  
		//Appel model pour listing
		$admin = new Admin();
		$select = $admin->select()->where("Login <> 'Maintenance'")->order($table.' '.$tri);
	  
		$this->view->listadmins = $admin->fetchAll($select);
	  
	}

	function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$admin = new Admin();

					$admin->delete('ID = '.$id);

					$this->view->messageSuccess = "L'administrateur � �t� supprim�";
					$this->log("L'administrateur a ete supprime",'info');
				} catch (Zend_Exception $e) {
					$this->view->messageError = $e->getMessage();
					$this->log($e->getMessage(),'err');
				}
			}
		}
		$this->_forward('/list');

	}

	function editAction()
	{
		 
		$this->view->titlePage = "Modifer un administrateur";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
			

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			$validatorEmail = new Zend_Validate_EmailAddress();

			//get the form params
			$params = $this->_request->getPost();
				
			//Refractor the params
			$dataTemp = array (
			 		'NOM' => $filter->filter($params['lastname']),
			 		'ID' => $filter->filter($params['id']),
			 		'PRENOM' => $filter->filter($params['firstname']),
			 		'LOGIN' => $filter->filter($params['login']),
			 		'EMAIL' => $filter->filter($params['email'])
			);
			 
			$mdp = $filter->filter($params['editpassword']);
			$mdp2 = $filter->filter($params['editpassword2']);
			
				
			if ($validator->isValid($dataTemp['NOM']) &&
			$validator->isValid($dataTemp['PRENOM']) &&
			$validator->isValid($dataTemp['LOGIN']) &&
			$validatorEmail->isValid($dataTemp['EMAIL'])
			) {
					
				$data = array (
			 		'NOM' => $dataTemp['NOM'],
			 		'PRENOM' => $dataTemp['PRENOM'],
			 		'LOGIN' => $dataTemp['LOGIN'],
			 		'EMAIL' => $dataTemp['EMAIL']
				);
				
				if ($validator->isValid($mdp) && $validator->isValid($mdp2) &&
				     ($mdp == $mdp2)) {
					$data['MDP'] =  md5($mdp);
				}
			
			
				try {

					$id = $dataTemp['ID'];
					 
					if ( $id > 0) {
						$admin = new Admin();
							
						$n = $admin->update($data, 'ID = '.$id);
						 
						$this->log('Update : '.$n.' : '.$data['NOM'].' '.$data['PRENOM'],'info');
						 
						$this->_forward('/list');
					}
				} catch (Zend_Exception $e) {

					$this->view->messageError = "L'email ou le login existe d�j�";
					 
					$this->log($e->getMessage(),'err');
					 
					$this->view->populateForm = $dataTemp;
					 
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError =  $this->getErrorValidator($errorCode);
				}
				foreach ($validatorEmail->getErrors() as $errorCode) {
					$this->view->messageError =  $this->getErrorValidator($errorCode);
				}
				$this->view->populateForm = $dataTemp;
			}

		} else {
			//populate form
			$id = (int)$this->_request->getParam('id');
			 
			if ($id > 0) {
				$admin = new Admin();
				$row = $admin->fetchRow('ID = '.$id);
				$this->view->populateForm = $row->toArray();
			}
		}
	}

	function addAction()
	{
		 
		$this->view->titlePage = "Ajouter un administrateur";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
			
		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			$validatorEmail = new Zend_Validate_EmailAddress();

			//get the form params
			$params = $this->_request->getPost();
				
			//Refractor the params
			$mdp = $filter->filter($params['addpassword']);
			$mdp2 = $filter->filter($params['addpassword2']);
				
			$dataTemp = array (
			 		'NOM' => $filter->filter($params['lastname']),
			 		'PRENOM' => $filter->filter($params['firstname']),
			 		'LOGIN' => $filter->filter($params['addlogin']),
			 		'EMAIL' => $filter->filter($params['email'])
			);
				
			if ($validator->isValid($dataTemp['NOM']) &&
			$validator->isValid($dataTemp['PRENOM']) &&
			$validator->isValid($dataTemp['LOGIN']) &&
			$validatorEmail->isValid($dataTemp['EMAIL']) &&
			$validator->isValid($mdp) &&
			$validator->isValid($mdp2) &&
			($mdp == $mdp2)
			) {
					
				$data = array (
			 		'NOM' => $dataTemp['NOM'],
			 		'PRENOM' => $dataTemp['PRENOM'],
			 		'LOGIN' => $dataTemp['LOGIN'],
			 		'MDP' => md5($mdp),
			 		'EMAIL' => $dataTemp['EMAIL'],
			 		'ROLE' => '100'
			 		);
			 		try {
			 			$admin = new Admin();
			 			$admin->insert($data);

			 			$this->view->messageSuccess = "L'administrateur a �t� ajout�";
			 			$this->log("L'administrateur a �t� ajout�",'info');
			 		} catch (Zend_Exception $e) {

			 			$this->view->messageError = "L'email ou le login existe d�j�";
			 			$this->log($e->getMessage(),'err');
			 			$this->view->populateForm = $dataTemp;
			 		}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError =  $this->getErrorValidator($errorCode);
				}
				foreach ($validatorEmail->getErrors() as $errorCode) {
					$this->view->messageError =  $this->getErrorValidator($errorCode);
				}
				$this->view->populateForm = $dataTemp;
			}

		}
	}

}
?>modules/backoffice/controllers/ToolController.php000060400000006510150710367660016341 0ustar00<?php

class Backoffice_ToolController extends Modules_Backoffice_Controllers_MainController
{

	function init() {	}

	function redactorlistpicturesAction() {
		$repertoireDestination = "/items/datas/images/";
		$array = array();
		try {
			$scanned_directory = array_diff(scandir($_SERVER['DOCUMENT_ROOT'].$repertoireDestination), array('..', '.'));
			foreach ($scanned_directory as $image) {
				$path = $repertoireDestination.$image;
				array_push($array, array("thumb" => $path, "image" => $path, "title" => $image));
			}

		} catch (Exception $e) {
			$array = array( 'error' => $e->getMessage());
			$this->log($e->getMessage(),'err');
		}
		echo Zend_Json::encode($array);

		exit();
	}


	function redactoruploadpicturesAction() {
		$repertoireDestination = "/items/datas/images/";
		$array = array();

		try {
			if(!empty($_FILES['file']) && !empty($_FILES['file']['name'])) {
				$nomOrigine = $_FILES['file']['name'];
				$elementsChemin = pathinfo($nomOrigine);
				$extensionFichier = strtolower($elementsChemin['extension']);
				$extensionsAutorisees = array("jpeg", "jpg", "gif", "png");
				if (!(in_array($extensionFichier, $extensionsAutorisees))) {
					$array = array( 'error' => "Extension attendue : jpeg, jpg, gif, png");
				} else {
					if (move_uploaded_file($_FILES["file"]["tmp_name"],$_SERVER['DOCUMENT_ROOT'].$repertoireDestination.$nomOrigine)) {
						$array = array(
							'filelink' => $repertoireDestination.$nomOrigine,
							'filename' => $nomOrigine
						);
					} else {
						$array = array( 'error' => "Impossible d'enregistrer l'image");
					}
				}
			}
		} catch (Exception $e) {
			$array = array( 'error' => $e->getMessage());
			$this->log($e->getMessage(),'err');
		}
		echo Zend_Json::encode($array);

		exit();
	}


	function redactorlistfilesAction() {
		$repertoireDestination = "/items/datas/fichiers/";
		$array = array();
		try {
			$scanned_directory = array_diff(scandir($_SERVER['DOCUMENT_ROOT'].$repertoireDestination), array('..', '.'));
			foreach ($scanned_directory as $image) {
				$path = $repertoireDestination.$image;
				array_push($array, array("thumb" => $path, "image" => $path, "title" => $image));
			}

		} catch (Exception $e) {
			$array = array( 'error' => $e->getMessage());
			$this->log($e->getMessage(),'err');
		}
		echo Zend_Json::encode($array);

		exit();
	}
	
	function redactoruploadfilesAction() {
		$repertoireDestination = "/items/datas/fichiers/";
		$array = array();

		try {
			if(!empty($_FILES['file']) && !empty($_FILES['file']['name'])) {
				$nomOrigine = $_FILES['file']['name'];
				$elementsChemin = pathinfo($nomOrigine);
				$extensionFichier = strtolower($elementsChemin['extension']);
				$extensionsAutorisees = array("pdf");
				if (!(in_array($extensionFichier, $extensionsAutorisees))) {
					$array = array( 'error' => "Extension attendue : pdf");
				} else {
					if (move_uploaded_file($_FILES["file"]["tmp_name"],$_SERVER['DOCUMENT_ROOT'].$repertoireDestination.$nomOrigine)) {
						$array = array(
							'filelink' => $repertoireDestination.$nomOrigine,
							'filename' => $nomOrigine
						);
					} else {
						$array = array( 'error' => "Impossible d'enregistrer le fichier");
					}
				}
			}

		} catch (Exception $e) {
			$array = array( 'error' => $e->getMessage());
			$this->log($e->getMessage(),'err');
		}
		echo Zend_Json::encode($array);

		exit();
	}
}
?>modules/backoffice/controllers/BlogCategoryController.php000060400000014766150710367660020021 0ustar00<?php
class Backoffice_BlogCategoryController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Administration"; 
		$this->view->currentMenu = "BlogCategory";
	}
    function indexAction()
	{
		$this->_forward('/list');

	}

	function listAction()
	{
		try {
		    $this->view->titlePage = "Gestion des cat�gories du blog";
            
		    $blogCategory = new BlogCategory();
            $this->view->listallblogcategories = $blogCategory->AllCategories(0);
        } catch (Zend_Exception $e) { 
			$this->view->messageError = $e->getMessage();
			$this->log($e->getMessage(),'err');
		}
	}
    function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$category = new BlogCategory();
					if ($category->fetchRow('id_parent = '.$id)) {
						$this->view->messageError = 'Cette cat�gorie est parente';
					} else {
						$subject = new BlogSubject();
						$select = $subject->fetchRow('id_category = '.$id);
						if ($select) {
							$this->view->messageError = 'Cette cat�gorie est utilis�e par le sujet : <b>'.$select->title."<b/>";
						} else {

							$category->delete('id = '.$id); 
							$this->view->messageSuccess = "La cat�gorie du blog a et� supprim�e";
							$this->log("La cat�gorie du blog a et� supprim�e",'info');

						}
					}
				}
                catch (Zend_Exception $e) {
					$this->view->messageError = $e->getMessage();
					$this->log($e->getMessage(),'err');
				}
			}
		}
		$this->_forward('/list');

	} 
	public function addAction()
	{
        $data = array ( 
                 'is_publish' => 0, 
                 'is_close' => 0, 
                 'title' => "",
                 'sub_title' => "",
                 'message' => ""
        );
		try {
            $blogCategory = new BlogCategory();
            $this->view->listallblogcategories = $blogCategory->AllCategories(0);
		    $this->view->titlePage = "Ajouter une cat�gorie";
		    $this->view->messageSuccess = "";
		    $this->view->messageError = ""; 
		    if ($this->_request->isPost()) {
 
		        //filtres pour changer les chaines
		        $filter = new Zend_Filter();
		        $filter	->addFilter(new Zend_Filter_StripTags())
		        ->addFilter(new Zend_Filter_StringTrim());
             
		        //get the form params
		        $params = $this->_request->getPost();

		        //Refractor the params
		        $data = array ( 
			 	        'is_publish' =>  (int)$params['is_publish'], 
			 	        'title' => $filter->filter($params['title']),
			 	        'message' => $params['message'],
			 	        'sub_title' => $params['sub_title'],
			 	        'is_close' =>  (int)$params['is_close'],
                        'date_updated' => date('Y-m-d H:i:s') ,
                        'id_parent' => (int)$params['idparent'] 
		        );  
			    $validator = new Zend_Validate();
			    $validator -> addValidator(new Zend_Validate_NotEmpty());
                 if (
			    $validator->isValid($data['title']) && 
                $data['id_parent'] > 0
			    ) { 
				        $blogCategory->insert($data);
				        $this->view->messageSuccess = "La cat�gorie a �t� ajout�e"; 
                        $data['title'] = "";
                        $data['sub_title'] = "";
                        $data['message'] = "";
                 } else {
                     foreach ($validator->getErrors() as $errorCode) {
                         $this->view->messageError .=  $this->getErrorValidator($errorCode);
                     }
                     if ($data['id_parent'] == 0) {
                         $this->view->messageError .= "Choisissez une cat�gorie parente.";
                     }
                 } 
            }
		}
        catch (Zend_Exception $e) { 
			$this->log($e->getMessage(),'err');
        } 
		$this->view->populateData = $data; 
	}
    
    public function editAction()
	{
        $data = array ( 
                 'is_publish' => 0, 
                 'is_close' => 0, 
                 'title' => "",
                 'sub_title' => "",
                 'message' => ""
        );
		try {
		    $blogCategory = new BlogCategory();
            $this->view->listallblogcategories = $blogCategory->AllCategories(0);
		    $this->view->titlePage = "Modifier une cat�gorie";
		    $this->view->messageSuccess = "";
		    $this->view->messageError = "";
			
		    //filtres pour changer les chaines
		    $filter = new Zend_Filter();
		    $filter	->addFilter(new Zend_Filter_StripTags())
		    ->addFilter(new Zend_Filter_StringTrim());
         
		    if ($this->getRequest()->getParam('id')) {
			    $id = (int)$this->getRequest()->getParam('id');
			    if ($id>0) {
				    $this->view->populateData = $blogCategory->fetchRow('ID = '.$id);
			    }
		    }
		    if ($this->getRequest()->isPost()) {

			    //get the form params
			    $params = $this->_request->getPost();

			    //Refractor the params
			    $data = array ( 
                        'id' => (int)$params['id'],
			 	        'is_publish' =>  (int)$params['is_publish'], 
			 	        'title' => $filter->filter($params['title']),
			 	        'message' => $params['message'],
			 	        'sub_title' => $params['sub_title'],
			 	        'is_close' =>  (int)$params['is_close'],
                        'date_updated' => date('Y-m-d H:i:s') ,
                        'id_parent' => (int)$params['idparent'] 
		        );  
                $this->view->populateData = $data;

			    $validator = new Zend_Validate();
			    $validator -> addValidator(new Zend_Validate_NotEmpty());
                 if (
			    $validator->isValid($data['title']) 
			    ) { 
				    $id = (int)$params['id'];
				    if ( $id > 0) {
							
					    $blogCategory->update($data,'ID = '.$id); 
					    $this->view->messageSuccess = "La cat�gorie a �t� modifi�e";
					    $this->view->populateData = $blogCategory->fetchRow('ID = '.$id);
				    }
                 } else {
                     foreach ($validator->getErrors() as $errorCode) {
                         $this->view->messageError .=  $this->getErrorValidator($errorCode);
                     }
                     if ($data['id_parent'] == 0) {
                         $this->view->messageError .= "Choisissez une cat�gorie parente.";
                     }
                 } 
		    }
        }
        catch (Zend_Exception $e) {
            $this->view->populateData = $data;
            $this->log($e->getMessage(),'err');
        } 
	}

}
?>modules/backoffice/controllers/BlogSubjectController.php000060400000016475150710367660017642 0ustar00<?php
class Backoffice_BlogSubjectController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Administration"; 
		$this->view->currentMenu = "BlogSubject";
	}
    function indexAction()
	{
		$this->_forward('/search');

	}
     
    public function searchAction()
	{
        $this->view->titlePage = "Rechercher un sujet";  
		$data = array (  
			 	'title' => "",
			 	'is_publish' => 0,
			 	'is_close' => 0, 
			 	'id_category' => 0
		);
        $blogCategory = new BlogCategory();
        $this->view->listallblogcategories = $blogCategory->AllCategories(0); 
        $this->view->listallsubjects = array();
        try { 
        
		    if ($this->_request->isPost()) { 
                //filtres pour changer les chaines
                $filter = new Zend_Filter();
                $filter	->addFilter(new Zend_Filter_StripTags())
                ->addFilter(new Zend_Filter_StringTrim());

                //get the form params
                $params = $this->_request->getPost();

                //Refractor the params
                $data = array (  
                         'title' => $filter->filter($params['title']),
                         'is_publish' => (int)$params['is_publish'],
                         'is_close' => (int)$params['is_close'],
                         'id_category' => (int)$params['id_category']
                ); 
                
                $blogSubject = new BlogSubject(); 
                $this->view->listallsubjects = $blogSubject->getPostBySearch($data);  
		    }
		    $this->view->populateData = $data; 
        } catch (Zend_Exception $e) {
            $this->view->populateData = $data;
            $this->log($e->getMessage(),'err');
        } 
    }


    function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try { 
					$subject = new BlogSubject(); 
					$subject->delete('id = '.$id); 
					$this->view->messageSuccess = "Le sujet a et� supprim�";
					$this->log("Le sujet a et� supprim�",'info'); 
				}
                catch (Zend_Exception $e) {
					$this->view->messageError = $e->getMessage();
					$this->log($e->getMessage(),'err');
				}
			}
		}
		$this->_forward('/list');

	} 
	public function addAction()
	{
        $data = array ( 
                 'is_publish' => 0, 
                 'is_close' => 0, 
                 'title' => "",
                 'sub_title' => "",
                 'message' => "", 
                 'id_category' => 0
        );
		try {
            $blogCategory = new BlogCategory();
            $this->view->listallblogcategories = $blogCategory->AllCategories(0);
		    $this->view->titlePage = "Ajouter un sujet";
		    $this->view->messageSuccess = "";
		    $this->view->messageError = ""; 
		    if ($this->_request->isPost()) {
 
		        //filtres pour changer les chaines
		        $filter = new Zend_Filter();
		        $filter	->addFilter(new Zend_Filter_StripTags())
		        ->addFilter(new Zend_Filter_StringTrim());
             
		        //get the form params
		        $params = $this->_request->getPost();

		        //Refractor the params
		        $data = array ( 
			 	        'is_publish' =>  (int)$params['is_publish'], 
			 	        'title' => $filter->filter($params['title']),
			 	        'message' => $params['message'],
			 	        'sub_title' => $params['sub_title'],
			 	        'is_close' =>  (int)$params['is_close'],
                        'date_updated' => date('Y-m-d H:i:s') ,
                        'id_category' => (int)$params['id_category'] 
		        );  
			    $validator = new Zend_Validate();
			    $validator -> addValidator(new Zend_Validate_NotEmpty());
                 if (
			    $validator->isValid($data['title']) && 
                $data['id_category'] > 0
			    ) { 
                        $blogSubject = new BlogSubject();
				        $blogSubject->insert($data);
				        $this->view->messageSuccess = "Le sujet a �t� ajout�"; 
                        $data['title'] = "";
                        $data['sub_title'] = "";
                        $data['message'] = "";
                 } else {
                     foreach ($validator->getErrors() as $errorCode) {
                         $this->view->messageError .=  $this->getErrorValidator($errorCode);
                     }
                     if ($data['id_category'] == 0) {
                         $this->view->messageError .= "Choisissez une cat�gorie.";
                     }
                 } 
            }
		}
        catch (Zend_Exception $e) { 
			$this->log($e->getMessage(),'err');
        } 
		$this->view->populateData = $data; 
	}
    
    public function editAction()
	{
        $data = array ( 
                 'is_publish' => 0, 
                 'is_close' => 0, 
                 'title' => "",
                 'sub_title' => "",
                 'message' => "", 
                 'id_category' => 0
        );
		try {
		    $blogCategory = new BlogCategory();
            $blogSubject = new BlogSubject();
            $this->view->listallblogcategories = $blogCategory->AllCategories(0);
		    $this->view->titlePage = "Modifier un sujet";
		    $this->view->messageSuccess = "";
		    $this->view->messageError = "";
			
		    //filtres pour changer les chaines
		    $filter = new Zend_Filter();
		    $filter	->addFilter(new Zend_Filter_StripTags())
		    ->addFilter(new Zend_Filter_StringTrim());
         
		    if ($this->getRequest()->getParam('id')) {
			    $id = (int)$this->getRequest()->getParam('id');
			    if ($id>0) {
				    $this->view->populateData = $blogSubject->fetchRow('ID = '.$id);
			    }
		    }
		    if ($this->getRequest()->isPost()) {

			    //get the form params
			    $params = $this->_request->getPost();

			    //Refractor the params
			    $data = array ( 
                        'id' => (int)$params['id'],
			 	        'is_publish' =>  (int)$params['is_publish'], 
			 	        'title' => $filter->filter($params['title']),
			 	        'message' => $params['message'],
			 	        'sub_title' => $params['sub_title'],
			 	        'is_close' =>  (int)$params['is_close'],
                        'date_updated' => date('Y-m-d H:i:s') ,
                        'id_category' => (int)$params['id_category'] 
		        );  
                $this->view->populateData = $data;

			    $validator = new Zend_Validate();
			    $validator -> addValidator(new Zend_Validate_NotEmpty());
                 if ( $validator->isValid($data['title'])  ) { 
				    $id = (int)$params['id'];
				    if ( $id > 0) { 
					    $blogSubject->update($data,'ID = '.$id); 
					    $this->view->messageSuccess = "Le sujet a �t� modifi�.";
					    $this->view->populateData = $blogSubject->fetchRow('ID = '.$id);
				    }
                 } else {
                     foreach ($validator->getErrors() as $errorCode) {
                         $this->view->messageError .=  $this->getErrorValidator($errorCode);
                     }
                     if ($data['id_category'] == 0) {
                         $this->view->messageError .= "Choisissez une cat�gorie.";
                     }
                 } 
		    }
        }
        catch (Zend_Exception $e) {
            $this->view->populateData = $data;
            $this->log($e->getMessage(),'err');
        } 
	}

}
?>modules/backoffice/controllers/AnnoncecmsController.php000060400000012744150710367660017516 0ustar00<?php
class Backoffice_AnnoncecmsController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "AnnonceCms";
		$this->isConnectedWithRole('isCategory');
	}
	public function indexAction()
	{
		$this->_forward('/list');
	}

	public function editAction()
	{
			
		$this->view->titlePage = "Modifier un article";
			
		//filtres pour changer les chaines
		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		//valideurs pour les chaines
		$validator = new Zend_Validate();
		$validator -> addValidator(new Zend_Validate_NotEmpty())
		-> addValidator(new Zend_Validate_StringLength(3));

		$annonce = new AnnonceCms();
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id>0) {
				$this->view->populateFormAnnonceCms = $annonce->fetchRow('ID = '.$id);
			}
		}
		
		if ($this->getRequest()->isPost()) {

			//get the form params
			$params = $this->_request->getPost();
            
			//Refractor the params
			$dataAnnonce = array (
			 		'ID' => (int)$params['id'],
			 		'NOM' => $filter->filter($params['nom']),
			 		'CONTENT' => $params['content'],
			 		'CONTENT_SHORT' => $filter->filter($params['content_short']),
			 		'CONTENT_LONG' => $params['content_long'],
			 		'POSITION' => (int) $filter->filter($params['position']),
			 		'isSHOW' => $params['isshow'],
					'ID_CATS' => ''
					);
					
					if (isset($params['categories'])) {
						foreach($params['categories'] as $value)
						{
							$dataAnnonce['ID_CATS'] .= ":".$value.":";
						}
					}
					if ($validator->isValid($dataAnnonce['NOM']) &&
					$validator->isValid($dataAnnonce['CONTENT'])&&
					!empty($dataAnnonce['ID_CATS'])
					) {
						try {
							$id = (int)$params['id'];
							if ( $id > 0) {
									
								$annonce->update($dataAnnonce,'ID = '.$id);
								$this->view->messageSuccess = "L'article a �t� modifi�";
								$this->view->populateFormAnnonceCms = $annonce->fetchRow('ID = '.$id);
								$this->log("L'article a �t� modifi� ".$id,'info');
							}
						} catch (Zend_Exception $e) {
							$this->log($e->getMessage(),'err');
							$this->view->populateFormAnnonceCms = $dataAnnonce;
						}
					} else {
						foreach ($validator->getErrors() as $errorCode) {
							$this->view->messageError .=  $this->getErrorValidator($errorCode);
						}
						$this->view->populateFormAnnonceCms = $dataAnnonce;
					}

		}
	}


	public function addAction()
	{
			
		$this->view->titlePage = "Ajouter un article";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'NOM' => $filter->filter($params['nom']),
			 		'CONTENT' => $params['content'],
			 		'CONTENT_SHORT' => $filter->filter($params['content_short']),
			 		'CONTENT_LONG' => $params['content_long'],
			 		'POSITION' => (int) $filter->filter($params['position']),
			 		'isSHOW' => $params['isshow'],
					'ID_CATS' => ''
					);
					
					if (isset($params['categories'])) {
						foreach($params['categories'] as $value)
						{
							$dataAnnonce['ID_CATS'] .= ":".$value.":";
						}
					}
					
					if (
					$validator->isValid($dataAnnonce['NOM']) &&
					$validator->isValid($dataAnnonce['CONTENT']) &&
					!empty($dataAnnonce['ID_CATS'])
					) {
						try {
							$annonce = new AnnonceCms();
							$annonce->insert($dataAnnonce);
							$this->view->messageSuccess = "L'article a �t� ajout�";
							$this->log("L'article a �t� ajout�",'info');
							
					        $lastid = $annonce->getAdapter()->lastInsertId();
							 
                            $this->_request->setParam('id', $lastid);
		                    $this->_forward('/edit'); 
							
						} catch (Zend_Exception $e) {
							$this->log($e->getMessage(),'err');
							$this->view->populateFormAnnonceCms = $dataAnnonce;
						}

					} else {
						foreach ($validator->getErrors() as $errorCode) {
							$this->view->messageError .=  $this->getErrorValidator($errorCode);
						}
						$this->view->populateFormAnnonceCms = $dataAnnonce;
					}

		}
	}

	public function listAction()
	{
		$this->view->titlePage = "Gestion des articles"; 
			
		//Appel model pour listing
		$annonces = new AnnonceCms();
		$result = $annonces->getAllAnnonces();

		$category = new Category();
		$this->view->listallcategories = $category->getAllCategoriesByID(0);
		
		$this->view->listAnnoncecms = $result;
	}



	public function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$annonce = new AnnonceCms();

					$annonce->delete('ID = '.$id);
					$this->view->messageSuccess = "L'article a �t� supprim�";

					$this->log("L'article a �t� supprim�",'info');
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');
	}

}
?>modules/backoffice/controllers/ProductoptionlistController.php000060400000010362150710367660021171 0ustar00<?php
class Backoffice_ProductoptionlistController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Administration";

		$this->isConnectedWithRole('isProduct'); 
	}
	public function indexAction()
	{
		$this->_forward('/option');

	}
public function optionAction() {
		$this->view->titlePage = "Gestion des caract�ristiques s�lectionnable";
		$this->view->currentMenu = "Option";
		
		$optionList = new OptionList();
		if ($this->_request->isPost() && (int)$this->_request->getParam('id') ==0) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			//get the form params
			$params = $this->_request->getPost();

			$values = explode(",", $params['value']);
			$result = "";
			foreach ($values as $value) {
				$valTemp = $filter->filter($value);
				if (!empty($valTemp)) {
					if (empty($result))  {
						$result .= $filter->filter($valTemp);
					} else {
						$result .= "::".$filter->filter($valTemp);
					}
				}
			}	
						
			$data = array (
			 		'NAME' => $filter->filter($params['name']),
			 		'VALUE' => $result
			);

			if ($validator->isValid($data['NAME']) && $validator->isValid($data['VALUE'])) {

				try { 
					$optionList->insert($data); 
					$this->view->messageSuccess = "La caract�ristique a �t� ajout�e"; 
				} catch (Zend_Exception $e) { 
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "La caract�ristique existe d�j�"; 
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			} 
		} 
		$this->view->listoption = $optionList->getAll();
	}
	public function optioneditAction()
	{
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			//get the form params
			$params = $this->_request->getPost();
			
			$values = explode(",", $params['value']);
			$result = "";
			foreach ($values as $value) {
				$valTemp = $filter->filter($value);
				if (!empty($valTemp)) {
					if (empty($result))  {
						$result .= $filter->filter($valTemp);
					} else {
						$result .= "::".$filter->filter($valTemp);
					}
				}
			}	
			
			$data = array (
			 		'NAME' => $filter->filter($params['name']),
			 		'VALUE' => $result,
			 		'ID' => $filter->filter($params['id'])
			);

			if ($validator->isValid($data['NAME']) && $validator->isValid($data['VALUE']) ) {

				try {
					$optionList = new OptionList();
					$optionList->update($data, 'ID = '.$data['ID']);

					$this->view->messageSuccess = "La caract�ristique a �t� modifi�e";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "La caract�ristique existe d�ja";

					$this->_forward('option');
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('option');
	}
	public function optiondelAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try { 
					$optionList = new OptionList();
					$isExistProduct = $optionList->getProductByIdOption($id); 
					if (!$isExistProduct) { 
						$optionList->delete('ID = '.$id);

						$this->view->messageSuccess = "La caract�ristique a �t� supprim�e";
					} else {
						$this->view->messageError = "La caract�ristique est utilis�e par : <b/>".$isExistProduct['NOM']."</b>";
					}
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
					$this->_forward('/option');
				}
			}
		}
		$this->_forward('/option');
	}
	
}
?>modules/backoffice/controllers/CsvController.php000060400000105322150710367660016160 0ustar00<?php
class Backoffice_CsvController extends Modules_Backoffice_Controllers_MainController
{

	function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "Export";
		$this->isConnectedWithRole('isStats');
	}
	function indexAction()
	{
		$this->_forward('/export');
	}
    
	function exporthelloAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender();


			$this->view->titlePage = "Exporter le fichier CSV";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";


			$fichier = new FichierExcel();
			$fichier->Colonne("Nom du produit;Description du produit;Lien image du produit;Url vers la fiche produit sur le site du client;Lien vers une documentation sur le produit au format pdf;Identifiant unique du produit;Mot cl� 1;Mot cl� 2;Mot cl� 3;Mot cl� 4;Mot cl� 5;Mot cl� 6;Mot cl� 7;Mot cl� 8;Mot cl� 9;Mot cl� 10;Prix HT en �;Domaine d'utilisation;Marque du produit;Frais de port;Delai de livraison;Garantie;Disponibilit�;Quantit� minimum;EAN");

			$sql = "SELECT p.ID ID, p.NOM NOM, p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.DESCRIPTIONLONG DESCLONG, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
					p.DOCNAME DOCNAME, p.DOCURL DOCURL, p.IDBREND IDBREND,
					p.isPROMO isPROMO, pic.URL URLIMAGE, sb.BREND BREND, sb.URL BRENDURL, p.IDCATEGORY IDCATEGORY, c.NOM CATEGORYNOM, c.NAVNOM CATEGORYNAV, 
					p.DESCRIPTIONTECH DESCTECH, p.DESCRIPTIONNORME DESCNORME, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
					FROM product p
					LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
					LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
					LEFT JOIN category AS c ON c.ID = p.IDCATEGORY
					WHERE p.isACTIVE = 0
					AND pic.POSITION = 1
					GROUP BY ID
					ORDER BY p.ID ASC";

			$product = new Product();
			$productChild = new ProductChild();
			$listProducts = $product->getAdapter()->fetchAll($sql);

			foreach ($listProducts as $row) {
				$sqlChild = "
						SELECT pc.ID ID ,pc.REFERENCE REFERENCE,pc.DESIGNATION DESIGNATION,pc.PRIX PRIX, pc.isPROMO isPROMO ,
						pc.IMAGEPROMO IMAGEPROMO,pc.isDEVIS isDEVIS, pc.QUANTITYMIN QUANTITYMIN
							FROM productchild AS pc
						WHERE pc.IDPRODUCT = ".$row['ID']." 
						ORDER BY pc.PRIX ASC";
					
				$productChildTemp = $productChild->getAdapter()->fetchAll($sqlChild);
					
				$navnom = 	$this->verifyNavigationString($row['NAVNOM'], $row['NOM'], '');

				$urlImage = $this->baseUrl_SiteCommerceUrl."/".$row['URLIMAGE'];
				//$urlPage = $this->baseUrl_SiteCommerceUrl."/produits/detail/page/".$navnom."/p/".$row['ID'];
				$urlPage = $this->getUrlPage(array('NAVNOM_URLPARENTS' => $row['NAVNOM_URLPARENTS'], 'PAGE' => $navnom, 'ID' => $row['ID']));

					
				$motcle = array();
				$navnomStrip =  explode("-", $navnom);
				for ($index = 0; $index < sizeof($navnomStrip); $index++) {
					$word = $navnomStrip[$index];
					if (strlen($word) > 3){
						array_push($motcle, $word);
					}
				}
				if (sizeof($motcle) < 10) {
					$navnomcat = explode("-", $row['CATEGORYNAV']);
					for ($index = 0; $index < sizeof($navnomcat); $index++) {
						$word = $navnomcat[$index];
						if (strlen($word) > 3){
							array_push($motcle, $word);
						}
					}
					if (sizeof($motcle) < 10) {
						$brend = $row['BREND'];
						array_push($motcle, $brend);
					}
					if (sizeof($motcle) < 10) {
						for ($index = sizeof($motcle); $index < 10; $index++) {
							array_push($motcle, $this->siteName);
						}
					}
				}
				$reference = "";
				$prix = "";
				$description = "";
				foreach ($productChildTemp as $rowChild) {
					$reference = $rowChild['REFERENCE'];
					$prix = $rowChild['PRIX'];
					$descTemp = $row['DESCSHORT']." ".$rowChild['DESIGNATION'];

					$description = $this->cleanUp($descTemp);
					$description = addslashes($description);
					break;
				}
				$fichier->Insertion('"'.$row['NOM'].'";"'.$description.'";"'.$urlImage.'";"'.$urlPage.'";"'.$row['DOCURL'].'";"'.$reference.'";"'.$motcle[0].'";"'.$motcle[1].'";"'.$motcle[2].'";"'.$motcle[3].'";"'.$motcle[4].'";"'.$motcle[5].'";"'.$motcle[6].'";"'.$motcle[7].'";"'.$motcle[8].'";"'.$motcle[9].'";'.$prix.';;"'.$row['BREND'].'";;"48H par TNT";;0;;');
			}

			$fichier->output('hellopro_fr');
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
		}
	}
	function exportleguideAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender();

			$this->view->titlePage = "Exporter le fichier CSV";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";

			$fichier = new FichierExcel();
			$fichier->Colonne("categorie;identifiant_unique;titre;description;prix;url_produit;url_image;frais_de_livraison;disponibilite;delais_de_livraison;garantie;reference_modele;D3E;marque;ean;prix_barre;type_promotion;devise;occasion;URL_mobile");


			$sql = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.DESCRIPTIONLONG DESCLONG, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
					p.DOCNAME DOCNAME, p.DOCURL DOCURL, p.IDBREND IDBREND,
					p.isPROMO isPROMO, pic.URL URLIMAGE, sb.BREND BREND, sb.URL BRENDURL, p.IDCATEGORY IDCATEGORY, c.NOM CATEGORYNOM,
					p.DESCRIPTIONTECH DESCTECH, p.DESCRIPTIONNORME DESCNORME, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
					FROM product p
					LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
					LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
					LEFT JOIN category AS c ON c.ID = p.IDCATEGORY
					WHERE p.isACTIVE = 0
					AND pic.POSITION = 1
					GROUP BY ID
					ORDER BY p.ID ASC";

			$product = new Product();
			$productChild = new ProductChild();
			$listProducts = $product->getAdapter()->fetchAll($sql);

			foreach ($listProducts as $row) {
				$sqlChild = "
						SELECT pc.ID ID ,pc.REFERENCE REFERENCE,pc.DESIGNATION DESIGNATION,pc.PRIX PRIX, pc.isPROMO isPROMO ,
						pc.IMAGEPROMO IMAGEPROMO,pc.isDEVIS isDEVIS, pc.QUANTITYMIN QUANTITYMIN
							FROM productchild AS pc
						WHERE pc.IDPRODUCT = ".$row['ID']." 
						ORDER BY pc.PRIX ASC";
					
				$productChildTemp = $productChild->getAdapter()->fetchAll($sqlChild);
					
				$navnom = $this->verifyNavigationString($row['NAVNOM'], $row['NOM'], '');

				$urlImage = $this->baseUrl_SiteCommerceUrl."/".$row['URLIMAGE'];
				//$urlPage = $this->baseUrl_SiteCommerceUrl."/produits/detail/".$navnom."/p/".$row['ID'];
				$urlPage = $this->getUrlPage(array('NAVNOM_URLPARENTS' => $row['NAVNOM_URLPARENTS'],'PAGE' => $navnom, 'ID' => $row['ID']));
					
				$fraislivraison = "";
				$garantie="";
					
				$reference = "";
				$prix = "";
				$description = "";
				foreach ($productChildTemp as $rowChild) {
					$reference = $rowChild['REFERENCE'];
					$prix = $rowChild['PRIX'];
					$descTemp = $row['DESCSHORT']." ".$rowChild['DESIGNATION'];

					$description = $this->cleanUp($descTemp);
					$description = addslashes($description);
					break;
				}
				$fichier->Insertion('"'.$row['CATEGORYNOM'].'";"'.$reference.'";"'.$row['NOM'].'";"'.$description.'";"'.$prix.'";"'.$urlPage.'";"'.$urlImage.'";"'.$fraislivraison.'";"0";"48 heures";"'.$garantie.'";;;;;;;;;');

			}

			$fichier->output('leguide_fr');
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
		}
	}

	function exportkelkooAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender();

			$this->view->titlePage = "Exporter le fichier CSV";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";

			$fichier = new FichierText();
			$fichier->Colonne("id|model|brand|description|price|url|merchantcat|image|ean|sku|used|availability|deliveryprice|deliveryTime|deliveryinfo|warranty|ecotax|catkkid|taggingmatching|voucher|voucherdesc|voucherurl|vouchercode|voucherstart|voucherend|pricenorebate|percentagepromo|promostart|promoend|offertype|flag|shopinfo|validity");

			$sql = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.DESCRIPTIONLONG DESCLONG, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
					p.DOCNAME DOCNAME, p.DOCURL DOCURL, p.IDBREND IDBREND,
					p.isPROMO isPROMO, pic.URL URLIMAGE, sb.BREND BREND, sb.URL BRENDURL, p.IDCATEGORY IDCATEGORY, c.NOM CATEGORYNOM, c.NAVNOM CATEGORYNAV, c.DESCRIPTION CATEGORYDESC, 
					p.DESCRIPTIONTECH DESCTECH, p.DESCRIPTIONNORME DESCNORME, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
					FROM product p
					LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
					LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
					LEFT JOIN category AS c ON c.ID = p.IDCATEGORY
					WHERE p.isACTIVE = 0
					AND pic.POSITION = 1
					GROUP BY ID
					ORDER BY p.ID ASC";

			$product = new Product();
			$productChild = new ProductChild();
			$listProducts = $product->getAdapter()->fetchAll($sql);

			foreach ($listProducts as $row) {
				$sqlChild = "
						SELECT pc.ID ID ,pc.REFERENCE REFERENCE,pc.DESIGNATION DESIGNATION,pc.PRIX PRIX, pc.isPROMO isPROMO ,
						pc.IMAGEPROMO IMAGEPROMO,pc.isDEVIS isDEVIS, pc.QUANTITYMIN QUANTITYMIN
							FROM productchild AS pc
						WHERE pc.IDPRODUCT = ".$row['ID']." 
						ORDER BY pc.PRIX ASC";
					
				$productChildTemp = $productChild->getAdapter()->fetchAll($sqlChild);
					
				$navnom = $this->verifyNavigationString($row['NAVNOM'], $row['NOM'], '');

				$urlImage = $this->baseUrl_SiteCommerceUrl."/".$row['URLIMAGE'];
				//$urlPage = $this->baseUrl_SiteCommerceUrl."/produits/detail/page/".$navnom."/p/".$row['ID'];
				$urlPage = $this->getUrlPage(array('NAVNOM_URLPARENTS' => $row['NAVNOM_URLPARENTS'],'PAGE' => $navnom, 'ID' => $row['ID']));
					
				$motcle = array();
				$navnomStrip =  explode("-", $navnom);
				for ($index = 0; $index < sizeof($navnomStrip); $index++) {
					$word = $navnomStrip[$index];
					if (strlen($word) > 3){
						array_push($motcle, $word);
					}
				}
				if (sizeof($motcle) < 10) {
					$navnomcat = explode("-", $row['CATEGORYNAV']);
					for ($index = 0; $index < sizeof($navnomcat); $index++) {
						$word = $navnomcat[$index];
						if (strlen($word) > 3){
							array_push($motcle, $word);
						}
					}
					if (sizeof($motcle) < 10) {
						$brend = $row['BREND'];
						array_push($motcle, $brend);
					}
					if (sizeof($motcle) < 10) {
						for ($index = sizeof($motcle); $index < 10; $index++) {
							array_push($motcle, $this->siteName);
						}
					}
				}
				$reference = "";
				$prix = "";
				$description = "";
				foreach ($productChildTemp as $rowChild) {
					$reference = $rowChild['REFERENCE'];
					$prix = $rowChild['PRIX'];
					$descTemp = $row['DESCSHORT']." ".$rowChild['DESIGNATION'];

					$description = $this->cleanUp($descTemp);
					$description = str_replace("|", "", $description);
					$description = addslashes($description);

					break;
				}
				$catkid = "";
				$shopinfo = $this->siteName." : ".str_replace("|", "", $this->cleanUp($row['CATEGORYDESC']));
				$validity = "";
				$fichier->Insertion('"'.$reference.'"|"'.$row['NOM'].'"|"'.$row['BREND'].'"|"'.$description.'"|'.$prix.'|"'.$urlPage.'"|"'.$row['CATEGORYNOM'].'"|"'.$urlImage.'"||||1||"Sous 48 heures"|"Livraison TNT Express"|||'.$catkid.'|"'.$motcle[0].' '.$motcle[1].' '.$motcle[2].' '.$motcle[3].' '.$motcle[4].'"|||||||||||single||"'.$shopinfo.'"|"'.$validity.'"');

			}

			$fichier->output('kelkoo_fr');
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
		}
	}

	function exportciaoAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender();


			$this->view->titlePage = "Exporter le fichier CSV";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";

			$fichier = new FichierExcel();
			$fichier->Colonne("Name;Brand;MNP;Deeplink;Imagelink;Price;ShippingCost;Delivery;Merchant;Category;SKU;offerID;Description");

			$sql = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.DESCRIPTIONLONG DESCLONG, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
					p.DOCNAME DOCNAME, p.DOCURL DOCURL, p.IDBREND IDBREND,
					p.isPROMO isPROMO, pic.URL URLIMAGE, sb.BREND BREND, sb.URL BRENDURL, p.IDCATEGORY IDCATEGORY, c.NOM CATEGORYNOM, c.NAVNOM CATEGORYNAV, 
					p.DESCRIPTIONTECH DESCTECH, p.DESCRIPTIONNORME DESCNORME, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
					FROM product p
					LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
					LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
					LEFT JOIN category AS c ON c.ID = p.IDCATEGORY
					WHERE p.isACTIVE = 0
					AND pic.POSITION = 1
					GROUP BY ID
					ORDER BY p.ID ASC";

			$product = new Product();
			$productChild = new ProductChild();
			$listProducts = $product->getAdapter()->fetchAll($sql);

			foreach ($listProducts as $row) {
				$sqlChild = "
						SELECT pc.ID ID ,pc.REFERENCE REFERENCE,pc.DESIGNATION DESIGNATION,pc.PRIX PRIX, pc.isPROMO isPROMO ,
						pc.IMAGEPROMO IMAGEPROMO,pc.isDEVIS isDEVIS, pc.QUANTITYMIN QUANTITYMIN
							FROM productchild AS pc
						WHERE pc.IDPRODUCT = ".$row['ID']." 
						ORDER BY pc.PRIX ASC";
					
				$productChildTemp = $productChild->getAdapter()->fetchAll($sqlChild);
					
				$navnom = $this->verifyNavigationString($row['NAVNOM'], $row['NOM'], '');

				$urlImage = $this->baseUrl_SiteCommerceUrl."/".$row['URLIMAGE'];
				//$urlPage = $this->baseUrl_SiteCommerceUrl."/produits/detail/page/".$navnom."/p/".$row['ID'];
				$urlPage = $this->getUrlPage(array('NAVNOM_URLPARENTS' => $row['NAVNOM_URLPARENTS'],'PAGE' => $navnom, 'ID' => $row['ID']));
					
					
				$reference = "";
				$prix = "";
				$description = "";
				foreach ($productChildTemp as $rowChild) {
					$reference = $rowChild['REFERENCE'];
					$prix = $rowChild['PRIX'];
					$descTemp = $row['DESCSHORT']." ".$rowChild['DESIGNATION'];

					$description = $this->cleanUp($descTemp);
					$description = addslashes($description);
					break;
				}
				$fichier->Insertion('"'.$row['NOM'].'";"'.$row['BREND'].'";;"'.$urlPage.'";"'.$urlImage.'";'.$prix.';;"48h";;"'.$row['CATEGORYNOM'].'";"EUR";"'.$reference.'";"'.$description.'"');
			}

			$fichier->output('ciao_fr');
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
		}
	}

	public function sitemapxmlAction() {
		try {

			$this->view->titlePage = "Exporter le sitemap";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";

			if ($this->_request->isPost()) {
				//get the form params
				$params = $this->_request->getPost();

				$changefreq = $params['changefreq'];
				$priority = $params['priority'];
				$isImageActive = $params['all_image'];
				$isCheckLinkActive = $params['checklink'];
				$isCustomNavnomActive = $params['all_navnom'];

				// Instance de la class DomDocument
				$doc = new DOMDocument();

				// Definition de la version et l'encodage
				$doc->version = '1.0';
				$doc->encoding = 'UTF-8';

				$isImage = true;
				if ($isImageActive == "N") { $isImage = false; }

				$body_elt = $doc->createElementNS('http://www.sitemaps.org/schemas/sitemap/0.9', 'urlset');
				$doc->appendChild($body_elt);

				if ($isImage) {
					$body_elt->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:image', 'http://www.google.com/schemas/sitemap-image/1.1');
					//$body_elt->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:video', 'http://www.google.com/schemas/sitemap-video/1.1');
				}

				$isDupliateByNavNom = false;

				$isCheckLink = false;
				if ($isCheckLinkActive == "Y") { $isCheckLink = true; }

				$isCustomNavnom = false;
				if ($isCustomNavnomActive == "Y") {  $isCustomNavnom = true; }

				$countDefault = $this->sitemapAddUrlDefault($doc, $body_elt, $isCheckLink);
					
				$countProduct = $this->sitemapAddUrlProducts($doc, $body_elt, $changefreq, $priority, $isDupliateByNavNom,$isImage, $isCheckLink, $isCustomNavnom);
					
				$countCategorie = $this->sitemapAddUrlCategories($doc, $body_elt, $changefreq, $priority, $isDupliateByNavNom,$isImage, $isCheckLink);

				$countCategorie2 = $this->sitemapAddUrlCategories2($doc, $body_elt, $changefreq, $priority, $isDupliateByNavNom,$isImage, $isCheckLink);
                
				$countServices = $this->sitemapAddUrlInfos($doc, $body_elt, $changefreq, $priority, $isDupliateByNavNom,$isImage, $isCheckLink);


				$this->view->messageSuccess = "Le Sitemap a �t� remplac�.";
				if ($countProduct['RESULT'] == 'SUCCESS') {
					$this->view->messageSuccess .= " Produits : <b>".$countProduct['OK']."</b> urls,";
				} else {
					$this->view->messageError .= "Erreur sur les produits : ".$countProduct['OK']." urls OK, script interrompu.  ".$countProduct['RESULT'];
				}
					
				if ($countCategorie['RESULT'] == 'SUCCESS') {
					$this->view->messageSuccess .= " Cat�gories : <b>".$countCategorie['OK']."</b> urls,";
				} else {
					$this->view->messageError .= "Erreur sur les cat�gories : ".$countCategorie['OK']." urls OK, script interrompu.  ".$countCategorie['RESULT'];
				}
                
				if ($countCategorie2['RESULT'] == 'SUCCESS') {
					$this->view->messageSuccess .= " Cat�gories subsidiaires : <b>".$countCategorie2['OK']."</b> urls,";
				} else {
					$this->view->messageError .= "Erreur sur les cat�gories subsidiaires : ".$countCategorie2['OK']." urls OK, script interrompu.  ".$countCategorie2['RESULT'];
				}

				if ($countServices['RESULT'] == 'SUCCESS') {
					$this->view->messageSuccess .= " Informations : <b>".$countServices['OK']."</b> urls,";
				} else {
					$this->view->messageError .= "Erreur sur les informations : ".$countServices['OK']." urls OK, script interrompu.  ".$countServices['RESULT'];
				}

				if ($countDefault['RESULT'] == 'SUCCESS') {
					$this->view->messageSuccess .= " Connexions : <b>".$countDefault['OK']."</b> urls,";
				} else {
					$this->view->messageError .= "Erreur sur les connexions : ".$countDefault['OK']." urls OK, script interrompu.  ".$countDefault['RESULT'];
				}

				$this->view->messageSuccess .= " Total de liens : <b>".($countProduct['OK']+$countCategorie['OK']+$countCategorie2['OK']+$countServices['OK']+$countDefault['OK'])."</b>";
					
				if ($isCheckLink) {
					$this->view->messageSuccess .= "  V�rification des liens -> OK : <b>".($countProduct['OK']+$countCategorie['OK']+$countCategorie2['OK']+$countServices['OK']+$countDefault['OK'])."</b>";
					$this->view->messageError .= " V�rification des liens -> Liens morts : <b>".($countProduct['NOK']+$countCategorie['NOK']+$countCategorie2['NOK']+$countServices['NOK']+$countDefault['NOK'])."</b>";
				}

				$doc->formatOutput = true;
				// Sauver le document XML sous le nom simple.xml
				$doc->save('sitemap.xml');
				//echo $doc->saveXML();
			
				if($this->pingBingForSitemap()) {
					$this->view->messageSuccess .= ", Mise � niveau de Bing";
				}
				if($this->pingGoogleForSitemap()) {
					$this->view->messageSuccess .= ", Mise � niveau de Google";
				}
			}
		} catch (Zend_Exception $e) {
			$this->log('Erreur lors de la generation du sitemap XML : '.$e->getMessage(),'err');
			$this->view->messageError = "Erreur lors de la g�n�ration du sitemap XML : ".$e->getMessage();
		}
	}

	private function pingBingForSitemap() {
		return $this->sendUrlPostByRequest('http://www.bing.com/ping?sitemap='.$this->baseUrl_SiteCommerceUrl.'/sitemap.xml');		
	}

	private function pingGoogleForSitemap() {
		return $this->sendUrlPostByRequest('http://www.google.com/webmasters/sitemaps/ping?sitemap='.$this->baseUrl_SiteCommerceUrl.'/sitemap.xml');
	}	

	private function sendUrlPostByRequest($url) {
		$a = @get_headers($url);
		if ($a) {   
			if (strstr($a[0],'200')) { 
				return true; 
			}
		} 
		
		return false;
	}
	
	private function isLinkDead ($url) {
		if ($this->sendUrlPostByRequest($url)) {
			return false;
		}
		return true;
	}
	
	private function sitemapAddUrlProducts($doc, $body_elt, $changefreq, $priority, $isDupliateByNavNom, $isImage, $isCheckLink, $isCustomNavnom) {

		try {
			$countOk = 0;
			$countNOk = 0;

			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_CustomAccent())
			->addFilter(new Zend_Filter_Alnum(array('allowwhitespace' => true)));

			$filterLight = new Zend_Filter();
			$filterLight->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());
				
			$sql = "SELECT p.ID ID, p.NOM NOM, p.NAVNOM NAVNOM, pic.URL URLIMAGE,
					p.CUSTOM_NAVNOM1 CUSTOM_NAVNOM1 ,p.CUSTOM_NAVNOM2 CUSTOM_NAVNOM2 , 
					p.CUSTOM_NAVNOM3 CUSTOM_NAVNOM3, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
					FROM product p
					LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
			       LEFT JOIN category c ON p.IDCATEGORY = c.ID
					WHERE p.isACTIVE = 0
					AND pic.POSITION = 1
					GROUP BY ID
					ORDER BY p.ID ASC";

			$product = new Product();
			$listProducts = $product->getAdapter()->fetchAll($sql);

			$picture = new Picture();

			$date = new Zend_Date();
			$currentDate = $date->toString('YYYY-MM-dd');

			$type = 1; 

			foreach ($listProducts as $row) { 
				$url_elt = $doc->createElement('url');
				$body_elt->appendChild($url_elt);

				$navnom = 	$this->verifyNavigationString($row['NAVNOM'], $row['NOM'], '');
				$urlPage = $this->getUrlPageProduct(array('NAVNOM_URLPARENTS' => $row['NAVNOM_URLPARENTS'],'PAGE' => $navnom, 'ID' => $row['ID'], 'TYPE' => $type));

				$loc_elt = $doc->createElement('loc',  $urlPage);
				$url_elt->appendChild($loc_elt);

				if ($isImage) {
					$listPicture = $picture->fetchAll('IDPRODUCT = '.$row['ID']);

					foreach ($listPicture as $pic) {
						$image_elt  = $doc->createElement('image:image');
						$url_elt->appendChild($image_elt);

						$urlImage = $this->baseUrl_SiteCommerceUrl."/".$pic['URL'];

						$imageloc_elt = $doc->createElement('image:loc',$urlImage);
						$image_elt->appendChild($imageloc_elt);

						$string1 = $filter->filter($pic['STRING1']);
						if (isset($string1) && !empty($string1)) {
							$imagetitle_elt = $doc->createElement('image:title', $string1);
							$image_elt->appendChild($imagetitle_elt);
						}
						$string2 = $filter->filter($pic['STRING2']);
						if (isset($string2) && !empty($string2)) {
							$imagecaption_elt = $doc->createElement('image:caption', $string2);
							$image_elt->appendChild($imagecaption_elt);
						}
					}
				}

				$lastmod_elt  = $doc->createElement('lastmod', $currentDate);
				$changefreq_elt  = $doc->createElement('changefreq', $changefreq);
				$priority_elt  = $doc->createElement('priority', $priority);
				$url_elt->appendChild($lastmod_elt);
				$url_elt->appendChild($changefreq_elt);
				$url_elt->appendChild($priority_elt);
						
						
				if ($isCheckLink && $this->isLinkDead($urlPage)) { $countNOk++;
				} else { $countOk++; } 

				if ($isCustomNavnom) {
					for ($index = 1; $index < 4; $index++) {
						$navnomTemp = $filterLight->filter($row['CUSTOM_NAVNOM'.$index]);
						if (!empty($navnomTemp)) { 
								$url_elt = $doc->createElement('url');
								$body_elt->appendChild($url_elt);
									
								$navnom = 	$this->verifyNavigationString($navnomTemp, $navnomTemp, '');
								$urlPage = $this->getUrlPageProduct(array('NAVNOM_URLPARENTS' => $row['NAVNOM_URLPARENTS'],'PAGE' => $navnom, 'ID' => $row['ID'], 'TYPE' => $type));
									
								$loc_elt = $doc->createElement('loc',  $urlPage);
								$url_elt->appendChild($loc_elt);
									
								if ($isImage) {
									$listPicture = $picture->fetchAll('IDPRODUCT = '.$row['ID']);
									//$urlPage = $this->baseUrl_SiteCommerceUrl."/produits/detail/page/".$navnom."/p/".$row['ID'];
										
									foreach ($listPicture as $pic) {
										$image_elt  = $doc->createElement('image:image');
										$url_elt->appendChild($image_elt);
											
										$urlImage = $this->baseUrl_SiteCommerceUrl."/".$pic['URL'];
											
										$imageloc_elt = $doc->createElement('image:loc',$urlImage);
										$image_elt->appendChild($imageloc_elt);
											
										$string1 = $filter->filter($pic['STRING1']);
										if (isset($string1) && !empty($string1)) {
											$imagetitle_elt = $doc->createElement('image:title', $string1);
											$image_elt->appendChild($imagetitle_elt);
										}
										$string2 = $filter->filter($pic['STRING2']);
										if (isset($string2) && !empty($string2)) {
											$imagecaption_elt = $doc->createElement('image:caption', $string2);
											$image_elt->appendChild($imagecaption_elt);
										}
									}
								}
									
								$lastmod_elt  = $doc->createElement('lastmod', $currentDate);
								$changefreq_elt  = $doc->createElement('changefreq', $changefreq);
								$priority_elt  = $doc->createElement('priority', $priority);
								$url_elt->appendChild($lastmod_elt);
								$url_elt->appendChild($changefreq_elt);
								$url_elt->appendChild($priority_elt);


								if ($isCheckLink && $this->isLinkDead($urlPage)) { $countNOk++;
								} else { $countOk++; }
							} 
					}
				}
			}
		} catch (Zend_Exception $e) {
			$this->log('Erreur lors de la generation du sitemapAddUrlProducts : '.$e->getMessage(),'err');
			return array('OK' => $countOk, 'NOK' => $countNOk, 'RESULT' => $e->getMessage());
		}
		return array('OK' => $countOk, 'NOK' => $countNOk, 'RESULT' => 'SUCCESS');
	}
	private function sitemapAddUrlCategories($doc, $body_elt, $changefreq, $priority, $isDupliateByNavNom, $isImage, $isCheckLink) {
			
		try {
			$countOk = 0;
			$countNOk = 0;

			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_CustomAccent())
			->addFilter(new Zend_Filter_Alnum(array('allowwhitespace' => true)));

			$sql = "SELECT c.ID ID, c.NOM NOM, c.URL URL, c.NAVNOM NAVNOM, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
			FROM category c WHERE c.isACTIVE = 1";

			$categorie = new Category();
			$listCats = $categorie->getAdapter()->fetchAll($sql);

			$date = new Zend_Date();
			$currentDate = $date->toString('YYYY-MM-dd');

			$type = 1; 

			foreach ($listCats as $row) { 
				$url_elt = $doc->createElement('url');
				$body_elt->appendChild($url_elt);

				$navnom = 	$this->verifyNavigationString($row['NAVNOM'], $row['NOM'], '');
				$urlPage = $this->getUrlPageCategory(array('NAVNOM_URLPARENTS' => $row['NAVNOM_URLPARENTS'], 'PAGE' => $navnom, 'ID' => $row['ID'], 'TYPE' => $type));

				$loc_elt = $doc->createElement('loc',  $urlPage);
				$url_elt->appendChild($loc_elt);

				if ($isImage) {
					if (isset($row['URL']) && !empty($row['URL'])) {
						$image_elt  = $doc->createElement('image:image');
						$url_elt->appendChild($image_elt);

						$urlImage = $this->baseUrl_SiteCommerceUrl."/".$row['URL'];

						$imageloc_elt = $doc->createElement('image:loc',$urlImage);
						$image_elt->appendChild($imageloc_elt);

						$string1 = $filter->filter($row['NOM']);
						if (isset($string1) && !empty($string1)) {
							$imagetitle_elt = $doc->createElement('image:title', $string1);
							$image_elt->appendChild($imagetitle_elt);
						}
					}
				}

				$lastmod_elt  = $doc->createElement('lastmod', $currentDate);
				$changefreq_elt  = $doc->createElement('changefreq', $changefreq);
				$priority_elt  = $doc->createElement('priority', $priority);
				$url_elt->appendChild($lastmod_elt);
				$url_elt->appendChild($changefreq_elt);
				$url_elt->appendChild($priority_elt);

				if ($isCheckLink && $this->isLinkDead($urlPage)) { $countNOk++;
				} else { $countOk++; } 
			}
		} catch (Zend_Exception $e) {
			$this->log('Erreur lors de la generation du sitemapAddUrlCategories : '.$e->getMessage(),'err');
			return array('OK' => $countOk, 'NOK' => $countNOk, 'RESULT' => $e->getMessage());
		}
		return array('OK' => $countOk, 'NOK' => $countNOk, 'RESULT' => 'SUCCESS');
	}

	private function sitemapAddUrlCategories2($doc, $body_elt, $changefreq, $priority, $isDupliateByNavNom, $isImage, $isCheckLink) {
        
		try {
			$countOk = 0;
			$countNOk = 0;

			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_CustomAccent())
			->addFilter(new Zend_Filter_Alnum(array('allowwhitespace' => true)));

			$sql = "SELECT c.ID ID, c.NOM NOM, c.URL URL, c.NAVNOM NAVNOM, c.NAVNOM_URLPARENTS NAVNOM_URLPARENTS
			FROM category2 c WHERE c.isACTIVE = 1";

			$categorie = new Category();
			$listCats = $categorie->getAdapter()->fetchAll($sql);

			$date = new Zend_Date();
			$currentDate = $date->toString('YYYY-MM-dd');

			$type = 2; 

			foreach ($listCats as $row) { 
					$url_elt = $doc->createElement('url');
					$body_elt->appendChild($url_elt);

					$navnom = 	$this->verifyNavigationString($row['NAVNOM'], $row['NOM'], '');
					$urlPage = $this->getUrlPageCategory(array('NAVNOM_URLPARENTS' => $row['NAVNOM_URLPARENTS'], 'PAGE' => $navnom, 'ID' => $row['ID'], 'TYPE' => $type));

					$loc_elt = $doc->createElement('loc',  $urlPage);
					$url_elt->appendChild($loc_elt);

					if ($isImage) {
						if (isset($row['URL']) && !empty($row['URL'])) {
							$image_elt  = $doc->createElement('image:image');
							$url_elt->appendChild($image_elt);

							$urlImage = $this->baseUrl_SiteCommerceUrl."/".$row['URL'];

							$imageloc_elt = $doc->createElement('image:loc',$urlImage);
							$image_elt->appendChild($imageloc_elt);

							$string1 = $filter->filter($row['NOM']);
							if (isset($string1) && !empty($string1)) {
								$imagetitle_elt = $doc->createElement('image:title', $string1);
								$image_elt->appendChild($imagetitle_elt);
							}
						}
					}

					$lastmod_elt  = $doc->createElement('lastmod', $currentDate);
					$changefreq_elt  = $doc->createElement('changefreq', $changefreq);
					$priority_elt  = $doc->createElement('priority', $priority);
					$url_elt->appendChild($lastmod_elt);
					$url_elt->appendChild($changefreq_elt);
					$url_elt->appendChild($priority_elt);

					if ($isCheckLink && $this->isLinkDead($urlPage)) {
                        $countNOk++;
					} else { $countOk++; } 
			}
		}
        catch (Zend_Exception $e) {
			$this->log('Erreur lors de la generation du sitemapAddUrlCategories2 : '.$e->getMessage(),'err');
			return array('OK' => $countOk, 'NOK' => $countNOk, 'RESULT' => $e->getMessage());
		}
		return array('OK' => $countOk, 'NOK' => $countNOk, 'RESULT' => 'SUCCESS');
	}
	private function sitemapAddUrlInfos($doc, $body_elt, $changefreq, $priority, $isDupliateByNavNom,$isImage, $isCheckLink) {
			
		try {
			$countOk = 0;
			$countNOk = 0;

			$footers = new FooterContent();
			$listFooter = $footers->fetchAll();

			$date = new Zend_Date();
			$currentDate = $date->toString('YYYY-MM-dd');


			$type = 1; 

			foreach ($listFooter AS $row) { 
					$urlPage = $this->getUrlPageInfo(array('TITRE' => $row['TITRE'], 'ID' => $row['ID'], 'URL' => $row['URL'], 'TYPE' => $type));

					$url_elt = $doc->createElement('url');
					$body_elt->appendChild($url_elt);

					$loc_elt = $doc->createElement('loc',  $urlPage);
					$url_elt->appendChild($loc_elt);

					$lastmod_elt  = $doc->createElement('lastmod', $currentDate);
					$changefreq_elt  = $doc->createElement('changefreq', $changefreq);
					$priority_elt  = $doc->createElement('priority', $priority);
					$url_elt->appendChild($lastmod_elt);
					$url_elt->appendChild($changefreq_elt);
					$url_elt->appendChild($priority_elt);

					if ($isCheckLink && $this->isLinkDead($urlPage)) { $countNOk++;
					} else { $countOk++; } 
			}

		} catch (Zend_Exception $e) {
			$this->log('Erreur lors de la generation du sitemapAddUrlInfos : '.$e->getMessage(),'err');
			return array('OK' => $countOk, 'NOK' => $countNOk, 'RESULT' => $e->getMessage());
		}
		return array('OK' => $countOk, 'NOK' => $countNOk, 'RESULT' => 'SUCCESS');
	}

	private function sitemapAddUrlDefault($doc, $body_elt, $isCheckLink) {

		try {
			$countOk = 0;
			$countNOk = 0;
				
			$date = new Zend_Date();
			$currentDate = $date->toString('YYYY-MM-dd');

			$addArray = array();
			$addArray[0]['loc'] = $this->baseUrl_SiteCommerceUrl."/";
			$addArray[0]['changefreq'] = "monthly";
			$addArray[0]['priority'] = "0.9";

			$addArray[1]['loc'] = $this->baseUrl_SiteCommerceUrl."/mon-panier.html";
			$addArray[1]['changefreq'] = "monthly";
			$addArray[1]['priority'] = "0.9";

			$addArray[2]['loc'] = $this->baseUrl_SiteCommerceUrl."/connectez-vous.html";
			$addArray[2]['changefreq'] = "monthly";
			$addArray[2]['priority'] = "0.9";

			$addArray[3]['loc'] = $this->baseUrl_SiteCommerceUrl."/enregistrez-vous.html";
			$addArray[3]['changefreq'] = "monthly";
			$addArray[3]['priority'] = "0.9";

			$addArray[4]['loc'] = $this->baseUrl_SiteCommerceUrl."/services/faq/";
			$addArray[4]['changefreq'] = "monthly";
			$addArray[4]['priority'] = "0.9";

			$addArray[5]['loc'] = $this->baseUrl_SiteCommerceUrl."/retrouver-mon-mot-de-passe.html";
			$addArray[5]['changefreq'] = "monthly";
			$addArray[5]['priority'] = "0.9";


			for ($i = 0; $i < sizeof($addArray); $i++) {
					
				$url_elt = $doc->createElement('url');
				$body_elt->appendChild($url_elt);
					
				$loc_elt = $doc->createElement('loc',  $addArray[$i]['loc']);
				$url_elt->appendChild($loc_elt);


				$lastmod_elt  = $doc->createElement('lastmod', $currentDate);
				$changefreq_elt  = $doc->createElement('changefreq', $addArray[$i]['changefreq']);
				$priority_elt  = $doc->createElement('priority', $addArray[$i]['priority']);
				$url_elt->appendChild($lastmod_elt);
				$url_elt->appendChild($changefreq_elt);
				$url_elt->appendChild($priority_elt);

				if ($isCheckLink && $this->isLinkDead($addArray[$i]['loc'])) { $countNOk++;
				} else { $countOk++; }
			}


		} catch (Zend_Exception $e) {
			$this->log('Erreur lors de la generation du sitemapAddUrlDefault : '.$e->getMessage(),'err');
			return array('OK' => $countOk, 'NOK' => $countNOk, 'RESULT' => $e->getMessage());
		}
		return array('OK' => $countOk, 'NOK' => $countNOk, 'RESULT' => 'SUCCESS');
	}

	private function cleanUp($value) {
		$result = $value;
		$filter = new Zend_Filter();
		$filter->addFilter(new Zend_Filter_StringTrim())
		->addFilter(new Zend_Filter_StripTags());
		$result =$filter->filter($result);
		$result = html_entity_decode($result,ENT_QUOTES,"ISO-8859-1");
		$result = str_replace("\r\n", "", $result);
		$result = str_replace('"',"'",$result);
		$result = str_replace(';',"'",$result);
		return $result;
	}

	private function getUrlPage($params) {
		//produit
		return $this->baseUrl_SiteCommerceUrl."/".Utils_Tool::getFormattedUrlProduct($params['NAVNOM_URLPARENTS'], $params['PAGE'], $params['ID']);
	}

	private function getUrlPageProduct($params) {
		//produit
		switch ($params['TYPE']) {
			case 1 :
				return $this->baseUrl_SiteCommerceUrl."/".Utils_Tool::getFormattedUrlProduct($params['NAVNOM_URLPARENTS'], $params['PAGE'], $params['ID']);
				break;
		}
	}
	
	private function getUrlPageCategory($params) {
		//category
		switch ($params['TYPE']) {
			case 1 :
				return $this->baseUrl_SiteCommerceUrl."/".Utils_Tool::getFormattedUrlCategory($params['NAVNOM_URLPARENTS'], $params['PAGE'], $params['ID']);
				break;
			case 1 :
				return $this->baseUrl_SiteCommerceUrl."/".Utils_Tool::getFormattedUrlCategory2($params['NAVNOM_URLPARENTS'], $params['PAGE'], $params['ID']);
				break;
		}
	}
	private function getUrlPageInfo($params) {
		//Info
		$navnom = $this->verifyNavigationString("", $params['TITRE'], "");
		$urlPage = "";
		if (empty($params['URL'])) {
			switch ($params['TYPE']) {
				case 1 :
					$urlPage = $this->baseUrl_SiteCommerceUrl."/info-".$params['ID']."/".$navnom.".html";
					break;
			}
		} else {
			$urlPage = "http://".$params['URL'];
		}
		return $urlPage;
	}
}
?>modules/backoffice/controllers/PromotionController.php000060400000136235150710367660017422 0ustar00<?php
class Backoffice_PromotionController extends Modules_Backoffice_Controllers_MainController
{

	function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "Promos";
		$this->isConnectedWithRole('isPromo'); 
	}
	function indexAction()
	{
		$this->_forward('/product');

	}

	function frontAction()
	{
		$this->view->titlePage = "Les promotions de la page d'Accueil";
		$promoFront = new PromoFront();
			
		$listFrontSQL = "
		SELECT p.NOM NOM, p.DESCRIPTIONSHORT DESCSHORT, p.ID IDPRODUCT,
				pf.REFERENCE REFERENCE, pf.POSITION POSITION, pf.ID ID
				FROM promo_front AS pf
				LEFT JOIN productchild AS pc ON pc.REFERENCE = pf.REFERENCE
				LEFT JOIN product AS p ON pc.IDPRODUCT = p.ID
				ORDER BY pf.POSITION ASC";
		$listFront = $promoFront->getAdapter()->fetchAll($listFrontSQL);
		$this->view->listFront = $listFront;
	}
	function frontaddAction()
	{
		if ($this->getRequest()->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			$promoFront = new PromoFront();
			$productChild = new ProductChild();

			$params = array();
			$params = $this->getRequest()->getPost();

			if ($validator->isValid($params['reference']))
			{
				$isExistProduct = $productChild->fetchRow("REFERENCE = '".$params['reference']."'");
				if ($isExistProduct ) {
					if ($isExistProduct['isPROMO'] == 0) {
						$isExistFront = $promoFront->fetchRow("REFERENCE = '".$params['reference']."'");
						if (!$isExistFront) {
							$date = new Zend_Date();
							$data = array (
		 		 						'REFERENCE' => $filter->filter($params['reference']),
										'POSITION' => (int)$params['position'],
 	 									'DATEINSERTPROMO' => $date->toString('YYYY-MM-dd HH-mm-ss')
							);
							$promoFront->insert($data);
						} else {
							$this->view->messageError = "Le produit est d�j� affich�";
						}
					} else {
						$this->view->messageError = "La r�f�rence n'est pas en promotion";
					}
				} else {
					$this->view->messageError = "La r�f�rence ".$params['reference']." n'existe pas.";
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('front');
	}

	function fronteditAction() {
		if ($this->getRequest()->isPost()) {

			$promoFront = new PromoFront();
			$params = $this->getRequest()->getPost();

			$date = new Zend_Date();
			$data = array (
 	 						'DATEINSERTPROMO' => $date->toString('YYYY-MM-dd HH-mm-ss'),
					 		'POSITION' => (int)$params['position']
			);
			$promoFront->update($data,'ID = '.$params['promoid']);

			$this->view->messageSuccess = "Le produit est affich�";

		}
		$this->_forward('front');
	}
	function frontdelAction() {
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id > 0 ) {
				$promoFront = new PromoFront();
				$promoFront->delete('ID = '.$id);
				$this->view->messageSuccess = "L'article n'est plus affich� sur la page d'accueil";
			}
		}
		$this->_forward('front');

	}

	function productAction() {
		$this->view->titlePage = "Les promotions sur les Produits";
		$supplierBrend = new SupplierBrend();
		$this->view->listbrend = $supplierBrend->fetchAll($supplierBrend->select()->order('BREND ASC'));

		$promoProduct = new PromoProduct();

		//Promo par article
		$listPromo1SQL = "
		SELECT p.NOM NOM, p.DESCRIPTIONSHORT DESCSHORT, p.ID ID, ppc.ID IDPROMO,
				pc.REFERENCE REFERENCE, ppc.REMISEEURO REMISEEURO, ppc.REMISEPOUR REMISEPOUR
				FROM promo_productchild AS ppc
				LEFT JOIN productchild AS pc ON pc.REFERENCE = ppc.REFERENCE
				LEFT JOIN product AS p ON pc.IDPRODUCT = p.ID
				WHERE ppc.REFERENCE IS NOT NULL
				ORDER BY pc.REFERENCE ASC";
		$listPromo1 = $promoProduct->getAdapter()->fetchAll($listPromo1SQL);
		$this->view->listPromo1 = $listPromo1;

		//Promotion sur X selon Y
		$listPromo2SQL = "
		SELECT ppc.REMISEEURO REMISEEURO, ppc.REMISEPOUR REMISEPOUR,ppc.ID IDPROMO,
				 ppc.CHILDREFBUY CHILDREFBUY, ppc.CHILDREFPROMO CHILDREFPROMO,
				 ppc.CHILDREFBUYNB CHILDREFBUYNB, ppc.CHILDREFPROMONB CHILDREFPROMONB
				 FROM promo_productchild AS ppc
				WHERE ppc.CHILDREFBUY IS NOT NULL 
				AND ppc.CHILDREFPROMO IS NOT NULL
				ORDER BY ppc.CHILDREFBUY, ppc.CHILDREFPROMO ASC";

		$this->view->listPromo2 = $promoProduct->getAdapter()->fetchAll($listPromo2SQL);

		//Promotion Date
		$listPromo3SQL = "
		SELECT ppc.DATEPROMOSTART DATEPROMOSTART, ppc.DATEPROMOEND DATEPROMOEND,ppc.ID IDPROMO,
			ppc.REMISEEURO REMISEEURO, ppc.REMISEPOUR REMISEPOUR
				FROM promo_productchild AS ppc
				WHERE ppc.DATEPROMOSTART IS NOT NULL 
				AND ppc.DATEPROMOEND IS NOT NULL 
				ORDER BY ppc.DATEPROMOSTART, ppc.DATEPROMOEND ASC";
		$this->view->listPromo3 = $promoProduct->getAdapter()->fetchAll($listPromo3SQL);

		//Promotion Gamme
		$listPromo4SQL = "
		SELECT c.NOM NOMCATEGORY, c.ID IDCATEGORY, ppc.ID IDPROMO,
			ppc.REMISEEURO REMISEEURO, ppc.REMISEPOUR REMISEPOUR
				FROM promo_productchild AS ppc
				LEFT JOIN category AS c ON c.ID = ppc.IDCATEGORY
				WHERE ppc.IDCATEGORY IS NOT NULL
				ORDER BY c.NOM ASC";
		$this->view->listPromo4 = $promoProduct->getAdapter()->fetchAll($listPromo4SQL);

		//Promotion Marque
		$listPromo5SQL = "
		SELECT sb.BREND BREND, sb.ID IDBREND, ppc.ID IDPROMO,
			ppc.REMISEEURO REMISEEURO, ppc.REMISEPOUR REMISEPOUR
				FROM promo_productchild AS ppc
				LEFT JOIN supplier_brend AS sb ON sb.ID = ppc.IDBREND
				WHERE ppc.IDBREND IS NOT NULL
				ORDER BY sb.BREND ASC";
		$this->view->listPromo5 = $promoProduct->getAdapter()->fetchAll($listPromo5SQL);


	}
	function productdelAction() {
        try {
		    if ($this->getRequest()->getParam('id')) {
			    $id = (int)$this->getRequest()->getParam('id');
			    if ($id > 0 ) {
				    $promoProduct = new PromoProduct();

				    $promoProduct->delete('ID = '.$id);
				    $this->view->messageSuccess = "La promotion a �t� supprim�e ";

			    } else {
				    $this->view->messageError = "La promotion n'a pas �t� supprim�e ";

			    }
		    }
		    if ($this->getRequest()->getParam('idref')) {
			    $idRef = (int)$this->getRequest()->getParam('idref');
			    if ($idRef > 0 ) {
				    $promoProduct = new PromoProduct();
				    $productChild = new ProductChild();

				    $resultSQL = "
				    SELECT p.NOM NOM,p.ID IDPRODUCT, p.isPROMO isPROMOPRODUCT, 
						    pp.ID, pp.REFERENCE REFERENCE
					    FROM promo_productchild AS pp
					    LEFT JOIN productchild AS pc ON pc.REFERENCE = pp.REFERENCE
					    LEFT JOIN product AS p ON pc.IDPRODUCT = p.ID
					    WHERE pp.ID = ".$idRef;
                        
				    $result = $promoProduct->getAdapter()->fetchRow($resultSQL);

				    $data = array (
					    'isPROMO' => 1
				    );
				    $productChild->update($data,"REFERENCE = '".$result['REFERENCE']."'");

				    $isLastPromo = $productChild->fetchRow("isPROMO = 0 AND IDPRODUCT = ".$result['IDPRODUCT']);
				    if (!$isLastPromo) {
					    $product = new Product();
					    $product->update($data,"ID = ".$result['IDPRODUCT']);
				    }
					
				    $promoProduct->delete('ID = '.$idRef);
				    $this->view->messageSuccess = "La promotion a �t� supprim�e ";

			    } else {
				    $this->view->messageError = "La promotion n'a pas �t� supprim�e ";

			    }
		    }
        } catch (Zend_Exception $e) {
			$this->log('productdelAction : '.$e->getMessage(),'err');
		}
		$this->_forward('product');
	}
	function productaddAction() {
        try {
		    if ($this->getRequest()->isPost()) {

			    //filtres pour changer les chaines
			    $filter = new Zend_Filter();
			    $filter	->addFilter(new Zend_Filter_StripTags())
			    ->addFilter(new Zend_Filter_StringTrim());

			    //valideurs pour les chaines
			    $validator = new Zend_Validate();
			    $validator -> addValidator(new Zend_Validate_NotEmpty());


			    $promoProduct = new PromoProduct();
			    $productChild = new ProductChild();

			    $params = array();
			    $params = $this->getRequest()->getPost();

			    $remiseeuro = !empty($params['remiseeuro']) ? $params['remiseeuro'] : 0;
			    $remisepour = (int)$params['remisepour'];
			    $isOK = true;
			    if ($remiseeuro > 0 && $remisepour > 0) {
				    $this->view->messageError = "La remise est soit en EURO, soit en POURCENTAGE. ";
				    $isOK = false;
			    }
			    if ($remiseeuro == 0 && $remisepour == 0) {
				    $this->view->messageError = "La remise est soit en EURO, soit en POURCENTAGE et est obligatoire. ";
				    $isOK = false;
			    }
			    if (($validator->isValid($remiseeuro) ||
			    $validator->isValid($remisepour)) && $isOK == true
			    ) {
				    switch ($params['promo']) {
					    case 1 :
						    if ($validator->isValid($params['reference'])) {

							    $isExistChild = $productChild->fetchRow("REFERENCE = '".$params['reference']."'");
							    $isExistPromo = $promoProduct->fetchRow("REFERENCE = '".$params['reference']."'");
							    if ($isExistChild) {
								    if ($isExistPromo) {
									    $this->view->messageError = "La r�f�rence : ".$params['reference']." est d�ja en promotion. ";
								    } else {
									    $date = new Zend_Date();

									    $data = array (
				 		 						    'DATEINSERTPROMO' => $date->toString('YYYY-MM-dd HH-mm-ss'),
												    'REMISEEURO' => $remiseeuro,
										 		    'REMISEPOUR' => $remisepour,
										 		    'REFERENCE' => $filter->filter($params['reference'])
									    );
									    $promoProduct->insert($data);

									    $product = new Product();
									    $data2 = array (
				 		 						    'isPROMO' => 0
									    );
									    $product->update($data2, 'ID = '.$isExistChild['IDPRODUCT']);
									    $productChild->update($data2, "REFERENCE = '".$isExistChild['REFERENCE']."'");

									    $this->view->messageSuccess = "La r�f�rence : ".$data['REFERENCE']." est maintenant est promotion. ";
								    }
							    } else {
								    $this->view->messageError = "La r�f�rence : ".$params['reference']." n'existe pas. ";
							    }
						    } else {
							    foreach ($validator->getErrors() as $errorCode) {
								    $this->view->messageError .=  $this->getErrorValidator($errorCode);
							    }
						    }
						    break;
					    case 2 :
						
						    if ($validator->isValid($params['referencebuy']) &&
						    $validator->isValid($params['referencepromo']) &&
						    ((int)$params['referencepromonb']>0) &&
						    ((int)$params['referencebuynb']>0)
						    ) {

							    $isExistChild1 = $productChild->fetchRow("REFERENCE = '".$params['referencebuy']."'");
							    $isExistChild2 = $productChild->fetchRow("REFERENCE = '".$params['referencepromo']."'");

							    if ($isExistChild1 && $isExistChild2 && $params['referencebuy'] != $params['referencepromo']) {
								    $isExistPromo = $promoProduct->fetchRow("CHILDREFBUY = '".$params['referencebuy']."' AND CHILDREFPROMO = '".$params['referencepromo']."'");
									
								    if ($isExistPromo) {
									    $this->view->messageError = "La r�f�rence : ".$params['referencepromo']." est d�j� en promotion. ";
								    } else {
									    $date = new Zend_Date();

									    $data = array (
				 		 						    'DATEINSERTPROMO' => $date->toString('YYYY-MM-dd HH-mm-ss'),
												    'REMISEEURO' => $remiseeuro,
										 		    'REMISEPOUR' => $remisepour,
										 		    'CHILDREFBUY' => $filter->filter($params['referencebuy']),
										 		    'CHILDREFPROMO' => $filter->filter($params['referencepromo']),
										 		    'CHILDREFPROMONB' => $filter->filter((int)$params['referencepromonb']),
										 		    'CHILDREFBUYNB' => $filter->filter((int)$params['referencebuynb'])
									    );
									    $promoProduct->insert($data);

									    $this->view->messageSuccess = "Si <b>".$data['CHILDREFBUYNB']."</b> articles de <b>".$data['CHILDREFBUY']."</b> sont achet�s alors <b>".$data['CHILDREFPROMONB']."</b> articles de <b>".$data['CHILDREFPROMO']."</b> sont en promotion ";
								    }
							    } else {
								    if ($params['referencebuy'] == $params['referencepromo']) {
									    $this->view->messageError = "Les r�f�rences sont identiques";

								    } else {
									    $this->view->messageError = "La r�f�rence : ".$params['referencebuy']." ou ".$params['referencepromo']." n'existe pas. ";

								    }
							    }
						    } else {
							    foreach ($validator->getErrors() as $errorCode) {
								    $this->view->messageError .=  $this->getErrorValidator($errorCode);
							    }
						    }
						    break;
					    case 3 :
						    $validator->addValidator(new Zend_Validate_Date());

						    if ($validator->isValid($params['sd']) &&
						    $validator->isValid($params['ed'])
						    ) {
							    $isExistPromo = $promoProduct->fetchRow("DATEPROMOSTART = '".$params['sd']."' AND DATEPROMOEND = '".$params['ed']."' ");

							    if ($isExistPromo) {
								    $this->view->messageError = "La promotion pour cette p�riode existe d�j� ";
							    } else {
								    $date = new Zend_Date();

								    $data = array (
			 		 						    'DATEINSERTPROMO' => $date->toString('YYYY-MM-dd HH-mm-ss'),
											    'REMISEEURO' => $remiseeuro,
									 		    'REMISEPOUR' => $remisepour,
									 		    'DATEPROMOSTART' => $filter->filter($params['sd']),
									 		    'DATEPROMOEND' => $filter->filter($params['ed'])
								    );
								    $promoProduct->insert($data);
									
								    $this->view->messageSuccess = "Les produits o� la date de promotion est comprise entre ".$params['sd']." et ".$params['ed']." sont en promotions. ";
							    }
						    } else {
							    foreach ($validator->getErrors() as $errorCode) {
								    $this->view->messageError .=  $this->getErrorValidator($errorCode);
							    }
						    }
						    break;
							
					    case 4 :
						    if ($params['listcategory'] > 0 ) {

							    $isExistPromo = $promoProduct->fetchRow("IDCATEGORY = ".$params['listcategory']);

							    if ($isExistPromo) {
								    $this->view->messageError = "La promotion pour cette gamme existe d�j� ";
							    } else {
								    $date = new Zend_Date();

								    $data = array (
			 		 						    'DATEINSERTPROMO' => $date->toString('YYYY-MM-dd HH-mm-ss'),
											    'REMISEEURO' => $remiseeuro,
									 		    'REMISEPOUR' => $remisepour,
									 		    'IDCATEGORY' => $filter->filter($params['listcategory'])
								    );
								    $promoProduct->insert($data);
									
								    $this->view->messageSuccess = "Les produits de la gamme sont maintenant en promotion. ";
							    }
						    } else {
							    $this->view->messageError = "S�lectionner une cat�gorie";

						    }
						    break;
							
					    case 5 :
						    if ($params['listbrend'] > 0 ) {

							    $isExistPromo = $promoProduct->fetchRow("IDBREND = ".$params['listbrend']);

							    if ($isExistPromo) {
								    $this->view->messageError = "La promotion pour cette marque existe d�j� ";
							    } else {
								    $date = new Zend_Date();

								    $data = array (
			 		 						    'DATEINSERTPROMO' => $date->toString('YYYY-MM-dd HH-mm-ss'),
											    'REMISEEURO' => $remiseeuro,
									 		    'REMISEPOUR' => $remisepour,
									 		    'IDBREND' => $filter->filter($params['listbrend'])
								    );
								    $promoProduct->insert($data);
									
								    $this->view->messageSuccess = "Les produits de la marque sont maintenant en promotion. ";
							    }
						    } else {
							    $this->view->messageError = "S�lectionner une marque";

						    }
						    break;
					    default:
						    $this->_forward('product');
						    break;
							
				    }
			    } else {
				    foreach ($validator->getErrors() as $errorCode) {
					    $this->view->messageError .=  $this->getErrorValidator($errorCode);
				    }
			    }
		    }
        } catch (Zend_Exception $e) {
			$this->log('productaddAction : '.$e->getMessage(),'err');
			$this->view->messageError = "V�rifier les param�tres";
		}
		$this->_forward('product');
	}

	function commandAction() {
		$this->view->titlePage = "Les remises sur les Commandes";
		$promoCommand = new PromoCommand();

		$isAll = $promoCommand->fetchRow('isALL = 0 AND isALL IS NOT NULL');
		if ($isAll) {
			$this->view->remiseAll = $isAll;
		}
		$isMontant = $promoCommand->fetchRow('MONTANTEQUAL > 0 AND MONTANTEQUAL IS NOT NULL');
		if ($isMontant) {
			$this->view->remiseMontant = $isMontant;
		}
		
		$listRemise1SQL = "
		SELECT p.NOM NOM,p.ID IDPRODUCT, p.DESCRIPTIONSHORT DESCSHORT, prc.ID ID,prc.CHILDNBR CHILDNBR,
				prc.CHILDREFERENCE CHILDREFERENCE, prc.REMISEEURO REMISEEURO, prc.REMISEPOUR REMISEPOUR
				FROM promo_command AS prc
				LEFT JOIN productchild AS pc ON pc.REFERENCE = prc.CHILDREFERENCE
				LEFT JOIN product AS p ON pc.IDPRODUCT = p.ID
				WHERE prc.CHILDREFERENCE IS NOT NULL
				ORDER BY prc.CHILDREFERENCE ASC";
		$listRemise1 = $promoCommand->getAdapter()->fetchAll($listRemise1SQL);
		$this->view->listRemise1 = $listRemise1;

	}

	function commandaddAction() {
		if ($this->getRequest()->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			$promoCommand = new PromoCommand();
			$productChild = new ProductChild();

			$params = array();
			$params = $this->getRequest()->getPost();

			if ($params['remise'] == '5') {
				if (isset($params['montantfrais']) && (int)$params['montantfrais'] > 0 && $validator->isValid($params['montantfrais'])) {
					$isExistFrais = $promoCommand->fetchRow("MONTANTVALID IS NOT NULL");
					if ($isExistFrais) {
						$date = new Zend_Date();

						$data = array (
  						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
  						'MONTANTVALID' => $filter->filter($params['montantfrais'])
						);
						$promoCommand->update($data,'ID = '.$isExistFrais['ID']);

						$this->view->messageSuccess = "La validit� de la commande a �t� modifi�e ";

					} else {
						$date = new Zend_Date();

						$data = array (
  						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
  						'MONTANTVALID' => $filter->filter($params['montantfrais'])
						);
						$promoCommand->insert($data);
						$this->view->messageSuccess = "La validit� de la commande a �t� modifi�e ";
					}
				} else {
					$this->view->messageError = "Le montant de la commande doit etre sup�rieur � 0";
				}
			}
			if (isset($params['remisepour']) && isset($params['remiseeuro'])) {
					
				$remiseeuro = (int)$params['remiseeuro'];
				$remisepour = (int)$params['remisepour'];
				$isOK = true;
				if ($remiseeuro > 0 && $remisepour > 0) {
					$this->view->messageError = "La remise est soit en EURO, soit en POURCENTAGE. ";
					$isOK = false;
				}
				if ($remiseeuro == 0 && $remisepour == 0) {
					$this->view->messageError = "La remise est soit en EURO, soit en POURCENTAGE et est obligatoire. ";
					$isOK = false;
				}
				if (($validator->isValid($remiseeuro) ||
				$validator->isValid($remisepour)) && $isOK == true
				) {
					switch ($params['remise']) {
						case 1 :
							$isExistAll = $promoCommand->fetchRow("isALL IS NOT NULL");
							if ($isExistAll) {
								$date = new Zend_Date();

								$data = array (
				 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
				 		 						'isALL' => '0',
												'REMISEEURO' => $filter->filter($params['remiseeuro']),
										 		'REMISEPOUR' => $filter->filter($params['remisepour'])
								);
								$promoCommand->update($data,'ID = '.$isExistAll['ID']);
									
								$this->view->messageSuccess = "Toutes les commandes ont maintenant une remise ";

							} else {
								$date = new Zend_Date();

								$data = array (
				 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
				 		 						'isALL' => '0',
												'REMISEEURO' => $filter->filter($params['remiseeuro']),
										 		'REMISEPOUR' => $filter->filter($params['remisepour'])
								);
								$promoCommand->insert($data);
								$this->view->messageSuccess = "Toutes les commandes ont maintenant une remise ";
							}

							break;
						case 2 :
							if ($validator->isValid($params['montant']) &&
							(int)$params['montant'] > 0
							) {
									
								$isExistMontant = $promoCommand->fetchRow("MONTANTEQUAL IS NOT NULL");

								if ($isExistMontant) {
									$date = new Zend_Date();

									$data = array (
				 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
				 		 						'MONTANTEQUAL' => $filter->filter($params['montant']),
												'REMISEEURO' => $filter->filter($params['remiseeuro']),
										 		'REMISEPOUR' => $filter->filter($params['remisepour'])
									);
									$promoCommand->update($data,'ID = '.$isExistMontant['ID']);

									$this->view->messageSuccess = "Toutes les commandes ont maintenant une remise ";

								} else {
									$date = new Zend_Date();

									$data = array (
				 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
				 		 						'MONTANTEQUAL' => $filter->filter($params['montant']),
												'REMISEEURO' => $filter->filter($params['remiseeuro']),
										 		'REMISEPOUR' => $filter->filter($params['remisepour'])
									);
									$promoCommand->insert($data);
									$this->view->messageSuccess = "Toutes les commandes ont maintenant une remise ";
								}
							} else {
								foreach ($validator->getErrors() as $errorCode) {
									$this->view->messageError .=  $this->getErrorValidator($errorCode);
								}
							}
							break;
						case 3 :
							if ($validator->isValid($params['nbrreference']) &&
							$validator->isValid($params['reference']) &&
							(int)$params['nbrreference'] > 0
							) {
									
								$isExistReferenceChild = $productChild->fetchRow("REFERENCE = '".$params['reference']."' ");
								if ($isExistReferenceChild) {
									$isExistReference = $promoCommand->fetchRow("CHILDREFERENCE = '".$params['reference']."' ");

									if ($isExistReference) {
										$this->view->messageError = "Les commandes ont d�j� une remise sur cet article ";

									} else {
										$date = new Zend_Date();

										$data = array (
						 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
						 		 						'CHILDREFERENCE' => $filter->filter($params['reference']),
						 		 						'CHILDNBR' => $filter->filter($params['nbrreference']),
														'REMISEEURO' => $filter->filter($params['remiseeuro']),
												 		'REMISEPOUR' => $filter->filter($params['remisepour'])
										);
										$promoCommand->insert($data);
										$this->view->messageSuccess = "Toutes les commandes ont maintenant une remise ";
									}
								} else {
									$this->view->messageError =  "La r�f�rence ".$params['reference']." n'existe pas";

								}
							} else {
								foreach ($validator->getErrors() as $errorCode) {
									$this->view->messageError .=  $this->getErrorValidator($errorCode);
								}
								if ((int)$params['nbrreference'] == 0) {
									$this->view->messageError .=  "Le nombre d'articles doit etre sup�rieur � 0";

								}
							}
							break;
						case 4 :
							if (isset($params['montantfrais']) && (int)$params['montantfrais'] > 0) {
								$isExistFrais = $promoCommand->fetchRow("MONTANTFRAISCMD IS NOT NULL AND MONTANTFRAISCMD = ".$params['montantfrais']);
								if ($isExistFrais) {
									$date = new Zend_Date();

									$data = array (
	 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
	 		 						'MONTANTFRAISCMD' => $filter->filter($params['montantfrais']),
									'REMISEEURO' => $filter->filter($params['remiseeuro']),
									'REMISEPOUR' => $filter->filter($params['remisepour'])
									);
									$promoCommand->update($data,'ID = '.$isExistFrais['ID']);

									$this->view->messageSuccess = "Les frais de livraison sont modifi�s ";

								} else {
									$date = new Zend_Date();

									$data = array (
	 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
	 		 						'MONTANTFRAISCMD' => $filter->filter($params['montantfrais']),
									'REMISEEURO' => $filter->filter($params['remiseeuro']),
									'REMISEPOUR' => $filter->filter($params['remisepour'])
									);
									$promoCommand->insert($data);
									$this->view->messageSuccess = "Les frais de livraison sont modifi�s ";
								}
							} else {
								$this->view->messageError = "Le montant de la commande doit etre sup�rieur � 0";
							}
							break;
						default:
							$this->_forward('command');
							break;

					}
				} else {
					foreach ($validator->getErrors() as $errorCode) {
						$this->view->messageError .=  $this->getErrorValidator($errorCode);
					}
				}
			}
		}
		$this->_forward('command');
	}
	function commanddelAction() {
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id > 0 ) {
				$promoCommand = new PromoCommand();
				$promoCommand->delete('ID = '.$id);
				$this->view->messageSuccess = "La remise a �t� supprim�e ";
			} else {
				$this->view->messageError = "La remise n'a pas �t� supprim�e ";

			}
		}
		$this->_forward('command');
	}
	function userAction() {
		$this->view->titlePage = "Les remises des Clients";
		$promoUser = new PromoUser();
		$user = new User();
		$supplierBrend = new SupplierBrend();
		$this->view->listbrend = $supplierBrend->fetchAll($supplierBrend->select()->order('BREND ASC'));

		$codeIntern = new CodeIntern();
		$this->view->listAllCIntern = $codeIntern->fetchAll($codeIntern->select()->order('CODE ASC'));

		$listAllUserSQL = "
		SELECT u.NOM NOM,u.ID IDUSER, u.PRENOM PRENOM
				FROM user AS u 
				ORDER BY u.NOM, u.PRENOM ASC";
		$listAllUser = $user->getAdapter()->fetchAll($listAllUserSQL);
		if ($listAllUser) {
			$this->view->listAllUser = $listAllUser;
		}

		$listUserSQL = "
		SELECT u.NOM NOM,u.ID IDUSER, u.PRENOM PRENOM, 
				pu.ID ID, pu.REMISEEURO REMISEEURO, pu.REMISEPOUR REMISEPOUR
				FROM promo_user AS pu
				LEFT JOIN user AS u ON u.ID = pu.IDUSER
				WHERE pu.IDUSER IS NOT NULL
				ORDER BY u.NOM, u.PRENOM ASC";
		$listUser = $promoUser->getAdapter()->fetchAll($listUserSQL);
		if ($listUser) {
			$this->view->listUser = $listUser;
		}

		$isDateInsc = $promoUser->fetchRow('isDATEINSCR = 0');
		if ($isDateInsc) {
			$this->view->dateInsc = $isDateInsc;
		}
		$isFirstCmd = $promoUser->fetchRow('isFIRSTCMD = 0');
		if ($isFirstCmd) {
			$this->view->firstCmd = $isFirstCmd;
		}

		$listUserBrendSQL = "
		SELECT u.NOM NOM,u.ID IDUSER, u.PRENOM PRENOM, 
				pu.ID ID, pu.REMISEEURO REMISEEURO, pu.REMISEPOUR REMISEPOUR, pu.USERIDBREND USERIDBREND, pu.USERBRENDID USERBRENDID, sb.BREND BREND, sb.IDSUPPLIER IDSUPPLIER
				FROM promo_user AS pu
				LEFT JOIN user AS u ON u.ID = pu.USERIDBREND
				LEFT JOIN supplier_brend AS sb ON sb.ID = pu.USERBRENDID
				WHERE pu.USERIDBREND IS NOT NULL
				AND pu.USERBRENDID IS NOT NULL
				ORDER BY u.NOM, u.PRENOM ASC";
		$listUserBrend = $promoUser->getAdapter()->fetchAll($listUserBrendSQL);
		if ($listUserBrend) {
			$this->view->listUserBrend = $listUserBrend;
		}

		$listCinternBrendSQL = "
		SELECT pu.ID ID, pu.REMISEEURO REMISEEURO, pu.REMISEPOUR REMISEPOUR, uci.LABEL LABELINTERN, uci.CODE CODEINTERN,
			pu.CINTERNIDBREND CINTERNIDBREND, sb.BREND BREND, pu.CINTERNBRENDID CINTERNBRENDID, sb.IDSUPPLIER IDSUPPLIER
				FROM promo_user AS pu
				LEFT JOIN user_cintern AS uci ON uci.ID = pu.CINTERNIDBREND
				LEFT JOIN supplier_brend AS sb ON sb.ID = pu.CINTERNBRENDID
				WHERE pu.CINTERNIDBREND IS NOT NULL 
				AND pu.CINTERNBRENDID IS NOT NULL 
				ORDER BY uci.CODE,sb.BREND ASC";
		$listCinternBrend = $promoUser->getAdapter()->fetchAll($listCinternBrendSQL);
		if ($listCinternBrend) {
			$this->view->listCinternBrend = $listCinternBrend;
		}



	}
	function useraddAction() {
		if ($this->getRequest()->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			$promoUser = new PromoUser();

			$params = array();
			$params = $this->getRequest()->getPost();

			$remiseeuro = (int)$params['remiseeuro'];
			$remisepour = (int)$params['remisepour'];
			$isOK = true;
			if ($remiseeuro > 0 && $remisepour > 0) {
				$this->view->messageError = "La remise est soit en EURO, soit en POURCENTAGE. ";
				$isOK = false;
			}
			if ($remiseeuro == 0 && $remisepour == 0) {
				$this->view->messageError = "La remise est soit en EURO, soit en POURCENTAGE et est obligatoire. ";
				$isOK = false;
			}
			if (($validator->isValid($remiseeuro) ||
			$validator->isValid($remisepour)) && $isOK == true
			) {
				switch ($params['remise']) {
					case 1 :
						$isExistAnnif = $promoUser->fetchRow("isDATEINSCR IS NOT NULL");
						if ($isExistAnnif) {
							$date = new Zend_Date();

							$data = array (
	 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
	 		 						'isDATEINSCR' => '0',
									'REMISEEURO' => $filter->filter($params['remiseeuro']),
							 		'REMISEPOUR' => $filter->filter($params['remisepour'])
							);
							$promoUser->update($data,'ID = '.$isExistAnnif['ID']);

							$this->view->messageSuccess = "Tout les clients ont maintenant une remise selon leurs dates d'inscription";

						} else {
							$date = new Zend_Date();

							$data = array (
	 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
	 		 						'isDATEINSCR' => '0',
									'REMISEEURO' => $filter->filter($params['remiseeuro']),
							 		'REMISEPOUR' => $filter->filter($params['remisepour'])
							);
							$promoUser->insert($data);
							$this->view->messageSuccess = "Tout les clients ont maintenant une remise selon leurs dates d'inscription";

						}

						break;
					case 2 :
						$isExistFirst = $promoUser->fetchRow("isFIRSTCMD IS NOT NULL");
						if ($isExistFirst) {
							$date = new Zend_Date();

							$data = array (
	 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
	 		 						'isFIRSTCMD' => '0',
									'REMISEEURO' => $filter->filter($params['remiseeuro']),
							 		'REMISEPOUR' => $filter->filter($params['remisepour'])
							);
							$promoUser->update($data,'ID = '.$isExistFirst['ID']);

							$this->view->messageSuccess = "Tout les clients ont maintenant une remise si c'est la premi�re commande";

						} else {
							$date = new Zend_Date();

							$data = array (
	 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
	 		 						'isFIRSTCMD' => '0',
									'REMISEEURO' => $filter->filter($params['remiseeuro']),
							 		'REMISEPOUR' => $filter->filter($params['remisepour'])
							);
							$promoUser->insert($data);
							$this->view->messageSuccess = "Tout les clients ont maintenant une remise si c'est la premi�re commande";

						}

						break;
					case 3 :
						$iduser = (int)$params['iduser'];
						if ($iduser > 0) {
							$isExistUser = $promoUser->fetchRow("IDUSER IS NOT NULL AND IDUSER = ".$iduser);
							if ($isExistUser) {
								$date = new Zend_Date();

								$data = array (
		 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
		 		 						'IDUSER' => (int)$params['iduser'],
										'REMISEEURO' => $filter->filter($params['remiseeuro']),
								 		'REMISEPOUR' => $filter->filter($params['remisepour'])
								);
								$promoUser->update($data,'ID = '.$isExistUser['ID']);

								$this->view->messageSuccess = "Le client � maintenant une remise sur sa prochaine commande";

							} else {
								$date = new Zend_Date();

								$data = array (
		 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
		 		 						'IDUSER' => (int)$params['iduser'],
										'REMISEEURO' => $filter->filter($params['remiseeuro']),
								 		'REMISEPOUR' => $filter->filter($params['remisepour'])
								);
								$promoUser->insert($data);
								$this->view->messageSuccess = "Le client � maintenant une remise sur sa prochaine commande";

							}
						} else {
							$this->view->messageError = "S�lectionner un utilisateur";

						}
						break;

					case 4 :
						$iduser = (int)$params['iduser'];
						$idbrend = (int)$params['idbrend'];
						if ($iduser > 0 && $idbrend > 0) {
							$isExistUserBrend = $promoUser->fetchRow("USERIDBREND IS NOT NULL AND USERIDBREND = ".$iduser." AND USERBRENDID IS NOT NULL AND USERBRENDID = ".$idbrend);
							if ($isExistUserBrend) {
								$date = new Zend_Date();

								$data = array (
		 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
		 		 						'USERIDBREND' => $iduser,
		 		 						'USERBRENDID' => $idbrend,
										'REMISEEURO' => $filter->filter($params['remiseeuro']),
								 		'REMISEPOUR' => $filter->filter($params['remisepour'])
								);
								$promoUser->update($data,'ID = '.$isExistUserBrend['ID']);

								$this->view->messageSuccess = "Le client � maintenant une remise sur les produits de la marque";

							} else {
								$date = new Zend_Date();

								$data = array (
		 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
		 		 						'USERIDBREND' => $iduser,
		 		 						'USERBRENDID' => $idbrend,
										'REMISEEURO' => $filter->filter($params['remiseeuro']),
								 		'REMISEPOUR' => $filter->filter($params['remisepour'])
								);
								$promoUser->insert($data);
								$this->view->messageSuccess = "Le client � maintenant une remise sur les produits de la marque";

							}
						} else {
							$this->view->messageError = "S�lectionner un client et une marque";

						}
						break;

					case 5 :
						$idcintern = (int)$params['idcintern'];
						$idbrend = (int)$params['idbrend'];
						if ($idcintern > 0 && $idbrend > 0) {
							$isExistCinternBrend = $promoUser->fetchRow("CINTERNIDBREND IS NOT NULL AND CINTERNIDBREND = ".$idcintern." AND CINTERNBRENDID IS NOT NULL AND CINTERNBRENDID = ".$idbrend);
							if ($isExistCinternBrend) {
								$date = new Zend_Date();

								$data = array (
		 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
		 		 						'CINTERNIDBREND' => $idcintern,
		 		 						'CINTERNBRENDID' => $idbrend,
										'REMISEEURO' => $filter->filter($params['remiseeuro']),
								 		'REMISEPOUR' => $filter->filter($params['remisepour'])
								);
								$promoUser->update($data,'ID = '.$isExistCinternBrend['ID']);

								$this->view->messageSuccess = "Le code interne a maintenant une remise sur les produits de la marque";

							} else {
								$date = new Zend_Date();

								$data = array (
		 		 						'DATEINSERTREMISE' => $date->toString('YYYY-MM-dd HH-mm-ss'),
		 		 						'CINTERNIDBREND' => $idcintern,
		 		 						'CINTERNBRENDID' => $idbrend,
										'REMISEEURO' => $filter->filter($params['remiseeuro']),
								 		'REMISEPOUR' => $filter->filter($params['remisepour'])
								);
								$promoUser->insert($data);
								$this->view->messageSuccess = "Le code interne � maintenant une remise sur les produits de la marque";

							}
						} else {
							$this->view->messageError = "S�lectionner un code interne et une marque";

						}
						break;
					default:
						$this->_forward('user');
						break;

				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('user');
	}
	function userdelAction() {
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id > 0 ) {
				$promoUser = new PromoUser();
				$promoUser->delete('ID = '.$id);
				$this->view->messageSuccess = "La remise a �t� supprim�e ";
			} else {
				$this->view->messageError = "La remise n'a pas �t� supprim�e ";

			}
		}
		$this->_forward('user');
	}
	function giftAction() {
		$this->view->titlePage = "Les Avantages";
		$promoGift = new PromoGift();

		$listProductGiftSQL = "
		SELECT pg.PRODREFBUY PRODREFBUY, pg.PRODREFGIFT PRODREFGIFT,pg.ID ID,
				pg.PRODNBBUY PRODNBBUY,pg.PRODNBGIFT PRODNBGIFT 
				 FROM promo_gift AS pg
				WHERE pg.PRODREFBUY IS NOT NULL 
				AND pg.PRODREFGIFT IS NOT NULL
				ORDER BY pg.PRODREFBUY, pg.PRODREFGIFT ASC";
		$listProductGift = $promoGift->getAdapter()->fetchAll($listProductGiftSQL);
		$this->view->listProductGift = $listProductGift;

		$listCmdGiftSQL = "
		SELECT pg.CMDMONTANT CMDMONTANT, pg.CMDPRODREFGIFT CMDPRODREFGIFT,pg.ID ID, pc.IDPRODUCT
				 FROM promo_gift AS pg
				 LEFT JOIN productchild AS pc ON pc.REFERENCE = pg.CMDPRODREFGIFT
				WHERE pg.CMDMONTANT IS NOT NULL 
				AND pg.CMDPRODREFGIFT IS NOT NULL
				ORDER BY pg.CMDPRODREFGIFT ASC";
		$listCmdGift = $promoGift->getAdapter()->fetchAll($listCmdGiftSQL);
		$this->view->listCmdGift = $listCmdGift;
	}

	function giftaddAction() {
		if ($this->getRequest()->isPost()) {
			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			$params = $this->getRequest()->getPost();
			$promoGift = new PromoGift();
			$productChild = new ProductChild();

			switch ($params['gift']) {
				case 1 :
					$buy = $filter->filter($params['referencebuy']);
					$nbbuy = $filter->filter((int)$params['referencenbbuy']);
					$gift = $filter->filter($params['referencegift']);
					$nbgift = $filter->filter((int)$params['referencenbgift']);
					if ($validator->isValid($buy) &&
					$validator->isValid($gift) && 
					((int)$nbbuy>0) && 
					((int)$nbgift>0) ) {
						$isExistBuy = $productChild->fetchRow("REFERENCE = '".$buy."' ");

						if ($isExistBuy) {
							$isExistGift = $productChild->fetchRow("REFERENCE = '".$gift."' ");
							if ($isExistGift) {
								$isExistPromo = $promoGift->fetchRow("PRODREFBUY = '".$buy."' AND PRODREFGIFT = '".$gift."'");
								if (!$isExistPromo) {
									$date = new Zend_Date();
									$data = array (
			 		 						'DATEINSERTGIFT' => $date->toString('YYYY-MM-dd HH-mm-ss'),
			 		 						'PRODREFBUY' => $buy,
											'PRODREFGIFT' => $gift,
											'PRODNBGIFT' => $nbgift,
											'PRODNBBUY' => $nbbuy
									);

									$promoGift->insert($data);
									$this->view->messageSuccess = "L'avantage est maintenant disponible";
								} else {
									$this->view->messageError = "L'avantage existe d�j�";
								}
							} else {
								$this->view->messageError = "La r�f�rence ".$params['referencegift']." n'existe pas";
							}
						} else {
							$this->view->messageError = "La r�f�rence ".$params['referencebuy']." n'existe pas";
						}

					} else {
						foreach ($validator->getErrors() as $errorCode) {
							$this->view->messageError .=  $this->getErrorValidator($errorCode);
						}
					}
					break;
				case 2 :
					$reference = $filter->filter($params['reference']);
					if ($validator->isValid($params['montant']) &&
					$validator->isValid($reference)) {
						if ((int)$params['montant'] > 0) {
							$isExistGift = $productChild->fetchRow("REFERENCE = '".$reference."' ");

							if ($isExistGift) {
								$isExistPromo = $promoGift->fetchRow("CMDMONTANT = '".$params['montant']."' AND CMDPRODREFGIFT = '".$reference."'");
								if (!$isExistPromo) {
									$date = new Zend_Date();
									$data = array (
			 		 						'DATEINSERTGIFT' => $date->toString('YYYY-MM-dd HH-mm-ss'),
			 		 						'CMDMONTANT' => $filter->filter($params['montant']),
											'CMDPRODREFGIFT' => $reference
									);

									$promoGift->insert($data);
									$this->view->messageSuccess = "L'avantage est maintenant disponible";
								} else {
									$this->view->messageError = "L'avantage existe d�j�";
								}
							} else {
								$this->view->messageError = "La r�f�rence ".$reference." n'existe pas";
							}
						} else {
							$this->view->messageError = "Le montant doit etre > 0";
						}
					} else {
						foreach ($validator->getErrors() as $errorCode) {
							$this->view->messageError .=  $this->getErrorValidator($errorCode);
						}
					}
					break;

			}
		}
		$this->_forward('gift');
	}

	function giftdelAction() {
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id > 0 ) {
				$promoGift = new PromoGift();
				$promoGift->delete('ID = '.$id);
				$this->view->messageSuccess = "L'avantage a �t� supprim�e ";
			} else {
				$this->view->messageError = "L'avantage n'a pas �t� supprim�e ";

			}
		}
		$this->_forward('gift');
	}
	
	function codereductionAction(){
		$this->view->titlePage = "Les Codes de r�duction";
		$codeReduction = new CodeReduction();
		$listCodes = $codeReduction->getAllCodes();
		$this->view->listReduc = $listCodes;
	}
	
	private function passgen() {
		$chaine ="mnoTUzS5678kVvwxy9WXYZRNCDEFrslq41GtuaHIJKpOPQA23LcdefghiBMbj0";
		srand((double)microtime()*1000000);
		for($i=0; $i<8; $i++){
			@$pass .= $chaine[rand()%strlen($chaine)];
		}
		return $pass;
	}
	
	function addcodereductionproduitAction(){
		if ($this->getRequest()->isPost()) {
			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			$params = array();
			$params = $this->getRequest()->getPost();
			
			$codereduc_euro = $params['codereduc_euro'];
			$codereduc_pour = (int)$params['codereduc_pour'];
			$isOK = true;
			if ($codereduc_euro > 0 && $codereduc_pour > 0) {
				$this->view->messageError = "La r�duction est soit en EURO, soit en POURCENTAGE. ";
				$isOK = false;
			}
			if ($codereduc_euro == 0 && $codereduc_pour == 0) {
				$this->view->messageError = "La r�duction est soit en EURO, soit en POURCENTAGE et est obligatoire. ";
				$isOK = false;
			}
			
			$codereduc_ref = $params['codereduc_ref'];
			$codereduc_nbr = (int)$params['codereduc_nbr'];
			$sd = $params['sd2'];
			$ed = $params['ed2'];
			
			if (($validator->isValid($codereduc_euro) ||
			$validator->isValid($codereduc_pour)) && 
			$isOK == true &&
			$validator->isValid($codereduc_ref) && 
			$validator->isValid($codereduc_nbr) 
			) {
				$validator2 = new Zend_Validate();
				$validator2->addValidator(new Zend_Validate_Date());

				if ($validator2->isValid($sd) &&
				$validator2->isValid($ed)
				) {
					$code = $this->passgen();
					$labelProd = "produit";
					$labelDroit = "donne";
					if ($codereduc_nbr > 1) { $labelProd .= "s"; $labelDroit .= "nt"; }
					$labelPrix = "";
					if ($codereduc_pour > 0) { $labelPrix = $codereduc_pour. " %";
					} else { $labelPrix = $codereduc_euro. " euros"; }
					$libelle = $codereduc_nbr." ".$labelProd." de la r�ference : ".$codereduc_ref." ".$labelDroit." droit � ".$labelPrix." de r�duction. ";
					
					$codeReduction = new CodeReduction();
					$data = array(
						"CODE" => $code,
						"LIBELLE" => $libelle,
						"PRODUITREF" => $codereduc_ref,
						"PRODUITNBR" => $codereduc_nbr,
						"EURO" => $codereduc_euro,
						"POUR" => $codereduc_pour,
						"DATESTART" => $sd,
						"DATEEND" => $ed,
						"isACTIF" => 1
					);
					$codeReduction->insert($data);
					$this->view->messageSuccess = "CODE : ".$code." : ".$libelle;
				} else {
					foreach ($validator->getErrors() as $errorCode) {
						$this->view->messageError .=  $this->getErrorValidator($errorCode);
					}
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('codereduction');
	}
	
	function addcodereductioncommandeAction(){
		if ($this->getRequest()->isPost()) {
			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			$params = array();
			$params = $this->getRequest()->getPost();
			
			$codereduc_euro = $params['codereduc_euro'];
			$codereduc_pour = (int)$params['codereduc_pour'];
			$isOK = true;
			if ($codereduc_euro > 0 && $codereduc_pour > 0) {
				$this->view->messageError = "La r�duction est soit en EURO, soit en POURCENTAGE. ";
				$isOK = false;
			}
			if ($codereduc_euro == 0 && $codereduc_pour == 0) {
				$this->view->messageError = "La r�duction est soit en EURO, soit en POURCENTAGE et est obligatoire. ";
				$isOK = false;
			}
			
			$codereduc_cmdmin = $params['codereduc_cmdmin'];
			$sd = $params['sd1'];
			$ed = $params['ed1'];
			
		if (($validator->isValid($codereduc_euro) ||
			$validator->isValid($codereduc_pour)) && 
			$isOK == true &&
			$validator->isValid($codereduc_cmdmin) 
			) {
				$validator2 = new Zend_Validate();
				$validator2->addValidator(new Zend_Validate_Date());

				if ($validator2->isValid($sd) &&
				$validator2->isValid($ed)
				) {
					if ($codereduc_cmdmin > 0) {
						
						$code = $this->passgen();
						$labelPrix = "";
						if ($codereduc_pour > 0) { $labelPrix = $codereduc_pour. " %";
						} else { $labelPrix = $codereduc_euro. " euros"; }
						$libelle = "Pour ".$codereduc_cmdmin." euros de commande, il y a ".$labelPrix." de r�duction. ";
					
						$codeReduction = new CodeReduction();
						$data = array(
							"CODE" => $code,
							"LIBELLE" => $libelle,
							"CMDTOTAL" => $codereduc_cmdmin,
							"EURO" => $codereduc_euro,
							"POUR" => $codereduc_pour,
							"DATESTART" => $sd,
							"DATEEND" => $ed,
							"isACTIF" => 1
						);
						$codeReduction->insert($data);
						$this->view->messageSuccess = "CODE : ".$code."<br/> ".$libelle;
					}
				} else {
					foreach ($validator->getErrors() as $errorCode) {
						$this->view->messageError .=  $this->getErrorValidator($errorCode);
					}
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('codereduction');
	}
	
	
	function delcodereductionAction() {
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id > 0 ) {
				$codeReduction = new CodeReduction();
				$codeReduction->delete('ID = '.$id);
				$this->view->messageSuccess = "Le code de r�duction a �t� supprim�e ";
			} else {
				$this->view->messageError = "Le code de r�duction n'a pas �t� supprim�e ";

			}
		}
		$this->_forward('codereduction');
	}

	function activecodereductionAction() {
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id > 0 ) {
				$codeReduction = new CodeReduction();
				$data = array(
					"isACTIF" => 1
				);
				$codeReduction->update($data,'ID = '.$id);
				$this->view->messageSuccess = "Le code de r�duction est actif ";
			} 
		}
		$this->_forward('codereduction');
	}

	function unactivecodereductionAction() {
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id > 0 ) {
				$codeReduction = new CodeReduction();
				$data = array(
					"isACTIF" => 0
				);
				$codeReduction->update($data,'ID = '.$id);
				$this->view->messageSuccess = "Le code de r�duction est inactif ";
			}
		}
		$this->_forward('codereduction');
	}
}
?>modules/backoffice/controllers/AnnonceleftController.php000060400000012117150710367660017660 0ustar00<?php
class Backoffice_AnnonceleftController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "AnnonceLeft";
		$this->isConnectedWithRole('isPromo');
	}
	public function indexAction()
	{
		$this->_forward('/list');
	}

	public function editAction()
	{
			
		$this->view->titlePage = "Modifier une Annonce";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
			
		//filtres pour changer les chaines
		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		//valideurs pour les chaines
		$validator = new Zend_Validate();
		$validator -> addValidator(new Zend_Validate_NotEmpty())
		-> addValidator(new Zend_Validate_StringLength(3));

		$annonce = new AnnonceLeft();
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id>0) {
				$this->view->populateFormAnnonceLeft = $annonce->fetchRow('ID = '.$id);
			}
		}
		if ($this->getRequest()->isPost()) {

			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'ID' => (int)$params['id'],
			 		'NOM' => $filter->filter($params['nom']),
			 		'CONTENT' => $params['content'],
			 		'isSHOW' => $params['isshow'],
					'ID_CATS' => ''
					);
					
					if (isset($params['categories'])) {
						foreach($params['categories'] as $value)
						{
							$dataAnnonce['ID_CATS'] .= ":".$value.":";
						}
					}
					if ($validator->isValid($dataAnnonce['NOM']) &&
					$validator->isValid($dataAnnonce['CONTENT'])&&
					!empty($dataAnnonce['ID_CATS'])
					) {
						try {
							$id = (int)$params['id'];
							if ( $id > 0) {
									
								$annonce->update($dataAnnonce,'ID = '.$id);
								$this->view->messageSuccess = "La publicit� a �t� modifi�e";
								$this->view->populateFormAnnonceLeft = $annonce->fetchRow('ID = '.$id);
								$this->log("La publicit� a �t� modifi�e ".$id,'info');
							}
						} catch (Zend_Exception $e) {
							$this->log($e->getMessage(),'err');
							$this->view->populateFormAnnonceLeft = $dataAnnonce;
						}
					} else {
						foreach ($validator->getErrors() as $errorCode) {
							$this->view->messageError .=  $this->getErrorValidator($errorCode);
						}
						$this->view->populateFormAnnonceLeft = $dataAnnonce;
					}

		}
		$this->_forward('/list');
	}


	public function addAction()
	{
			
		$this->view->titlePage = "Ajouter une Annonce";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'NOM' => $filter->filter($params['nom']),
			 		'CONTENT' => $params['content'],
			 		'isSHOW' => $params['isshow'],
					'ID_CATS' => ''
					);
					
					if (isset($params['categories'])) {
						foreach($params['categories'] as $value)
						{
							$dataAnnonce['ID_CATS'] .= ":".$value.":";
						}
					}
					
					if (
					$validator->isValid($dataAnnonce['NOM']) &&
					$validator->isValid($dataAnnonce['CONTENT']) &&
					!empty($dataAnnonce['ID_CATS'])
					) {
						try {
							$annonce = new AnnonceLeft();
							$annonce->insert($dataAnnonce);
							$this->view->messageSuccess = "La publicit� a �t� ajout�e";
							$this->log("La publicit� a �t� ajout�e",'info');
						} catch (Zend_Exception $e) {
							$this->log($e->getMessage(),'err');
							$this->view->populateFormAnnonceLeft = $dataAnnonce;
						}

					} else {
						foreach ($validator->getErrors() as $errorCode) {
							$this->view->messageError .=  $this->getErrorValidator($errorCode);
						}
						$this->view->populateFormAnnonceLeft = $dataAnnonce;
					}

		}
		$this->_forward('/list');
	}

	public function listAction()
	{
		$this->view->titlePage = "Gestion des publicit�s par cat�gories"; 
			
		//Appel model pour listing
		$annonces = new AnnonceLeft();
		$result = $annonces->getAllAnnonces();

		$category = new Category();
		$this->view->listallcategories = $category->getAllCategoriesByID(0);
		
		$this->view->listannonceleft = $result;
	}



	public function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$annonce = new AnnonceLeft();

					$annonce->delete('ID = '.$id);
					$this->view->messageSuccess = "La publicit� a �t� supprim�e";

					$this->log("La publicit� a �t� supprim�e",'info');
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');
	}

}
?>modules/backoffice/controllers/PrestashopController.php000060400000065162150710367660017564 0ustar00<?php
class Backoffice_PrestashopController extends Modules_Backoffice_Controllers_MainController {
	function init() {
		$this->view->title = "Administration";
		$this->view->currentMenu = "Prestashop";
		$this->isConnectedWithRole ( 'isMaintenance' );
	}
	public function indexAction() {
			$this->view->titlePage = "Gestion commerciale Prestashop";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
	}
	private $_SEPARATOR = ';';
	private function cleanUp($value) {
		$result = $value;
		$filter = new Zend_Filter ();
		$filter->addFilter ( new Zend_Filter_StringTrim () )->addFilter ( new Zend_Filter_StripTags () );
		$result = $filter->filter ( $result );
		$result = html_entity_decode ( $result, ENT_QUOTES, "ISO-8859-1" );
		$result = str_replace ( "\r\n", "", $result );
		$result = str_replace ( '�', " ", $result );  
		$result = str_replace ( '"', '\"', $result );  
		$result = str_replace ( $this->_SEPARATOR, "", $result );
		return !empty($result) ? '"'.$result.'"' : "";
	}
	private function cleanUpSpace($value) {
		$filter = new Zend_Filter ();
		$filter->addFilter ( new Zend_Filter_Alnum () );
		$value = str_replace ( $this->_SEPARATOR, "", $value );
		return $filter->filter ( $value );
	}
	private function cleanUpAddQuote($value) {
		return '"' . $this->cleanUp ( $value ) . '"';
	}
	function exportclientsAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale EBP";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$fichier = new FichierExcel ();
			$user = new User ();
			$select = $user->select ()->order ( "ID ASC" );
			$listusers = $user->fetchAll ( $select );
			
			foreach ( $listusers as $row ) {
				$result = $row ['ID'] . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['NOM'] ) . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Code Famille
				                              // Facturation
				$result .= $row ['CIVILITE'] . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['ADRESSE'] ) . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Adresse 2
				$result .= $this->_SEPARATOR; // Adresse 3
				$result .= $this->_SEPARATOR; // Adresse 4
				$result .= $this->cleanUpSpace ( $row ['CP'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['VILLE'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['DEPARTEMENT'] ) . $this->_SEPARATOR;
				$result .= "FR" . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Site Web
				$result .= $row ['CIVILITE'] . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['PRENOM'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['NOM'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['FONCTION'] ) . $this->_SEPARATOR;
				$result .= $row ['TEL'] . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Tel Portable
				$result .= $row ['FAX'] . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['EMAIL'] ) . $this->_SEPARATOR;
				// Livraison
				$result .= $row ['CIVILITE'] . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['NOM'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['ADRESSE'] ) . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Adresse 2
				$result .= $this->_SEPARATOR; // Adresse 3
				$result .= $this->_SEPARATOR; // Adresse 4
				$result .= $this->cleanUpSpace ( $row ['CP'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['VILLE'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['DEPARTEMENT'] ) . $this->_SEPARATOR;
				$result .= "FR" . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Site Web
				                              // Contact
				$result .= $row ['CIVILITE'] . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['PRENOM'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['NOM'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['FONCTION'] ) . $this->_SEPARATOR;
				$result .= $row ['TEL'] . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Tel Portable
				$result .= $row ['FAX'] . $this->_SEPARATOR;
				$result .= $this->cleanUp ( $row ['EMAIL'] ) . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Compte comptable
				$result .= $this->cleanUpSpace ( $row ['NUMIDFISC'] ) . $this->_SEPARATOR;
				$result .= $this->cleanUpSpace ( $row ['SIRET'] ) . $this->_SEPARATOR;
				$result .= $this->_SEPARATOR; // Code NAF
				$result .= "0";
				
				$fichier->Insertion ( $result );
			}
			$fichier->output ( 'ebp_clients' );
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
	} 
	function exportfournisseursAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale : Prestashop";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$fichier = new FichierExcel ();
			$supplier = new Supplier ();
			$select = $supplier->select ()->order ( "ID ASC" );
			$listsuppliers = $supplier->fetchAll ( $select );
			
			$supplierBrend = new SupplierBrend ();
			
		    $result = "ID" . $this->_SEPARATOR;
		    $result .= "Active (0/1)" . $this->_SEPARATOR;
		    $result .= "Name *".$this->_SEPARATOR; 
		    $result .= "Description".$this->_SEPARATOR;  
		    $result .= "Short description".$this->_SEPARATOR;
		    $result .= "Meta title".$this->_SEPARATOR;  
		    $result .= "Meta keywords".$this->_SEPARATOR; 
		    $result .= "Meta description".$this->_SEPARATOR; 
		    $result .= "Image URL";  
			$fichier->Insertion ($result);
			
			foreach ( $listsuppliers as $row ) {
				
				$listbrends = $supplierBrend->select()->where ( "IDSUPPLIER = " . $row ['ID'] )->query ()->fetchAll ();
				
				foreach ( $listbrends as $rowBrend ) { 
					$result = $rowBrend['ID'].$this->_SEPARATOR;
					$result .= '1'. $this->_SEPARATOR;
					$result .= $this->cleanUp ( $rowBrend ['BREND'] ) . $this->_SEPARATOR;
					$result .= '"'.str_replace ( '"', '\"',$row ['DESCRIPTIONLONG'] ).'"'.$this->_SEPARATOR;   
					$result .= $this->cleanUp ( $row ['DESCRIPTIONSHORT'] ).$this->_SEPARATOR;   
					$result .=  $this->cleanUp ( $rowBrend ['BREND']." - Achat / Vente produits ".$rowBrend ['BREND']." pour professionnel").$this->_SEPARATOR;   
					$result .= $this->cleanUp ( $rowBrend ['BREND'].", ".$row ['COMPANY']).$this->_SEPARATOR;   
					$result .= $this->cleanUp ( $row ['DESCRIPTIONSHORT'] ).$this->_SEPARATOR;   
					$result .=$this->baseUrl_SiteCommerceUrl."/".$rowBrend ['URL'];   
					
					$fichier->Insertion ( $result );
				}
			}
			$fichier->output ( 'presta_fabricants' );
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
	}
	function exportcategoriesAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale : Prestashop";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
            //Prestashop 
            $result = "ID". $this->_SEPARATOR;
			$result .= "Active (0/1)" . $this->_SEPARATOR;
			$result .= "Name *". $this->_SEPARATOR;
			$result .= "Parent category".$this->_SEPARATOR;
			$result .= "Root category (0/1)".$this->_SEPARATOR;
			$result .= "Description".$this->_SEPARATOR;
			$result .= "Meta title". $this->_SEPARATOR;
			$result .=  "Meta keywords". $this->_SEPARATOR;
			$result .= "Meta description". $this->_SEPARATOR; 
			$result .= "URL rewritten".$this->_SEPARATOR;
			$result .= "Image URL";
				
			$fichier = new FichierExcel ();
            
			$fichier->Insertion ( $result );
            
			$category = new Category ();
             $sql = "SELECT c.*  FROM category AS c  where idparent = 0 order by ID asc";   
	        $listcategories =$category->getAdapter ()->fetchAll($sql);
            
            $this->exportcategoriescsvline($fichier, $listcategories, "Accueil");
			
			$fichier->output ( 'presta_categories' );
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
	}
    private function exportcategoriescsvline($fichier, $listcategories, $parentName) {
    
			$category = new Category ();
        foreach ( $listcategories as $row ) {
            $isroot =  '0';
                
            $id = "";//$row ['ID'];
			$result = $id. $this->_SEPARATOR;
			$result .= $row ['isACTIVE'] . $this->_SEPARATOR;
			$result .= $this->cleanUp ( $row ['NOM'] ) . $this->_SEPARATOR;
			$result .= $parentName .$this->_SEPARATOR;
			$result .= $isroot.$this->_SEPARATOR;
            $name = !empty($row['DESCRIPTIONLONG']) ? $row ['DESCRIPTIONLONG'] : $row ['DESCRIPTION'];
                 
			$result .= '"'.str_replace ( '"', '\"',$name).'"'.$this->_SEPARATOR;
			$result .= $this->cleanUp ( $row ['NAVTITRENOM'] ). $this->_SEPARATOR; 
			$result .=  '"'.str_replace ( '"', '\"',substr($row ['KEYWORDS'], 0, 255)).'"'. $this->_SEPARATOR; 
			$result .=  '"'.str_replace ( '"', '\"',substr($row ['NAVDESCRIPTION'], 0, 255)).'"'. $this->_SEPARATOR; 
			$result .= $this->_SEPARATOR;
			$result .= $this->baseUrl_SiteCommerceUrl."/".$row ['URL'];
				
			$fichier->Insertion ( $result );
            
             $sql = "SELECT c.*  FROM category AS c  where idparent = ".$row ['ID']." order by NOM asc";   
	        $listcategoriesubs =$category->getAdapter ()->fetchAll($sql);
            if (!empty($listcategoriesubs)) {
                $this->exportcategoriescsvline($fichier, $listcategoriesubs, $this->cleanUp ( $row ['NOM'] ));
            }
		}
    }
    
	private function getUrlPage($params) {
		return $this->baseUrl_SiteCommerceUrl . "/" . $params ['PAGE'] . "-" . $params ['ID'] . ".html";
	}
	function exportarticlesAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale : Prestashop";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$fichier = new FichierExcel ();
			
			$sql = "SELECT p.ID ID, p.NOM NOM,p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.DESCRIPTIONLONG DESCLONG, p.PRIX PRIX, p.isDEVIS isDEVISPRODUCT,
					p.DOCNAME DOCNAME, p.DOCURL DOCURL, p.IDBREND IDBREND,
					p.isPROMO isPROMO, pic.URL URLIMAGE, sb.BREND BREND, sb.URL BRENDURL, p.IDCATEGORY IDCATEGORY, c.NOM CATEGORYNOM,
					p.DESCRIPTIONTECH DESCTECH, p.DESCRIPTIONNORME DESCNORME
					FROM product p
					LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID
					LEFT JOIN supplier_brend sb ON sb.ID = p.IDBREND
					LEFT JOIN category AS c ON c.ID = p.IDCATEGORY
					WHERE p.isACTIVE = 0
					AND pic.POSITION = 1
					GROUP BY ID
					ORDER BY p.ID ASC";
			
			$product = new Product ();
			$productChild = new ProductChild ();
			$listProducts = $product->getAdapter ()->fetchAll ( $sql );
			
			foreach ( $listProducts as $row ) {
				$sqlChild = "
						SELECT pc.ID ID ,pc.REFERENCE REFERENCE,pc.DESIGNATION DESIGNATION,pc.PRIX PRIX, pc.isPROMO isPROMO ,
						pc.IMAGEPROMO IMAGEPROMO,pc.isDEVIS isDEVIS, pc.QUANTITYMIN QUANTITYMIN
							FROM productchild AS pc
						WHERE pc.IDPRODUCT = " . $row ['ID'] . "
						ORDER BY pc.PRIX ASC";
				
				$productChildTemp = $productChild->getAdapter ()->fetchAll ( $sqlChild );
				
				$navnom = $this->verifyNavigationString ( $row ['NAVNOM'], $row ['NOM'], '' );
				
				$urlImage = $this->baseUrl_SiteCommerceUrl . "/" . $row ['URLIMAGE'];
				$urlPage = $this->getUrlPage ( array (
						'PAGE' => $navnom,
						'ID' => $row ['ID'] 
				) );
				
				$fraislivraison = "";
				$garantie = "";
				
				$reference = "";
				$description = "";
				foreach ( $productChildTemp as $rowChild ) {
					$reference = $this->cleanUp ( $rowChild ['REFERENCE'] );
					
					$description = $this->cleanUp ( $rowChild ['DESIGNATION'] );
					
					$result = $rowChild ['ID'] . $this->_SEPARATOR;
					$result .= $this->cleanUp ( $row ['NOM'] ) . $this->_SEPARATOR;
					$result .= $row ['IDCATEGORY'] . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR; // Prix de revient
					$result .= $rowChild ['PRIX'] . $this->_SEPARATOR;
					$result .= $this->tva . $this->_SEPARATOR;
					$result .= $description . $this->_SEPARATOR;
					$result .= $reference . $this->_SEPARATOR; // Code barre
					$result .= $this->_SEPARATOR; // Code unite
					$result .= $this->_SEPARATOR; // Type d'article
					$result .= $this->_SEPARATOR; // Code emplacement
					$result .= $row ['IDBREND'] . $this->_SEPARATOR;
					$result .= $this->_SEPARATOR; // Code �co
					
					$fichier->Insertion ( $result );
				}
			}
			
			$fichier->output ( 'ebp_articles' );
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
	}
	private function formatDate($datevalue) {
		$date = new Zend_Date ();
		$date->set ( $datevalue );
		return $date->toString ( 'dd/MM/YYYY' );
	}
	private function getCommandDevisLine($listcommands) {
		$commandLine = new CommandProduct ();
		$fichier = new FichierExcel ();
		$result = "Document - Num�ro du document;Document - Date;Document - Code client;Document - Nom du client;Document - Adresse 1 (facturation);Document - Code postal (facturation);Document - Ville (facturation);Document - Code Pays (facturation);Document - Nom (contact) (facturation);Document - Pr�nom (facturation);Document - T�l�phone fixe (facturation);Document - Fax (facturation);Document - E-mail (facturation);Document - Nom (adresse) (livraison);Document - Adresse 1 (livraison);Document - Code postal (livraison);Document - Ville (livraison);Document - Code Pays (livraison);Document - T�l�phone fixe (livraison);Document - Fax (livraison);Document - E-mail (livraison);Document - Frais de port HT;Document - Total Brut HT;Document - Total TTC;Document - Taux de TVA port;Ligne - Code article;Ligne - Quantit�;Ligne - Taux de TVA;Ligne - PV HT;Ligne - Montant Net HT;Ligne - Montant de remise unitaire HT cumul�";
		$fichier->Colonne ( $result );
		foreach ( $listcommands as $row ) {
			$result = '"' . $row ['REFERENCE'] . '"' . $this->_SEPARATOR;
			$result .= '"' . $this->formatDate ( $row ['DATESTART'] ) . '"' . $this->_SEPARATOR;
			$result .= '"' . $row ['IDUSER'] . '"' . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_NOM'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['FACT_ADRESSE'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['FACT_CP'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['FACT_VILLE'] ) . $this->_SEPARATOR;
			$result .= "FR" . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_NOM'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_PRENOM'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_TEL'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_FAX'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_EMAIL'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['LIV_RAISONSOCIAL'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['LIV_ADRESSE'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['LIV_CP'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['LIV_VILLE'] ) . $this->_SEPARATOR;
			$result .= "FR" . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_TEL'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_FAX'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['USER_EMAIL'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['PRIXFRAISPORT'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['PRIXTOTALHTFP'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $row ['PRIXTOTALTTC'] ) . $this->_SEPARATOR;
			$result .= $this->cleanUpAddQuote ( $this->getCurrentTva ( $row ['DATESTART'] ) ) . $this->_SEPARATOR;
			
			$selectLine = $commandLine->select ()->where ( "IDCOMMAND = " . $row ["ID"] );
			$listLines = $commandLine->fetchAll ( $selectLine );
			foreach ( $listLines as $rowLine ) {
				$resultLine = $result;
				
				$resultLine .= $this->cleanUpAddQuote ( $rowLine ['CHILDID'] ) . $this->_SEPARATOR;
				$resultLine .= $this->cleanUpAddQuote ( $rowLine ['CHILDQUANTITY'] ) . $this->_SEPARATOR;
				$resultLine .= $this->cleanUpAddQuote ( $this->getCurrentTva ( $row ['DATESTART'] ) ) . $this->_SEPARATOR;
				$resultLine .= $this->cleanUpAddQuote ( $rowLine ['CHILDPRIX'] ) . $this->_SEPARATOR;
				$resultLine .= $this->cleanUpAddQuote ( $rowLine ['CHILDPRIXTOTAL'] ) . $this->_SEPARATOR;
				$resultLine .= $this->cleanUpAddQuote ( $rowLine ['CHILDPRIXREMISE'] ) . $this->_SEPARATOR;
				
				$fichier->Insertion ( $resultLine );
			}
		}
		return $fichier;
	}
	function exportcommandesAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale : EBP";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$command = new Command ();
			
			$date = new Zend_Date ();
			$date->addMonth ( - 3 );
			$select = "
				SELECT *
				FROM command
				WHERE isARCHIVE = 1
				AND STATUT IN (1, 2, 3)
				AND DATESTART >= '" . $date->toString ( 'YYYY-MM-dd' ) . "'";
			
			$listcommands = $command->getAdapter ()->fetchAll ( $select );
			
			$fichier = $this->getCommandDevisLine ( $listcommands );
			
			$fichier->output ( 'ebp_commandes' );
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
	}
	function exportdevisAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale : EBP";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$command = new Command ();
			
			$date = new Zend_Date ();
			$date->addMonth ( - 3 );
			$select = "
				SELECT *
				FROM command
				WHERE isARCHIVE = 1
				AND STATUT IN (10, 11)
				AND DATESTART >= '" . $date->toString ( 'YYYY-MM-dd' ) . "'";
			
			$listcommands = $command->getAdapter ()->fetchAll ( $select );
			
			$fichier = $this->getCommandDevisLine ( $listcommands );
			
			$fichier->output ( 'ebp_devis' );
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
	}
	function importcategoriesAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale : EBP";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$nomTemp = 'csvfile';
			
			if ($this->isValidCSVFile ( $nomTemp )) {
				$nomOrigine = $_FILES [$nomTemp] ['name'];
				
				$date = new Zend_Date ();
				$nomDestination = "importcategories-" . $date->toString ( 'dd-MM-YYYY_HH-mm-ss' ) . ".csv";
				
				if ($this->uploadCsvFile ( $_FILES [$nomTemp] ["tmp_name"], $nomDestination )) {
					
					$header = array (
							0 => 'ID',
							1 => 'NOM',
							2 => 'NOUSE1',
							3 => 'NOUSE2',
							4 => 'NOUSE3',
							5 => 'NOUSE4',
							6 => 'NOUSE5',
							7 => 'NOUSE6' 
					);
					$dataRows = $this->csv_to_array ( $this->csv_import . $nomDestination, $header );
					if (sizeof ( $dataRows [0] ) == sizeof ( $header )) {
						
						$category = new Category ();
						$filesAdded = 0;
						$filesUpdated = 0;
						$filesError = 0;
						foreach ( $dataRows as $row ) {
							
							$id = $row ["ID"];
							$nom = $this->cleanUp ( $row ["NOM"] );
							
							$currentCat = $category->select ()->where ( "ID = ?", $id )->query ()->fetch ();
							
							if ($currentCat != null && ! empty ( $currentCat )) {
								try {
									// Update
									if ($currentCat ['NOM'] != $nom) {
										$data = array (
												'NOM' => $nom 
										);
										$category->update ( $data, 'ID = ' . $id );
										$filesUpdated ++;
									}
								} catch ( Zend_Exception $e ) {
									$filesError ++;
									$this->log ( $e->getMessage (), 'warn' );
								}
							} else {
								try {
									$navnom = $this->verifyNavigationString ( "", $nom, '' );
									$keywords = $this->generateKeyWords ( $navnom );
									// Insert
									$data = array (
											'NOM' => $nom,
											'NAVTITRENOM' => $nom,
											'DESCRIPTION' => $nom,
											'NAVDESCRIPTION' => $nom,
											'NAVNOM' => $navnom,
											'KEYWORDS' => $keywords,
											'IDPARENT' => 0 
									);
									$category->insert ( $data );
									
									$lastid = $category->getAdapter()->lastInsertId();
									if ($lastid > 0) {
										mkdir ("items/category/".$lastid, 0777);
										mkdir ("items/product/".$lastid, 0777);
									}
									
									$filesAdded ++;
								} catch ( Zend_Exception $e ) {
									$filesError ++;
									$this->log ( $e->getMessage (), 'warn' );
								}
							}
						}
						$this->view->messageSuccess = "Importation des fiches Familles articles<br/>
														Fiches ajout�es : " . $filesAdded . "<br/>
														Fiches modifi�es : " . $filesUpdated . "<br/>
														Fiches non import�es : " . $filesError . "<br/>";
					} else {
						$this->view->messageError = "Le fichier n'est pas au format attendu pour les Familles articles";
					}
				} else {
					$this->view->messageError = "Le fichier n'a pas pu etre import�.";
				}
			}
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
		$this->render ( '/index' );
	}
	function importarticlesAction() {
		try {
			$this->_helper->viewRenderer->setNeverRender ();
			
			$this->view->titlePage = "Gestion commerciale : EBP";
			$this->view->messageSuccess = "";
			$this->view->messageError = "";
			
			$nomTemp = 'csvfile';
			
			if ($this->isValidCSVFile ( $nomTemp )) {
				$nomOrigine = $_FILES [$nomTemp] ['name'];
				
				$date = new Zend_Date ();
				$nomDestination = "importarticles-" . $date->toString ( 'dd-MM-YYYY_HH-mm-ss' ) . ".csv";
				
				if ($this->uploadCsvFile ( $_FILES [$nomTemp] ["tmp_name"], $nomDestination )) {
					
					$header = array (
							0 => 'ID',
							1 => 'NOM',
							2 => 'IDCATEGORY',
							3 => 'NOUSE1',
							4 => 'PRIX',
							5 => 'TVA',
							6 => 'DESCRIPTION',
							7 => 'REFERENCE',
							8 => 'NOUSE2',
							9 => 'NOUSE3',
							10 => 'NOUSE4',
							11 => 'IDBREND',
							12 => 'NOUSE5' 
					);
					
					$dataRows = $this->csv_to_array ( $this->csv_import . $nomDestination, $header );
					if (sizeof ( $dataRows [0] ) == sizeof ( $header )) {
						
						$product = new Product ();
						$productLine = new ProductChild ();
						$filesAdded = 0;
						$filesUpdated = 0;
						$filesError = 0;
						
						$date = new Zend_Date ();
						foreach ( $dataRows as $row ) {
							
							$id = $row ["ID"];
							$prix = $this->cleanUp ( $row ["PRIX"] );
							$description = $this->cleanUp ( $row ["DESCRIPTION"] );
							$reference = $this->cleanUp ( $row ["REFERENCE"] );
							
							$tva = $this->cleanUp ( $row ["TVA"] );
							$nom_prod = $this->cleanUp ( $row ["NOM"] );
							$idCat_prod = $this->cleanUp ( $row ["IDCATEGORY"] );
							$idbrend_prod = $this->cleanUp ( $row ["IDBREND"] );
							
							$currentProdLine = $productLine->select ()->where ( "REFERENCE = ?", $reference )->query ()->fetch ();
							
							if ($currentProdLine != null && ! empty ( $currentProdLine )) {
								try {
									
									// Update
									$dataChild = array (
											'DESIGNATION' => $description,
											'PRIX' => $prix,
											'DATEMODIF' => $date->toString ( 'YYYY-MM-dd HH:mm:ss' ) 
									);
									
									$productChild = new ProductChild ();
									$productChild->update ( $dataChild, 'ID = ' . $id );
									$filesUpdated ++;
								} catch ( Zend_Exception $e ) {
									$filesError ++;
									$this->log ( $e->getMessage (), 'warn' );
								}
							} else {
								try {
									// Insert
									$navnom = $this->verifyNavigationString ( "", $nom_prod, '' );
									$keywords = $this->generateKeyWords ( $navnom );
									
									$data = array (
											'NOM' => $nom_prod,
											'NAVNOM' => $navnom,
											'KEYWORDS' => $keywords,
											'NAVTITRE' => '',
											'NAVDESC' => '',
											'DESCRIPTIONSHORT' => $nom_prod,
											'DESCRIPTIONLONG' => $nom_prod,
											'PRIX' => $prix,
											'isACTIVE' => 1,
											'DATEPROMO' => $date->toString ( 'YYYY-MM-dd' ),
											'isPROMO' => '1',
											'IDCATEGORY' => $idCat_prod,
											'ISSHOWBREND' => 1 
									);
									$product->insert ( $data );
									$lastId = $product->getAdapter ()->lastInsertId ();
									
									$dataChild = array (
											'REFERENCE' => $reference,
											'DESIGNATION' => $description,
											'PRIX' => $prix,
											'ETATSTOCK' => 0,
											'QUANTITYMIN' => 1,
											'isDEVIS' => 1,
											'IMAGEPROMO' => 0,
											'DATEMODIF' => $date->toString ( 'YYYY-MM-dd HH:mm:ss' ),
											'IDPRODUCT' => $lastId 
									);
									
									$productChild = new ProductChild ();
									$productChild->insert ( $dataChild );
									
									$filesAdded ++;
								} catch ( Zend_Exception $e ) {
									$filesError ++;
									$this->log ( $e->getMessage (), 'warn' );
								}
							}
						}
						$this->view->messageSuccess = "Importation des fiches Articles<br/>
														Fiches ajout�es : " . $filesAdded . "<br/>
														Fiches modifi�es : " . $filesUpdated . "<br/>
														Fiches non import�es : " . $filesError . "<br/>";
					} else {
						$this->view->messageError = "Le fichier n'est pas au format attendu pour les Articles";
					}
				} else {
					$this->view->messageError = "Le fichier n'a pas pu etre import�.";
				}
			}
		} catch ( Zend_Exception $e ) {
			$this->log ( $e->getMessage (), 'err' );
		}
		$this->render ( '/index' );
	}
	var $csv_import = 'csvfiles/import/';
	private function uploadCsvFile($tmpName, $destName) {
		if (! file_exists ( $this->csv_import )) {
			mkdir ( $this->csv_import, 0777, true );
		}
		return move_uploaded_file ( $tmpName, $this->csv_import . $destName );
	}
	private function isValidCSVFile($name) {
		if (! empty ( $_FILES [$name] ) && ! empty ( $_FILES [$name] ['name'] )) {
			$nomOrigine = $_FILES [$name] ['name'];
			$elementsChemin = pathinfo ( $nomOrigine );
			$extensionFichier = strtolower($elementsChemin ['extension']);
			$extensionsAutorisees = array (
					"csv" 
			);
			if (! (in_array ( $extensionFichier, $extensionsAutorisees ))) {
				$this->view->messageError = "Le fichier n'a pas l'extension attendue (.csv)";
			} else {
				return true;
			}
		} else {
			$this->view->messageError = "Vous pouvez exporter les donn�es via EBP -> Outils -> Exportation de donn�es";
		}
		return false;
	}
	private function csv_to_array($filename = '', $header, $delimiter = ';') {
		if (! file_exists ( $filename ) || ! is_readable ( $filename ))
			return FALSE;
		
		$data = array ();
		if (($handle = fopen ( $filename, 'r' )) !== FALSE) {
			while ( ($row = fgetcsv ( $handle, 1000, $delimiter )) !== FALSE ) {
				if (! $header) {
					$header = $row;
				} else if (sizeof ( $header ) == sizeof ( $row )) {
					$data [] = array_combine ( $header, $row );
				}
			}
			fclose ( $handle );
		}
		return $data;
	}
}
?>modules/backoffice/controllers/FooterController.php000060400000015050150710367660016661 0ustar00<?php
class Backoffice_FooterController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "Footer";
		$this->isConnectedWithRole('isFooter'); 
	}
	public function indexAction()
	{
		$this->_forward('/list');

	}

	public function editAction()
	{
			
		$this->view->titlePage = "Modifier un pied de page";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
			
		//filtres pour changer les chaines
		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		//valideurs pour les chaines
		$validator = new Zend_Validate();
		$validator -> addValidator(new Zend_Validate_NotEmpty());

		$footer = new FooterContent();
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id>0) {
				$this->view->populateFormFooter = $footer->fetchRow('ID = '.$id);
			}
		}
		if ($this->getRequest()->isPost()) {

			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataFooter = array (
			 		'ID' => (int)$params['id'],
			 		'TITRE' => $filter->filter($params['titre']),
			 		'URL' => $filter->filter($params['url']),
			 		'CONTENT' => $params['content']
			);

			if ($validator->isValid($dataFooter['TITRE'])
			) {
				if ((empty($dataFooter['URL']) && empty($dataFooter['CONTENT'])) ||
				(!empty($dataFooter['URL']) && !empty($dataFooter['CONTENT']))
				) {
					$this->view->messageError = "Le pied de page est soit un lien vers une autre page, soit du contenu";

					$this->view->populateFormFooter = $dataFooter;
				} else {
					try {
							
						$id = (int)$params['id'];
							
						if ( $id > 0) {

							$footer->update($dataFooter,'ID = '.$id);
							$this->view->messageSuccess = "Le pied de page a �t� modifi�";
							$this->view->populateFormFooter = $footer->fetchRow('ID = '.$id);

							$this->log("Le pied de page a �t� modifi� : ".$id,'info');
						}
					} catch (Zend_Exception $e) {
						$this->log($e->getMessage(),'err');
						$this->view->populateFormFooter = $dataFooter;
					}
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
				$this->view->populateFormFooter = $dataFooter;
			}

		}

			
			
	}

	public function addAction()
	{
			
		$this->view->titlePage = "Ajouter un pied de page";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataFooter = array (
			 		'TITRE' => $filter->filter($params['titre']),
			 		'URL' => $filter->filter($params['url']),
			 		'CONTENT' => $params['content']
			);
			if (
			$validator->isValid($dataFooter['TITRE'])
			) {
					
				if ((empty($dataFooter['URL']) && empty($dataFooter['CONTENT'])) ||
				(!empty($dataFooter['URL']) && !empty($dataFooter['CONTENT']))
				) {
					$this->view->messageError = "Le pied de page est soit un lien vers une autre page, soit du contenu";

					$this->view->populateFormFooter = $dataFooter;
				} else {
					try {
						$footer = new FooterContent();
						$footer->insert($dataFooter);
						$this->view->messageSuccess = "Le pied de page a �t� ajout�";
						$this->log("Le pied de page a �t� ajout�",'info');
					} catch (Zend_Exception $e) {
						$this->log($e->getMessage(),'err');
						$this->view->populateFormFooter = $dataFooter;
					}
				}
					
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError =  $this->getErrorValidator($errorCode);
				}
				$this->view->populateFormFooter = $dataFooter;
			}

		}
	}

	public function listAction()
	{
		$this->view->titlePage = "Gestion des pieds de page"; 
		//Appel model pour listing
		$footer = new FooterContent();

		$result = $footer->fetchAll();
			
		$this->view->listfooter = $result;
			
	}

	public function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$footer = new FooterContent();

					$footer->delete('ID = '.$id);
					$this->view->messageSuccess = "Le pied de page a �t� supprim�";
					$this->log("Le pied de page a �t� supprim�",'info');
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');

	}
	
	public function docAction() { 
		$this->view->titlePage = "Gestion des documents"; 
		$this->view->currentMenu = "Document";
	}

	public function adddocAction() { 
		if(!empty($_FILES['file']) && !empty($_FILES['file']['name'])) {
			$nomOrigine = $_FILES['file']['name'];
			$elementsChemin = pathinfo($nomOrigine);
			$extensionFichier = strtolower($elementsChemin['extension']);
			$extensionsAutorisees = array("pdf");
			if (!(in_array($extensionFichier, $extensionsAutorisees))) {
				$this->view->messageError = "Le fichier n'a pas l'extension attendue";
			} else { 
				$repertoireDestination = 'doc/';
				$this->checkDirectoryExist($repertoireDestination);
				//$date = new Zend_Date();
					
				$nomDestination = $nomOrigine;//$date->toString('dd-MM-YYYY_HH-mm-ss').".".$extensionFichier;
					 
				if (move_uploaded_file($_FILES["file"]["tmp_name"],$repertoireDestination.$nomDestination)) {
					try {
						$this->view->messageSuccess = "Le document a �t� ajout� ";
					} catch (Exception $e) {
						$this->view->messageError = $e->getMessage();
					}
				} else {
					$this->view->messageError = "Le fichier n'a pas �t� upload�";
				}
			}
		} else {
			$this->view->messageError = "S�lectionner un fichier PDF";
		}
		$this->_forward('doc');
	}
	public function deldocAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->isPost()) {
			$params = $this->_request->getPost();
			try {
				unlink($params['doc']);
				$this->view->messageSuccess = "Le document a �t� supprim� d�finitivement";
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
		$this->_forward('doc');
	}

}
?>modules/backoffice/controllers/AnnoncerightController.php000060400000012257150710367660020050 0ustar00<?php
class Backoffice_AnnoncerightController extends Modules_Backoffice_Controllers_MainController
{

	public function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "AnnonceRight";
		$this->isConnectedWithRole('isPromo');
	}
	public function indexAction()
	{
		$this->_forward('/list');
	}

	public function editAction()
	{
			
		$this->view->titlePage = "Modifier une annonce";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		
        try {
		//filtres pour changer les chaines
		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());

		//valideurs pour les chaines
		$validator = new Zend_Validate();
		$validator -> addValidator(new Zend_Validate_NotEmpty())
		-> addValidator(new Zend_Validate_StringLength(3));

		$annonce = new AnnonceRight();
		if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
			if ($id>0) {
				$this->view->populateFormAnnonce = $annonce->fetchRow('ID = '.$id);
			}
		}
		if ($this->getRequest()->isPost()) {

			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'ID' => (int)$params['id'],
			 		'NOM' => $filter->filter($params['nom']),
			 		'CONTENT' => $params['content'],
			 		'isSHOW' => $params['isshow'],
			 		'POSITION' => $params['position'],
					'ID_CATS' => ''
					);
					
					/*if (isset($params['categories'])) {
						foreach($params['categories'] as $value)
						{
							$dataAnnonce['ID_CATS'] .= ":".$value.":";
						}
					}*/
					if ($validator->isValid($dataAnnonce['NOM']) &&
					$validator->isValid($dataAnnonce['CONTENT'])
					) {
						try {
							$id = (int)$params['id'];
							if ( $id > 0) {
									
								$annonce->update($dataAnnonce,'ID = '.$id);
								$this->view->messageSuccess = "L'annonce a �t� modifi�e";
								$this->view->populateFormAnnonce = $annonce->fetchRow('ID = '.$id);
								$this->log("L'annonce a �t� modifi�e ".$id,'info');
							}
						} catch (Zend_Exception $e) {
							$this->log($e->getMessage(),'err');
							$this->view->populateFormAnnonce = $dataAnnonce;
						}
					} else {
						foreach ($validator->getErrors() as $errorCode) {
							$this->view->messageError .=  $this->getErrorValidator($errorCode);
						}
						$this->view->populateFormAnnonce = $dataAnnonce;
					}

		}
        } catch (Zend_Exception $e) {
			$this->log("Error edit : ".$e->getMessage(),'err');
		}
		$this->_forward('/list');
	}


	public function addAction()
	{
			
		$this->view->titlePage = "Ajouter une annonce";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(3));


			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$dataAnnonce = array (
			 		'NOM' => $filter->filter($params['nom']),
			 		'CONTENT' => $params['content'],
			 		'isSHOW' => $params['isshow'],
			 		'POSITION' => $params['position'],
					'ID_CATS' => ''
					);
					/*
					if (isset($params['categories'])) {
						foreach($params['categories'] as $value)
						{
							$dataAnnonce['ID_CATS'] .= ":".$value.":";
						}
					}*/
					
					if (
					$validator->isValid($dataAnnonce['NOM']) &&
					$validator->isValid($dataAnnonce['CONTENT'])
					) {
						try {
							$annonce = new AnnonceRight();
							$annonce->insert($dataAnnonce);
							$this->view->messageSuccess = "L'annonce a �t� ajout�e";
							$this->log("L'annonce a �t� ajout�e",'info');
						} catch (Zend_Exception $e) {
							$this->log($e->getMessage(),'err');
							$this->view->populateFormAnnonce = $dataAnnonce;
						}

					} else {
						foreach ($validator->getErrors() as $errorCode) {
							$this->view->messageError .=  $this->getErrorValidator($errorCode);
						}
						$this->view->populateFormAnnonce = $dataAnnonce;
					}

		}
		$this->_forward('/list');
	}

	public function listAction()
	{
		$this->view->titlePage = "Gestion des mises en avant sur la page d'accueil"; 
			
		//Appel model pour listing
		$annonces = new AnnonceRight();
		$result = $annonces->getAllAnnonces();

		/*$category = new Category();
		$this->view->listallcategories = $category->getAllCategoriesByID(0);
		*/
		$this->view->listannonce = $result;
	}



	public function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$annonce = new AnnonceRight();

					$annonce->delete('ID = '.$id);
					$this->view->messageSuccess = "L'annonce a �t� supprim�e";

					$this->log("L'annonce a �t� supprim�e",'info');
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = $e->getMessage();
				}
			}
		}
		$this->_forward('/list');
	}

}
?>modules/backoffice/controllers/CategoryController.php000060400000063640150710367660017210 0ustar00<?php

class Backoffice_CategoryController extends Modules_Backoffice_Controllers_MainController
{

	function init()
	{
		$this->view->title = "Administration";
		$this->view->currentMenu = "Category";

		$this->isConnectedWithRole('isCategory'); 
	}
	function indexAction()
	{
		$this->_forward('/list');

	}
    
	function listAction()
	{
		$this->view->titlePage = "Gestion des cat�gories";
			
		//Gestion des tris
		$table = 'NOM';
		$tri = 'ASC';
	}

	function delAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		if($this->_request->getParam('id')) {
			$id = (int)$this->_request->getParam('id');
			if ($id > 0) {
				try {
					$category = new Category();
					if ($category->fetchRow('IDPARENT = '.$id)) {
						$this->view->messageError = 'Cette cat�gorie est parente';
					} else {
						$product = new Product();
						$select = $product->fetchRow('IDCATEGORY = '.$id);
						if ($select) {
							$this->view->messageError = 'Cette cat�gorie est utilis�e par le produit : <b>'.$select->NOM."<b/>";
						} else {

							$category->delete('ID = '.$id);

							$this->delete_directory('items/category/'.$id);
							$this->delete_directory('items/product/'.$id);

							$this->view->messageSuccess = "La cat�gorie a et� supprim�e";
							$this->log("La cat�gorie a et� supprim�e",'info');

						}
					}
				} catch (Zend_Exception $e) {
					$this->view->messageError = $e->getMessage();
					$this->log($e->getMessage(),'err');
				}
			}
		}
		$this->_forward('/list');

	}

	function editAction() {
		$this->view->titlePage = "Modifier une cat�gorie";
		//populate form
		if ($this->_request->getParam('id')) { $id = (int)$this->_request->getParam('id'); }
		if ($this->_request->getParam('idCat')) { $id = (int)$this->_request->getParam('idCat'); }

		if ($id > 0) {
			$category = new Category();
			$row = $category->fetchRow('ID = '.$id);
			if ($row) {
				$this->view->populateForm = $row->toArray();
 
				$listCat = array();
				$listCat = $category->getTreeCatsOf($id);
				if (!empty($listCat) && !$listCat['SUBS']) {
					$categoryTypeTri = new CategoryTypeTri();
					$this->view->listNavigationTri = $categoryTypeTri->getListTriByCategoryInOneRow($id);
				}

                
		        if ($this->isSiteGallery) {
		            $annonces = new AnnonceCms();
		            $this->view->listAnnoncecms = $annonces->getAllAnnoncesByCategory($id);
                     
		            $annonces = new AnnonceGallery();
		            $this->view->listAnnonceGallery = $annonces->getAllAnnoncesByCategory($id);

		        }

			} else { $this->_forward('/list'); }
		} else {
			$this->_forward('/list');
		}
	}

	function editmigrateAction()
	{ 
		$this->view->titlePage = "Modifier une cat�gorie";
        if ($this->_request->isPost()) {
            //get the form params
			$params = $this->_request->getPost();
             
			try {

				$id = (int)$params['id'];
				$idReceiver = (int)$params['idcategory'];
                    
                if ($id > 0 && $idReceiver > 0) { 
                    $category = new Category();  
                    if ($category->canBeMigrate($id)) { 
                            //Migration des produits
                            $dataProduct = array (
			 		            'IDCATEGORY' => $idReceiver
			                ); 
                            $product = new Product();  
				            $product->update($dataProduct, 'IDCATEGORY = '.$id);
                            
                            $dataCategory = array (
			 		            'isACTIVE' => false
			                ); 
				            $category->update($dataCategory, 'ID = '.$id);
                            
				            $this->view->messageSuccess .= "La cat�gorie a �t� migr�e, la redirection est effectu�e";
                    
				            $this->log("La cat�gorie a �t� migr�e de ".$id." vers ".$idReceiver,'info'); 
                    } else {
					    $this->view->messageError .= "La cat�gorie est parente";
                    }

                } else {                    
					$this->view->messageError .= "V�rifier les param�tres";
                }
 
			} catch (Zend_Exception $e) {
				$this->log($e->getMessage(),'err');
				$this->view->messageError = "Impossible de migrer la cat�gorie".$e->getMessage();
			} 
        }
		$this->_forward('/edit');
	}
    
	function editcategoryAction()
	{
			
		$this->view->titlePage = "Modifier une cat�gorie";
		$id = 0;
		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());


			//get the form params
			$params = $this->_request->getPost();

			$docChoice = '';
			if (isset($params['docChoice'])) {
				$docChoice = $filter->filter($params['docChoice']);
			}
			
			$urlRedirect = '';
			if (isset($params['urlredirect'])) {
				$urlRedirect = $filter->filter($params['urlredirect']);
			}
			//Refractor the params
			$data = array (
			 		'NOM' => $filter->filter($params['nom']),
					'IDPARENT' => $filter->filter($params['idparent']),
			 		'DESCRIPTION' => $params['desc'], 
			 		'DESCRIPTIONLONG' => $params['desclong'], 
			 		'DESCRIPTIONSHORT' => $params['descshort'], 
			 		'URLREDIRECT' => $urlRedirect, 
			 		'CHOICEDOC' => $docChoice
			);
             
			if (isset($params['position'])) {
				$data['POSITION'] = (int)$params['position'];
			}



			if ($validator->isValid($data['NOM'])) {

				try {

					$id = $params['id'];

					$category = new Category();
					$category->update($data, 'ID = '.$id);

					$this->view->messageSuccess = "La cat�gorie a �t� modifi�e";
					if($this->uploadNewPicsAndSave($id)) {
						$this->view->messageSuccess .= " , l'image aussi";
					}
					if($this->uploadNewPicsSlideAndSave($id)) {
						$this->view->messageSuccess .= " , l'image du slide aussi";
					}

					if($this->uploadNewChoicePics($id)) {
						$this->view->messageSuccess .= " , le comment choisir aussi";
					}
                    
                    $nbSubs = $category->updateTreeInLineAsPathOfChilds($id, true);

					$this->view->messageSuccess .= " , ".$nbSubs." urls d'acc�s modifi�es.";

					$this->log("La cat�gorie a �t� modifi�e : ".$id,'info');

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "La cat�gorie existe d�j�";
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError =  $this->getErrorValidator($errorCode);
				}
			}

		}
		$this->_forward('/edit');
	}

	function customnavnomeditAction()
	{
		$this->view->titlePage = "Modifier une cat�gorie";
		$id = 0;
		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			//get the form params
			$params = $this->_request->getPost();

			$navnom = $this->verifyNavigationString($filter->filter($params['navnom']), $params['nom'], '');
            
			$keywords = "";
			if (isset($params['keywords']) && !empty($params['keywords'])) {
				$keywords = $params['keywords'];
			} else {
				$navnomStrip =  explode("-", $navnom);
				for ($index = 0; $index < sizeof($navnomStrip); $index++) {
					$word = $navnomStrip[$index];
					if (empty($keywords)) {
						if (strlen($word) > 3){ $keywords .= $word; }
					} else {
						if (strlen($word) > 3){ $keywords .= ",".$word; }
					}
				}
			}

			//Refractor the params
			$data = array (
					'NAVTITRENOM' => $filter->filter($params['navtitrenom']),
			 		'NAVNOM' => $navnom,
					'KEYWORDS' => $keywords,
					'NAVDESCRIPTION' => $filter->filter($params['navdescription'])
			);
            
			if ($validator->isValid($data['NAVNOM']) &&
			$validator->isValid($data['KEYWORDS'])) {
				if (empty($data['NAVTITRENOM'])) {
					$data['NAVTITRENOM'] = $filter->filter($params['nom']);
				}
				if (empty($data['NAVDESCRIPTION'])) {
					$data['NAVDESCRIPTION'] = "";
				}
				try {
					$id = $params['id'];

                    $category = new Category();
                    
                    if (isset($params['urlaccess']) && $params['idparent'] == 0) {
                        $data['NAVNOM_URLPARENTS'] = $this->verifyNavigationString('',$filter->filter($params['urlaccess']), '');
                    }
                    
                    if (empty($data['NAVNOM_URLPARENTS'])) {
                        $data['NAVNOM_URLPARENTS'] = $category->getTreeInLineAsPathOf($id);
                        if (empty($data['NAVNOM_URLPARENTS'])) {
                            $data['NAVNOM_URLPARENTS'] = $navnom;
                        }
                    }
                    
					$category->update($data, 'ID = '.$id);
                    
                    $nbSubs = $category->updateTreeInLineAsPathOfChilds($id, false);

					$this->view->messageSuccess = "La cat�gorie a �t� modifi�e, ".$nbSubs." urls d'acc�s modifi�es.";

				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
					$this->view->messageError = "La cat�gorie existe d�j�";
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
			}

		}
		$this->_forward('/edit');
	}
    
	function editthemeAction()
	{
		$this->view->titlePage = "Modifier le th�me";
		if ($this->_request->isPost()) {
			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$data = array (
			 		'ID_THEME' => $params['idtheme']
			);

			try {

				$id = (int)$params['id'];

				$category = new Category();
				$category->update($data, 'ID = '.$id);
                 $this->view->messageSuccess = "Le th�me a �t� modifi�"; 
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
			}
		}
		$this->_forward('/edit');
	}
	function editactiveAction()
	{
		$this->view->titlePage = "Modifier une cat�gorie";
		if ($this->_request->isPost()) {
			//get the form params
			$params = $this->_request->getPost();

			//Refractor the params
			$data = array (
			 		'isACTIVE' => $params['active']
			);

			try {

				$id = (int)$params['id'];

				$category = new Category();
				$category->update($data, 'ID = '.$id);

				//inversement des bool
				if ($data['isACTIVE'] == 1) {
					$data['isACTIVE'] = 0;
				} else {
					$data['isACTIVE'] = 1;
				}
				$dataProduct = array(
						'isACTIVE' => $data['isACTIVE']
				);
				$produit = new Product();
				$nb = $produit->updateByCategory($id, $dataProduct);
				$this->view->messageSuccess = "La cat�gorie a �t� modifi�e";
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
			}
		}
		$this->_forward('/edit');
	}

	function addAction()
	{
			
		$this->view->titlePage = "Ajouter une cat�gorie";
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
			
		if ($this->_request->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			//get the form params
			$params = $this->_request->getPost();

			$navnom = $this->verifyNavigationString($filter->filter($params['navnom']), $params['nom'], '');

			$keywords = "";
			if (isset($params['keywords']) && !empty($params['keywords'])) {
				$keywords = $params['keywords'];
			} else {

				$navnomStrip =  explode("-", $navnom);
				for ($index = 0; $index < sizeof($navnomStrip); $index++) {
					$word = $navnomStrip[$index];
					if (empty($keywords)) {
						if (strlen($word) > 3){ $keywords .= $word; }
					} else {
						if (strlen($word) > 3){ $keywords .= ",".$word; }
					}
				}
			}

			$data = array (
			 		'NOM' => $filter->filter($params['nom']),
					'NAVTITRENOM' => $filter->filter($params['nom']),
			 		'DESCRIPTION' => $filter->filter($params['desc']),
			 		'NAVDESCRIPTION' => $filter->filter($params['desc']),
			 		'NAVNOM' => $navnom,
			 		'KEYWORDS' => $keywords,
			 		'IDPARENT' => $filter->filter($params['idparent'])
			);
             
			if ($validator->isValid($data['NOM']) &&
			$validator->isValid($data['NAVNOM'])
			) {
				try {
					$category = new Category();
                    $data['NAVNOM_URLPARENTS'] = $category->getTreeInLineAsPathOf($data['IDPARENT']);                    
                    if (empty($data['NAVNOM_URLPARENTS'])) {
                        $data['NAVNOM_URLPARENTS'] = $navnom;
                    }
					$category->insert($data);

					//create items folder for pics
					$lastid = $category->getAdapter()->lastInsertId();

					if ($lastid > 0) { 
                        $this->checkDirectoryExist("items/category/".$lastid);
                        $this->checkDirectoryExist("items/product/".$lastid);

						$this->view->messageSuccess = "La cat�gorie a �t� ajout�e";
						if($this->uploadNewPicsAndSave($lastid)) {
							$this->view->messageSuccess .= " , l'image a �t� upload�e";
						}

						$this->log("La cat�gorie a �t� ajout�e",'info');
						//Listing Categories
						$category = new Category();
						$this->view->listallcategories = $category->getAllCategoriesByID(0);
                        
                        $this->_request->setParam('id', $lastid);
		                $this->_forward('/edit'); 

					}
				} catch (Zend_Exception $e) {
					$this->view->messageError = "La cat�gorie existe d�j�";
					$this->log($e->getMessage(),'err');
					$this->view->populateForm = $data;
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError .=  $this->getErrorValidator($errorCode);
				}
				$this->view->populateForm = $data;
			}
		}
	}
     
	function uploadNewPics($idCat, $field) {
        if(!empty($_FILES[$field]) && !empty($_FILES[$field]['name'])) {
			$nomOrigine = $_FILES[$field]['name'];
			$elementsChemin = pathinfo($nomOrigine);
			$extensionFichier = strtolower($elementsChemin['extension']);
			$extensionsAutorisees = array("jpg", "jpeg",  "gif", "png");
			if (!(in_array($extensionFichier, $extensionsAutorisees))) {
				$this->view->messageError = "Le fichier n'a pas l'extension attendue";
			} else {
				// Copie dans le repertoire du script avec un nom
				$repertoireDestination = 'items/category/'.$idCat.'/';
				$this->checkDirectoryExist($repertoireDestination);
				
                $nomDestination = $this->generateNavigationString($elementsChemin['filename']).".".$extensionFichier;
				$fileoriginal = $repertoireDestination.$nomDestination;
                
				if (move_uploaded_file($_FILES[$field]["tmp_name"],$fileoriginal)) {
                        //Resize picture
                        $info = getimagesize($fileoriginal) ;
                        list($width_old, $height_old) = $info;
                        $maxwidth = $this->FeaturePictureResizeWidth;
                        $maxheight = $this->FeaturePictureResizeHeight;
                            
                        if ($width_old > $maxwidth || $height_old > $maxheight) {     
                            Utils_Tool::smart_resize_image($fileoriginal , null, $maxwidth , $maxheight , true , $fileoriginal , true , false ,50 );
                        }  
                        
					return $repertoireDestination.$nomDestination;
				} else {
					$this->view->messageError = "Le fichier n'a pas �t� upload�";
				}
			}
		}
		return "";
    }
	function uploadNewPicsAndSave($idCat) {
        $url = $this->uploadNewPics($idCat, 'picCat');
		if(!empty($url)) {
			try {
				$category = new Category();
				$data = array (
					'URL' => $url
				);
				$category->update($data,'ID = '.$idCat);

				return true;
			} catch (Exception $e) {
				$this->view->messageError = $e->getMessage();
				return false;
			}
		}
		return false;
	}
	function uploadNewPicsSlideAndSave($idCat) {
        $url = $this->uploadNewPics($idCat, 'picSlideCat');
		if(!empty($url)) {
			try {
				$category = new Category();
				$data = array (
					'URL_SLIDE' => $url
				);
				$category->update($data,'ID = '.$idCat);

				return true;
			} catch (Exception $e) {
				$this->view->messageError = $e->getMessage();
				return false;
			}
		}
		return false;
	}

	function uploadNewChoicePics($idCat) {
		if(!empty($_FILES['picChoice']) && !empty($_FILES['picChoice']['name'])) {
			$nomOrigine = $_FILES['picChoice']['name'];
			$elementsChemin = pathinfo($nomOrigine);
			$extensionFichier = strtolower($elementsChemin['extension']);
			$extensionsAutorisees = array("jpg", "jpeg",  "gif", "png");
			if (!(in_array($extensionFichier, $extensionsAutorisees))) {
				$this->view->messageError = "Le fichier n'a pas l'extension attendue";
			} else {
				// Copie dans le repertoire du script avec un nom
				// incluant l'heure a la seconde pres
				$repertoireDestination = 'items/category_choice/'.$idCat.'/';
				$this->checkDirectoryExist($repertoireDestination);
				
				$date = new Zend_Date();
					
				//$nomDestination = $date->toString('dd-MM-YYYY_HH-mm-ss').".".$extensionFichier;
                $nomDestination = $this->generateNavigationString($elementsChemin['filename']).".".$extensionFichier;
					
				if (move_uploaded_file($_FILES["picChoice"]["tmp_name"],$repertoireDestination.$nomDestination)) {
					try {
						$category = new Category();
						$data = array (
					 		'CHOICEURL' => $repertoireDestination.$nomDestination
						);
						$category->update($data,'ID = '.$idCat);

						return true;
					} catch (Exception $e) {
						$this->view->messageError = $e->getMessage();
						return false;
					}
				} else {
					$this->view->messageError = "Le fichier n'a pas �t� upload�";
				}
			}
		}

		return false;
	}
	function setpictureAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->isPost()) {
			$params = $this->_request->getPost();
			try {
				$category = new Category();
                if (isset($params['typeimage']) && $params['typeimage'] == 1) {
				    $data = array (
				 		    'URL_SLIDE' => $params['picture']
				    );
                } else {
				    $data = array (
				 		    'URL' => $params['picture']
				    );
                }
				$category->update($data,'ID = '.$params['idCat']);
				$this->view->messageSuccess = "L'image a �t� modifi�e";
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
		$this->_forward('/edit');

	}

	function erasepictureAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->isPost()) {
			$params = $this->_request->getPost();

			try {
				$category = new Category();

				unlink($params['picture']);
				$data = array (
			 		'URL' => ''
			 		);
			 		$category->update($data,"ID = ".$params['idCat']." AND URL = '".$params['picture']."'");
			 		$this->view->messageSuccess = "L'image a �t� supprim�e d�finitivement";
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
		$this->_forward('/edit');

	}


	function setpicturechoiceAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->isPost()) {
			$params = $this->_request->getPost();
			try {
				$category = new Category();
				$data = array (
				 	'CHOICEURL' => $params['picture']
				);
				$category->update($data,'ID = '.$params['idCat']);
				$this->view->messageSuccess = "L'image a �t� modifi�e";
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
		$this->_forward('/edit');

	}

	function erasepicturechoiceAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";

		if($this->_request->isPost()) {
			$params = $this->_request->getPost();

			try {
				$category = new Category();
				unlink($params['picture']);
				$data = array (
			 		'CHOICEURL' => ''
			 		);
			 		$category->update($data,"ID = ".$params['idCat']." AND CHOICEURL = '".$params['picture']."'");
			 		$this->view->messageSuccess = "L'image a �t� supprim�e d�finitivement";
			} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				$this->view->messageError = $e->getMessage();
			}
		}
		$this->_forward('/edit');

	}
	
	
	function deletegalleryAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		if($this->_request->getParam('id') && $this->_request->getParam('idgallery')) {
			$id = (int)$this->_request->getParam('id');
			$idgallery = (int)$this->_request->getParam('idgallery');
			if ($id > 0 && $idgallery > 0) {
				try {
					
					$annonce = new AnnonceGallery();
					$dataAnnonceCurrent = $annonce->fetchRow('ID = '.$idgallery);
					
					$dataAnnonce = array ( 
						'ID_CATS' => str_replace(":".$id.":", "", $dataAnnonceCurrent['ID_CATS'])
					);
				 
					$annonce->update($dataAnnonce,'ID = '.$idgallery); 
			 		$this->view->messageSuccess = "L'image a �t� supprim�e de la cat�gorie";
					$this->log("L'image ".$idgallery." a �t� supprim�e de la cat�gorie".$id,'info');
					
				} catch (Zend_Exception $e) {
					$this->view->messageError = $e->getMessage();
					$this->log($e->getMessage(),'err');
				}
			}
		}
		$this->_forward('/edit'); 
	}
	
	function deletecmsAction() {

		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		if($this->_request->getParam('id') && $this->_request->getParam('idarticle')) {
			$id = (int)$this->_request->getParam('id');
			$idarticle = (int)$this->_request->getParam('idarticle');
			if ($id > 0 && $idarticle > 0) {
				try {
					
					$annonce = new AnnonceCms();
					$dataAnnonceCurrent = $annonce->fetchRow('ID = '.$idarticle);
					
					$dataAnnonce = array ( 
						'ID_CATS' => str_replace(":".$id.":", "", $dataAnnonceCurrent['ID_CATS'])
					);
				 
			 		$annonce->update($dataAnnonce,'ID = '.$idarticle); 
			 		$this->view->messageSuccess = "L'article a �t� supprim� de la cat�gorie";
					$this->log("L'article ".$idarticle." a �t� supprim� de la cat�gorie".$id,'info');
					
				} catch (Zend_Exception $e) {
					$this->view->messageError = $e->getMessage();
					$this->log($e->getMessage(),'err');
				}
			}
		}
		$this->_forward('/edit');
	}
	
	
	function addmultiplegalleryAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		  
		if($this->_request->isPost()) {
			$params = $this->_request->getPost();
			  
			$id = (int)$this->_request->getParam('idCat');
			$annonce = new AnnonceGallery();
			
			 if ($id > 0) { 
				$dataAnnonce = array (
						'NOM' => "",
						'CONTENT' => "",
						'CONTENT_SHORT' => "",
						'CONTENT_LONG' => "",
						'POSITION' => 0,
						'isSHOW' => 0,
						'ID_CATS' => ":".$id.":"
				); 
				try { 
					$annonce->insert($dataAnnonce);
					$lastid = $annonce->getAdapter()->lastInsertId();                               
					$result = $this->uploadHandlerFileUpload($lastid); 
					
					if (isset($result['success']) && $result['success'] == true) {

						$this->log("L'image a �t� ajout�e ".$lastid ,'info'); 
						
					} else {
						 
						$annonce->delete('ID = '.$lastid);						
						$this->delete_directory('items/gallery/'.$lastid);
						$this->log("L'image a �t� ajout�e puis supprim�e : ".$result['error'],'err'); 
					}	
								 
					echo json_encode($result);  
					
				} catch (Zend_Exception $e) { 
					$this->log($e->getMessage(),'err');
				}
			} 
		}
		 
		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout(); 
		$this->render('ajaxvalue'); 
	} 
	
	function uploadHandlerFileUpload($id) { 
		$uploader = new UploadHandler();
 
		$uploader->allowedExtensions = array("jpg", "jpeg",  "gif", "png"); 
		$uploader->sizeLimit = null; 
		$uploader->inputName = "qqfile";
		
		$repertoireGallery = 'items/gallery/';
		$_REQUEST['qquuid'] = $id; 
		
		$currentName = '';
		 if (isset($_REQUEST['qqfilename'])) {
			 $currentName = $_REQUEST['qqfilename'];
		} else if (isset($_FILES[$uploader->inputName])) {
            $currentName = $_FILES[$uploader->inputName]['name'];
		}
		 
		$elementsChemin = pathinfo($currentName);
		$extensionFichier = strtolower($elementsChemin['extension']); 
		$nomDestination = $this->generateNavigationString($elementsChemin['filename']).".".$extensionFichier; 
		 
		// If you want to use the chunking/resume feature, specify the folder to temporarily save parts.
		$this->checkDirectoryExist($repertoireGallery."chunks");
		$uploader->chunksFolder = $repertoireGallery."chunks";
  

		// Call handleUpload() with the name of the folder, relative to PHP's getcwd()
		$result = $uploader->handleUpload($repertoireGallery, $nomDestination);
 
		if (isset($result['success']) && $result['success'] == true) {
			$repertoireDestination = $repertoireGallery.$id."/";
			$fileoriginal = $repertoireDestination.$nomDestination;	 
			
			//Resize picture		
			 $fileResizedName = $repertoireDestination.$this->generateNavigationString($elementsChemin['filename']); 
							
			//Admin
			Utils_Tool::smart_resize_image($fileoriginal , null, 100 , null , true , $fileResizedName."_100.".$extensionFichier , false , false ,80 ); 
					
			if (isset($this->FeatureSiteThemeCms) && !empty($this->FeatureSiteThemeCms)) { 
				foreach ($this->FeatureSiteThemeCms as $row) { 
					if (isset($row['WIDTH_THUMB']) && $row['WIDTH_THUMB'] > 0) {
						Utils_Tool::smart_resize_image($fileoriginal , null, $row['WIDTH_THUMB'] , null , true , $fileResizedName."_".$row['WIDTH_THUMB'].".".$extensionFichier , false , false ,80 ); 
					}
				} 
			}
			
			//Save url
			$url = $repertoireDestination.$result["uploadName"];
			if(!empty($url)) {
				try { 
					$annonce = new AnnonceGallery();
					$data = array ( 'URL' => $url, 'NOM' => $elementsChemin['filename'] );
					$annonce->update($data,'ID = '.$id);  
				} catch (Exception $e) {
					$this->log($e->getMessage(),'err');
				}
			} 
		}

		return $result;
	}  
	
}
?>modules/backoffice/views/scripts/annoncegallery/message.phtml000060400000000260150710367660020614 0ustar00<div style="clear: both;">
<span class="errorText"><?php echo $this -> messageError; ?></span>
<span class="successText"><?php echo $this -> messageSuccess; ?></span> 
</div>
	modules/backoffice/views/scripts/annoncegallery/ajaxshowallpicture.phtml000060400000003654150710367660023113 0ustar00
<div class="table-box">
<table class="display table" id="AnnonceGalleryTable" width="100%">
	<thead>
		<tr>
			<th></th> 
			<th>Titre</th> 
			<th>Url</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	
		<?php foreach($this->listAnnonceGallery as $row)  { ?>
		<tr>
			<td>
				<?php if (!empty($row['URL'])) { 
					$urlPicture = $row['URL'];?>
					<ul class="gallerybox ">
						<li>
							<figure>
								<img src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($urlPicture, 100);?>" />
							</figure>
						</li>
					</ul>
				<?php } ?>
			</td>
			<td><?php echo $row['NOM'];?></td> 
			<td><?php echo '/'.$row['URL']; ?></td>
			<td>
				<?php if (!empty($row['URL'])) { 
					$urlPicture = $row['URL'];?>
				<div class="btn-group">
	             	<a class="btn btn-success" href="javascript:;" onclick="imageSelectedForArticle(<?php echo "'/".$urlPicture."'"; ?>, <?php echo "'/".Utils_Tool::find_thumb($urlPicture, 180)."'"; ?>);"><span class="glyphicon glyphicon-eye-open"></span> S&eacute;lectionner</a>
				</div>
				<?php } ?>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>	
	function imageSelectedForArticle(linkOriginal, linkThumb) { 
		var oldContent = tinyMCE.get('annonceContent').getContent();  
		var newsContent = oldContent.replace(/\/items\/gallery\/([0-9]+)\/([a-z\-0-9]+\.)+([a-z]+)/i, linkOriginal);    
		newsContent = newsContent.replace(/\/items\/gallery\/([0-9]+)\/([a-z\-0-9]+\_)+([0-9]+).([a-z]+)/i, linkThumb); 
		newsContent = newsContent.replace("/business/image/noimage.png", linkThumb);    
		newsContent = newsContent.replace("/business/image/noimage_big.png", linkOriginal);    
		tinyMCE.get('annonceContent').setContent(newsContent);
		$( "#pickImageFromGalleryContent" ).toggle();
	}		
	$(document).ready(function() {
		initDataTable('AnnonceGalleryTable', [[ 1, "asc" ]], [{ "orderable": false, "targets": 0 }, { "orderable": false, "targets": -1, "width": "270px" }]); 	    
	});
</script>
</div>
modules/backoffice/views/scripts/annoncegallery/edit.phtml000060400000012053150710367660020120 0ustar00 
 <div class="table-box">
	<form action="<?php echo $this->baseUrl; ?>/backoffice/annoncegallery/edit" method="post" name="editAnnonceForm" enctype="multipart/form-data" >
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Statut</td>
				<td class="col-md-8">
					<input type="radio" value="0" name="isshow" id="isshow1" class="bluecheckradios" <?php if ($this->populateFormAnnonceGallery['isSHOW'] == 0) { echo 'checked="checked"';} ?>><label for="isshow1">&nbsp;Actif</label>
					<input type="radio" value="1" name="isshow" id="isshow2" class="bluecheckradios" <?php if ($this->populateFormAnnonceGallery['isSHOW'] == 1) { echo 'checked="checked"';} ?>><label for="isshow2">&nbsp;Inactif</label>
			
				</td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Position</td>
				<td class="col-md-8"><input type="text" name="position" size="40" class="form-control"  placeholder="Position de l'image" id="position" value="<?php echo $this->populateFormAnnonceGallery['POSITION']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-4">Titre</td>
				<td class="col-md-8"><input type="text" name="nom" size="40" class="form-control"  placeholder="Titre non visible" id="nom" value="<?php echo $this->populateFormAnnonceGallery['NOM']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-4">Cat�gorie</td>
				<td class="col-md-8">
					<?php $tabController = explode(':',$this->populateFormAnnonceGallery['ID_CATS']);  ?>
					<select class="form-control" size="15" name="categories[]" id="categories" multiple="multiple">
						<?php 
						$show = array();
						foreach($this->listallcategories as $row) { 
						 	for ($level=0 ; $level<11; $level++) { 
								if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
								?>
									<option value="<?php echo $this->escape($row['ID'.$level]); ?>" <?php if (in_array($row['ID'.$level], $tabController)) {echo 'selected="selected"';} ?>>
										<?php 
						 				for ($i=0 ; $i<$level; $i++) { 
											echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
										}
										echo $row['NOM'.$level]; ?>
									
									</option>
									<?php 
									$show['NOM'.$level] = $row['NOM'.$level];
								}
							 } 
						} ?>
					</select>
				</td>
			</tr>
			
			<tr >
				<td >
					<label for="picture" >Image</label>
					<br/>
					<div class="col-md-12 text-center no-space-top">
						<?php if (!empty($this->populateFormAnnonceGallery['URL'])) { 
							$urlPicture = $this->populateFormAnnonceGallery['URL'];
						?>
						<ul class="gallerybox ">
							<li>
								<figure>
									<img src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($urlPicture, 100);?>" />
								</figure>
							</li>
						</ul>
						<?php } ?>
					</div>
				</td>
				<td>
					<input type="file" name="picture" id="picture" size="50"/>
					<br><i>Extensions : jpg, gif, png</i>
				</td>
			</tr>
			<tr >
				<td class="col-md-12" colspan="2">&nbsp;Contenu</td>
			</tr>
			<tr > 
				<td class="col-md-12" colspan="2"><input type="text" name="content_short" size="40" class="form-control"  placeholder="Titre de l'image" id="content_short" value="<?php echo $this->populateFormAnnonceGallery['CONTENT_SHORT']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-12" colspan="2"><input type="text" name="content_long" size="40" class="form-control"  placeholder="Sous-titre de l'image" id="content_long" value="<?php echo $this->populateFormAnnonceGallery['CONTENT_LONG']; ?>" /></td>
			</tr> 
			<tr>
				<td colspan="2" class="text-center">
					<input type="hidden" name="content" value="">
					<input type="hidden" name="id" value="<?php echo $this->populateFormAnnonceGallery['ID'];?>">
					<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
$(function(){
	tinymce.init({
	  selector: 'textarea',
	  height: 500, 
	  convert_urls: false,
	  theme: 'modern',
	  skin: "lightgraygradient",
	  language: 'fr_FR',
	  plugins: [
		'advlist autolink lists link image charmap print preview hr anchor pagebreak',
		'searchreplace wordcount visualblocks visualchars code fullscreen',
		'insertdatetime media nonbreaking save table contextmenu directionality',
		'emoticons template paste textcolor colorpicker textpattern imagetools jbimages'
	  ],
	  toolbar1: 'insertfile undo redo | styleselect | bold italic forecolor backcolor emoticons | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image jbimages template | print preview media',
	  image_advtab: true,
	  relative_urls: false,
	  templates: <?php echo $this->FeatureTinymceTemplate; ?>,
	  content_css: '<?php echo $this->FeatureTinymceCss; ?>'
	 });
		
});
</script>
modules/backoffice/views/scripts/annoncegallery/list.phtml000060400000002674150710367660020156 0ustar00
<div class="table-box">
<table class="display table" id="AnnonceGalleryTable" width="100%">
	<thead>
		<tr>
			<th></th> 
			<th>Titre</th> 
			<th>Statut</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	
		<?php foreach($this->listAnnonceGallery as $row)  { ?>
		<tr>
			<td>
				<?php if (!empty($row['URL'])) { 
					$urlPicture = $row['URL'];?>
					<ul class="gallerybox ">
						<li>
							<figure>
								<img src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($urlPicture, 100);?>" />
							</figure>
						</li>
					</ul>
				<?php } ?>
			</td>
			<td><?php echo $row['NOM'];?></td> 
			<td><?php if ($this->escape($row['isSHOW'])==0) {echo 'Actif';} else {echo 'Inactif';} ?></td>
			<td>
				<div class="btn-group">
	             	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/annoncegallery/edit/id/<?php echo $row['ID']; ?>"><span class="glyphicon glyphicon-edit"></span> Modifier</a>
					<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/annoncegallery/del/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>			
	$(document).ready(function() {
		initDataTable('AnnonceGalleryTable', [[ 1, "asc" ]], [{ "orderable": false, "targets": 0 }, { "orderable": false, "targets": -1, "width": "270px" }]); 	    
	});
</script>
</div>
modules/backoffice/views/scripts/annoncegallery/add.phtml000060400000011671150710367660017730 0ustar00 
 <div class="table-box">
	<form action="<?php echo $this->baseUrl; ?>/backoffice/annoncegallery/add" method="post" name="addAnnonceForm" enctype="multipart/form-data" >
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Statut</td>
				<td class="col-md-8">
					<input type="radio" value="0" name="isshow" id="isshow1" class="bluecheckradios" <?php if ($this->populateFormAnnonceGallery['isSHOW'] == 0) { echo 'checked="checked"';} ?>><label for="isshow1">&nbsp;Actif</label>
					<input type="radio" value="1" name="isshow" id="isshow2" class="bluecheckradios" <?php if ($this->populateFormAnnonceGallery['isSHOW'] == 1) { echo 'checked="checked"';} ?>><label for="isshow2">&nbsp;Inactif</label>
			
				</td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Position</td>
				<td class="col-md-8"><input type="text" name="position" size="40" class="form-control"  placeholder="Position de l'image" id="position" value="<?php echo $this->populateFormAnnonceGallery['POSITION']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-4">Titre</td>
				<td class="col-md-8"><input type="text" name="nom" size="40" class="form-control"  placeholder="Titre non visible" id="nom" value="<?php echo $this->populateFormAnnonceGallery['NOM']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-4">Cat�gorie</td>
				<td class="col-md-8">
					<?php $tabController = explode(':',$this->populateFormAnnonceGallery['ID_CATS']);  ?>
					<select class="form-control" size="15" name="categories[]" id="categories" multiple="multiple">
						<?php 
						$show = array();
						foreach($this->listallcategories as $row) { 
						 	for ($level=0 ; $level<11; $level++) { 
								if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
								?>
									<option value="<?php echo $this->escape($row['ID'.$level]); ?>" <?php if (in_array($row['ID'.$level], $tabController)) {echo 'selected="selected"';} ?>>
										<?php 
						 				for ($i=0 ; $i<$level; $i++) { 
											echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
										}
										echo $row['NOM'.$level]; ?>
									
									</option>
									<?php 
									$show['NOM'.$level] = $row['NOM'.$level];
								}
							 } 
						} ?>
					</select>
				</td>
			</tr>
			<tr >
				<td >
					<label for="picture" >Image</label>
					<br/>
					<div class="col-md-12 text-center no-space-top">
						<?php if (!empty($this->populateFormAnnonceGallery['URL'])) {
							$urlPicture = $this->populateFormAnnonceGallery['URL']; ?>
						<ul class="gallerybox ">
							<li>
								<figure>
									<img src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($urlPicture, 100);?>" />
								</figure>
							</li>
						</ul>
						<?php } ?>
					</div>
				</td>
				<td>
					<input type="file" name="picture" id="picture" size="50"/>
					<br><i>Extensions : jpg, gif, png</i>
				</td>
			</tr>
			<tr >
				<td class="col-md-12" colspan="2">&nbsp;Contenu</td>
			</tr>
			<tr > 
				<td class="col-md-12" colspan="2"><input type="text" name="content_short" size="40" class="form-control"  placeholder="Titre de l'image" id="content_short" value="<?php echo $this->populateFormAnnonceGallery['CONTENT_SHORT']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-12" colspan="2"><input type="text" name="content_long" size="40" class="form-control"  placeholder="Sous-titre de l'image" id="content_long" value="<?php echo $this->populateFormAnnonceGallery['CONTENT_LONG']; ?>" /></td>
			</tr> 
			<tr>
				<td colspan="2" class="text-center">
					<input type="hidden" name="content" value="">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
$(function(){
	tinymce.init({
	  selector: 'textarea',
	  height: 500, 
	  convert_urls: false,
	  theme: 'modern',
	  skin: "lightgraygradient",
	  language: 'fr_FR',
	  plugins: [
		'advlist autolink lists link image charmap print preview hr anchor pagebreak',
		'searchreplace wordcount visualblocks visualchars code fullscreen',
		'insertdatetime media nonbreaking save table contextmenu directionality',
		'emoticons template paste textcolor colorpicker textpattern imagetools jbimages'
	  ],
	  toolbar1: 'insertfile undo redo | styleselect | bold italic forecolor backcolor emoticons | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image jbimages template | print preview media',
	  image_advtab: true,
	  relative_urls: false,
	  templates: <?php echo $this->FeatureTinymceTemplate; ?>,
	  content_css: '<?php echo $this->FeatureTinymceCss; ?>'
	 });
		
});
</script>
modules/backoffice/views/scripts/index/index.phtml000060400000007156150710367660016420 0ustar00
<?php  if ($this->isSiteEbusiness) {  ?>
	<?php if ($this->useradmin['isCommand'] == 1 && isset($this->statlistdevis) && !empty($this->statlistdevis)) {  ?>
	<div class="col-md-6">
		<div class="col-md-12 no-space-top"><h5>Les devis non trait�s</h5></div>
		<div class="col-md-12 no-space-top">
			<table  class="display table" id="devisHomeTable" width="100%">
				<?php foreach($this->statlistdevis as $row) { ?>
				<tr >
					<td >
						 <a class="btn btn-primary"  href="<?php echo $this->baseUrl; ?>/backoffice/command/edit/id/<?php echo $this->escape($row['CMDID']);?>"><span class="glyphicon glyphicon-list-alt"></span>&nbsp;<?php echo $this->escape($row['CMDREF']);?></a>
					 </td>
					<td >
						 <a class="btn btn-primary"  href="<?php echo $this->baseUrl; ?>/backoffice/user/edit/id/<?php echo $this->escape($row['IDUSER']);?>"><span class="glyphicon glyphicon-user"></span>&nbsp;<?php echo $row['USERNOM'].' '.$row['USERPRENOM']; ?></a>
					 </td>
					<td > 
						 <?php echo sprintf("%.2f",$this->escape($row['CMDTOTALTTC'])); ?><b>&nbsp;&#8364;</b>
					 </td>
				</tr>
				<?php }  ?>
			</table>
		</div>
	</div>
	<?php } ?>
	 
	<?php if ($this->useradmin['isCommand'] == 1 && isset($this->statlistcommand) && !empty($this->statlistcommand)) {  ?>
	<div class="col-md-6">
		<div class="col-md-12 no-space-top"><h5>Les commandes non trait�es</h5></div>
		<div class="col-md-12 no-space-top">
		<table  class="display table" id="commandsHomeTable" width="100%">
			<?php  foreach($this->statlistcommand as $row) { ?>
			<tr >
				<td >
					 <a class="btn btn-primary" href="<?php echo $this->baseUrl; ?>/backoffice/command/edit/id/<?php echo $this->escape($row['CMDID']);?>"><span class="glyphicon glyphicon-list-alt"></span>&nbsp;<?php echo $this->escape($row['CMDREF']);?></a>
				 </td>
				<td >
					 <a class="btn btn-primary" href="<?php echo $this->baseUrl; ?>/backoffice/user/edit/id/<?php echo $this->escape($row['IDUSER']);?>"><span class="glyphicon glyphicon-user"></span>&nbsp;<?php echo $row['USERNOM'].' '.$row['USERPRENOM']; ?></a>
				 </td>
				<td >
					 <?php echo sprintf("%.2f",$this->escape($row['CMDTOTALTTC'])); ?><b>&nbsp;&#8364;</b>
				 </td>
			</tr>
			<?php } ?>
		</table>
		</div>
	</div>
	<?php } ?>
	<?php if ($this->useradmin['isProduct'] == 1 && isset($this->statlistproduct) && !empty($this->statlistproduct)) {  ?>
	<div class="col-md-12">
		<div class="col-md-12 no-space-top"><h5>Les produits non visible</h5></div>
		<div class="col-md-12 no-space-top">
			<table  class="display table" id="productsHomeTable" width="100%">
			<?php foreach($this->statlistproduct as $row) { ?>
				<tr <?php if ($this->escape($row['isACTIVE']) == 1) { echo "class='unactiveRow'";  } ?>>
					<td >
						 <a href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $this->escape($row['ID']);?>"><img src="<?php if (isset($listPics[$row['ID']])) { echo '/'.$listPics[$row['ID']]; }  ?>" /></a> 
					</td>
					<td >
						 <a class="btn btn-primary" href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $this->escape($row['ID']);?>"><span class="glyphicon glyphicon-eye-open"></span>&nbsp;<?php echo $row['NOM'];?></a>
							<?php echo $row['DESCRIPTIONSHORT'] ;?>
					 </td>
					<td  > 
							<?php echo $this->escape($row['PRIX']); ?><b>&nbsp;&#8364;</b>
					 </td>
				</tr>
				<?php } ?>
			</table>
		</div>
	</div> 
	<?php } ?>  
	<script>			
		$(document).ready(function() {
			initDataTable('productsHomeTable', [[0, "asc" ]], [ { "orderable": false, "targets": 0},{ "orderable": false, "targets": 1},{ "orderable": false, "targets": 2}]); 	
		});
	</script>
<?php } ?>  modules/backoffice/views/scripts/auth/login.phtml000060400000002247150710367660016247 0ustar00 <div class="loginwrapper whiter">
	<span class="circle"></span>
	<div class="loginone">
    	<header>
        	<a href="#"><img src="<?php echo $this->baseUrl; ?>/business/image/logo.png" alt="" /></a>
            <p>Entrez vos identifiants pour vous connecter</p> 
            <?php if ($this->messageError != null ||  $this->messageError != "") { ?>
            <div class="alert alert-danger"><?php echo $this->messageError; ?></div>
            <?php } ?>
        </header>      							
        <form action="<?php echo $this->baseUrl; ?>/backoffice/auth/login" method="post">
        	<div class="username">
        		<input type="text" class="form-control" placeholder="Votre identifiant" name="username" />
                <i class="glyphicon glyphicon-user"></i>
            </div>
            <div class="password">
            	<input type="password" class="form-control" placeholder="Votre mot de passe" name="password" />
                <i class="glyphicon glyphicon-lock"></i>
            </div>
            <div class="custom-radio-checkbox"></div> 
            <input type="submit" class="btn btn-default" value="Connexion" />
        </form>
    </div>           
</div>
		modules/backoffice/views/scripts/fidelitypoint/list.phtml000060400000007745150710367660020044 0ustar00
 <div class="table-box">
	<?php if ($this->populateFormAnnonce['TITRE']) { ?>
	<form action="<?php echo $this->baseUrl; ?>/backoffice/fidelitypoint/edit" method="post" name="editAnnonceForm" >
	<?php } else { ?>
	<form action="<?php echo $this->baseUrl; ?>/backoffice/fidelitypoint/add" method="post" name="addAnnonceForm" >
	<?php } ?>
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Titre</td>
				<td class="col-md-8"><input type="text" class="form-control" placeholder="Titre de l'offre" name="titre" size="40" id="titre" value="<?php echo $this->populateFormAnnonce['TITRE']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Points de fid�lit�</td>
				<td class="col-md-8"><input type="text" class="form-control" placeholder="Points de fid�lit� de l'offre" name="fidelitypoint" size="40" id="fidelitypoint" value="<?php echo $this->populateFormAnnonce['POINTFIDELITE']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Statut</td>
				<td class="col-md-8">
					<input type="radio" value="1" name="isshow" id="isshow1" class="bluecheckradios" <?php if ($this->populateFormAnnonce['isSHOW'] == 1) { echo 'checked="checked"';} ?>><label for="isshow1">&nbsp;Actif</label>
					<input type="radio" value="0" name="isshow" id="isshow2" class="bluecheckradios" <?php if ($this->populateFormAnnonce['isSHOW'] == 0) { echo 'checked="checked"';} ?>><label for="isshow2">&nbsp;Inactif</label>
			
				</td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Contenu</td>
				<td class="col-md-8">
						<textarea  name="content" cols="130" rows="20" id="annonceContent" name="annonceContent">
						<?php if (isset($this->populateFormAnnonce['CONTENT']) && !empty($this->populateFormAnnonce['CONTENT'])) { 
							 echo $this->populateFormAnnonce['CONTENT']; 
						} ?>
						</textarea>
				</td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<?php if ($this->populateFormAnnonce['TITRE']) { ?>
						<input type="hidden" name="id" value="<?php echo $this->populateFormAnnonce['ID'];?>">
						<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
					<?php } else { ?>
						<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
					<?php } ?>
						
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
$(function(){
	initEditor('#annonceContent');
});
</script>

 
 
 
 <div class="table-box">
<table class="display table" id="fidelitypointTable" width="100%">
	<thead>
		<tr>
			<th>Titre</th>
      <th>Statut</th>
      <th>Points de fid�lit�</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	
		<?php foreach($this->listannonce as $row)  { ?>
		<tr>
			<td><?php echo $row['TITRE'];?></td>
			<td><?php if ($this->escape($row['isSHOW'])==true) {echo 'Actif';} else {echo 'Inactif';} ?></td>
			<td><?php echo $row['POINTFIDELITE'];?></td>
			<td>
				<div class="btn-group">
	             	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/fidelitypoint/edit/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-edit"></span> Modifier</a>
					<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/fidelitypoint/del/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>			
	$(document).ready(function() {
		initDataTable('fidelitypointTable', [[ 0, "asc" ]], [{ "orderable": false, "targets": -1, "width": "270px" }]); 	    
	});
</script>
</div>
modules/backoffice/views/scripts/category/list.phtml000060400000002726150710367660016770 0ustar00<div class="table-box">
<div class="col-md-12 text-center"><?php echo $this->render("alert.phtml"); ?></div>
<table class="display table" id="productTable" width="100%">
	<thead>
		<tr>
			<th class="col-md-4" colspan="11"><?php echo $this->titlePage; ?></th>
		</tr>
	</thead>
	<tbody>
		<?php foreach($this->listallcategories as $row)  { ?>
		<tr>
			<?php for ($level=0 ; $level<11; $level++) { 
				$hasStyle="";
				$hasClass="col-md-2";
			if (!((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null)) {
				$hasClass = "col-md-1";
			} ?>
			<td style="<?php echo $hasStyle; ?>" class="<?php echo $hasClass; ?>">
				<?php 
				if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
				?>
				<div class="no-space ">
					<a href="<?php echo $this->baseUrl; ?>/backoffice/category/edit/id/<?php echo $row['ID'.$level]; ?>" <?php if ($row['isACTIVE'.$level] == false) { ?> style="color: red"<?php }?>>
						<?php echo $row['NOM'.$level]; ?>
					</a>
				</div>
				<div class="no-space text-right"> 
					<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/category/del/id/<?php echo $row['ID'.$level]; ?>" ><span class="glyphicon glyphicon-trash"></span></button>
					<?php $show['NOM'.$level] = $row['NOM'.$level]; } ?>
				</div>
			</td>
			<?php } ?>
		</tr>
		<?php } ?>
	</tbody>
</table>
</div>
modules/backoffice/views/scripts/category/edit.phtml000060400000072761150710367660016750 0ustar00<div class="table-box">	
	<div class="col-md-3 text-left">
		<a class="<?php if ($this->populateForm['isACTIVE'] == false) { echo 'btn btn-danger';} else { echo 'btn btn-info'; } ?>" 
			target="_blank" 
			href="<?php echo $this->baseUrl; ?>/<?php echo Utils_Tool::getFormattedUrlCategory($this->populateForm['NAVNOM_URLPARENTS'], $this->populateForm['NAVNOM'], $this->populateForm['ID']); ?>">
			<i class="glyphicon glyphicon-eye-open"></i>&nbsp;<?php echo $this->populateForm['NOM']; ?>
		</a> 
	</div>
	<?php  if ($this->isSiteEbusiness) {  ?>
	<div class="col-md-6 text-right" style="margin-top:0px;">
		<form action="<?php echo $this->baseUrl; ?>/backoffice/category/editmigrate#tabs-category" method="post" >
			 <div class="col-md-6 text-right"> D�sactiver cette cat�gorie et migrer les produits vers<br />
				<small>Une redirection sera effectu�e vers la cat�gorie s�lectionn�e</small>
			</div>
			<div class="col-md-4 text-right"> 
					<select name="idcategory" id="idcategory"  class="form-control" >
						<option value="0" selected="selected">Cette cat�gorie</option> 
						<?php 
							$show = array();
							foreach($this->listallcategories as $row) { 
								for ($level=0 ; $level<11; $level++) { 
									if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
									  if ($this->populateForm['ID'] == $row['ID'.$level]) {
										break;
									  } else {
										?>
											<option value="<?php echo $this->escape($row['ID'.$level]); ?>"  >
												<?php 
												for ($i=0 ; $i<$level; $i++) { 
													echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
												}
												echo $row['NOM'.$level]; ?>
														
											</option>
											<?php 
											$show['NOM'.$level] = $row['NOM'.$level];
										}
									  } 
									} 
							} ?>
					</select> 
			</div>
			<div class="col-md-2 text-right">
				<input type="hidden" name="id" value="<?php echo $this->populateForm['ID']; ?>">
				<button class="btn btn-primary" type="submit" name="edit"><i class="glyphicon glyphicon-resize-small"></i>&nbsp;Migrer</button>
			</div>
		</form>	
	</div>
	<?php } ?> 
	<div class="col-md-3 text-right">
		<form action="<?php echo $this->baseUrl; ?>/backoffice/category/editactive#tabs-category" method="post" >
					
			<input type="radio" class="bluecheckradios" name="active" id="active1" value="1" <?php if ($this->populateForm['isACTIVE'] == true) { echo 'checked="checked"';} ?>><label for="active1">&nbsp;Actif</label>
			<input type="radio" class="bluecheckradios" name="active" id="active2" value="0" <?php if ($this->populateForm['isACTIVE'] == false) { echo 'checked="checked"';} ?>><label for="active2">&nbsp;Inactif</label>
			<input type="hidden" name="id" value="<?php echo $this->populateForm['ID']; ?>">
			<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
		</form>	
	</div>
	
	<?php  if ($this->isSiteGallery) {  ?>
	<div class="col-md-3 text-right">
		<form action="<?php echo $this->baseUrl; ?>/backoffice/category/edittheme#tabs-category" method="post" >
			<div class="col-md-8 no-space-top"> 
				<select name="idtheme" id="idtheme"  class="form-control" >
					<?php  foreach($this->FeatureSiteThemeCms as $row) {  
					if ($row['ID_THEME'] != 3 && $row['ID_THEME'] != 5) {
					?>
					<option  value="<?php echo $row['ID_THEME']; ?>" <?php if ($row['ID_THEME'] == $this->populateForm['ID_THEME']) { echo 'selected="selected"';}?> >
						<?php echo $row['NOM_THEME']; ?> 
					</option>
					<?php  }} ?>
				</select>
			</div>
			<div class="col-md-4 no-space-top">
				<input type="hidden" name="id" value="<?php echo $this->populateForm['ID']; ?>">
				<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier le th�me</button>
			</div>
		</form>	
	</div>
	<?php  }  ?>

	<div class="col-md-12"><?php echo $this->render("alert_tr.phtml"); ?></div>
								
	<div class="col-md-12 no-space-side">
		<div class="tabs-section ">
			<ul class="nav nav-tabs" id="myTab">
				<li ><a href="#tabs-category" data-toggle="tab">Cat�gorie</a></li>
				<li ><a href="#tabs-referencement" data-toggle="tab">R�f�rencement</a></li>
				<li ><a href="#tabs-image" data-toggle="tab">Images</a></li>
				<?php  if ($this->isSiteGallery) {  ?>
				<li ><a href="#tabs-gallery" data-toggle="tab">Articles / Galleries</a></li>
				<?php  }  ?>
			</ul>
			<div class="tab-content">
				<div class="tab-pane active" id="tabs-category">
					<section class="boxpadding">
						<form action="<?php echo $this->baseUrl; ?>/backoffice/category/editcategory#tabs-category" method="post"  enctype="multipart/form-data" >
							<table class="table">
                	<?php  if ($this->isSiteGallery) {  ?>
				       	  <tr >
									  <td class="col-md-4"><label for="position">Position</label></td>
									  <td class="col-md-8"><input type="text" name="position" id="position" value="<?php echo $this->populateForm['POSITION']; ?>" class="form-control"/></td>
								  </tr> 
				        <?php  }  ?>
                  
								<tr >
									<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;<label for="nom">Nom</label></td>
									<td class="col-md-8"><input type="text" name="nom" id="nom" value="<?php echo $this->populateForm['NOM']; ?>" class="form-control"/></td>
								</tr> 
								<tr >
									<td ><label for="desc">Description</label></td>
									<td>
                                        <textarea class="form-control"  rows="10" cols="40" name="desc" id="desc"><?php echo $this->populateForm['DESCRIPTION'];?></textarea>
                                    </td>
								</tr>
                
                
                <?php if ($this->FeatureCategoryTextDescriptionShort) { ?>
								<tr >
									<td ><label for="descshort">Description courte</label></td>
									<td>
									  <textarea class="form-control"  rows="10" cols="40" name="descshort" id="descshort"><?php echo $this->populateForm['DESCRIPTIONSHORT'];?></textarea>
								  </td>
								</tr>
                <?php } else { ?>
                     <input type="hidden" name="descshort" value="" />
                <?php } ?>
                
                <?php if ($this->FeatureCategoryTextDescriptionLong) { ?>
								<tr >
									<td ><label for="desclong">Description longue</label></td>
									<td>
                                        <textarea class="form-control"  rows="10" cols="40" name="desclong" id="desclong"><?php echo $this->populateForm['DESCRIPTIONLONG'];?></textarea>
                                    </td>
								</tr>
                <?php } else { ?>
								<input type="hidden" name="desclong" value="" />
                <?php } ?>
                
                <?php if ($this->FeatureCategoryLinkRedirection) { ?>
								<tr >
									<td ><label for="urlredirect">Url de redirection</label><br /><small># = aucune action</small></td>
									<td>
										<input class="form-control" type="text" name="urlredirect" id="urlredirect" value="<?php echo $this->populateForm['URLREDIRECT'];?>"> 
                                    </td>
								</tr>
                <?php } else { ?>
								<input type="hidden" name="urlredirect" value="" />
                <?php } ?>
								<tr >
									<td ><label for="idparent">Cat�gorie parente</label></td>
									<td> 
										<select name="idparent" id="idparent"  class="form-control" >
											<option value="0">AUCUNE</option>
											<?php 
											$show = array();
											foreach($this->listallcategories as $row) { 
											 	for ($level=0 ; $level<11; $level++) { 
													if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
													?>
														<option value="<?php echo $this->escape($row['ID'.$level]); ?>" <?php if ($row['ID'.$level] == $this->populateForm['IDPARENT']) { echo 'selected="selected"';}?> >
															<?php 
											 				for ($i=0 ; $i<$level; $i++) { 
																echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
															}
															echo $row['NOM'.$level]; ?>
														
														</option>
														<?php 
														$show['NOM'.$level] = $row['NOM'.$level];
													}
												 } 
											} ?>
										</select> 
									</td>
								</tr>
								<tr >
									<td >
										<label for="picCat" >Image</label>
										<br/>
										<div class="col-md-12 text-center no-space-top">
											<?php if (!empty($this->populateForm['URL'])) { ?>
											<ul class="gallerybox ">
											  	<li>
													<figure>
														<img src="<?php echo $this->baseUrl.'/'.$this->populateForm['URL'];?>" />
													</figure>
												</li>
											</ul>
											<?php } ?>
										</div>
									</td>
									<td>
										<input type="file" name="picCat" id="picCat" size="50"/>
										<br><i>Extensions : jpg, gif, png</i>
										
									</td>
								</tr>
                                
                                <?php if ($this->FeatureCategoryPictureSlide) { ?>
								<tr >
									<td >
										<label for="picCat" >Image du slide</label>
										<br/>
										<div class="col-md-12 text-center no-space-top">
											<?php if (!empty($this->populateForm['URL_SLIDE'])) { ?>
											<ul class="gallerybox ">
											  	<li>
													<figure>
														<img src="<?php echo $this->baseUrl.'/'.$this->populateForm['URL_SLIDE'];?>" />
													</figure>
												</li>
											</ul>
											<?php } ?>
										</div>
									</td>
									<td>
										<input type="file" name="picSlideCat" id="picSlideCat" size="50"/>
										<br><i>Extensions : jpg, gif, png</i>
									</td>
								</tr>
                                <?php } ?>

								<?php  if ($this->isSiteEbusiness) {  ?>
								<tr >
									<td>
										<label for="picChoice" >Image de "Comment Choisir"</label>
										<br/>
										<?php if (isset($this->populateForm['CHOICEURL']) && !empty($this->populateForm['CHOICEURL'])) { ?>
										<div class="col-md-12 text-center no-space-top">
											<ul class="gallerybox ">
											  	<li>
													<figure>
														<img src="<?php echo $this->baseUrl.'/'.$this->populateForm['CHOICEURL'];?>" />
													</figure>
												</li>
											</ul>
										</div>
										<?php } ?>
									</td>
									<td>
										<input type="file" name="picChoice" id="picChoice" size="50"/>
										<br><i>Extensions : jpg, gif, png</i>
										
									</td>
								</tr> 
								<tr>
									<td nowrap="nowrap"><label for=docChoice>Document de "Comment Choisir"</label></td>
									<td>
										<select name="docChoice" id="docChoice" class="form-control">
										<option value="" selected="selected">Aucun</option>
										<?php 
											$files = glob("doc/*.pdf");
											for ($i=0; $i <sizeof($files); $i++) {				
										?>
										<option value="<?php echo $files[$i]; ?>" <?php if ($files[$i] == $this->populateForm['CHOICEDOC']) { echo 'selected="selected"';} ?> ><?php echo $files[$i]; ?></option>
										<?php } ?>
										</select> 
									</td>
								</tr> 
                                <?php } ?>
								<tr>
									<td align="center" colspan="2">	
										<input type="hidden" name="id"  value="<?php echo $this->populateForm['ID']; ?>">
										<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
									</td>
								</tr>
							</table>
						</form>
					</section>
				</div>
				
				<div class="tab-pane" id="tabs-referencement">
					<section class="boxpadding">
						<form action="<?php  echo $this->baseUrl; ?>/backoffice/category/customnavnomedit#tabs-referencement" method="post">
						<table class="table"> 
							<tr >
								<td colspan="2" ><h5>M�ta donn�es</h5></td>
							</tr> 
							<tr >
								<td class="col-md-4">
									<label for="navnom">Nom de navigation</label>
								</td>
								<td class="col-md-8">
									<input type="text" name="navnom" id="navnom" value="<?php echo $this->populateForm['NAVNOM']; ?>" class="form-control"/>
								</td>
							</tr>
							<tr >
								<td ><label for="navtitrenom">Titre de navigation</label>	<br/>
								<i><?php if (!empty($this->populateForm['NAVTITRENOM'])) { echo  strlen($this->populateForm['NAVTITRENOM'])." caract�res"; } ?></i></td> 
								<td > 
								  <input class="form-control" type="text" name="navtitrenom" id="navtitrenom" value="<?php echo $this->populateForm['NAVTITRENOM'];?>">
                </td>
							</tr>  
							<tr>
								<td><label for="navdescription">Description</label>	<br/>
                <i><?php if (!empty($this->populateForm['NAVDESCRIPTION'])) { echo  strlen($this->populateForm['NAVDESCRIPTION'])." caract�res"; } ?></i></td>
								<td>
									<input class="form-control" type="text" name="navdescription" id="navdescription" value="<?php echo $this->populateForm['NAVDESCRIPTION'];?>">
	              </td>
							</tr>  
							<tr>
								<td><label for="keywords">Mots cl�s</label></td>
								<td>
									<input class="form-control" type="text" name="keywords" id="keywords" value="<?php echo $this->populateForm['KEYWORDS'];?>">
								</td>
							</tr>
              <tr >
                <td colspan="2" >
                  <h5>Url</h5>
                </td>
              </tr>
              <tr>
                <td>
                  <label for="urlaccess">Acc�s hi�rarchique</label>
                </td>
                <td>
                  <input class="form-control" <?php if ($this->populateForm['IDPARENT'] != 0) { echo "readonly='readonly'"; } ?> type="text" name="urlaccess" id="urlaccess" value="<?php echo $this->populateForm['NAVNOM_URLPARENTS'];?>" placeholder="Pr�fix composant l'url, Ex : rubrique/sous-rubrique" >
                  </td>
              </tr>
              <tr >
								<td colspan="2" class="text-center">
									<input type="hidden" name="nom" value="<?php echo $this->populateForm['NOM'];?>">
									<input type="hidden" size="60" name="id" value="<?php echo $this->populateForm['ID'];?>">
                    <input type="hidden" size="60" name="idparent" value="<?php echo $this->populateForm['IDPARENT'];?>">
                    <button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
								</td>
							</tr> 
						</table>
						</form>
					</section>
				</div>
				
				<div class="tab-pane" id="tabs-image">
					<section class="boxpadding">
						<table class="table">  
							<tr>
								<td width="250px">
									<label for="idparent">Images</label>
								</td>
								<td >
									<?php 
										$files = glob("items/category/".$this->populateForm['ID']."/*.*");
										for ($i=0; $i <sizeof($files); $i++) {				
									?>
									<div class="col-md-3 text-center no-space-top">
										<form action="<?php echo $this->baseUrl; ?>/backoffice/category/setpicture#tabs-image" method="post">
										<div class="col-md-12 text-center">
											<ul class="gallerybox ">
											  	<li>
													<figure>
														<img src="<?php echo $this->baseUrl.'/'.$files[$i]; ?>" />
													</figure>
												</li>
											</ul>
										</div>
										<div class="col-md-4 text-right">
											<button class="btn btn-primary" type="submit" name="edit"><i class="glyphicon glyphicon-resize-small"></i>&nbsp;Lier</button>
											<input type="hidden" name="picture" value="<?php echo $files[$i]; ?>" >
											<input type="hidden" name="idCat" value="<?php echo $this->populateForm['ID']; ?>" >
										</div>
                                            
                                        <?php if ($this->FeatureCategoryPictureSlide) { ?>
										    <div class="col-md-8 text-right">
										        <select name="typeimage" class="form-control">
										            <option value="0" selected="selected">Normal</option>
										            <option value="1" >Slide</option>
                                                </select>
                                            </div>
                                         <?php } else { ?>
                                            <input type="hidden" value="0" name="typeimage">
                                         <?php }  ?>
										</form>	
										<div class="col-md-12 text-left">
										<form action="<?php echo $this->baseUrl; ?>/backoffice/category/erasepicture#tabs-image" method="post" id="delPictureImage<?php echo $i;?>">
											<button class="btn btn-danger btn-modal" type="button" data-toggle="ajaxModalSubmitDelete" data-form="delPictureImage<?php echo $i;?>"  ><i class="glyphicon glyphicon-trash"></i>&nbsp;Supprimer</button>
											<input type="hidden" name="picture" value="<?php echo $files[$i]; ?>" >
											<input type="hidden" name="idCat" value="<?php echo $this->populateForm['ID']; ?>" >
										</form>	
										</div>
									</div>
									<?php } ?>
								</td>
							</tr>
								<?php  if ($this->isSiteEbusiness) {  ?>
							<tr >
								<td >
									<label for="idparent" >Images de "Comment choisir"</label>
								</td>
								<td >
									<?php 
										$files = glob("items/category_choice/".$this->populateForm['ID']."/*.*");
										for ($i=0; $i <sizeof($files); $i++) {				
									?>
									<div class="col-md-3 text-center no-space-top">
										<form action="<?php echo $this->baseUrl; ?>/backoffice/category/setpicturechoice#tabs-image" method="post">
										<div class="col-md-12 text-center">
											<ul class="gallerybox ">
											  	<li>
													<figure>
														<img src="<?php echo $this->baseUrl.'/'.$files[$i]; ?>" />
													</figure>
												</li>
											</ul>
										</div>
										<div class="col-md-6 text-left">
											<button class="btn btn-primary" type="submit" name="edit"><i class="glyphicon glyphicon-resize-small"></i>&nbsp;Lier</button>
											<input type="hidden" name="picture" value="<?php echo $files[$i]; ?>" >
											<input type="hidden" name="idCat" value="<?php echo $this->populateForm['ID']; ?>" >
										</div>
										</form>	
										<div class="col-md-6 text-right">
										<form action="<?php echo $this->baseUrl; ?>/backoffice/category/erasepicturechoice#tabs-image" method="post" id="delPictureImageChoice<?php echo $i;?>">
											<button class="btn btn-danger btn-modal" type="button" data-toggle="ajaxModalSubmitDelete" data-form="delPictureImageChoice<?php echo $i;?>"  ><i class="glyphicon glyphicon-trash"></i>&nbsp;Supprimer</button>
											<input type="hidden" name="picture" value="<?php echo $files[$i]; ?>" >
											<input type="hidden" name="idCat" value="<?php echo $this->populateForm['ID']; ?>" >
										</form>	
										</div>
									</div>
									<?php } 
										$files = glob("items/category_choice/*.*");
										for ($i=0; $i <sizeof($files); $i++) {				
									?>
									<div class="col-md-3 text-center no-space-top">
										<form action="<?php echo $this->baseUrl; ?>/backoffice/category/setpicturechoice#tabs-image" method="post">
										<div class="col-md-12 text-center">
											<ul class="gallerybox ">
											  	<li>
													<figure>
														<img src="<?php echo $this->baseUrl.'/'.$files[$i]; ?>" />
													</figure>
												</li>
											</ul>
										</div>
										<div class="col-md-12">
											<button class="btn btn-primary" type="submit" name="edit"><i class="glyphicon glyphicon-resize-small"></i>&nbsp;Lier</button>
											<input type="hidden" name="picture" value="<?php echo $files[$i]; ?>" >
											<input type="hidden" name="idCat" value="<?php echo $this->populateForm['ID']; ?>" >
										</div>
										</form>	
									</div>
									
									<?php } ?>
								</td>
							</tr>
							<?php } ?>
						</table>
					</section>
				</div>
			
				<div class="tab-pane" id="tabs-gallery">
					<section class="boxpadding"> 
						<table class="display table" id="AnnonceCmsGalleryTable" width="100%">
							<tbody>
							
								<?php if(!empty($this->listAnnoncecms))  { ?> 
								<tr>
									<td colspan="4">Articles</td>
								</tr>
								<?php } 
								foreach($this->listAnnoncecms as $row)  { ?>
								<tr>
									<td></td>
									<td><?php echo $row['NOM'];?></td> 
									<td><?php if ($this->escape($row['isSHOW'])==0) {echo 'Actif';} else {echo 'Inactif';} ?></td>
									<td style="width:300px;">
										<div class="btn-group">
											<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/annoncecms/edit/id/<?php echo $row['ID']; ?>" target="_blank"><span class="glyphicon glyphicon-edit"></span> Modifier</a>
											<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/category/deletecms/id/<?php echo $this->populateForm['ID'];?>/idarticle/<?php echo $row['ID']; ?>#tabs-gallery"><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
										</div>
									</td>
								</tr>
								<?php } ?>
								<tr >
									<td colspan="4">
										<div class="col-md-12">Galleries <span id="message-gallery"></span></div> 
										
										<div class="col-md-12">
											<div id="fine-uploader-manual-trigger"></div>
										</div>
										
									
										<?php if(!empty($this->listAnnonceGallery))  { ?> 
										<div class="col-md-12">
											<ul id="sortable-gallery">
												<?php foreach($this->listAnnonceGallery as $row)  { ?>
												<li class="col-md-12" style="list-style-type:none" data-pic-id="<?php echo $row['ID']; ?>" data-cat-id="<?php echo $this->populateForm['ID']; ?>" > 
													<?php if (!empty($row['URL'])) { 
														$urlPicture = $row['URL'];?>
													<div class="col-md-3 no-space-top">
														<ul class="gallerybox">
															<li >
																<figure>
																	<img src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($urlPicture, 100);?>" />
																</figure>
															</li>
														</ul>
													</div> 
													<?php } ?> 
													<div class="col-md-3 no-space-top"><?php echo $row['NOM'];?></div> 
													<div class="col-md-3 no-space-top"><?php if ($this->escape($row['isSHOW'])==0) {echo 'Actif';} else {echo 'Inactif';} ?></div>
													<div class="col-md-3 no-space-top">
														<div class="btn-group">
															<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/annoncegallery/edit/id/<?php echo $row['ID']; ?>" target="_blank"><span class="glyphicon glyphicon-edit"></span> Modifier</a>
														
															<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/category/deletegallery/id/<?php echo $this->populateForm['ID'];?>/idgallery/<?php echo $row['ID']; ?>#tabs-gallery"><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
														</div>
													</div>
												</li>
												<?php } ?>
											</ul>
										</div>
										<?php } ?> 
									</td> 
								</tr>
							</tbody>
						</table> 
					</section>
				</div>
			</div>
		</div>
	</div>
</div>
<style> 
  .sortable-placeholder{ height: 1.5em; line-height: 1.2em; } 
  
        #trigger-upload {
            color: white;
            background-color: #00ABC7;
            font-size: 14px;
            padding: 7px 20px;
            background-image: none;
        }

        #fine-uploader-manual-trigger .qq-upload-button {
            margin-right: 15px;
        }

        #fine-uploader-manual-trigger .buttons {
            width: 36%;
        }

        #fine-uploader-manual-trigger .qq-uploader .qq-total-progress-bar-container {
            width: 60%;
        }
    </style>
    <link href="<?php echo $this->baseUrl; ?>/css/themes/admin/js/fileupload/fine-uploader-new.min.css" rel="stylesheet"> 
    <script src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/fileupload/fine-uploader.min.js"></script>
 
    <script type="text/template" id="qq-template-manual-trigger">
        <div class="qq-uploader-selector qq-uploader" qq-drop-area-text="Drag & Drop">
            <div class="qq-total-progress-bar-container-selector qq-total-progress-bar-container">
                <div role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" class="qq-total-progress-bar-selector qq-progress-bar qq-total-progress-bar"></div>
            </div>
            <div class="qq-upload-drop-area-selector qq-upload-drop-area" qq-hide-dropzone>
                <span class="qq-upload-drop-area-text-selector"></span>
            </div>
            <div class="buttons">
                <div class="qq-upload-button-selector qq-upload-button">
                    <div>S�lectionner</div>
                </div>
                <button type="button" id="trigger-upload" class="btn btn-primary">
                    <i class="glyphicon glyphicon-upload"></i> Upload
                </button>
            </div>
            <span class="qq-drop-processing-selector qq-drop-processing">
                <span>Upload en cours ...</span>
                <span class="qq-drop-processing-spinner-selector qq-drop-processing-spinner"></span>
            </span>
            <ul class="qq-upload-list-selector qq-upload-list" aria-live="polite" aria-relevant="additions removals">
                <li>
                    <div class="qq-progress-bar-container-selector">
                        <div role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" class="qq-progress-bar-selector qq-progress-bar"></div>
                    </div>
                    <span class="qq-upload-spinner-selector qq-upload-spinner"></span>
                    <img class="qq-thumbnail-selector" qq-max-size="100" qq-server-scale>
                    <span class="qq-upload-file-selector qq-upload-file"></span>
                    <span class="qq-edit-filename-icon-selector qq-edit-filename-icon" aria-label="Edit filename"></span>
                    <input class="qq-edit-filename-selector qq-edit-filename" tabindex="0" type="text">
                    <span class="qq-upload-size-selector qq-upload-size"></span>
                    <button type="button" class="qq-btn qq-upload-cancel-selector qq-upload-cancel">Annuler</button>
                    <button type="button" class="qq-btn qq-upload-retry-selector qq-upload-retry">R�essayer</button>
                    <button type="button" class="qq-btn qq-upload-delete-selector qq-upload-delete">Supprimer</button>
                    <span role="status" class="qq-upload-status-text-selector qq-upload-status-text"></span>
                </li>
            </ul>

            <dialog class="qq-alert-dialog-selector">
                <div class="qq-dialog-message-selector"></div>
                <div class="qq-dialog-buttons">
                    <button type="button" class="qq-cancel-button-selector">Fermer</button>
                </div>
            </dialog>

            <dialog class="qq-confirm-dialog-selector">
                <div class="qq-dialog-message-selector"></div>
                <div class="qq-dialog-buttons">
                    <button type="button" class="qq-cancel-button-selector">Non</button>
                    <button type="button" class="qq-ok-button-selector">Oui</button>
                </div>
            </dialog>

            <dialog class="qq-prompt-dialog-selector">
                <div class="qq-dialog-message-selector"></div>
                <input type="text">
                <div class="qq-dialog-buttons">
                    <button type="button" class="qq-cancel-button-selector">Annuler</button>
                    <button type="button" class="qq-ok-button-selector">Ok</button>
                </div>
            </dialog>
		<div id="qq-dialog-error-message" class="alert alert-danger hide"></div>
        </div>
    </script>

 
	<script>
	 
	 $('#sortable-gallery').sortable({
            placeholder : "fantom",
		axis: 'y',
		update: function (event, ui) {  
		
			var data = 'position='+ui.item.index()+'&id='+ui.item.attr('data-pic-id')+'&category='+ui.item.attr('data-cat-id');
			
			 $.ajax({
				 data: data,
				 type: 'post',
				 url: '<?php echo $this->baseurl; ?>/backoffice/annoncegallery/editposition'
			 });
		}
	});

		var url = document.location.toString();
		if (url.match('#')) {
			$('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
		} else {
			$('.nav-tabs a[href="#tabs-category"]').tab('show');
		}
		
	
		var manualUploader = new qq.FineUploader({
			element: document.getElementById('fine-uploader-manual-trigger'),
			template: 'qq-template-manual-trigger',
			text: {
                formatProgress: "{percent}% de {total_size}",
                failUpload: "Upload erron�",
                waitingForResponse: 'Upload en cours ...',
                paused: "Pause"
            }, 
			request: {
				endpoint: '<?php echo $this->baseUrl; ?>/backoffice/category/addmultiplegallery?idCat=<?php echo $this->populateForm['ID']; ?>'
			},
			thumbnails: {
				placeholders: {
					waitingPath: '<?php echo $this->baseUrl; ?>/css/themes/admin/js/fileupload/placeholders/waiting-generic.png',
					notAvailablePath: '<?php echo $this->baseUrl; ?>/css/themes/admin/js/fileupload/placeholders/not_available-generic.png'
				}
			},
			autoUpload: false,
			debug: false, 
            showMessage: function(message) { 
            },
		});

		qq(document.getElementById("trigger-upload")).attach("click", function() {
			manualUploader.uploadStoredFiles();
		});
	</script>modules/backoffice/views/scripts/category/ajaxvalue.phtml000060400000000145150710367660017766 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?>
<?php  echo $this->messageSuccess; ?>modules/backoffice/views/scripts/category/add.phtml000060400000005112150710367660016535 0ustar00 <div class="table-box">
	<form action="<?php echo $this->baseUrl; ?>/backoffice/category/add" method="post" name="addCategory"  enctype="multipart/form-data" >
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Nom</td>
				<td class="col-md-8"><input type="text" class="form-control" name="nom" id="nom" value="<?php echo $this->populateForm['NOM']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Nom de navigation</td>
				<td class="col-md-8"><input type="text" class="form-control" name="navnom" id="navnom" value="<?php echo $this->populateForm['NAVNOM']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-4">Mots cl�s</td>
				<td class="col-md-8"><input type="text" class="form-control" name="keywords" id="keywords" value="<?php echo $this->populateForm['KEYWORDS']; ?>" /></td>
			</tr>
			<tr>
				<td class="col-md-4">Description</td>
				<td class="col-md-8"><input type="text" class="form-control" name="desc" id="desc" value="<?php echo $this->populateForm['DESCRIPTION']; ?>" /></td>
			</tr>
			<tr>
				<td class="col-md-4">Cat�gorie parente</td>
				<td class="col-md-8">
					<select name="idparent" id="idparent" class="form-control">
						<option value="0">AUCUNE</option>
						<?php 
						$show = array();
						foreach($this->listallcategories as $row) { 
						 	for ($level=0 ; $level<11; $level++) { 
								if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
								?>
									<option value="<?php echo $this->escape($row['ID'.$level]); ?>">
										<?php 
						 				for ($i=0 ; $i<$level; $i++) { 
											echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
										}
										echo $row['NOM'.$level]; ?>
									
									</option>
									<?php 
									$show['NOM'.$level] = $row['NOM'.$level];
								}
							 } 
						} ?>
					</select>
				</td>
			</tr>
			<tr>
				<td class="col-md-4">Image</td>
				<td class="col-md-8">
					<input type="file" name="picCat" id ="picCat" size="50" >
						<br><i>Extensions : jpg, gif, png</i>
				</td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
		modules/backoffice/views/scripts/faq/list.phtml000060400000014167150710367660015724 0ustar00<script type="text/javascript">
$(function(){
	initRichTextBox('#faq_question', 2, 500, 150);
	initRichTextBox('#faq_reponse', 2, 500, 150);
	generateTabs($("#tabs"), 1);  
});
</script>
<div id="tabs">
	<ul>
		<li><a href="#tabs-category">Cat�gorie</a></li>
		<li><a href="#tabs-qr">Questions/Reponses</a></li> 
	</ul>
	<div id="tabs-category">
		<form action="<?php  echo $this->baseUrl; ?>/backoffice/faq/addfaqtype#tabs-category" method="post">
			<table cellpadding="0" cellspacing="10" border="0" width="800px">
				<tr>
					<td >
						<span class="errorText"><?php echo $this -> messageError; ?></span>
						<span class="successText"><?php echo $this -> messageSuccess; ?></span>
					</td>
				</tr>
				<tr > <td colspan="3" style="background:#666666; height: 1px"></td></tr>
				<tr>
					<td colspan="3">
						<div class="text2">CATEGORIE</div>
					</td>
				</tr>
				<tr > <td colspan="3" style="background:#666666; height: 1px"></td></tr>
				<tr>
					<td>
						Nom : <br/>
						<input type="text" size="40" name="faq_nom" >
					</td>
					<td>
						<input type="submit" value="Ajouter" >
					</td>
				</tr>
			</table>
		</form>
		
		<?php  foreach($this->faqtypes as $row) { ?>
		<form action="<?php  echo $this->baseUrl; ?>/backoffice/faq/editfaqtype" method="post">
			<table cellpadding="0" cellspacing="6" border="0" >
				<tr>
					<td>
						<input type="text" size="40" name="faq_nom" value="<?php echo $row['NOM'];?>">
					</td>
					<td >
						<input type="hidden" value="<?php echo $row['ID']; ?>" name="faq_id">
						<input type="submit" value="Modifier">
						<?php if ($row['isACTIVE'] == 0) { ?>
							<a class="button" href="<?php echo $this->baseUrl; ?>/backoffice/faq/activefaqtype/id/<?php echo $row['ID']; ?>#tabs-category" onClick="return msgOkCancelDelete();">Activer</a>
						<?php } else { ?>
							<a class="button" href="<?php echo $this->baseUrl; ?>/backoffice/faq/unactivefaqtype/id/<?php echo $row['ID']; ?>#tabs-category" onClick="return msgOkCancelDelete();">D�sactiver</a>
						<?php } ?>
						<a class="button" href="<?php echo $this->baseUrl; ?>/backoffice/faq/delfaqtype/id/<?php echo $row['ID']; ?>#tabs-category" onClick="return msgOkCancelDelete();">Supprimer</a>
						
					</td>
				</tr>
			</table>
		</form>
		<?php } ?>
	</div>
	<div id="tabs-qr">
		<form action="<?php  echo $this->baseUrl; ?>/backoffice/faq/addfaq#tabs-qr" method="post">
			<table cellpadding="0" cellspacing="10" border="0" >
				<tr>
					<td colspan="5">
						<span class="errorText"><?php echo $this -> messageError; ?></span>
						<span class="successText"><?php echo $this -> messageSuccess; ?></span>
					</td>
				</tr>
				<tr > <td colspan="5" style="background:#666666; height: 1px"></td></tr>
				<tr>
					<td colspan="5">
						<div class="text2">AJOUTER</div>
					</td>
				</tr>
				<tr > <td colspan="5" style="background:#666666; height: 1px"></td></tr>
				<tr>
					<td>QUESTION </td>
					<td>REPONSE </td>
					<td>POSITION </td>
					<td>CATEGORIE </td>
					<td> </td>
				</tr>
				<tr>
					<td><textarea rows="5" cols="30" name="faq_question" id="faq_question" class="faq_question"></textarea></td>
					<td><textarea rows="5" cols="30" name="faq_reponse" id="faq_reponse" class="faq_reponse"></textarea></td>
					<td><input type="text" size="5" name="faq_position" ></td>
					<td>
						<select name="faq_type">
							<?php foreach($this->faqtypes as $row) { ?>
							<option value="<?php echo $row['ID']; ?>"><?php echo $row['NOM']; ?></option>
							<?php }?>
						</select>
					</td>
					<td>
						<input type="submit" value="Ajouter" >
					</td>
				</tr>
			</table>
		</form>
		
		<table cellpadding="0" cellspacing="10" border="0" width="1200px">
			<?php $lastType = ""; 
			foreach($this->faq as $row) { 
				if ($lastType != $row['IDTYPE']) {  
					$lastType = $row['IDTYPE']; ?>
			<tr > <td colspan="5" style="background:#666666; height: 1px"></td></tr>
			<tr>
				<td colspan="5">
					<div class="text2"><?php echo $row['NOMTYPE']; ?></div>
				</td>
			</tr>
			<tr > <td colspan="5" style="background:#666666; height: 1px"></td></tr>
			<?php } ?>
			<tr > 
				<td colspan="5" >
					<form action="<?php  echo $this->baseUrl; ?>/backoffice/faq/editfaq#tabs-qr" method="post">
					
					<table cellpadding="0" cellspacing="10" border="0" >
						<tr>
							<td><textarea rows="5" cols="30" name="faq_question" class="faq_question"><?php echo $row['QUESTION'];?></textarea></td>
							<td><textarea rows="5" cols="30" name="faq_reponse" class="faq_reponse"><?php echo $row['REPONSE'];?></textarea></td>
							<td colspan="3">
								<table cellpadding="0" cellspacing="10" border="0" >
									<tr>
										<td><input type="text" size="5" name="faq_position" value="<?php echo $this->escape($row['POSITION']);?>"></td>
										<td>
											<select name="faq_type">
												<?php foreach($this->faqtypes as $rowType) { ?>
												<option value="<?php echo $rowType['ID']; ?>" <?php if ($rowType['ID'] == $row['IDTYPE']) { echo "selected"; } ?>><?php echo $rowType['NOM']; ?></option>
												<?php }?>
											</select>
										</td>
									</tr>
									<tr>
										<td colspan="2" width="300px">
											<input type="hidden" value="<?php echo $row['ID']; ?>" name="faq_id">
											<span><input type="submit" value="Modifier"></span>
											<span>
											<?php if ($row['isACTIVEFAQ'] == 0) { ?>
												<a class="button" href="<?php echo $this->baseUrl; ?>/backoffice/faq/activefaq/id/<?php echo $row['ID']; ?>#tabs-qr" onClick="return msgOkCancelDelete();">Activer</a> 
											<?php } else { ?>
												<a class="button" href="<?php echo $this->baseUrl; ?>/backoffice/faq/unactivefaq/id/<?php echo $row['ID']; ?>#tabs-qr" onClick="return msgOkCancelDelete();">D�sactiver</a> 
											<?php } ?>
											</span>
											<span> <a class="button" href="<?php echo $this->baseUrl; ?>/backoffice/faq/delfaq/id/<?php echo $row['ID']; ?>#tabs-qr" onClick="return msgOkCancelDelete();">Supprimer</a></span>
											
										</td>
									</tr>
								</table>	 
							</td>
						</tr>
					</table>
					</form>
				</td>
			</tr>
					
			<?php } ?>
		</table>
	</div>
</div>
 modules/backoffice/views/scripts/ebp/index.phtml000060400000006067150710367660016057 0ustar00 <div class="table-box">
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-12 text-center" colspan="2"><h5>Exportation des donn�es vers EBP</h5></td>
			</tr>
			<tr >
				<td class="col-md-5">Vous pouvez importer toutes les donn�es dans EBP -> Outils -> Importation de donn�es</td>
				<td class="col-md-7">
					<div class="btn-group">
						<a href="<?php echo $this->baseUrl; ?>/backoffice/ebp/exportfournisseurs" class="btn btn-success"><i class="glyphicon glyphicon-open"></i>&nbsp;Exporter les Fournisseurs</a>
						<a href="<?php echo $this->baseUrl; ?>/backoffice/ebp/exportclients" class="btn btn-success"><i class="glyphicon glyphicon-open"></i>&nbsp;Exporter les Clients</a>
						<a href="<?php echo $this->baseUrl; ?>/backoffice/ebp/exportcategories" class="btn btn-success"><i class="glyphicon glyphicon-open"></i>&nbsp;Exporter les Familles articles</a>
						<a href="<?php echo $this->baseUrl; ?>/backoffice/ebp/exportarticles" class="btn btn-success"><i class="glyphicon glyphicon-open"></i>&nbsp;Exporter les Articles</a>
					</div>
				</td>
			</tr> 
			<tr >
				<td class="col-md-5">Vous pouvez importer les donn�es des 3 derniers mois dans EBP -> Outils -> Imports param�trables</td>
				<td class="col-md-7">
					<div class="btn-group">
						<a href="<?php echo $this->baseUrl; ?>/backoffice/ebp/exportcommandes" class="btn btn-success"><i class="glyphicon glyphicon-open"></i>&nbsp;Exporter les Commandes (Vente)</a>
						<a href="<?php echo $this->baseUrl; ?>/backoffice/ebp/exportdevis" class="btn btn-success"><i class="glyphicon glyphicon-open"></i>&nbsp;Exporter les Devis (Vente)</a>
					</div>
				</td>
			</tr>
			<tr >
				<td class="col-md-12 text-center" colspan="2"><h5>Importation des donn�es vers le site</h5></td>
			</tr>
			<tr >
				<td class="col-md-5">Vous pouvez exporter les donn�es via EBP -> Outils -> Exportation de donn�es</td>
				<td class="col-md-7">
					<form action="<?php echo $this->baseUrl; ?>/backoffice/ebp/importcategories" method="post" name="importCategorieForm"  enctype="multipart/form-data" >
						<div class="col-md-6 no-space-top"><input type="file" name="csvfile" id="csvfile"></div>
						<div class="col-md-6 no-space-top"><button class="btn btn-primary" type="submit" ><i class="glyphicon glyphicon-save"></i>&nbsp;Importer les Familles articles</button></div>
					</form>
				</td>
			</tr>
			<tr >
				<td class="col-md-5"></td>
				<td class="col-md-7">
					<form action="<?php echo $this->baseUrl; ?>/backoffice/ebp/importarticles" method="post" name="importArticlesForm"  enctype="multipart/form-data" >
						<div class="col-md-6 no-space-top"><input type="file" name="csvfile" id="csvfile"></div>
						<div class="col-md-6 no-space-top"><button class="btn btn-primary" type="submit" ><i class="glyphicon glyphicon-save"></i>&nbsp;Importer les Articles</button></div>
					</form>
				</td>
			</tr>
		</tbody>
	</table>
</div>
<div class="clearfix"></div>modules/backoffice/views/scripts/product/option.phtml000060400000004013150710367660017157 0ustar00 <div class="table-box">
	<form method="POST" action="<?php echo $this->baseUrl; ?>/backoffice/product/option">
	<table class="table">
		<thead>
			<tr>
				<th class="col-md-4" colspan="2"><?php echo $this->titlePage; ?><i style="display:none">Liste de caract�ristiques d�taillant un produit</i></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr class="nostriped">
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Caract�ristique</td>
				<td class="col-md-8"><input type="text" class="form-control" size="60" name="nom" placeholder="Ajouter une caract�ristique de produit"></td>
			</tr>
			<tr class="nostriped">
				<td colspan="2" class="text-center">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>

<div class="table-box">
<table class="display table" id="optionTable" width="100%">
	<thead>
		<tr>
			<th>Caract�ristiques</th> 
		</tr>
	</thead>
	<tbody>
		<?php foreach($this->listoption as $row)  { ?>
		<tr>
			<td>
				<form method="POST" action="<?php echo $this->baseUrl; ?>/backoffice/product/optionedit">
				<div class="col-md-8 no-space-top">
					<input type="text" class="form-control" size="40" name="nom" value="<?php echo $this->escape($row['NOM']);?>">
				</div>
				<div class="col-md-4 no-space-top">
					<input type="hidden" name="id" id="id" value="<?php echo $this->escape($row['ID']);?>">
					<div class="btn-group">
						<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
						<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/product/optiondel/id/<?php echo $this->escape($row['ID']);?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
					</div>
				</div>
				</form>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
</div>
modules/backoffice/views/scripts/product/ajaxvalue.phtml000060400000000145150710367660017631 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?>
<?php  echo $this->messageSuccess; ?>modules/backoffice/views/scripts/product/search.phtml000060400000023407150710367660017124 0ustar00 <div class="table-box">
	<form method="POST" action="/backoffice/product/search">
	<table class="table">
		<thead>
			<tr>
				<th class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<tr class="nostriped">
				<td class="col-md-12 ">
					<div class="col-md-4 no-space-top"><input placeholder="Rechercher un nom, une r�f�rence, une description" class="form-control" type="text" size="60" name="search" id="search" value="<?php echo $this->populateForm['search'];?>"></div>
					<div class="col-md-4 no-space-top">
						<div class="col-md-6  no-space-top"><input placeholder="Entre le prix minimum"  class="form-control" type="text" size="10" name="prixMin" id="prixMin" value="<?php echo $this->populateForm['prixMin'];?>"></div>
						<div class="col-md-6 no-space-top"><input placeholder="et le prix maximum" class="form-control" type="text" size="10" name="prixMax" id="prixMax" value="<?php echo $this->populateForm['prixMax'];?>"></div>
					</div>
				</td>
			</tr>
			<tr class="nostriped">
				<td class="col-md-12">
					<div class="col-md-2 no-space-top">
						<div class="col-md-12 no-space-top"><h5>Rechercher un produit actif</h5></div>
						<div class="text-center">
							<input type="radio" class="bluecheckradios" name="active" id="active1" value="0" <?php if ($this->populateForm['active'] == 0) { echo 'checked="checked"';} ?>><label for="active1">&nbsp;Actif</label>
							<input type="radio" class="bluecheckradios" name="active" id="active2" value="1" <?php if ($this->populateForm['active'] == 1) { echo 'checked="checked"';} ?>><label for="active2">&nbsp;Non actif</label>
							<input type="radio" class="bluecheckradios" name="active" id="active3" value="2" <?php if ($this->populateForm['active'] == 2) { echo 'checked="checked"';} ?>><label for="active3">&nbsp;Les deux</label>
						</div>
					</div>
					<div class="col-md-3 no-space-top">
						<div class="col-md-12 no-space-top"><h5>Rechercher un produit ayant une image</h5></div>
						<div class="text-center">
							<input type="radio" class="bluecheckradios" name="image" id="image1" value="0" <?php if ($this->populateForm['image'] == 0) { echo 'checked="checked"';} ?>><label for="image1">&nbsp;Avec</label>
							<input type="radio" class="bluecheckradios" name="image" id="image2" value="1" <?php if ($this->populateForm['image'] == 1) { echo 'checked="checked"';} ?>><label for="image2">&nbsp;Sans</label>
							<input type="radio" class="bluecheckradios" name="image" id="image3" value="2" <?php if ($this->populateForm['image'] == 2) { echo 'checked="checked"';} ?>><label for="image3">&nbsp;Les deux</label>
						</div>
					</div>
					<div class="col-md-3 no-space-top">
						<div class="col-md-12 no-space-top"><h5>Rechercher un produit en promotion</h5></div>
						<div class="text-center">
							<input type="radio" class="bluecheckradios" name="activePromo" id="activePromo1" value="0" <?php if ($this->populateForm['activePromo'] == 0) { echo 'checked="checked"';} ?>><label for="activePromo1">&nbsp;En promotion</label>
							<input type="radio" class="bluecheckradios" name="activePromo" id="activePromo2" value="1" <?php if ($this->populateForm['activePromo'] == 1) { echo 'checked="checked"';} ?>><label for="activePromo2">&nbsp;Hors promotion</label>
							<input type="radio" class="bluecheckradios" name="activePromo" id="activePromo3" value="2" <?php if ($this->populateForm['activePromo'] == 2) { echo 'checked="checked"';} ?> ><label for="activePromo3">&nbsp;Les deux</label>
						</div>
					</div>
					<div class="col-md-4 no-space-top">
						<div class="col-md-12 no-space-top"><h5>Rechercher un produit disponible</h5></div>
						<div class="text-center">
							<input type="radio" class="bluecheckradios" value="0" name="etatstock" id="etatstock1"  <?php if ($this->populateForm['etatstock'] == 0) { echo 'checked="checked"';} ?>><label for="etatstock1">&nbsp;Disponible</label>
							<input type="radio" class="bluecheckradios" value="1" name="etatstock" id="etatstock2"  <?php if ($this->populateForm['etatstock'] == 1) { echo 'checked="checked"';} ?>><label for="etatstock2">&nbsp;En attente</label>
							<input type="radio" class="bluecheckradios" value="2" name="etatstock" id="etatstock3"  <?php if ($this->populateForm['etatstock'] == 2) { echo 'checked="checked"';} ?>><label for="etatstock3">&nbsp;Nous contacter</label>
							<input type="radio" class="bluecheckradios" value="3" name="etatstock" id="etatstock4"  <?php if ($this->populateForm['etatstock'] == 3) { echo 'checked="checked"';} ?>><label for="etatstock4">&nbsp;Tous</label>
						</div>
					</div>
				</td>
			</tr>
			<tr class="nostriped">
				<td class="col-md-12">
					<div class="col-md-6 no-space-top">
						<div class="col-md-12 no-space-top"><h5>Rechercher une caract�ristique du produit</h5></div>
						<div class="col-md-6 no-space-top">
							<select class="form-control" name="optionId" id="optionId">
								<option value="All" <?php if ($this->populateForm['optionId'] == 'All') { echo 'selected="selected"';}?> >Tous</option>
								<?php foreach($this->listoption as $row) { ?>
								<option value="<?php echo $this->escape($row['ID']); ?>" <?php if ($this->populateForm['optionId'] == $this->escape($row['ID'])) { echo 'selected="selected"';}?> > 
									<?php echo $this->escape($row['NOM']); ?>
								</option>
								<?php } ?>
							</select>
						</div>
						<div class="col-md-6 no-space-top">
							<input placeholder="Valeur de la caract�ristique"  class="form-control" type="text" size="10" name="optionValue" id="optionValue" value="<?php echo $this->populateForm['optionValue'];?>">
						</div>
					</div>
					<div class="col-md-6 no-space-top" >
						<div class="col-md-12 no-space-top"><h5>Rechercher une marque</h5></div>
						<div class="col-md-6 no-space-top">
							<select class="form-control" name="idbrend" id="idbrend">
								<option value="All"  <?php if ($this->populateForm['idbrend'] == 'All') { echo 'selected="selected"';}?>>Tous</option>
								<?php foreach($this->listbrend as $row) { ?>
								<option value="<?php echo $this->escape($row['ID']); ?>" <?php if ($this->populateForm['idbrend'] == $this->escape($row['ID'])) { echo 'selected="selected"';}?> >
									<?php echo $this->escape($row['BREND']);?>
								</option>
								<?php } ?>
							</select>
						</div>
					</div>
				</td>
			</tr>
			<tr class="nostriped">
				<td class="col-md-12"> 
					<div class="col-md-6 no-space-top">
						<div class="col-md-12 no-space-top"><h5>Rechercher une cat�gorie</h5></div>
						<div class="col-md-12 no-space-top">
							<select class="form-control" name="idcategorySearch" >
							<option value="All" <?php if ($this->populateForm['idcategorySearch'] == 'All') { echo 'selected="selected"';}?>>Tous</option>
							<?php 
							$show = array();
							foreach($this->listallcategories as $row) { 
							 	for ($level=0 ; $level<11; $level++) { 
									if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
									?>
										<option value="<?php echo $this->escape($row['ID'.$level]); ?>" <?php if ($this->populateForm['idcategorySearch'] == $this->escape($row['ID'.$level])) { echo 'selected="selected"';}?>>
											<?php 
							 				for ($i=0 ; $i<$level; $i++) { 
												echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
											}
											echo $this->escape($row['NOM'.$level]); ?>
										
										</option>
										<?php 
										$show['NOM'.$level] = $row['NOM'.$level];
									}
								 } 
							} ?>
							</select>
						</div>
					</div>
					<div class="col-md-6 text-center">
						<button type="submit" name="searchbtn"  class="btn btn-primary">
						  <span class="glyphicon glyphicon-search"></span> Rechercher
						</button>				
					</div>
				</td>
			</tr>
			<tr>
				<td class="col-md-12"></td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<div class="table-box">
<?php 
$listPics = $this->listproductpicture; 
?>
<table class="display table" id="productTable" width="100%">
	<thead>
		<tr>
			<th></th>
			<th>Nom</th>
			<th>Description</th>
			<th class="center">Prix</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	
		<?php foreach($this->listSearch as $row)  { ?>
		<tr>
			<td>
				<ul class="gallerybox">
                	<li>
						<figure>
							<a href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $this->escape($row['ID']);?>" target="_blank"><img src="<?php if (isset($listPics[$row['ID']])) { echo '/'.$listPics[$row['ID']]; } else {echo '/items/product/default/default.png'; } ?>"></a>
						</figure>
					</li>
				</ul>
			</td>
			<td>
				<?php echo $row['NOM'];?>
			</td>
			<td>	
				<?php echo $row['DESCRIPTIONSHORT'];?>
				<?php if ($this->escape($row['isPROMO']) == 0) { ?> <br/><br/>En promo<?php } ?>
			</td>
			<td>
				<?php echo $this->escape($row['PRIX']); ?>&nbsp;&#8364;
			</td>
			<td>
				<div class="btn-group">
	             	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $this->escape($row['ID']);?>" target="_blank"><span class="glyphicon glyphicon-edit"></span> Modifier</a>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>			
	$(document).ready(function() {
		initDataTable('productTable', [[ 1, "asc" ]], [
		                    		                { "orderable": false, "targets": 0, "width": "150px"  },
		                    		                { "orderable": false, "targets": -1, "width": "270px" },
		                    		                { "orderable": true, "targets": 1, "type": "html"},
		                    		                { "orderable": true, "targets": 2, "type": "html"},
		                    		                { "orderable": true, "targets": 3}
		                    		              ]); 	    
	});
</script>
</div>


modules/backoffice/views/scripts/product/livraison.phtml000060400000010744150710367660017665 0ustar00<table cellpadding="0" cellspacing="6" border="0" width="800px">
	<tr>
		<td >
			<span class="errorText"><?php echo $this -> messageError; ?></span>
			<span class="successText"><?php echo $this -> messageSuccess; ?></span>
		</td>
	</tr>
	<tr>
		<td>
			<form action="<?php  echo $this->baseUrl; ?>/backoffice/product/addlivraisontype" method="post">
			<table cellpadding="0" cellspacing="10" border="0" >
				<tr > <td colspan="3" style="background:#666666; height: 1px"></td></tr>
				<tr>
					<td colspan="3">
						<div class="text2">TYPE DE LIVRAISON</div>
					</td>
				</tr>
				<tr > <td colspan="3" style="background:#666666; height: 1px"></td></tr>
				<tr>
					<td>
						Nom : <br/>
						<input type="text" size="40" name="livraison_nom" >
					</td>
					<td>
						Franco : <br/>
						<input type="text" size="5" name="livraison_franco" >
					</td>
					<td>
						<input type="submit" value="Ajouter" >
					</td>
				</tr>
				<tr > <td colspan="3" style="background:#666666; height: 1px"></td></tr>
			</table>
			</form>
		</td>
	</tr>
	<tr>
		<td >
			<?php  foreach($this->livraisontypes as $row) { ?>
				<form action="<?php  echo $this->baseUrl; ?>/backoffice/product/editlivraisontype" method="post">
				
				<table cellpadding="0" cellspacing="10" border="0" >
					<tr>
						<td>
							<input type="text" size="40" name="livraison_nom" value="<?php echo $this->escape($row['NOM']);?>">
						</td>
						<td>
							<input type="text" size="5" name="livraison_franco" value="<?php echo $this->escape($row['CMDFRANCO']);?>">
						</td>
						<td>
							<input type="hidden" value="<?php echo $row['ID']; ?>" name="livraison_id">
							<input type="submit" value="Modifier">
						</td>
						<td>
							<a class="button"  href="<?php echo $this->baseUrl; ?>/backoffice/product/dellivraisontype/id/<?php echo $row['ID']; ?>" onClick="return msgOkCancelDelete();">Supprimer</a>
						</td>
					</tr>
				</table>
			</form>
			<?php } ?>
		</td>
	</tr>
	
	<tr>
		<td>
			<form action="<?php  echo $this->baseUrl; ?>/backoffice/product/addlivraisonpoids" method="post">
			<table cellpadding="0" cellspacing="10" border="0" >
				
				<tr > <td colspan="6" style="background:#666666; height: 1px"></td></tr>
				<tr>
					<td colspan="6">
						<div class="text2">POIDS</div>
					</td>
				</tr>
				<tr > <td colspan="6" style="background:#666666; height: 1px"></td></tr>
				<tr>
					<td width="100px">
						<input type="text" size="6" name="livraison_poids_from" >Kg
					</td>
					<td width="20px"> - > </td>
					<td width="100px">
						<input type="text" size="6" name="livraison_poids_to" >Kg
					</td>
					<td width="200px">
						<?php  foreach($this->livraisontypes as $row) { ?>
						<input type="radio" checked="checked" name="livraison_poids_type" value="<?php echo $row['ID']; ?>" ><?php echo $row['NOM'];?><br/>
						<?php } ?>
					</td>
					
					<td width="100px">
						<input type="text" size="6" name="livraison_poids_price">&euro;
					</td>
					<td  width="150px">
						<input type="submit" value="Ajouter" >	
					</td>
				</tr>
				<tr > <td colspan="6" style="background:#666666; height: 1px"></td></tr>
				
			</table>
			</form>
			<?php  foreach($this->livraisonpoids as $row) { ?>
			<form action="<?php  echo $this->baseUrl; ?>/backoffice/product/editlivraisonpoids" method="post">
				
			<table cellpadding="0" cellspacing="10" border="0" > 
				<tr>
					<td>
						<input type="text" size="6" name="livraison_poids_from" value="<?php echo $this->escape($row['FROM']);?>">Kg
					</td>
					<td> - > </td>
					<td>
						<input type="text" size="6" name="livraison_poids_to" value="<?php echo $this->escape($row['TO']);?>">Kg
					</td>
					<td>
						<?php  foreach($this->livraisontypes as $rowType) { ?>
						<input type="radio" <?php if ($rowType['ID'] == $row['TYPE']) { echo 'checked="checked"';} ?>  name="livraison_poids_type" value="<?php echo $rowType['ID']; ?>" ><?php echo $rowType['NOM'];?><br/>
						<?php } ?>
						<input type="hidden" value="<?php echo $row['ID']; ?>" name="livraison_poids_id">
					</td>
					<td>
						<input type="text" size="6" name="livraison_poids_price" value="<?php echo $this->escape($row['PRICE']);?>">&euro;
					</td>
					<td>
						<input type="submit" value="Modifier" >		
						<a class="button" href="<?php echo $this->baseUrl; ?>/backoffice/product/dellivraisonpoids/id/<?php echo $row['ID']; ?>" onClick="return msgOkCancelDelete();">Supprimer</a>
					
					</td>
				</tr>
			</table>
			</form>
			<?php } ?>
		</td>
	</tr>
</table>modules/backoffice/views/scripts/product/livraisoncat.phtml000060400000002254150710367660020352 0ustar00<form action="<?php  echo $this->baseUrl; ?>/backoffice/product/livraisoncat" method="post">
<table cellpadding="0" cellspacing="7" border="0">
<tr>
	<td align="center" colspan="5">
		<span class="errorText"><?php echo $this -> messageError; ?></span>
		<span class="successText"><?php echo $this -> messageSuccess; ?></span>
	</td>
</tr>
<tr>
	<td align="left" colspan="11">
		<input type="submit" value="Modifier">
	</td>
</tr>
<?php 
$show = array();
foreach($this->listallcategories as $row) : ?>
<tr>
	<?php for ($level=0 ; $level<11; $level++) { ?>
	<td >
		<?php 
		if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
		?>
		<input size="4" type="text" name="livraison_poids_<?php echo $row['ID'.$level]; ?>">
		<input type="hidden" name="livraison_poids_id[]" value="<?php echo $row['ID'.$level]; ?>">
		<?php } ?>
	</td>
	<td >
		<?php 
		if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
		?>
			
			<?php echo $this->escape($row['NOM'.$level]); 
			$show['NOM'.$level] = $row['NOM'.$level];
		}
		?>
	</td>
	<?php } ?>
</tr>
<?php endforeach; ?>
</table>
</form>
modules/backoffice/views/scripts/product/ajaxaccessoirelist.phtml000060400000002157150710367660021536 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?> 
<?php 
$index = 0;
foreach ($this->listAccessoires as $accesoire) { 
$index++; ?> 
<div class="col-md-3 text-center no-space-top">
	<div class="col-md-12 text-center">
		<ul class="gallerybox">
		  	<li>
				<?php echo $accesoire['NOM']; ?>
				<figure>
					<img alt="<?php echo $accesoire['DESIGNATION']; ?>"
							title="<?php echo $accesoire['DESIGNATION']; ?>"
							src="<?php echo $this->baseUrl.'/'.$accesoire['URL']; ?>" />
				</figure>
			</li>
		</ul>
	</div>
	<div class="btn-group">
		<a class="btn btn-danger" href="javascript:;" onclick="delProductAccessoire(<?php echo $this->currentProduct; ?>, <?php echo $accesoire['IDACCESSOIRE']; ?>)">
			<i class="glyphicon glyphicon-resize-full"></i>&nbsp;D�lier
		</a>
		<a class="btn btn-success" target="_blank" href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $accesoire['ID']."#tabs-items"; ?>">
			<i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier
		</a>
	</div>
</div>
<?php if ($index >= 4) {
	$index =0;
?>
	<div class="col-md-12 no-space"></div>
	<?php 
	}
} ?>modules/backoffice/views/scripts/product/ajaxannexelist.phtml000060400000002421150710367660020666 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?> 
<?php 
$index = 0;
foreach ($this->listAnnexes as $product) { 
if ($this->currentProduct != $product['ID']) { 
$index++;
	?> 
<div class="col-md-3 text-center no-space-top">
	<div class="col-md-12 text-center">
		<ul class="gallerybox">
		  	<li>
					<?php echo $product['NOM']; ?>
				<figure>
					<img alt="<?php if ($product['isSHOWBREND'] == 0) {echo strtoupper($product['BREND']." - ");} echo $product['NOM']; ?>"
							title="<?php if ($product['isSHOWBREND'] == 0) {echo strtoupper($product['BREND'].' - ');} echo $product['NOM']; ?>"
							src="<?php echo $this->baseUrl.'/'.$product['URL']; ?>" />
				</figure>
			</li>
		</ul>
	</div>
	<div class="btn-group">
		<a class="btn btn-danger" href="javascript:;" onclick="delProductAnnexe(<?php echo $this->currentProduct; ?>, <?php echo $product['ID']; ?>)">
			<i class="glyphicon glyphicon-resize-full"></i>&nbsp;D�lier
		</a>
		<a class="btn btn-success" target="_blank" href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $product['ID']."#tabs-items"; ?>">
			<i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier
		</a>
	</div>
</div>
<?php } 
	if ($index >= 4) {
	$index =0;
?>
	<div class="col-md-12 no-space"></div>
	<?php 
	}
} ?>modules/backoffice/views/scripts/product/list.phtml000060400000007566150710367660016642 0ustar00 <div class="table-box">
	<form method="POST" action="/backoffice/product/list">
	<table class="table">
		<thead>
			<tr>
				<th class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td class="col-md-12">
					<div class="col-md-7">
						<select class="form-control" name="categorySearch" >
						<?php 
						$show = array();
						foreach($this->listallcategories as $row) { 
						 	for ($level=0 ; $level<11; $level++) { 
								if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
								?>
									<option value="<?php echo $this->escape($row['ID'.$level]); ?>" <?php if ($row['ID'.$level] == $this->searchCategory) { echo 'selected="selected"';}?>>
										<?php 
						 				for ($i=0 ; $i<$level; $i++) { 
											echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
										}
										echo $this->escape($row['NOM'.$level]); ?>
									
									</option>
									<?php 
									$show['NOM'.$level] = $row['NOM'.$level];
								}
							 } 
						} ?>
						</select>
					</div>
					<div class="col-md-2">
						<div class="custom-radio-checkbox">
							<input tabindex="1" type="checkbox" class="bluecheckradios" id="isActive" name="isActive" <?php if ($this->searchCategoryActive == "0") { echo 'checked="checked"';}?>>
							<label for="isActive">Statut : Actif</label>
						</div> 
					</div>
					<div class="col-md-1 col-md-offset-1">
						<button type="submit" name="search"  class="btn btn-primary">
						  <span class="glyphicon glyphicon-search"></span> Rechercher
						</button>				
					</div>
					<div class="col-md-12"></div>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<div class="table-box">
<?php 
$listPics = $this->listproductpicture; 
?>
<table class="display table" id="productTable" width="100%">
	<thead>
		<tr>
			<th></th>
			<th>Nom</th>
			<th>Description</th>
			<th class="center">Prix</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	
		<?php foreach($this->listproducts as $row)  { ?>
		<tr>
			<td>
				<ul class="gallerybox">
                	<li>
						<figure>
							<a href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $this->escape($row['ID']);?>" ><img src="<?php if (isset($listPics[$row['ID']])) { echo '/'.$listPics[$row['ID']]; } else {echo '/items/product/default/default.png'; } ?>"></a>
						</figure>
					</li>
				</ul>
			</td>
			<td>
				<?php echo $row['NOM'];?>
			</td>
			<td>	
				<?php echo $row['DESCRIPTIONSHORT'];?>
				<?php if ($this->escape($row['isPROMO']) == 0) { ?> <br/><br/>En promo<?php } ?>
			</td>
			<td>
				<?php echo $this->escape($row['PRIX']); ?>&nbsp;&#8364;
			</td>
			<td>
				<div class="btn-group">
	             	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $this->escape($row['ID']);?>" ><span class="glyphicon glyphicon-edit"></span> Modifier</a>
					<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/product/del/id/<?php echo $this->escape($row['ID']); ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>			
	$(document).ready(function() {
		initDataTable('productTable', [[ 1, "asc" ]], [
		                    		                { "orderable": false, "targets": 0, "width": "150px"  },
		                    		                { "orderable": false, "targets": -1, "width": "270px" },
		                    		                { "orderable": true, "targets": 1, "type": "html"},
		                    		                { "orderable": true, "targets": 2, "type": "html"},
		                    		                { "orderable": true, "targets": 3}
		                    		              ]); 	    
	});
</script>
</div>modules/backoffice/views/scripts/product/ajaxaccessoireproductlist.phtml000060400000005047150710367660023140 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?> 
<div style="float: right; width: 850px;"> 
<?php 
 
foreach ($this->listProducts as $product) {
	$isAcc = false; 
	$color = "#CC0000";
	foreach ($this->listAccessoires as $productAccessoire) {
		if ($productAccessoire['ID'] == $product['ID']) {
			$color = "green";
			$isAcc = true;
			break;
		}
	}
if ($this->currentProduct != $product['ID']) { ?> 
<div class="productBoxOpt"> 
	<div class="productBoxCell"  style="border: 1px solid <?php echo $color; ?>;">
		<div class="productBoxCellTitle" style="background-color: <?php echo $color;?>;">
			<span class="link1" style="color: white; ">
				<?php if ($isAcc == true) { ?>
					<a href="javascript:;" onclick="delProductAccessoire(<?php echo $this->currentProduct; ?>, <?php echo $product['ID']; ?>)"><?php echo $product['NOM']; ?> </a>
				<?php } else { ?>
					<a href="javascript:;" onclick="addProductAccessoire(<?php echo $this->currentProduct; ?>, <?php echo $product['ID']; ?>)"><?php echo $product['NOM']; ?> </a>
				<?php } ?>
			</span> 
		</div>
		<div class="productBoxCellImg">
			<div class="productBoxCellImgOpt">
				<img alt="<?php if ($product['isSHOWBREND'] == 0) {echo strtoupper($product['BREND']." - ");} echo $product['NOM']; ?>"
				title="<?php if ($product['isSHOWBREND'] == 0) {echo strtoupper($product['BREND'].' - ');} echo $product['NOM']; ?>"
				src="<?php echo $this->baseUrl.'/'.$product['URL']; ?>" />
			</div>
		</div>
		<div class="productBoxCellDesc">
			<div style="clear: both;height: 50px" class='text4'>
				<?php echo $product['DESCSHORT']; ?>
			</div>
			<div style="clear: both;height: 30px;">
				<div style="float: left;">
					<span class='text6'><?php if ($product['isSHOWBREND'] == 0) {echo strtoupper($product['BREND']);} ?></span><br />
					<span class='text5'><?php echo $product['NBREFERENCE'].' r�f�rences'; ?></span><br />
				</div>
				<div style="float: left;">
					<?php if ($product['isPROMO'] == 0) { ?>
					<span class="productPromoImg">
						<img alt="" src="<?php echo $this->baseUrl; ?>/business/image/admin/promo.png" />
					</span>
					<?php } ?>
				</div>
				
			</div>
			<div style="clear: both;">
			<?php if ($product['isDEVISPRODUCT'] == 1) { ?>
			<span class='text6'>� partir de : </span><br />
			<span class='text7'><?php echo number_format($product['PRIX'], 2, ',', ' ').' '; ?><span class="text8">&#8364;</span></span>
			<?php } else { ?>
			<span class="text6" style="color: <?php echo $color; ?>;">Sur devis</span>
			<?php } ?>
			</div> 
		</div>
	</div>  
</div>
<?php } } ?>
</div>modules/backoffice/views/scripts/product/edit.phtml000060400000157405150710367660016612 0ustar00
<?php 
	$categoryListStringSelected = "";
	$categoryListString = "";
	
	$categoryDUP1ListStringSelected = ""; 
	$categoryDUP2ListStringSelected = ""; 
	$categoryDUP3ListStringSelected = ""; 
	
	$show = array();
	foreach($this->listallcategories as $row) { 
	 	for ($level=0 ; $level<11; $level++) { 
			if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
			 	 
				$currentID = $row['ID'.$level];
				$currentLABEL = $row['NOM'.$level];
				
				$dataResult = computeSelectOption($currentID, $this->populateForm['IDCATEGORY'],$currentLABEL , $level);
				$categoryListStringSelected .= $dataResult['selected'];
				$categoryListString .= $dataResult['unselected'];
				
				$idCategoryDup1 = "";
				if (isset($this->populateForm['IDCATEGORY_DUP1'])){
					$idCategoryDup1 = $this->populateForm['IDCATEGORY_DUP1'];
				}				
				$dataResultDUP1 = computeSelectOption($currentID, $idCategoryDup1 ,$currentLABEL , $level);
							
				$idCategoryDup2 = "";
				if (isset($this->populateForm['IDCATEGORY_DUP2'])){
					$idCategoryDup2 = $this->populateForm['IDCATEGORY_DUP2'];
				}				
				$dataResultDUP2 = computeSelectOption($currentID, $idCategoryDup2,$currentLABEL , $level);
					
				$idCategoryDup3 = "";
				if (isset($this->populateForm['IDCATEGORY_DUP3'])){
					$idCategoryDup3 = $this->populateForm['IDCATEGORY_DUP3'];
				}	
				$dataResultDUP3 = computeSelectOption($currentID, $idCategoryDup3,$currentLABEL , $level);
				
				$categoryDUP1ListStringSelected .= $dataResultDUP1['selected'];
				$categoryDUP2ListStringSelected .= $dataResultDUP2['selected'];
				$categoryDUP3ListStringSelected .= $dataResultDUP3['selected'];
				
				$show['NOM'.$level] = $row['NOM'.$level];
			}
		 } 
	} 
	
	function computeSelectOption($id, $idtotest, $label, $level) {
				$categoryListStringSelected = "";
				$categoryListString = "";
				$categoryListStringSelected .= '<option value="'; 
				$categoryListStringSelected .= (int)$id;
				$categoryListStringSelected .= '"'; 
				
				$categoryListString .= '<option value="'; 
				$categoryListString .= (int)$id;
				$categoryListString .= '"'; 
				
				if ($id == $idtotest) { 
					$categoryListStringSelected .= ' selected="selected"';
				}
				$categoryListString .= '>';
				$categoryListStringSelected .= '>';
				 
 				for ($i=0 ; $i<$level; $i++) { 
					$categoryListString .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
					$categoryListStringSelected .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
				}
				$categoryListStringSelected .= $label; 
				$categoryListStringSelected .= '</option>'; 
				$categoryListString .= $label; 
				$categoryListString .= '</option>';
				return array('selected' => $categoryListStringSelected, 'unselected' => $categoryListString);
	}
	?>
	
<div class="table-box">	
	<div class="col-md-8 text-left">
    
		<a class="<?php if ($this->isProductOutOfStock) { echo 'btn btn-warning';} elseif (!$this->isProcuctEnable) { echo 'btn btn-danger';} else { echo 'btn btn-info'; } ?>" target="_blank" href="<?php echo $this->baseUrl; ?>/<?php echo Utils_Tool::getFormattedUrlProduct($this->populateForm['NAVNOM_URLPARENTS'], $this->populateForm['NAVNOM'], $this->populateForm['ID']); ?>">
			<i class="glyphicon glyphicon-eye-open"></i>&nbsp;<?php echo $this->populateForm['NOM']; ?>
		</a>
    <b>
    <?php if ($this->isProductOutOfStock) { 
        echo "Le produit est �puis�";
    } elseif (!$this->isProcuctEnable) { 
        echo "Le produit est d�sactiv�";
    }  ?>
    </b>
	</div>
	<div class="col-md-4 text-right">
		<button class="btn btn-danger btn-modal text-right" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/product/del/id/<?php echo $this->populateForm['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
	</div>
	<div class="col-md-12 no-space-side">
		<div class="tabs-section ">
			<ul class="nav nav-tabs" id="myTab">
				<li class="active"><a href="#product" data-toggle="tab">Produit</a></li>
				<li><a href="#items" data-toggle="tab">Items</a></li>
				<li><a href="#pricedeg" data-toggle="tab">Prix d�gressif</a></li>
				<li><a href="#referencement" data-toggle="tab">R�f�rencement</a></li>
				<li><a href="#accessoire" data-toggle="tab">Accessoires</a></li>
				<li><a href="#images" data-toggle="tab">Images</a></li>
				<li><a href="#docs" data-toggle="tab">Documents</a></li>
				<li><a href="#cats" data-toggle="tab">Cat�gories</a></li>
			</ul>
			<div class="tab-content">
				<div class="tab-pane active" id="product">
					<section class="boxpadding">
						<form action="<?php  echo $this->baseUrl; ?>/backoffice/product/editproduct#product" method="post">
							<table class="table">
								<?php echo $this->render("alert_tr.phtml"); ?>
								<tr >
									<td class="col-md-4"><label for="active"><span <?php if ($this->populateForm['isACTIVE'] == 1) { echo 'class="errorText"';} ?>>Statut</span></label></td>
									<td class="col-md-8">
										<input type="radio" class="bluecheckradios" name="active" id="active0" value="0" <?php if ($this->populateForm['isACTIVE'] == 0) { echo 'checked="checked"';} ?>><label for="active0">&nbsp;Actif</label> 
										<input type="radio" class="bluecheckradios" name="active" id="active1" value="1" <?php if ($this->populateForm['isACTIVE'] == 1) { echo 'checked="checked"';} ?>><label for="active1">&nbsp;Inactif</label>
									</td>
								</tr>
								<tr>
									<td><i class="glyphicon glyphicon-asterisk"></i>&nbsp;<label for="nom">Nom</label></td>
									<td ><input type="text" class="form-control"  size="60" name="nom" id="nom" value="<?php echo $this->populateForm['NOM'];?>"></td>
								</tr> 
								<tr>
									<td ><i class="glyphicon glyphicon-asterisk"></i>&nbsp;<label for="descshort">Description courte</label></td>
									<td class="desc-panel-detail-short"><textarea class="form-control"  rows="2" cols="50" name="descshort" id="descshort"><?php echo $this->populateForm['DESCRIPTIONSHORT'];?></textarea></td>
								</tr>
								<tr>
									<td><i class="glyphicon glyphicon-asterisk"></i>&nbsp;<label for="descshort">Description longue</label></td>
									<td class="desc-panel-detail"><textarea class="form-control"  rows="10" cols="40" name="desclong" id="desclong"><?php echo $this->populateForm['DESCRIPTIONLONG'];?></textarea></td>
								</tr>
								<tr>
									<td><label for="descshort">Description technique</label></td>
									<td class="desc-panel-detail"><textarea class="form-control" rows="10" cols="40" name="desctech" id="desctech"><?php echo $this->populateForm['DESCRIPTIONTECH'];?></textarea></td>
								</tr>
								<tr>
									<td><label for="descshort">Description norme</label></td>
									<td class="desc-panel-detail"><textarea class="form-control" rows="10" cols="40" name="descnorme" id="descnorme"><?php echo $this->populateForm['DESCRIPTIONNORME'];?></textarea></td>
								</tr>
								<tr>
									<td ><label for="prix">A partir de </label></td>
									<td>
										<div style="float: left;">
											<input type="checkbox" class="bluecheckradios" name="devisonproduct" id="devisonproduct" onchange="showOrHide('devisonproduct', 'productPriceLabel');" <?php if ($this->populateForm['isDEVIS'] == 0) { echo 'checked="checked"'; } ?>><label for="devisonproduct">sur devis</label>
										</div>
										<div style="float: left;margin-left: 30px" id="productPriceLabel">
											<input type="hidden" name="prix" id="prix" value="<?php echo $this->populateForm['PRIXLOWEST'];?>">
											
											<?php echo "Prix calcul� : ".$this->populateForm['PRIXLOWEST']; ?><b>&nbsp;&#8364;</b>
										</div>
									</td>
								</tr>
								<tr >
									<td><label for="datePromoProduct">Date de la Promotion (Promotion 3)</label></td>
									<td>
										<input type="text" class="form-control" readonly="readonly" name="datePromoProduct" id="datePromoProduct" value="<?php echo $this->populateForm['DATEPROMO']; ?>" maxlength="10" />
										<input type="hidden"  name="sd" id="datePromoProductField" value="<?php echo $this->populateForm['DATEPROMO']; ?>" maxlength="10" />
									
									</td>
								</tr>
								<tr >
									<td><label for="idcategory">Cat�gorie</label></td>
									<td>
									
										<select class="form-control"  name="idcategory" id="idcategory">
											<?php  echo $categoryListStringSelected;?>
										</select>
									</td>
								</tr>
								<tr>
									<td><label for="stock">Disponibilit�</label></td>
									<td>
										<select class="form-control" name="stock" id="stock">
											<option value="1" <?php if ($this->populateForm['STOCK'] == 1) { echo 'selected="selected"';} ?> >Disponible</option>
											<option value="2" <?php if ($this->populateForm['STOCK'] == 2) { echo 'selected="selected"';} ?> >Disponible sous 8 jours</option>
											<option value="3" <?php if ($this->populateForm['STOCK'] == 3) { echo 'selected="selected"';} ?> >Nous contacter</option>
											<option value="4" <?php if ($this->populateForm['STOCK'] == 4) { echo 'selected="selected"';} ?> >�puis�</option>
										</select>
									</td>
								</tr>
								<tr >
									<td><label for="idbrend">Marque</label></td>
									<td>
										<select class="form-control" name="idbrend" id="idbrend">
											<option value="0">Aucun</option>
											<?php foreach($this->listbrend as $row) { 
												?>
											<option value="<?php echo $this->escape($row['ID']); ?>" <?php if ($row['ID'] == $this->populateForm['IDBREND']) { echo 'selected="selected"';}?> >
												<?php echo $this->escape($row['BREND']); ?>
											</option>
											<?php } ?>
										</select>
										<div class="col-md-12">
											<div class="col-md-3 no-space-top">Afficher la marque ?</div>
											<div class="col-md-9 no-space-top">
												<input type="radio" class="bluecheckradios" value="0" name="showbrend" id="showbrend0" <?php if ($this->populateForm['isSHOWBREND'] == 0) { echo 'checked="checked"';} ?>><label for="showbrend0">&nbsp;Oui</label>
												<input type="radio" class="bluecheckradios" value="1" name="showbrend" id="showbrend1" <?php if ($this->populateForm['isSHOWBREND'] == 1) { echo 'checked="checked"';} ?>><label for="showbrend1">&nbsp;Non</label>
											</div>
										</div>	
									</td>
								</tr>
                <tr>
                  <td>
                    <label for="boostedhome">Mise en avant</label>
                  </td>
                  <td>
                    <input type="text" class="form-control" name="boostedhome" value="<?php echo $this->populateForm['BOOSTED_HOME'];?>" placeholder="Affichage sur la page d'accueil (0 = Annulation)" />
                  </td>
                </tr>
                <tr>
                  <td>
                    <label for="boostedhome">Meilleure vente</label>
                  </td>
                  <td>
                    <input type="text" class="form-control" name="boostedbestseller" value="<?php echo $this->populateForm['BOOSTED_BESTSELLER'];?>" placeholder="Score de meilleure vente" />
                  </td>
                </tr>
								<tr>
									<td colspan="2" class="text-center">
										<input type="hidden" name="id" id="id" value="<?php echo $this->populateForm['ID'];?>" />
										<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
									</td>
								</tr>
							</table>
						</form> 
					</section>
				</div>
				<div class="tab-pane" id="items">
					<section class="boxpadding">
						<table class="table">
							<?php echo $this->render("alert_tr.phtml"); ?>
								<tr >
									<td><h5>Caract�ristiques</h5><i>D�tail de produits</i></td>
									<td>
										<form action="<?php echo $this->baseUrl; ?>/backoffice/product/addproductoption#items" method="post">
										<div class="col-md-12  no-space-top">
											<div class="col-md-8 no-space-top">
												<select name="idoption" id="idoption" class="form-control">
													<?php foreach($this->listoption as $row) { ?>
													<option value="<?php echo $this->escape($row['ID']); ?>" > 
														<?php echo $this->escape($row['NOM']); ?>
													</option>
													<?php } ?>
												</select>
											</div>
											<div class="col-md-4  no-space-top">	
												<input type="hidden" name="id" value="<?php echo $this->populateForm['ID'];?>" />	
												<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
											</div>	
										</div>
										</form>	
									</td>
								</tr>
								<tr >
									<td colspan="2" >
										<?php foreach($this->listproductoption as $row) { ?>
											<label><?php echo $this->escape($row['NOMOPTION']); ?></label>
											<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/product/delproductoption/idopt/<?php echo $this->escape($row['IDOPTION']);?>/id/<?php echo $this->populateForm['ID'];?>#items" ><span class="glyphicon glyphicon-resize-full"></span> D�lier</button>
										<?php } ?>
									</td>
								</tr>
								<tr >
									<td><h5>Caract�ristique</h5><i>S�lectionnable</i></td> 
									<td>
										<?php if ($this->populateForm['ONSELECT_IDOPTION'] > 0) {  
												$optionList = $this->populateForm['ONSELECT_OPTION'];?>
												<div class="col-md-12  no-space-top">
													<div class="col-md-4  no-space-top"><?php echo $optionList->name; ?></div>
													<div class="col-md-4  no-space-top"><?php echo $optionList->valuesHTML(); ?></div>
													<div class="col-md-4  no-space-top"><button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/product/delcaracteristiquelist/id/<?php echo $this->populateForm['ID'];?>#items" ><span class="glyphicon glyphicon-resize-full"></span> D�lier</button></div>
												</div>
												
										<?php  } else { 
										 if (isset($this->listChild) && !empty($this->listChild)) { ?>
											<form action="<?php echo $this->baseUrl; ?>/backoffice/product/addcaracteristiquelist#items" method="post">											
												<div class="col-md-12  no-space-top">
													<div class="col-md-8  no-space-top">
														<select name="idoption" class="form-control">
															<?php foreach($this->optionsbylist as $optionList) { ?>
																<option value="<?php echo $optionList->id;?>">
																	<?php 
																	$values = explode("::", $optionList->valuesString);
																	$result = "";
																	foreach ($values as $value) {
																		if (empty($result))  {
																			$result .= $value;
																		} else {
																			$result .= ", ".$value;
																		}
																	}
																	echo $optionList->name." (".$result.")";
																	?>
																</option>
															<?php } ?>
														</select>
													</div>
													<div class="col-md-4  no-space-top">
														<input type="hidden" name="id" value="<?php echo $this->populateForm['ID'];?>" />
														<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
													</div>
												</div>
											</form>
										<?php }} ?>
									</td>
								</tr>
								<tr >
									<td colspan="2" >
										<form action="<?php echo $this->baseUrl; ?>/backoffice/product/addchilds#items" method="post">
											<div class="col-md-12 no-space">
												<h5>Ajouter des r�f�rences</h5>
												<input type="hidden" name="id" value="<?php echo $this->populateForm['ID'];?>" />
												<div class="invoice-box">													
													<?php for ($index = 0; $index < 2; $index++) { ?>
													<input type="hidden" value="0" name="<?php echo $index."etatstock";  ?>" />
													<input type="hidden" value="0" name="<?php echo $index."poids";  ?>" />
													<input type="hidden" value="0" name="<?php echo $index."imagePromo";  ?>" />
													<div class="col-md-6 no-space-top">
														<div class="invoice-content">
															<div class="col-md-12 no-space">
																<table class="table ">
					                                                <tbody>
						                                                <tr>
						                                                    <td class="meta-head"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;D�signation</td>
						                                                    <td><input class="form-control" type="text"  name="<?php echo $index."designation";  ?>" id="<?php echo $index."designation";  ?>"  value="<?php if (isset($this->populateChild[$index.'DESIGNATION'])) { echo $this->populateChild[$index.'DESIGNATION']; } ?>" /></td>
						                                                </tr>
						                                            </tbody>
					                                            </table>
															</div>
															<div class="col-md-6 no-space">
																<table class="table table-left no-border-top">
					                                                <tbody>
						                                                <tr>
						                                                    <td class="meta-head"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;R�f�rence</td>
						                                                    <td><input class="form-control" type="text" name="<?php echo $index."reference";  ?>" id="<?php echo $index."reference";  ?>" value="<?php if (isset($this->populateChild[$index.'REFERENCE'])) { echo $this->populateChild[$index.'REFERENCE']; }?>" /></td>
						                                                </tr>
						                                                <tr>
						                                                    <td class="meta-head"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Prix</td>
						                                                    <td><input class="form-control"  type="text" name="<?php echo $index."prixNormal";  ?>" id="<?php echo $index."prixNormal";  ?>" value="<?php if (isset($this->populateChild[$index.'PRIX'])) { echo $this->populateChild[$index.'PRIX']; } ?>" /></td>
						                                                </tr>
						                                                <tr>
						                                                    <td class="meta-head">Sur devis ?</td>
						                                                    <td class="text-center"><input type="checkbox" class="bluecheckradios" name="<?php echo $index."devisprice";  ?>" id="<?php echo $index."devisprice";  ?>" /></td>
						                                                </tr>
						                                                <tr>
						                                                    <td class="meta-head">Quantit� minimum</td>
						                                                    <td><input class="form-control" type="text"  name="<?php echo $index."quantiteMin";  ?>" id = "<?php echo $index."quantiteMin";  ?>" value="<?php if (isset($this->populateChild[$index.'QUANTITYMIN'])) { echo $this->populateChild[$index.'QUANTITYMIN']; } ?>" /></td>
						                                                </tr>
						                                            </tbody>
					                                            </table>
															</div>
															<div class="col-md-6 no-space">
					                                            <table class="table table-right no-border-top">
					                                                <tbody>
																		<?php 
																		$listOption = array();
																		$i = 0;
																		foreach($this->listproductoption as $row) { 
																			$listOption[$i] = $this->escape($row['IDOPTION']);
																			$i++; ?>
						                                                <tr>
						                                                    <td class="meta-head"><?php echo $this->escape($row['NOMOPTION']); ?></td>
						                                                    <td><input class="form-control" type="text" name="<?php echo $index."option".$row['IDOPTION']; ?>" id="<?php echo $index."option".$row['IDOPTION']; ?>" value=""></td>
						                                                </tr>
																		<?php } ?>																		
						                                            </tbody>
					                                            </table>
				                                            </div>
				                                        </div>
			                                        </div>
			                                        <?php } ?>
	                                        	</div>
											</div>
											<div class="col-md-12 text-center col-margin-15">
												<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
												<input type="hidden" name="listOption"  value='<?php echo serialize($listOption);?>'>
											</div>
										</form>	
									</td>
								</tr>
								<?php if (isset($this->listChild) && !empty($this->listChild)) { ?>
								<tr>
									<td colspan="2">
										<form action="<?php echo $this->baseUrl; ?>/backoffice/product/editchilds#items" method="post">
											<input type="hidden" name="id" value="<?php echo $this->populateForm['ID'];?>" />
											<div class="col-md-12 no-space">
												<h5>Modifier les r�f�rences</h5>
												<div class="invoice-box">
													<?php  $index = 0;
													foreach($this->listChild as $row) { ?>	
													<input type="hidden" name="<?php echo $index."idchild"; ?>" id="<?php echo $index."idchild"; ?>" value="<?php echo $this->escape($row['ID']);?>">														
													<input type="hidden" value="0" name="<?php echo $index."etatstock";  ?>" />												
													<input type="hidden" value="0" name="<?php echo $index."poids";  ?>" />
																			
													<div class="col-md-6 no-space-top">
														<div class="invoice-content">
															<div class="col-md-12 no-space">
																<table class="table ">
					                          <tbody>
						                          <tr>
						                              <td class="meta-head"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;D�signation</td>
						                              <td><input class="form-control" type="text"  name="<?php echo $index."designation";  ?>"  value="<?php echo $row['DESIGNATION'];  ?>" /></td>
						                          </tr>
						                      </tbody>
					                      </table>
															</div>
															<div class="col-md-6 no-space">
																<table class="table table-left no-border-top">
					                            <tbody>
						                            <tr>
						                                <td class="meta-head"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;R�f�rence</td>
						                                <td><input class="form-control" type="text" name="<?php echo $index."reference"; ?>" id="<?php echo $index."reference"; ?>" value="<?php echo $this->escape($row['REFERENCE']);?>"></td>
						                            </tr>
						                            <tr>
						                                <td class="meta-head"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Prix</td>
						                                <td><input class="form-control" type="text" name="<?php echo $index."prixNormal"; ?>" id="<?php echo $index."prixNormal"; ?>" value="<?php echo $this->escape($row['PRIX']);?>"></td>
						                            </tr>
						                            <tr>
						                                <td class="meta-head">Sur devis ?</td>
						                                <td class="text-center"><input type="checkbox" class="bluecheckradios" name="<?php echo $index."devisprice"; ?>" id="<?php echo $index."devisprice"; ?>" <?php if ($row['isDEVIS'] == 0) { echo 'checked="checked"'; } ?> ></td>
						                            </tr>
						                            <tr>
						                                <td class="meta-head">Quantit� minimum</td>
						                                <td><input class="form-control" type="text" size="5" name="<?php echo $index."quantiteMin"; ?>" id = "<?php echo $index."quantiteMin"; ?>" value="<?php echo $this->escape($row['QUANTITYMIN']);?>" ></td>
						                            </tr>
						                            <tr>
						                                <td class="meta-head">Franco annulation</td>
						                                <td class="text-center"><input type="checkbox" class="bluecheckradios" name="<?php echo $index."francodenied"; ?>" id="<?php echo $index."francodenied"; ?>" <?php if ($row['isFRANCODENIED'] == 0) { echo 'checked="checked"'; } ?> ></td>
						                            </tr>
						                            <tr>
						                                <td class="meta-head">Image de la promo</td>
						                                <td><input class="form-control" type="text" size="2" name="<?php echo $index."imagePromo"; ?>" id = "<?php echo $index."imagePromo"; ?>" value="<?php echo $this->escape($row['IMAGEPROMO']);?>" ></td>
						                            </tr>
						                            <tr>
						                                <td class="meta-head">Points de fid�lit�</td>
						                                <td><input class="form-control" type="text" size="2" name="<?php echo $index."pointFidelite"; ?>" id = "<?php echo $index."pointFidelite"; ?>" value="<?php echo $this->escape($row['POINTFIDELITE']);?>" ></td>
						                            </tr>
						                        </tbody>
					                        </table>
															</div>
															<div class="col-md-6 no-space">
					                      <table class="table table-right no-border-top">
					                          <tbody>
									                    <?php  foreach($this->listproductoption as $option) {  ?>
						                          <tr>
						                              <td class="meta-head"><?php echo $this->escape($option['NOMOPTION']); ?></td>
						                              <td><input class="form-control" type="text" size="10" name="<?php echo $index."option".$option['IDOPTION']; ?>" id="<?php echo $index."option".$option['IDOPTION']; ?>" value="<?php if (isset($row['OPTION_VALUE_'.$option['IDOPTION']])) {echo $this->escape($row['OPTION_VALUE_'.$option['IDOPTION']]); } ?>"></td>
						                          </tr>
									                    <?php } ?>																		
						                      </tbody>
					                      </table>
				                      </div>
				                      <div class="col-md-12 text-center col-margin-15" >
				                        <button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/product/delchild/idchild/<?php echo $this->escape($row['ID']); ?>/id/<?php echo $this->populateForm['ID'];?>#items" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
							                  <button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
		                          </div>
				                    </div>
			                    </div>
			                    <?php $index++; } ?>
		                        <div class="col-md-12 text-center" >
					                    <input type="hidden" name="listOption"  value='<?php echo serialize($listOption);?>'>
					                    <input type="hidden" name="nbRows"  value='<?php echo $index;?>'>
				                    </div>
	                      </div>
											</div>
										</form>
									</td>
								</tr>
								<?php } ?>
							</table> 
					</section>
				</div>
				<div class="tab-pane" id="pricedeg">
					<section class="boxpadding">
						<table class="table">
							<?php echo $this->render("alert_tr.phtml"); ?>
							<tr class="nostriped"> 
								<td >
									<form action="<?php echo $this->baseUrl; ?>/backoffice/product/editchildqteprixactivation#pricedeg" method="post">
										<div class="col-md-2 no-space-top"><label for="activateItemPrix">Activer les prix d�gr�ssif</label></div>
										<div class="col-md-1 no-space-top"><input type="checkbox" class="bluecheckradios" id="activateItemPrix"  name="activateItemPrix" <?php if ($this->populateForm['isQTEPRIXACTIVE']) { echo 'checked="checked"';} ?> ></div>
										<div class="col-md-8 no-space-top text-left">
											<input type="hidden" name="id" value="<?php echo $this->populateForm['ID'];?>" />
											<button class="btn btn-success" type="submit" ><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
										</div>
									</form>
								</td>
							</tr> 
							<?php if (isset($this->listChild) && !empty($this->listChild)) { ?>
							<tr class="nostriped">
								<td  >
									<form action="<?php echo $this->baseUrl; ?>/backoffice/product/addchildqteprix#pricedeg" method="post">
									<table class="table">
										<thead align="center">
											<tr>
												<th>R�f�rence</th> 
												<th >Quantit� minimum</th> 
												<th >Quantit� maximum</th>  
												<th class="text-center" >Prix</th>  
												<th>&nbsp;</th>  
											</tr>
										</thead>
										<tbody>
											<tr align="center">
												<td>
													<select class="form-control" name="item_id">
														<?php foreach($this->listChild as $row) { ?>
														<option value="<?php echo $row['ID']; ?>"><?php echo $this->escape($row['REFERENCE']);?></option>
														<?php } ?>
													</select>
												</td> 
												<td><input type="text" class="form-control" placeholder="Quantit� minimum d'achat" name="min" value="" size="5"/></td> 
												<td>
													<div class="col-md-9 no-space-top"><input type="text" class="form-control" placeholder="Quantit� maximum d'achat" name="max" value="" size="5"/></div>
													<div class="col-md-3 no-space-top"><input type="checkbox" class="bluecheckradios" name="maxend" id="maxend" /><label for="maxend">&nbsp;Et plus</label></div>
												</td>
												<td><input type="text" class="form-control" placeholder="Prix d'achat" name="prix" value="" size="5"/></td> 
												<td>
													<input type="hidden" name="id" value="<?php echo $this->populateForm['ID'];?>" />
													<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
												</td> 
											</tr>
										</tbody>
									</table>
									</form>
								</td>
							</tr>
							<?php }
							if (isset($this->productChildQte) && !empty($this->productChildQte)) { ?>
							<tr class="nostriped">
								<td >
									<table class="table">
										<thead align="center">
											<tr>
												<th>R�f�rence</th> 
												<th>D�signation</th> 
												<th>De</th> 
												<th>�</th> 
												<th class="text-center">Prix</th> 
												<th>&nbsp;</th>
											</tr>
										</thead>
										<tbody>
											<?php foreach($this->productChildQte as $row) { ?>
											<tr > 
												<td >
													<span <?php if (!$row['isQTEPRIXACTIVE']) { ?>style="color:red;"<?php } ?>><?php echo $this->escape($row['REFERENCE']);?></span>
												</td>
												<td >
													<span><?php echo $row['DESIGNATION'];?></span> 
												</td> 
												<td >
													<span><?php echo $this->escape($row['MIN']);?></span> 
												</td> 
												<td  >
													<span>
													<?php if ($row['MAX'] <> 999999999) { echo $this->escape($row['MAX']); }
													else {echo "Et Plus"; } ?></span> 
												</td> 
												<td >
													<span><?php echo $this->escape($row['PRIX']);?></span> 
												</td> 
												<td  > 
													<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/product/delchildqteprix/id/<?php echo $this->populateForm['ID'];?>/item_id/<?php echo $row['ID'];?>#pricedeg" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
												</td>
											</tr>
											<?php } ?> 
										</tbody>
									</table> 
								</td>
							</tr>
							<?php } ?>
						</table> 
					</section>
				</div>
				<div class="tab-pane" id="referencement">
					<section class="boxpadding">
						<table class="table">
							<?php echo $this->render("alert_tr.phtml"); ?>
							<tr >
								<td><h5>M�ta donn�es</h5></td>
							</tr>
							<tr>
								<td >
									<form action="<?php  echo $this->baseUrl; ?>/backoffice/product/editnavheader#referencement" method="post">
										<input type="hidden" size="60" name="id" value="<?php echo $this->populateForm['ID'];?>">
										<table class="table">
											<tr class="nostriped">
												<td ><label for="navtitre">Titre</label>	<br/>
                          <i><?php if (!empty($this->populateForm['NAVTITRE'])) { echo  strlen($this->populateForm['NAVTITRE'])." caract�res"; } ?></i>
												</td>
												<td >
													<input placeholder="Titre de la page" class="form-control" size="70" type="text" name="navtitre" id="navtitre" value="<?php echo $this->populateForm['NAVTITRE'];?>"> 
												</td>
											</tr> 
											<tr class="nostriped">
												<td ><label for="navdesc">Description</label><br/>	
                          <i><?php if (!empty($this->populateForm['NAVDESC'])) { echo  strlen($this->populateForm['NAVDESC'])." caract�res"; } ?></i>
												</td>
												<td >
													<input placeholder="Description de la page" class="form-control" type="text" name="navdesc" id="navdesc" value="<?php echo $this->populateForm['NAVDESC'];?>" >
												</td>
											</tr> 
											<tr class="nostriped">
												<td ><label for="keywords_list">Mots cl�s</label></td>
												<td ><input placeholder="Vos mots cl�s" class="form-control"  size="40" type="text" name="keywords_list" id="keywords_list" value="<?php echo $this->populateForm['KEYWORDS'];?>">
												<i>mot cl� 1, mot cl� 2, ...</i></td>
											</tr> 								
											<tr class="nostriped">
												<td colspan="2" class="text-center" >
													<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
												</td>
											</tr> 
										</table>
									</form>
								</td>
							</tr>  
							<tr >
								<td><h5>Nom de navigation</h5></td>
							</tr>
							<tr> 
								<td >
									<form action="<?php  echo $this->baseUrl; ?>/backoffice/product/editcustomnavnom#referencement" method="post">
									<input type="hidden" size="60" name="id" value="<?php echo $this->populateForm['ID'];?>">
														
									<table  class="table">
										<tr class="nostriped">
											<td ><label for="navnom">Nom actuel</label></td> 
											<td >
											<input type="hidden" name="nom" value="<?php echo $this->populateForm['NOM'];?>">
											<input placeholder="Nom de navigation alternatif" class="form-control"  type="text" size="70" name="navnom" id="navnom" value="<?php echo $this->populateForm['NAVNOM'];?>"></td>
										</tr> 
										<tr class="nostriped">
											<td ><label for="navnom_custom1">Nom</label></td>
											<td >
												<input placeholder="Nom de navigation alternatif" class="form-control"  size="70" type="text" value="<?php echo $this->populateForm['CUSTOM_NAVNOM1'];?>" name="navnom_custom1" id="navnom_custom1" />
											</td>
										</tr> 
										<tr class="nostriped">
											<td ><label for="navnom_custom2">Nom</label></td>
											<td >
												<input placeholder="Nom de navigation alternatif" class="form-control"  size="70" type="text" value="<?php echo $this->populateForm['CUSTOM_NAVNOM2'];?>" name="navnom_custom2" id="navnom_custom2" />
											</td>
										</tr>
										<tr class="nostriped">
											<td ><label for="navnom_custom3">Nom</label></td>
											<td >
												<input placeholder="Nom de navigation alternatif" class="form-control"  size="70" type="text" value="<?php echo $this->populateForm['CUSTOM_NAVNOM3'];?>" name="navnom_custom3" id="navnom_custom3" />
											</td>
										</tr>
										<tr class="nostriped">
											<td colspan="2" class="text-center">
												<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
											</td>
										</tr> 
									</table>
									</form>
								</td> 
							</tr>
							<tr >
								<td><h5>Sitemap</h5></td>
							</tr>
							<tr class="nostriped">
								<td>  
									<pre>
									 <?php echo $this->siteMapShow; ?> 
									 </pre>
								</td>
							</tr>  
						</table>
					</section>
				</div>
				<div class="tab-pane" id="accessoire">
					<section class="boxpadding">
						<table class="table">
							<?php echo $this->render("alert_tr.phtml"); ?>							
							<tr >
								<td><h5>Accessoires</h5></td>
							</tr>
							<tr >
								<td>
									<form action="<?php  echo $this->baseUrl; ?>/backoffice/product/addproductaccessoire#accessoire" method="post">
									<table class="table">
										<tr  class="nostriped">
											<td class="col-md-2"><label for="reference_acc">R�f�rence</label></td>
											<td class="col-md-8">
												<input placeholder="Ajouter une r�f�rence de produit en tant qu'accessoire" class="form-control" type="text" name="reference_acc" id="reference_acc">
											</td>
											<td class="col-md-2">
												<input type="hidden" size="60" name="id" value="<?php echo $this->populateForm['ID'];?>">
												<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
											</td>
										</tr>
										<tr  class="nostriped">
											<td class="col-md-2"><label >Accessoires li�s</label></td>
											<td class="col-md-10" colspan="2"> 
												<div id="idproduitacc_success" > 
												<?php echo $this->render("/product/ajaxaccessoirelist.phtml"); ?>
												</div>
											</td>
										</tr> 
									</table>	
									</form>
								</td>
							</tr>  
														
							<tr >
								<td><h5>Les clients ayant consult� cet article ont �galement regard� ces produits</h5></td>
							</tr>
							<tr>
								<td>
									<table class="table">
										<tr  class="nostriped">
											<td class="col-md-2"><label for="idcategoryann">Cat�gorie</label></td>
											<td class="col-md-10">
												<select class="form-control" name="idcategoryann" id="idcategoryann">
													<option value="none">S�lectionner</option>
													<?php  echo $categoryListString; ?>
												</select>  
											</td>
										</tr> 
										<tr  class="nostriped">
											<td><label for="idproduitann">Produits</label></td>
											<td > 
												<div id="idcategoryann_success" ></div>	
												<div id="idcategoryann_loading" class="ajax-loading" style="display: none;">Chargement</div>
											
											</td>
										</tr> 
										<tr  class="nostriped">
											<td><label >Produits li�s</label></td>
											<td > 
												<div id="idproduitann_success" > 
												<?php echo $this->render("/product/ajaxannexelist.phtml"); ?>
												</div>
											</td>
										</tr> 
									</table>
								</td>
							</tr>
						</table>
					</section>
				</div>
				<div class="tab-pane" id="images">
					<section class="boxpadding">
						<table class="table">
							<?php echo $this->render("alert_tr.phtml"); ?>							
							<tr >
								<td ><h5>Images</h5></td>
							</tr>
							<tr >
								<td>
									<form method="post" enctype="multipart/form-data" action="<?php echo $this->baseUrl; ?>/backoffice/product/uploadpics#images">
									<table class="table">
										<tr  class="nostriped">
											<td class="col-md-2"><label for="reference_acc">Ajouter une image</label></td>
											<td class="col-md-8">
												<input type="file" name="file" class="file" size="50"/><br/>
												<i>Extensions : jpeg, jpg, gif, png</i>
											</td>
											<td class="col-md-2">
												<input type="hidden" name="idcat" id="idcat" value="<?php echo $this->populateForm['IDCATEGORY'];?>" />
												<input type="hidden" name="id" value="<?php echo $this->populateForm['ID'];?>" />
												<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
											</td>
										</tr>
									</table>
									</form>
								</td>
							</tr> 
							<tr>
								<td><h5>Images du produit</h5></td>
							</tr>
							<tr >
								<td >
									<form action="<?php echo $this->baseUrl; ?>/backoffice/product/editpicture#images" method="post">
										<input type="hidden" name="id" value="<?php echo $this->populateForm['ID'];?>" />
										<table class="table">
											<tr  class="nostriped">
												<td class="text-center no-space-top"><button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button></td>
											</tr>
											<tr  class="nostriped">
												<td >
													
													<?php $i=0; 
													foreach($this->listPicture as $row) { ?>
													
													<div class="col-md-3 text-center no-space-top">
														<div class="col-md-12 text-center">
															<ul class="gallerybox">
															  	<li>
																	<figure>
																		<img src="<?php echo $this->baseUrl.'/'.$row['URL']; ?>" />
																	</figure>
																</li>
															</ul>
														</div>
														<div class="col-md-12 text-center">
																<input placeholder="Position d'affichage" class="form-control" type="text" size="2" name="position<?php echo $i; ?>" value="<?php echo $row['POSITION']; ?>">
																<input placeholder="Information sur l'image" class="form-control" type="text" size="15" name="string1_<?php echo $i; ?>" value="<?php echo $row['STRING1']; ?>">
																<input placeholder="Information sur l'image" class="form-control" type="text" size="15" name="string2_<?php echo $i; ?>" value="<?php echo $row['STRING2']; ?>">
																<input type="hidden" name="id<?php echo $i; ?>" value="<?php echo $row['ID']; ?>" >
														</div>
														<div class="btn-group">
															<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/product/delpicture/pic/<?php echo $row['ID']; ?>/id/<?php echo $this->populateForm['ID'];?>#images" ><i class="glyphicon glyphicon-resize-full"></i>&nbsp;D�lier</button>
														</div>
													</div>
													<?php $i++; } ?>
													<input type="hidden" name="nbrImg" value="<?php echo $i; ?>" >
												</td>
											</tr>
										</table>
									</form>
								</td>
							</tr>
							<tr ><td ><h5>Images de la cat�gorie</h5></td></tr>
							<tr  class="nostriped">
								<td>
									<?php 
										$files = glob("items/product/".$this->populateForm['IDCATEGORY']."/*.*");
										for ($i=0; $i <sizeof($files); $i++) {				
									?>
									
									
									<div class="col-md-3 text-center no-space-top">
										<form action="<?php echo $this->baseUrl; ?>/backoffice/product/setpicture#images" method="post" >
										<div class="col-md-12 text-center">
											<ul class="gallerybox ">
											  	<li>
													<figure>
														<img src="<?php echo $this->baseUrl.'/'.$files[$i]; ?>" />
													</figure>
												</li>
											</ul>
										</div>
										<div class="col-md-12">
											<button class="btn btn-primary" type="submit" name="edit"><i class="glyphicon glyphicon-resize-small"></i>&nbsp;Lier</button>
											<input type="hidden" name="picture" value="<?php echo $files[$i]; ?>" >
											<input type="hidden" name="id" value="<?php echo $this->populateForm['ID'];?>" />
										</div>
										</form>	
									</div>
									<?php } ?>
								</td>
							</tr>
							<tr ><td ><h5>Image par d�faut</h5></td></tr>
							<tr >
								<td >
									<?php 
										$files = glob("items/product/default/*.*");
										for ($i=0; $i <sizeof($files); $i++) {				
									?>
									<div class="col-md-3 text-center no-space-top">
										<form action="<?php echo $this->baseUrl; ?>/backoffice/product/setpicture#images" method="post">
										<div class="col-md-12 text-center">
											<ul class="gallerybox">
											  	<li>
													<figure>
														<img src="<?php echo $this->baseUrl.'/'.$files[$i]; ?>" />
													</figure>
												</li>
											</ul>
										</div>
										<div class="col-md-12">
											<button class="btn btn-primary" type="submit" name="edit"><i class="glyphicon glyphicon-resize-small"></i>&nbsp;Lier</button>
											<input type="hidden" name="picture" value="<?php echo $files[$i]; ?>" >
											<input type="hidden" name="id" value="<?php echo $this->populateForm['ID'];?>" />
										</div>
										</form>	
									</div>
									<?php } ?>
								</td>
							</tr>
						</table>
					</section>
				</div>
				<div class="tab-pane" id="docs">
					<section class="boxpadding">
						<table class="table">
							<?php echo $this->render("alert_tr.phtml"); ?>		
							<tr >
								<td ><h5>Document associ� au produit</h5></td>
							</tr>
							<tr >
								<td >
									<?php 
									if (isset($this->populateForm['DOCNAME']) && !empty($this->populateForm['DOCNAME'])) {
									?>
									
										<table class="table">
											<tr >
												<td >
													<a class="btn btn-primary" href="<?php echo $this->baseUrl.'/'.$this->populateForm['DOCURL']; ?>" target="_blank"><i class="glyphicon glyphicon-eye-open"></i>&nbsp;Voir le document : <?php echo $this->populateForm['DOCNAME']; ?></a>
												</td>
												<td>
													<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/product/deldoc/id/<?php echo $this->populateForm['ID']; ?>#docs" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
												</td>
											</tr>		
										</table>
									<?php } else { ?>
										<form method="post" enctype="multipart/form-data" action="<?php echo $this->baseUrl; ?>/backoffice/product/editdoc#docs">
										<table class="table">
											<thead>
												<tr>
													<th>Nom du lien</th>
													<th>Document</th>
													<th></th>
												</tr>
											</thead>
											<tbody>
												<tr >
													<td>
														<input type="hidden" name="docid_product" id="docid_product" value="<?php echo $this->populateForm['ID']; ?>">
														<input class="form-control" type="text" name="docname_product" id="docname_product" value="<?php echo $this->populateForm['DOCNAME'];?>">
													</td>
													<td>
														<input type="file" name="file_doc" class="file" size="50"/>
														<input type="hidden" name="id" value="<?php echo $this->populateForm['ID'];?>" />
													</td>
													<td>
														<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
													</td>
												</tr>	
											</tbody>
										</table>
										</form>
									<?php  }  ?>	
								</td>
							</tr>
							
							<tr >
								<td ><h5>Document associ� aux r�f�rences</h5></td>
							</tr>
							<?php if (isset($this->listChild) && !empty($this->listChild)) { ?>
							<tr >
								<td >
									<table class="table">
										<thead>	
											<tr align="center">
												<th>R�f�rence</th>
												<th>Document</th>
											</tr>
										</thead>
										<tbody>
										<?php  foreach($this->listChild as $row) { ?>
										<tr  class="nostriped">
											<td >
												<span><?php echo $this->escape($row['REFERENCE']);?></span>
											</td>
											
											<td >
												<form method="post" enctype="multipart/form-data" action="<?php echo $this->baseUrl; ?>/backoffice/product/editftfds#docs">
													<input type="hidden" name="idchild_ftfds" id="idchild_ftfds" value="<?php echo $this->escape($row['ID']);?>">
													<input type="hidden" name="id" value="<?php echo $this->populateForm['ID'];?>" />
													
													<?php 
													$isFTFDS = false;
													foreach($this->listFTFDS as $rowFTFDS) {  
														if ($rowFTFDS['ID_CHILD'] == $row['ID']) {
													?>
														<div class="col-md-8">
															<a class="btn btn-primary" href="<?php echo $this->baseUrl.'/'.$rowFTFDS['URL']; ?>" target="_blank"><i class="glyphicon glyphicon-eye-open"></i>&nbsp;Voir le document</a>
														</div>
														<div class="col-md-4">
															<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/product/delftfds/idchild/<?php echo $this->escape($rowFTFDS['ID_CHILD']); ?>/id/<?php echo $this->populateForm['ID'];?>#docs" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
														</div>
													<?php 
														$isFTFDS = true;
														}
													}
													if ($isFTFDS == false) { ?>
														<div class="col-md-8">
															<input type="file" name="file_ftfds" class="file" size="50"/>
														</div>
														<div class="col-md-4">
															<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
														</div>
													<?php  }  ?>
												</form>
											</td>
										</tr>	
										<?php } ?>	
										</tbody>
									</table>
								</td>
							</tr>
							<?php } ?>
						</table>
					</section>
				</div>
				<div class="tab-pane" id="cats">
					<section class="boxpadding">
						<form action="<?php  echo $this->baseUrl; ?>/backoffice/product/editproductcategories#cats" method="post">
							<input type="hidden" name="id" id="id" value="<?php echo $this->populateForm['ID'];?>" />
							<table class="table">
								<?php echo $this->render("alert_tr.phtml"); ?>		
								<tr>
									<td class="text-center">
										<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
									</td>
								</tr>
								<tr >
									<td  ><h5>Dupliquer le produit dans les cat�gories</h5></td>
								</tr>
								<tr >
									<td>
										<table class="table">
											<tr class="nostriped">
												<td><label for="idcategory_duplicat1">Cat�gorie</label></td>
												<td> 
													<select class="form-control" name="idcategory_duplicat1" id="idcategory_duplicat1">
														<option value="0">Aucun</option>
														<?php  echo $categoryDUP1ListStringSelected;?>
													</select>
												</td>
											</tr>
											<tr class="nostriped">
												<td><label for="idcategory_duplicat2">Cat�gorie</label></td>
												<td> 
													<select class="form-control" name="idcategory_duplicat2" id="idcategory_duplicat2">
														<option value="0">Aucun</option>
														<?php  echo $categoryDUP2ListStringSelected;?>
													</select>
												</td>
											</tr> 
											<tr class="nostriped">
												<td><label for="idcategory_duplicat3">Cat�gorie</label></td>
												<td> 
													<select class="form-control" name="idcategory_duplicat3" id="idcategory_duplicat3">
														<option value="0" >Aucun</option>
														<?php  echo $categoryDUP3ListStringSelected;?>
													</select>
												</td>
											</tr> 
										</table>
									</td>
								</tr> 
								<tr >
									<td colspan="2" ><h5>Dupliquer le produit dans les cat�gories subsidiaires</h5></td>
								</tr>
								<tr >
									<td>
										<table class="table">
											<tr class="nostriped">
												<td><label for="idcategory_promosolde">Cat�gorie</label></td>
												<td> 
													<select style="height:200px" class="form-control" id="idcategory_promosolde" name="idcategory_promosolde[]" multiple="multiple" >
														<option value="0">Aucun</option>
														<?php 
														$show = array();
														$productCategories = $this->productCategories;
														foreach($this->listallcategories2 as $row) { 
														 	for ($level=0 ; $level<11; $level++) { 
																if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
																?>
																	<option value="<?php echo $this->escape($row['ID'.$level]); ?>"  
																	<?php foreach ($productCategories as $currentCategory) {  
																		 if ($row['ID'.$level] == $currentCategory['ID']) { echo 'selected="selected"'; }
																		}?>  
																	>
																		<?php 
														 				for ($i=0 ; $i<$level; $i++) { 
																			echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
																		}
																		echo $this->escape($row['NOM'.$level]); ?>
																	
																	</option>
																	<?php 
																	$show['NOM'.$level] = $row['NOM'.$level];
																}
															 } 
														} ?>
													</select>
												</td>
											</tr>
										</table>
									</td>
								</tr> 
							</table>
						</form>
					</section>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript"> 
$(function(){ 
	initEditor('#descshort');
	initEditor('#desclong');
	initEditor('#desctech');
	initEditor('#descnorme');
	initTabs(window.location.hash);
	$("#idcategoryann_success").html("");
	$("#idcategoryann").bind({
		change: function() {  
			if ($(this).val() != 'none' ) {
					$("#idcategoryann_loading").css({'display' : 'block'});
					$("#idcategoryann_success").html(""); 
					 $.ajax( {
					type : "POST", 
					async : true,
					url : '/backoffice/product/ajaxproductannexelistbycat', 
					data : "idcategory="+$(this).val()+"&idproduct="+$("#id").val(),
					success : function(data) {  
						$("#idcategoryann_loading").css({'display' : 'none'});
						$("#idcategoryann_success").html(data);
					}}); 
			}  
	   } 
	});
	
	var str = "<?php echo $this->populateForm['DATEPROMO']; ?>";
	var res = str.split("-");
	$("#datePromoProduct").datepicker({ 
		altFormat: 'yy-mm-dd', 
		altField: "#datePromoProductField",
		dateFormat: 'DD, d MM, yy'
	}).datepicker("setDate", new Date(res[0],res[1] - 1,res[2]));
});

function refreshListProduct(type) {
	if (type == 'ann') {  
		 $.ajax( {
				type : "POST", 
				async : true,
				url : '/backoffice/product/ajaxproductannexelistbycat', 
				data : "idcategory="+$("#idcategoryann option:selected").val()+"&idproduct="+$("#id").val(),
				success : function(data) {   
					$("#idcategoryann_success").html(data);
				}});
	} 
} 

function delProductAccessoire(idProduct, idAccessoire) {
	$.ajax( {
		type : "POST", 
		async : true,
		url : '/backoffice/product/ajaxdelproductaccessoire',  
		data : "idproduct="+idProduct+"&idAccessoire="+idAccessoire,
		success : function(data) {  
			$("#idproduitacc_success").html(data);   
		}});  
} 

function addProductAnnexe(idProduct, idAnnexe) {
	$.ajax( {
		type : "POST", 
		async : true,
		url : '/backoffice/product/ajaxaddproductannexe', 
		data : "idproduct="+idProduct+"&idannexe="+idAnnexe,
		success : function(data) {  
			$("#idproduitann_success").html(data);  
			refreshListProduct('ann');
		}});  
} 
function delProductAnnexe(idProduct, idAnnexe) {
	$.ajax( {
		type : "POST", 
		async : true,
		url : '/backoffice/product/ajaxdelproductannexe', 
		data : "idproduct="+idProduct+"&idannexe="+idAnnexe,
		success : function(data) {  
			$("#idproduitann_success").html(data);   
			refreshListProduct('ann');
		}});  
} 
</script>modules/backoffice/views/scripts/product/keywordsengine.phtml000060400000004642150710367660020714 0ustar00 <div class="table-box">
	<form method="POST" action="<?php  echo $this->baseUrl; ?>/backoffice/product/addkeywordsengine">
	<table class="table">
		<thead>
			<tr>
				<th class="col-md-4" colspan="2"><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr class="nostriped">
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Mot cl�</td>
				<td class="col-md-8"><input type="text" class="form-control" size="60" name="keyword" id="keyword" placeholder="Ajouter un mot cl� pour la barre de recherche"></td>
			</tr>
			<tr class="nostriped">
				<td colspan="2" class="text-center">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
					<a class="button" style="display:none" href="<?php  echo $this->baseUrl; ?>/backoffice/product/keywordsenginereset">Reset</a>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>

<div class="table-box">
<?php echo $this->paginationControl($this->paginator, 'All', 'pagination.phtml'); ?>
<table class="display table" id="keywordTable" width="100%">
	<thead>
		<tr>
			<th>Mot cl�</th>
		</tr>
	</thead>
	<tbody>
		<?php foreach($this->paginator as $row)  { ?>
		<tr >
			<td>
				<form action="<?php  echo $this->baseUrl; ?>/backoffice/product/editkeywordsengine" method="post">
				<div class="col-md-8 no-space-top">
					<input class="form-control" type="text" size="40" name="keyword" value="<?php echo $this->escape($row['KEYWORD']);?>">
				</div>
				<div class="col-md-4 no-space-top">
					<input type="hidden" value="<?php echo $row['ID']; ?>" name="keyword_id">
					<input type="hidden" value="<?php echo  $this->paginator->getCurrentPageNumber(); ?>" name="page">
					<div class="btn-group">
						<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
						<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/product/delkeywordsengine/id/<?php echo $row['ID']; ?>/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
					</div>
				</div>
				</form>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<?php echo $this->paginationControl($this->paginator, 'All', 'pagination.phtml'); ?>
</div>modules/backoffice/views/scripts/product/ajaxannexeproductlist.phtml000060400000002726150710367660022277 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?> 
<?php 
 
foreach ($this->listProducts as $product) {
	$isAcc = false; 
	$color = "#CC0000";
	foreach ($this->listAnnexes as $productAnnexe) {
		if ($productAnnexe['ID'] == $product['ID']) {
			$color = "green";
			$isAcc = true;
			break;
		}
	}
if ($this->currentProduct != $product['ID']) { ?> 

<div class="col-md-3 text-center no-space-top">
	<div class="col-md-12 text-center">
		<ul class="gallerybox">
		  	<li>
				<?php echo $product['NOM']; ?>
				<figure>
					<img alt="<?php echo $product['NOM']; ?>"
							title="<?php echo $product['NOM']; ?>"
							src="<?php echo $this->baseUrl.'/'.$product['URL']; ?>" />
				</figure>
			</li>
		</ul>
	</div>
	<div class="btn-group">
		<?php if ($isAcc == true) { ?>
			<a href="javascript:;" class="btn btn-danger" onclick="delProductAnnexe(<?php echo $this->currentProduct; ?>, <?php echo $product['ID']; ?>)"><i class="glyphicon glyphicon-resize-full"></i>&nbsp;D�lier</a>
		<?php } else { ?>
			<a href="javascript:;" class="btn btn-primary" onclick="addProductAnnexe(<?php echo $this->currentProduct; ?>, <?php echo $product['ID']; ?>)"><i class="glyphicon glyphicon-resize-small"></i>&nbsp;Lier</a>
		<?php } ?>
		<a class="btn btn-success" target="_blank" href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $product['ID']."#tabs-items"; ?>">
			<i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier
		</a>
	</div>
</div>
<?php } } ?>modules/backoffice/views/scripts/product/optionprofil.phtml000060400000003247150710367660020403 0ustar00<table cellpadding="0" cellspacing="5" border="0"width="800px">

<tr>
	<td align="left" colspan="3">
		<form method="POST" action="<?php echo $this->baseUrl; ?>/backoffice/product/optionprofil">
		<table cellpadding="0" cellspacing="0" width="500px">
			<tr>
				<td colspan="2">Ajouter un profil d'options</td>
			</tr>
			<tr>
				<td>Nom : </td>
				<td><input type="text" name="nom" id="nom" value="" size="40" ></td>
			</tr>
			<tr>
				<td>Options : </td>
				<td>
					<?php  if ($this->listoption) { ?>
					<select multiple="multiple" name="profilOptions[]" id="profilOptions">
					<?php foreach($this->listoption as $row) : ?>
					<option value="<?php echo $this->escape($row['ID']);?>" ><?php echo $this->escape($row['NOM']);?></option>
					<?php endforeach; ?>
					</select>
					<?php } ?>
				</td>
			</tr>
			<tr>
				<td colspan="2"><input type="submit" name="add" value="Ajouter" /></td>
			</tr>
		</table>
		</form>
	</td>
</tr>			
<tr>
	<td colspan="3" style="background:#666666;height:1px;"></td>
</tr>
<tr>
	<td align="left" colspan="3">
		<span class="errorText"><?php echo $this -> messageError; ?></span>
		<span class="successText"><?php echo $this -> messageSuccess; ?></span>
	</td>
</tr>
<?php  if ($this->listprofils) { ?>
	<tr>
		<td valign="top" width="510px">
			<table cellpadding="0" cellspacing="0" width="500px">
				<?php foreach($this->listprofils as $row) { ?>
				<tr>
					<td><?php echo $this->escape($row['NOM']);?></td>
					<td >
						<a href="<?php echo $this->baseUrl; ?>/backoffice/product/optionprofildel/id/<?php echo $this->escape($row['ID']);?>">Supprimer</a>
					</td>
				</tr>
				<?php } ?>
			</table>
		</td>
	</tr>
<?php } ?>
</table>
modules/backoffice/views/scripts/product/add.phtml000060400000006624150710367660016411 0ustar00 <div class="table-box">
	<form method="POST" action="/backoffice/product/add">
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Nom</td>
				<td class="col-md-8"><input type="text" class="form-control" size="60" name="nom" id="nom" value="<?php echo $this->populateForm['NOM'];?>"></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Description courte</td>
				<td class="col-md-8"><textarea rows="2" class="form-control" cols="50" name="descshort" id="descshort"><?php echo $this->populateForm['DESCRIPTIONSHORT'];?></textarea></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Description longue</td>
				<td class="col-md-8"><textarea rows="10"  class="form-control" cols="50" name="desclong" id="desclong"><?php echo $this->populateForm['DESCRIPTIONLONG'];?></textarea></td>
			</tr>
			<tr>
				<td class="col-md-4">Statut</td>
				<td class="col-md-8">
					<input type="radio" class="bluecheckradios" name="active" id="active1" value="0" <?php if ($this->populateForm['isACTIVE'] == 0) { echo 'checked="checked"';} ?>>&nbsp;<label for="active1">Actif</label> 
					<input type="radio" class="bluecheckradios" name="active" id="active2" value="1" <?php if ($this->populateForm['isACTIVE'] == 1) { echo 'checked="checked"';} ?>>&nbsp;<label for="active2">Inactif</label>
				</td>
			</tr>
			<tr>
				<td class="col-md-4">Cat�gorie</td>
				<td class="col-md-8">
					<select name="idcategory" id="idcategory" class="form-control">
						<?php 
						$show = array();
						foreach($this->listallcategories as $row) { 
						 	for ($level=0 ; $level<11; $level++) { 
								if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
								?>
									<option value="<?php echo $this->escape($row['ID'.$level]); ?>" <?php if ($row['ID'.$level] == $this->populateForm['IDCATEGORY']) { echo 'selected="selected"';}?> >
										<?php 
						 				for ($i=0 ; $i<$level; $i++) { 
											echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
										}
										echo $row['NOM'.$level]; ?>
									</option>
									<?php 
									$show['NOM'.$level] = $row['NOM'.$level];
								}
							 } 
						} ?>
					</select>
				</td>
			</tr>
			<tr>
				<td class="col-md-4">Marque</td>
				<td class="col-md-8">
					<select name="idbrend" id="idbrend" class="form-control">
						<option value="0">Aucun</option>
						<?php foreach($this->listbrend as $row) { ?>
						<option value="<?php echo $this->escape($row['ID']); ?>" <?php if ($row['ID'] == $this->populateForm['IDBREND']) { echo 'selected="selected"';}?> >
							<?php echo $this->escape($row['BREND']); ?>
						</option>
						<?php } ?>
					</select>
				</td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
					<input type="hidden" name="prix" id="prix" value="0.00">
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
$(function(){
	initEditor('#descshort');
	initEditor('#desclong');
});
</script>modules/backoffice/views/scripts/pagination.phtml000060400000001452150710367660016324 0ustar00<?php if ($this->pageCount) { ?>
<ul class="pagination">
	<li style="display:none" class="paginate_button previous <?php if (!isset($this->previous)) { ?>disabled<?php } ?>"> <a href="<?php if (!isset($this->previous)) { echo "#"; } else {  echo $this->url(array('page' => $this->previous));  }?>">Pr�c�dent</a></li>
	<?php foreach ($this->pagesInRange as $page) { ?>
	<li class="paginate_button <?php if ($page == $this->current) {?>active<?php }?>"><a href="<?php echo $this->url(array('page' => $page)); ?>"><?php echo $page; ?></a></li>
	<?php } ?>
	<li style="display:none" class="paginate_button next <?php if (!isset($this->next)) { ?>disabled<?php } ?>"><a href="<?php if (!isset($this->next)) { echo "#"; } else {  echo $this->url(array('page' => $this->next));  }?>">Suivant</a></li>
</ul>
<?php } ?>modules/backoffice/views/scripts/blogcomment/edit.phtml000060400000005147150710367660017433 0ustar00
<div class="table-box">
  <form method="POST" action="/backoffice/blogcomment/edit">
    <table class="table">
      <thead>
        <tr>
          <th class="col-md-4" >
            <?php echo $this->titlePage; ?>
          </th>
        </tr>
      </thead>
      <tbody>
        <?php echo $this->render("alert_tr.phtml"); ?>
			  <tr >
				  <td class="col-md-4">Publier</td>
				  <td class="col-md-8">
					  <input type="radio" value="<?php echo true; ?>" name="is_publish" id="is_publish1" class="bluecheckradios" <?php if ($this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish1">&nbsp;Oui</label>
					  <input type="radio" value="<?php echo false; ?>" name="is_publish" id="is_publish2" class="bluecheckradios" <?php if (!$this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish2">&nbsp;Non</label>
			    </td>
			  </tr>
        <tr >
          <td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Pseudo</td>
          <td class="col-md-8">
            <input type="text" class="form-control" placeholder="Pseudo" name="pseudo" size="40" id="pseudo" value="<?php echo $this->populateData['pseudo']; ?>"/>
          </td>
        </tr>
			  <tr >
				  <td class="col-md-4">Sujet</td>
				  <td class="col-md-8">
					  <select name="id_subject" id="id_subject" class="form-control">
						  <?php  
						  foreach($this->listSubjects as $row) {  
								  ?>
									  <option value="<?php echo $this->escape($row['id']); ?>" <?php if ($row['id'] == $this->populateData['id_subject']) { echo 'selected="selected"';}?>>
										  <?php  echo $row['category_name'].' > '.$row['title']; ?>
									  </option>
						 <?php   } ?>
					  </select> 
          </td>
			  </tr>
			  <tr >
				  <td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Contenu</td>
				  <td class="col-md-8"> 
						<textarea  name="message" cols="130" rows="20" id="annonceContent">
						<?php if (isset($this->populateData['message']) && !empty($this->populateData['message'])) { 
							 echo $this->populateData['message']; 
						} ?>
						</textarea>
          </td>
			  </tr> 
			<tr>
				<td colspan="2" class="text-center">
            <input type="hidden" value="<?php echo $this->populateData['id']; ?>" name="id" />
            <button type="submit" name="search"  class="btn btn-success">
              <span class="glyphicon glyphicon-plus"></span> Modifier
            </button>
				</td>
			</tr> 
    </tbody>
    </table>
  </form>
  
  <script>
    $(document).ready(function() { 
    initEditor('#annonceContent');
    });
  </script>
</div>modules/backoffice/views/scripts/blogcomment/search.phtml000060400000007363150710367660017755 0ustar00
<div class="table-box">
  <form method="POST" action="/backoffice/blogcomment/search">
    <table class="table">
      <thead>
        <tr>
          <th class="col-md-4" >
            <?php echo $this->titlePage; ?>
          </th>
        </tr>
      </thead>
      <tbody>
        <?php echo $this->render("alert_tr.phtml"); ?>
			  <tr >
				  <td class="col-md-4">Publi�</td>
				  <td class="col-md-8">
					  <input type="radio" value="<?php echo true; ?>" name="is_publish" id="is_publish1" class="bluecheckradios" <?php if ($this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish1">&nbsp;Oui</label>
					  <input type="radio" value="<?php echo false; ?>" name="is_publish" id="is_publish2" class="bluecheckradios" <?php if (!$this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish2">&nbsp;Non</label>
			    </td>
			  </tr>
			  <tr >
				  <td class="col-md-4">Ferm�</td>
				  <td class="col-md-8">
					  <input type="radio" value="<?php echo true; ?>" name="is_close" id="is_close1" class="bluecheckradios" <?php if ($this->populateData['is_close']) { echo 'checked="checked"';} ?>><label for="is_close1">&nbsp;Oui</label>
					  <input type="radio" value="<?php echo false; ?>" name="is_close" id="is_close2" class="bluecheckradios" <?php if (!$this->populateData['is_close']) { echo 'checked="checked"';} ?>><label for="is_close2">&nbsp;Non</label>
			    </td>
			  </tr>
			  <tr >
				  <td class="col-md-4">Contenu</td>
				  <td class="col-md-8"><input type="text" class="form-control" placeholder="Contenu � rechercher" name="message" size="40" id="title" value="<?php echo $this->populateData['message']; ?>"/></td>
			  </tr> 
			  <tr >
				  <td class="col-md-4">Sujet</td>
				  <td class="col-md-8">
					  <select name="id_subject" id="id_subject" class="form-control">
						  <?php  
						  foreach($this->listSubjects as $row) {  
								  ?>
									  <option value="<?php echo $this->escape($row['id']); ?>" <?php if ($row['id'] == $this->populateData['id_subject']) { echo 'selected="selected"';}?>>
										  <?php  echo $row['category_name'].' > '.$row['title']; ?>
									
									  </option>
						 <?php   } ?>
					  </select> 
          </td>
			  </tr>
			<tr>
				<td colspan="2" class="text-center">
            <button type="submit" name="search"  class="btn btn-primary">
              <span class="glyphicon glyphicon-search"></span> Rechercher
            </button>
				</td>
			</tr> 
    </tbody>
    </table>
  </form>
</div>
<?php 
$listSearchs = $this->listSearchs; 
if (isset($listSearchs)) { 
?>

<div class="clearfix"></div>
<div class="table-box">

  <table class="display table" id="searchTable" width="100%">
    <thead>
      <tr>
        <th>Pseudo</th>
        <th>Contenu</th>
        <th>Date</th>
        <th></th>
      </tr>
    </thead>
    <tbody>

      <?php foreach($listSearchs as $row)  { ?>
      <tr>
        <td>
          <?php echo $row['pseudo'];?>
        </td>
        <td>
          <?php echo $row['message'];?>
        </td>
        <td>
          <?php $date = new Zend_Date($row['date_updated'], Zend_Date::ISO_8601); 
            echo $date->toString('dd-MM-YYYY HH:mm:ss');
          ?>
        </td>
        <td>
          <div class="btn-group">
            <a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/blogcomment/edit/id/<?php echo $this->escape($row['id']);?>" target="_blank"><span class="glyphicon glyphicon-edit"></span> Modifier</a>
         </div>
        </td>
      </tr>
      <?php } ?>
    </tbody>
  </table>
  <script>
    $(document).ready(function() {
    initDataTable('searchTable', [[ 3, "desc" ]], [
    { "orderable": false, "targets": -1, "width": "150px" },
    ]);
    });
  </script>
</div>
<?php  } ?>modules/backoffice/views/scripts/blogcomment/add.phtml000060400000005017150710367660017232 0ustar00
<div class="table-box">
  <form method="POST" action="/backoffice/blogcomment/add">
    <table class="table">
      <thead>
        <tr>
          <th class="col-md-4" >
            <?php echo $this->titlePage; ?>
          </th>
        </tr>
      </thead>
      <tbody>
        <?php echo $this->render("alert_tr.phtml"); ?>
			  <tr >
				  <td class="col-md-4">Publier</td>
				  <td class="col-md-8">
					  <input type="radio" value="<?php echo true; ?>" name="is_publish" id="is_publish1" class="bluecheckradios" <?php if ($this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish1">&nbsp;Oui</label>
					  <input type="radio" value="<?php echo false; ?>" name="is_publish" id="is_publish2" class="bluecheckradios" <?php if (!$this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish2">&nbsp;Non</label>
			    </td>
			  </tr>
        <tr >
          <td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Pseudo</td>
          <td class="col-md-8">
            <input type="text" class="form-control" placeholder="Pseudo" name="pseudo" size="40" id="pseudo" value="<?php echo $this->populateData['pseudo']; ?>"/>
          </td>
        </tr>
        
			  <tr >
				  <td class="col-md-4">Sujet</td>
				  <td class="col-md-8">
					  <select name="id_subject" id="id_subject" class="form-control">
						  <?php  
						  foreach($this->listSubjects as $row) {  
								  ?>
									  <option value="<?php echo $this->escape($row['id']); ?>" <?php if ($row['id'] == $this->populateData['id_subject']) { echo 'selected="selected"';}?>>
										  <?php  echo $row['category_name'].' > '.$row['title']; ?>
									  </option>
						 <?php   } ?>
					  </select> 
          </td>
			  </tr>
			  <tr >
				  <td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Contenu</td>
				  <td class="col-md-8"> 
						<textarea  name="message" cols="130" rows="20" id="annonceContent">
						<?php if (isset($this->populateData['message']) && !empty($this->populateData['message'])) { 
							 echo $this->populateData['message']; 
						} ?>
						</textarea>
          </td>
			  </tr> 
			<tr>
				<td colspan="2" class="text-center">
            <button type="submit" name="search"  class="btn btn-success">
              <span class="glyphicon glyphicon-plus"></span> Ajouter
            </button>
				</td>
			</tr> 
    </tbody>
    </table>
  </form>
  
  <script>
    $(document).ready(function() { 
    initEditor('#annonceContent');
    });
  </script>
</div>modules/backoffice/views/scripts/annoncefront/list.phtml000060400000007106150710367660017642 0ustar00 <div class="table-box">
	<?php if ($this->populateFormAnnonceFront['NOM']) { ?>
	<form action="<?php echo $this->baseUrl; ?>/backoffice/annoncefront/edit" method="post" name="editAnnonceForm">
	<?php } else { ?>
	<form action="<?php echo $this->baseUrl; ?>/backoffice/annoncefront/add" method="post" name="addAnnonceForm">
	<?php } ?>
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Titre</td>
				<td class="col-md-8"><input type="text" name="nom" size="40" class="form-control"  placeholder="Titre de l'information" id="nom" value="<?php echo $this->populateFormAnnonceFront['NOM']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Statut</td>
				<td class="col-md-8">
					<input type="radio" value="0" name="isshow" id="isshow1" class="bluecheckradios" <?php if ($this->populateFormAnnonceFront['isSHOW'] == 0) { echo 'checked="checked"';} ?>><label for="isshow1">&nbsp;Actif</label>
					<input type="radio" value="1" name="isshow" id="isshow2" class="bluecheckradios" <?php if ($this->populateFormAnnonceFront['isSHOW'] == 1) { echo 'checked="checked"';} ?>><label for="isshow2">&nbsp;Inactif</label>
			
				</td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Contenu</td>
				<td class="col-md-8">
						<textarea  name="content" cols="130" rows="20" id="annonceContent" name="annonceContent">
						<?php if (isset($this->populateFormAnnonceFront['CONTENT']) && !empty($this->populateFormAnnonceFront['CONTENT'])) { 
							 echo $this->populateFormAnnonceFront['CONTENT']; 
						} ?>
						</textarea>
				</td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<?php if ($this->populateFormAnnonceFront['NOM']) { ?>
						<input type="hidden" name="id" value="<?php echo $this->populateFormAnnonceFront['ID'];?>">
						<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
					<?php } else { ?>
						<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
					<?php } ?>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
$(function(){
	initEditor('#annonceContent');
});
</script>

 <div class="table-box">
<table class="display table" id="annonceFrontTable" width="100%">
	<thead>
		<tr>
			<th>Titre</th>
			<th>Statut</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	
		<?php foreach($this->listannoncefront as $row)  { ?>
		<tr>
			<td><?php echo $row['NOM'];?></td>
			<td><?php if ($this->escape($row['isSHOW'])==0) {echo 'Actif';} else {echo 'Inactif';} ?></td>
			<td>
				<div class="btn-group">
	             	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/annoncefront/edit/id/<?php echo $row['ID']; ?>"><span class="glyphicon glyphicon-edit"></span> Modifier</a>
					<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/annoncefront/del/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>			
	$(document).ready(function() {
		initDataTable('annonceFrontTable', [[ 0, "asc" ]], [{ "orderable": false, "targets": -1, "width": "270px" }]); 	    
	});
</script>
</div>
modules/backoffice/views/scripts/alert_tr.phtml000060400000000244150710367660016005 0ustar00<?php if (!empty($this->messageError) || !empty($this->messageSuccess)) { ?>
<tr>
	<td colspan="2"><?php echo $this->render("alert.phtml"); ?></td>
</tr>
<?php } ?>modules/backoffice/views/scripts/annonceleft/list.phtml000060400000011276150710367660017447 0ustar00 <div class="table-box">
	<?php if ($this->populateFormAnnonceLeft['NOM']) { ?>
	<form action="<?php echo $this->baseUrl; ?>/backoffice/annonceleft/edit" method="post" name="editAnnonceForm" >
	<?php } else { ?>
	<form action="<?php echo $this->baseUrl; ?>/backoffice/annonceleft/add" method="post" name="addAnnonceForm" >
	<?php } ?>
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Titre</td>
				<td class="col-md-8"><input type="text" name="nom" size="40" class="form-control"  placeholder="Titre de la publicit�" id="nom" value="<?php echo $this->populateFormAnnonceLeft['NOM']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Statut</td>
				<td class="col-md-8">
					<input type="radio" value="0" name="isshow" id="isshow1" class="bluecheckradios" <?php if ($this->populateFormAnnonceLeft['isSHOW'] == 0) { echo 'checked="checked"';} ?>><label for="isshow1">&nbsp;Actif</label>
					<input type="radio" value="1" name="isshow" id="isshow2" class="bluecheckradios" <?php if ($this->populateFormAnnonceLeft['isSHOW'] == 1) { echo 'checked="checked"';} ?>><label for="isshow2">&nbsp;Inactif</label>
			
				</td>
			</tr>
			<tr >
				<td class="col-md-4">Localisation</td>
				<td class="col-md-8">
					<?php $tabController = explode(':',$this->populateFormAnnonceLeft['ID_CATS']);  ?>
					<select class="form-control" size="15" name="categories[]" id="categories" multiple="multiple">
						<option value="0" <?php if (in_array('0', $tabController)) {echo 'selected="selected"';} ?> >Toutes les cat�gories</option>
						<?php 
						$show = array();
						foreach($this->listallcategories as $row) { 
						 	for ($level=0 ; $level<11; $level++) { 
								if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
								?>
									<option value="<?php echo $this->escape($row['ID'.$level]); ?>" <?php if (in_array($row['ID'.$level], $tabController)) {echo 'selected="selected"';} ?>>
										<?php 
						 				for ($i=0 ; $i<$level; $i++) { 
											echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
										}
										echo $row['NOM'.$level]; ?>
									
									</option>
									<?php 
									$show['NOM'.$level] = $row['NOM'.$level];
								}
							 } 
						} ?>
					</select>
				</td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Contenu</td>
				<td class="col-md-8">
						<textarea  name="content" cols="130" rows="20" id="annonceContent" name="annonceContent">
						<?php if (isset($this->populateFormAnnonceLeft['CONTENT']) && !empty($this->populateFormAnnonceLeft['CONTENT'])) { 
							 echo $this->populateFormAnnonceLeft['CONTENT']; 
						} ?>
						</textarea>
				</td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<?php if ($this->populateFormAnnonceLeft['NOM']) { ?>
						<input type="hidden" name="id" value="<?php echo $this->populateFormAnnonceLeft['ID'];?>">
						<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
					<?php } else { ?>
						<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
					<?php } ?>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
$(function(){
	initEditor('#annonceContent');
});
</script>

 <div class="table-box">
<table class="display table" id="annonceLeftTable" width="100%">
	<thead>
		<tr>
			<th>Titre</th>
			<th>Statut</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	
		<?php foreach($this->listannonceleft as $row)  { ?>
		<tr>
			<td><?php echo $row['NOM'];?></td>
			<td><?php if ($this->escape($row['isSHOW'])==0) {echo 'Actif';} else {echo 'Inactif';} ?></td>
			<td>
				<div class="btn-group">
	             	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/annonceleft/edit/id/<?php echo $row['ID']; ?>"><span class="glyphicon glyphicon-edit"></span> Modifier</a>
					<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/annonceleft/del/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>			
	$(document).ready(function() {
		initDataTable('annonceLeftTable', [[ 0, "asc" ]], [{ "orderable": false, "targets": -1, "width": "270px" }]); 	    
	});
</script>
</div>
modules/backoffice/views/scripts/statistic/clickstatsproduct.phtml000060400000001252150710367660021745 0ustar00<?php 
function  checkColorSource($source) {
	$color = "black";
      if ($source == 'Redirection : Hello Pro') {
            $color = "blue";
      } 
      return $color;
}

?>

<table cellpadding="0" cellspacing="5" border="0" width="800px">
<tr class="linkHeader" align="center">
	<th width="500px">URL</th>
	<th width="200px">SOURCE</th>
	<th width="100px">CLICKS</th>
</tr>

<?php foreach($this->listClick as $row) { ?>
<tr style="color: <?php echo checkColorSource($row['SOURCE']); ?>">
	<td align="left" ><?php echo $row['URL']; ?></td>
	<td align="left" ><?php echo $row['SOURCE']; ?></td>
	<td align="center" ><?php echo $row['NbURL']; ?></td>
</tr>
<?php } ?>
</table>


modules/backoffice/views/scripts/statistic/logdefault.phtml000060400000006705150710367660020336 0ustar00<?php 
function  checkColorLog($level) {
	if ($level == "CRIT") {
		return "red";
	}
	if ($level == "ERR") {
		return "red";
	}
	if ($level == "INFO") {
		return "black";
	}
	if ($level == "WARN") {
		return "#cc9900";
	}
}

?> <div class="table-box">
<div class="col-md-12 header-single-line">
	<div class="col-md-5 header-single no-space-top"><?php echo $this->titlePage; ?></div>
	<div class="col-md-7 no-space-top"><?php echo $this->render("alert.phtml"); ?></div>
</div>
<div class="col-md-12 text-center">
	Afficher par 
	<div class="btn-group">
		<a class="btn btn-primary" href='<?php echo $this->baseUrl;?>/backoffice/statistic/logdefault/nb/100/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>' >100</a>
   		<a class="btn btn-primary" href='<?php echo $this->baseUrl;?>/backoffice/statistic/logdefault/nb/200/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>' >200</a>
   		<a class="btn btn-primary" href='<?php echo $this->baseUrl;?>/backoffice/statistic/logdefault/nb/300/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>' >300</a>
   		<a class="btn btn-primary" href='<?php echo $this->baseUrl;?>/backoffice/statistic/logdefault/nb/500/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>' >500</a>
   		<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl;?>/backoffice/statistic/logdefaultclean" ><span class="glyphicon glyphicon-trash"></span> Supprimer l'historique</button>
	</div>
</div>            
<?php echo $this->paginationControl($this->paginator, 'All', 'pagination.phtml'); ?>
<table class="display table" id="supplierTable" width="100%">
	<thead>
		<tr>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logdefault/col/DATE_LOG/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>">Date</a></th>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logdefault/col/LEVEL_NAME/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>">Type</a></th>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logdefault/col/CONTROLLER/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>">Controller</a></th>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logdefault/col/MESSAGE/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>">Message</a></th>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logdefault/col/IP/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>">IP</a></th>
		</tr> 	
	</thead>
	<tbody>
	
		<?php foreach($this->paginator as $row)  { ?>
		<tr style="color: <?php echo checkColorLog($row->LEVEL_NAME); ?>">
			<td><?php  
			$myDate = new Zend_Date(strtotime($row->DATE_LOG));
			$mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
			$moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
			echo $myDate->toString("dd").' '.$moisComplet[(int)$myDate->toString('MM')].' '.$myDate->toString("YYYY").' '.$myDate->toString("HH").":".$myDate->toString("mm").":".$myDate->toString("ss");
			?></td>
			<td><?php echo $row->LEVEL_NAME; ?></td>
			<td><?php echo $row->CONTROLLER; ?></td>
			<td ><?php echo $row->MESSAGE ; ?></td>
			<td ><?php echo $row->IP ; ?></td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<?php echo $this->paginationControl($this->paginator, 'All', 'pagination.phtml'); ?>
</div>

modules/backoffice/views/scripts/statistic/keymap.phtml000060400000013666150710367660017502 0ustar00<table cellpadding="0" cellspacing="7" border="0">

<tr>
	<td align="center" colspan="2">
		<span class="errorText"><?php echo $this -> messageError; ?></span>
		<span class="successText"><?php echo $this -> messageSuccess; ?></span>
	</td>
</tr>
<tr>
	<td align="center" colspan="2" class="keymap">
		<div style="float: left">
			<a href="#" style="font-size:10px ">Texte 10px</a>
			<a href="#" style="font-size:15px ">Texte 15px</a>
			<a href="#" style="font-size:20px ">Texte 20px</a>
			<a href="#" style="font-size:25px ">Texte 25px</a>
		</div>
	</td>
</tr>
<tr>
	<td align="center" colspan="2" class="keymap">
		<div style="float: left">
			<span style="color: #333333">DEFAULT</span>
			<span style="color: #787878">#787878</span>
			<span style="color: #8db91c">#8db91c</span>
			<span style="color: #b9aa01">#b9aa01</span>
			<span style="color: #289bd4">#289bd4</span>
			<span style="color: #e22e3a">#e22e3a</span>
			<span style="color: #bb90bb">#bb90bb</span>
			<span  style="color: #009249">#009249</span>
			<span style="color: #f19408">#f19408</span>
			<span style="color: #e1037a">#e1037a</span>
		</div>
	</td>
</tr>
<tr>
	<td valign="top">
		<table cellpadding="0" cellspacing="7" border="0">
			<tr>
				<td align="center" colspan="4">
					<span class="text2">CATEGORIES</span>
				</td>
			</tr>
			<tr>
				<td>CATEGORIE</td>
				<td>COULEUR</td>
				<td>TAILLE</td>
				<td>POSITION</td>
				<td style="display:none;">VUES</td>
				<td></td>
			</tr>
			<?php 
			$listMapCat = $this->listMapCat;
			$listCat = $this->listCat;
			$show = array();
			foreach($listCat as $row) {
			
			?>		
			<tr>
			<form action="<?php  echo $this->baseUrl; ?>/backoffice/statistic/keymapcatedit" method="post">
				<td class="text1">
					<?php echo $this->escape($row['NOM']);  ?>
				</td>
				<td>
					<input type="text" size="7" name="colorKey" value="<?php if (isset($listMapCat[$row['ID']]['COLOR'])) { echo $listMapCat[$row['ID']]['COLOR'];} ?>">
				</td>
				<td>
					<input type="text" size="5" name="sizeKey" value="<?php if (isset($listMapCat[$row['ID']]['SIZE'])) { echo $listMapCat[$row['ID']]['SIZE'];} ?>">
				</td>
				<td>
					<input type="text" size="5" name="positionKey" value="<?php if (isset($listMapCat[$row['ID']]['POSITION'])) { echo $listMapCat[$row['ID']]['POSITION']; } ?>">
					<input type="hidden" value="<?php echo $row['ID']; ?>" name="catId">
				</td>
				<td style="display:none;">
					<?php if (isset($listMapCat[$row['ID']]) && !empty($listMapCat[$row['ID']]['VIEW'])) { 
						 echo $listMapCat[$row['ID']]['VIEW']; 
					} ?>
				</td>
				<td>
					<input type="image" src="<?php echo $this->baseUrl; ?>/business/image/admin/edit.png" >
				</td>
			</form>
				<td>	
					<form action="<?php echo $this->baseUrl; ?>/backoffice/statistic/keymapshow" method="POST">
						<input type="hidden" value="<?php echo $row['ID']; ?>" name="catIdShow">
						<input type="hidden" value="CAT" name="keyType">
						<?php if (isset($listMapCat[$row['ID']]) && !empty($listMapCat[$row['ID']]['ID']) && $listMapCat[$row['ID']]['isSHOW'] == 1) { ?>
							<input type="image" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock0.png" name="showInput">
							<input type="hidden" name="showvalue" value="0">
						<?php } else { ?>
								<input type="image" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock2.png" name="showInput">
								<input type="hidden" name="showvalue" value="1">
						<?php } ?>
					</form>
				</td>
			</tr>
			<?php }  ?>
		</table>
	</td>
	<td valign="top">
		<table cellpadding="0" cellspacing="7" border="0">
			<tr>
				<td align="center" colspan="4">
					<span class="text2">MARQUES</span>
				</td>
			</tr>
			<tr>
				<td>MARQUE</td>
				<td>COULEUR</td>
				<td>TAILLE</td>
				<td>POSITION</td>
				<td style="display:none;">VUES</td>
				<td></td>
			</tr>
			<?php 
			$listMapBrend = $this->listMapBrend;
			$listBrend = $this->listBrend;
			$show = array();
			foreach($listBrend as $row) {
			
			?>		
			<tr>
			<form action="<?php  echo $this->baseUrl; ?>/backoffice/statistic/keymapbrendedit" method="post">
				<td class="text1">
					<?php echo $this->escape($row['BREND']);  ?>
				</td>
				<td>
					<input type="text" size="7" name="colorKey" value="<?php if (isset($listMapBrend[$row['ID']]['COLOR'])) { echo $listMapBrend[$row['ID']]['COLOR'];} ?>">
				</td>
				<td>
					<input type="text" size="5" name="sizeKey" value="<?php if (isset($listMapBrend[$row['ID']]) && isset($listMapBrend[$row['ID']]['ID'])) { echo $listMapBrend[$row['ID']]['SIZE']; } ?>">
				</td>
				<td>
					<input type="text" size="5" name="positionKey" value="<?php if (isset($listMapBrend[$row['ID']]) && isset($listMapBrend[$row['ID']]['ID'])) { echo $listMapBrend[$row['ID']]['POSITION']; } ?>">
					<input type="hidden" value="<?php echo $row['ID']; ?>" name="brendId">
				</td>
				<td style="display:none;">
					<?php if (isset($listMapBrend[$row['ID']]) && !empty($listMapBrend[$row['ID']]['VIEW'])) { 
						 echo $listMapBrend[$row['ID']]['VIEW']; 
					} ?>
				</td>
				<td>
					<input type="image" src="<?php echo $this->baseUrl; ?>/business/image/admin/edit.png" >
				</td>
			
			</form>	
				<td>
					<form action="<?php echo $this->baseUrl; ?>/backoffice/statistic/keymapshow" method="POST">
						<input type="hidden" value="<?php echo $row['ID']; ?>" name="brendIdShow">
						<input type="hidden" value="BREND" name="keyType">
						<?php if (isset($listMapBrend[$row['ID']]) && !empty($listMapBrend[$row['ID']]['ID']) && $listMapBrend[$row['ID']]['isSHOW'] == 1) { ?>
							<input type="image" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock0.png" name="showInput">
							<input type="hidden" name="showvalue" value="0">
						<?php } else { ?>
								<input type="image" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock2.png" name="showInput">
								<input type="hidden" name="showvalue" value="1">
						<?php } ?>
					</form>
					
				</td>
			</tr>
			<?php }  ?>
		</table>
	</td>
</tr>

</table>
modules/backoffice/views/scripts/statistic/searchkey.phtml000060400000007311150710367660020160 0ustar00<div class="table-box">
<div class="col-md-12 header-single-line">
	<div class="col-md-5 header-single no-space-top"><?php echo $this->titlePage; ?></div>
	<div class="col-md-7 no-space-top"><?php echo $this->render("alert.phtml"); ?></div>
</div>
<div class="col-md-12 text-center">
	Afficher par 
	<div class="btn-group">
		<a class="btn btn-primary" href='<?php echo $this->baseUrl;?>/backoffice/statistic/searchkey/nb/100/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>' >100</a>
   		<a class="btn btn-primary" href='<?php echo $this->baseUrl;?>/backoffice/statistic/searchkey/nb/200/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>' >200</a>
   		<a class="btn btn-primary" href='<?php echo $this->baseUrl;?>/backoffice/statistic/searchkey/nb/300/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>' >300</a>
   		<a class="btn btn-primary" href='<?php echo $this->baseUrl;?>/backoffice/statistic/searchkey/nb/500/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>' >500</a>
   	</div>
</div>            
<?php echo $this->paginationControl($this->paginator, 'All', 'pagination.phtml'); ?>
<table class="display table" id="supplierTable" width="100%">
	<thead>
		<tr>
			<th > <a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/searchkey/col/DATESTART/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>">Date de d�but</a></th>
			<th ><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/searchkey/col/DATEEND/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>">Date de fin</a></th>
			<th >Dur�e</th>
			<th ><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/searchkey/col/VALUE/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>">Recherche</a></th>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/searchkey/col/IP/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>">IP</a></th>
		</tr> 	
	</thead>
	<tbody>
		<?php 
			function difheure($heuredeb,$heurefin)
			{
			   $hd=explode(":",$heuredeb);
			   $hf=explode(":",$heurefin);
			   $hd[0]=(int)($hd[0]);$hd[1]=(int)($hd[1]);$hd[2]=(int)($hd[2]);
			   $hf[0]=(int)($hf[0]);$hf[1]=(int)($hf[1]);$hf[2]=(int)($hf[2]);
			   if($hf[2]<$hd[2]){$hf[1]=$hf[1]-1;$hf[2]=$hf[2]+60;}
			   if($hf[1]<$hd[1]){$hf[0]=$hf[0]-1;$hf[1]=$hf[1]+60;}
			   if($hf[0]<$hd[0]){$hf[0]=$hf[0]+24;}
			   return (($hf[0]-$hd[0]).":".($hf[1]-$hd[1]).":".($hf[2]-$hd[2]));
			}
			
			foreach($this->paginator as $row) { ?>
			<tr>
				<td align="left"><?php  
				$myDateStart = new Zend_Date(strtotime($row->DATESTART));
				$mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
				$moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
				$hourStart = $myDateStart->toString("HH").":".$myDateStart->toString("mm").":".$myDateStart->toString("ss");
				echo $myDateStart->toString("dd").' '.$moisComplet[(int)$myDateStart->toString('MM')].' '.$myDateStart->toString("YYYY").' '.$hourStart;
				?></td>
				<td align="center"><?php  
				$myDateEnd = new Zend_Date(strtotime($row->DATEEND));
				$hourEnd = $myDateEnd->toString("HH").":".$myDateEnd->toString("mm").":".$myDateEnd->toString("ss");
				echo $myDateEnd->toString("dd").' '.$moisComplet[(int)$myDateEnd->toString('MM')].' '.$myDateEnd->toString("YYYY").' '.$hourEnd;
				?></td>
				<td align="left" ><?php echo difheure($hourStart,$hourEnd); ?></td>
				<td align="left" ><?php echo $row->VALUE ; ?></td>
				<td align="left"><?php echo $row->IP ; ?></td>
			</tr>
			<?php } ?>
	</tbody>
</table>
<?php echo $this->paginationControl($this->paginator, 'All', 'pagination.phtml'); ?>
</div>modules/backoffice/views/scripts/statistic/logadmin.phtml000060400000006661150710367660020003 0ustar00<?php 
function  checkColorLog($level) {
	if ($level == "CRIT") {
		return "red";
	}
	if ($level == "ERR") {
		return "red";
	}
	if ($level == "INFO") {
		return "black";
	}
	if ($level == "WARN") {
		return "#cc9900";
	}
}

?> <div class="table-box">
<div class="col-md-12 header-single-line">
	<div class="col-md-5 header-single no-space-top"><?php echo $this->titlePage; ?></div>
	<div class="col-md-7 no-space-top"><?php echo $this->render("alert.phtml"); ?></div>
</div>
<div class="col-md-12 text-center">
	Afficher par 
	<div class="btn-group">
		<a class="btn btn-primary" href='<?php echo $this->baseUrl;?>/backoffice/statistic/logadmin/nb/100/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>' >100</a>
   		<a class="btn btn-primary" href='<?php echo $this->baseUrl;?>/backoffice/statistic/logadmin/nb/200/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>' >200</a>
   		<a class="btn btn-primary" href='<?php echo $this->baseUrl;?>/backoffice/statistic/logadmin/nb/300/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>' >300</a>
   		<a class="btn btn-primary" href='<?php echo $this->baseUrl;?>/backoffice/statistic/logadmin/nb/500/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>' >500</a>
   		<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl;?>/backoffice/statistic/logadminclean" ><span class="glyphicon glyphicon-trash"></span> Supprimer l'historique</button>
	</div>
</div>            
<?php echo $this->paginationControl($this->paginator, 'All', 'pagination.phtml'); ?>
<table class="display table" id="supplierTable" width="100%">
	<thead>
		<tr>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logadmin/col/DATE_LOG/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>">Date</a></th>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logadmin/col/LEVEL_NAME/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>">Type</a></th>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logadmin/col/CONTROLLER/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>">Controller</a></th>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logadmin/col/MESSAGE/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>">Message</a></th>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logadmin/col/IP/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>">IP</a></th>
		</tr> 	
	</thead>
	<tbody>
	
		<?php foreach($this->paginator as $row)  { ?>
		<tr style="color: <?php echo checkColorLog($row->LEVEL_NAME); ?>">
			<td><?php  
			$myDate = new Zend_Date(strtotime($row->DATE_LOG));
			$mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
			$moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
			echo $myDate->toString("dd").' '.$moisComplet[(int)$myDate->toString('MM')].' '.$myDate->toString("YYYY").' '.$myDate->toString("HH").":".$myDate->toString("mm").":".$myDate->toString("ss");
			?></td>
			<td><?php echo $row->LEVEL_NAME; ?></td>
			<td><?php echo $row->CONTROLLER; ?></td>
			<td ><?php echo $row->MESSAGE ; ?></td>
			<td ><?php echo $row->IP ; ?></td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<?php echo $this->paginationControl($this->paginator, 'All', 'pagination.phtml'); ?>
</div>

modules/backoffice/views/scripts/statistic/stats.phtml000060400000016401150710367660017340 0ustar00<div class="col-xs-6">
	<div class="sec-box">
		<header>
			<h2 class="heading">Meilleures ventes par r�f�rence - Ann�e </h2>
		</header>
		<div class="contents boxpadding">
			<div class="charts-box">
				<div id="displaydigonalbar"></div>
				<script>
					<?php $element = $this->statsBestSellYear;  ?>
					var day_data = [
						<?php 
						$separator = "";
						foreach ($element as $value) { ?>
							<?php echo $separator;?>{"period": <?php echo '"'.$value['REFERENCE'].'"'; ?>, "label1": <?php echo '"'.sprintf("%.2f", $value['TOTAL']).'"'; ?>, "label2": <?php echo '"'.$value['NB_CMD'].'"'; ?>}
						<?php $separator = ",";
						} ?>
					];
					Morris.Bar({
					  element: 'displaydigonalbar',
					  data: day_data,
					  xkey: 'period',
					  ykeys: ['label1', 'label2'],
					  labels: ['Somme', 'Commande'],
					  xLabelAngle: 0
					});
				</script>
			</div>
		</div>
	</div>
</div>
<div class="col-xs-6">
	<div class="sec-box">
		<header>
			<h2 class="heading">Meilleures ventes par r�f�rence - Mois</h2>
		</header>
		<div class="contents boxpadding">
			<div class="charts-box">
				<div id="displaydigonalbar2"></div>
				<script>
					<?php $element = $this->statsBestSellMonth;  ?>
					var day_data = [
						<?php 
						$separator = "";
						foreach ($element as $value) { ?>
							<?php echo $separator;?>{"period": <?php echo '"'.$value['REFERENCE'].'"'; ?>, "label1": <?php echo '"'.sprintf("%.2f", $value['TOTAL']).'"'; ?>, "label2": <?php echo '"'.$value['NB_CMD'].'"'; ?>}
						<?php $separator = ",";
						} ?>
					];
					Morris.Bar({
					  element: 'displaydigonalbar2',
					  data: day_data,
					  xkey: 'period',
					  ykeys: ['label1', 'label2'],
					  labels: ['Somme', 'Commande'],
					  xLabelAngle: 0
					});
				</script>
			</div>
		</div>
	</div>
</div>
<div class="col-xs-6">
	<div class="sec-box">
		<header>
			<h2 class="heading">Les r�f�rences les plus vendus - Ann�e </h2>
		</header>
		<div class="contents boxpadding">
			<div class="charts-box">
				<div id="displaydigonalbar3"></div>
				<script>
					<?php $element = $this->statsNbProductYear;  ?>
					var day_data = [
						<?php 
						$separator = "";
						foreach ($element as $value) { ?>
							<?php echo $separator;?>{"period": <?php echo '"'.$value['REFERENCE'].'"'; ?>, "label1": <?php echo '"'.sprintf("%.2f", $value['TOTAL']).'"'; ?>, "label2": <?php echo '"'.$value['NB'].'"'; ?>}
						<?php $separator = ",";
						} ?>
					];
					Morris.Bar({
					  element: 'displaydigonalbar3',
					  data: day_data,
					  xkey: 'period',
					  ykeys: ['label1', 'label2'],
					  labels: ['Somme', 'Quantit�'],
					  xLabelAngle: 0
					});
				</script>
			</div>
		</div>
	</div>
</div>
<div class="col-xs-6">
	<div class="sec-box">
		<header>
			<h2 class="heading">Les r�f�rences les plus vendus - Mois</h2>
		</header>
		<div class="contents boxpadding">
			<div class="charts-box">
				<div id="displaydigonalbar4"></div>
				<script>
					<?php $element = $this->statsNbProductMonth;  ?>
					var day_data = [
						<?php 
						$separator = "";
						foreach ($element as $value) { ?>
							<?php echo $separator;?>{"period": <?php echo '"'.$value['REFERENCE'].'"'; ?>, "label1": <?php echo '"'.$value['NB'].'"'; ?>, "label2": <?php echo '"'.$value['NB_CMD'].'"'; ?>}
						<?php $separator = ",";
						} ?>
					];
					Morris.Bar({
					  element: 'displaydigonalbar4',
					  data: day_data,
					  xkey: 'period',
					  ykeys: ['label1', 'label2'],
					  labels: ['Somme', 'Commande'],
					  xLabelAngle: 0
					});
				</script>
			</div>
		</div>
	</div>
</div>


 <div class="col-xs-6">
	<div class="sec-box">
		<header>
			<h2 class="heading">R�partition des commandes par cat�gorie - Ann�e</h2>
		</header>
		<div class="contents boxpadding">
			<div class="charts-box">
				<div id="donutchartcolor"></div>
				<script>
					Morris.Donut({
	                    element: 'donutchartcolor',
	                    data: [
						<?php  $element = $this->statsCategoryCmdYear; 
								$separator = "";
								foreach ($element as $value) { ?>
								<?php echo $separator;?> {value: <?php echo  $value['NB_CMD']; ?>, label: <?php echo '"'.$value['CAT_NOM'].'"'; ?>}
								<?php $separator = ","; } ?>
	                    ],
	                    backgroundColor: '#ccc',
	                    labelColor: '#060',
	                    colors: [
	                      '#0BA462',
	                      '#39B580',
	                      '#67C69D',
	                      '#95D7BB'
	                    ],
	                    formatter: function (x) { return x }
	                  });
				</script>
			</div>
		</div>
	</div>
</div>
 <div class="col-xs-6">
	<div class="sec-box">
		<header>
			<h2 class="heading">R�partition des commandes par cat�gorie - Mois</h2>
		</header>
		<div class="contents boxpadding">
			<div class="charts-box">
				<div id="donutchartcolor2"></div>
				<script>
					Morris.Donut({
	                    element: 'donutchartcolor2',
	                    data: [
						<?php  $element = $this->statsCategoryCmdMonth; 
								$separator = "";
								foreach ($element as $value) { ?>
								<?php echo $separator;?> {value: <?php echo  $value['NB_CMD']; ?>, label: <?php echo '"'.$value['CAT_NOM'].'"'; ?>}
								<?php $separator = ","; } ?>
	                    ],
	                    backgroundColor: '#ccc',
	                    labelColor: '#060',
	                    colors: [
	                      '#0BA462',
	                      '#39B580',
	                      '#67C69D',
	                      '#95D7BB'
	                    ],
	                    formatter: function (x) { return x }
	                  });
				</script>
			</div>
		</div>
	</div>
</div>
<div class="col-xs-12">
                            <div class="sec-box">
                                <header>
                                    <h2 class="heading">Recherche par mots cl�s - Ann�e</h2>
                                </header>
                                <div class="contents boxpadding">
                                    <div class="charts-box">
                                        <div id="formatenondate"></div>
                                        <script>
                                            var day_data = [
											<?php  $element = $this->statsKeyWordYear; 
											$separator = "";
											foreach ($element as $value) { ?>
											<?php echo $separator;?> {"elapsed": <?php echo  '"'.$value['VALUE'].'"'; ?>, "value": <?php echo $value['NB']; ?>}
											<?php $separator = ","; } ?>
                                            ];
                                            Morris.Line({
                                              element: 'formatenondate',
                                              axes: false,
                                              data: day_data,
                                              xkey: 'elapsed',
                                              ykeys: ['value'],
                                              labels: ['Recherche'],
                                              parseTime: false
                                            });
                                        </script>
                                    </div>
                                </div>
                            </div>
                        </div>modules/backoffice/views/scripts/statistic/clickstatsip.phtml000060400000001774150710367660020706 0ustar00<?php 
function  checkColorSource($source) {
	$color = "black";
      if ($source == 'Redirection : Hello Pro') {
            $color = "blue";
      } 
      return $color;
}

?>
<table cellpadding="0" cellspacing="5" border="0" width="200px">
<?php foreach($this->listSource as $row) : ?>
<tr style="color: <?php echo checkColorSource($row['Source']); ?>">
	<td align="left">
		<?php echo $row['Source']; ?>
	</td>
	<td align="center" ><?php echo $row['NbSource']; ?></td>
</tr>
<?php endforeach; ?>
</table>

<table cellpadding="0" cellspacing="5" border="0" width="500px">
<tr class="linkHeader" align="center">
	<th width="150px">IP</th>
	<th width="150px">SOURCE</th>
	<th width="150px">CLICKS</th>
</tr>

<?php foreach($this->listIp as $row) { ?>
<tr style="color: <?php echo checkColorSource($row['Source']); ?>">
	<td align="center">
		<?php  echo $row['Ip']; ?>
	</td>
	<td align="center" ><?php echo $row['Source']; ?></td>
	<td align="center" ><?php echo $row['NbSource']; ?></td>
</tr>
<?php } ?>
</table>


modules/backoffice/views/scripts/command/ajaxmessage.phtml000060400000000206150710367660020075 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?>
<?php echo $this->messageSuccess; ?><?php echo $this->messageError; ?>modules/backoffice/views/scripts/command/facture_deliverytrack.phtml000060400000001176150710367660022175 0ustar00<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
$facture = $this->facture;
?>
Bonjour,<br /><br />
Votre commande est en cours de livraison.<br /><br />
Avec le suivi, votre colis est unique. <br />
Vous pouvez consulter le suivi de votre colis via l'adresse : <?php echo $facture['DELIVERY_TRACKINGLINK'];?><br />
Votre num�ro de colis : <?php echo $facture['DELIVERY_TRACKINGNUMBER'];?>
</body>
</html>

modules/backoffice/views/scripts/command/edit.phtml000060400000051203150710367660016535 0ustar00
<?php
$facture = $this->facture;
$caddy = $facture['CADDY'];
?>
<script type="text/javascript"> 
$(function(){  
	$("#showallproduct_public_button").bind({
		click: function() {
			openUrls($("#showallproductcontent_public"));
		}	
	}); 
	$("#showallproduct_admin_button").bind({
		click: function() {
			openUrls($("#showallproductcontent_admin"));
		}	
	});
});

function openUrls(element) { 
	var $mainlink = element.children(); 
	$mainlink.each(function(i){	 
		window.open($(this).attr("href"), '_blank'); 
    });
}
</script>


<style>
.adminBoxCommand {
	float: left;
	width: 700px;
	margin: 10px 0 0 0;
	border: 1px solid red;
}

.bill_body {
	clear:both;
	width: 800px;
	margin: 20px auto 0 auto;
}

.bill_header {
	float: left;
	width: 800px;
}

.bill_company {
	float: left;
}

.bill_company_logo {
	margin: 10px 0 10px 10px;
	width: 94px;
	height: 121px;
}

.bill_idents {
	float: right;
	width: 550px;
}

.bill_idents_opt1 {
	float: left;
	width: 120px;
	height: 50px;
	margin: 0 0 0 10px;
}

.bill_idents_opt21 {
	float: left;
	width: 120px;
	height: 25px;
	background-color: #e7e7e7;
	margin: 0 0 0 0;
	text-align: center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}

.bill_idents_opt31 {
	float: left;
	width: 120px;
	height: 24px;
	margin: 1px 0 0 0;
	text-align: center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}

.bill_idents_opt22 {
	float: left;
	width: 250px;
	height: 25px;
	background-color: #e7e7e7;
	margin: 0 0 0 0;
	text-align: center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}

.bill_idents_opt32 {
	float: left;
	width: 250px;
	height: 24px;
	margin: 1px 0 0 0;
	text-align: center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}

.bill_text {
	color: #000000;
	font-weight: bold;
}

.bill_text2 {
	color: #000000;
	font-weight: bold;
	line-height: 25px;
}

.bill_text3 {
	color: #000000;
	font-size: 11px;
}

.bill_address {
	float: left;
	width: 700px;
	margin: 10px 0 0 0;
}

.bill_address_opt {
	float: left;
	width: 300px;
	margin: 0 0 0 50px;
}

.bill_address_opt1 {
	float: left;
	width: 300px;
	height: 25px;
	background-color: #e7e7e7;
	margin: 0 0 0 0;
	text-align: center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}

.bill_address_opt2 {
	float: left;
	width: 250px;
	margin: 10px 0 0 20px;
}

.bill_line {
	line-height: 25px;
}

.bill_line2 {
	line-height: 20px;
}

.bill_caddy {
	float: left;
	width: 800px;
	height: auto;
	margin: 10px 0 0 0;
}

.bill_facture {
	float: left;
	width: 800px;
}

.bill_buy {
	float: left;
	width: 500px;
}

.bill_user_paiement_box {
	width: 450px;
	margin: 5px 0 0 0;
	padding: 0 10px 10px 10px;
	border: 2px #000000 solid;
}

.bill_detail {
	float: right;
	width: 250px;
	height: 130px;
	border: solid 1px black;
	margin: 10px 0 0 0;
}

.bill_footer {
	float: left;
	width: 800px;
	margin: 20px 0 0 0;
}

.bill_footer2 {
	float: left;
	width: 800px;
	text-align: center;
	margin: 0 0 20px 0;
}
</style>

<div class="table-box hidden-print">
<table class="table">
	<thead>
		<tr>
			<th class="col-md-4" colspan="2"><?php echo $this->titlePage; ?></th>
		</tr>
	</thead>
	<tbody>
	<?php echo $this->render("alert_tr.phtml"); ?>
		<tr>
			<td class="col-md-6">
				<div class="btn-group">
                 	<a class="btn btn-primary"
					target="_blank" href="<?php echo $this->baseUrl; ?>/backoffice/user/edit/id/<?php echo $facture['USER_ID']; ?>"><span class="glyphicon glyphicon-user"></span>&nbsp;Fiche client</a>
                    <button class="btn btn-primary" id="showallproduct_public_button"><i class="glyphicon glyphicon-eye-open"></i>&nbsp;Voir tous les produits</button>
                    <button class="btn btn-primary" id="showallproduct_admin_button"><i class="glyphicon glyphicon-cog"></i>&nbsp;Configurer tous les produits</button>
                    <a class="btn btn-primary" href="#" onclick="window.print();return false;"><i class="glyphicon glyphicon-print"></i>&nbsp;Imprimer</a>
               </div>
                                        
				<div style="display: none;" id="showallproductcontent_public"><?php 
				$extracted  = array();
				foreach($caddy as $row) {
					if (!in_array($row['PRODUCTID'], $extracted)) {
						array_push($extracted, $row['PRODUCTID']); ?> <a target="_blank"
					href="<?php echo $this->baseUrl; ?>/<?php echo Utils_Tool::getFormattedUrlProduct($row['NAVNOM_URLPARENTS'], $row['NAVPRODUCTNOM'], $row['PRODUCTID']);  ?>"></a>
					<?php
					}
				} ?></div>
				<div style="display: none;" id="showallproductcontent_admin"><?php $extracted  = array();
				foreach($caddy as $row) {
					if (!in_array($row['PRODUCTID'], $extracted)) {
						array_push($extracted, $row['PRODUCTID']); ?> <a target="_blank"
					href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $row['PRODUCTID'];  ?>"></a>
					<?php
					}
				} ?>
				</div>
			</td>
			<td class="col-md-6">

			<div class="col-md-12 no-space-top">
			  <form action="<?php echo $this->baseUrl; ?>/backoffice/command/edit/" method="POST" name="setSTATUTForm">

			    <div class="col-md-6 no-space-top">
            <select name="statut" class="form-control">
				      <option value="1" <?php if ($facture['STATUT']==1) { echo 'selected'; }?>>Commande - En attente</option>
              <option value="4" <?php if ($facture['STATUT']==4) { echo 'selected'; }?>>Commande - En traitement</option>
				      <option value="2" <?php if ($facture['STATUT']==2) { echo 'selected'; }?>>Commande - En livraison</option>
				      <option value="3" <?php if ($facture['STATUT']==3) { echo 'selected'; }?>>Commande - Termine</option>

				      <?php if ($facture['STATUT'] != 1 && $facture['STATUT'] != 2 && $facture['STATUT'] != 3 && $facture['STATUT'] != 4) {  ?>
				      <option value="10" <?php if ($facture['STATUT']==10) { echo 'selected'; }?>>Devis - En Attente</option>
				      <option value="11" <?php if ($facture['STATUT']==11) { echo 'selected'; }?>>Devis - Termine</option>
				      <?php } ?>
			      </select>
          </div>
			    <div class="col-md-6 no-space-top">
              <input type="hidden" name="idcmd" value="<?php echo $facture['ID']; ?>" />
			        <button class="btn btn-success" type="submit"><span class="glyphicon glyphicon-edit"></span>&nbsp;Modifier</button>
			    </div>
          <?php  if ($facture['STATUT']==2 || $facture['STATUT']==3){?>
          <div class="col-md-12">
            <div class="col-md-6 no-space-top">
              <div class="col-md-6 no-space-top" style="margin-top:10px">
                Suivi de livraison :
              </div>
              <div class="col-md-6 no-space-top">
                <a href="<?php echo $this->baseUrl; ?>/backoffice/command/deliverymail/id/<?php echo $facture['ID']; ?>" class="btn btn-primary">Envoyer le mail</a>
              </div>
            </div>
            <div class="col-md-6 no-space-top">
              <div class="col-md-12 no-space-top">
                <input type="text" name="delivery_trackinglink" class="form-control" placeholder="Lien d'acc�s au suivi de livraison" value="<?php echo $facture['DELIVERY_TRACKINGLINK']; ?>" />
              </div>
              <div class="col-md-12 no-space-top">
                <input type="text" name="delivery_trackingnumber" class="form-control" placeholder="Num�ro de colis" value="<?php echo $facture['DELIVERY_TRACKINGNUMBER']; ?>" />
              </div>
            </div>
            </div>
          <?php } ?>

          <?php  if ($facture['STATUT']==4){?>
          <div class="col-md-12 ">
            <div class="col-md-8 no-space-top" style="margin-top:10px">
              Commande en cours de traitement :
            </div>
            <div class="col-md-4 no-space-top">
              <a href="<?php echo $this->baseUrl; ?>/backoffice/command/traitementmail/id/<?php echo $facture['ID']; ?>" class="btn btn-primary">Envoyer le mail</a>
            </div>
          </div>
          <?php } ?>
          
			  </form>
			</div>
			<?php if ($facture['USER_MODEPAIEMENT'] == 1) { ?>
			<div class="col-md-12">
			<div class="col-md-6 no-space-top">Statut du paiement :</div>
			<div class="col-md-6 no-space-top"><?php 
			if (!isset($facture['PAYMENT_STATUS'])) {
				echo "N/C";
			} else {
				if ($facture['PAYMENT_STATUS'] == 'Completed') {
					echo "Paiement �ffectu� - Completed";
				} else {
					echo "Paiement en attente - ".$facture['PAYMENT_STATUS'];
				}
			}
			?></div>
			</div>
			<div class="col-md-12 no-space-top">
			<div class="col-md-6 no-space-top">Transaction :</div>
			<div class="col-md-6 no-space-top"><?php 
			if (!isset($facture['TXN_ID'])) {
				echo "N/C";
			} else {
				echo $facture['TXN_ID'];
			}
			?></div>
			</div>
			<?php } ?>
			<div class="col-md-12 no-space-top">
			  <div class="col-md-6 no-space-top">Date Fin :</div>
			  <div class="col-md-6 no-space-top"><?php 
			  $mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
			  $moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
			  if ($facture['DATEEND'] != null && $facture['DATEEND'] != '0000-00-00 00:00:00') {
				  $myDateEnd = new Zend_Date(strtotime($facture['DATEEND']));
				  echo $myDateEnd->toString("dd").' '.$mois[(int)$myDateEnd->toString('MM')].' '.$myDateEnd->toString("YYYY");
			  } ?></div>
			</div>
			</td>
		</tr>
	</tbody>
</table>
</div>
<div class="clearfix"></div>

<div class="bill_body">
<div class="bill_header">
<div class="bill_company">
<div class="bill_company_logo"><a href="<?php echo $this->baseUrl_SiteCommerceUrl; ?>"><img
	alt="Directement � la source de la qualit�"
	src="<?php echo $this->baseUrl; ?>/business/image/logo.png"
	style="border: none;" /></a></div>
</div>
<div class="bill_idents">
<div class="bill_idents_opt1">
<div class="bill_idents_opt21"><span class="bill_line"><?php if ($facture['STATUT'] == 1 || $facture['STATUT'] == 2 || $facture['STATUT'] == 3) { echo 'Commande N';} else {echo 'Devis N';} ?></span>
</div>
<div class="bill_idents_opt31"><span class="bill_line"><?php echo $facture['REFERENCE']; ?></span>
</div>
</div>
<div class="bill_idents_opt1">
<div class="bill_idents_opt21"><span class="bill_line"><?php echo 'Date'; ?></span>
</div>
<div class="bill_idents_opt31"><span class="bill_line"> <?php 
$myDate = new Zend_Date(strtotime($facture['DATESTART']));
echo $myDate->toString("dd").' '.$mois[(int)$myDate->toString('MM')].' '.$myDate->toString("YYYY");
?> </span></div>
</div>
<div class="bill_idents_opt1">
<div class="bill_idents_opt22"><span class="bill_line"><?php echo 'Client'; ?></span>
</div>
<div class="bill_idents_opt32"><span class="bill_line link2"><?php echo $facture['USER_EMAIL']; ?></span>
</div>
</div>
</div>

<div style="float: left; width: 800px"><span class="bill_text">Compte :
<?php echo $facture['USER_NUMCOMPTE']; ?></span><br>
<span class="bill_text">Tel : <?php echo $this->tel_contact; ?></span><br>
<span class="bill_text">Email : <?php echo $this->serviceClient_Mail; ?></span>
</div>
</div>

<div class="bill_address">
<div class="bill_address_opt">
<div class="bill_address_opt1"><span class="bill_line">Adresse de
Facturation</span></div>
<div class="bill_address_opt2"><span class="bill_text2"><?php echo $facture['FACT_RAISONSOCIAL']; ?></span><br>
<span class="bill_text2"><?php echo $facture['FACT_ADRESSE']; ?></span><br>
<span class="bill_text2"><?php echo $facture['FACT_CP'].' '.$facture['FACT_VILLE']; ?></span><br>
<span class="bill_text2"><?php echo $facture['FACT_PAYS']; ?></span></div>
</div>
<div class="bill_address_opt">
<div class="bill_address_opt1"><span class="bill_line">Adresse de
Livraison</span></div>
<div class="bill_address_opt2"><span class="bill_text2"><?php echo html_entity_decode($facture['LIV_RAISONSOCIAL']); ?></span><br>
<span class="bill_text2"><?php echo $facture['LIV_ADRESSE']; ?></span><br>
<span class="bill_text2"><?php echo $facture['LIV_CP'].' '.$facture['LIV_VILLE']; ?></span><br>
<span class="bill_text2"><?php echo $facture['LIV_PAYS']; ?></span></div>
</div>
</div>
<div class="bill_caddy">
<table style="border: 1px solid black;" cellpadding="0" cellspacing="0"
	width="100%">
	<tr align="center" style="background-color: #e7e7e7;">
		<th class="bill_line">R�f�rence</th>
		<th class="bill_line">D�signation</th>
		<th class="bill_line" style="width: 60px">Dispo.</th>
		<th class="bill_line">Quantit�</th>
		<th class="bill_line" style="text-align:center">P.U. HT</th>
		<th class="bill_line" style="display: none;">Prix Remis�</th>
		<th class="bill_line">Montant HT</th>
	</tr>
	<?php
	$index = 1;
	$i = 0;
	foreach($caddy as $row) {
		?>
	<tr>
		<td colspan="6" height="1px" style="background-color: #868686"></td>
	</tr>
	<tr align="center" height="25px">
		<td class="textTd1" width="110px"
			style="text-align: center; white-space: nowrap;"><?php echo $this->escape($row['REFERENCE']);?>
		</td>
		<td width="450px" class="link4" style="text-align: left;"><a
			target="_blank" style="color: black;"
			href="<?php echo $this->baseUrl; ?>/<?php echo Utils_Tool::getFormattedUrlProduct($row['NAVNOM_URLPARENTS'], $row['NAVPRODUCTNOM'], $row['PRODUCTID']); ?>"><?php echo $row['DESIGNATION'];?></a>
			<?php if (!empty($row['SELECTEDOPTION'])) {
				echo '<br/>'.$row['SELECTEDOPTION'].'<br/>';
			} ?></td>

		<td class="textTd1"><?php if ((int)$row['STOCK'] == 1) { ?> <img
			alt="Disponible" title="Disponible"
			src="<?php echo $this->baseUrl; ?>/business/image/admin/stock11.png" />
			<?php } else if ((int)$row['STOCK'] == 2) { ?> <img
			alt="Disponible sous 8 jours" title="Disponible sous 8 jours"
			src="<?php echo $this->baseUrl; ?>/business/image/admin/stock22.png" />
			<?php } else if ((int)$row['STOCK'] == 3) { ?> <img
			alt="Nous contacter" title="Nous contacter"
			src="<?php echo $this->baseUrl; ?>/business/image/admin/stock33.png" />
			<?php }?></td>
		<td class="textTd1"><?php echo $row['QUANTITY']; ?></td>
		<td class="textTd1" width="150px">
		<table border="0" cellpadding="0" cellspacing="0">
			<tr align="left">
			<?php if ($row['isDEVIS'] == 1) {
				if ($row['isPROMO'] == 0) { ?>
				<td align="right"><span> <?php echo number_format($row['PROMOPRIX'], 2, ',', ' ').' ';?><span
					style="color: #000000">&#8364;</span> </span><br>
				<span class='oldPromoPrice'> <?php echo number_format($row['PRIX'], 2, ',', ' ').' ';?>&#8364;
				</span></td>
				<td width="50px"><img
					src="<?php echo $this->baseUrl; ?>/business/image/admin/promo.png"
					alt="Ce produit est en promotion" width="50px" /></td>
					<?php } else { ?>
				<td align="left" width="100%"><span> <?php echo number_format($row['PRIX'], 2, ',', ' ').' ';?>
				<span style="color: #000000">&#8364;</span> </span></td>
				<?php }
			} else { ?>
				<td align="center" colspan="2"><span class="text12" style="color:<?php echo $this->actualDesign['color'];?>"><?php echo 'sur devis'; ?></span>
				</td>
				<?php } ?>
			</tr>
		</table>
		</td>
		<td width="120px" style="display: none;"><?php if ($row['isPROMO'] == 1 && $row['REMISEPRIX'] > 0) { ?>
		<span class="textTd1"> <?php
		if ((int)$row['REMISEPRIXTAUXP'] > 0) {
			echo number_format($row['REMISEPRIX'], 2, ',', ' ').'&nbsp;&#8364; <br>('.$this->escape($row['REMISEPRIXTAUXP']).'&nbsp;%)';
		} else {
			echo number_format($row['REMISEPRIX'], 2, ',', ' ').'&nbsp;&#8364;';
		}
		?> </span> <?php } ?></td>
		<td width="120px"><span class="textTd1" style="float: right;"> <?php if ($row['isDEVIS'] == 1) { 
			echo number_format($row['PRIXTOTAL'], 2, ',', ' ').'&nbsp;&#8364;';
		} ?> </span></td>
	</tr>
	<?php $i++; } ?>


  <?php
	$caddyfidelite = $facture['CADDYFIDELITE'];
	foreach($caddyfidelite as $row) {
		?>
    <tr>
      <td colspan="6">
        <div style="font-weight: bold;margin:10px;">
          <?php echo 'Carte de fid�lit� : '.$row['NOM'].' ('.$row['NBPOINT'].' points)'; ?>
        </div>
      </td>
    </tr>
  <?php } ?>
</table>
</div>
<div class="bill_facture">
<div class="bill_buy"><?php switch ($facture['USER_MODEPAIEMENT_TYPE']) {
	case 1 : ?>
<div class="bill_user_paiement_box">
<div class="bill_text2" style="text-align: center">Mode de paiement :
Par ch�que</div>
<div style="margin-left: 10px">- Veuillez libeller votre ch�que �
l�ordre de <?php echo $this->siteName; ?></div>
<div style="margin-left: 10px">- Inscrivez le num�ro de votre commande
au dos de votre ch�que</div>
<div style="margin-left: 10px">- Puis envoyez votre r�glement �
l�adresse suivante :</div>
<br />
<div class="bill_text" style="text-align: center"><?php echo $this->siteName; ?></div>
<br />
<div class="bill_text" style="text-align: center"><?php echo $this->site_addresse3_title; ?></div>
<div class="bill_text" style="text-align: center"><?php echo $this->site_addresse3_address; ?></div>
<div class="bill_text" style="text-align: center"><?php echo $this->site_addresse3_cp; ?></div>
<br />
<div style="font-size: 10px; text-align: center">A noter : Les produits
sont exp�di�s � r�ception du ch�que</div>
</div>
	<?php  break;
case 2 : ?>
<div class="bill_user_paiement_box">
<div class="bill_text2" style="text-align: center">Mode de paiement :
Par virement</div>
<div>- La commande sera exp�di�e d�s le virement pr�sent sur notre
compte bancaire.</div>
<div class="bill_text">- Inscrivez votre num�ro de commande sur le
formulaire de virement</div>
<div>- Vous disposez d�un <span style="font-weight: bold;">d�lai de 15
jours</span> pour effectuer le virement sur notre compte ci-dessous
indiqu�, au d�l� de ce d�lai votre commande sera automatiquement
annul�e.</div>
<br />
<div class="bill_text">RIB : <?php echo $this->site_rib_numbers; ?></div>
<div class="bill_text">No IBAN : <?php echo $this->site_rib_iban; ?></div>
<div class="bill_text">Code BIC : <?php echo $this->site_rib_bic; ?></div>
<div class="bill_text">Nom du compte : <?php echo $this->siteName; ?></div>
<div class="bill_text">Nom et domiciliation de la banque : <?php echo $this->site_rib_bankname; ?></div>
</div>
<?php 	break;
default : ?> <span class="bill_text2"> <?php if (empty($facture['USER_MODEPAIEMENT_LABEL'])) { ?>
Mode de reglement : <?php 
switch ($facture['USER_MODEPAIEMENT']) {
	case 1 : echo " Paiement s�curis� en ligne"; break;
	case 2 : echo " Contre remboursement";break;
	case 3 : echo " Paiement diff�r� - 30 jours";break;
	case 4 : echo " Paiement diff�r� - 45 jours";break;
	case 5 : echo " Paiement diff�r� - 60 jours";break;
	case 6 : echo " A r�ception de la facture";break;
}
} else {
	echo $facture['USER_MODEPAIEMENT_LABEL'];
} ?> </span> <?php
break;
} ?></div>
<div class="bill_detail">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr align="right">
		<td class="bill_line2">Total HT</td>
		<td class="bill_line2"><?php echo number_format($facture['PRIXTOTALHTHR'], 2, ',', ' '); ?>
		&#8364;</td>
	</tr>
	<tr align="right">
		<td class="bill_line2">Remise <?php if (isset($facture['CODEREDUCTION']) && !empty($facture['CODEREDUCTION']) ) { echo " ( ".$facture['CODEREDUCTION']." ) "; } ?></td>
		<td class="bill_line2"><?php echo number_format($facture['PRIXREMISEEUR'], 2, ',', ' '); ?>
		&#8364;</td>
	</tr>
	<tr align="right">
		<td class="bill_line2"><?php if (isset($facture['LIV_NOM']) && !empty($facture['LIV_NOM']) ) { echo 'Livraison en '.$facture['LIV_NOM']; } else { echo 'Frais de port'; } ?></td>
		<td class="bill_line2"><?php echo number_format($facture['PRIXFRAISPORT'], 2, ',', ' '); ?>
		&#8364;</td>
	</tr>
	<tr>
		<td colspan="2" height="1px" style="background-color: #868686"></td>
	</tr>
	<tr align="right">
		<td class="bill_text2">Net HT</td>
		<td class="bill_text2"><?php echo number_format($facture['PRIXTOTALHTFP'], 2, ',', ' '); ?>
		&#8364;</td>
	</tr>
	<tr align="right">
		<td class="bill_line2">Total TVA</td>
		<td class="bill_line2"><?php echo number_format($facture['PRIXTOTALTVA'], 2, ',', ' '); ?>
		&#8364;</td>
	</tr>
	<tr>
		<td colspan="2" height="1px" style="background-color: #868686"></td>
	</tr>
	<tr align="right">
		<td class="bill_text2">NET A PAYER TTC</td>
		<td class="bill_text2"><?php echo number_format($facture['PRIXTOTALTTC'], 2, ',', ' '); ?>
		&#8364;</td>
	</tr>
</table>
</div>
</div>


<div class="bill_footer"><span class="link18"> <input type="checkbox"
	checked="checked" disabled="disabled" /> J'ai pris connaissance des
Conditions G�n�rales de Vente et les accepte sans r�serves. </span> <br />
<br />
<span class="bill_text3"> P�nalit�s de retard (taux annuel) : 9,00% </span><br>
<span class="bill_text3"> <b>RESERVE DE PROPRIETE</b> : Nous nous
r�servons la propri�t� des marchandises jusqu'au paiement du prix par
l'acheteur. Notre droit de revendication porte aussi bien sur les
marchandises que sur leur prix si elles ont d�j� �t� revendues (Loi du
12 mai 1980). </span><br>
<br>
</div>

<div class="bill_footer2"><span class="bill_text3"> <?php echo $this->site_addresse; ?>
</span><br>
<span class="bill_text3"> <?php echo $this->site_actualshort; ?> </span>
</div>
</div>
modules/backoffice/views/scripts/command/listdevis.phtml000060400000012347150710367660017624 0ustar00
<div class="table-box">
<div class="col-md-12 header-single-line">
	<div class="col-md-5 header-single no-space-top"><?php echo $this->titlePage; ?></div>
	<div class="col-md-7 no-space-top"><?php echo $this->render("alert.phtml"); ?></div>
</div>
<table class="display table" id="commandTable" width="100%">
	<thead>
		<tr>
			<th class="text-center">
				<form action="<?php echo $this->baseUrl; ?>/backoffice/command/archivedevis/" method="POST" id="archiveForm" >
					<div>
						<a class="btn btn-success" href="#" onclick="javascript:submitArchive();">Archiver</a>
					</div>
					<div>
						<input type="hidden" name="checkBoxValues" id="checkBoxValues" value="">
					</div>
				</form>
			</th>
			<th class="text-center">R�f�rence</th>
			<th class="no-wrap">Mode de reglement</th>
			<th class="no-wrap">Prix TTC</th>
			<th>Statut</th>
			<th class="text-center">Client</th>
			<th class="no-wrap">Date de la commande</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
		<?php foreach($this->listcommand as $row) { ?> 
		<tr>
			<td class="text-center"><input type="checkbox"  class="bluecheckradios" name="archiveCommand" value="<?php echo $row->ID; ?>"></td>
			<td > <a class="btn btn-primary"  href="<?php echo $this->baseUrl; ?>/backoffice/command/edit/id/<?php echo $row->ID; ?>"><span class="glyphicon glyphicon-list-alt"></span>&nbsp;<?php echo $this->escape($row->REFERENCE);?></a></td>
			<td >
			<?php 
			switch ($row->USER_MODEPAIEMENT_TYPE) {
					case 1 : echo "Par ch�que"; break;
					case 2 : echo "Par virement"; break; 
					default :
						switch ($row->USER_MODEPAIEMENT) {
							case 1 : echo " Paiement en ligne"; break;
							case 2 : echo " Contre remboursement";break;
							case 3 : echo " Paiement diff�r� - 30 jours";break;
							case 4 : echo " Paiement diff�r� - 45 jours";break;
							case 5 : echo " Paiement diff�r� - 60 jours";break;
							case 6 : echo " A r�ception de la facture ";break;
						}
						break;
			} ?>
			</td>
			<td ><?php echo sprintf("%.2f",$this->escape($row->PRIXTOTALTTC)).'&nbsp;&#8364;';?></td>
			<td >
			<?php 
				switch ($this->escape($row->STATUT)) {
					case 1 : echo 'Commande - En attente'; break;
					case 2 : echo 'Commande - En livraison'; break;
					case 3 : echo 'Commande - Termin�e'; break;
					case 4 : echo 'Commande - En traitement'; break;
					case 10 : echo 'Devis - En attente'; break;
					case 11 : echo 'Devis - Termin�'; break;
				}
			?>
			</td>
			<td ><a class="btn btn-primary " href="<?php echo $this->baseUrl; ?>/backoffice/user/edit/id/<?php echo $row->IDUSER; ?>" ><span class="glyphicon glyphicon-user"></span>&nbsp;<?php echo $row->USER_NOM.' '.$row->USER_PRENOM;?></a></td>
			<td ><?php 
			$myDate = new Zend_Date(strtotime($row->DATESTART));
			$mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
			$moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
			echo $myDate->toString("dd").' '.$mois[(int)$myDate->toString('MM')].' '.$myDate->toString("YYYY");
				
			?></td>
			
			<td  class="text-center">
				<div class="btn-group">
		        	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/command/edit/id/<?php echo $row->ID; ?>"><span class="glyphicon glyphicon-edit"></span> Modifier</a>
					<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/command/deldevis/id/<?php echo $row->ID; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>			
	$(document).ready(function() {
		initDataTable('commandTable', [[ 1, "asc" ]], [{ "orderable": false, "targets": 0}, { "orderable": false, "targets": -1, "width": "270px" }]); 	    
	});

	function submitArchive() {
		var elms = $("input[name=archiveCommand]:checked");
		$("#checkBoxValues").val("");
	 	
		var commandeValue = "devis";
		var data = "";
		var totalCommand = 0;
		elms.each(function( index ) {
			data += $(this).val()+",";
			totalCommand++;
		});
		
		if (totalCommand > 1) {
			commandeValue = "devis";
		}

	 	if (totalCommand > 0) {
			$("#ajaxModalArchive").remove();
		 	$("#checkBoxValues").val(data);
	        var $labelHeader = "Confirmation d'archivage", $labelBody = "Vous etes sur le point d'archiver "+totalCommand+" "+commandeValue+", voulez vous continuer ? ";
	        var $modal = $('<div id="ajaxModalArchive" class="modal fade" role="dialog" aria-labelledby="myModalLabel" ><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal">&times;</button><h4 class="modal-title">'+$labelHeader+'</h4></div><div class="modal-body">'+$labelBody+'</div><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button><button type="button" class="btn btn-success" id="modalBtnDelete">Archiver</button></div></div></div></div>');
	        $('body').append($modal);
	        $('#ajaxModalArchive').modal({backdrop: 'static', keyboard: false});
	        $("#modalBtnDelete").on('click', function(e) {
	        	document.forms["archiveForm"].submit();
	        });
		}
	}
</script>
</div>modules/backoffice/views/scripts/command/listcommand.phtml000060400000012372150710367660020126 0ustar00
<div class="table-box">
<div class="col-md-12 header-single-line">
	<div class="col-md-5 header-single no-space-top"><?php echo $this->titlePage; ?></div>
	<div class="col-md-7 no-space-top"><?php echo $this->render("alert.phtml"); ?></div>
</div>
<table class="display table" id="commandTable" width="100%">
	<thead>
		<tr>
			<th class="text-center">
				<form action="<?php echo $this->baseUrl; ?>/backoffice/command/archivecommand/" method="POST" id="archiveForm" >
					<div>
						<a class="btn btn-success" href="#" onclick="javascript:submitArchive();">Archiver</a>
					</div>
					<div>
						<input type="hidden" name="checkBoxValues" id="checkBoxValues" value="">
					</div>
				</form>
			</th>
			<th class="text-center">R�f�rence</th>
			<th class="no-wrap">Mode de reglement</th>
			<th class="no-wrap">Prix TTC</th>
			<th>Statut</th>
			<th class="text-center">Client</th>
			<th class="no-wrap">Date de la commande</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
		<?php foreach($this->listcommand as $row) { ?> 
		<tr>
			<td class="text-center"><input type="checkbox"  class="bluecheckradios" name="archiveCommand" value="<?php echo $row->ID; ?>"></td>
			<td > <a class="btn btn-primary"  href="<?php echo $this->baseUrl; ?>/backoffice/command/edit/id/<?php echo $row->ID; ?>"><span class="glyphicon glyphicon-list-alt"></span>&nbsp;<?php echo $this->escape($row->REFERENCE);?></a></td>
			<td >
			<?php 
			switch ($row->USER_MODEPAIEMENT_TYPE) {
					case 1 : echo "Par ch�que"; break;
					case 2 : echo "Par virement"; break; 
					default :
						switch ($row->USER_MODEPAIEMENT) {
							case 1 : echo " Paiement en ligne"; break;
							case 2 : echo " Contre remboursement";break;
							case 3 : echo " Paiement diff�r� - 30 jours";break;
							case 4 : echo " Paiement diff�r� - 45 jours";break;
							case 5 : echo " Paiement diff�r� - 60 jours";break;
							case 6 : echo " A r�ception de la facture ";break;
						}
						break;
			} ?>
			</td>
			<td ><?php echo sprintf("%.2f",$this->escape($row->PRIXTOTALTTC)).'&nbsp;&#8364;';?></td>
			<td >
			<?php 
				switch ($this->escape($row->STATUT)) {
					case 1 : echo 'Commande - En attente'; break;
					case 2 : echo 'Commande - En livraison'; break;
					case 3 : echo 'Commande - Termin�e'; break;
					case 4 : echo 'Commande - En traitement'; break;
					case 10 : echo 'Devis - En attente'; break;
					case 11 : echo 'Devis - Termin�'; break;
				}
			?>
			</td>
			<td ><a class="btn btn-primary " href="<?php echo $this->baseUrl; ?>/backoffice/user/edit/id/<?php echo $row->IDUSER; ?>" ><span class="glyphicon glyphicon-user"></span>&nbsp;<?php echo $row->USER_NOM.' '.$row->USER_PRENOM;?></a></td>
			<td ><?php 
			$myDate = new Zend_Date(strtotime($row->DATESTART));
			$mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
			$moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
			echo $myDate->toString("dd").' '.$mois[(int)$myDate->toString('MM')].' '.$myDate->toString("YYYY");
				
			?></td>
			
			<td  class="text-center">
				<div class="btn-group">
		       	 	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/command/edit/id/<?php echo $row->ID; ?>"><span class="glyphicon glyphicon-edit"></span> Modifier</a>
		        	<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/command/delcommand/id/<?php echo $row->ID; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>			
	$(document).ready(function() {
		initDataTable('commandTable', [[ 1, "asc" ]], [{ "orderable": false, "targets": 0}, { "orderable": false, "targets": -1, "width": "270px" }]); 	    
	});

	function submitArchive() {
		var elms = $("input[name=archiveCommand]:checked");
		$("#checkBoxValues").val("");
	 	
		var commandeValue = "commande";
		var data = "";
		var totalCommand = 0;
		elms.each(function( index ) {
			data += $(this).val()+",";
			totalCommand++;
		});
		
		if (totalCommand > 1) {
			commandeValue = "commandes";
		}

	 	if (totalCommand > 0) {
			$("#ajaxModalArchive").remove();
		 	$("#checkBoxValues").val(data);
	        var $labelHeader = "Confirmation d'archivage", $labelBody = "Vous etes sur le point d'archiver "+totalCommand+" "+commandeValue+", voulez vous continuer ? ";
	        var $modal = $('<div id="ajaxModalArchive" class="modal fade" role="dialog" aria-labelledby="myModalLabel" ><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal">&times;</button><h4 class="modal-title">'+$labelHeader+'</h4></div><div class="modal-body">'+$labelBody+'</div><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button><button type="button" class="btn btn-success" id="modalBtnDelete">Archiver</button></div></div></div></div>');
	        $('body').append($modal);
	        $('#ajaxModalArchive').modal({backdrop: 'static', keyboard: false});
	        $("#modalBtnDelete").on('click', function(e) {
	        	document.forms["archiveForm"].submit();
	        });
		}
	}
</script>
</div>
modules/backoffice/views/scripts/command/search.phtml000060400000007525150710367660017065 0ustar00
<div class="table-box">
	<form method="POST" action="<?php echo $this->baseUrl; ?>/backoffice/command/search">
	<table class="table">
		<thead>
			<tr>
				<th class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td class="col-md-12">
					<div class="col-md-7">
						<input type="text" value="<?php echo $this->searchValue; ?>" id="searchValue" name="searchValue" class="form-control" placeholder="Votre recherche : r�f�rence, nom, pr�nom ou email du client">
					</div>
					<div class="col-md-2">	
						<div class="custom-radio-checkbox">
							<input tabindex="1" type="checkbox" class="bluecheckradios" id="searchType" name="searchType" <?php if ($this->searchType) { echo 'checked="checked"';}?>>
							<label for="searchType">En cours de validation...</label>
						</div> 						
					</div>
					<div class="col-md-1 col-md-offset-1">
						<button type="submit" name="search"  class="btn btn-primary">
						  <span class="glyphicon glyphicon-search"></span> Rechercher
						</button>				
					</div>
					<div class="col-md-12"></div>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>

<div class="table-box">
<table class="display table" id="commandSearchTable" width="100%">
	<thead>
		<tr>
			<th></th>
			<th class="text-center">R�f�rence</th>
			<th class="no-wrap">Prix TTC</th>
			<th>Statut</th>
			<th class="text-center">Client</th>
			<th class="no-wrap">Date de la commande</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
		<?php foreach($this->listcommand as $row) { ?> 
		<tr>
			<td><?php if ($row['isARCHIVE'] == 0) { echo 'Archiv�'; } ?> </td>
			<td > <a class="btn btn-primary"  href="<?php echo $this->baseUrl; ?>/backoffice/command/edit/id/<?php echo $row['ID']; ?>"><span class="glyphicon glyphicon-list-alt"></span>&nbsp;<?php echo $this->escape($row['REFERENCE']);?></a></td>
			<td ><?php echo sprintf("%.2f",$this->escape($row['PRIXTOTALTTC'])).'&nbsp;&#8364;';?></td>
			<td >
			<?php 
				switch ($this->escape($row['STATUT'])) {
					case 1 : echo 'Commande - En attente'; break;
					case 2 : echo 'Commande - En livraison'; break;
					case 3 : echo 'Commande - Termin�e'; break;
					case 4 : echo 'Commande - En traitement'; break;
					case 10 : echo 'Devis - En attente'; break;
					case 11 : echo 'Devis - Termin�'; break;
				}
			?>
			</td>
			<td ><a class="btn btn-primary " href="<?php echo $this->baseUrl; ?>/backoffice/user/edit/id/<?php echo $row['IDUSER']; ?>" ><span class="glyphicon glyphicon-user"></span>&nbsp;<?php echo $row['USER_NOM'].' '.$row['USER_PRENOM'];?></a></td>
			<td ><?php 
			$myDate = new Zend_Date(strtotime($row['DATESTART']));
			$mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
			$moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
			echo $myDate->toString("dd").' '.$mois[(int)$myDate->toString('MM')].' '.$myDate->toString("YYYY");
				
			?></td>
			
			<td class="text-center">
				<div class="btn-group">
		        	<a class="btn btn-success" target="_blank" href="<?php echo $this->baseUrl; ?>/backoffice/command/edit/id/<?php echo $row['ID']; ?>"><span class="glyphicon glyphicon-edit"></span> Modifier</a>
		        	<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/command/del/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
</div>

<script type="text/javascript">
$(document).ready(function(){
	initCheckbox('.bluecheckradios');
	initDataTable('commandSearchTable', [[ 1, "asc" ]], [{ "orderable": false, "targets": 0}, { "orderable": false, "targets": -1, "width": "270px" }]);     
	
});
</script>modules/backoffice/views/scripts/command/facture_traitementinprogress.phtml000060400000001304150710367660023606 0ustar00<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
$facture = $this->facture;
?>
Bonjour,<br /><br />
Votre commande est en cours de traitement.<br /><br />
Elle sera transmise � notre plateforme logistique d�s validation de votre r�glement par notre Service Clients.<br /><br />
<b>SUIVI DE COMMANDE :</b><br /><br />
Le suivi de commande sera assur� par courriel.<br />
Vous pourrez �galement obtenir des informations en vous connectant � votre compte client.
</body>
</html>

modules/backoffice/views/scripts/annoncecms/edit.phtml000060400000014216150710367660017246 0ustar00 
 <div class="table-box">
	<form action="<?php echo $this->baseUrl; ?>/backoffice/annoncecms/edit" method="post" name="editAnnonceForm" >
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Statut</td>
				<td class="col-md-8">
					<input type="radio" value="0" name="isshow" id="isshow1" class="bluecheckradios" <?php if ($this->populateFormAnnonceCms['isSHOW'] == 0) { echo 'checked="checked"';} ?>><label for="isshow1">&nbsp;Actif</label>
					<input type="radio" value="1" name="isshow" id="isshow2" class="bluecheckradios" <?php if ($this->populateFormAnnonceCms['isSHOW'] == 1) { echo 'checked="checked"';} ?>><label for="isshow2">&nbsp;Inactif</label>
			
				</td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Position</td>
				<td class="col-md-8"><input type="text" name="position" size="40" class="form-control"  placeholder="Position de l'article" id="position" value="<?php echo $this->populateFormAnnonceCms['POSITION']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Titre</td>
				<td class="col-md-8"><input type="text" name="nom" size="40" class="form-control"  placeholder="Titre non visible" id="nom" value="<?php echo $this->populateFormAnnonceCms['NOM']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-4">Cat�gorie</td>
				<td class="col-md-8">
					<?php $tabController = explode(':',$this->populateFormAnnonceCms['ID_CATS']);  ?>
					<select class="form-control" size="15" name="categories[]" id="categories" multiple="multiple">
						<?php 
						$show = array();
						foreach($this->listallcategories as $row) { 
						 	for ($level=0 ; $level<11; $level++) { 
								if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
								?>
									<option value="<?php echo $this->escape($row['ID'.$level]); ?>" <?php if (in_array($row['ID'.$level], $tabController)) {echo 'selected="selected"';} ?>>
										<?php 
						 				for ($i=0 ; $i<$level; $i++) { 
											echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
										}
										echo $row['NOM'.$level]; ?>
									
									</option>
									<?php 
									$show['NOM'.$level] = $row['NOM'.$level];
								}
							 } 
						} ?>
					</select>
				</td>
			</tr>
			<tr >
				<td class="col-md-12" colspan="2">&nbsp;Contenu</td>
			</tr>
			<tr > 
				<td class="col-md-12" colspan="2">
					<div class="col-md-6 no-space-top" >
						<input type="text" name="content_short" size="40" class="form-control"  placeholder="Titre de l'article" id="content_short" value="<?php echo $this->populateFormAnnonceCms['CONTENT_SHORT']; ?>" />
					</div>
					<div class="col-md-6 no-space-top" >
						<input type="text" name="content_long" size="40" class="form-control"  placeholder="Sous-titre de l'article" id="content_long" value="<?php echo $this->populateFormAnnonceCms['CONTENT_LONG']; ?>" />
					</div>
				</td>
			</tr>
			<tr >
				<td class="col-md-6 text-center" colspan="2">
					<button id="pickImageFromGallery" class="btn btn-info">S�lectionner une image depuis la gallerie</button>
					<div id="pickImageFromGalleryContent" style="display:none"></div>
				</td>
			</tr>
			<tr > 
				<td class="col-md-12" colspan="2">  
					<textarea  name="content" cols="130" rows="20" id="annonceContent" name="annonceContent">
					<?php if (isset($this->populateFormAnnonceCms['CONTENT']) && !empty($this->populateFormAnnonceCms['CONTENT'])) { 
						 echo $this->populateFormAnnonceCms['CONTENT']; 
					} ?>					
					</textarea>
				</td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<input type="hidden" name="id" value="<?php echo $this->populateFormAnnonceCms['ID'];?>">
					<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
$(function(){
	tinymce.init({
	  selector: 'textarea',
	  height: 500, 
	  convert_urls: false,
	  theme: 'modern',
	  skin: "lightgraygradient",
	  language: 'fr_FR',
	  plugins: [
		'advlist autolink lists link image charmap print preview hr anchor pagebreak',
		'searchreplace wordcount visualblocks visualchars code fullscreen',
		'insertdatetime media nonbreaking save table contextmenu directionality',
		'emoticons template paste textcolor colorpicker textpattern imagetools jbimages'
	  ],
	  toolbar1: 'insertfile undo redo | styleselect fontselect | bold italic forecolor backcolor emoticons | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image jbimages template | print preview media',
	  image_advtab: true,
	  relative_urls: false,
	  templates: <?php echo $this->FeatureTinymceTemplate; ?>,
	  content_css: '<?php echo $this->FeatureTinymceCss; ?>',
	   font_formats: 'DEFAUT(Aref Ruqaa)=ArefRuqaaReg;'+'DEFAUT 2 (Poiret One)=PoiretOne;'+'Andale Mono=andale mono,times;'+ 'Arial=arial,helvetica,sans-serif;'+ 'Arial Black=arial black,avant garde;'+ 'Book Antiqua=book antiqua,palatino;'+ 'Comic Sans MS=comic sans ms,sans-serif;'+ 'Courier New=courier new,courier;'+ 'Georgia=georgia,palatino;'+ 'Helvetica=helvetica;'+ 'Impact=impact,chicago;'+ 'Symbol=symbol;'+ 'Tahoma=tahoma,arial,helvetica,sans-serif;'+ 'Terminal=terminal,monaco;'+ 'Times New Roman=times new roman,times;'+ 'Trebuchet MS=trebuchet ms,geneva;'+ 'Verdana=verdana,geneva;'+ 'Webdings=webdings;'+ 'Wingdings=wingdings,zapf dingbats'
	});
	$( "#pickImageFromGallery" ).click(function(){
		$( "#pickImageFromGalleryContent" ).toggle();
		if($('#pickImageFromGalleryContent').css('display') == 'block') {
			$.ajax( {
				type : "GET",
				async : true,
				url : '/backoffice/annoncegallery/ajaxshowallpicture',  
				contentType:"application/x-www-form-urlencoded; charset=iso-8859-1",
				success : function(data) {  
					$('#pickImageFromGalleryContent').html(data); 
				}});
		}
			
		return false;		
	});
});

</script>
modules/backoffice/views/scripts/annoncecms/list.phtml000060400000002115150710367660017267 0ustar00 
 <div class="table-box">
<table class="display table" id="annoncecmsTable" width="100%">
	<thead>
		<tr>
			<th>Titre</th> 
			<th>Statut</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	
		<?php foreach($this->listAnnoncecms as $row)  { ?>
		<tr>
			<td><?php echo $row['NOM'];?></td> 
			<td><?php if ($this->escape($row['isSHOW'])==0) {echo 'Actif';} else {echo 'Inactif';} ?></td>
			<td>
				<div class="btn-group">
	             	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/annoncecms/edit/id/<?php echo $row['ID']; ?>"><span class="glyphicon glyphicon-edit"></span> Modifier</a>
					<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/annoncecms/del/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>			
	$(document).ready(function() {
		initDataTable('annoncecmsTable', [[ 0, "asc" ]], [{ "orderable": false, "targets": -1, "width": "270px" }]); 	    
	});
</script>
</div>
modules/backoffice/views/scripts/annoncecms/add.phtml000060400000012627150710367660017055 0ustar00 
 <div class="table-box">
	<form action="<?php echo $this->baseUrl; ?>/backoffice/annoncecms/add" method="post" name="addAnnonceForm" >
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Statut</td>
				<td class="col-md-8">
					<input type="radio" value="0" name="isshow" id="isshow1" class="bluecheckradios" <?php if ($this->populateFormAnnonceCms['isSHOW'] == 0) { echo 'checked="checked"';} ?>><label for="isshow1">&nbsp;Actif</label>
					<input type="radio" value="1" name="isshow" id="isshow2" class="bluecheckradios" <?php if ($this->populateFormAnnonceCms['isSHOW'] == 1) { echo 'checked="checked"';} ?>><label for="isshow2">&nbsp;Inactif</label>
			
				</td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Position</td>
				<td class="col-md-8"><input type="text" name="position" size="40" class="form-control"  placeholder="Position de l'article" id="position" value="<?php echo $this->populateFormAnnonceCms['POSITION']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Titre</td>
				<td class="col-md-8"><input type="text" name="nom" size="40" class="form-control"  placeholder="Titre non visible" id="nom" value="<?php echo $this->populateFormAnnonceCms['NOM']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-4">Cat�gorie</td>
				<td class="col-md-8">
					<?php $tabController = explode(':',$this->populateFormAnnonceCms['ID_CATS']);  ?>
					<select class="form-control" size="15" name="categories[]" id="categories" multiple="multiple">
						<?php 
						$show = array();
						foreach($this->listallcategories as $row) { 
						 	for ($level=0 ; $level<11; $level++) { 
								if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
								?>
									<option value="<?php echo $this->escape($row['ID'.$level]); ?>" <?php if (in_array($row['ID'.$level], $tabController)) {echo 'selected="selected"';} ?>>
										<?php 
						 				for ($i=0 ; $i<$level; $i++) { 
											echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
										}
										echo $row['NOM'.$level]; ?>
									
									</option>
									<?php 
									$show['NOM'.$level] = $row['NOM'.$level];
								}
							 } 
						} ?>
					</select>
				</td>
			</tr>
			<tr >
				<td class="col-md-12" colspan="2">&nbsp;Contenu</td>
			</tr>
			<tr > 
				<td class="col-md-12" colspan="2">
					<div class="col-md-6 no-space-top" >
						<input type="text" name="content_short" size="40" class="form-control"  placeholder="Titre de l'article" id="content_short" value="<?php echo $this->populateFormAnnonceCms['CONTENT_SHORT']; ?>" />
					</div>
					<div class="col-md-6 no-space-top" >
						<input type="text" name="content_long" size="40" class="form-control"  placeholder="Sous-titre de l'article" id="content_long" value="<?php echo $this->populateFormAnnonceCms['CONTENT_LONG']; ?>" />
					</div>
				</td>
			</tr> 
			<tr >
				<td class="col-md-6 text-center" colspan="2">
					<button id="pickImageFromGallery" class="btn btn-info">S�lectionner une image depuis la gallerie</button>
					<div id="pickImageFromGalleryContent" style="display:none"></div>
				</td>
			</tr>
			<tr > 
				<td class="col-md-12" colspan="2">  
					<textarea  name="content" cols="130" rows="20" id="annonceContent" name="annonceContent">
					<?php if (isset($this->populateFormAnnonceCms['CONTENT']) && !empty($this->populateFormAnnonceCms['CONTENT'])) { 
						 echo $this->populateFormAnnonceCms['CONTENT']; 
					} ?>					
					</textarea>
				</td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
$(function(){
	tinymce.init({
	  selector: 'textarea',
	  height: 500, 
	  convert_urls: false,
	  theme: 'modern',
	  skin: "lightgraygradient",
	  language: 'fr_FR',
	  plugins: [
		'advlist autolink lists link image charmap print preview hr anchor pagebreak',
		'searchreplace wordcount visualblocks visualchars code fullscreen',
		'insertdatetime media nonbreaking save table contextmenu directionality',
		'emoticons template paste textcolor colorpicker textpattern imagetools jbimages'
	  ],
	  toolbar1: 'insertfile undo redo | styleselect | bold italic forecolor backcolor emoticons | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image jbimages template | print preview media',
	  image_advtab: true,
	  relative_urls: false,
	  templates: <?php echo $this->FeatureTinymceTemplate; ?>,
	  content_css: '<?php echo $this->FeatureTinymceCss; ?>'
	 });
		
	$( "#pickImageFromGallery" ).click(function(){
		$( "#pickImageFromGalleryContent" ).toggle();
		if($('#pickImageFromGalleryContent').css('display') == 'block') {
			$.ajax( {
				type : "GET",
				async : true,
				url : '/backoffice/annoncegallery/ajaxshowallpicture',  
				contentType:"application/x-www-form-urlencoded; charset=iso-8859-1",
				success : function(data) {  
					$('#pickImageFromGalleryContent').html(data); 
				}});
		}
			
		return false;		
	});
});
</script>
modules/backoffice/views/scripts/supplier/list.phtml000060400000003762150710367660017017 0ustar00<div class="table-box">
<div class="col-md-12 header-single-line">
	<div class="col-md-5 header-single no-space-top"><?php echo $this->titlePage; ?></div>
	<div class="col-md-7 no-space-top"><?php echo $this->render("alert.phtml"); ?></div>
</div>
<table class="display table" id="supplierTable" width="100%">
	<thead>
		<tr>
			<th></th>
			<th>Entreprise</th>
			<th>Nom</th>
			<th>Pr�nom</th>
			<th>Email</th>
			<th>Tel</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	
		<?php foreach($this->listsupplier as $row)  { ?>
		<tr>
			<td>
				<ul class="gallerybox">
                	<li>
						<figure>
							<a href="<?php echo $this->baseUrl; ?>/backoffice/supplier/edit/id/<?php echo $row['ID']; ?>"><img src="<?php if (isset($row['URL'])) { echo '/'.$this->escape($row['URL']); } else {echo '/items/product/default/default.png'; } ?>"></a>
						</figure>
					</li>
				</ul>
			</td>
			<td><?php echo $this->escape($row['COMPANY']);?></td>
			<td><?php echo $this->escape($row['NOM']);?></td>
			<td><?php echo $this->escape($row['PRENOM']);?></td>
			<td><?php echo $this->escape($row['EMAIL']);?></td>
			<td><?php echo $this->escape($row['TEL']);?></td>
			<td>
				<div class="btn-group">
	             	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/supplier/edit/id/<?php echo $row['ID']; ?>"><span class="glyphicon glyphicon-edit"></span> Modifier</a>
					<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/supplier/del/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>			
	$(document).ready(function() {
		initDataTable('supplierTable', [[ 1, "asc" ]], [
			                    		                { "orderable": false, "targets": 0},
		                    		                { "orderable": false, "targets": -1, "width": "270px" }
		                    		              ]); 	    
	});
</script>
</div>modules/backoffice/views/scripts/supplier/edit.phtml000060400000025473150710367660016774 0ustar00
<div class="table-box">	
	<div class="col-md-12 no-space-side">
		<div class="tabs-section ">
			<ul class="nav nav-tabs" id="myTab">
				<li class="active"><a href="#tabs-supplier" data-toggle="tab">Fournisseur</a></li>
				<li><a href="#tabs-brend" data-toggle="tab">Marques</a></li>
			</ul>
			<div class="tab-content">
				<div class="tab-pane active" id="tabs-supplier">
					<section class 	="boxpadding">
						<?php $formSupplier = $this->populateFormSupplier; ?>
						<form action="<?php echo $this->baseUrl; ?>/backoffice/supplier/edit#tabs-supplier" method="post" name="editSupplierForm" enctype="multipart/form-data" >
						<table class="table">
							<?php echo $this->render("alert_tr.phtml"); ?>							
							<tr >
								<td class="col-md-4">
									<i class="glyphicon glyphicon-asterisk"></i>&nbsp;<label for="company">Nom de l'entreprise</label>
								</td>
								<td class="col-md-8">
									<input type="text" class="form-control" name="company" id="company" value="<?php echo $formSupplier['COMPANY']; ?>"/>
								</td>
							</tr>
              <tr >
                <td class="col-md-4">
                  <label for="descshort">Description courte</label>
                </td>
                <td class="col-md-8">
                  <input type="text" class="form-control" name="descshort" id="descshort" value="<?php echo $formSupplier['DESCRIPTIONSHORT']; ?>"/>
                </td>
              </tr>
              <tr >
                <td class="col-md-4">
                  <label for="desclong">Description longue</label>
                </td>
                <td class="col-md-8">
                  <textarea class="form-control"  rows="10" cols="50" name="desclong" id="desclong"><?php echo $formSupplier['DESCRIPTIONLONG'];?></textarea>
                </td>
              </tr>
							<tr><td colspan="2"><h5>Responsable</h5></td></tr>
							<tr >
								<td >
									<i class="glyphicon glyphicon-asterisk"></i>&nbsp;<label for="nom">Nom</label>
								</td>
								<td>
									<input type="text" class="form-control" name="nom" id="nom" value="<?php echo $formSupplier['NOM']; ?>"/>
								</td>
							</tr>
							<tr >
								<td>
									<i class="glyphicon glyphicon-asterisk"></i>&nbsp;<label for="prenom">Pr�nom</label>
								</td>
								<td>
									<input type="text" class="form-control" name="prenom" id="prenom" value="<?php echo $formSupplier['PRENOM']; ?>"/>
								</td>
							</tr>
							<tr >
								<td>
									<i class="glyphicon glyphicon-asterisk"></i>&nbsp;<label for="email">Email</label>
								</td>
								<td>
									<input type="text" class="form-control" name="email" id="email" value="<?php echo $formSupplier['EMAIL']; ?>"/>
								</td>
							</tr>
							<tr >
								<td>
									<label for="tel">Telephone</label>
								</td>
								<td>
									<input type="text" class="form-control" name="tel" id="tel" value="<?php echo $formSupplier['TEL']; ?>"/>
								</td>
							</tr>
							<tr >
								<td>
									<label for="fax">Fax</label>
								</td>
								<td>
									<input type="text" class="form-control" name="fax" id="fax" value="<?php echo $formSupplier['FAX']; ?>"/>
								</td>
							</tr>
							<tr >
								<td>
									<label for="address">Adresse</label>
								</td>
								<td>
									<input type="text" class="form-control" name="address" id="address" value="<?php echo $formSupplier['ADDRESSE']; ?>"/>
								</td>
							</tr>
							<tr >
								<td>
									<label for="cp">Code Postal</label>
								</td>
								<td>
									<input type="text" class="form-control" name="cp" id="cp" value="<?php echo $formSupplier['CP']; ?>"/>
								</td>
							</tr>
							<tr >
								<td>
									<label for="ville">Ville</label>
								</td>
								<td>
									<input type="text" class="form-control" name="ville" id="ville" value="<?php echo $formSupplier['VILLE']; ?>"/>
								</td>
							</tr>
							<tr >
								<td width="200px">
									<label for="picture">Image du fournisseur</label>
									<div class="col-md-12 text-center no-space-top">
										<ul class="gallerybox ">
										  	<li>
												<figure>
													<img src="<?php echo '/'.$formSupplier['URL'];?>" />
												</figure>
											</li>
										</ul>
									</div>
								</td>
								<td>
									<input type="file" name="picture" id="picture" size="50"/>
									<br/>
									<i>Extensions : jpg, gif, png</i>
								</td>
							</tr>
							<tr>
								<td align="center" colspan="2">
									<input type="hidden" class="input4" name="id" id="id" value="<?php echo $formSupplier['ID']; ?>">
									<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
								</td>
							</tr>
						</table>
					</form> 
					</section>
				</div>
				<div class="tab-pane" id="tabs-brend">
					<section class 	="boxpadding">
						<?php  $formBrends = $this->populateFormBrend; ?>
						<table class="table" >
							<?php echo $this->render("alert_tr.phtml"); ?>
							<tr >
								<td colspan="2">
									<form action="<?php echo $this->baseUrl; ?>/backoffice/supplier/addbrend#tabs-brend" method="post" name="addBrendForm" enctype="multipart/form-data" >
										<table  class="table" >
											<tr  >
												<td><h5>Ajouter une marque</h5></td>
												<td>
													<label for="brend">Nom : </label>
												</td>
												<td>
													<label><input placeholder="Marque du fournisseur" class="form-control" type="text" name="brend" id="brend" size="20"> </label>
												</td>
												<td>
													<input type="file" name="picture" id="picture" size="50"/><br>
													<i>Extensions : jpg, gif, png</i>
												</td>
												<td>
													<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
													<input type="hidden" name="id" id="id" value="<?php echo $formSupplier['ID']; ?>" >
												</td>
											</tr>
										</table>
									</form>
								</td>
							</tr>
							<tr >
								<td colspan="2">
									<?php 
									foreach($formBrends as $brend) { 
									?>
									<div class="col-md-3 no-space-top">
										<form action="<?php echo $this->baseUrl; ?>/backoffice/supplier/editbrend#tabs-brend" method="post" name="editBrendForm" >
										<div class="col-md-12 text-center  no-space-top">
											<ul class="gallerybox ">
											  	<li>
													<figure>
														<img src="<?php echo $this->baseUrl.'/'.$brend['URL'];?>" />
													</figure>
												</li>
											</ul>
										</div>
										<div class="col-md-12 no-space-top">
											<input class="form-control" type="text" name="brend" value="<?php echo $brend['BREND']; ?>"/>
										</div>
										<div class="col-md-12 no-space-top">
											 <select name="isshowbrendpage" class="form-control">
										            <option value="1" <?php if ($brend['IS_SHOW_BREND_PAGE'] == true) { echo 'selected="selected"';} ?>>Afficher sur la page des marques</option>
										            <option value="0" <?php if ($brend['IS_SHOW_BREND_PAGE'] == false) { echo 'selected="selected"';} ?>>Ne pas afficher sur la page des marques</option>
                                                </select>
										</div>
										<div class="col-md-6 text-right">
											<button class="btn btn-success " type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
											<input type="hidden" name="idBrend" value="<?php echo $brend['ID']; ?>" >
											<input type="hidden" name="id" value="<?php echo $formSupplier['ID']; ?>" >
										</div>
										</form>	
																				
										<form action="<?php echo $this->baseUrl; ?>/backoffice/supplier/delbrend#tabs-brend" method="post" >
										<div class="col-md-6 text-left">
											<button class="btn btn-danger" type="submit" name="edit"><span class="glyphicon glyphicon-resize-full"></span> D�lier</button>
											<input type="hidden" name="idBrend" value="<?php echo $brend['ID']; ?>" >
											<input type="hidden" name="id" value="<?php echo $formSupplier['ID']; ?>" >
										</div>
										</form>
									</div>
									<?php ; } ?>
								</td>
							</tr> 
							<tr><td colspan="2"><h5>Les images</h5></td></tr>
							<tr >
								<td ><label for="selectIdSetPicture">Modifier l'image</label></td>
								<td >
									<?php $files = glob("items/supplier/*.*"); ?>
									<div class="col-md-6 no-space-top" >
										<select class="form-control" name="selectIdSetPicture" id="selectIdSetPicture" onchange="setSupplierMarqueForPicture(<?php echo sizeof($files); ?>);">
											<option value="0">Modifier</option>
											<?php 
											foreach($formBrends as $brend) { 
											?><option value="<?php echo $brend['ID']; ?>"><?php echo 'Marque : '.$brend['BREND']; ?></option>
											<?php } ?>
										</select>
									</div>
								</td>
							</tr>
							<tr >
								<td  colspan="2">
									<?php for ($i=0; $i <sizeof($files); $i++) { ?>
									<div class="col-md-3 text-center no-space-top">
										<form action="<?php echo $this->baseUrl; ?>/backoffice/supplier/setpicture#tabs-brend" method="post" name="setPictureForm_<?php echo $i; ?>">
										<div class="col-md-12 text-center">
											<ul class="gallerybox ">
											  	<li>
													<figure>
														<img src="<?php echo $this->baseUrl.'/'.$files[$i]; ?>" />
													</figure>
												</li>
											</ul>
										</div>
										<div class="col-md-6 text-right">
											<button class="btn btn-primary" type="submit" name="edit"><i class="glyphicon glyphicon-resize-small"></i>&nbsp;Lier</button>
											<input type="hidden" name="picture" value="<?php echo $files[$i]; ?>" >
											<input type="hidden" name="id" value="<?php echo $formSupplier['ID']; ?>" >
											<input type="hidden" name="idSelected" id="idSelected" >
										</div>
										</form>	
																				
										<form action="<?php echo $this->baseUrl; ?>/backoffice/supplier/erasepicture#tabs-brend" method="post" id="delPictureImage<?php echo $i;?>">
										<div class="col-md-6 text-left">
											<button class="btn btn-danger btn-modal" type="button" data-toggle="ajaxModalSubmitDelete" data-form="delPictureImage<?php echo $i;?>"  ><i class="glyphicon glyphicon-trash"></i>&nbsp;Supprimer</button>
											<input type="hidden" name="picture" value="<?php echo $files[$i]; ?>" >
											<input type="hidden" name="id" value="<?php echo $formSupplier['ID']; ?>" >
										</div>
										</form>
									</div>
									<?php } ?>
								</td>
							</tr> 
						</table>
					</section>
				</div>
			</div>
		</div>
	</div>
</div>


<script type="text/javascript">  
$(function(){  
	initTabs(window.location.hash);
    initEditor('#desclong');
});
</script>modules/backoffice/views/scripts/supplier/add.phtml000060400000006214150710367660016567 0ustar00 
<div class="table-box">
	<form action="<?php echo $this->baseUrl; ?>/backoffice/supplier/add" method="post" name="addSupplierForm"  enctype="multipart/form-data" >
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Marque</td>
				<td class="col-md-8"><input type="text" class="form-control" name="brend" id="brend" value="<?php echo $this->populateFormBrend['BREND']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Nom de l'entreprise</td>
				<td class="col-md-8"><input type="text" class="form-control" name="company" id="company" value="<?php echo $this->populateFormSupplier['COMPANY']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Nom</td>
				<td class="col-md-8"><input type="text" class="form-control" name="lastname" id="lastname" value="<?php echo $this->populateFormSupplier['NOM']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Pr�nom</td>
				<td class="col-md-8"><input type="text" class="form-control" name="firstname" id="firstname" value="<?php echo $this->populateFormSupplier['PRENOM']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Email</td>
				<td class="col-md-8"><input type="text" class="form-control" name="email" id="email" value="<?php echo $this->populateFormSupplier['EMAIL']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4">T�l�phone</td>
				<td class="col-md-8"><input type="text" class="form-control" name="tel" id="tel" value="<?php echo $this->populateFormSupplier['TEL']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4">Fax</td>
				<td class="col-md-8"><input type="text" class="form-control" name="fax" id="fax" value="<?php echo $this->populateFormSupplier['FAX']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4">Adresse</td>
				<td class="col-md-8"><input type="text" class="form-control" name="address" id="address" value="<?php echo $this->populateFormSupplier['ADDRESSE']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4">Code Postal</td>
				<td class="col-md-8"><input type="text" class="form-control" name="cp" id="cp" value="<?php echo $this->populateFormSupplier['CP']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4">Ville</td>
				<td class="col-md-8"><input type="text" class="form-control" name="ville" id="ville" value="<?php echo $this->populateFormSupplier['VILLE']; ?>"/></td>
			</tr>
			<tr>
				<td class="col-md-4">Image du fournisseur</td>
				<td class="col-md-8">
					<input type="file" name="picture" id ="picture" size="50" >
						<br><i>Extensions : jpg, gif, png</i>
				</td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
		modules/backoffice/views/scripts/supplier/search.phtml000060400000004075150710367660017307 0ustar00<table cellpadding="0" cellspacing="5" border="0" width="1200px">
<tr>
	<td align="left" colspan="9">
	
		<form method="POST" action="<?php echo $this->baseUrl; ?>/backoffice/supplier/search">
			<input type="text" size="50" value="" id="searchValue" name="searchValue">
			<select id="searchType" name="searchType">
				<option value="BREND">Marque</option>
				<option value="COMPANY">Entreprise</option>
				<option value="NOM">Nom</option>
				<option value="PRENOM">Pr�nom</option>
				<option value="EMAIL">Email</option>
				<option value="ADDRESSE">Adresse</option>
				<option value="CP">Code Postal</option>
				<option value="VILLE">Ville</option>
			</select>
			<input type="submit" name="search" value="Rechercher" />
		</form>
	</td>
</tr>
<tr>
	<td align="left" colspan="9">
		<span class="errorText"><?php echo $this -> messageError; ?></span>
		<span class="successText"><?php echo $this -> messageSuccess; ?></span>
	</td>
</tr>
<?php if ($this->listsupplierCount > 0) { ?>
<tr class="linkHeader">
	<th> ENTREPRISE </th>
	<th> NOM </th>
	<th> PRENOM </th>
	<th> EMAIL </th>
	<th> TEL </th>
	<th> FAX </th>
	<th> ADRESSE </th>
	<th> CODE POSTAL </th>
	<th> VILLE </th>
	<th width="150px">&nbsp;</th>
</tr>

<?php foreach($this->listsupplier as $row) : ?>
<tr>
	<td><?php echo $this->escape($row['COMPANY']);?></td>
	<td><?php echo $this->escape($row['NOM']);?></td>
	<td><?php echo $this->escape($row['PRENOM']);?></td>
	<td><?php echo $this->escape($row['EMAIL']);?></td>
	<td><?php echo $this->escape($row['TEL']);?></td>
	<td><?php echo $this->escape($row['FAX']);?></td>
	<td><?php echo $this->escape($row['ADDRESSE']);?></td>
	<td><?php echo $this->escape($row['CP']);?></td>
	<td><?php echo $this->escape($row['VILLE']);?></td>
	<td  width="200px">
        <a class="button" href="<?php echo $this->baseUrl; ?>/backoffice/supplier/edit/id/<?php echo $this->escape($row['ID']); ?>">Modifier</a>
        <a class="button" href="<?php echo $this->baseUrl; ?>/backoffice/supplier/del/id/<?php echo $this->escape($row['ID']); ?>">Supprimer</a>
	</td>
</tr>
<?php endforeach; 
}
?>
</table>
modules/backoffice/views/scripts/productoptionlist/option.phtml000060400000005400150710367660021305 0ustar00 <div class="table-box">
	<form method="POST" action="<?php echo $this->baseUrl; ?>/backoffice/productoptionlist/option">
	<table class="table">
		<thead>
			<tr>
				<th class="col-md-4" colspan="2"><?php echo $this->titlePage; ?><i style="display:none">Liste de caract�ristiques disponible lors de la s�lection d'un produit</i></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr class="nostriped">
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Caract�ristique</td>
				<td class="col-md-8"><input type="text" class="form-control" size="60" name="name" placeholder="Ajouter une caract�ristique de produit"></td>
			</tr>
			<tr class="nostriped">
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Valeurs</td>
				<td class="col-md-8"><input type="text" class="form-control" name="value" value="" size="40" placeholder="Ajouter une liste de valeurs � s�lectionner"><i>valeur 1, valeur 2, ...</i></td>
				
			</tr>
			<tr class="nostriped">
				<td colspan="2" class="text-center">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>

<div class="table-box">
<table class="display table" id="optionTable" width="100%">
	<thead>
		<tr>
			<th>Caract�ristiques</th>
		</tr>
	</thead>
	<tbody>
		<?php foreach($this->listoption as $optionList)  { ?>
		<tr>
			<td >
				<form method="POST" action="<?php echo $this->baseUrl; ?>/backoffice/productoptionlist/optionedit">
				<div class="col-md-4 no-space-top">
					<input type="text" class="form-control" size="40" name="name" value="<?php echo $optionList->name;?>">
				</div>
				<div class="col-md-4 no-space-top">
					<?php $values = explode("::", $optionList->valuesString);
						$result = "";
						foreach ($values as $value) {
							if (empty($result))  {
								$result .= $value;
							} else {
								$result .= ", ".$value;
							}
						}	?>	
					<input type="text" class="form-control" size="40" name="value" value="<?php echo $result;?>">
				</div>
				
				
				<div class="col-md-4 no-space-top">
					<input type="hidden" name="id" id="id" value="<?php echo $optionList->id;?>">
					<div class="btn-group">
						<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
						<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/productoptionlist/optiondel/id/<?php echo $optionList->id;?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
					</div>
				</div>
				</form>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
</div>
modules/backoffice/views/scripts/annonce/list.phtml000060400000006161150710367660016571 0ustar00<script type="text/javascript">
$(function(){
	initRichTextBox('#annonceContent', 1, 500, 150);
});
</script>
<table cellpadding="0" cellspacing="5" border="0" width="100%">
<tr>
	<td align="left" colspan="4">
		<span class="errorText"><?php echo $this -> messageError; ?></span>
		<span class="successText"><?php echo $this -> messageSuccess; ?></span>
	</td>
</tr>
<tr>
	<td colspan="4">
		<table border="0" cellpadding="0" cellspacing="0" width="1000px">
			<tr>
				<td>
				<?php if ($this->populateFormAnnonce['TITRE']) { ?>
					<form action="<?php echo $this->baseUrl; ?>/backoffice/annonce/edit" method="post" name="editAnnonceForm" >
					<?php } else { ?>
					<form action="<?php echo $this->baseUrl; ?>/backoffice/annonce/add" method="post" name="addAnnonceForm" >
					<?php } ?>
						<table  border="0" cellpadding="0" cellspacing="10" width="850px" align="left">
							<tr >
								<td>
									Titre
								</td>
								<td>
									<input type="text" name="titre" size="40" id="titre" value="<?php echo $this->populateFormAnnonce['TITRE']; ?>"/>
								</td>
							</tr>
							<tr >
								<td>
									Afficher
								</td>
								<td>
									<input type="radio" value="0" name="isshow" <?php if ($this->populateFormAnnonce['isSHOW'] == 0) { echo 'checked="checked"';} ?>>Oui</input>
									<input type="radio" value="1" name="isshow" <?php if ($this->populateFormAnnonce['isSHOW'] == 1) { echo 'checked="checked"';} ?>>Non</input><br>
			
								</td>
							</tr>
							<tr >
								<td valign="top">
									Contenu
								</td>
								<td class="desc-annonce-detail">
									<?php if ($this->populateFormAnnonce) { ?>
									<textarea  name="content" id="annonceContent" name="annonceContent"><?php echo $this->populateFormAnnonce['CONTENT']; ?></textarea>
									<?php } ?>
								
								</td>
							</tr>	
							<tr>
								<td align="center" colspan="2">
									<?php if ($this->populateFormAnnonce['TITRE']) { ?>
									<input type="hidden" name="id" value="<?php echo $this->populateFormAnnonce['ID'];?>">
									<input type="submit" name="edit" value="Modifier" />
									<?php } else { ?>
									<input type="submit" name="add" value="Ajouter" />
									<?php } ?>
								</td>
							</tr>
						</table>
					</form>
				</td>
			</tr>
		</table>
	</td>
</tr>
<tr class="linkHeader">
	<th>TITRE</th>
	<th >AFFICHAGE</th>
	<th >&nbsp;</th>
	<th >&nbsp;</th>
</tr>

<?php foreach($this->listannonce as $row) : ?>
<tr>
	<td width="300px" class="link3"><a href="<?php echo $this->baseUrl; ?>/backoffice/annonce/edit/id/<?php echo $row['ID']; ?>"><?php echo $row['TITRE'];?></a></td>
	<td><?php if ($this->escape($row['isSHOW'])==0) {echo 'Oui';} else {echo 'Non';} ?></td>
	<td colspan="2">
        <a class="button" href="<?php echo $this->baseUrl; ?>/backoffice/annonce/edit/id/<?php echo $row['ID']; ?>">Modifier</a>
    
        <a class="button" href="<?php echo $this->baseUrl; ?>/backoffice/annonce/del/id/<?php echo $row['ID']; ?>" onclick="return msgOkCancelDelete();">Supprimer</a>
	</td>
</tr>
<tr>
	<td colspan="4" style="background:#666666;height:1px;"></td>
</tr>
<?php endforeach; ?>
</table>
modules/backoffice/views/scripts/csv/export.phtml000060400000000000150710367660016273 0ustar00modules/backoffice/views/scripts/csv/sitemapxml.phtml000060400000003512150710367660017150 0ustar00
 <div class="table-box">
	<form action="<?php echo $this->baseUrl; ?>/backoffice/csv/sitemapxml" method="post">
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"> Fr�quence</td>
				<td class="col-md-8">
					<select class="form-control" name="changefreq">
						<option value="weekly" >weekly</option>
						<option value="monthly" selected="selected">monthly</option> 
					</select>
				</td>
			</tr>
			<tr>
				<td class="col-md-4">Priorit�</td>
				<td class="col-md-8">
					<select class="form-control" name="priority">
						<option value="0.8" selected="selected">0.8</option>
					</select>
				</td>
			</tr>
			<tr >
				<td class="col-md-4">Images</td>
				<td class="col-md-8">
					<select class="form-control" name="all_image">
						<option value="Y" selected="selected">Oui</option>
						<option value="N">Non</option>
					</select>
				</td>
			</tr>
			<tr >
				<td class="col-md-4">Liens de navigation de produits</td>
				<td class="col-md-8">
					<select class="form-control" name="all_navnom">
						<option value="Y">Oui</option>
						<option value="N" selected="selected">Non</option>
					</select>
				</td>
			</tr>
			<tr >
				<td class="col-md-4">V�rifier les liens</td>
				<td class="col-md-8">
					<select class="form-control" name="checklink">
						<option value="Y" >Oui</option>
						<option value="N" selected="selected">Non</option>
					</select>
				</td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-cog"></i>&nbsp;G�n�rer le sitemap</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>modules/backoffice/views/scripts/prestashop/index.phtml000060400000002227150710367660017473 0ustar00
   <div class="table-box">
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-12 text-center" colspan="2"><h5>Exportation des donn�es vers Prestashop</h5></td>
			</tr>
			<tr >
				<td class="col-md-5">Vous pouvez importer toutes les donn�es dans Prestashop -> Outils -> Importation de donn�es</td>
				<td class="col-md-7">
					<div class="btn-group">
						<a href="<?php echo $this->baseUrl; ?>/backoffice/prestashop/exportcategories" class="btn btn-success"><i class="glyphicon glyphicon-open"></i>&nbsp;Exporter les Familles articles</a>
						<a href="<?php echo $this->baseUrl; ?>/backoffice/prestashop/exportfournisseurs" class="btn btn-success"><i class="glyphicon glyphicon-open"></i>&nbsp;Exporter les Fournisseurs</a>
						<a href="<?php echo $this->baseUrl; ?>/backoffice/prestashop/exportclients" class="btn btn-success"><i class="glyphicon glyphicon-open"></i>&nbsp;Exporter les Clients</a>
					</div>
				</td>
			</tr>  
		</tbody>
	</table>
</div>
<div class="clearfix"></div>modules/backoffice/views/scripts/error/error.phtml000060400000000027150710367660016452 0ustar00Sorry, an error occuredmodules/backoffice/views/scripts/blogsubject/search.phtml000060400000010505150710367660017742 0ustar00
<div class="table-box">
  <form method="POST" action="/backoffice/blogsubject/search">
    <table class="table">
      <thead>
        <tr>
          <th class="col-md-4" >
            <?php echo $this->titlePage; ?>
          </th>
        </tr>
      </thead>
      <tbody>
        <?php echo $this->render("alert_tr.phtml"); ?>
			  <tr >
				  <td class="col-md-4">Publi�</td>
				  <td class="col-md-8">
					  <input type="radio" value="<?php echo true; ?>" name="is_publish" id="is_publish1" class="bluecheckradios" <?php if ($this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish1">&nbsp;Oui</label>
					  <input type="radio" value="<?php echo false; ?>" name="is_publish" id="is_publish2" class="bluecheckradios" <?php if (!$this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish2">&nbsp;Non</label>
			    </td>
			  </tr>
			  <tr >
				  <td class="col-md-4">Ferm�</td>
				  <td class="col-md-8">
					  <input type="radio" value="<?php echo true; ?>" name="is_close" id="is_close1" class="bluecheckradios" <?php if ($this->populateData['is_close']) { echo 'checked="checked"';} ?>><label for="is_close1">&nbsp;Oui</label>
					  <input type="radio" value="<?php echo false; ?>" name="is_close" id="is_close2" class="bluecheckradios" <?php if (!$this->populateData['is_close']) { echo 'checked="checked"';} ?>><label for="is_close2">&nbsp;Non</label>
			    </td>
			  </tr>
               <tr>
				  <td class="col-md-4">Cat�gorie</td>
				  <td class="col-md-8">
					  <select name="id_category" id="id_category" class="form-control">
						  <?php 
						  $show = array();
						  foreach($this->listallblogcategories as $row) { 
						 	  for ($level=0 ; $level<11; $level++) { 
								  if ((!isset($show['title'.$level]) || $show['title'.$level] != $row['title'.$level]) && $row['title'.$level] != null) {
								  ?>
									  <option value="<?php echo $this->escape($row['id'.$level]); ?>" <?php if ($row['id'.$level] == $this->populateData['id_category']) { echo 'selected="selected"';}?>>
										  <?php 
						 				  for ($i=0 ; $i<$level; $i++) { 
											  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
										  }
										  echo $row['title'.$level]; ?>
									
									  </option>
									  <?php 
									  $show['title'.$level] = $row['title'.$level];
								  }
							   } 
						  } ?>
					  </select>
				  </td>
			  </tr>
			  <tr >
				  <td class="col-md-4">Titre</td>
				  <td class="col-md-8"><input type="text" class="form-control" placeholder="Titre � rechercher" name="title" size="40" id="title" value="<?php echo $this->populateData['title']; ?>"/></td>
			  </tr> 
			<tr>
				<td colspan="2" class="text-center">
            <button type="submit" name="search"  class="btn btn-primary">
              <span class="glyphicon glyphicon-search"></span> Rechercher
            </button>
				</td>
			</tr> 
    </tbody>
    </table>
  </form>
</div>
<?php 
$listSearchs = $this->listallsubjects; 
if (isset($listSearchs)) { 
?>

<div class="clearfix"></div>
<div class="table-box">

  <table class="display table" id="searchTable" width="100%">
    <thead>
      <tr> 
        <th>Titre</th>
        <th>Visibilit�</th>
        <th>Etat</th>
        <th></th>
      </tr>
    </thead>
    <tbody>

      <?php foreach($listSearchs as $row)  { ?>
      <tr>
        <td>
          <?php echo $row['title'];?>
        </td>
        <td>
          <?php if ($row['is_publish']) { echo 'Publi�';} else{echo 'Non publi�';};?>
        </td>
        <td>
          <?php if ($row['is_close']) { echo 'Ferm�';} else{echo 'Ouvert';};?>
        </td>
        <td>
          <div class="btn-group">
            <a target="_blank" class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/blogsubject/edit/id/<?php echo $this->escape($row['id']);?>" ><span class="glyphicon glyphicon-edit"></span> Modifier</a>
          </div>
        </td>
      </tr>
      <?php } ?>
    </tbody>
  </table>
  <script>
    $(document).ready(function() {
    initDataTable('searchTable', [[ 0, "asc" ]], [
    { "orderable": true, "targets": 0 },
    { "orderable": true, "targets": 1, "width": "150px"  },
    { "orderable": true, "targets": 2, "width": "150px"  },
    { "orderable": false, "targets": -1, "width": "200px" },
    ]);
    });
  </script>
</div>
<?php  } ?>modules/backoffice/views/scripts/blogsubject/add.phtml000060400000007267150710367660017240 0ustar00
<div class="table-box">
  <form method="POST" action="/backoffice/blogsubject/add">
    <table class="table">
      <thead>
        <tr>
          <th class="col-md-4" >
            <?php echo $this->titlePage; ?>
          </th>
        </tr>
      </thead>
      <tbody>
        <?php echo $this->render("alert_tr.phtml"); ?>
			  <tr >
				  <td class="col-md-4">Publier</td>
				  <td class="col-md-8">
					  <input type="radio" value="<?php echo true; ?>" name="is_publish" id="is_publish1" class="bluecheckradios" <?php if ($this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish1">&nbsp;Oui</label>
					  <input type="radio" value="<?php echo false; ?>" name="is_publish" id="is_publish2" class="bluecheckradios" <?php if (!$this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish2">&nbsp;Non</label>
			    </td>
			  </tr>
			  <tr >
				  <td class="col-md-4">Fermer</td>
				  <td class="col-md-8">
					  <input type="radio" value="<?php echo true; ?>" name="is_close" id="is_close1" class="bluecheckradios" <?php if ($this->populateData['is_close']) { echo 'checked="checked"';} ?>><label for="is_close1">&nbsp;Oui</label>
					  <input type="radio" value="<?php echo false; ?>" name="is_close" id="is_close2" class="bluecheckradios" <?php if (!$this->populateData['is_close']) { echo 'checked="checked"';} ?>><label for="is_close2">&nbsp;Non</label>
			    </td>
			  </tr>
			  <tr>
				  <td class="col-md-4">Cat�gorie</td>
				  <td class="col-md-8">
					  <select name="id_category" id="id_category" class="form-control">
						  <?php 
						  $show = array();
						  foreach($this->listallblogcategories as $row) { 
						 	  for ($level=0 ; $level<11; $level++) { 
								  if ((!isset($show['title'.$level]) || $show['title'.$level] != $row['title'.$level]) && $row['title'.$level] != null) {
								  ?>
									  <option value="<?php echo $this->escape($row['id'.$level]); ?>" <?php if ($row['id'.$level] == $this->populateData['id_category']) { echo 'selected="selected"';}?>>
										  <?php 
						 				  for ($i=0 ; $i<$level; $i++) { 
											  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
										  }
										  echo $row['title'.$level]; ?>
									
									  </option>
									  <?php 
									  $show['title'.$level] = $row['title'.$level];
								  }
							   } 
						  } ?>
					  </select>
				  </td>
			  </tr>
			  <tr >
				  <td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Titre</td>
				  <td class="col-md-8"><input type="text" class="form-control" placeholder="Titre" name="title" size="40" id="title" value="<?php echo $this->populateData['title']; ?>"/></td>
			  </tr> 
			  <tr >
				  <td class="col-md-4">Titre secondaire</td>
				  <td class="col-md-8"><input type="text" class="form-control" placeholder="Titre secondaire" name="sub_title" size="40" id="sub_title" value="<?php echo $this->populateData['sub_title']; ?>"/></td>
			  </tr> 
			  <tr >
				  <td class="col-md-4">Contenu</td>
				  <td class="col-md-8"> 
						<textarea  name="message" cols="130" rows="20" id="annonceContent">
						<?php if (isset($this->populateData['message']) && !empty($this->populateData['message'])) { 
							 echo $this->populateData['message']; 
						} ?>
						</textarea>
          </td>
			  </tr> 
			<tr>
				<td colspan="2" class="text-center">
            <button type="submit" name="search"  class="btn btn-success">
              <span class="glyphicon glyphicon-plus"></span> Ajouter
            </button>
				</td>
			</tr> 
    </tbody>
    </table>
  </form>
  
  <script>
    $(document).ready(function() { 
    initEditor('#annonceContent');
    });
  </script>
</div>modules/backoffice/views/scripts/blogsubject/edit.phtml000060400000007502150710367660017425 0ustar00
<div class="table-box">
  <form method="POST" action="/backoffice/blogsubject/edit">
    <table class="table">
      <thead>
        <tr>
          <th class="col-md-4" >
            <?php echo $this->titlePage; ?>
          </th>
        </tr>
      </thead>
      <tbody>
        <?php echo $this->render("alert_tr.phtml"); ?>
			  <tr >
				  <td class="col-md-4">Publier</td>
				  <td class="col-md-8">
					  <input type="radio" value="<?php echo true; ?>" name="is_publish" id="is_publish1" class="bluecheckradios" <?php if ($this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish1">&nbsp;Oui</label>
					  <input type="radio" value="<?php echo false; ?>" name="is_publish" id="is_publish2" class="bluecheckradios" <?php if (!$this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish2">&nbsp;Non</label>
			    </td>
			  </tr>
			  <tr >
				  <td class="col-md-4">Fermer</td>
				  <td class="col-md-8">
					  <input type="radio" value="<?php echo true; ?>" name="is_close" id="is_close1" class="bluecheckradios" <?php if ($this->populateData['is_close']) { echo 'checked="checked"';} ?>><label for="is_close1">&nbsp;Oui</label>
					  <input type="radio" value="<?php echo false; ?>" name="is_close" id="is_close2" class="bluecheckradios" <?php if (!$this->populateData['is_close']) { echo 'checked="checked"';} ?>><label for="is_close2">&nbsp;Non</label>
			    </td>
			  </tr>
			  <tr>
				  <td class="col-md-4">Cat�gorie</td>
				  <td class="col-md-8"> 
					    <select name="id_category" id="id_category" class="form-control">
						    <?php 
						    $show = array();
						    foreach($this->listallblogcategories as $row) { 
						 	    for ($level=0 ; $level<11; $level++) { 
								    if ((!isset($show['title'.$level]) || $show['title'.$level] != $row['title'.$level]) && $row['title'.$level] != null) {
								    ?>
									    <option value="<?php echo $this->escape($row['id'.$level]); ?>" <?php if ($row['id'.$level] == $this->populateData['id_category']) { echo 'selected="selected"';}?>>
										    <?php 
						 				    for ($i=0 ; $i<$level; $i++) { 
											    echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
										    }
										    echo $row['title'.$level]; ?>
									
									    </option>
									    <?php 
									    $show['title'.$level] = $row['title'.$level];
								    }
							     } 
						    } ?>
					    </select> 
				  </td>
			  </tr>
			  <tr >
				  <td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Titre</td>
				  <td class="col-md-8"><input type="text" class="form-control" placeholder="Titre" name="title" size="40" id="title" value="<?php echo $this->populateData['title']; ?>"/></td>
			  </tr> 
			  <tr >
				  <td class="col-md-4">Titre secondaire</td>
				  <td class="col-md-8"><input type="text" class="form-control" placeholder="Titre secondaire" name="sub_title" size="40" id="sub_title" value="<?php echo $this->populateData['sub_title']; ?>"/></td>
			  </tr> 
			  <tr >
				  <td class="col-md-4">Contenu</td>
				  <td class="col-md-8"> 
						<textarea  name="message" cols="130" rows="20" id="annonceContent">
						<?php if (isset($this->populateData['message']) && !empty($this->populateData['message'])) { 
							 echo $this->populateData['message']; 
						} ?>
						</textarea>
          </td>
			  </tr> 
			<tr>
				<td colspan="2" class="text-center">
            <input type="hidden" value="<?php echo $this->populateData['id']; ?>" name="id" />
            <button type="submit" name="search"  class="btn btn-success">
              <span class="glyphicon glyphicon-edit"></span> Modifier
            </button>
				</td>
			</tr> 
    </tbody>
    </table>
  </form>
  
  <script>
    $(document).ready(function() { 
    initEditor('#annonceContent');
    });
  </script>
</div>modules/backoffice/views/scripts/category2/add.phtml000060400000005061150710367660016622 0ustar00
 <div class="table-box">
<form action="<?php echo $this->baseUrl; ?>/backoffice/category2/add" method="post" name="addCategory"  enctype="multipart/form-data" >
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Nom</td>
				<td class="col-md-8"><input type="text" class="form-control" name="nom" id="nom" value="<?php echo $this->populateForm['NOM']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Nom de navigation</td>
				<td class="col-md-8"><input type="text" class="form-control" name="navnom" id="navnom" value="<?php echo $this->populateForm['NAVNOM']; ?>" /></td>
			</tr>
			<tr >
				<td class="col-md-4">Mots cl�s</td>
				<td class="col-md-8"><input type="text" class="form-control" name="keywords" id="keywords" value="<?php echo $this->populateForm['KEYWORDS']; ?>" /></td>
			</tr>
			<tr>
				<td class="col-md-4">Description</td>
				<td class="col-md-8"><input type="text" class="form-control" name="desc" id="desc" value="<?php echo $this->populateForm['DESCRIPTION']; ?>" /></td>
			</tr>
			<tr>
				<td class="col-md-4">Cat�gorie parente</td>
				<td class="col-md-8">
					<select name="idparent" id="idparent" class="form-control">
						<?php 
						$show = array();
						foreach($this->listallcategories2 as $row) { 
						 	for ($level=0 ; $level<11; $level++) { 
								if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
								?>
									<option value="<?php echo $this->escape($row['ID'.$level]); ?>">
										<?php 
						 				for ($i=0 ; $i<$level; $i++) { 
											echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
										}
										echo $row['NOM'.$level]; ?>
									
									</option>
									<?php 
									$show['NOM'.$level] = $row['NOM'.$level];
								}
							 } 
						} ?>
					</select>
				</td>
			</tr>
			<tr>
				<td class="col-md-4">Image de la cat�gorie</td>
				<td class="col-md-8">
					<input type="file" name="picCat" id ="picCat" size="50" >
						<br><i>Extensions : jpg, gif, png</i>
				</td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>modules/backoffice/views/scripts/category2/list.phtml000060400000003326150710367660017047 0ustar00<div class="table-box">
  <div class="col-md-12 text-center">
    <?php echo $this->render("alert.phtml"); ?>
  </div>
  <table class="display table" id="productTable" width="100%">
    <thead>
      <tr>
        <th class="col-md-4" colspan="11">
          <?php echo $this->titlePage; ?>
        </th>
      </tr>
    </thead>
    <tbody>
      <?php foreach($this->listallcategories2 as $row)  { ?>
      <tr>
        <?php for ($level=0 ; $level<11; $level++) { 
				$hasStyle="";
				$hasClass="col-md-2";
			if (!((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null)) {
				$hasClass = "col-md-1";
			} ?>
        <td style="<?php echo $hasStyle; ?>" class="<?php echo $hasClass; ?>">
          <?php 
				if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
				?>
          <div class="no-space ">
            <a href="<?php echo $this->baseUrl; ?>/backoffice/category2/edit/id/<?php echo $row['ID'.$level]; ?>" <?php if ($row['isACTIVE'.$level] == false) { ?> style="color: red"<?php }?>>
              <?php echo $row['NOM'.$level]; ?>
            </a>
          </div>
          <div class="no-space text-right">
            <?php if ($row['IDPARENT'.$level] != 0) { ?>
            <button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/category2/del/id/<?php echo $row['ID'.$level]; ?>" ><span class="glyphicon glyphicon-trash"></span>
            </button>
            <?php } ?>
            <?php $show['NOM'.$level] = $row['NOM'.$level]; } ?>
          </div>
        </td>
        <?php } ?>
      </tr>
      <?php } ?>
    </tbody>
  </table>
</div>
modules/backoffice/views/scripts/category2/edit.phtml000060400000041402150710367660017016 0ustar00
<div class="table-box">
  <div class="col-md-8 text-left">
    <a class="<?php if ($this->populateForm['isACTIVE'] == false) { echo 'btn btn-danger';} else { echo 'btn btn-info'; } ?>" target="_blank" href="<?php echo $this->baseUrl; ?>/<?php echo Utils_Tool::getFormattedUrlCategory2($this->populateForm['NAVNOM_URLPARENTS'], $this->populateForm['NAVNOM'], $this->populateForm['ID']); ?>">
      <i class="glyphicon glyphicon-eye-open"></i>&nbsp;<?php echo $this->populateForm['NOM']; ?>
    </a>
  </div>
  <div class="col-md-4 text-right">
    <form action="<?php echo $this->baseUrl; ?>/backoffice/category2/editactive#tabs-category" method="post" >

      <input type="radio" class="bluecheckradios" name="active" id="active1" value="1" <?php if ($this->populateForm['isACTIVE'] == true) { echo 'checked="checked"';} ?>><label for="active1">&nbsp;Actif</label>
      <input type="radio" class="bluecheckradios" name="active" id="active2" value="0" <?php if ($this->populateForm['isACTIVE'] == false) { echo 'checked="checked"';} ?>><label for="active2">&nbsp;Inactif</label>
      <input type="hidden" name="id" value="<?php echo $this->populateForm['ID']; ?>">
      <button class="btn btn-success" type="submit" name="edit">
        <i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier
      </button>
    </form>
  </div>
  <div class="col-md-12 no-space-side">
    <div class="tabs-section ">
      <ul class="nav nav-tabs" id="myTab">
        <li class="active">
          <a href="#tabs-category" data-toggle="tab">Cat�gorie</a>
        </li>
        <li>
          <a href="#tabs-referencement" data-toggle="tab">R�f�rencement</a>
        </li>
        <li>
          <a href="#tabs-image" data-toggle="tab">Images</a>
        </li>
      </ul>
      <div class="tab-content">
        <div class="tab-pane active" id="tabs-category">
          <section class="boxpadding">
            <form action="<?php echo $this->baseUrl; ?>/backoffice/category2/editcategory#tabs-category" method="post"  enctype="multipart/form-data" >
              <table class="table">
                <?php echo $this->render("alert_tr.phtml"); ?>
                <tr >
                  <td class="col-md-4">
                    <i class="glyphicon glyphicon-asterisk"></i>&nbsp;<label for="nom">Nom</label>
                  </td>
                  <td class="col-md-8">
                    <input type="text" name="nom" id="nom" value="<?php echo $this->populateForm['NOM']; ?>" class="form-control"/>
                  </td>
                </tr>
                <tr >
                  <td >
                    <label for="desc">Description</label>
                  </td>
                  <td>
                    <input type="text"  name="desc" id="desc"  class="form-control" value="<?php echo $this->populateForm['DESCRIPTION'];?>">
                  </td>
                </tr>
                <tr >
                  <td >
                    <?php if ($this->populateForm['IDPARENT'] != 0) { ?>
                    <label for="idparent">Cat�gorie parente</label>
                    <?php } ?>
                  </td>
                  <td>
                    <?php if ($this->populateForm['IDPARENT'] != 0) { ?>
                    <select name="idparent" id="idparent"  class="form-control" >
                      <?php 
											$show = array();
											foreach($this->listallcategories2 as $row) { 
											 	for ($level=0 ; $level<11; $level++) { 
													if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
													?>
                      <option value="
                        <?php echo $this->escape($row['ID'.$level]); ?>" <?php if ($row['ID'.$level] == $this->populateForm['IDPARENT']) { echo 'selected="selected"';}?> >
                        <?php 
											 				for ($i=0 ; $i<$level; $i++) { 
																echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
															}
															echo $row['NOM'.$level]; ?>

                      </option>
                      <?php 
														$show['NOM'.$level] = $row['NOM'.$level];
													}
												 } 
											} ?>
                    </select>
                    <?php } else { ?>
                    <input type="hidden" name="idparent"  value="0">
                      <?php } ?>
                    </td>
                </tr>
                <tr >
                  <td >
                    <label for="picCat" >Image de la cat�gorie</label>
                    <br/>
                    <div class="col-md-12 text-center no-space-top">
                      <ul class="gallerybox ">
                        <li>
                          <figure>
                            <img src="<?php echo $this->baseUrl.'/'.$this->populateForm['URL'];?>" />
                          </figure>
                        </li>
                      </ul>
                    </div>
                  </td>
                  <td>
                    <input type="file" name="picCat" id="picCat" size="50"/>
                    <br>
                      <i>Extensions : jpg, gif, png</i>

                    </td>
                </tr>
                <tr >
                  <td>
                    <label for="picChoice" >Image de "Comment Choisir"</label>
                    <br/>
                    <?php if (isset($this->populateForm['CHOICEURL']) && !empty($this->populateForm['CHOICEURL'])) { ?>
                    <div class="col-md-12 text-center no-space-top">
                      <ul class="gallerybox ">
                        <li>
                          <figure>
                            <img src="<?php echo $this->baseUrl.'/'.$this->populateForm['CHOICEURL'];?>" />
                          </figure>
                        </li>
                      </ul>
                    </div>
                    <?php } ?>
                  </td>
                  <td>
                    <input type="file" name="picChoice" id="picChoice" size="50"/>
                    <br>
                      <i>Extensions : jpg, gif, png</i>

                    </td>
                </tr>
                <tr>
                  <td nowrap="nowrap">
                    <label for="docChoice">Document de "Comment Choisir"</label>
                  </td>
                  <td>
                    <select name="docChoice" id="docChoice" class="form-control">
                      <option value="" selected="selected">Aucun</option>
                      <?php 
											$files = glob("doc/*.pdf");
											for ($i=0; $i <sizeof($files); $i++) {				
										?>
                      <option value="
                        <?php echo $files[$i]; ?>" <?php if ($files[$i] == $this->populateForm['CHOICEDOC']) { echo 'selected="selected"';} ?> ><?php echo $files[$i]; ?>
                      </option>
                      <?php } ?>
                    </select>
                  </td>
                </tr>
                <tr>
                  <td align="center" colspan="2">
                    <input type="hidden" name="id"  value="<?php echo $this->populateForm['ID']; ?>">
                    <button class="btn btn-success" type="submit" name="edit">
                      <i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier
                    </button>
                  </td>
                </tr>
              </table>
            </form>
          </section>
        </div>

        <div class="tab-pane" id="tabs-referencement">
          <section class="boxpadding">
            <form action="
              <?php  echo $this->baseUrl; ?>/backoffice/category2/customnavnomedit#tabs-referencement" method="post">
              <table class="table">
                <?php echo $this->render("alert_tr.phtml"); ?>
                <tr >
                  <td colspan="2" >
                    <h5>M�ta donn�es</h5>
                  </td>
                </tr>
                <tr >
                  <td class="col-md-4">
                    <label for="navnom">Nom de navigation</label>
                  </td>
                  <td class="col-md-8">
                    <input type="text" name="navnom" id="navnom" value="<?php echo $this->populateForm['NAVNOM']; ?>" class="form-control"/>
                  </td>
                </tr>
                <tr >
                  <td >
                    <label for="navtitrenom">Titre de navigation</label>
                  </td>
                  <td >
                    <input class="form-control" type="text" name="navtitrenom" id="navtitrenom" value="<?php echo $this->populateForm['NAVTITRENOM'];?>">
                  </td>
                </tr>
                <tr>
                  <td>
                    <label for="navdescription">Description</label>
                  </td>
                  <td>
                    <input class="form-control" type="text" name="navdescription" id="navdescription" value="<?php echo $this->populateForm['NAVDESCRIPTION'];?>">
                  </td>
                </tr>
                <tr>
                  <td>
                    <label for="keywords">Mots cl�s</label>
                  </td>
                  <td>
                    <input class="form-control" type="text" name="keywords" id="keywords" value="<?php echo $this->populateForm['KEYWORDS'];?>">
                  </td>
                </tr>
                <tr >
                  <td colspan="2" >
                    <h5>Url</h5>
                  </td>
                </tr>
                <tr>
                  <td>
                    <label for="urlaccess">Acc�s hi�rarchique</label>
                  </td>
                  <td>
                    <input class="form-control" <?php if ($this->populateForm['IDPARENT'] != 0) { echo "readonly='readonly'"; } ?> type="text" name="urlaccess" id="urlaccess" placeholder="Pr�fix composant l'url, Ex : rubrique/sous-rubrique" value="<?php echo $this->populateForm['NAVNOM_URLPARENTS'];?>">
                  </td>
                </tr>
                <tr >
                  <td colspan="2" class="text-center">
                    <input type="hidden" name="nom" value="<?php echo $this->populateForm['NOM'];?>">
                    <input type="hidden" size="60" name="id" value="<?php echo $this->populateForm['ID'];?>">
                      <input type="hidden" size="60" name="idparent" value="<?php echo $this->populateForm['IDPARENT'];?>">
                      <button class="btn btn-success" type="submit" name="edit">
                      <i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier
                    </button>
                  </td>
                </tr>
              </table>
            </form>
          </section>
        </div>

        <div class="tab-pane" id="tabs-image">
          <section class="boxpadding">
            <table class="table">
              <?php echo $this->render("alert_tr.phtml"); ?>
              <tr>
                <td width="250px">
                  <label for="idparent">Images</label>
                </td>
                <td >
                  <?php 
										$files = glob("items/category2/".$this->populateForm['ID']."/*.*");
										for ($i=0; $i <sizeof($files); $i++) {				
									?>
                  <div class="col-md-3 text-center no-space-top">
                    <form action="
                      <?php echo $this->baseUrl; ?>/backoffice/category2/setpicture#tabs-image" method="post">
                      <div class="col-md-12 text-center">
                        <ul class="gallerybox ">
                          <li>
                            <figure>
                              <img src="<?php echo $this->baseUrl.'/'.$files[$i]; ?>" />
                            </figure>
                          </li>
                        </ul>
                      </div>
                      <div class="col-md-6 text-right">
                        <button class="btn btn-primary" type="submit" name="edit">
                          <i class="glyphicon glyphicon-resize-small"></i>&nbsp;Lier
                        </button>
                        <input type="hidden" name="picture" value="<?php echo $files[$i]; ?>" >
                        <input type="hidden" name="idCat" value="<?php echo $this->populateForm['ID']; ?>" >
                      </div>
                    </form>
                    <div class="col-md-6 text-left">
                      <form action="
                        <?php echo $this->baseUrl; ?>/backoffice/category2/erasepicture#tabs-image" method="post" id="delPictureImage<?php echo $i;?>">
                        <button class="btn btn-danger btn-modal" type="button" data-toggle="ajaxModalSubmitDelete" data-form="delPictureImage"
                          <?php echo $i;?>"  ><i class="glyphicon glyphicon-trash"></i>&nbsp;Supprimer
                        </button>
                        <input type="hidden" name="picture" value="<?php echo $files[$i]; ?>" >
                        <input type="hidden" name="idCat" value="<?php echo $this->populateForm['ID']; ?>" >
                      </form>
                    </div>
                  </div>
                  <?php } ?>
                </td>
              </tr>
              <tr >
                <td >
                  <label for="idparent" >Images de "Comment choisir"</label>
                </td>
                <td >
                  <?php 
										$files = glob("items/category_choice/".$this->populateForm['ID']."/*.*");
										for ($i=0; $i <sizeof($files); $i++) {				
									?>
                  <div class="col-md-3 text-center no-space-top">
                    <form action="
                      <?php echo $this->baseUrl; ?>/backoffice/category2/setpicturechoice#tabs-image" method="post">
                      <div class="col-md-12 text-center">
                        <ul class="gallerybox ">
                          <li>
                            <figure>
                              <img src="<?php echo $this->baseUrl.'/'.$files[$i]; ?>" />
                            </figure>
                          </li>
                        </ul>
                      </div>
                      <div class="col-md-6 text-left">
                        <button class="btn btn-primary" type="submit" name="edit">
                          <i class="glyphicon glyphicon-resize-small"></i>&nbsp;Lier
                        </button>
                        <input type="hidden" name="picture" value="<?php echo $files[$i]; ?>" >
                        <input type="hidden" name="idCat" value="<?php echo $this->populateForm['ID']; ?>" >
                      </div>
                    </form>
                    <div class="col-md-6 text-right">
                      <form action="<?php echo $this->baseUrl; ?>/backoffice/category2/erasepicturechoice#tabs-image" method="post" id="delPictureImageChoice<?php echo $i;?>">
                        <button class="btn btn-danger btn-modal" type="button" data-toggle="ajaxModalSubmitDelete" data-form="delPictureImageChoice"
                          <?php echo $i;?>"  ><i class="glyphicon glyphicon-trash"></i>&nbsp;Supprimer
                        </button>
                        <input type="hidden" name="picture" value="<?php echo $files[$i]; ?>" >
                        <input type="hidden" name="idCat" value="<?php echo $this->populateForm['ID']; ?>" >
                      </form>
                    </div>
                  </div>
                  <?php } 
										$files = glob("items/category_choice/*.*");
										for ($i=0; $i <sizeof($files); $i++) {				
									?>
                  <div class="col-md-3 text-center no-space-top">
                    <form action="<?php echo $this->baseUrl; ?>/backoffice/category2/setpicturechoice#tabs-image" method="post">
                      <div class="col-md-12 text-center">
                        <ul class="gallerybox ">
                          <li>
                            <figure>
                              <img src="<?php echo $this->baseUrl.'/'.$files[$i]; ?>" />
                            </figure>
                          </li>
                        </ul>
                      </div>
                      <div class="col-md-12">
                        <button class="btn btn-primary" type="submit" name="edit">
                          <i class="glyphicon glyphicon-resize-small"></i>&nbsp;Lier
                        </button>
                        <input type="hidden" name="picture" value="<?php echo $files[$i]; ?>" >
                        <input type="hidden" name="idCat" value="<?php echo $this->populateForm['ID']; ?>" >
                      </div>
                    </form>
                  </div>

                  <?php } ?>
                </td>
              </tr>
            </table>
          </section>
        </div>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
  $(document).ready(function() {
  initTabs(window.location.hash);
  });
</script>modules/backoffice/views/scripts/annoncecontent/list.phtml000060400000007066150710367660020171 0ustar00 <div class="table-box">
	<?php if ($this->populateFormAnnonce['TITRE']) { ?>
	<form action="<?php echo $this->baseUrl; ?>/backoffice/annoncecontent/edit" method="post" name="editAnnonceForm" >
	<?php } else { ?>
	<form action="<?php echo $this->baseUrl; ?>/backoffice/annoncecontent/add" method="post" name="addAnnonceForm" >
	<?php } ?>
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Titre</td>
				<td class="col-md-8"><input type="text" class="form-control" placeholder="Titre de l'annonce" name="titre" size="40" id="titre" value="<?php echo $this->populateFormAnnonce['TITRE']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Statut</td>
				<td class="col-md-8">
					<input type="radio" value="0" name="isshow" id="isshow1" class="bluecheckradios" <?php if ($this->populateFormAnnonce['isSHOW'] == 0) { echo 'checked="checked"';} ?>><label for="isshow1">&nbsp;Actif</label>
					<input type="radio" value="1" name="isshow" id="isshow2" class="bluecheckradios" <?php if ($this->populateFormAnnonce['isSHOW'] == 1) { echo 'checked="checked"';} ?>><label for="isshow2">&nbsp;Inactif</label>
			
				</td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Contenu</td>
				<td class="col-md-8">
						<textarea  name="content" cols="130" rows="20" id="annonceContent" name="annonceContent">
						<?php if (isset($this->populateFormAnnonce['CONTENT']) && !empty($this->populateFormAnnonce['CONTENT'])) { 
							 echo $this->populateFormAnnonce['CONTENT']; 
						} ?>
						</textarea>
				</td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<?php if ($this->populateFormAnnonce['TITRE']) { ?>
						<input type="hidden" name="id" value="<?php echo $this->populateFormAnnonce['ID'];?>">
						<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
					<?php } else { ?>
						<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
					<?php } ?>
						
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
$(function(){
	initEditor('#annonceContent');
});
</script>

 
 
 
 <div class="table-box">
<table class="display table" id="annonceContentTable" width="100%">
	<thead>
		<tr>
			<th>Titre</th>
			<th>Statut</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	
		<?php foreach($this->listannonce as $row)  { ?>
		<tr>
			<td><?php echo $row['TITRE'];?></td>
			<td><?php if ($this->escape($row['isSHOW'])==0) {echo 'Actif';} else {echo 'Inactif';} ?></td>
			<td>
				<div class="btn-group">
	             	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/annoncecontent/edit/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-edit"></span> Modifier</a>
					<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/annoncecontent/del/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>			
	$(document).ready(function() {
		initDataTable('annonceContentTable', [[ 0, "asc" ]], [{ "orderable": false, "targets": -1, "width": "270px" }]); 	    
	});
</script>
</div>
modules/backoffice/views/scripts/alert.phtml000060400000000501150710367660015274 0ustar00<div class="col-md-12 text-center no-space-top">
	<?php if (!empty($this->messageError)) { ?>
	<span class="alert alert-danger"><?php echo $this -> messageError; ?></span>
	<?php }
	if (!empty($this->messageSuccess)) { ?>
	<span class="alert alert-success"><?php echo $this -> messageSuccess; ?></span>
	<?php } ?>
</div>modules/backoffice/views/scripts/blogcategory/add.phtml000060400000007126150710367660017410 0ustar00
<div class="table-box">
  <form method="POST" action="/backoffice/blogcategory/add">
    <table class="table">
      <thead>
        <tr>
          <th class="col-md-4" >
            <?php echo $this->titlePage; ?>
          </th>
        </tr>
      </thead>
      <tbody>
        <?php echo $this->render("alert_tr.phtml"); ?>
			  <tr >
				  <td class="col-md-4">Publier</td>
				  <td class="col-md-8">
					  <input type="radio" value="<?php echo true; ?>" name="is_publish" id="is_publish1" class="bluecheckradios" <?php if ($this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish1">&nbsp;Oui</label>
					  <input type="radio" value="<?php echo false; ?>" name="is_publish" id="is_publish2" class="bluecheckradios" <?php if (!$this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish2">&nbsp;Non</label>
			    </td>
			  </tr>
			  <tr >
				  <td class="col-md-4">Fermer</td>
				  <td class="col-md-8">
					  <input type="radio" value="<?php echo true; ?>" name="is_close" id="is_close1" class="bluecheckradios" <?php if ($this->populateData['is_close']) { echo 'checked="checked"';} ?>><label for="is_close1">&nbsp;Oui</label>
					  <input type="radio" value="<?php echo false; ?>" name="is_close" id="is_close2" class="bluecheckradios" <?php if (!$this->populateData['is_close']) { echo 'checked="checked"';} ?>><label for="is_close2">&nbsp;Non</label>
			    </td>
			  </tr>
			  <tr>
				  <td class="col-md-4">Cat�gorie parente</td>
				  <td class="col-md-8">
					  <select name="idparent" id="idparent" class="form-control">
						  <?php 
						  $show = array();
						  foreach($this->listallblogcategories as $row) { 
						 	  for ($level=0 ; $level<11; $level++) { 
								  if ((!isset($show['title'.$level]) || $show['title'.$level] != $row['title'.$level]) && $row['title'.$level] != null) {
								  ?>
									  <option value="<?php echo $this->escape($row['id'.$level]); ?>">
										  <?php 
						 				  for ($i=0 ; $i<$level; $i++) { 
											  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
										  }
										  echo $row['title'.$level]; ?>
									
									  </option>
									  <?php 
									  $show['title'.$level] = $row['title'.$level];
								  }
							   } 
						  } ?>
					  </select>
				  </td>
			  </tr>
			  <tr >
				  <td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Titre</td>
				  <td class="col-md-8"><input type="text" class="form-control" placeholder="Titre" name="title" size="40" id="title" value="<?php echo $this->populateData['title']; ?>"/></td>
			  </tr> 
			  <tr >
				  <td class="col-md-4">Titre secondaire</td>
				  <td class="col-md-8"><input type="text" class="form-control" placeholder="Titre secondaire" name="sub_title" size="40" id="sub_title" value="<?php echo $this->populateData['sub_title']; ?>"/></td>
			  </tr> 
			  <tr >
				  <td class="col-md-4">Contenu</td>
				  <td class="col-md-8"> 
						<textarea  name="message" cols="130" rows="20" id="annonceContent">
						<?php if (isset($this->populateData['message']) && !empty($this->populateData['message'])) { 
							 echo $this->populateData['message']; 
						} ?>
						</textarea>
          </td>
			  </tr> 
			<tr>
				<td colspan="2" class="text-center">
            <button type="submit" name="search"  class="btn btn-success">
              <span class="glyphicon glyphicon-plus"></span> Ajouter
            </button>
				</td>
			</tr> 
    </tbody>
    </table>
  </form>
  
  <script>
    $(document).ready(function() { 
    initEditor('#annonceContent');
    });
  </script>
</div>modules/backoffice/views/scripts/blogcategory/list.phtml000060400000003057150710367660017632 0ustar00<div class="table-box">
<div class="col-md-12 text-center"><?php echo $this->render("alert.phtml"); ?></div>
<table class="display table" id="productTable" width="100%">
	<thead>
		<tr>
			<th class="col-md-4" colspan="11"><?php echo $this->titlePage; ?></th>
		</tr>
	</thead>
	<tbody>
		<?php foreach($this->listallblogcategories as $row)  { ?>
		<tr>
			<?php for ($level=0 ; $level<3; $level++) { 
				$hasStyle="";
				$hasClass="col-md-2";
			if (!((!isset($show['title'.$level]) || $show['title'.$level] != $row['title'.$level]) && $row['title'.$level] != null)) {
				$hasClass = "col-md-1";
			} ?>
			<td style="<?php echo $hasStyle; ?>" class="<?php echo $hasClass; ?>">
				<?php 
				if ((!isset($show['title'.$level]) || $show['title'.$level] != $row['title'.$level]) && $row['title'.$level] != null) {
				?>
				<div class="no-space text-left">
					<a href="<?php echo $this->baseUrl; ?>/backoffice/blogcategory/edit/id/<?php echo $row['id'.$level]; ?>" <?php if ($row['is_close'.$level] == 1 || $row['is_publish'.$level] == 0 ) { ?> style="color: red"<?php }?>>
						<?php echo $row['title'.$level]; ?>
					</a>
					<?php if ($row['id_parent'.$level] != 0) { ?>
					<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/blogcategory/del/id/<?php echo $row['id'.$level]; ?>" ><span class="glyphicon glyphicon-trash"></span></button>
					<?php } ?>
				<?php $show['title'.$level] = $row['title'.$level]; } ?>
				</div>
			</td>
			<?php } ?>
		</tr>
		<?php } ?>
	</tbody>
</table>
</div>
modules/backoffice/views/scripts/blogcategory/edit.phtml000060400000007772150710367660017614 0ustar00
<div class="table-box">
  <form method="POST" action="/backoffice/blogcategory/edit">
    <table class="table">
      <thead>
        <tr>
          <th class="col-md-4" >
            <?php echo $this->titlePage; ?>
          </th>
        </tr>
      </thead>
      <tbody>
        <?php echo $this->render("alert_tr.phtml"); ?>
			  <tr >
				  <td class="col-md-4">Publier</td>
				  <td class="col-md-8">
					  <input type="radio" value="<?php echo true; ?>" name="is_publish" id="is_publish1" class="bluecheckradios" <?php if ($this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish1">&nbsp;Oui</label>
					  <input type="radio" value="<?php echo false; ?>" name="is_publish" id="is_publish2" class="bluecheckradios" <?php if (!$this->populateData['is_publish']) { echo 'checked="checked"';} ?>><label for="is_publish2">&nbsp;Non</label>
			    </td>
			  </tr>
			  <tr >
				  <td class="col-md-4">Fermer</td>
				  <td class="col-md-8">
					  <input type="radio" value="<?php echo true; ?>" name="is_close" id="is_close1" class="bluecheckradios" <?php if ($this->populateData['is_close']) { echo 'checked="checked"';} ?>><label for="is_close1">&nbsp;Oui</label>
					  <input type="radio" value="<?php echo false; ?>" name="is_close" id="is_close2" class="bluecheckradios" <?php if (!$this->populateData['is_close']) { echo 'checked="checked"';} ?>><label for="is_close2">&nbsp;Non</label>
			    </td>
			  </tr>
			  <tr>
				  <td class="col-md-4">Cat�gorie parente</td>
				  <td class="col-md-8">
            <?php  if ($this->populateData['id_parent'] > 0) { ?>
					    <select name="idparent" id="idparent" class="form-control">
						    <?php 
						    $show = array();
						    foreach($this->listallblogcategories as $row) { 
						 	    for ($level=0 ; $level<11; $level++) { 
								    if ((!isset($show['title'.$level]) || $show['title'.$level] != $row['title'.$level]) && $row['title'.$level] != null) {
								    ?>
									    <option value="<?php echo $this->escape($row['id'.$level]); ?>" <?php if ($row['id'.$level] == $this->populateData['id_parent']) { echo 'selected="selected"';}?>>
										    <?php 
						 				    for ($i=0 ; $i<$level; $i++) { 
											    echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
										    }
										    echo $row['title'.$level]; ?>
									
									    </option>
									    <?php 
									    $show['title'.$level] = $row['title'.$level];
								    }
							     } 
						    } ?>
					    </select>
            <?php } else {  ?> 
              <input type="hidden" name="idparent" value="0" />
            <?php } ?>
				  </td>
			  </tr>
			  <tr >
				  <td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Titre</td>
				  <td class="col-md-8"><input type="text" class="form-control" placeholder="Titre" name="title" size="40" id="title" value="<?php echo $this->populateData['title']; ?>"/></td>
			  </tr> 
			  <tr >
				  <td class="col-md-4">Titre secondaire</td>
				  <td class="col-md-8"><input type="text" class="form-control" placeholder="Titre secondaire" name="sub_title" size="40" id="sub_title" value="<?php echo $this->populateData['sub_title']; ?>"/></td>
			  </tr> 
			  <tr >
				  <td class="col-md-4">Contenu</td>
				  <td class="col-md-8"> 
						<textarea  name="message" cols="130" rows="20" id="annonceContent">
						<?php if (isset($this->populateData['message']) && !empty($this->populateData['message'])) { 
							 echo $this->populateData['message']; 
						} ?>
						</textarea>
          </td>
			  </tr> 
			<tr>
				<td colspan="2" class="text-center">
            <input type="hidden" value="<?php echo $this->populateData['id']; ?>" name="id" />
            <button type="submit" name="search"  class="btn btn-success">
              <span class="glyphicon glyphicon-edit"></span> Modifier
            </button>
				</td>
			</tr> 
    </tbody>
    </table>
  </form>
  
  <script>
    $(document).ready(function() { 
    initEditor('#annonceContent');
    });
  </script>
</div>modules/backoffice/views/scripts/annoncefooter/list.phtml000060400000015230150710367660020005 0ustar00 <div class="table-box">
	<?php if ($this->populateFormAnnonceFooter['TITRE']) { ?>
	<form action="<?php echo $this->baseUrl; ?>/backoffice/annoncefooter/edit" method="post" name="editAnnonceForm" >
	<?php } else { ?>
	<form action="<?php echo $this->baseUrl; ?>/backoffice/annoncefooter/add" method="post" name="addAnnonceForm" >
	<?php } ?>
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Titre</td>
				<td class="col-md-8"><input class="form-control" type="text" class="form-control"  placeholder="Titre de l'information"  name="titre" size="40" id="titre" value="<?php echo $this->populateFormAnnonceFooter['TITRE']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Statut</td>
				<td class="col-md-8">
					<input type="radio" value="0" name="isshow" id="isshow1" class="bluecheckradios" <?php if ($this->populateFormAnnonceFooter['isSHOW'] == 0) { echo 'checked="checked"';} ?>><label for="isshow1">&nbsp;Actif</label>
					<input type="radio" value="1" name="isshow" id="isshow2" class="bluecheckradios" <?php if ($this->populateFormAnnonceFooter['isSHOW'] == 1) { echo 'checked="checked"';} ?>><label for="isshow2">&nbsp;Inactif</label>
			
				</td>
			</tr>
			<tr >
				<td class="col-md-4">Localisation</td>
				<td class="col-md-8">
					<div class="col-md-6 no-space-top">
						<?php $tabController = explode(';',$this->populateFormAnnonceFooter['CONT_NAME']); 
						$selectedController = array();
						for ($i=0;$i<sizeof($tabController);$i++) {
							$selectedController[$tabController[$i]] = true;
						}
						?>
							<select class="form-control" size="10" name="controllername[]"  multiple="multiple">
								<option value="index" <?php if (isset($selectedController['index'])) {echo 'selected="selected"';} ?> >Accueil</option>
								<option value="user" <?php if (isset($selectedController['user'])) {echo 'selected="selected"';} ?>>Compte</option>
								<option value="produits" <?php if (isset($selectedController['produits'])) {echo 'selected="selected"';} ?>>Produits</option>
								<option value="commande" <?php if (isset($selectedController['commande'])) {echo 'selected="selected"';} ?>>Commande</option>
								<option value="services" <?php if (isset($selectedController['services'])) {echo 'selected="selected"';} ?>>Services</option>
								<option value="produitspromotion" <?php if (isset($selectedController['produitspromotion'])) {echo 'selected="selected"';} ?>>Promotions</option>
								
							</select>
					</div>
					<div class="col-md-6 no-space-top">	
						<?php if (isset($selectedController['produits'])) { 
							$tabCategorie = explode(';',$this->populateFormAnnonceFooter['CAT_ID']); 
							$selectedCategorie = array();
							for ($i=0;$i<sizeof($tabCategorie);$i++) {
								$selectedCategorie[$tabCategorie[$i]] = true;
							}
							
							?>
							<div class="col-md-2 no-space-top">Produits</div>
							<div class="col-md-10 no-space-top">
								<select class="form-control" size="10" name="categorie[]"  multiple="multiple">
									<option value="1" <?php if (isset($selectedCategorie[1])) {echo 'selected="selected"';} ?> >Manutention, levage</option>
									<option value="2" <?php if (isset($selectedCategorie[2])) {echo 'selected="selected"';} ?> >Pr�vention de l'environnement</option>
									<option value="3" <?php if (isset($selectedCategorie[3])) {echo 'selected="selected"';} ?> >Stockage, rayonnage</option>
									<option value="4" <?php if (isset($selectedCategorie[4])) {echo 'selected="selected"';} ?> >Entretien, propret�</option>
									<option value="5" <?php if (isset($selectedCategorie[5])) {echo 'selected="selected"';} ?> >Protection, s�curit�</option>
									<option value="6" <?php if (isset($selectedCategorie[6])) {echo 'selected="selected"';} ?> >Emballage</option>
									<option value="7" <?php if (isset($selectedCategorie[7])) {echo 'selected="selected"';} ?> >Outillage</option>
									<option value="8" <?php if (isset($selectedCategorie[8])) {echo 'selected="selected"';} ?> >Mobilier d'atelier</option>
									<option value="9" <?php if (isset($selectedCategorie[9])) {echo 'selected="selected"';} ?> >Mobilier de bureau et de collectivit�</option>
								</select>
							</div>
						<?php } ?>
					</div>
				</td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Contenu</td>
				<td class="col-md-8">
						<textarea  name="content" cols="130" rows="20" id="annonceContent" name="annonceContent">
						<?php if (isset($this->populateFormAnnonceFooter['CONTENT']) && !empty($this->populateFormAnnonceFooter['CONTENT'])) { 
							 echo $this->populateFormAnnonceFooter['CONTENT']; 
						} ?>
						</textarea>
				</td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<?php if ($this->populateFormAnnonceFooter['TITRE']) { ?>
						<input type="hidden" name="id" value="<?php echo $this->populateFormAnnonceFooter['ID'];?>">
						<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
					<?php } else { ?>
						<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
					<?php } ?>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
$(function(){
	initEditor('#annonceContent');
});
</script>

 <div class="table-box">
<table class="display table" id="annonceFooterTable" width="100%">
	<thead>
		<tr>
			<th>Titre</th>
			<th>Statut</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	
		<?php foreach($this->listannoncefooter as $row)  { ?>
		<tr>
			<td><?php echo $row['TITRE'];?></td>
			<td><?php if ($this->escape($row['isSHOW'])==0) {echo 'Actif';} else {echo 'Inactif';} ?></td>
			<td>
				<div class="btn-group">
	             	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/annoncefooter/edit/id/<?php echo $row['ID']; ?>"><span class="glyphicon glyphicon-edit"></span> Modifier</a>
					<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/annoncefooter/del/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>			
	$(document).ready(function() {
		initDataTable('annonceFooterTable', [[ 0, "asc" ]], [{ "orderable": false, "targets": -1, "width": "270px" }]); 	    
	});
</script>
</div>
modules/backoffice/views/scripts/user/edit.phtml000060400000060464150710367660016106 0ustar00
<div class="table-box">	
	<div class="col-md-12 no-space-side">
		<div class="tabs-section ">
			<ul class="nav nav-tabs" id="myTab">
				<li class="active"><a href="#tabs-user" data-toggle="tab">Informations</a></li>
				<li><a href="#tabs-panier" data-toggle="tab">Panier personnalis�</a></li>
				<li><a href="#tabs-remises" data-toggle="tab">Remises en cours</a></li>
				<li><a href="#tabs-fidelitypoint" data-toggle="tab">Carte fid�lit�</a></li>
			</ul>
			<div class="tab-content">
        
				<div class="tab-pane active" id="tabs-user">
					<section class="boxpadding">
						<form action="<?php echo $this->baseUrl; ?>/backoffice/user/edituser#tabs-user" method="post">
							<table class="table">
								<?php echo $this->render("alert_tr.phtml"); ?>	
								<tr>
									<td class="col-md-4"><label for="civility">Civilit�</label></td>
									<td class="col-md-8">
										<select name="civility" id="civility" class="form-control">
											<option value="Mr" <?php if ($this->populateForm['CIVILITE'] == 'Mr') { echo 'selected'; } ?>>Monsieur</option>
											<option value="Mme" <?php if ($this->populateForm['CIVILITE'] == 'Mme') { echo 'selected'; } ?>>Madame</option>
											<option value="Mlle" <?php if ($this->populateForm['CIVILITE'] == 'Mlle') { echo 'selected'; } ?>>Mademoiselle</option>
										</select>
									</td>
								</tr>
								<tr>
									<td ><label for="numcompte">Num�ro du compte</label></td>
									<td>
										<input type="text" class="form-control" name="numcompte" id="numcompte"  value="<?php echo $this->populateForm['NUMCOMPTE']; ?>">
									</td>
								</tr>
								<tr >
									<td >
										<label for="lastname">Nom</label>
									</td>
									<td>
										<input type="text"  class="form-control"  name="lastname" id="lastname" value="<?php echo $this->populateForm['NOM']; ?>"/>
									</td>
								</tr>
								<tr >
									<td>
										<label for="firstname">Pr�nom</label>
									</td>
									<td>
										<input type="text" class="form-control" name="firstname" id="firstname" value="<?php echo $this->populateForm['PRENOM']; ?>"/>
									</td>
								</tr>
								<tr >
									<td>
										<label for="email">Email</label>
									</td>
									<td>
										<input type="text" class="form-control"  name="email" id="email" value="<?php echo $this->populateForm['EMAIL']; ?>"/>
									</td>
								</tr>
								<tr >
									<td>
										<label for="tel">T�l�phone</label>
									</td>
									<td>
										<input type="text" class="form-control"  name="tel" id="tel"  maxlength="10"  value="<?php echo $this->populateForm['TEL']; ?>"/>
									</td>
								</tr>
								<tr>
									<td><label for="fax">Fax</label></td>
									<td>
										<input type="text" class="form-control" name="fax" id="fax" maxlength="10"  value="<?php echo $this->populateForm['FAX']; ?>">
									</td>
								</tr>
								<tr>
									<td><label for="fct">Fonction : </label></td>
									<td>
										<input type="text" class="form-control" name="fct" id="fct"  value="<?php echo $this->populateForm['FONCTION']; ?>">
									</td>
								</tr>
								<tr>
									<td ><label for="raisonsocial">Raison sociale :</label></td>
									<td>
										<input type="text" class="form-control" name="raisonsocial" id="raisonsocial"  value="<?php echo $this->populateForm['RAISONSOCIAL']; ?>">
									</td>
								</tr>
								<tr>
									<td><label for="adressecomplete">Adresse</label></td>
									<td>
										<input type="text" class="form-control" name="adressecomplete" id="adressecomplete"  value="<?php echo $this->populateForm['ADRESSECOMPLETE']; ?>">
									</td>
								</tr>
								<tr>
									<td><label for="adresse">Rue</label></td>
									<td>
										<input type="text" class="form-control" name="adresse" id="adresse"  value="<?php echo $this->populateForm['ADRESSE']; ?>">
									</td>
								</tr>
								<tr>
									<td><label for="cp">Code postal</label></td>
									<td>
										<input type="text" class="form-control" name="cp" id="cp"  value="<?php echo $this->populateForm['CP']; ?>">
									</td>
								</tr>
								<tr>
									<td><label for="ville">Ville</label></td>
									<td>
										<input type="text" class="form-control" name="ville" id="ville"  value="<?php echo $this->populateForm['VILLE']; ?>">
									</td>
								</tr>
								<tr>
									<td><label for="departement">D�partement</label></td>
									<td>
										<input type="text" class="form-control" name="departement" id="departement"  value="<?php echo $this->populateForm['DEPARTEMENT']; ?>">
									</td>
								</tr>
								<tr>
									<td><label for="region">R�gion</label></td>
									<td>
										<input type="text" class="form-control" name="region" id="region"  value="<?php echo $this->populateForm['REGION']; ?>">
									</td>
								</tr>
								<tr>
									<td><label for="pays">Pays</label></td>
									<td>
										<input type="text" class="form-control" name="pays" id="pays" maxlength="10" value="<?php echo $this->populateForm['PAYS']; ?>" >
									</td>
								</tr>
								<tr>
									<td><label for="siret">SIRET</label></td>
									<td>
										<input type="text" class="form-control" name="siret" id="siret"  value="<?php echo $this->populateForm['SIRET']; ?>">
									</td>
								</tr>
								<tr>
									<td><label for="numidfisc">Num�ro d'identification fiscale</label></td>
									<td>
										<input type="text" class="form-control" name="numidfisc" id="numidfisc"  value="<?php echo $this->populateForm['NUMIDFISC']; ?>">
									</td>
								</tr>
								<tr>
									<td><label for="codeape">Code APE</label></td>
									<td>
										<input type="text" class="form-control" name="codeape" id="codeape"  value="<?php echo $this->populateForm['CODEAPE']; ?>">
									</td>
								</tr>
								<tr>
									<td><label for="sectactivite">Secteur d'activit�</label></td>
									<td>
										<input type="text" class="form-control" name="sectactivite" id="sectactivite"  value="<?php echo $this->populateForm['SECTACTIVITE']; ?>">
									</td>
								</tr>
								<tr>
									<td><label for="comm">Commentaires</label></td>
									<td>
										<textarea class="form-control" name="comm" id="comm" ><?php echo $this->populateForm['COMMENTAIRE']; ?></textarea>
									</td>
								</tr>
								<tr>
									<td><label for="cintern">Code Interne</label></td>
									<td>
										<select name="cintern" id="cintern" class="form-control">
											<option value="0">Selectionner un Code Interne</option>
											
											<?php foreach ($this->listCodeIntern as $row) { ?>
											<option value="<?php echo $row['ID']; ?>" <?php if ($row['ID'] == $this->populateForm['CODEINTERN']) { echo 'selected="selected"'; } ?> >
											<?php echo $row['CODE'].' - '.$row['LABEL']; ?>
											</option>
											<?php } ?>
										</select>
									</td>
								</tr>
								<tr>
									<td><label>Type</label></td>
									<td>
										<INPUT type=radio class="bluecheckradios" name="typeuser" id="typeuserPart" value="Particulier" <?php if ($this->populateForm['TYPE'] == 'Particulier') { echo 'checked="checked"'; } ?> ><label for="typeuserPart">&nbsp;Particulier</label>
										<INPUT type=radio class="bluecheckradios" name="typeuser" id="typeuserPro" value="Professionnel" <?php if ($this->populateForm['TYPE'] == 'Professionnel') { echo 'checked="checked"'; } ?> ><label for="typeuserPro">&nbsp;Professionnel</label>
									</td>
								</tr>
								<tr>
									<td><label>Activer "A r�ception de la facture"</label></td>
									<td>
										<INPUT type=radio class="bluecheckradios" name="isrecepfacture" id="isrecepfacture1"  value="Y" <?php if ($this->populateForm['isRECEPFACTURE'] == 'Y') { echo 'checked="checked"'; } ?> ><label for="isrecepfacture1">&nbsp;Oui</label>
										<INPUT type=radio class="bluecheckradios" name="isrecepfacture" id="isrecepfacture2" value="N" <?php if ($this->populateForm['isRECEPFACTURE'] == 'N') { echo 'checked="checked"'; } ?> ><label for="isrecepfacture2">&nbsp;Non</label>
									</td>
								</tr>
								<tr>
									<td><label>Activer "Paiement diff�r�"</label></td>
									<td>
										<INPUT type=radio class="bluecheckradios" name="iscredit" id="iscredit1" value="1" <?php if ($this->populateForm['isCREDIT'] == 1) { echo 'checked="checked"'; } ?> ><label for="iscredit1">&nbsp;Oui</label>
										<INPUT type=radio class="bluecheckradios" name="iscredit" id="iscredit2" value="0" <?php if ($this->populateForm['isCREDIT'] == 0) { echo 'checked="checked"'; } ?> ><label for="iscredit2">&nbsp;Non</label>
									</td>
								</tr>
								<tr >
									<td><label>Mode de paiement</label></td>
									<td>
										<table class="table">
											<tr class="nostriped">
												<td ><label for="modepaiement1">Paiement en ligne</label></td>
												<td>
													<input type="radio" class="bluecheckradios" id="modepaiement1" name="modepaiement" <?php if ($this->populateForm['MODEPAIEMENT'] == 1) { echo 'checked="checked"'; } ?> value="1">
												</td>
											</tr>
											<tr class="nostriped">
												<td><label for="modepaiement2">Contre remboursement</label></td>
												<td >
													<input type="radio" class="bluecheckradios" id="modepaiement2" name="modepaiement" <?php if ($this->populateForm['MODEPAIEMENT'] == 2) { echo 'checked="checked"'; } ?> value="2">
												</td>
											</tr>
											<tr class="nostriped">
												<td><label for="modepaiement3">A r�ception de la facture</label></td>
												<td >
													<input type="radio" class="bluecheckradios" id="modepaiement3" name="modepaiement" <?php if ($this->populateForm['MODEPAIEMENT'] == 6) { echo 'checked="checked"'; } ?> value="6">
												</td>
											</tr>
											<tr class="nostriped">
												<td><label>Paiement diff�r� de</label></td>
												<td>
													<table class="table">
														<tr class="nostriped">
															<td><label for="modepaiement4">30 jours</label></td>
															<td>
																<input type="radio" class="bluecheckradios" id="modepaiement4" name="modepaiement" <?php if ($this->populateForm['MODEPAIEMENT'] == 3) { echo 'checked="checked"'; } ?> value="3">
															</td>
														</tr>
														<tr class="nostriped">
															<td ><label for="modepaiement5">45 jours</label></td>
															<td>
																<input type="radio" class="bluecheckradios" id="modepaiement5" name="modepaiement" <?php if ($this->populateForm['MODEPAIEMENT'] == 4) { echo 'checked="checked"'; } ?> value="4">
															</td>
														</tr>
														<tr class="nostriped">
															<td ><label for="modepaiement6">60 jours</label></td>
															<td>
																<input type="radio" class="bluecheckradios" id="modepaiement6" name="modepaiement" <?php if ($this->populateForm['MODEPAIEMENT'] == 5) { echo 'checked="checked"'; } ?> value="5">
															</td>
														</tr>
													</table>
												</td>
											</tr>
										</table>
									</td>
								</tr>
								<tr>
									<td colspan="2" class="text-center">
										<input type="hidden" name="id" id="id" value="<?php echo $this->populateForm['ID']; ?>">
										<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
									</td>
								</tr>
							</table>
						</form> 
					</section>
				</div>
        
				<div class="tab-pane" id="tabs-panier">
					<section class="boxpadding">
						<?php echo $this->render("alert.phtml"); ?>	
						  <form action="<?php echo $this->baseUrl; ?>/backoffice/user/panieractiveall#tabs-panier" method="post">
							  <table  class="table">
								  <tr>
									  <td><label>Statut du panier personnalis�</label></td>
									  <td > 
										  <input type="radio" class="bluecheckradios" name="isActif" id="isActif1" value="Y" <?php if ($this->populateForm['isCADDYTYPE'] == 'Y') {echo 'checked="checked"'; } ?> /><label for="isActif1">&nbsp;Actif</label>
										  <input type="radio" class="bluecheckradios" name="isActif" id="isActif2" value="N" <?php if ($this->populateForm['isCADDYTYPE'] == 'N') {echo 'checked="checked"'; } ?>/><label for="isActif2">&nbsp;Inactif</label>
									  </td> 
									  <td >
										  <input type="hidden" name="id" id="id" value="<?php echo $this->populateForm['ID']; ?>"> 
										  <button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
									  </td>
								  </tr>
							  </table>
						  </form>   
						  <form action="<?php echo $this->baseUrl; ?>/backoffice/user/panieradd#tabs-panier" method="post">
							  <table  class="table">
								  <tr>
									  <td ><label for="reference">R�f�rence</label></td>
									  <td><input placeholder="R�f�rence du produit � remiser" type="text" name="reference" id="reference" class="form-control"></td>
									  <td> 
										  <div class="col-md-6 no-space-top">
											  <div class="col-md-3 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
											  <div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
										  </div>
										  <div class="col-md-6 no-space-top">
											  <div class="col-md-3 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
											  <div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
										  </div>
									  </td> 
									  <td>
										  <input type="hidden" name="id" id="id" value="<?php echo $this->populateForm['ID']; ?>"> 
										  <button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
									  </td>
								  </tr>
							  </table>
						  </form>   
							<?php if ($this->caddyType) { $caddyType = $this->caddyType; ?>
							<table class="table">
								<thead>
									<tr>
										<th></th>
										<th style="width:400px;">Produit</th>
										<th class="text-center">Prix</th> 
										<th class="text-center">Remise</th>  
										<th class="text-center">Statut</th>
										<th >Quantit�</th> 
										<th class="text-center">Remises</th> 
										<th ></th> 
									</tr>
								</thead>
								<tbody>
									<?php
									$index = 1; 
									foreach($caddyType->facture_lines as $row) { ?>
									<tr>
										<td>
											<?php if (isset($row->item_isAccessoire) && $row->item_isAccessoire == "N") { ?>
												<ul class="gallerybox ">
												  	<li>
														<figure>
															<a target="_blank" href="<?php echo $this->baseUrl."/backoffice/product/edit/showProduct/".$row->product_id; ?>" >
																<img src="<?php echo $this->baseUrl.'/'.$row->product_url; ?>">
															</a>
														</figure>
													</li>
												</ul>
											<?php } ?>
										</td>
										<td>
											<?php echo $row->item_designation;?><br/><br/>
											<?php echo "Ref. ".$this->escape($row->item_reference);?>
										</td> 
										<td >
											<?php  if ($row->isPromo()) { 
										 		$prix = $row->getPrixAfterRemise(); ?>
										 		<div class="text-remise">
											 		 <div class="text-remise-price" <?php if ($prix < 0) { echo 'style="color:red;"'; } ?>>
													 	<?php echo number_format($prix, 2, ',', ' ').' ';?>&#8364;
													 </div>
													 <div class="text-remise-price-old" <?php if ($prix < 0) { echo 'style="color:red;"'; } ?>>
													 	<?php echo number_format($row->item_prix, 2, ',', ' ').' ';?>&#8364;
													 </div>
										 		</div> 
												<?php } else { ?>
													<div class="text-no-remise">
														<?php echo number_format($row->item_prix, 2, ',', ' ').' ';?>&#8364;
													</div>
												<?php }  ?>
										</td>  
										<td   >
											<?php if ($this->escape($row->remise_euro) > 0 ) { echo $this->escape($row->remise_euro)."&nbsp;&#8364;"; } ?>
											<?php if ($this->escape($row->remise_pour) > 0 ) { echo $this->escape($row->remise_pour)."&nbsp;%"; } ?>
										</td> 								
										<td >
											<?php if ($row->isCaddyTypeActif()) { ?>
											<form action="<?php echo $this->baseUrl; ?>/backoffice/user/panieractive#tabs-panier" method="post">
												<input type="hidden" value="<?php echo $row->caddytype_id; ?>" name="idcaddy">
												<input type="hidden" value="<?php echo $caddyType->user_id; ?>" name="id">
												<input type="hidden" value="N" name="isActif">
												<button class="btn btn-danger" type="submit" name="edit"><i class="glyphicon glyphicon-resize-full"></i>&nbsp;D�sactiver</button>
											</form> 
											<?php } else { ?> 
											<form action="<?php echo $this->baseUrl; ?>/backoffice/user/panieractive#tabs-panier" method="post">
												<input type="hidden" value="<?php echo $row->caddytype_id; ?>" name="idcaddy">
												<input type="hidden" value="<?php echo $caddyType->user_id; ?>" name="id">
												<input type="hidden" value="Y" name="isActif">
												<button class="btn btn-primary" type="submit" name="edit"><i class="glyphicon glyphicon-resize-small"></i>&nbsp;Activer</button>
											</form> 
											<?php }?> 
										</td>
										<td class="text-center"> <?php echo $row->caddytype_qte_total; ?> </td>
										<td > 
											<form action="<?php echo $this->baseUrl; ?>/backoffice/user/panieredit#tabs-panier" method="post">
												<div class="col-md-12 no-space-top">
													<div class="col-md-4 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
													<div class="col-md-7 no-space-top"><input placeholder="Remise en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
												</div>
												<div class="col-md-12 no-space-top">
													<div class="col-md-4 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
													<div class="col-md-7 no-space-top"><input placeholder="Remise en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
												</div>
												<div class="col-md-12 no-space-top text-center">
													<input type="hidden" value="<?php echo $row->caddytype_id; ?>" name="idcaddy">
													<input type="hidden" value="<?php echo $caddyType->user_id; ?>" name="id">
													<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
												</div>
											</form>
										</td> 
										<td>
											<form action="<?php echo $this->baseUrl; ?>/backoffice/user/panierdel#tabs-panier" method="post" id="delRemisePanier<?php echo $index; ?>">
												<input type="hidden" value="<?php echo $row->caddytype_id; ?>" name="idcaddy">
												<input type="hidden" value="<?php echo $caddyType->user_id; ?>" name="id">
												<button class="btn btn-danger btn-modal" type="button" data-toggle="ajaxModalSubmitDelete" data-form="delRemisePanier<?php echo $index; ?>"  ><i class="glyphicon glyphicon-trash"></i>&nbsp;Supprimer</button>
											</form>
										</td>
									</tr>
									<?php $index++;} ?>
								</tbody>
							</table>
							<?php } ?> 
					</section>
				</div>
        
				<div class="tab-pane" id="tabs-remises">
					<section class="boxpadding">
						<?php $isOneRemise = false; ?>
						<table  class="table">
							<?php if ($this->listUser) { $isOneRemise = true; $listUser = $this->listUser; ?>
							<tr >
								<td >Remise sur les commandes</td>
								<td >
									<?php if ($this->escape($listUser['REMISEEURO']) > 0 ) { echo $this->escape($listUser['REMISEEURO'])."&nbsp;&#8364;"; } ?>
									<?php if ($this->escape($listUser['REMISEPOUR']) > 0 ) { echo $this->escape($listUser['REMISEPOUR'])."&nbsp;%"; } ?>
								</td>
							</tr>
							<?php } 
							if ($this->listUserBrend) { $isOneRemise = true; $listUserBrend = $this->listUserBrend;
								foreach($listUserBrend as $row) {  ?>
							<tr >
								<td >Pour les produits de la marque 
									<a class="btn btn-primary" target="_blank" href="<?php echo $this->baseUrl; ?>/backoffice/supplier/edit/id/<?php echo $this->escape($row['IDSUPPLIER']);?>">
										<?php echo $row['BREND']; ?>
									</a>
								</td>
								<td > 
									<?php if ($this->escape($row['REMISEEURO']) > 0 ) { echo $this->escape($row['REMISEEURO'])."&nbsp;&#8364;"; } ?>
									<?php if ($this->escape($row['REMISEPOUR']) > 0 ) { echo $this->escape($row['REMISEPOUR'])."&nbsp;%"; } ?>
								</td>
							</tr>
							<?php }}
							if ($this->listCinternBrend) {  $isOneRemise = true; $listCinternBrend = $this->listCinternBrend;
							foreach($listCinternBrend as $row) {
							?>
							<tr >
								<td >Pour le code interne 
									<a class="btn btn-primary" target="_blank" href="<?php echo $this->baseUrl; ?>/backoffice/user/codeinterne">
										<?php echo $row['CODEINTERN'].' - '.$row['LABELINTERN'];?>
									</a>	
									et produits de la marque 
									<a class="btn btn-primary" target="_blank" href="<?php echo $this->baseUrl; ?>/backoffice/supplier/edit/id/<?php echo $this->escape($row['IDSUPPLIER']);?>">
										<?php echo $row['BREND']; ?>
									</a> 
								</td>
								<td > 
									<?php if ($this->escape($row['REMISEEURO']) > 0 ) { echo $this->escape($row['REMISEEURO'])."&nbsp;&#8364;"; } ?>
									<?php if ($this->escape($row['REMISEPOUR']) > 0 ) { echo $this->escape($row['REMISEPOUR'])."&nbsp;%"; } ?>
								</td>
							</tr>
							<?php } } ?> 
							<?php if (!$isOneRemise) { ?> 
								<tr><td colspan="2">Aucune remise n'est associ�e au client</td> </tr>
							<?php } ?>
						</table> 
					</section>
				</div>

        <div class="tab-pane" id="tabs-fidelitypoint">
          <section class="boxpadding">
            <div style="padding:10px;">
                <div>Nombre de points : <?php echo $this->userfidelite['POINTFIDELITETOTAL']; ?></div>
              
              <?php if (isset($this->listcommandfidelite) && !empty($this->listcommandfidelite)) { ?>
              <div class="col-md-12">
                <table class="display table" id="commandfideliteTable" width="100%">
	                <thead>
		                <tr>
			                <th class="text-center">R�f�rence</th>
			                <th class="text-center">Client</th>
                      <th class="no-wrap text-center">Date de la commande</th>
		                </tr>
	                </thead>
	                <tbody>
		                <?php foreach($this->listcommandfidelite as $row) { ?> 
		                <tr>
			                <td class="text-center"> <a class="btn btn-primary"  href="<?php echo $this->baseUrl; ?>/backoffice/command/edit/id/<?php echo $row['ID']; ?>"><span class="glyphicon glyphicon-list-alt"></span>&nbsp;<?php echo $this->escape($row['REFERENCE']);?></a></td>
			                <td class="text-center"><a class="btn btn-primary " href="<?php echo $this->baseUrl; ?>/backoffice/user/edit/id/<?php echo $row['IDUSER']; ?>" ><span class="glyphicon glyphicon-user"></span>&nbsp;<?php echo $row['USER_NOM'].' '.$row['USER_PRENOM'];?></a></td>
                      <td class="text-center"><?php 
			                $myDate = new Zend_Date(strtotime($row['DATESTART']));
			                $mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
			                $moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
			                echo $myDate->toString("dd").' '.$mois[(int)$myDate->toString('MM')].' '.$myDate->toString("YYYY");
				
			                ?></td>
		                </tr>
		                <?php } ?>
	                </tbody>
                </table>
              </div>
              <?php } ?>
            </div>
          </section>
			  </div>
        
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
  $(function(){
  initTabs(window.location.hash);
  initDataTable('commandfideliteTable', [[ 0, "asc" ]], [{ "orderable": true, "targets": -1, "width": "270px" }]);
  });
</script>
		modules/backoffice/views/scripts/user/list.phtml000060400000005164150710367660016130 0ustar00<div class="table-box">
<div class="col-md-12 header-single-line">
	<div class="col-md-5 header-single no-space-top"><?php echo $this->titlePage; ?></div>
	<div class="col-md-7 no-space-top"><?php echo $this->render("alert.phtml"); ?></div>
</div>
<?php echo $this->paginationControl($this->paginator, 'All', 'pagination.phtml'); ?>
<table class="display table" id="supplierTable" width="100%">
	<thead>
		<tr>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/user/list/col/NOM">Nom</a></th>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/user/list/col/PRENOM">Pr�nom</a></th>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/user/list/col/RAISONSOCIAL">Raison sociale</a></th>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/user/list/col/TYPE">Type</a></th>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/user/list/col/EMAIL">Email</a></th>
			<th><a href="<?php echo $this->baseUrl; ?>/backoffice/user/list/col/TEL">Tel</a></th>
			<th></th>
		</tr> 	
	</thead>
	<tbody>
	
		<?php foreach($this->paginator as $row)  { ?>
		<tr>
			<td><?php echo $row->NOM;?></td>
			<td><?php echo $row->PRENOM;?></td>
			<td><?php echo $row->RAISONSOCIAL;?></td>
			<td><?php echo $this->escape($row->TYPE);?></td>
			<td><?php echo $this->escape($row->EMAIL);?></td>
			<td><?php echo $this->escape($row->TEL);?></td>
			<td class="text-center no-space-side">
				<div class="btn-group">
	             	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/user/edit/id/<?php echo $row->ID; ?>" ><span class="glyphicon glyphicon-edit"></span> Modifier</a>
				  	<?php if ($this->escape($row->isBAN) == 1) { ?>
			        	<a class="btn btn-warning" href="<?php echo $this->baseUrl; ?>/backoffice/user/ban/id/<?php echo $row->ID; ?>/ban/0/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>" ><span class="glyphicon glyphicon-ban-circle"></span> Bannir</a>
			        <?php } else { ?>
			       		<a class="btn btn-warning" href="<?php echo $this->baseUrl; ?>/backoffice/user/ban/id/<?php echo $row->ID; ?>/ban/1/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>" ><span class="glyphicon glyphicon-ok-sign"></span> D�bannir</a>
			         <?php } ?>
					<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/user/del/id/<?php echo $row->ID; ?>/page/<?php echo  $this->paginator->getCurrentPageNumber(); ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<?php echo $this->paginationControl($this->paginator, 'All', 'pagination.phtml'); ?>
</div>modules/backoffice/views/scripts/user/newsletter.phtml000060400000003550150710367660017346 0ustar00 <div class="table-box">
	<form action="<?php echo $this->baseUrl; ?>/backoffice/user/newsletter" method="post">
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;De</td>
				<td class="col-md-8"><input name="fromMessage"  class="form-control" size="50"  value="<?php echo $this->messageFrom; ?>"></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Envoyer �</td>
				<td class="col-md-8">
					<?php $listMail = $this->listMail; ?>
					<select name="email" class="form-control">
						<option value="All" selected="selected">Tout le monde</option>
						<?php foreach ($listMail as $row) { ?>
						<option value="<?php echo $row['EMAIL']; ?>"><?php echo $row['EMAIL']; ?></option>
						<?php } ?>
					</select>
				</td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Objet du mail</td>
				<td class="col-md-8"><input type="text"  class="form-control" size="50" name="objetMessage" value="<?php echo $this->messageObjet; ?>"></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Message</td>
				<td class="col-md-8"><textarea rows="30" class="form-control" cols="50" name="mailMessage" id="mailMessage"><?php echo $this->messageBody; ?></textarea></td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-envelope"></i>&nbsp;Envoyer le mail</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
$(function(){
	initEditor('#mailMessage');
});
</script>modules/backoffice/views/scripts/user/guest.phtml000060400000001453150710367660016301 0ustar00<div class="table-box">
<div class="col-md-12 header-single-line">
	<div class="col-md-5 header-single no-space-top"><?php echo $this->titlePage; ?></div>
	<div class="col-md-7 no-space-top"><?php echo $this->render("alert.phtml"); ?></div>
</div>
<?php echo $this->paginationControl($this->paginator, 'All', 'pagination.phtml'); ?>
<table class="display table" id="supplierTable" width="100%">
	<thead>
		<tr>
			<th>Informations</th>
			<th>Email</th>
			<th>Action</th>
		</tr> 	
	</thead>
	<tbody>
	
		<?php foreach($this->paginator as $row)  { ?>
		<tr>
			<td><?php echo $row->INFORMATION;?></td>
			<td><?php echo $row->EMAIL;?></td>
			<td><?php echo $row->ACTION;?></td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<?php echo $this->paginationControl($this->paginator, 'All', 'pagination.phtml'); ?>
</div>modules/backoffice/views/scripts/user/search.phtml000060400000003460150710367660016417 0ustar00 <div class="table-box">
	<form method="POST" action="<?php echo $this->baseUrl; ?>/backoffice/user/search">
	<table class="table">
		<thead>
			<tr>
				<th class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr class="nostriped">
				<td class="col-md-12"> 
					<div class="col-md-6 no-space-top"><input type="text" class="form-control" placeholder="Rechercher un nom, un pr�nom, un email, un t�l�phone ou une adresse" size="50" value="" id="searchValue" name="searchValue"></div>
					<div class="col-md-6 text-center no-space-top">
						<button type="submit" name="search"  class="btn btn-primary">
						  <span class="glyphicon glyphicon-search"></span> Rechercher
						</button>				
					</div>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<div class="table-box">
<table class="display table" id="userSearchTable" width="100%">
	<thead>
		<tr>
			<th>Nom</th>
			<th>Pr�nom</th>
			<th>Email</th>
			<th>Tel</th>
			<th>Adresse</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	
		<?php foreach($this->listSearch as $row)  { ?>
		<tr>
			<td><?php echo $row->NOM;?></td>
			<td><?php echo $row->PRENOM;?></td>
			<td><?php echo $row->EMAIL;?></td>
			<td><?php echo $row->TEL;?></td>
			<td><?php echo $row->ADRESSE;?></td>
			<td class="text-center no-space-side">
				<div class="btn-group">
	             	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/user/edit/id/<?php echo $row->ID; ?>" ><span class="glyphicon glyphicon-edit"></span> Modifier</a>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>			
	$(document).ready(function() {
		initDataTable('userSearchTable', [[ 0, "asc" ]], [ { "orderable": false, "targets": -1}]); 	    
	});
</script>
</div>
modules/backoffice/views/scripts/user/codeinterne.phtml000060400000005571150710367660017456 0ustar00 <div class="table-box">
	<form method="POST" action="<?php echo $this->baseUrl; ?>/backoffice/user/codeinterne">
	<table class="table">
		<thead>
			<tr>
				<th class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr class="nostriped">
				<td>
					<div class="col-md-6 no-space-top">
						<div class="col-md-4 no-space-top"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Code</div>
						<div class="col-md-8 no-space-top"><input type="text" class="form-control" placeholder="Code interne pouvant �tre associ� au client"  name="code" id="code" value="" size="20" ></div>
					</div>					
					<div class="col-md-6 no-space-top">
						<div class="col-md-4 no-space-top"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Description</div>
						<div class="col-md-8 no-space-top"><input type="text" class="form-control" placeholder="Description du code interne" name="label" id="label" value="" size="60" ></div>
					</div>
				</td>
			</tr>
			<tr class="nostriped">
				<td class="text-center">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>

<div class="table-box">
<table class="display table" id="optionTable" width="100%">
	<thead>
		<tr>
			<th>Codes internes</th> 
		</tr>
	</thead>
	<tbody>
		<?php foreach($this->listcodeintern as $row)  { ?>
		<tr>
			<td>
				<form method="POST" action="<?php echo $this->baseUrl; ?>/backoffice/user/codeinterneedit">
					<div class="col-md-5 no-space-top">
						<div class="col-md-4 no-space-top"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Code</div>
						<div class="col-md-8 no-space-top"><input type="text" class="form-control" size="20" name="code" id="code" value="<?php echo $this->escape($row['CODE']);?>"></div>
					</div>					
					<div class="col-md-5 no-space-top">
						<div class="col-md-4 no-space-top"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Description</div>
						<div class="col-md-8 no-space-top"><input type="text" class="form-control"  size="60" name="label" id="label" value="<?php echo $this->escape($row['LABEL']);?>"></div>
					</div>
					<div class="col-md-2 no-space-top">
						<input type="hidden" name="id" id="id" value="<?php echo $this->escape($row['ID']);?>">
						<div class="btn-group">
							<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
							<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/user/codeinternedel/id/<?php echo $this->escape($row['ID']);?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
						</div>
					</div>
				</form>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
</div>modules/backoffice/views/scripts/productglobal/list.phtml000060400000016771150710367660020021 0ustar00<div class="table-box">
 	<table  class="table">
 		<tr><td><h5>Augmentation g�n�rale du prix des produits</h5></td></tr>
		<?php echo $this->render("alert_tr.phtml"); ?>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/productglobal/addpricecategory" method="post">
					<div class="col-md-12 no-space-top">
						<div class="col-md-2 no-space-top"><label>De la cat�gorie</label></div>
						<div class="col-md-4 no-space-top">
							<select name="listcategory" class="form-control">
								<option value="none">Aucun</option>
								<option value="0">Tous</option>
								<?php 
								$show = array();
								foreach($this->listallcategories as $row) { 
								 	for ($level=0 ; $level<11; $level++) { 
										if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
										?>
											<option value="<?php echo $this->escape($row['ID'.$level]); ?>">
												<?php 
								 				for ($i=0 ; $i<$level; $i++) { 
													echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
												}
												echo $this->escape($row['NOM'.$level]); ?>
											
											</option>
											<?php 
											$show['NOM'.$level] = $row['NOM'.$level];
										}
									 } 
								} ?>
							</select>
						</div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-6 no-space-top">
								<label >Pourcentage de prix&nbsp;% </label>
							</div>
							<div class="col-md-3 no-space-top">
								<select class="form-control" name="pricesign">
									<option>+</option>
									<option>-</option>
								</select>
							</div>
							<div class="col-md-3 no-space-top">
								<input class="form-control" type="text" size="2" name="pricepour" id="pricepour" value="" maxlength="2">
							</div>
						</div>
						<div class="col-md-2 no-space-top text-center">
							<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
						</div>
					</div>
				</form>
			</td>
		</tr>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/productglobal/addpricebrend" method="post">
					<div class="col-md-12 no-space-top">
						<div class="col-md-2 no-space-top"><label>De la marque</label></div>
						<div class="col-md-4 no-space-top">
							<select name="listbrend" class="form-control">
								<option value="none">Aucun</option>
									<?php foreach($this->listbrend as $row) { ?>
									<option value="<?php echo $this->escape($row['ID']); ?>" >
										<?php echo $this->escape($row['BREND']); ?>
									</option>
									<?php } ?>
							</select>
						</div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-6 no-space-top">
								<label >Pourcentage de prix&nbsp;% </label>
							</div>
							<div class="col-md-3 no-space-top">
								<select class="form-control" name="pricesign">
									<option>+</option>
									<option>-</option>
								</select>
							</div>
							<div class="col-md-3 no-space-top">
								<input class="form-control" type="text" size="2" name="pricepour" id="pricepour" value="" maxlength="2">
							</div>
						</div>
						<div class="col-md-2 no-space-top text-center">
							<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
						</div>
					</div>
				</form>
			</td>
		</tr>
 		<tr><td><h5>Grille de frais de livraison </h5></td></tr>
		<tr>
			<td>
			<form action="<?php echo $this->baseUrl; ?>/backoffice/productglobal/commandadd" method="post">
					<div class="col-md-12 no-space-top">
						<div class="col-md-2 no-space-top"><label>Frais de livraison</label></div>
						<div class="col-md-3 no-space-top">Quand le MONTANT TOTAL de la commande est inf�rieur � </div>
						<div class="col-md-4 no-space-top"><input placeholder="Montant de la commande" type="text" class="form-control" name="montantfrais" value="" /></div>
						<div class="col-md-3 no-space-top">&nbsp;&#8364;, les frais de livraison sont de </div>
					</div>
					<div class="col-md-12">
						<div class="col-md-2 no-space-top"></div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
						</div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
						</div>
						<div class="col-md-2 no-space-top text-center">
							<input type="hidden" value="4" name="remise" />
							<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
						</div>
					</div>
					
			</form>
			</td>
		</tr>
 		<tr><td><h5>Validation de la commande</h5></td></tr>
		<tr>
			<td>
			<form action="<?php echo $this->baseUrl; ?>/backoffice/productglobal/commandadd" method="post">
					<div class="col-md-12 no-space-top">
						<div class="col-md-2 no-space-top"><label>Commande</label></div>
						<div class="col-md-3 no-space-top">Quand le MONTANT TOTAL de la commande est inf�rieur � </div>
						<div class="col-md-4 no-space-top"><input placeholder="Montant de la commande" type="text" class="form-control" name="montantfrais" value="" /></div>
						<div class="col-md-3 no-space-top">&nbsp;&#8364;, la commande n'est pas valide </div>
					</div>
					<div class="col-md-12 no-space-top text-right">
						<input type="hidden" value="5" name="remise" />
						<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
					</div>
					
			</form>
			</td>
		</tr>
	</table>
</div>
<div class="table-box">
	<table class="table">
 		<tr><td colspan="2"><h5>Remises effectives</h5></td></tr>
	 <?php 
		if ($this->remiseFrais) { 
			$remise = $this->remiseFrais;
			foreach($remise as $row) :
			?>
		<tr >
			<td >Si le MONTANT TOTAL de la commande est < <b><?php echo $row['MONTANTFRAISCMD'];?>&nbsp;&#8364;</b> les frais de livraison sont de 
				<b><?php if ($row['REMISEPOUR']>0) {echo $row['REMISEPOUR'].'&nbsp;%';} else {echo $row['REMISEEURO'].'&nbsp;&#8364;';} ?></b> du MONTANT TOTAL
			</td>
			<td class="text-center">
				<a class="btn btn-danger" href="<?php echo $this->baseUrl; ?>/backoffice/productglobal/commanddel/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
			</td>
		</tr>
		<?php endforeach; }
		if ($this->validCommand) { 
			$validCommand = $this->validCommand;
			?>
			<tr >
				<td >Si le MONTANT TOTAL de la commande est < <b><?php echo $validCommand['MONTANTVALID'];?>&nbsp;&#8364;</b>, la commande n'est pas valide 
				</td>
				<td class="text-center">
					<a class="btn btn-danger" href="<?php echo $this->baseUrl; ?>/backoffice/productglobal/commanddel/id/<?php echo $validCommand['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
				</td>
			</tr>
		<?php } ?>
 </table>
</div>

<table cellpadding="0" cellspacing="5" border="0" width="100%">
	<tr >
		<td colspan="2" style="background:#666666; height: 1px"></td>
	</tr>
	
	
	<tr >
		<td colspan="2" style="background:#666666; height: 1px"></td>
	</tr>
</table>modules/backoffice/views/scripts/footer/add.phtml000060400000002730150710367660016221 0ustar00 <div class="table-box">
	<form action="<?php echo $this->baseUrl; ?>/backoffice/footer/add" method="post" name="addFooterForm" >
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Titre</td>
				<td class="col-md-8"><input type="text" class="form-control" placeholder="Titre du pied de page" name="titre" size="40" id="titre" value="<?php echo $this->populateFormFooter['TITRE']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4">Lien</td>
				<td class="col-md-8"><input type="text" class="form-control" placeholder="Lien direct vers une autre page" name="url" size="40" id="url" value="<?php echo $this->populateFormFooter['URL']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4">Contenu</td>
				<td class="col-md-8"><textarea rows="30" placeholder="Ou �diter un contenu" class="form-control" cols="50" name="content" id="content"><?php echo $this->populateFormFooter['CONTENT']; ?></textarea></td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
$(function(){
	initEditor('#content');
});
</script>
		modules/backoffice/views/scripts/footer/doc.phtml000060400000003463150710367660016242 0ustar00 <div class="table-box">
	<form action="<?php echo $this->baseUrl; ?>/backoffice/footer/adddoc" method="post" name="addDoc"  enctype="multipart/form-data" >
	<table class="table">
		<thead>
			<tr>
				<th class="col-md-4" colspan="2"><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr class="nostriped">
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Document</td>
				<td class="col-md-8"><input type="file" name="file" id ="file" size="50" ><i>Extensions : pdf</i></td>
			</tr>
			<tr class="nostriped">
				<td colspan="2" class="text-center">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>

<div class="table-box">
<table class="display table" id="optionTable" width="100%">
	<thead>
		<tr>
			<th>Documents</th> 
		</tr>
	</thead>
	<tbody>
		<?php 
			$files = glob("doc/*.pdf");
			$count = 0;
			for ($i=0; $i <sizeof($files); $i++) {				
		?>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/footer/deldoc" method="post" id="delDocForm<?php echo $count;?>">
				<div class="col-md-8 no-space-top"><a href="<?php echo '/'.$files[$i]; ?>" target="_blank"><?php echo '/'.$files[$i]; ?></a></div>
				<div class="col-md-4 no-space-top">
					<input type="hidden" name="doc" value="<?php echo $files[$i]; ?>" > 
					<div class="btn-group">
						<button class="btn btn-danger btn-modal" type="button" data-toggle="ajaxModalSubmitDelete" data-form="delDocForm<?php echo $count;?>"  ><i class="glyphicon glyphicon-trash"></i>&nbsp;Supprimer</button>
					</div>
				</div>
				</form>
			</td>
		</tr>
		<?php $count++; } ?>
	</tbody>
</table>
</div>modules/backoffice/views/scripts/footer/list.phtml000060400000002430150710367660016441 0ustar00<div class="table-box">
<div class="col-md-12 header-single-line">
	<div class="col-md-5 header-single no-space-top"><?php echo $this->titlePage; ?></div>
	<div class="col-md-7 no-space-top"><?php echo $this->render("alert.phtml"); ?></div>
</div>
<table class="display table" id="supplierTable" width="100%">
	<thead>
		<tr>
			<th>Titre</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	
		<?php foreach($this->listfooter as $row)  { ?>
		<tr>
			<td><?php echo $this->escape($row['TITRE']);?></td>
			<td class="text-center">
				<div class="btn-group">
	             	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/footer/edit/id/<?php echo $row['ID']; ?>"><span class="glyphicon glyphicon-edit"></span> Modifier</a>
					<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/footer/del/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>			
	$(document).ready(function() {
		initDataTable('supplierTable', [[ 0, "asc" ]], [
		                    		                { "orderable": false, "targets": -1, "width": "300px" }
		                    		              ]); 	    
	});
</script>
</div>
modules/backoffice/views/scripts/footer/edit.phtml000060400000003075150710367660016421 0ustar00 <div class="table-box">
	<form action="<?php echo $this->baseUrl; ?>/backoffice/footer/edit" method="post" name="editFooterForm" >
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Titre</td>
				<td class="col-md-8"><input type="text" class="form-control" placeholder="Titre du pied de page" name="titre" size="40" id="titre" value="<?php echo $this->populateFormFooter['TITRE']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4">Lien</td>
				<td class="col-md-8"><input type="text" class="form-control" placeholder="Lien direct vers une autre page" name="url" size="40" id="url" value="<?php echo $this->populateFormFooter['URL']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4">Contenu</td>
				<td class="col-md-8"><textarea rows="30" placeholder="Ou �diter un contenu" class="form-control" cols="50" name="content" id="content"><?php echo $this->populateFormFooter['CONTENT']; ?></textarea></td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<input type="hidden" name="id" id="id" value="<?php echo $this->populateFormFooter['ID']; ?>" >
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
$(function(){
	initEditor('#content');
});
</script>modules/backoffice/views/scripts/alert_tr1.phtml000060400000000230150710367660016061 0ustar00<?php if (!empty($this->messageError) || !empty($this->messageSuccess)) { ?>
<tr>
	<td><?php echo $this->render("alert.phtml"); ?></td>
</tr>
<?php } ?>modules/backoffice/views/scripts/maintenance/index.phtml000060400000011446150710367660017570 0ustar00
<div class="col-md-12">
  <span class="errorText">
    <?php echo $this -> messageError; ?>
  </span>
  <span class="successText">
    <?php echo $this -> messageSuccess; ?>
  </span>
</div>

<div class="col-md-12">
  <h1>Cat�gorie</h1>
  <div class="col-md-3">
    <div class="col-md-8">
      Cat�gorie : Lancer le recalcule des urls (Acc�s hi�rarchique)
    </div>
    <div class="col-md-4">
      <a href="<?php echo $this->baseUrl; ?>/backoffice/maintenance/generatecategoryurlaccess" class="btn btn-success"><i class="fa fa-gear"></i>&nbsp;Lancer
      </a>
    </div>
  </div>
</div>

<div class="col-md-12">
  <h1>Cat�gorie subsidiaire</h1>
  <div class="col-md-3">
    <div class="col-md-8">
      Cat�gorie subsidiaire : Lancer le recalcule des urls (Acc�s hi�rarchique)
    </div>
    <div class="col-md-4">
      <a href="<?php echo $this->baseUrl; ?>/backoffice/maintenance/generatecategory2urlaccess" class="btn btn-success"><i class="fa fa-gear"></i>&nbsp;Lancer
      </a>
    </div>
  </div>
</div>

<div class="col-md-12">
  <h1>Produit</h1>
  <div class="col-md-3">
    <div class="col-md-8">
      Produit - R�f�rence - Designation : Nettoyage de la r�f�rence des items
    </div>
    <div class="col-md-4">
      <a href="<?php echo $this->baseUrl; ?>/backoffice/maintenance/cleanproductdesignationreference" class="btn btn-success"><i class="fa fa-gear"></i>&nbsp;Lancer
      </a>
    </div>
  </div>
  <div class="col-md-3">
    <div class="col-md-8">
      Produit inactif => Produit actif + Disponibilit� : Epuis�
    </div>
    <div class="col-md-4">
      <a href="<?php echo $this->baseUrl; ?>/backoffice/maintenance/productchangeinactivetoepuise" class="btn btn-success"><i class="fa fa-gear"></i>&nbsp;Lancer
      </a>
    </div>
  </div>
  <div class="col-md-3">
    <div class="col-md-8">
      Calcul des meilleures ventes
    </div>
    <div class="col-md-4">
      <a href="<?php echo $this->baseUrl; ?>/backoffice/maintenance/productcomputebestseller" class="btn btn-success"><i class="fa fa-gear"></i>&nbsp;Lancer
      </a>
    </div>
  </div>
</div>

<div class="col-md-12">
  <h1>Images</h1>
  <div class="col-md-12">
    <div class="col-md-3">
      <div class="col-md-8">
        Image de produits - Renommage des noms de type date
      </div>
      <div class="col-md-4">
        <a href="<?php echo $this->baseUrl; ?>/backoffice/maintenance/cleanproductimagename" class="btn btn-success"><i class="fa fa-gear"></i>&nbsp;Lancer
        </a>
      </div>
    </div>
    <div class="col-md-3">
      <div class="col-md-8">
        Image de cat�gories - Renommage des noms de type date
      </div>
      <div class="col-md-4">
        <a href="<?php echo $this->baseUrl; ?>/backoffice/maintenance/cleancategoryimagename" class="btn btn-success"><i class="fa fa-gear"></i>&nbsp;Lancer
        </a>
      </div>
    </div>
    <div class="col-md-3">
      <div class="col-md-8">
        Image de cat�gories subsidiaire - Renommage des noms de type date
      </div>
      <div class="col-md-4">
        <a href="<?php echo $this->baseUrl; ?>/backoffice/maintenance/cleancategorysubsimagename" class="btn btn-success"><i class="fa fa-gear"></i>&nbsp;Lancer
        </a>
      </div>
    </div>
    <div class="col-md-3">
      <div class="col-md-8">
        Image de fournisseur - Renommage des noms de type date
      </div>
      <div class="col-md-4">
        <a href="<?php echo $this->baseUrl; ?>/backoffice/maintenance/cleansupplierimagename" class="btn btn-success"><i class="fa fa-gear"></i>&nbsp;Lancer
        </a>
      </div>
    </div>
  </div>
  <div class="col-md-12">
    <div class="col-md-3">
      <div class="col-md-8">
        Redimensionnement d'images (Width : <?php echo $this->FeaturePictureResizeWidth; ?>px, Height : <?php echo $this->FeaturePictureResizeHeight; ?>px) <br />Produits - Cat�gories - Cat�gories subsidiaires - Fournisseurs
      </div>
      <div class="col-md-4">
        <a href="<?php echo $this->baseUrl; ?>/backoffice/maintenance/resizepicture" class="btn btn-success"><i class="fa fa-gear"></i>&nbsp;Lancer
        </a>
      </div>
    </div>
  </div>


  <div class="col-md-12">
    <h1>Elastic search</h1>
    <div class="col-md-3">
        <div class="col-md-8">
          Indexation Globale
        </div>
        <div class="col-md-4">
          <a href="javascript:;" class="btn btn-success" onclick="sendRequest('<?php echo $this->baseUrl; ?>/backoffice/maintenance/elasticsearchglobaleindeaxation')"><i class="fa fa-gear"></i>&nbsp;Lancer</a>
        </div>
    </div>
  </div>

  <script type="text/javascript">
    function sendRequest(urlToSend) {
        $.ajax({
            url: urlToSend, 
            type: 'GET',
            async: true,
            success: function() {
              $(".successText").html( "La requete � �t� envoy�." );
            }
        });
    }
  </script>
</div>



modules/backoffice/views/scripts/maintenance/generatenavnomproduct.phtml000060400000000260150710367660023063 0ustar00<div style="clear: both;">
<span class="errorText"><?php echo $this -> messageError; ?></span>
<span class="successText"><?php echo $this -> messageSuccess; ?></span>

</div>
	modules/backoffice/views/scripts/maintenance/message.phtml000060400000000260150710367660020075 0ustar00<div style="clear: both;">
<span class="errorText"><?php echo $this -> messageError; ?></span>
<span class="successText"><?php echo $this -> messageSuccess; ?></span> 
</div>
	modules/backoffice/views/scripts/annonceright/list.phtml000060400000011605150710367660017626 0ustar00
<div class="table-box">
  <?php if ($this->populateFormAnnonce['NOM']) { ?>
  <form action="<?php echo $this->baseUrl; ?>/backoffice/annonceright/edit" method="post" name="editAnnonceForm" >
  <?php } else { ?>
  <form action="<?php echo $this->baseUrl; ?>/backoffice/annonceright/add" method="post" name="addAnnonceForm" >
    <?php } ?>
    <table class="table">
      <thead>
        <tr>
          <th colspan="2" class="col-md-4" >
            <?php echo $this->titlePage; ?>
          </th>
        </tr>
      </thead>
      <tbody>
        <?php echo $this->render("alert_tr.phtml"); ?>
        <tr >
          <td class="col-md-4">
            <i class="glyphicon glyphicon-asterisk"></i>&nbsp;Titre
          </td>
          <td class="col-md-8">
            <input type="text" class="form-control" placeholder="Titre de l'annonce" name="nom" size="40" id="nom" value="<?php echo $this->populateFormAnnonce['NOM']; ?>"/>
          </td>
        </tr>
        <tr >
          <td class="col-md-4">
            <i class="glyphicon glyphicon-asterisk"></i>&nbsp;Statut
          </td>
          <td class="col-md-8">
            <input type="radio" value="0" name="isshow" id="isshow1" class="bluecheckradios" <?php if ($this->populateFormAnnonce['isSHOW'] == 0) { echo 'checked="checked"';} ?>><label for="isshow1">&nbsp;Actif</label>
            <input type="radio" value="1" name="isshow" id="isshow2" class="bluecheckradios" <?php if ($this->populateFormAnnonce['isSHOW'] == 1) { echo 'checked="checked"';} ?>><label for="isshow2">&nbsp;Inactif</label>

          </td>
        </tr>
        <tr >
          <td class="col-md-4">
            <i class="glyphicon glyphicon-asterisk"></i>&nbsp;Contenu
          </td>
          <td class="col-md-8">
            <textarea  name="content" cols="130" rows="20" id="annonceright" name="annonceright">
              <?php if (isset($this->populateFormAnnonce['CONTENT']) && !empty($this->populateFormAnnonce['CONTENT'])) { 
							 echo $this->populateFormAnnonce['CONTENT']; 
						} ?>
            </textarea>
          </td>
        </tr>
        <?php if ($this->FeatureAnnonceRightPosition) { ?>
        <tr >
          <td class="col-md-4">
            <i class="glyphicon glyphicon-asterisk"></i>&nbsp;Position
          </td>
          <td class="col-md-8">
            <input type="radio" value="0" name="position" id="position1" class="bluecheckradios"  <?php if ($this->populateFormAnnonce['POSITION'] == 0) { echo 'checked="checked"';} ?>><label for="position1">&nbsp;Avant les produits</label>
            <input type="radio" value="1" name="position" id="position2" class="bluecheckradios" <?php if ($this->populateFormAnnonce['POSITION'] == 1) { echo 'checked="checked"';} ?>><label for="position2">&nbsp;Apr�s les produits</label>
          </td>
        </tr>
       <?php } else { ?>
          <input type="hidden"  name="position" value="0"/>
        <?php }?>
        <tr>
          <td colspan="2" class="text-center">
            <?php if ($this->populateFormAnnonce['NOM']) { ?>
            <input type="hidden" name="id" value="<?php echo $this->populateFormAnnonce['ID'];?>">
            <button class="btn btn-success" type="submit" name="edit">
              <i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier
            </button>
            <?php } else { ?>
            <button class="btn btn-success" type="submit" name="add">
              <i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter
            </button>
            <?php } ?>

          </td>
        </tr>
      </tbody>
    </table>
  </form>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
  $(function(){
  initEditor('#annonceright');
  });
</script>




<div class="table-box">
  <table class="display table" id="annoncerightTable" width="100%">
    <thead>
      <tr>
        <th>Titre</th>
        <th>Statut</th>
        <th></th>
      </tr>
    </thead>
    <tbody>

      <?php foreach($this->listannonce as $row)  { ?>
      <tr>
        <td>
          <?php echo $row['NOM'];?>
        </td>
        <td>
          <?php if ($this->escape($row['isSHOW'])==0) {echo 'Actif';} else {echo 'Inactif';} ?>
        </td>
        <td>
          <div class="btn-group">
            <a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/annonceright/edit/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-edit"></span> Modifier
            </a>
            <button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/annonceright/del/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer
            </button>
          </div>
        </td>
      </tr>
      <?php } ?>
    </tbody>
  </table>
  <script>
    $(document).ready(function() {
    initDataTable('annoncerightTable', [[ 0, "asc" ]], [{ "orderable": false, "targets": -1, "width": "270px" }]);
    });
  </script>
</div>
modules/backoffice/views/scripts/promotion/product.phtml000060400000036052150710367660017705 0ustar00<div class="table-box">
 	<table  class="table">
 		<tr><td><h5>Remises associ�es aux produits</h5></td></tr>
		<?php echo $this->render("alert_tr.phtml"); ?>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/productadd" method="post">
					<div class="col-md-12 no-space-top">
						<div class="col-md-2 no-space-top"><label>Sur un produit</label></div>
						<div class="col-md-10 no-space-top"><input type="text" placeholder=" R�f�rence du produit" class="form-control" size="10" name="reference" id="reference" value=""></div>
					</div>
					<div class="col-md-12">
						<div class="col-md-2 no-space-top"></div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
						</div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
						</div>
						<div class="col-md-2 no-space-top text-center">
							<input type="hidden" value="1" name="promo" />
							<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
						</div>
					</div>
				</form>
			</td>
		</tr>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/productadd" method="post">
					<div class="col-md-12 no-space-top">
						<div class="col-md-2 no-space-top"><label>Remise sur X selon Y</label></div>
						<div class="col-md-2 no-space-top"><label>Produit achet� par le client</label></div>
						<div class="col-md-4 no-space-top"><input type="text" placeholder="Quantit� du produit" class="form-control"  size="2" name="referencebuynb" id="referencebuynb" value="" /></div>
						<div class="col-md-4 no-space-top"><input placeholder="R�f�rence du produit" type="text" class="form-control" size="10" name="referencebuy" id="referencebuy" value="" /> </div>
					</div>
					<div class="col-md-12 no-space-top">
						<div class="col-md-2 no-space-top"></div>
						<div class="col-md-2 no-space-top"><label>Produit remis�</label></div>
						<div class="col-md-4 no-space-top"><input type="text" class="form-control" placeholder="Quantit� du produit" size="2" name="referencepromonb" id="referencepromonb" value="" /></div>
						<div class="col-md-4 no-space-top"><input type="text" placeholder="R�f�rence du produit" class="form-control" size="10" name="referencepromo" id="referencepromo" value="" /></div>
					</div>
					<div class="col-md-12">
						<div class="col-md-2 no-space-top"></div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
						</div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
						</div>
						<div class="col-md-2 no-space-top text-center">
							<input type="hidden" value="2" name="promo" />
							<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
						</div>
					</div>
					
				</form>
			</td>
		</tr>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/productadd" method="post">
					<div class="col-md-12 no-space-top">
						<div class="col-md-2 no-space-top"><label>Remise par date</label></div>
						<div class="col-md-2 no-space-top"><label>Date de d�but</label></div>
						<div class="col-md-3 no-space-top"> 
							<input type="text" class="form-control" readonly="readonly" name="sdPicker" id="sdPicker" value="" maxlength="10" />
							<input type="hidden"  name="sd" id="sdPickerField" value="" maxlength="10" />
						</div>
						<div class="col-md-2 no-space-top"><label>Date de fin</label></div>
						<div class="col-md-3 no-space-top">
							<input type="text" class="form-control" readonly="readonly" name="edPicker" id="edPicker" value="" maxlength="10" />
							<input type="hidden"  name="ed" id="edPickerField" value="" maxlength="10" />
						</div>
					 </div>
					<div class="col-md-12">
						<div class="col-md-2 no-space-top"></div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
						</div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
						</div>
						<div class="col-md-2 no-space-top text-center">
							<input type="hidden" value="3" name="promo" />
							<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
						</div>
					</div>
				</form>
			</td>
		</tr>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/productadd" method="post">
					<div class="col-md-12 no-space-top">
						<div class="col-md-2 no-space-top"><label>Sur une cat�gorie</label></div>
						<div class="col-md-10 no-space-top">
							<select name="listcategory" class="form-control">
								<option value="0">Aucun</option>
								<?php 
								$show = array();
								foreach($this->listallcategories as $row) { 
								 	for ($level=0 ; $level<11; $level++) { 
										if ((!isset($show['NOM'.$level]) || $show['NOM'.$level] != $row['NOM'.$level]) && $row['NOM'.$level] != null) {
										?>
											<option value="<?php echo $this->escape($row['ID'.$level]); ?>">
												<?php 
								 				for ($i=0 ; $i<$level; $i++) { 
													echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
												}
												echo $this->escape($row['NOM'.$level]); ?>
											
											</option>
											<?php 
											$show['NOM'.$level] = $row['NOM'.$level];
										}
									 } 
								} ?>
							</select>
						</div>
					</div>
					<div class="col-md-12">
						<div class="col-md-2 no-space-top"></div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
						</div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
						</div>
						<div class="col-md-2 no-space-top text-center">
						<input type="hidden" value="4" name="promo" />
							<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
						</div>
					</div>
				</form>
			</td>
		</tr>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/productadd" method="post">
					<div class="col-md-12 no-space-top">
						<div class="col-md-2 no-space-top"><label>Sur une marque</label></div>
						<div class="col-md-10 no-space-top">
							<select name="listbrend" class="form-control">
								<option value="0">Aucun</option>
									<?php foreach($this->listbrend as $row) { ?>
									<option value="<?php echo $this->escape($row['ID']); ?>" >
										<?php echo $this->escape($row['BREND']); ?>
									</option>
									<?php } ?>
							</select>
						</div>
					</div>
					<div class="col-md-12">
						<div class="col-md-2 no-space-top"></div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
						</div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
						</div>
						<div class="col-md-2 no-space-top text-center">
						<input type="hidden" value="5" name="promo" />
							<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
						</div>
					</div>
				</form>
			</td>
		</tr>
	</table>
</div>
<div class="table-box">
	<table class="table">
 		<tr><td colspan="4"><h5>Remises effectives</h5></td></tr>
 		<?php 
			if ($this->listPromo1) {
			$listPromo1 = $this->listPromo1;
			foreach($listPromo1 as $row) { ?>
			<tr >
				<td > R�f�rence <a  href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $this->escape($row['ID']);?>"><?php echo $this->escape($row['REFERENCE']);?></a>
				</td>
				<td >  Produit <a  href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $this->escape($row['ID']);?>"><?php echo $this->escape($row['NOM']);?></a>
				</td>
				<td  > Remise de <b>
					<?php if ($this->escape($row['REMISEEURO']) > 0 ) { echo $this->escape($row['REMISEEURO'])."&nbsp;&#8364;"; } ?>
					<?php if ($this->escape($row['REMISEPOUR']) > 0 ) { echo $this->escape($row['REMISEPOUR'])."&nbsp;%"; } ?></b>
				 </td>
				<td class="text-center">
					<a class="btn btn-danger" href="<?php echo $this->baseUrl; ?>/backoffice/promotion/productdel/idref/<?php echo $row['IDPROMO']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
				</td>
			</tr>
			<?php } } ?>
			
			<?php 
			if ($this->listPromo2) {
			$listPromo2 = $this->listPromo2;
			foreach($listPromo2 as $row) { ?>
			<tr >
				<td > 
						Si <b><?php echo $this->escape($row['CHILDREFBUYNB']);?></b> articles de la reference : <b><?php echo $this->escape($row['CHILDREFBUY']);?></b> sont achetes
				 </td>
				<td   >
					 <b><?php echo $this->escape($row['CHILDREFPROMONB']);?></b> articles de la reference : <b><?php echo $this->escape($row['CHILDREFPROMO']);?></b> ont une remise
				 </td>
				<td  >
					<div >Remise de <b>
					<?php if ($this->escape($row['REMISEEURO']) > 0 ) { echo $this->escape($row['REMISEEURO'])."&nbsp;&#8364;"; } ?>
					<?php if ($this->escape($row['REMISEPOUR']) > 0 ) { echo $this->escape($row['REMISEPOUR'])."&nbsp;%"; } ?></b>
					</div>
				</td>
				<td class="text-center">
			<a class="btn btn-danger" href="<?php echo $this->baseUrl; ?>/backoffice/promotion/productdel/id/<?php echo $row['IDPROMO']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
				</td>
			</tr>
			<?php } } ?>
			<?php 
			if ($this->listPromo3) {
				$listPromo3 = $this->listPromo3;
				
				foreach($listPromo3 as $row) { 
				$myDate1 = new Zend_Date(strtotime($row['DATEPROMOSTART']));
				$myDate2 = new Zend_Date(strtotime($row['DATEPROMOEND']));
					?>
				<tr >
					<td > 
							Les produits o� la date de promo est comprise entre 
					 </td>
					 <td>
							<?php 
							$mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
							$moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
							?>
	 						<b><?php echo $myDate1->toString("dd").' '.$mois[(int)$myDate1->toString('MM')].' '.$myDate1->toString("YYYY");?></b> et 
							<b><?php echo $myDate2->toString("dd").' '.$mois[(int)$myDate2->toString('MM')].' '.$myDate2->toString("YYYY");?></b> 
					 </td>
					<td >
						 Remise de <b>
						<?php if ($this->escape($row['REMISEEURO']) > 0 ) { echo $this->escape($row['REMISEEURO'])."&nbsp;&#8364;"; } ?>
						<?php if ($this->escape($row['REMISEPOUR']) > 0 ) { echo $this->escape($row['REMISEPOUR'])."&nbsp;%"; } ?></b>
					</td>
					<td class="text-center">
						<a class="btn btn-danger" href="<?php echo $this->baseUrl; ?>/backoffice/promotion/productdel/id/<?php echo $row['IDPROMO']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
					</td>
				</tr>
			<?php }   } ?>
			
			<?php 
			if ($this->listPromo4) {
			$listPromo4 = $this->listPromo4;
			foreach($listPromo4 as $row) { ?>
			<tr >
				<td  >
					 Les produits associ�s � la cat�gorie 
				 </td>
				 <td><b><?php echo $this->escape($row['NOMCATEGORY']);?></b></td>
				<td  > Remise de <b>
					<?php if ($this->escape($row['REMISEEURO']) > 0 ) { echo $this->escape($row['REMISEEURO'])."&nbsp;&#8364;"; } ?>
					<?php if ($this->escape($row['REMISEPOUR']) > 0 ) { echo $this->escape($row['REMISEPOUR'])."&nbsp;%"; } ?></b>
				</td>
				<td class="text-center">
					<a class="btn btn-danger" href="<?php echo $this->baseUrl; ?>/backoffice/promotion/productdel/id/<?php echo $row['IDPROMO']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
				</td>
			</tr>
			<?php }   } ?>
			 
			<?php 
			if ($this->listPromo5) {
			$listPromo5 = $this->listPromo5;
			foreach($listPromo5 as $row) { ?>
			<tr >
				<td > 
					 Les produits associ�s � la marque 
				</td>
				<td><?php echo $this->escape($row['BREND']);?> </td>
				<td  > Remise de <b>
					<?php if ($this->escape($row['REMISEEURO']) > 0 ) { echo $this->escape($row['REMISEEURO'])."&nbsp;&#8364;"; } ?>
					<?php if ($this->escape($row['REMISEPOUR']) > 0 ) { echo $this->escape($row['REMISEPOUR'])."&nbsp;%"; } ?>
					</b>
				</td>
				<td class="text-center">
					<a class="btn btn-danger" href="<?php echo $this->baseUrl; ?>/backoffice/promotion/productdel/id/<?php echo $row['IDPROMO']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
				</td>
			</tr>
			<?php }   } ?>
 	</table>
 </div>


<script type="text/javascript"> 
$(function(){
	$("#sdPicker").datepicker({ 
		altFormat: 'yy-mm-dd', 
		altField: "#sdPickerField",
		dateFormat: 'DD, d MM, yy'
	});

	$("#edPicker").datepicker({ 
		altFormat: 'yy-mm-dd', 
		altField: "#edPickerField",
		dateFormat: 'DD, d MM, yy'
	});
});


</script> 
   modules/backoffice/views/scripts/promotion/codereduction.phtml000060400000013531150710367660021051 0ustar00<div class="table-box">
 	<table  class="table">
 		<tr><td><h5>Remises par code de r�duction</h5></td></tr>
		<?php echo $this->render("alert_tr.phtml"); ?>
		<tr>
			<td>
				<form action="<?php  echo $this->baseUrl; ?>/backoffice/promotion/addcodereductionproduit" method="post">
					<table class="table">
						<thead>
							<tr >
								<th>R�f�rence</th>
								<th>Quantit�</th>
								<th>Date d�but</th>
								<th>Date fin</th>
								<th class="text-center">&#8364;</th>
								<th class="text-center">%</th>
								<th></th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td><input  class="form-control" type="text" size="10" name="codereduc_ref" ></td>
								<td><input  class="form-control" type="text" size="3" name="codereduc_nbr" ></td>
								<td >
									<input class="form-control"  type="text" readonly="readonly" name="sd2Picker" id="sd2Picker" value="" maxlength="10" />
									<input type="hidden"  name="sd2" id="sd2PickerField" value="" maxlength="10" />
								</td>
								<td >
									<input  class="form-control" type="text" readonly="readonly" name="ed2Picker" id="ed2Picker"  value="" maxlength="10" />
									<input type="hidden"  name="ed2" id="ed2PickerField" value="" maxlength="10" />
								</td>
								<td><input  class="form-control" type="text" size="5" name="codereduc_euro" value=""></td>
								<td><input  class="form-control" type="text" size="5" name="codereduc_pour" value="" maxlength="3"></td>
								<td>
								<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button></td>
							</tr>
						</tbody>
					</table>
				</form>
			</td>
		</tr>
		<tr>
			<td>
				<form action="<?php  echo $this->baseUrl; ?>/backoffice/promotion/addcodereductioncommande" method="post">
				<table class="table">
					<thead>
						<tr>
							<th >Minimum d'achat</th>
							<th>Date d�but</th>
							<th>Date fin</th>
							<th class="text-center">&#8364;</th>
							<th class="text-center">%</th>
							<th></th>
						</tr>
					</thead>
					<tr>
						<td ><input class="form-control" type="text" size="10" name="codereduc_cmdmin" ></td>
						<td>
							<input class="form-control" type="text" readonly="readonly" name="sd1Picker" id="sd1Picker" value="" maxlength="10" />
							<input type="hidden"  name="sd1" id="sd1PickerField" value="" maxlength="10" />
						</td>
						<td>
							<input class="form-control" type="text" readonly="readonly" name="ed1Picker" id="ed1Picker" value="" maxlength="10" />
							<input type="hidden"  name="ed1" id="ed1PickerField" value="" maxlength="10" />
						</td>
						<td><input class="form-control" type="text" size="5" name="codereduc_euro" value=""></td>
						<td><input class="form-control" type="text" size="5" name="codereduc_pour" value="" maxlength="3"></td>
						<td>
								<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button></td>
					</tr>
				</table>
				</form>
			</td>
		</tr>
	</table>
</div>

<div class="table-box">
	<table class="table">
 		<tr><td colspan="6"><h5>Remises effectives</h5></td></tr>
 		<?php 
 		$mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
		$moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
			
 		foreach($this->listReduc as $row) { ?>
		<tr  <?php
		$isUsed = false; 
		if (isset($row['NOM']) && !empty($row['NOM']) && 
		isset($row['PRENOM']) && !empty($row['PRENOM'])&& 
		isset($row['IDUSER']) && !empty($row['IDUSER']) && $row['IDUSER'] > 0) {
			$isUsed = true;
		}?> >
			<td >
				<?php echo "CODE : ".$row['CODE']."<br/>  ".$this->escape($row['LIBELLE']); 
				if ($isUsed == true) { ?>
				<br/> 
				Utilis� par : <a href="<?php echo $this->baseUrl; ?>/backoffice/user/edit/id/<?php echo $row['IDUSER']; ?>"><?php echo $row['PRENOM']." ".$row['NOM'];?></a>
				<?php } ?>
			</td>
			<td>
				<?php $myDate1 = new Zend_Date(strtotime($row['DATESTART']));?>
 				<?php echo $myDate1->toString("dd").' '.$mois[(int)$myDate1->toString('MM')].' '.$myDate1->toString("YYYY");?>
 			</td>
			<td>
				<?php $myDate2 = new Zend_Date(strtotime($row['DATESTART']));?>
 				<?php echo $myDate2->toString("dd").' '.$mois[(int)$myDate2->toString('MM')].' '.$myDate2->toString("YYYY");?>
 			</td>
			<td  >
				<?php if ($this->escape($row['EURO']) > 0 ) { echo $this->escape($row['EURO'])."<b>&nbsp;&#8364;</b>"; } ?>
			</td>
			<td  >
				<?php if ($this->escape($row['POUR']) > 0 ) { echo $this->escape($row['POUR'])."<b>&nbsp;%</b>"; } ?>
			</td>
			<td  >
				<span >
				<?php if ($row['isACTIF'] == 1) { ?>
					<a class="btn btn-warning" href="<?php echo $this->baseUrl; ?>/backoffice/promotion/unactivecodereduction/id/<?php echo $row['ID']; ?>" >D�sactiver</a>
				<?php } else { ?>
					<a class="btn btn-warning" href="<?php echo $this->baseUrl; ?>/backoffice/promotion/activecodereduction/id/<?php echo $row['ID']; ?>" >Activer</a>
				<?php } ?>
				</span>
				<span >
				<a class="btn btn-danger" href="<?php echo $this->baseUrl; ?>/backoffice/promotion/delcodereduction/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
				</span>
			</td> 
		</tr>
		<?php } ?>
 	</table>
</div>




<script type="text/javascript"> 
$(function(){
	$("#sd2Picker").datepicker({ 
		altFormat: 'yy-mm-dd', 
		altField: "#sd2PickerField",
		dateFormat: 'DD, d MM, yy'
	});
	$("#ed2Picker").datepicker({ 
		altFormat: 'yy-mm-dd', 
		altField: "#ed2PickerField",
		dateFormat: 'DD, d MM, yy'
	});
	$("#sd1Picker").datepicker({ 
		altFormat: 'yy-mm-dd', 
		altField: "#sd1PickerField",
		dateFormat: 'DD, d MM, yy'
	});
	$("#ed1Picker").datepicker({ 
		altFormat: 'yy-mm-dd', 
		altField: "#ed1PickerField",
		dateFormat: 'DD, d MM, yy'
	});
});
</script> modules/backoffice/views/scripts/promotion/user.phtml000060400000032716150710367660017206 0ustar00 <div class="table-box">
 	<table  class="table">
 		<tr><td><h5>Remises associ�es aux clients</h5></td></tr>
		<?php echo $this->render("alert_tr.phtml"); ?>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/useradd" method="post">
					<div class="col-md-2 no-space-top"><label>Anniversaire de l'inscription</label></div>
					<div class="col-md-4 no-space-top">
						<div class="col-md-3 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
						<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
					</div>
					<div class="col-md-4 no-space-top">
						<div class="col-md-3 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
						<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
					</div>
					<div class="col-md-2 no-space-top text-center">
							<input type="hidden" value="1" name="remise" />
						<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
					</div>
				</form>
			</td>
		</tr>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/useradd" method="post">
					<div class="col-md-2 no-space-top"><label>Si c'est la premiere commande</label></div>
					<div class="col-md-4 no-space-top">
						<div class="col-md-3 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
						<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
					</div>
					<div class="col-md-4 no-space-top">
						<div class="col-md-3 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
						<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
					</div>
					<div class="col-md-2 no-space-top text-center">
							<input type="hidden" value="2" name="remise" />
						<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
					</div>
				</form>
			</td>
		</tr>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/useradd" method="post">
					<div class="col-md-12 no-space-top">
						<div class="col-md-2 no-space-top no-space-side"><label>Sp�cifique au client</label></div>
						<div class="col-md-10 no-space-top">
							<select name="iduser" class="form-control">
								<option value="0">S�lectionner un Client</option>
								<?php 
								$listAllUser = $this->listAllUser ;
								foreach($listAllUser as $row) { 
									?>
								<option value="<?php echo $this->escape($row['IDUSER']); ?>">
									<?php  echo $row['NOM']." ".$row['PRENOM'] ; ?>
								</option>
								<?php  }  ?>
							</select>	
						</div>
					</div>
					<div class="col-md-12 no-space-side">
						<div class="col-md-2 no-space-top"></div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
						</div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
						</div>
						<div class="col-md-2 no-space-top text-center">
								<input type="hidden" value="3" name="remise" />
							<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
						</div>
					</div>
				</form>
			</td>
		</tr>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/useradd" method="post">
					<div class="col-md-12 no-space-top">
						<div class="col-md-2 no-space-top no-space-side"><label>Sp�cifique � un client et une marque</label></div>
						<div class="col-md-10 no-space-top">
							<div class="col-md-6 no-space-top no-space-side">
								<select name="iduser" class="form-control">
									<option value="0">S�lectionner un Client</option>
									<?php 
									$listAllUser = $this->listAllUser ;
									foreach($listAllUser as $row) { 
										?>
									<option value="<?php echo $this->escape($row['IDUSER']); ?>">
										<?php  echo $row['NOM']." ".$row['PRENOM'] ; ?>
									</option>
									<?php  }  ?>
								</select> 
							</div>
							<div class="col-md-6 no-space-top no-space-side">
								<select name="idbrend" class="form-control">
									<option value="0">S�lectionner une Marque</option>
									<?php 
									$listAllBrend = $this->listbrend ;
									foreach($listAllBrend as $row) { 
										?>
									<option value="<?php echo $this->escape($row['ID']); ?>">
										<?php  echo $row['BREND']; ?>
									</option>
									<?php  }  ?>
								</select>
							</div>
						</div>
					</div>
					<div class="col-md-12 no-space-side">
						<div class="col-md-2 no-space-top"></div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
						</div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
						</div>
						<div  class="col-md-2 no-space-top text-center">
								<input type="hidden" value="4" name="remise" />
							<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
						</div>
					</div>
				</form>
			</td>
		</tr>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/useradd" method="post">
					<div class="col-md-12 no-space-top">
						<div class="col-md-2 no-space-top no-space-side"><label>Sp�cifique � un code interne et une marque</label></div>
						<div class="col-md-10 no-space-top">
							<div class="col-md-6 no-space-top no-space-side">
								<select name="idcintern" class="form-control">
									<option value="0">S�lectionner un Code Interne</option>
									<?php 
									$listAllCIntern = $this->listAllCIntern ;
									foreach($listAllCIntern as $row) { 
										?>
									<option value="<?php echo $this->escape($row['ID']); ?>">
										<?php  echo $row['CODE']." - ".$row['LABEL'] ; ?>
									</option>
									<?php  }  ?>
								</select> 
							</div>
							<div class="col-md-6 no-space-top no-space-side">
								<select name="idbrend" class="form-control">
									<option value="0">S�lectionner une Marque</option>
									<?php 
									$listAllBrend = $this->listbrend ;
									foreach($listAllBrend as $row) { 
										?>
									<option value="<?php echo $this->escape($row['ID']); ?>">
										<?php  echo $row['BREND']; ?>
									</option>
									<?php  }  ?>
								</select>
							</div>
						</div>
					</div>
					<div class="col-md-12 no-space-side">
						<div class="col-md-2 no-space-top"></div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
						</div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
						</div>
						<div class="col-md-2 no-space-top text-center">
								<input type="hidden" value="5" name="remise" />
							<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
						</div>
					</div>
				</form>
			</td>
		</tr>
	</table>
</div>
 <div class="table-box">
		<table class="table">
 			<tr><td colspan="3"><h5>Remises effectives</h5></td></tr>
			<?php  
			if ($this->dateInsc) { 
				$remise = $this->dateInsc;
				?>
				<tr >
					<td >Si la date anniversaire est atteinte 
					</td>
						<td><span >Remise de <b>
							<?php if ($this->escape($remise['REMISEEURO']) > 0 ) { echo $this->escape($remise['REMISEEURO'])."&nbsp;&#8364;"; } ?>
							<?php if ($this->escape($remise['REMISEPOUR']) > 0 ) { echo $this->escape($remise['REMISEPOUR'])."&nbsp;%"; } ?></b>
						</span>		</td>
					<td class="text-center">
						<a class="btn btn-danger" href="<?php echo $this->baseUrl; ?>/backoffice/promotion/userdel/id/<?php echo $remise['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
					</td>
				</tr>
				<?php } 
					if ($this->firstCmd) { 
						$remise = $this->firstCmd;
						?>
					<tr >
						<td >Si c'est la premiere commande	
						</td>
						<td>
							<span >Remise de <b>
								<?php if ($this->escape($remise['REMISEEURO']) > 0 ) { echo $this->escape($remise['REMISEEURO'])."&nbsp;&#8364;"; } ?>
								<?php if ($this->escape($remise['REMISEPOUR']) > 0 ) { echo $this->escape($remise['REMISEPOUR'])."&nbsp;%"; } ?></b>
							</span>	</td>
						<td class="text-center">
								<a class="btn btn-danger" href="<?php echo $this->baseUrl; ?>/backoffice/promotion/userdel/id/<?php echo $remise['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
						</td>
					</tr>
					<?php } ?>
				<?php 
				if ($this->listUser) {
				$listUser = $this->listUser;
				foreach($listUser as $row) {  ?>
				<tr >
					<td > 
							<a class="btn btn-primary" href="<?php echo $this->baseUrl; ?>/backoffice/user/edit/id/<?php echo $this->escape($row['IDUSER']);?>">
								<?php echo $row['NOM'].' '.$row['PRENOM'];?>
							</a> remise sur les commandes 
					</td>
					<td >
						<div>Remise de <b>
							<?php if ($this->escape($row['REMISEEURO']) > 0 ) { echo $this->escape($row['REMISEEURO'])."&nbsp;&#8364;"; } ?>
							<?php if ($this->escape($row['REMISEPOUR']) > 0 ) { echo $this->escape($row['REMISEPOUR'])."&nbsp;%"; } ?></b>
						</div>
					</td>
					<td class="text-center">
						<a class="btn btn-danger" href="<?php echo $this->baseUrl; ?>/backoffice/promotion/userdel/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
					</td>
				</tr>
				<?php }   } ?>
			<?php 
			if ($this->listUserBrend) {
			$listUserBrend = $this->listUserBrend;
			foreach($listUserBrend as $row) {  ?>
			<tr >
				<td >
						<a class="btn btn-primary" href="<?php echo $this->baseUrl; ?>/backoffice/user/edit/id/<?php echo $this->escape($row['IDUSER']);?>">
							<?php echo $row['NOM'].' '.$row['PRENOM'];?>
						</a> pour les produits de la marque 
						<a class="btn btn-primary" href="<?php echo $this->baseUrl; ?>/backoffice/supplier/edit/id/<?php echo $this->escape($row['IDSUPPLIER']);?>">
						<?php echo $row['BREND']; ?>
						</a>
				</td>
				<td  >
					<div >Remise de <b>
					<?php if ($this->escape($row['REMISEEURO']) > 0 ) { echo $this->escape($row['REMISEEURO'])."&nbsp;&#8364;"; } ?>
					<?php if ($this->escape($row['REMISEPOUR']) > 0 ) { echo $this->escape($row['REMISEPOUR'])."&nbsp;%"; } ?></b>
					</div>
				</td>
				<td class="text-center">
						<a class="btn btn-danger"  href="<?php echo $this->baseUrl; ?>/backoffice/promotion/userdel/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
				</td>
			</tr>
			<?php }   } ?>
				<?php 
				if ($this->listCinternBrend) {
				$listCinternBrend = $this->listCinternBrend;
				foreach($listCinternBrend as $row) {  ?>
				<tr >
					<td > 
							<a class="btn btn-primary" href="<?php echo $this->baseUrl; ?>/backoffice/user/codeinterne">
								<?php echo $row['CODEINTERN'].' - '.$row['LABELINTERN'];?>
							</a> pour les produits de la marque 
							<a class="btn btn-primary"  href="<?php echo $this->baseUrl; ?>/backoffice/supplier/edit/id/<?php echo $this->escape($row['IDSUPPLIER']);?>">
							<?php echo $row['BREND']; ?>
							</a> 
					</td>
					<td >
						<div >Remise de <b>
						<?php if ($this->escape($row['REMISEEURO']) > 0 ) { echo $this->escape($row['REMISEEURO'])."&nbsp;&#8364;"; } ?>
						<?php if ($this->escape($row['REMISEPOUR']) > 0 ) { echo $this->escape($row['REMISEPOUR'])."&nbsp;%"; } ?></b>
						</div>
					</td>
					<td class="text-center">
						<a class="btn btn-danger" href="<?php echo $this->baseUrl; ?>/backoffice/promotion/userdel/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
					</td>
				</tr>
				<?php }   } ?>
			</table>
</div>modules/backoffice/views/scripts/promotion/gift.phtml000060400000010536150710367660017155 0ustar00<table cellpadding="0" cellspacing="5" border="0" width="1000px">
	<tr>
		<td colspan="2">
			<span class="errorText"><?php echo $this -> messageError; ?></span>
			<span class="successText"><?php echo $this -> messageSuccess; ?></span>
		</td>
	</tr>
	<tr >
		<td colspan="2" style="background:#666666; height: 1px"></td>
	</tr>
	<tr >
		<td colspan="2"><div class="text2">LES AVANTAGES</div></td>
	</tr>
	<tr >
		<td colspan="2" style="background:#666666; height: 1px"></td>
	</tr>
	<tr >
		<td colspan="2" >
			<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/giftadd" method="post">
				<table  border="0" cellpadding="0" cellspacing="10" width="1000px" align="left">
					<tr >
						<td width="800px">
							Pour <input type="text" name="referencenbbuy" size="4"> article(s) achete <input type="text" name="referencebuy" > il y a <input type="text" name="referencenbgift" size="3"> article(s) offert <input type="text" name="referencegift" > 
						</td>
						<td>
							<input type="hidden" value="1" name="gift" />
							<input type="submit" name="ajouter" value="Ajouter"/>
						</td>
					</tr>
				</table>
			</form>
		</td>
	</tr>
	<tr >
		<td colspan="2" style="background:#666666; height: 1px"></td>
	</tr>	
	<tr >
		<td colspan="2" >
		<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/giftadd" method="post">
				<table  border="0" cellpadding="0" cellspacing="10" width="1000px" align="left">
					<tr >
						<td width="400px">
							Si le MONTANT TOTAL de la commande >= <input type="text" name="montant">
						</td>
						<td width="400px">
							cet article est offert <input type="text" name="reference">
						</td>
						<td>
							<input type="hidden" value="2" name="gift" />
							<input type="submit" name="ajouter" value="Ajouter"/>
						</td>
					</tr>
				</table>
			</form>
		</td>
	</tr>
	<tr >
		<td colspan="2" style="background:#666666; height: 1px"></td>
	</tr>
	<tr >
		<td >
			<div  class="text2">LES AVANTAGES EN COURS</div>
		
		
		</td>
		<td class="link2" style="text-align: center">
		
		<a href="" id="giftSlide1" >Article achete -> Article offert </a> | 
		<a href="" id="giftSlide2" >Selon la commande </a>
		</td>
	</tr>
	<tr >
		<td colspan="2" style="background:#666666; height: 1px"></td>
	</tr>
	<tr >
		<td colspan="2" style="background:#666666; height: 1px"></td>
	</tr>
	<tr >
		<td colspan="2" >
			<div id="v-giftSlide1" >
				<table cellpadding="0" cellspacing="5" border="0"  width="1000px" >
					<?php 
					if ($this->listProductGift) {
					$listProductGift = $this->listProductGift;
					foreach($listProductGift as $row) : ?>
					<tr >
						<td valign="top" >
							<b><?php echo $this->escape($row['PRODNBBUY']);?></b> Article(s) achete : <b><?php echo $this->escape($row['PRODREFBUY']);?></b>
						</td>
						<td valign="top" >
							<div class="link3" >
							 <b><?php echo $this->escape($row['PRODNBGIFT']);?></b> Article(s) offert : <b><?php echo $this->escape($row['PRODREFGIFT']);?></b>
							
							</div>
						</td>
						<td style="text-align: center">
							<a class="button" href="<?php echo $this->baseUrl; ?>/backoffice/promotion/giftdel/id/<?php echo $row['ID']; ?>" >Supprimer</a>
						</td>
					</tr>
					<tr><td colspan="3" style="background:#666666;height:1px;"></td></tr>
					<?php endforeach;   } ?>
				</table>

			</div>
		</td>
	</tr>
	<tr >
		<td colspan="2" >
			<div id="v-giftSlide2" >
				<table cellpadding="0" cellspacing="5" border="0"  width="1000px" >
					<?php 
					if ($this->listCmdGift) {
					$listCmdGift = $this->listCmdGift;
					foreach($listCmdGift as $row) : ?>
					<tr >
						<td valign="top" >
							Si le MONTANT TOTAL de la commande >= <b><?php echo $this->escape($row['CMDMONTANT']);?>&nbsp;&#8364;</b>
						</td>
						<td valign="top" >
							<div class="link3" >
								Article offert : 
								<a href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $this->escape($row['IDPRODUCT']);?>"><?php echo $this->escape($row['CMDPRODREFGIFT']);?></a>
							
							</div>
						</td>
						<td style="text-align: center">
							<a class="button" href="<?php echo $this->baseUrl; ?>/backoffice/promotion/giftdel/id/<?php echo $row['ID']; ?>" >Supprimer</a>
						</td>
					</tr>
					<tr><td colspan="3" style="background:#666666;height:1px;"></td></tr>
					<?php endforeach;   } ?>
				</table>

			</div>
		</td>
	</tr>
</table>modules/backoffice/views/scripts/promotion/front.phtml000060400000005254150710367660017355 0ustar00<table cellpadding="0" cellspacing="5" border="0" width="100%">
	<tr>
		<td colspan="2">
			<span class="errorText"><?php echo $this -> messageError; ?></span>
			<span class="successText"><?php echo $this -> messageSuccess; ?></span>
		</td>
	</tr>
	<tr >
		<td colspan="2" style="background:#666666; height: 1px"></td>
	</tr>
	<tr >
		<td colspan="2"><div class="text2">LES PROMOTIONS DE LA PAGE D'ACCUEIL</div></td>
	</tr>
	<tr >
		<td colspan="2" style="background:#666666; height: 1px"></td>
	</tr>
	<tr >
		<td colspan="2">
			<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/frontadd" method="post">
				<table  border="0" cellpadding="0" cellspacing="10" width="100%"  >
					<tr >
						<td width="200px">
							Afficher un produit
						</td>
						<td width="200px">
							REFERENCE : <input type="text" name="reference" id="reference" value=""/>
						</td>
						<td>
							POSITION : <input type="text" name="position" id="position" value="" maxlength="2" size="4"/>
						</td>
						<td>
							<input type="submit" name="ajouter" value="Ajouter"/>
						</td>
					</tr>
				</table>
			</form>
		</td>
	</tr>
	<tr >
		<td colspan="2" style="background:#666666; height: 1px"></td>
	</tr>
	<?php  if ($this->listFront) { ?>
	<tr>
		<td colspan="2">
			<table cellpadding="0" cellspacing="5" border="0" width="100%">
				<?php 
				$listFront = $this->listFront;
				foreach($listFront as $row) { ?>
				<tr >
					<td valign="top" >
						<div class="link3" >
							<a href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $this->escape($row['IDPRODUCT']);?>"><?php echo $this->escape($row['REFERENCE']);?>
							
							</a>
						</div>
					</td>
					<td valign="top" width="300px">
						<div class="link3" >
							<a href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $this->escape($row['IDPRODUCT']);?>"><?php echo $this->escape($row['NOM']);?></a>
						</div>
						<div class="text1" >
							<?php echo $row['DESCSHORT'] ;?>
						</div>
					</td>
					
					<td valign="top" >
						<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/frontedit" method="post">
					
						POSITION : <input type="text" name="position" value="<?php echo $row['POSITION']; ?>"  maxlength="2" size="4"> 
						<input type="hidden" name="promoid" value="<?php echo $row['ID']; ?>">
					 
						<input type="submit" name="edit" value="Modifier"> 
						</form>
					</td>
					<td style="text-align: center">
						<a class="button" href="<?php echo $this->baseUrl; ?>/backoffice/promotion/frontdel/id/<?php echo $row['ID']; ?>" >Supprimer</a>
					</td>
				</tr>
				<?php } ?>
			</table>
		</td>
	</tr>
	<?php } ?>
</table>modules/backoffice/views/scripts/promotion/command.phtml000060400000016743150710367660017650 0ustar00<div class="table-box">
 	<table  class="table">
 		<tr><td><h5>Remises associ�es aux commandes</h5></td></tr>
		<?php echo $this->render("alert_tr.phtml"); ?>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/commandadd" method="post">
					<div class="col-md-2 no-space-top"><label>Sur toute les commandes</label></div>
					<div class="col-md-4 no-space-top">
						<div class="col-md-3 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
						<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
					</div>
					<div class="col-md-4 no-space-top">
						<div class="col-md-3 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
						<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
					</div>
					<div class="col-md-2 no-space-top text-center">
							<input type="hidden" value="1" name="remise" />
						<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
					</div>
				</form>
			</td>
		</tr>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/commandadd" method="post">
					<div class="col-md-12 no-space-top">
						<div class="col-md-4 no-space-top no-space-side"><label>Quand le MONTANT TOTAL de la commande est sup�rieur � </label></div>
						<div class="col-md-8 no-space-top no-space-side"><input type="text" placeholder="Montant de la commande" name="montant" value="" class="form-control" /></div>
					</div>
					<div class="col-md-12 no-space-side">
						<div class="col-md-2"></div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
						</div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
						</div>
						<div class="col-md-2 no-space-top text-center">
								<input type="hidden" value="2" name="remise" />
							<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
						</div>
					</div>
				</form>
			</td>
		</tr>
		<tr>
			<td>
				<form action="<?php echo $this->baseUrl; ?>/backoffice/promotion/commandadd" method="post">
					<div class="col-md-12 no-space-top">
						<div class="col-md-3 no-space-top no-space-side"><label>Quand il y a </label></div>
						<div class="col-md-3 no-space-top no-space-side"><input type="text" placeholder="Quantit� d'articles" name="nbrreference" class="form-control" ></div>
						<div class="col-md-3 no-space-top no-space-side text-center"><label>articles de REFERENCE </label></div>
						<div class="col-md-3 no-space-top no-space-side"><input type="text" placeholder="R�f�rence du produit" name="reference" class="form-control" ></div>
					</div>
					<div class="col-md-12 no-space-side">
						<div class="col-md-2"></div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remiseeuro">Remise&nbsp;&#8364;</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en euros" class="form-control" type="text" size="10" name="remiseeuro" id="remiseeuro" value=""></div>
						</div>
						<div class="col-md-4 no-space-top">
							<div class="col-md-3 no-space-top"><label for="remisepour">Remise&nbsp;%</label></div>
							<div class="col-md-9 no-space-top"><input placeholder="Remise � effectuer en pourcentage" class="form-control" type="text" size="10" name="remisepour" id="remisepour" value="" maxlength="3"></div>
						</div>
						<div class="col-md-2 no-space-top text-center">
								<input type="hidden" value="3" name="remise" />
							<button class="btn btn-success" type="submit" name="edit"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
						</div>
					</div>
				</form>
			</td>
		</tr>
	</table>
</div>
  
<div class="table-box">
	<table class="table">
 		<tr><td colspan="3"><h5>Remises effectives</h5></td></tr>
		<?php 
		if ($this->remiseAll) { 
		$isAll = $this->remiseAll;
		?>
		<tr >
			<td >Sur toute les commandes	
			</td>
			<td>
				<span >Remise de <b>
					<?php if ($this->escape($isAll['REMISEEURO']) > 0 ) { echo $this->escape($isAll['REMISEEURO'])."&nbsp;&#8364;"; } ?>
					<?php if ($this->escape($isAll['REMISEPOUR']) > 0 ) { echo $this->escape($isAll['REMISEPOUR'])."&nbsp;%"; } ?></b>
				</span>	</td>
			<td class="text-center">
						<a class="btn btn-danger"  href="<?php echo $this->baseUrl; ?>/backoffice/promotion/commanddel/id/<?php echo $isAll['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
			</td>
		</tr>
		<?php } 
		if ($this->remiseMontant) { 
			$remise = $this->remiseMontant;
			?>
		<tr >
			<td >Si le MONTANT TOTAL de la commande est sup�rieur � <b><?php echo $remise['MONTANTEQUAL'];?>&nbsp;&#8364;</b> alors 
			</td>
			<td>
				<span  >Remise de <b>
					<?php if ($this->escape($remise['REMISEEURO']) > 0 ) { echo $this->escape($remise['REMISEEURO'])."<b>&nbsp;&#8364;</b>"; } ?>
					<?php if ($this->escape($remise['REMISEPOUR']) > 0 ) { echo $this->escape($remise['REMISEPOUR'])."<b>&nbsp;%</b>"; } ?></b>
				</span>		
			</td>
			<td class="text-center">
						<a class="btn btn-danger"  href="<?php echo $this->baseUrl; ?>/backoffice/promotion/commanddel/id/<?php echo $remise['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
			</td>
		</tr>
		<?php }  ?>
		<tr >
			<td colspan="3" > 
					<table class="table">
						<?php  if ($this->listRemise1) { 
						$listRemise1 = $this->listRemise1;
						foreach($listRemise1 as $row) : ?>
						<tr >
							<td > 
									<a href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $this->escape($row['IDPRODUCT']);?>"><?php echo $this->escape($row['CHILDREFERENCE']);?></a>
								 
							</td>
							<td  > 
									<a href="<?php echo $this->baseUrl; ?>/backoffice/product/edit/showProduct/<?php echo $this->escape($row['IDPRODUCT']);?>"><?php echo $this->escape($row['NOM']);?></a>
								 	<?php echo $row['DESCSHORT'] ;?> 
							</td>
							<td >
								<div >Remise de <b>
								<?php if ($this->escape($row['REMISEEURO']) > 0 ) { echo $this->escape($row['REMISEEURO'])."&nbsp;&#8364;"; } ?>
								<?php if ($this->escape($row['REMISEPOUR']) > 0 ) { echo $this->escape($row['REMISEPOUR'])."&nbsp;%"; } ?></b>
								</div>
							</td>
							<td  >Pour
								<span  >
									<b><?php if ($this->escape($row['CHILDNBR']) > 0 ) { echo $this->escape($row['CHILDNBR']); } ?></b>
								</span>
								articles
							</td>
							<td class="text-center">
								<a class="btn btn-danger"  href="<?php echo $this->baseUrl; ?>/backoffice/promotion/commanddel/id/<?php echo $row['ID']; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</a>
							</td>
						</tr>
						<?php endforeach; } ?>
					</table>
			</td>
		</tr>
	</table>
</div>modules/backoffice/views/scripts/admin/edit.phtml000060400000004034150710367660016207 0ustar00 <div class="table-box">
	<form action="<?php echo $this->baseUrl; ?>/backoffice/admin/edit" method="post">
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Nom</td>
				<td class="col-md-8"><input type="text" class="form-control" name="lastname" id="lastname" value="<?php echo $this->populateForm['NOM']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Pr�nom</td>
				<td class="col-md-8"><input type="text" class="form-control" name="firstname" id="firstname" value="<?php echo $this->populateForm['PRENOM']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Email</td>
				<td class="col-md-8"><input type="text" class="form-control" name="email" id="email" value="<?php echo $this->populateForm['EMAIL']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Login</td>
				<td class="col-md-8"><input type="text" class="form-control" name="login" id="login" value="<?php echo $this->populateForm['LOGIN']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4">Nouveau mot de passe</td>
				<td class="col-md-8"><input type="password" class="form-control" name="editpassword" id="editpassword" value=""/></td>
			</tr>
			<tr >
				<td class="col-md-4">Confirmer le nouveau mot de passe</td>
				<td class="col-md-8"><input type="password" class="form-control" name="editpassword2" id="editpassword2" value=""/></td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<input type="hidden" name="id" id="id" value="<?php echo $this->populateForm['ID']; ?>">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-edit"></i>&nbsp;Modifier</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>modules/backoffice/views/scripts/admin/list.phtml000060400000022661150710367660016243 0ustar00<div class="table-box">
<div class="col-md-12 header-single-line">
	<div class="col-md-5 header-single no-space-top"><?php echo $this->titlePage; ?></div>
	<div class="col-md-7 no-space-top"><?php echo $this->render("alert.phtml"); ?></div>
</div>
<table class="display table" id="adminTable" width="100%">
	<thead>
		<tr>
			<th>Nom</th>
			<th>Pr�nom</th>
			<th>Email</th>
			<th>Login</th>
			<th class="text-center">R�les</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	
		<?php foreach($this->listadmins as $row)  { ?>
		<tr>
			<td><?php echo $this->escape($row->NOM);?></td>
			<td><?php echo $this->escape($row->PRENOM);?></td>
			<td><?php echo $this->escape($row->EMAIL);?></td>
			<td><?php echo $this->escape($row->LOGIN);?></td>
			<td>
			<?php  if ($this->isSiteGallery) {  ?>
			
					<div class="col-md-6 no-space-top">  	
						<form action="<?php echo $this->baseUrl; ?>/backoffice/admin/setrole" method="POST">
							<input type="hidden" name="idadmin" value="<?php echo $this->escape($row->ID);?>">
							<input type="hidden" name="roletype" value="isAdmin">
							<?php if ($row->isADMIN == 1 ) {  ?>
								<button type="submit" class="btn btn-success btn-group-justified">Administrateur</button>
								<input type="hidden" name="rolevalue" value="0">
							<?php } else { ?>
								<button type="submit" class="btn btn-danger btn-group-justified">Administrateur</button>
								<input type="hidden" name="rolevalue" value="1">
							<?php } ?>
						</form>
					</div>
					<div class="col-md-6 no-space-top">  	
						<form action="<?php echo $this->baseUrl; ?>/backoffice/admin/setrole" method="POST">
							<input type="hidden" name="idadmin" value="<?php echo $this->escape($row->ID);?>">
							<input type="hidden" name="roletype" value="isCategory">
							<?php if ($row->isCATEGORY == 1 ) {  ?>
								<button type="submit" class="btn btn-success btn-group-justified">Cat�gorie</button>
								<input type="hidden" name="rolevalue" value="0">
							<?php } else { ?>
								<button type="submit" class="btn btn-danger btn-group-justified">Cat�gorie</button>
								<input type="hidden" name="rolevalue" value="1">
							<?php } ?>
						</form>
					</div>
				<?php } ?>
			
				<?php  if ($this->isSiteEbusiness) {  ?>
					<div class="col-md-3 ">                        
	                 	<form action="<?php echo $this->baseUrl; ?>/backoffice/admin/setrole" method="POST">
							<input type="hidden" name="idadmin" value="<?php echo $this->escape($row->ID);?>">
							<input type="hidden" name="roletype" value="isProduct">
							<?php if ($row->isPRODUCT == 1 ) {  ?>
								<button type="submit" class="btn btn-success btn-group-justified">Produit</button>
								<input type="hidden" name="rolevalue" value="0">
							<?php } else { ?>
								<button type="submit" class="btn btn-danger btn-group-justified">Produit</button>
								<input type="hidden" name="rolevalue" value="1">
							<?php } ?>
						</form>
					</div>	
					<div class="col-md-3">  
						<form action="<?php echo $this->baseUrl; ?>/backoffice/admin/setrole" method="POST">
							<input type="hidden" name="idadmin" value="<?php echo $this->escape($row->ID);?>">
							<input type="hidden" name="roletype" value="isPromo">
							<?php if ($row->isPROMO == 1 ) {  ?>
								<button type="submit" class="btn btn-success btn-group-justified">Promotion</button>
								<input type="hidden" name="rolevalue" value="0">
							<?php } else { ?>
								<button type="submit" class="btn btn-danger btn-group-justified">Promotion</button>
								<input type="hidden" name="rolevalue" value="1">
							<?php } ?>
						</form>
					</div>
					<div class="col-md-3">  
						<form action="<?php echo $this->baseUrl; ?>/backoffice/admin/setrole" method="POST">
							<input type="hidden" name="idadmin" value="<?php echo $this->escape($row->ID);?>">
							<input type="hidden" name="roletype" value="isCommand">
							<?php if ($row->isCOMMAND == 1 ) {  ?>
								<button type="submit" class="btn btn-success btn-group-justified">Commande</button>
								<input type="hidden" name="rolevalue" value="0">
							<?php } else { ?>
								<button type="submit" class="btn btn-danger btn-group-justified">Commande</button>
								<input type="hidden" name="rolevalue" value="1">
							<?php } ?>
						</form>
					</div>
					<div class="col-md-3">  	
						<form action="<?php echo $this->baseUrl; ?>/backoffice/admin/setrole" method="POST">
							<input type="hidden" name="idadmin" value="<?php echo $this->escape($row->ID);?>">
							<input type="hidden" name="roletype" value="isCategory">
							<?php if ($row->isCATEGORY == 1 ) {  ?>
								<button type="submit" class="btn btn-success btn-group-justified">Catégorie</button>
								<input type="hidden" name="rolevalue" value="0">
							<?php } else { ?>
								<button type="submit" class="btn btn-danger btn-group-justified">Catégorie</button>
								<input type="hidden" name="rolevalue" value="1">
							<?php } ?>
						</form>
					</div>
					<div class="col-md-3">  	
						<form action="<?php echo $this->baseUrl; ?>/backoffice/admin/setrole" method="POST">
							<input type="hidden" name="idadmin" value="<?php echo $this->escape($row->ID);?>">
							<input type="hidden" name="roletype" value="isSupplier">
							<?php if ($row->isSUPPLIER == 1 ) {  ?>
								<button type="submit" class="btn btn-success btn-group-justified">Fournisseur</button>
								<input type="hidden" name="rolevalue" value="0">
							<?php } else { ?>
								<button type="submit" class="btn btn-danger btn-group-justified">Fournisseur</button>
								<input type="hidden" name="rolevalue" value="1">
							<?php } ?>
						</form>
					</div>
					<div class="col-md-3">     
						<form action="<?php echo $this->baseUrl; ?>/backoffice/admin/setrole" method="POST">
							<input type="hidden" name="idadmin" value="<?php echo $this->escape($row->ID);?>">
							<input type="hidden" name="roletype" value="isUser">
							<?php if ($row->isUSER == 1 ) {  ?>
								<button type="submit" class="btn btn-success btn-group-justified">Client</button>
								<input type="hidden" name="rolevalue" value="0">
							<?php } else { ?>
								<button type="submit" class="btn btn-danger btn-group-justified">Client</button>
								<input type="hidden" name="rolevalue" value="1">
							<?php } ?>
						</form>
					</div>
					<div class="col-md-3">  	
						<form action="<?php echo $this->baseUrl; ?>/backoffice/admin/setrole" method="POST">
							<input type="hidden" name="idadmin" value="<?php echo $this->escape($row->ID);?>">
							<input type="hidden" name="roletype" value="isFooter">
							<?php if ($row->isFOOTER == 1 ) {  ?>
								<button type="submit" class="btn btn-success btn-group-justified">Pied de page</button>
								<input type="hidden" name="rolevalue" value="0">
							<?php } else { ?>
								<button type="submit" class="btn btn-danger btn-group-justified">Pied de page</button>
								<input type="hidden" name="rolevalue" value="1">
							<?php } ?>
						</form>
					</div>
					<div class="col-md-3">  	
						<form action="<?php echo $this->baseUrl; ?>/backoffice/admin/setrole" method="POST">
							<input type="hidden" name="idadmin" value="<?php echo $this->escape($row->ID);?>">
							<input type="hidden" name="roletype" value="isAdmin">
							<?php if ($row->isADMIN == 1 ) {  ?>
								<button type="submit" class="btn btn-success btn-group-justified">Administrateur</button>
								<input type="hidden" name="rolevalue" value="0">
							<?php } else { ?>
								<button type="submit" class="btn btn-danger btn-group-justified">Administrateur</button>
								<input type="hidden" name="rolevalue" value="1">
							<?php } ?>
						</form>
					</div>
					<div class="col-md-3">  	
						<form action="<?php echo $this->baseUrl; ?>/backoffice/admin/setrole" method="POST">
							<input type="hidden" name="idadmin" value="<?php echo $this->escape($row->ID);?>">
							<input type="hidden" name="roletype" value="isStats">
							<?php if ($row->isSTATS == 1 ) {  ?>
								<button type="submit" class="btn btn-success btn-group-justified">Statistique</button>
								<input type="hidden" name="rolevalue" value="0">
							<?php } else { ?>
								<button type="submit" class="btn btn-danger btn-group-justified">Statistique</button>
								<input type="hidden" name="rolevalue" value="1">
							<?php } ?>
						</form>
                    </div>
			
				<?php } ?>
			</td>
			<td class="text-center no-space-side">
				<div class="btn-group" >
	             	<a class="btn btn-success" href="<?php echo $this->baseUrl; ?>/backoffice/admin/edit/id/<?php echo $row->ID; ?>" ><span class="glyphicon glyphicon-edit"></span> Modifier</a>
					<button class="btn btn-danger btn-modal" data-toggle="ajaxModalDelete" data-linkok="<?php echo $this->baseUrl; ?>/backoffice/admin/del/id/<?php echo $row->ID; ?>" ><span class="glyphicon glyphicon-trash"></span> Supprimer</button>
				</div>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<script>			
	$(document).ready(function() {
		initDataTable('adminTable', [[0, "asc" ]], [ { "orderable": false, "targets": -2},{ "orderable": false, "targets": -1, "width": "270px" }]); 	

		  $('.greenbutns').each(function(){
				var self = $(this),
				  label = self.next(),
				  label_text = label.text();
			
				label.remove();
				self.iCheck({
				  checkboxClass: 'icheckbox_line-green',
				  radioClass: 'iradio_line-green',
				  insert: '<div class="icheck_line-icon"></div>' + label_text
				});
			  });
	});
</script>
</div>

modules/backoffice/views/scripts/admin/add.phtml000060400000004025150710367660016012 0ustar00 <div class="table-box">
	<form action="<?php echo $this->baseUrl; ?>/backoffice/admin/add" method="post">
	<table class="table">
		<thead>
			<tr>
				<th colspan="2" class="col-md-4" ><?php echo $this->titlePage; ?></th>
			</tr>
		</thead>
		<tbody>
			<?php echo $this->render("alert_tr.phtml"); ?>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Nom</td>
				<td class="col-md-8"><input type="text" class="form-control" name="lastname" id="lastname" value="<?php echo $this->populateForm['NOM']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Pr�nom</td>
				<td class="col-md-8"><input type="text" class="form-control" name="firstname" id="firstname" value="<?php echo $this->populateForm['PRENOM']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Email</td>
				<td class="col-md-8"><input type="text" class="form-control" name="email" id="email" value="<?php echo $this->populateForm['EMAIL']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Login</td>
				<td class="col-md-8"><input type="text" class="form-control" name="addlogin" id="addlogin" value="<?php echo $this->populateForm['LOGIN']; ?>"/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Mot de passe</td>
				<td class="col-md-8"><input type="password" class="form-control" name="addpassword" id="addpassword" value=""/></td>
			</tr>
			<tr >
				<td class="col-md-4"><i class="glyphicon glyphicon-asterisk"></i>&nbsp;Confirmer le mot de passe</td>
				<td class="col-md-8"><input type="password" class="form-control" name="addpassword2" id="addpassword2" value=""/></td>
			</tr>
			<tr>
				<td colspan="2" class="text-center">
					<button class="btn btn-success" type="submit" name="add"><i class="glyphicon glyphicon-plus"></i>&nbsp;Ajouter</button>
				</td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
<div class="clearfix"></div>
		modules/backoffice/views/layouts/headerLayoutTopMenu.phtml000060400000017261150710367660020147 0ustar00
<?php if ($this->currentMenu == "Product") { ?>
 <li><a href="<?php echo $this->baseUrl; ?>/backoffice/product" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/search" ><i class="glyphicon glyphicon-search"></i>Recherche avanc�e</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/keywordsengine" ><i class="glyphicon glyphicon-cog"></i>Moteur de recherche</a></li>
<?php } ?>
<?php if ($this->currentMenu == "Option") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/option" ><i class="glyphicon glyphicon-th"></i>D�tail du produit</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/productoptionlist/option" ><i class="glyphicon glyphicon-th-list"></i>S�lectionnable</a></li>
<?php } ?>
<?php if ($this->currentMenu == "Category") { ?>
<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>  
<?php } ?>
<?php if ($this->currentMenu == "CategorySubs") { ?>
<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category2" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category2/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li> 
<?php } ?>
<?php if ($this->currentMenu == "Command") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/command/listcommand" ><i class="glyphicon glyphicon-eye-open"></i>Commandes</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/command/listdevis" ><i class="glyphicon glyphicon-eye-open"></i>Devis</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/command/search" ><i class="glyphicon glyphicon-search"></i>Rechercher</a></li>
<?php } ?>
<?php if ($this->currentMenu == "Promos") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/product" ><i class="glyphicon glyphicon-eye-open"></i>Produit</a></li>
<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/command" ><i class="glyphicon glyphicon-eye-open"></i>Commande</a></li>
<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/user" ><i class="glyphicon glyphicon-eye-open"></i>Client</a></li>
<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/codereduction" ><i class="glyphicon glyphicon-barcode"></i>Codes r�duction</a></li>
	<?php if ($this->useradmin['isAdmin'] == 1 ) { ?>
	<li><a href="<?php echo $this->baseUrl; ?>/backoffice/productglobal" ><i class="glyphicon glyphicon-eye-open"></i>G�n�ralit�s</a></li>		
	<?php } ?>
<?php } ?>
<?php if ($this->currentMenu == "Supplier") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/supplier" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/supplier/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "User") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/list" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/search" ><i class="glyphicon glyphicon-search"></i>Rechercher</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/codeinterne" ><i class="glyphicon glyphicon-barcode"></i>Codes Internes</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/newsletter" ><i class="glyphicon glyphicon-envelope"></i>Newsletter</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/fidelitypoint/list" ><i class="glyphicon glyphicon-credit-card"></i>Carte fid�lit�</a></li>

<?php if ($this->FeatureProductSendDetail || $this->FeatureProductDocumentDownloadGuest) { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/guest" ><i class="glyphicon glyphicon-user"></i>Invit�s</a></li>
<?php } ?>
<?php } ?>
<?php if ($this->currentMenu == "Admin") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/admin" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/admin/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "AnnonceContent") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncecontent" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "AnnonceFront") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncefront" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "AnnonceLeft") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annonceleft" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "AnnonceRight") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annonceright" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "AnnonceFooter") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncefooter" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "Footer") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/footer" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/footer/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "Logs") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logadmin" ><i class="glyphicon glyphicon-eye-open"></i>Administration</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logdefault" ><i class="glyphicon glyphicon-eye-open"></i>Publique</a></li> 
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/searchkey" ><i class="glyphicon glyphicon-eye-open"></i>Recherche des mots cl�s</a></li>
<?php } ?>
<?php if ($this->currentMenu == "BlogCategory") { ?> 
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/blogcategory/" ><i class="glyphicon glyphicon-eye-open"></i>Rechercher</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/blogcategory/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li> 
<?php } ?> 
<?php if ($this->currentMenu == "BlogComment") { ?> 
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/blogcomment/" ><i class="glyphicon glyphicon-eye-open"></i>Rechercher</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/blogcomment/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?> 
<?php if ($this->currentMenu == "BlogSubject") { ?> 
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/blogsubject/" ><i class="glyphicon glyphicon-eye-open"></i>Rechercher</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/blogsubject/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?> 
<?php if ($this->currentMenu == "AnnonceCms") { ?> 
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncecms/" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncecms/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?> 
<?php if ($this->currentMenu == "AnnonceGallery") { ?> 
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncegallery/" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncegallery/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?> 






modules/backoffice/views/layouts/layout.phtml000060400000013061150710367660015520 0ustar00<!DOCTYPE HTML>
<html>
<?php header('Content-type: text/html; charset=iso-8859-1'); ?>
<head>
<title><?php echo $this->title; ?></title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="icon" type="image/png" href="<?php echo $this->baseUrl; ?>/favicon.ico" /> 
	
<!-- Themes -->
<link href="<?php echo $this->baseUrl; ?>/css/themes/admin/css/style.css" rel="stylesheet" media="screen" />
<link href="<?php echo $this->baseUrl; ?>/css/themes/admin/css/bootstrap.css" rel="stylesheet" media="all" />
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet" media="all" />
<link href="<?php echo $this->baseUrl; ?>/css/themes/admin/custom.css" rel="stylesheet" media="screen" />
<link href="<?php echo $this->baseUrl; ?>/css/themes/admin/css/jquery.ui.datepicker.css" rel="stylesheet" media="screen" />
<link href="<?php echo $this->baseUrl; ?>/css/themes/admin/css/jquery-ui-1.10.4.custom.min.css" rel="stylesheet" media="screen" />


<link href="<?php echo $this->baseUrl; ?>/css/default/default.css" rel="stylesheet" media="screen" />
<link href="<?php echo $this->baseUrl; ?>/css/themes/admin/admin.css" rel="stylesheet" media="screen" />


<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />

<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.accordion.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.custom-scrollbar.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/icheck.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery-ui.custom.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.ui.datepicker.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.ui.datepicker-fr.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/selectnav.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/morris-0.4.1.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/raphael-2.1.0.min.js"></script>

<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.ui.effect.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.ui.effect-fade.js"></script>
 
<link href="<?php echo $this->baseUrl; ?>/js/redactor/redactor.css" rel="stylesheet" media="screen" />
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/redactor/redactor.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/redactor/fr.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/redactor/fontcolor.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/redactor/fontfamily.js"></script>
 
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/tinymce/tinymce.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/tinymce/themes/modern/theme.min.js"></script>
 

<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/custom.js"></script>
<!--[if lt IE 9]>
	<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
	<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->


<!-- elRTE -->
<script src="<?php echo $this->baseUrl; ?>/js/elrte/js/elrte.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="<?php echo $this->baseUrl; ?>/js/elrte/css/elrte.min.css" type="text/css" media="screen" charset="utf-8" />
<!-- elRTE translation messages -->
<script src="<?php echo $this->baseUrl; ?>/js/elrte/js/i18n/elrte.fr.js" type="text/javascript" charset="utf-8"></script>

<!-- elFINDER -->
<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $this->baseUrl; ?>/js/elfinder/css/elfinder.min.css" />
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/elfinder/js/elfinder.min.js"></script>
<!-- elFINDER translation messages -->
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/elfinder/js/i18n/elfinder.fr.js"></script>

<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/serialize/xorax_serialize.js"></script>

</head>
<body>

<?php  if($this->useradmin) { ?> 
<!-- Wrapper Start -->
<div class="wrapper" >
	<?php echo $this->render("headerLayout.phtml"); ?>
	<div class="structure-row alone">
	
        <div class="right-sec" >
			 <?php echo $this->render("headerLayoutTop.phtml"); ?>
			  <div class="content-section">
                <div class="container-liquid" >
					<?php echo $this->layout()->content; ?>
				</div>
			</div>
        </div>
	</div>
</div>
<?php } else { 
	echo $this->render("../scripts/auth/login.phtml"); 
 }  ?>
</body>
</html>modules/backoffice/views/layouts/headerLayout.phtml000060400000030364150710367660016636 0ustar00

<header class="hidden-print">             
	<nav class="topnavigation">
		<ul >
	
<?php  if ($this->isSiteGallery) {  ?>
	<?php if ($this->useradmin['isCategory'] == 1 ) { ?>
	<li class="<?php if ($this->currentMenu == "Category") { echo "active"; }?>">
		<a href="<?php echo $this->baseUrl; ?>/backoffice/category" class="ui-elements"><i class="glyphicon glyphicon-th-list"></i>&nbsp;Cat�gorie</a>
		<ul >
		   <li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category" >Visualiser</a></li>
			<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category/add" >Ajouter</a></li>  
		</ul>
	</li>
	<li  class="<?php if ($this->currentMenu == "AnnonceCms") { echo "active"; }?>">
		<a href="<?php echo $this->baseUrl; ?>/backoffice/annoncecms" class="ui-elements"><i class="glyphicon glyphicon-list-alt"></i>&nbsp;Articles</a>
		<ul >
			<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncecms" >Visualiser</a></li>
			<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncecms/add" >Ajouter</a></li>
		</ul>
	</li>
	<li  class="<?php if ($this->currentMenu == "AnnonceGallery") { echo "active"; }?>">
		<a href="<?php echo $this->baseUrl; ?>/backoffice/annoncegallery" class="ui-elements"><i class="glyphicon glyphicon-list-alt"></i>&nbsp;Gallerie</a>
		<ul >
			<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncegallery" >Visualiser</a></li>
			<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncegallery/add" >Ajouter</a></li>
		</ul>
	</li>
	<?php }?> 
<?php }?> 
<?php  if ($this->isSiteEbusiness) {  ?>
		<?php if ($this->useradmin['isProduct'] == 1 ) { ?>
			<li class="<?php if ($this->currentMenu == "Product") { echo "active"; }?>">
				<a href="<?php echo $this->baseUrl; ?>/backoffice/product" class="layouts"><i class="glyphicon glyphicon-th"></i>&nbsp;Produits</a>
				<ul>
				   <li><a href="<?php echo $this->baseUrl; ?>/backoffice/product" >Visualiser</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/add" >Ajouter</a></li>
					<?php if (false) { ?>
					<li style="display:none;"><a href="<?php echo $this->baseUrl; ?>/backoffice/product/livraison" >Livraison</a></li>
					<?php } ?>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/search" >Recherche avanc�e</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/keywordsengine" >Moteur de recherche</a></li>
				</ul>
			</li>
			<li class="<?php if ($this->currentMenu == "Option") { echo "active"; }?>">
				<a href="#layouts" class="layouts"><i class="glyphicon glyphicon-th"></i>&nbsp;Caract�ristiques</a>
				<ul >
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/option" >D�tail du produit</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/productoptionlist/option" >S�lectionnable</a></li>
					<?php if (false) { ?>
					<li style="display:none"><span class="link4"><a href="<?php echo $this->baseUrl; ?>/backoffice/product/optionprofil" >Profil d'options</a></span></li>
					<?php } ?>
				</ul>
			</li>
		<?php } ?>
		<?php if ($this->useradmin['isCategory'] == 1 ) { ?>
			<li class="<?php if ($this->currentMenu == "Category") { echo "active"; }?>">
				<a href="<?php echo $this->baseUrl; ?>/backoffice/category" class="ui-elements"><i class="glyphicon glyphicon-th-list"></i>&nbsp;Cat�gories</a>
				<ul >
				   <li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category" >Visualiser</a></li>
					<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category/add" >Ajouter</a></li>  
					<?php if (false) { ?>
					<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/product/livraisoncat" style="display:none" >Config. du poids</a></li>
					<?php } ?>
				</ul>
			</li>
			<li class="<?php if ($this->currentMenu == "CategorySubs") { echo "active"; }?>">
				<a href="<?php echo $this->baseUrl; ?>/backoffice/category2" class="ui-elements"><i class="glyphicon glyphicon-th-list"></i>&nbsp;Cat�gories subsidiaire</a>
				<ul >
					<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category2" >Visualiser</a></li>
					<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category2/add" >Ajouter</a></li> 
				</ul>
			</li>
		<?php } ?>
		<?php if ($this->useradmin['isCommand'] == 1 ) { ?>
			<li class="<?php if ($this->currentMenu == "Command") { echo "active"; }?>">
				<a href="#forms" class="forms"><i class="glyphicon glyphicon-list-alt"></i>&nbsp;Commandes & Devis</a>
				<ul >
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/command/listcommand" >Commandes</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/command/listdevis" >Devis</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/command/search" >Rechercher</a></li>
				</ul>
			</li>
		<?php } ?>
		<?php if ($this->useradmin['isPromo'] == 1 ) { ?>
			<li class="<?php if ($this->currentMenu == "Promos") { echo "active"; }?>">
				<a href="#forms" class="forms"><i class="glyphicon glyphicon-list-alt"></i>&nbsp;Promos & Remises</a>
				<ul >
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/product" >Sur le produit</a></li>
					<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/command" >Sur la commande</a></li>
					<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/user" >Sur le client</a></li>
					<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/codereduction" >Codes r�duction</a></li>
					<?php if ($this->useradmin['isAdmin'] == 1 ) { ?>
						<li><a href="<?php echo $this->baseUrl; ?>/backoffice/productglobal" >G�n�ralit�s</a></li>		
					<?php } ?>
				</ul>
			</li>
		<?php } ?>
		<?php if ($this->useradmin['isSupplier'] == 1 ) { ?>
			<li class="<?php if ($this->currentMenu == "Supplier") { echo "active"; }?>">
				<a href="<?php echo $this->baseUrl; ?>/backoffice/supplier" class="loginoptions"><i class="glyphicon glyphicon-user"></i>&nbsp;Fournisseurs</a>
				<ul >
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/supplier" >Visualiser</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/supplier/add" >Ajouter</a></li>
				</ul>
			</li>
		<?php } ?>
		<?php if ($this->useradmin['isUser'] == 1 ) { ?>
			<li  class="<?php if ($this->currentMenu == "User") { echo "active"; }?>">
				<a href="<?php echo $this->baseUrl; ?>/backoffice/user/list" class="loginoptions"><i class="glyphicon glyphicon-user"></i>&nbsp;Clients</a>
				<ul >
				  <li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/list" >Visualiser</a></li>
				  <li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/search" >Rechercher</a></li>
				  <li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/codeinterne" >Codes internes</a></li>
				  <li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/newsletter" >Newsletter</a></li>
				  <li><a href="<?php echo $this->baseUrl; ?>/backoffice/fidelitypoint/list" >Carte fid�lit�</a></li>
					
				<?php if ($this->FeatureProductSendDetail || $this->FeatureProductDocumentDownloadGuest) { ?>
				<li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/guest" >Invit�s</a></li>
				<?php } ?>

				</ul>
			</li>
		<?php } ?>
		<?php if ($this->useradmin['isPromo'] == 1 ) { ?>
			<li class="<?php if ($this->currentMenu == "AnnonceContent" || 
			$this->currentMenu == "AnnonceFront"|| 
			$this->currentMenu == "AnnonceLeft"|| 
			$this->currentMenu == "AnnonceFooter"|| 
			$this->currentMenu == "AnnonceRight") { echo "active"; }?>">
				<a href="#pages" class="pages"><i class="glyphicon glyphicon-edit"></i>&nbsp;Annonces</a>
				<ul >
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncecontent" >Publicit� sur l'accueil</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncefront" >Information sur l'accueil</a></li>	
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annonceright" >Mise en avant sur l'accueil</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annonceleft" >Publicit� par cat�gorie</a></li>				
					<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncefooter" >Bas de page</a></li>
				</ul>
			</li>
		<?php } ?>  
		<?php if ($this->useradmin['isFooter'] == 1 ) { ?>
			<li  class="<?php if ($this->currentMenu == "Footer") { echo "active"; }?>">
				<a href="<?php echo $this->baseUrl; ?>/backoffice/footer" class="pages"><i class="glyphicon glyphicon-edit"></i>&nbsp;Pied de page</a>
				<ul >
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/footer" >Visualiser</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/footer/add" >Ajouter</a></li>
				</ul>
			</li>
		<?php } ?> 
		<?php if ($this->useradmin['isFooter'] == 1 ) { ?>
			<li class="<?php if ($this->currentMenu == "Document") { echo "active"; }?>">
				<a href="<?php echo $this->baseUrl; ?>/backoffice/footer/doc" class="pages"><i class="glyphicon glyphicon-edit"></i>&nbsp;Documents</a>
			</li>
		<?php } ?>
		<?php if ($this->useradmin['isStats'] == 1 ) { ?>
			<li class="<?php if ($this->currentMenu == "Stats") { echo "active"; }?>">
				<a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/stats" class="charts"><i class="fa fa-line-chart"></i>&nbsp;Statistiques</a>
			</li>
		<?php }?>
		<?php if ($this->useradmin['isStats'] == 1 ) { ?>
			<li class="<?php if ($this->currentMenu == "Export") { echo "active"; }?>">
				<a href="#charts" class="charts"><i class="glyphicon glyphicon-floppy-saved"></i>&nbsp;Exports</a>
				<ul >
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/csv/sitemapxml" >G�n�rer le sitemap</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/csv/exporthello" >CSV -> Hello pro</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/csv/exportleguide" >CSV -> Le Guide</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/csv/exportciao" >CSV -> CIA o</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/csv/exportkelkoo" >CSV -> Kelkoo</a></li> 
				</ul>
			</li>
			<li class="<?php if ($this->currentMenu == "Ebp") { echo "active"; }?>">
				<a href="<?php echo $this->baseUrl; ?>/backoffice/ebp" class="charts"><i class="glyphicon glyphicon-transfer"></i>&nbsp;EBP</a>
			</li>
		<?php } ?>

		<?php if ($this->useradmin['isMaintenance'] == 1 ) { ?>
			<li class="<?php if ($this->currentMenu == "Scripts") { echo "active"; }?>">
				<a href="<?php echo $this->baseUrl; ?>/backoffice/maintenance" class="charts" ><i class="fa fa-spinner"></i>&nbsp;Scripts</a>
			</li>
			<li class="<?php if ($this->currentMenu == "Prestashop") { echo "active"; }?>">
				<a href="<?php echo $this->baseUrl; ?>/backoffice/prestashop" class="charts" ><i class="fa fa-spinner"></i>&nbsp;Prestashop</a>
			</li>
		<?php }?> 
			<li class="<?php if ($this->currentMenu == "Blog" || $this->currentMenu == "BlogCategory") { echo "active"; }?>">
				<a href="#" class="charts" ><i class="fa fa-spinner"></i>&nbsp;Blog</a>
				<ul>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/blogcomment">Commentaires</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/blogsubject" >Sujets</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/blogcategory" >Cat�gories</a></li> 
				</ul>
			</li> 
		<?php }?> 
		
		<?php if ($this->useradmin['isAdmin'] == 1 ) { ?>
			<li  class="<?php if ($this->currentMenu == "Admin") { echo "active"; }?>">
				<a href="<?php echo $this->baseUrl; ?>/backoffice/admin" class="loginoptions"><i class="glyphicon glyphicon-user"></i>&nbsp;Administrateurs</a>
				<ul >
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/admin" >Visualiser</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/admin/add" >Ajouter</a></li>
				</ul>
			</li>
		<?php } ?> 
		
		<?php if ($this->useradmin['isStats'] == 1 ) { ?>
			<li class="<?php if ($this->currentMenu == "Logs") { echo "active"; }?>">
				<a href="#charts" class="charts"><i class="glyphicon glyphicon-info-sign"></i>&nbsp;Logs</a>
				<ul >
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logadmin" >Administration</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logdefault" >Publique</a></li> 
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/searchkey" >Recherche des mots cl�s</a></li>
					<li><a href="<?php echo $this->baseUrl; ?>/backoffice/csv/sitemapxml" >Sitemap</a></li> 
				</ul>
			</li>
		<?php } ?> 
			
		</ul>
		<div class="clearfix"></div>
	</nav>
	<div class="clearfix"></div>
</header>modules/backoffice/views/layouts/headerLayoutTop.phtml000060400000004362150710367660017320 0ustar00

<header class="hidden-print">
                <!-- User Section Start -->
                <div class="user">
                    <div class="logo">
                        <a href="<?php echo $this->baseUrl; ?>/backoffice"><?php echo $this->siteName; ?></a>
                    </div>   
                    <div class="welcome">
                        <p>Bienvenue</p>
                        <h5><a href="<?php echo $this->baseUrl; ?>/backoffice"><?php echo $this->escape($this->useradmin['nom']). ' '.$this->escape($this->useradmin['prenom']).'.'; ?></a></h5>
                    </div>
                </div>
                <!-- User Section End -->
                <!-- Search Section Start -->
			<?php  if ($this->isSiteEbusiness) {  ?>
                <div class="search-box">
                	<form method="POST" action="/backoffice/product/search" id="searchbarform">
	                    <input type="text" placeholder="Rechercher un produit" name="search" id="searchbarinput" />
	                    <input type="submit" value="go" />
                    </form>
                </div>
			<?php  }  ?>
                <!-- Search Section End -->
                <!-- Header Top Navigation Start -->
                <nav class="topnav">
                    <ul id="nav1">
		 				<?php echo $this->render("headerLayoutTopMenu.phtml"); ?>
                        <li class="settings">
                        	<a href="#"><i class="glyphicon glyphicon-wrench"></i>Param�tres</a>
                            <div class="popdown popdown-right settings">
                            	<nav>
                                    <a href="http://www.web-entreprise.net/0/demander-des-informations-sur-les-produits-solutions-et-services-professionnels-de-web-entreprise" target="_blank"><i class="glyphicon glyphicon-question-sign"></i>Besoin d'aides ?</a>
                                    <a href="<?php echo $this->baseUrl; ?>/backoffice/auth/logout"><i class="glyphicon glyphicon-log-out"></i>D�connexion</a>
                                </nav>
                            </div>
                        </li>
                    </ul>
                </nav>
                <!-- Header Top Navigation End -->
                <div class="clearfix"></div>
            </header>modules/backoffice/views/layouts-left/layout.phtml000060400000012246150710367660016454 0ustar00<!DOCTYPE HTML>
<html>
<head>
<title><?php echo $this->title; ?></title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="icon" type="image/png" href="<?php echo $this->baseUrl; ?>/favicon.ico" /> 
	
<!-- Themes -->
<link href="<?php echo $this->baseUrl; ?>/css/themes/admin/css/style.css" rel="stylesheet" media="screen" />
<link href="<?php echo $this->baseUrl; ?>/css/themes/admin/css/bootstrap.css" rel="stylesheet" media="all" />
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet" media="all" />
<link href="<?php echo $this->baseUrl; ?>/js/redactor/redactor.css" rel="stylesheet" media="screen" />
<link href="<?php echo $this->baseUrl; ?>/css/themes/admin/custom.css" rel="stylesheet" media="screen" />
<link href="<?php echo $this->baseUrl; ?>/css/themes/admin/css/jquery.ui.datepicker.css" rel="stylesheet" media="screen" />
<link href="<?php echo $this->baseUrl; ?>/css/themes/admin/css/jquery-ui-1.10.4.custom.min.css" rel="stylesheet" media="screen" />

<link href="<?php echo $this->baseUrl; ?>/css/default/default.css" rel="stylesheet" media="screen" />


<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />

<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.accordion.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.custom-scrollbar.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/icheck.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery-ui.custom.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.ui.datepicker.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.ui.datepicker-fr.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/selectnav.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/redactor/redactor.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/redactor/fr.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/redactor/fontcolor.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/redactor/fontfamily.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/morris-0.4.1.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/raphael-2.1.0.min.js"></script>

<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.ui.effect.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/js/jquery.ui.effect-fade.js"></script>




<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/css/themes/admin/custom.js"></script>
<!--[if lt IE 9]>
	<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
	<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->


<!-- elRTE -->
<script src="<?php echo $this->baseUrl; ?>/js/elrte/js/elrte.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="<?php echo $this->baseUrl; ?>/js/elrte/css/elrte.min.css" type="text/css" media="screen" charset="utf-8" />
<!-- elRTE translation messages -->
<script src="<?php echo $this->baseUrl; ?>/js/elrte/js/i18n/elrte.fr.js" type="text/javascript" charset="utf-8"></script>

<!-- elFINDER -->
<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $this->baseUrl; ?>/js/elfinder/css/elfinder.min.css" />
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/elfinder/js/elfinder.min.js"></script>
<!-- elFINDER translation messages -->
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/elfinder/js/i18n/elfinder.fr.js"></script>

<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/serialize/xorax_serialize.js"></script>

</head>
<body>

<?php  if($this->useradmin) { ?> 
<!-- Wrapper Start -->
<div class="wrapper" >
	<div class="structure-row">
		 <?php echo $this->render("headerLayout.phtml"); ?>
	
        <div class="right-sec" >
			 <?php echo $this->render("headerLayoutTop.phtml"); ?>
			  <div class="content-section">
                <div class="container-liquid" >
					<?php echo $this->layout()->content; ?>
				</div>
			</div>
        </div>
	</div>
</div>
<?php } else { 
	echo $this->render("../scripts/auth/login.phtml"); 
 }  ?>
</body>
</html>modules/backoffice/views/layouts-left/headerLayoutTopMenu.phtml000060400000013312150710367660021070 0ustar00<?php if ($this->currentMenu == "Product") { ?>
 <li><a href="<?php echo $this->baseUrl; ?>/backoffice/product" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/search" ><i class="glyphicon glyphicon-search"></i>Recherche avanc�e</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/keywordsengine" ><i class="glyphicon glyphicon-cog"></i>Moteur de recherche</a></li>
<?php } ?>
<?php if ($this->currentMenu == "Option") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/option" ><i class="glyphicon glyphicon-th"></i>D�tail du produit</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/productoptionlist/option" ><i class="glyphicon glyphicon-th-list"></i>S�lectionnable</a></li>
<?php } ?>
<?php if ($this->currentMenu == "Category") { ?>
<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>  
<?php } ?>
<?php if ($this->currentMenu == "CategorySubs") { ?>
<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category2" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category2/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li> 
<?php } ?>
<?php if ($this->currentMenu == "Command") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/command/listcommand" ><i class="glyphicon glyphicon-eye-open"></i>Commandes</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/command/listdevis" ><i class="glyphicon glyphicon-eye-open"></i>Devis</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/command/search" ><i class="glyphicon glyphicon-search"></i>Rechercher</a></li>
<?php } ?>
<?php if ($this->currentMenu == "Promos") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/product" ><i class="glyphicon glyphicon-eye-open"></i>Produit</a></li>
<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/command" ><i class="glyphicon glyphicon-eye-open"></i>Commande</a></li>
<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/user" ><i class="glyphicon glyphicon-eye-open"></i>Client</a></li>
<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/codereduction" ><i class="glyphicon glyphicon-barcode"></i>Codes r�duction</a></li>
	<?php if ($this->useradmin['isAdmin'] == 1 ) { ?>
	<li><a href="<?php echo $this->baseUrl; ?>/backoffice/productglobal" ><i class="glyphicon glyphicon-eye-open"></i>G�n�ralit�s</a></li>		
	<?php } ?>
<?php } ?>
<?php if ($this->currentMenu == "Supplier") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/supplier" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/supplier/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "User") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/list" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/search" ><i class="glyphicon glyphicon-search"></i>Rechercher</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/codeinterne" ><i class="glyphicon glyphicon-barcode"></i>Codes Internes</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/newsletter" ><i class="glyphicon glyphicon-envelope"></i>Newsletter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "Admin") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/admin" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/admin/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "AnnonceContent") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncecontent" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "AnnonceFront") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncefront" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "AnnonceLeft") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annonceleft" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "AnnonceRight") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annonceright" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "AnnonceFooter") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncefooter" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "Footer") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/footer" ><i class="glyphicon glyphicon-eye-open"></i>Visualiser</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/footer/add" ><i class="glyphicon glyphicon-plus"></i>Ajouter</a></li>
<?php } ?>
<?php if ($this->currentMenu == "Logs") { ?>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logadmin" ><i class="glyphicon glyphicon-eye-open"></i>Administration</a></li>
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logdefault" ><i class="glyphicon glyphicon-eye-open"></i>Publique</a></li> 
<li><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/searchkey" ><i class="glyphicon glyphicon-eye-open"></i>Recherche des mots cl�s</a></li>
<?php } ?>





modules/backoffice/views/layouts-left/headerLayoutTop.phtml000060400000004002150710367660020237 0ustar00
<header class="hidden-print">
                <!-- User Section Start -->
                <div class="user">
                    <div class="welcome">
                        <p>Bienvenue</p>
                        <h5><a href="<?php echo $this->baseUrl; ?>/backoffice"><?php echo $this->escape($this->useradmin['nom']). ' '.$this->escape($this->useradmin['prenom']).'.'; ?></a></h5>
                    </div>
                </div>
                <!-- User Section End -->
                <!-- Search Section Start -->
                <div class="search-box">
                	<form method="POST" action="/backoffice/product/search" id="searchbarform">
	                    <input type="text" placeholder="Rechercher un produit" name="search" id="searchbarinput" />
	                    <input type="submit" value="go" />
                    </form>
                </div>
                <!-- Search Section End -->
                <!-- Header Top Navigation Start -->
                <nav class="topnav">
                    <ul id="nav1">
		 				<?php echo $this->render("headerLayoutTopMenu.phtml"); ?>
                        <li class="settings">
                        	<a href="#"><i class="glyphicon glyphicon-wrench"></i>Param�tres</a>
                            <div class="popdown popdown-right settings">
                            	<nav>
                                    <a href="http://www.web-entreprise.net/0/demander-des-informations-sur-les-produits-solutions-et-services-professionnels-de-web-entreprise" target="_blank"><i class="glyphicon glyphicon-question-sign"></i>Besoin d'aides ?</a>
                                    <a href="<?php echo $this->baseUrl; ?>/backoffice/auth/logout"><i class="glyphicon glyphicon-log-out"></i>D�connexion</a>
                                </nav>
                            </div>
                        </li>
                    </ul>
                </nav>
                <!-- Header Top Navigation End -->
                <div class="clearfix"></div>
            </header>modules/backoffice/views/layouts-left/headerLayout.phtml000060400000030220150710367660017555 0ustar00<aside class="sidebar hidden-print">
        <div class="sidebar-in">
                <!-- Sidebar Header Start -->
                <header>
                    <!-- Logo Start -->
                    <div class="logo">
                        <a href="<?php echo $this->baseUrl; ?>/backoffice"><img src="<?php echo $this->baseUrl; ?>/business/image/logo_1.png" alt="Accueil" /></a>
                    </div>
                    <!-- Logo End -->
                    <!-- Toggle Button Start -->
                    <a href="#" class="togglemenu">&nbsp;</a>
                    <!-- Toggle Button End -->
                    <div class="clearfix"></div>
                </header>
                <!-- Sidebar Header End -->
                <!-- Sidebar Navigation Start -->
                
                <nav class="navigation">
                    <ul class="navi-acc" id="navBar">
                   	<?php if ($this->useradmin['isProduct'] == 1 ) { ?>
                        <li class="<?php if ($this->currentMenu == "Product") { echo "active"; }?>">
                       	 	<a href="#layouts" class="layouts">Produits</a>
	                        <ul <?php if ($this->currentMenu != "Product") { echo "style='display:none'"; }?>>
	                           <li><a href="<?php echo $this->baseUrl; ?>/backoffice/product" >Visualiser</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/add" >Ajouter</a></li>
								<?php if (false) { ?>
								<li style="display:none;"><a href="<?php echo $this->baseUrl; ?>/backoffice/product/livraison" >Livraison</a></li>
								<?php } ?>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/search" >Recherche avanc�e</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/keywordsengine" >Moteur de recherche</a></li>
							</ul>
	                   	</li>
                        <li class="<?php if ($this->currentMenu == "Option") { echo "active"; }?>">
	                        <a href="#layouts" class="layouts">Caract�ristiques</a>
	                        <ul <?php if ($this->currentMenu != "Option") { echo "style='display:none'"; }?>>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/product/option" >D�tail du produit</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/productoptionlist/option" >S�lectionnable</a></li>
								<?php if (false) { ?>
								<li style="display:none"><span class="link4"><a href="<?php echo $this->baseUrl; ?>/backoffice/product/optionprofil" >Profil d'options</a></span></li>
		                    	<?php } ?>
		                    </ul>
	                   	</li>
					<?php } ?>
					<?php if ($this->useradmin['isCategory'] == 1 ) { ?>
						<li class="<?php if ($this->currentMenu == "Category") { echo "active"; }?>">
                         	<a href="#ui-elements" class="ui-elements">Cat�gories</a>
                            <ul <?php if ($this->currentMenu != "Category") { echo "style='display:none'"; }?>>
                               <li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category" >Visualiser</a></li>
								<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category/add" >Ajouter</a></li>  
								<?php if (false) { ?>
								<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/product/livraisoncat" style="display:none" >Config. du poids</a></li>
								<?php } ?>
                            </ul>
                        </li>
						<li class="<?php if ($this->currentMenu == "CategorySubs") { echo "active"; }?>">
                            <a href="#ui-elements" class="ui-elements">Cat�gories subsidiaire</a>
                            <ul <?php if ($this->currentMenu != "CategorySubs") { echo "style='display:none'"; }?>>
								<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category2" >Visualiser</a></li>
								<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/category2/add" >Ajouter</a></li> 
                            </ul>
                        </li>
					<?php } ?>
					<?php if ($this->useradmin['isCommand'] == 1 ) { ?>
						<li class="<?php if ($this->currentMenu == "Command") { echo "active"; }?>">
                            <a href="#forms" class="forms">Commandes & Devis</a>
                            <ul  <?php if ($this->currentMenu != "Command") { echo "style='display:none'"; }?>>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/command/listcommand" >Commandes</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/command/listdevis" >Devis</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/command/search" >Rechercher</a></li>
                            </ul>
                        </li>
					<?php } ?>
					<?php if ($this->useradmin['isPromo'] == 1 ) { ?>
						<li class="<?php if ($this->currentMenu == "Promos") { echo "active"; }?>">
                            <a href="#forms" class="forms">Promos & Remises</a>
                            <ul <?php if ($this->currentMenu != "Promos") { echo "style='display:none'"; }?>>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/product" >Sur le produit</a></li>
								<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/command" >Sur la commande</a></li>
								<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/user" >Sur le client</a></li>
								<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/promotion/codereduction" >Codes r�duction</a></li>
								<?php if ($this->useradmin['isAdmin'] == 1 ) { ?>
									<li><a href="<?php echo $this->baseUrl; ?>/backoffice/productglobal" >G�n�ralit�s</a></li>		
								<?php } ?>
                            </ul>
                        </li>
					<?php } ?>
					<?php if ($this->useradmin['isSupplier'] == 1 ) { ?>
						<li class="<?php if ($this->currentMenu == "Supplier") { echo "active"; }?>">
                            <a href="#loginoptions" class="loginoptions">Fournisseurs</a>
                            <ul <?php if ($this->currentMenu != "Supplier") { echo "style='display:none'"; }?>>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/supplier" >Visualiser</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/supplier/add" >Ajouter</a></li>
                            </ul>
                        </li>
					<?php } ?>
					<?php if ($this->useradmin['isUser'] == 1 ) { ?>
						<li  class="<?php if ($this->currentMenu == "User") { echo "active"; }?>">
                            <a href="#loginoptions" class="loginoptions">Clients</a>
                            <ul <?php if ($this->currentMenu != "User") { echo "style='display:none'"; }?>>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/list" >Visualiser</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/search" >Rechercher</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/codeinterne" >Codes internes</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/user/newsletter" >Newsletter</a></li>
                            </ul>
                        </li>
					<?php } ?>
					<?php if ($this->useradmin['isAdmin'] == 1 ) { ?>
						<li  class="<?php if ($this->currentMenu == "Admin") { echo "active"; }?>">
                            <a href="#loginoptions" class="loginoptions">Administrateurs</a>
                            <ul <?php if ($this->currentMenu != "Admin") { echo "style='display:none'"; }?>>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/admin" >Visualiser</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/admin/add" >Ajouter</a></li>
                            </ul>
                        </li>
					<?php } ?> 
					<?php if ($this->useradmin['isPromo'] == 1 ) { ?>
						<li class="<?php if ($this->currentMenu == "AnnonceContent" || 
						$this->currentMenu == "AnnonceFront"|| 
						$this->currentMenu == "AnnonceLeft"|| 
						$this->currentMenu == "AnnonceFooter") { echo "active"; }?>">
                            <a href="#pages" class="pages">Annonces</a>
                            <ul <?php if ($this->currentMenu != "AnnonceContent" && 
						$this->currentMenu != "AnnonceFront"&& 
						$this->currentMenu != "AnnonceLeft"&& 
						$this->currentMenu != "AnnonceFooter") { echo "style='display:none'"; }?>>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncecontent" >Publicit� sur l'accueil</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncefront" >Information sur l'accueil</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/annonceleft" >Publicit� par cat�gorie</a></li>								
								<?php if (false) { ?>
								<li style="display: none;"><a href="<?php echo $this->baseUrl; ?>/backoffice/annonceright" >Bandeau Droit</a></li>
								<?php } ?>
								<li ><a href="<?php echo $this->baseUrl; ?>/backoffice/annoncefooter" >Bas de page</a></li>
                            </ul>
                        </li>
					<?php } ?>  
					<?php if ($this->useradmin['isFooter'] == 1 ) { ?>
						<li  class="<?php if ($this->currentMenu == "Footer") { echo "active"; }?>">
                            <a href="#pages" class="pages">Pied de page</a>
                            <ul  <?php if ($this->currentMenu != "Footer") { echo "style='display:none'"; }?>>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/footer" >Visualiser</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/footer/add" >Ajouter</a></li>
                            </ul>
                        </li>
					<?php } ?> 
					<?php if ($this->useradmin['isFooter'] == 1 ) { ?>
						<li class="<?php if ($this->currentMenu == "Document") { echo "active"; }?>">
                            <a href="<?php echo $this->baseUrl; ?>/backoffice/footer/doc" class="pages">Documents</a>
                        </li>
					<?php } ?>
					<?php if ($this->useradmin['isStats'] == 1 ) { ?>
						<li class="<?php if ($this->currentMenu == "Stats") { echo "active"; }?>">
                            <a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/stats" class="charts">Statistiques</a>
                        </li>
                    <?php }?>
					<?php if ($this->useradmin['isStats'] == 1 ) { ?>
						<li class="<?php if ($this->currentMenu == "Logs") { echo "active"; }?>">
                            <a href="#charts" class="charts">Logs</a>
                            <ul  <?php if ($this->currentMenu != "Logs") { echo "style='display:none'"; }?>>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logadmin" >Administration</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/logdefault" >Publique</a></li> 
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/statistic/searchkey" >Recherche des mots cl�s</a></li>
                            </ul>
                        </li>
						<li class="<?php if ($this->currentMenu == "Export") { echo "active"; }?>">
                            <a href="#charts" class="charts">Exports</a>
                            <ul <?php if ($this->currentMenu != "Export") { echo "style='display:none'"; }?> >
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/csv/sitemapxml" >G�n�rer le sitemap</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/csv/exporthello" >CSV -> Hello pro</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/csv/exportleguide" >CSV -> Le Guide</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/csv/exportciao" >CSV -> CIA o</a></li>
								<li><a href="<?php echo $this->baseUrl; ?>/backoffice/csv/exportkelkoo" >CSV -> Kelkoo</a></li> 
                            </ul>
                        </li>
						<li class="<?php if ($this->currentMenu == "Ebp") { echo "active"; }?>">
                            <a href="<?php echo $this->baseUrl; ?>/backoffice/ebp" class="charts">EBP</a>
                        </li>
                    <?php } ?>
                    </ul>
                    <div class="clearfix"></div>
                </nav>
                <!-- Sidebar Navigation End -->
                <!-- Shadow Start -->
                <span class="shadows"></span>
                <!-- Shadow End -->
            </div>
        </aside>modules/default/views/helpers/mail_ajaxdownloaddocument.phtml000060400000001623150710367660020732 0ustar00<?php header('Content-Type: text/html; charset=ISO-8859-15'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
    Bonjour <?php echo $this->user_fullname; ?>,<br /><br />
Voici la fiche technique du produit trouv� sur le site <?php echo $this->site_url; ?> : <br /><br />
<?php echo $this->document_link; ?><br /><br />
Le nom du produit est : <?php echo $this->product_name; ?><br /><br />
Pour y acc�der : <br /><br />
<?php echo $this->product_url; ?><br /><br />
<?php echo $this->site_name; ?> pr�sente toute une gamme de <?php echo $this->category_name; ?>, � d�couvrir en cliquant sur le lien suivant :<br /><br />
<?php echo $this->category_url; ?><br /><br />
</body>
</html>
modules/default/views/helpers/mail_user_to_commercial.phtml000060400000001642150710367660020374 0ustar00<?php
$user = $this->user;
$message = $this->message;
$messageNotConnected = $this->messageNotConnected;
?>
<style type="text/css">
.text1 {
	font-family: "Arial";
	font-size: 11px;
	font-weight: bold;
	color: #000000; 
	text-decoration: none; 
	width: 100%;  
	float: left;
	margin: 5px;
	text-align: center;
}
.text2 {
	font-family: "Arial";
	font-size: 11px;
	font-weight: normal;
	color: #000000; 
	text-decoration: none; 
	width: 100%;  
	float: left;
	margin: 5px;
	text-align: center;
}
</style>
<div class="text1">DEMANDE D'INFORMATIONS</div> 
<div class="text1">Client :</div>
<div class="text2">
	<?php if (isset($user) && !empty($user)) { 
		echo $user['nom']." ".$user['prenom'].'<br/><br/>';
		echo 'Email : '.$user['email'].'<br/><br/>';
		echo 'T�l�phone : '.$user['tel']; 
	} else { 
		echo $messageNotConnected; 
	} ?>
</div>
<div class="text1">Message :</div>
<div class="text2">
	<?php echo $message;  ?>
</div>modules/default/views/helpers/mail_ajaxsendfriend.phtml000060400000000613150710367660017503 0ustar00<?php header('Content-Type: text/html; charset=ISO-8859-15'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
    <?php echo $this->text_message; ?>
</body>
</html>
modules/default/views/scripts/commande/paiement.phtml000060400000002134150710367660017126 0ustar00
<?php 
if (isset($this->verifMessage) && $this->verifMessage == 1) { ?>
<div class="col-xs-6 col-xs-offset-3 alert alert-success text-center hidden-print"  >
	Votre commande a �t� prise en compte
</div>
<div class="col-xs-12  hidden-print" style="margin-top: 20px; margin-bottom: 20px;">
	<div class="col-xs-6 text-center "><a class="btn btn-primary" href="<?php echo $this->baseUrl; ?>/">Retourner � la page d'accueil</a></div>
	<div class="col-xs-6 text-center "><a class="btn btn-default" onclick="window.print();return false;" href="<?php echo $this->baseUrl; ?>/"><span class="fa fa-print"></span> Imprimer</a></div>
</div>
<?php } else { ?>

<div class="col-xs-6 col-xs-offset-3 alert alert-danger text-center hidden-print"  >
	Votre commande n'a pas �t� prise en compte
</div>
<div class="col-xs-12" style="margin-top: 20px; margin-bottom: 20px;">
	<div class="col-xs-12 text-center"><a class="btn btn-primary hidden-print" href="<?php echo $this->baseUrl; ?>/mon-panier-validation.html">Retourner � la page de validation</a></div>
</div>		
<?php }	?>

<?php echo $this->render("/commande/facture.phtml"); ?>modules/default/views/scripts/commande/facture_mail.phtml000060400000037400150710367660017763 0ustar00<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
	<meta name="Identifier-URL" content="<?php echo $this->baseUrl_SiteCommerceUrl;?>" />
	<meta name="Reply-to" content="<?php echo $this->serviceClient_Mail;?>" />
	
	<style type="text/css">
	
img {
	border: none;
	margin: 0 0 0 0;
	padding: 0 0 0 0;
}

body {
	font-family: "Arial";
	font-size: 12px;
	text-align: left;
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
}

.oldPromoPrice {
	font-size: 10px;
	font-weight: normal;
	color: #5e5e59;
	text-decoration: line-through;
}
.link6 a:link,.link6 a:visited,.link6 a:active {
	font-family: "Verdana";
	font-size: 11px;
	font-weight: bold;
	color: #787878;
	text-decoration: none;
}

.link6 a:hover {
	text-decoration: underline;
}

.textTd1 {
	font-family: "Verdana";
	font-size: 11px;
	font-weight: normal;
	color: #000000;
	text-decoration: none;
}

.bill_body {
	clear: both;
	width: 800px;
	margin: 0 auto 0 auto;
}
 

.bill_company {
	float: left;
}
.bill_company_logo {
	margin: 10px 0 10px 10px;
	padding: 10px 0 10px 10px;
	width: 94px;
	height: 121px;
}
.bill_idents {
	float: right;
	width: 550px;
}
.bill_idents_opt1{
	float:left;
	width:120px;
	height:50px;
	margin:0 0 0 10px;
	padding:0 0 0 10px;
}

.bill_idents_opt21{
	float:left;
	width:120px;
	height:25px;
	background-color: #e7e7e7;
	margin:0 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}
.bill_idents_opt31{
	float:left;
	width:120px;
	height:24px;
	margin:1px 0 0 0;
	padding:1px 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}

.bill_idents_opt22{
	float:left;
	width:250px;
	height:25px;
	background-color: #e7e7e7;
	margin:0 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}
.bill_idents_opt32{
	float:left;
	width:250px;
	height:24px;
	margin:1px 0 0 0;
	padding:1px 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}

.bill_text {
	color: #000000;
	font-weight: bold;
}
.bill_text2 {
	color: #000000;
	font-weight: bold;
	line-height:25px;
}
.bill_text3 {
	color: #000000;
	font-size:11px;
}
.bill_address {
	float: left;
	width: 800px; 
	margin:10px 0 0 0;
}

.bill_address_opt {
	float: left;
	width: 300px; 
	margin: 0 0 0 50px;
}
.bill_address_opt1{
	float:left;
	width:300px;
	height:25px;
	background-color: #e7e7e7;
	margin:0 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}




.bill_address_opt2 {
	float:left;
	width:250px;
	margin: 10px 0 0 20px;
	padding: 10px 0 0 20px;
}

.bill_line {
	line-height:25px;
	text-align:center;
	font-weight:bold;
}
.bill_line2 {
	line-height:20px;
}

.bill_caddy {
	float: left;
	width:800px;
	height:auto;
}

.bill_facture{
	float: left;
	width:800px; 
}

.bill_buy{
	float: left;
	width:500px; 
}
 
.bill_user_paiement_box {
	width:450px;
	margin:5px 0 0 0;
	padding: 0 10px 10px 10px;
	border : 2px #000000 solid;
}

.bill_detail{
	float: right;
	width:250px;
	height:130px;
	border: solid 1px black;
	margin: 10px 0 0 0;
	padding :10px 0 0 0;
}
.bill_footer{
	float: left;
	width:800px;
	margin: 20px 0 0 0;
	padding: 20px 0 0 0;
}
.bill_footer2{
	float: left;
	width:800px;
	text-align:center;
	margin: 0 0 20px 0;
	padding: 0 0 20px 0;
}
.bill_linkd a:link,.bill_linkd a:visited,.bill_linkd a:active {
	font-family: "Arial";
	font-size: 12px;
	font-weight: normal;
	color: #000000;
	text-decoration: none;
}

.bill_linkd a:hover {
	text-decoration: underline;
}
</style>
</head>
<body>

<?php
$facture = $this->facture;
?>
<div style="clear: both;	width: 800px;	margin: 0 auto 0 auto;">
	<div style="float: clear;width: 800px;">
		<div class="bill_company">
			<div class="bill_company_logo"> 
				<a href="<?php echo $this->baseUrl_SiteCommerceUrl; ?>/"><img alt="Directement � la source de la qualit�" src="<?php echo $this->baseUrl_SiteCommerceUrl; ?>/business/image/logo.png" style="border: none;"/></a>
			</div>
		</div>
		<div  style="	float: right;	width: 400px;">
			<div class="bill_idents_opt1">
				<div class="bill_idents_opt21">
					<span class="bill_line"><?php if ($facture['STATUT'] == 1 || $facture['STATUT'] == 2 || $facture['STATUT'] == 3) { echo 'Facture';} else {echo 'Devis';} ?></span>
				</div>
				<div class="bill_idents_opt31">
					<span class="bill_line"><?php echo $facture['REFERENCE']; ?></span>
				</div>
			</div>
			<div class="bill_idents_opt1">
				<div class="bill_idents_opt21">
					<span class="bill_line"><?php echo 'Date'; ?></span>
				</div>
				<div class="bill_idents_opt31">
					<span class="bill_line">
					<?php 
					try {
					$myDate = new Zend_Date(strtotime($facture['DATESTART']));
					
					$mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
				$moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
				
					echo $myDate->toString("dd").' '.$mois[(int)$myDate->toString('MM')].' '.$myDate->toString("YYYY");
					} catch(Zend_Exception $e) { } 
					?>
					</span>
				</div>
			</div>
			<div class="bill_idents_opt1">
				<div class="bill_idents_opt22">
					<span class="bill_line"><?php echo 'Client'; ?></span>
				</div>
				<div class="bill_idents_opt32">
				<span class="bill_line"><?php echo $facture['USER_EMAIL']; ?></span>
				</div>
			</div> 
		</div>
		<div style="	float: left;	width: 350px;">
			<?php if (!empty($facture['USER_NUMCOMPTE'])) {?>
			<span class="bill_text">Compte : <?php echo $facture['USER_NUMCOMPTE']; ?></span><br>
			<?php } ?>
			<span class="bill_text">Tel : <?php echo $this->tel_contact; ?></span><br>
			<span class="bill_text">Email : <?php  echo $this->serviceClient_Mail;?></span>
		</div>
	</div>
	<div class="bill_address">
		<div class="bill_address_opt">
			<div class="bill_address_opt1">
				<span class="bill_line">Adresse de Facturation</span>
			</div>
			<div class="bill_address_opt2">
				<span class="bill_text2"><?php echo $facture['FACT_RAISONSOCIAL']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['FACT_ADRESSE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['FACT_CP'].' '.$facture['FACT_VILLE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['FACT_PAYS']; ?></span>
			</div>
		</div>
		<div class="bill_address_opt">	
			<div class="bill_address_opt1">
				<span class="bill_line">Adresse de Livraison</span>
			</div>
			<div class="bill_address_opt2">
				<span class="bill_text2"><?php echo $facture['LIV_RAISONSOCIAL']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['LIV_ADRESSE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['LIV_CP'].' '.$facture['LIV_VILLE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['LIV_PAYS']; ?></span>
			</div>
		</div>
	</div>
	<div class="bill_caddy">
		<table style="border:1px solid black;"  border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr align="center" style="background-color: #e7e7e7;">
				<th class="bill_line" >R�f�rence</th>
				<th class="bill_line">D�signation</th>
				<th class="bill_line" style="width: 60px">Dispo.</th>
				<th class="bill_line">Quantit�</th>
				<th class="bill_line"  style="text-align: center">P.U. HT</th>
				<th class="bill_line"  style="display: none;">Prix Remis�</th>
				<th class="bill_line" >Montant HT</th>
			</tr>
			<?php 
			$index = 1;
			$i = 0;
			$caddy = $facture['CADDY'];
			foreach($caddy as $row) {
				?>
			<tr >
				<td colspan="6" height="1px" style="background-color: #868686"></td>
			</tr>
			<tr align="center"  height="25px" >
				<td class="textTd1" width="110px" style="text-align:center;white-space: nowrap;">
					<?php echo $this->escape($row['REFERENCE']);?>
				</td>
				<td  width="450px" class="bill_linkd" style="text-align: left;">
					<a target="_blank"  href="<?php echo $this->baseUrl_SiteCommerceUrl; ?>/<?php echo Utils_Tool::getFormattedUrlProduct($row['NAVNOM_URLPARENTS'], $row['NAVPRODUCTNOM'], $row['PRODUCTID']); ?>"><?php echo $row['DESIGNATION'];?></a>
					<?php if (!empty($row['SELECTEDOPTION'])) { 
						echo '<br/>'.$row['SELECTEDOPTION'].'<br/>';
					} ?>
				</td> 
				<td class="textTd1" > 
					<?php if ((int)$row['STOCK'] == 1) { ?>
					<img alt="Disponible" title="Disponible" src="<?php echo $this->baseUrl_SiteCommerceUrl; ?>/business/image/admin/stock11.png" />
					<?php } else if ((int)$row['STOCK'] == 2) { ?>
					<img alt="Disponible sous 8 jours" title="Disponible sous 8 jours" src="<?php echo $this->baseUrl_SiteCommerceUrl; ?>/business/image/admin/stock22.png" />
					<?php } else if ((int)$row['STOCK'] == 3) { ?>
					<img alt="Nous contacter" title="Nous contacter" src="<?php echo $this->baseUrl_SiteCommerceUrl; ?>/business/image/admin/stock33.png" />
					<?php }?> 	
				</td>
				<td class="textTd1" >
					<?php echo $row['QUANTITY']; ?>	
				</td>
				<td class="textTd1" width="150px">
						<?php $this->currentData = $row;
						echo $this->render("../produits/ajaxshowpromoprice.phtml"); ?>
				</td>
				<td width="120px"  style="display: none;">
				<?php if ($row['isPROMO'] == 1 && $row['REMISEPRIX'] > 0) { ?>
					<span class="textTd1" >
						<?php
							if ((int)$row['REMISEPRIXTAUXP'] > 0) {
									echo number_format($row['REMISEPRIX'], 2, ',', ' ').' &#8364; <br>('.$this->escape($row['REMISEPRIXTAUXP']).' %)';
								} else {
									echo number_format($row['REMISEPRIX'], 2, ',', ' ').' &#8364;';
								}
							?>
					</span>
					<?php } ?>
				</td>
				<td width="120px">
					<span class="textTd1" style="float: right;" >
						<?php if ($row['isDEVIS'] == 1) { 
							echo number_format($row['PRIXTOTAL'], 2, ',', ' ').' &#8364;';
						} ?>
					</span>
				</td>
			</tr>
			<?php $i++; } ?>
	
  <?php
	$caddyfidelite = $facture['CADDYFIDELITE'];
	foreach($caddyfidelite as $row) {
		?>
    <tr>
      <td colspan="6">
        <div style="font-weight: bold;margin:10px;">
          <?php echo 'Carte de fid�lit� : '.$row['NOM'].' ('.$row['NBPOINT'].' points)'; ?>
        </div>
      </td>
    </tr>
  <?php } ?>				
		</table>
	</div>
	<div class="bill_facture"> 
		<div class="bill_buy">   
				<?php switch ($facture['USER_MODEPAIEMENT_TYPE']) {
						case 1 : ?>
						<div class="bill_user_paiement_box">
							<div class="bill_text2" style="text-align:center">Mode de paiement : Par ch�que</div>
							<div style="margin-left:10px">- Veuillez libeller votre ch�que � l�ordre de <?php echo $this->siteName; ?></div>
							<div style="margin-left:10px">- Inscrivez le num�ro de votre commande au dos de votre ch�que</div>
							<div style="margin-left:10px">- Puis envoyez votre r�glement � l�adresse suivante :</div>
							<br/>
							<div class="bill_text" style="text-align:center"><?php echo $this->siteName; ?></div>
							<br/>
							<div class="bill_text" style="text-align:center"><?php echo $this->site_addresse3_title; ?></div>
							<div class="bill_text" style="text-align:center"><?php echo $this->site_addresse3_address; ?></div>
							<div class="bill_text" style="text-align:center"><?php echo $this->site_addresse3_cp; ?></div>
							<br/>
							<div style="font-size:10px;text-align:center">A noter : Les produits sont exp�di�s � r�ception du ch�que</div> 
						</div> 
						<?php  break;
							case 2 : ?>  
						<div class="bill_user_paiement_box">
							<div class="bill_text2" style="text-align:center">Mode de paiement : Par virement</div>
							<div >- La commande sera exp�di�e d�s le virement pr�sent sur notre compte bancaire.</div> 
							<div class="bill_text">- Inscrivez votre num�ro de commande sur le formulaire de virement</div> 
							<div >- Vous disposez d�un <span style="font-weight: bold;">d�lai de 15 jours</span> pour effectuer le virement sur notre compte ci-dessous indiqu�, au d�l� de ce d�lai votre commande sera automatiquement annul�e.</div> 
							<br/>
							<div class="bill_text">RIB : <?php echo $this->site_rib_numbers; ?></div> 
							<div class="bill_text">No IBAN : <?php echo $this->site_rib_iban; ?></div> 
							<div class="bill_text">Code BIC : <?php echo $this->site_rib_bic; ?></div> 
							<div class="bill_text">Nom du compte : <?php echo $this->siteName; ?></div> 
							<div class="bill_text">Nom et domiciliation de la banque : <?php echo $this->site_rib_bankname; ?></div>  
						</div> 
				<?php 	break;
						default : ?>
							<span class="bill_text2">
							<?php if (empty($facture['USER_MODEPAIEMENT_LABEL'])) { ?> Mode de reglement :
							<?php 
								switch ($facture['USER_MODEPAIEMENT']) {
									case 1 : echo " Paiement s�curis� en ligne"; break;
									case 2 : echo " Contre remboursement";break;
									case 3 : echo " Paiement diff�r� - 30 jours";break;
									case 4 : echo " Paiement diff�r� - 45 jours";break;
									case 5 : echo " Paiement diff�r� - 60 jours";break;
									case 6 : echo " A r�ception de la facture";break;
								}
							} else { 
								echo $facture['USER_MODEPAIEMENT_LABEL'];
							} ?>
							</span>	 
						<?php 
						break;  
				} ?>  
		</div> 
		<div class="bill_detail">
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr align="right">
					<td class="bill_line2">Total HT</td>
					<td  class="bill_line2"><?php echo number_format($facture['PRIXTOTALHTHR'], 2, ',', ' '); ?> &#8364;</td>
				</tr>	
				<tr align="right">
					<td  class="bill_line2" >Remise <?php if (isset($facture['CODEREDUCTION']) && !empty($facture['CODEREDUCTION']) ) { echo " ( ".$facture['CODEREDUCTION']." ) "; } ?></td>
					<td  class="bill_line2" ><?php echo number_format($facture['PRIXREMISEEUR'], 2, ',', ' '); ?> &#8364;</td>
				</tr>	
				<tr align="right"> 
					<td  class="bill_line2">
						<?php if (strcasecmp($facture['LIV_PAYS'], "FRANCE") != 0) { ?>
						Prix d�part 	
						<?php } else {
							if (isset($facture['LIV_NOM']) && !empty($facture['LIV_NOM']) ) { echo 'Livraison en '.$facture['LIV_NOM']; } else { echo 'Frais de port'; } 
						} ?>
					</td>
					
					<td class="bill_line2"><?php echo number_format($facture['PRIXFRAISPORT'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
				<tr >
					<td colspan="2" height="1px" style="background-color: #868686"></td>
				</tr>
				<tr align="right">
					<td class="bill_text2">Net HT</td>
					<td class="bill_text2"><?php echo number_format($facture['PRIXTOTALHTFP'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
				<tr align="right">
					<td  class="bill_line2">Total TVA</td>
					<td  class="bill_line2"><?php echo number_format($facture['PRIXTOTALTVA'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
				<tr >
					<td colspan="2" height="1px" style="background-color: #868686"></td>
				</tr>
				<tr align="right">
					<td class="bill_text2">NET A PAYER TTC</td>
					<td class="bill_text2"><?php echo number_format($facture['PRIXTOTALTTC'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
			</table>
		</div>
	</div>
	
	
	<div class="bill_footer">
			<span class="link18">
				<input type="checkbox" checked="checked" disabled="disabled"/>
				J'ai pris connaissance des Conditions G�n�rales de Vente et les accepte sans r�serves.
			</span>
			<br /><br />
			<span class="bill_text3">
			P�nalit�s de retard (taux annuel) : 9,00% 
			</span><br>
			<span class="bill_text3">
			<b>RESERVE DE PROPRIETE</b> : Nous nous r�servons la propri�t� des marchandises jusqu'au paiement du prix par l'acheteur. Notre droit de revendication porte aussi bien sur les marchandises que sur leur prix si elles ont d�j� �t� revendues (Loi du 12 mai 1980). 
			</span><br><br>
	</div>
	
		<div class="bill_footer2" >
				<span class="bill_text3">
			<?php echo $this->site_addresse; ?>
			</span><br>
			<span class="bill_text3">
			<?php echo $this->site_actualshort; ?>
			</span>
		</div >
</div>


</body>
</html>
modules/default/views/scripts/commande/facture.phtml000060400000036655150710367660016774 0ustar00
<?php
$facture = $this->facture;
?>
<script type="text/javascript"> 
	 $(function(){
		 window.print();
	});
</script>
<style type="text/css">
.textTd1 {
	font-family: "Verdana";
	font-size: 11px;
	font-weight: normal;
	color: #000000;
	text-decoration: none;
}
.oldPromoPrice {
	font-size: 10px;
	font-weight: normal;
	color: #5e5e59;
	text-decoration: line-through;
}
.bill_body {
	clear: both;
	width: 800px;
	margin: 0 auto 0 auto;
}

.bill_header {
	float: clear : both;
	width: 800px;
}

.bill_company {
	float: left;
}
.bill_company_logo {
	margin: 10px 0 10px 10px;
	width: 94px;
	height: 121px;
}
.bill_idents {
	float: right;
	width: 550px;
}
.bill_idents_opt1{
	float:left;
	width:120px;
	height:50px;
	margin:0 0 0 10px;
}

.bill_idents_opt21{
	float:left;
	width:120px;
	height:25px;
	background-color: #e7e7e7;
	margin:0 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}
.bill_idents_opt31{
	float:left;
	width:120px;
	height:24px;
	margin:1px 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}

.bill_idents_opt22{
	float:left;
	width:250px;
	height:25px;
	background-color: #e7e7e7;
	margin:0 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}
.bill_idents_opt32{
	float:left;
	width:250px;
	height:24px;
	margin:1px 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}

.bill_text {
	color: #000000;
	font-weight: bold;
}
.bill_text2 {
	color: #000000;
	font-weight: bold;
	line-height:25px;
}
.bill_text3 {
	color: #000000;
	font-size:11px;
}
.bill_address {
	float: left;
	width: 800px; 
	margin:10px 0 0 0;
}

.bill_address_opt {
	float: left;
	width: 300px; 
	margin: 0 0 0 50px;
	
}
.bill_address_opt1{
	float:left;
	width:300px;
	height:25px;
	background-color: #e7e7e7;
	margin:0 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}
 
.bill_address_opt2 {
	float:left;
	width:250px;
	margin: 10px 0 0 20px;
}

.bill_line {
	line-height:25px;
	text-align:center;
	font-weight:bold;
}
.bill_line2 {
	line-height:20px;
}

.bill_caddy {
	float: left;
	width:800px;
	height:auto;
}

.bill_facture{
	float: left;
	width:800px; 
}

.bill_buy{
	float: left;
	width:500px; 
}
 
.bill_user_paiement_box {
	width:450px;
	margin:5px 0 0 0;
	padding: 0 10px 10px 10px;
	border : 2px #000000 solid;
}

.bill_detail{
	float: right;
	width:250px;
	height:130px;
	border: solid 1px black;
	margin: 10px 0 0 0;
}
.bill_footer{
	float: left;
	width:800px;
	margin: 20px 0 0 0;
}
.bill_footer2{
	float: left;
	width:800px;
	text-align:center;
	margin: 0 0 20px 0;
}

.bill_linkd a:link,.bill_linkd a:visited,.bill_linkd a:active {
	font-family: "Arial";
	font-size: 12px;
	font-weight: normal;
	color: #000000;
	text-decoration: none;
}

.bill_linkd a:hover {
	text-decoration: underline;
}
</style>
<div class="bill_body">
	<div class="bill_header">
		<div class="bill_company">
			<div class="bill_company_logo">
        <a href="<?php echo $this->baseUrl_SiteCommerceUrl; ?>/"><img alt="Directement � la source de la qualit�" src="<?php echo $this->baseUrl_SiteCommerceUrl; ?>/business/image/logo.png" style="border: none;"/></a>
			</div>
		</div>
		<div class="bill_idents">
			<div class="bill_idents_opt1">
				<div class="bill_idents_opt21">
					<span class="bill_line"><?php if ($facture['STATUT'] == 1) { echo 'Commande N';} else {echo 'Devis N';} ?></span>
				</div>
				<div class="bill_idents_opt31">
					<span class="bill_line"><?php echo $facture['REFERENCE']; ?></span>
				</div>
			</div>
			<div class="bill_idents_opt1">
				<div class="bill_idents_opt21">
					<span class="bill_line"><?php echo 'Date'; ?></span>
				</div>
				<div class="bill_idents_opt31">
					<span class="bill_line">
					<?php 
					try {
					$myDate = new Zend_Date(strtotime($facture['DATESTART']));
					$mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
				$moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
				
					echo $myDate->toString("dd").' '.$mois[(int)$myDate->toString('MM')].' '.$myDate->toString("YYYY");
		
					
					} catch(Zend_Exception $e) {
						
					} ?>
					</span>
				</div>
			</div>
			<div class="bill_idents_opt1">
				<div class="bill_idents_opt22">
					<span class="bill_line"><?php echo 'Client'; ?></span>
				</div>
				<div class="bill_idents_opt32">
				<span class="bill_line"><?php echo $facture['USER_EMAIL']; ?></span>
				</div>
			</div> 
		</div>
		<div style="float: left;width:800px ">
			<?php if (!empty($facture['USER_NUMCOMPTE'])) {?>
				<span class="bill_text">Compte : <?php echo $facture['USER_NUMCOMPTE']; ?></span><br>
			<?php } ?>
			<span class="bill_text">Tel : <?php echo $this->tel_contact; ?></span><br>
			<span class="bill_text">Email : <?php echo $this->serviceClient_Mail; ?></span>
		</div>
	</div>
	<div class="bill_address">
		<div class="bill_address_opt">
			<div class="bill_address_opt1">
				<span class="bill_line">Adresse de Facturation</span>
			</div>
			<div class="bill_address_opt2">
				<span class="bill_text2"><?php echo $facture['FACT_RAISONSOCIAL']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['FACT_ADRESSE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['FACT_CP'].' '.$facture['FACT_VILLE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['FACT_PAYS']; ?></span>
			</div>
		</div>
		<div class="bill_address_opt">	
			<div class="bill_address_opt1">
				<span class="bill_line">Adresse de Livraison</span>
			</div>
			<div class="bill_address_opt2">
				<span class="bill_text2"><?php echo $facture['LIV_RAISONSOCIAL']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['LIV_ADRESSE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['LIV_CP'].'  '.$facture['LIV_VILLE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['LIV_PAYS']; ?></span>
			</div>
		</div>
	</div>
	<div class="bill_caddy">
		<table style="border:1px solid black;"  border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr align="center" style="background-color: #e7e7e7;">
				<th class="bill_line" >R�f�rence</th>
				<th class="bill_line">D�signation</th>
				<th class="bill_line" style="width: 60px">Dispo.</th>
				<th class="bill_line">Quantit�</th>
				<th class="bill_line" style="text-align:center">P.U. HT</th> 
				<th class="bill_line" >Montant HT</th>
			</tr>
			<?php 
			$index = 1;
			$i = 0;
			$caddy = $facture['CADDY'];
			foreach($caddy as $row) {
				?>
			<tr >
				<td colspan="6" height="1px" style="background-color: #868686"></td>
			</tr>
			<tr align="center"  height="25px" >
				<td class="textTd1" width="110px" style="text-align:center;white-space: nowrap;">
					<?php echo $this->escape($row->item_reference);?>
				</td>
				<td  width="450px" class="bill_linkd" style="text-align: left;">
					<?php echo $row->item_designation;?>
					<?php if (!empty($row->item_selectedOption)) { 
						echo '<br/>'.$row->item_selectedOption.'<br/>';
					} ?> 
				</td>
				<td class="textTd1" > 
					<?php if ((int)$row->item_stock == 1) { ?>
					<img alt="Disponible" title="Disponible" src="<?php echo $this->baseUrl_SiteCommerceUrl; ?>/business/image/admin/stock11.png" />
					<?php } else if ((int)$row->item_stock == 2) { ?>
					<img alt="Disponible sous 8 jours" title="Disponible sous 8 jours" src="<?php echo $this->baseUrl_SiteCommerceUrl; ?>/business/image/admin/stock22.png" />
					<?php } else if ((int)$row->item_stock == 3) { ?>
					<img alt="Nous contacter" title="Nous contacter" src="<?php echo $this->baseUrl_SiteCommerceUrl; ?>/business/image/admin/stock33.png" />
					<?php }?> 	
				</td>
				<td class="textTd1" >
					<?php echo $row->item_qte; ?>	
				</td>
				<td class="textTd1" width="150px">
						<?php $this->currentData = $row;
						echo $this->render("/produits/ajaxshowpromopricecaddy.phtml"); ?>
				</td> 
				<td width="120px">
					<span class="textTd1" style="float: right;" >
					<?php 
						if (!$row->isSurDevis()) {
							echo number_format($row->getPrixTotalHT(true), 2, ',', ' ').' &#8364;';
						}
					?>
					</span>
				</td>
			</tr>
			<?php $i++; } ?>	
			
  <?php
	$caddyfidelite = $facture['CADDYFIDELITE'];
	foreach($caddyfidelite as $row) {
		?>
    <tr>
      <td colspan="6">
        <div style="font-weight: bold;margin:10px;">
          <?php echo 'Carte de fid�lit� : '.$row->fidelite_nom.' ('.$row->fidelite_nbpoint.' points)'; ?>
        </div>
      </td>
    </tr>
  <?php } ?>
		</table>
	</div>
	<div class="bill_facture">
		<?php if ($facture['STATUT'] == 1) { ?> 
		<div class="bill_buy">   
				<?php switch ($facture['USER_MODEPAIEMENT_TYPE']) {
						case 1 : ?>
						<div class="bill_user_paiement_box">
							<div class="bill_text2" style="text-align:center">Mode de paiement : Par ch�que</div>
							<div style="margin-left:10px">- Veuillez libeller votre ch�que � l�ordre de <?php echo $this->siteName; ?></div>
							<div style="margin-left:10px">- Inscrivez le num�ro de votre commande au dos de votre ch�que</div>
							<div style="margin-left:10px">- Puis envoyez votre r�glement � l�adresse suivante :</div>
							<br/>
							<div class="bill_text" style="text-align:center"><?php echo $this->siteName; ?></div>
							<br/>
						<div class="bill_text" style="text-align:center"><?php echo $this->site_addresse3_title; ?></div>
							<div class="bill_text" style="text-align:center"><?php echo $this->site_addresse3_address; ?></div>
							<div class="bill_text" style="text-align:center"><?php echo $this->site_addresse3_cp; ?></div>
							<br/>
							<div style="font-size:10px;text-align:center">A noter : Les produits sont exp�di�s � r�ception du ch�que</div> 
						</div> 
						<?php  break;
							case 2 : ?>  
						<div class="bill_user_paiement_box">
							<div class="bill_text2" style="text-align:center">Mode de paiement : Par virement</div>
							<div >- La commande sera exp�di�e d�s le virement pr�sent sur notre compte bancaire.</div> 
							<div class="bill_text">- Inscrivez votre num�ro de commande sur le formulaire de virement</div> 
							<div >- Vous disposez d�un <span style="font-weight: bold;">d�lai de 15 jours</span> pour effectuer le virement sur notre compte ci-dessous indiqu�, au d�l� de ce d�lai votre commande sera automatiquement annul�e.</div> 
							<br/>
							<div class="bill_text">RIB : <?php echo $this->site_rib_numbers; ?></div> 
							<div class="bill_text">No IBAN : <?php echo $this->site_rib_iban; ?></div> 
							<div class="bill_text">Code BIC : <?php echo $this->site_rib_bic; ?></div> 
							<div class="bill_text">Nom du compte : <?php echo $this->siteName; ?></div> 
							<div class="bill_text">Nom et domiciliation de la banque : <?php echo $this->site_rib_bankname; ?></div>  
						</div> 
				<?php 	break;
						default : ?> 
							<span class="bill_text2">
							<?php if (empty($facture['USER_MODEPAIEMENT_LABEL'])) { ?> Mode de reglement :
							<?php 
								switch ($facture['USER_MODEPAIEMENT']) {
									case 1 : echo " Paiement s�curis� en ligne"; break;
									case 2 : echo " Contre remboursement";break;
									case 3 : echo " Paiement diff�r� - 30 jours";break;
									case 4 : echo " Paiement diff�r� - 45 jours";break;
									case 5 : echo " Paiement diff�r� - 60 jours";break;
									case 6 : echo " A r�ception de la facture";break;
								}
							} else { 
								echo $facture['USER_MODEPAIEMENT_LABEL'];
							} ?>
							</span>	 
						<?php 
						break;  
				} ?>  
		</div>
		<?php } ?>
		<div class="bill_detail">
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr align="right">
					<td class="bill_line2">Total HT</td>
					<td  class="bill_line2"><?php echo number_format($facture['PRIXTOTALHTHR'], 2, ',', ' '); ?> &#8364;</td>
				</tr>	
				<tr align="right">
					<td  class="bill_line2" >Remise <?php if (isset($facture['CODEREDUCTION']) && !empty($facture['CODEREDUCTION']) ) { echo " ( ".$facture['CODEREDUCTION']['CODE']." ) "; } ?></td>
					<td  class="bill_line2" ><?php echo number_format($facture['PRIXREMISEEUR'], 2, ',', ' '); ?> &#8364;</td>
				</tr>	
				<tr align="right"> 
					<td  class="bill_line2">
						<?php if (strcasecmp($facture['LIV_PAYS'], "FRANCE") != 0) { ?>
						Prix d�part 	
						<?php } else {
							if (isset($facture['INFOLIV']) && !empty($facture['INFOLIV']) ) { echo 'Livraison en '.$facture['INFOLIV']['NOMLIV']; } else { echo 'Frais de port'; } 
						} ?>
					</td> 
					<td class="bill_line2"><?php echo number_format($facture['PRIXFRAISPORT'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
				<tr >
					<td colspan="2" height="1px" style="background-color: #868686"></td>
				</tr>
				<tr align="right">
					<td class="bill_text2">Net HT</td>
					<td class="bill_text2"><?php echo number_format($facture['PRIXTOTALHTFP'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
				<tr align="right">
					<td  class="bill_line2">Total TVA</td>
					<td  class="bill_line2"><?php echo number_format($facture['PRIXTOTALTVA'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
				<tr >
					<td colspan="2" height="1px" style="background-color: #868686"></td>
				</tr>
				<tr align="right">
					<td class="bill_text2">NET A PAYER TTC</td>
					<td class="bill_text2"><?php echo number_format($facture['PRIXTOTALTTC'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
			</table>
		</div>
	</div>
	
	
	<div class="bill_footer">
			<span class="link18">
				<input type="checkbox" checked="checked" disabled="disabled"/>
				J'ai pris connaissance des Conditions G�n�rales de Vente et les accepte sans r�serves.
			</span>
			<br /><br />
			<span class="bill_text3">
			P�nalit�s de retard (taux annuel) : 9,00% 
			</span><br>
			<span class="bill_text3">
			<b>RESERVE DE PROPRIETE</b> : Nous nous r�servons la propri�t� des marchandises jusqu'au paiement du prix par l'acheteur. Notre droit de revendication porte aussi bien sur les marchandises que sur leur prix si elles ont d�j� �t� revendues (Loi du 12 mai 1980). 
			</span><br><br>
	</div>
	
		<div class="bill_footer2" >
				<span class="bill_text3">
			<?php echo $this->site_addresse; ?>
			</span><br>
			<span class="bill_text3">
			<?php echo $this->site_actualshort; ?>
			</span>
		</div >
</div>
 
<script type="text/javascript">
  
  ga('create', '<?php echo $this->google_analytics; ?>', 'auto', {'name': 'cmdTracker'});
  
  ga('cmdTracker.require', 'ecommerce');
 
  ga('cmdTracker.ecommerce:addTransaction', {
    'id': '<?php echo $facture['ID_COMMAND'];?>', 
	  'affiliation': '<?php echo $this->siteName; ?>',  
	  'revenue': '<?php echo str_replace(" ", "", number_format($facture['PRIXTOTALTTC'], 2, '.', ' ')); ?>', 
	  'shipping': '<?php echo number_format($facture['PRIXFRAISPORT'], 2, '.', ' '); ?>',  
	  'tax': '0',
    'currency': 'EUR'
	});

  <?php $caddy = $facture['CADDY'];
  foreach($caddy as $row) { 
		$unitPrice = "";
		if (!$row->isSurDevis()) {
		 	if ($row->isPromo()) { 
				$unitPrice = number_format($row->getPrixAfterRemise(), 2, '.', ' ');
			} else {
				$unitPrice = number_format($row->item_prix, 2, '.', ' ').' ';
			} 
		}
	?>
	
	ga('cmdTracker.ecommerce:addItem', {
  'id': '<?php echo $facture['ID_COMMAND'];?>',    
  'name': '<?php echo strip_tags($row->item_designation);?>',   
  'sku': '<?php echo $this->escape($row->item_reference);?>',  
  'category': '',  
  'price': '<?php echo str_replace(" ", "", $unitPrice);?>',  
  'quantity': '<?php echo $row->item_qte;?>'  
});

  <?php } ?>

  ga('cmdTracker.ecommerce:send');
</script>
modules/default/views/scripts/commande/paypalipnvalidationtest.phtml000060400000000000150710367660022262 0ustar00modules/default/views/scripts/commande/connexion.phtml000060400000003101150710367660017317 0ustar00
<script type="text/javascript">
$(function(){
$('#addUserForm').submit(function(e) {  
    e.preventDefault();
		 $.ajax( {
			type : "POST",
			async : true,
			url : '/commande/ajaxenregistrement', 
			data : stringify($(this).serializeArray()),
      contentType:"application/x-www-form-urlencoded; charset=iso-8859-1",
			success : function(data) { 
				 if (data == "SUCCESS") {
					 window.location="/mon-panier-livraison.html";
				} else {
					$('#alertMessage').html(data);
					$('#alertMessage').show();
				} 
			}});
		});

	$('#connexionForm').submit(function() { 
		 $.ajax( {
			type : "POST",
			async : true,
			url : '/commande/ajaxconnexion', 
			data : $(this).serialize(),
			success : function(data) { 
				 if (data == "SUCCESS") {
					 window.location="/mon-panier-livraison.html";
				} else {
					$('#alertMessage').html(data);
					$('#alertMessage').show();
				}
			}});
		  return false;
		});	
	
});

</script>


<div class="col-xs-12 caddy-header-box" style="padding-left: 0;">
	<div class="col-xs-10 col-xs-offset-1 caddy_flux" style="padding-left: 0;">
		<div class="caddy_flux_panier"></div>
		<div class="caddy_flux_separator"></div>
		<div class="caddy_flux_id_over"></div>
		<div class="caddy_flux_separator"></div>
		<div class="caddy_flux_livraison"></div>
		<div class="caddy_flux_separator"></div>
		<div class="caddy_flux_validation"></div>
	</div>
</div>
<div id="alertMessage" style="display: none;" class="col-xs-6 col-xs-offset-3 alert alert-danger text-center"  ></div>

<?php 
$this->showSlide = 1;
echo $this->render("/user/connexion.phtml"); ?>modules/default/views/scripts/commande/devis.phtml000060400000001142150710367660016434 0ustar00<div class="col-xs-6 col-xs-offset-3 alert alert-success text-center hidden-print"  >
	Votre devis a �t� prise en compte
</div>
<div class="col-xs-12" style="margin-top: 20px; margin-bottom: 20px;">
	<div class="col-xs-6 text-center "><a class="btn btn-primary hidden-print" href="<?php echo $this->baseUrl; ?>/">Retourner � la page d'accueil</a></div>
	<div class="col-xs-6 text-center "><a class="btn btn-default" onclick="window.print();return false;" href="<?php echo $this->baseUrl; ?>/"><span class="fa fa-print"></span> Imprimer</a></div>
</div>

<?php echo $this->render("/commande/facture.phtml"); ?>
modules/default/views/scripts/commande/paypalipnvalidation.phtml000060400000000000150710367660021362 0ustar00modules/default/views/scripts/commande/livraison.phtml000060400000015414150710367660017337 0ustar00
<script type="text/javascript">
$(function(){ 
	$('#commandeLivForm').submit(function() { 
		 $.ajax( {
			type : "POST",
			async : true,
			url : '/commande/ajaxlivraison', 
			data : $(this).serialize(),
			success : function(data) { 
				 $('#cmdLivResult').html(data);
			}});
		  return false;
		});

	 $('#validLiv').bind({
	    click: function(e){ 
	 		window.location="/mon-panier-validation.html";
	    }
	});

	 var params = new Array();
	params['route'] = $('#livuser_adresse');
	params['locality'] = $('#livuser_ville');
	params['administrative_area_level_2'] = null;
	params['administrative_area_level_1'] = null;
	params['country'] = $('#livuser_pays');
	params['postal_code'] = $('#livuser_cp');
	
	initEventAddress($('#livuser_adressecomplete'), params);
	
});
</script>

<div class="col-xs-12 caddy-header-box" style="padding-left: 0;">
	<div class="col-xs-10 col-xs-offset-1 caddy_flux" style="padding-left: 0;">
		<div class="caddy_flux_panier"></div>
		<div class="caddy_flux_separator"></div>
		<div class="caddy_flux_id"></div>
		<div class="caddy_flux_separator"></div>
		<div class="caddy_flux_livraison_over"></div>
		<div class="caddy_flux_separator"></div>
		<div class="caddy_flux_validation"></div>
	</div>
</div>
<div class="cmdLiv">
	<div class="cmdLiv_BG1">
		<div class="textA5 titleA1">R�CAPITULATIF DE VOTRE LIVRAISON</div>
	</div>
	<div class="cmdLiv_BG2">
		<div class="col-xs-12 noPadding" style="margin-top: 10px;margin-bottom: 10px;">
		
			<div class="col-xs-6 noPadding caddy-liv-info">
				<form id="commandeLivForm" action="<?php echo $this->baseUrl; ?>/commande/ajaxlivraison/" method="post">	
			
				<div class="textA6" style="float: left;width: 100%;">
					Modifier votre adresse de Livraison
				</div>
			
				<div class="cmdField" style="margin: 10px 0 0 0">
					<div class="textA2 cmdFieldLabel">
						<?php if($this->adresseLiv['type'] == "Professionnel") { 
							echo "* Raison sociale :";
						} else {
							echo "* Pr�nom et Nom :";
						}?>
					</div>
					<div style="float: left;">
						<input type="text" class="form-control" name="livuser_raisonsocial" id="livuser_raisonsocial"  value="<?php echo $this->adresseLiv['raisonsocial']; ?>" />
					</div>
				</div>
				<input type="hidden" id="address_type" name="address_type" value="old">
					
				<div id="adresseNew"  style="display: none;">
					<div class="cmdField" style="margin: 10px 0 0 0">
						<div class="messageError" id="addressError" style="clear: both;display: none;margin: 0 0 0 70px"></div>
						
						<div class="textA2 cmdFieldLabel">* Adresse :</div>
						<div style="float: left;">
							<input type="text" class="form-control" name="livuser_adressecomplete" id="livuser_adressecomplete"  value="<?php echo $this->adresseLiv['adressecomplete']; ?>" />
						</div>
					</div>
					<div class="cmdField" style="margin: 10px 0 0 0">
						<div class="textA2 cmdFieldLabel">Rue :</div>
						<div style="float: left;">
							<input  style="border: none;" readonly="readonly"  type="text" class="form-control" name="livuser_adresse" id="livuser_adresse"  value="<?php echo $this->adresseLiv['adresse']; ?>" />
						</div>
					</div>
					<div class="cmdField" style="margin: 10px 0 0 0">
						<div class="textA2 cmdFieldLabel">Code postal :</div>
						<div style="float: left;">
							<input  style="border: none;" readonly="readonly"  type="text" class="form-control" name="livuser_cp" id="livuser_cp"  value="<?php echo $this->adresseLiv['cp']; ?>" />
						</div>
					</div>
					<div class="cmdField" style="margin: 10px 0 0 0">
						<div class="textA2 cmdFieldLabel">Ville :</div>
						<div style="float: left;">
							<input  style="border: none;" readonly="readonly"  type="text" class="form-control" name="livuser_ville" id="livuser_ville"  value="<?php echo $this->adresseLiv['ville']; ?>" />
						</div>
					</div>
					<div class="cmdField" style="margin: 10px 0 0 0">
						<div class="textA2 cmdFieldLabel">Pays :</div>
						<div style="float: left;">
							<input  style="border: none;" readonly="readonly"  type="text" class="form-control" name="livuser_pays" id="livuser_pays"  value="<?php echo $this->adresseLiv['pays']; ?>" />
						</div>
					</div>
					
					<div class="cmdField" style="margin: 10px 0 0 0"> 
						<div style="float: left;">
							<span class="link7"><a href="javascript:;" onclick="swichAdresse($('#adresseNew'),$('#adresseOld'),$('#address_type'), 'old')">Je ne trouve pas mon adresse !</a></span>
						</div>
					</div>
							
				</div>
				
				<div id="adresseOld" >
					<div class="cmdField" style="margin: 10px 0 0 0">
						<div class="textA2 cmdFieldLabel">* Adresse :</div>
						<div style="float: left;">
							<input type="text" class="form-control" name="livuser_adresse_old"  value="<?php echo $this->adresseLiv['adresse']; ?>" />
						</div>
					</div>
					<div class="cmdField" style="margin: 10px 0 0 0">
						<div class="textA2 cmdFieldLabel">* Code postal :</div>
						<div style="float: left;">
							<input type="text" class="form-control" name="livuser_cp_old"  value="<?php echo $this->adresseLiv['cp']; ?>" />
						</div>
					</div>
					<div class="cmdField" style="margin: 10px 0 0 0">
						<div class="textA2 cmdFieldLabel">* Ville :</div>
						<div style="float: left;">
							<input type="text" class="form-control" name="livuser_ville_old"  value="<?php echo $this->adresseLiv['ville']; ?>" />
						</div>
					</div>
					<div class="cmdField" style="margin: 10px 0 0 0">
						<div class="textA2 cmdFieldLabel">* Pays :</div>
						<div style="float: left;">
							<select name="livuser_pays_old" class="form-control">
								<?php 
								foreach ($this->listPays as $pays) { ?>
								<option value="<?php echo $pays['PAYS']; ?>" <?php if (strcasecmp($pays['PAYS'], "FRANCE") == 0) { echo 'selected'; } ?>><?php echo $pays['PAYS']; ?></option>
								<?php }?>
							</select>
						</div>
					</div>
					<div class="cmdField" style="margin: 10px 0 0 0;display: none;"> 
						<div style="float: left;">
							<span class="link7"><a href="javascript:;" onclick="swichAdresse($('#adresseOld'),$('#adresseNew'),$('#address_type'), 'new')">Trouver mon adresse</a></span>
						</div>
					</div>
				</div>
				</form>
			</div>
			<div class="col-xs-6 noPadding">
				<div class="textA6" style="float: left;width: 100%;">
					Adresse de Livraison 
				</div>
				<div class="col-md-8 col-md-offset-2" id="cmdLivResult">
					<?php echo $this->render("/ajax/ajaxlivraison.phtml"); ?>
				</div>
			</div>
		</div>
	
	</div>
	<div class="cmdLiv_BG3"> 
		<div class="cmdFieldSubmit">
			<input type="button" class="btn btn-primary" onclick="$('#commandeLivForm').submit();" id="editLiv" value="MODIFIER" />
		</div>
		<div class="cmdFieldSubmit2" >
			<input type="button" id="validLiv" class="btn btn-success btn-lg" value="CONTINUER"/>
		</div>
	</div>
</div>
modules/default/views/scripts/commande/validation.phtml000060400000021171150710367660017460 0ustar00

<div class="col-xs-12 caddy-header-box" style="padding-left: 0;">
	<div class="col-xs-10 col-xs-offset-1 caddy_flux" style="padding-left: 0;">
		<div class="caddy_flux_panier"></div>
		<div class="caddy_flux_separator"></div>
		<div class="caddy_flux_id"></div>
		<div class="caddy_flux_separator"></div>
		<div class="caddy_flux_livraison"></div>
		<div class="caddy_flux_separator"></div>
		<div class="caddy_flux_validation_over"></div>
	</div>
</div>
<?php 
$facture = $this->facture;
?>
<div style="float: left; margin: 0 0 0 150px">
	<span class="text3" >Avant de terminer votre commande, veuillez v�rifier l'exactitude de vos donn�es. </span>
</div>

 <?php echo $this->render("/commande/factureedit.phtml"); ?>

<div class="col-xs-6 col-xs-offset-6 text-right" >
  <div class="checkbox" style="width: 360px;">
	   <label class="link18">
          <input type="checkbox" name="isCGV" id="isCGV" > J'ai pris connaissance des <a href="<?php echo $this->baseUrl; ?>/info-3/conditions-generales-vente.html" target="_blank">Conditions G�n�rales de Vente</a>
	
        </label>
	</div>
  </div>
<div class="col-xs-12 noPadding" style="margin: 20px 0 70px 0;">

	<div  class="col-sm-3 col-xs-12 text-center noPadding" > 
		<a class="btn btn-primary btn-lg caddy-link" href="<?php echo $this->baseUrl; ?>/commande/devis" onclick="return checkCheckBoxes('isCGV');" >
			FAIRE UN DEVIS
		</a> 
	</div> 
	<?php if ($facture['PRIXTOTALTTC'] > 0 && $this->isCommandValid == true) { ?>
		<div class="col-sm-2 col-xs-12 text-center noPadding">
			<a onclick="return checkCheckBoxes('isCGV');"  href="<?php echo $this->baseUrl; ?>/commande/paiement/type/1" class="btn btn-primary caddy-link"   >
				PAYER PAR CHEQUE
			</a>
		</div>
		<div class="col-sm-2 col-xs-12 text-center noPadding">
			<a onclick="return checkCheckBoxes('isCGV');" href="<?php echo $this->baseUrl; ?>/commande/paiement/type/2" class="btn btn-primary caddy-link" >
				FAIRE UN VIREMENT
			</a>
		</div>
		
		<div class="col-sm-2 col-xs-12 text-center noPadding">
			<?php 
				$modepaiement = $facture['USER_MODEPAIEMENT'];
				$isCompte = false;  
				$modepaiement_imgTexte = '';
				if ($this->user['isrecepfacture'] == "Y" || $this->user['iscredit'] == 1) {
					switch ($modepaiement) {
						case 2 : 
							$modepaiement_texte = "Payer � r�ception de la facture";
							$modepaiement_img = "/business/image/inbox.png";
							$modepaiement_imgTexte = "Payer � r�ception de la facture";
							$isCompte = true;
							break;
						case 3 : 
							$modepaiement_texte = "Paiement diff�r� - 30 jours";
							$modepaiement_img = "/business/image/delai_payment.png";
							$modepaiement_imgTexte = "Payer par paiement diff�r� de 30 jours";
							$isCompte = true;
							break;
						case 4 : 
							$modepaiement_texte = "Paiement diff�r� - 45 jours";
							$modepaiement_img = "/business/image/delai_payment.png";
							$modepaiement_imgTexte = "Payer par paiement diff�r� de 45 jours";
							$isCompte = true;
							break;
						case 5 : 
							$modepaiement_texte = "Paiement diff�r� - 60 jours";
							$modepaiement_img = "/business/image/delai_payment.png";
							$modepaiement_imgTexte = "Payer par paiement diff�r� de 60 jours";
							$isCompte = true;
							break;
						case 6 : 
							$modepaiement_texte = "A r�ception de la facture";
							$modepaiement_img = "/business/image/delai_payment.png";
							$modepaiement_imgTexte = "Payer a r�ception de la facture";
							$isCompte = true;
							break;
						default :
							$isCompte = false;
							break;
					} 
				}   
				if ($isCompte) { 
			?>
			<a onclick="return checkCheckBoxes('isCGV');" title="<?php echo $modepaiement_imgTexte; ?>"  href="<?php echo $this->baseUrl; ?>/commande/paiement/type/3" data-placement="bottom" class="tooltips btn btn-danger btn-lg caddy-link" >
					EN COMPTE
				</a>
				<?php } ?>
		</div>
		<div class="col-sm-3 col-xs-12 text-center noPadding" >
				<?php $myDate = new Zend_Date(strtotime($facture['DATESTART'])); ?>
				
					<form action="https://securepayments.paypal.com/acquiringweb?cmd=_hosted-payment" method="post">
						<input type="hidden" name="cmd" value="_hosted-payment">
						<input type="hidden" name="business" value="<?php echo $this->paypal_business; ?>">
						<input type="hidden" name="item_name" value="<?php echo 'Total de la commande du '.$myDate->toString('dd/MM/YYYY').' (TTC)'; ?>" /> 
						<input type="hidden" name="item_number" value="<?php echo $facture['ID_COMMAND']; ?>" />
						<input type="hidden" name="custom" value="<?php echo $facture['ID_COMMAND']; ?>" />
						<input type="hidden" name="no_shipping" value="1">
						<input type="hidden" name="no_note" value="1">
						<input type="hidden" name="return" value="<?php echo $this->baseUrl_SiteCommerceUrl; ?>/commande/paiement">
						<input type="hidden" name="cancel_return" value="<?php echo $this->baseUrl_SiteCommerceUrl; ?>/commande/paiement">
						<input type="hidden" name="page_style" value="PayPalPerso">
						<input type="hidden" name="currency_code" value="EUR">
						
						<input type="hidden" name="subtotal" value="<?php echo $facture['PRIXTOTALTTC']; ?>"> 
						<input class="btn btn-success btn-lg caddy-link btn-paypal-only" data-placement="top" type="submit" name="PayPal2" value="PAYER VIA PAYPAL"  onclick="return checkCheckBoxes('isCGV');" >
						
						<input type="hidden" name="first_name" value="<?php echo utf8_encode($facture['LIV_RAISONSOCIAL']); ?>">
						<input type="hidden" name="address1" value="<?php echo utf8_encode($facture['FACT_ADRESSE']); ?>">
						<input type="hidden" name="city" value="<?php echo utf8_encode($facture['FACT_VILLE']); ?>">
						<input type="hidden" name="zip" value="<?php echo utf8_encode($facture['LIV_CP']); ?>">
						<input type="hidden" name="country" value="<?php echo utf8_encode($facture['LIV_PAYS']); ?>">
						<input type="hidden" name="billing_first_name" value="<?php echo utf8_encode($facture['USER_PRENOM']); ?>">
						<input type="hidden" name="billing_last_name" value="<?php echo utf8_encode($facture['USER_NOM']); ?>">
						<input type="hidden" name="billing_address1" value="<?php echo utf8_encode($facture['FACT_ADRESSE']); ?>">
						<input type="hidden" name="billing_city" value="<?php echo utf8_encode($facture['FACT_VILLE']); ?>">
						<input type="hidden" name="billing_zip" value="<?php echo utf8_encode($facture['FACT_CP']); ?>">
						<input type="hidden" name="billing_country" value="<?php echo utf8_encode($facture['FACT_PAYS']); ?>">
					
						<!-- PERSONNALISATION -->
						<input type="hidden" name="template" value="TemplateA">
						<input type="hidden" name="bodyBgColor" value="#A2A1A1">
						<input type="hidden" name="footerTextColor" value="#000000">
						<input type="hidden" name="headerBgColor" value="#ffffff">
						<input type="hidden" name="headerHeight" value="150">
						<input type="hidden" name="logoImage" value="<?php echo $this->baseUrl_SiteCommerceUrl; ?>/business/image/logo.png">
						<input type="hidden" name="orderSummaryBgColor" value="#D6D6D6">
						<input type="hidden" name="pageButtonBgColor" value="#68B777">
						<input type="hidden" name="pageButtonTextColor" value="#000000">
						
						<input type="hidden" name="pageTitleTextColor" value="#DE021B">
						<input type="hidden" name="sectionBorder" value="#DE021B">
						<input type="hidden" name="showCustomerName" value="true">
						<input type="hidden" name="showBillingAddress" value="true">
						<input type="hidden" name="showShippingAddress" value="true">
						
					</form>
			</div>
			<?php } ?>
	</div>	

	<input type="hidden" id="PRIXTOTALHT" value="<?php echo $facture['PRIXTOTALHT']; ?>">
	<input type="hidden" id="PRIXTOTALTTC" value="<?php echo $facture['PRIXTOTALTTC']; ?>">
	<input type="hidden" id="PRIXFRAISPORT" value="<?php echo $facture['PRIXFRAISPORT']; ?>">
	<input type="hidden" id="PRIXTAX" value="<?php echo $facture['PRIXTOTALTTC'] - $facture['PRIXTOTALHT'] ; ?>">
	<input type="hidden" id="REFERENCE" value="<?php echo $facture['REFERENCE']; ?>">
	<input type="hidden" id="IDUSER" value="<?php echo $facture['IDUSER']; ?>">
	<input type="hidden" id="USER_EMAIL" value="<?php echo $facture['USER_EMAIL']; ?>">
	<input type="hidden" id="USER_NOM" value="<?php echo utf8_encode($facture['USER_NOM']); ?>">
	<input type="hidden" id="USER_PRENOM" value="<?php echo utf8_encode($facture['USER_PRENOM']); ?>">
	<input type="hidden" id="LIV_VILLE" value="<?php echo utf8_encode($facture['LIV_VILLE']); ?>">
	<input type="hidden" id="LIV_PAYS" value="<?php echo utf8_encode($facture['LIV_PAYS']); ?>">
	<input type="hidden" id="USER_TYPE" value="<?php echo $facture['USER_TYPE']; ?>">
	<input type="hidden" id="USER_MODEPAIEMENT_LABEL" value="<?php echo $facture['USER_MODEPAIEMENT_LABEL']; ?>"> 
modules/default/views/scripts/commande/factureedit.phtml000060400000024601150710367660017626 0ustar00
<?php
$facture = $this->facture;
?>
<style type="text/css">
.oldPromoPrice,
.text12 {
font-size: 11px;
}

.bill_body {
	clear: both;
	width: 800px;
	margin: 0 auto 0 auto;
}

.bill_header {
	float: clear : both;
	width: 800px;
}

.bill_company {
	float: left;
}
.bill_company_logo {
	margin: 10px 0 10px 10px;
	width: 94px;
	height: 121px;
}
.bill_idents {
	float: right;
	width: 550px;
	margin: 20px 0 0 0 ;
}
.bill_idents_opt1{
	float:left;
	width:120px;
	height:50px;
	margin:0 0 0 10px;
}

.bill_idents_opt21{
	float:left;
	width:120px;
	height:25px;
	background-color: #e7e7e7;
	margin:0 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}
.bill_idents_opt31{
	float:left;
	width:120px;
	height:24px;
	margin:1px 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}

.bill_idents_opt22{
	float:left;
	width:250px;
	height:25px;
	background-color: #e7e7e7;
	margin:0 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}
.bill_idents_opt32{
	float:left;
	width:250px;
	height:24px;
	margin:1px 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}

.bill_text {
	color: #000000;
	font-weight: bold;
}
.bill_text2 {
	color: #000000;
	font-weight: bold;
	line-height:25px;
}
.bill_text3 {
	color: #000000;
	font-size:11px;
}
.bill_address {
	float: left;
	width: 800px; 
	margin:10px 0 0 0;
}

.bill_address_opt {
	float: left;
	width: 300px; 
	margin: 0 0 0 50px;
}
.bill_address_opt1{
	float:left;
	width:300px;
	height:25px;
	background-color: #e7e7e7;
	margin:0 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}

.bill_address_opt2 {
	float:left;
	width:250px;
	margin: 10px 0 0 20px;
}
.bill_address_opt3 {
	float:left;
	width:300px;
	margin: 10px 0 0 0;
}

.bill_line {
	line-height:25px;
	text-align:center;
	font-weight:bold;
}
.bill_line2 {
	line-height:20px;
}

.bill_caddy {
	float: left;
	width:800px;
	height:auto;
}

.bill_facture{
	float: left;
	width:800px;
	height:150px;
}

.bill_buy{
	float: left;
	width:350px;
	height:30px;
}

.bill_detail{
	float: right;
	width:250px;
	height:130px;
	border: solid 1px black;
	margin: 10px 0 0 0;
}
.bill_footer{
	float: left;
	width:800px;
	margin: 20px 0 0 0;
}
.bill_footer2{
	float: left;
	width:800px;
	text-align:center;
	margin: 0 0 20px 0;
}

.bill_linkd a:link,.bill_linkd a:visited,.bill_linkd a:active {
	font-family: "Arial";
	font-size: 12px;
	font-weight: normal;
	color: #000000;
	text-decoration: none;
}

.bill_linkd a:hover {
	text-decoration: underline;
}
</style>
<div class="bill_body">
	<div class="bill_header">
		<div class="bill_company">
			<div class="bill_company_logo"> 
				<a href="<?php echo $this->baseUrl; ?>/"><img alt="Directement � la source de la qualit�" src="<?php echo $this->baseUrl; ?>/business/image/logo.png" /></a>
			</div>
			<div>
				<?php if (!empty($facture['USER_NUMCOMPTE'])) {?>
				<span class="bill_text">Compte : <?php echo $facture['USER_NUMCOMPTE']; ?></span><br>
				<?php } ?>
				<span class="bill_text">Tel : <?php echo $this->tel_contact; ?></span><br>
				<span class="bill_text">Email : <?php echo $this->serviceClient_Mail; ?></span>
			</div>
		</div>
		<div class="bill_idents">
			<div class="bill_idents_opt1">
				<div class="bill_idents_opt21">
					<span class="bill_line"><?php echo 'Date'; ?></span>
				</div>
				<div class="bill_idents_opt31">
					<span class="bill_line">
					<?php 
					try {
					$myDate = new Zend_Date(strtotime($facture['DATESTART']));
					
					$mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
				$moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
				
					echo $myDate->toString("dd").' '.$mois[(int)$myDate->toString('MM')].' '.$myDate->toString("YYYY");
		
					} catch(Zend_Exception $e) {
						
					} ?>
					</span>
				</div>
			</div>
			<div class="bill_idents_opt1">
				<div class="bill_idents_opt22">
					<span class="bill_line"><?php echo 'Client'; ?></span>
				</div>
				<div class="bill_idents_opt32">
				<span class="bill_line"><?php echo $facture['USER_EMAIL']; ?></span>
				</div>
			</div>
		
		</div>
	</div>
	<div class="bill_address">
		<div class="bill_address_opt">
			<div class="bill_address_opt1">
				<span class="bill_line">Adresse de Facturation</span>
			</div>
			<div class="bill_address_opt2">
				<span class="bill_text2"><?php echo $facture['FACT_RAISONSOCIAL']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['FACT_ADRESSE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['FACT_CP'].' '.$facture['FACT_VILLE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['FACT_PAYS']; ?></span>
				</div>
			<div class="bill_address_opt3">
				<span class="text3">Pour modifier votre adresse de facturation, <span class="link4"><a href="<?php echo $this->baseUrl; ?>/mon-compte.html">cliquez ici. </a></span></span>
			</div>
		</div>
		<div class="bill_address_opt">	
			<div class="bill_address_opt1">
				<span class="bill_line">Adresse de Livraison</span>
			</div>
			<div class="bill_address_opt2">
				<span class="bill_text2"><?php echo $facture['LIV_RAISONSOCIAL']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['LIV_ADRESSE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['LIV_CP'].' '.$facture['LIV_VILLE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['LIV_PAYS']; ?></span>
			</div>
			<div class="bill_address_opt3">
				<span class="text3">Pour modifier votre adresse de livraison, <span class="link4"><a href="<?php echo $this->baseUrl; ?>/mon-panier-livraison.html">cliquez ici. </a></span></span>
			</div> 
		</div>
	</div>
	<div class="bill_caddy">
		<table style="border:1px solid black;"  border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr align="center" style="background-color: #e7e7e7;">
				<th class="bill_line" >R�f�rence</th>
				<th class="bill_line">D�signation</th>
				<th class="bill_line" style="width: 60px">Dispo.</th>
				<th class="bill_line">Quantit�</th>
				<th class="bill_line"  style="text-align: center">P.U. HT</th> 
				<th class="bill_line" >Montant HT</th>
			</tr>
			<?php 
			$index = 1;
			$i = 0;
			$caddy = $facture['CADDY'];
			foreach($caddy as $row) { 
				?>
			<tr >
				<td colspan="6" height="1px" style="background-color: #868686"></td>
			</tr>
			<tr align="center"  height="25px" >
				<td class="textTd1" width="110px" style="text-align:center;white-space: nowrap;">
					<?php echo $this->escape($row->item_reference);?>
				</td>
				<td  width="450px" class="bill_linkd" style="text-align: left;">
					<a target="_blank"  href="<?php echo $this->baseUrl; ?>/<?php echo Utils_Tool::getFormattedUrlProduct($row->product_navnom_urlparents, $row->product_navnom, $row->product_id); ?>"><?php echo $row->item_designation;?></a>
					<?php if (!empty($row->item_selectedOption)) { 
						echo '<br/>'.$row->item_selectedOption.'<br/>';
					} ?>
				</td>
				<td class="textTd1" > 
					<?php if ((int)$row->item_stock == 1) { ?>
					<img class="tooltips" alt="Disponible imm�diatement" title="Disponible imm�diatement" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock11.png" />
					<?php } else if ((int)$row->item_stock == 2) { ?>
					<img class="tooltips" alt="Disponible sous 8 jours" title="Disponible sous 8 jours" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock22.png" />
					<?php } else if ((int)$row->item_stock == 3) { ?>
					<img class="tooltips" alt="Nous contacter" title="Nous contacter" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock33.png" />
					<?php }?> 	
				</td>
				<td class="textTd1" >
					<?php echo $row->item_qte; ?>	
				</td>
				<td class="textTd1" width="150px">					
						<?php $this->currentData = $row;
						echo $this->render("/produits/ajaxshowpromopricecaddy.phtml"); ?>
				</td> 
				<td width="120px">
					<span class="textTd1" style="float: right;" >
					<?php 
						if (!$row->isSurDevis()) {
							echo number_format($row->getPrixTotalHT(true), 2, ',', ' ').' &#8364;';
						}
					?>
					</span>
				</td>
			</tr>
			<?php $i++; } ?>	
			<?php
	$caddyfidelite = $facture['CADDYFIDELITE'];
	foreach($caddyfidelite as $row) {
		?>
    <tr>
      <td colspan="6">
        <div style="font-weight: bold;margin:10px;">
          <?php echo 'Carte de fid�lit� : '.$row->fidelite_nom.' ('.$row->fidelite_nbpoint.' points)'; ?>
        </div>
      </td>
    </tr>
  <?php } ?>
		</table>
	</div>
	<div class="bill_facture">
		<div class="bill_detail">
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr align="right">
					<td class="bill_line2">Total HT</td>
					<td  class="bill_line2"><?php echo number_format($facture['PRIXTOTALHTHR'], 2, ',', ' '); ?> &#8364;</td>
				</tr>	
				<tr align="right">
					<td  class="bill_line2" >Remise <?php if (isset($facture['CODEREDUCTION']) && !empty($facture['CODEREDUCTION']) ) { echo " ( ".$facture['CODEREDUCTION']['CODE']." ) "; } ?></td>
					<td  class="bill_line2" ><?php echo number_format($facture['PRIXREMISEEUR'], 2, ',', ' '); ?> &#8364;</td>
				</tr>	
				<tr align="right">
					<td  class="bill_line2">
						<?php if (strcasecmp($facture['LIV_PAYS'], "FRANCE") != 0) { ?>
						Prix d�part 	
						<?php } else {
							if (isset($facture['INFOLIV']) && !empty($facture['INFOLIV']) ) { echo 'Livraison en '.$facture['INFOLIV']['NOMLIV']; } else { echo 'Frais de port'; } 
						} ?>
					</td>
					<td class="bill_line2"><?php echo number_format($facture['PRIXFRAISPORT'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
				<tr >
					<td colspan="2" height="1px" style="background-color: #868686"></td>
				</tr>
				<tr align="right">
					<td class="bill_text2">Net HT</td>
					<td class="bill_text2"><?php echo number_format($facture['PRIXTOTALHTFP'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
				<tr align="right">
					<td  class="bill_line2">Total TVA</td>
					<td  class="bill_line2"><?php echo number_format($facture['PRIXTOTALTVA'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
				<tr >
					<td colspan="2" height="1px" style="background-color: #868686"></td>
				</tr>
				<tr align="right">
					<td class="bill_text2">NET A PAYER TTC</td>
					<td class="bill_text2"><?php echo number_format($facture['PRIXTOTALTTC'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
			</table>
		</div>
	</div>
</div>
modules/default/views/scripts/index/index.phtml000060400000005621150710367660015763 0ustar00<script type="text/javascript">var homePage = true;</script>

<!-- Fullscreen gallery start -->
<div class="slider" id="slider">
	<div id="gallery">
		<?php foreach ($this->listAllGalleries as $row) { 
			if (!empty($row['URL'])) { 			
				$info = getimagesize($row['URL']) ;
				list($width_old, $height_old) = $info;
		?>
		<img src="/business/light/img/blank.png" data-original="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 0);?>" width="<?php echo $width_old; ?>" height="<?php echo $height_old; ?>" alt="<?php echo $this->escape($row['CONTENT_SHORT']);?>" />
		<?php } } ?>
		</div>
</div><!-- Slider div end / Fullscreen gallery end -->
<!--
<div id="fullscreen"><div id="fullscreen_icon" title="Plein �cran" class="qtip"></div></div>
<div id="play"><div id="play_icon" title="Lecture automatique" class="qtip"></div></div>
<div id="sound"><div id="sound_icon" title="Son on/off" class="qtip"></div></div>
 
<div id="desc_info"><div id="desc_info_icon" title="Description" class="qtip"></div></div>
-->
<div id="desc_cont">
	<?php foreach ($this->listAllGalleries as $row) { 
		if (!empty($row['URL'])) {
		if (!empty($row['CONTENT_SHORT']) || !empty($row['CONTENT_LONG'])) { ?>
	<div>
		<h2><?php echo $this->escape($row['CONTENT_SHORT']);?></h2>
		<p class="margin_1line"><?php echo $this->escape($row['CONTENT_LONG']);?></p>	
		<div class="desc-one-half float-left margin_1line">	
			<ul class="buy text-left">
				<li>ACHETER LES PHOTOS</li>
				<li>
					<ul>
						<li><a href="<?php echo $this->custom_link_1; ?>" title="JingoO" class="qtip"><img src="/business/light/img/icons/stock/fotolia.png" alt="JingoO" /></a></li>
					</ul>
				</li>
			</ul>
		</div>
	</div>
	<?php } else { ?>
	<div></div>
	<?php  } } } ?>   
</div>
<div id="modal_shadow"></div>

<!-- Big navigation arrows -->
<div id="left"><div id="arrow_left"></div><a href="#" id="scroll_left"></a></div>
<div id="right"><div id="arrow_right"></div><a href="#" id="scroll_right"></a></div>

<!-- Thumbnails
<div id="gallery_hide"></div>
<div id="thumbnails_bg">
	<div id="mini_cont"> 
		<a class="prev" id="mini_prev" href="#"></a>
		<a class="next" id="mini_next" href="#"></a>
		<div id="thumbnails_cont">
			<div id="thumbnails"> 
			<?php foreach ($this->listAllGalleries as $row) { 
				if (!empty($row['URL'])) { ?>
				<a href="#"><img src="/business/light/img/blank.png" data-original="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 100);?>" alt="<?php echo $this->escape($row['CONTENT_SHORT']);?>"/></a>
			<?php } } ?>
			</div> 
		</div> 
		<div id="bottom-line">
			<div id="author">&copy; <?php echo $this->siteName; ?></div>
		</div> 
	
	</div> 
</div> 

<div id="gallery-show"></div>
 -->
<div id="img-pattern"></div>
<!-- audio player -->
<div id="audio">
	<div id="jquery_jplayer_1" class="jp-jplayer"></div>
  <div id="jp_container_1" class="jp-audio"><div class="jp-type-single"></div></div>
</div><!-- end audio div -->
 modules/default/views/scripts/contact/empty.phtml000060400000000000150710367660016320 0ustar00modules/default/views/scripts/contact/index.phtml000060400000004013150710367660016301 0ustar00

<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/validate.js"></script>

<!-- page content -->
<div id="page" style="background: transparent !important; border:0 !important;">
<div class="big_header"><h1 class="big_header">Contact</h1></div>

<div id="page_top"></div>
<div class="scroll-pane">
<div class="page_block">
<div class="column_cont">	
		<div class="two-third margin_1line contactpage">		
		<h3>Envoyer un message</h3>
		<div id="comment" class="margin_1line"></div>
			<!-- contactForm -->
			<form name="contactForm" id="contactForm" method="get" action="" class="margin_1line">
				<div class="contact"><label for="name">Nom:</label>
				<input type="text" name="name" id="name" class="required,all" />&nbsp;
				<img name="name" src="/business/light/img/blank.png" alt=""/></div>
				
				<div class="contact margin_1line"><label for="email">Email:</label>
				<input type="text" name="email" id="email" class="required,email" />&nbsp;
				<img name="email" src="/business/light/img/blank.png" alt=""/></div>
				
				<div class="contact margin_1line"><label for="message">Message:</label>
				<textarea name="message" id="message" class="required,all" rows="8" cols="10"></textarea>&nbsp;
				<img name="message" src="/business/light/img/blank.png" alt=""/></div>
				
				<div class="contact"><label for="submit">&nbsp;</label><a href="#" id="submit" class="butt custom_font  margin_3_2line">Envoyer</a></div>
			</form><!-- contacForm end -->
	</div>
	<div class="one-third contactpage">		
	<h3 class="margin_1line"><?php echo $this->custom_text_1; ?></h3>
			<h6 class="margin_1line"><?php echo $this->custom_text_2; ?></h6>
			<p class="margin_1line"><?php echo $this->custom_text_3; ?></p>
			<p class="margin_1line">
				e-mail: <?php echo $this->contact_Mail; ?><br />
				tel: 07-88-97-44-55 <br />
			</p>
	</div>	
</div><!-- column_cont div end -->

<div class="clear"></div>

</div><!-- page-block div end -->
<div class="page-footer">&copy; <?php echo $this->siteName; ?></div>

</div>


</div>modules/default/views/scripts/produits/ajaxaddpanier.phtml000060400000000217150710367660020205 0ustar00<span class="messageSuccess"><?php echo $this->messageSuccess; ?></span> 
<span class="messageError"><?php echo $this->messageError; ?></span> modules/default/views/scripts/produits/monpaniertype.phtml000060400000007464150710367660020317 0ustar00

<script  type="text/javascript" >

$(function(){
	initEventsCaddyType();
});

</script>
<div class="spaceBG2" ></div> 
<div >
<?php  
$caddyTypes = $this->caddyType; 

if (empty($caddyTypes)) { ?>
<div class="col-xs-12 text-center" style="margin-top: 20px;">Il n'y a aucun article dans votre panier.</div>
<div class="col-xs-12 text-center" style="margin-top: 20px;">
		<a   data-placement="bottom" class="btn btn-default btn-lg" href="<?php if (isset($this->urlCurrentProduct) && !empty($this->urlCurrentProduct)) { echo $this->urlCurrentProduct; } else { echo $this->baseUrl.'/'; } ?>" >
			CONTINUER MES ACHATS
		</a>
</div>
<?php  } else { ?>
<div class="productAnnexeLabel caddyTypeUp">
	Retrouver les r�f�rences de vos produits
</div>

<form  id="caddyTypeCheckForm" action="<?php echo $this->baseUrl; ?>/mon-panier-type-actualiser.html" method="post">
	<div style="float: left;width: 100%;">
		<table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr align="center" height="50px" style="background-color: #e7e7e7">
				<th class="textTh1">Produit</th>
				<th class="textTh1">Dispo.</th>
				<th class="textTh1">Prix Unitaire (HT)</th> 
				<th class="textTh1">Quantit�</th>   
			</tr>
			<?php
			$index = 1;
			$i = 0;
			foreach($caddyTypes as $row) {
				?>
			<tr align="center"  height="25px"  style="background-color:<?php  if (!$row->isPromoCaddyType) { if ($index == 0) {echo '#E7E7E7'; $index=1;} else {$index=0; echo '#FFFFFF';} } else { echo "#92B901"; } ?>;">
				<td  >
					<div class="caddyProdImg" >  
						<a target="_blank" href="<?php echo $this->baseUrl; ?>/<?php echo Utils_Tool::getFormattedUrlProduct($row->navnom_urlparents, $row->navnom, $row->idProduit); ?>"
							title="<?php echo $this->escape($row->designation);?>" >
							<img src="<?php echo $this->baseUrl.'/'.$row->url; ?>">
						</a>
					</div>
					<div class="caddyProdTxt" >
						<div class="link17" style="width: auto;clear:both">
							<a target="_blank" href="<?php echo $this->baseUrl; ?>/<?php echo Utils_Tool::getFormattedUrlProduct($row->navnom_urlparents, $row->navnom, $row->idProduit); ?>">
								<?php echo $this->escape($row->designation);?>
							</a>
						</div>
						<div class="textA1 productDetail_ref">
							<?php echo "Ref. ".$this->escape($row->reference);?>
						</div>
					</div>
				</td> 
				<td width="70px">
					<?php if ((int)$row->stock == 1) { ?>
					<img alt="Disponible" title="Disponible" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock11.png">
					<?php } else if ((int)$row->stock == 2) { ?>
					<img alt="Disponible sous 8 jours" title="Disponible sous 8 jours" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock22.png">
					<?php } else if ((int)$row->stock == 3) { ?>
					<img alt="Nous contacter" title="Nous contacter" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock33.png">
					<?php }?> 
				</td>
				<td valign="top" width="150px">
						
						<?php $this->currentData = $row;
						echo $this->render("/produits/ajaxshowpromopricecaddy.phtml"); ?>
				</td> 
				<td align="center">
					<div style="clear:both;width: 90px;margin: 0 auto 0 auto;">
						<input onclick="javascript:clearInput($(this), '0');" type="text" class="input3 caddyQuantity" maxlength="6" name="Quantity[]" value="<?php echo $row->qte; ?>" /> 
					</div>
					
					<input type="hidden" name="Child[]" value="<?php echo $row->idChild; ?>" /> 
					
					<input type="hidden" name="CaddyType[]" value="<?php if ($row->isPromoCaddyType) { echo $row->id; } else { echo '0'; } ?>" />  
					
					<input type="hidden" name="QuantityMin[]" value="<?php echo $row->qte_min; ?>" />  
				</td> 
			</tr>
			<?php $i++; } ?>
		</table>
	</div>
	<div  style="float: left;width: 100%;text-align: center;margin:10px;"><input class="button" type="submit" value="Ajouter"></div>
	</form>  
<?php } ?>
</div> modules/default/views/scripts/produits/nosproduits.phtml000060400000005045150710367660020007 0ustar00
<?php 
	echo $this->render("/ajax/caddyaccountright.phtml"); 
$listProducts = array();
$listProducts = $this->listAllProducts;
$color = $this->actualDesign['color'];
$listCat = array();
$listCat = $this->listCat;
 
?>
<script type="text/javascript">
$(function(){
	$('#slider-product-id').liquidSlider({
		autoHeight : true,
		minHeight : 0,
		autoSlide: true,
		autoSlideInterval : 5000,
		pauseOnHover : false,
		includeTitle : false,
		dynamicTabs : false
	});
	
    initProductPagination("#productpagination", 1, <?php echo ceil(sizeof($listProducts) / 16); ?>);
});
</script>
 
	<?php if (isset($listCat['CHOICEURL']) && !empty($listCat['CHOICEURL']) && 
				isset($listCat['CHOICEDOC']) && !empty($listCat['CHOICEDOC'])) { ?>
	<span style="display:none;margin: 0 0 0 20px;" > 
		<a href="<?php echo $this->baseUrl; ?>/<?php echo $listCat['CHOICEDOC'];?>" title='Comment choisir "<?php echo $listCat['NOM']; ?>" ?' target="_blank">
			<img alt='Comment choisir "<?php echo $listCat['NOM']; ?>" ?' src="<?php echo $this->basUrl; ?>/<?php echo $listCat['CHOICEURL'];?>">
		</a>
	</span>
	<?php } ?>

<div class="col-xs-12 col-sm-10 col-sm-offset-1 text-center visible-md visible-lg">
	<div class="col-xs-12"  style="margin-top: 10px; margin-bottom: 10px;">
		<span class="product-title-tri">Trier les produits</span>
		<?php $link = $this->baseUrl."/".Utils_Tool::getFormattedUrlCategory($this->currentCategory['NAVNOM_URLPARENTS'], $this->currentCategory['NAVNOM'], $this->currentCategory['ID']); ?>
		<a href="<?php echo $link."?tri=5";?>" class="btn btn-default">Meilleures ventes</a> 
    <a  href="<?php echo $link."?tri=1";?>" class="btn btn-default">Prix croissant</a>
		<a  href="<?php echo $link."?tri=2";?>" class="btn btn-default">Prix d�croissant</a>
		<a  href="<?php echo $link."?tri=3";?>" class="btn btn-default">Nom croissant</a>
		<a  href="<?php echo $link."?tri=4";?>" class="btn btn-default">Nom d�croissant</a>
	</div>  
</div>
<?php 
$paginationPage = 1;
$count = 0;
if (!empty($listProducts)) { 
	foreach ($listProducts as $row) {
		if ($count > 15) {
			$count = 0;
			$paginationPage++;
		}
		$this->currentData = $row;
		$this->currentPaginationPage = $paginationPage;
		$count++;
		echo $this->render("/produits/ajaxshowproductbox.phtml");	
	}
}?>

<div class="col-xs-10 col-xs-offset-1 text-center">
	<div id="productpagination"></div>    
</div>

<?php if (isset($listCat['DESCRIPTIONLONG']) && !empty($listCat['DESCRIPTIONLONG'])) { ?>
<div class="col-xs-12 noPadding" style="margin: 0 0 10px 0;">
    <?php echo $listCat['DESCRIPTIONLONG']; ?>
</div>
<?php } ?>modules/default/views/scripts/produits/ajaxdownloaddocument.phtml000060400000006362150710367660021633 0ustar00
<?php header('Content-Type: text/html; charset=ISO-8859-15'); ?>
 
<?php if (!$this->isSuccess) { ?>

<?php
	$product = $this->detailProduct;
    if (isset($product) && !empty($product)) { 
?>	

    <form id="dialog-form-doc" enctype="multipart/form-data"  class="white-popup-block mfp-hide form-horizontal" action="<?php echo $this->baseUrl.'/produits/ajaxdownloaddocument'; ?>" method="post">
	    <script type="text/javascript">
            $(function() {
                initDetailProductDialogSendDoc();
            });
        </script>
        <span class="indexBox4_title2">Fiche technique � t�l�charger</span>
	    <fieldset style="border:0;">
		    <p>Pour recevoir par mail notre fiche technique, veuillez renseigner le formulaire ci-dessous.</p>
		     
			    <div class="form-group">
				    <label for="civility_doc" class="col-sm-2 control-label">Civilit�</label>
                    <div class="col-sm-10">
                        <label class="radio-inline">
                          <input type="radio" name="civility_doc" value="M." checked="checked"> M.
                        </label>
                        <label class="radio-inline">
                          <input type="radio" name="civility_doc" value="Mme"> Mme
                        </label>
                        <label class="radio-inline">
                          <input type="radio" name="civility_doc" value="Mlle"> Mlle
                        </label>
			        </div>
			    </div>
			     <div class="form-group">
				    <label for="name_doc" class="col-sm-2 control-label">Nom</label>
                     <div class="col-sm-10">
				        <input id="name_doc" name="name_doc" type="text" placeholder="Nom" class="form-control" required="">
			        </div>
			    </div>
			     <div class="form-group">
				    <label for="firstname_doc" class="col-sm-2 control-label">Pr�nom</label>
                     <div class="col-sm-10">
				        <input id="firstname_doc" name="firstname_doc" type="text" placeholder="Pr�nom" class="form-control" required="">
			        </div>
			    </div>
			     <div class="form-group">
				    <label for="email_doc" class="col-sm-2 control-label">Email</label>
                     <div class="col-sm-10">
				        <input id="email_doc" name="email_doc" type="email" placeholder="exemple@domaine.com" class="form-control" required="">
			        </div>
			    </div>
			    <div class="form-group">
                    <div class="col-sm-12 text-center">
                        <input type="submit" class="btn btn-default" value="Recevoir par mail" /> 
                        <input type="hidden" name="product_id_doc" value="<?php echo $product['ID']; ?>" /> 
                     </div> 
			    </div> 
	    </fieldset>
    </form>
<?php } else { ?>
<div class="white-popup-block-medium">
    <div class="text-center">
        <input type="button" class="btn btn-danger" value="Fermer" onclick="$.magnificPopup.close();" /> 
    </div> 
</div> 
<?php } 
} else { ?>
<div class="white-popup-block-medium">
    <div class="text-center">
        <?php echo $this->message ;?><br /><br />
    </div> 
    <div class="text-center">
        <input type="button" class="btn btn-danger" value="Fermer" onclick="$.magnificPopup.close();" /> 
    </div> 
</div> 
<?php }  ?>modules/default/views/scripts/produits/ajaxshowpromopricecaddy.phtml000060400000002350150710367660022343 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1');

if ($this->currentData) {
	$currentData = $this->currentData;
	if (!$currentData->isSurDevis()) {
		 if ($currentData->isPromo()) { ?>
				<div class="productDetail_priceBox" <?php if ($currentData->getPrixAfterRemise() > 999) { echo 'style="width:165px;"'; } ?>>   
		 		<div class="productDetail_promoImag hidden-print" >
					<img class="tooltips" data-placement="bottom" src="<?php echo $this->baseUrl; ?>/business/image/promo.png" alt="Ce produit est en promotion" title="Ce produit est en promotion" >
				</div>
		 		<div class="productDetail_price" >
			 		 <div class="text12" >
					 	<?php echo number_format($currentData->getPrixAfterRemise(), 2, ',', ' ').' ';?>
					 	<span style="color: #000000">&#8364;</span> 
					 </div>
					 <div>
					 	<span class='oldPromoPrice'> <?php echo number_format($currentData->item_prix, 2, ',', ' ').' ';?>&#8364;</span>
					 </div>
		 		</div> 
			</div>
			
		<?php } else { ?>
				<div class="text12" >
					<?php echo number_format($currentData->item_prix, 2, ',', ' ').' ';?>
					<span style="color: #000000">&#8364;</span>
				</div> 
		<?php } 
	} else { ?>
			<div  class="text12">
				<span>sur devis</span>
			</div> 
	<?php }} ?>modules/default/views/scripts/produits/categorie.phtml000060400000021152150710367660017355 0ustar00<?php  
	$currentCat = array();
	$currentCat = $this->currentCat; 
?> 

<?php if (isset($currentCat['ID_THEME']) && $currentCat['ID_THEME'] == 2) {
	
	echo $this->render("/index/index.phtml");
	
} else { ?>

	<div id="page">

	<?php   
		if (isset($currentCat['NOM']) && !empty($currentCat['NOM'])) { ?>
		<div class="big_header"><h1 class="big_header"><?php echo $currentCat['NOM'];  ?></h1></div>
	<?php } 

	$isGallerie = isset($currentCat['ID_THEME']) && !empty($currentCat['ID_THEME']) && isset($this->listAllGalleries) && !empty($this->listAllGalleries);
	$isGallerieSlide = $isGallerie && $currentCat['ID_THEME'] == 6;
	$isArticles = isset($this->listAllArticles) && !empty($this->listAllArticles);// && !$isGallerieSlide;
	
	$subsCategory = $this->currentCatSubs['SUBS'];
	if (sizeof($subsCategory) > 0) { 
	 ?> 
        <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl; ?>/business/light/gamma/css/style.css"/> 
		 <div id="page_top"></div> 
		<div class="scroll-pane">
			<div class="page_block" >   
				<div class="gamma-container " id="gamma-container" >

					<ul class="gamma-gallery">

					<?php
					$isLeft = true; 
					foreach ($subsCategory as $row) { 
							$title = $this->escape($row['NOM']);
							$description = $this->escape($row['DESCRIPTION']);  
							$link_href = $this->baseUrl."/".Utils_Tool::getFormattedUrlCategory($row['NAVNOM_URLPARENTS'], $row['NAVNOM'], $row['ID']);
							
						?>
						<li > 
							<div style="float:left;width:100%;padding:30px 0 30px 0">
								<div style="float:<?php if ($isLeft) { echo "left"; } else {echo "right"; }?>">
									<?php if (!empty($row['URL'])) {  ?> 
										<a href="<?php echo $link_href;?>" alt="<?php echo $title;?>" /> 
											 <img src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 0);?>" alt="<?php echo $this->escape($row['NOM']);?>"/> 
										</a>   
									<?php } else { ?> 
										<a href="<?php echo $link_href;?>" alt="<?php echo $title;?>" />   <?php echo $title;?> </a>   
									<?php }  ?> 
								</div>
								<div style="float:<?php if ($isLeft) { echo "left"; } else {echo "right"; }?>; <?php if ($isLeft) {  echo "margin:0 0 0 30px"; } else {echo "margin:0 30px 0 0";}?> ; width: 350px; text-align: justify;    text-justify: inter-word;">
									<?php if (!empty($row['URL'])) {  ?> 
									<div style="clear:both">
										<a style="float:<?php if ($isLeft) { echo "left"; } else {echo "right"; }?>;" href="<?php echo $link_href;?>" alt="<?php echo $title;?>" />
											<?php echo $title;?>
										</a>
									</div><br /><br />
									<?php }  ?> 
									<a href="<?php echo $link_href;?>" alt="<?php echo $title;?>" style="text-decoration:none;color:#4F4F4F"/><p ><?php echo $description;?> </p>   </a>
								</div>
							</div>
						</li>
					<?php 
					$isLeft = !$isLeft; 
						}  ?> 
					
					</ul>

					<div class="gamma-overlay"></div> 
				</div>   
			</div> <!-- page_block -->
			<div class="page-footer">&copy; <?php echo $this->siteName; ?></div>
		</div> <!-- scroll-pane --> 	
	<?php 
	} else {
		if ($isArticles) { ?>

				<div class="submenu">
				<?php foreach ($this->listAllArticles as $row) { 
					if (!empty($row['CONTENT_SHORT'])) { ?>
					<a href="#article-<?php echo $row['ID'];  ?>" class="custom_font filter"><?php echo $row['CONTENT_SHORT'];  ?></a>
				<?php }
				} ?>
				</div>
				<div class="scroll-pane">
					<div class="page_block">

						<?php foreach ($this->listAllArticles as $row) { ?>
						<div id="article-<?php echo $row['ID'];  ?>">
							<?php echo $row['CONTENT']; ?>
						</div>
						<?php } ?>
						<div class="clear"></div>
					<?php if (!$isGallerie) { ?>
					</div> <!-- page_block -->
					<div class="page-footer">&copy; <?php echo $this->siteName; ?></div>
				</div> <!-- scroll-pane -->
				<?php } ?>
		<?php } 
		
		if ($isGallerie) { ?>

		<?php 
			$currentTheme = (int)$currentCat['ID_THEME'];
			$currentWithThumb = 0;
			if (isset($this->FeatureSiteThemeCms) && !empty($this->FeatureSiteThemeCms)) { 
				foreach ($this->FeatureSiteThemeCms as $row) { 
					if ($row['ID_THEME'] == $currentTheme && isset($row['WIDTH_THUMB']) && $row['WIDTH_THUMB'] > 0) {
						$currentWithThumb = $row['WIDTH_THUMB'];
						break;
					}
				} 
			}
			
			switch ($currentTheme) { 
				case 3: 
				case 4: 
				case 5:
				?>
				
			<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl; ?>/business/light/gamma/css/style.css"/>
			<script src="<?php echo $this->baseUrl; ?>/business/light/gamma/js/modernizr.custom.70736.js"></script>
			<noscript><link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl; ?>/business/light/gamma/css/noJS.css"/></noscript>
			<script src="<?php echo $this->baseUrl; ?>/business/light/gamma/js/jquery.masonry.min.js"></script>
			<script src="<?php echo $this->baseUrl; ?>/business/light/gamma/js/js-url.min.js"></script>
			<script src="<?php echo $this->baseUrl; ?>/business/light/gamma/js/jquerypp.custom.js"></script>
			<script src="<?php echo $this->baseUrl; ?>/business/light/gamma/js/gamma.js"></script>
			
			
				<div id="page_top"></div>
				<?php if (!$isArticles) { ?>
				<div class="scroll-pane">
					<div class="page_block" >  
				<?php } ?>
						<div class="gamma-container gamma-loading" id="gamma-container">

							<ul class="gamma-gallery">

							<?php foreach ($this->listAllGalleries as $row) { 
								if (!empty($row['URL'])) { 
									$title = $this->escape($row['NOM']);
									$description = $this->escape($row['CONTENT_SHORT']);
									if (!empty($row['CONTENT_LONG'])) {
										if (!empty($description)) {
											$description .= " - ";
										}
										$description .= $this->escape($row['CONTENT_LONG']);
									}
								?>
								<li>
									<div data-alt="<?php echo $description;?>" data-description="<h3><?php echo $this->escape($row['CONTENT_SHORT']); ?></h3>" data-max-width="1800" data-max-height="1350">
										<div data-src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 0);?>" data-min-width="700"></div>
										<div data-src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 641);?>" data-min-width="600"></div>
										<div data-src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 295);?>" data-min-width="300"></div> 
										<div data-src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 180);?>" data-min-width="140"></div>
										<div data-src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 100);?>"></div> 
										<noscript>
											<img src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 100);?>" alt="<?php echo $description;?>"/>
										</noscript>
									</div>
								</li>
							<?php } } ?> 
							
							</ul>

							<div class="gamma-overlay"></div> 
						</div>  
				<?php if (!$isArticles) { ?>
					</div> <!-- page_block -->
					<div class="page-footer">&copy; <?php echo $this->siteName; ?></div>
				</div> <!-- scroll-pane -->
				<?php } ?>
			
					 
				<script type="text/javascript">
					
					$(function() {  
					
						var GammaSettings = { 
								viewport : [ {
									width : 600,
									columns : 3
								}, { 
									width : 0,
									columns : 2
								} ],
								overlayAnimated : false, 
						};

						Gamma.init( GammaSettings, fncallback );
		  
						function fncallback() { 

							var element = $('.scroll-pane').jScrollPane(); 
							var api = element.data('jsp');  
							api.reinitialise();
							
						}
					});

				</script>	

				<?php
					break;
				case 6:?>
				<div id="page_top"></div>
				<?php if (!$isArticles) { ?>
				<div class="scroll-pane">
					<div class="page_block">
				<?php } ?>
					<div class="col-md-12">
						<p class="margin_1line">&nbsp;</p>
						<p class="margin_1line margin_bottom_1line"><?php echo $currentCat['DESCRIPTION']; ?></p>
						<div class="responsiveslides-div" style="width:641px; height: 404px;">
							<ul class="rslides">
							<?php foreach ($this->listAllGalleries as $row) { 
								if (!empty($row['URL'])) { ?>
								<li><img src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], $currentWithThumb);?>" /></li>
							<?php } } ?>  
							</ul>
						</div>	
						
					</div>
				<?php if (!$isArticles) { ?>
					</div> <!-- page_block -->
					<div class="page-footer">&copy; <?php echo $this->siteName; ?></div>
				</div> <!-- scroll-pane -->
				<?php } ?>
					<?php
					break;
			}
		}
		if ($isArticles && $isGallerie) { ?>
				</div> <!-- page_block -->
			<div class="page-footer">&copy; <?php echo $this->siteName; ?></div>
		</div> <!-- scroll-pane -->
		<?php }
	}	 ?>
	
	</div>
<?php } ?>
		modules/default/views/scripts/produits/detail.phtml000060400000052067150710367660016666 0ustar00

<?php
	$product = $this->detailProduct;
	$userNamespace = new Zend_Session_Namespace($this->session_variable);
	$myCaddy = $userNamespace->myObjectCaddy;
	$nbOption = 3;

    $auth = Zend_Auth::getInstance();
	$auth->setStorage(new Zend_Auth_Storage_Session($this->session_storage));
	$storage = $auth->getStorage()->read(); 

?>	

<?php if (Utils_Tool::isMobile()) { ?>
	  <?php echo $this->render("/produits/detailmobile.phtml"); ?>
<?php } else { ?>

<?php if ($this->prefixPromoClass == "eco-") { ?>
<style type="text/css">

html, body {
	background: url('/business/image/eco-bg1.jpg') no-repeat top center;
	background-color: #21530d;
	-webkit-background-size: cover; 
    -moz-background-size: cover;   
    -o-background-size: cover;   
    background-size: cover;  
}
.wrapBgContent-l,
.wrapBgContent-r {
	background:none;
}
.wrapBgContent-1 {
  -webkit-box-shadow: 0px 0px 30px rgba(0, 0, 0, 1);
          box-shadow: 0px 0px 30px rgba(0, 0, 0, 1);
}

.wrapBgContent-2 {
  -webkit-box-shadow: 0px 20px 30px rgba(0, 0, 0, 1);
          box-shadow: 0px 20px 30px rgba(0, 0, 0, 1);
}

</style>
<?php } ?>
 
<div >
    
	<?php echo $this->render("/produits/ajaxdownloaddocument.phtml"); ?>
	<?php echo $this->render("/produits/ajaxsendfriend.phtml"); ?>
</div>

<div class="col-xs-12 prod-detail-box" itemscope itemtype="http://schema.org/Product">
	<div class="col-xs-12 prod-detail-title-box noPadding">
		<?php 
		$colTitle = "col-xs-12";
		if (!empty($product['DOCNAME']) && !empty($product['DOCURL'])) { 
			$colTitle = "col-xs-10";
		} ?> 
			
		<div class="<?php echo $colTitle?> noPadding">
			<h1 class="prod-detail-title "  itemprop="name">
				<?php echo $this->escape($product['NOM']); ?>
			</h1>
		</div>

        <?php  if (!empty($product['DOCNAME']) && !empty($product['DOCURL'])) { 
            if (($auth->hasIdentity() && isset($storage['user'])) || !$this->FeatureProductDocumentDownloadGuest) { ?>
			    <div class="col-xs-2 noPadding">
				    <div style="float: left;" class=" hidden-xs hidden-sm">			
					    <div class="prod-detail-document" style="width: 100px;">					
						    <a href="<?php echo $this->baseUrl.'/'.$this->escape($product['DOCURL']); ?>" target="_blank">
							    <span > 
								    <?php echo $this->escape($product['DOCNAME']); ?>
							    </span>
						    </a>
					    </div>
				    </div>
				    <div class="prod-detail-document prod-detail-document-pic">
					    <a style="line-height: 50px;" class="tooltips" data-placement="bottom" title="<?php echo $this->escape($product['DOCNAME']); ?>" href="<?php echo $this->baseUrl.'/'.$this->escape($product['DOCURL']); ?>" target="_blank">
						    <img src="<?php echo $this->baseUrl; ?>/business/image/icon-pdf.png" alt="<?php echo $this->escape($product['DOCNAME']); ?>">	
					    </a>
				    </div>
			    </div>
		    <?php } else if ($this->FeatureProductDocumentDownloadGuest) { ?>
                <div class="col-xs-2 noPadding">
				    <div style="float: left;" class=" hidden-xs hidden-sm">			
					    <div class="prod-detail-document" style="width: 100px;">					
						    <a href="#dialog-form-doc" class="popup-with-form-doc" >
							    <span > 
								    <?php echo $this->escape($product['DOCNAME']); ?>
							    </span>
						    </a>
					    </div>
				    </div>
				    <div class="prod-detail-document prod-detail-document-pic">
					    <a style="line-height: 50px;" class="tooltips popup-with-form-doc"  data-placement="bottom" title="<?php echo $this->escape($product['DOCNAME']); ?>" href="#dialog-form-doc" >
						    <img src="<?php echo $this->baseUrl; ?>/business/image/icon-pdf.png" alt="<?php echo $this->escape($product['DOCNAME']); ?>">	
					    </a>
				    </div>
			    </div>
        <?php } } ?> 
	</div>
	<div class="col-xs-12 noPadding prod-detail-mid-box">
		<div class="col-md-6 col-xs-12 prod-detail-pics-box noPadding">
			<div class="pikachoose" >
				<ul id="pikame" class="jcarousel-skin-pika">
				<?php    foreach ($product['LISTPICS'] as $pic) { ?>
					<li><a data-fancybox-group="prodpicdetail" href="<?php echo $this->baseUrl.'/'.$pic['URL']; ?>" title="<?php echo $this->escape($pic['STRING1'].' '.$pic['STRING2']) ; ?>"><img itemprop="image" src="<?php echo $this->baseUrl.'/'.$pic['URL']; ?>" style="height: 300px"/></a><span><?php if (!empty($pic['STRING1'])) {  
										echo $pic['STRING1'].'<br/>';
									} if (!empty($pic['STRING2'])) {  
										echo $pic['STRING2'] ;
									} ?></span></li>
				<?php } ?>
				</ul>
			</div>
		</div>
		<div class="col-md-6 col-xs-12 noPadding prod-detail-info-box"  >		
			<div class="col-xs-12 prod-detail-info-box-content">
				<input type="hidden" id="isEcoDurable" value="<?php echo $this->prefixPromoClass;?>">
				<div>
  					<a href="#1" class="btn btn-tab-link <?php if(empty($this->prefixPromoClass)) { echo "btn-danger"; } else { echo "btn-success";} ?> btn-tab-default-active" data-liquidslider-ref="prod-info-slider-id">Description</a>
					<?php 
					$count = 2;
					if (!empty($product['DESCTECH'])) { ?>
 					<a href="<?php echo '#'.$count; ?>" class="btn btn-tab-link btn-tab-default-link" data-liquidslider-ref="prod-info-slider-id">Informations techniques</a>
					<?php $count++;} 
					if (!empty($product['DESCNORME'])) { ?>
					<a href="<?php echo '#'.$count; ?>" class="btn btn-tab-link btn-tab-default-link" data-liquidslider-ref="prod-info-slider-id">Normes</a>
					
						<?php } ?>
				</div>
			
				<div class="liquid-slider liquid-slider-product-info" id="prod-info-slider-id">				
				     <div>
	      				<?php echo $product['DESCLONG']; ?>
	      			</div>      			
						<?php if (!empty($product['DESCTECH'])) { ?>
						  <div>
		      				<?php echo $product['DESCTECH']; ?>
		      			</div>
						<?php } if (!empty($product['DESCNORME'])) { ?>
						  <div>
			      				<?php echo $product['DESCNORME']; ?>
			      			</div>
						<?php } ?>
						
				</div>
			</div>
			
			<div class="prod-detail-price"  itemprop="offers" itemscope itemtype="http://schema.org/Offer">
					<?php if ($product['isDEVISPRODUCT'] == 1) { ?>
          <meta itemprop="priceCurrency" content="EUR" />
          <meta itemprop="price" content="<?php echo number_format($product['PRIXLOWEST'], 2, ',', ' '); ?>" /> 
					<div class="productPriceDetailBox" >
						<span class="<?php echo $this->prefixPromoClass; ?>productPriceTitle" style="float: right;" >� partir de</span><br />
						<span class="<?php echo $this->prefixPromoClass; ?>productPriceDetail" ><?php echo number_format($product['PRIXLOWEST'], 2, ',', ' ').' '; ?> &#8364;</span>
						<span class="<?php echo $this->prefixPromoClass; ?>productPriceDetailHT"  style="float: right;" > HT</span>
					</div>
					<?php } else { ?>
					<div class="productPriceDetailBox">
						<span  class="<?php echo $this->prefixPromoClass; ?>productPriceTitle" style="margin-left: 10px; margin-top: 5px">Sur devis</span>
					</div>
					<?php } ?>
			</div>
      
		 	<div class="col-xs-12 " >
				<?php if (!empty($product['STOCK']) && !empty($product['STOCK']) && !$this->isProductOutOfStock) { ?>
				<div class="<?php echo $this->prefixPromoClass; ?>prod-detail-liv-title">D�lais de livraison
					<?php if ((int)$product['STOCK'] == 1) { ?>
					<img class="tooltips" alt="Disponible imm�diatement" title="Disponible imm�diatement" src="<?php echo $this->baseUrl; ?>/business/image/stock111.png">
					<?php } else if ((int)$product['STOCK'] == 2) { ?>
					<img class="tooltips" alt="Disponible sous 8 jours" title="Disponible sous 8 jours" src="<?php echo $this->baseUrl; ?>/business/image/stock222.png">
					<?php } else if ((int)$product['STOCK'] == 3) { ?>
					<img class="tooltips" alt="Nous contacter" title="Nous contacter" src="<?php echo $this->baseUrl; ?>/business/image/stock333.png">
					<?php }?> 
				</div>
				<?php } ?>
			</div>
		</div> 
	</div>
	
		
			<div class="col-xs-12 noPadding" style="margin-bottom: 5px;">	
				<div  class="col-sm-6 col-xs-12 noPadding "> 
					<?php if ($this->escape($product['BRENDURL']) && $product['isSHOWBREND'] == 0) {?>
           <meta itemprop="brand" content="<?php echo $this->escape($product['BREND']); ?>" />

					<img class="prod-detail-brend tooltips" title="<?php echo $this->escape($product['BREND']); ?>" src="<?php echo $this->baseUrl.'/'.$product['BRENDURL']; ?>" alt="<?php echo $product['BREND']; ?>" title="<?php echo $product['BREND']; ?>" />
					<?php } ?> 
					<?php if ($product['isQTEPRIXACTIVE']) { ?>
					<img class="tooltips" data-placement="right" alt="D�couvrez nos prix d�gressif" title="D�couvrez nos prix d�gressif" src="<?php echo $this->baseUrl; ?>/business/image/degressif2.png">
					<?php } ?>
				</div>
				<div  class="col-sm-6 col-xs-12">
          <?php $url = "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]; ?>
          <a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $url; ?>" class="btn btn-facebook"><i class="fa fa-facebook"></i></a>
          <a target="_blank" href="https://plus.google.com/share?url=<?php echo $url; ?>" class="btn btn-google-plus"><i class="fa fa-google-plus"></i></a>
          <a target="_blank" href="https://twitter.com/home?status=<?php echo $url; ?>" class="btn btn-twitter"><i class="fa fa-twitter"></i></a>
          <a target="_blank" href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo $url; ?>&title=<?php echo utf8_encode($this->escape($product['NOM'])); ?>&summary=<?php echo utf8_encode($this->escape($product['DESCSHORT'])); ?>&source=<?php echo $this->baseUrl_SiteCommerceUrl; ?>" class="btn btn-linkedin"><i class="fa fa-linkedin"></i></a>
        
         <?php  if ($this->FeatureProductSendDetail) { ?>
            <a href="#dialog-form-send-friend" class="btn btn-default popup-with-form-send-friend"><i class="fa fa-envelope"></i> Conseillez cet article</a>
         <?php  } ?>
          
        </div> 
			
			</div>

  <form id="productAddForm" action="<?php echo $this->baseUrl; ?>/produits/ajaxaddpanier/<?php echo $product['NAVNOM']; ?>/p/<?php echo $product['ID']; ?>" method="post">
    
    <div class="col-xs-12 noPadding prod-detail-buy text-right">
      <?php if (!$this->isProductOutOfStock) { ?> 
          <div class=" col-xs-12 noPadding">
            <div id="detailAddInfo" style="display:none" class="detailAddInfoContent"></div>
          </div>
          <button type="submit" class="btn btn-success btn-lg">
            <img id="prod-detail-add-btn" src="<?php echo $this->baseUrl; ?>/business/image/add-caddy.png" class="glyphicon-caddy" /> AJOUTER AU PANIER
          </button>
      <?php } else { ?>
        <span class="btn btn-success btn-lg">Le produit est �puis�</span>
      <?php } ?>
    </div>

  <div class="col-xs-12 noPadding">

			<div class="col-xs-12 noPadding">
				<input type="hidden" name="idProd" id="idProd" value="<?php echo $this->escape($product['ID']); ?>" />
          <h2 class="prod-detail-desc"  itemprop="description">
            <b>Descriptif : </b>
            <?php echo strip_tags($product['DESCSHORT']); ?>
          </h2>
				<table border="0" cellpadding="0" cellspacing="0" width="100%" class="prod-detail-ref-table">
					<thead>
					<tr >
						<th class="textTh1" style="text-align: center;" >Produit</th>
							
						<?php for($i=0 ; $i < $nbOption; $i++) { 
						if (isset($product['LISTOPTION'][$i]) && isset($product['LISTOPTION'][$i]['NOMOPTION']) ) {
							?>
						<th  class="textTh1 productDetail_option" > 
							<?php echo $this->escape($product['LISTOPTION'][$i]['NOMOPTION']); ?>
						</th>
						<?php }
						} ?>
						<?php  if ($product['ONSELECT_IDOPTION'] > 0  && !empty($product['ONSELECT_OPTION'])) { ?>
						<th  class="textTh1 productDetail_option" > 	
						 	<?php $currentOption = $product['ONSELECT_OPTION'];
								echo $currentOption->name;
							 ?>
						</th>
						<?php } ?>
						<th  class="textTh1" style="text-align: center;" width="130px" nowrap="nowrap">Prix Unitaire (HT)</th>
            <?php if (!$this->isProductOutOfStock) { ?>
						<th  class="textTh1 hidden-print" id="qteTableHeader" width="100px" style="text-align: center">Quantit�</th>
            <?php } ?>
					</tr>
					</thead>
					<tbody>
					<?php 
					$index = 1;
					$count = 0; 
					if (sizeof($product['LISTCHILD']) > 0) { 
						foreach($product['LISTCHILD'] as $child) {  ?>
						<tr align="center" class="<?php if ($index == 0) {echo 'trStripOdd'; $index=1;} else {$index=0; echo 'trStripEven';} ?>" >
																
							<td>
								<?php 
									$isFTFDS = false;
									if ($this->listFTFDS) {
									foreach($this->listFTFDS as $rowFTFDS) { 
										if ($rowFTFDS['ID_CHILD'] == $child['ID']) { ?>
									<div class="prod-detail-document" style="float: left;margin: 10px;" >
                                      <?php  if (($auth->hasIdentity() && isset($storage['user'])) || !$this->FeatureProductDocumentDownloadGuest) { ?>
			        					<a class="tooltips" data-placement="bottom" title="Voir la fiche technique et donn�es de s�curit�" href="<?php echo $this->baseUrl.'/'.$rowFTFDS['URL']; ?>" target="_blank">
											<img src="<?php echo $this->baseUrl; ?>/business/image/icon-pdf.png" alt="Voir la fiche technique et donn�es de s�curit�">	
										</a>
                                      <?php  } else if ($this->FeatureProductDocumentDownloadGuest) { ?>
										<a class="tooltips popup-with-form-doc" data-placement="bottom" title="Voir la fiche technique et donn�es de s�curit�" href="#dialog-form-doc" >
											<img src="<?php echo $this->baseUrl; ?>/business/image/icon-pdf.png" alt="Voir la fiche technique et donn�es de s�curit�">	
										</a>
                                      <?php  } ?>
                                         
                                         
									</div>
									<?php }}} ?>
									
									<div style="float: left;">
										<div class="textA1" style="width: auto;"> 
											<?php echo $child['DESIGNATION'];?>
										</div>
										<div class="textA1 productDetail_ref" >
											<div style="float: left;margin: 5px 0 5px 0">
												<?php echo "Ref. ".$this->escape($child['REFERENCE']); ?>
											</div>
											<?php if ($child['isQTEPRIXACTIVE'] && $child['QTEPRIXITEM'] > 0) { ?>
											<div style="float: right;margin: 0 10px 5px 0">
												<a class="btn <?php if(empty($this->prefixPromoClass)) { echo "btn-danger"; } else { echo "btn-success";} ?> tooltips showModalPrice" data-placement="right" href="<?php echo $this->baseUrl; ?>/<?php echo Utils_Tool::getFormattedUrlProduct($product['NAVNOM_URLPARENTS'], $product['NAVNOM'], $product['ID']); ?>" title="Nos prix d�gressif" id="item-<?php echo $child['ID']; ?>-<?php echo $child['QTEPRIXITEM'];?>">
													Prix d�gressif
												</a>
							 				</div>
											<?php } ?>
										</div>
									</div>
							</td>
							<?php for($i=0 ; $i < $nbOption; $i++) { 
							if (isset($product['LISTOPTION'][$i]) && isset($product['LISTOPTION'][$i]['NOMOPTION'])) { ?>
							<td class="textTd1 ">
								<?php 
								 if (isset($child['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']])) {echo $this->escape($child['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']]['OPTIONVALUE']); } 
								?> 
							</td>
							<?php } } ?>
							
							<?php  if ($product['ONSELECT_IDOPTION'] > 0  && !empty($product['ONSELECT_OPTION'])) { ?>
							<td  class="textTh1" > 	
							 	<select name="selectedOption_<?php echo $count; ?>" class="selectedOption form-control">
									<?php 
									$optionsList = $product['ONSELECT_OPTION'];
									foreach($optionsList->values as $currentOption) {  ?>
									<option value="<?php echo $currentOption; ?>">
										<?php echo $currentOption; ?> 
									</option>
									<?php } ?>
								</select> 
							</td>
							<?php } ?>
							
							
							<td align="center" >
							<?php $this->currentData = $child;
								echo $this->render("/produits/ajaxshowpromoprice.phtml"); ?>
							</td>
              <?php if (!$this->isProductOutOfStock) { ?>
							<td class="textTd1  hidden-print" >
								<div class="col-md-8 col-md-offset-2 noPadding">
								<?php  
									if (isset($myCaddy->items))  {
										$myValue = $myCaddy->getQuantity($child['ID']);
									}
								
									?>
									<input onclick="clearById('quantity_<?php echo $this->escape($child['ID']); ?>', '0')" type="text" class="form-control text-center" maxlength="5" name="quantity_<?php echo $this->escape($child['ID']); ?>" id="quantity_<?php echo $this->escape($child['ID']); ?>" value="<?php echo $myValue; ?>" />
									<input type="hidden" name="idChild_<?php echo $count; ?>" value="<?php echo $this->escape($child['ID']); ?>" />
									<input type="hidden" name="qtyMinChild_<?php echo $count; ?>" value="<?php echo $this->escape($child['QUANTITYMIN']); ?>" />
									<input type="hidden" name="isAccessoire_<?php echo $count; ?>" value="N" >
								</div>
							</td>
              <?php } ?>
						</tr>
						<?php $count++; } }
						
						
						
						if (sizeof($product['PRODUCT_ACCESSOIRE']) > 0) {  
					foreach ($product['PRODUCT_ACCESSOIRE']  as $child ) { ?>
					<tr align="center" class="<?php if ($index == 0) {echo 'trStripOdd'; $index=1;} else {$index=0; echo 'trStripEven';} ?>"  >
																
							<td>
									<div style="float: left;">
										<div class="textA1" style="width: auto;"> 
											<?php echo $child['DESIGNATION'];?>
										</div>
										<div class="textA1 productDetail_ref" >
											<div style="float: left;margin: 5px 0 5px 0">
												<?php echo "Ref. ".$this->escape($child['REFERENCE']); ?>
											</div>
											<?php if ($child['isQTEPRIXACTIVE'] && $child['QTEPRIXITEM'] > 0) { ?>
											<div style="float: right;margin: 0 10px 5px 0">
												<a class="btn <?php if(empty($this->prefixPromoClass)) { echo "btn-danger"; } else { echo "btn-success";} ?> tooltips showModalPrice" data-placement="right" href="<?php echo $this->baseUrl; ?>/<?php echo Utils_Tool::getFormattedUrlProduct($product['NAVNOM_URLPARENTS'], $product['NAVNOM'], $product['ID']);?>" title="Nos prix d�gressif" id="item-<?php echo $child['ID']; ?>-<?php echo $child['QTEPRIXITEM'];?>">
													Prix d�gressif
												</a>
							 				</div>
											<?php } ?>
										</div>
									</div>
							</td>
							<?php for($i=0 ; $i < $nbOption; $i++) { 
							if (isset($product['LISTOPTION'][$i]) && isset($product['LISTOPTION'][$i]['NOMOPTION'])) { ?>
							<td class="textTd1">
								<?php 
								 if (isset($child['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']])) {echo $this->escape($child['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']]['OPTIONVALUE']); } 
								?> 
							</td>
							<?php } } ?>
							
							<?php  if ($product['ONSELECT_IDOPTION'] > 0  && !empty($product['ONSELECT_OPTION'])) { ?>
							<td  class="textTh1" > 	
							 	<select name="selectedOption_<?php echo $count; ?>" class="selectedOption form-control">
									<?php 
									$optionsList = $product['ONSELECT_OPTION'];
									foreach($optionsList->values as $currentOption) {  ?>
									<option value="<?php echo $currentOption; ?>">
										<?php echo $currentOption; ?> 
									</option>
									<?php } ?>
								</select> 
							</td>
							<?php } ?>
							
							<td align="center" >
							<?php $this->currentData = $child;
								echo $this->render("/produits/ajaxshowpromoprice.phtml"); ?>
							</td>
            <?php if (!$this->isProductOutOfStock) { ?>
							<td class="textTd1  hidden-print" >
								<div class="col-md-8 col-md-offset-2 noPadding">
								<?php  
									if (isset($myCaddy->items))  {
										$myValue = $myCaddy->getQuantity($child['ID']);
									}
								
									?>
									<input onclick="clearById('quantity_<?php echo $this->escape($child['ID']); ?>', '0')" type="text" class="form-control text-center" maxlength="5" name="quantity_<?php echo $this->escape($child['ID']); ?>" id="quantity_<?php echo $this->escape($child['ID']); ?>" value="<?php echo $myValue; ?>" />
									<input type="hidden" name="idChild_<?php echo $count; ?>" value="<?php echo $this->escape($child['ID']); ?>" />
									<input type="hidden" name="qtyMinChild_<?php echo $count; ?>" value="<?php echo $this->escape($child['QUANTITYMIN']); ?>" />
									<input type="hidden" name="isAccessoire_<?php echo $count; ?>" value="Y" >
								</div>
							</td>
            <?php } ?>
						</tr>
					<?php $count++; }}  ?>
					</tbody>
				</table>
				<input type="hidden" name="nbr" value="<?php echo $count; ?>" />
			</div>
			<div class="col-xs-12 noPadding">
			
				<div class="<?php echo $this->prefixPromoClass; ?>prod-detail-caracs col-sm-6 col-xs-12">
					<a class="showModalDetail tooltips" data-placement="bottom" data-nbrchilds="<?php echo $count;?>" href="<?php echo $this->baseUrl; ?>/<?php echo Utils_Tool::getFormattedUrlProduct($product['NAVNOM_URLPARENTS'], $product['NAVNOM'], $product['ID']);?>" title="Voir toutes les caract�ristiques - <?php echo $this->escape($product['NOM']); ?>">Voir toutes les caract�ristiques</a>
				</div>
				
				
				<div id="productAddFormLog"> </div>
			</div>
  </div>
  </form>
</div>

	<?php echo $this->render("/produits/ajaxannexelist.phtml"); ?>
<script type="text/javascript">
$(function(){
	initEventDetail(); 
}); 
</script> 
<?php } ?>

			modules/default/views/scripts/produits/ajaxshowchildqteprice.phtml000060400000003047150710367660022003 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1');
$productQte = $this->detailProductQte; 
if (isset($productQte) && !empty($productQte)) {  
?>  
<link href="<?php echo $this->baseUrl; ?>/business/css/default-bootstrap.css" rel="stylesheet">
    <link href="<?php echo $this->baseUrl; ?>/business/css/default.css" rel="stylesheet">
<style>
html, body {
background-color: white;
}
</style>
<table cellpadding="0" cellspacing="0"   class="prod-detail-ref-table"> 
	<thead>
		<tr align="center"  >
			<th colspan="2"  >Quantit�</th>  
			<th  >Prix unitaire &#8364;</th>  
		</tr> 
		<tr align="center" class="headerQtePrice">
			<th width="70px"   >De</th> 
			<th width="70px"   >�</th> 
			<th width="120px" >HT</th>  
		</tr> 
	</thead>
	<tbody>
	<?php 
		$index = 1;
		foreach($productQte as $row) { ?>
	<tr  class=" <?php if ($index == 0) {echo 'trStripOdd'; $index=1;} else {$index=0; echo 'trStripEven';} ?>" style="height:30px">    
		<td align="center" >
			<span><?php echo $this->escape($row['MIN']);?></span> 
		</td> 
		<td align="center"  >
			<span>
			<?php if ($row['MAX'] <> 999999999) { echo $this->escape($row['MAX']); }
			else {echo "Et Plus"; } ?></span> 
		</td> 
		<td  align="center"  >
			<div class="text12" >
				<?php echo number_format($row['PRIX'], 2, ',', ' ').' ';?>
				<span style="color: #000000">&#8364;</span>
			</div> 
		</td>  
	</tr>
	<?php } ?>
	</tbody>
</table> 
<?php } else { ?>
<div style="clear: both;text-align: center;vertical-align:middle;">Aucun prix d�gressif n'est disponible pour cet article.</div>
<?php } ?>modules/default/views/scripts/produits/ajaxshowallchilds.phtml000060400000006516150710367660021126 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1');
$product = $this->detailProduct; 
if (isset($product) && !empty($product)) { 
$nbOption = sizeof($product['LISTOPTION']);
?> 
<link href="<?php echo $this->baseUrl; ?>/business/css/default-bootstrap.css" rel="stylesheet">
    <link href="<?php echo $this->baseUrl; ?>/business/css/default.css" rel="stylesheet">
    <style>
html, body {
background-color: white;
}
</style>
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="prod-detail-ref-table">
	<thead>
	<tr > 
		<th >Produit</th>
			
		<?php for($i=0 ; $i<$nbOption; $i++) { 
		if (isset($product['LISTOPTION'][$i]) && isset($product['LISTOPTION'][$i]['NOMOPTION']) ) {
			?>
		<th  class=" productDetail_option" style="padding: 10px"> 
			<?php echo $this->escape($product['LISTOPTION'][$i]['NOMOPTION']); ?>
		</th>
		<?php }
		} ?>
	</tr>
	</thead>
	<tbody>
	<?php 
	$index = 1;
	$count = 0;
	foreach($product['LISTCHILD'] as $child) { 
		
		?>
	<tr align="center" class="<?php if ($index == 0) {echo 'trStripOdd'; $index=1;} else {$index=0; echo 'trStripEven';} ?>" >
			<td valign="top" >	
			<div class="textA1" style="width: auto;clear:both"> 
				<?php echo $child['DESIGNATION'];?>
			</div>
			<div class="textA1 productDetail_ref" >
				<?php echo "Ref. ".$this->escape($child['REFERENCE']);?>
			</div>
		</td>
		<?php for($i=0 ; $i<$nbOption; $i++) { 
		if (isset($product['LISTOPTION'][$i]) && isset($product['LISTOPTION'][$i]['NOMOPTION'])) { ?>
		<td class="textTd1" >
		
			<?php if ($product['ONSELECT_IDOPTION'] > 0 ) {
					if (($product['LISTOPTION'][$i]['IDOPTION'] == $product['ONSELECT_IDOPTION']) && isset($child['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']])) { ?>
				 	<?php 
					$optionsForChild = explode(";", $this->escape($child['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']]['OPTIONVALUE']));;
					foreach($optionsForChild as $currentOption) {  
						echo $this->escape($currentOption)."<br/><br/>"; 
					} ?> 
			<?php } else {
				if (isset($child['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']])) {echo $this->escape($child['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']]['OPTIONVALUE']); } 
				} 
			} else {
				 if (isset($child['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']])) {echo $this->escape($child['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']]['OPTIONVALUE']); } 
			} ?> 
		</td>
		<?php } } ?> 
	</tr>
	<?php $count++; } ?>	
	 
	<?php  
	foreach ($product['PRODUCT_ACCESSOIRE']  as $childAccessoire ) {  
		?>
	<tr align="center" class="<?php if ($index == 0) {echo 'trStripOdd'; $index=1;} else {$index=0; echo 'trStripEven';} ?>"  >
						 
		<td valign="top" >	
			<div class="textA1" style="width: auto;clear:both"><?php echo $childAccessoire['DESIGNATION'];?></div>

			<div class="textA1 productDetail_ref">
				<?php echo "Ref. ".$this->escape($childAccessoire['REFERENCE']);?>
			</div>
		</td>
		<?php for($i=0 ; $i<$nbOption; $i++) { 
		if (isset($product['LISTOPTION'][$i]) && isset($product['LISTOPTION'][$i]['NOMOPTION'])) { ?>
		<td class="textTd1">
			<?php if (isset($childAccessoire['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']])) {echo $this->escape($childAccessoire['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']]['OPTIONVALUE']); } ?>
		</td>
		<?php } } ?> 
	</tr>
	<?php $count++; }  ?>
	</tbody>
</table>
<?php } ?>modules/default/views/scripts/produits/monpanier.phtml000060400000001157150710367660017406 0ustar00

<script  type="text/javascript" >

$(function(){
	initEventsCaddy();
});

</script>
<div class="col-xs-12 caddy-header-box" style="padding-left: 0;">
	<div class="col-xs-10 col-xs-offset-1 caddy_flux" style="padding-left: 0;">
		<div class="caddy_flux_panier_over"></div>
		<div class="caddy_flux_separator"></div>
		<div class="caddy_flux_id"></div>
		<div class="caddy_flux_separator"></div>
		<div class="caddy_flux_livraison"></div>
		<div class="caddy_flux_separator"></div>
		<div class="caddy_flux_validation"></div>
	</div>
</div>
<div id="caddyArea">
<?php echo $this->render("/ajax/ajaxcaddy.phtml"); ?>

</div>modules/default/views/scripts/produits/ajaxannexelist.phtml000060400000001444150710367660020433 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?>


<?php if (isset($this->listAnnexes) && !empty($this->listAnnexes)) { ?>
<div
	class="col-xs-12 hidden-print <?php echo $this->prefixPromoClass; ?>footer-content-divider"></div>
<div class="col-xs-12 noPadding prod-detail-annexe-box">
<div class="col-xs-12 noPadding">
<div class="productAnnexeLabel" style="color : <?php if(empty($this->prefixPromoClass)) { echo $this->actualDesign['color']; } else { echo "#000";} ?>;">
<h3>Les clients ayant consult� cet article ont �galement regard� ces produits</h3></div>
</div>
<?php
//$color = "none";
$color = $this->actualDesign['color'];
foreach ($this->listAnnexes as $product) {
	$this->currentData = $product;
	echo $this->render("/produits/ajaxshowproductbox.phtml");
}  ?></div>
<?php } ?>modules/default/views/scripts/produits/ajaxsendfriend.phtml000060400000006776150710367660020417 0ustar00
 <?php header('Content-Type: text/html; charset=ISO-8859-15'); ?>

<?php if (!$this->isSuccess) { ?>
<?php
	$product = $this->detailProduct;
?>	

    <form id="dialog-form-send-friend" class="white-popup-block-medium mfp-hide form-horizontal" action="<?php echo $this->baseUrl.'/produits/ajaxsendfriend'; ?>" method="post">
	    <script type="text/javascript">
            $(function() {
                initDetailProductDialogSendFriend();
            });
        </script>
        <span class="indexBox4_title2">Conseillez cet article</span>
	    <fieldset style="border:0;">
		    <p>Pour partager cet article, veuillez renseigner le formulaire ci-dessous.</p>
		    
            <?php 
	        $auth = Zend_Auth::getInstance();
	        $auth->setStorage(new Zend_Auth_Storage_Session($this->session_storage));
	        $storage = $auth->getStorage()->read();  
            $currentName = "";
		    if ($auth->hasIdentity() && isset($storage['user'])) {
             $currentName = $storage['user']['prenom'].' '.$storage['user']['nom'];
            }
            ?>
             <div class="form-group">
				<label for="name_friend" class="col-sm-3 control-label">Nom de l'exp�diteur</label>
                 <div class="col-sm-9">
				    <input id="name_friend" name="name_friend" type="text" value="<?php echo $currentName; ?>" placeholder="Nom de l'exp�diteur" class="form-control" required="">
			   </div>
			</div>
			<div class="form-group">
				<label for="email_friend" class="col-sm-3 control-label" >Email de destination</label>
				<div class="col-sm-9">
                     <input id="email_friend" name="email_friend" type="email" placeholder="exemple@domaine.com" class="form-control" required="">
			     </div>
			</div>
             <div class="form-group">
				    <label for="message_friend" class="col-sm-3 control-label">Votre message</label>
                  <div class="col-sm-9">
                    <?php 
                     $linkProd = Utils_Tool::getFormattedUrlProduct($product['NAVNOM_URLPARENTS'], $product['NAVNOM'], $product['ID']);
	                 $linkCat = Utils_Tool::getFormattedUrlCategory($product['NAVNOM_URLPARENTS'], $product['CATNAVNOM'], $product['IDCATEGORY']);
                    
                    ?>
                    <textarea id="message_friend" name="message_friend" class="form-control" rows="10" cols="70">Bonjour,
                      
Voici un produit int�ressant trouv� sur le site <?php echo $this->baseUrl_SiteCommerceUrl; ?> : 

Le nom du produit est : <?php echo $this->escape($product['NOM']); ?>


Pour y acc�der : 

<?php echo $this->baseUrl_SiteCommerceUrl."/".$linkProd; ?>


<?php echo $this->siteName; ?> pr�sente toute une gamme de <?php echo $product['CATNOM'] ?>, � d�couvrir en cliquant sur le lien suivant :

<?php echo $this->baseUrl_SiteCommerceUrl."/".$linkCat; ?>
                    </textarea>
			    </div>
			</div>
			<div class="form-group">
                <div class="col-sm-12 text-center">
                    <input type="submit" class="btn btn-default" value="Envoyer le mail" /> 
                    <input type="hidden" name="product_id_friend" value="<?php echo $product['ID']; ?>" /> 
                    </div> 
			</div> 
	    </fieldset>
    </form>

<?php } else { ?>
<div class="white-popup-block-medium">
    <div class="text-center">
        <?php echo $this->message ;?><br /><br />
    </div> 
    <div class="text-center">
        <input type="button" class="btn btn-danger" value="Fermer" onclick="$.magnificPopup.close();" /> 
    </div> 
</div> 
<?php } ?>modules/default/views/scripts/produits/categorie_gamma.phtml000060400000011350150710367660020516 0ustar00<?xml version="1.0" encoding="Windows-1252"?>

<?php  
	$currentCat = array();
	$currentCat = $this->currentCat;
?> 

<?php if (isset($currentCat['ID_THEME']) && $currentCat['ID_THEME'] == 2) {
	
	echo $this->render("/index/index.phtml");
	
} else { ?>

	<div id="page">

	<?php   
		if (isset($currentCat['NOM']) && !empty($currentCat['NOM'])) { ?>
		<div class="big_header"><h1 class="big_header"><?php echo $currentCat['NOM'];  ?></h1></div>
	<?php } 

	if (isset($currentCat['ID_THEME']) && !empty($currentCat['ID_THEME']) && isset($this->listAllGalleries) && !empty($this->listAllGalleries)) { ?>

	<?php
		$currentTheme = (int)$currentCat['ID_THEME'];
		$currentWithThumb = 0;
		if (isset($this->FeatureSiteThemeCms) && !empty($this->FeatureSiteThemeCms)) { 
			foreach ($this->FeatureSiteThemeCms as $row) { 
				if ($row['ID_THEME'] == $currentTheme && isset($row['WIDTH_THUMB']) && $row['WIDTH_THUMB'] > 0) {
					$currentWithThumb = $row['WIDTH_THUMB'];
					break;
				}
			} 
		}
		
		switch ($currentTheme) { 
			case 3: 
			case 4: 
			case 5:
			?>
			
        <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl; ?>/business/light/gamma/css/style.css"/>
		
        <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl; ?>/business/light/gamma/css/stylesite.css"/>
		<script src="<?php echo $this->baseUrl; ?>/business/light/gamma/js/modernizr.custom.70736.js"></script>
		<noscript><link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl; ?>/business/light/gamma/css/noJS.css"/></noscript>
		<script src="<?php echo $this->baseUrl; ?>/business/light/gamma/js/jquery.masonry.min.js"></script>
		<script src="<?php echo $this->baseUrl; ?>/business/light/gamma/js/js-url.min.js"></script>
		<script src="<?php echo $this->baseUrl; ?>/business/light/gamma/js/jquerypp.custom.js"></script>
		<script src="<?php echo $this->baseUrl; ?>/business/light/gamma/js/gamma.js"></script>
		
		
			<div id="page_top"></div>
			<div class="scroll-pane">
				<div class="page_block">
					<div class="gamma-container gamma-loading" id="gamma-container">

						<ul class="gamma-gallery">

						<?php foreach ($this->listAllGalleries as $row) { 
							if (!empty($row['URL'])) { ?>
							<li>
								<div data-alt="<?php echo $this->escape($row['CONTENT_SHORT']);?>" data-max-width="1800" data-max-height="1350">
									<div data-src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 641);?>" data-min-width="700"></div>
									<div data-src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 295);?>" data-min-width="300"></div>
									<div data-src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 0);?>"></div>
									<noscript>
										<img src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 0);?>" alt="<?php echo $this->escape($row['CONTENT_SHORT']);?>"/>
									</noscript>
								</div>
							</li>
						<?php } } ?>
						</ul>

					<div class="gamma-overlay"></div> 
				</div>
			</div>
			

		<script type="text/javascript">
			
			$(function() {

				var GammaSettings = { 
						viewport : [ {
							width : 600,
							columns : 3
						}, { 
							width : 0,
							columns : 2
						} ]
				};

				Gamma.init( GammaSettings, fncallback );
  
				function fncallback() {  }

			});

		</script>	
		
			<?php
				break;
			case 6:?>
			<div id="page_top"></div>
			<div class="scroll-pane">
				<div class="page_block">
					<p class="margin_1line">&nbsp;</p>
					<p class="margin_1line margin_bottom_1line"><?php echo $currentCat['DESCRIPTION']; ?></p>
					<div class="responsiveslides-div" style="width:641px; height: 404px;">
						<ul class="rslides">
						<?php foreach ($this->listAllGalleries as $row) { 
							if (!empty($row['URL'])) { ?>
							<li><img src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], $currentWithThumb);?>" /></li>
						<?php } } ?>  
						</ul>
					</div>	
				</div>
				<div class="page-footer">&copy; <?php echo $this->siteName; ?></div>
			</div>		
				<?php
				break;
		}
	} else if (isset($this->listAllArticles) && !empty($this->listAllArticles)) { ?>

			<div class="submenu">
			<?php foreach ($this->listAllArticles as $row) { 
				if (!empty($row['CONTENT_SHORT'])) { ?>
				<a href="#article-<?php echo $row['ID'];  ?>" class="custom_font filter"><?php echo $row['CONTENT_SHORT'];  ?></a>
			<?php }
			} ?>
			</div>
			<div class="scroll-pane">
				<div class="page_block">

					<?php foreach ($this->listAllArticles as $row) { ?>
					<div id="article-<?php echo $row['ID'];  ?>">
						<?php echo $row['CONTENT']; ?>
					</div>
					<?php } ?>
					<div class="clear"></div>
				</div>
				<div class="page-footer">&copy; <?php echo $this->siteName; ?></div>
			</div>

	<?php } ?>
	</div>
<?php } ?>
		modules/default/views/scripts/produits/ajaxfacets.phtml000060400000003522150710367660017525 0ustar00

<?php  
  $listFacets = $this->listSearchFacets;  
  $facetPosition = 0;
if (!empty($listFacets) && !empty($listFacets)) {?>
  <form action="<?php echo $this->baseUrl; ?>/produits/recherche" method="post" id="searchfacet">
    <input type="hidden" value="<?php echo $this->searchKey; ?>>" name="key" />
    <div class="facet-main" id="facet-main">
	    <?php foreach ($listFacets as $row) { 
       $facetPosition++;
        if (isset($row->Values->ProductFacetValue)) { 
          $displayUl = "none";
          if ($facetPosition < 4 || $row->IsSelected) {
            $displayUl="block";
          }
        ?>
        <div class="facet-content">
          <div class="facet-name"><?php echo $row->Name; ?></div>
          <ul style="display:<?php echo $displayUl; ?>">
	        <?php
          
            $facetValue = array();
            if (!is_array($row->Values->ProductFacetValue)) { 
                array_push($facetValue, $row->Values->ProductFacetValue); 
            } else {
                $facetValue = $row->Values->ProductFacetValue;
            }
            
            $count = 1; 
            foreach ($facetValue as $rowValue) { 
              $idFacet =  $row->Id."_".$count;
            ?>
              <li>
                <input type="checkbox" name="facet_<?php echo $idFacet;  ?>" 
                id="facet_<?php echo $idFacet; ?>" 
                onclick="selectCurrentFacetSubmit()" 
                value="<?php echo $rowValue->Value; ?>" 
                <?php if ($rowValue->IsSelected) { echo "checked"; } ?> /> 
                <a href="javascript:;" class="facet-value-link" onclick="selectCurrentFacet('facet_<?php echo $idFacet; ?>');"><?php echo $rowValue->Value; ?></a> 
              </li>
            <?php $count++; } ?>
          
          </ul>
        </div>
      <?php }
      } ?>
    </div>
  </form>
<?php } ?> modules/default/views/scripts/produits/catalogue.phtml000060400000000026150710367660017354 0ustar00Catalogue ou Connexionmodules/default/views/scripts/produits/categorie_default_theme.phtml000060400000012775150710367660022256 0ustar00<?xml version="1.0" encoding="Windows-1252"?>


<?php  
	$currentCat = array();
	$currentCat = $this->currentCat;
?> 

<?php if (isset($currentCat['ID_THEME']) && $currentCat['ID_THEME'] == 2) {
	
	echo $this->render("/index/index.phtml");
	
} else { ?>

	<div id="page">

	<?php   
		if (isset($currentCat['NOM']) && !empty($currentCat['NOM'])) { ?>
		<div class="big_header"><h1 class="big_header"><?php echo $currentCat['NOM'];  ?></h1></div>
	<?php } 

	if (isset($currentCat['ID_THEME']) && !empty($currentCat['ID_THEME']) && isset($this->listAllGalleries) && !empty($this->listAllGalleries)) { ?>

	<?php
		$currentTheme = (int)$currentCat['ID_THEME'];
		$currentWithThumb = 0;
		if (isset($this->FeatureSiteThemeCms) && !empty($this->FeatureSiteThemeCms)) { 
			foreach ($this->FeatureSiteThemeCms as $row) { 
				if ($row['ID_THEME'] == $currentTheme && isset($row['WIDTH_THUMB']) && $row['WIDTH_THUMB'] > 0) {
					$currentWithThumb = $row['WIDTH_THUMB'];
					break;
				}
			} 
		}
		
		switch ($currentTheme) { 
			case 3:
			?>
			<div id="page_top"></div>
			<div class="scroll-pane">
				<div class="page_block">
					<ul class="portfolio2c margin_1line" id="portfolio-list">	
						<?php foreach ($this->listAllGalleries as $row) { 
							if (!empty($row['URL'])) { ?>
						<li class="category2 category3">
							<div class="item">
								<img style="width:310px;" src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], $currentWithThumb);?>" alt="<?php echo $this->escape($row['CONTENT_SHORT']);?>"/>
								<a class="gallery_group" rel="gallery_group" href="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 0);?>" title="<?php echo $this->escape($row['CONTENT_LONG']);?>">
								</a>
								<div class="details">
									<div class="mblogfooter2 custom_font"><p><?php echo $this->escape($row['CONTENT_SHORT']);?></p></div>
								</div>				
							</div>
						</li>
						<?php } } ?>
					</ul>
				</div>
				<div class="page-footer">&copy; <?php echo $this->siteName; ?></div>
			</div>
			<?php
				break;
			case 4:
			?>
			<div id="page_top"></div>
			<div class="scroll-pane">
				<div class="page_block">
					<ul class="portfolio3c margin_1line" id="portfolio-list">	
						<?php foreach ($this->listAllGalleries as $row) { 
							if (!empty($row['URL'])) { ?>
						<li class="category2 category3">
							<div class="item">
								<img style="width:200px;" src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], $currentWithThumb);?>" alt="<?php echo $this->escape($row['CONTENT_SHORT']);?>"/>
								<a class="gallery_group" rel="gallery_group" href="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 0);?>" title="<?php echo $this->escape($row['CONTENT_LONG']);?>">
								</a>
								<div class="details">
									<div class="mblogfooter2 custom_font"><p><?php echo $this->escape($row['CONTENT_SHORT']);?></p></div>
								</div>				
							</div>
						</li>
						<?php } } ?>
					</ul>
				</div>
				<div class="page-footer">&copy; <?php echo $this->siteName; ?></div>
			</div>
			<?php
				break;
			case 5:
			?>
			<div id="page_top"></div>
			<div class="scroll-pane">
				<div class="page_block">
					<ul class="portfolio4c margin_1line" id="portfolio-list">	
						<?php foreach ($this->listAllGalleries as $row) { 
							if (!empty($row['URL'])) { ?>
						<li class="category2 category3">
							<div class="item">
								<img style="width:142px;" src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], $currentWithThumb);?>" alt="<?php echo $this->escape($row['CONTENT_SHORT']);?>"/>
								<a class="gallery_group" rel="gallery_group" href="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], 0);?>" title="<?php echo $this->escape($row['CONTENT_LONG']);?>">
								</a>
								<div class="details">
									<div class="mblogfooter2 custom_font"><p><?php echo $this->escape($row['CONTENT_SHORT']);?></p></div>
								</div>				
							</div>
						</li>
						<?php } } ?>
					</ul>
				</div>
				<div class="page-footer">&copy; <?php echo $this->siteName; ?></div>
			</div>
			<?php
				break;
			case 6:?>
			<div id="page_top"></div>
			<div class="scroll-pane">
				<div class="page_block">
					<p class="margin_1line">&nbsp;</p>
					<p class="margin_1line margin_bottom_1line"><?php echo $currentCat['DESCRIPTION']; ?></p>
					<div class="responsiveslides-div" style="width:641px; height: 404px;">
						<ul class="rslides">
						<?php foreach ($this->listAllGalleries as $row) { 
							if (!empty($row['URL'])) { ?>
							<li><img src="<?php echo $this->baseUrl.'/'.Utils_Tool::find_thumb($row['URL'], $currentWithThumb);?>" /></li>
						<?php } } ?>  
						</ul>
					</div>	
				</div>
				<div class="page-footer">&copy; <?php echo $this->siteName; ?></div>
			</div>		
				<?php
				break;
		}
	} else if (isset($this->listAllArticles) && !empty($this->listAllArticles)) { ?>

			<div class="submenu">
			<?php foreach ($this->listAllArticles as $row) { 
				if (!empty($row['CONTENT_SHORT'])) { ?>
				<a href="#article-<?php echo $row['ID'];  ?>" class="custom_font filter"><?php echo $row['CONTENT_SHORT'];  ?></a>
			<?php }
			} ?>
			</div>
			<div class="scroll-pane">
				<div class="page_block">

					<?php foreach ($this->listAllArticles as $row) { ?>
					<div id="article-<?php echo $row['ID'];  ?>">
						<?php echo $row['CONTENT']; ?>
					</div>
					<?php } ?>
					<div class="clear"></div>
				</div>
				<div class="page-footer">&copy; <?php echo $this->siteName; ?></div>
			</div>

	<?php } ?>
	</div>
<?php } ?>
		modules/default/views/scripts/produits/ajaxshowpromoprice.phtml000060400000002325150710367660021340 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1');

if ($this->currentData) {
	$currentData = $this->currentData;
if ($currentData['isDEVIS'] == 1) { 
			if ($currentData['isPROMO'] == 0) { ?> 
			<div class="productDetail_priceBox" <?php if ($currentData['PROMOPRIX'] > 999) { echo 'style="width:165px;"'; } ?>>   
		 		<div class="productDetail_promoImag hidden-print" >
					<img class="tooltips" data-placement="bottom" src="<?php echo $this->baseUrl; ?>/business/image/promo.png" alt="Ce produit est en promotion" title="Ce produit est en promotion" >
				</div>
		 		<div class="productDetail_price" >
			 		 <div class="text12" >
					 	<?php echo number_format($currentData['PROMOPRIX'], 2, ',', ' ').' ';?>
					 	<span style="color: #000000">&#8364;</span> 
					 </div>
					 <div>
					 	<span class='oldPromoPrice'> <?php echo number_format($currentData['PRIX'], 2, ',', ' ').' ';?>&#8364;</span>
					 </div>
		 		</div> 
			</div>
		<?php } else { ?> 
				<div class="text12" >
					<?php echo number_format($currentData['PRIX'], 2, ',', ' ').' ';?>
					<span style="color: #000000">&#8364;</span>
				</div> 
		<?php } 
	 } else { ?> 
			<div  class="text12">
				<span>sur devis</span>
			</div> 
	<?php }} ?>modules/default/views/scripts/produits/nosmarquesdetail.phtml000060400000000626150710367660020776 0ustar00
<?php $brend = $this->brends; ?>
<div class="page-header">
  <div class="col-xs-6 col-md-3">
    <a href="#" class="thumbnail">
      <img src="<?php echo $this->baseUrl."/".$brend["URL"]; ?>" alt="<?php echo $brend["BREND"]; ?>" />
    </a>
  </div>
  <h1><?php echo $brend["BREND"]; ?><small><?php echo $brend["DESCRIPTIONSHORT"]; ?></small></h1>
  <p><?php echo $brend["DESCRIPTIONLONG"]; ?></p>
</div>modules/default/views/scripts/produits/recherche.phtml000060400000002134150710367660017342 0ustar00

<div id="productContainer" class="col-md-12 noPadding">

<?php 
$listProducts = array();
$listProducts = $this->listSearchPages;
$listCat = array();
$listCat = $this->listCat;

echo $this->render("/produits/ajaxfacets.phtml");
?>

<div class="col-md-12 prod-detail-title-box noPadding" id="prod-search-title">
	<h1 class="prod-detail-title ">
		<?php if (sizeof($listProducts) == 0) { 
			if (strlen($this->searchKey) > 0) { ?>
			<span >Votre recherche de "<span ><?php echo $this->searchKey; ?></span>" n'a retourn�e aucun r�sultats </span>
			<?php } else { ?>
			<span >Votre recherche n'a retourn�e aucun r�sultats </span>
			<?php }
		} else { ?>
			<span>R�SULTATS DE LA RECHERCHE : "<span ><?php echo $this->searchKey; ?></span>"</span>
		<?php } ?>
	</h1>
</div>


  <div id="productContents">
    <?php
  if (!empty($listProducts)) { 
	  foreach ($listProducts as $row) {
		  $this->currentData = $row;
		  echo $this->render("/produits/ajaxshowproductbox.phtml");
	  } 
  } 
  ?>
  </div>

  <script type="text/javascript">
  $(document).ready(function() {
    initSearch();
    });
  </script>

</div>
modules/default/views/scripts/produits/detailmobile.phtml000060400000032275150710367660020055 0ustar00
<?php
$product = $this->detailProduct;
$userNamespace = new Zend_Session_Namespace($this->session_variable);
$myCaddy = $userNamespace->myObjectCaddy;
$nbOption = 3;
?>
 <style>
   .productPriceDetailBox {
    position:relative;
   }
 </style>

  <div class="col-xs-12 prod-detail-box noPadding">
    <div class="col-xs-12 prod-detail-title-box noPadding"> 
      <div class="noPadding">
        <h1 class="prod-detail-title "><?php echo $this->escape($product['NOM']); ?></h1>
      </div>
    </div>
    
    <div class="col-xs-12 noPadding">
      <div class='prod-detailimg-mobile-content'>
          <div class='prod-detailimg-mobile-main' style='<?php $width = 300 * sizeof($product['LISTPICS']); echo 'width:'.$width.'px';  ?>'>
            <ul >
              <?php    foreach ($product['LISTPICS'] as $pic) { ?>
	                <li class='prod-detailimg-mobile-content-li'>
                      <div class="col-xs-12">
                        <?php if (!empty($pic['STRING1'])) {  
			                    echo $pic['STRING1'].'<br/>';
		                    } if (!empty($pic['STRING2'])) {
			                    echo $pic['STRING2'] ;
		                    } ?>
                      </div>
                      <div class="col-xs-12 prod-detailimg-mobile noPadding">
                        <center><a href="<?php echo $this->baseUrl.'/'.$pic['URL']; ?>" title="<?php echo $this->escape($pic['STRING1'].' '.$pic['STRING2']) ; ?>">
                          <img src="<?php echo $this->baseUrl.'/'.$pic['URL']; ?>" alt="<?php echo $this->escape($pic['STRING1']) ; ?>" />
                        </a></center>
                      </div>
                  </li>
		            <?php } ?>
            </ul>
          </div>
      </div>
      
      <div  class="col-xs-12">
          <?php $url = "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]; ?>
          <a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $url; ?>" class="btn btn-facebook"><i class="fa fa-facebook"></i></a>
          <a target="_blank" href="https://plus.google.com/share?url=<?php echo $url; ?>" class="btn btn-google-plus"><i class="fa fa-google-plus"></i></a>
          <a target="_blank" href="https://twitter.com/home?status=<?php echo $url; ?>" class="btn btn-twitter"><i class="fa fa-twitter"></i></a>
          <a target="_blank" href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo $url; ?>&title=<?php echo utf8_encode($this->escape($product['NOM'])); ?>&summary=<?php echo utf8_encode($this->escape($product['DESCSHORT'])); ?>&source=<?php echo $this->baseUrl_SiteCommerceUrl; ?>" class="btn btn-linkedin"><i class="fa fa-linkedin"></i></a>
        
          <?php  if ($this->FeatureProductSendDetail) { ?>
            <a href="#dialog-form-send-friend" class="btn btn-default popup-with-form-send-friend"><i class="fa fa-envelope"></i> Conseillez cet article</a>
          <?php  } ?>
      </div>
  </div>
  
    
  <div class="col-xs-12 prod-detail-title ">Nos R�f�rences</div>
    
  <div class="col-xs-12">
      <form id="productAddForm" action="<?php echo $this->baseUrl; ?>/produits/ajaxaddpanier/<?php echo $product['NAVNOM']; ?>/p/<?php echo $product['ID']; ?>" method="post">
        <input type="hidden" name="idProd" id="idProd" value="<?php echo $this->escape($product['ID']); ?>" />
          <?php
	        $index = 1;
	        $count = 0;
	        if (sizeof($product['LISTCHILD']) > 0) {
		        foreach($product['LISTCHILD'] as $child) {  
						    if (isset($child['DESIGNATION']) && !empty($child['DESIGNATION'])) { ?>
			    <div class="col-xs-12"><?php echo $child['DESIGNATION'];?> ( Ref. <?php echo $this->escape($child['REFERENCE']); ?> )</div>
          
          <?php for($i=0 ; $i<$nbOption; $i++) {
				    if (isset($product['LISTOPTION'][$i]) && isset($product['LISTOPTION'][$i]['NOMOPTION']) && isset($child['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']])) { ?>
			      <div class="col-xs-12 noPadding" style="margin-top:10px;">
              <div class="col-xs-6 noPadding"><b><?php echo $this->escape($product['LISTOPTION'][$i]['NOMOPTION']); ?> : </b></div>
              <div class="col-xs-6 noPadding">
                <?php echo $this->escape($child['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']]['OPTIONVALUE']);  ?>
              </div>
            </div>
			    <?php } } ?>
          
          
			    <?php  if ($product['ONSELECT_IDOPTION'] > 0  && !empty($product['ONSELECT_OPTION'])) { ?>
			    <div class="col-xs-12 noPadding"  style="margin-top:10px;">
            <div class="col-xs-6 noPadding"><b><?php  $optionsList = $product['ONSELECT_OPTION']; echo $optionsList->name; ?> : </b></div>
            <div class="col-xs-6 noPadding">
              <select name="selectedOption_<?php echo $count; ?>" class="selectedOption form-control">
				        <?php
				            foreach($optionsList->values as $currentOption) {  ?>
				            <option value="<?php echo $currentOption; ?>"><?php echo $currentOption; ?></option>
				        <?php } ?>
			        </select>
             </div>
          </div>
			    <?php } ?>
          
          <div class="col-xs-12 noPadding"  style="margin-top:10px;">
            <?php if (!$this->isProductOutOfStock) { ?>
			        <div class="col-xs-6 noPadding">
                <div class="col-xs-6 noPadding"><b>Quantit� : </b></div>
                <div class="col-xs-6 noPadding">
                    <?php  if (isset($myCaddy->items))  { $myValue = $myCaddy->getQuantity($child['ID']); } ?> 
                  <input onclick="clearById('quantity_<?php echo $this->escape($child['ID']); ?>', '0')"
				          type="text" class="form-control text-center" maxlength="5" name="quantity_<?php echo $this->escape($child['ID']); ?>"
				          id="quantity_<?php echo $this->escape($child['ID']); ?>" value="<?php echo $myValue; ?>" /> 
                  <input type="hidden" name="idChild_<?php echo $count; ?>" value="<?php echo $this->escape($child['ID']); ?>" /> 
                  <input type="hidden" name="qtyMinChild_<?php echo $count; ?>" value="<?php echo $this->escape($child['QUANTITYMIN']); ?>" /> 
                  <input type="hidden" name="isAccessoire_<?php echo $count; ?>" value="N">
                </div>
              </div>
            <?php } ?>
            <div>
              <?php $this->currentData = $child; echo $this->render("/produits/ajaxshowpromoprice.phtml"); ?>
            </div>
          </div>
          
          <div class="col-xs-12 noPadding">
            <div class="col-xs-12 noPadding">
              <?php if (!$this->isProductOutOfStock) { ?>
                <div class="col-xs-12 noPadding text-center">
                  <button type="submit" class="btn btn-success btn-lg">
                    <img id="prod-detail-add-btn" src="<?php echo $this->baseUrl; ?>/business/image/add-caddy.png" class="glyphicon-caddy" /> AJOUTER AU PANIER
                  </button> 
                </div> 
              <?php } else { ?>
                <span class="btn btn-success btn-lg">Le produit est �puis�</span>
              <?php } ?>
            </div>
          </div>
		  <?php $count++; } } } ?>
    
    <?php
	        if (sizeof($product['PRODUCT_ACCESSOIRE']) > 0) {
		        foreach($product['PRODUCT_ACCESSOIRE'] as $child) {  
						    if (isset($child['DESIGNATION']) && !empty($child['DESIGNATION'])) { ?>
			    <div class="col-xs-12"><?php echo $child['DESIGNATION'];?> ( Ref. <?php echo $this->escape($child['REFERENCE']); ?> )</div>
          
          <?php for($i=0 ; $i<$nbOption; $i++) {
				    if (isset($product['LISTOPTION'][$i]) && isset($product['LISTOPTION'][$i]['NOMOPTION']) && isset($child['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']])) { ?>
			      <div class="col-xs-12 noPadding" style="margin-top:10px;">
              <div class="col-xs-6 noPadding"><b><?php echo $this->escape($product['LISTOPTION'][$i]['NOMOPTION']); ?> : </b></div>
              <div class="col-xs-6 noPadding">
                <?php echo $this->escape($child['OPTION_VALUES'][$product['LISTOPTION'][$i]['IDOPTION']]['OPTIONVALUE']);  ?>
              </div>
            </div>
			    <?php } } ?>
          
          
			    <?php  if ($product['ONSELECT_IDOPTION'] > 0  && !empty($product['ONSELECT_OPTION'])) { ?>
			    <div class="col-xs-12 noPadding"  style="margin-top:10px;">
            <div class="col-xs-6 noPadding"><b><?php  $optionsList = $product['ONSELECT_OPTION']; echo $optionsList->name; ?> : </b></div>
            <div class="col-xs-6 noPadding">
              <select name="selectedOption_<?php echo $count; ?>" class="selectedOption form-control">
				        <?php
				            foreach($optionsList->values as $currentOption) {  ?>
				            <option value="<?php echo $currentOption; ?>"><?php echo $currentOption; ?></option>
				        <?php } ?>
			        </select>
             </div>
          </div>
			    <?php } ?>
          
          <div class="col-xs-12 noPadding"  style="margin-top:10px;">
            <?php if (!$this->isProductOutOfStock) { ?>
			        <div class="col-xs-6 noPadding">
                <div class="col-xs-6 noPadding"><b>Quantit� : </b></div>
                <div class="col-xs-6 noPadding">
                    <?php  if (isset($myCaddy->items))  { $myValue = $myCaddy->getQuantity($child['ID']); } ?> 
                  <input onclick="clearById('quantity_<?php echo $this->escape($child['ID']); ?>', '0')"
				          type="text" class="form-control text-center" maxlength="5" name="quantity_<?php echo $this->escape($child['ID']); ?>"
				          id="quantity_<?php echo $this->escape($child['ID']); ?>" value="<?php echo $myValue; ?>" /> 
                  <input type="hidden" name="idChild_<?php echo $count; ?>" value="<?php echo $this->escape($child['ID']); ?>" /> 
                  <input type="hidden" name="qtyMinChild_<?php echo $count; ?>" value="<?php echo $this->escape($child['QUANTITYMIN']); ?>" /> 
                  <input type="hidden" name="isAccessoire_<?php echo $count; ?>" value="Y">
                </div>
              </div>
            <?php } ?>
            <div>
              <?php $this->currentData = $child; echo $this->render("/produits/ajaxshowpromoprice.phtml"); ?>
            </div>
          </div>
          
          <div class="col-xs-12 noPadding">
            <div class="col-xs-12 noPadding">
              <?php if (!$this->isProductOutOfStock) { ?>
                <div class="col-xs-12 noPadding text-center">
                  <button type="submit" class="btn btn-success btn-lg">
                    <img id="prod-detail-add-btn" src="<?php echo $this->baseUrl; ?>/business/image/add-caddy.png" class="glyphicon-caddy" /> AJOUTER AU PANIER
                  </button> 
                </div> 
              <?php } else { ?>
                <span class="btn btn-success btn-lg">Le produit est �puis�</span>
              <?php } ?>
            </div>
          </div>
		  <?php $count++; } } } ?>
          
      <input type="hidden" name="nbr" value="<?php echo $count; ?>" />
      <div id="productAddFormLog"></div>
    </form>
  </div> 
    
  <div class="col-xs-12 noPadding"> 
      <div class="col-xs-12">
        <?php if ($this->escape($product['BRENDURL']) && $product['isSHOWBREND'] == 0) {?>
          <img class="prod-detail-brend tooltips" title="<?php echo $this->escape($product['BREND']); ?>"
	          src="<?php echo $this->baseUrl.'/'.$product['BRENDURL']; ?>"
	          alt="<?php echo $product['BREND']; ?>"
	          title="<?php echo $product['BREND']; ?>" /> 
        <?php } 
        if ($product['isQTEPRIXACTIVE']) { ?>
          <img class="tooltips" data-placement="right"
	          alt="D�couvrez nos prix d�gressif" title="D�couvrez nos prix d�gressif"
	          src="<?php echo $this->baseUrl; ?>/business/image/header/degressif2.png">
	      <?php } ?>
        <div class="prod-detail-price">
          <?php if ($product['isDEVISPRODUCT'] == 1) { ?>
            <div class="productPriceDetailBox"><span class="productPriceTitle" style="float: right;">� partir de</span><br />
              <span class="productPriceDetail"><?php echo number_format($product['PRIXLOWEST'], 2, ',', ' ').' '; ?> &#8364;</span> <span class="productPriceDetailHT" style="float: right;"> HT</span></div>
	        <?php } else { ?>
            <div class="productPriceDetailBox"><span class="productPriceTitle" style="margin-left: 10px; margin-top: 5px">Sur devis</span></div>
	        <?php } ?>
        </div>
      
        <h2 class="prod-detail-desc"><?php echo strip_tags($product['DESCSHORT']); ?></h2>
      </div> 
      <?php if (!empty($product['DESCLONG'])) { ?>
      <div class="col-xs-12 prod-detail-title ">Description</div>
      <div class="col-xs-12"> 
          <?php echo $product['DESCLONG']; ?>
      </div>
      <?php } ?>
      <?php if (!empty($product['DESCTECH'])) { ?>
      <div class="col-xs-12 prod-detail-title ">Informations techniques</div>
      <div class="col-xs-12"> 
          <?php echo $product['DESCTECH']; ?>
      </div>
      <?php } ?>
      <?php if (!empty($product['DESCNORME'])) { ?>
      <div class="col-xs-12 prod-detail-title ">Normes</div>
      <div class="col-xs-12"> 
          <?php echo $product['DESCNORME']; ?>
      </div>
      <?php } ?>
  </div>
  <script type="text/javascript">
  $(function(){
	  initEventDetail(); 
  }); 
  </script> modules/default/views/scripts/produits/ajaxshowproductbox.phtml000060400000007320150710367660021352 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1');

$prefixClass = $this->prefixPromoClass;

if ($this->currentData) {
	$row = $this->currentData;
	$paginationPage = "";
	if (!empty($this->currentPaginationPage)) {
		$paginationPage = "prod-pagination prod-pagination-".$this->currentPaginationPage;
	}
	$link = "";
	if(isset($row['PRODUCT_URL'])) {
		$link = $this->baseUrl."/".$row['PRODUCT_URL'];
	} else if (isset($row['NAVNOM'])) {
		$link = $this->baseUrl."/".Utils_Tool::getFormattedUrlProduct($row['NAVNOM_URLPARENTS'], $row['NAVNOM'], $row['ID']);
	} else if (isset($row['PRODNAVNOM'])){
		$link = $this->baseUrl."/".Utils_Tool::getFormattedUrlProduct($row['NAVNOM_URLPARENTS'], $row['PRODNAVNOM'], $row['ID']);
	}
		$name = $this->escape($row['NOM']);
		$desc = $row['DESCSHORT'];
		$nametitle = $name;
		$brendurl= '';
		if ($row['isSHOWBREND'] == 0) {
			$nametitle =  strtoupper($row['BREND'].' - ').$name;
			$brendurl = $row['BRENDURL'];
		} 
		$nametitle = $this->escape($nametitle);

		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());
		$descFiltered = $filter->filter($desc);
	?>	
 
 <div class="col-md-3 col-sm-4 col-xs-12 categorieBoxContent  <?php echo $paginationPage; ?>">
		<div class="productBox text-center">
			<div class="col-xs-12 productHeader noPadding">
				<?php  if ($row['isSHOWBREND'] == 0) { ?>
					<img src="<?php echo '/'.$this->escape($row['BRENDURL']); ?>" alt="<?php echo $nametitle; ?>"/>
				<?php } ?>
				<?php if ($row['isPROMO'] == 0) { ?>
					<div >
						<img class="tooltips" data-placement="top" alt="Ce produit est en promotion" title="Ce produit est en promotion" src="<?php echo $this->baseUrl; ?>/business/image/promo.png" />
					</div>
				<?php } else if ($row['isPRIXDEGRESSIF']) { ?>
					<div>
						<img alt="Les prix sont d�gressifs" src="<?php echo $this->baseUrl; ?>/business/image/prixdeg.png" />
					</div>
				<?php } ?>
			
				<?php if ($row['isDEVISPRODUCT'] == 1) { ?>
					<div class="productPriceBox">
						<span class="<?php echo $prefixClass; ?>productPriceTitle" >� partir de</span><br />
						<span class="<?php echo $prefixClass; ?>productPrice" ><?php echo number_format($row['PRIXLOWEST'], 2, ',', ' ').' '; ?> &#8364;</span>
						<span class="<?php echo $prefixClass; ?>productPriceHT">HT</span>
					</div>
				<?php } else { ?>
					<div class="productPriceBox">
						<span  class="productPrice" style="margin-left: 10px; margin-top: 5px">Sur devis</span>
					</div>
				<?php } ?>
			</div>
			<div class="col-xs-12 noPadding">
				<center><a title="<?php echo $descFiltered;?>" class="tooltips" data-placement="bottom" href="<?php echo $link;?>" >
					<span class="categorieBoxImg">
						<img src="<?php echo '/'.$this->escape($row['URL']); ?>" alt="<?php echo $nametitle; ?>"/>
					</span>
				</a></center>
			</div>
			<div class="col-xs-12 noPadding  text-left">
				<div class="productBoxTitleContent">
					<a class="productBoxTitle"  href="<?php echo $link;?>" >
						<?php echo $name; ?>
					</a>
				</div>
			</div>
			<div class="col-xs-12 productBoxDesc text-left">
				<?php echo $desc; ?>
			</div>
			<div class="col-xs-12 productBoxTitleSubContent">
				<a class="col-xs-12 <?php echo $prefixClass; ?>productBoxTitleGo tooltips" data-placement="bottom" title="<?php echo $nametitle;?>" href="<?php echo $link;?>" >
					Voir la fiche produit
					<?php 
						$filter = new Zend_Filter();
						$filter	->addFilter(new Zend_Filter_StripTags())
						->addFilter(new Zend_Filter_StringTrim());
					?>
					<img src="/business/image/<?php echo $prefixClass; ?>category-icon.png" alt="<?php echo $descFiltered; ?>"  style="margin-left: 15px;">
				</a>	
			</div>
		</div>
	</div>

<?php } ?>modules/default/views/scripts/produits/nosmarques.phtml000060400000002063150710367660017610 0ustar00
<div>
  <div class="col-xs-12 prod-detail-title-box noPadding">
      <h1 class="prod-detail-title ">
        Nos marques
      </h1>
  </div>
  
  <?php
  foreach ($this->brends as $row) { 
  $link = $this->baseUrl."/nos-marques/".Utils_Tool::generateNavigationString($row['BREND'])."-".$row['IDBREND'].".html";
  ?>
  <div class="col-md-3 col-sm-4 col-xs-6 categorieBoxContent nolink">
    <a href="<?php echo $link; ?>">
    <div class="productBox text-center">
      <div class="col-xs-10 col-xs-offset-1 noPadding">
          <span class="categorieBoxImg">
            <img src="<?php echo $this->baseUrl; ?>/<?php echo $this->escape($row['URL']); ?>" alt="<?php echo $row['BREND']; ?>"/>
          </span>
      </div>
      <div class="col-xs-12 noPadding  text-left">
        <div class="productBoxTitleContent">
            <?php echo $row['BREND']; ?>
        </div>
      </div>
      <div class="col-xs-12 productBoxDesc text-left" style="height:auto">
        <?php echo $row['DESCRIPTIONSHORT']; ?>
      </div>
    </div>
    </a>
  </div>
  <?php } ?>
</div>modules/default/views/scripts/produits/ajaxshowallproducts.phtml000060400000002160150710367660021512 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?>  
<?php if (isset($this->listAllProducts) && !empty($this->listAllProducts)) { 
	 //$color = "none";
	 $color = $this->actualDesign['color']; 
		foreach ($this->listAllProducts as $row) { 
			$link = $this->baseUrl."/".Utils_Tool::getFormattedUrlProduct($row['NAVNOM_URLPARENTS'], $row['PRODNAVNOM'], $row['ID']);
			$desc = $this->escape($row['DESCSHORT']);
			$name = $this->escape($row['NOM']);
		?>  
	 <div class="col-md-3 categorieBoxContent">
		<div class="categorieBox text-center">
			<div class="col-md-10 col-md-offset-1 noPadding">
				<a class="tooltips" data-placement="bottom" title="<?php echo $desc;?>" href="<?php echo $link;?>" >
					<span class="categorieBoxImg">
						<img src="<?php echo '/'.$this->escape($row['URL']); ?>" alt="<?php echo $name; ?>"/>
					</span>
				</a>
			</div>
			<div class="col-md-12 noPadding categorieBoxTitleContent">
				<a class="categorieBoxTitle tooltips" data-placement="bottom" title="<?php echo $desc;?>" href="<?php echo $link;?>" >
					<?php echo $name; ?>
				</a>
			</div>
		</div>
	</div>
<?php } }?>		
	 modules/default/views/scripts/services/faq.phtml000060400000003426150710367660016140 0ustar00<!--[if IE]>
<style type="text/css">
.textA16, .textA15 {
  filter: glow(color=#ffffff,strength=1);
}
.linkA16, .linkA15 {
  filter: glow(color=#ffffff,strength=1);
}
</style>
<![endif]-->
<div class="spaceBG2" style="clear: both;"></div>
<div class="faq_container">
	<div class="faq_container1">
		<div class="faq_containerType">
			<div class="linkA16" style="clear:both;margin: 5px 0 0 10px; text-align:left;"><a href="<?php echo $this->baseUrl; ?>/services/faq/" title="Foire aux questions">FAQ</a></div>
			<div class="linkA15" style="clear:both;margin: 0 0 0 10px; text-align:left;"><a href="<?php echo $this->baseUrl; ?>/services/faq/" title="Foire aux questions">La solution <br/>� vos questions</a></div>
		</div>
			<?php $i = 0; foreach($this->faqType as $row) { ?>
				<div class="faq_typeLink"><div class="linkA4" style="margin: 5px 0 0 0;"><a href="javascript:;" onclick="javascript:showFAQ('<?php echo $row['ID']; ?>');"><?php echo $row['NOM'];?></a></div></div>
			<?php } ?>
	</div>
	<div class="faq_container2">
	<?php $lastType = ""; 
		foreach($this->faqs as $row) { 
		if ($lastType != $row['IDTYPE']) { $lastType = $row['IDTYPE'];?>
			<div class="faq_type faq_typeV_<?php echo $row['IDTYPE']; ?> textA14" >
				<span><?php echo $row['NOMTYPE'];?></span>
			</div>
		<?php } ?>
		<div class="faq_content faq_contentV_<?php echo $row['IDTYPE']; ?>" >
			<div class="faq_contentOpt">
				<div class="textA4" style="float: left;width: 30px;">Q :</div>
				<div class="textA3" style="float: left;width: 470px"><?php echo $row['QUESTION'];?></div>
			</div>
			<div class="faq_contentOpt">
				<div class="textA4" style="float: left;width: 30px;">R :</div>
				<div class="textA3" style="float: left;width: 470px;"><?php echo $row['REPONSE'];?></div>
			</div>
		</div>
		<?php } ?>
	</div>
</div>modules/default/views/scripts/services/information.phtml000060400000000447150710367660017716 0ustar00<?php $service = $this->service; ?>
<div class="col-xs-12 indexBox3_title" style="margin-top: 10px;"><?php echo $service['TITRE']; ?></div>
<div class="col-md-12" style="padding-top: 10px; padding-bottom: 10px;border: 1px solid #ccc;margin-top: 10px;">
	<?php echo $service['CONTENT']; ?>
</div>modules/default/views/scripts/pagination.phtml000060400000002247150710367660015677 0ustar00<?php if ($this->pageCount): ?>
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="margin-top:15px;">
	<tr>
		<td width="200" style="text-align:right;">
			<span class="footer_menus" >
				<!-- Previous page link --> 
				<?php if (isset($this->previous)) { ?> 
				  <a href="<?php echo $this->url(array('page' => $this->previous)); ?>">&lt; <?php echo "Pr�c�dent"; ?></a> 
				<?php } ?> 
			</span>								
		</td>
		<td style="text-align:center;">
			<span class="link2">
				<!-- Numbered page links -->
				<?php foreach ($this->pagesInRange as $page) { ?> 
				  <?php if ($page != $this->current) { ?>
				    <a href="<?php echo $this->url(array('page' => $page)); ?>"><?php echo $page; ?></a> 
				  <?php  } else { ?>
				    <span ><?php echo $page; ?></span>
				  <?php } 
				   if ($this->last != $page) { echo '|';} 
				    } ?>
			</span>								
		</td>
		<td width="200">
			<span class="footer_menus">
				<!-- Next page link --> 
				<?php if (isset($this->next)) { ?> 
				  <a href="<?php echo $this->url(array('page' => $this->next)); ?>"><?php echo "Suivant" ?> &gt;</a>
				<?php } ?> 
			</span>								
		</td>
	</tr>
</table>
<?php endif; ?>modules/default/views/scripts/ajax/ajaxvalue.phtml000060400000000144150710367660016443 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?>
<?php echo $this->messageSuccess; ?>modules/default/views/scripts/ajax/ajaxlivraison.phtml000060400000001540150710367660017336 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?>
<?php 
$marginTop = 30;
if (isset($this->messageSuccess) && !empty($this->messageSuccess)) {?>
<div class="alert alert-success  text-center"><?php echo $this->messageSuccess; ?></div>
<?php $marginTop = 0; } 
 if (isset($this->messageError) && !empty($this->messageError)) { ?>
<div class="alert alert-danger  text-center"><?php echo $this->messageError; ?></div>
<?php $marginTop = 0; }?>

<div class="cmdLivResultOpt textA7" style="margin: <?php echo $marginTop.'px'; ?> 0 0 10px;"><?php echo $this->adresseLiv['raisonsocial']; ?></div>
<div class="cmdLivResultOpt"><?php echo $this->adresseLiv['adresse']; ?></div>
<div class="cmdLivResultOpt"><?php echo $this->adresseLiv['cp']." ".$this->adresseLiv['ville'];  ?></div>
<div class="cmdLivResultOpt"><?php echo $this->adresseLiv['pays']; ?></div>
modules/default/views/scripts/ajax/ajaxaccount.phtml000060400000004244150710367660016770 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?>

<?php 
	$auth = Zend_Auth::getInstance();
	$auth->setStorage(new Zend_Auth_Storage_Session($this->session_storage));
	$storage = $auth->getStorage()->read(); 

if (isset($this->messageError) && !empty($this->messageError)) { ?> 
<script type="text/javascript"> 
	 $(function(){
		 $('#leftUserMessage').css({'display':'block'}).html('<?php echo $this->messageError; ?>');
	});
</script>
<?php }
 
 if ($auth->hasIdentity() && isset($storage['user'])) { ?>
<div class="leftUserDeconnecte" >
	<a href="javascript:;" id ="accountLeftLogout" title="Pour vous déconnecter" class="tooltips" data-placement="top"><img src="<?php echo $this->baseUrl; ?>/business/image/deconnexion.png" /></a>
	
</div>
<div class="leftUserContent"> 
	<div class="leftUserFormText" <?php if ($auth->hasIdentity() && isset($storage['user'])) {  echo 'style="display: block"';  } else {  echo 'style="display: none"'; } ?>>
		Bonjour,<br/>
		<span id="ajaxNameUser" ><?php 
			if ($auth->hasIdentity() && isset($storage['user'])) {
				echo $storage['user']['prenom'].' '.$storage['user']['nom']; 
			 }?>	
		</span>
	</div> 
</div>
<div class="leftUserAccountBtn">
	<a href="<?php echo $this->baseUrl; ?>/mon-compte.html" title="Accéder à votre espace"><img alt="" style="margin: 0; padding: 0" src="<?php echo $this->baseUrl; ?>/image/header/my_space.png" /></a>
</div>
<?php } else { ?>
<div class="leftUserTitleForm"><span class="link_shadow18_r" ><a href="javascript:;" onclick="javascript:sendUserLeftConnect();" title="Me connecter à mon compte">Mon Compte</a></span></div>
<div class="leftUserContent leftUserFormText" >
	<div class="leftUserForm">
		<form id="connexionFormLeft" method="post" >	  
			<div class="leftUserFormInput">
				<input type="text" name="connexionleft_login" id="connexionleft_login" value="Identifiant" onfocus="clearById('connexionleft_login',new Array('Identifiant'));"/>
			</div>
			<div class="leftUserFormInput">
				<input type="password" name="connexionleft_mdp" id="connexionleft_mdp" value="Mot de passe" onfocus="clearById('connexionleft_mdp',new Array('Mot de passe'));"/>
			</div>
		</form>
	</div>  
</div>
<?php } ?> 
			modules/default/views/scripts/ajax/ajaxcaddy.phtml000060400000031556150710367660016426 0ustar00
<?php header('Content-type: text/html; charset=iso-8859-1');  
$myFacture = $this->myFacture;  
if (isset($myFacture) && $myFacture->getNbArticles() == 0) { ?>
<div class="col-xs-12 text-center" style="margin-top: 20px;">Il n'y a aucun article dans votre panier.</div>
<div class="col-xs-12 text-center" style="margin-top: 20px;">
		<a   data-placement="bottom" class="btn btn-default btn-lg" href="<?php if (isset($this->urlCurrentProduct) && !empty($this->urlCurrentProduct)) { echo $this->urlCurrentProduct; } else { echo $this->baseUrl.'/'; } ?>" >
			CONTINUER MES ACHATS
		</a>
</div>
<?php  } else { ?>
<div class="col-xs-12">

<form id="caddyCheckForm" action="<?php echo $this->baseUrl; ?>/produits/ajaxcheckcaddy/" method="post">
	<div style="float: left;width: 100%;">
		<table border="0" cellpadding="0" cellspacing="0" width="100%" class="prod-detail-ref-table">
			<thead>
			<tr align="center" height="50px" style="background-color: #e7e7e7">
				<th class="text-center" style="width: 55%">Produit</th>
				<th class="text-center" style="width: 10%">Dispo.</th>
				<th class="text-center" style="width: 15%">Prix Unitaire (HT)</th> 
				<th class="text-center"  style="width: 10%">Quantit�</th>
				<th class="text-center" style="width: 10%">Prix Total</th>
			</tr>
			</thead>
			<tbody>
			<?php
			$index = 1;
			$i = 0;
			$caddyType_first = true; 
			$isHaveItems = false;
			foreach($myFacture->facture_lines as $row) { 
				if (!$isHaveItems && !$row->isCaddyTypeActif()) { $isHaveItems = true;}
				if (($caddyType_first && $row->isCaddyTypeActif()) && $isHaveItems) { $caddyType_first = false;?>
					<tr>
						<td colspan="5"><div  style="background-color: red;clear:both;width: 500px; height: 1px;margin: 5px auto 5px auto;"></div></td>
					</tr>
				<?php } ?>
			<tr align="center"  height="25px"  style="background-color:<?php if ($index == 0) {echo '#E7E7E7'; $index=1;} else {$index=0; echo '#FFFFFF';} ?>;">
				<td width="400px">
					<div class="caddyProdImg" > 
						<?php if (isset($row->item_isAccessoire) && $row->item_isAccessoire == "N") { ?>
							<a href="<?php echo $this->baseUrl; ?>/<?php Utils_Tool::getFormattedUrlProduct($row->product_navnom_urlparents, $row->product_navnom, $row->product_id); ?>"
								>
								<img src="<?php echo $this->baseUrl.'/'.$row->product_url; ?>">
							</a>
						<?php } ?>
					</div>
					<div class="caddyProdTxt" >
						<div class="link17" style="width: auto;clear:both">
							<a href="<?php echo $this->baseUrl; ?>/<?php echo Utils_Tool::getFormattedUrlProduct($row->product_navnom_urlparents, $row->product_navnom, $row->product_id); ?>">
								<?php echo $row->item_designation;?>
							</a>
						</div>
						<div class="textA1 productDetail_ref">
							<div class="productDetail_ref_label">
								<?php echo "Ref. ".$this->escape($row->item_reference); ?>
							</div>
							<div class="productDetail_ref_selected">
								<?php 
								 if (!empty($row->item_selectedOption) && !empty($row->item_optionsByList)) { 
								  $optionsByList = $row->item_optionsByList;
								 	?>
								 	<select name="selectedOption[]" class="selectedOption form-control">
										<?php foreach($optionsByList->values as $currentOption) {  ?>
										<option value="<?php echo $currentOption; ?>" <?php if ($row->item_selectedOption == $currentOption) { echo 'selected="selected"'; } ?> >
											<?php echo $currentOption; ?> 
										</option>
										<?php } ?>
									</select>   
									<input type="hidden" name="selectedOptionName[]" value="<?php echo $optionsByList->name; ?>" /> 
								<?php } else { ?> 
								<input type="hidden" name="selectedOption[]" value="" /> 
								<input type="hidden" name="selectedOptionName[]" value="" /> 
								<?php } ?>
							</div>
						</div>
					</div>
				</td> 
				<td >
					<?php if ((int)$row->item_stock == 1) { ?>
					<img class="tooltips" alt="Disponible imm�diatement" title="Disponible imm�diatement" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock11.png" class="tooltips">
					<?php } else if ((int)$row->item_stock == 2) { ?>
					<imgclass="tooltips" alt="Disponible sous 8 jours" title="Disponible sous 8 jours" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock22.png" class="tooltips" >
					<?php } else if ((int)$row->item_stock == 3) { ?>
					<img class="tooltips" alt="Nous contacter" title="Nous contacter" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock33.png" class="tooltips">
					<?php }?> 
				
				</td>
				<td valign="middle">
						<?php $this->currentData = $row;
						echo $this->render("/produits/ajaxshowpromopricecaddy.phtml"); ?>
				</td>
				<td valign="middle" align="center">
					<div style="clear:both;width: 90px">
						<div class="col-xs-8 noPadding">
							<input type="text" class="form-control text-center caddyQuantity" maxlength="6" name="Quantity[]" id="Quantity_<?php echo $row->item_id.'_'.$i; ?>" value="<?php echo $row->item_qte; ?>" /> 
						</div>
						<div class="col-xs-4 noPadding">
							<a href="javascript:;" onclick="caddyDeleteByModify($(this), '<?php echo $row->item_id.'_'.$i; ?>')">
								<img alt="Supprimer" class="tooltips" data-placement="right"  title="Supprimer" src="<?php echo $this->baseUrl; ?>/business/image/admin/suppcaddy.png">
							</a>
						</div>
					</div>
					
					<input type="hidden" name="Child[]" value="<?php echo $row->item_id; ?>" /> 
					<input type="hidden" name="QuantityMin[]"  value="<?php echo $row->item_qte_min; ?>" />
					<input type="hidden" name="Accessoire[]" value="<?php echo $row->item_isAccessoire; ?>" /> 
					<input type="hidden" name="CaddyType[]" value="<?php echo $row->caddytype_id; ?>" /> 
				</td>
				<td width="120px" valign="middle">
					<div class="textPriceBox" style="margin: 10px 0 0 0; " >
						<span>
						<?php if (!$row->isSurDevis()) { echo number_format($row->getPrixTotalHT(true), 2, ',', ' ').' &#8364;'; }	 ?>
						</span>
					</div>
				</td>
			</tr>
			<?php $i++; } ?>
			<?php foreach($myFacture->facture_fidelite_lines as $row) { 
		  if ($row->isFideliteGift()) {  ?>
    <tr>
      <td colspan="3">
        <div style="font-weight: bold;margin:10px;">
          <?php echo 'Carte de fid�lit� : '.$row->fidelite_nom.' ('.$row->fidelite_nbpoint.' points)'; ?>
        </div>
      </td>
      <td style="text-align:right">
          <a href="<?php echo $this->baseUrl; ?>/user/deletecaddyfidelitypoint/id/<?php echo $row->fidelite_id; ?>" >
            <img alt="Supprimer" class="tooltips" data-placement="right" title="Supprimer" src="<?php echo $this->baseUrl; ?>/business/image/admin/suppcaddy.png">
          </a>
      </td>
      <td></td>
    </tr>
    <?php }  } ?>
			</tbody>
		</table>
	</div>
</form>
</div>
	<div class="col-xs-12" >
		<div class="col-sm-6 col-xs-12">
		<?php if (!isset($this->isCommandValid)) { ?>
			<div class="textA4" style="clear: both;margin: 20px 0 0 0;">
				Vous b�n�ficiez d'un code de r�duction ?
			</div>
			
			<div id="labelCodeReduc" class="caddyLabelReduc">
				<?php if (isset($this->messageSuccessReduc)) { 
					 if ($this->messageSuccessReduc == "OK") { ?>
					 	<span class="messageSuccess"><?php echo $this->messageMessReduc ?></span>
					 <?php } else { ?>
					 	<span class="messageError"><?php echo $this->messageMessReduc; ?></span>
					<?php }
				} ?>
			</div>
			<div style="clear: both;text-align: center;width: 100%">
				<div class="textA2" style="float: left;margin: 15px 0 0 30px">Saisissez-le ici : </div>
				<div style="float: left; margin: 10px 0 0 10px"><input class="form-control" type="text" name="caddyCodeReduc" id="caddyCodeReduc"></div>
				<div style="float: left;margin: 0 0 0 10px">
					<?php if (isset($myFacture->code_reduction) && !empty($myFacture->code_reduction)) { ?>
					<input type="image" id="submitCodeReduc" src="<?php echo $this->baseUrl; ?>/business/image/admin/btnok.png" >
					<?php } else { ?>
					<input type="image" id="submitCodeReduc" src="<?php echo $this->baseUrl; ?>/business/image/admin/btnnon.png" >
					<?php } ?>
				</div>
			</div>
		<?php }  ?>
	    </div>
		<div class="col-sm-6 col-xs-12" style="padding-right: 0;">
			<div style="float: right;">
				<div class="caddyPrice1 textA3" >Total HR / HT</div>
				<div class="caddyPrice2" >
					<div class="textPriceBox">
						<span><?php echo number_format($myFacture->total_HT_HR, 2, ',', ' '); ?> &#8364;</span>
					</div> 
				</div>
			</div>
			<div style="float: right;">
				<div class="caddyPrice1 textA3" style="color: #1d7f0d; ">Remises sp�cifiques <?php if (isset($myFacture->code_reduction) && !empty($myFacture->code_reduction) ) { echo " ( ".$myFacture->code_reduction['CODE']." ) "; } ?></div>
				<div class="caddyPrice2" >
					<div class="textPriceBox" >
						<span><?php echo number_format($myFacture->getPrixRemise(), 2, ',', ' ') ; ?> &#8364;</span>
					</div>
				</div>
			</div>
			<div style="float: right;">
				<div class="caddyPrice1 textA3" >
					Frais de port
				</div>
				<div class="caddyPrice3" >
					<div class="textPriceBox">
						<span id="showLivraison" > <?php echo number_format($myFacture->total_frais_port, 2, ',', ' '); ?> &#8364;</span>
					</div>
				</div>
			</div>
			
			<div style="float: right;">
				<div class="caddyPrice1 textA3" style="color: #ff0000; height: 31px">TOTAL HT</div>
				<div class="caddyPrice2 textA3" style="color: #ff0000; height: 31px;padding: 5px 0 5px 0; ">
					<div class="textPriceBoxHT" >
						<span id="showTotalHT"><?php echo number_format($myFacture->total_HT_FP, 2, ',', ' '); ?> &#8364;</span>
					</div>
				</div>
			</div>
		</div>
		</div>
	<?php  if (isset($this->isCommandValid)) { ?>
	<div class="col-xs-6 col-xs-offset-3 alert alert-danger text-center" style="margin-bottom: 0px;" >
		<?php echo $this->isCommandValid;  ?>
	</div>
	<?php }
	if (isset($this->resteFrancoLiv)) { ?>
	<div class="col-xs-6 col-xs-offset-3 alert alert-danger text-center" style="margin-bottom: 0px;" >
		<?php   echo $this->resteFrancoLiv; ?>
	</div>
	<?php } ?>
	<div id="caddyCheckFormLog" class="col-xs-12"  style="min-height: 72px;"> </div>
	<div class="col-xs-12"  style="margin-bottom: 40px;">
		<div class="col-md-3 col-sm-6 text-center">
			<input type="button" style="margin-top: 5px; margin-bottom: 5px" class="btn btn-default btn-block" data-placement="bottom" value="CALCULER MON PANIER" id="caddySubmitValid" />
		</div>
		<div class="col-md-3 col-sm-6 text-center">
			<a style="margin-top: 5px; margin-bottom: 5px"  data-placement="bottom" class="btn btn-default btn-block" href="<?php if (isset($this->urlCurrentProduct) && !empty($this->urlCurrentProduct)) { echo $this->urlCurrentProduct; } else { echo $this->baseUrl.'/'; } ?>" >
				CONTINUER MES ACHATS
			</a>
			
		</div> 
		<div class="col-md-3 col-sm-6 text-center">
			<a title="Pour r�aliser un devis"  data-placement="bottom" class="tooltips btn btn-primary btn-lg btn-block caddy-link" href="<?php echo $this->baseUrl; ?>/mon-panier-livraison.html"  >
				DEVIS
			</a>
		</div>
		<?php if (!isset($this->isCommandValid)) { ?>
		<div class="col-md-3 col-sm-6 text-center">
			<a title="Pour passer une commande"  data-placement="bottom" class="tooltips btn btn-success btn-lg btn-block caddy-link" href="<?php echo $this->baseUrl; ?>/mon-panier-livraison.html" >
				COMMANDER
			</a>
		</div>
		<?php } ?>
	</div>


<?php } ?>


<?php if ($this->isCarteFideliteEnable && isset($this->myCaddyFideliteAvailable)) { ?>
<div class="col-xs-12" style="padding-bottom:150px;">
  <h3>Carte de fid�lit�  <a class="btn btn-primary"  href="<?php echo $this->baseUrl; ?>/mon-compte.html#cartefidelite" ><span class="fa fa-user"></span> MES POINTS<?php if (isset($this->myUserFideliteInfo)) {echo ' : '.$this->myUserFideliteInfo['POINTFIDELITETOTAL']; }?></a></h3><hr/>
 	     
  <?php
    foreach($this->myCaddyFideliteAvailable as $row)  { ?>
        <div class="col-md-12">
          <h4><?php echo $row['TITRE'];?> : <?php echo $row['POINTFIDELITE'];?> points</h4>
        </div>
        <div class="col-md-12" style="padding:10px">
          <div class="col-md-10">
            <?php echo $row['CONTENT'];?>
          </div> 
          <div class="col-md-2">
            <a class="btn btn-success"  href="<?php echo $this->baseUrl; ?>/user/addcaddyfidelitypoint/id/<?php echo $row['ID']; ?>" ><span class="fa fa-plus-circle"></span> AJOUTER AU PANIER</a>
		      </div>
        </div>
  <?php }?>
  <?php
    foreach($this->myCaddyFideliteAllExceptCurrents as $row)  { ?>
        <div class="col-md-12">
          <h4><?php echo $row['TITRE'];?> : <?php echo $row['POINTFIDELITE'];?> points</h4>
        </div>
        <div class="col-md-12" style="padding:10px">
          <div class="col-md-10">
            <?php echo $row['CONTENT'];?>
          </div> 
          <div class="col-md-2">
            <a class="btn btn-success" disabled="disabled" href="<?php echo $this->baseUrl; ?>/user/addcaddyfidelitypoint/id/<?php echo $row['ID']; ?>" ><span class="fa fa-plus-circle"></span> AJOUTER AU PANIER</a>
		      </div>
        </div>
  <?php }?>
</div>
<?php } ?>modules/default/views/scripts/ajax/caddyaccountrightnoslide.phtml000060400000011170150710367660021541 0ustar00
<style type="text/css">
    .text-title-slide-red {
        color: #bd2f2c; 
        font-weight:bold;
        font-size: 15px;
    }
    .text-title-slide-gray  {
        color: #5B595A;
    }
    .text-title-slide-gray a:link, .text-title-slide-gray a:visited, .text-title-slide-gray a:active   {
        color: #5B595A;
        text-decoration:underline;
        font-weight:bold;
        font-size: 15px;
    }
    .text-title-slide-gray a:hover {
        color: #5B595A;
        text-decoration:underline;
    }
    .box-right-title-slide-right {
        border: 1px solid #cccccc;
        border-left:none;
    }
    .box-right-border-mid {
        border-top:none;
        border-bottom:none;
    }
    .box-right-vertical-align {
        height:90px;
        text-align:center;
        display: table-cell;
        vertical-align: middle;
        width:250px;
    }
</style>
 

<?php  
  $listProducts = array();
  $listProducts = $this->listAllProductsBestSeller;
  if (!empty($listProducts)) {   ?>
<div class="col-md-3 col-xs-12  noPadding">
  <div class="col-xs-12 noPadding box-bottom-command-title">Meilleures ventes</div>
  <ul>
    <?php  
        $count = 0;
        foreach ($listProducts as $row) {  
          if ($count < 4) {
            if ($row['BOOSTED_BESTSELLER'] > 0) { 
            
	            $nametitle = $this->escape($row['NOM']);
	            $link = "";
	            if (isset($row['NAVNOM'])) {
		            $link = $this->baseUrl."/".Utils_Tool::getFormattedUrlProduct($row['NAVNOM_URLPARENTS'], $row['NAVNOM'], $row['ID']);
	            } else if (isset($row['PRODNAVNOM'])){
		            $link = $this->baseUrl."/".Utils_Tool::getFormattedUrlProduct($row['NAVNOM_URLPARENTS'], $row['PRODNAVNOM'], $row['ID']);
	            }
  ?>
		         <li>
               <a  href="<?php echo $link;?>" >
               <div class="col-xs-6 noPadding">
                 <div  class="col-xs-12 noPadding">
                   <?php  if ($row['isDEVISPRODUCT'] == 1) { ?>
				              <div class="productPriceBox">
					              <span class="productPriceTitle">� partir de</span><br />
					              <span class="productPrice" style="font-size:15px"><?php echo number_format($row['PRIXLOWEST'], 2, ',', ' ').' '; ?>&nbsp;&#8364;</span>&nbsp;<span class="productPriceHT">HT</span>
				              </div>
			              <?php } else { ?>
				              <div class="productPriceBox"><span class="productPrice" style="margin-left: 10px; margin-top: 5px">Sur devis</span></div>
			              <?php } ?>
                 </div>
                 <div  class="col-xs-12 noPadding productBoxImgPreviewContent">
                   <center>
                      <div class="productBoxImgPreview">
                        <img src="<?php echo '/'.$this->escape($row['URL']); ?>" alt="<?php echo $nametitle; ?>" />
                       </div>
                   </center>
                 </div>
               </div>
               </a>
             </li>
    <?php $count++;
            }
          } else {
              break;
          }
        }
      ?>
  </ul>
</div>
<?php  
} else { ?>


<div class="col-md-3 col-xs-12 indexBoxContent" >
    <div class="col-xs-12 text-title-slide-gray box-right-title-slide-right noPadding">
      <a href="<?php echo $this->baseUrl; ?>/blog.html"><img src="/business/image/blog.png" width="250" /></a>
    </div>
    <div class="col-xs-12 text-title-slide-gray box-right-title-slide-right box-right-border-mid" >
        <div class="box-right-vertical-align">
             <a href="mailto:<?php echo $this->serviceClient_Mail;?>?subject=<?php echo 'DEMANDE DE DEVIS EXPRESS';?>&body=Bonjour, " >DEMANDE DE DEVIS EXPRESS</a>
        </div>
    </div>
    <div class="col-xs-12 text-title-slide-gray box-right-title-slide-right text-center noPadding" style="max-height:98px; height:98px;">
		<div class="indexBox4_title1" style="margin: 3px 0 0 0">PAIEMENT <span class="indexBox4_title2">S�CURIS�</span></div>
        <div class="indexBox4_title4" style="margin:6px 0 6px 0">
            <a class="tooltips" placement="bottom" title="" href="/info-14/paiement-securise-et-conditions-de-reglement.html" data-original-title="Paiement s�curis� et conditions de r�glement"></a><a href="http://www.afidistribution.com/info-2/paiement-securise.html" title="" class="tooltips" data-original-title="Paiement s�curis� et conditions de r�glement">
                <img src="/business/image/cardicons.png" alt="Paiement s�curis�" style="height: 30px; vertical-align: middle;" />
            </a>
        </div>
        <div class="indexBox4_title3" style="margin: 0 0 0 0">En partenariat avec la Banque Populaire</div>
    </div>
</div>

<?php } ?>
	modules/default/views/scripts/ajax/caddyaccountright.phtml000060400000007764150710367660020201 0ustar00	<script type="text/javascript"> 
	 $(function(){
		 initEventUserConnectAccountSlide();
	});
</script>
<style type="text/css">
     
        .index-big-box-img {
        display: table-cell;
        vertical-align: middle;
        text-align: right;
        height: 278px;
        width: 764px;
        padding : 0 0 0 0;
        margin : 0 0 0 0;
    }

        .index-big-box-img img {
            max-height: 275px;
            /*max-width: 763px;*/
            padding: 0 0 0 0;
            margin: 0 0 0 0;
        }  

    .slide-category-box-text {
        text-shadow: 1px 1px #fff;
        font-size: 14px;
        line-height: 21px;
        max-width : 650px;
    }

    .slide-category-box-title {
        padding: 15px 15px 15px 15px;
    }

    .slide-category-box-title h1 {
        font-weight: normal;
        font-size: 21px;
        text-transform: uppercase;
        font-weight : bold;
        margin : 0 0 0 0;
        padding: 0 0 0 0;
    }
    .slide-category-box-picture {
        position: absolute;
        bottom: 0;
    }

    .slide-category-box-content {
        position: absolute;
        top: 50px;
        min-width:760px;
    }
      .slide-category-box-content div {
          background-color: rgba(255,255,255,0.8);
          float: left;
          min-width:760px;
      }
    .slide-category-box-bot {
        padding: 5px 15px 5px 15px;
    }

    .slide-category-box-mid {
        padding: 5px 15px 5px 15px;
    }
    .slide-clear {
        clear:both;
    }
</style>
<div class="col-md-12 visible-md visible-lg sliderPanelTop noPadding ">
	<div class="col-md-9 col-xs-12  indexBigBox noPadding">		
		<?php  if ($this->listads) {		?>		
		<div class="liquid-slider liquid-slider-ads" id="slider-category-id">	
		<?php } else { ?>		
		<div class="liquid-slider liquid-slider-ads" >		
		<?php }  
						if ($this->listCat) {
							$listCat = array();
							$listCat = $this->listCat; ?>
			<div class="col-xs-12 index-big-box noPadding" style="overflow: hidden;overflow-y: hidden; ">
				<div class="col-xs-12 noPadding slide-category-box-picture" >
                    
					<div class="index-big-box-img" >
                        <?php if (isset($listCat['URL_SLIDE']) && !empty($listCat['URL_SLIDE'])) { ?>
						    <img src="<?php echo $this->baseUrl."/".$this->escape($listCat['URL_SLIDE']); ?>" class="tooltips" title="<?php echo $this->escape($listCat['NOM']); ?>">
					    <?php } else if (isset($listCat['URL']) && !empty($listCat['URL'])) { ?>		
		                    <img src="<?php echo $this->baseUrl."/".$this->escape($listCat['URL']); ?>" class="tooltips" title="<?php echo $this->escape($listCat['NOM']); ?>">
					    <?php } ?>
                    </div>
				</div>
				<div class="col-xs-12 noPadding slide-category-box-content">
                    <div class="slide-category-box-title">
                            <h1><?php echo $listCat['NOM']; ?></h1>
                    </div>
                        <?php 
						if (isset($listCat['CHOICEDOC']) && !empty($listCat['CHOICEDOC'])) { ?>
                    <div class="slide-clear"></div>
                    <div class="noPadding ">
					    <div class="col-xs-12 index-big-box-title3 text-left slide-category-box-mid" style="background-color : transparent;">
						    <a href="<?php echo $this->baseUrl; ?>/<?php echo $listCat['CHOICEDOC'];?>" target="_blank">
							    <span class="col-xs-12 text-left">Comment choisir le bon produit ?</span>
						    </a>
					    </div>
                    </div>
					    <?php } ?>
                    <div class="slide-clear"></div>
                    <div  class="noPadding text-left slide-category-box-bot"><p class="slide-category-box-text"><?php echo $listCat['DESCRIPTION']; ?></p></div>
				</div>
			</div>
		<?php } 
		 if ($this->listads) {
					$listAnnonce = $this->listads;
					foreach ($listAnnonce as $row) {  ?> 
						<div class="col-xs-12 noPadding"><?php echo $row['CONTENT'];?></div>
			<?php }} ?>
		</div>		
	</div>
	<?php echo $this->render("/ajax/caddyaccountrightnoslide.phtml");?>
</div>
	modules/default/views/scripts/ajax/ajaxmessage.phtml000060400000000706150710367660016757 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?>
<div class="col-xs-6 col-xs-offset-3">
<?php if (isset($this->messageSuccess) && !empty($this->messageSuccess)) {?>
<div class="alert alert-success  text-center"><?php echo $this->messageSuccess; ?></div>
<?php } 
      if (isset($this->messageError) && !empty($this->messageError)) { ?>
<div class="alert alert-danger  text-center"><?php echo $this->messageError; ?></div>
<?php }?>
</div>modules/default/views/scripts/produitspromotion/nosproduits.phtml000060400000006235150710367660021760 0ustar00
<?php
$prefixClass = $this->prefixPromoClass;
if ($prefixClass == "eco-") { ?>
<style type="text/css">
  .footer-content-divider{
  background: url('/business/image/eco-line.png') repeat-x top left;
  height: 15px;
  margin: 10px 0 0 0;
  }
  html, body {
  background: url('/business/image/eco-bg.jpg') no-repeat top center;
  background-color: #21530d;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  }
  .wrapBgContent-l,
  .wrapBgContent-r {
  background:none;
  }
  .wrapBgContent-1 {
  -webkit-box-shadow: 0px 0px 30px rgba(0, 0, 0, 1);
  box-shadow: 0px 0px 30px rgba(0, 0, 0, 1);
  }

  .wrapBgContent-2 {
  -webkit-box-shadow: 0px 20px 30px rgba(0, 0, 0, 1);
  box-shadow: 0px 20px 30px rgba(0, 0, 0, 1);
  }

</style>
<?php } ?>
<script  type="text/javascript" >

$(function(){
	initEventsPromotionCats();
});

</script>
<?php

$listProducts = array();
$listProducts = $this->listAllProducts;
$listCat = array();
$listCat = $this->listCat;
?>
 
<div class="hidden-xs col-md-12 sliderPanelTop noPadding">
	<div class="col-md-9 col-xs-12  indexBigBox">		
		<?php
			$colPromo = "col-xs-12";
			 if ($prefixClass == "eco-") { ?>
			<div class="col-xs-12 index-big-box noPadding <?php echo $prefixClass; ?>bg" style="overflow: hidden;overflow-y: hidden; ">
				<div class="<?php echo $prefixClass; ?>title1">D�couvrer notre</div>
				<div class="<?php echo $prefixClass; ?>title2">Gamme</div>
				<div class="<?php echo $prefixClass; ?>title3">D�veloppement Durable</div>
				<?php 
						if (isset($listCat['CHOICEDOC']) && !empty($listCat['CHOICEDOC'])) { 
						$colPromo = "col-xs-7";?>
					<div class="col-xs-5 <?php echo $prefixClass; ?>choicedoc text-right noPadding">
						<a href="<?php echo $this->baseUrl; ?>/<?php echo $listCat['CHOICEDOC'];?>" target="_blank">
							<span class="col-xs-12 text-center">Comment choisir le bon produit ?</span>						
						</a>
					</div>
					<?php } ?>
				<?php if ($listCat['ID'] != 3) { ?>
				<div class="<?php echo $colPromo;?> <?php echo $prefixClass; ?>title4"><?php echo $listCat['NOM']; ?></div>
				<?php } ?>
			</div>
		<?php }
		if ($prefixClass == "") { ?>
			<div class="col-xs-12 index-big-box noPadding promo-bg" style="overflow: hidden;overflow-y: hidden; ">
				<?php 
					if (isset($listCat['CHOICEDOC']) && !empty($listCat['CHOICEDOC'])) { 
					?>
					<div class="col-xs-5 promo-choicedoc text-right noPadding">
						<a href="<?php echo $this->baseUrl; ?>/<?php echo $listCat['CHOICEDOC'];?>" target="_blank">
							<span class="col-xs-12 text-center">Comment choisir le bon produit ?</span>						
						</a>
					</div>
					<?php } ?>
			</div>
		<?php } ?>
	</div>
	
	<?php echo $this->render("/ajax/caddyaccountrightnoslide.phtml"); ?>
</div>

<?php if ($prefixClass == "") { ?>
<div class="col-xs-12 indexBox3_title" style="margin-top: 10px;margin-bottom: 10px">
  <h1 class="eco-title-h1">
    <?php echo $listCat['NOM']; ?>
  </h1>
</div>
<?php } ?>

<div class="col-xs-12 noPadding">
<?php if (!empty($listProducts)) {  
foreach ($listProducts as $row) {
		$this->currentData = $row;
		echo $this->render("/produits/ajaxshowproductbox.phtml");	
	}
}
	?>	  
</div>modules/default/views/scripts/produitspromotion/categorie.phtml000060400000012325150710367660021326 0ustar00
<script  type="text/javascript" >

$(function(){
	initEventsPromotionCats();
});

</script>
<?php
$listCat = array();
$listCat = $this->listCat;

$prefixClass = $this->prefixPromoClass;
?>

<?php if ($prefixClass == "eco-") { ?>
<style type="text/css">
.footer-content-divider{
	background: url('/business/image/eco-line.png') repeat-x top left;
	 height: 15px;
	 margin: 10px 0 0 0;
}
<?php if ($listCat['IDPARENT'] == 0) { ?>
  html, body {
  background: url('/business/image/eco-bg2.jpg') no-repeat top center;
  background-color: #21530d;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  }
  <?php } else { ?>
  html, body {
  background: url('/business/image/eco-bg1.jpg') no-repeat top center;
  background-color: #21530d;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  }
  <?php } ?>
.wrapBgContent-l,
.wrapBgContent-r {
	background:none;
}
.wrapBgContent-1 {
  -webkit-box-shadow: 0px 0px 30px rgba(0, 0, 0, 1);
          box-shadow: 0px 0px 30px rgba(0, 0, 0, 1);
}

.wrapBgContent-2 {
  -webkit-box-shadow: 0px 20px 30px rgba(0, 0, 0, 1);
          box-shadow: 0px 20px 30px rgba(0, 0, 0, 1);
}

</style>
<?php } ?>

<div class="hidden-xs col-md-12 sliderPanelTop noPadding">
	<div class="col-md-9 col-xs-12  indexBigBox">		
		<?php
			$colPromo = "col-xs-12";
			 if ($prefixClass == "eco-") { ?>
			<div class="col-xs-12 index-big-box noPadding <?php echo $prefixClass; ?>bg" style="overflow: hidden;overflow-y: hidden; ">
				<div class="<?php echo $prefixClass; ?>title1">D�couvrer notre</div>
				<div class="<?php echo $prefixClass; ?>title2">Gamme</div>
				<div class="<?php echo $prefixClass; ?>title3">D�veloppement Durable</div>
				<?php 
						if (isset($listCat['CHOICEDOC']) && !empty($listCat['CHOICEDOC'])) { 
						$colPromo = "col-xs-7";?>
					<div class="col-xs-5 <?php echo $prefixClass; ?>choicedoc text-right noPadding">
						<a href="<?php echo $this->baseUrl; ?>/<?php echo $listCat['CHOICEDOC'];?>" target="_blank">
							<span class="col-xs-12 text-center">Comment choisir le bon produit ?</span>						
						</a>
					</div>
					<?php } ?>
				<?php if ($listCat['ID'] != 3) { ?>
				<div class="<?php echo $colPromo;?> <?php echo $prefixClass; ?>title4"><?php echo $listCat['NOM']; ?></div>
				<?php } ?>
			</div>
		<?php }
		if ($prefixClass == "") { ?>
			<div class="col-xs-12 index-big-box noPadding promo-bg" style="overflow: hidden;overflow-y: hidden; ">
				<?php 
					if (isset($listCat['CHOICEDOC']) && !empty($listCat['CHOICEDOC'])) { 
					?>
					<div class="col-xs-5 promo-choicedoc text-right noPadding">
						<a href="<?php echo $this->baseUrl; ?>/<?php echo $listCat['CHOICEDOC'];?>" target="_blank">
							<span class="col-xs-12 text-center">Comment choisir le bon produit ?</span>						
						</a>
					</div>
					<?php } ?>
			</div>
		<?php } ?>
	</div>
	
	<?php echo $this->render("/ajax/caddyaccountrightnoslide.phtml"); ?>
</div>

<?php if ($prefixClass == "") { ?>
<div class="col-xs-12 indexBox3_title" style="margin-top: 10px;margin-bottom: 10px">
  <h1 class="eco-title-h1">
    <?php echo $listCat['NOM']; ?>
  </h1>
</div>
<?php } ?>

<div class="col-xs-12 noPadding">
	<?php 
	$i = 0;
	$filter = new Zend_Filter_StringToUpper();
	if (!empty($listCat['SUBS'])) {
		
	foreach ($listCat['SUBS'] as $row) {
		$nbProducts = $row['NBPRODUCT'];
		$link = $this->baseUrl."/".Utils_Tool::getFormattedUrlCategory2($row['NAVNOM_URLPARENTS'], $row['NAVNOM'], $row['ID']);
    
		$desc = $this->escape($row['DESCRIPTION']);
		$name = $this->escape($row['NOM']);
		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());
		$descFiltered = $filter->filter($desc);
		?>
		<div class="col-md-3 col-sm-4 col-xs-12 categorieBoxContent">
			<div class="categorieBox text-center">
				<?php if ($prefixClass == "eco-") { ?>
					<div class="eco-tree"></div>
				<?php } ?>
				<div class="col-xs-10 col-xs-offset-1 noPadding">
					<center><a class="tooltips" data-placement="bottom" title="<?php echo $descFiltered;?>" href="<?php echo $link;?>" >
						<span class="categorieBoxImg">
							<img src="<?php echo '/'.$this->escape($row['URL']); ?>" alt="<?php echo $name; ?>"/>
						</span>
					</a></center>
				</div>
				<div class="col-xs-12 <?php echo $prefixClass; ?>categorieBoxTitleContent" >
					<div>
						<a class="<?php echo $prefixClass; ?>categorieBoxTitle" href="<?php echo $link;?>" >
							<?php echo $name; ?>
						</a>
					</div>
				</div>
				<div class="col-xs-12 categorieBoxTitleSubContent">
					<a class="<?php echo $prefixClass; ?>categorieBoxTitle2 tooltips" data-placement="bottom" title="<?php echo $descFiltered;?>" href="<?php echo $link;?>">
						<?php if ($nbProducts > 1) { ?>
						Voir les <?php echo $nbProducts;?> mod�les disponibles
						<?php } else if ($nbProducts == 1) { ?>
						Voir le mod�le disponible
						<?php } else if ($nbProducts == 0) { ?>
						Voir la gamme
						<?php } 
						?>
						<img src="/business/image/<?php echo $prefixClass; ?>category-icon.png" alt="<?php echo $descFiltered; ?>" style="margin-left: 10px;">
					</a>			
				</div>
			</div>
		</div>
	<?php } 
	}
	?>
</div>modules/default/views/scripts/user/ajaxlistdevis.phtml000060400000004457150710367660017403 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); 
 
	$mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
	$moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
if (!empty($this->messageError) || !empty($this->messageSuccess)) { ?>
<div class="userAccount_MessageDevis"> 
	<span class="messageError2" ><?php echo $this->messageError; ?></span>
	<span class="messageSuccess2" ><?php echo $this->messageSuccess; ?></span>
</div>
<?php } ?>
<div class="userAccount_Panel">	
<table class="user-cmd-table" cellpadding="0" cellspacing="0">
	<thead>
	<tr>
		<th class="col-xs-2">Date du devis</th> 
		<th class="col-xs-2">R�f�rence</th> 
		<th class="col-xs-2">Statut</th> 
		<th class="col-xs-2">Prix TTC</th>
		<th style="width: 300px;"></th>
	</tr>
	</thead>
	<tbody>
	<?php 
		$myCommands = $this->myDevis;  
		if (sizeof($myCommands) > 0) {
			foreach ($myCommands as $command) {
			$myDate = new Zend_Date(strtotime($command['DATESTART']));
	?>
	<tr align="center">
		<td ><?php 
		echo $myDate->toString("dd").' '.$mois[(int)$myDate->toString('MM')].' '.$myDate->toString("YYYY");
		?></td>
		<td ><?php echo $command['REFERENCE']; ?></td>
		<td>
		<?php 
			switch ($this->escape($command['STATUT'])) { 
				case 10 : echo 'En cours'; break;
				case 11 : echo 'Termin�'; break;
			}
		?>
		</td>
		<td class="text-right">
			<span style="margin-right:10px;">
			<?php echo number_format($command['PRIXTOTALTTC'], 2, ',', ' ').' &#8364;'; ?>  
			</span>
		</td>
		<td >
				<a target="_blank"  href="<?php echo $this->baseUrl; ?>/user/commande/ref/<?php echo $command['REFERENCE']; ?>" title="Voir le d�tail du devis" class="tooltips btn btn-primary" data-placement="left">
					<i class="fa fa-search"></i> VISUALISER
				</a> 
				<a href="javascript:;" onclick="javascript:retrieveCommandToCaddy('<?php echo $command['REFERENCE']; ?>');"  title="Mettre le devis dans mon panier" class="tooltips btn btn-success" data-placement="left" >
					<span class="fa fa-plus-circle"></span> AJOUTER AU PANIER
				</a>
		</td>
	</tr>
	<?php 
			}		
	} else { ?>
	<tr>
		<td colspan="5" align="center" class="text3" height="50px">Aucun devis</td>
	</tr>
	<?php } ?>
	</tbody>
</table>
</div>modules/default/views/scripts/user/connexion.phtml000060400000045524150710367660016531 0ustar00

<script type="text/javascript">
  $(function(){
  var currentUrl = document.location.href;
  var currentUrlAncre = currentUrl.split('#');
  if (currentUrlAncre.length > 1) {
  $('#current_con_ancre').attr('value', currentUrlAncre[1]);
  $('#current_save_ancre').attr('value', currentUrlAncre[1]);
  }
  });
</script>
<?php if ($this->showSlide == 1) {
	$showslide = 1;
} else {
	$showslide = 2;
}
?>
<script type="text/javascript">
  $(function(){
  initEventConnexion(<?php echo $showslide; ?>);

  var params = new Array();
  params['route'] = $('#adduser_adresse');
  params['locality'] = $('#adduser_ville');
  params['administrative_area_level_2'] = $('#adduser_departement');
  params['administrative_area_level_1'] = $('#adduser_region');
  params['country'] = $('#adduser_pays');
  params['postal_code'] = $('#adduser_cp');

  initEventAddress($('#adduser_adressecomplete'), params);
  });
</script>

<div class="col-xs-12 text-center caddy-header-box"
	style="margin-bottom: 10px; margin-top: 10px;">
  <span
	class="user-con-title col-xs-6 col-xs-offset-3  ">
    Identifiez-vous ! <img
	src="<?php echo $this->baseUrl; ?>/business/image/lock.png"
    alt="Identifiez-vous !" />
  </span>
</div>
<div class="col-xs-12" style="margin-bottom: 10px; margin-top: 10px;">
  <div class="col-xs-6 noPadding text-center">
    <a href="javascript:;"
	id="connexion1" class="btn btn-primary btn-lg">J'ai d�j� command�</a>
  </div>
  <div class="col-xs-6 noPadding text-center">
    <a href="javascript:;"
	id="connexion2" class="btn btn-danger btn-lg">Je suis un nouveau client</a>
  </div>
</div>

<div id="v-connexion1">
  <div class="col-xs-6 col-xs-offset-3 col-border-default">
    <form class="form-horizontal" role="form" name="connexionForm"
      id="connexionForm"
      action="<?php echo $this->baseUrl; ?>/connectez-vous.html"
      method="post">

      <div class="form-group">
        <div class="col-sm-12 text-center">
          <span class="messageError2">
            <?php echo $this->messageErrorConnect; ?>
          </span>
        </div>
      </div>

      <div class="form-group">
        <label for="connexion_login"
	class="col-sm-4 noPadding control-label">Identifiant (Email)</label>
        <div class="col-sm-8">
          <input type="text" class="form-control"
	name="connexion_login" id="connexion_login"
	value="<?php echo $this->populateFormConnect['LOGIN']; ?>" /> <input
	type="hidden" name="current_con_ancre" id="current_con_ancre"
	value="<?php if (isset($this->current_con_ancre)) {echo $this->current_con_ancre; } ?>" />
        </div>
      </div>

      <div class="form-group">
        <label for="connexion_mdp"
	class="col-sm-4  noPadding control-label">Mot de passe</label>
        <div class="col-sm-8">
          <input type="password" class="form-control"
	name="connexion_mdp" id="connexion_mdp" />
        </div>
      </div>
      <div class="form-group text-center">
        <input type="submit"
	class="btn btn-primary" value="ME CONNECTER" />
      </div>

    </form>
  </div>
  <div class="col-xs-6 col-xs-offset-3 col-border-default">
    <span
	class="text3">
      Pour r�cup�rer votre mot de passe veuillez indiquer
      l'adresse e-mail avec laquelle vous vous �tes inscrit.
    </span>

    <form class="form-horizontal" role="form" name="passwordForgetForm"
      id="passwordForgetForm"
      action="<?php echo $this->baseUrl; ?>/retrouver-mon-mot-de-passe.html"
      method="post">

      <div class="form-group">
        <div class="col-sm-12 text-center">
          <span class="messageError2">
            <?php echo $this->messageErrorPass; ?>
          </span>
          <span class="messageSuccess2">
            <?php echo $this->messageSuccessPass; ?>
          </span>
        </div>
      </div>

      <div class="form-group">
        <label for="emailpassword"
	class="col-sm-4 noPadding control-label">Votre e-mail</label>
        <div class="col-sm-8">
          <input type="email" class="form-control"
	name="emailpassword" id="emailpassword" />
        </div>
      </div>
      <div class="form-group text-center">
        <input type="submit"
	class="btn btn-primary" value="RECUPERER MON MOT DE PASSE" />
      </div>
    </form>
  </div>

</div>

<div id="v-connexion2">
  <form name="addUserForm" id="addUserForm" class="form-horizontal"
    role="form"
    action="<?php echo $this->baseUrl; ?>/enregistrez-vous.html"
    method="post">

    <div class="form-group">
      <div class="col-sm-12 text-center">
        <span class="messageError2">
          <?php echo $this->messageErrorAddUser; ?>
        </span>
      </div>
    </div>

    <div class="col-xs-6 col-xs-offset-3 col-border-default">
      <div class="form-group ">
        <div class="col-xs-12 text-center">
          <span class="text6">
            Vos Identifiants
          </span>
        </div>
      </div>

      <div class="form-group">
        <label for="adduser_login"
	class="col-sm-4 noPadding control-label">* Identifiant (Email)</label>
        <div class="col-sm-8">
          <input type="email" class="form-control"
	name="adduser_login" id="adduser_login"
	value="<?php echo $this->populateFormAdd['LOGIN']; ?>" /> <input
	type="hidden" name="current_save_ancre" id="current_save_ancre"
	value="<?php if (isset($this->current_save_ancre)) {echo $this->current_save_ancre; } ?>" />
          <span class="text3">(4 caract�res minimum)</span>
        </div>
      </div>

      <div class="form-group">
        <label class="col-sm-4  noPadding control-label">
          *
          Mot de passe
        </label>
        <div class="col-sm-8">
          <input type="password" class="form-control"
	name="adduser_mdp" id="adduser_mdp" />
          <span class="text3">
            (4
            caract�res minimum)
          </span>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-4  noPadding control-label">
          *
          Confirmation du mot de passe
        </label>
        <div class="col-sm-8">
          <input type="password" class="form-control"
	name="adduser_mdp2" id="adduser_mdp2" />
          <span class="text3">
            (4
            caract�res minimum)
          </span>
        </div>
      </div>
    </div>

    <div class="col-sm-12 col-border-default">
      <div class="col-sm-6 ">
        <div class="form-group">
          <div class="col-xs-12 text-center">
            <span class="text6">Vos coordonn�es </span>
          </div>
        </div>

        <div class="form-group">
          <label class="col-sm-4  noPadding control-label">
            *
            Civilit�
          </label>
          <div class="col-sm-8">
            <select class="form-control"
	name="adduser_civility" id="adduser_civility">
              <option value="Mr"
                <?php if ($this->populateFormAdd['CIVILITE'] == 'Mr') { echo 'selected'; } ?>>Monsieur
              </option>
              <option value="Mme"
                <?php if ($this->populateFormAdd['CIVILITE'] == 'Mme') { echo 'selected'; } ?>>Madame
              </option>
              <option value="Mlle"
                <?php if ($this->populateFormAdd['CIVILITE'] == 'Mlle') { echo 'selected'; } ?>>Mademoiselle
              </option>
            </select>
          </div>
        </div>

        <div class="form-group">
          <label class="col-sm-4  noPadding control-label">
            *
            Nom
          </label>
          <div class="col-sm-8">
            <input type="text" class="form-control"
	name="adduser_nom" id="adduser_nom"
	value="<?php echo $this->populateFormAdd['NOM']; ?>" />
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-4  noPadding control-label">
            *
            Pr�nom
          </label>
          <div class="col-sm-8">
            <input type="text" class="form-control"
	name="adduser_prenom" id="adduser_prenom"
	value="<?php echo $this->populateFormAdd['PRENOM']; ?>" />
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-4  noPadding control-label">Fonction</label>
          <div class="col-sm-8">
            <input type="text" class="form-control"
	name="adduser_fct" id="adduser_fct"
	value="<?php echo $this->populateFormAdd['FONCTION']; ?>" />
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-4  noPadding control-label">
            *
            T�l�phone
          </label>
          <div class="col-sm-8">
            <input type="text" class="form-control"
	name="adduser_tel" id="adduser_tel" maxlength="10"
	value="<?php echo $this->populateFormAdd['TEL']; ?>" /> <span
	class="text3">(Exemple : 0810120007)</span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-4  noPadding control-label">
            Fax
          </label>
          <div class="col-sm-8">
            <input type="text" class="form-control"
	name="adduser_fax" id="adduser_fax" maxlength="10"
	value="<?php echo $this->populateFormAdd['FAX']; ?>" /> <span
	class="text3">(Exemple : 0810120007)</span> <input type="hidden"
	id="address_type" name="address_type" value="old">
          </div>
        </div>

      </div>
      <div class="col-sm-6">
        <div class="form-group">
          <div class="col-xs-12 text-center">
            <span class="text6">Votre adresse </span>
          </div>
        </div>
        <div class="col-sm-12 text-center messageError" id="addressError"
          style="clear: both; display: none;"></div>

        <div id="adresseNew" style="display: none;">
          <div class="form-group">
            <label class="col-sm-4  noPadding control-label">
              *
              Adresse
            </label>
            <div class="col-sm-8">
              <input type="text" class="form-control"
	name="adduser_adressecomplete" id="adduser_adressecomplete"
	value="<?php echo $this->populateFormAdd['ADRESSECOMPLETE']; ?>" />
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-4  noPadding control-label">* Rue</label>
            <div class="col-sm-8">
              <input type="text" style="border: none;"
	readonly="readonly" class="form-control" name="adduser_adresse"
	id="adduser_adresse"
	value="<?php echo $this->populateFormAdd['ADRESSE']; ?>" /> <input
	type="hidden" name="adduser_departement" id="adduser_departement"
	value="<?php echo $this->populateFormAdd['DEPARTEMENT']; ?>" /> <input
	type="hidden" name="adduser_region" id="adduser_region"
	value="<?php echo $this->populateFormAdd['REGION']; ?>" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-4  noPadding control-label">
              * Code postal
            </label>
            <div class="col-sm-8">
              <input readonly="readonly" style="border: none;"
	type="text" class="form-control" name="adduser_cp" id="adduser_cp"
	value="<?php echo $this->populateFormAdd['CP']; ?>" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-4  noPadding control-label">* Ville</label>
            <div class="col-sm-8">
              <input readonly="readonly" style="border: none;"
	type="text" class="form-control" name="adduser_ville"
	id="adduser_ville"
	value="<?php echo $this->populateFormAdd['VILLE']; ?>" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-4  noPadding control-label">* Pays</label>
            <div class="col-sm-8">
              <input readonly="readonly" style="border: none;"
	type="text" class="form-control" name="adduser_pays" id="adduser_pays"
	value="<?php echo $this->populateFormAdd['PAYS']; ?>" />
            </div>
          </div>
          <div class="form-group text-right">
            <span class="link7">
              <a
	href="javascript:;"
	onclick="swichAdresse($('#adresseNew'),$('#adresseOld'),$('#address_type'), 'old')">
                Je
                ne trouve pas mon adresse !
              </a>
            </span>
          </div>
        </div>

        <div id="adresseOld">
          <div class="form-group">
            <label class="col-sm-4  noPadding control-label">
              *
              Adresse
            </label>
            <div class="col-sm-8">
              <input type="text" class="form-control"
	name="adduser_adresse_old"
	value="<?php echo $this->populateFormAdd['ADRESSE']; ?>" />
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-4  noPadding control-label">
              * Code postal
            </label>
            <div class="col-sm-8">
              <input type="text" class="form-control"
	name="adduser_cp_old"
	value="<?php echo $this->populateFormAdd['CP']; ?>" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-4  noPadding control-label">* Ville</label>
            <div class="col-sm-8">
              <input type="text" class="form-control"
	name="adduser_ville_old"
	value="<?php echo $this->populateFormAdd['VILLE']; ?>" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-4  noPadding control-label">* Pays</label>
            <div class="col-sm-8">
              <select class="form-control"
	name="adduser_pays_old">
                <?php
	foreach ($this->listPays as $pays) { ?>
                <option value="
                  <?php echo $pays['PAYS']; ?>"
                  <?php if (strcasecmp($this->populateFormAdd['PAYS'], $pays['PAYS']) == 0) { echo 'selected'; } else if ($pays['PAYS'] == "FRANCE") { echo 'selected'; } ?>><?php echo $pays['PAYS']; ?>
                </option>
                <?php }?>
              </select>
            </div>
          </div>
          <div class="form-group text-right">
            <span class="link7">
              <a
	href="javascript:;"
	onclick="swichAdresse($('#adresseOld'),$('#adresseNew'),$('#address_type'), 'new')">
                Trouver
                mon adresse
              </a>
            </span>
          </div>
        </div>

      </div>
    </div>


    <div class="col-sm-12  col-border-default">
      <div class="form-group">
        <label class="col-sm-3 noPadding control-label">
          *
          Vous �tes ?
        </label>
        <div class="col-sm-8">
          <label class="checkbox-inline">
            <INPUT type="radio"
	name="adduser_typeuser" id="adduser_typeuserPart" value="Particulier"
	<?php if ($this->populateFormAdd['TYPE'] == 'Particulier') { echo 'checked="checked"'; } ?>>Particulier
          </label>
          <label class="checkbox-inline">
            <INPUT type="radio"
	name="adduser_typeuser" id="adduser_typeuserPro" value="Professionnel"
	<?php if ($this->populateFormAdd['TYPE'] == 'Professionnel') { echo 'checked="checked"'; } ?>>Professionnel
          </label>
        </div>
      </div>
      <div class="col-sm-12" id="v-UserInfo">
        <div class="col-xs-7 col-xs-offset-2  col-border-default"
          style="margin-bottom: 10px;">
          <div class="form-group">
            <div class="col-sm-12 text-center">
              <span class="text6">
                Informations
                compl�mentaire
              </span>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3  noPadding control-label">
              *
              Raison sociale
            </label>
            <div class="col-sm-8">
              <input type="text" class="form-control"
	name="adduser_raisonsocial" id="adduser_raisonsocial"
	value="<?php echo $this->populateFormAdd['RAISONSOCIAL']; ?>" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3  noPadding control-label">
              *
              Num�ro SIRET
            </label>
            <div class="col-sm-8">
              <input type="text" class="form-control"
	name="adduser_siret" id="adduser_siret"
	value="<?php echo $this->populateFormAdd['SIRET']; ?>" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3  noPadding control-label">
              *
              Num�ro T.V.A. Intra Communautaire
            </label>
            <div class="col-sm-8">
              <input type="text" class="form-control"
	name="adduser_numidfisc" id="adduser_numidfisc"
	value="<?php echo $this->populateFormAdd['NUMIDFISC']; ?>" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3  noPadding control-label">
              *
              Code A.P.E.
            </label>
            <div class="col-sm-8">
              <input type="text" class="form-control"
	name="adduser_codeape" id="adduser_codeape"
	value="<?php echo $this->populateFormAdd['CODEAPE']; ?>" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3  noPadding control-label">
              Secteur
              d'activit�
            </label>
            <div class="col-sm-8">
              <input type="text" class="form-control"
	name="adduser_sectactivite" id="adduser_sectactivite"
	value="<?php echo $this->populateFormAdd['SECTACTIVITE']; ?>" />
            </div>
          </div>
        </div>
      </div>

      <div class="form-group">
        <label class="col-sm-4  noPadding control-label">Commentaires</label>
        <div class="col-sm-8">
          <textarea class="form-control" name="adduser_comm"
	id="adduser_comm">
            <?php echo $this->populateFormAdd['COMMENTAIRE']; ?>
          </textarea>
        </div>
      </div>
    </div>



    <div class="col-sm-12">
      <label class="checkbox-inline text-right">
        <input
	type="checkbox" name="adduser_newsletter" id="adduser_newsletter"
	<?php //if (!empty($this->populateFormAdd['newsletter'])) { echo 'checked'; } ?>
        checked="checked" /> Oui, je souhaite m'abonner � la newsletter afin
        d'�tre inform� des promotions exclusives et de l'actualit� de <?php echo $this->siteName; ?>.
      </label>
    </div>

    <div class="col-sm-12 text-center"
      style="margin-bottom: 20px; margin-top: 20px;">
      <input
	id="submitSaveConnexion" class="btn btn-success btn-lg" type="submit"
	value="CREER MON COMPTE" />
    </div>
    <div class="col-sm-12">
      <span class="text3 text-left">
        * Champs
        obligatoires
      </span>
      <br />
      <span class="text3" style="font-style: italic">
        Ces informations sont
        n�cessaires au traitement de votre commande et � la gestion de nos
        relations commerciales. Conform�ment � la Loi Informatique et Libert� du
        6 janvier 1978, vous disposez d'un droit d'acc�s, de rectification et
        d'opposition aux informations vous concernant. Vous pouvez demander � ne
        pas recevoir nos offres en cliquant sur le lien de d�sinscription
        pr�sent sur toutes les newsletters envoy�es par <?php echo $this->siteName; ?>.
      </span>
    </div>

  </form>
</div>
modules/default/views/scripts/user/ajaxlistcommand.phtml000060400000004157150710367660017704 0ustar00
<?php 
	$mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
	$moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
?> 
<table class="user-cmd-table" cellpadding="0" cellspacing="0" >
	<thead>
			<tr align="center"  >
				<th class="col-xs-2">Date de la commande</th> 
				<th class="col-xs-2">R�f�rence</th> 
				<th class="col-xs-2">Statut</th> 
				<th class="col-xs-2">Prix TTC</th>
				<th style="width: 300px;"></th> 
			</tr>
		</thead>
		<tbody>
			<?php 
				$myCommands = $this->myCommands; 
			
				if (sizeof($myCommands) > 0) {
					foreach ($myCommands as $command) {
					$myDate = new Zend_Date(strtotime($command['DATESTART']));
			?>
			<tr align="center" >
				<td><?php 
				echo $myDate->toString("dd").' '.$mois[(int)$myDate->toString('MM')].' '.$myDate->toString("YYYY");
				?></td>
				<td ><?php echo $command['REFERENCE']; ?></td>
				<td>
				<?php 
					switch ($this->escape($command['STATUT'])) {
						case 1 : echo 'En cours'; break;
						case 2 : echo 'En livraison'; break;
						case 3 : echo 'Termin�e'; break; 
					}
				?>
				</td>
				<td align="right" >
					<span style="margin-right:10px;">
					<?php echo number_format($command['PRIXTOTALTTC'], 2, ',', ' ').' &#8364;'; ?>
					</span>
				</td>
				<td >
						<a target="_blank" href="<?php echo $this->baseUrl; ?>/user/commande/ref/<?php echo $command['REFERENCE']; ?>" title="Voir le d�tail de la commande" class="tooltips btn btn-primary" data-placement="left">
							<i class="fa fa-search"></i> VISUALISER
						</a> 
						<a href="javascript:;" onclick="javascript:retrieveCommandToCaddy('<?php echo $command['REFERENCE']; ?>');" title="Mettre la commande dans mon panier" class="tooltips btn btn-success" data-placement="left">
							<span class="fa fa-plus-circle"></span> AJOUTER AU PANIER
						</a>
				</td>
			</tr>
			<?php 
					}		
			} else { ?>
			<tr>
				<td colspan="5" align="center" class="text3" height="50px">Aucune commande</td>
			</tr>
			<?php } ?>
			</tbody>
		</table>modules/default/views/scripts/user/facture.phtml000060400000035657150710367660016170 0ustar00
<?php
$facture = $this->facture;
?>
<style type="text/css">
.textTd1 {
	font-family: "Verdana";
	font-size: 11px;
	font-weight: normal;
	color: #000000;
	text-decoration: none;
}
.oldPromoPrice {
	font-size: 10px;
	font-weight: normal;
	color: #5e5e59;
	text-decoration: line-through;
}

.bill_body {
	clear: both;
	width: 800px;
	margin: 0 auto 0 auto;
}

.bill_header {
	float: clear : both;
	width: 800px;
}

.bill_company {
	float: left;
}
.bill_company_logo {
	margin: 10px 0 10px 10px;
	width: 94px;
	height: 121px;
}
.bill_idents {
	float: right;
	width: 550px;
}
.bill_idents_opt1{
	float:left;
	width:120px;
	height:50px;
	margin:0 0 0 10px;
}

.bill_idents_opt21{
	float:left;
	width:120px;
	height:25px;
	background-color: #e7e7e7;
	margin:0 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}
.bill_idents_opt31{
	float:left;
	width:120px;
	height:24px;
	margin:1px 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}

.bill_idents_opt22{
	float:left;
	width:250px;
	height:25px;
	background-color: #e7e7e7;
	margin:0 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}
.bill_idents_opt32{
	float:left;
	width:250px;
	height:24px;
	margin:1px 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}

.bill_text {
	color: #000000;
	font-weight: bold;
}
.bill_text2 {
	color: #000000;
	font-weight: bold;
	line-height:25px;
}
.bill_text3 {
	color: #000000;
	font-size:11px;
}
.bill_address {
	float: left;
	width: 800px; 
	margin:10px 0 0 0;
}

.bill_address_opt {
	float: left;
	width: 300px; 
	margin: 0 0 0 50px;
	
}
.bill_address_opt1{
	float:left;
	width:300px;
	height:25px;
	background-color: #e7e7e7;
	margin:0 0 0 0;
	text-align:center;
	border: solid 1px black;
	color: #000000;
	font-weight: bold;
}




.bill_address_opt2 {
	float:left;
	width:250px;
	margin: 10px 0 0 20px;
}

.bill_line {
	line-height:25px;
	text-align:center;
	font-weight:bold;
}
.bill_line2 {
	line-height:20px;
}

.bill_caddy {
	float: left;
	width:800px;
	height:auto;
}

.bill_facture{
	float: left;
	width:800px; 
}


.bill_buy{
	float: left;
	width:500px; 
}
 
.bill_user_paiement_box {
	width:450px;
	margin:5px 0 0 0;
	padding: 0 10px 10px 10px;
	border : 2px #000000 solid;
}


.bill_detail{
	float: right;
	width:250px;
	height:130px;
	border: solid 1px black;
	margin: 10px 0 0 0;
}
.bill_footer{
	float: left;
	width:800px;
	margin: 20px 0 0 0;
}
.bill_footer2{
	float: left;
	width:800px;
	text-align:center;
	margin: 0 0 20px 0;
}

.bill_linkd a:link,.bill_linkd a:visited,.bill_linkd a:active {
	font-family: "Arial";
	font-size: 12px;
	font-weight: normal;
	color: #000000;
	text-decoration: none;
}

.bill_linkd a:hover {
	text-decoration: underline;
}
</style>

<div class="spaceBG2" style="clear: both;"></div>
	<div class="col-xs-12 text-center hidden-print" style="margin-top: 20px; margin-bottom: 20px"><a class="btn btn-default" onclick="window.print();return false;" href="<?php echo $this->baseUrl; ?>/"><span class="fa fa-print"></span> Imprimer</a></div>
<div class="bill_body">
	<div class="bill_header">
		<div class="bill_company">
			<div class="bill_company_logo"> 
				<a href="<?php echo $this->baseUrl; ?>/"><img alt="Directement � la source de la qualit�" src="<?php echo $this->baseUrl; ?>/business/image/logo.png" style="border: none;"/></a>
			</div>
		</div>
		<div class="bill_idents">
			<div class="bill_idents_opt1">
				<div class="bill_idents_opt21">
					<span class="bill_line"><?php if ($facture['STATUT'] == 1 || $facture['STATUT'] == 2 || $facture['STATUT'] == 3) { echo 'Facture';} else {echo 'Devis';} ?></span>
				</div>
				<div class="bill_idents_opt31">
					<span class="bill_line"><?php echo $facture['REFERENCE']; ?></span>
				</div>
			</div>
			<div class="bill_idents_opt1">
				<div class="bill_idents_opt21">
					<span class="bill_line"><?php echo 'Date'; ?></span>
				</div>
				<div class="bill_idents_opt31">
					<span class="bill_line">
					<?php 
					try {
					$myDate = new Zend_Date(strtotime($facture['DATESTART']));
					
					$mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
				$moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
				
					echo $myDate->toString("dd").' '.$mois[(int)$myDate->toString('MM')].' '.$myDate->toString("YYYY");
					} catch(Zend_Exception $e) { } 
					?>
					</span>
				</div>
			</div>
			<div class="bill_idents_opt1">
				<div class="bill_idents_opt22">
					<span class="bill_line"><?php echo 'Client'; ?></span>
				</div>
				<div class="bill_idents_opt32">
				<span class="bill_line"><?php echo $facture['USER_EMAIL']; ?></span>
				</div>
			</div> 
		</div>
		<div style="float: left;width:800px ">
			<?php if (!empty($facture['USER_NUMCOMPTE'])) {?>
			<span class="bill_text">Compte : <?php echo $facture['USER_NUMCOMPTE']; ?></span><br>
			<?php } ?>
			<span class="bill_text">Tel : <?php echo $this->tel_contact; ?></span><br>
			<span class="bill_text">Email : <?php  echo $this->serviceClient_Mail;?></span>
		</div>
	</div>
	<div class="bill_address">
		<div class="bill_address_opt">
			<div class="bill_address_opt1">
				<span class="bill_line">Adresse de Facturation</span>
			</div>
			<div class="bill_address_opt2">
				<span class="bill_text2"><?php echo $facture['FACT_RAISONSOCIAL']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['FACT_ADRESSE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['FACT_CP'].' '.$facture['FACT_VILLE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['FACT_PAYS']; ?></span>
			</div>
		</div>
		<div class="bill_address_opt">	
			<div class="bill_address_opt1">
				<span class="bill_line">Adresse de Livraison</span>
			</div>
			<div class="bill_address_opt2">
				<span class="bill_text2"><?php echo $facture['LIV_RAISONSOCIAL']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['LIV_ADRESSE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['LIV_CP'].' '.$facture['LIV_VILLE']; ?></span><br>
				<span class="bill_text2"><?php echo $facture['LIV_PAYS']; ?></span>
			</div>
		</div>
	</div>
	<div class="bill_caddy">
		<table style="border:1px solid black;"  border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr align="center" style="background-color: #e7e7e7;">
				<th class="bill_line" >R�f�rence</th>
				<th class="bill_line">D�signation</th>
				<th class="bill_line" style="width: 60px">Dispo.</th>
				<th class="bill_line">Quantit�</th>
				<th class="bill_line"  style="text-align: center">P.U. HT</th>
				<th class="bill_line"  style="display: none;">Prix Remis�</th>
				<th class="bill_line" >Montant HT</th>
			</tr>
			<?php 
			$index = 1;
			$i = 0;
			$caddy = $facture['CADDY'];
			foreach($caddy as $row) {
				?>
			<tr >
				<td colspan="6" height="1px" style="background-color: #868686"></td>
			</tr>
			<tr align="center"  height="25px" >
				<td class="textTd1" width="110px" style="text-align:center;white-space: nowrap;">
					<?php echo $this->escape($row['REFERENCE']);?>
				</td>
				<td  width="450px" class="bill_linkd" style="text-align: left;">
					<a target="_blank"  href="<?php echo $this->baseUrl; ?>/<?php echo Utils_Tool::getFormattedUrlProduct($row['NAVNOM_URLPARENTS'], $row['NAVPRODUCTNOM'], $row['PRODUCTID']); ?>"><?php echo $row['DESIGNATION'];?></a>
					<?php if (!empty($row['SELECTEDOPTION'])) { 
						echo '<br/>'.$row['SELECTEDOPTION'].'<br/>';
					} ?>
				</td> 
				<td class="textTd1" > 
					<?php if ((int)$row['STOCK'] == 1) { ?>
					<img alt="Disponible" title="Disponible" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock11.png" />
					<?php } else if ((int)$row['STOCK'] == 2) { ?>
					<img alt="Disponible sous 8 jours" title="Disponible sous 8 jours" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock22.png" />
					<?php } else if ((int)$row['STOCK'] == 3) { ?>
					<img alt="Nous contacter" title="Nous contacter" src="<?php echo $this->baseUrl; ?>/business/image/admin/stock33.png" />
					<?php }?> 	
				</td>
				<td class="textTd1" >
					<?php echo $row['QUANTITY']; ?>	
				</td>
				<td class="textTd1" width="150px">
						<?php $this->currentData = $row;
						echo $this->render("/produits/ajaxshowpromoprice.phtml"); ?>
				</td>
				<td width="120px"  style="display: none;">
				<?php if ($row['isPROMO'] == 1 && $row['REMISEPRIX'] > 0) { ?>
					<span class="textTd1" >
						<?php
							if ((int)$row['REMISEPRIXTAUXP'] > 0) {
									echo number_format($row['REMISEPRIX'], 2, ',', ' ').' &#8364; <br>('.$this->escape($row['REMISEPRIXTAUXP']).' %)';
								} else {
									echo number_format($row['REMISEPRIX'], 2, ',', ' ').' &#8364;';
								}
							?>
					</span>
					<?php } ?>
				</td>
				<td width="120px">
					<span class="textTd1" style="float: right;" >
						<?php if ($row['isDEVIS'] == 1) { 
							echo number_format($row['PRIXTOTAL'], 2, ',', ' ').' &#8364;';
						} ?>
					</span>
				</td>
			</tr>
			<?php $i++; } ?>
<?php
	$caddyfidelite = $facture['CADDYFIDELITE'];
	foreach($caddyfidelite as $row) {
		?>
    <tr>
      <td colspan="6">
        <div style="font-weight: bold;margin:10px;">
          <?php echo 'Carte de fid�lit� : '.$row['NOM'].' ('.$row['NBPOINT'].' points)'; ?>
        </div>
      </td>
    </tr>
  <?php } ?>			
		</table>
	</div>
	<div class="bill_facture"> 
		<div class="bill_buy">   
				<?php switch ($facture['USER_MODEPAIEMENT_TYPE']) {
						case 1 : ?>
						<div class="bill_user_paiement_box">
							<div class="bill_text2" style="text-align:center">Mode de paiement : Par ch�que</div>
							<div style="margin-left:10px">- Veuillez libeller votre ch�que � l�ordre de <?php echo $this->siteName; ?></div>
							<div style="margin-left:10px">- Inscrivez le num�ro de votre commande au dos de votre ch�que</div>
							<div style="margin-left:10px">- Puis envoyez votre r�glement � l�adresse suivante :</div>
							<br/>
							<div class="bill_text" style="text-align:center"><?php echo $this->siteName; ?></div>
							<br/>
							<div class="bill_text" style="text-align:center"><?php echo $this->site_addresse3_title; ?></div>
							<div class="bill_text" style="text-align:center"><?php echo $this->site_addresse3_address; ?></div>
							<div class="bill_text" style="text-align:center"><?php echo $this->site_addresse3_cp; ?></div>
							<br/>
							<div style="font-size:10px;text-align:center">A noter : Les produits sont exp�di�s � r�ception du ch�que</div> 
						</div> 
						<?php  break;
							case 2 : ?>  
						<div class="bill_user_paiement_box">
							<div class="bill_text2" style="text-align:center">Mode de paiement : Par virement</div>
							<div >- La commande sera exp�di�e d�s le virement pr�sent sur notre compte bancaire.</div> 
							<div class="bill_text">- Inscrivez votre num�ro de commande sur le formulaire de virement</div> 
							<div >- Vous disposez d�un <span style="font-weight: bold;">d�lai de 15 jours</span> pour effectuer le virement sur notre compte ci-dessous indiqu�, au d�l� de ce d�lai votre commande sera automatiquement annul�e.</div> 
							<br/>
							<div class="bill_text">RIB : <?php echo $this->site_rib_numbers; ?></div> 
							<div class="bill_text">No IBAN : <?php echo $this->site_rib_iban; ?></div> 
							<div class="bill_text">Code BIC : <?php echo $this->site_rib_bic; ?></div> 
							<div class="bill_text">Nom du compte : <?php echo $this->siteName; ?></div> 
							<div class="bill_text">Nom et domiciliation de la banque : <?php echo $this->site_rib_bankname; ?></div>  
						</div> 
				<?php 	break;
						default : ?>
							<span class="bill_text2">
							<?php if (empty($facture['USER_MODEPAIEMENT_LABEL'])) { ?> Mode de reglement :
							<?php 
								switch ($facture['USER_MODEPAIEMENT']) {
									case 1 : echo " Paiement s�curis� en ligne"; break;
									case 2 : echo " Contre remboursement";break;
									case 3 : echo " Paiement diff�r� - 30 jours";break;
									case 4 : echo " Paiement diff�r� - 45 jours";break;
									case 5 : echo " Paiement diff�r� - 60 jours";break;
									case 6 : echo " A r�ception de la facture";break;
								}
							} else { 
								echo $facture['USER_MODEPAIEMENT_LABEL'];
							} ?>
							</span>	 
						<?php 
						break;  
				} ?>  
		</div> 
		<div class="bill_detail">
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr align="right">
					<td class="bill_line2">Total HT</td>
					<td  class="bill_line2"><?php echo number_format($facture['PRIXTOTALHTHR'], 2, ',', ' '); ?> &#8364;</td>
				</tr>	
				<tr align="right">
					<td  class="bill_line2" >Remise <?php if (isset($facture['CODEREDUCTION']) && !empty($facture['CODEREDUCTION']) ) { echo " ( ".$facture['CODEREDUCTION']." ) "; } ?></td>
					<td  class="bill_line2" ><?php echo number_format($facture['PRIXREMISEEUR'], 2, ',', ' '); ?> &#8364;</td>
				</tr>	
				<tr align="right"> 
					<td  class="bill_line2">
						<?php if (strcasecmp($facture['LIV_PAYS'], "FRANCE") != 0) { ?>
						Prix d�part 	
						<?php } else {
							if (isset($facture['LIV_NOM']) && !empty($facture['LIV_NOM']) ) { echo 'Livraison en '.$facture['LIV_NOM']; } else { echo 'Frais de port'; } 
						} ?>
					</td>
					
					<td class="bill_line2"><?php echo number_format($facture['PRIXFRAISPORT'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
				<tr >
					<td colspan="2" height="1px" style="background-color: #868686"></td>
				</tr>
				<tr align="right">
					<td class="bill_text2">Net HT</td>
					<td class="bill_text2"><?php echo number_format($facture['PRIXTOTALHTFP'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
				<tr align="right">
					<td  class="bill_line2">Total TVA</td>
					<td  class="bill_line2"><?php echo number_format($facture['PRIXTOTALTVA'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
				<tr >
					<td colspan="2" height="1px" style="background-color: #868686"></td>
				</tr>
				<tr align="right">
					<td class="bill_text2">NET A PAYER TTC</td>
					<td class="bill_text2"><?php echo number_format($facture['PRIXTOTALTTC'], 2, ',', ' '); ?> &#8364;</td>
				</tr>
			</table>
		</div>
	</div>
	
	
	<div class="bill_footer">
			<span class="link18">
				<input type="checkbox" checked="checked" disabled="disabled"/>
				J'ai pris connaissance des Conditions G�n�rales de Vente et les accepte sans r�serves.
			</span>
			<br /><br />
			<span class="bill_text3">
			P�nalit�s de retard (taux annuel) : 9,00% 
			</span><br>
			<span class="bill_text3">
			<b>RESERVE DE PROPRIETE</b> : Nous nous r�servons la propri�t� des marchandises jusqu'au paiement du prix par l'acheteur. Notre droit de revendication porte aussi bien sur les marchandises que sur leur prix si elles ont d�j� �t� revendues (Loi du 12 mai 1980). 
			</span><br><br>
	</div>
	
		<div class="bill_footer2" >
				<span class="bill_text3">
			<?php echo $this->site_addresse; ?>
			</span><br>
			<span class="bill_text3">
			<?php echo $this->site_actualshort; ?>
			</span>
		</div >
</div>
modules/default/views/scripts/user/ajaxcaddyselection.phtml000060400000011127150710367660020357 0ustar00

<script  type="text/javascript" >

$(function(){
	initEventsCaddyType();
});

</script>  

<?php $caddyTypes = $this->caddyType; ?>
<div class="userAccount_Panel">	
	<?php if (isset($caddyTypes) && !empty($caddyTypes)) { ?>
	<form  id="caddyTypeCheckForm" action="<?php echo $this->baseUrl; ?>/mon-panier-type-actualiser.html" method="post"> 
	<table class="user-cmd-table"cellpadding="0" cellspacing="0" width="100%">
		<thead >
		<tr align="center" >
			<th >Produit</th> 
			<th >Prix Unitaire (HT)</th> 
			<th >Prix remis�</th> 
			<th style="width: 100px;">Quantit�</th>
			<th>Prix Total</th> 
		</tr>  
		</thead>
		<tbody>
		<?php foreach($caddyTypes as $row) { ?>
		<tr align="center" >
			<td  >
				<div class="caddyProdImg" >  
					<a target="_blank" class="tooltips" data-placement="right" href="<?php echo $this->baseUrl; ?>/<?php echo Utils_Tool::getFormattedUrlProduct($row->navnom_urlparents, $row->navnom, $row->idProduit); ?>"
						title="<?php echo $this->escape($row->designation);?>" >
						<img src="<?php echo $this->baseUrl.'/'.$row->url; ?>">
					</a>
				</div>
				<div class="caddyProdTxt" >
					<div class="link17" style="width: auto;clear:both">
						<a target="_blank" class="tooltips"  data-placement="top" href="<?php echo $this->baseUrl; ?>/<?php echo Utils_Tool::getFormattedUrlProduct($row->navnom_urlparents, $row->navnom, $row->idProduit); ?>"
						title="<?php echo $this->escape($row->designation);?>">
							<?php echo $row->designation;?>
						</a>
					</div>
					<div class="textA1 productDetail_ref">
						<?php echo "Ref. ".$this->escape($row->reference);?>
					</div>
				</div>
			</td>  
			<td >
				<?php if (!$row->isSurDevis()) { ?>
					<div class="textA2" >
						<?php echo number_format($row->prix, 2, ',', ' ').' ';?>
						<span style="color: #000000">&#8364;</span>
					</div> 
				<?php } else { ?>
					<div >
						<span class="textA2" >sur devis</span>
					</div>
				<?php } ?>
			</td> 
			<td  >
				<?php if (!$row->isSurDevis()) { 
					if ($row->isPromoCaddyType) { ?>
				 	<div class="textA2">
					 	<?php echo number_format($row->getPrixAfterRemise(), 2, ',', ' ').' ';?>
					 	<span style="color: #000000">&#8364;</span> 
					 </div>  
				<?php } else { echo '&nbsp;'; }
					} else { ?>
					<div >
						<span class="textA2" >sur devis</span>
					</div>
				<?php } ?>
			</td>
			<td>
				<div class="col-xs-12 noPadding">  
					<div class="col-xs-8 noPadding">
						<input  onclick="javascript:clearInput($(this), '0');" type="text" class="form-control input-sm text-center caddyQuantity" maxlength="6" name="Quantity[]" value="<?php echo $row->qte; ?>" /> 
					</div>
					<div class="col-xs-4 noPadding" style="margin-top: 5px; ">
						<a href="javascript:;" onclick="changeValueOfCaddyTypeQte($(this), 0)">
							<img alt="Supprimer" class="tooltips" data-placement="right" title="Supprimer" src="<?php echo $this->baseUrl; ?>/business/image/mini_trash.png">
						</a>  
					</div>
				</div> 				
				<input type="hidden" name="selectedOption[]" value="<?php echo $row->selectedOption; ?>" /> 
				<input type="hidden" name="Child[]" value="<?php echo $row->idChild; ?>" /> 
				<input type="hidden" name="CaddyType[]" value="<?php if ($row->isPromoCaddyType) { echo $row->id; } else { echo '0'; } ?>" />  
				<input type="hidden" name="QuantityMin[]" value="<?php echo $row->qte_min; ?>" />  
			</td> 
			<td  >
				<?php if (!$row->isSurDevis()) { 
					if ($row->isPromoCaddyType) { ?>
				 	<div class="textA2">
					 	<?php echo number_format($row->getPrixAfterRemise(), 2, ',', ' ').' ';?>
					 	<span style="color: #000000">&#8364;</span> 
					 </div>  
				<?php } else { ?>
					<div class="textA2" >
						<?php echo number_format($row->prix, 2, ',', ' ').' ';?>
						<span style="color: #000000">&#8364;</span>
					</div>  
				<?php }
				} else { ?>
					<div >
						<span class="textA2" >sur devis</span>
					</div>
				<?php } ?>
			</td>
		</tr>
		<?php } ?>
		</tbody>
		</table> 
		<div class="col-xs-12 text-center" style="margin-top: 10px;"> 
			<button type="submit" class="tooltips btn btn-success" data-placement="left" title="Mettre la s�lection dans mon panier" >
			  <span class="fa fa-plus-circle"></span> AJOUTER AU PANIER
			</button>
		</div>  
	</form> 
	<?php } else { ?>
	<div class="userAccount_NoCaddyType">
		<span>Vous n�avez pas encore de s�lection,</span>
		<span>Contactez-nous le plus vite possible !</span>
		<span><?php echo $this->siteName; ?></span>
		<?php echo $this->site_addresse2; ?>		
		<span>N� Azur : <?php echo $this->tel_contact; ?></span>
		<span><?php echo $this->contact_Mail; ?></span> 
	</div>
	<?php } ?>
</div>  modules/default/views/scripts/user/sendmailtoconseiller.phtml000060400000002475150710367660020746 0ustar00<form action="<?php echo $this->baseUrl; ?>/contacter-un-conseiller.html" method="post">
	<div class="user_mail_field_component_textarea">	
		<span class="messageError2"><?php echo $this -> messageErrorAskConseiller; ?></span>
		<span class="messageSuccess2"><?php echo $this -> messageSuccessAskConseiller; ?></span>
	</div>
	<?php if (!$this->isConnected) { ?>
	<div class="user_mail_field_title text6">Vous contacter par :</div>
	<div class="user_mail_field_component">
		<div class="user_mail_field_text"><span>Email</span></div>
		<div class="user_mail_field_text2">
			<input type="text" class="input4" name="user_email" value="<?php echo $this->messageMail; ?>"/>
		</div>
	</div>
	<div class="user_mail_field_component">
		<div class="user_mail_field_text"><span>T�l�phone</span></div>
		<div class="user_mail_field_text2">	
			<input type="text" class="input4" name="user_tel" value="<?php echo $this->messageTel; ?>"/>
		</div>
	</div>
	<?php } ?>
	<div class="user_mail_field_title text6">Votre message :</div>
	<div class="user_mail_field_component_textarea"><textarea cols="80" rows="10" name="user_message" ><?php echo $this->messageBody; ?></textarea></div>
	<div class="user_mail_field_component_textarea" >
		<input type="submit" class="button" style="margin: 20px;" value="Envoyer" title="Envoyer le mail">
	</div> 
</form>modules/default/views/scripts/user/newsletter.phtml000060400000000000150710367660016701 0ustar00modules/default/views/scripts/user/index.phtml000060400000000000150710367660015614 0ustar00modules/default/views/scripts/user/ajaxlistcartefidelite.phtml000060400000001600150710367660021060 0ustar00
<?php $carteFidelite = $this->carteFidelite; ?>
<div class="userAccount_Panel"  style="padding-bottom:150px;">
  <div class="col-md-12 text-center">
    <h3>Nombre de points : <?php echo $carteFidelite['POINTFIDELITETOTAL']; ?></h3><hr/>
  </div>

  <?php foreach($this->listfidelitegift as $row)  { ?>
  <div class="col-md-12">
    <h4><?php echo $row['TITRE'];?> : <?php echo $row['POINTFIDELITE'];?> points</h4>
  </div>
  <div class="col-md-12" style="padding:10px">
    <div class="col-md-10">
      <?php echo $row['CONTENT'];?>
    </div> 
    <div class="col-md-2">
      <a class="btn btn-success" <?php if ($carteFidelite['POINTFIDELITETOTAL'] < $row['POINTFIDELITE']) { echo "disabled"; }?> href="<?php echo $this->baseUrl; ?>/user/addcaddyfidelitypoint/id/<?php echo $row['ID']; ?>" ><span class="fa fa-plus-circle"></span> AJOUTER AU PANIER</a>
		</div>
  </div>
  <?php } ?>
</div>modules/default/views/scripts/user/moncompte.phtml000060400000036705150710367660016533 0ustar00
<script>  
$(function(){
	initEventUser();
	
	var params = new Array();
	params['route'] = $('#edituser_adresse');
	params['locality'] = $('#edituser_ville');
	params['administrative_area_level_2'] = $('#edituser_departement');
	params['administrative_area_level_1'] = $('#edituser_region');
	params['country'] = $('#edituser_pays');
	params['postal_code'] = $('#edituser_cp');
	
	initEventAddress($('#edituser_adressecomplete'), params);

	
});
</script>
<style>
.form-group { 
margin: 0 0 10px 0;	
}
.help-block {
	margin-bottom: 0;
}
.form-horizontal .control-label {
font-size: 13px;
}
</style>
<?php  		
$mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
$moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
?>
<div class="userAccount_TitleContent">
	<div class="userAccount_Title"></div>
	<div class="col-xs-12 noPadding">
    <div class="btn-group btn-group-justified" role="group" >
      <div class="btn-group" role="group">
        <button type="button" id="userAccount_InfosTrigger" class="btn btn-primary user-btn-tab">Mes Informations</button>
      </div>
      <div class="btn-group" role="group">
        <button type="button" id="userAccount_CmdTrigger" class="btn btn-primary user-btn-tab">Mes Commandes</button>
      </div>
      <div class="btn-group" role="group">
        <button type="button" id="userAccount_DevisTrigger" class="btn btn-primary user-btn-tab">Mes Devis</button>
      </div>
      <div class="btn-group" role="group">
        <button type="button" id="userAccount_CaddyTrigger" class="btn btn-primary user-btn-tab">Ma S�lection</button>
      </div>
      <?php  if ($this->isCarteFideliteEnable) {  ?>
      <div class="btn-group" role="group">
        <button type="button" id="userAccount_CarteFideliteTrigger" class="btn btn-primary user-btn-tab">Ma carte de fid�lit�</button>
      </div>
      <?php } ?>
    </div>
	</div>
</div>	
<div class="userAccount_Content"> 
	<div id="userAccount_Caddy"  class="userAccount_Panel">	
		<?php echo $this->render("/user/ajaxcaddyselection.phtml"); ?>
	</div>
	<div id="userAccount_Cmd"  class="userAccount_Panel">	
		<?php echo $this->render("/user/ajaxlistcommand.phtml"); ?>
	</div>	
	<div id="userAccount_Devis"  class="userAccount_Panel">	
		<?php echo $this->render("/user/ajaxlistdevis.phtml"); ?>
	</div>
  <?php  if ($this->isCarteFideliteEnable) { ?>
  <div id="userAccount_CarteFidelite" class="userAccount_Panel">
    <?php echo $this->render("/user/ajaxlistcartefidelite.phtml"); ?>
  </div>
  <?php } ?>
		
	<div id="userAccount_Infos" class="userAccount_Panel">  
		<div class="userAccount_Message"> 
			<span class="messageError2" ><?php echo $this->messageErrorEditUser; ?></span>
			<span class="messageSuccess2" ><?php echo $this->messageSuccessEditUser; ?></span>
		</div>
		<div class="userAccount_InfosLogin">
		
		
		<form class="form-horizontal" name="editUserIdentForm" action="<?php echo $this->baseUrl; ?>/mon-compte-modification-des-identifiants.html" method="POST">	
			<div class="col-xs-6 col-xs-offset-3">					
					<div class="form-group">
				    	<label   class="col-sm-4 col-sm-offset-4 control-label text6">Vos Identifiants</label>
				  	</div>
					  
				  <div class="form-group">
				    <label for="edituser_login" class="col-sm-5 control-label">* Identifiant (Email)</label>
				    <div class="col-sm-5">
				    	<input type="text" class="form-control input-sm" name="edituser_login" id="edituser_login" value="<?php echo $this->populateFormEdit['login']; ?>"/>
					</div>
				  </div>
					  
				  <div class="form-group">
				    <label for="edituser_mdp" class="col-sm-5 control-label">* Mot de passe</label>
				    <div class="col-sm-5">
				    	<input type="password" class="form-control input-sm" name="edituser_mdp" id="edituser_mdp" />
				    	<span class="help-block">4 caract�res minimum</span>
					</div>
				  </div>
					  
				  <div class="form-group">
				    <label for="edituser_mdp2" class="col-sm-5 control-label">* Confirmation du mot de passe</label>
				    <div class="col-sm-5">
						<input type="password" class="form-control input-sm" name="edituser_mdp2" id="edituser_mdp2" />
						<span class="help-block">4 caract�res minimum</span>
					</div>
				  </div>
			</div>
			<div style="clear:both;margin: 5px auto 5px auto; text-align: center;" >
				<input type="submit" value="CHANGER MON MOT DE PASSE" class="btn btn-primary" />
			</div>
		</form>
		</div>
		<div class="lineBG2" ><!-- --></div>
		
		
		<form class="form-horizontal" role="form" name="editUserForm" action="<?php echo $this->baseUrl; ?>/mon-compte-modification-des-informations.html" method="POST">
			<div class="col-xs-12">
				<div class="col-xs-6">
					<div class="form-group">
				    	<label   class="col-sm-4 control-label text6">Vos Identifiants</label>
				  	</div>
				  
				  <div class="form-group">
				    <label for="edituser_civility" class="col-sm-3 control-label">* Civilit�</label>
				    <div class="col-sm-9">
				    	<select class="form-control input-sm" name="edituser_civility" id="edituser_civility">
							<option value="Mr" <?php if ($this->populateFormEdit['civilite'] == 'Mr') { echo 'selected'; } ?>>Monsieur</option>
							<option value="Mme" <?php if ($this->populateFormEdit['civilite'] == 'Mme') { echo 'selected'; } ?>>Madame</option>
							<option value="Mlle" <?php if ($this->populateFormEdit['civilite'] == 'Mlle') { echo 'selected'; } ?>>Mademoiselle</option>
						</select>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="edituser_nom" class="col-sm-3 control-label">* Nom</label>
				    <div class="col-sm-9">
				      	<input type="text" class="form-control input-sm" name="edituser_nom" id="edituser_nom" value="<?php echo $this->populateFormEdit['nom']; ?>" />
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="edituser_prenom" class="col-sm-3 control-label">* Pr�nom</label>
				    <div class="col-sm-9">
				     	<input type="text" class="form-control input-sm" name="edituser_prenom" id="edituser_prenom"  value="<?php echo $this->populateFormEdit['prenom']; ?>"/>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="edituser_fct" class="col-sm-3 control-label">Fonction</label>
				    <div class="col-sm-9">
				     	<input type="text" class="form-control input-sm" name="edituser_fct" id="edituser_fct"  value="<?php echo $this->populateFormEdit['fonction']; ?>"/>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="edituser_tel" class="col-sm-3 control-label">* T�l�phone</label>
				    <div class="col-sm-9">
				     	<input type="text" class="form-control input-sm" name="edituser_tel" id="edituser_tel" value="<?php echo $this->populateFormEdit['tel']; ?>"/>
				   		<span class="help-block">(Exemple : 0810120007)</span>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="edituser_fax" class="col-sm-3 control-label">Fax</label>
				    <div class="col-sm-9">
				     	<input type="text" class="form-control input-sm" name="edituser_fax" id="edituser_fax" value="<?php echo $this->populateFormEdit['fax']; ?>"/>
				   		<span class="help-block">(Exemple : 0810120007)</span>
				   	 </div>
				  </div>		
				  <div class="form-group">
				    <label for="edituser_email" class="col-sm-3 control-label">* Email</label>
				    <div class="col-sm-9">
				     	<input type="email" class="form-control input-sm" name="edituser_email" id="edituser_email"  value="<?php echo $this->populateFormEdit['email']; ?>"/>
						<input type="hidden" id="address_type" name="address_type" value="old">
				    </div>
				  </div>		
				</div>  
			  
				 <div class="col-xs-6" id="adresseOld">
					<div class="form-group">
				    	<label   class="col-sm-4 control-label text6">Votre adresse</label>
				  	</div>
				  	<div class="form-group">
				    	<label for="edituser_adresse_old" class="col-sm-3 control-label">* Adresse</label>
				    	<div class="col-sm-9">
				     		<input type="text" class="form-control input-sm" name="edituser_adresse_old"  value="<?php echo $this->populateFormEdit['adresse']; ?>"/>
						</div>
				  	</div>
				  	<div class="form-group">
				    	<label for="edituser_cp_old" class="col-sm-3 control-label">* Code postal</label>
				    	<div class="col-sm-9">
				     		<input type="text" class="form-control input-sm" name="edituser_cp_old"   value="<?php echo $this->populateFormEdit['cp']; ?>"/>
						</div>
				  	</div>
				  	<div class="form-group">
				    	<label for="edituser_ville_old" class="col-sm-3 control-label">* Ville</label>
				    	<div class="col-sm-9">
				     		<input type="text" class="form-control input-sm" name="edituser_ville_old"  value="<?php echo $this->populateFormEdit['ville']; ?>"/>
						</div>
				  	</div>
				  	<div class="form-group">
				    	<label for="edituser_pays_old" class="col-sm-3 control-label">* Pays</label>
				    	<div class="col-sm-9">
				     		<select class="form-control input-sm" name="edituser_pays_old" >
								<?php  
								foreach ($this->listPays as $pays) { ?>
								<option value="<?php echo $pays['PAYS']; ?>" <?php if (strcasecmp($this->populateFormEdit['pays'], $pays['PAYS']) == 0) { echo 'selected'; } ?>><?php echo $pays['PAYS']; ?></option>
								<?php }?>
							</select>
						</div>
				  	</div>
				</div>
			</div>	 
					
			<div style="float: left;display: none;"  id="adresseNew">
					<table cellpadding="0" cellspacing="5" border="0" width="380px" >
						<tr style="display: none;">
							<td  colspan="2">
								<span  class="link7"><a href="javascript:;" onclick="swichAdresse($('#adresseOld'),$('#adresseNew'),$('#address_type'), 'new')">Trouver mon adresse</a></span>
							</td>
						</tr>
						<tr>
							<td colspan="2">
								<span class="text6">Votre adresse</span>
								<div class="messageError" id="addressError" style="clear: both;display: none;"></div>
							</td>
						</tr>
						<tr>
							<td>
								* Adresse :  	
							</td>
							<td>
								<input type="text" class="input4" name="edituser_adressecomplete" id="edituser_adressecomplete"  value="<?php echo $this->populateFormEdit['adressecomplete']; ?>"/>
							</td>
						</tr>
						
						<tr>
							<td >
								Rue :  	
							</td>
							<td>
								<input type="text" style="border: none;" readonly="readonly" class="input4" name="edituser_adresse" id="edituser_adresse"  value="<?php echo $this->populateFormEdit['adresse']; ?>"/>
								<input type="hidden" name="edituser_departement" id="edituser_departement"  value="<?php echo $this->populateFormEdit['departement']; ?>"/>
								<input type="hidden" name="edituser_region" id="edituser_region"  value="<?php echo $this->populateFormEdit['region']; ?>"/>
							</td>
						</tr> 
						<tr>
							<td>
								Code postal :  	
							</td>
							<td>
								<input readonly="readonly"  style="border: none;" type="text"  name="edituser_cp" id="edituser_cp"  value="<?php echo $this->populateFormEdit['cp']; ?>"/>
							</td>
						</tr>
						<tr>
							<td>
								Ville :  	
							</td>
							<td>
								<input readonly="readonly"  style="border: none;" type="text"  name="edituser_ville" id="edituser_ville"  value="<?php echo $this->populateFormEdit['ville']; ?>"/>
							</td>
						</tr>
						<tr>
							<td>
								Pays : 	
							</td>
							<td>
								<input readonly="readonly"  style="border: none;"  type="text" class="input4" name="edituser_pays" id="edituser_pays"  value="<?php echo $this->populateFormEdit['pays']; ?>"/>
							</td>
						</tr>
						<tr>
							<td colspan="2">
								<span class="link7"><a href="javascript:;" onclick="swichAdresse($('#adresseNew'),$('#adresseOld'),$('#address_type'), 'old')">Je ne trouve pas mon adresse !</a></span>
							</td>
						</tr>
					</table>
				</div>
				
				
			<div class="lineBG2"><!-- --></div>
			
			<div class="col-xs-6 col-xs-offset-3">	
				  <div class="col-sm-6 col-xs-12">
				    	<label   class="control-label text6">* Vous etes ?</label>
				  </div>
				  <div class="col-sm-3 col-xs-6">
				  	<div class="radio">
					  <label>
					    <INPUT type=radio name="edituser_typeuser" id="edituser_typeuserPart" value="Particulier" <?php if ($this->populateFormEdit['type'] == 'Particulier') { echo 'checked="checked"'; } ?>  >
					    Particulier
					  </label>
					</div>				   
				  </div>
				  <div class="col-sm-3 col-xs-6">
				  
				  	<div class="radio">
					  <label>
					    <INPUT type=radio name="edituser_typeuser" id="edituser_typeuserPro" value="Professionnel" <?php if ($this->populateFormEdit['type'] == 'Professionnel') { echo 'checked="checked"'; } ?> >
					    Professionnel
					  </label>
					</div>
				    
				  </div>
			</div>
			
			<div class="col-xs-7 col-xs-offset-2" id ="v-UserInfo">	
					<div class="form-group">
				    	<label  class="col-sm-5 control-label text6">+ d'informations</label>
				  	</div>
			  	<div class="form-group">
			    	<label for="edituser_raisonsocial" class="col-xs-5 control-label">* Raison sociale</label>
			    	<div class="col-xs-7">
			     		<input type="text" class="form-control input-sm" name="edituser_raisonsocial" id="edituser_raisonsocial"  value="<?php echo $this->populateFormEdit['raisonsocial']; ?>"/>
					</div>
			  	</div>
			  	<div class="form-group">
			    	<label for="edituser_siret" class="col-xs-5 control-label">* Num�ro SIRET</label>
			    	<div class="col-xs-7">
			     		<input type="text" class="form-control input-sm" name="edituser_siret" id="edituser_siret"  value="<?php echo $this->populateFormEdit['siret']; ?>"/>
					</div>
			  	</div>
			  	<div class="form-group">
			    	<label for="edituser_numidfisc" class="col-xs-5 control-label">* Num�ro T.V.A. Intra Communautaire</label>
			    	<div class="col-xs-7">
			     		<input type="text" class="form-control input-sm" name="edituser_numidfisc" id="edituser_numidfisc"  value="<?php echo $this->populateFormEdit['numidfisc']; ?>"/>
					</div>
			  	</div>
			  	<div class="form-group">
			    	<label for="edituser_codeape" class="col-xs-5 control-label">* Code A.P.E.</label>
			    	<div class="col-xs-7">
			     		<input type="text" class="form-control input-sm" name="edituser_codeape" id="edituser_codeape"  value="<?php echo $this->populateFormEdit['codeape']; ?>"/>
					</div>
			  	</div>
			  	<div class="form-group">
			    	<label for="edituser_sectactivite" class="col-xs-5 control-label">Secteur d'activit�</label>
			    	<div class="col-xs-7">
			     		<input type="text" class="form-control input-sm" name="edituser_sectactivite" id="edituser_sectactivite"  value="<?php echo $this->populateFormEdit['sectactivite']; ?>"/>
					</div>
			  	</div>
			
			</div>
						
			<div class="lineBG2"><!-- --></div>
			
			<div class="col-xs-7 col-xs-offset-2">				
			  	<div class="form-group">
			    	<label for="edituser_comm" class="col-xs-5 control-label">Commentaires</label>
			    	<div class="col-xs-7"> 
			     		<textarea class="form-control  input-sm" name="edituser_comm" id="edituser_comm" ><?php echo $this->populateFormEdit['commentaire']; ?></textarea>
					</div>
			  	</div>
			</div>
			 
			<div style="clear: both;text-align: right;">
				<div style="margin: 10px 0 10px 0"><span class="text3">* Champs obligatoires</span></div>
			</div> 
			<div style="clear: both;margin : 0 auto 0 auto;text-align: center;" >
				<input type="submit" value="MODIFIER MES INFORMATIONS"  class="btn btn-primary"  />
			</div>
		</form>
		<div style="clear: both; height: 10px;"></div>
	</div>
</div>modules/default/views/scripts/error/error.phtml000060400000001141150710367660016020 0ustar00
<div id="page">
	<div class="big_header"><h1 class="big_header">Page non trouv�e</h1></div>	
	<div class="submenu">
		<a href="/" class="custom_font filter">Accueil</a>
	</div>
	<div class="scroll-pane">
		<div class="page_block">
			<blockquote class="error margin_1line">
			Chez visiteur, la page que vous d�sirez visualiser n'existe pas ou plus. <br/> <br/>Veuillez <a href="/" role="button">cliquer ici</a> pour revenir � la page d'accueil, afin de rechercher ce que vous voulez
			</blockquote> 
			<div class="clear"></div>

		</div>
		<div class="page-footer">&copy; Karen Petit</div>
	</div>
</div>
modules/default/views/scripts/blog/actualites.phtml000060400000001256150710367660016626 0ustar00
<?php echo $this->render("/blog/_blogHeader.phtml"); ?>
<div class="col-md-12">
  <div class="row">
    <div class="col-lg-8 noPadding">
      <h1 class="blog-title"><?php echo $this->currentCategory['title']; ?></h1> 
      <p><?php echo $this->currentCategory['sub_title']; ?></p>
      <hr>
        <?php  
        $posts = $this->listSubjects;
        if (!empty($posts)) {
          foreach ($posts as $post) {  
		        $this->currentPost = $post;
            echo $this->render("/blog/_blogShortDetail.phtml"); 
           } 
        }?>
    </div>
    
    <div class="col-md-4">
      <?php echo $this->render("/blog/_blogCategories.phtml");  ?> 
    </div>

  </div>
</div>modules/default/views/scripts/blog/sujet.phtml000060400000002011150710367660015610 0ustar00
<?php echo $this->render("/blog/_blogHeader.phtml"); ?>
<div class="col-md-12">
  <div class="row">
    <div class="col-lg-8 noPadding">
      <h1 class="blog-title"><?php echo $this->currentSubject['title']; ?></h1> 
      <p><?php echo $this->currentSubject['sub_title']; ?></p>
      <p><?php echo $this->currentSubject['message']; ?></p>

      <div class="col-md-12">
        <?php if($this->currentCategory['is_close'] == 0 && $this->currentSubject['is_close'] == 0) { 
              echo $this->render("/blog/_blogAddPost.phtml"); 
        } ?>
      </div>
      <div class="col-md-12">
        <hr>
          <?php  
          $posts = $this->listComments;
          if (!empty($posts)) {
            foreach ($posts as $post) {  
		          $this->currentPost = $post;
              echo $this->render("/blog/_blogShortDetailComment.phtml"); 
             } 
          }?>
      </div>
    </div>
 
    <div class="col-md-4">
      <?php echo $this->render("/blog/_blogCategories.phtml");  ?> 
    </div>

  </div>
</div>modules/default/views/scripts/blog/_blogShortDetail.phtml000060400000002152150710367660017711 0ustar00
 <?php $post = $this->currentPost; ?>
  <div class="media"> 
    <div class="media-body">
      <div class="col-md-9">
        <a class="pull-left" href="<?php echo $this->baseUrl."/blog/sujet/id/".$post['id']; ?>">
          <?php echo $post['title']; ?>
        </a>
        <small>&nbsp;
          <?php 
					  try {
					    $myDate = new Zend_Date(strtotime($post['date_updated']));
					    $mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
				      $moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
				
					    echo $myDate->toString("dd").' '.$mois[(int)$myDate->toString('MM')].' '.$myDate->toString("YYYY"); 
					  } catch(Zend_Exception $e) {
						
					  } ?></small>
      </div> 
      <div class="col-md-3 text-right">
        <a href="<?php echo $this->baseUrl."/blog/sujet/id/".$post['id']; ?>" class="btn btn-primary">Voir</a>
      </div> 
      <div class="col-md-12"><p><?php echo $post['sub_title']; ?></p></div>
    </div>
  </div>
<hr />modules/default/views/scripts/blog/_blogHeader.phtml000060400000001073150710367660016660 0ustar00
<div class="col-md-12 blog-header" >
  <div class="col-md-12 text-center">
    <a href="<?php echo $this->baseUrl; ?>/blog/actualites.html" class="btn btn-info">Blog</a>
  </div>
</div>
<?php if (!empty($this->messageSuccess)) {  ?>
  <div class="col-md-12 text-center no-space-top">
		<span class="alert alert-success"><?php echo $this->messageSuccess; ?></span>
	</div>
<?php } else if (!empty($this->messageError)) { ?>
  <div class="col-md-12 text-center no-space-top">
		<span class="alert alert-danger"><?php echo $this->messageError; ?></span>
	</div>
<?php }  ?>modules/default/views/scripts/blog/_blogCategories.phtml000060400000000775150710367660017565 0ustar00
<?php  
  $posts = $this->listCategories;
    if (!empty($posts)) { ?>
      <div class="well">
        <div class="row">
          <div class="col-xs-12">
            <ul class="list-unstyled">
              <?php  foreach ($posts as $post) {  ?>
              <li>
                <a href="<?php echo $this->baseUrl."/blog/actualites/id/".$post['id'] ?>"><?php echo $post['title'];?></a>
              </li>
              <?php } ?>
            </ul>
          </div>
        </div>
      </div>
<?php } ?>modules/default/views/scripts/blog/forum.phtml000060400000002013150710367660015610 0ustar00
<?php echo $this->render("/blog/_blogHeader.phtml"); ?>
<div class="col-md-12">
  <div class="row">
    <div class="col-lg-8 noPadding">
      <h1  class="blog-title"> <?php echo $this->currentCategory['title']; ?></h1>
      <p><?php echo $this->currentCategory['message']; ?></p>
      <hr>
        <?php  
        $posts = $this->listNewPosts;
        if (!empty($posts)) {
        foreach ($posts as $post) {  
		      $this->currentPost = $post;
          echo $this->render("/blog/_blogShortDetail.phtml"); 
         } } ?>
      </div>

    <div class="col-md-4">
      <?php echo $this->render("/blog/_blogSubjects.phtml"); 
      
      $sidePosts = $this->listPostsSide;
      if (!empty($sidePosts)) {
        foreach ($sidePosts as $post) {  
		      $this->currentPost = $post;
          echo $this->render("/blog/_blogSide.phtml");
        }} ?>
    </div>

  </div>
</div>
<?php if($this->currentCategory['id'] > 0 && $this->currentCategory['is_close'] == 0) { 
    echo $this->render("/blog/_blogAddPost.phtml"); 
} ?>modules/default/views/scripts/blog/_blogSide.phtml000060400000000300150710367660016344 0ustar00
<?php $post = $this->currentPost; ?>
<div class="well">
  <a class="pull-left" href="#"> 
      <?php echo $post['pseudo']; ?> 
  </a>
  <br/>
  <p><?php echo $post['message']; ?></p> 
</div>modules/default/views/scripts/blog/_blogSubjects.phtml000060400000000737150710367660017260 0ustar00

 <div class="well">
    <div class="row">
      <div class="col-xs-12">
        <ul class="list-unstyled">
          <?php  
            $posts = $this->listSubjects;
            if (!empty($posts)) {
              foreach ($posts as $post) {  ?>
              <li>
                <a href="<?php echo $this->baseUrl."/blog/sujet/id/".$post['id'] ?>"><?php echo $post['title'];?></a>
              </li>
            <?php } } ?>
        </ul>
      </div>
    </div> 
  </div> modules/default/views/scripts/blog/detail.phtml000060400000015350150710367660015732 0ustar00
<?php echo $this->render("/blog/_blogHeader.phtml"); ?>
<div class="col-md-12">
  <div class="row">

    <!-- Blog Post Content Column -->
    <div class="col-lg-8">

      <!-- Blog Post -->

      <!-- Title -->
      <h1>Blog Post Title</h1>

      <!-- Author -->
      <p class="lead">
        by <a href="#">Start Bootstrap</a>
      </p>

      <hr>

        <!-- Date/Time -->
        <p>
          <span class="glyphicon glyphicon-time"></span> Posted on August 24, 2013 at 9:00 PM
        </p>

        <hr>

          <!-- Preview Image -->
          <img class="img-responsive" src="http://placehold.it/900x300" alt="">

            <hr>

              <!-- Post Content -->
              <p class="lead">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ducimus, vero, obcaecati, aut, error quam sapiente nemo saepe quibusdam sit excepturi nam quia corporis eligendi eos magni recusandae laborum minus inventore?</p>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut, tenetur natus doloremque laborum quos iste ipsum rerum obcaecati impedit odit illo dolorum ab tempora nihil dicta earum fugiat. Temporibus, voluptatibus.</p>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eos, doloribus, dolorem iusto blanditiis unde eius illum consequuntur neque dicta incidunt ullam ea hic porro optio ratione repellat perspiciatis. Enim, iure!</p>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error, nostrum, aliquid, animi, ut quas placeat totam sunt tempora commodi nihil ullam alias modi dicta saepe minima ab quo voluptatem obcaecati?</p>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Harum, dolor quis. Sunt, ut, explicabo, aliquam tenetur ratione tempore quidem voluptates cupiditate voluptas illo saepe quaerat numquam recusandae? Qui, necessitatibus, est!</p>

              <hr>

                <!-- Blog Comments -->

                <!-- Comments Form -->
                <div class="well">
                  <h4>Leave a Comment:</h4>
                  <form role="form">
                    <div class="form-group">
                      <textarea class="form-control" rows="3"></textarea>
                    </div>
                    <button type="submit" class="btn btn-primary">Submit</button>
                  </form>
                </div>

                <hr>

                  <!-- Posted Comments -->

                  <!-- Comment -->
                  <div class="media">
                    <a class="pull-left" href="#">
                      <img class="media-object" src="http://placehold.it/64x64" alt="">
                    </a>
                    <div class="media-body">
                      <h4 class="media-heading">
                        Start Bootstrap
                        <small>August 25, 2014 at 9:30 PM</small>
                      </h4>
                      Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.
                    </div>
                  </div>

                  <!-- Comment -->
                  <div class="media">
                    <a class="pull-left" href="#">
                      <img class="media-object" src="http://placehold.it/64x64" alt="">
                    </a>
                    <div class="media-body">
                      <h4 class="media-heading">
                        Start Bootstrap
                        <small>August 25, 2014 at 9:30 PM</small>
                      </h4>
                      Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.
                      <!-- Nested Comment -->
                      <div class="media">
                        <a class="pull-left" href="#">
                          <img class="media-object" src="http://placehold.it/64x64" alt="">
                            </a>
                        <div class="media-body">
                          <h4 class="media-heading">
                            Nested Start Bootstrap
                            <small>August 25, 2014 at 9:30 PM</small>
                          </h4>
                          Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.
                        </div>
                      </div>
                      <!-- End Nested Comment -->
                    </div>
                  </div>

                </div>

    <!-- Blog Sidebar Widgets Column -->
    <div class="col-md-4">

      <!-- Blog Search Well -->
      <div class="well">
        <h4>Blog Search</h4>
        <div class="input-group">
          <input type="text" class="form-control">
            <span class="input-group-btn">
              <button class="btn btn-default" type="button">
                <span class="glyphicon glyphicon-search"></span>
              </button>
            </span>
          </div>
        <!-- /.input-group -->
      </div>

      <!-- Blog Categories Well -->
      <div class="well">
        <h4>Blog Categories</h4>
        <div class="row">
          <div class="col-lg-6">
            <ul class="list-unstyled">
              <li>
                <a href="#">Category Name</a>
              </li>
              <li>
                <a href="#">Category Name</a>
              </li>
              <li>
                <a href="#">Category Name</a>
              </li>
              <li>
                <a href="#">Category Name</a>
              </li>
            </ul>
          </div>
          <div class="col-lg-6">
            <ul class="list-unstyled">
              <li>
                <a href="#">Category Name</a>
              </li>
              <li>
                <a href="#">Category Name</a>
              </li>
              <li>
                <a href="#">Category Name</a>
              </li>
              <li>
                <a href="#">Category Name</a>
              </li>
            </ul>
          </div>
        </div>
        <!-- /.row -->
      </div>

      <!-- Side Widget Well -->
      <div class="well">
        <h4>Side Widget Well</h4>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore, perspiciatis adipisci accusamus laudantium odit aliquam repellat tempore quos aspernatur vero.</p>
      </div>

    </div>

  </div>
</div>modules/default/views/scripts/blog/_blogAddPost.phtml000060400000003327150710367660017032 0ustar00

<div class="col-md-12">
<form id="dialog-add-post" class="form-horizontal" action="<?php echo $this->baseUrl; ?>/blog/addpost" method="post">
	  <span class="indexBox4_title2">R�diger un commentaire</span>
	  <fieldset style="border:0;">

      <?php 
       $storage = null;
       try {
	        $auth = Zend_Auth::getInstance();
	        $auth->setStorage(new Zend_Auth_Storage_Session($this->session_storage));
	        $storage = $auth->getStorage()->read(); 
	      } catch (Zend_Exception $e) {
	      }
      
      if ($storage != null && $auth->hasIdentity() && isset($storage['user'])) { ?>
			  <div class="form-group">
				  <label for="pseudo" class="col-sm-12 text-left"><?php echo $storage['user']['prenom']; ?></label> 
				  <input name="pseudo" type="hidden" value="<?php echo $storage['user']['prenom']; ?>"> 
			  </div>
      <?php } else { ?>
			  <div class="form-group">
				  <label for="pseudo" class="col-sm-2 control-label">Pseudo</label>
            <div class="col-sm-10">
				      <input name="pseudo" type="text" class="form-control" required="">
			      </div>
			  </div>
      <?php } ?>
			    <div class="form-group">
				  <label for="commentaire" class="col-sm-2 control-label">Commentaire</label>
            <div class="col-sm-10">
              <textarea name="commentaire" class="form-control" rows="5" required=""></textarea> 
			      </div>
			  </div>
			  <div class="form-group">
            <div class="col-sm-12 text-center">
                <input type="submit" class="btn btn-default" value="Publier le commentaire" />
                <input type="hidden" name="subject_id" value="<?php echo $this->currentSubject['id']; ?>"/>
              </div> 
			  </div> 
	  </fieldset>
  </form>
</div>modules/default/views/scripts/blog/_blogShortDetailComment.phtml000060400000002277150710367660021244 0ustar00
 <?php $post = $this->currentPost; ?>
  <div class="media"> 
    <div class="media-body">
      <div class="col-md-9">
        <a class="pull-left" href="#">
          <?php echo $post['pseudo']; ?>
        </a>
        <small>&nbsp;
          <?php 
					  try {
					    $myDate = new Zend_Date(strtotime($post['date_updated']));
					    $mois = array('','Jan.', 'F�v.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Ao�t', 'Sept.', 'Oct.', 'Nov.', 'D�c.');
				      $moisComplet = array('','Janvier', 'F�vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'D�cembre');
				
					    echo $myDate->toString("dd").' '.$mois[(int)$myDate->toString('MM')].' '.$myDate->toString("YYYY"); 
					  } catch(Zend_Exception $e) {
						
					  } ?></small>
      </div> 
      <?php if ($this->currentCategory['is_close'] == 0 && $this->currentSubject['is_close'] == 0) { ?>
        <div class="col-md-3 text-right">
          <a href="#" class="btn btn-success" onclick="scrollTo('#dialog-add-post')">R�pondre&nbsp;<i class="fa fa-reply"></i></a>
        </div>
      <?php } ?>
      <div class="col-md-12"><p><?php echo $post['message']; ?></p></div>
    </div>
  </div>
<hr />modules/default/views/layouts/menuLayout.phtml000060400000001015150710367660015711 0ustar00<div class="menuLayoutBorder">
	<?php if ($this->listallannonces) { ?>	
	<div class="annonce_container">	 
			<div id="annonce-slider" class="coda-slider preload">
				<?php 
				$i = 1;
				$listAnnonce = $this->listallannonces;
				foreach ($listAnnonce as $row) { ?> 
					<div class="panel annonce_boxPanel"> 
						<div class="panel-wrapper">
							<div class="title-panel"><?php echo $i; ?></div> 
							<?php echo $row['CONTENT'];?>
						</div>
					</div>
				<?php $i++; } ?> 
			</div>
	</div>
	<?php } ?>
</div>modules/default/views/layouts/layout.phtml000060400000016221150710367660015071 0ustar00<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php header('Content-type: text/html; charset=iso-8859-1'); ?>
<head itemscope itemtype="http://schema.org/WebSite"> 
	<title><?php echo $this->title; ?></title>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
	<meta name="description" content="<?php echo $this->metadescription; ?>" />
	<meta name="keywords" content="<?php if (isset($this->metakeywords) && !empty($this->metakeywords)) {echo $this->metakeywords;}   ?>" />	
	<link rel="icon" type="image/png" href="<?php echo $this->baseUrl; ?>/favicon.ico" /> 	 
	<meta name="google-site-verification" content="<?php echo $this->google_site_verification; ?>" />
	<meta name="Reply-to" content="<?php echo $this->serviceClient_Mail; ?>" />
	<meta name="Copyright" content="<?php echo $this->siteName; ?>" />
 
<?php 
	$product = $this->detailProduct;
  if (isset($product) && !empty($product)) {
    $url = "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]; ?>
    <meta property="og:url" content="<?php echo $url; ?>" />
    <meta property="og:type" content="article" />
    <meta property="og:title" content="<?php echo strip_tags($this->escape($product['NOM'])); ?>" />
    <meta property="og:description" content="<?php echo strip_tags($product['DESCSHORT']); ?>" />
	
	<meta name="twitter:card" content="summary" />
    <meta name="twitter:url" content="<?php echo $url; ?>" />
	<meta name="twitter:title" content="<?php echo strip_tags($this->escape($product['NOM'])); ?>" />
	<meta name="twitter:description" content="<?php echo strip_tags($product['DESCSHORT']); ?>" />
	
    <?php if (isset($product['LISTPICS']) && isset($product['LISTPICS'][0])) { 
	$urlPic = "http://".$_SERVER["HTTP_HOST"].'/'.$product['LISTPICS'][0]['URL'];?>
    <meta property="og:image" content="<?php echo $urlPic; ?>" />
	<meta name="twitter:image" content="<?php echo $urlPic; ?>" />
<?php } }?> 

	<!-- Google Analytics -->
	<script type="text/javascript" >
	(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
	(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
	m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
	})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

	ga('create', '<?php echo $this->google_analytics; ?>', 'auto');
	ga('send', 'pageview');
	</script>
	<!-- End Google Analytics -->
	
	<script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "Organization",
      "url": "<?php echo $this->baseUrl_SiteCommerceUrl; ?>",
      "logo": "<?php echo $this->baseUrl_SiteCommerceUrl; ?>/business/image/logo.png"
    }
    </script>
	
	
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>

<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'/> 
<!--[if lte IE 8]>
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl; ?>/business/light/css/css_ie.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl; ?>/business/light/css/css.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl; ?>/business/light/css/responsive.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl; ?>/business/light/css/css_default.css" media="screen" />
<link rel="stylesheet" type='text/css' href='<?php echo $this->baseUrl; ?>/business/light/js/simplemodal/css/basic.css' media='screen' />
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl; ?>/business/light/js/superfish/css/superfish.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl; ?>/business/light/js/superfish/css/superfish-vertical.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl; ?>/business/light/js/fancybox/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl; ?>/business/light/js/jScrollPane/style/jquery.jscrollpane.css" media="all" />
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl; ?>/business/light/js/video-js/video-js.css" media="all" />

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/carouFredSel/jquery.carouFredSel-3.2.1-packed.js"></script>
<script type='text/javascript' src='<?php echo $this->baseUrl; ?>/business/light/js/debouncedresize/jquery.debouncedresize.js'></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/timer/jquery.timers.js"></script>
<script type="text/javascript" src='<?php echo $this->baseUrl; ?>/business/light/js/simplemodal/js/jquery.simplemodal.js'></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/superfish/js/hoverIntent.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/superfish/js/superfish.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/fancybox/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/fancybox/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/qtip/jquery.qtip-1.0.0-rc3.min.js"></script> 
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/tweetie/tweetie.js"></script>  
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/filterable/js/filterable.js" ></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/config.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/big_gallery.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/jScrollPane/script/jquery.jscrollpane.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/jScrollPane/script/jquery.mousewheel.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/video-js/video.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/jPlayer/jquery.jplayer.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/TinyNav/tinynav.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/touchSwipe/jquery.touchSwipe.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/lazyload/jquery.lazyload.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl; ?>/business/light/js/responsiveslides/responsiveslides.min.js"></script>
 
</head>
<body  id="body"> 
	<?php echo $this->render("headerLayout.phtml"); ?>

	<?php echo $this->layout()->content; ?>	
</body> 
</html>
modules/default/views/layouts/rightLayout.phtml000060400000001272150710367660016067 0ustar00
	
<!--[if IE]>
<style type="text/css">
.textA10, .textA9, .textA8b, .textA11 , .textA12, .textA13 {
  filter: glow(color=#000000,strength=1);
}
.linkA10, .linkA9, .linkA8b, .linkA11 , .linkA12, .linkA13 {
  filter: glow(color=#000000,strength=1);
}
</style>
<![endif]-->

<div class="rightPubContent">
	<?php if ($this->listannoncesright) {
		$listAnnonceRight = $this->listannoncesright;
		
		$idCat = $this->listannoncesrightCategory;
		foreach ($listAnnonceRight as $row) {
		$tabCategorie = explode(';',$row['ID_CATS']); 
		if (in_array($idCat, $tabCategorie) || in_array('0', $tabCategorie)) {
			
	?>
	<div class="menuExtraRightOpt"><?php echo $row['CONTENT'];?></div>
	<?php } } } ?>
</div>modules/default/views/layouts/extraHeaderLayout.phtml000060400000000000150710367660017172 0ustar00modules/default/views/layouts/leftLayout.phtml000060400000010272150710367660015704 0ustar00
<div class="leftLogo"> 
	<a title="Accueil" href="<?php echo $this->baseUrl; ?>/"><img alt="Directement � la source de la qualit�" src="<?php echo $this->baseUrl; ?>/business/image/logo.png" /></a>
</div> 
<div class="rightPromotion" > 
	<span class="link_shadow18_y2" > 
		<a href="<?php echo $this->baseUrl; ?>/nos-promotions.html" title="D�couvrez nos promotions">Promotions</a> 
	</span>
</div>
<div class="menuOngletsTitle"><span class="text_shadow18_w">Nos Produits</span></div>
 


<?php if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6' ) !== FALSE || strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7' ) !== FALSE ) { ?>
<div class="menuOnglets">
	<div  class="menuOnglet_1 <?php if ( $this->actualDesign['idCategory'] == 1 ) { echo 'menuOnglet_1_hover'; } ?>" ><a style="margin: 2px 0 0 60px;" id="onglet_1" href="<?php echo $this->baseUrl; ?>/industrie/1-manutention-levage.html" <?php if ( $this->actualDesign['idCategory'] == 1 ) { echo 'class="selected"'; } ?> >Manutention, levage</a></div>
	<div  class="menuOnglet_2 <?php if ( $this->actualDesign['idCategory'] == 2 ) { echo 'menuOnglet_2_hover'; } ?>" ><a style="margin: 0 0 0 60px;" id="onglet_2" href="<?php echo $this->baseUrl; ?>/industrie/2-prevention-environnement.html" <?php if ( $this->actualDesign['idCategory'] == 2 ) { echo 'class="selected"'; } ?>>Pr�vention de<br/> l'environnement</a></div>
	<div  class="menuOnglet_3 <?php if ( $this->actualDesign['idCategory'] == 3 ) { echo 'menuOnglet_3_hover'; } ?>" ><a style="margin: 0 0 0 60px;" id="onglet_3" href="<?php echo $this->baseUrl; ?>/industrie/3-stockage-rayonnage.html" <?php if ( $this->actualDesign['idCategory'] == 3 ) { echo 'class="selected"'; } ?>>Stockage,<br/> rayonnage</a></div>
	<div  class="menuOnglet_4 <?php if ( $this->actualDesign['idCategory'] == 4 ) { echo 'menuOnglet_4_hover'; } ?>" ><a style="margin: 0 0 0 60px;" id="onglet_4" href="<?php echo $this->baseUrl; ?>/industrie/4-entretien-proprete.html" <?php if ( $this->actualDesign['idCategory'] == 4 ) { echo 'class="selected"'; } ?>>Entretien,<br/> propret�</a></div>
	<div  class="menuOnglet_5 <?php if ( $this->actualDesign['idCategory'] == 5 ) { echo 'menuOnglet_5_hover'; } ?>" ><a style="margin: 0 0 0 60px;" id="onglet_5" href="<?php echo $this->baseUrl; ?>/industrie/5-protection-securite.html" <?php if ( $this->actualDesign['idCategory'] == 5 ) { echo 'class="selected"'; } ?>>Protection, s�curit�</a></div>
	<div  class="menuOnglet_6 <?php if ( $this->actualDesign['idCategory'] == 6 ) { echo 'menuOnglet_6_hover'; } ?>" ><a style="margin: 10px 0 0 60px;" id="onglet_6" href="<?php echo $this->baseUrl; ?>/industrie/6-emballage.html" <?php if ( $this->actualDesign['idCategory'] == 6 ) { echo 'class="selected"'; } ?>>Emballage</a></div>
	<div  class="menuOnglet_7 <?php if ( $this->actualDesign['idCategory'] == 7 ) { echo 'menuOnglet_7_hover'; } ?>" ><a style="margin: 10px 0 0 60px;" id="onglet_7" href="<?php echo $this->baseUrl; ?>/industrie/7-outillage.html" <?php if ( $this->actualDesign['idCategory'] == 7 ) { echo 'class="selected"'; } ?>>Outillage</a></div>
	<div  class="menuOnglet_8 <?php if ( $this->actualDesign['idCategory'] == 8 ) { echo 'menuOnglet_8_hover'; } ?>" ><a style="margin: 10px 0 0 60px;" id="onglet_8" href="<?php echo $this->baseUrl; ?>/industrie/8-mobilier-atelier.html" <?php if ( $this->actualDesign['idCategory'] == 8 ) { echo 'class="selected"'; } ?>>Mobilier d'atelier</a></div>
	<div  class="menuOnglet_9 <?php if ( $this->actualDesign['idCategory'] == 9 ) { echo 'menuOnglet_9_hover'; } ?>" ><a style="margin: 10px 0 0 45px;" id="onglet_9" href="<?php echo $this->baseUrl; ?>/industrie/9-mobilier-bureau-collectivite.html" <?php if ( $this->actualDesign['idCategory'] == 9 ) { echo 'class="selected"'; } ?>>Mobilier de bureau</a></div>
</div> 
<?php } else { echo $this->render("menuajax.phtml");  } ?> 
		
<div class="leftPubContent">
	<?php if ($this->listannoncesleft) {
		$listAnnonceLeft = $this->listannoncesleft;
		
		$idCat = $this->listannoncesleftCategory;
		foreach ($listAnnonceLeft as $row) {
		$tabCategorie = explode(';',$row['ID_CATS']); 
		if (in_array($idCat, $tabCategorie) || in_array('0', $tabCategorie)) {
			
	?>
	<div class="menuExtraRightOpt"><?php echo $row['CONTENT'];?></div>
	<?php } } } ?>
</div>

modules/default/views/layouts/breadcrumb.phtml000060400000002101150710367660015652 0ustar00
<?php if ($this->breadcrumb) { ?>
	<div class="col-xs-12 noPadding bread-crumb-box hidden-print">	
	<ol class="breadcrumb" itemscope="" itemtype="http://schema.org/BreadcrumbList">
	  <li><a href="<?php echo $this->baseUrl; ?>/">Accueil</a></li>
	  <?php 
		$breadcrumb = $this->breadcrumb;
  $currentType = "";
  $position = 0;
		  foreach ($breadcrumb as $row) {
      $link = "";
	     if (isset($this->isPromoPage) && $this->isPromoPage) {
		      $link = $this->baseUrl."/".Utils_Tool::getFormattedUrlCategory2($row['NAVNOM_URLPARENTS'], $row['NAVNOM'], $row['ID']);
	      } else {
		      $link = $this->baseUrl."/".Utils_Tool::getFormattedUrlCategory($row['NAVNOM_URLPARENTS'], $row['NAVNOM'], $row['ID']);
	      }
				$name =  $row['NOM'];
    $position++;
				?>
		  <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
        <a itemprop="item" href="<?php echo $link;?>"><span itemprop="name"><?php echo $name; ?></span></a>
        <meta itemprop="position" content="<?php echo $position; ?>" />
      </li>
		  <?php }?>
	</ol>
</div>
<?php }?>
modules/default/views/layouts/headerLayout.phtml000060400000006410150710367660016201 0ustar00
<div id="loader"><img src="<?php echo $this->baseUrl; ?>/business/light/img/loader2.gif" alt="Chargement du site en cours ..."/></div>

<?php  
	$currentCat = array();
	$currentCat = $this->currentCat;
	if (isset($currentCat) && !empty($currentCat['URL'])) { ?>
	<div id="background"><img src="<?php echo $this->baseUrl; ?>/<?php echo $currentCat['URL']; ?>" alt=""/></div>
<?php } ?>

<div id="logo"><a href="<?php echo $this->baseUrl; ?>/" title="<?php echo $this->siteName; ?>"><img class="logoimg" alt="Karen petit" src="<?php echo $this->baseUrl; ?>/business/light/img/logo.svg" /></a></div>

<div id="menu-show"><div id="menu-show-arrow"></div></div>
<div id="menu-hide"><div id="menu-hide-arrow"></div></div> 

<div id="menu">

<?php  
$params = array(
		'CATEGORIE_CURRENT' => 1, 
		'BASE_URL' => $this->baseUrl,
		'RESULT_MENUS' =>array(),
		'COLORS' => $this->designColors
);
if (isset($this->actualDesign) && !empty($this->actualDesign)) {
	$params['CATEGORIE_CURRENT'] = $this->actualDesign['idCategory'];
} 
function generateHTMLResponsiveMenu($data, $params) {
	$result = '';
	$counter = 0;
    $rowcount = 0;
	foreach ($data as $row) {
		if (isset($row['CATEGORIE']) && !empty($row['CATEGORIE'])) {
			$link_href = $params['BASE_URL']."/".Utils_Tool::getFormattedUrlCategory($row['CATEGORIE']['NAVNOM_URLPARENTS'], $row['CATEGORIE']['NAVNOM'], $row['CATEGORIE']['ID']);
			
			if (!empty($row['CATEGORIE']['URLREDIRECT'])) {
				$link_href = $row['CATEGORIE']['URLREDIRECT'];
			}
			
			if (isset($row['CHILDS']) && !empty($row['CHILDS'])) {
				$result .= '<li>';
				$result .= '<a href="'.$link_href.'">'.$row['CATEGORIE']['NOM'].'</a>';
				
				if ($link_href == "#") {
				$result .= '<ul>';
				$result .= generateHTMLResponsiveMenu($row['CHILDS'], $params);
				$result .= '</ul >';
				} 
			} else {
				$result .= '<li >';
				$result .= '<a  href="'.$link_href.'" >'.$row['CATEGORIE']['NOM'].'</a>';
				$result .= '</li >';
			}
		} 
	}
	return $result;
}

?>

        <?php if (isset($this->listallcategories)) { ?> 
		<ul class="sf-menu sf-vertical"> 
            <?php echo generateHTMLResponsiveMenu($this->listallcategories, $params);?>  
			<li>
				<a href="<?php echo $this->baseUrl; ?>/contact">CONTACT</a>
			</li>	
		</ul>
        <?php } ?> 
		
		<ul class="buy">
			<li>&nbsp;</li>
			<li>ESPACE CLIENT</li>
			<li>
				<ul>
					<li><a href="<?php echo $this->custom_link_1; ?>" title="JingoO" class="qtip"><img src="/business/light/img/icons/stock/fotolia.png" alt="JingoO" /></a></li>
				</ul>
			</li>
		</ul>
		<ul class="follow">
			<li>+</li>
			<li>
				<ul>
					<li><a href="<?php echo $this->link_media_facebook; ?>" title="Facebook" class="qtip"><img src="/business/light/img/icons/social/facebook.png" alt="Facebook" /></a></li>
					<li><a href="<?php echo $this->link_media_flickr; ?>" title="Printerest" class="qtip"><img src="/business/light/img/icons/social/pinterest.png" alt="Printerest" /></a></li>
					<li><a href="<?php echo $this->link_media_rss; ?>" title="500px" class="qtip"><img src="/business/light/img/icons/social/sharethis.png" alt="500px" /></a></li>
					<li><a href="<?php echo $this->custom_link_2; ?>" title="Instagram" class="qtip"><img src="/business/light/img/icons/social/instagram.png" alt="Instagram" /></a></li>
				</ul>
			</li>
		</ul> 
</div> modules/default/views/layouts/menuajax.phtml000060400000006733150710367660015373 0ustar00

<script type="text/javascript"> 
	$(function(){
		ddsmoothmenu.init({
			mainmenuid: "smoothMenu", //menu DIV id
			orientation: 'v', //Horizontal or vertical menu: Set to "h" or "v"
			classname: 'ddsmoothmenu', //class added to menu's outer DIV
			contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
		});
	});
</script>
<?php  
$params = array(
		'CATEGORIE_CURRENT' => 0, 
		'BASE_URL' => $this->baseUrl,
		'RESULT_MENUS' =>array(),
		'COLORS' => $this->designColors
);
if (isset($this->actualDesign) && !empty($this->actualDesign)) {
	$params['CATEGORIE_CURRENT'] = $this->actualDesign['idCategory'];
}

function generateHTMLMenu($data, $params) {
	$result = '';
	foreach ($data as $row) {
		if (isset($row['CATEGORIE']) && !empty($row['CATEGORIE'])) {

			$link_href = $params['BASE_URL']."/".Utils_Tool::getFormattedUrlCategory($row['CATEGORIE']['NAVNOM_URLPARENTS'], $row['CATEGORIE']['NAVNOM'], $row['CATEGORIE']['ID']);
				
			if ($row['CATEGORIE']['ID'] < 10) {
				
				if ($row['CATEGORIE']['ID'] == 1) {
					$result .= '<ul>'; 
				}
			
				$params['CATEGORIE_PARENT'] = $row['CATEGORIE']['ID'];

				$stringClass = "";
				if ($params['CATEGORIE_CURRENT'] == $row['CATEGORIE']['ID'] ) {
					$stringClass = "Selected";
				}
				 
				$result .= '<li class="linkOngletFirst">';
				$result .= '<a class="linkOnglet'.$stringClass.'_'.$row['CATEGORIE']['ID'].'" href="'.$link_href.'" id="fg-menu-category-'.$row['CATEGORIE']['ID'].'" >';
				
				if ($row['CATEGORIE']['ID'] == 1) {
					$result .= '<span>Manutention, levage</span>';
				} else  if ($row['CATEGORIE']['ID'] == 2) {
					$result .= "<span>Pr�vention de l'environnement</span>";
				} else if ($row['CATEGORIE']['ID'] == 3) {
					$result .= '<span>Stockage, rayonnage</span>';
				} else if ($row['CATEGORIE']['ID'] == 4) {
					$result .= '<span>Entretien et propret�</span>';
				} else if ($row['CATEGORIE']['ID'] == 5) {
					$result .= '<span>Protection, s�curit�</span>';
				} else if ($row['CATEGORIE']['ID'] == 6) {
					$result .= '<span>Emballage</span>';
				} else if ($row['CATEGORIE']['ID'] == 7) {
					$result .= '<span>Outillage</span>';
				} else if ($row['CATEGORIE']['ID'] == 8) {
					$result .= "<span>Mobilier d'atelier</span>";
				} else if ($row['CATEGORIE']['ID'] == 9) {
					$result .= '<span>Mobilier de bureau</span>';
				} else {
					$result .= '<span>'.$row['CATEGORIE']['NOM'].'</span>';
				}
			
				$result .= '</a>';

				$result .= '<ul style="border:1px solid '.$params['COLORS'][$params['CATEGORIE_PARENT']].';">';

				if (isset($row['CHILDS']) && !empty($row['CHILDS'])) {
					$result .= generateHTMLMenu($row['CHILDS'], $params);
				}
			}  else { 
				$result .= '<li >';
				$result .= '<a href="'.$link_href.'" class="linkSubOnglet_'.$params['CATEGORIE_PARENT'].'">';
				$result .= $row['CATEGORIE']['NOM'];
				$result .= '</a>';
				if ($row['LEVEL'] < 2) {
					if (isset($row['CHILDS']) && !empty($row['CHILDS'])) {
						$result .= '<ul style="border:1px solid '.$params['COLORS'][$params['CATEGORIE_PARENT']].';">';
						$result .= generateHTMLMenu($row['CHILDS'], $params);
						$result .= '</ul>';
					}
				}
				$result .= '</li>';
				
			}

			if ($row['CATEGORIE']['ID'] < 10) {
				$result .= '</ul></li>';  
			}
		} 
	}
	return $result;
}
?>

<noscript>
<?php $listMenu = generateHTMLMenu($this->listallcategories, $params);?>
</noscript> 
 <div class="menuOnglets">
	 <div id="smoothMenu" class="ddsmoothmenu" >
	<?php echo $listMenu;?>
	</div>  
 </div>
 







modules/default/views/layouts/extraLayout.phtml000060400000000704150710367660016074 0ustar00<?php if ($this->listallannoncesfooter) { ?>
<div class="extraLayoutOpt">
<?php 
	$listAnnonce = $this->listallannoncesfooter;
	foreach ($listAnnonce as $row) {
		$tabCategorie = explode(';',$row['CAT_ID']); 
		$selectedCategorie = array();
		for ($i=0;$i<sizeof($tabCategorie);$i++) {
			if ($this->breadcrumb[0]['ID'] == $tabCategorie[$i]) {
			?>
			<div  class="menuExtraOpt"> <?php echo $row['CONTENT'];?> </div>
	<?php } } } ?>
</div>
<?php }  ?>modules/default/views/layouts/footerLayout.phtml000060400000005131150710367660016246 0ustar00
<div class="footerBg col-sm-12 visible-sm visible-md visible-lg hidden-print">
	<div class="footerBgContent">
	
		<div class="col-sm-9">
		<?php 
			$custom_info_id = 4; 
			$listFooters = $this->listFooters;
      if (isset($listFooters)) {
      
			foreach ($listFooters as $footer) { ?>
	  			<div class="col-sm-4 footerTitle" >
			<?php if (empty($footer['URL'])) { ?>
						<a href="<?php echo $this->baseUrl; ?>/info<?php echo "-".$footer['ID']; ?>/<?php echo str_replace("page/","",$footer['TITRENAV']).".html"; ?>">
						
						<?php if ($footer['ID'] == $custom_info_id) {?>
							<img src="<?php echo $this->baseUrl; ?>/business/image/box-devdurable.png">
						<?php }
						echo $footer['TITRE']; ?></a>
					<?php } else { ?>
						<a target="_blank" href="http://<?php echo $footer['URL']; ?>"><?php echo $footer['TITRE']; ?></a>
			<?php } ?> 
  			</div>
		<?php }} ?>
      <div class="col-sm-4 footerTitle" >
        <a href="<?php echo $this->baseUrl; ?>/nos-marques.html">Nos marques</a>
      </div>
		</div>
  			<div class="col-sm-3" >
  				<div class="col-sm-12 footerMediaBoxTitle">Nous suivre sur :</div>
  				<div class="col-sm-12 footerMediaBox"><a target="_blank" href="<?php echo $this->link_media_facebook; ?>" data-placement="right" class="tooltips" title="Notre Facebook"><img src="<?php echo $this->baseUrl; ?>/business/image/icon-facebook.png"/> <span>Facebook</span></a></div>
  				<div class="col-sm-12 footerMediaBox"><a target="_blank" href="<?php echo $this->link_media_google; ?>" data-placement="right" class="tooltips" title="Notre page Google"><img src="<?php echo $this->baseUrl; ?>/business/image/icon-google.png"/> <span>Google +</span></a></div>
  				<div class="col-sm-12 footerMediaBox"><a target="_blank" href="<?php echo $this->link_media_twitter; ?>" data-placement="right" class="tooltips" title="Suivez nous sur Twitter"><img src="<?php echo $this->baseUrl; ?>/business/image/icon-twitter.png"/> <span>Twitter</span></a></div>
  				<div class="col-sm-12 footerMediaBox"><a target="_blank" href="<?php echo $this->link_media_viadeo; ?>"  data-placement="right" class="tooltips" title="Contactez nous via Viadeo"><img src="<?php echo $this->baseUrl; ?>/business/image/icon-viadeo.png"/> <span>Viadeo</span></a></div>
  			</div>
  			<div class="col-sm-12 text-center" >
  				<?php echo $this->custom_text_1; ?>
  			</div>
  	</div>
  	
  	
  	<div class="footerTitleRealised col-sm-12 visible-sm visible-md visible-lg hidden-print text-center">
  		<a href="http://www.web-entreprise.net" title="Web Entreprise" target="_blank">Site r�alis� par Web Entreprise</a>
  	</div>
  	
</div>modules/default/views/layouts/extraFooterLayout.phtml000060400000003631150710367660017255 0ustar00
<style type="text/css">
    .box-bottom-command {
        background: url('/business/image/bon-de-commande.jpg') bottom;
        height: 138px;
    }
    .box-bottom-command a {
        height: 140px;
        display:block;
    }
    .box-bottom-command a:link, .box-bottom-command a:visited, .box-bottom-command a:active {
        text-decoration: none;
        color: #bd2f2c;
    }
    .box-bottom-command a:hover {
        text-decoration: none;
    }
    .box-bottom-command-title {
        color: #5B595A;
        font-weight: bold;
        text-align: center;
        font-size: 20px;
        text-decoration: none;
    }
    .box-bottom-command-link {
        color: #bd2f2c;
        margin-top: 30px;
        font-size: 15px;
        text-align: right;
    }
    .box-bottom-command a:hover .box-bottom-command-link {
        text-decoration: underline;
    }
</style>
<div class="col-xs-12 hidden-print <?php echo $this->prefixPromoClass; ?>footer-content-divider"></div>
<div class="col-xs-12 noPadding footer-content-container hidden-print" >
	<?php 
		$extraFooter = $this->listallannoncesfooter;
		if (isset($extraFooter)) {		
			$counter = 0;
			foreach ($extraFooter as $row) { 
				if ($counter < 2) { ?>
					<div class="col-md-4 col-sm-6 col-xs-12 indexBox4 visible-md visible-lg noPadding" style="overflow: hidden; overflow-y:auto; ">	
						 <?php 	echo $row['CONTENT']; ?>
					</div>
			<?php } 
			$counter++;
		}
	} ?>
	<div class="col-md-4 col-sm-6 col-xs-12 indexBox4 noPadding footer-content-box-last noMargin visible-md visible-lg" style="margin-top: 10px;">
		<div  class="box-bottom-command">
            <a href="<?php echo $this->baseUrl; ?>/doc/bondecommande.pdf" target="_blank">
                <div class="box-bottom-command-title">T�l�charger un bon de commande</div>
                <div class="box-bottom-command-link">T�l�charger <br />& imprimer</div>
            </a>
	    </div> 
	</div> 
    
</div>modules/default/controllers/BlogController.php000060400000007636150710367660015671 0ustar00<?php

class BlogController  extends Modules_Default_Controllers_MainController
{

	public function init()
	{
		$this->view->baseUrl = $this->getBaseUrl();
		$this->checkMaintenance();
	}
    
	public function actualitesAction()
	{ 
		try {
            $blogCategory = new BlogCategory();
            $blogSubject = new BlogSubject(); 
            $id = 1;
            $this->view->type_name = "actualites"; 
            if ($this->getRequest()->getParam('id')) {
			    $id = (int)$this->getRequest()->getParam('id');  
		    } 

            $currentCategory = $blogCategory->fetchRow('ID = '.$id); 
            $this->view->currentCategory = $currentCategory; 
            $this->view->title = $currentCategory['title'];  
             
            $this->view->listSubjects = $blogSubject->AllSubjectsBy($id); 
            $this->view->listCategories = $blogCategory->getAllActivesCategories(1);  
        }
        catch (Zend_Exception $e) { 
			$this->view->messageError = $e->getMessage();
			$this->log($e->getMessage(),'err');
		}
	} 

    
	public function sujetAction()
	{ 
		try {
            $blogCategory = new BlogCategory();
            $blogSubject = new BlogSubject(); 
            $blogComment = new BlogComment(); 
            $id = 0; 
            if ($this->getRequest()->getParam('id')) {
			    $id = (int)$this->getRequest()->getParam('id');  
                
			    $added = (int)$this->getRequest()->getParam('a'); 
                if ($added == 1) {
                    $this->view->messageSuccess = "Le commentaire a �t� ajout�";
                } else if ($added == 2) {
                    $this->view->messageError = "Le commentaire n'a pas �t� ajout�";
                }
                
                $currentSubject = $blogSubject->fetchRow('ID = '.$id); 
			    $currentCategory = $blogCategory->fetchRow('ID = '.$currentSubject['id_category']); 
                $this->view->listSubjects = $blogSubject->AllSubjectsBy($currentSubject['id_category']); 
                $this->view->listComments = $blogComment->AllCommentsBy($id); 
                
                $this->view->listCategories = $blogCategory->getAllActivesCategories(1); 
                
                $this->view->currentCategory = $currentCategory; 
                $this->view->currentSubject = $currentSubject; 
                $this->view->title = $currentSubject['title'];  
		    }  
        }
        catch (Zend_Exception $e) { 
			$this->view->messageError = $e->getMessage();
			$this->log($e->getMessage(),'err');
		}
	}  
	public function addpostAction()
	{ 
		try {
		    if ($this->_request->isPost()) {
                $filter = new Zend_Filter();
			    $filter	->addFilter(new Zend_Filter_StripTags())
			    ->addFilter(new Zend_Filter_StringTrim());

			    $validator = new Zend_Validate();
			    $validator -> addValidator(new Zend_Validate_NotEmpty());

			    $params = array();
			    $params = $this->getRequest()->getPost();
			    $id = (int)$params['subject_id'];  
			    $pseudo = $filter->filter($params['pseudo']);
			    $message = $filter->filter($params['commentaire']);

                if ($validator->isValid($pseudo) && $validator->isValid($message) && $id > 0) {
                
                    $data = array (  
                                'id_subject' => $id,
                                'is_publish' =>  1,   
                                'pseudo' => $pseudo,
                                'message' => $message, 
                                'date_updated' => date('Y-m-d H:i:s') 
                    );

                    $blogComment = new BlogComment();
                    $blogComment->insert($data);
                    $this->_redirect('/blog/sujet/id/'.$id.'/a/1');
                }  else {
                    $this->_redirect('/blog/sujet/id/'.$id.'/a/2');
                }
            }
		} catch (Zend_Exception $e) { 
			$this->log($e->getMessage(),'err');
		}  
        $this->_redirect('/');
    }
}

?>modules/default/controllers/ErrorController.php000060400000004514150710367660016067 0ustar00<?php

class ErrorController  extends Zend_Controller_Action
{

	public function errorAction()
	{
		$errors = $this->_getParam('error_handler');
		$this->initLog();
		$exception = $errors->exception;
		$message = "Une erreure est survenue : ".$exception->getMessage().";<br/>URL : ".$this->getRequest()->getRequestUri();

		switch ($errors->type) {
			case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
				$message .= "<br/>TYPE : Le controller n'existe pas";
				break;
			case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
				$message .= "<br/>TYPE : Page introuvable";
				break;
			case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_OTHER:
				switch ($exception) {
					case 'Zend_View_Exception' :
						$message = "<br/>TYPE : 500 : Erreur de traitement d'une vue";
						break;
					case 'Zend_Db_Exception' :
						$message.= "<br/>TYPE : 503 : Erreur de traitement dans la base de donn�es";
						break;
					case 'Metier_Exception' :
						$message.= "<br/>TYPE : 200 : Erreur metier";
						break;
					default:
						$message.= "<br/>TRACE : ".$exception->getTraceAsString();
						break;
				}
				break;
		}
		$message .= "<br/>USER AGENT : ".getenv("HTTP_USER_AGENT");
		$botDetector = new BotDetector();
		$isBot = $botDetector->isBot(getenv("HTTP_USER_AGENT"));
		if ($isBot != 'ERROR') {
			$message .= "<br/>Bot : ".$isBot;
			$this->log($message,'warn');
		} else {
			$this->log($message,'err');
		} 
		$this->view->title = 'Un probl�me est survenu';
        $this->_response->clearBody();
        $this->_response->clearHeaders();
        $this->_response->setHttpResponseCode(404);
	}

	private function initLog() {
		$registry = Zend_Registry::getInstance();
		$loggerDefault = $registry->get('loggerDefault');

		$controller = Zend_Controller_Front::getInstance()->getRequest();
		$loggerDefault->setEventItem('controller', $controller->getControllerName().'::'.$controller->getActionName());
			
		$registry->set('loggerDefault', $loggerDefault);
	}

	private function log($message , $level) {
		$loggerDefault = Zend_Registry::get('loggerDefault');
		if ($level == 'info') {
			$loggerDefault->info($message);
		} elseif ($level == 'err') {
			$loggerDefault->err($message);
		} elseif ($level == 'warn') {
			$loggerDefault->warn($message);
		} elseif ($level == 'crit') {
			$loggerDefault->crit($message);
		}
	}

}
?>modules/default/controllers/CommandeController.php000060400000143440150710367660016523 0ustar00<?php

class CommandeController  extends Modules_Default_Controllers_MainController
{
	public function init()
	{
		$this->view->baseUrl = $this->getBaseUrl();
		$this->checkMaintenance();
	}

	public function indexAction()
	{
		$this->_redirect('/mon-panier.html');
	}
	public function livraisonAction()
	{
		$this->view->title = 'Livraison';
		$auth = Zend_Auth::getInstance();
		$auth->setStorage($this->getSessionStorage());
		$storage = $auth->getStorage()->read();

		if ($auth->hasIdentity() && isset($storage['user'])) {

			$usernamespace = $this->getSession();
			$myFacture = $usernamespace->myFactureValidate;

			if (isset($myFacture) && $myFacture->isFactureValid(1)) {

				$this->view->etapeCommande = 3;
				$this->view->linksMenu = $this->generateLinksMenu(3);

				$dataLiv = array();

				if (isset($usernamespace->addresseLiv) && !empty($usernamespace->addresseLiv)) {
					$dataLiv = $usernamespace->addresseLiv;
				} else {
					$raisonsocial = "";
					if ($storage['user']['type'] == "Professionnel") {
						$raisonsocial = $storage['user']['raisonsocial'];
					} else {
						$raisonsocial = $storage['user']['prenom']." ".$storage['user']['nom'];
					}
					$dataLiv = array('raisonsocial' => $raisonsocial,
                                  'adresse' => $storage['user']['adresse'], 
                                  'adressecomplete' => $storage['user']['adressecomplete'], 
                                  'cp' => $storage['user']['cp'], 
                                  'ville' => $storage['user']['ville'], 
                                  'pays' => $storage['user']['pays'],
                                  'type' => $storage['user']['type']);
					$usernamespace->addresseLiv = $dataLiv;
				}

				$this->view->adresseLiv = $dataLiv;
					
			} else {
				$this->_redirect('/mon-panier.html');
			}
		}  else {
			$this->_redirect('/mon-panier-connexion.html');
		}
	}
	public function ajaxlivraisonAction()
	{
		$auth = Zend_Auth::getInstance();
		$auth->setStorage($this->getSessionStorage());
		$storage = $auth->getStorage()->read();

		if ($auth->hasIdentity() && isset($storage['user'])) {

			$usernamespace = $this->getSession();
			$myFacture = $usernamespace->myFactureValidate;
			if (isset($myFacture) && $myFacture->isFactureValid(1)) {
				if ($this->getRequest()->isPost()) {
					$filter = new Zend_Filter();
					$filter	->addFilter(new Zend_Filter_StripTags())
					->addFilter(new Zend_Filter_StringTrim())
					->addFilter(new Zend_Filter_HtmlEntities(ENT_COMPAT, 'UTF-8')); //for mootools

					$validator = new Zend_Validate();
					$validator -> addValidator(new Zend_Validate_NotEmpty());

					$livuser_raisonsocial = $filter->filter(strtoupper($this->getRequest()->getPost('livuser_raisonsocial')));

					$adresse_type = $this->getRequest()->getPost('address_type');
					if ($adresse_type == 'new') {
						$livuser_adresse = $filter->filter($this->getRequest()->getPost('livuser_adresse'));
						$livuser_cp = $filter->filter($this->getRequest()->getPost('livuser_cp'));
						$livuser_ville = $filter->filter($this->getRequest()->getPost('livuser_ville'));
						$livuser_pays = $filter->filter($this->getRequest()->getPost('livuser_pays'));
						$livuser_adressecomplete = $filter->filter($this->getRequest()->getPost('livuser_adressecomplete'));
					} else {
						$livuser_adresse = $filter->filter($this->getRequest()->getPost('livuser_adresse_old'));
						$livuser_cp = $filter->filter($this->getRequest()->getPost('livuser_cp_old'));
						$livuser_ville = $filter->filter($this->getRequest()->getPost('livuser_ville_old'));
						$livuser_pays = $filter->filter($this->getRequest()->getPost('livuser_pays_old'));
						$livuser_adressecomplete = $filter->filter($this->getRequest()->getPost('livuser_adresse_old'));
					}

					if ($validator->isValid($livuser_raisonsocial) &&
					$validator->isValid($livuser_adresse) &&
					$validator->isValid($livuser_ville) &&
					$validator->isValid($livuser_pays) &&
					$validator->isValid($livuser_cp)
					) {
						$dataLiv = array(
	                                  'raisonsocial' =>$livuser_raisonsocial, 
	                                  'adresse' => $livuser_adresse, 
									  'adressecomplete' => $livuser_adressecomplete,
	                                  'cp' => $livuser_cp, 
	                                  'ville' => $livuser_ville, 
	                                  'pays' => $livuser_pays, 
	                                  'type' => $storage['user']['type']);
							
						$usernamespace->addresseLiv = $dataLiv;
						$this->view->adresseLiv = $dataLiv;
						$this->view->messageSuccess = "Votre adresse a �t� modifi�e";
					} else {
						foreach ($validator->getErrors() as $errorCode) {
							$this->view->messageError =  $this->getErrorValidator($errorCode);
						}
					}
				}
			}
		}
		$this->_forward('ajaxlivraison','ajax');
	}

	public function connexionAction() {
		$this->view->title = 'Connexion';
		$auth = Zend_Auth::getInstance();
		$auth->setStorage($this->getSessionStorage());
		$storage = $auth->getStorage()->read();

		if ($auth->hasIdentity() && isset($storage['user'])) {
			$this->_redirect('/mon-panier-livraison.html');
		} else {
			$this->view->linksMenu = $this->generateLinksMenu(2);
		}
	}

	public function ajaxconnexionAction() {
		if ($this->getRequest()->isPost()) {
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(4));

			$login = $filter->filter($this->getRequest()->getPost('connexion_login'));
			$mdp = $filter->filter($this->getRequest()->getPost('connexion_mdp'));

			if ($validator->isValid($login) && $validator->isValid($mdp)) {
				$this->view->messageSuccess = $this->connectMe($login, $mdp);
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageSuccess =  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('ajaxvalue','ajax');
	}

	public function ajaxenregistrementAction() {
		$isAdd = false;
		if ($this->getRequest()->isPost()) {

			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());
			$filter2 = new Zend_Filter();
			$filter2->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_Digits());

			$filterMaj = new Zend_Filter();
			$filterMaj->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_StringToUpper());

			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(4));

			$validatorTel = new Zend_Validate();
			$validatorTel -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(10));

			$validator2 = new Zend_Validate();
			$validator2 -> addValidator(new Zend_Validate_NotEmpty());
 
			$validatorEmail = new Zend_Validate_EmailAddress();

			$adduser_login = $filter->filter($this->getRequest()->getPost('adduser_login'));
			$adduser_mdp = $filter->filter($this->getRequest()->getPost('adduser_mdp'));
			$adduser_mdp2 = $filter->filter($this->getRequest()->getPost('adduser_mdp2'));

			$adduser_civility = $filter->filter($this->getRequest()->getPost('adduser_civility'));
			$adduser_nom = $filterMaj->filter($this->getRequest()->getPost('adduser_nom'));
			$adduser_prenom = $filter->filter($this->getRequest()->getPost('adduser_prenom'));
             
			$adduser_fct = $filter->filter($this->getRequest()->getPost('adduser_fct'));
			$adduser_tel = $filter2->filter($this->getRequest()->getPost('adduser_tel'));
			$adduser_fax = $filter2->filter($this->getRequest()->getPost('adduser_fax'));
			$adduser_email = $adduser_login;// $filter->filter($this->getRequest()->getPost('adduser_email'));


			$adduser_adresse = $filter->filter($this->getRequest()->getPost('adduser_adresse'));
			$adduser_cp = $filter->filter($this->getRequest()->getPost('adduser_cp'));
			$adduser_ville = $filter->filter($this->getRequest()->getPost('adduser_ville'));
			$adduser_pays = $filter->filter($this->getRequest()->getPost('adduser_pays'));
			$adduser_departement = $filter->filter($this->getRequest()->getPost('adduser_departement'));
			$adduser_region = $filter->filter($this->getRequest()->getPost('adduser_region'));
			$adduser_adressecomplete = $filter->filter($this->getRequest()->getPost('adduser_adressecomplete'));

			$adresse_type = $this->getRequest()->getPost('address_type');
			if ($adresse_type == 'new') {
				$adduser_adresse = $filter->filter($this->getRequest()->getPost('adduser_adresse'));
				$adduser_cp = $filter->filter($this->getRequest()->getPost('adduser_cp'));
				$adduser_ville = $filter->filter($this->getRequest()->getPost('adduser_ville'));
				$adduser_pays = $filter->filter($this->getRequest()->getPost('adduser_pays'));
				$adduser_departement = $filter->filter($this->getRequest()->getPost('adduser_departement'));
				$adduser_region = $filter->filter($this->getRequest()->getPost('adduser_region'));
				$adduser_adressecomplete = $filter->filter($this->getRequest()->getPost('adduser_adressecomplete'));
			} else {
				$adduser_adresse = $filter->filter($this->getRequest()->getPost('adduser_adresse_old'));
				$adduser_cp = $filter->filter($this->getRequest()->getPost('adduser_cp_old'));
				$adduser_ville = $filter->filter($this->getRequest()->getPost('adduser_ville_old'));
				$adduser_pays = $filter->filter($this->getRequest()->getPost('adduser_pays_old'));
				$adduser_departement = '';
				$adduser_region = '';
				$adduser_adressecomplete = $filter->filter($this->getRequest()->getPost('adduser_adresse_old'));
			}

			$adduser_raisonsocial = $filterMaj->filter($this->getRequest()->getPost('adduser_raisonsocial'));
			$adduser_siret = $filterMaj->filter($this->getRequest()->getPost('adduser_siret'));
			$adduser_numidfisc = $filterMaj->filter($this->getRequest()->getPost('adduser_numidfisc'));
			$adduser_codeape = $filterMaj->filter($this->getRequest()->getPost('adduser_codeape'));
			$adduser_sectactivite = $filterMaj->filter($this->getRequest()->getPost('adduser_sectactivite'));

			$adduser_comm = $filter->filter($this->getRequest()->getPost('adduser_comm'));

			$adduser_newsletter = $filter->filter($this->getRequest()->getPost('adduser_newsletter'));

			$typeUser = $filter->filter($this->getRequest()->getPost('adduser_typeuser'));

			$date = new Zend_Date();
			$dateinsc = $date->toString('YYYY-MM-dd HH:mm:ss');

			$data = array(
                                  'LOGIN' => utf8_decode($adduser_login), 
                                  'MDP' => md5($adduser_mdp), 
                                  'ROLE' => 0, 
                                  'NOM' => utf8_decode($adduser_nom), 
                                  'PRENOM' => utf8_decode($adduser_prenom),
                                  'CIVILITE' => $adduser_civility, 
                                  'FONCTION' => utf8_decode($adduser_fct), 
                                  'RAISONSOCIAL' => utf8_decode($adduser_raisonsocial), 
                                  'ADRESSE' => utf8_decode($adduser_adresse), 
                                  'CP' => utf8_decode($adduser_cp), 
                                  'VILLE' => utf8_decode($adduser_ville), 
                                  'DEPARTEMENT' => utf8_decode($adduser_departement), 
                                  'REGION' => utf8_decode($adduser_region), 
								  'ADRESSECOMPLETE' => utf8_decode($adduser_adressecomplete),
                                  'PAYS' => utf8_decode($adduser_pays), 
                                  'EMAIL' => utf8_decode($adduser_email), 
                                  'TEL' => $adduser_tel, 
                                  'FAX' => $adduser_fax, 
                                  'SIRET' => utf8_decode($adduser_siret), 
								  'NUMIDFISC' => utf8_decode($adduser_numidfisc),
                                  'CODEAPE' => utf8_decode($adduser_codeape), 
                                  'SECTACTIVITE' => utf8_decode($adduser_sectactivite), 
                                  'COMMENTAIRE' => utf8_decode($adduser_comm),  
                                  'TYPE' => $typeUser, 
                                  'DATEINSC' => $dateinsc);

			$isTypeOk = false;
			if ($validator2->isValid($typeUser)) {
				$isTypeOk = true;
			}

			$errorType = 0;
			if ($validator->isValid($adduser_mdp) && $validator->isValid($adduser_mdp2) &&
			$validator2->isValid($adduser_civility) &&
			$validator2->isValid($adduser_nom) && $validator2->isValid($adduser_adresse) &&
			$validator2->isValid($adduser_prenom) && $validator2->isValid($adduser_ville) &&
			$validator2->isValid($adduser_pays) &&
			$validatorEmail->isValid($adduser_login) && $validator2->isValid($adduser_cp)
			) {
				if ($isTypeOk) {
					if ($typeUser == "Professionnel") {
						if ($validator2->isValid($adduser_raisonsocial) &&
						$validator2->isValid($adduser_siret) &&
						$validator2->isValid($adduser_numidfisc) &&
						$validator2->isValid($adduser_codeape)) {

						} else { 
							$errorType = 3;
							foreach ($validator2->getErrors() as $errorCode) {
								$this->view->messageSuccess =  $this->getErrorValidator($errorCode);
							}
						}
					}
				} else {
					$errorType = 2;
					$this->view->messageSuccess =  "Vous devez choisir entre Particulier et Professionnel. ";
				}
			} else {
				$errorType = 1; 
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageSuccess =  $this->getErrorValidator($errorCode);
				}
				foreach ($validator2->getErrors() as $errorCode) {
					$this->view->messageSuccess =  $this->getErrorValidator($errorCode);
				}
				foreach ($validatorEmail->getErrors() as $errorCode) {
					$this->view->messageSuccess =  $this->getErrorValidator($errorCode);
				}
			}


			if ($errorType == 0) {
				if ($validatorTel->isValid($adduser_tel)) {
					if ($adduser_mdp2 == $adduser_mdp) {

						try {
							$user = new User();

							$isExistLogin = $user->fetchRow("LOGIN = '".$adduser_login."'");

							if (!$isExistLogin) {

								$isExistEmail = $user->fetchRow("EMAIL = '".$adduser_email."'");
								if (!$isExistEmail) {
									$isAdd = $user->insert($data);
									$this->log("Nouveau client : ".$adduser_email,'info');
									if ($adduser_newsletter) {
										$user_newsletter = new UserNewsletter();
										$code = md5($dateinsc.'_'.$adduser_email);
											
										$isExistNL = $user_newsletter->fetchRow("EMAIL = '".$adduser_email."'");

										if(!$isExistNL) {
											$dataNL = array(
						 	 					'EMAIL' => $adduser_email,
						 	 					'DATEINS' => $dateinsc,
						 	 					'CODE' => $code
											);
											$user_newsletter->insert($dataNL);
										}
									}

									$this->view->messageSuccess = $this->connectMe($adduser_login, $adduser_mdp);
								} else {
									$this->view->messageSuccess =  "L'email est d�j� utilis�.";
								}
							} else {
								$this->view->messageSuccess =  "L'identifiant existe d�j�";
							}
						} catch (Zend_Exception $e) {
							$this->log($e->getMessage(),'err');
							$this->view->messageSuccess =  "Une erreur est survenue, v�rifier vos informations.";
						}
					} else {
						$this->view->messageSuccess =  "V�rifier votre mot de passe";
					}
				} else {
					$this->view->messageSuccess =  "V�rifier votre num�ro de t�l�phone";
				}
			}
		}
		$this->_forward('ajaxvalue','ajax');
	}


	private function computeBill($statut,$reference,$id,$facture,$addresseLiv, $user) {
		$fact_raisonsociale = $user['prenom']." ".strtoupper($user['nom']);
		if ($user['type'] == "Professionnel") {
			$fact_raisonsociale = $user['raisonsocial'];
		} 
		$USER_MODEPAIEMENT_LABEL = " Paiement s�curis� en ligne";
		switch ($user['modepaiement']) {
			case 1 : $USER_MODEPAIEMENT_LABEL = " Paiement s�curis� en ligne"; break;
			case 2 : $USER_MODEPAIEMENT_LABEL = " Contre remboursement";break;
			case 3 : $USER_MODEPAIEMENT_LABEL = " Paiement diff�r� - 30 jours";break;
			case 4 : $USER_MODEPAIEMENT_LABEL = " Paiement diff�r� - 45 jours";break;
			case 5 : $USER_MODEPAIEMENT_LABEL = " Paiement diff�r� - 60 jours";break;
			case 6 : $USER_MODEPAIEMENT_LABEL = " A r�ception de la facture";break;
		}
        
        if($statut == 10) {
            $USER_MODEPAIEMENT_LABEL = "Devis";
        }

		$data = array (
						'REFERENCE' => $reference, 
						'PRIXTOTALHTHR' => $facture->total_HT_HR,
						'PRIXREMISEEUR' => $facture->total_remise,
						'PRIXTOTALHT' => $facture->total_HT,
						'PRIXFRAISPORT' => $facture->total_frais_port,
						'PRIXFRAISPORTPOUR' => $facture->total_frais_port_pour,
						'PRIXTOTALHTFP' => $facture->total_HT_FP,
						'PRIXTOTALTTC' => $facture->total_TTC,
						'PRIXTOTALTVA' => $facture->total_TVA,
						'DATESTART' => $facture->date_start, 
						'IDUSER' => $user['id'],
						'STATUT' => $statut,
						'LIV_RAISONSOCIAL' => $addresseLiv['raisonsocial'],
						'LIV_ADRESSE' => $addresseLiv['adresse'],
						'LIV_CP' => $addresseLiv['cp'],
						'LIV_VILLE' => $addresseLiv['ville'],
						'LIV_PAYS' => $addresseLiv['pays'],
						'FACT_RAISONSOCIAL' => $fact_raisonsociale,
						'FACT_ADRESSE' => $user['adresse'],
						'FACT_CP' => $user['cp'],
						'FACT_VILLE' => $user['ville'],
						'FACT_PAYS' => $user['pays'],
						'USER_NOM' =>$user['nom'],
						'USER_PRENOM' =>$user['prenom'],
						'USER_TEL' =>$user['tel'],
						'USER_FAX' =>$user['fax'],
						'USER_NUMCOMPTE' =>$user['numcompte'],
						'USER_EMAIL' =>$user['email'],
						'USER_MODEPAIEMENT' =>$user['modepaiement'],
						'USER_TYPE' =>$user['type'],
						'USER_MODEPAIEMENT_LABEL' =>$USER_MODEPAIEMENT_LABEL,
						'CADDY' => $facture->facture_lines,
						'INFOLIV' => $facture->livraison,
						'CODEREDUCTION' => $facture->code_reduction,
						'ID_COMMAND' => $id
		);
        $data['CADDYFIDELITE'] = array();
        if($statut != 10) {
            $data['CADDYFIDELITE'] = $facture->facture_fidelite_lines;
        } else {
            $facture->facture_fidelite_lines = array();            
        }
		return $data;
	}
 
	public function validationAction()
	{
		try {
			$this->view->title = 'Confirmation de votre commande';
			$auth = Zend_Auth::getInstance();
			$auth->setStorage($this->getSessionStorage());
			$storage = $auth->getStorage()->read();

			if ($auth->hasIdentity() && isset($storage['user'])) {
				
				$this->view->user = $storage['user'];

				$usernamespace = $this->getSession();
				$addresseLiv = $usernamespace->addresseLiv;
				$facture = $usernamespace->myFactureValidate;

				if ($this->isExisteArray($addresseLiv) && $facture->isFactureValid(2)) {
					$this->view->etapeCommande = 4;
					$this->view->linksMenu = $this->generateLinksMenu(4); 
					$usernamespace->myFactureValidate = $facture;

					$data = $this->insertNewCommand(0,'Validating','',$facture, $addresseLiv,$storage['user']);
					$usernamespace->commandAdded = $data;

					$facture = $this->computeBill(0,$data['REFERENCE'],$data['ID'],$facture, $addresseLiv, $storage['user']);
					$this->view->facture = $facture;

					$promo = new PromoCalculator();
					$this->view->isCommandValid = $promo->isCommandValid($facture['PRIXTOTALHT']);

				} else {
					$this->_redirect('/mon-panier.html');
				}
			}  else {
				$this->_redirect('/connectez-vous.html');
			}
		} catch (Zend_Exception $e) {
			$this->log("Erreur : validationAction() ".$e->getMessage(),'err');
			$this->_redirect('/');
		}
	}

	private function isExisteArray($array) {
		if (isset($array) && sizeof($array) > 0) {
			return true;
		} else {
			return false;
		}
	}
	public function paiementAction() {
		try {

			$auth = Zend_Auth::getInstance();
			$auth->setStorage($this->getSessionStorage());
			$storage = $auth->getStorage()->read();
			$ispaiementOk = false;
            $sendmail = true;
			
			if ($auth->hasIdentity() && isset($storage['user'])) {
				$modepaiement = $storage['user']['modepaiement']; 
				$payment_status = 'Pending';
				$txn_id = '';
				
				$type_paiement = '';
				$type = 0;
				$type_prefix = 'Mode de paiement : ';
				switch ($modepaiement) {
					case 1 :
						$type_paiement = $type_prefix.'Paiement s�curis� en ligne';
						$ispaiementOk = true;
                        $sendmail = false;
						if ($this->ipnPaypalListenerValidate()) {
							$payment_status = $this->_request->getParam('payment_status');
							$txn_id = $this->_request->getParam('txn_id');
						} 
						break;
					default :
						$ispaiementOk = false;
						break;
				}
				
				if ((int)$this->getRequest()->getParam('type') > 0) {
					$type = (int)$this->getRequest()->getParam('type'); 
					switch ($type) {
						case 1 : 
							$ispaiementOk = true; 
							$type_paiement = $type_prefix.'Par ch�que';
							break;
						case 2 : 
							$ispaiementOk = true; 
							$type_paiement = $type_prefix.'Par virement';
							break;
						case 3 : 
							$ispaiementOk = true; 
							switch ($modepaiement) { 
								case 2 : $type_paiement = $type_prefix."Contre remboursement";break;
								case 3 : $type_paiement = $type_prefix."Paiement diff�r� - 30 jours";break;
								case 4 : $type_paiement = $type_prefix."Paiement diff�r� - 45 jours";break;
								case 5 : $type_paiement = $type_prefix."Paiement diff�r� - 60 jours";break;
								case 6 : $type_paiement = $type_prefix."A r�ception de la facture";break;
							} 
							break; 
					}
				} 
			} else {
			    $this->log("Erreur : paiementAction() No user",'warn');
            }

			if ($ispaiementOk) {
			    $this->log("Erreur : paiementAction() Paiement Ok",'warn');
				$this->finishandclosepaiement($payment_status, $txn_id, $type_paiement, $type, $sendmail);				
			}  else {
			    $this->log("Erreur : paiementAction() Redirect Home",'warn');
				$this->_redirect('/');
			}

		}catch (Zend_Exception $e) {
			$this->log("Erreur : paiementAction() ".$e->getMessage(),'err');
			$this->_redirect('/');
		}
	}

	private function sendMailCommande($facture, $to) {


		$view = new Zend_View();
		$view->addScriptPath('../application/modules/default/views/scripts/commande/');
		$view->assign("facture",$facture);
		$view->assign("baseUrl", "http://".$this->site_actualshort);
		$view->assign("baseUrl_SiteCommerceUrl", $this->baseUrl_SiteCommerceUrl);
		$view->assign("serviceClient_Mail", $this->serviceClient_Mail);
		
		$view->assign("siteName", $this->siteName);
		$view->assign("site_addresse3_title", $this->site_addresse3_title);
		$view->assign("site_addresse3_address", $this->site_addresse3_address);
		$view->assign("site_addresse3_cp", $this->site_addresse3_cp);
		$view->assign("site_addresse", $this->site_addresse);
		$view->assign("site_actualshort", $this->site_actualshort);
		
		$view->assign("site_rib_numbers", $this->site_rib_numbers);
		$view->assign("site_rib_iban", $this->site_rib_iban);
		$view->assign("site_rib_bic", $this->site_rib_bic);
		$view->assign("site_rib_bankname", $this->site_rib_bankname);

		$body = $view->render("facture_mail.phtml");

		$from =  $this->serviceClient_Mail;

		if ($facture['STATUT'] == 1) { $objet = "Votre commande : ".$facture['REFERENCE']; } else {$objet = "Votre devis : ".$facture['REFERENCE'];}

		$mail = new Zend_Mail();
		$mail->setBodyHtml($body);
		$mail->setFrom($from, $this->siteName);
		$mail->addTo($to);
		$mail->setSubject($objet);
		try {
			$mail->send();
			$this->log("L'email de commande a �t� envoy� a : ".$to,'info');
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
		}
	}

	private function referencegen() {
		$chaine ="mnoTUzS5678kVvwxy9WXYZRNCDEFrslq41GtuaHIJKpOPQA23LcdefghiBMbj0";
		srand((double)microtime()*1000000);
		for($i=0; $i<10; $i++){
			@$pass .= $chaine[rand()%strlen($chaine)];
		}
		return $pass;
	}

	private function generateLinksMenu($etapeCommande){
		$linksMenu = array();
		switch ($etapeCommande) {
			case 2 :
				$linksMenu[0]['NAVURL'] = '/mon-panier.html';
				$linksMenu[0]['NAVNOM'] = 'Mon Panier';
				$linksMenu[1]['NAVURL'] = '/mon-panier-connexion.html';
				$linksMenu[1]['NAVNOM'] = 'Identification';
				break;

			case 3 :
				$linksMenu[0]['NAVURL'] = '/mon-panier.html';
				$linksMenu[0]['NAVNOM'] = 'Mon Panier';
				$linksMenu[1]['NAVURL'] = '/mon-panier-livraison.html';
				$linksMenu[1]['NAVNOM'] = 'Livraison';
				break;

			case 4 :
				$linksMenu[0]['NAVURL'] = '/mon-panier.html';
				$linksMenu[0]['NAVNOM'] = 'Mon Panier';
				$linksMenu[1]['NAVURL'] = '/mon-panier-livraison.html';
				$linksMenu[1]['NAVNOM'] = 'Livraison';
				$linksMenu[2]['NAVURL'] = '/mon-panier-validation.html';
				$linksMenu[2]['NAVNOM'] = 'Validation';
				break;

		}

		return $linksMenu;
	}
    
	private function updateCommandFidelite($id, $facture) {
        $commandFidelite = new CommandFidelite();
        $commandFidelite->delete('IDCOMMAND = '.$id); 
		foreach ($facture->facture_fidelite_lines as $row) {
			$dataCaddyFidelite = array (
						'IDFIDELITE' => $row->fidelite_id,
						'NBPOINT' => $row->fidelite_nbpoint,                  
						'NOM' => $row->fidelite_nom,
						'IDCOMMAND' => $id
			);
			$commandFidelite->insert($dataCaddyFidelite);
		}
    }

	private function updateCommand($id, $payment_status,$txn, $statut) {

		try {
			$command = new Command();
			$data = array(
			'PAYMENT_STATUS' => $payment_status,
			'TXN_ID' => $txn,
			'STATUT' => $statut
			);
			$command->update($data,'ID = '.$id);
            
            if ($statut != 10 && $this->carte_fidelite_enabled) {
                 $facture = $command->getCommandAsFacture($id);
			     $commandProduct = new CommandProduct();
			     $productChild = new ProductChild();
                 foreach($facture['CADDY'] as $row) {
                    $child = $productChild->fetchRow('ID = '.$row['ID']);
                    $dataProd = array(
			            'POINTFIDELITE' => $child['POINTFIDELITE'],
			            'POINTFIDELITESUM' => $child['POINTFIDELITE'] * $row['QUANTITY']
			        );
			        $commandProduct->update($dataProd,'ID = '.$row['IDLINE']);
                }
            }
		} catch(Zend_Exception $e) {
			$this->log('Erreur lors de la mise a jour de la commande : '.$id.' Message : '.$e->getMessage(),'err');
			return false;
		}
		return true;
	}

	private function updateCommandByID($id, $payment_status,$txn, $statut) {
		try {
			$command = new Command();
			$data = array(
			'PAYMENT_STATUS' => $payment_status,
			'TXN_ID' => $txn,
			'STATUT' => $statut
			);
			$command->update($data,'ID = '.$id);

			$currentCommand = $command->fetchRow('ID = '.$id);
			if (isset($currentCommand) && !empty($currentCommand) && !empty($currentCommand['CODEREDUCTION'])) {
				$codeReduction = new CodeReduction();
				$date = new Zend_Date();
				$data = array(
					"isACTIF" => 0,
					"NOM" => $currentCommand['USER_NOM'],
					"PRENOM" => $currentCommand['USER_PRENOM'],
					"IDUSER" => $currentCommand['IDUSER'],
					"ID" => $id,
					"DATEUSE" => $date->toString('YYYY-MM-dd HH:mm:ss')
				);
				$codeReduction->update($data,"CODE = '".$currentCommand['CODEREDUCTION']."'");
			}

		} catch(Zend_Exception $e) {
			$this->log('Erreur lors de la mise a jour de la commande ID : '.$id.' Message : '.$e->getMessage(),'err');
			return false;
		}
		return true;
	}


	private function updateCommandByIDUNVERIFIED($id, $paymentStat) {
		try {
			$command = new Command();
			$data = array(
			'PAYMENT_STATUS' => $paymentStat,
			'STATUT' => 1
			);
			$command->update($data,'ID = '.$id);
		} catch(Zend_Exception $e) {
			$this->log('Erreur lors de la mise a jour de la commande ID : '.$id.' Message : '.$e->getMessage(),'err');
			return false;
		}
		return true;
	}

	private function deleteNewCommand($id) {
		try {
			$command = new Command();
			$commandProduct = new CommandProduct();

			$commandProduct->delete('IDCOMMAND = '.$id);
			$command->delete('ID = '.$id);
		} catch(Zend_Exception $e) {
			$this->log('Erreur lors de la suppression de la commande : '.$id.' Message : '.$e->getMessage(),'err');
			return false;
		}
		return true;
	}


	private function insertNewCommand($statut,$payment_status,$txn, $myFacture, $addresseLiv, $user) {
		$command = new Command();
		$fact_raisonsociale = $user['prenom']." ".strtoupper($user['nom']);
		if ($user['type'] == "Professionnel") {
			$fact_raisonsociale = $user['raisonsocial'];
		}
		$codereduction = "";
		$codereductioneuro = 0;
		$livnom = "";
		if (isset($myFacture->code_reduction) && !empty($myFacture->code_reduction)) {
			$codereductioneuro = $myFacture->code_reduction['EURO'];
			$codereduction = $myFacture->code_reduction['CODE'];
		}
		if (isset($myFacture->livraison) && !empty($myFacture->livraison)) {
			$livnom = $myFacture->livraison['NOMLIV'];
		}
			
		$data = array (
						'REFERENCE' => 'REF-'.$this->referencegen(),
						'PRIXTOTALHTHR' => $myFacture->total_HT_HR,
						'PRIXREMISEEUR' => $myFacture->total_remise,
						'PRIXTOTALHT' => $myFacture->total_HT,
						'PRIXFRAISPORT' => $myFacture->total_frais_port,
						'PRIXFRAISPORTPOUR' => $myFacture->total_frais_port_pour,
						'PRIXTOTALHTFP' => $myFacture->total_HT_FP,
						'PRIXTOTALTTC' => $myFacture->total_TTC,
						'DATESTART' => $myFacture->date_start,
						'STATUT' => $statut,
						'PAYMENT_STATUS' => $payment_status,
						'TXN_ID' => $txn,
						'IDUSER' => $user['id'],
						'LIV_RAISONSOCIAL' => $addresseLiv['raisonsocial'],
						'LIV_ADRESSE' => $addresseLiv['adresse'],
						'LIV_CP' => $addresseLiv['cp'],
						'LIV_VILLE' => $addresseLiv['ville'],
						'LIV_PAYS' => $addresseLiv['pays'],
						'FACT_RAISONSOCIAL' => $fact_raisonsociale,
						'FACT_ADRESSE' => $user['adresse'],
						'FACT_CP' => $user['cp'],
						'FACT_VILLE' => $user['ville'],
						'FACT_PAYS' => $user['pays'],
						'USER_NOM' =>$user['nom'],
						'USER_PRENOM' =>$user['prenom'],
						'USER_TEL' =>$user['tel'],
						'USER_FAX' =>$user['fax'],
						'USER_EMAIL' =>$user['email'],
						'USER_NUMCOMPTE' =>$user['numcompte'],
						'USER_MODEPAIEMENT' =>$user['modepaiement'],
						'USER_MODEPAIEMENT_TYPE' => 0,
						'LIV_NOM' =>$livnom,
						'CODEREDUCTIONEURO' => $codereductioneuro,
						'CODEREDUCTION' => $codereduction
		);

		$command->insert($data);

		$lastID = $command->getAdapter()->lastInsertId($command,'ID');

		$date = new Zend_Date();
		$myReference = $this->lpad_zero($lastID, 5)."-".$date->toString('YY');
		$dataRef = array ( 'REFERENCE' => $myReference );
		$command->update($dataRef,"ID = ".$lastID);
			
		$commandProduct = new CommandProduct();
		$userCaddyType = new UserCaddyType();

		foreach ($myFacture->facture_lines as $row) {
			$dataCaddy = array (
						'CHILDID' => $row->item_id,
						'CHILDREF' => $row->item_reference,
						'CHILDisPROMO' => $row->item_isPromo,
						'CHILDisDEVIS' => $row->item_isDevis,
						'CHILDPRIX' => $row->item_prix,
						'CHILDQUANTITY' => $row->item_qte,
						'CHILDPROMOPRIX' => $row->getPrixAfterRemise(),
						'CHILDPRIXTOTAL' => $row->getPrixTotalHT(true),
						'CHILDPRIXREMISE' => $row->getPrixRemise(),
						'CHILDREMISEPRIXTAUXE' => $row->remise_euro,
						'CHILDREMISEPRIXTAUXP' => $row->remise_pour,
						'PRODUCTID' => $row->product_id,
						'IDCOMMAND' => $lastID,
						'SELECTEDOPTION' => $row->item_selectedOption,
                        'POINTFIDELITE' => 0,
                        'POINTFIDELITESUM' => 0
			);
			$userCaddyType->addNewUserItem($row->item_reference, $user['id']);
			$commandProduct->insert($dataCaddy);
		}

		$dataReturn = array(
			'REFERENCE' => $myReference,
			'ID' => $lastID
		);
		return $dataReturn;
	}

	public function paypalipnvalidationtestAction() {
		$resultPaypal = $this->ipnPaypalListener();
		$this->_redirect('/');
	}

	public function paypalipnvalidationAction() {
		$resultPaypal = $this->ipnPaypalListener();
		$this->_redirect('/');
	}

	private function sendMail($body, $from, $to, $objet) {
		$mail = new Zend_Mail();
		$mail->setBodyHtml($body);
		$mail->setFrom($from, $this->siteName.' : PAYPAL');
		$mail->addTo($to);
		$mail->setSubject($objet);
		try {
			$mail->send();
			$this->log("L'email a �t� envoy� a : ".$to,'info');
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
		}
	}

	private function ipnPaypalListener() {
		
		$idCommand = $this->_request->getParam('item_number');
		if (empty($idCommand)) {
			$idCommand = $this->_request->getParam('custom');			
		}
		
		$dataIPN = array(
			'transaction_subject' => $this->_request->getParam('transaction_subject'),
			'txn_type' => $this->_request->getParam('txn_type'),
			'payment_date' => $this->_request->getParam('payment_date'),
			'last_name' => $this->_request->getParam('last_name'),
			'residence_country' => $this->_request->getParam('residence_country'),
			'pending_reason' => $this->_request->getParam('pending_reason'),
			'item_name' => $this->_request->getParam('item_name'),
			'payment_gross' => $this->_request->getParam('payment_gross'),
			'payment_currency' => $this->_request->getParam('mc_currency'),
			'business' => $this->_request->getParam('business'),
			'payment_type' => $this->_request->getParam('payment_type'),
			'protection_eligibility' => $this->_request->getParam('protection_eligibility'),
			'payer_status' => $this->_request->getParam('payer_status'),
			'verify_sign' => $this->_request->getParam('verify_sign'),
			'txn_id' => $this->_request->getParam('txn_id'),
			'payer_email' => $this->_request->getParam('payer_email'),
			'tax' => $this->_request->getParam('tax'),
			'test_ipn' => $this->_request->getParam('test_ipn'),
			'first_name' => $this->_request->getParam('first_name'),
			'receiver_email' => $this->_request->getParam('receiver_email'),
			'quantity' => $this->_request->getParam('quantity'),
			'payer_id' => $this->_request->getParam('payer_id'),
			'receiver_id' => $this->_request->getParam('receiver_id'),
			'item_number' => $idCommand,
			'payment_status' => $this->_request->getParam('payment_status'),
			'handling_amount' => $this->_request->getParam('handling_amount'),
			'shipping' => $this->_request->getParam('shipping'),
			'payment_amount' => $this->_request->getParam('mc_gross'),
			'custom' => $this->_request->getParam('custom'),
			'charset' => $this->_request->getParam('charset'),
			'notify_version' => $this->_request->getParam('notify_version'),
			'merchant_return_link' => $this->_request->getParam('merchant_return_link')
		);

		// read the post from PayPal system and add 'cmd'
		$req = 'cmd=_notify-validate';

		foreach ($_POST as $key => $value) {
			$value = urlencode(stripslashes($value));
			$req .= "&$key=$value";
		}
		
		$this->log('PAYPAL : IPN INCOMING : req : '.$req,'info');

		// post back to PayPal system to validate
		$header  = "POST /cgi-bin/webscr HTTP/1.0\r\n";
		$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
		$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";

		//If testing on Sandbox use:
		$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);

		$notify_email = $this->reglement_Mail;

		if (!$fp) {
			return false;
		} else {
			fputs ($fp, $header . $req);
			while (!feof($fp)) {
				$res = fgets ($fp, 1024);
				if (strcmp ($res, "VERIFIED") == 0) {
					if ($this->isTxnidUnique($dataIPN)) {

						if ($dataIPN['payment_status'] == 'Completed' && $dataIPN['receiver_id'] == $this->paypal_business) {
							$paypal_payment = new PaypalPaiement();
							$paypal_payment->insert($dataIPN);

							$this->updateCommandByID($idCommand,$dataIPN['payment_status'],$dataIPN['txn_id'],1);
		                    $this->log('PAYPAL : IPN-VERIFIED : res : '.$res.' : req : '.$req,'info');
							$this->sendMail("$res\n $req \n", $notify_email, $notify_email, 'PAYPAL : IPN-VERIFIED');

				            $command = new Command();                            
                            $facture = $command->getCommandAsFacture($idCommand);
                            $this->finishandclosepaiementsendmail($facture, $idCommand, true, "Mode de paiement : Paiement s�curis� en ligne", 0);
                            
							return true;

						} else {
							$this->updateCommandByIDUNVERIFIED($idCommand, 'Incorrect');
							$this->sendMail("$res\n $req \n", $notify_email, $notify_email, 'PAYPAL : IPN-VERIFIED INCORRECT');
							$this->log('PAYPAL : IPN-VERIFIED INCORRECT : res : '.$res.' : req : '.$req,'warn');
						}
					} else {
						$this->updateCommandByIDUNVERIFIED($idCommand, 'Duplicated');
						$this->sendMail("$res\n $req \n", $notify_email, $notify_email, 'PAYPAL : IPN-VERIFIED DUPLICATED TRANSACTION');
						$this->log('PAYPAL : IPN-VERIFIED DUPLICATED TRANSACTION : res : '.$res.' : req : '.$req,'warn');
					}

				} else if (strcmp ($res, "INVALID") == 0) {
					$this->updateCommandByIDUNVERIFIED($idCommand, 'Invalid');
					$this->sendMail("$res\n $req \n", $notify_email, $notify_email, 'PAYPAL : IPN-INVALID');
					$this->log('PAYPAL : IPN-INVALID : res : '.$res.' : req : '.$req,'warn');
				}

			}
			fclose ($fp);
		}
		return false;
	}
    
    private function finishandclosepaiementsendmail($facture, $idCommand, $sendmail, $type_paiement, $type) {
		$command = new Command();
		$dataTemp = array(
				'USER_MODEPAIEMENT_LABEL' => $type_paiement,
				'USER_MODEPAIEMENT_TYPE' => $type
		);
		$command->update($dataTemp,'ID = '.$idCommand);
        
        if ($sendmail) {
            $facture['USER_MODEPAIEMENT_LABEL'] = $type_paiement;
		    $facture['USER_MODEPAIEMENT_TYPE'] = $type;                
		    $this->sendMailCommande($facture,$this->devisCommande_Mail);
		    $this->sendMailCommande($facture,$facture['USER_EMAIL']);
        }                
	    /*
        if (isset($this->ekomi_email) && !empty($this->ekomi_email)) {
		    $this->sendMailCommande($factureDevis,$this->ekomi_email);
        }*/                
    }

	private function ipnPaypalListenerValidate() {
	
		$idCommand = $this->_request->getParam('item_number');
		if (empty($idCommand)) {
			$idCommand = $this->_request->getParam('custom');			
		}
		
		$dataIPN = array(
			'transaction_subject' => $this->_request->getParam('transaction_subject'),
			'txn_type' => $this->_request->getParam('txn_type'),
			'payment_date' => $this->_request->getParam('payment_date'),
			'last_name' => $this->_request->getParam('last_name'),
			'residence_country' => $this->_request->getParam('residence_country'),
			'pending_reason' => $this->_request->getParam('pending_reason'),
			'item_name' => $this->_request->getParam('item_name'),
			'payment_gross' => $this->_request->getParam('payment_gross'),
			'payment_currency' => $this->_request->getParam('mc_currency'),
			'business' => $this->_request->getParam('business'),
			'payment_type' => $this->_request->getParam('payment_type'),
			'protection_eligibility' => $this->_request->getParam('protection_eligibility'),
			'payer_status' => $this->_request->getParam('payer_status'),
			'verify_sign' => $this->_request->getParam('verify_sign'),
			'txn_id' => $this->_request->getParam('txn_id'),
			'payer_email' => $this->_request->getParam('payer_email'),
			'tax' => $this->_request->getParam('tax'),
			'test_ipn' => $this->_request->getParam('test_ipn'),
			'first_name' => $this->_request->getParam('first_name'),
			'receiver_email' => $this->_request->getParam('receiver_email'),
			'quantity' => $this->_request->getParam('quantity'),
			'payer_id' => $this->_request->getParam('payer_id'),
			'receiver_id' => $this->_request->getParam('receiver_id'),
			'item_number' => $idCommand,
			'payment_status' => $this->_request->getParam('payment_status'),
			'handling_amount' => $this->_request->getParam('handling_amount'),
			'shipping' => $this->_request->getParam('shipping'),
			'payment_amount' => $this->_request->getParam('mc_gross'),
			'custom' => $this->_request->getParam('custom'),
			'charset' => $this->_request->getParam('charset'),
			'notify_version' => $this->_request->getParam('notify_version'),
			'merchant_return_link' => $this->_request->getParam('merchant_return_link')
		);

		$notify_email = $this->reglement_Mail;

		// read the post from PayPal system and add 'cmd'
		$req = 'cmd=_notify-validate';

		foreach ($_POST as $key => $value) {
			$value = urlencode(stripslashes($value));
			$req .= "&$key=$value";
		}

		$this->log('PAYPAL : IPN INCOMING : req : '.$req,'info');
		
		// post back to PayPal system to validate
		$header  = "POST /cgi-bin/webscr HTTP/1.0\r\n";
		$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
		$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";

		//If testing on Sandbox use:
		$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);

		if (!$fp) {
			return false;
		} else {
			fputs ($fp, $header . $req);
			while (!feof($fp)) {
				$res = fgets ($fp, 1024);
				if (strcmp ($res, "VERIFIED") == 0) {
					if (!$this->isTxnidUnique($dataIPN)) {
						if ($dataIPN['payment_status'] == 'Completed' && $dataIPN['receiver_id'] == $this->paypal_business) {
							return true;
						}
					}
				} else if (strcmp ($res, "INVALID") == 0) {
					return false;
				}
			}
			fclose ($fp);
		}
		return false;
	}
	private function isTxnidUnique($data) {
		$paypal_payment = new PaypalPaiement();
		$row = $paypal_payment->fetchRow("txn_id = '".$data['txn_id']."'");
		if($row) { return false; } else { return true; }
	}


	public function devisAction() {
		$this->view->title = 'Confirmation de votre devis';
			
		try {
			$auth = Zend_Auth::getInstance();
			$auth->setStorage($this->getSessionStorage());
			$storage = $auth->getStorage()->read();
			if ($auth->hasIdentity() && isset($storage['user'])) {
				$usernamespace = $this->getSession();
				$addresseLiv = $usernamespace->addresseLiv;
				$facture = $usernamespace->myFactureValidate;
				if ($this->isExisteArray($addresseLiv) && $facture->isFactureValid(2) && isset($usernamespace->commandAdded)) {

					$dataReturn = $usernamespace->commandAdded;
					$this->updateCommand($dataReturn['ID'],'Pending','',10);

					if (isset($facture->code_reduction) && !empty($facture->code_reduction)) {
						$codeReduction = new CodeReduction();
						$date = new Zend_Date();
						$data = array(
						"isACTIF" => 0,
						"NOM" => $storage['user']['nom'],
						"PRENOM" => $storage['user']['prenom'],
						"IDUSER" => $storage['user']['id'],
						"REFERENCE" => $dataReturn['REFERENCE'],
						"DATEUSE" => $date->toString('YYYY-MM-dd HH:mm:ss')
						);
						$codeReduction->update($data,"CODE = '".$facture->code_reduction['CODE']."'");
					}

					$factureDevis = $this->computeBill(10,$dataReturn['REFERENCE'],$dataReturn['ID'], $facture,$addresseLiv, $storage['user']);
					$this->view->facture = $factureDevis;
                    
                    $command = new Command();                            
                    $facture = $command->getCommandAsFacture($dataReturn['ID']);
					$this->sendMailCommande($facture,$this->devisCommande_Mail);
					$this->sendMailCommande($facture,$facture['USER_EMAIL']);
                    
					$this->view->linksMenu = $this->generateLinksMenu(4);
					$usernamespace->addresseLiv = array();
					$usernamespace->myFactureValidate = array();

					unset($usernamespace->addresseLiv);
					unset($usernamespace->myFactureValidate);
					unset($usernamespace->commandAdded);

					$usernamespace->myObjectCaddy =array();
					unset($usernamespace->myObjectCaddy);
                    
				    $usernamespace->myObjectCaddyFidelite = array();
				    unset($usernamespace->myObjectCaddyFidelite);
				} else { $this->_redirect('/'); }
			} else { $this->_redirect('/connectez-vous.html'); }
		} catch (Zend_Exception $e) {
			$this->log('Erreur : devisAction() : '.$e->getTraceAsString(),'err');
			$this->_redirect('/');
		}
	}

	private function lpad_zero($chaine,$taille) {
		return str_pad($chaine,$taille,"0",STR_PAD_LEFT);
	}
	
	private function finishandclosepaiement($payment_status, $txn_id, $type_paiement, $type, $sendmail) {
		if (!isset($this->site_rib_numbers)) {
			$this->initVariables();
		}
		$auth = Zend_Auth::getInstance();
		$auth->setStorage($this->getSessionStorage());
		$storage = $auth->getStorage()->read();
		
		if ($auth->hasIdentity() && isset($storage['user'])) {
		
			$usernamespace = $this->getSession();
			$addresseLiv = $usernamespace->addresseLiv;
			$myFacture = $usernamespace->myFactureValidate;
		
			if ($this->isExisteArray($addresseLiv) && $myFacture->isFactureValid(2) && isset($usernamespace->commandAdded)) {
		
				$this->view->title = 'Confirmation de votre commande';
		
				$data = $usernamespace->commandAdded;
				$this->updateCommand($data['ID'],$payment_status,$txn_id,1);
                
				$this->updateCommandFidelite($data['ID'], $myFacture);
        
				$facture = $this->computeBill(1,$data['REFERENCE'],$data['ID'], $myFacture,$addresseLiv,$storage['user']);
                
                $facture['USER_MODEPAIEMENT_LABEL'] = $type_paiement;
		        $facture['USER_MODEPAIEMENT_TYPE'] = $type; 
                $this->view->facture = $facture;
                
				$command = new Command();                            
                $factureMail = $command->getCommandAsFacture($data['ID']);
                $this->finishandclosepaiementsendmail($factureMail, $data['ID'], $sendmail, $type_paiement, $type);
                            
				$this->view->linksMenu = $this->generateLinksMenu(4);
		
				$this->log("Nouvelle commande : ".$data['REFERENCE'],'info');
				$this->view->verifMessage = 1;
		
				$usernamespace->addresseLiv = array();
				$usernamespace->myFactureValidate = array();
		
				unset($usernamespace->addresseLiv);
				unset($usernamespace->myFactureValidate);
				unset($usernamespace->commandAdded);
		
				$usernamespace->myObjectCaddy = array();
				unset($usernamespace->myObjectCaddy);
                
				$usernamespace->myObjectCaddyFidelite = array();
				unset($usernamespace->myObjectCaddyFidelite);
			} else {
				$this->_redirect('/mon-panier.html');
			}
		}   else {
			$this->_redirect('/connectez-vous.html');
		}
	}
	public function citelispaiementAction() {
		require_once('../library/citelis/configuration/identification.php');
		require_once('../library/citelis/configuration/options.php');
		require_once('../library/citelis/lib/lib_debug.php');
				
		$array = array();
		$payline = new paylineSDK(MERCHANT_ID, ACCESS_KEY, PROXY_HOST, PROXY_PORT, PROXY_LOGIN, PROXY_PASSWORD, PRODUCTION);
		$payline->returnURL = RETURN_URL;
		$payline->cancelURL = CANCEL_URL;
		$payline->notificationURL = NOTIFICATION_URL;
		
		// PAYMENT
		$array['payment']['amount'] = $_POST['amount'];
		$array['payment']['currency'] = PAYMENT_CURRENCY;
		$array['payment']['action'] = PAYMENT_ACTION;
		$array['payment']['mode'] = PAYMENT_MODE;
		
		// ORDER
		$array['order']['ref'] = $_POST['ref'];
		$array['order']['amount'] = $_POST['amount'];
		$array['order']['currency'] = PAYMENT_CURRENCY;
		
		// CONTRACT NUMBERS
		$array['payment']['contractNumber'] = CONTRACT_NUMBER;
		$contracts = explode(";",CONTRACT_NUMBER_LIST);
		$array['contracts'] = $contracts;
		$secondContracts = explode(";",SECOND_CONTRACT_NUMBER_LIST);
		$array['secondContracts'] = $secondContracts;
		
		// EXECUTE
		$result = $payline->doWebPayment($array);
		
		if(isset($result) && $result['result']['code'] == '00000'){		
			//Sauvegarde du token
			$usernamespace = $this->getSession();
			$usernamespace->commandAddedLastTokenCitelis = $result["token"];
			$this->_redirect($result["redirectURL"]);
		} elseif(isset($result)) {
			$this->log("Erreur commande citelis : ".$result['result']['code']. ' '.$result['result']['longMessage'],'err');
			$this->_redirect('/mon-panier-validation.html');
		}
	}
	
	public function paiementcitelisAction() {
		try {
			$auth = Zend_Auth::getInstance();
			$auth->setStorage($this->getSessionStorage());
			$storage = $auth->getStorage()->read();
			$ispaiementOk = false;
				
			if ($auth->hasIdentity() && isset($storage['user'])) {
				$usernamespace = $this->getSession();
				$this->log("Token recu : ".$this->_request->getParam("token"). ' / Token sauvegard� : '.$usernamespace->commandAddedLastTokenCitelis,'info');
				if ($usernamespace->commandAddedLastTokenCitelis == $this->_request->getParam("token")) {				
					$ispaiementOk = true;
				}
			}

			if ($ispaiementOk) {
				$this->finishandclosepaiement("Pending",$this->_request->getParam("token"), "Mode de paiement : Paiement s�curis� en ligne", 0, true);
			 	$this->render('paiement');
			}  else {
				$this->_redirect('/');
			}
	
		}catch (Zend_Exception $e) {
			$this->log("Erreur : paiementcitelisAction() ".$e->getMessage(),'err');
			$this->_redirect('/');
		}
	}
	
	public function citelisipnvalidationAction() {
		$this->ipnCitelisListener();
		$this->_redirect('/');
	}
	
	private function ipnCitelisListener() { 
		require_once('../library/citelis/configuration/identification.php');
		require_once('../library/citelis/configuration/options.php');
		require_once('../library/citelis/lib/lib_debug.php');
		try {	
			// GET TOKEN
			$token = $this->_request->getParam("token");
			if(isset($token)){
				$this->log("WebPaymentDetailsRequest - Token : ".$token,'info');
				$array = array();
				$payline = new paylineSDK(MERCHANT_ID, ACCESS_KEY, PROXY_HOST, PROXY_PORT, PROXY_LOGIN, PROXY_PASSWORD, PRODUCTION);
					
				$array['token'] = $token;
	    		$array['version'] = '3';
				// EXECUTE
				$result = $payline->getWebPaymentDetails($array);
				if(isset($result)){
					$command = new Command();
					$currentCommand = $command->fetchRow('TXN_ID = "'.$token.'"');
					$idCommand = $currentCommand["ID"];
					
					$output = print_a($result, 1, true);
					if ($result['result']['code'] == "00000" || $result['result']['code'] == "01001" ) {
						$this->updateCommandByID($idCommand,"Completed", $token,1);
						
						$this->log('CITELIS : IPN-VERIFIED : res : '.$output,'info');
						$this->sendMail($output." \n", $notify_email, $notify_email, 'CITELIS : IPN-VERIFIED');
					} else {
						$this->updateCommandByIDUNVERIFIED($idCommand, 'Incorrect');
						$this->log('CITELIS : IPN-VERIFIED INCORRECT : res : '.$output,'warn');
						$this->sendMail($output." \n"." \n", $notify_email, $notify_email, 'CITELIS : IPN-VERIFIED INCORRECT');
					}
				} else {
					$this->log("WebPaymentDetailsRequest - No results",'info');
				}
			} else {
				$this->log("WebPaymentDetailsRequest - Token Missing ",'info');
			}
		} catch (Zend_Exception $e) {
			$this->log('Erreur : ipnCitelisListener() : '.$e->getTraceAsString(),'err');
		}
  	}
}?>
modules/default/controllers/IndexController.php000060400000002425150710367660016044 0ustar00<?php

class IndexController  extends Modules_Default_Controllers_MainController
{

	public function init()
	{
		$this->view->baseUrl = $this->getBaseUrl();
	}

	public function indexAction()
	{
        $this->setCanonicalUrl($this->baseUrl_SiteCommerceUrl."/");
		$this->view->title = $this->TextHomeMetaTitle;
		$this->view->metadescription = $this->TextHomeMetaDescription;
        
		if ($this->isSiteGallery) {
			$id = 1;
			
		    $annonceGallery = new AnnonceGallery(); 
            $this->view->listAllGalleries = $annonceGallery->getAnnoncesByShow($id);
			
			$category = new Category();  
			$currentCat = $category->fetchRow("ID = ".$id);
			
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())->addFilter(new Zend_Filter_StringTrim());

			$this->view->title = $currentCat['NAVTITRENOM'];
			$this->view->metadescription = $filter->filter($currentCat['NAVDESCRIPTION']);  
			$this->view->metakeywords = $currentCat['KEYWORDS']; 
		}
		if ($this->isSiteEbusiness) {
	        $annonces = new AnnonceContent();
	        $result = $annonces->getAnnoncesByShow(0);
	        $this->view->listads = $result;

	        $annoncesfrontHeader = new  AnnonceFrontHeader();
	        $this->view->listinfos = $annoncesfrontHeader->getAnnonces();
        }

	}

}



?>modules/default/controllers/ServicesController.php000060400000002723150710367660016561 0ustar00<?php

class ServicesController  extends Modules_Default_Controllers_MainController
{

	public function init()
	{
		$this->view->baseUrl = $this->getBaseUrl();
		$this->checkMaintenance();
	}

	public function indexAction()
	{
		$this->_forward('information');
	}
	public function informationAction()
	{
		if ($this->getRequest()->getParam('p') && (int)$this->getRequest()->getParam('p')>0) {
				
			$id = (int)$this->getRequest()->getParam('p');
			$footer = new FooterContent();
            $detailFooterRow = $footer->fetchRow('ID = '.$id);
            if ($detailFooterRow) {
                $detailFooter = $detailFooterRow->toArray();
                 
                $linksMenu[0]['NAVURL'] = "";
                $linksMenu[0]['NAVNOM'] = $detailFooter['TITRE'];
                $this->view->linksMenu = $linksMenu;
				
                $this->view->title = $detailFooter['TITRE'];
                $this->view->service = $detailFooter;
            } else {
                $this->log("Impossible de trouver l'information : ".$this->getRequest()->getRequestUri(), 'warn');
                $this->_redirect('/');
            }
		}
	}

	public function faqAction() {
		$linksMenu[0]['NAVURL'] = '/services/faq';
		$linksMenu[0]['NAVNOM'] = 'FAQ';
		$this->view->linksMenu = $linksMenu;
			
		$this->view->title = 'Foire aux questions';
			
		$faq = new FAQ();
		$this->view->faqs = $faq->getLists();
		$faqtype = new FAQType();
		$this->view->faqType = $faqtype->getTypes();
	}
}



?>modules/default/controllers/AjaxController.php000060400000002357150710367660015664 0ustar00<?php

class AjaxController extends Modules_Default_Controllers_MainController
{
	private $layout;

	public function init()
	{
		$this->view->baseUrl = $this->getBaseUrl();
		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->checkMaintenance();
	}
	public function indexAction()
	{
		$this->_forward('ajaxmessage');
	}

	public function ajaxmessageAction() {
		$this->render();
	}
	public function ajaxvalueAction() {
		$this->render();
	}
	public function ajaxcaddyAction() {
		$this->render();
	}
	public function ajaxlivraisonAction() {
		$this->render();
	}
	public function ajaxaccountAction() {
		$this->render();
	}



	public function autocompletekeywordAction() {
		$result = array();
		if ($this->getRequest()->isPost()) {
			$filter = new Zend_Filter();
			$filter->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringToLower())
			->addFilter(new Zend_Filter_CustomAlnum(array('allowwhitespace' => true)));

			$keyword = new KeyWord();
			$key = $filter->filter(utf8_decode($this->getRequest()->getPost('search')));
			$result = $keyword->findByKeyword($key);
		}
		$this->view->messageSuccess = serialize($result);
		$this->render('ajaxvalue');
	}
}
?>modules/default/controllers/ProduitspromotionController.php000060400000025367150710367660020567 0ustar00<?php

class ProduitsPromotionController extends Modules_Default_Controllers_MainController
{

	private $myCaddy;

	public function init()
	{
		$this->view->baseUrl = $this->getBaseUrl();
		$this->checkMaintenance();

	}
    
    private function computeUrlNavigationParent($row) {
        return $row['NAVNOM_URLPARENTS']."/".$row['CATNAVNOM'];
    }
    
	public function indexAction()
	{
		$params = $this->getRequest()->getParams();
		$params['c'] = 1;
		$params['page'] = 'nos-promotions';
		$this->getRequest()->setParams($params);
		$this->_forward('/categorie');
	}
	private function computeProductListToShow($list, $user) {
		try {
			$listProducts = array();
			$metakeywords = '';

			$isAllPromos = false;
			$currentPromoAll = array();
			$currentPromo = array();
			$listUserCodeInternIdBrendFound = array();
			$listUserCodeInternIdBrends = array();
			$listIdBrendFound = array();
			$listUserIdBrendFound = array();
			$listUserIdBrends = array();
			$listIdBrends = array();
			$promoCalculator = new PromoCalculator();
			$promoProduct = new PromoProduct();
			$promoUser = new PromoUser();
			$product= new Product();
 
			if (!empty($list)) {
				$idCategory = $list[0]['CATID'];
				$myPromo = $promoProduct->getRemiseByProductCategory($idCategory);
				if ($this->isPromoActive($myPromo)) { $isAllPromos = true; $currentPromoAll = $myPromo; }
			}
			$productChildQte = new ProductChildQte();

			foreach ($list AS $row) {
				$currentProduct = array();
				$currentProduct['ID'] = $row['ID'];
				$currentProduct['NOM'] = $row['NOM'];
				//$currentProduct['DESCSHORT'] = $this->cutString($row['DESCSHORT'], 80);
				$currentProduct['DESCSHORT'] = $row['DESCSHORT'];
				$currentProduct['URL'] = $row['URL'];
				$currentProduct['BREND'] = $row['BREND'];
				$currentProduct['isSHOWBREND'] = $row['isSHOWBREND'];
				$currentProduct['BRENDURL'] = $row['BRENDURL'];
				$currentProduct['NBREFERENCE'] = $row['NBREFERENCE'];
				$currentProduct['isDEVISPRODUCT'] = $row['isDEVISPRODUCT'];
                $currentProduct['NAVNOM_URLPARENTS'] = $this->computeUrlNavigationParent($row);

				if (isset($row['NAVNOM'])) {
					$navnom = $row['NAVNOM'];
				} else {
					$navnom = $row['PRODNAVNOM'];
				}

				$currentProduct['NAVNOM'] = $this->verifyNavigationString($navnom, $row['NOM'], '');
                

				$currentProduct['NAVTITRE'] = $row['NAVTITRE'];
				$currentProduct['NAVDESC'] = $row['NAVDESC'];

				$isFirst = false;

				if (empty($metakeywords)) {
					$metakeywords .= $row['KEYWORDS_PROD'];
				} else {
					$metakeywords .= ','.$row['KEYWORDS_PROD'];
				}

				$currentProduct['isPROMO'] = $row['isPROMO'];
				$currentProduct['PRIX'] = $row['PRIX'];

				/*
				 * PRIX DEGRESSIF
				 */
				$currentProduct['isPRIXDEGRESSIF'] = $productChildQte->isPrixDegressifByProductID($row['ID']);
					
				/*
				 * CALCUL PROMO
				 */
				$idBrend = $row['BRENDID'];

				if (!in_array($idBrend, $listIdBrends, true)) {
					$myPromo = $promoProduct->getRemiseByProductBrend($idBrend);
					array_push($listIdBrends, $idBrend);
					if ($this->isPromoActive($myPromo)) { array_push($listIdBrendFound, array('ID' => $idBrend, 'PROMO' => $myPromo)); }
				}
				if ($row['isPROMO'] == 1) {
					$isRemise = false;
					if (in_array($idBrend, $listIdBrends, true)) {
						foreach ($listIdBrendFound as $brendPromos) {
							if ($brendPromos['ID'] == $idBrend) {
								$currentProduct['isPROMO'] = 0;
								$currentPromo = $brendPromos['PROMO'];
								if ($currentPromo['REMISEEURO'] > 0) {
									$currentProduct['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromo['REMISEEURO']);
									$isRemise = true;
								}
								if ($currentPromo['REMISEPOUR'] > 0) {
									$currentProduct['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromo['REMISEPOUR']);
									$isRemise = true;
								}
								break;
							}
						}
					}
					if ($isAllPromos && !empty($currentPromoAll) && !$isRemise ) {
						$currentProduct['isPROMO'] = 0;
						if ($currentPromoAll['REMISEEURO'] > 0) {
							$currentProduct['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromoAll['REMISEEURO']);
						}
						if ($currentPromoAll['REMISEPOUR'] > 0) {
							$currentProduct['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromoAll['REMISEPOUR']);
						}
					}
				}
				if (isset($user) && !empty($user)) {
					$userId = $user['id'];
					$codeIntern = $user['cintern'];
					$isRemise = false;

					if (!empty($codeIntern)) {
						if (!in_array($idBrend.'-'.$codeIntern, $listUserCodeInternIdBrends, true)) {
							$myPromo = $promoUser->getRemiseByCodeInternMarque($idBrend, $codeIntern);
							array_push($listUserCodeInternIdBrends, $idBrend.'-'.$codeIntern);
							if ($this->isPromoActive($myPromo)) { array_push($listUserCodeInternIdBrendFound, array('ID' => $idBrend, 'CODE' => $codeIntern, 'PROMO' => $myPromo)); }
						}
						if (in_array($idBrend.'-'.$codeIntern, $listUserCodeInternIdBrends, true)) {
							foreach ($listUserCodeInternIdBrendFound as $brendPromos) {
								if ($brendPromos['ID'] == $idBrend && $brendPromos['CODE'] == $codeIntern ) {
									$currentProduct['isPROMO'] = 0;
									$currentPromo = $brendPromos['PROMO'];
									if ($currentPromo['REMISEEURO'] > 0) {
										$currentProduct['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromo['REMISEEURO']);
										$isRemise = true;
									}
									if ($currentPromo['REMISEPOUR'] > 0) {
										$currentProduct['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromo['REMISEPOUR']);
										$isRemise = true;
									}
									break;
								}
							}
						}
					}
					if (!$isRemise) {
						if (!in_array($idBrend, $listUserIdBrends, true)) {
							$myPromo = $promoUser->getRemiseByMarque($idBrend, $userId);
							array_push($listUserIdBrends, $idBrend);
							if ($this->isPromoActive($myPromo)) { array_push($listUserIdBrendFound, array('ID' => $idBrend, 'PROMO' => $myPromo)); }
						}
						if (in_array($idBrend, $listUserIdBrends, true)) {
							foreach ($listUserIdBrendFound as $brendPromos) {
								if ($brendPromos['ID'] == $idBrend) {
									$currentProduct['isPROMO'] = 0;
									$currentPromo = $brendPromos['PROMO'];
									if ($currentPromo['REMISEEURO'] > 0) {
										$currentProduct['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromo['REMISEEURO']);
										$isRemise = true;
									}
									if ($currentPromo['REMISEPOUR'] > 0) {
										$currentProduct['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromo['REMISEPOUR']);
										$isRemise = true;
									}
									break;
								}
							}
						}
					}
				}


				if ($currentProduct['PRIX'] <= 0 ) { $currentProduct['PRIX'] = $row['PRIX']; }
				
				$currentProduct['PRIXLOWEST'] = $product->calculateLowestPrice($currentProduct['ID']);
				
				array_push($listProducts, $currentProduct);
			}
			return $result = array( 'PRODUCTS' => $listProducts, 'META_KEY' =>  $metakeywords);
		} catch (Zend_Exception $e) {
			$this->log('Erreur computeProductListToShow : '.$e->getMessage(),'err');
		}
		return $result = array( 'PRODUCTS' => array(), 'META_KEY' =>  '');
	}
	public function categorieAction()
	{
		$userNamespace = $this->getSession();
		$category = new Category2();
		$product = new Product();

		$auth = Zend_Auth::getInstance();
		$auth->setStorage($this->getSessionStorage());
		$storage = $auth->getStorage()->read();
		$currentUser = array();
		if ($auth->hasIdentity() && isset($storage['user'])) {
			$currentUser = $storage['user'];
		}
		if ($this->getRequest()->getParam('c')) {
			$id = (int)$this->getRequest()->getParam('c');

			if ($id>0) {

				try {
					$this->checkTypeOfPromo($id);
					$listCat = array();
					$listCat = $category->getTreeCatsOf($id);
					if (!empty($listCat)) {
						$this->view->listCat = $listCat;

						$this->view->isPromoPage = true;
						$breadcrumb = $category->getTreeInLineOf($id);
						$this->view->breadcrumb = $breadcrumb;
						$this->view->actualDesign = $this->showDesign(0, 0);

						if (empty($listCat['NAVTITRENOM'])) {
							$listCat['NAVTITRENOM'] = $listCat['NOM'];
						}
						if (empty($listCat['NAVDESCRIPTION'])) {
							$listCat['NAVDESCRIPTION'] = $listCat['DESCRIPTION'];
						}

						$filter = new Zend_Filter();
						$filter	->addFilter(new Zend_Filter_StripTags())->addFilter(new Zend_Filter_StringTrim());

						$this->view->metadescription = $listCat['NAVDESCRIPTION'];
						$this->view->title = $listCat['NAVTITRENOM'];
						$isTri_metaKeyword = false;

						$annoncesleft = new AnnonceLeft();
						$this->view->listads = $annoncesleft->getAnnoncesByShow($id);

						if (!$listCat['SUBS']) {
							$triSql = 'NOM ASC';
							//List of products
							$productList = $product->getProductsByIdCategoryForPromotion($id, $triSql);


							$this->view->orderNameProduct = $userNamespace->objOrderNameProduct;
							$resultProduct = $this->computeProductListToShow($productList, $currentUser);
							$this->view->listAllProducts = $resultProduct['PRODUCTS'];

                            if (!empty($listCat['KEYWORDS'])) {
                                $this->view->metakeywords = $listCat['KEYWORDS'];
                            } else {                                
                                $this->view->metakeywords = $resultProduct['META_KEY'];
                            }
							
							//Show product page
							$this->render('nosproduits');
						} else {
							$metakeywords = $listCat['KEYWORDS'];

                            if (empty($metakeywords)) {
							    for ($index = 0; $index < sizeOf($listCat['SUBS']); $index++) {
								    if (empty($metakeywords)) {
									    $metakeywords .= $listCat['SUBS'][$index]['KEYWORDS'];
								    } else {
									    $metakeywords .= ','.$listCat['SUBS'][$index]['KEYWORDS'];
								    }
							    }
                            }
							$this->view->metakeywords = $metakeywords;
						}
					} else {
						$this->log('Impossible de trouver la categorie : '.$this->getRequest()->getRequestUri(), 'warn');
						$this->_redirect('/');
					}

				} catch (Zend_Exception $e) {
					$this->log('Erreur pour trouver : '.$this->getRequest()->getRequestUri()." ".$e->getMessage(),'err');
					$this->_redirect('/');
				}
			} else {
				$this->_redirect('/');
			}
		}  else {
			$this->_redirect('/');
		}
	}

	private function checkTypeOfPromo($id) {
		$category = new Category2();
		$firstCategory = $category->getParentFirstOf($id);
		if ($firstCategory != null) {
			$currentId = $firstCategory["ID"];
			if ($currentId == 2) { $this->view->prefixPromoClass = "eco-"; }
			if ($currentId == 1) { $this->view->prefixPromoClass = ""; }
		}
	}

	private function isPromoActive($myPromo) {
		if ($myPromo) {
			if ($myPromo['REMISEEURO'] > 0) { return true; }
			if ($myPromo['REMISEPOUR'] > 0) { return true; }
		}
		return false;
	}
}
?>modules/default/controllers/ProduitsController.php000060400000246061150710367660016614 0ustar00<?php

class ProduitsController extends Modules_Default_Controllers_MainController
{

	private $myCaddy;

	public function init()
	{
		$this->view->baseUrl = $this->getBaseUrl();
		$this->checkMaintenance();
	}
	public function indexAction()
	{
		$this->_redirect('/');
	}
    public function ajaxdownloaddocumentAction() {
    
        $message = "";
        $isSuccess = false;
        if ($this->getRequest()->isPost()) {
        
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			$validatorEmail = new Zend_Validate_EmailAddress();
                
			$params = array();
			$params = $this->getRequest()->getPost();

			$civility = $filter->filter($params['civility_doc']);
			$name = $filter->filter($params['name_doc']);
			$firstname = $filter->filter($params['firstname_doc']);
			$email = $filter->filter($params['email_doc']);
			$product_id = (int) $params['product_id_doc'];
            
			if ($validator->isValid($civility) && $validator->isValid($name)  && $validator->isValid($firstname)
             && $validatorEmail->isValid($email)  && $product_id > 0) {
             
				$product = $this->computeProductDetail($product_id);
                $linkProd = $this->baseUrl_SiteCommerceUrl."/".Utils_Tool::getFormattedUrlProduct($product['NAVNOM_URLPARENTS'], $product['NAVNOM'], $product['ID']);
	            $linkCat = $this->baseUrl_SiteCommerceUrl."/".Utils_Tool::getFormattedUrlCategory($product['NAVNOM_URLPARENTS'], $product['CATNAVNOM'], $product['IDCATEGORY']);
                $prodName = $product['NOM'];
                $catName = $product['CATNOM'];
                
                $docUrl =$product['DOCURL'];
                if (empty($docUrl)) {
					$listFTFDS = $this->getFTFDSByIdProd($product_id);
                    if (isset($listFTFDS) && !empty($listFTFDS) && sizeof($listFTFDS) > 0) {
                           $docUrl = $listFTFDS[0]['URL'];
                    }
                }
                
                $destFullName = $civility." ".$firstname." ".$name;
                
                $fromEmail = $this->no_reply_Mail;
                $fromName = $this->siteName;
                $toEmail = $email;
                
                try {
                    $userGuest = new UserGuest();
                    $date = new Zend_Date();
                    $data = array (
						'INFORMATION' => $destFullName,
						'ACTION' => "Fiche technique � t�l�charger : ".$prodName,
						'EMAIL' => $toEmail,
                        'DATEINSERT' => $date->toString('YYYY-MM-dd HH:mm:ss')
					);
					$userGuest->insert($data);
                    
			        $view = new Zend_View();
			        $view->addScriptPath('../application/modules/default/views/helpers/');
			        $view->assign("user_name",$name);
			        $view->assign("user_firstname",$firstname);
			        $view->assign("user_email",$email);
			        $view->assign("user_civility",$civility);
			        $view->assign("user_fullname",$destFullName);
                    
			        $view->assign("site_url",$this->siteName);
			        $view->assign("product_url",$linkProd);
			        $view->assign("category_url",$linkCat);
			        $view->assign("category_name",$catName);
			        $view->assign("product_name",$prodName);
			        $view->assign("document_link",$this->baseUrl_SiteCommerceUrl."/".$docUrl);
                    
                    $body = $view->render("mail_ajaxdownloaddocument.phtml");
			        $subject = "Fiche technique : ".$prodName;
				
			        $mail = new Zend_Mail();
			        $mail->setBodyHtml($body);
			        $mail->setFrom($fromEmail, $fromName);
			        $mail->addTo($toEmail);
			        $mail->setSubject($subject);

			        $mail->send();
			        $this->log("L'email de fiche technique a �t� envoy� par : ".$fromEmail.", ".$fromName." � ".$toEmail,'info');
 
		        } catch (Zend_Exception $e) {
			        $this->log($e->getMessage(),'err');
		        }         
             
                $message = "Le mail � �t� envoy� � <b>".$destFullName."</b>.";
                $isSuccess = true;
            }   else if ($product_id > 0) {
				$product = $this->computeProductDetail($product_id);
			    $this->view->detailProduct = $product;
            }  
        }
        
        $this->view->message = $message;
        $this->view->isSuccess = $isSuccess;
        
		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render();
    }
    public function ajaxsendfriendAction() {
    
        $message = "";
        $isSuccess = false;
        if ($this->getRequest()->isPost()) {
        
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			$params = array();
			$params = $this->getRequest()->getPost();

			$name = $filter->filter($params['name_friend']);
			$email = $filter->filter($params['email_friend']);
			$message = nl2br(htmlspecialchars($params['message_friend']));
			$product_id = (int) $params['product_id_friend'];
            
			if ($validator->isValid($name)  && $validator->isValid($email) && $validator->isValid($message) && $product_id > 0) {
            
                $fromEmail = $this->no_reply_Mail;
                $fromName = $name;
                $toEmail = $email;
				$product = $this->computeProductDetail($product_id);
                
                 try {
                 
                    $userGuest = new UserGuest();
					$date = new Zend_Date();
                    $data = array (
						'INFORMATION' => $name,
						'ACTION' => "Conseillez cet article : ".$product["NOM"],
						'EMAIL' => $toEmail,
                        'DATEINSERT' => $date->toString('YYYY-MM-dd HH:mm:ss')
					);
					$userGuest->insert($data);
                    
			        $view = new Zend_View();
			        $view->addScriptPath('../application/modules/default/views/helpers/');              
			        $view->assign("text_message",$message);
                    
                    $body = $view->render("mail_ajaxsendfriend.phtml");
			        $subject = "Voici un article conseill� par ".$name;
				 
			        $mail = new Zend_Mail();
			        $mail->setBodyHtml(utf8_decode($body));
			        $mail->setFrom($fromEmail, $fromName);
			        $mail->addTo($toEmail);
			        $mail->setSubject($subject);

			        $mail->send();
			        $this->log("L'email de conseille a �t� envoy� par : ".$fromEmail.", ".$fromName." � ".$toEmail,'info');
 
		        } catch (Zend_Exception $e) {
			        $this->log($e->getMessage(),'err');
		        }      
             
                $message = "Le mail � �t� envoy� � <b>".$email."</b>.";
                $isSuccess = true;
            }    
        }
        
        $this->view->message = $message;
        $this->view->isSuccess = $isSuccess;
        
		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render();
    }
        
	public function nosmarquesAction() {        
		$this->view->title = 'Nos marques';
        $brand = new SupplierBrend();
        $this->view->brends = $brand->getAllShowableBrends();
    }
    
	public function nosmarquesdetailAction() {   
		$this->view->title = 'Nos marques'; 
        if ($this->getRequest()->getParam('id')) {
			$id = (int)$this->getRequest()->getParam('id');
            if ($id > 0) {
                try {
                    $brand = new SupplierBrend();
                    $brendData = $brand->getBrendByID($id);
                    $this->view->brends = $brendData;
                    $this->view->title = 'Nos marques - '.$brendData["BREND"]; 
		        } catch (Zend_Exception $e) {
			        $this->log("Error nosmarquesdetailAction : ".$id." : ".$e->getMessage(),'err');
                    $this->_forward('nosmarques','produits');
		        }
            } 
        }else {
            $this->_forward('nosmarques','produits');
        }
    }
    
	public function ajaxshowchildqtepriceAction() {
		$this->view->detailProductQte = array();
		$id = (int)$this->getRequest()->getParam('id');
		if ($id > 0) {
			$productChildQte = new ProductChildQte();
			$detailProductQte = $productChildQte->getAllActiveByItem($id);
				
			//Calcul des promos pour le prix degressif
			$productChild = new ProductChild();
			$childs = $productChild->getChildsInfoByListId($id);
			$promo = new PromoCalculator();
			$facture = new Facture();
			foreach ($detailProductQte AS $row) {
				$factureLine = new FactureLine();
				$childs[0]["PRIX"] = $row["PRIX"];
				$factureLine->setLineInfo($childs[0], 1, "N");
				$factureLine->setPromoCaddyType(false);
				$facture->addLine($factureLine);
				$promo->computeAllPromos($facture, null);
				$row["PRIX"] = $factureLine->getPrixTotalHT(true);
			}
				
			if (!empty($detailProductQte)) {
				$this->view->detailProductQte = $detailProductQte;
			}
		}
		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render();
	}
	public function ajaxshowallchildsAction() {
		$id = (int)$this->getRequest()->getParam('id');
		if ($id > 0) {
			$myProduct = $this->computeProductDetail($id);
			if ($myProduct) {
				$this->view->detailProduct = $myProduct;
				$category = new Category();
				$categoryFirst = $category->getParentFirstOf($myProduct['IDCATEGORY']);
				$this->view->actualDesign = $this->showDesign($categoryFirst['ID'], $categoryFirst);
			} else {
				$this->view->detailProduct = array();
				$this->view->actualDesign = array();
			}
		}
		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render();
	}

	public function ajaxcodereductionAction() {
		if ($this->getRequest()->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			//valideurs pour les chaines
			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty());

			$params = array();
			$params = $this->getRequest()->getPost();

			$codeReduc = $filter->filter($params['codeReduc']);
			$this->view->messageSuccessReduc = "NOK";

			$user_namespace = $this->getSession();
			if (isset($user_namespace->urlCurrentProduct) && !empty($user_namespace->urlCurrentProduct)) {
				$this->view->urlCurrentProduct = $user_namespace->urlCurrentProduct;
			}

			if ($validator->isValid($codeReduc)) {

				$codeReduction = new CodeReduction();
				$resultCode = $codeReduction->getVerifyCodeBy($codeReduc);
				if (isset($resultCode) && !empty($resultCode)) {
					if ($resultCode['isACTIF'] == 1) {

						$usernamespace =  $this->getSession();
							
						$myFacture = $usernamespace->myFactureValidate;

						$myFacture->code_reduction = $resultCode;

						$myFacture->code_reduction['EURO'] = $myFacture->getPrixCodeReduction();
						$usernamespace->myFactureValidate = $myFacture;
						$this->view->messageSuccessReduc = "OK";
						$this->view->messageMessReduc = "Le code de r�duction est disponible";
					} else { $this->view->messageMessReduc = "Le code de r�duction n'est pas actif"; }
				} else { $this->view->messageMessReduc = "Le code de r�duction n'est plus disponible"; }
			} else {
				$usernamespace =  $this->getSession();
				$myFacture = $usernamespace->myFactureValidate;
				$myFacture->code_reduction = array();
				$usernamespace->myFactureValidate = $myFacture;

				$this->view->messageMessReduc = "Le code de r�duction n'est pas valide";
			}
		}
		$this->computeMonPanier();
		$this->_forward('ajaxcaddy','ajax');
	}

	private function computeLivraison ($totalHT) {
		$result = array();
		$result['fraisLivEUR'] = 0;
		$result['fraisLivPOUR'] = 0;
		$result['francoEur'] = 0;
		$result['resteFrancoLiv'] = 0;
		$promoCommand = new PromoCommand();
		try {
			$fraisCMD = $promoCommand->fetchAll('MONTANTFRAISCMD IS NOT NULL','MONTANTFRAISCMD ASC')->toArray();
			if ($fraisCMD) {
				foreach ($fraisCMD as $rowFrais) {
					if ($totalHT < $rowFrais['MONTANTFRAISCMD']) {
						if ($rowFrais['REMISEEURO'] > 0) {
							$result['fraisLivEUR'] = $rowFrais['REMISEEURO'];
						} else if ($rowFrais['REMISEPOUR'] > 0) {
							$result['fraisLivEUR'] = sprintf("%.2f", ($totalHT * $rowFrais['REMISEPOUR']) / 100);
							$result['fraisLivPOUR'] = $rowFrais['REMISEPOUR'];
						}
						break;
					}
				}
				foreach ($fraisCMD as $rowFrais) {
					$result['francoEur'] = $rowFrais['MONTANTFRAISCMD'];
				}
					
				if($totalHT < $result['francoEur']) {
					$result['resteFrancoLiv'] = $result['francoEur'] - $totalHT;
				}
			}
		} catch (Zend_Exception $e) {
			$this->log("Error computeOldLivraison : ".$e->getMessage(),'err');
		}
		return $result;
	}

	public function monpanierAction() {
		if ($this->getRequest()->getParam('paypalVerifError')) {
			$this->view->paypalVerifError = "Votre commande n'a pas �t� prise en compte, rev�rifier vos informations";
		}

		$user_namespace = $this->getSession();

		if (isset($user_namespace->urlCurrentProduct) && !empty($user_namespace->urlCurrentProduct)) {
			$this->view->urlCurrentProduct = $user_namespace->urlCurrentProduct;
		}
        
		$this->view->title = 'Mon Panier';
		$this->view->etapeCommande = 1;
		$linksMenu = array();
		$linksMenu[0]['NAVURL'] = '/mon-panier.html';
		$linksMenu[0]['NAVNOM'] = 'Mon Panier';

		$this->view->linksMenu = $linksMenu;

		$this->saveCaddyTemp();

		$this->computeMonPanier();
        
	}

	private function saveCaddyTemp() {

		$userNamespace = $this->getSession();
		if (isset($userNamespace->myObjectCaddy) && !empty($userNamespace->myObjectCaddy)) {
			$myCaddy = $userNamespace->myObjectCaddy;
			$auth = Zend_Auth::getInstance();
			$auth->setStorage($this->getSessionStorage());
			$storage = $auth->getStorage()->read();

			if ($auth->hasIdentity() && isset($storage['user']) && !empty($myCaddy->items)) {
				$caddyTemp = new CaddyTemp();
				$caddyTemp->delete('USERID = '.$storage['user']['id']);

				foreach ($myCaddy->items as $item) {
					$data = array (
						'CHILDID' => $item->idChild,
						'CHILDQUANTITY' => $item->qteChild,
						'PRODUCTID' => $item->idProduit,
						'PRODUCTNOM' => $item->nom,
						'DESCSHORT' => $item->descshort,
						'NAVNOM' => $item->navnom,
						'URL' => $item->url,
						'DESIGNATION' => $item->designation,
						'USERID' => $storage['user']['id'],
						'SELECTEDOPTION' => $item->selectedOption 
					);

					$caddyTemp->insert($data);
				}
                
                if ($this->carte_fidelite_enabled) {
                    $carteFidelite = new CarteFidelite();
                    $this->view->myCaddyFideliteAvailable = $carteFidelite->getAnnoncesByAvailability($storage['user']['id']);
                    $this->view->myCaddyFideliteAllExceptCurrents = $carteFidelite->getAnnoncesByAvailabilityWithoutCurrent($storage['user']['id']);
                    $this->view->myUserFideliteInfo = $carteFidelite->getInfosByUser($storage['user']['id']);
                }
			}
		}
	}

	private function generateFacture($facture, $caddy) {
		foreach($caddy->items as $item) {
			$optionList = new OptionList();
			$productChild = new ProductChild();
			$results = $productChild->getChildsInfoByListId($item->idChild);
			foreach ($results AS $row) {
				$myItem = $caddy->getItemByIdAndOption($row['IDCHILD'], $item->selectedOption);

				if ($myItem != null) {
					$factureLine = new FactureLine();
					$factureLine->setLineInfo($row, $myItem->qteChild, $myItem->isAccessoire);

					$factureLine->item_selectedOption = $myItem->selectedOption;
						
					$factureLine->product_navnom = $this->verifyNavigationString($factureLine->product_navnom, $factureLine->product_nom, '');

					$factureLine->setPromoCaddyType(false);

					$facture->addLine($factureLine);
				}
			}
		}   
        
		$userNamespace = $this->getSession();    
        if (isset($userNamespace->myObjectCaddyFidelite) && !empty($userNamespace->myObjectCaddyFidelite)) {
            $fidelitegifts = $userNamespace->myObjectCaddyFidelite;
		        foreach($fidelitegifts->items as $item) {
			        $factureLine = new FactureLine();
			        $factureLine->setFideliteGift($item);
                    $facture->addFideliteLine($factureLine);
                }
        }
                
	}

	private function generateFactureCaddyType($facture, $caddy) {
		$userCaddyType = new UserCaddyType();
		foreach($caddy->itemsCaddyType as $item) {
			$results = $userCaddyType->getArticleByCaddyIdList($item->id);
			foreach ($results AS $row) {
				$myItem = $caddy->getItemCaddyTypeByIdChildAndOption($row['IDCHILD'], $item->selectedOption);
				if ($myItem != null && ($row['REMISEEURO'] > 0 || $row['REMISEPOUR'] > 0)) {

					$factureLine = new FactureLine();
					$factureLine->product_navnom = $this->verifyNavigationString($factureLine->product_navnom, $factureLine->product_nom, '');
					$factureLine->setLineInfo($row, $myItem->qte, 'N');
					$factureLine->caddytype_id = $myItem->id;
						
					$factureLine->item_selectedOption = $myItem->selectedOption;

					if ($row['REMISEEURO'] > 0) {
						$factureLine->remise_euro = $row['REMISEEURO'];
						$factureLine->setPromoCaddyType(true);
						$factureLine->caddytype_isActif = 'Y';
					} else if ($row['REMISEPOUR'] > 0) {
						$factureLine->remise_pour = $row['REMISEPOUR'];
						$factureLine->setPromoCaddyType(true);
						$factureLine->caddytype_isActif = 'Y';
					}

					if ($factureLine->isCaddyTypeActif()) {
						$poidsCurrent = $factureLine->getPoidsTotal();
						if ($poidsCurrent > 0) { $facture->total_poids += $poidsCurrent ;
						} else { $facture->isAncienPoids = true;  }
						if ($factureLine->isFrancoDenied()) { $facture->isFrancoDenied = true; }

						$facture->total_HT_HR += $factureLine->getPrixTotalHT(true);

						$facture->addLine($factureLine);
					}
				}
			}
		}
	}
		
	private function computeFactureGlobalByQteDegressif($myFacture) {
		$productChildQte = new ProductChildQte();
		$productChild = new ProductChild();
		foreach ($myFacture->facture_lines as $lines) {
			$result = $productChild->getChildPriceByIdChild($lines->item_id);
			$currentPrice = $productChildQte->getCurrentPrice($lines->item_id, $lines->item_qte, $result['PRIX']);
			$lines->item_prix = sprintf("%.2f",$currentPrice);
		}
	}

	public function computeMonPanier() {
		$userNamespace = $this->getSession();
		$myCaddyTemp = $userNamespace->myObjectCaddy;
		if ((isset($myCaddyTemp->items) && !empty($myCaddyTemp->items)) ||
		(isset($myCaddyTemp->itemsCaddyType) && !empty($myCaddyTemp->itemsCaddyType))) {

			$auth = Zend_Auth::getInstance();
			$auth->setStorage($this->getSessionStorage());
			$storage = $auth->getStorage()->read();
			$user = array();
			if ($auth->hasIdentity() && isset($storage['user'])) {
				$user = $storage['user'];
			}

			$myFacture_CodeReduc = array();
			if (isset($userNamespace->myFactureValidate)) {
				$myFacture = $userNamespace->myFactureValidate;
				if (isset($myFacture->code_reduction) && !empty($myFacture->code_reduction)) {
					$myFacture_CodeReduc = $myFacture->code_reduction;
				}
			}

			$myFacture = new Facture();

			$userNamespace->myFactureValidate = $myFacture;

			$resteFrancoLiv = 0;

			$this->generateFacture($myFacture, $myCaddyTemp);
			if (isset($user) && !empty($user) && $user['iscaddytype'] == 'Y') {
				//Panier Type apres le calcul des promos
				$this->generateFactureCaddyType($myFacture, $myCaddyTemp);
			}
			/*Recuperation du prix degressif*/
			$this->computeFactureGlobalByQteDegressif($myFacture);

			$myFacture->code_reduction = $myFacture_CodeReduc;

			/*
			 * CALCUL DES PROMOS
			 */
			$promo = new PromoCalculator();
			$promo->computeAllPromos($myFacture, $user);

			$resteToValid = $promo->getPrixCommandValidation($myFacture);
			if ($resteToValid > 0) {
				$this->view->isCommandValid = "Vous ne pouvez pas valider votre commande,<br/> il vous manque la somme de <b>".$resteToValid."</b> euros, pour atteindre le <b>minimum requis</b>.";
			}

			$myFacture->total_HT = $myFacture->getPrixTotalHT();

			/*
			 * MODE DE LIVRAISON
			 */

			//Calcul des frais de livraison
			$lastFraisLivEur = 0;

			$arrayLivraison = $this->computeLivraison($myFacture->total_HT);
			if (isset($arrayLivraison) && !empty($arrayLivraison)) {
				if ($myFacture->total_HT == 0) {
					$myFacture->total_frais_port = sprintf("%.2f", 0);
					$myFacture->total_frais_port_pour  = 0;
				} else {
					$myFacture->total_frais_port = $arrayLivraison['fraisLivEUR'];
					$myFacture->total_frais_port_pour  = $arrayLivraison['fraisLivPOUR'];
				}

				$lastFraisLivEur  = $arrayLivraison['francoEur'];
				$resteFrancoLiv  = $arrayLivraison['resteFrancoLiv'];
			}

			$myFacture->total_HT_FP = $myFacture->getPrixTotalHT_FP(false);
			$myFacture->total_TVA = $myFacture->getPrixTotalTVA(false);
			$myFacture->total_TTC = $myFacture->getPrixTotalTTC(false);
			$myFacture->total_remise = $myFacture->getPrixRemise();

			$myFacture->resteFrancoLiv = $resteFrancoLiv;
			if ($myFacture->resteFrancoLiv > 0) {
				$this->view->resteFrancoLiv = "Il vous reste <b>".number_format(sprintf("%.2f", $myFacture->resteFrancoLiv), 2, ',', ' ')."</b> euros, avant d'avoir le franco de port.";
			}
            
			if ($this->carte_fidelite_enabled) {
                $carteFidelite = new CarteFidelite();
                $myUserFideliteInfo = $carteFidelite->getInfosByUser($user['id']);                
                if (!$myFacture->isCarteFidelitePointsValid($myUserFideliteInfo['POINTFIDELITETOTAL'])) {
                	$this->view->isCommandValid = "Vous ne pouvez pas valider votre commande,<br/> vous n'avez pas assez de <b>points fid�lit�</b>.";
			    }
			}
            
			$userNamespace->myFactureValidate = $myFacture;
			$this->view->myFacture = $myFacture;
			$this->view->user_facture_validate = $myFacture;
            
		} else {
			$userNamespace->myFactureValidate = new Facture();
			$userNamespace->myObjectCaddy = new Caddy();
			$this->view->myFacture = $userNamespace->myFactureValidate;
			$this->view->user_facture_validate = $userNamespace->myFactureValidate;
            
		}
	}



	public function formatNumber($number) {
		return number_format($number, 2, ',', ' ');
	}

	public function getCaddyProducts($myCaddyTemp) {

		$i = 0;
		foreach($myCaddyTemp->items as $item) {
			if ($i == 0 ) {
				$stringTempP = $item->idProduit;
				$stringTempC = $item->idChild;
			} else {
				$stringTempP .= ', '.$item->idProduit;
				$stringTempC .= ', '.$item->idChild;
			}
			$i++;
		}



		$sql = "
			SELECT p.NOM NOM,p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.ID IDPRODUCT, pic.URL URL,p.isPROMO isPROMO, pc.DESIGNATION DESIGNATION, p.STOCK STOCK,
			pc.ID IDCHILD, pc.REFERENCE REFERENCE, pc.isDEVIS isDEVIS, pc.isPROMO isPROMOCHILD, pc.PRIX PRIX, p.DATEPROMO DATEPROMO,
			p.IDCATEGORY IDCATEGORY, p.IDBREND IDBREND, p.isSHOWBREND isSHOWBREND, pc.QUANTITYMIN QUANTITYMIN, pc.POIDS POIDS, pc.isFRANCODENIED isFRANCODENIED
			FROM product p
			LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID 
			LEFT JOIN productchild pc ON pc.IDPRODUCT = p.ID
			WHERE p.ID IN ( ".$stringTempP." )
			AND pc.ID IN ( ".$stringTempC." )
			AND p.isACTIVE = 0
			AND pic.POSITION = 1
			";


		$product = new Product();
		$result = $product->getAdapter()->fetchAll($sql);


		$promoProduct = new PromoProduct();
		$i = 0;

		$childRefBuy = '';
		$myTemp = array();
		foreach ($result AS $row) {

			$myItem = $myCaddyTemp->getItemById($row['IDCHILD']);

			if ($myItem != null)
			{
				$myTemp[$i]['CHILD']['isACCESSOIRE'] = $myItem->isAccessoire;

				$myTemp[$i]['CHILD']['ID'] = $row['IDCHILD'];
				$myTemp[$i]['CHILD']['REFERENCE'] = $row['REFERENCE'];
				$myTemp[$i]['CHILD']['DESIGNATION'] = $row['DESIGNATION'];
				$myTemp[$i]['CHILD']['isPROMO'] = $row['isPROMOCHILD'];
				$myTemp[$i]['CHILD']['isDEVIS'] = $row['isDEVIS'];
				$myTemp[$i]['CHILD']['POIDS'] = $row['POIDS'];
				$myTemp[$i]['CHILD']['isFRANCODENIED'] = $row['isFRANCODENIED'];
				$myTemp[$i]['CHILD']['QUANTITYMIN'] = $row['QUANTITYMIN'];
				$myTemp[$i]['CHILD']['PRIX'] = sprintf("%.2f",$row['PRIX']);
				$myTemp[$i]['CHILD']['REMISEEURO'] = 0;
				$myTemp[$i]['CHILD']['REMISEPOUR'] = 0;

				$myTemp[$i]['CHILD']['QUANTITY'] = $myItem->qteChild;

				//Insertion du code pour la gestion des promos
				$myTemp[$i]['CHILD']['PROMOPRIX'] = sprintf("%.2f",$row['PRIX']);

				if ($row['isPROMOCHILD'] == 0) {
					//Produit - REFERENCE
					$myPromo = $promoProduct->fetchRow("REFERENCE = '".$row['REFERENCE']."'");
					if ($myPromo['REMISEEURO'] > 0) {
						$myTemp[$i]['CHILD']['PROMOPRIX'] = sprintf("%.2f",$row['PRIX'] - $myPromo['REMISEEURO']);
					}
					if ($myPromo['REMISEPOUR'] > 0) {
						$myTemp[$i]['CHILD']['PROMOPRIX'] = sprintf("%.2f",$row['PRIX'] - (($row['PRIX'] * $myPromo['REMISEPOUR']) / 100));
					}

					if ($myTemp[$i]['CHILD']['PROMOPRIX'] < 0) {
						$myTemp[$i]['CHILD']['PROMOPRIX'] = sprintf("%.2f",$row['PRIX']);
					}
				}

				if ($myTemp[$i]['CHILD']['isDEVIS'] == 0) {
					$myTemp[$i]['CHILD']['PRIX'] = 0;
					$myTemp[$i]['CHILD']['PROMOPRIX'] = 0;
				}

				$myTemp[$i]['PRODUIT']['ID'] = $row['IDPRODUCT'];
				$myTemp[$i]['PRODUIT']['NOM'] = $row['NOM'];
				$myTemp[$i]['PRODUIT']['DESCSHORT'] = $row['DESCSHORT'];
				$myTemp[$i]['PRODUIT']['isPROMO'] = $row['isPROMO'];
				$myTemp[$i]['PRODUIT']['IDBREND'] = $row['IDBREND'];
				$myTemp[$i]['PRODUIT']['isSHOWBREND'] = $row['isSHOWBREND'];
				$myTemp[$i]['PRODUIT']['IDCATEGORY'] = $row['IDCATEGORY'];
				$myTemp[$i]['PRODUIT']['DATEPROMO'] = $row['DATEPROMO'];
				$myTemp[$i]['PRODUIT']['STOCK'] = $row['STOCK'];

				$myTemp[$i]['PRODUIT']['NAVNOM'] = $this->verifyNavigationString($row['NAVNOM'], $row['NOM'], '');

				$myTemp[$i]['PRODUIT']['URL'] = $row['URL'];


				$i++;
			}
		}
		return $myTemp;

	}


	public function ajaxaddpanierAction() {
		if ($this->getRequest()->isPost('productAddForm')) {
			$params = $this->getRequest()->getPost();

			$idProduct = $params['idProd'];

			for ($i = 0; $i < $params['nbr']; $i++) {
				if (isset($params['idChild_'.$i])) {
					$idchild = $params['idChild_'.$i];

					if (isset($params['quantity_'.$idchild])) {
						$qte = intval($params['quantity_'.$idchild]);
						$quantityMin = intval($params['qtyMinChild_'.$i]);
						$isAccessoire = $params['isAccessoire_'.$i];
						$selectedOptionValue = '';
						if (isset($params['selectedOption_'.$i]) && !empty($params['selectedOption_'.$i])) {
							$selectedOptionValue = $params['selectedOption_'.$i];
						}

						if ($qte > 0) {

							$qte = $this->computeQtyMin($qte, $quantityMin);

							$this->ajouterArticle( $idchild, $qte, $isAccessoire, $selectedOptionValue);
							$this->view->messageError = '';
							$this->view->messageSuccess = "Le produit a &eacute;t&eacute; ajout&eacute; &agrave; votre panier";
						} else {
							$this->supprimerArticle($idchild, $selectedOptionValue);
							$this->view->messageSuccess = "Votre panier a &eacute;t&eacute; actualis&eacute;";
							$this->view->messageError = '';
						}
					}
				}
			}

		}
		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render();
	}

	public function ajaxcountcaddyAction() {
		$userNamespace = $this->getSession();
		$myCaddy = $userNamespace->myObjectCaddy;
		$nbArticles = 0;
		if (isset($myCaddy->items)) {
			$nbArticles=count($myCaddy->items);
		}
		if ($nbArticles > 1) {
			$this->view->messageSuccess = $nbArticles.' PRODUITS';
		} else if ($nbArticles == 0) {
			$this->view->messageSuccess = 'Aucun produit';
		} else {
			$this->view->messageSuccess = $nbArticles.' PRODUIT';
		}
		$this->_forward('ajaxvalue', 'ajax');
	}
	/*
	 * Caddy
	 *
	 */
	public function ajaxcheckcaddyAction() {
		if ($this->getRequest()->isPost('caddyCheckForm')) {
			$params = $this->getRequest()->getPost();

			if (isset($params['Child'],$params['Quantity'])) {
				$listChild = $params['Child'];
				$listQuantity = $params['Quantity'];
				$listQuantityMin = $params['QuantityMin'];
				$listAcc= $params['Accessoire'];
				$listCaddyType= $params['CaddyType'];
				$listSelectedOption= $params['selectedOption'];

				for ($i = 0; $i < sizeof($listChild); $i++) {
					if (isset($listChild[$i],$listQuantity[$i])) {
						$idchild = intval($listChild[$i]);
						$qte = intval($listQuantity[$i]);
						$quantityMin = intval($listQuantityMin[$i]);
						$isAccessoire = $listAcc[$i];
						$idCaddyType = intval($listCaddyType[$i]);
						$selectedOption = $listSelectedOption[$i];

						if ($qte > 0) {
							$qte = $this->computeQtyMin($qte, $quantityMin);

							if ($idCaddyType > 0) {
								$this->ajouterArticleCaddyType($idCaddyType, $qte, $selectedOption);
							} else {
								$this->ajouterArticle($idchild, $qte, $isAccessoire, $selectedOption);
							}
							$this->view->messageError="";
							$this->view->messageSuccess = "Votre caddy a &eacute;t&eacute; modifi&eacute;";
						} else {
							if ($idCaddyType > 0) {
								$this->supprimerArticleCaddyType($idCaddyType, $selectedOption);
							} else {
								$this->supprimerArticle($idchild, $selectedOption);
							}
						}
					}
				}
			}
		}

		$this->_forward('ajaxmessage','ajax');
	}

	private function computeQtyMin($qte, $qteMin)
	{
		$reste = $qte % $qteMin;
		$value = ($qte - $reste) / $qteMin;

		if ($reste != 0) {
			$value++;
		}
		$result = $qteMin * $value;
		return $result;
	}



	private function ajouterArticleCaddyType($idCaddyType, $qteChild, $selectedOption){
		try {
			$userNamespace = $this->getSession();
			if (!isset($userNamespace->myObjectCaddy)) { $userNamespace->myObjectCaddy = new Caddy(); }
			$caddy = $userNamespace->myObjectCaddy;
			$caddy->addItemToCaddyType($idCaddyType, $qteChild, $selectedOption);
			$userNamespace->myObjectCaddy = $caddy;
		} catch (Zend_Exception $e) { $this->log($e->getMessage(), 'err'); }
	}

	private function ajouterArticle($idChild, $qteChild, $isAccessoire, $selectedOptionValue){
		try {
			$userNamespace = $this->getSession();
			if (!isset($userNamespace->myObjectCaddy)) { $userNamespace->myObjectCaddy = new Caddy(); }
			$caddy = $userNamespace->myObjectCaddy;
			$caddy->addItemToCaddy($idChild, $qteChild, $isAccessoire, $selectedOptionValue);
			$userNamespace->myObjectCaddy = $caddy;
		} catch (Zend_Exception $e) { $this->log($e->getMessage(), 'err'); }
	}

	private function supprimerArticle($idChild, $selectedOptionValue){
		try {
			$userNamespace = $this->getSession();
			if (!isset($userNamespace->myObjectCaddy)) { $userNamespace->myObjectCaddy = new Caddy(); }
			$caddy = $userNamespace->myObjectCaddy;
			$caddy->delItemToCaddy($idChild, $selectedOptionValue);
			$userNamespace->myObjectCaddy = $caddy;
		} catch (Zend_Exception $e) { $this->log($e->getMessage(), 'err'); }
	}

	private function supprimerArticleCaddyType($idCaddyType, $selectedOptionValue){
		try {
			$userNamespace = $this->getSession();
			if (!isset($userNamespace->myObjectCaddy)) { $userNamespace->myObjectCaddy = new Caddy(); }
			$caddy = $userNamespace->myObjectCaddy;
			$caddy->delItemToCaddyType($idCaddyType, $selectedOptionValue);
			$userNamespace->myObjectCaddy = $caddy;
		} catch (Zend_Exception $e) { $this->log($e->getMessage(), 'err'); }
	}

	private function computeProductChildsList($id, $idCat, $idBrend) {
		$myListChild = array();
		try {
			$productChild = new ProductChild();
			$productChildTemp = $productChild->getProductChildsByIdProduct($id);

			$myListChild = $this->computeProductChildsListArray($productChildTemp, $idCat, $idBrend);
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
		}
		return $myListChild;
	}


	private function computeProductChildsListArray($productChilds, $idCat, $idBrend) {
		$myListChild = array();
		try {
			$i = -1;
			$actualChild = 0;

			$isAllPromos = false;
			$currentPromoAll = array();
			$currentPromo = array();
			$listUserCodeInternIdBrendFound = array();
			$listUserCodeInternIdBrends = array();
			$listIdBrendFound = array();
			$listUserIdBrendFound = array();
			$listUserIdBrends = array();
			$listIdBrends = array();
			$promoCalculator = new PromoCalculator();
			$promoProduct = new PromoProduct();
			$promoUser = new PromoUser();

            $user = array();
            try {
			    $auth = Zend_Auth::getInstance();
			    $auth->setStorage($this->getSessionStorage());
			    $storage = $auth->getStorage()->read();
			    if ($auth->hasIdentity() && isset($storage['user'])) {
				    $user = $storage['user'];
                }
            }
            catch (Zend_Exception $e) {
                $this->log($e->getMessage(), 'err');
            }


			if (!empty($productChilds)) {
				$idCategory = $idCat;
				$myPromo = $promoProduct->getRemiseByProductCategory($idCategory);
				if ($this->isPromoActive($myPromo)) { $isAllPromos = true; $currentPromoAll = $myPromo; }
			}

			$userNamespace = $this->getSession();
			$myCaddy = $userNamespace->myObjectCaddy;
				
			$productChildQte = new ProductChildQte();
			foreach ($productChilds as $child) {
				if ($child['ID'] != $actualChild) {
					$i++;
					/* Prix Unitaire par Quantite*/
					$myListChild[$i]['QTEPRIXITEM'] = $productChildQte->getQteByItem($child['ID']);
					$myListChild[$i]['isQTEPRIXACTIVE'] = $child['isQTEPRIXACTIVE'];
					$child['PRIX'] = $productChildQte->getCurrentPrice($child['ID'], $myCaddy->getQuantity($child['ID']), $child['PRIX']);
						
					$myListChild[$i]['ID'] = $child['ID'];
					$myListChild[$i]['PRODUCTNAVNOM'] = $this->verifyNavigationString($child['PRODUCTNAVNOM'], $child['PRODUCTNOM'], '') ;
					$myListChild[$i]['PRODUCTNOM'] = $child['PRODUCTNOM'];
					$myListChild[$i]['PRODUCTID'] = $child['PRODUCTID'];
					$myListChild[$i]['REFERENCE'] = $child['REFERENCE'];
					$myListChild[$i]['DESIGNATION'] = $child['DESIGNATION'];
					$myListChild[$i]['PRIX'] = sprintf("%.2f",$child['PRIX']);
					$myListChild[$i]['isPROMO'] = $child['isPROMO'];
					$myListChild[$i]['isDEVIS'] = $child['isDEVIS'];
					$myListChild[$i]['QUANTITYMIN'] = $child['QUANTITYMIN'];

					$myListChild[$i]['PROMOPRIX'] = '';
					if ($child['isPROMO'] == 0) {
						$myPromo = $promoProduct->fetchRow("REFERENCE = '".$child['REFERENCE']."'");
						if ($myPromo['REMISEEURO'] > 0) {
							$myListChild[$i]['PROMOPRIX'] = sprintf("%.2f",$child['PRIX'] - $myPromo['REMISEEURO']);
						}
						if ($myPromo['REMISEPOUR'] > 0) {
							$myListChild[$i]['PROMOPRIX'] = sprintf("%.2f",$child['PRIX'] - (($child['PRIX'] * $myPromo['REMISEPOUR']) / 100));
						}
						if ($myListChild[$i]['PROMOPRIX'] < 0) { $myListChild[$i]['PROMOPRIX'] = 0; }
					}

					$myListChild[$i]['IMAGEPROMO'] = $child['IMAGEPROMO'];
					$myListChild[$i]['OPTION_VALUES'] = array();
					$actualChild = $child['ID'];


					/*
					 * CALCUL PROMO
					 */

					if (!in_array($idBrend, $listIdBrends, true)) {
						$myPromo = $promoProduct->getRemiseByProductBrend($idBrend);
						array_push($listIdBrends, $idBrend);
						if ($this->isPromoActive($myPromo)) { array_push($listIdBrendFound, array('ID' => $idBrend, 'PROMO' => $myPromo)); }
					}
					if ($child['isPROMO'] == 1) {
						$isRemise = false;
						if (in_array($idBrend, $listIdBrends, true)) {
							foreach ($listIdBrendFound as $brendPromos) {
								if ($brendPromos['ID'] == $idBrend) {
									$myListChild[$i]['isPROMO'] = 0;
									$currentPromo = $brendPromos['PROMO'];
									if ($currentPromo['REMISEEURO'] > 0) {
										$myListChild[$i]['PROMOPRIX'] = $promoCalculator->calculEuro($myListChild[$i]['PRIX'], $currentPromo['REMISEEURO']);
										$isRemise = true;
									}
									if ($currentPromo['REMISEPOUR'] > 0) {
										$myListChild[$i]['PROMOPRIX'] = $promoCalculator->calculPour($myListChild[$i]['PRIX'], $currentPromo['REMISEPOUR']);
										$isRemise = true;
									}
									break;
								}
							}
						}
						if ($isAllPromos && !empty($currentPromoAll) && !$isRemise ) {
							$myListChild[$i]['isPROMO'] = 0;
							if ($currentPromoAll['REMISEEURO'] > 0) {
								$myListChild[$i]['PROMOPRIX'] = $promoCalculator->calculEuro($myListChild[$i]['PRIX'], $currentPromoAll['REMISEEURO']);
							}
							if ($currentPromoAll['REMISEPOUR'] > 0) {
								$myListChild[$i]['PROMOPRIX'] = $promoCalculator->calculPour($myListChild[$i]['PRIX'], $currentPromoAll['REMISEPOUR']);
							}
						}
					}
					if (isset($user) && !empty($user)) {
						$userId = $user['id'];
						$codeIntern = $user['cintern'];
						$isRemise = false;

						if (!empty($codeIntern)) {
							if (!in_array($idBrend.'-'.$codeIntern, $listUserCodeInternIdBrends, true)) {
								$myPromo = $promoUser->getRemiseByCodeInternMarque($idBrend, $codeIntern);
								array_push($listUserCodeInternIdBrends, $idBrend.'-'.$codeIntern);
								if ($this->isPromoActive($myPromo)) { array_push($listUserCodeInternIdBrendFound, array('ID' => $idBrend, 'CODE' => $codeIntern, 'PROMO' => $myPromo)); }
							}
							if (in_array($idBrend.'-'.$codeIntern, $listUserCodeInternIdBrends, true)) {
								foreach ($listUserCodeInternIdBrendFound as $brendPromos) {
									if ($brendPromos['ID'] == $idBrend && $brendPromos['CODE'] == $codeIntern ) {
										$myListChild[$i]['isPROMO'] = 0;
										$currentPromo = $brendPromos['PROMO'];
										if ($currentPromo['REMISEEURO'] > 0) {
											$myListChild[$i]['PROMOPRIX'] = $promoCalculator->calculEuro($myListChild[$i]['PRIX'], $currentPromo['REMISEEURO']);
											$isRemise = true;
										}
										if ($currentPromo['REMISEPOUR'] > 0) {
											$myListChild[$i]['PROMOPRIX'] = $promoCalculator->calculPour($myListChild[$i]['PRIX'], $currentPromo['REMISEPOUR']);
											$isRemise = true;
										}
										break;
									}
								}
							}
						}
						if (!$isRemise) {
							if (!in_array($idBrend, $listUserIdBrends, true)) {
								$myPromo = $promoUser->getRemiseByMarque($idBrend, $userId);
								array_push($listUserIdBrends, $idBrend);
								if ($this->isPromoActive($myPromo)) { array_push($listUserIdBrendFound, array('ID' => $idBrend, 'PROMO' => $myPromo)); }
							}
							if (in_array($idBrend, $listUserIdBrends, true)) {
								foreach ($listUserIdBrendFound as $brendPromos) {
									if ($brendPromos['ID'] == $idBrend) {
										$myListChild[$i]['isPROMO'] = 0;
										$currentPromo = $brendPromos['PROMO'];
										if ($currentPromo['REMISEEURO'] > 0) {
											$myListChild[$i]['PROMOPRIX'] = $promoCalculator->calculEuro($myListChild[$i]['PRIX'], $currentPromo['REMISEEURO']);
											$isRemise = true;
										}
										if ($currentPromo['REMISEPOUR'] > 0) {
											$myListChild[$i]['PROMOPRIX'] = $promoCalculator->calculPour($myListChild[$i]['PRIX'], $currentPromo['REMISEPOUR']);
											$isRemise = true;
										}
										break;
									}
								}
							}
						}
					}
					if ($myListChild[$i]['PROMOPRIX'] < 0) { $myListChild[$i]['PROMOPRIX'] = $myListChild[$i]['PRIX']; }
				}
				$myListChild[$i]['OPTION_VALUES'][$child['OPTIONID']]['OPTIONVALUE'] = $child['OPTIONVALUE'];
				$myListChild[$i]['OPTION_VALUES'][$child['OPTIONID']]['OPTIONID'] = $child['OPTIONID'];
			}

		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(), 'err');
		}
		return $myListChild;
	}

	private function checkTypeOfPromo($id) {
		$category = new Category2();
		$firstCategory = $category->getParentFirstOf($id);
		if ($firstCategory != null) {
			$currentId = $firstCategory["ID"];
			if ($currentId == 2) { $this->view->prefixPromoClass = "eco-"; }
		}
	}

	private function computeProductDetail($id) {
		try {
			$product = new Product();

			//Get Product
			$productTemp = $product->getProductById($id);

            $currentUser = array();
            try {
                $auth = Zend_Auth::getInstance();
                $auth->setStorage($this->getSessionStorage());
                $storage = $auth->getStorage()->read();
                if ($auth->hasIdentity() && isset($storage['user'])) {
                    $currentUser = $storage['user'];
                }
            }
            catch (Zend_Exception $e) { }

			if ($productTemp) {
				//Get Picture
				$picture = new Picture();
				$productPics = $picture->getAllByIdProduct($id);

				//Produits Annexe
				$productAnnexe = new ProductAnnexe();
				$productList = $productAnnexe->getAnnexesByProductID($id, 'NOM ASC');
				$listAnnexes = $this->computeProductListToShow($productList, $currentUser);
				$this->view->listAnnexes = $listAnnexes['PRODUCTS'];

				//Produits Accessoire
				$productAccessoire = new ProductAccessoire();
				$listAccessoires = $productAccessoire->getAccessoiresOptionsByProductID($id, 'NOM ASC');

				$listAccessoireChilds = $this->computeProductChildsListArray($listAccessoires, $productTemp[0]['IDCATEGORY'], $productTemp[0]['IDBREND']);

				$myProduct = array();

				$myProduct['PRODUCT_ACCESSOIRE'] = $listAccessoireChilds;

				if ($product->isInCategorySubsidiaire($productTemp[0]['ID'], 2)) {
					$this->view->prefixPromoClass = "eco-";
				}

				$myProduct['ID'] = $productTemp[0]['ID'];
				$myProduct['NOM'] = $productTemp[0]['NOM'];

				$myProduct['NAVNOM'] = $this->verifyNavigationString( $productTemp[0]['NAVNOM'], $productTemp[0]['NOM'], "");

				$myProduct['NAVTITRE'] = $productTemp[0]['NAVTITRE'];
				$myProduct['NAVDESC'] = $productTemp[0]['NAVDESC'];

				if (empty($myProduct['NAVTITRE'])) {
					$myProduct['NAVTITRE'] = $myProduct['NOM'];
				}
				if (empty($myProduct['NAVDESC'])) {
					$myProduct['NAVDESC'] = $productTemp[0]['DESCSHORT'];
				}
				$myProduct['NAVNOM_URLPARENTS'] = $this->computeUrlNavigationParent($productTemp[0]);

				$myProduct['KEYWORDS'] = $productTemp[0]['KEYWORDS'];
				$myProduct['DESCSHORT'] = $productTemp[0]['DESCSHORT'];
				$myProduct['DESCLONG'] = $productTemp[0]['DESCLONG'];
				$myProduct['DESCNORME'] = $productTemp[0]['DESCNORME'];
				$myProduct['DESCTECH'] = $productTemp[0]['DESCTECH'];
				$myProduct['PRIX'] = sprintf("%.2f",$productTemp[0]['PRIX']);
				$myProduct['PRIXLOWEST'] = $product->calculateLowestPrice($productTemp[0]['ID']);
				$myProduct['isPROMO'] = $productTemp[0]['isPROMO'];
				$myProduct['IDCATEGORY'] = $productTemp[0]['IDCATEGORY'];
				$myProduct['CATNOM'] = $productTemp[0]['CATNOM'];
				$myProduct['CATNAVNOM'] = $productTemp[0]['CATNAVNOM'];
				$myProduct['URL'] = $productTemp[0]['URL'];
				$myProduct['BREND'] = $productTemp[0]['BREND'];
				$myProduct['IDBREND'] = $productTemp[0]['IDBREND'];
				$myProduct['isSHOWBREND'] = $productTemp[0]['isSHOWBREND'];
				$myProduct['BRENDURL'] = $productTemp[0]['BRENDURL'];
				$myProduct['isDEVISPRODUCT'] = $productTemp[0]['isDEVISPRODUCT'];
				$myProduct['DOCNAME'] = $productTemp[0]['DOCNAME'];
				$myProduct['DOCURL'] = $productTemp[0]['DOCURL'];
				$myProduct['STOCK'] = $productTemp[0]['STOCK'];
				$myProduct['isQTEPRIXACTIVE'] = $productTemp[0]['isQTEPRIXACTIVE'];
				$myProduct['BOOSTED_BESTSELLER'] = $productTemp[0]['BOOSTED_BESTSELLER'];

				$myProduct['ONSELECT_IDOPTION'] = $productTemp[0]['ONSELECT_IDOPTION'];
				if ($myProduct['ONSELECT_IDOPTION'] > 0) {
					$optionList = new OptionList();
					$myProduct['ONSELECT_OPTION'] = $optionList->getByIdProduct($myProduct['ID']);
				}

				$myProduct['LISTPICS'] = $productPics;

				$i = 0;
				$myProduct['LISTOPTION'] = array();
				foreach ($productTemp as $option) {
                    $hasOption = false;
                    foreach ($myProduct['LISTOPTION'] as $current_option) {
                        if ($current_option['IDOPTION'] == $option['IDOPTION']) {
                            $hasOption = true;
                            break;
                        }
                    }
                    if (!$hasOption) {
                        $myProduct['LISTOPTION'][$i]['NOMOPTION'] = $option['NOMOPTION'];
                        $myProduct['LISTOPTION'][$i]['IDOPTION'] = $option['IDOPTION'];
                        $i++;
                    }
				}

				$myProduct['LISTCHILD'] = $this->computeProductChildsList($id, $myProduct['IDCATEGORY'], $myProduct['IDBREND']);

				return $myProduct;
			} else { return false;}
		} catch (Zend_Exception $e) {
			$this->log("ComputeProductDetail : "+$e->getMessage(), 'err');
		}
		return false;
	}
    
    private function checkForProductRedirection($row) {
	    $link = "";
	    if(isset($row['PRODUCT_URL'])) {
		    $link = "/".$row['PRODUCT_URL'];
	    } else if (isset($row['NAVNOM'])) {
		    $link = "/".Utils_Tool::getFormattedUrlProduct($row['NAVNOM_URLPARENTS'], $row['NAVNOM'], $row['ID']);
	    } else if (isset($row['PRODNAVNOM'])){
		    $link = "/".Utils_Tool::getFormattedUrlProduct($row['NAVNOM_URLPARENTS'], $row['PRODNAVNOM'], $row['ID']);
	    } 
        if ($this->FeatureRedirectionAuto) {
            $front = Zend_Controller_Front::getInstance();
            $currentpage = $front->getRequest()->getRequestUri();
            if ($link != $currentpage) {
                $this->send301Redirection($this->baseUrl_SiteCommerceUrl.$link);
            }
        }
        $this->setCanonicalUrl($this->baseUrl_SiteCommerceUrl.$link);
    }
    private function checkForCategoryRedirection($row) {
	    $link = "/".Utils_Tool::getFormattedUrlCategory($row['NAVNOM_URLPARENTS'], $row['NAVNOM'], $row['ID']); 
        if ($this->FeatureRedirectionAuto) {
            $front = Zend_Controller_Front::getInstance();
            $currentpage = $front->getRequest()->getRequestUri();
        
            if ($link != $currentpage) {
                $this->send301Redirection($this->baseUrl_SiteCommerceUrl.$link);
            }
        }
        $this->setCanonicalUrl($this->baseUrl_SiteCommerceUrl.$link);
    }

	public function detailAction()
	{
		if ($this->getRequest()->getParam('p')) {
			$id = (int)$this->getRequest()->getParam('p');

			if ($id>0) {
                $user_namespace = null;
				try {
					$user_namespace = $this->getSession();
	            } catch (Zend_Exception $e) {  
                
                }
	
				try {				
                    $myProduct = $this->computeProductDetail($id);

					if ($myProduct) {
                    
                        $this->checkForProductRedirection($myProduct);

                        if (isset($user_namespace) && !empty($user_namespace)){
						    $user_namespace->urlCurrentProduct = $this->getRequest()->getRequestUri();

						    $user_namespace->currentProductDetail = $myProduct;
                        }

						$category = new Category();

						$breadcrumb = $category->getTreeInLineOf($myProduct['IDCATEGORY']);

						$this->view->listFTFDS = $this->getFTFDSByIdProd($id);

						$this->view->breadcrumb = $breadcrumb;
                        
                        if (isset($user_namespace) && !empty($user_namespace)){
						    $user_namespace->currentProductDetailDesign = $this->showDesign($breadcrumb[0]['ID'], $breadcrumb[0]);
						    $this->view->actualDesign = $user_namespace->currentProductDetailDesign;
                        }
						$this->view->title = $myProduct['NAVTITRE'];

						$filter = new Zend_Filter();
						$filter	->addFilter(new Zend_Filter_StripTags())->addFilter(new Zend_Filter_StringTrim());
						$this->view->metadescription = $filter->filter($myProduct['NAVDESC']);
						$this->view->metakeywords = $myProduct['KEYWORDS'];

						$this->view->detailProduct = $myProduct;
                                                
                        $isProductOutOfStock = false;
                        if ($myProduct['STOCK'] == 4) {
                            $isProductOutOfStock = true;
                        }
                        $this->view->isProductOutOfStock = $isProductOutOfStock; 
                        
					} else { $this->log('Le produit est introuvable : '.$this->getRequest()->getRequestUri(), 'warn'); $this->_redirect('/'); }
				} catch (Zend_Exception $e) {  $this->log($e->getMessage(), 'err'); $this->_redirect('/');  }
			} else { $this->_redirect('/');  }
		}  else { $this->_redirect('/');  }
	}


	private function isPromoActive($myPromo) {
		if ($myPromo) {
			if ($myPromo['REMISEEURO'] > 0) { return true; }
			if ($myPromo['REMISEPOUR'] > 0) { return true; }
		}
		return false;
	}


	private function computeProductListToShowOld($list, $user) {
		$i = 0;
		$j = 1;
		$isFirst = true;
		$listProducts = array();
		$metakeywords = '';

		$isAllPromos = false;
		$currentPromoAll = array();
		$currentPromo = array();
		$listUserCodeInternIdBrendFound = array();
		$listUserCodeInternIdBrends = array();
		$listIdBrendFound = array();
		$listUserIdBrendFound = array();
		$listUserIdBrends = array();
		$listIdBrends = array();
		$promoCalculator = new PromoCalculator();
		$promoProduct = new PromoProduct();
		$promoUser = new PromoUser();
 
		if (!empty($list)) {
			$idCategory = $list[0]['CATID'];
			$myPromo = $promoProduct->getRemiseByProductCategory($idCategory);
			if ($this->isPromoActive($myPromo)) { $isAllPromos = true; $currentPromoAll = $myPromo; }
             
		}

		foreach ($list AS $row) {
			if ($j == 9 ) {
				$j = 1;
				$i++;
				$isFirst = true;
			} else {
				if (!$isFirst) {
					$j++;
				}
			}

			$listProducts[$i][$j]['ID'] = $row['ID'];
			$listProducts[$i][$j]['NOM'] = $row['NOM'];
			$listProducts[$i][$j]['DESCSHORT'] = $this->cutString($row['DESCSHORT'], 80);
			$listProducts[$i][$j]['URL'] = $row['URL'];
			$listProducts[$i][$j]['BREND'] = $row['BREND'];
			$listProducts[$i][$j]['isSHOWBREND'] = $row['isSHOWBREND'];
			$listProducts[$i][$j]['BRENDURL'] = $row['BRENDURL'];
			$listProducts[$i][$j]['NBREFERENCE'] = $row['NBREFERENCE'];
			$listProducts[$i][$j]['isDEVISPRODUCT'] = $row['isDEVISPRODUCT'];
			$listProducts[$i][$j]['BOOSTED_BESTSELLER'] = $row['BOOSTED_BESTSELLER'];

			$listProducts[$i][$j]['NAVNOM'] = $this->verifyNavigationString($row['PRODNAVNOM'], $row['NOM'], '');
			$listProducts[$i][$j]['NAVNOM_URLPARENTS'] = $row['NAVNOM_URLPARENTS'];

			$listProducts[$i][$j]['NAVTITRE'] = $row['NAVTITRE'];
			$listProducts[$i][$j]['NAVDESC'] = $row['NAVDESC'];

			$isFirst = false;

			if (empty($metakeywords)) {
				$metakeywords .= $row['KEYWORDS_PROD'];
			} else {
				$metakeywords .= ','.$row['KEYWORDS_PROD'];
			}

			$listProducts[$i][$j]['isPROMO'] = $row['isPROMO'];
			$listProducts[$i][$j]['PRIX'] = $row['PRIX'];

			/*
			 * CALCUL PROMO
			 */
			$idBrend = $row['BRENDID'];

			if (!in_array($idBrend, $listIdBrends, true)) {
				$myPromo = $promoProduct->getRemiseByProductBrend($idBrend);
				array_push($listIdBrends, $idBrend);
				if ($this->isPromoActive($myPromo)) { array_push($listIdBrendFound, array('ID' => $idBrend, 'PROMO' => $myPromo)); }
			}
			if ($row['isPROMO'] == 1) {
				$isRemise = false;
				if (in_array($idBrend, $listIdBrends, true)) {
					foreach ($listIdBrendFound as $brendPromos) {
						if ($brendPromos['ID'] == $idBrend) {
							$listProducts[$i][$j]['isPROMO'] = 0;
							$currentPromo = $brendPromos['PROMO'];
							if ($currentPromo['REMISEEURO'] > 0) {
								$listProducts[$i][$j]['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromo['REMISEEURO']);
								$isRemise = true;
							}
							if ($currentPromo['REMISEPOUR'] > 0) {
								$listProducts[$i][$j]['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromo['REMISEPOUR']);
								$isRemise = true;
							}
							break;
						}
					}
				}
				if ($isAllPromos && !empty($currentPromoAll) && !$isRemise ) {
					$listProducts[$i][$j]['isPROMO'] = 0;
					if ($currentPromoAll['REMISEEURO'] > 0) {
						$listProducts[$i][$j]['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromoAll['REMISEEURO']);
					}
					if ($currentPromoAll['REMISEPOUR'] > 0) {
						$listProducts[$i][$j]['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromoAll['REMISEPOUR']);
					}
				}
			}
			if (isset($user) && !empty($user)) {
				$userId = $user['id'];
				$codeIntern = $user['cintern'];
				$isRemise = false;

				if (!empty($codeIntern)) {
					if (!in_array($idBrend.'-'.$codeIntern, $listUserCodeInternIdBrends, true)) {
						$myPromo = $promoUser->getRemiseByCodeInternMarque($idBrend, $codeIntern);
						array_push($listUserCodeInternIdBrends, $idBrend.'-'.$codeIntern);
						if ($this->isPromoActive($myPromo)) { array_push($listUserCodeInternIdBrendFound, array('ID' => $idBrend, 'CODE' => $codeIntern, 'PROMO' => $myPromo)); }
					}
					if (in_array($idBrend.'-'.$codeIntern, $listUserCodeInternIdBrends, true)) {
						foreach ($listUserCodeInternIdBrendFound as $brendPromos) {
							if ($brendPromos['ID'] == $idBrend && $brendPromos['CODE'] == $codeIntern ) {
								$listProducts[$i][$j]['isPROMO'] = 0;
								$currentPromo = $brendPromos['PROMO'];
								if ($currentPromo['REMISEEURO'] > 0) {
									$listProducts[$i][$j]['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromo['REMISEEURO']);
									$isRemise = true;
								}
								if ($currentPromo['REMISEPOUR'] > 0) {
									$listProducts[$i][$j]['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromo['REMISEPOUR']);
									$isRemise = true;
								}
								break;
							}
						}
					}
				}
				if (!$isRemise) {
					if (!in_array($idBrend, $listUserIdBrends, true)) {
						$myPromo = $promoUser->getRemiseByMarque($idBrend, $userId);
						array_push($listUserIdBrends, $idBrend);
						if ($this->isPromoActive($myPromo)) { array_push($listUserIdBrendFound, array('ID' => $idBrend, 'PROMO' => $myPromo)); }
					}
					if (in_array($idBrend, $listUserIdBrends, true)) {
						foreach ($listUserIdBrendFound as $brendPromos) {
							if ($brendPromos['ID'] == $idBrend) {
								$listProducts[$i][$j]['isPROMO'] = 0;
								$currentPromo = $brendPromos['PROMO'];
								if ($currentPromo['REMISEEURO'] > 0) {
									$listProducts[$i][$j]['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromo['REMISEEURO']);
									$isRemise = true;
								}
								if ($currentPromo['REMISEPOUR'] > 0) {
									$listProducts[$i][$j]['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromo['REMISEPOUR']);
									$isRemise = true;
								}
								break;
							}
						}
					}
				}
			}


			if ($listProducts[$i][$j]['PRIX'] <= 0 ) { $listProducts[$i][$j]['PRIX'] = $row['PRIX']; }
		}
		return $result = array( 'PRODUCTS' => $listProducts, 'META_KEY' =>  $metakeywords);
	}
    
    private function computeUrlNavigationParent($row) {
        return $row['NAVNOM_URLPARENTS']."/".$row['CATNAVNOM'];
    }
 

	private function computeProductListToShowFromEs($user, $searchWord, $listFacets) {
		try {
            if (empty($this->FeatureElasticSearchWsdl) || empty($this->FeatureElasticSearchUsername) || empty($this->FeatureElasticSearchKey) || $this->FeatureElasticSearchEnableOnSearch == false) {
		        return array( 'PRODUCTS' => array(), 'META_KEY' =>  '');
            }
            $facetsValues = "";
            if (!empty($listFacets)){
                $facetsValues = json_encode($listFacets);
            }
            $this->log("Elastic search => Search word : ".$searchWord. " / Facets : ".$facetsValues,'info');
             
            $result = new stdClass();
            $isCalledSucceed = false;
            try
            {     
                $soapClient = $this->getSoapClient($this->FeatureElasticSearchWsdl);
                $request = $this->getSoapHeader($this->FeatureElasticSearchUsername, $this->FeatureElasticSearchKey);
                    
                $request->SearchWord = $searchWord;
                if (!empty($listFacets)){
                    $request->Facets = $facetsValues;
                }
                
                $parameters = new stdClass();
                $parameters->request = $request;
                    
                $result = $soapClient->SearchProducts($parameters);
                
                $isCalledSucceed = true;
                $soapClient = null;   
            }
            catch (SoapFault $fault)
            {
				$this->log($fault->faultstring,'err');
            }
                
            if (!$isCalledSucceed || $result->SearchProductsResult->Total == 0) {
		        return array( 'PRODUCTS' => array(), 'META_KEY' =>  '');
            }   
            //------------------------------------------------------
            
            $listProducts = array();  
			$listUserIdBrendFound = array();
			$listUserIdBrends = array();
		    $listIdBrends = array(); 
		    $listIdBrendFound = array();
			$promoUser = new PromoUser();
			$promoCalculator = new PromoCalculator();
			$promoProduct = new PromoProduct();
			$product = new Product();
			$metakeywords = '';  
            
			$isAllPromos = false;
              
            $listOfFacets = array();
            
            if (isset($result->SearchProductsResult->Facets->ProductFacet)) {
                if (!is_array($result->SearchProductsResult->Facets->ProductFacet)) { 
                    array_push($listOfFacets, $result->SearchProductsResult->Facets->ProductFacet); 
                } else {
                    $listOfFacets = $result->SearchProductsResult->Facets->ProductFacet;
                }
            }
            
            $listOfProducts = array();
            if ($result->SearchProductsResult->Total == 1) {
                array_push($listOfProducts, $result->SearchProductsResult->Products->ProductDetail); 
            } else {
                $listOfProducts = $result->SearchProductsResult->Products->ProductDetail;
            }
            
			foreach ($listOfProducts as $row) { 
                try
                {     
				    $currentProduct = array();
				    $currentProduct['ID'] = $row->ProductId;
				    $currentProduct['NOM'] = $row->Name;
				    $currentProduct['DESCSHORT'] = $row->ShortDescription;
				    $currentProduct['PRODUCT_URL'] = $row->ProductUrl;
			  
				    $currentProduct['NAVNOM'] =  $row->MetaNavigationName; 
				    $currentProduct['NAVTITRE'] =  $row->MetaTitle;
				    $currentProduct['NAVDESC'] =  $row->MetaDescription;
                  
                    $isPromo = false; 
                    $currentPrice = 99999; 
                    if (isset($row->ProductPrice)) {
				        $currentProduct['isDEVISPRODUCT'] = !$row->ProductPrice->IsDevis;
				        $currentProduct['PRIX'] = $row->ProductPrice->Price;
				        $currentProduct['PRIXLOWEST'] = $currentProduct['PRIX'];
				        $currentProduct['isPRIXDEGRESSIF'] = $row->ProductPrice->IsDegresivePrice;
				        $currentProduct['isPROMO'] = !$row->ProductPrice->IsPromo;
                        $currentPrice = $row->ProductPrice->Price; 
                        $isPromo = $currentProduct['isPROMO'];
                    } else {
				        $currentProduct['isDEVISPRODUCT'] = "";
				        $currentProduct['PRIX'] = $currentPrice;
				        $currentProduct['PRIXLOWEST'] = $currentProduct['PRIX'];
				        $currentProduct['isPRIXDEGRESSIF'] = 0;
				        $currentProduct['isPROMO'] = 1;
                    }
					
                    if (isset($row->Category)) {
				        $currentProduct['CATID'] = $row->Category->Id;
				        $currentProduct['CATNOM'] = $row->Category->Name;
                        $currentProduct['NAVNOM_URLPARENTS'] = $row->Category->NavigationName;
                    } else {
				        $currentProduct['CATID'] = 0;
				        $currentProduct['CATNOM'] = "";
                        $currentProduct['NAVNOM_URLPARENTS'] = "";
                    }
                
                    if (isset($row->Reranking)) {
                        $currentProduct['BOOSTED_BESTSELLER'] = $row->Reranking->BestSeller; 
                    } else {
                        $currentProduct['BOOSTED_BESTSELLER'] = 99999; 
                    }
                 
				    $currentProduct['URL'] = $row->DefaultPictureUrl; 
                
				    $idBrend = 0;
                    if (isset($row->Brand)) {
				        $currentProduct['isSHOWBREND'] = !$row->Brand->IsShow;
				        $currentProduct['BREND'] = $row->Brand->Name;
				        $currentProduct['BRENDURL'] = $row->Brand->Url;
                        $idBrend = $row->Brand->Id;
                    } else {
				        $currentProduct['isSHOWBREND'] = false;
				        $currentProduct['BREND'] = "";
				        $currentProduct['BRENDURL'] = "";
                    }
				    $currentProduct['NBREFERENCE'] = $row->NbReferences;
                 
                
			        $listUserCodeInternIdBrendFound = array();
			        $listUserCodeInternIdBrends = array();
                   
				    /*
				        * CALCUL PROMO
				        */ 
                
				    if (!in_array($idBrend, $listIdBrends, true)) {
					    $myPromo = $promoProduct->getRemiseByProductBrend($idBrend);
					    array_push($listIdBrends, $idBrend);
					    if ($this->isPromoActive($myPromo)) {
                            $isPromo = true;
                            array_push($listIdBrendFound, array('ID' => $idBrend, 'PROMO' => $myPromo)); 
                        }
				    }
				    if ($isPromo) {
					    $isRemise = false;
					    if (in_array($idBrend, $listIdBrends, true)) {
						    foreach ($listIdBrendFound as $brendPromos) {
							    if ($brendPromos['ID'] == $idBrend) {
								    $currentProduct['isPROMO'] = 0;
								    $currentPromo = $brendPromos['PROMO'];
								    if ($currentPromo['REMISEEURO'] > 0) {
									    $currentProduct['PRIX'] = $promoCalculator->calculEuro($currentPrice, $currentPromo['REMISEEURO']);
									    $isRemise = true;
								    }
								    if ($currentPromo['REMISEPOUR'] > 0) {
									    $currentProduct['PRIX'] = $promoCalculator->calculPour($currentPrice, $currentPromo['REMISEPOUR']);
									    $isRemise = true;
								    }
								    break;
							    }
						    }
					    }
					    if ($isAllPromos && !empty($currentPromoAll) && !$isRemise ) {
						    $currentProduct['isPROMO'] = 0;
						    if ($currentPromoAll['REMISEEURO'] > 0) {
							    $currentProduct['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromoAll['REMISEEURO']);
						    }
						    if ($currentPromoAll['REMISEPOUR'] > 0) {
							    $currentProduct['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromoAll['REMISEPOUR']);
						    }
					    }
				    }
				    if (isset($user) && !empty($user)) {
					    $userId = $user['id'];
					    $codeIntern = $user['cintern'];
					    $isRemise = false;

					    if (!empty($codeIntern)) {
						    if (!in_array($idBrend.'-'.$codeIntern, $listUserCodeInternIdBrends, true)) {
							    $myPromo = $promoUser->getRemiseByCodeInternMarque($idBrend, $codeIntern);
							    array_push($listUserCodeInternIdBrends, $idBrend.'-'.$codeIntern);
							    if ($this->isPromoActive($myPromo)) { 
                                    $isPromo = true;
                                    array_push($listUserCodeInternIdBrendFound, array('ID' => $idBrend, 'CODE' => $codeIntern, 'PROMO' => $myPromo)); 
                                }
						    }
						    if (in_array($idBrend.'-'.$codeIntern, $listUserCodeInternIdBrends, true)) {
							    foreach ($listUserCodeInternIdBrendFound as $brendPromos) {
								    if ($brendPromos['ID'] == $idBrend && $brendPromos['CODE'] == $codeIntern ) {
									    $currentProduct['isPROMO'] = 0;
									    $currentPromo = $brendPromos['PROMO'];
									    if ($currentPromo['REMISEEURO'] > 0) {
										    $currentProduct['PRIX'] = $promoCalculator->calculEuro($currentPrice, $currentPromo['REMISEEURO']);
										    $isRemise = true;
									    }
									    if ($currentPromo['REMISEPOUR'] > 0) {
										    $currentProduct['PRIX'] = $promoCalculator->calculPour($currentPrice, $currentPromo['REMISEPOUR']);
										    $isRemise = true;
									    }
									    break;
								    }
							    }
						    }
					    }
					    if (!$isRemise) {
						    if (!in_array($idBrend, $listUserIdBrends, true)) {
							    $myPromo = $promoUser->getRemiseByMarque($idBrend, $userId);
							    array_push($listUserIdBrends, $idBrend);
							    if ($this->isPromoActive($myPromo)) { 
                                    $isPromo = true;
                                    array_push($listUserIdBrendFound, array('ID' => $idBrend, 'PROMO' => $myPromo)); 
                                }
						    }
						    if (in_array($idBrend, $listUserIdBrends, true)) {
							    foreach ($listUserIdBrendFound as $brendPromos) {
								    if ($brendPromos['ID'] == $idBrend) {
									    $currentProduct['isPROMO'] = 0;
									    $currentPromo = $brendPromos['PROMO'];
									    if ($currentPromo['REMISEEURO'] > 0) {
										    $currentProduct['PRIX'] = $promoCalculator->calculEuro($currentPrice, $currentPromo['REMISEEURO']);
										    $isRemise = true;
									    }
									    if ($currentPromo['REMISEPOUR'] > 0) {
										    $currentProduct['PRIX'] = $promoCalculator->calculPour($currentPrice, $currentPromo['REMISEPOUR']);
										    $isRemise = true;
									    }
									    break;
								    }
							    }
						    }
					    } 
                    }  
				    if ($currentProduct['PRIX'] <= 0 ) { 
                        $currentProduct['PRIX'] = $currentPrice; 
                    } 
				    $currentProduct['PRIXLOWEST'] = $product->calculateLowestPrice($currentProduct['ID']);
					
				    array_push($listProducts, $currentProduct);
                }
                catch (Zend_Exception $e)
                {
			        $this->log($e->getMessage(),'err');
                }
            } 
            
			return array( 'PRODUCTS' => $listProducts, 'FACETS' => $listOfFacets, 'META_KEY' =>  $metakeywords);
		} catch (Zend_Exception $e) {
			$this->log('computeProductListToShowFromEs : '.$e->getMessage(),'err');
		}
		return array( 'PRODUCTS' => array(), 'META_KEY' =>  '');
    }
      
      
	private function computeProductListToShow($list, $user) {
		try {
			$listProducts = array();
			$metakeywords = '';

			$isAllPromos = false;
			$currentPromoAll = array();
			$currentPromo = array();
			$listUserCodeInternIdBrendFound = array();
			$listUserCodeInternIdBrends = array();
			$listUserIdBrendFound = array();
			$listUserIdBrends = array();
			$listIdBrends = array();
			$listIdBrendFound = array();
			$promoCalculator = new PromoCalculator();
			$promoProduct = new PromoProduct();
			$promoUser = new PromoUser();
			$product= new Product();

			if (!empty($list)) {
				$idCategory = $list[0]['CATID'];
				$myPromo = $promoProduct->getRemiseByProductCategory($idCategory);
				if ($this->isPromoActive($myPromo)) { $isAllPromos = true; $currentPromoAll = $myPromo; }
			}
			$productChildQte = new ProductChildQte();

			foreach ($list AS $row) {
				$currentProduct = array();
				$currentProduct['ID'] = $row['ID'];
				$currentProduct['NOM'] = $row['NOM'];
				$currentProduct['CATID'] = $row['CATID'];
				$currentProduct['CATNOM'] = $row['CATNOM'];
				$currentProduct['DESCSHORT'] = $row['DESCSHORT'];
				$currentProduct['URL'] = $row['URL'];
				$currentProduct['BREND'] = $row['BREND'];
				$currentProduct['isSHOWBREND'] = $row['isSHOWBREND'];
				$currentProduct['BRENDURL'] = $row['BRENDURL'];
				$currentProduct['NBREFERENCE'] = $row['NBREFERENCE'];
				$currentProduct['isDEVISPRODUCT'] = $row['isDEVISPRODUCT'];
                $currentProduct['NAVNOM_URLPARENTS'] = $this->computeUrlNavigationParent($row);
                $currentProduct['BOOSTED_BESTSELLER'] = $row['BOOSTED_BESTSELLER'];

				if (isset($row['NAVNOM'])) {
					$navnom = $row['NAVNOM'];
				} else {
					$navnom = $row['PRODNAVNOM'];
				}

				$currentProduct['NAVNOM'] = $this->verifyNavigationString($navnom, $row['NOM'], '');

				$currentProduct['NAVTITRE'] = $row['NAVTITRE'];
				$currentProduct['NAVDESC'] = $row['NAVDESC'];

				$isFirst = false;

				if (empty($metakeywords)) {
					$metakeywords .= $row['KEYWORDS_PROD'];
				} else {
					$metakeywords .= ','.$row['KEYWORDS_PROD'];
				}

				$currentProduct['isPROMO'] = $row['isPROMO'];
				$currentProduct['PRIX'] = $row['PRIX'];

				/*
				 * PRIX DEGRESSIF
				 */
				$currentProduct['isPRIXDEGRESSIF'] = $productChildQte->isPrixDegressifByProductID($row['ID']);
					
				/*
				 * CALCUL PROMO
				 */
				$idBrend = $row['BRENDID'];

				if (!in_array($idBrend, $listIdBrends, true)) {
					$myPromo = $promoProduct->getRemiseByProductBrend($idBrend);
					array_push($listIdBrends, $idBrend);
					if ($this->isPromoActive($myPromo)) { array_push($listIdBrendFound, array('ID' => $idBrend, 'PROMO' => $myPromo)); }
				}
				if ($row['isPROMO'] == 1) {
					$isRemise = false;
					if (in_array($idBrend, $listIdBrends, true)) {
						foreach ($listIdBrendFound as $brendPromos) {
							if ($brendPromos['ID'] == $idBrend) {
								$currentProduct['isPROMO'] = 0;
								$currentPromo = $brendPromos['PROMO'];
								if ($currentPromo['REMISEEURO'] > 0) {
									$currentProduct['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromo['REMISEEURO']);
									$isRemise = true;
								}
								if ($currentPromo['REMISEPOUR'] > 0) {
									$currentProduct['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromo['REMISEPOUR']);
									$isRemise = true;
								}
								break;
							}
						}
					}
					if ($isAllPromos && !empty($currentPromoAll) && !$isRemise ) {
						$currentProduct['isPROMO'] = 0;
						if ($currentPromoAll['REMISEEURO'] > 0) {
							$currentProduct['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromoAll['REMISEEURO']);
						}
						if ($currentPromoAll['REMISEPOUR'] > 0) {
							$currentProduct['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromoAll['REMISEPOUR']);
						}
					}
				}
				if (isset($user) && !empty($user)) {
					$userId = $user['id'];
					$codeIntern = $user['cintern'];
					$isRemise = false;

					if (!empty($codeIntern)) {
						if (!in_array($idBrend.'-'.$codeIntern, $listUserCodeInternIdBrends, true)) {
							$myPromo = $promoUser->getRemiseByCodeInternMarque($idBrend, $codeIntern);
							array_push($listUserCodeInternIdBrends, $idBrend.'-'.$codeIntern);
							if ($this->isPromoActive($myPromo)) { array_push($listUserCodeInternIdBrendFound, array('ID' => $idBrend, 'CODE' => $codeIntern, 'PROMO' => $myPromo)); }
						}
						if (in_array($idBrend.'-'.$codeIntern, $listUserCodeInternIdBrends, true)) {
							foreach ($listUserCodeInternIdBrendFound as $brendPromos) {
								if ($brendPromos['ID'] == $idBrend && $brendPromos['CODE'] == $codeIntern ) {
									$currentProduct['isPROMO'] = 0;
									$currentPromo = $brendPromos['PROMO'];
									if ($currentPromo['REMISEEURO'] > 0) {
										$currentProduct['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromo['REMISEEURO']);
										$isRemise = true;
									}
									if ($currentPromo['REMISEPOUR'] > 0) {
										$currentProduct['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromo['REMISEPOUR']);
										$isRemise = true;
									}
									break;
								}
							}
						}
					}
					if (!$isRemise) {
						if (!in_array($idBrend, $listUserIdBrends, true)) {
							$myPromo = $promoUser->getRemiseByMarque($idBrend, $userId);
							array_push($listUserIdBrends, $idBrend);
							if ($this->isPromoActive($myPromo)) { array_push($listUserIdBrendFound, array('ID' => $idBrend, 'PROMO' => $myPromo)); }
						}
						if (in_array($idBrend, $listUserIdBrends, true)) {
							foreach ($listUserIdBrendFound as $brendPromos) {
								if ($brendPromos['ID'] == $idBrend) {
									$currentProduct['isPROMO'] = 0;
									$currentPromo = $brendPromos['PROMO'];
									if ($currentPromo['REMISEEURO'] > 0) {
										$currentProduct['PRIX'] = $promoCalculator->calculEuro($row['PRIX'], $currentPromo['REMISEEURO']);
										$isRemise = true;
									}
									if ($currentPromo['REMISEPOUR'] > 0) {
										$currentProduct['PRIX'] = $promoCalculator->calculPour($row['PRIX'], $currentPromo['REMISEPOUR']);
										$isRemise = true;
									}
									break;
								}
							}
						}
					}
				}


				if ($currentProduct['PRIX'] <= 0 ) { $currentProduct['PRIX'] = $row['PRIX']; }
 
				$currentProduct['PRIXLOWEST'] = $product->calculateLowestPrice($currentProduct['ID']);
					
				array_push($listProducts, $currentProduct);
			}
			return $result = array( 'PRODUCTS' => $listProducts, 'META_KEY' =>  $metakeywords);
		} catch (Zend_Exception $e) {
			$this->log('ComputeProductListToShow : '.$e->getMessage(),'err');
		}
		return $result = array( 'PRODUCTS' => array(), 'META_KEY' =>  '');
	}

	private function getLastCharOf($str) { return $str{strlen($str)-1}; }

    private function ebusinessCategoryAction($id) {
         $currentUser = array();
		try {
		    $auth = Zend_Auth::getInstance();
		    $auth->setStorage($this->getSessionStorage());
		    $storage = $auth->getStorage()->read();
		    if ($auth->hasIdentity() && isset($storage['user'])) {
			    $currentUser = $storage['user'];
            }
        }
        catch (Zend_Exception $e) {
        }

        $category = new Category();
		$product = new Product();
        $productList = array();
		$listCat = array();
		$listCat = $category->getTreeCatsOfWithLevel($id, true);
                    
		if (!empty($listCat)) {
                    
            $this->checkForCategoryRedirection($listCat);
                        
			$this->view->listCat = $listCat;
			$breadcrumb = $category->getTreeInLineOf($id);
			$this->view->breadcrumb = $breadcrumb;
			$this->view->actualDesign = $this->showDesign($breadcrumb[0]['ID'], $breadcrumb[0]);

			if (empty($listCat['NAVTITRENOM'])) {
				$listCat['NAVTITRENOM'] = $listCat['NOM'];
			}
			if (empty($listCat['NAVDESCRIPTION'])) {
				$listCat['NAVDESCRIPTION'] = $listCat['DESCRIPTION'];
			}

			/* Referencement automatique
				$key = new KeyMap();
				$key->updateCatEntry($id);
				*/

			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())->addFilter(new Zend_Filter_StringTrim());

			$this->view->metadescription = $filter->filter($listCat['NAVDESCRIPTION']);
			$this->view->title = $listCat['NAVTITRENOM'];
			//$isTri_metaKeyword = false;

			$annoncesleft = new AnnonceLeft();
			$this->view->listads = $annoncesleft->getAnnoncesByShow($id);
						
			if (!$listCat['SUBS']) {
				$triSql = 'BOOSTED_BESTSELLER ASC';
				switch ($this->_request->getParam('tri')) {
					case 1:
						$triSql = "PRIX ASC";
						break;
					case 2:
						$triSql = "PRIX DESC";
						break;
					case 3:
						$triSql = 'NOM ASC';
						break;
					case 4:
						$triSql = 'NOM DESC';
						break;
					case 5:
						$triSql = 'BOOSTED_BESTSELLER ASC';
						break;
										
				}
				$this->view->currentCategory =$listCat;
								
				//List of products
				$productList = $product->getProductsByIdCategory($id, $triSql);
								
				$resultProduct = $this->computeProductListToShow($productList, $currentUser);
				$this->view->listAllProducts = $resultProduct['PRODUCTS'];
                            
                if (!empty($listCat['KEYWORDS'])) {
                    $this->view->metakeywords = $listCat['KEYWORDS'];
                } else {                                
                    $this->view->metakeywords = $resultProduct['META_KEY'];
                }
								
				//Show product page
				$this->render('nosproduits');
			} else {
				$metakeywords = $listCat['KEYWORDS'];

                if (empty($metakeywords)) {
                    for ($index = 0; $index < sizeOf($listCat['SUBS']); $index++) {
                        if (empty($metakeywords)) {
                            $metakeywords .= $listCat['SUBS'][$index]['KEYWORDS'];
                        } else {
                            $metakeywords .= ','.$listCat['SUBS'][$index]['KEYWORDS'];
                        }
                    }
                }
				$this->view->metakeywords = $metakeywords;
                if ($this->FeatureProductShowBestSellerOnCategory) {
					$productList = $product->getAllProductsBestSellerByCatId($id);
					$resultProduct = $this->computeProductListToShow($productList, $currentUser);
					$this->view->listAllProductsBestSeller = $resultProduct['PRODUCTS'];
                } 
				$productList = $product->getAllTreeSubProductsByCatId($id);
				$resultProduct = $this->computeProductListToShow($productList, $currentUser);                             
				$this->view->listAllProducts = $resultProduct['PRODUCTS'];
			}
		} else {
			$this->log('Impossible de trouver la categorie : '.$this->getRequest()->getRequestUri(), 'warn');
			$this->_redirect('/');
		}
    }

    private function gallerieCategoryAction($id) {
		$annonce = new AnnonceCms(); 
        $this->view->listAllArticles = $annonce->getAnnoncesByShow($id);
        
		$annonceGallery = new AnnonceGallery(); 
        $this->view->listAllGalleries = $annonceGallery->getAnnoncesByShow($id);

        $category = new Category();  
		$currentCat = $category->fetchRow("ID = ".$id);
		
		$this->view->currentCat = $currentCat;
		
		$this->view->currentCatSubs = $category->getTreeCatsOfWithLevel($id, true);
		
		if (empty($currentCat['NAVTITRENOM'])) {
			$currentCat['NAVTITRENOM'] = $currentCat['NOM'];
		}
		if (empty($currentCat['NAVDESCRIPTION'])) {
			$currentCat['NAVDESCRIPTION'] = $currentCat['DESCRIPTION'];
		}
		$filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())->addFilter(new Zend_Filter_StringTrim());

		$this->view->title = $currentCat['NAVTITRENOM'];
		$this->view->metadescription = $filter->filter($currentCat['NAVDESCRIPTION']);  
		$this->view->metakeywords = $currentCat['KEYWORDS']; 
    }

	public function categorieAction()
	{ 
		if ($this->getRequest()->getParam('c')) {
			$id = (int)$this->getRequest()->getParam('c');

			if ($id>0) {

				try {
                    if ($this->isSiteEbusiness) {
                        $this->ebusinessCategoryAction($id);
                    } 
                    if ($this->isSiteGallery) {
                        $this->gallerieCategoryAction($id);
                    } 
				} catch (Zend_Exception $e) {
					$this->log('Erreur pour trouver : '.$this->getRequest()->getRequestUri()." ".$e->getMessage(),'err');
					$this->_redirect('/');
				}
			} else {
				$this->_redirect('/');
			}
		}  else {
			$this->_redirect('/');
		}
	}
 
	public function rechercheAction () {
        $listFacetsSelected = array(); 
		try {
			$date = new Zend_Date();
			$date_start = $date->toString('YYYY-MM-dd HH:mm:ss');

			$filter = new Zend_Filter();
			$filter->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringToLower())
			->addFilter(new Zend_Filter_CustomAlnum(array('allowwhitespace' => true)));

			$keyTemp = $filter->filter($this->getRequest()->getParam('key'));
			if ($keyTemp=='Rechercher') { $keyTemp = ''; }

			$title = 'Votre s�lection';
			$linksMenu = array();

			if (strlen($keyTemp) == 0) {
				$linksMenu[0]['NAVURL'] = '/produits/recherche';
				$linksMenu[0]['NAVNOM'] = $title;

			} else {
				$title .= ' : "'.$keyTemp.'"';
				$linksMenu[0]['NAVURL'] = '/produits/recherche?key='.$keyTemp;
				$linksMenu[0]['NAVNOM'] = 'Votre s�lection : '.$keyTemp;
			}

			$this->view->linksMenu = $linksMenu;
			$this->view->title = $title;
			$this->view->searchKey = $keyTemp;

			if (!empty($keyTemp) && strlen($keyTemp) >= 2 ) {
                
                $currentUser = array();
                try {
                    $auth = Zend_Auth::getInstance();
                    $auth->setStorage($this->getSessionStorage());
                    $storage = $auth->getStorage()->read();
                    if ($auth->hasIdentity() && isset($storage['user'])) {
                        $currentUser = $storage['user'];
                    }
                }
                catch (Zend_Exception $e) { }
 
                foreach ( $this->getRequest()->getParams() as $key => $value) {
                    if (Utils_Tool::startsWith($key, "facet_") ) {
                        $keys = explode("_", $key);
                        $idFacet = $keys[1]."_".$keys[2];
                        $listFacetsSelected[$idFacet] = $value; 
                    }
                }  
                
				$resultProduct = $this->computeProductListToShowFromEs($currentUser, $keyTemp, $listFacetsSelected);
                
                if (sizeof($resultProduct['PRODUCTS']) == 0) {
                    $listFacetsSelected = array(); 
					$this->log("Alternative search => Search word : ".$keyTemp,'info');
                    $product = new Product();
				    $productList = $product->getProductsBySearch($keyTemp);
                    
				    $resultProduct = $this->computeProductListToShow($productList, $currentUser); 
                }
                
                $currentFacets = array();
                if (isset($resultProduct['FACETS']) && !empty($resultProduct['FACETS'])) {
                    $currentFacets = $resultProduct['FACETS'];
                }
				$this->view->listSearchFacets =  $currentFacets;
				$this->view->listSearchPages =  $resultProduct['PRODUCTS'];
				$this->view->nbrProd = sizeof($resultProduct['PRODUCTS']);

				try {
					$date = new Zend_Date();
					$data = array (
								'VALUE' => $keyTemp,
								'DATEEND' => $date->toString('YYYY-MM-dd HH:mm:ss'),
								'IP' => $_SERVER['REMOTE_ADDR'],
								'DATESTART' => $date_start
					);

					$statsSearch = new StatsSearch();
					$statsSearch->insert($data);
				} catch (Zend_Exception $e) {
					$this->log($e->getMessage(),'err');
				}

			} else {
				$this->view->listSearchPages = array();
				$this->view->listSearchFacets = array();
				$this->view->nbrProd = 0;
			}

		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
		}
        
        if ($this->getRequest()->isXmlHttpRequest()) {
		    $layout = Zend_Layout::getMvcInstance();
		    $layout->disableLayout();
        }
	}


	private function getFTFDSByIdProd($id) {
		$childFTFDS = new ProductChildFTFDS();
		$selectFTFDS = "SELECT pcftfds.ID_CHILD ID_CHILD ,pcftfds.URL URL
							FROM productchild_ftfds AS pcftfds 
						LEFT JOIN productchild AS pc ON pcftfds.ID_CHILD = pc.ID
						WHERE pc.IDPRODUCT = ".$id;

		$listFTFDS = $childFTFDS->getAdapter()->fetchAll($selectFTFDS);
		return $listFTFDS;
	}

	public function monpaniercleanupAction() {
		$userNamespace = $this->getSession();

		if (!isset($userNamespace->myObjectCaddy)) {
			$userNamespace->myObjectCaddy = new Caddy();
		}

		$caddy = $userNamespace->myObjectCaddy;
		$caddy->cleanUp();
		$userNamespace->myObjectCaddy = $caddy;
        $userNamespace->myObjectCaddyFidelite = new CaddyFidelite();
        
		$this->_forward('/monpaniertype');
	}

	public function monpaniertypeeditAction() {
		try {
			$linksMenu[0]['NAVURL'] = '/mon-panier-type-actualiser.html';
			$linksMenu[0]['NAVNOM'] = 'Mon Panier type';
			$this->view->linksMenu = $linksMenu;

			$this->view->title = 'Int�grer vos produits directement � votre panier';

			if ($this->isConnected()) {
				if ($this->_request->isPost()) {
					$params = $this->_request->getPost();
					if (isset($params['Child'],$params['Quantity'], $params['CaddyType'])) {
						$listChild = $params['Child'];
						$listQuantity = $params['Quantity'];
						$listQuantityMin = $params['QuantityMin'];
						$listCaddyType =  $params['CaddyType'];
						$listSelectedOption =  $params['selectedOption'];

						for ($i = 0; $i < sizeof($listChild); $i++) {
							if (isset($listChild[$i],$listQuantity[$i])) {
								$idchild = $listChild[$i];
								$qte = intval($listQuantity[$i]);
								$quantityMin = intval($listQuantityMin[$i]);
								$idCaddyType = intval($listCaddyType[$i]);
								$selectedOption = $listSelectedOption[$i];

								if ($qte > 0) {
									$qte = $this->computeQtyMin($qte, $quantityMin);
									if ($idCaddyType > 0 ) {
										$this->ajouterArticleCaddyType($idCaddyType, $qte, $selectedOption);
									} else {
										$this->ajouterArticle($idchild,$qte, 'N', $selectedOption);
									}
								} else {
									if ($idCaddyType > 0 ) {
										$this->supprimerArticleCaddyType($idCaddyType, $selectedOption);
									} else {
										$this->supprimerArticle($idchild, $selectedOption);
									}
								}
							}
						}
					}
				}
			}
		} catch (Zend_Exception $e) { $this->log($e->getMessage(),'err'); }
		$this->_redirect('/mon-panier.html');
	}

}
?>modules/default/controllers/UserController.php000060400000135326150710367660015722 0ustar00<?php


class UserController extends Modules_Default_Controllers_MainController
{
	public function init() {
		$this->view->baseUrl = $this->getBaseUrl();
		$this->checkMaintenance();
	}
	public function indexAction() {

	}
    
    public function deletecaddyfidelitypointAction() {
        try {
            $auth = Zend_Auth::getInstance();
			$auth->setStorage($this->getSessionStorage());
			$storage = $auth->getStorage()->read();
			if ($auth->hasIdentity() && isset($storage['user'])) {
		        if ($this->getRequest()->getParam('id')) {          
                    $id = (int) $this->getRequest()->getParam('id');
                    if ($id > 0) {
                        $userNamespace = $this->getSession();
                        if (isset($userNamespace->myObjectCaddyFidelite)) { 
                            $caddyFidelite = $userNamespace->myObjectCaddyFidelite;
                            $caddyFidelite->removeItem($id);
                            $userNamespace->myObjectCaddyFidelite = $caddyFidelite;
                        }
                    }    
                }            
            }
        } catch (Zend_Exception $e) { $this->log($e->getMessage(), 'err'); }
        $this->_redirect('/mon-panier.html');
    }

	public function addcaddyfidelitypointAction() {

        try {
            $auth = Zend_Auth::getInstance();
			$auth->setStorage($this->getSessionStorage());
			$storage = $auth->getStorage()->read();
			if ($auth->hasIdentity() && isset($storage['user'])) {
		        if ($this->getRequest()->getParam('id')) {          
                    $id = (int) $this->getRequest()->getParam('id');
                    if ($id > 0) {
                        $carteFidelite = new CarteFidelite();
                        $isAvailable = $carteFidelite->isAnnonceAvailableForUser($storage['user']['id'], $id);
                        if ($isAvailable) {
                            $userNamespace = $this->getSession();
                            if (!isset($userNamespace->myObjectCaddyFidelite)) { $userNamespace->myObjectCaddyFidelite = new CaddyFidelite(); }
                            $caddyFidelite = $userNamespace->myObjectCaddyFidelite;
                            $caddyFidelite->addItem($id);
                            $userNamespace->myObjectCaddyFidelite = $caddyFidelite;
                        }
                    }    
                }            
            }
        } catch (Zend_Exception $e) { $this->log($e->getMessage(), 'err'); }
        $this->_redirect('/mon-panier.html');
	}
	private function computeFactureTVA($facture, $paysLivraison) {
		$fact = new Facture();
		$fact->computeFactureTVA($facture, $paysLivraison);
		return $facture;
	}

	public function commandeAction()
	{
		if ($this->getRequest()->getParam('ref')) {
			$auth = Zend_Auth::getInstance();
			$auth->setStorage($this->getSessionStorage());
			$storage = $auth->getStorage()->read();

			$linksMenu[0]['NAVURL'] = '/mon-compte.html';
			$linksMenu[0]['NAVNOM'] = 'Mon compte';
			$this->view->linksMenu = $linksMenu;

			$filter = new Zend_Filter();
			$filter->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_StripTags());

			if ($auth->hasIdentity() && isset($storage['user'])) {

				$commande = new Command();
				$ref = $filter->filter($this->getRequest()->getParam('ref'));
				$isExist = $commande->fetchRow("REFERENCE = '".$ref."'");
				if ($isExist) {

					$resultCommande = $commande->findCommandByUserAndRef($storage['user']['id'],$ref );

					$myCommand = array();
					$myCommand['CADDY'] = array();
					$myCommand['CADDYFIDELITE'] = array();
					$i = 0;

                    $idCommand = 0;
					foreach ($resultCommande AS $row) {
						if ($i == 0) {
							$myCommand['REFERENCE'] = $row['REFERENCE'];
							$myCommand['ID'] = $row['ID'];
                            $idCommand = $row['ID'];

							$myCommand['PRIXTOTALTTC'] = sprintf("%.2f", $row['TOTALTTC']);
							$myCommand['PRIXTOTALHTFP'] = sprintf("%.2f", $row['TOTALHTFP']);
							$myCommand['PRIXFRAISPORTPOUR'] = $row['FRAISPORTPOUR'];
							$myCommand['PRIXFRAISPORT'] = sprintf("%.2f", $row['FRAISPORT']);
							$myCommand['PRIXTOTALHT'] = sprintf("%.2f", $row['TOTALHT']);
							$myCommand['PRIXTOTALHTHR'] = sprintf("%.2f", $row['TOTALHTHR']);
							$myCommand['PRIXREMISEEUR'] = sprintf("%.2f", $row['REMISEEUR']);
							$myCommand['DATESTART'] = $row['DATESTART'];

							$myCommand = $this->computeFactureTVA($myCommand, $row['LIVPAYS']);

							$myCommand['STATUT'] = $row['STATUT'];
							$myCommand['LIV_RAISONSOCIAL'] = $row['LIVRAISONSOCIAL'];
							$myCommand['LIV_ADRESSE'] = $row['LIVADRESSE'];
							$myCommand['LIV_CP'] = $row['LIVCP'];
							$myCommand['LIV_VILLE'] = $row['LIVVILLE'];
							$myCommand['LIV_PAYS'] = $row['LIVPAYS'];
							$myCommand['FACT_RAISONSOCIAL'] = $row['FACTRAISONSOCIAL'];
							$myCommand['FACT_ADRESSE'] = $row['FACTADRESSE'];
							$myCommand['FACT_CP'] = $row['FACTCP'];
							$myCommand['FACT_VILLE'] = $row['FACTVILLE'];
							$myCommand['FACT_PAYS'] = $row['FACTPAYS'];
							$myCommand['USER_NOM'] = $row['USERNOM'];
							$myCommand['USER_PRENOM'] = $row['USERPRENOM'];
							$myCommand['USER_TEL'] = $row['USERTEL'];
							$myCommand['USER_FAX'] = $row['USERFAX'];
							$myCommand['USER_NUMCOMPTE'] = $row['USERNUMCOMPTE'];
							$myCommand['USER_EMAIL'] = $row['USEREMAIL'];
							$myCommand['USER_MODEPAIEMENT'] = $row['USERMODEPAIEMENT'];
							$myCommand['LIV_NOM'] = $row['LIV_NOM'];
							$myCommand['CODEREDUCTION'] = $row['CODEREDUCTION'];
							$myCommand['USER_MODEPAIEMENT_TYPE'] = $row['USER_MODEPAIEMENT_TYPE'];
							$myCommand['USER_MODEPAIEMENT_LABEL'] = $row['USER_MODEPAIEMENT_LABEL'];
						}

						$myCommand['CADDY'][$i]['ID'] = $row['CHILDID'];
						$myCommand['CADDY'][$i]['REFERENCE'] = $row['CHILDREF'];
						$myCommand['CADDY'][$i]['DESIGNATION'] = $row['DESIGNATION'];
						$myCommand['CADDY'][$i]['isPROMO'] = $row['CHILDisPROMO'];
						$myCommand['CADDY'][$i]['isDEVIS'] = $row['CHILDisDEVIS'];
						$myCommand['CADDY'][$i]['PRIX'] = sprintf("%.2f", $row['CHILDPRIX']);
						$myCommand['CADDY'][$i]['QUANTITY'] = $row['CHILDQUANTITY'];
						$myCommand['CADDY'][$i]['PROMOPRIX'] = sprintf("%.2f", $row['CHILDPROMOPRIX']);
						$myCommand['CADDY'][$i]['PRIXTOTAL'] = sprintf("%.2f", $row['CHILDPRIXTOTAL']);
						$myCommand['CADDY'][$i]['REMISEPRIX'] = sprintf("%.2f", $row['CHILDPRIXREMISE']);
						$myCommand['CADDY'][$i]['REMISEPRIXTAUXE'] = sprintf("%.2f", $row['CHILDREMISEPRIXTAUXE']);
						$myCommand['CADDY'][$i]['REMISEPRIXTAUXP'] = $row['CHILDREMISEPRIXTAUXP'];
						$myCommand['CADDY'][$i]['PRODUCTID'] = $row['PRODUCTID'];
						$myCommand['CADDY'][$i]['PRODUCTNOM'] = $row['PRODUCTNOM'];
						$myCommand['CADDY'][$i]['STOCK'] = $row['STOCK'];
						$myCommand['CADDY'][$i]['SELECTEDOPTION'] = $row['SELECTEDOPTION'];
                        
						$myCommand['CADDY'][$i]['NAVPRODUCTNOM'] = $this->verifyNavigationString($row['PRODUCTNAVNOM'], $row['PRODUCTNOM'],'');
						$myCommand['CADDY'][$i]['NAVNOM_URLPARENTS'] = $row['NAVNOM_URLPARENTS'];
						$i++;
					}
                    
                    
					$i = 0;
					$resultCommandeFidelite = $commande->findCommandFideliteByUserAndRef($idCommand);
					foreach ($resultCommandeFidelite AS $row) {
						$myCommand['CADDYFIDELITE'][$i]['IDFIDELITE'] = $row['IDFIDELITE'];
						$myCommand['CADDYFIDELITE'][$i]['NOM'] = $row['NOM'];
						$myCommand['CADDYFIDELITE'][$i]['NBPOINT'] = $row['NBPOINT'];
                        $i++;
                    }
						
					if ($myCommand['STATUT'] == 1 || $myCommand['STATUT'] == 2 || $myCommand['STATUT'] == 3) {
						$this->view->title = 'Votre Facture';
					} else {
						$this->view->title = 'Votre Devis';
					}


					$this->view->facture = $myCommand;
					$this->render('facture');
				} else {
					$this->_redirect('/mon-compte.html');
				}
			} else {
				$this->_redirect('/connectez-vous.html');
			}
		} else {
			$this->_redirect('/mon-compte.html');
		}
	}
	public function newsletteraddAction()
	{
		if ($this->getRequest()->isPost()) {

			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_StringToLower());

			$validatorEmail = new Zend_Validate_EmailAddress();

			$email = $filter->filter($this->getRequest()->getPost('nltr_email'));
			$date = new Zend_Date();
			$dateins = $date->toString('YYYY-MM-dd HH:mm:ss');
			$code = md5($dateins.'_'.$email);

			if ($validatorEmail->isValid($email)) {
				$myNltr = new UserNewsletter();
				$isExist = $myNltr->fetchRow("EMAIL = '".$email."'");
				if(!$isExist) {
					$data = array(
						'EMAIL' => $email,
						'CODE' => $code,
						'DATEINS' => $dateins
					);
					$myNltr->insert($data);
					$this->view->messageSuccess =   "Vous �tes maintenant membre de notre <b>Newsletter</b>";//"Pour effacer : <a href='/user/newsletter/nltr_quit/$code'>$code</a>";
				} else {
					$this->view->messageError =  "L'email existe d�j�";
				}
			} else {
				$this->view->messageError =  "V�rifier votre email";
			}
		}
		$this->_forward('ajaxmessage','ajax');
	}
	public function newsletterAction()
	{
		if ($this->getRequest()->getParam('nltr_quit')) {
			//filtres pour changer les chaines
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			$code = $filter->filter($this->getRequest()->getParam('nltr_quit'));

			$myNltr = new UserNewsletter();
			$isExist = $myNltr->fetchRow("CODE = '".$code."'");

			if ($isExist) {
				$myNltr->delete("CODE = '".$code."'");
			}
			$this->view->nltrMessageError = "Vous avez �t� d�sinscrit";
		}
		$this->_forward('index','index');
	}

	public function deconnexionAction()
	{
		$auth = Zend_Auth::getInstance();
		$auth->setStorage($this->getSessionStorage())->clearIdentity();

		$this->view->user = null;
		$this->resetSession();

		$this->_redirect('/connectez-vous.html');
	}

	public function ajaxdeconnexionAction()
	{
		$auth = Zend_Auth::getInstance();
		$auth->setStorage($this->getSessionStorage())->clearIdentity();
		$this->view->user = null;
		$this->resetSession();

		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
	}

	private function passgen() {
		$chaine ="mnoTUzS5678kVvwxy9WXYZRNCDEFrslq41GtuaHIJKpOPQA23LcdefghiBMbj0";
		srand((double)microtime()*1000000);
		for($i=0; $i<8; $i++){
			@$pass .= $chaine[rand()%strlen($chaine)];
		}
		return $pass;
	}


	public function passwordforgetAction() {
        try {
		    $this->view->title = 'Mot de passe oubli� ?';
		    $linksMenu[0]['NAVURL'] = '/connectez-vous.html';
		    $linksMenu[0]['NAVNOM'] = 'Identifiez-vous !';
		    $this->view->linksMenu = $linksMenu;
		    $this->view->showSlide = 1;

		    $filter = new Zend_Filter();
		    $filter	->addFilter(new Zend_Filter_StripTags())
		    ->addFilter(new Zend_Filter_StringTrim());

		    $validatorEmail = new Zend_Validate_EmailAddress();

		    if ($this->getRequest()->isPost()) {
			    $email = $filter->filter($this->getRequest()->getPost('emailpassword'));
			    if ($validatorEmail->isValid($email)) {
				    $user = new User();
				    $isExist = $user->fetchRow("EMAIL = '".$email."'");

				    if ($isExist) {

					    $newMDP = $this->passgen();
					    $mail = new Zend_Mail();

					    $mail->setBodyHtml("Cher(�re) ".$isExist['NOM']." ".$isExist['PRENOM'].",<br><br>
					    Nous avons bien re�u votre message nous demandant de vous aider � retrouver vos identifiants. <br>
					    Vous trouverez ci-dessous votre nouveau mot de passe. <br>
					    Si celui ci ne vous convient pas, vous pouvez le modifier � tout moment.<br><br>
					    Votre pseudo : ".$isExist['LOGIN']."<br>
					    Votre mot de passe : ".$newMDP."<br><br>
					    <a href='".$this->baseUrl_SiteCommerceUrl."/mon-compte.html'>Vous pouvez vous connecter ici</a><br><br>
					    ".$this->siteName);

					    $mail->setFrom($this->serviceClient_Mail, $this->siteName);
					    $mail->addTo($isExist['EMAIL'], $isExist['NOM'].' '.$isExist['PRENOM']);
					    $mail->setSubject($this->siteName.', votre mot de passe');
					    $mail->send();

					    $data = array('MDP' => md5($newMDP));
					    $user->update($data, 'ID = '.$isExist['ID']);

					    $this->view->messageSuccessPass = "Nous venons de vous envoyer par email votre nouveau mot de passe.";
				    } else {
				     $this->view->messageErrorPass = "V�rifier votre email";
				    }

			    } else {
				    $this->view->messageErrorPass = "V�rifier votre email";
			    }
		    }
		} catch (Zend_Exception $e) { $this->log($e->getMessage(), 'err'); }
		$this->render('connexion');
	}
	public function connexionAction() {
		$this->view->title = 'Identifiez-vous !';
		$linksMenu[0]['NAVURL'] = '/connectez-vous.html';
		$linksMenu[0]['NAVNOM'] = 'Identifiez-vous !';
		$this->view->linksMenu = $linksMenu;
		$this->view->showSlide = 1;

		if ($this->getRequest()->isPost()) {
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(4));

			$login = $filter->filter($this->getRequest()->getPost('connexion_login'));
			$mdp = $filter->filter($this->getRequest()->getPost('connexion_mdp'));

			$user = new User();


			if ($validator->isValid($login) && $validator->isValid($mdp)) {
				$messageSuccess = $this->connectMe($login, $mdp);
				if ($messageSuccess == "SUCCESS") {

					$this->retrievecommandbyuser();

					$currentAncre = $this->getRequest()->getPost('current_con_ancre');
					if (isset($currentAncre) && !empty($currentAncre)) {
						if ($currentAncre == "commandes") {
							$this->_redirect('/mon-compte.html#commandes');
						} else if ($currentAncre == "selection") {
							$this->_redirect('/mon-compte.html#selection');
						}
					} else {
						$userNamespace = $this->getSession();
						$myCaddyTemp = $userNamespace->myObjectCaddy;
						if (isset($myCaddyTemp->items) && !empty($myCaddyTemp->items)) {
							$this->_redirect('/mon-panier.html');
						} else {
							$this->_redirect('/');
						}
					}

				} else {
					$this->view->messageErrorConnect =  $messageSuccess;
					$this->view->user = null;

					$currentAncre = $this->getRequest()->getPost('current_con_ancre');
					if (isset($currentAncre) && !empty($currentAncre)) {
						$this->view->current_con_ancre = $currentAncre;
					}
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageErrorConnect =  $this->getErrorValidator($errorCode);
				}
			}
		}
	}

	public function ajaxrefreshcaddytypeAction() {
		if ($this->isConnected()) {
			$user = $this->getStorageUser();
			if ($user['iscaddytype'] == 'Y') { $this->view->messageSuccess = 'SUCCESS';
			} else { $this->view->messageSuccess = 'ERROR'; }
		}
		$this->_forward('ajaxvalue','ajax');
	}

	public function ajaxrefreshcaddysizeAction() {
		$userNamespace = $this->getSession();
		$result = 'Aucun produit';
		if (isset($userNamespace->myObjectCaddy) && !empty($userNamespace->myObjectCaddy)) {
			$myCaddy = $userNamespace->myObjectCaddy;
			$size = $myCaddy->getTotalSize();
			if ($size > 1) {
				$result = $size.' PRODUITS';
			} else if ($size == 1) {
				$result = $size.' PRODUIT';
			}
		}
		$this->view->messageSuccess = $result;
		$this->_forward('ajaxvalue','ajax');
	}

	public function ajaxconnexionAction() {
		if ($this->getRequest()->isPost()) {
			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(4));

			$login = $filter->filter($this->getRequest()->getPost('connexionleft_login'));
			$mdp = $filter->filter($this->getRequest()->getPost('connexionleft_mdp'));

			if ($validator->isValid($login) && $validator->isValid($mdp)) {
				$messageSuccess = $this->connectMe($login, $mdp);
				if ($messageSuccess == "SUCCESS") {

					$this->retrievecommandbyuser();

					$auth = Zend_Auth::getInstance();
					$auth->setStorage($this->getSessionStorage());
					$storage = $auth->getStorage()->read();
				} else {
					$this->view->messageError = $messageSuccess;
				}
			} else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageError =  $this->getErrorValidator($errorCode);
				}
			}
		}
		$this->_forward('ajaxaccount','ajax');
	}

	public function moncompteAction() {
		$this->view->title = 'Mon Compte';
		if ($this->isConnected()) {

			$linksMenu[0]['NAVURL'] = '/mon-compte.html';
			$linksMenu[0]['NAVNOM'] = 'Mon compte';
			$this->view->linksMenu = $linksMenu;

			$user = $this->getStorageUser();

			$command = new Command();
			$this->view->myCommands = $command->findCommandsByUser($user['id']);
			$this->view->myDevis = $command->findDevisByUser($user['id']);
			$this->view->caddyType = $this->getCaddyTypeByUserConnected();
            
            $carteFidelite = new CarteFidelite();
			$this->view->carteFidelite = $carteFidelite->getInfosByUser($user['id']);
            
			$this->view->listfidelitegift = $carteFidelite->getAnnoncesByShow(1);
            
            
			$this->view->populateFormEdit = $user;

		}  else { $this->_redirect('/connectez-vous.html'); }
	}

	public function enregistrementAction() {
		$isAdd = false;

		$this->view->title = 'Cr�ation de votre compte';
		$linksMenu[0]['NAVURL'] = '/user/enregistrement';
		$linksMenu[0]['NAVNOM'] = ' Identifiez-vous !';
		$this->view->linksMenu = $linksMenu;

		$this->view->showSlide = 2;

		if ($this->getRequest()->isPost()) {

			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());
			$filter2 = new Zend_Filter();
			$filter2->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_Digits());

			$filterMaj = new Zend_Filter();
			$filterMaj->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_StringToUpper());

			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(4));

			$validatorTel = new Zend_Validate();
			$validatorTel -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(10));

			$validator2 = new Zend_Validate();
			$validator2 -> addValidator(new Zend_Validate_NotEmpty());

			$validatorEmail = new Zend_Validate_EmailAddress();

			$adduser_login = $filter->filter($this->getRequest()->getPost('adduser_login'));
			$adduser_mdp = $filter->filter($this->getRequest()->getPost('adduser_mdp'));
			$adduser_mdp2 = $filter->filter($this->getRequest()->getPost('adduser_mdp2'));

			$adduser_civility = $filter->filter($this->getRequest()->getPost('adduser_civility'));
            $adduser_nom = $filterMaj->filter($this->getRequest()->getPost('adduser_nom'));
			$adduser_prenom = $filter->filter($this->getRequest()->getPost('adduser_prenom'));
            
			$adduser_fct = $filter->filter($this->getRequest()->getPost('adduser_fct'));
			$adduser_tel = $filter2->filter($this->getRequest()->getPost('adduser_tel'));
			$adduser_fax = $filter2->filter($this->getRequest()->getPost('adduser_fax'));
			$adduser_email = $adduser_login;// $filter->filter($this->getRequest()->getPost('adduser_email'));


			$adduser_adresse = $filter->filter($this->getRequest()->getPost('adduser_adresse'));
			$adduser_cp = $filter->filter($this->getRequest()->getPost('adduser_cp'));
			$adduser_ville = $filter->filter($this->getRequest()->getPost('adduser_ville'));
			$adduser_pays = $filter->filter($this->getRequest()->getPost('adduser_pays'));
			$adduser_departement = $filter->filter($this->getRequest()->getPost('adduser_departement'));
			$adduser_region = $filter->filter($this->getRequest()->getPost('adduser_region'));
			$adduser_adressecomplete = $filter->filter($this->getRequest()->getPost('adduser_adressecomplete'));

			$adresse_type = $this->getRequest()->getPost('address_type');
			if ($adresse_type == 'new') {
				$adduser_adresse = $filter->filter($this->getRequest()->getPost('adduser_adresse'));
				$adduser_cp = $filter->filter($this->getRequest()->getPost('adduser_cp'));
				$adduser_ville = $filter->filter($this->getRequest()->getPost('adduser_ville'));
				$adduser_pays = $filter->filter($this->getRequest()->getPost('adduser_pays'));
				$adduser_departement = $filter->filter($this->getRequest()->getPost('adduser_departement'));
				$adduser_region = $filter->filter($this->getRequest()->getPost('adduser_region'));
				$adduser_adressecomplete = $filter->filter($this->getRequest()->getPost('adduser_adressecomplete'));
			} else {
				$adduser_adresse = $filter->filter($this->getRequest()->getPost('adduser_adresse_old'));
				$adduser_cp = $filter->filter($this->getRequest()->getPost('adduser_cp_old'));
				$adduser_ville = $filter->filter($this->getRequest()->getPost('adduser_ville_old'));
				$adduser_pays = $filter->filter($this->getRequest()->getPost('adduser_pays_old'));
				$adduser_departement = '';
				$adduser_region = '';
				$adduser_adressecomplete = $filter->filter($this->getRequest()->getPost('adduser_adresse_old'));
			}

			$adduser_raisonsocial = $filterMaj->filter($this->getRequest()->getPost('adduser_raisonsocial'));
			$adduser_siret = $filterMaj->filter($this->getRequest()->getPost('adduser_siret'));
			$adduser_numidfisc = $filterMaj->filter($this->getRequest()->getPost('adduser_numidfisc'));
			$adduser_codeape = $filterMaj->filter($this->getRequest()->getPost('adduser_codeape'));
			$adduser_sectactivite = $filterMaj->filter($this->getRequest()->getPost('adduser_sectactivite'));

			$adduser_comm = $filter->filter($this->getRequest()->getPost('adduser_comm'));

			$adduser_newsletter = $filter->filter($this->getRequest()->getPost('adduser_newsletter'));

			$typeUser = $filter->filter($this->getRequest()->getPost('adduser_typeuser'));

			$date = new Zend_Date();
			$dateinsc = $date->toString('YYYY-MM-dd HH:mm:ss');

			$data = array(
                                  'LOGIN' => $adduser_login, 
                                  'MDP' => md5($adduser_mdp), 
                                  'ROLE' => 0, 
                                  'NOM' => $adduser_nom, 
                                  'PRENOM' => $adduser_prenom,
                                  'CIVILITE' => $adduser_civility, 
                                  'FONCTION' => $adduser_fct, 
                                  'RAISONSOCIAL' => $adduser_raisonsocial, 
                                  'ADRESSE' => $adduser_adresse, 
                                  'CP' => $adduser_cp, 
                                  'VILLE' => $adduser_ville, 
                                  'DEPARTEMENT' => $adduser_departement, 
                                  'REGION' => $adduser_region, 
								  'ADRESSECOMPLETE' => $adduser_adressecomplete,
                                  'PAYS' => $adduser_pays, 
                                  'EMAIL' => $adduser_email, 
                                  'TEL' => $adduser_tel, 
                                  'FAX' => $adduser_fax, 
                                  'SIRET' => $adduser_siret, 
								  'NUMIDFISC' => $adduser_numidfisc,
                                  'CODEAPE' => $adduser_codeape, 
                                  'SECTACTIVITE' => $adduser_sectactivite, 
                                  'COMMENTAIRE' => $adduser_comm,  
                                  'TYPE' => $typeUser, 
                                  'DATEINSC' => $dateinsc);

			$isTypeOk = false;
			if ($validator2->isValid($typeUser)) {
				$isTypeOk = true;
			}

			$errorType = 0;
			if ($validator->isValid($adduser_mdp) && $validator->isValid($adduser_mdp2) &&
			$validator2->isValid($adduser_civility) &&
			$validator2->isValid($adduser_nom) && $validator2->isValid($adduser_adresse) &&
			$validator2->isValid($adduser_prenom) && $validator2->isValid($adduser_ville) &&
			$validator2->isValid($adduser_pays) &&
			$validatorEmail->isValid($adduser_login) && $validator2->isValid($adduser_cp)
			) {
				if ($isTypeOk) {
					if ($typeUser == "Professionnel") {
						if ($validator2->isValid($adduser_raisonsocial) &&
						$validator2->isValid($adduser_siret) &&
						$validator2->isValid($adduser_numidfisc) &&
						$validator2->isValid($adduser_codeape)) {

						} else {
							$errorType = 3;
							foreach ($validator2->getErrors() as $errorCode) {
								$this->view->messageErrorAddUser =  $this->getErrorValidator($errorCode);
							}
						}
					}
				} else {
					$errorType = 2;
					$this->view->messageErrorAddUser =  "Vous devez choisir entre Particulier et Professionnel. ";
				}
			} else {
				$errorType = 1;
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageErrorAddUser =  $this->getErrorValidator($errorCode);
				}
				foreach ($validator2->getErrors() as $errorCode) {
					$this->view->messageErrorAddUser =  $this->getErrorValidator($errorCode);
				}
				foreach ($validatorEmail->getErrors() as $errorCode) {
					$this->view->messageErrorAddUser =  $this->getErrorValidator($errorCode);
				}
			}


			if ($errorType == 0) {
				if ($validatorTel->isValid($adduser_tel)) {
					if ($adduser_mdp2 == $adduser_mdp) {

						try {
							$user = new User();

							$isExistLogin = $user->fetchRow("LOGIN = '".$adduser_login."'");

							if (!$isExistLogin) {

								$isExistEmail = $user->fetchRow("EMAIL = '".$adduser_email."'");
								if (!$isExistEmail) {
									$isAdd = $user->insert($data);
									$this->log("Nouveau client : ".$adduser_email,'info');
									if ($adduser_newsletter) {
										$user_newsletter = new UserNewsletter();
										$code = md5($dateinsc.'_'.$adduser_email);
											
										$isExistNL = $user_newsletter->fetchRow("EMAIL = '".$adduser_email."'");

										if(!$isExistNL) {
											$dataNL = array(
						 	 					'EMAIL' => $adduser_email,
						 	 					'DATEINS' => $dateinsc,
						 	 					'CODE' => $code
											);
											$user_newsletter->insert($dataNL);
										}
									}
									$messageSuccess = $this->connectMe($adduser_login, $adduser_mdp);
									if ($messageSuccess != "SUCCESS") {
										$this->view->messageErrorAddUser = $messageSuccess;
									}

								} else {
									$this->view->messageErrorAddUser =  "L'email est d�j� utilis�.";
								}
							} else {
								$this->view->messageErrorAddUser =  "L'identifiant existe d�j�";
							}
						} catch (Zend_Exception $e) {
							$this->log($e->getMessage(),'err');
							$data['newsletter'] = $adduser_newsletter;
							$this->view->populateFormAdd = $data;
							$this->view->messageErrorAddUser =  "Une erreur est survenue, v�rifier vos informations.";
							$this->render('connexion');
						}
					} else {
						$this->view->messageErrorAddUser =  "V�rifier votre mot de passe";
					}
				} else {
					$this->view->messageErrorAddUser =  "V�rifier votre num�ro de t�l�phone";
				}
			}

			$data['newsletter'] = $adduser_newsletter;
			$this->view->populateFormAdd = $data;

		}
		if ($isAdd) {
			$currentAncre = $this->getRequest()->getPost('current_save_ancre');
			if (isset($currentAncre) && !empty($currentAncre)) {
				if ($currentAncre == "commandes") {
					$this->_redirect('/mon-compte.html#commandes');
				} else if ($currentAncre == "selection") {
					$this->_redirect('/mon-compte.html#selection');
				}
			} else {
				$userNamespace = $this->getSession();
				$myCaddyTemp = $userNamespace->myObjectCaddy;
				if (isset($myCaddyTemp->items) && !empty($myCaddyTemp->items)) {
					$this->_redirect('/mon-panier.html');
				} else {
					$this->_redirect('/');
				}
			}
		} else {
			$currentAncre = $this->getRequest()->getPost('current_save_ancre');
			if (isset($currentAncre) && !empty($currentAncre)) {
				$this->view->current_save_ancre = $currentAncre;
			}
			$this->render('connexion');
		}
	}

	public function actualiserAction() {

		$linksMenu[0]['NAVURL'] = '/mon-compte.html';
		$linksMenu[0]['NAVNOM'] = 'Mon compte';
		$this->view->linksMenu = $linksMenu;
		if ($this->getRequest()->isPost()) {

			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());
			$filter2 = new Zend_Filter();
			$filter2->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_Digits());

			$filterMaj = new Zend_Filter();
			$filterMaj->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim())
			->addFilter(new Zend_Filter_StringToUpper());


			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(4));

			$validatorTel = new Zend_Validate();
			$validatorTel -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(10));

			$validator2 = new Zend_Validate();
			$validator2 -> addValidator(new Zend_Validate_NotEmpty());


			$validatorEmail = new Zend_Validate_EmailAddress();

			$edituser_civility = $filter->filter($this->getRequest()->getPost('edituser_civility'));
			$edituser_nom = $filterMaj->filter($this->getRequest()->getPost('edituser_nom'));
			$edituser_prenom = $filter->filter($this->getRequest()->getPost('edituser_prenom'));
			$edituser_fct = $filter->filter($this->getRequest()->getPost('edituser_fct'));
			$edituser_tel = $filter2->filter($this->getRequest()->getPost('edituser_tel'));
			$edituser_fax = $filter2->filter($this->getRequest()->getPost('edituser_fax'));
			$edituser_email = $filter->filter($this->getRequest()->getPost('edituser_email'));

			$adresse_type = $this->getRequest()->getPost('address_type');
			if ($adresse_type == 'new') {
				$edituser_adresse = $filter->filter($this->getRequest()->getPost('edituser_adresse'));
				$edituser_cp = $filter->filter($this->getRequest()->getPost('edituser_cp'));
				$edituser_ville = $filter->filter($this->getRequest()->getPost('edituser_ville'));
				$edituser_pays = $filter->filter($this->getRequest()->getPost('edituser_pays'));
				$edituser_departement = $filter->filter($this->getRequest()->getPost('edituser_departement'));
				$edituser_region = $filter->filter($this->getRequest()->getPost('edituser_region'));
				$edituser_adressecomplete = $filter->filter($this->getRequest()->getPost('edituser_adressecomplete'));
			} else {
				$edituser_adresse = $filter->filter($this->getRequest()->getPost('edituser_adresse_old'));
				$edituser_cp = $filter->filter($this->getRequest()->getPost('edituser_cp_old'));
				$edituser_ville = $filter->filter($this->getRequest()->getPost('edituser_ville_old'));
				$edituser_pays = $filter->filter($this->getRequest()->getPost('edituser_pays_old'));
				$edituser_departement = '';
				$edituser_region = '';
				$edituser_adressecomplete = $filter->filter($this->getRequest()->getPost('edituser_adresse_old'));
			}

			$edituser_raisonsocial = $filterMaj->filter($this->getRequest()->getPost('edituser_raisonsocial'));
			$edituser_siret = $filterMaj->filter($this->getRequest()->getPost('edituser_siret'));
			$edituser_numidfisc = $filterMaj->filter($this->getRequest()->getPost('edituser_numidfisc'));
			$edituser_codeape = $filterMaj->filter($this->getRequest()->getPost('edituser_codeape'));
			$edituser_sectactivite = $filterMaj->filter($this->getRequest()->getPost('edituser_sectactivite'));

			$edituser_comm = $filter->filter($this->getRequest()->getPost('edituser_comm'));
			//$edituser_modepaiement = $filter->filter($this->getRequest()->getPost('edituser_modepaiement'));

			$typeUser = $filter->filter($this->getRequest()->getPost('edituser_typeuser'));


			$isTypeOk = false;
			if ($validator2->isValid($typeUser)) {
				$isTypeOk = true;
			}

			$errorType = 0;
			if ($validator2->isValid($edituser_civility) &&
			$validator2->isValid($edituser_nom) && $validator2->isValid($edituser_adresse) &&
			$validator2->isValid($edituser_prenom) && $validator2->isValid($edituser_ville) &&
			$validator2->isValid($edituser_pays) &&
			$validatorEmail->isValid($edituser_email)  && $validator2->isValid($edituser_cp)
			) {
				if ($isTypeOk) {
					if ($typeUser == "Professionnel") {
						if ($validator2->isValid($edituser_raisonsocial) &&
						$validator2->isValid($edituser_siret) &&
						$validator2->isValid($edituser_numidfisc) &&
						$validator2->isValid($edituser_codeape)) {

						} else {
							$errorType = 3;
							foreach ($validator2->getErrors() as $errorCode) {
								$this->view->messageErrorEditUser =  $this->getErrorValidator($errorCode);
							}
						}
					}
				} else {
					$errorType = 2;
					$this->view->messageErrorEditUser =  "Vous devez choisir entre Particulier et Professionnel. ";
				}
			} else {
				$errorType = 1;
					
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageErrorEditUser =  $this->getErrorValidator($errorCode);
				}
				foreach ($validator2->getErrors() as $errorCode) {
					$this->view->messageErrorEditUser =  $this->getErrorValidator($errorCode);
				}
				foreach ($validatorEmail->getErrors() as $errorCode) {
					$this->view->messageErrorEditUser =  $this->getErrorValidator($errorCode);
				}
			}


			if ($errorType == 0) {
				if ($typeUser == "Particulier") {
					//$edituser_modepaiement = 1;
					$edituser_raisonsocial = "";
				}

				if ($validatorTel->isValid($edituser_tel)) {

					try {
						$user = new User();
						$auth = Zend_Auth::getInstance();
						$auth->setStorage($this->getSessionStorage());
						$storage = $auth->getStorage()->read();
						$isExistEmail = $user->fetchRow("EMAIL = '".$edituser_email."' AND ID <> ".$storage['user']['id']);
						/*
						 if($storage['user']['iscredit'] == 0 && ($edituser_modepaiement != 1 && $edituser_modepaiement != 2 && $edituser_modepaiement != 6) ) {
							$edituser_modepaiement = 1;
							}
							*/
						$data = array(
	                                  'ROLE' => 0, 
	                                  'NOM' => $edituser_nom, 
	                                  'PRENOM' => $edituser_prenom,
	                                  'CIVILITE' => $edituser_civility, 
	                                  'FONCTION' => $edituser_fct, 
	                                  'RAISONSOCIAL' => $edituser_raisonsocial, 
	                                  'ADRESSE' => $edituser_adresse, 
	                                  'CP' => $edituser_cp, 
	                                  'VILLE' => $edituser_ville, 
	                                  'PAYS' => $edituser_pays, 
	                                  'DEPARTEMENT' => $edituser_departement, 
	                                  'REGION' => $edituser_region, 
	                                  'ADRESSECOMPLETE' => $edituser_adressecomplete, 
	                                  'EMAIL' => $edituser_email, 
	                                  'TEL' => $edituser_tel, 
	                                  'FAX' => $edituser_fax, 
	                                  'SIRET' => $edituser_siret, 
									  'NUMIDFISC' => $edituser_numidfisc,
	                                  'CODEAPE' => $edituser_codeape, 
	                                  'SECTACTIVITE' => $edituser_sectactivite, 
	                                  'COMMENTAIRE' => $edituser_comm,  
	                                  'TYPE' => $typeUser);

						if (!$isExistEmail) {

							$isEdit = $user->update($data, 'ID = '.$storage['user']['id']);

							$myUser = $user->fetchRow("ID = ".$storage['user']['id']);

							$userAuth = $this->computUserInfo($myUser);

							$storage = $auth->getStorage();
							$storage->write(array( 'user' => $userAuth));

							$this->view->user = $userAuth;

							$this->view->messageSuccessEditUser =  "Vos informations ont �t� modifi�es.";
						} else {
							$this->view->messageErrorEditUser =  "L'email est d�j� utilis�";
						}
					} catch (Zend_Exception $e) {
						$this->view->messageErrorEditUser =  "Une erreur est survenue, v�rifier vos informations";
						$this->_forward('moncompte');
					}
				} else {
					$this->view->messageErrorEditUser =  "V�rifier votre num�ro de t�l�phone";
				}
			}
		}
		$this->_forward('moncompte');
	}

	public function modifierAction() {

		$linksMenu[0]['NAVURL'] = '/mon-compte.html';
		$linksMenu[0]['NAVNOM'] = 'Mon compte';
		$this->view->linksMenu = $linksMenu;
		if ($this->getRequest()->isPost()) {

			$filter = new Zend_Filter();
			$filter	->addFilter(new Zend_Filter_StripTags())
			->addFilter(new Zend_Filter_StringTrim());

			$validator = new Zend_Validate();
			$validator -> addValidator(new Zend_Validate_NotEmpty())
			-> addValidator(new Zend_Validate_StringLength(4));

			$validatorEmail = new Zend_Validate_EmailAddress();

			$edituser_login = $filter->filter($this->getRequest()->getPost('edituser_login'));
			$edituser_mdp = $filter->filter($this->getRequest()->getPost('edituser_mdp'));
			$edituser_mdp2 = $filter->filter($this->getRequest()->getPost('edituser_mdp2'));

			$data = array(
                   'LOGIN' => $edituser_login, 
                   'MDP' => md5($edituser_mdp));

			if (
			$validator->isValid($edituser_login) &&
			$validator->isValid($edituser_mdp) &&
			$validator->isValid($edituser_mdp2) &&
			$validatorEmail->isValid($edituser_login)
			) {
				if ($edituser_mdp2 == $edituser_mdp) {

					try {
						$user = new User();
							
						$auth = Zend_Auth::getInstance();
						$auth->setStorage($this->getSessionStorage());
						$storage = $auth->getStorage()->read();
							
						$isExistLogin = $user->fetchRow("LOGIN = '".$edituser_login."' AND ID <> ".$storage['user']['id']);

						if (!$isExistLogin) {
							$isEdit = $user->update($data,'ID = '.$storage['user']['id']);

							$messageResult = $this->connectMe($edituser_login,$edituser_mdp);

							if ($messageResult == "SUCCESS") {
								$auth = Zend_Auth::getInstance();
								$auth->setStorage($this->getSessionStorage());
								$storage = $auth->getStorage()->read();

								if ($auth->hasIdentity() && isset($storage['user'])) {
									$this->view->user = $storage['user'];
								}
							}
							$this->view->messageSuccessEditUser =  "Vos identifiants ont �t� modifi�s.";

						} else {
							$this->view->messageErrorEditUser =  "L'identifiant existe d�j�";
						}
					} catch (Zend_Exception $e) {
						$this->view->messageErrorEditUser =  "Une erreur est survenue, v�rifier vos informations.";
						$this->_forward('moncompte');
					}
				} else {
					$this->view->messageErrorEditUser =  "V�rifier votre mot de passe";
				}
			}  else {
				foreach ($validator->getErrors() as $errorCode) {
					$this->view->messageErrorEditUser =  $this->getErrorValidator($errorCode);
				}
				foreach ($validatorEmail->getErrors() as $errorCode) {
					$this->view->messageErrorEditUser =  $this->getErrorValidator($errorCode);
				}
			}

			$this->_forward('moncompte');

		}
	}



	public function retrievecommandbyrefAction() {
		$result = "ERROR";
		if ($this->getRequest()->isPost()) {
			try {
				$params = $this->getRequest()->getPost();
				$refCommand = $params["ref"];
				$auth = Zend_Auth::getInstance();
				$auth->setStorage($this->getSessionStorage());
				$storage = $auth->getStorage()->read();

				if ($auth->hasIdentity() && isset($storage['user']) &&
				isset($refCommand) && !empty($refCommand)) {

					$myCaddy = new Caddy();

					$command = new Command();
					$resultCommand = $command->findCommandCaddyRetrieve($storage['user']['id'],$refCommand );

					foreach ($resultCommand AS $row) {
						$item = new Item();

						$item->idChild = $row['CHILDID'];
						$item->qteChild = $row['CHILDQUANTITY'];
						$item->idProduit = $row['PRODUCTID'];
						$item->nom = $row['PRODUCTNOM'];
						$item->descshort = $row['DESCSHORT'];
						$item->navnom = $this->verifyNavigationString($row['PRODUCTNAVNOM'],$row['PRODUCTNOM'], '');
						$item->url = $row['URL'];
						$item->designation = $row['DESIGNATION'];
						$item->isAccessoire = 'N';
						$item->stock = $row['STOCK'];
						$item->selectedOption = $row['SELECTEDOPTION'];

						array_push($myCaddy->items, $item);
					}

					$userNamespace = $this->getSession();
					$userNamespace->myObjectCaddy = $myCaddy;
					$result = "SUCCESS";
				}
			} catch (Zend_Exception $e) {
				$this->log("Error retrievecommandbyref : ".$e->getMessage(),'err');
			}
		}
		$this->view->messageSuccess = $result;
		$this->_forward('ajaxvalue', 'ajax');
	}

	private function retrievecommandbyuser() {
		try {
			$auth = Zend_Auth::getInstance();
			$auth->setStorage($this->getSessionStorage());
			$storage = $auth->getStorage()->read();

			if ($auth->hasIdentity() && isset($storage['user'])) {
				$userNamespace = $this->getSession();
				if (isset($userNamespace->myObjectCaddy)) {
					$caddyTemp = $userNamespace->myObjectCaddy;
					if (!empty($caddyTemp->items)) { return false; }
				}
					
				$myCaddy = new Caddy();
				$myCaddy->getCaddyTemp($storage['user']['id']);
				$userNamespace->myObjectCaddy = $myCaddy;
			}
		} catch (Zend_Exception $e) {
			$this->log("Error retrievecommandbyuser : ".$e->getMessage(),'err');
		}
		return false;
	}


	public function ajaxdeletedevisAction() {
		$this->view->messageSuccess = "";
		$this->view->messageError = "";
		if ($this->isConnected()) {
			$user = $this->getStorageUser();
			$command = new Command();
			if($this->_request->getParam('id')) {
				$id = (int)$this->_request->getParam('id');
				if ($id > 0) {
					try {
						$result = $command->deleteDevisByUser($user['id'], $id);

						if ($result == 'OK') {
							$this->view->messageSuccess = "Le devis a �t� supprim�";
							$this->log("Le devis a �t� supprim�",'info');
						} else if ($result == 'USER') {
							$this->view->messageError = "Le devis n'a pas �t� supprim�, vous n'avez pas les droits.";
							$this->log("Le devis n'a pas �t� supprim�, vous n'avez pas les droits",'warn');
						} else {
							$this->view->messageError = "Le devis n'a pas �t� supprim�, vous n'avez pas les droits.";
							$this->log("Le devis n'a pas �t� supprim�, vous n'avez pas les droits",'err');
						}
					} catch (Zend_Exception $e) {
						$this->log($e->getMessage(),'err');
						$this->view->messageError = $e->getMessage();
					}
				}
			}
			$this->view->myDevis = $command->findDevisByUser($user['id']);
		}

		$layout = Zend_Layout::getMvcInstance();
		$layout->disableLayout();
		$this->render('ajaxlistdevis');
	}


	private function getCaddyTypeByUserConnected() {
		$caddyType = array();
		try {
			if ($this->isConnected()) {
				$user = $this->getStorageUser();
				if ($user['iscaddytype'] == 'Y') {
					$userNamespace = $this->getSession();
					if (!isset($userNamespace->myObjectCaddy)) { $userNamespace->myObjectCaddy = new Caddy(); }
					$caddy = $userNamespace->myObjectCaddy;
					$userCaddyType = new UserCaddyType();
					$caddyType = $userCaddyType->computeFrontCaddyTypeByUser($user, $caddy, true);
				}
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
		}
		return $caddyType;
	}

	public function sendmailtoconseillerAction() {
		try {
			$botDetector = new BotDetector();
			$isBot = $botDetector->isBot(getenv("HTTP_USER_AGENT"));
			if ($isBot != 'ERROR') {
				$this->_redirect($this->baseUrl_SiteCommerceUrl);
			}
				
			$linksMenu[0]['NAVURL'] = '/contacter-un-conseiller.html';
			$linksMenu[0]['NAVNOM'] = "Demande d'informations";
			$this->view->linksMenu = $linksMenu;

			if ($this->isConnected()) { $this->view->isConnected = true;
			} else { $this->view->isConnected = false; }

			if ($this->getRequest()->isPost()) {

				$filter = new Zend_Filter();
				$filter	->addFilter(new Zend_Filter_StripTags())
				->addFilter(new Zend_Filter_StringTrim());

				$validatorMessage = new Zend_Validate();
				$validatorMessage -> addValidator(new Zend_Validate_NotEmpty())
				-> addValidator(new Zend_Validate_StringLength(4));

				$validatorTel = new Zend_Validate();
				$validatorTel -> addValidator(new Zend_Validate_NotEmpty())
				-> addValidator(new Zend_Validate_StringLength(10));

				$validatorEmail = new Zend_Validate_EmailAddress();
					

				$params = $this->getRequest()->getPost();
				$message = $filter->filter($params['user_message']);
				$tel = "";
				$email = "";
				$messageNotConnected = "";
				$user = array();
				$fromEmail = $this->no_reply_Mail;
				$fromName = "Invit�";

				$isMailValid = false;

				if ($this->isConnected()) {
					$user = $this->getStorageUser();
					$fromEmail = $user['email'];
					$fromName = $user['prenom']." ".$user['prenom'];
					$tel = $user['tel'];
					$email = $user['email'];
					$isMailValid = true;
				} else {
					$messageNotConnected = 'Non connect�';
					$messageNotConnected .= '<br /><br />';
					$messageNotConnected .= 'IP : '.$_SERVER['REMOTE_ADDR'];
					$messageNotConnected .= '<br /><br />';

					$tel = $filter->filter($params['user_tel']);
					$email = $filter->filter($params['user_email']);
						
					if ($validatorTel->isValid($tel) || $validatorEmail->isValid($email)) {
						$isMailValid = true;
						if (!empty($email)) { $fromEmail = $email; $messageNotConnected .= 'Email : '.$email.'<br /><br />';}
						if (!empty($tel)) { $messageNotConnected .= 'T�l�phone : '.$tel.'<br /><br />'; }
					} else {
						$this->view->messageErrorAskConseiller = "Vous devez nous communiquer votre <b>email</b> ou votre <b>t�l�phone</b> pour prendre contact avec vous.";
					}
				}
				if ($isMailValid) {
					if ($validatorMessage->isValid($message)) {
						$isSend = $this->sendMailToCommercial($message, $messageNotConnected, $user, $fromEmail, $fromName);
						if ($isSend) {
							$this->view->messageSuccessAskConseiller = "Votre demande d'informations a �t� envoy�, un conseiller vous contactera au plus vite.";
						} else {
							$this->view->messageErrorAskConseiller = "Votre demande d'informations n'a pas �t� envoy�, contactez nous au ".$this->tel_contact.".";
						}
					} else {
						$this->view->messageErrorAskConseiller = "Votre message doit contenir au moins 4 caract�res.";
					}
				}
					
				$this->view->messageMail = $email;
				$this->view->messageTel = $tel;
				$this->view->messageBody = $message;
			}
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
		}
	}

	private function sendMailToCommercial($message,$messageNotConnected, $user, $fromEmail, $fromName) {
		try {
			$view = new Zend_View();
			$view->addScriptPath('../application/modules/default/views/helpers/');
			$view->assign("message",$message);
			$view->assign("messageNotConnected",$messageNotConnected);
			$view->assign("user",$user);
				
			$body = $view->render("mail_user_to_commercial.phtml");
			$subject = "[INFORMATION] ".$fromName;
				
			$mail = new Zend_Mail();
			$mail->setBodyHtml($body);
			$mail->setFrom($fromEmail, $fromName);
			$mail->addTo($this->serviceClient_Mail);
			$mail->setSubject($subject);

			$mail->send();
			$this->log("L'email de demande d'informations a �t� envoy� par : ".$fromEmail.", ".$fromName,'info');
			return true;
		} catch (Zend_Exception $e) {
			$this->log($e->getMessage(),'err');
		}
		return false;
	}
}
?>modules/default/controllers/AuthController.php000060400000003735150710367660015703 0ustar00<?php

class AuthController  extends Modules_Default_Controllers_MainController
{
	public function init()
	{
		$this->view->baseUrl = $this->getBaseUrl();
		$this->checkMaintenance();
	}
	public function indexAction()
	{

	}
	public function logoutAction()
	{
		Zend_Auth::getInstance()->clearIdentity();
		$this->view->user = null;
		$this->_redirect('/');
	}
	public function loginAction()
	{

		$this->view->message = '';
		if ($this->_request->isPost()) {

			// collect the data from the user
			Zend_Loader::loadClass('Zend_Filter_StripTags');
			$f = new Zend_Filter_StripTags();
			$username = $f->filter($this->_request->getPost('username'));
			$password = $f->filter($this->_request->getPost('password'));

			if (empty($username) || empty($password)) {

				$this->view->message = 'Les champs sont obligatoire.';
					
			} else {

				// setup Zend_Auth adapter for a database table
				Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable');
				$dbAdapter = Zend_Registry::get('dbAdapter');

				$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter,
															'user',
															'LOGIN',
															'MDP',
															'MD5(?) AND ROLE = "0"'); 
					
				// Set the input credential values to authenticate against
				$authAdapter->setIdentity($username);
				$authAdapter->setCredential($password);

				// do the authentication
				$auth = Zend_Auth::getInstance();
				$result = $auth->authenticate($authAdapter);
				//$result = $authAdapter->authenticate();
					
				if ($result->isValid()) {

					// success: store database row to auth's storage
					// system. (Not the password though!) //array('IDUSER', 'LOGIN'));
					$data = $authAdapter->getResultRowObject(null, 'mdp');

					$auth->getStorage()->write($data);

					$this->log("Login : ".$username,'info');
					$this->_redirect('/backoffice/');
				} else {
					// failure: clear database row from session
					$this->view->message = 'Les identifiants sont incorrects.';
				}
			}
		}
		$this->render();
	}
}

?>modules/default/controllers/ContactController.php000060400000012352150710367660016370 0ustar00<?php

class ContactController  extends Modules_Default_Controllers_MainController
{

	public function init()
	{
		$this->view->baseUrl = $this->getBaseUrl();
	}

	public function indexAction()
	{
        $isAjaxResponse = false;
		if ($this->_request->isPost())
        {
	        $this->sendEmail();
            $isAjaxResponse = true;
        } else if (isset($_GET["required"]) || isset($_GET["type"]) || isset($_GET["value"])) {
	        $this->validateData();
            $isAjaxResponse = true;
        }

        if ($isAjaxResponse) {
		    $layout = Zend_Layout::getMvcInstance();
		    $layout->disableLayout();
		    $this->render('empty');
        }
	} 
    
    // Validates data and sending e-mail
    function sendEmail()
    {
        $filter = new Zend_Filter();
		$filter	->addFilter(new Zend_Filter_StripTags())
		->addFilter(new Zend_Filter_StringTrim());
        
		$validator = new Zend_Validate();
		$validator -> addValidator(new Zend_Validate_NotEmpty());

		$params = $this->_request->getPost();

	    $output = '';
	    $error = 0;
	    if(!$validator->isValid($params['name']))
	    {
		    $output .= '<p>Ins�rer votre nom</p>';
		    $error = 1;
	    }
        
        $validatorEmail = new Zend_Validate_EmailAddress();
        
	    if(!$validator->isValid($params['email']))
	    {
		    $output .= '<p>Ins�rer votre e-mail</p>';
		    $error = 1;
	    }
	    elseif(!$validatorEmail->isValid($params['email']))
	    {
		    $output .= '<p>Mauvais e-mail</p>';
		    $error = 1;
	    }
	
	    if(!$validator->isValid($params['message']))
	    {
		    $output .= '<p>Ins�rer votre message</p>';
		    $error = 1;
	    }
	    if($error)
	    {
		    echo '<blockquote class="error margin_1line margin_bottom_1line">'.utf8_encode($output).'</blockquote>';
	    }
	    else
	    {
			$this->trySendEmail($params, 0);
	    }
    }
	 function trySendEmail($params, $count) {
		 
		$to = $this->contact_Mail;
		$subject = "Message depuis la gallery";
		$mbody = "
		Emetteur:
		".$params['name']."
		".$params['email']."
		
		Message:
		".$params['message']."
		
		";
		try {  
			$mail = new Zend_Mail();
			$mail->setBodyHtml($mbody);
			$mail->setFrom(strip_tags($params['email']), $params['name']);
			$mail->addTo($to);
			$mail->setSubject($subject);
			$mail->send();

			echo '<blockquote class="success margin_1line margin_bottom_1line">'.utf8_encode('E-mail envoy�').'</blockquote>';
			   
		} catch (Zend_Exception $e) { 
			if ($count <= 3) {
				$count += 1; 
				$this->trySendEmail($params, $count);
			} else { 
				echo '<blockquote class="error margin_1line margin_bottom_1line">'.utf8_encode('Une erreur est survenue ... Veuillez r�essayer.').'</blockquote>';		
				$this->log($e->getMessage(),'err'); 
			}
		} 
	 }

    function validateData() {
	 
	    $required = $this->_request->getParam('required');
	    $type = $this->_request->getParam('type');
	    $value = $this->_request->getParam('value');

	    $this->validateRequired($required, $value, $type);

	    switch ($type) {
		    case 'number':
			    $this->validateNumber($value);
			    break;
		    case 'alphanum':
			    $this->validateAlphanum($value);
			    break;
		    case 'alpha':
			    $this->validateAlpha($value);
			    break;
		    case 'date':
			    $this->validateDate($value);
			    break;
		    case 'email':
			    $this->validateEmail($value);
			    break;
		    case 'url':
			    $this->validateUrl($value);
		    case 'all':
			    $this->validateAll($value);
			    break;
	    }
    }

    // The function to check if a field is required or not
    function validateRequired($required, $value, $type) {
	    if($required == "required") {

		    // Check if we got an empty value
		    if($value == "") {
			    echo "false";
			    exit();
		    }
	    } else {
		    if($value == "") {
			    echo "none";
			    exit();
		    }
	    }
    }

    // Validation of an Email Address
    function validateEmail($value) {
        $validatorEmail = new Zend_Validate_EmailAddress();        
	    if($validatorEmail->isValid($value)) {
		    echo "true";
	    } else {
		    echo "false";
	    }
    }

    // Validation of a date
    function validateDate($value) {
	    if(ereg("^(([1-9])|(0[1-9])|(1[0-2]))\/(([0-9])|([0-2][0-9])|(3[0-1]))\/(([0-9][0-9])|([1-2][0,9][0-9][0-9]))$", $value, $regs)) {
		    echo "true";
	    } else {
		    echo "false";
	    }
    }

    // Validation of an URL
    function validateUrl($value) {
	    if(ereg("^(http|https|ftp)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&amp;%\$#\=~])*[^\.\,\)\(\s]$", $value, $regs)) {
		    echo "true";
	    } else {
		    echo "false";
	    }
    }

    // Validation of characters
    function validateAlpha($value) {
	    if(ereg("^[a-zA-Z]+$", $value, $regs)) {
		    echo "true";
	    } else {
		    echo "false";
	    }
    }

    // Validation of characters and numbers
    function validateAlphanum($value) {
	    if(ereg("^[a-zA-Z0-9]+$", $value, $regs)) {
		    echo "true";
	    } else {
		    echo "false";
	    }
    }

    // Validation of numbers
    function validateNumber($value) {
	    if(ereg("^[0-9]+$", $value, $regs)) {
		    echo "true";
	    } else {
		    echo "false";
	    }
    }

    // Validation of numbers
    function validateAll($value) {
		    echo "true";
    }

}



?>config/settings.ini000060400000006542150710367660010370 0ustar00[prod]
site_vitrine = "http://www.karenpetit.net";
devisCommande_Mail = "contact@karenpetit.net";
no_reply_Mail = "contact@karenpetit.net";	
serviceClient_Mail = "contact@karenpetit.net";
contact_Mail = "contact@karenpetit.net";
newsletter_Mail = "contact@karenpetit.net";
reglement_Mail = "contact@karenpetit.net";
site_actualshort = "karenpetit.fr";
baseUrl_SiteCommerceUrl = "http://www.karenpetit.fr";
siteName  = "Karen Petit";
site_addresse = "";
site_addresse2 = "";
site_addresse3_title = "";
site_addresse3_address = "";
site_addresse3_cp = "";
mail_port = "465";
mail_auth = "login";
mail_username = "postmaster@karenpetit.fr";
mail_password = "V9k54s9CxR";
mail_smtp = "SSL0.OVH.NET";
session_variable  = "KARENPETIT_Default_Variables";
session_storage  = "KARENPETIT_Default_Session_Storage";
session_admin_variable  = "KARENPETIT_Admin_Variables";
session_admin_storage = "KARENPETIT_Admin_Session_Storage";	
tel_contact = "06 85 84 57 84";	
link_media_facebook = "https://www.facebook.com/karenpetitphotographe";	
link_media_viadeo = "https://secure.viadeo.com/fr/signin";	
link_media_twitter = "https://twitter.com/";	
link_media_google = "https://plus.google.com/";
link_media_flickr = "http://fr.pinterest.com/kapvisualaddict";
link_media_rss = "https://500px.com/karen77";
custom_text_1 = "KAREN PETIT";	
custom_text_2 = "PHOTOGRAPHE";	
custom_text_3 = "";	
custom_text_4 = "";	
custom_text_5 = "";
custom_link_1 = "http://www.jingoo.com/infos/acces.php/1287167";	
custom_link_2 = "https://www.instagram.com/karenpetitphotographe/";	
custom_link_3 = "";	
custom_link_4 = "";	
custom_link_5 = "";	
google_analytics = "UA-90423963-1";	
google_site_verification = "wp04DZmY5adLGY3w9n74Td0csxl2PynnKoe3kl63BJw";
FeatureRedirectionAuto = true;
TextHomeMetaTitle = "";
TextHomeMetaDescription ="";
FeatureSiteType = 2;
FeatureSiteThemeCms = "1:Normal/2:Gallerie (Pleine page)/3:Gallerie (2 colonnes):295/4:Gallerie (3 colonnes):180/5:Gallerie (4 colonnes):100/6:Gallerie (Slide):641";
FeatureTinymceCss = "/business/light/css/css.css, /business/light/templates/css.css";
FeatureTinymceTemplate = "[ {'title': 'Image centre', 'url': '/business/light/templates/centered_image_with_qtip.htm'}, {'title': 'Image gauche', 'url': '/business/light/templates/left_float_image.htm'}, {'title': 'Image droite', 'url': '/business/light/templates/right_float_image.htm'}, {'title': 'Paragraphe', 'url': '/business/light/templates/paragraph.htm'}, {'title': 'Tout', 'url': '/business/light/templates/feature_all.htm'},  {'title': 'block de code', 'url': '/business/light/templates/this_is_a_piece_of_code.htm'}, {'title': 'block citation', 'url': '/business/light/templates/this_is_a_quote.htm'}, {'title': 'table', 'url': '/business/light/templates/table.htm'}, {'title': 'deux colonnes', 'url': '/business/light/templates/two_half_columns.htm'}, {'title': 'trois colonnes', 'url': '/business/light/templates/tree_columns.htm'}, {'title': 'quatre colonnes', 'url': '/business/light/templates/four_columns.htm'}, {'title': '1/4 3/4 colonnes', 'url': '/business/light/templates/small_big_columns.htm'}, {'title': 'titres', 'url': '/business/light/templates/this_is_a_header.htm'}, {'title': 'blocks d\'info', 'url': '/business/light/templates/info_blocks.htm'}, {'title': '3 images', 'url': '/business/light/templates/3images.htm'}  ]";
FeatureCategoryLinkRedirection = true;
config/database.ini000060400000000352150710367660010265 0ustar00[prod]
developer = true
database.adapter = PDO_MYSQL
database.params.host     = karenpetzbprods.mysql.db
database.params.username = karenpetzbprods
database.params.password = oe9M4w4a2m0tt2oN
database.params.dbname   = karenpetzbprods