Esempio n. 1
8
 public function save(\Models\PageModel $page)
 {
     $query = "INSERT INTO page (label, title, body, slug) VALUES (?, ?, ?, ?)";
     $param = [$page->getLabel(), $page->getTitle(), $page->getBody(), $page->getSlug()];
     $this->db->query($query, $param);
     return $this->db->row();
 }
Esempio n. 2
0
 /**
  * 
  * @param \Repository\User $user
  * @return type
  */
 public function save(\Models\UserModels $user)
 {
     $query = "INSERT INTO users (username, password) VALUES (?, ?)";
     $param = [$user->getUsername(), $user->getPasword()];
     $this->db->query($query, $param);
     return $this->db->row();
 }
Esempio n. 3
0
 public function selectByConferenceId($id)
 {
     $query = "SELECT v.name, v.address, v.id\r\n                  FROM venues v\r\n                  JOIN conferences c ON c.venue_id = v.id\r\n                  WHERE c.id = ?";
     $this->db->query($query, [$id]);
     $result = $this->db->row();
     return new \Models\VenueModel($result['name'], $result['address'], $result['id']);
 }
Esempio n. 4
0
 public function save(User_infoModel $user)
 {
     $query = 'INSERT INTO user_info(user_id, gender, first_name, last_name, email)
             VALUE (?, ?, ?, ?, ?)';
     $param = [$user->getUserId(), $user->getGender(), $user->getFirstName(), $user->getLastName(), $user->getEmail()];
     $this->db->query($query, $param);
     return $this->db->row();
 }
Esempio n. 5
0
 public function save(\Models\ConferenceModel $conf)
 {
     $query = 'INSERT INTO conferences (confName, startDate, endDate, venue_id, user_id)
               VALUES (?, ?, ?, ?, ?)';
     $param = [$conf->getConfName(), $conf->getStartDate(), $conf->getEndDate(), $conf->getVenueId(), $conf->getUserId()];
     $this->db->query($query, $param);
     return $this->db->row();
 }
Esempio n. 6
0
 public function getHallIdByConference($confId, $hallName)
 {
     $query = 'SELECT h.id, h.seating, h.hallName, h.venue_id
               FROM `halls` AS h
               JOIN `venues` AS v ON v.id = h.venue_id
               JOIN `conferences` AS c ON c.venue_id = v.id
               WHERE c.id = ? and h.hallName = ?';
     $this->db->query($query, [$confId, $hallName]);
     return $this->db->row();
 }
Esempio n. 7
0
 public function getLecturesById($id)
 {
     $query = 'SELECT name, startTime, endTime, break, hall_id, conference_Id, day, l.id
               FROM lectures as l
               WHERE c.id = ?';
     $this->db->query($query, [$id]);
     $result = $this->db->fetchAll();
     $lecture = [];
     foreach ($result as $key => $value) {
         $lecture[] = new LectureModel($value['name'], $value['startTime'], $value['endTime'], $value['break'], $value['hall_id'], $value['conference_Id'], $value['day'], $value['id']);
     }
     return $lecture;
 }
Esempio n. 8
0
 public function createTable($class, $properties = [])
 {
     $constrain = ["CONSTRAINT fk_user_info_users FOREIGN KEY (user_id)\r\n            REFERENCES conf.users (id))", "CONSTRAINT fk_users_roles FOREIGN KEY (role_id)\r\n            REFERENCES conf.role (id))"];
     $query = "CREATE TABLE IF NOT EXISTS `conf`.`{$class}` ( ";
     foreach ($properties as $value) {
         foreach ($value as $valueKey => $valueName) {
             $query .= "{$valueKey} ";
             foreach ($value[$valueKey] as $v) {
                 $query .= "{$v} ";
             }
             $query .= ', ';
         }
     }
     if ($class == "Users") {
         $query .= $constrain[1];
     }
     if ($class == "User_info") {
         $query .= $constrain[0];
     }
     $query .= " DEFAULT CHARACTER SET = utf8";
     $this->db->query($query);
     return $this->db->row();
 }