/** * This method reads the configuration options (using the getConfig method) * and initializes the database connections. * */ function configure() { $connections = $this->getConfig(); if ($connections) { foreach ($connections as $name => $params) { self::$connections[$name] = DbFactory::getConnection($params, $name); } } }
public function __construct($startDate, $endDate = '', $userId = 0) { require_once 'db/DbFactory.class.php'; $this->conn = DbFactory::getConnection(); if (!$startDate) { $startDate = date('Y-m'); } if (!$endDate) { $endDate = date('Y-m'); } $this->start = $startDate; $this->end = $endDate; $query = $this->conn->newStatement('SELECT user_id FROM employee_data WHERE status < 5 AND IF(:uid:,user_id=:uid:,1)'); $query->setInteger('uid', $userId); $this->users = array_keys($query->getAllRecords('user_id')); $this->values = $this->getValues(); }