[svn r14734] upcoming event

skala
Patrick Cool 17 years ago
parent a6a74222e4
commit 34da4017de
  1. 70
      main/calendar/agenda.inc.php
  2. 11
      main/calendar/agenda.php

@ -1,4 +1,4 @@
<?php //$Id: agenda.inc.php 14723 2008-04-02 15:29:06Z yannoo $
<?php //$Id: agenda.inc.php 14734 2008-04-03 08:05:10Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -2380,4 +2380,72 @@ function get_agendaitems($month, $year)
}
return $agendaitems;
}
function display_upcoming_events()
{
echo '<b>'.get_lang('UpcomingEvent').'</b><br />';
$number_of_items_to_show = (int)api_get_setting('number_of_upcoming_events');
//databases of the courses
$TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA);
$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$group_memberships = GroupManager :: get_group_ids($array_course_info["db"], $_user['user_id']);
// if the user is administrator of that course we show all the agenda items
if (api_is_allowed_to_edit())
{
//echo "course admin";
$sqlquery = "SELECT
DISTINCT agenda.*, item_property.*
FROM ".$TABLEAGENDA." agenda,
".$TABLE_ITEMPROPERTY." item_property
WHERE agenda.id = item_property.ref ".$show_all_current."
AND item_property.tool='".TOOL_CALENDAR_EVENT."'
AND item_property.visibility='1'
AND agenda.start_date > NOW()
GROUP BY agenda.id
ORDER BY start_date ".$sort;
}
// if the user is not an administrator of that course
else
{
//echo "GEEN course admin";
if (is_array($group_memberships))
{
$sqlquery = "SELECT
agenda.*, item_property.*
FROM ".$TABLEAGENDA." agenda,
".$TABLE_ITEMPROPERTY." item_property
WHERE agenda.id = item_property.ref ".$show_all_current."
AND item_property.tool='".TOOL_CALENDAR_EVENT."'
AND ( item_property.to_user_id='".$_user['user_id']."' OR item_property.to_group_id IN (0, ".implode(", ", $group_memberships).") )
AND item_property.visibility='1'
AND agenda.start_date > NOW()
ORDER BY start_date ".$sort;
}
else
{
$sqlquery = "SELECT
agenda.*, item_property.*
FROM ".$TABLEAGENDA." agenda,
".$TABLE_ITEMPROPERTY." item_property
WHERE agenda.id = item_property.ref ".$show_all_current."
AND item_property.tool='".TOOL_CALENDAR_EVENT."'
AND ( item_property.to_user_id='".$_user['user_id']."' OR item_property.to_group_id='0')
AND item_property.visibility='1'
AND agenda.start_date > NOW()
ORDER BY start_date ".$sort;
}
}
$result = api_sql_query($sqlquery, __FILE__, __LINE__);
$counter = 0;
while ($item = mysql_fetch_assoc($result))
{
if ($counter < $number_of_items_to_show)
{
echo $item['start_date'].' - '.$item['title'].'<br />';
$counter++;
}
}
}
?>

@ -1,4 +1,4 @@
<?php //$Id: agenda.php 14721 2008-04-02 11:19:08Z pcool $
<?php //$Id: agenda.php 14734 2008-04-03 08:05:10Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -260,7 +260,14 @@ if ($_GET['origin']!='learnpath')
// the small calendar
$MonthName = $MonthsLong[$select_month -1];
$agenda_items=get_calendar_items($select_month,$select_year);
display_minimonthcalendar($agenda_items, $select_month,$select_year, $MonthName);
if (api_get_setting('display_mini_month_calendar') == 'true')
{
display_minimonthcalendar($agenda_items, $select_month,$select_year, $MonthName);
}
if (api_get_setting('display_upcoming_events') == 'true')
{
display_upcoming_events();
}
// the links for adding, filtering, showall, ...
echo '<ul id="agenda_select">';
if (is_allowed_to_edit() OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))

Loading…
Cancel
Save