mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 09:35:00 +00:00
make methods public, add methods getUser() and setUser()
This commit is contained in:
parent
e483796c85
commit
f0e05463af
|
@ -33,12 +33,20 @@ class SeedDMS_Calendar {
|
|||
*/
|
||||
protected $db;
|
||||
|
||||
function __construct($db, $user) {
|
||||
public function __construct($db, $user) { /* {{{ */
|
||||
$this->db = $db;
|
||||
$this->user = $user;
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
function getEvents($day, $month, $year) { /* {{{ */
|
||||
public function setUser($user) { /* {{{ */
|
||||
$this->user = $user;
|
||||
} /* }}} */
|
||||
|
||||
public function getUser() { /* {{{ */
|
||||
return $this->user;
|
||||
} /* }}} */
|
||||
|
||||
public function getEvents($day, $month, $year) { /* {{{ */
|
||||
$date = mktime(12,0,0, $month, $day, $year);
|
||||
|
||||
$queryStr = "SELECT * FROM `tblEvents` WHERE `start` <= " . $date . " AND `stop` >= " . $date;
|
||||
|
@ -49,7 +57,7 @@ class SeedDMS_Calendar {
|
|||
return $ret;
|
||||
} /* }}} */
|
||||
|
||||
function getEventsInInterval($start, $stop) { /* {{{ */
|
||||
public function getEventsInInterval($start, $stop) { /* {{{ */
|
||||
$queryStr = "SELECT * FROM `tblEvents` WHERE ( `start` <= " . (int) $start . " AND `stop` >= " . (int) $start . " ) ".
|
||||
"OR ( `start` <= " . (int) $stop . " AND `stop` >= " . (int) $stop . " ) ".
|
||||
"OR ( `start` >= " . (int) $start . " AND `stop` <= " . (int) $stop . " )";
|
||||
|
@ -60,7 +68,7 @@ class SeedDMS_Calendar {
|
|||
return $ret;
|
||||
} /* }}} */
|
||||
|
||||
function addEvent($from, $to, $name, $comment ) { /* {{{ */
|
||||
public function addEvent($from, $to, $name, $comment ) { /* {{{ */
|
||||
$queryStr = "INSERT INTO `tblEvents` (`name`, `comment`, `start`, `stop`, `date`, `userID`) VALUES ".
|
||||
"(".$this->db->qstr($name).", ".$this->db->qstr($comment).", ".(int) $from.", ".(int) $to.", ".$this->db->getCurrentTimestamp().", ".$this->user->getID().")";
|
||||
|
||||
|
@ -68,7 +76,7 @@ class SeedDMS_Calendar {
|
|||
return $ret;
|
||||
} /* }}} */
|
||||
|
||||
function getEvent($id) { /* {{{ */
|
||||
public function getEvent($id) { /* {{{ */
|
||||
if (!is_numeric($id)) return false;
|
||||
|
||||
$queryStr = "SELECT * FROM `tblEvents` WHERE `id` = " . (int) $id;
|
||||
|
@ -80,7 +88,7 @@ class SeedDMS_Calendar {
|
|||
return $ret[0];
|
||||
} /* }}} */
|
||||
|
||||
function editEvent($id, $from, $to=null, $name=null, $comment=null) { /* {{{ */
|
||||
public function editEvent($id, $from, $to=null, $name=null, $comment=null) { /* {{{ */
|
||||
if (!is_numeric($id)) return false;
|
||||
|
||||
$queryStr = "UPDATE `tblEvents` SET `start` = " . (int) $from . ($to !== null ? ", `stop` = " . (int) $to : '') . ($name !== null ? ", `name` = " . $this->db->qstr($name) : '') . ($comment !== null ? ", `comment` = " . $this->db->qstr($comment) : '') . ", `date` = " . $this->db->getCurrentTimestamp() . " WHERE `id` = ". (int) $id;
|
||||
|
@ -88,7 +96,7 @@ class SeedDMS_Calendar {
|
|||
return $ret;
|
||||
} /* }}} */
|
||||
|
||||
function delEvent($id) { /* {{{ */
|
||||
public function delEvent($id) { /* {{{ */
|
||||
if (!is_numeric($id)) return false;
|
||||
|
||||
$queryStr = "DELETE FROM `tblEvents` WHERE `id` = " . (int) $id;
|
||||
|
|
Loading…
Reference in New Issue
Block a user