Exemplo n.º 1
0
$calType = array_key_exists('calFormat', $_REQUEST) && array_key_exists($_REQUEST['calFormat'], $formatList) ? $_REQUEST['calFormat'] : get_conf('calType', 'ics');
// need to be in a course
if (!claro_is_in_a_course()) {
    die('<form >cidReq = <input name="cidReq" type="text"  /><input type="submit" /></form>');
}
if (!$_course['visibility'] && !claro_is_course_allowed()) {
    if (!isset($_SERVER['PHP_AUTH_USER'])) {
        header('WWW-Authenticate: Basic realm="' . get_lang('iCal feed for %course', array('%course' => $_course['name'])) . '"');
        header('HTTP/1.0 401 Unauthorized');
        echo '<h2>' . get_lang('You need to be authenticated with your %sitename account', array('%sitename' => $siteName)) . '</h2>' . '<a href="index.php?cidReq=' . claro_get_current_course_id() . '">' . get_lang('Retry') . '</a>';
        exit;
    } else {
        if (get_magic_quotes_gpc()) {
            $_REQUEST['login'] = stripslashes($_SERVER['PHP_AUTH_USER']);
            $_REQUEST['password'] = stripslashes($_SERVER['PHP_AUTH_PW']);
        } else {
            $_REQUEST['login'] = $_SERVER['PHP_AUTH_USER'];
            $_REQUEST['password'] = $_SERVER['PHP_AUTH_PW'];
        }
        require '../inc/claro_init_local.inc.php';
        if (!$_course['visibility'] && !claro_is_course_allowed()) {
            header('WWW-Authenticate: Basic realm="' . get_lang('iCal feed for %course', array('%course' => $_course['name'])) . '"');
            header('HTTP/1.0 401 Unauthorized');
            echo '<h2>' . get_lang('You need to be authenticated with your %sitename account', array('%sitename' => $siteName)) . '</h2>' . '<a href="index.php?cidReq=' . claro_get_current_course_id() . '">' . get_lang('Retry') . '</a>';
            exit;
        }
    }
}
// OK TO SEND FEED
claro_send_file(buildICal(array(CLARO_CONTEXT_COURSE => claro_get_current_course_id()), $calType));
Exemplo n.º 2
0
        }
        // end if $submit Announcement
        if ($autoExportRefresh) {
            /**
             * in future, the 2 following calls would be pas by event manager.
             */
            // rss update
            /*if ( get_conf('enableRssInCourse',1))
              {
                  require_once get_path('incRepositorySys') . '/lib/rss.write.lib.php';
                  build_rss( array('course' => claro_get_current_course_id()));
              }*/
            // iCal update
            if (get_conf('enableICalInCourse', 1)) {
                require_once get_path('incRepositorySys') . '/lib/ical.write.lib.php';
                buildICal(array('course' => claro_get_current_course_id()));
            }
        }
    }
    // end if isset $_REQUEST['cmd']
}
// end if is_allowedToEdit
// Prepare displays
if ($displayList) {
    // list
    $announcementList = announcement_get_item_list($context);
    $bottomAnnouncement = $announcementQty = count($announcementList);
}
$displayButtonLine = (bool) $is_allowedToEdit && (empty($cmd) || $cmd != 'rqEdit' || $cmd != 'rqCreate');
// Command list
$cmdList = array();
Exemplo n.º 3
0
            $editedEvent['id'] = '';
            $editedEvent['title'] = '';
            $editedEvent['content'] = '';
            $editedEvent['date'] = time();
            $editedEvent['lastingAncient'] = false;
            $editedEvent['location'] = '';
            $nextCommand = 'exAdd';
        }
        $display_form = true;
    }
    // end if cmd == 'rqEdit' && cmd == 'rqAdd'
    if ($autoExportRefresh) {
        // ical update
        if (get_conf('enableICalInCourse', 1)) {
            require_once get_path('incRepositorySys') . '/lib/ical.write.lib.php';
            buildICal(array(CLARO_CONTEXT_COURSE => claro_get_current_course_id()));
        }
    }
}
// end id is_allowed to edit
// Display
$noQUERY_STRING = true;
$eventList = agenda_get_item_list($currentContext, $orderDirection);
// Command list
$cmdList = array();
$cmdList[] = array('name' => get_lang('Today'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '#today')));
if (count($eventList) > 0) {
    if (get_conf('enableICalInCourse')) {
        $cmdList[] = array('img' => 'calendar', 'name' => get_lang('Download'), 'url' => claro_htmlspecialchars(Url::Contextualize(get_path('url') . '/claroline/backends/ical.php')));
    }
    if ($orderDirection == 'DESC') {