当前位置: 首页>>代码示例>>PHP>>正文


PHP vcalendar::createCalendar方法代码示例

本文整理汇总了PHP中vcalendar::createCalendar方法的典型用法代码示例。如果您正苦于以下问题:PHP vcalendar::createCalendar方法的具体用法?PHP vcalendar::createCalendar怎么用?PHP vcalendar::createCalendar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vcalendar的用法示例。


在下文中一共展示了vcalendar::createCalendar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ical

 public function ical($params)
 {
     $this->setView('ical.php');
     $official = isset($params['official']);
     $group_name = isset($params['group']) ? $params['group'] : null;
     $event_model = new Event_Model();
     $events = $event_model->getUpcoming($group_name, $official, false);
     // Creation of the iCal content
     $cache_entry = 'ical-' . (isset($group_name) ? $group_name : '') . '-' . ($official ? 'official' : 'non-official');
     $content = Cache::read($cache_entry);
     if (!$content) {
         require_once APP_DIR . 'classes/class.iCalcreator.php';
         $cal = new vcalendar();
         $cal->setConfig('unique_id', $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
         $cal->setProperty('method', 'PUBLISH');
         $cal->setProperty('x-wr-calname', $official ? __('EVENTS_TITLE_OFFICIAL') : __('EVENTS_TITLE_NONOFFICIAL'));
         $cal->setProperty('X-WR-CALDESC', '');
         $cal->setProperty('X-WR-TIMEZONE', date('e'));
         foreach ($events as $event) {
             $vevent = new vevent();
             $vevent->setProperty('dtstart', array('year' => (int) date('Y', $event['date_start']), 'month' => (int) date('n', $event['date_start']), 'day' => (int) date('j', $event['date_start']), 'hour' => (int) date('G', $event['date_start']), 'min' => (int) date('i', $event['date_start']), 'sec' => (int) date('s', $event['date_start'])));
             $vevent->setProperty('dtend', array('year' => (int) date('Y', $event['date_end']), 'month' => (int) date('n', $event['date_end']), 'day' => (int) date('j', $event['date_end']), 'hour' => (int) date('G', $event['date_end']), 'min' => (int) date('i', $event['date_end']), 'sec' => (int) date('s', $event['date_end'])));
             $vevent->setProperty('summary', $event['title']);
             $vevent->setProperty('description', $event['message']);
             $cal->setComponent($vevent);
         }
         $content = $cal->createCalendar();
         Cache::write($cache_entry, $content, 2 * 3600);
     }
     $this->set('content', $content);
 }
开发者ID:hugonicolas,项目名称:Site,代码行数:31,代码来源:Event.php

示例2: row2array

 private static function row2array($row, $timezone, $hostname, $uid, $namespace_id)
 {
     $v = new vcalendar();
     $v->setConfig('unique_id', $hostname);
     $v->setProperty('method', 'PUBLISH');
     $v->setProperty("x-wr-calname", "AnimexxCal");
     $v->setProperty("X-WR-CALDESC", "Animexx Calendar");
     $v->setProperty("X-WR-TIMEZONE", $timezone);
     if ($row["adjust"]) {
         $start = datetime_convert('UTC', date_default_timezone_get(), $row["start"]);
         $finish = datetime_convert('UTC', date_default_timezone_get(), $row["finish"]);
     } else {
         $start = $row["start"];
         $finish = $row["finish"];
     }
     $allday = strpos($start, "00:00:00") !== false && strpos($finish, "00:00:00") !== false;
     /*
     
     if ($allday) {
     	$dat = Datetime::createFromFormat("Y-m-d H:i:s", $finish_tmp);
     	$dat->sub(new DateInterval("P1D"));
     	$finish = datetime_convert("UTC", date_default_timezone_get(), $dat->format("Y-m-d H:i:s"));
     	var_dump($finish);
     }
     */
     $subject = substr(preg_replace("/\\[[^\\]]*\\]/", "", $row["desc"]), 0, 100);
     $description = preg_replace("/\\[[^\\]]*\\]/", "", $row["desc"]);
     $vevent = dav_create_vevent(wdcal_mySql2icalTime($row["start"]), wdcal_mySql2icalTime($row["finish"]), false);
     $vevent->setLocation(icalendar_sanitize_string($row["location"]));
     $vevent->setSummary(icalendar_sanitize_string($subject));
     $vevent->setDescription(icalendar_sanitize_string($description));
     $v->setComponent($vevent);
     $ical = $v->createCalendar();
     return array("uid" => $uid, "namespace" => CALDAV_NAMESPACE_FRIENDICA_NATIVE, "namespace_id" => $namespace_id, "date" => $row["edited"], "data_uri" => "friendica-" . $namespace_id . "-" . $row["id"] . "@" . $hostname, "data_subject" => $subject, "data_location" => $row["location"], "data_description" => $description, "data_start" => $start, "data_end" => $finish, "data_allday" => $allday, "data_type" => $row["type"], "ical" => $ical, "ical_size" => strlen($ical), "ical_etag" => md5($ical));
 }
开发者ID:robhell,项目名称:friendica-addons,代码行数:35,代码来源:virtual_cal_source_friendica.inc.php

示例3: display

 function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     $option = JRequest::getCmd('option');
     $model = $this->getModel();
     $results = $model->getResults(JRequest::getVar('p', 0, '', 'int'));
     $project = $model->getProject(JRequest::getVar('p', 0, '', 'int'));
     $document = JFactory::getDocument();
     $v = new vcalendar();
     // initiate new CALENDAR
     $v->setConfig('project' . $project->id, $mainframe->getCfg('live_site'));
     // config with site domain
     $v->setProperty('X-WR-CALNAME', $project->name);
     // set some X-properties, name, content.. .
     $v->setProperty('X-WR-CALDESC', JText::_('COM_TRACKS_Project_calendar'));
     $v->setConfig("filename", 'project_' . $project->id . '.ics');
     foreach ((array) $results as $result) {
         if (!ereg('([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})', $result->start_date, $start_date)) {
             continue;
         }
         $e = new vevent();
         // initiate a new EVENT
         $e->setProperty('categories', $project->name);
         // catagorize
         $e->setProperty('dtstart', $start_date[1], $start_date[2], $start_date[3], $start_date[4], $start_date[5], $start_date[6]);
         if (ereg('([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})', $result->end_date, $end_date)) {
             $e->setProperty('dtend', $end_date[1], $end_date[2], $end_date[3], $end_date[4], $end_date[5], $end_date[6]);
         }
         $description = array();
         $description[] = $result->round_name;
         if ($result->winner && $result->winner->last_name) {
             $winner = JText::_('COM_TRACKS_Winner') . $result->winner->first_name . ' ' . $result->winner->last_name;
             if ($result->winner->team_name) {
                 $winner .= ' (' . $result->winner->team_name . ')';
             }
             $description[] = $winner;
         }
         $description = implode('\\n', $description);
         $e->setProperty('description', $description);
         // describe the event
         $e->setProperty('location', $result->round_name);
         // locate the event
         $v->addComponent($e);
         // add component to calendar
     }
     /* alt. production */
     // $v->returnCalendar();                       // generate and redirect output to user browser
     /* alt. dev. and test */
     $str = $v->createCalendar();
     // generate and get output in string, for testing?
     //      echo $str;return;
     $v->returnCalendar();
 }
