Current File : /home/k/a/r/karenpetzb/www/items/category/backoffice.tar
controllers/StatisticController.php000060400000022673150711547040013650 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();
		}
	}
}

	
?>controllers/CommandController.php000060400000036473150711547040013262 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");
	}
}
?>controllers/ProductController.php000060400000264177150711547040013330 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');
	} 
	
}
?>controllers/ErrorController.php000060400000001737150711547040012770 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);
		}
	}
}
?>controllers/MaintenanceController.php000060400000073461150711547040014124 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');
    }
}
controllers/FidelitypointController.php000060400000010773150711547040014522 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');
	}

}
?>controllers/AnnoncefrontController.php000060400000010743150711547040014326 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');
	}

}
?>controllers/Category2Controller.php000060400000040105150711547040013526 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');

	}
}
?>controllers/BlogCommentController.php000060400000014400150711547040014074 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');
		}
	}
 
}
?>controllers/AnnoncegalleryController.php000060400000021724150711547040014636 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');
	}

}
?>controllers/AuthController.php000060400000014461150711547040012576 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();
	}
}

?>controllers/FaqController.php000060400000021723150711547040012403 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');
	}
}
?>controllers/EbpController.php000060400000067715150711547040012415 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;
	}
}
?>controllers/IndexController.php000060400000010100150711547040012726 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();
			}
		}
	}
    
}



?>controllers/UserController.php000060400000053441150711547040012614 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');
	}
}
?>controllers/SupplierController.php000060400000046770150711547040013510 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');	
	}
}
?>controllers/AnnoncefooterController.php000060400000012273150711547040014474 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');
	}

}
?>controllers/AnnonceController.php000060400000010457150711547040013257 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');
	}

}
?>controllers/ProductglobalController.php000060400000024125150711547040014474 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');
	}
}
?>controllers/AnnoncecontentController.php000060400000010654150711547040014651 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');
	}

}
?>controllers/AdminController.php000060400000017302150711547040012722 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;
			}

		}
	}

}
?>controllers/ToolController.php000060400000006510150711547040012606 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();
	}
}
?>controllers/BlogCategoryController.php000060400000014766150711547040014266 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');
        } 
	}

}
?>controllers/BlogSubjectController.php000060400000016475150711547040014107 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');
        } 
	}

}
?>controllers/AnnoncecmsController.php000060400000012744150711547040013763 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');
	}

}
?>controllers/ProductoptionlistController.php000060400000010362150711547040015436 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');
	}
	
}
?>controllers/CsvController.php000060400000105322150711547040012425 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;
	}
}
?>controllers/PromotionController.php000060400000136235150711547040013667 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');
	}
}
?>controllers/AnnonceleftController.php000060400000012117150711547040014125 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');
	}

}
?>controllers/PrestashopController.php000060400000065162150711547040014031 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;
	}
}
?>controllers/FooterController.php000060400000015050150711547040013126 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');
	}

}
?>controllers/AnnoncerightController.php000060400000012257150711547040014315 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');
	}

}
?>controllers/CategoryController.php000060400000063640150711547040013455 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;
	}  
	
}
?>views/scripts/annoncegallery/message.phtml000060400000000260150711547040015061 0ustar00<div style="clear: both;">
<span class="errorText"><?php echo $this -> messageError; ?></span>
<span class="successText"><?php echo $this -> messageSuccess; ?></span> 
</div>
	views/scripts/annoncegallery/ajaxshowallpicture.phtml000060400000003654150711547040017360 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>
views/scripts/annoncegallery/edit.phtml000060400000012053150711547040014365 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>
views/scripts/annoncegallery/list.phtml000060400000002674150711547040014423 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>
views/scripts/annoncegallery/add.phtml000060400000011671150711547040014175 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>
views/scripts/index/index.phtml000060400000007156150711547040012665 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 } ?>  views/scripts/auth/login.phtml000060400000002247150711547040012514 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>
		views/scripts/fidelitypoint/list.phtml000060400000007745150711547040014311 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>
views/scripts/category/list.phtml000060400000002726150711547040013235 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>
views/scripts/category/edit.phtml000060400000072761150711547040013215 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>views/scripts/category/ajaxvalue.phtml000060400000000145150711547040014233 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?>
<?php  echo $this->messageSuccess; ?>views/scripts/category/add.phtml000060400000005112150711547040013002 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>
		views/scripts/faq/list.phtml000060400000014167150711547040012171 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>
 views/scripts/ebp/index.phtml000060400000006067150711547040012324 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>views/scripts/product/option.phtml000060400000004013150711547040013424 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>
