mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
pass current user to constructor of Calendar class
This commit is contained in:
parent
1a74c45cae
commit
13f3a0f373
|
@ -33,8 +33,9 @@ class SeedDMS_Calendar {
|
|||
*/
|
||||
protected $db;
|
||||
|
||||
function __construct($db) {
|
||||
function __construct($db, $user) {
|
||||
$this->db = $db;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
function getEvents($day, $month, $year) { /* {{{ */
|
||||
|
@ -54,10 +55,8 @@ class SeedDMS_Calendar {
|
|||
} /* }}} */
|
||||
|
||||
function addEvent($from, $to, $name, $comment ) { /* {{{ */
|
||||
global $user;
|
||||
|
||||
$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().", ".$user->getID().")";
|
||||
"(".$this->db->qstr($name).", ".$this->db->qstr($comment).", ".(int) $from.", ".(int) $to.", ".$this->db->getCurrentTimestamp().", ".$this->user->getID().")";
|
||||
|
||||
$ret = $this->db->getResult($queryStr);
|
||||
return $ret;
|
||||
|
|
|
@ -64,7 +64,7 @@ if ($to<=$from){
|
|||
UI::exitError(getMLText("add_event"),getMLText("to_before_from"));
|
||||
}
|
||||
|
||||
$calendar = new SeedDMS_Calendar($dms->getDB());
|
||||
$calendar = new SeedDMS_Calendar($dms->getDB(), $user);
|
||||
|
||||
$res = $calendar->addEvent($from, $to, $name, $comment);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ if (!isset($_POST["from"]) && !(isset($_POST["frommonth"]) && isset($_POST["from
|
|||
UI::exitError(getMLText("edit_event"),getMLText("error_occured"));
|
||||
}
|
||||
|
||||
$calendar = new SeedDMS_Calendar($dms->getDB());
|
||||
$calendar = new SeedDMS_Calendar($dms->getDB(), $user);
|
||||
|
||||
if (!isset($_POST["eventid"]) || !($event = $calendar->getEvent($_POST["eventid"]))) {
|
||||
UI::exitError(getMLText("edit_event"),getMLText("error_occured"));
|
||||
|
|
|
@ -37,7 +37,7 @@ if (!isset($_POST["eventid"]) || !is_numeric($_POST["eventid"]) || intval($_POST
|
|||
UI::exitError(getMLText("edit_event"),getMLText("error_occured"));
|
||||
}
|
||||
|
||||
$calendar = new SeedDMS_Calendar($dms->getDB());
|
||||
$calendar = new SeedDMS_Calendar($dms->getDB(), $user);
|
||||
$event=$calendar->getEvent($_POST["eventid"]);
|
||||
|
||||
if (($user->getID()!=$event["userID"])&&(!$user->isAdmin())){
|
||||
|
|
|
@ -37,7 +37,7 @@ if(isset($_GET['documentid']) && $_GET['documentid'] && is_numeric($_GET['docume
|
|||
} else
|
||||
$document = null;
|
||||
|
||||
$calendar = new SeedDMS_Calendar($dms->getDB());
|
||||
$calendar = new SeedDMS_Calendar($dms->getDB(), $user);
|
||||
|
||||
if(isset($_GET['eventid']) && $_GET['eventid'] && is_numeric($_GET['eventid'])) {
|
||||
$event = $calendar->getEvent($_GET["eventid"]);
|
||||
|
|
Loading…
Reference in New Issue
Block a user