开发者ID:julienV,项目名称:Joomla-Tracks,代码行数:53,代码来源:view.ical.php

示例4: onPreInit

 public function onPreInit($param)
 {
     if (isset($_GET['idtm_termin'])) {
         $TerminRecord = TerminRecord::finder()->findByPK($_GET['idtm_termin']);
     } else {
         echo "Kein Termin";
         exit;
     }
     date_default_timezone_set('Europe/Berlin');
     $v = new vcalendar();
     // initiate new CALENDAR
     $v->setConfig('pliq_hpartner', 'planlogiq.com');
     // config with site domain
     $e = new vevent();
     // initiate a new EVENT
     $SDateArray = explode('-', $TerminRecord->ter_startdate);
     $EDateArray = explode('-', $TerminRecord->ter_enddate);
     $STimeArray = explode(':', $TerminRecord->ter_starttime);
     $ETimeArray = explode(':', $TerminRecord->ter_endtime);
     $e->setProperty('categories', ActivityRecord::finder()->findByPK($TerminRecord->idtm_activity)->act_name);
     // catagorize
     $e->setProperty('dtstart', $SDateArray[0], $SDateArray[1], $SDateArray[2], $STimeArray[0], $STimeArray[1], 00);
     // 24 dec 2006 19.30
     $e->setProperty('dtend', $EDateArray[0], $EDateArray[1], $EDateArray[2], $ETimeArray[0], $ETimeArray[1], 00);
     // 24 dec 2006 19.30
     //$e->setProperty( 'duration'
     //               , 0, 0, 3 );                    // 3 hours
     $e->setProperty('summary', $TerminRecord->ter_betreff);
     // describe the event
     $e->setProperty('description', $TerminRecord->ter_descr);
     // describe the event
     $e->setProperty('location', $TerminRecord->ter_ort);
     // locate the event
     $v->addComponent($e);
     // add component to calendar
     /* alt. production */
     // $v->returnCalendar();                       // generate and redirect output to user browser
     /* alt. dev. and test */
     $str = $v->createCalendar();
     // generate and get output in string, for testing?
     $this->getResponse()->appendHeader("Content-Type:" . $this->header);
     $this->getResponse()->appendHeader("Content-Disposition:inline;filename=" . $this->docName . '.' . $this->ext);
     echo $str;
     $writer->save('php://output');
     exit;
 }