views/scripts/product/ajaxvalue.phtml000060400000000145150711547040014076 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?>
<?php  echo $this->messageSuccess; ?>views/scripts/product/search.phtml000060400000023407150711547040013371 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>


views/scripts/product/livraison.phtml000060400000010744150711547040014132 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>views/scripts/product/livraisoncat.phtml000060400000002254150711547040014617 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>
views/scripts/product/ajaxaccessoirelist.phtml000060400000002157150711547040016003 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 
	}
} ?>views/scripts/product/ajaxannexelist.phtml000060400000002421150711547040015133 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 
	}
} ?>views/scripts/product/list.phtml000060400000007566150711547040013107 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>views/scripts/product/ajaxaccessoireproductlist.phtml000060400000005047150711547040017405 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>views/scripts/product/edit.phtml000060400000157405150711547040013057 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>views/scripts/product/keywordsengine.phtml000060400000004642150711547040015161 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>views/scripts/product/ajaxannexeproductlist.phtml000060400000002726150711547040016544 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 } } ?>views/scripts/product/optionprofil.phtml000060400000003247150711547040014650 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>
views/scripts/product/add.phtml000060400000006624150711547040012656 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>views/scripts/pagination.phtml000060400000001452150711547040012571 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 } ?>views/scripts/blogcomment/edit.phtml000060400000005147150711547040013700 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>views/scripts/blogcomment/search.phtml000060400000007363150711547040014222 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  } ?>views/scripts/blogcomment/add.phtml000060400000005017150711547040013477 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>views/scripts/annoncefront/list.phtml000060400000007106150711547040014107 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>
views/scripts/alert_tr.phtml000060400000000244150711547040012252 0ustar00<?php if (!empty($this->messageError) || !empty($this->messageSuccess)) { ?>
<tr>
	<td colspan="2"><?php echo $this->render("alert.phtml"); ?></td>
</tr>
<?php } ?>views/scripts/annonceleft/list.phtml000060400000011276150711547040013714 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>
views/scripts/statistic/clickstatsproduct.phtml000060400000001252150711547040016212 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>


views/scripts/statistic/logdefault.phtml000060400000006705150711547040014603 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>

views/scripts/statistic/keymap.phtml000060400000013666150711547040013747 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>
views/scripts/statistic/searchkey.phtml000060400000007311150711547040014425 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>views/scripts/statistic/logadmin.phtml000060400000006661150711547040014250 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>

views/scripts/statistic/stats.phtml000060400000016401150711547040013605 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>views/scripts/statistic/clickstatsip.phtml000060400000001774150711547040015153 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>


views/scripts/command/ajaxmessage.phtml000060400000000206150711547040014342 0ustar00<?php header('Content-type: text/html; charset=iso-8859-1'); ?>
<?php echo $this->messageSuccess; ?><?php echo $this->messageError; ?>views/scripts/command/facture_deliverytrack.phtml000060400000001176150711547040016442 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>

views/scripts/command/edit.phtml000060400000051203150711547040013002 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>
views/scripts/command/listdevis.phtml000060400000012347150711547040014071 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>views/scripts/command/listcommand.phtml000060400000012372150711547040014373 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>
views/scripts/command/search.phtml000060400000007525150711547040013332 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>views/scripts/command/facture_traitementinprogress.phtml000060400000001304150711547040020053 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>

views/scripts/annoncecms/edit.phtml000060400000014216150711547040013513 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>
views/scripts/annoncecms/list.phtml000060400000002115150711547040013534 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>
views/scripts/annoncecms/add.phtml000060400000012627150711547040013322 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>
views/scripts/supplier/list.phtml000060400000003762150711547040013264 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>views/scripts/supplier/edit.phtml000060400000025473150711547040013241 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>views/scripts/supplier/add.phtml000060400000006214150711547040013034 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>
		views/scripts/supplier/search.phtml000060400000004075150711547040013554 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>
