|
@@ -38,12 +38,8 @@ class Agenda
|
|
$sessionId = 0
|
|
$sessionId = 0
|
|
) {
|
|
) {
|
|
// Table definitions
|
|
// Table definitions
|
|
- $this->tbl_global_agenda = Database::get_main_table(
|
|
|
|
- TABLE_MAIN_SYSTEM_CALENDAR
|
|
|
|
- );
|
|
|
|
- $this->tbl_personal_agenda = Database::get_main_table(
|
|
|
|
- TABLE_PERSONAL_AGENDA
|
|
|
|
- );
|
|
|
|
|
|
+ $this->tbl_global_agenda = Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
|
|
|
|
+ $this->tbl_personal_agenda = Database::get_main_table(TABLE_PERSONAL_AGENDA);
|
|
$this->tbl_course_agenda = Database::get_course_table(TABLE_AGENDA);
|
|
$this->tbl_course_agenda = Database::get_course_table(TABLE_AGENDA);
|
|
$this->table_repeat = Database::get_course_table(TABLE_AGENDA_REPEAT);
|
|
$this->table_repeat = Database::get_course_table(TABLE_AGENDA_REPEAT);
|
|
|
|
|
|
@@ -142,7 +138,6 @@ class Agenda
|
|
public function setType($type)
|
|
public function setType($type)
|
|
{
|
|
{
|
|
$typeList = $this->getTypes();
|
|
$typeList = $this->getTypes();
|
|
-
|
|
|
|
if (in_array($type, $typeList)) {
|
|
if (in_array($type, $typeList)) {
|
|
$this->type = $type;
|
|
$this->type = $type;
|
|
}
|
|
}
|
|
@@ -738,7 +733,6 @@ class Agenda
|
|
}
|
|
}
|
|
|
|
|
|
$groupId = api_get_group_id();
|
|
$groupId = api_get_group_id();
|
|
-
|
|
|
|
$groupIid = 0;
|
|
$groupIid = 0;
|
|
if ($groupId) {
|
|
if ($groupId) {
|
|
$groupInfo = GroupManager::get_group_properties($groupId);
|
|
$groupInfo = GroupManager::get_group_properties($groupId);
|
|
@@ -1118,9 +1112,7 @@ class Agenda
|
|
$course_id = null,
|
|
$course_id = null,
|
|
$groupId = null,
|
|
$groupId = null,
|
|
$user_id = 0,
|
|
$user_id = 0,
|
|
- $format = 'json',
|
|
|
|
- $startLimit = 0,
|
|
|
|
- $endLimit = 0
|
|
|
|
|
|
+ $format = 'json'
|
|
) {
|
|
) {
|
|
switch ($this->type) {
|
|
switch ($this->type) {
|
|
case 'admin':
|
|
case 'admin':
|
|
@@ -1298,6 +1290,7 @@ class Agenda
|
|
*/
|
|
*/
|
|
public function resizeEvent($id, $minute_delta)
|
|
public function resizeEvent($id, $minute_delta)
|
|
{
|
|
{
|
|
|
|
+ $id = (int) $id;
|
|
$delta = intval($minute_delta);
|
|
$delta = intval($minute_delta);
|
|
$event = $this->get_event($id);
|
|
$event = $this->get_event($id);
|
|
if (!empty($event)) {
|
|
if (!empty($event)) {
|
|
@@ -1305,21 +1298,21 @@ class Agenda
|
|
case 'personal':
|
|
case 'personal':
|
|
$sql = "UPDATE $this->tbl_personal_agenda SET
|
|
$sql = "UPDATE $this->tbl_personal_agenda SET
|
|
enddate = DATE_ADD(enddate, INTERVAL $delta MINUTE)
|
|
enddate = DATE_ADD(enddate, INTERVAL $delta MINUTE)
|
|
- WHERE id=".intval($id);
|
|
|
|
|
|
+ WHERE id = ".$id;
|
|
Database::query($sql);
|
|
Database::query($sql);
|
|
break;
|
|
break;
|
|
case 'course':
|
|
case 'course':
|
|
$sql = "UPDATE $this->tbl_course_agenda SET
|
|
$sql = "UPDATE $this->tbl_course_agenda SET
|
|
end_date = DATE_ADD(end_date, INTERVAL $delta MINUTE)
|
|
end_date = DATE_ADD(end_date, INTERVAL $delta MINUTE)
|
|
- WHERE c_id = ".$this->course['real_id']." AND id=".intval(
|
|
|
|
- $id
|
|
|
|
- );
|
|
|
|
|
|
+ WHERE
|
|
|
|
+ c_id = ".$this->course['real_id']." AND
|
|
|
|
+ id = ".$id;
|
|
Database::query($sql);
|
|
Database::query($sql);
|
|
break;
|
|
break;
|
|
case 'admin':
|
|
case 'admin':
|
|
$sql = "UPDATE $this->tbl_global_agenda SET
|
|
$sql = "UPDATE $this->tbl_global_agenda SET
|
|
end_date = DATE_ADD(end_date, INTERVAL $delta MINUTE)
|
|
end_date = DATE_ADD(end_date, INTERVAL $delta MINUTE)
|
|
- WHERE id=".intval($id);
|
|
|
|
|
|
+ WHERE id = ".$id;
|
|
Database::query($sql);
|
|
Database::query($sql);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -1336,11 +1329,13 @@ class Agenda
|
|
*/
|
|
*/
|
|
public function move_event($id, $minute_delta, $allDay)
|
|
public function move_event($id, $minute_delta, $allDay)
|
|
{
|
|
{
|
|
|
|
+ $id = (int) $id;
|
|
$event = $this->get_event($id);
|
|
$event = $this->get_event($id);
|
|
|
|
|
|
if (empty($event)) {
|
|
if (empty($event)) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+
|
|
// we convert the hour delta into minutes and add the minute delta
|
|
// we convert the hour delta into minutes and add the minute delta
|
|
$delta = intval($minute_delta);
|
|
$delta = intval($minute_delta);
|
|
$allDay = intval($allDay);
|
|
$allDay = intval($allDay);
|
|
@@ -1351,7 +1346,7 @@ class Agenda
|
|
$sql = "UPDATE $this->tbl_personal_agenda SET
|
|
$sql = "UPDATE $this->tbl_personal_agenda SET
|
|
all_day = $allDay, date = DATE_ADD(date, INTERVAL $delta MINUTE),
|
|
all_day = $allDay, date = DATE_ADD(date, INTERVAL $delta MINUTE),
|
|
enddate = DATE_ADD(enddate, INTERVAL $delta MINUTE)
|
|
enddate = DATE_ADD(enddate, INTERVAL $delta MINUTE)
|
|
- WHERE id=".intval($id);
|
|
|
|
|
|
+ WHERE id=".$id;
|
|
Database::query($sql);
|
|
Database::query($sql);
|
|
break;
|
|
break;
|
|
case 'course':
|
|
case 'course':
|
|
@@ -1359,9 +1354,9 @@ class Agenda
|
|
all_day = $allDay,
|
|
all_day = $allDay,
|
|
start_date = DATE_ADD(start_date, INTERVAL $delta MINUTE),
|
|
start_date = DATE_ADD(start_date, INTERVAL $delta MINUTE),
|
|
end_date = DATE_ADD(end_date, INTERVAL $delta MINUTE)
|
|
end_date = DATE_ADD(end_date, INTERVAL $delta MINUTE)
|
|
- WHERE c_id = ".$this->course['real_id']." AND id=".intval(
|
|
|
|
- $id
|
|
|
|
- );
|
|
|
|
|
|
+ WHERE
|
|
|
|
+ c_id = ".$this->course['real_id']." AND
|
|
|
|
+ id=".$id;
|
|
Database::query($sql);
|
|
Database::query($sql);
|
|
break;
|
|
break;
|
|
case 'admin':
|
|
case 'admin':
|
|
@@ -1369,7 +1364,7 @@ class Agenda
|
|
all_day = $allDay,
|
|
all_day = $allDay,
|
|
start_date = DATE_ADD(start_date,INTERVAL $delta MINUTE),
|
|
start_date = DATE_ADD(start_date,INTERVAL $delta MINUTE),
|
|
end_date = DATE_ADD(end_date, INTERVAL $delta MINUTE)
|
|
end_date = DATE_ADD(end_date, INTERVAL $delta MINUTE)
|
|
- WHERE id=".intval($id);
|
|
|
|
|
|
+ WHERE id=".$id;
|
|
Database::query($sql);
|
|
Database::query($sql);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -1619,7 +1614,6 @@ class Agenda
|
|
);
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1642,12 +1636,8 @@ class Agenda
|
|
$user_id = 0,
|
|
$user_id = 0,
|
|
$color = ''
|
|
$color = ''
|
|
) {
|
|
) {
|
|
- $start = isset($start) && !empty($start) ? api_get_utc_datetime(
|
|
|
|
- intval($start)
|
|
|
|
- ) : null;
|
|
|
|
- $end = isset($end) && !empty($end) ? api_get_utc_datetime(
|
|
|
|
- intval($end)
|
|
|
|
- ) : null;
|
|
|
|
|
|
+ $start = isset($start) && !empty($start) ? api_get_utc_datetime(intval($start)) : null;
|
|
|
|
+ $end = isset($end) && !empty($end) ? api_get_utc_datetime(intval($end)) : null;
|
|
|
|
|
|
if (empty($courseInfo)) {
|
|
if (empty($courseInfo)) {
|
|
return array();
|
|
return array();
|
|
@@ -1781,8 +1771,7 @@ class Agenda
|
|
}
|
|
}
|
|
$visibilityCondition = " (ip.visibility IN ('1', '0')) AND ";
|
|
$visibilityCondition = " (ip.visibility IN ('1', '0')) AND ";
|
|
} else {
|
|
} else {
|
|
- $where_condition = " ( (ip.to_user_id = ".api_get_user_id(
|
|
|
|
- )." OR ip.to_user_id IS NULL) AND ip.to_group_id IS NULL) AND ";
|
|
|
|
|
|
+ $where_condition = " ( (ip.to_user_id = ".api_get_user_id()." OR ip.to_user_id IS NULL) AND ip.to_group_id IS NULL) AND ";
|
|
}
|
|
}
|
|
|
|
|
|
if (empty($session_id)) {
|
|
if (empty($session_id)) {
|
|
@@ -1876,11 +1865,9 @@ class Agenda
|
|
get_lang('Attachment')
|
|
get_lang('Attachment')
|
|
);
|
|
);
|
|
$user_filename = $attachment['filename'];
|
|
$user_filename = $attachment['filename'];
|
|
- $url = api_get_path(
|
|
|
|
- WEB_CODE_PATH
|
|
|
|
- ).'calendar/download.php?file='.$attachment['path'].'&course_id='.$course_id.'&'.api_get_cidreq(
|
|
|
|
- );
|
|
|
|
- $event['attachment'] .= $has_attachment.Display::url(
|
|
|
|
|
|
+ $url = api_get_path(WEB_CODE_PATH).'calendar/download.php?file='.$attachment['path'].'&course_id='.$course_id.'&'.api_get_cidreq();
|
|
|
|
+ $event['attachment'] .= $has_attachment.
|
|
|
|
+ Display::url(
|
|
$user_filename,
|
|
$user_filename,
|
|
$url
|
|
$url
|
|
).'<br />';
|
|
).'<br />';
|
|
@@ -2279,16 +2266,13 @@ class Agenda
|
|
*/
|
|
*/
|
|
public function getForm($params = [])
|
|
public function getForm($params = [])
|
|
{
|
|
{
|
|
- $action = isset($params['action']) ? Security::remove_XSS(
|
|
|
|
- $params['action']
|
|
|
|
- ) : null;
|
|
|
|
|
|
+ $action = isset($params['action']) ? Security::remove_XSS($params['action']) : null;
|
|
$id = isset($params['id']) ? intval($params['id']) : null;
|
|
$id = isset($params['id']) ? intval($params['id']) : null;
|
|
|
|
+
|
|
if ($this->type == 'course') {
|
|
if ($this->type == 'course') {
|
|
- $url = api_get_self().'?'.api_get_cidreq(
|
|
|
|
- ).'&action='.$action.'&id='.$id.'&type='.$this->type;
|
|
|
|
|
|
+ $url = api_get_self().'?'.api_get_cidreq().'&action='.$action.'&id='.$id.'&type='.$this->type;
|
|
} else {
|
|
} else {
|
|
- $url = api_get_self(
|
|
|
|
- ).'?action='.$action.'&id='.$id.'&type='.$this->type;
|
|
|
|
|
|
+ $url = api_get_self().'?action='.$action.'&id='.$id.'&type='.$this->type;
|
|
}
|
|
}
|
|
|
|
|
|
$form = new FormValidator(
|
|
$form = new FormValidator(
|