开发者ID:quantrocket,项目名称:planlogiq,代码行数:46,代码来源:PFCalendarEntry.php

示例5: createCalendar

 /**
  * Create calendar
  * Adds timezone component, when not already done
  *
  * @see http://kigkonsult.se/iCalcreator/docs/using.html#createTimezone
  *
  * @return string
  */
 public function createCalendar()
 {
     // add timezone component
     if ($this->timezone && $this->getComponent('VTIMEZONE') === false) {
         $xprops = array('X-LIC-LOCATION' => $this->timezone);
         \iCalUtilityFunctions::createTimezone($this, $this->timezone, $xprops);
     }
     return parent::createCalendar();
 }
开发者ID:dyvelop,项目名称:icalcreator-bundle,代码行数:17,代码来源:Calendar.php

示例6: vcalendar

    }
} else {
    $calendar = new vcalendar();
    $calsql = $data->select_query("calendar_items", "WHERE allowed = 1 AND trash=0");
    while ($temp = $data->fetch_array($calsql)) {
        $groups = unserialize($temp['groups']);
        if (is_array($groups)) {
            $allowed = in_group($groups);
        } else {
            $allowed = true;
        }
        if ($allowed) {
            $e = new vevent();
            $e->setProperty('categories', $config['troopname'] . " Calendar");
            $date = getdate($temp['startdate']);
            $e->setProperty('dtstart', $date['year'], $date['mon'], $date['mday'], $date['hours'], $date['minutes'], 00);
            $date = getdate($temp['enddate']);
            $e->setProperty('dtend', $date['year'], $date['mon'], $date['mday'], $date['hours'], $date['minutes'], 00);
            $e->setProperty('summary', censor($temp['summary']));
            $e->setProperty('description', $temp['detail'] != NULL ? truncate(strip_tags(censor($temp['detail']))) : "No details");
            $calendar->addComponent($e);
        }
    }
    header('Content-type: text/calendar');
    header('Content-Disposition: attachment; filename="calendar.ics"');
    echo $calendar->createCalendar();
    exit;
}
$tpl->assign("show_detail", $show_detail);
$pagename = "Calender";
$dbpage = true;
开发者ID:burak-tekin,项目名称:CMScout2,代码行数:31,代码来源:calender.php

示例7: array

                $vevent->setProperty("dtstart", array("year" => $dateArr[0], "month" => $dateArr[1], "day" => $dateArr[2], "hour" => $startTimeTrans[$os->startTime][0], "min" => $startTimeTrans[$os->startTime][1], "sec" => 0));
                $vevent->setProperty("dtend", array("year" => $dateArr[0], "month" => $dateArr[1], "day" => $dateArr[2], "hour" => $endTimeTrans[$os->startTime][0], "min" => $endTimeTrans[$os->startTime + $os->durationTime - 1][1], "sec" => 0));
                $vevent->setProperty("LOCATION", $os->location);
                // property name - case independent
                $vevent->setProperty("summary", $o->name);
                $vevent->setProperty("description", $o->tutor);
                if (count($os->week) > 1) {
                    // Set recurrence rule
                    $endWeek = $os->week[count($os->week) - 1];
                    $iWeek = $os->week[0];
                    $weekdayTrans = array('', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU');
                    $vevent->setProperty("RRULE", array("FREQ" => "WEEKLY", "COUNT" => $endWeek - $iWeek + 1, "INTERVAL" => 1, "WKST" => $weekdayTrans[$os->day]));
                    for (; $iWeek < $endWeek; $iWeek++) {
                        if (!in_array($iWeek, $os->week)) {
                            $dateArr = $school->getSchoolCalendar2Date($tables[0]['year'], $tables[0]['term'], $iWeek, $os->day);
                            $vevent->setProperty("EXDATE", array(array($dateArr[0], $dateArr[1], $dateArr[2], $startTimeTrans[$os->startTime][0], $startTimeTrans[$os->startTime][1], 0)));
                        }
                    }
                }
                //$schedArr[$os->day][$os->startTime][] = $os;
            }
        }
    }
    $preData = $v->createCalendar();
    include 'showdata.inc.php';
    include 'footer.inc.php';
    exit;
}
include 'header.inc.php';
include 'login.inc.php';
include 'footer.inc.php';
开发者ID:phy25,项目名称:bPlanner,代码行数:31,代码来源:index.php

