本文整理汇总了PHP中vcalendar::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP vcalendar::getConfig方法的具体用法?PHP vcalendar::getConfig怎么用?PHP vcalendar::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vcalendar
的用法示例。
在下文中一共展示了vcalendar::getConfig方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportar
function exportar($aObj = array(), $directo_a_browser = 1)
{
if (is_array($aObj)) {
$v = new vcalendar();
$v->setConfig('DIRECTORY', sfConfig::get('sf_cache_dir'));
foreach ($aObj as $link_evento) {
if ($link_evento->getEvento()) {
$e = new vevent();
$e->setProperty('DESCRIPTION', '');
$e->setProperty('SUMMARY', $link_evento->getEvento()->getTitulo());
$e->setProperty('class', 'PUBLIC');
$aFechaInicio = getdate(strtotime($link_evento->getEvento()->getFechaInicio()));
$e->setProperty('dtstart', $aFechaInicio['year'], $aFechaInicio['mon'], $aFechaInicio['mday'], $aFechaInicio['hours'], $aFechaInicio['minutes'], 0);
$aFechaFin = getdate(strtotime($link_evento->getEvento()->getFechaFin()));
$e->setProperty('dtend', $aFechaFin['year'], $aFechaFin['mon'], $aFechaFin['mday'], $aFechaFin['hours'], $aFechaFin['minutes'], 0);
$e->setProperty('dtstamp', gmdate('Ymd\\THi00\\Z'));
if ($link_evento->getEvento()->getFrecuencia()) {
$freq = $this->aFreq[$link_evento->getEvento()->getFrecuencia()];
$interval = $link_evento->getEvento()->getFrecuenciaIntervalo();
$aRrule = array();
$aRrule['FREQ'] = $freq;
$aRrule['INTERVAL'] = $interval;
if ($freq == "WEEKLY") {
$aRrule['BYDAY'] = array_chunk(explode(",", $link_evento->getEvento()->getRecurrenciaDiasIcal()), 1);
}
if ($link_evento->getEvento()->getRecurrenciaFin() != "") {
if (is_numeric($link_evento->getEvento()->getRecurrenciaFin())) {
$aRrule['COUNT'] = $link_evento->getEvento()->getRecurrenciaFin();
} else {
$aRrule['UNTIL'] = gmdate('Ymd\\THi00\\Z', strtotime($link_evento->getEvento()->getRecurrenciaFin()));
}
}
$e->setProperty('rrule', $aRrule);
}
$v->addComponent($e);
}
}
if ($directo_a_browser == 1) {
$v->returnCalendar();
} else {
$v->saveCalendar();
return $v->getConfig('filename');
}
} else {
$error = 'No envío un array para la exportación';
throw new Exception($error);
}
}
示例2: iCal2xls
/**
* function iCal2xls
*
* Convert iCal file to xls format and send file to browser (default) or save xls file to disk
* Definition iCal : rcf2445, http://kigkonsult.se/downloads/index.php#rfc
* Using iCalcreator: http://kigkonsult.se/downloads/index.php#iCalcreator
* Based on PEAR Spreadsheet_Excel_Writer-0.9.1 (and OLE-1.0.0RC1)
* to be installed as
* pear install channel://pear.php.net/OLE-1.0.0RC1
* pear install channel://pear.php.net/Spreadsheet_Excel_Writer-0.9.1
*
* @author Kjell-Inge Gustafsson <ical@kigkonsult.se>
* @since 3.0 - 2011-12-21
* @param object $calendar opt. iCalcreator calendar instance
* @return bool returns FALSE when error
*/
public function iCal2xls($calendar = FALSE)
{
$timeexec = array('start' => microtime(TRUE));
if ($this->log) {
$this->log->log(' ********** START **********', PEAR_LOG_NOTICE);
}
/** check input/output directory and filename */
$inputdirFile = $outputdirFile = '';
$inputFileParts = $outputFileParts = array();
$remoteInput = $remoteOutput = FALSE;
if ($calendar) {
$inputdirFile = $calendar->getConfig('DIRFILE');
$inputFileParts = pathinfo($inputdirFile);
$inputFileParts['dirname'] = realpath($inputFileParts['dirname']);
if ($this->log) {
$this->log->log('fileParts:' . var_export($inputFileParts, TRUE), PEAR_LOG_DEBUG);
}
} elseif (FALSE === $this->_fixIO('input', 'ics', $inputdirFile, $inputFileParts, $remoteInput)) {
if ($this->log) {
$this->log->log(number_format(microtime(TRUE) - $timeexec['start'], 5) . ' sec', PEAR_LOG_ERR);
$this->log->log("ERROR 2, invalid input ({$inputdirFile})", PEAR_LOG_ERR);
$this->log->flush();
}
return FALSE;
}
if (FALSE === $this->_fixIO('output', FALSE, $outputdirFile, $outputFileParts, $remoteOutput)) {
if (FALSE === $this->setConfig('outputfilename', $inputFileParts['filename'] . '.xls')) {
if ($this->log) {
$this->log->log(number_format(microtime(TRUE) - $timeexec['start'], 5) . ' sec', PEAR_LOG_ERR);
$this->log->log('ERROR 3, invalid output (' . $inputFileParts['filename'] . '.csv)', PEAR_LOG_ERR);
$this->log->flush();
}
return FALSE;
}
$outputdirFile = $this->getConfig('outputdirectory') . DIRECTORY_SEPARATOR . $inputFileParts['filename'] . '.xls';
$outputFileParts = pathinfo($outputdirFile);
if ($this->log) {
$this->log->log("output set to '{$outputdirFile}'", PEAR_LOG_INFO);
}
}
if ($this->log) {
$this->log->log("INPUT..FILE:{$inputdirFile}", PEAR_LOG_NOTICE);
$this->log->log("OUTPUT.FILE:{$outputdirFile}", PEAR_LOG_NOTICE);
}
$save = $this->getConfig('save');
if ($calendar) {
$calnl = $calendar->getConfig('nl');
} else {
/** iCalcreator set config, read and parse input iCal file */
$calendar = new vcalendar();
if (FALSE !== ($unique_id = $this->getConfig('unique_id'))) {
$calendar->setConfig('unique_id', $unique_id);
}
$calnl = $calendar->getConfig('nl');
if ($remoteInput) {
if (FALSE === $calendar->setConfig('url', $inputdirFile)) {
if ($this->log) {
$this->log->log("ERROR 3 INPUT FILE:'{$inputdirFile}' iCalcreator: invalid url", 3);
}
return FALSE;
}
} else {
if (FALSE === $calendar->setConfig('directory', $inputFileParts['dirname'])) {
if ($this->log) {
$this->log->log("ERROR 4 INPUT FILE:'{$inputdirFile}' iCalcreator: invalid directory: '" . $inputFileParts['dirname'] . "'", 3);
$this->log->flush();
}
return FALSE;
}
if (FALSE === $calendar->setConfig('filename', $inputFileParts['basename'])) {
if ($this->log) {
$this->log->log("ERROR 5 INPUT FILE:'{$inputdirFile}' iCalcreator: invalid filename: '" . $inputFileParts['basename'] . "'", 3);
$this->log->flush();
}
return FALSE;
}
}
if (FALSE === $calendar->parse()) {
if ($this->log) {
$this->log->log("ERROR 6 INPUT FILE:'{$inputdirFile}' iCalcreator parse error", 3);
$this->log->flush();
}
return FALSE;
}
//.........这里部分代码省略.........
示例3: iCal2csv
//.........这里部分代码省略.........
}
} else {
if (FALSE === ($filename = fileCheckRead($filename, $log))) {
if ($log) {
$log->log("{$iCal2csv_VERSION} (" . number_format(microtime(TRUE) - $timeexec['start'], 5) . ')');
$log->flush();
}
return FALSE;
}
$inputFileParts = pathinfo($filename);
if (!$diskfilename) {
$diskfilename = $inputFileParts['dirname'] . DIRECTORY_SEPARATOR . $inputFileParts['filename'] . '.csv';
}
}
$outputFileParts = pathinfo($diskfilename);
if ($save) {
if (FALSE === ($diskfilename = fileCheckWrite($outputFileParts['dirname'] . DIRECTORY_SEPARATOR . $outputFileParts['basename'], $log))) {
if ($log) {
$log->log("{$iCal2csv_VERSION} (" . number_format(microtime(TRUE) - $timeexec['start'], 5) . ')');
$log->flush();
}
return FALSE;
}
}
if ($log) {
$msg = $iCal2csv_VERSION . ' INPUT FILE:"' . $inputFileParts['dirname'] . DIRECTORY_SEPARATOR . $inputFileParts['basename'] . '"';
if ($save) {
$msg .= ' OUTPUT FILE: "' . $outputFileParts['dirname'] . DIRECTORY_SEPARATOR . $outputFileParts['basename'] . '"';
}
$log->log($msg, 7);
}
/* iCalcreator check, read and parse input iCal file */
$calendar = new vcalendar();
$calnl = $calendar->getConfig('nl');
if ($remoteInput) {
if (FALSE === $calendar->setConfig('url', $filename)) {
$msg = $iCal2csv_VERSION . ' ERROR 3 INPUT FILE:"' . $filename . '" iCalcreator: invalid url';
if ($log) {
$log->log($msg, 3);
$log->flush();
} else {
error_log($msg);
}
return FALSE;
}
} else {
if (FALSE === $calendar->setConfig('directory', $inputFileParts['dirname'])) {
$msg = $iCal2csv_VERSION . ' ERROR 4 INPUT FILE:"' . $filename . '" iCalcreator: invalid directory: "' . $inputFileParts['dirname'] . '"';
if ($log) {
$log->log($msg, 3);
$log->flush();
} else {
error_log($msg);
}
return FALSE;
}
if (FALSE === $calendar->setConfig('filename', $inputFileParts['basename'])) {
$msg = $iCal2csv_VERSION . ' ERROR 5 INPUT FILE:"' . $filename . '" iCalcreator: invalid filename: "' . $inputFileParts['basename'] . '"';
if ($log) {
$log->log($msg, 3);
$log->flush();
} else {
error_log($msg);
}
return FALSE;
}
示例4: lastRSS
* You should have received a copy of the GNU General Public
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
require_once 'lastRSS.php';
require_once 'iCalcreator.class.php';
$lr = new lastRSS();
$data = $lr->Get("http://feeds.feedburner.com/danaevents");
/*print_r($data);
exit;*/
$v = new vcalendar();
// create a new calendar instance
$v->setConfig('unique_id', $data['link']);
// set your unique id
$v->setProperty('method', 'PUBLISH');
// required of some calendar software
$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
示例5: getUserStamm
$v->returnCalendar();
} else {
if ($_POST["icalart"] == "mail") {
$user = getUserStamm($_SESSION["loginCRM"]);
$abs = sprintf("%s <%s>", $user["name"], $user["email"]);
$Subject = "LxO-Kalender";
$v->setConfig('directory', "/tmp/");
// identify directory
$v->saveCalendar();
// save calendar to file
include_once "Mail.php";
include_once "Mail/mime.php";
$headers = array("Return-Path" => $abs, "Reply-To" => $abs, "From" => $abs, "X-Mailer" => "PHP/" . phpversion(), "Subject" => $Subject);
$mime = new Mail_Mime("\n");
$mime->setTXTBody("");
echo "!" . $v->getConfig('directory') . "/" . $v->getConfig('filename') . "!" . $v->getConfig('filename') . "!";
$mime->addAttachment($v->getConfig('directory') . "/" . $v->getConfig('filename'), "text/plain", $v->getConfig('filename'));
$body = $mime->get(array("text_encoding" => "quoted-printable", "text_charset" => $_SESSION["charset"]));
$hdr = $mime->headers($headers);
$mail =& Mail::factory("mail");
$mail->_params = "-f " . $user["email"];
$rc = $mail->send($_POST["icaldest"], $hdr, $body);
} else {
if (strtoupper($_POST["icaldest"]) == "HOME") {
$_POST["icaldest"] = "dokumente/" . $_SESSION["dbname"] . "/" . $_SESSION["login"] . "/";
}
$v->setConfig('directory', $_POST["icaldest"]);
// identify directory
$v->saveCalendar();
// save calendar to file
}