61 lines
1.8 KiB
PHP
61 lines
1.8 KiB
PHP
<?php
|
|
/*
|
|
* To change this template, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
|
|
class Application_Model_CommandesGiants extends Zend_Db_Table_Abstract
|
|
{
|
|
protected $_name = 'commandes_giants';
|
|
|
|
public function __construct()
|
|
{
|
|
if (empty($config) && Zend_Registry::isRegistered('configuration')){
|
|
$configuration = Zend_Registry::get('configuration');
|
|
$this->_db = Zend_Db::factory($configuration->databases->db->sdv1);
|
|
} elseif(empty($config)){
|
|
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini', 'databases');
|
|
$this->_db = Zend_Db::factory($dbConfig->db->sdv1);
|
|
}
|
|
}
|
|
|
|
public function getCommandesGiantByLogin($login)
|
|
{
|
|
$sql = $this->select()
|
|
->where('login = ?', $login);
|
|
$result = $this->getAdapter()->fetchAll($sql);
|
|
return ($result);
|
|
}
|
|
|
|
public function getCommandesGiantByDate($date)
|
|
{
|
|
$sql = $this->select()
|
|
->where('date = ?', $date);
|
|
$result = $this->getAdapter()->fetchAll($sql);
|
|
return ($result);
|
|
}
|
|
|
|
public function getCommandesGiantByLoginAndDate($login, $date)
|
|
{
|
|
$sql = $this->select()
|
|
->where('login = ?', $login)
|
|
->where('date = ?', $date);
|
|
$result = $this->getAdapter()->fetchAll($sql);
|
|
return ($result);
|
|
}
|
|
|
|
public function getCommandesGiantLoginDateReportType($login, $date, $type, $pays)
|
|
{
|
|
$sql = $this->select()
|
|
->where('login = ?', $login)
|
|
->where('typeReport = ?', $type)
|
|
->where('date = ?', $date)
|
|
->where('pays = ?', $pays);
|
|
$result = $this->getAdapter()->fetchRow($sql);
|
|
return ($result['id']);
|
|
}
|
|
}
|
|
|
|
|
|
?>
|