示例8: addItem

 /**
  * @param array $start
  * @param array $end
  * @param string $subject
  * @param bool $allday
  * @param string $description
  * @param string $location
  * @param null $color
  * @param string $timezone
  * @param bool $notification
  * @param null $notification_type
  * @param null $notification_value
  * @return array|string
  */
 public function addItem($start, $end, $subject, $allday = false, $description = "", $location = "", $color = null, $timezone = "", $notification = true, $notification_type = null, $notification_value = null)
 {
     $a = get_app();
     $v = new vcalendar();
     $v->setConfig('unique_id', $a->get_hostname());
     $v->setProperty('method', 'PUBLISH');
     $v->setProperty("x-wr-calname", "AnimexxCal");
     $v->setProperty("X-WR-CALDESC", "Animexx Calendar");
     $v->setProperty("X-WR-TIMEZONE", $a->timezone);
     $vevent = dav_create_vevent($start, $end, $allday);
     $vevent->setLocation(icalendar_sanitize_string($location));
     $vevent->setSummary(icalendar_sanitize_string($subject));
     $vevent->setDescription(icalendar_sanitize_string($description));
     if (!is_null($color) && $color >= 0) {
         $vevent->setProperty("X-ANIMEXX-COLOR", $color);
     }
     if ($notification && $notification_type == null) {
         if ($allday) {
             $notification_type = "hour";
             $notification_value = 24;
         } else {
             $notification_type = "minute";
             $notification_value = 60;
         }
     }
     if ($notification) {
         $valarm = new valarm();
         $valarm->setTrigger($notification_type == "year" ? $notification_value : 0, $notification_type == "month" ? $notification_value : 0, $notification_type == "day" ? $notification_value : 0, $notification_type == "week" ? $notification_value : 0, $notification_type == "hour" ? $notification_value : 0, $notification_type == "minute" ? $notification_value : 0, $notification_type == "second" ? $notification_value : 0, true, $notification_value > 0);
         $valarm->setAction("DISPLAY");
         $valarm->setDescription($subject);
         $vevent->setComponent($valarm);
     }
     $v->setComponent($vevent);
     $ical = $v->createCalendar();
     $obj_id = trim($vevent->getProperty("UID"));
     $calendarBackend = new Sabre_CalDAV_Backend_Std();
     $calendarBackend->createCalendarObject($this->getNamespace() . "-" . $this->namespace_id, $obj_id . ".ics", $ical);
     return $obj_id . ".ics";
 }
开发者ID:robhell,项目名称:friendica-addons,代码行数:53,代码来源:wdcal_cal_source_private.inc.php

示例9: get

    $data = get($url, -1);
    if ($data != "") {
        preg_match("/(<h2>.*?)<h2>/s", $data, $matches);
        $data = $matches[1];
        $lines = explode("\n", $data, 2);
        $title = strip_tags($lines[0]);
        #print "Title: $title\n";
        $vevent->setProperty("SUMMARY", $title);
        preg_match("/When:<\\/dt><dd>([^<]+)<\\/dd>/", $data, $matches);
        $when = explode(",", $matches[1]);
        $time = strptime($when[1], "%e %B %Y");
        $times = explode("-", $when[0]);
        $start = $vevent->getProperty('DTSTART');
        $start['tz'] = $tzid;
        $vevent->setProperty('DTSTART', $start);
        $end = $vevent->getProperty('DTEND');
        $end['tz'] = $tzid;
        $vevent->setProperty('DTEND', $end);
        $content = trim(substr(strstr($data, "</dl>"), 5));
        $content .= "\n{$url}\n";
        #print $content."\n";
        $vevent->setProperty('description', $content);
    }
    $loc = $vevent->getProperty("location");
    if ($loc == "Limehouse town hall") {
        $vevent->setProperty("location", "Limehouse Town Hall, 646 Commercial Road London, E14 7HA, United Kingdom");
    }
    $out->addComponent($vevent);
}
print $out->createCalendar();
开发者ID:palfrey,项目名称:calendars,代码行数:30,代码来源:dorkbot.php

示例10: csv2iCal