views/scripts/productoptionlist/option.phtml000060400000005400150711547040015552 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>
views/scripts/annonce/list.phtml000060400000006161150711547040013036 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>
views/scripts/csv/export.phtml000060400000000000150711547040012540 0ustar00views/scripts/csv/sitemapxml.phtml000060400000003512150711547040013415 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>views/scripts/prestashop/index.phtml000060400000002227150711547040013740 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>views/scripts/error/error.phtml000060400000000027150711547040012717 0ustar00Sorry, an error occuredviews/scripts/blogsubject/search.phtml000060400000010505150711547040014207 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  } ?>views/scripts/blogsubject/add.phtml000060400000007267150711547040013505 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>views/scripts/blogsubject/edit.phtml000060400000007502150711547040013672 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>views/scripts/category2/add.phtml000060400000005061150711547040013067 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>views/scripts/category2/list.phtml000060400000003326150711547040013314 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>
views/scripts/category2/edit.phtml000060400000041402150711547040013263 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>views/scripts/annoncecontent/list.phtml000060400000007066150711547040014436 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>
views/scripts/alert.phtml000060400000000501150711547040011541 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>views/scripts/blogcategory/add.phtml000060400000007126150711547040013655 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>views/scripts/blogcategory/list.phtml000060400000003057150711547040014077 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>
views/scripts/blogcategory/edit.phtml000060400000007772150711547040014061 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>views/scripts/annoncefooter/list.phtml000060400000015230150711547040014252 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>
views/scripts/user/edit.phtml000060400000060464150711547040012353 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>
		views/scripts/user/list.phtml000060400000005164150711547040012375 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>views/scripts/user/newsletter.phtml000060400000003550150711547040013613 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>views/scripts/user/guest.phtml000060400000001453150711547040012546 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>views/scripts/user/search.phtml000060400000003460150711547040012664 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>
views/scripts/user/codeinterne.phtml000060400000005571150711547040013723 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>views/scripts/productglobal/list.phtml000060400000016771150711547040014266 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>views/scripts/footer/add.phtml000060400000002730150711547040012466 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>
		views/scripts/footer/doc.phtml000060400000003463150711547040012507 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>views/scripts/footer/list.phtml000060400000002430150711547040012706 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>
views/scripts/footer/edit.phtml000060400000003075150711547040012666 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>views/scripts/alert_tr1.phtml000060400000000230150711547040012326 0ustar00<?php if (!empty($this->messageError) || !empty($this->messageSuccess)) { ?>
<tr>
	<td><?php echo $this->render("alert.phtml"); ?></td>
</tr>
<?php } ?>views/scripts/maintenance/index.phtml000060400000011446150711547040014035 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>



views/scripts/maintenance/generatenavnomproduct.phtml000060400000000260150711547040017330 0ustar00<div style="clear: both;">
<span class="errorText"><?php echo $this -> messageError; ?></span>
<span class="successText"><?php echo $this -> messageSuccess; ?></span>

</div>
	views/scripts/maintenance/message.phtml000060400000000260150711547040014342 0ustar00<div style="clear: both;">
<span class="errorText"><?php echo $this -> messageError; ?></span>
<span class="successText"><?php echo $this -> messageSuccess; ?></span> 
</div>
	views/scripts/annonceright/list.phtml000060400000011605150711547040014073 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>
views/scripts/promotion/product.phtml000060400000036052150711547040014152 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> 
   views/scripts/promotion/codereduction.phtml000060400000013531150711547040015316 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> views/scripts/promotion/user.phtml000060400000032716150711547040013453 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>views/scripts/promotion/gift.phtml000060400000010536150711547040013422 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>views/scripts/promotion/front.phtml000060400000005254150711547040013622 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>views/scripts/promotion/command.phtml000060400000016743150711547040014115 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>views/scripts/admin/edit.phtml000060400000004034150711547040012454 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>views/scripts/admin/list.phtml000060400000022661150711547040012510 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>

views/scripts/admin/add.phtml000060400000004025150711547040012257 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>
		views/layouts/headerLayoutTopMenu.phtml000060400000017261150711547040014414 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 } ?> 






views/layouts/layout.phtml000060400000013061150711547040011765 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>views/layouts/headerLayout.phtml000060400000030364150711547040013103 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>views/layouts/headerLayoutTop.phtml000060400000004362150711547040013565 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>views/layouts-left/layout.phtml000060400000012246150711547040012721 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>views/layouts-left/headerLayoutTopMenu.phtml000060400000013312150711547040015335 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 } ?>





views/layouts-left/headerLayoutTop.phtml000060400000004002150711547040014504 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>views/layouts-left/headerLayout.phtml000060400000030220150711547040014022 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>