コード例 #1
0
 protected function _load()
 {
     $connection = DbConnection::getInstance()->getConnection();
     $sth = $connection->query('SELECT user.id, name, second_name, photo, email, title, role.id as role  FROM user INNER JOIN role on user.role_id = role.id');
     $sth->execute();
     $this->_itemsData = $sth->fetchAll();
 }
コード例 #2
0
ファイル: Report.php プロジェクト: swnsma/coursework3.1
 protected static function _getDiseasesData($last = false)
 {
     $connection = DbConnection::getInstance()->getConnection();
     $sql = "SELECT title, count(*) as total FROM disease INNER JOIN patient_disease ON disease.id = patient_disease.disease_id";
     if ($last) {
         $sql .= " WHERE DATEDIFF(CURDATE(), patient_disease.illness_start)<30 ";
     }
     $sql .= " GROUP BY title";
     $sth = $connection->prepare($sql);
     $sth->execute();
     return $sth->fetchAll();
 }
コード例 #3
0
 protected function _userSpecifiedLoad($userId, $active = false)
 {
     $connection = DbConnection::getInstance()->getConnection();
     $sth = $connection->prepare("CALL GetUserSpecifiedPatientService(?, ?)");
     $sth->execute(array($userId, $active ? 1 : 0));
     $result = $sth->fetchAll();
     if (empty($result[0]['id'])) {
         return array();
     } else {
         return $result;
     }
 }
コード例 #4
0
 public function saveAction(Request $request)
 {
     try {
         BigBrother::updateConfig($request->request->all());
         DbConnection::getInstance()->getConnection();
         BigBrother::saveConfig();
         $installer = new Installer();
         $installer->run();
     } catch (Exception $e) {
         $request->getSession()->set('message', 'Can\'t connect to database. Please try again.');
     }
     return $this->RedirectToRoute('lancer_lance_install');
 }
コード例 #5
0
ファイル: Installer.php プロジェクト: swnsma/coursework3.1
 protected function _install($installNode)
 {
     try {
         if (version_compare($installNode->version, $this->config->version) > 0) {
             DbConnection::getInstance()->getConnection()->beginTransaction();
             foreach ($installNode->tasks[0] as $task) {
                 DbConnection::getInstance()->getConnection()->query((string) $task);
             }
             DbConnection::getInstance()->getConnection()->commit();
             $this->config->version = $installNode->version;
             BigBrother::updateConfig($this->config);
         }
     } catch (\Exception $e) {
         DbConnection::getInstance()->getConnection()->rollBack();
         throw new \Exception("Install problems. Please check install content and repeat.");
     }
 }