Exemplo n.º 1
0
$getDateFrom = admFuncVariableIsValid($_GET, 'date_from', 'date');
$getDateTo = admFuncVariableIsValid($_GET, 'date_to', 'date');
$getViewMode = admFuncVariableIsValid($_GET, 'view_mode', 'string', array('defaultValue' => 'html', 'validValues' => array('html', 'print')));
$getView = admFuncVariableIsValid($_GET, 'view', 'string', array('defaultValue' => $gPreferences['dates_view'], 'validValues' => array('detail', 'compact', 'room', 'participants', 'description')));
// check if module is active
if ($gPreferences['enable_dates_module'] == 0) {
    // Module is not active
    $gMessage->show($gL10n->get('SYS_MODULE_DISABLED'));
} elseif ($gPreferences['enable_dates_module'] == 2) {
    // module only for valid Users
    require_once '../../system/login_valid.php';
}
// create object and get recordset of available dates
try {
    $dates = new ModuleDates();
    $dates->setParameter('mode', $getMode);
    $dates->setParameter('cat_id', $getCatId);
    $dates->setParameter('id', $getId);
    $dates->setParameter('show', $getShow);
    $dates->setParameter('view_mode', $getViewMode);
    $dates->setDateRange($getDateFrom, $getDateTo);
} catch (AdmException $e) {
    $e->showHtml();
}
if ($getCatId > 0) {
    $calendar = new TableCategory($gDb, $getCatId);
}
// Number of events each page for default view 'html' or 'compact' view
if ($gPreferences['dates_per_page'] > 0 && $getViewMode === 'html') {
    $datesPerPage = $gPreferences['dates_per_page'];
} else {
Exemplo n.º 2
0
if ($gPreferences['enable_dates_module'] == 0) {
    // Module disabled
    $gMessage->show($gL10n->get('SYS_MODULE_DISABLED'));
} elseif ($gPreferences['enable_dates_module'] == 2) {
    // only with valid login
    require_once '../../system/login_valid.php';
}
// If Ical enabled and module is public
if ($gPreferences['enable_dates_ical'] != 1) {
    $gMessage->setForwardUrl($gHomepage);
    $gMessage->show($gL10n->get('SYS_ICAL_DISABLED'));
}
// create Object
$dates = new ModuleDates();
// set mode, viewmode, calendar, startdate and enddate manually
$dates->setParameter('mode', 2);
$dates->setParameter('view_mode', 'period');
$dates->setParameter('cat_id', $getCatId);
$dates->setDaterange($startDate, $endDate);
// read events for output
$datesResult = $dates->getDataset(0, 0);
// get parameters fom $_GET Array stored in class
$parameter = $dates->getParameters();
// Headline for file name
if ($getCatId > 0) {
    $calendar = new TableCategory($gDb, $dates->getCatId());
    $getHeadline .= '_' . $calendar->getValue('cat_name');
}
$date = new TableDate($gDb);
$iCal = $date->getIcalHeader();
if ($datesResult['numResults'] > 0) {