Esempio n. 1
0
 /**
  * Constructor
  * @since Version 3.9
  * @param int $year
  */
 public function __construct($year = null)
 {
     parent::__construct();
     if ($year == null) {
         return;
     }
     if (checkdate(1, 1, $year)) {
         $this->year = $year;
     }
 }
Esempio n. 2
0
 /**
  * Constructor
  * @since Version 3.9
  * @param int $decade
  */
 public function __construct($decade = null)
 {
     parent::__construct();
     if ($decade == null) {
         return;
     }
     $decade = floor($decade / 10) * 10;
     if (checkdate(1, 1, $decade)) {
         $this->decade = $decade;
     }
 }
Esempio n. 3
0
 /**
  * Constructor
  * @since Version 3.8.7
  * @param int $id
  */
 public function __construct($id = null)
 {
     parent::__construct();
     if (!filter_var($id, FILTER_VALIDATE_INT)) {
         return;
     }
     $this->id = $id;
     $query = "SELECT * FROM chronicle_type WHERE id = ?";
     if ($row = $this->db->fetchRow($query, $this->id)) {
         $this->text = $row['text'];
         $this->group = $row['grouping'];
     }
 }
Esempio n. 4
0
 /**
  * Constructor
  * @since Version 3.8.7
  * @param int $id
  */
 public function __construct($id = false)
 {
     parent::__construct();
     if (filter_var($id, FILTER_VALIDATE_INT)) {
         $this->id = $id;
     }
     if (filter_var($id, FILTER_VALIDATE_INT)) {
         $query = "SELECT id, status, date, type_id, blurb, text, X(point) as lat, Y(point) AS lon, user_id, meta FROM chronicle_item WHERE id = ?";
         if ($row = $this->db->fetchRow($query, $this->id)) {
             $this->status = $row['status'];
             $this->blurb = $row['blurb'];
             $this->text = $row['text'];
             $this->Date = new DateTime($row['date']);
             $this->lat = $row['lat'];
             $this->lon = $row['lon'];
             $this->Author = new User($row['user_id']);
             $this->meta = json_decode($row['meta'], true);
             if (filter_var($row['type_id']) && $row['type_id'] > 0) {
                 $this->EntryType = new EntryType($row['type_id']);
             }
             if (filter_var($this->lat, FILTER_VALIDATE_FLOAT) && filter_var($this->lon, FILTER_VALIDATE_FLOAT)) {
                 $this->Place = new Place($this->lat, $this->lon);
             }
             $this->makeURLs();
         }
     }
 }