//.........这里部分代码省略.........
                         }
                         if ('X-' == substr($propName, 0, 2) || in_array($propName, array('CATEGORIES', 'COMMENT', 'CONTACT', 'DESCRIPTION', 'LOCATION', 'RESOURCES', 'SUMMARY'))) {
                             $val = str_replace(',', '\\,', $val);
                             if (FALSE !== ($pos = strpos($del . $val, ':'))) {
                                 while (FALSE !== ($pos2 = strpos($val, ';', $pos + 1))) {
                                     $val = substr($val, 0, $pos2) . '\\;' . substr($val, $pos2 + 1);
                                     if ($this->log) {
                                         $this->log->log("pos={$pos} pos2={$pos2} val='{$val}'", PEAR_LOG_DEBUG);
                                     }
                                     $pos = $pos2 + 1;
                                 }
                             }
                         }
                         if (FALSE === $actcomp->parse("{$propName}{$del}{$val}")) {
                             if ($this->log) {
                                 $this->log->log("ERROR 13, INPUT FILE:'{$inputdirFile}' iCalcreator: parse error: '{$propName}{$del}{$val}'", PEAR_LOG_ERR);
                             }
                         } elseif ($this->log) {
                             $this->log->log("iCalcreator->parse( '{$propName}{$del}{$val}' )", PEAR_LOG_DEBUG);
                         }
                     }
                     // end foreach( $value as $val
                 }
                 // end if( isset( $rows[$row][$col]
             }
             // end foreach( $proporder
         }
         // end for( $row = $actrow;
         if ($comp && $subcomp) {
             $comp->setComponent($subcomp);
         }
         if ($comp) {
             $calendar->setComponent($comp);
         }
     }
     $save = $this->getConfig('save');
     if ($this->log) {
         $timeexec['exit'] = microtime(TRUE);
         $msg = "INPUT '{$inputdirFile}'";
         $msg .= ' fileOk:' . number_format($timeexec['fileOk'] - $timeexec['start'], 5);
         $msg .= ' infoOk:' . number_format($timeexec['infoOk'] - $timeexec['fileOk'], 5);
         $msg .= ' zoneOk:' . number_format($timeexec['zoneOk'] - $timeexec['infoOk'], 5);
         $msg .= ' compOk:' . number_format($timeexec['exit'] - $timeexec['zoneOk'], 5);
         $msg .= ' total:' . number_format($timeexec['exit'] - $timeexec['start'], 5) . ' sec';
         $this->log->log($msg, PEAR_LOG_DEBUG);
         $msg = "'{$inputdirFile}' (" . $cntprops . ' components) start:' . date('H:i:s', $timeexec['start']);
         $msg .= ' total:' . number_format($timeexec['exit'] - $timeexec['start'], 5) . ' sec';
         if ($save) {
             $msg .= " -> '{$outputdirFile}'";
         }
         $this->log->log($msg, PEAR_LOG_NOTICE);
     }
     /** return calendar, save or send the file */
     if ($this->getConfig('outputobj')) {
         if ($this->log) {
             $this->log->log("INPUT FILE:'{$inputdirFile}' returning iCalcreator vcalendar instance", PEAR_LOG_NOTICE);
             $this->log->flush();
         }
         return $calendar;
         exit;
     }
     $d = $calendar->getConfig('directory');
     $f = $calendar->getConfig('filename');
     $df = $d . DIRECTORY_SEPARATOR . $f;
     if ($save) {
         if (FALSE !== $calendar->saveCalendar()) {
             if ($this->log) {
                 $this->log->log("INPUT FILE:'{$inputdirFile}' saved '{$df}'", PEAR_LOG_NOTICE);
                 $this->log->flush();
             }
             return TRUE;
         } else {
             // ??
             if ($this->log) {
                 $this->log->log("ERROR 16, INPUT FILE:'{$inputdirFile}' can't write to output file : '{$df}'", PEAR_LOG_ERR);
                 $this->log->flush();
             }
             return FALSE;
         }
     } else {
         if ($this->log) {
             $this->log->log("INPUT FILE:'{$inputdirFile}' returning : '{$f}'", PEAR_LOG_NOTICE);
             $this->log->flush();
         }
         $output = $calendar->createCalendar();
         $filesize = strlen($output);
         if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
             $output = gzencode($output, 9);
             $filesize = strlen($output);
             header('Content-Encoding: gzip');
             header('Vary: *');
         }
         header('Content-Type: text/calendar; charset=utf-8');
         header("Content-Disposition: attachment; filename='{$f}'");
         header('Cache-Control: max-age=10');
         header('Content-Length: ' . $filesize);
         echo $output;
     }
     return TRUE;
 }
开发者ID:andyUA,项目名称:kabmin-new,代码行数:101,代码来源:iCalcnv.class.php

示例11: vcalendar


