Esempio n. 1
0
        if (empty($listTasks->tas_modified[$i])) {
            $last_modified = '';
        } else {
            $last_modified = (int) strtotime($listTasks->tas_modified[$i]);
        }
        $task_url = (string) $root . '/general/login.php?url=tasks/viewtask.php?id=' . $listTasks->tas_id[$i];
        $end_date = '';
        if (empty($listTasks->tas_complete_date[$i]) || $listTasks->tas_complete_date[$i] == '--') {
            $end_date = '';
        } else {
            $end_date = (int) strtotime($listTasks->tas_complete_date[$i]);
        }
        if ($listTasks->tas_milestone[$i] == 1) {
            $iCal->addToDo($title, $description, '', $start_date, $task_duration, $end_date, $percent_done, $ical_priority, $ical_status, 0, $organizer, $attendee, $categorie, $last_modified, '', '', '', '', '', 0, '', $task_url, $langDefault, '');
        } else {
            $iCal->addEvent($organizer, $start_date, $start_date + 86400, '', 0, $categorie, $description, $title, 0, $attendee, $ical_priority, 0, 1, 0, '', 0, '', '', 0, $task_url, $langDefault, '');
        }
    }
}
// now get open meetings for this login
$tmpquery = " INNER JOIN {$tableCollab['attendants']} att ON att.meeting = mee.id " . "WHERE att.member = '{$_SESSION['idSession']}' " . "AND mee.status IN(0,2,3) ORDER BY mee.date ASC";
$listMeetings = new request();
$listMeetings->openMeetings($tmpquery);
$comptListMeetings = count($listMeetings->mee_id);
// add iCal VEVENT for each open meeting, if any
if ($comptListMeetings >= 1) {
    for ($i = 0; $i < $comptListMeetings; $i++) {
        $organizer = array($listMeetings->mee_chairman_name[$i], $listMeetings->mee_chairman_email[$i]);
        if (empty($listMeetings->mee_date[$i]) || $listMeetings->mee_date[$i] == '--') {
            continue;
        } else {
Esempio n. 2
0
 * @version 3.0
 * @copyright Copyright 2006 Queen's University, MEdTech Unit
 *
 * $Id: calendars.php 1103 2010-04-05 15:20:37Z simpson $
*/
@set_time_limit(0);
@set_include_path(implode(PATH_SEPARATOR, array(dirname(__FILE__) . "/../core", dirname(__FILE__) . "/../core/includes", dirname(__FILE__) . "/../core/library", get_include_path())));
/**
 * Include the Entrada init code.
 */
require_once "init.inc.php";
require_once "Entrada/icalendar/class.ical.inc.php";
$tmp_org_id = $_GET["org"];
$PROCESSED["org_id"] = clean_input($tmp_org_id, "int");
if ($PROCESSED["org_id"]) {
    $cohorts = groups_get_active_cohorts($PROCESSED["org_id"]);
    foreach ($cohorts as $cohort) {
        $query = "\n\t\t\t\t\tSELECT a.*, c.`proxy_id`, CONCAT_WS(' ', d.`firstname`, d.`lastname`) AS `fullname`, d.`email`\n\t\t\t\t\tFROM `events` AS a\n\t\t\t\t\tLEFT JOIN `event_audience` AS b\n\t\t\t\t\tON b.`event_id` = a.`event_id`\n\t\t\t\t\tLEFT JOIN `event_contacts` AS c\n\t\t\t\t\tON c.`event_id` = a.`event_id`\n\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_data` AS d\n\t\t\t\t\tON d.`id` = c.`proxy_id`\n\t\t\t\t\tWHERE b.`audience_type` = 'cohort'\n\t\t\t\t\tAND b.`audience_value` = " . $db->qstr($cohort["group_id"]) . "\n\t\t\t\t\tAND (c.`contact_order` IS NULL OR c.`contact_order` = '0')\n\t\t\t\t\tORDER BY a.`event_start` ASC";
        $results = $db->GetAll($query);
        if ($results) {
            $ical = new iCal("-//" . html_encode($_SERVER["HTTP_HOST"]) . "//iCal" . ($cohort["group_name"] ? html_encode($cohort["group_name"]) : "") . " Learning Events Calendar MIMEDIR//EN", 1, ENTRADA_ABSOLUTE . "/calendars/", $cohort ? clean_input($cohort["group_name"], "numeric") : "all_cohorts");
            // (ProgrammID, Method (1 = Publish | 0 = Request), Download Directory)
            foreach ($results as $result) {
                $ical->addEvent(array($result["fullname"] != "" ? $result["fullname"] : "", $result["email"] ? $result["email"] : ""), (int) $result["event_start"], (int) $result["event_finish"], $result["event_location"], 1, array("Phase " . $result["event_phase"], html_encode($cohort["group_name"])), strip_tags($result["event_message"]), strip_tags($result["event_title"]), 1, array(), 5, 0, 0, 0, array(), 1, "", 0, 1, str_replace("http://", "https://", ENTRADA_URL) . "/events?id=" . (int) $result["event_id"], "en", md5((int) $result["event_id"]));
            }
            $ical->writeFile();
        }
    }
} else {
    echo "When running the calender generation cron job an invalid org_id was provided, or no org_id was provided.";
}
Esempio n. 3
0
             unset($username, $password);
         }
     }
 }
 switch ($feed_type) {
     case "calendar.ics":
     case "ics":
         require_once "Entrada/icalendar/class.ical.inc.php";
         $query = "\tSELECT a.*, CONCAT_WS(' ', b.`firstname`, b.`lastname`) AS `fullname`, b.`email`, c.*, d.`community_title`\n\t\t\t\t\t\t\tFROM `community_events` AS a\n\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_data` AS b\n\t\t\t\t\t\t\tON b.`id` = a.`proxy_id`\n\t\t\t\t\t\t\tLEFT JOIN `community_pages` AS c\n\t\t\t\t\t\t\tON c.`cpage_id` = a.`cpage_id`\n\t\t\t\t\t\t\tLEFT JOIN `communities` AS d\n\t\t\t\t\t\t\tON a.`community_id` = d.`community_id`\n\t\t\t\t\t\t\tWHERE c.`cpage_id` = " . $db->qstr($page_record["cpage_id"]) . "\n\t\t\t\t\t\t\tAND a.`event_active` = '1'\n\t\t\t\t\t\t\tAND c.`page_active` = '1'\n\t\t\t\t\t\t\tORDER BY a.`event_start` ASC";
         $results = $db->GetAll($query);
         if ($results) {
             $community_title = $results[0]["community_title"];
             $ical = new iCal("-//" . html_encode($_SERVER["HTTP_HOST"]) . "//iCal Learning Events Calendar MIMEDIR//EN", 1, ENTRADA_ABSOLUTE . "/community/feeds" . $community_url . ":" . $page_url . "/ics", str_replace(array("/", " ", "_"), "-", $community_title . "->" . $page_record["menu_title"]));
             // (ProgrammID, Method (1 = Publish | 0 = Request), Download Directory)
             foreach ($results as $result) {
                 $ical->addEvent(array($result["fullname"] != "" ? $result["fullname"] : "", $result["email"] ? $result["email"] : ""), (int) $result["event_start"], (int) $result["event_finish"], $result["event_location"], 1, array($result["community_title"]), strip_tags(str_replace("<br />", " ", $result["event_description"])), strip_tags($result["event_title"]), 1, array(), 5, 0, 0, 0, array(), date("w", (int) $result["event_start"]), "", 0, 1, str_replace("http://", "https://", COMMUNITY_URL) . $page_record["community_url"] . ":" . $page_record["page_url"] . "?id=" . (int) $result["cevent_id"], "en", "");
             }
             if (!isset($ical->output)) {
                 $ical->generateOutput();
             }
             header("Content-Disposition: inline; filename=\"" . str_replace(array("/", " ", "_"), "-", $page_record["menu_title"]) . ".ics\"");
             header("Content-Type: text/calendar");
             echo $ical->output;
         }
         break;
     case "rss":
     case "rss10":
     case "rss20":
     default:
         $query = "\tSELECT a.*, CONCAT_WS(' ', b.`firstname`, b.`lastname`) as `author_name`, b.`email`\n\t\t\t\t\t\tFROM `community_history` AS a\n\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_data` AS b\n\t\t\t\t\t\tON b.`id` = a.`proxy_id`\n\t\t\t\t\t\tWHERE a.`community_id` = " . $db->qstr($community_id) . "\n\t\t\t\t\t\tAND a.`history_display` = '1'\n\t\t\t\t\t\tORDER BY a.`history_timestamp` DESC\n\t\t\t\t\t\tLIMIT 0, 30";
         $results = $db->GetAll($query);
Esempio n. 4
0
         }
         foreach ($learning_events["events"] as $key => $event) {
             if (array_search($event["course_id"], $course_ids) !== false) {
                 unset($learning_events["events"][$key]);
             }
         }
     }
 }
 switch ($calendar_type) {
     case "ics":
         add_statistic("calendar.api", "view", "type", "ics");
         require_once "Entrada/icalendar/class.ical.inc.php";
         $ical = new iCal("-//" . html_encode($_SERVER["HTTP_HOST"]) . "//iCal " . APPLICATION_NAME . " Calendar MIMEDIR//EN", 1, ENTRADA_ABSOLUTE . "/calendars/", $user_username);
         if (!empty($learning_events["events"])) {
             foreach ($learning_events["events"] as $event) {
                 $ical->addEvent(array(), (int) $event["event_start"], (int) $event["event_finish"], $event["event_location"] ? $event["event_location"] : "To Be Announced", 1, array(), strip_tags($event["event_message"]), strip_tags($event["event_title"]), 1, array(), 5, 0, 0, 0, array(), 1, "", 0, 1, str_replace("http://", "https://", ENTRADA_URL) . "/events?id=" . (int) $event["event_id"], "en", md5((int) $event["event_id"]));
             }
         }
         $ical->outputFile();
         break;
     case "json":
     default:
         $events = array();
         if (!empty($learning_events["events"])) {
             foreach ($learning_events["events"] as $drid => $event) {
                 $cal_type = 1;
                 $cal_updated = "";
                 if ($event["audience_type"] == "proxy_id") {
                     $cal_type = 3;
                 }
                 if ((int) $event["last_visited"] && (int) $event["last_visited"] < (int) $event["updated_date"]) {
Esempio n. 5
0
             }
             if ($item->getDateTime_start() == $item->getDateTime_end()) {
                 if (strstr($item->getDateTime_start(), "00:00:00")) {
                     $starttime = $starttime + 24 * 3600;
                 }
                 $endtime = 'allday';
             } elseif (strstr($item->getDateTime_start(), "00:00:00") and strstr($item->getDateTime_end(), "00:00:00")) {
                 $starttime = $starttime + 24 * 3600;
                 $endtime = $endtime + 24 * 3600;
             } elseif (strstr($item->getDateTime_start(), "00:00:00")) {
                 $starttime = $starttime + 24 * 3600;
                 $endtime = $endtime + 24 * 3600;
             }
             ### for thunderbird 3 and lightning 1.0b1 ###
             if ($starttime != '-1' and $endtime != '-1') {
                 $iCal->addEvent($organizer, $starttime, $endtime, $item->getPlace(), 1, $categories, html_entity_decode(strip_tags($item->getDescription()), ENT_NOQUOTES, 'UTF-8'), $title, 1, $attendee_array, 5, 0, 0, 0, array(), 1, '', $alarm, 1, $path . $c_single_entry_point . '?cid=' . $_GET['cid'] . '&mod=date&fct=detail&iid=' . $item->getItemID(), $language, $item->getItemID());
             }
         }
         $item = $item_list->getNext();
     }
     if ($current_module == CS_DATE_TYPE) {
         $dateiname = $translator->getMessage('DATES_EXPORT_FILENAME') . '_' . $_GET['cid'];
     } elseif ($current_module == CS_TODO_TYPE) {
         $dateiname = $translator->getMessage('TODO_EXPORT_FILENAME') . '_' . $_GET['cid'];
     }
     #echo $iCal->getOutput();
     $iCal->outputFile($dateiname);
     # logging
     include_once 'include/inc_log.php';
 } else {
     include_once 'etc/cs_constants.php';