Example #1
0
    }
    #output the day
    $datestr = date('D M j', $thisdate);
    $datearg = date('Y-m-d', $thisdate);
    $dateid = date("Mj", $thisdate);
    print "<div class=\"{$dateclass}\">";
    print '<span class="clipped">';
    print "<a class=\"date\" href=\"#\" onClick=\"return clickdate('{$datearg}', '{$dateid}')\"><strong>{$datestr}</strong>";
    if ($headline) {
        print ": {$headline}";
    }
    print '</a>';
    print '</span>';
    print "<div id=\"{$dateid}\" class=\"dateevents\">";
    if ($preload) {
        listevents($events);
    }
    print '</div>';
    print "</div>\n";
    # if today, then output JavaScript code to show today's events and
    # to scroll to today.  (We want to do this as soon as possible when
    # loading the page, since that's what the user probably wants to see.)
    if ($thisdate == $today) {
        print "<script type=\"text/javascript\">\n";
        print "clickdate('{$datearg}', '{$dateid}');\n";
        #!!! scroll!
        print "</script>\n";
    }
}
?>
<script type="text/JavaScript">
function content()
{
    global $HTTP_POST_VARS, $HTTP_GET_VARS, $list_prefix;
    $MAIN = loadadmintmplate("main");
    $CALENDAR = loadadmintmplate("calendar");
    $CONTENT = "";
    //first lets see if we are deleting an event
    if (0 == strcmp($HTTP_GET_VARS['mode'], "delete")) {
        //we are deleting this event.
        if (isset($HTTP_POST_VARS['delete_yes'])) {
            $sql = "DELETE FROM `" . $list_prefix . "calendar` WHERE `id` = '" . $HTTP_POST_VARS['deletelist'] . "';";
            $result = db_query($sql);
        } else {
            $CONTENT .= "You must check the checkbox to confirm deleting this event.<BR>\r\n";
        }
    }
    //lets see if we are adding a weekly event
    if (0 == strcmp($HTTP_GET_VARS['mode'], "dow")) {
        //we are adding a event
        $utime = usertime($HTTP_POST_VARS['hour'], $HTTP_POST_VARS['tmin'], $HTTP_POST_VARS['omin'], $HTTP_POST_VARS['$ampm']);
        $sql = "INSERT INTO `" . $list_prefix . "calendar` ( `id` , `weekly` , `monthly` , `yearly` , `date` , `time` , `description` ) VALUES ( '', '" . $HTTP_POST_VARS['dow'] . "', '', '', '', '" . $utime . "', '" . $HTTP_POST_VARS['description'] . "' );";
        $result = db_query($sql);
    }
    //lets see if we are adding a monthly event
    if (0 == strcmp($HTTP_GET_VARS['mode'], "dom")) {
        //we are adding a event
        $utime = usertime($HTTP_POST_VARS['hour'], $HTTP_POST_VARS['tmin'], $HTTP_POST_VARS['omin'], $HTTP_POST_VARS['$ampm']);
        $sql = "INSERT INTO `" . $list_prefix . "calendar` ( `id` , `weekly` , `monthly` , `yearly` , `date` , `time` , `description` ) VALUES ( '', '7', '" . $HTTP_POST_VARS['dom'] . "', '', '', '" . $utime . "', '" . $HTTP_POST_VARS['description'] . "' );";
        $result = db_query($sql);
    }
    //lets see if we are adding a yearly event
    if (0 == strcmp($HTTP_GET_VARS['mode'], "moy")) {
        //we are adding a event
        $utime = usertime($HTTP_POST_VARS['hour'], $HTTP_POST_VARS['tmin'], $HTTP_POST_VARS['omin'], $HTTP_POST_VARS['$ampm']);
        $sql = "INSERT INTO `" . $list_prefix . "calendar` ( `id` , `weekly` , `monthly` , `yearly` , `date` , `time` , `description` ) VALUES ( '', '7', '', '" . $HTTP_POST_VARS['moy'] . $HTTP_POST_VARS['domoy'] . "', '', '" . $utime . "', '" . $HTTP_POST_VARS['description'] . "' );";
        $result = db_query($sql);
    }
    //lets see if we are adding a scheduled event
    if (0 == strcmp($HTTP_GET_VARS['mode'], "norm")) {
        //we are adding a event
        $utime = usertime($HTTP_POST_VARS['hour'], $HTTP_POST_VARS['tmin'], $HTTP_POST_VARS['omin'], $HTTP_POST_VARS['$ampm']);
        $sql = "INSERT INTO `" . $list_prefix . "calendar` ( `id` , `weekly` , `monthly` , `yearly` , `date` , `time` , `description` ) VALUES ( '', '7', '', '', '" . $HTTP_POST_VARS['yearlist'] . $HTTP_POST_VARS['month'] . $HTTP_POST_VARS['day'] . "', '" . $utime . "', '" . $HTTP_POST_VARS['description'] . "' );";
        $result = db_query($sql);
    }
    //lets draw our interface now.
    $CONTENT .= insert_into_template($CALENDAR, "{DELETE_LIST}", listevents());
    $CONTENT = insert_into_template($CONTENT, "{YEARMENU}", yearmenu());
    $WORK = insert_into_template($MAIN, "{CONTENT}", $CONTENT);
    $WORK = filltemplate($WORK, "{SITENAME} Administration panel");
    printf("%s", striptemplate($WORK));
}