예제 #1
0
 /**
  * Load all of the alert types currently in the system from the database.
  * Should only be used to refresh the cache.
  *
  * @return MybbStuff_MyAlerts_Entity_AlertType[] All of the alert types
  *                                               currently in the database.
  */
 private function loadAlertTypes()
 {
     $tablePrefix = TABLE_PREFIX;
     $queryString = "SELECT * FROM {$tablePrefix}alert_types;";
     $query = $this->db->write_query($queryString);
     $alertTypes = array();
     if ($this->db->num_rows($query) > 0) {
         while ($row = $this->db->fetch_array($query)) {
             $alertType = new MybbStuff_MyAlerts_Entity_AlertType();
             $alertType->setId($row['id']);
             $alertType->setCode($row['code']);
             $alertType->setEnabled((int) $row['enabled'] == 1);
             $alertType->setCanBeUserDisabled((int) $row['can_be_user_disabled'] == 1);
             $alertTypes[$row['code']] = $alertType->toArray();
         }
     }
     return $alertTypes;
 }