//.........这里部分代码省略.........
             foreach ($html->find('div.content') as $d) {
                 $div = $d;
             }
             foreach ($div->find('span.module') as $m) {
                 $module = $m->innertext;
             }
             foreach ($div->find('span.title') as $tl) {
                 $title = $tl->innertext;
             }
             foreach ($div->find('span.content') as $c) {
                 $content = $c->innertext;
             }
             unset($html);
             unset($div);
             $summary = $module . $title . $content;
             $ac->setProperty('summary', $summary);
             // SUMMARY
             $ac->setProperty('sequence', 0);
             $ac->setProperty('status', 'CONFIRMED');
             // STATUS
             $ac->setProperty('transp', 'TRANSPARENT');
             // TRANSPARENCY
         }
         //GET THE TESTS FOR THIS COURSE
         $tests = $testsmod->extend_date($row[0]);
         foreach ($tests as $test) {
             // get the dates
             $test_start_unix_ts = $test[0]['unixts'];
             $test_end_unix_ts = $test[1]['unixts'];
             $ts =& $v->newComponent('vevent');
             // initiate TEST_START event
             $ts->setProperty('dtstart', date("Y", $test_start_unix_ts), date("n", $test_start_unix_ts), date("j", $test_start_unix_ts), date("G", $test_start_unix_ts), date("m", $test_start_unix_ts), date("i", $test_start_unix_ts));
             // TEST_START DTSTART
             $ts->setProperty('dtend', date("Y", $test_start_unix_ts), date("n", $test_start_unix_ts), date("j", $test_start_unix_ts), date("G", $test_start_unix_ts), date("m", $test_start_unix_ts), date("i", $test_start_unix_ts));
             // TEST_START DTEND
             $ts->setProperty('dtstamp', date("Y"), date("n"), date("j"), date("G"), date("m"), date("i"));
             // CALENDAR TS
             //parse the html content to get the summary
             $html = str_get_html($test[0]['content']);
             foreach ($html->find('div.content') as $d) {
                 $div = $d;
             }
             foreach ($div->find('span.module') as $m) {
                 $module = $m->innertext;
             }
             foreach ($div->find('span.title') as $tl) {
                 $title = $tl->innertext;
             }
             foreach ($div->find('span.content') as $c) {
                 $content = $c->innertext;
             }
             unset($html);
             unset($div);
             $summary = $module . $title . $content;
             $ts->setProperty('summary', $summary);
             // SUMMARY
             $ts->setProperty('sequence', 0);
             // SEQUENCE NUMBER
             $ts->setProperty('status', 'CONFIRMED');
             // STATUS
             $ts->setProperty('transp', 'TRANSPARENT');
             // TRANSPARENCY
             $te =& $v->newComponent('vevent');
             // initiate TEST_END EVENT
             $te->setProperty('dtstart', date("Y", $test_end_unix_ts), date("n", $test_end_unix_ts), date("j", $test_end_unix_ts), date("G", $test_end_unix_ts), date("m", $test_end_unix_ts), date("i", $test_end_unix_ts));
             // TEST_END DTSTART
             $te->setProperty('dtend', date("Y", $test_end_unix_ts), date("n", $test_end_unix_ts), date("j", $test_end_unix_ts), date("G", $test_end_unix_ts), date("m", $test_end_unix_ts), date("i", $test_end_unix_ts));
             // TEST_END DTEND
             $te->setProperty('dtstamp', date("Y"), date("n"), date("j"), date("G"), date("m"), date("i"));
             // CALENDAR TS
             //parse the html content to get the summary
             $html = str_get_html($test[1]['content']);
             foreach ($html->find('div.content') as $d) {
                 $div = $d;
             }
             foreach ($div->find('span.module') as $m) {
                 $module = $m->innertext;
             }
             foreach ($div->find('span.title') as $tl) {
                 $title = $tl->innertext;
             }
             foreach ($div->find('span.content') as $c) {
                 $content = $c->innertext;
             }
             unset($html);
             unset($div);
             $summary = $module . $title . $content;
             $te->setProperty('summary', $summary);
             // SUMMARY
             $te->setProperty('sequence', 0);
             // SEQUENCE NUMBER
             $te->setProperty('status', 'CONFIRMED');
             // STATUS
             $te->setProperty('transp', 'TRANSPARENT');
             // TRANSPARENCY
         }
     }
     $str = $v->createCalendar();
     return $str;
 }
开发者ID:laiello,项目名称:atutor-calendar,代码行数:101,代码来源:CalExport.class.php

