Created
May 3, 2011 20:26
-
-
Save philippTheCat/954151 to your computer and use it in GitHub Desktop.
notification.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Generated with SQLize v0.1 | |
*/ | |
class notification { | |
/** | |
* @type integer | |
*/ | |
private $id; | |
/** | |
* @type string | |
*/ | |
private $title; | |
/** | |
* @type string | |
*/ | |
private $text; | |
/** | |
* @type string | |
*/ | |
private $sender; | |
/** | |
* @type string | |
*/ | |
private $recipient; | |
/** | |
* @type integer | |
*/ | |
private $time; | |
/** | |
* @type integer | |
*/ | |
private $public; | |
/** | |
* get method for id | |
* @return integer | |
*/ | |
function get_id(){ | |
return $this->id; | |
} | |
/** | |
* set method for id | |
*/ | |
function set_id($id){ | |
$this->id = $id; | |
} | |
/** | |
* get method for title | |
* @return string | |
*/ | |
function get_title(){ | |
return $this->title; | |
} | |
/** | |
* set method for title | |
*/ | |
function set_title($title){ | |
$this->title = $title; | |
} | |
/** | |
* get method for text | |
* @return string | |
*/ | |
function get_text(){ | |
return $this->text; | |
} | |
/** | |
* set method for text | |
*/ | |
function set_text($text){ | |
$this->text = $text; | |
} | |
/** | |
* get method for sender | |
* @return string | |
*/ | |
function get_sender(){ | |
return $this->sender; | |
} | |
/** | |
* set method for sender | |
*/ | |
function set_sender($sender){ | |
$this->sender = $sender; | |
} | |
/** | |
* get method for recipient | |
* @return string | |
*/ | |
function get_recipient(){ | |
return $this->recipient; | |
} | |
/** | |
* set method for recipient | |
*/ | |
function set_recipient($recipient){ | |
$this->recipient = $recipient; | |
} | |
/** | |
* get method for time | |
* @return integer | |
*/ | |
function get_time(){ | |
return $this->time; | |
} | |
/** | |
* set method for time | |
*/ | |
function set_time($time){ | |
$this->time = $time; | |
} | |
/** | |
* get method for public | |
* @return integer | |
*/ | |
function get_public(){ | |
return $this->public; | |
} | |
/** | |
* set method for public | |
*/ | |
function set_public($public){ | |
$this->public = $public; | |
} | |
/** | |
* if $id is set: fetches the record from database and updates the instance | |
* if $id is not set: returns all records as instances | |
*/ | |
function fetch($id=null,$SQL=""){ | |
if (!is_null($id)) { | |
$where = "WHERE id = " . $id; | |
} else { | |
$where = " "; | |
} | |
$sql = "Select * from notification " . $where . $SQL . ";"; | |
$result = mysql_query($sql) or die(mysql_error()); | |
if (!is_null($id)) { | |
while ($row = mysql_fetch_assoc($result)) { | |
$this->set_id($row["id"]); | |
$this->set_title($row["title"]); | |
$this->set_text($row["text"]); | |
$this->set_sender($row["sender"]); | |
$this->set_recipient($row["recipient"]); | |
$this->set_time($row["time"]); | |
$this->set_public($row["public"]); | |
} | |
return; | |
} else { | |
$res = array(); | |
while ($row = mysql_fetch_assoc($result)) { | |
$curnotification = new notification(); | |
$curnotification->set_id($row["id"]); | |
$curnotification->set_title($row["title"]); | |
$curnotification->set_text($row["text"]); | |
$curnotification->set_sender($row["sender"]); | |
$curnotification->set_recipient($row["recipient"]); | |
$curnotification->set_time($row["time"]); | |
$curnotification->set_public($row["public"]); | |
$res[] = $curnotification; | |
} | |
return $res; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment