本文整理匯總了PHP中vCal::create_ical_string_from_array方法的典型用法代碼示例。如果您正苦於以下問題:PHP vCal::create_ical_string_from_array方法的具體用法?PHP vCal::create_ical_string_from_array怎麽用?PHP vCal::create_ical_string_from_array使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vCal
的用法示例。
在下文中一共展示了vCal::create_ical_string_from_array方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testcreate_ical_string_from_array
public function testcreate_ical_string_from_array()
{
$expected = "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//SugarCRM//SugarCRM Calendar//EN\r\nBEGIN:VFREEBUSY\r\nORGANIZER;CN= :VFREEBUSY\r\nDTSTART:2016-01-09 00:00:00\r\nDTEND:2016-03-09 00:00:00\r\nDTSTAMP:2016-01-10 11:07:15\r\nEND:VFREEBUSY\r\nEND:VCALENDAR\r\n";
$iCalArray = array(array('BEGIN', 'VCALENDAR'), array('VERSION', '2.0'), array('PRODID', '-//SugarCRM//SugarCRM Calendar//EN'), array('BEGIN', 'VFREEBUSY'), array('ORGANIZER;CN= ', 'VFREEBUSY'), array('DTSTART', '2016-01-09 00:00:00'), array('DTEND', '2016-03-09 00:00:00'), array('DTSTAMP', '2016-01-10 11:07:15'), array('END', 'VFREEBUSY'), array('END', 'VCALENDAR'));
$actual = vCal::create_ical_string_from_array($iCalArray);
$this->assertSame($expected, $actual);
}
示例2: getVcalIcal
/**
* Generates the complete string for the calendar
*
* @param User $user_focus the user
* @param integer $num_months the number of months to search before and after today
* @return string the iCal calenar string
*/
function getVcalIcal(&$user_focus, $num_months)
{
global $current_user, $timedate;
$current_user = $user_focus;
$cal_name = $user_focus->first_name . " " . $user_focus->last_name;
$ical_array = array();
$ical_array[] = array("BEGIN", "VCALENDAR");
$ical_array[] = array("VERSION", "2.0");
$ical_array[] = array("METHOD", "PUBLISH");
$ical_array[] = array("X-WR-CALNAME", "{$cal_name} (SugarCRM)");
$ical_array[] = array("PRODID", "-//SugarCRM//SugarCRM Calendar//EN");
$ical_array = array_merge($ical_array, vCal::create_ical_array_from_string($this->getTimezoneString()));
$ical_array[] = array("CALSCALE", "GREGORIAN");
$now_date_time = $timedate->getNow(true);
global $sugar_config;
$timeOffset = 2;
if (isset($sugar_config['vcal_time']) && $sugar_config['vcal_time'] != 0 && $sugar_config['vcal_time'] < 13) {
$timeOffset = $sugar_config['vcal_time'];
}
if (!empty($num_months)) {
$timeOffset = $num_months;
}
$start_date_time = $now_date_time->get("-{$timeOffset} months");
$end_date_time = $now_date_time->get("+{$timeOffset} months");
$utc_now_time = $this->getUtcDateTime($now_date_time);
$str = vCal::create_ical_string_from_array($ical_array, true);
$str .= $this->createSugarIcal($user_focus, $start_date_time, $end_date_time, $utc_now_time);
$ical_array = array(array("DTSTAMP", $utc_now_time));
$ical_array[] = array("END", "VCALENDAR");
$str .= vCal::create_ical_string_from_array($ical_array, true);
return $str;
}
示例3: testiCalStringFromArray
/**
* Test the function create_ical_string_from_array()
*
* @dataProvider iCalProvider
*/
public function testiCalStringFromArray($icalarray, $icalstring)
{
$res = vCal::create_ical_string_from_array($icalarray);
$this->assertEquals($icalstring, $res);
}