示例12: answerInvitation

 /**
  * @param string $iCal
  * @param string $myEmail
  * @param int $answer possible values: accept: 1, maybe: 2, decline: 3
  */
 public static function answerInvitation(string $iCal, string $myEmail, int $answer)
 {
     if ($answer == "1") {
         $text = "akzeptiert";
     }
     if ($answer == "2") {
         $text = "vorläufig akzeptiert";
     }
     if ($answer == "3") {
         $text = "abgelehnt";
     }
     $VC = new vcalendar();
     $VC->parse($iCal);
     $event = $VC->getComponent("vevent");
     $targetAttendee = "MAILTO:" . $myEmail;
     $i = 1;
     while ($valueOccur = $event->getProperty("ATTENDEE", $i, true)) {
         if (stripos($valueOccur["value"], $targetAttendee) === false) {
             $i++;
             continue;
         }
         $params = $valueOccur["params"];
         if ($answer == "1") {
             $params["PARTSTAT"] = "ACCEPTED";
         }
         if ($answer == "2") {
             $params["PARTSTAT"] = "TENTATIVE";
         }
         if ($answer == "3") {
             $params["PARTSTAT"] = "DECLINED";
         }
         if (isset($params["RSVP"])) {
             unset($params["RSVP"]);
         }
         $event->setAttendee($targetAttendee, $params, $i);
         $i++;
     }
     $i = 1;
     while ($valueOccur = $event->getProperty("ATTENDEE", $i, true)) {
         if (stripos($valueOccur["value"], $targetAttendee) === false) {
             $i++;
             $event->deleteProperty("ATTENDEE");
             continue;
         }
         $i++;
     }
     $event->setProperty("DTSTAMP", gmdate("Ymd") . "T" . gmdate("His") . "Z");
     $event->setProperty("LAST-MODIFIED", gmdate("Ymd") . "T" . gmdate("His") . "Z");
     $VC->deleteComponent("vevent");
     $VC->setComponent($event);
     $VC->setMethod("REPLY");
     $ics = $VC->createCalendar();
     $fromName = Session::currentUser()->A("name");
     $from = Session::currentUser()->A("UserEmail");
     $mail = new htmlMimeMail5();
     $mail->setFrom(utf8_decode($fromName . " <" . $from . ">"));
     if (!ini_get('safe_mode')) {
         $mail->setReturnPath($from);
     }
     $mail->setSubject(utf8_decode("Antwort Termineinladung (" . ucfirst($text) . "): " . $event->getProperty("SUMMARY")));
     $mail->addAttachment(new stringAttachment($ics, "invite.ics", 'application/ics'));
     $mail->setCalendar($ics, "REPLY");
     $mail->setCalendarCharset("UTF-8");
     $mail->setTextCharset("UTF-8");
     $mail->setText("{$fromName} hat diesen Termin {$text}");
     $organizer = str_replace("MAILTO:", "", $event->getProperty("ORGANIZER"));
     return $mail->send(array($organizer));
 }
开发者ID:nemiah,项目名称:trinityDB,代码行数:73,代码来源:iCalUtil.class.php

示例13: explode

$v->setConfig('filename', "danaevents-" . $v->getConfig('filename'));
$v->setXprop("X-WR-CALNAME", $data['title']);
$v->setXprop("X-WR-CALDESC", $data['description']);
foreach ($data['items'] as $item) {
    $lines = explode("\n", $item['description']);
    //<p>28/05/2008, 19:00 - 20:30</p>
    //print $lines[count($lines)-1];
    preg_match("/(\\d+)\\/(\\d+)\\/(\\d+), (\\d+):(\\d+) - (\\d+):(\\d+)/", $lines[count($lines) - 1], $matches);
    //print_r($matches);
    //exit;
    $vevent = new vevent();
    // create an event calendar component
    $vevent->setProperty('dtstart', array('year' => $matches[3], 'month' => $matches[2], 'day' => $matches[1], 'hour' => $matches[4], 'min' => $matches[5], 'sec' => 0));
    $vevent->setProperty('dtend', array('year' => $matches[3], 'month' => $matches[2], 'day' => $matches[1], 'hour' => $matches[6], 'min' => $matches[7], 'sec' => 0));
    $vevent->setProperty('LOCATION', '165 Queen\'s Gate, South Kensington, London, SW7 5HD');
    // property name - case independent
    $vevent->setProperty('summary', $item['title']);
    preg_match("/href=\"([^\"]+)/", $lines[0], $matches);
    array_pop($lines);
    array_pop($lines);
    $desc = trim(strip_tags(html_entity_decode(implode("\n", $lines))));
    $desc = str_replace("’", "'", $desc);
    $desc = str_replace("‘", "'", $desc);
    $desc .= "\n\n<a href=\"" . $matches[1] . "\">More info</a>";
    $vevent->setProperty('description', $desc);
    $v->setComponent($vevent);
    // add event to calendar
}
//$v->returnCalendar();
print $v->createCalendar();
开发者ID:palfrey,项目名称:calendars,代码行数:30,代码来源:danaevents.php

示例14: render_icalendar


//.........这里部分代码省略.........
            case 'milestone':
                $start_on = $object->getStartOn();
                $due_on = $object->getDueOn();
                $due_on->advance(24 * 60 * 60, true);
                // One day shift because iCal and Windows Calendar don't include last day
                $start_on_year = $start_on->getYear();
                $start_on_month = $start_on->getMonth() < 10 ? '0' . $start_on->getMonth() : $start_on->getMonth();
                $start_on_day = $start_on->getDay() < 10 ? '0' . $start_on->getDay() : $start_on->getDay();
                $due_on_year = $due_on->getYear();
                $due_on_month = $due_on->getMonth() < 10 ? '0' . $due_on->getMonth() : $due_on->getMonth();
                $due_on_day = $due_on->getDay() < 10 ? '0' . $due_on->getDay() : $due_on->getDay();
                $event = new vevent();
                $event->setProperty('dtstart', array($start_on_year, $start_on_month, $start_on_day), array('VALUE' => 'DATE'));
                $event->setProperty('dtend', array($due_on_year, $due_on_month, $due_on_day), array('VALUE' => 'DATE'));
                $event->setProperty('dtstamp', date('Ymd'));
                $event->setProperty('summary', $summary);
                if ($object->getBody()) {
                    $event->setProperty('description', html_to_text($object->getFormattedBody()) . "\n\n" . lang('Details: ') . $object->getViewUrl());
                } else {
                    $event->setProperty('description', lang('Details') . ': ' . $object->getViewUrl());
                }
                // if
                switch ($object->getPriority()) {
                    case PRIORITY_HIGHEST:
                        $event->setProperty('priority', 1);
                        break;
                    case PRIORITY_HIGH:
                        $event->setProperty('priority', 3);
                        break;
                    case PRIORITY_LOW:
                        $event->setProperty('priority', 7);
                        break;
                    case PRIORITY_LOWEST:
                        $event->setProperty('priority', 9);
                        break;
                    case PRIORITY_ONGOING:
                        $event->setProperty('priority', 11);
                        break;
                    case PRIORITY_HOLD:
                        $event->setProperty('priority', 13);
                        break;
                    default:
                        $event->setProperty('priority', 5);
                }
                // switch
                $calendar->addComponent($event);
                break;
            case 'ticket':
            case 'task':
                $start_on = $object->getCreatedOn();
                $due_on = $object->getDueOn();
                $todo = new vtodo();
                $todo->setProperty('summary', $summary);
                $todo->setProperty('description', $object->getName() . "\n\n" . lang('Details') . ': ' . $object->getViewUrl());
                switch ($object->getPriority()) {
                    case PRIORITY_HIGHEST:
                        $todo->setProperty('priority', 1);
                        break;
                    case PRIORITY_HIGH:
                        $todo->setProperty('priority', 3);
                        break;
                    case PRIORITY_LOW:
                        $todo->setProperty('priority', 7);
                        break;
                    case PRIORITY_LOWEST:
                        $todo->setProperty('priority', 9);
                        break;
                    case PRIORITY_ONGOING:
                        $todo->setProperty('priority', 11);
                        break;
                    case PRIORITY_HOLD:
                        $todo->setProperty('priority', 13);
                        break;
                    default:
                        $todo->setProperty('priority', 5);
                }
                // switch
                if (instance_of($due_on, 'DateValue')) {
                    $due_on_year = $due_on->getYear();
                    $due_on_month = $due_on->getMonth() < 10 ? '0' . $due_on->getMonth() : $due_on->getMonth();
                    $due_on_day = $due_on->getDay() < 10 ? '0' . $due_on->getDay() : $due_on->getDay();
                    $todo->setProperty('due', $due_on_year, $due_on_month, $due_on_day);
                }
                // if
                $calendar->addComponent($todo);
                break;
            default:
                break;
        }
    }
    // foreach
    $cal = $calendar->createCalendar();
    header('Content-Type: text/calendar; charset=UTF-8');
    header('Content-Disposition: attachment; filename="' . $name . '.ics"');
    header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
    header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
    header('Pragma: no-cache');
    print $cal;
    die;
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:101,代码来源:functions.php

示例15: foreach

    //Get events
    $q = $dbh->prepare("SELECT * FROM `cm_events_responsibles`,`cm_events`\n\t\tWHERE cm_events_responsibles.username = ?\n\t\tAND cm_events_responsibles.event_id = cm_events.id\n\t\tORDER by cm_events.start DESC");
    $q->bindParam(1, $user);
    $q->execute();
    $events = $q->fetchAll(PDO::FETCH_ASSOC);
    foreach ($events as $event) {
        $case_name = case_id_to_casename($dbh, $event['case_id']);
        $e = new vevent();
        // initiate EVENT
        if ($event['all_day'] == '1') {
            $start = explode(' ', $event['start']);
            //all-day events are date only
            $e->setProperty('dtstart', $start[0]);
            if ($event['end'] == null) {
                $e->setProperty('dtend', $start[0]);
                //make end same as event
            } else {
                $end = explode(' ', $event['end']);
                $e->setProperty('dtend', $end[0]);
            }
        } else {
            $e->setProperty('dtstart', $event['start']);
            $e->setProperty('dtend', $event['end']);
        }
        $e->setProperty('summary', $case_name . ": " . $event['task']);
        $e->setProperty('description', $event['notes']);
        $v->setComponent($e);
    }
    $cal = $v->createCalendar();
    echo $cal;
}
开发者ID:samtechnocrat,项目名称:ClinicCases,代码行数:31,代码来源:ical.php


注:本文中的vcalendar::createCalendar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。