本文整理汇总了PHP中Calendar::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Calendar::create方法的具体用法?PHP Calendar::create怎么用?PHP Calendar::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Calendar
的用法示例。
在下文中一共展示了Calendar::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* Добавляет новое событие
* @return void
*/
function add()
{
$user = Core::getInstance()->user;
// Определяем массив данных для обработки
$request = _Core_Request::getCurrent();
$event_array = array('type' => (int) $request->post['type'], 'account' => (int) $request->post['account'], 'amount' => (double) str_replace(' ', '', $request->post['amount']), 'category' => isset($request->post['category']) && (int) $request->post['category'] ? (int) $request->post['category'] : null, 'date' => Helper_Date::RusDate2Mysql($this->getDateOperation()), 'comment' => (string) $request->post['comment'], 'tags' => isset($request->post['tags']) ? $request->post['tags'] : null, 'convert' => isset($request->post['convert']) ? $request->post['convert'] : 0, 'close' => isset($request->post['close']) ? $request->post['close'] : 0, 'currency' => isset($request->post['currency']) ? $request->post['currency'] : 0, 'toAccount' => isset($request->post['toAccount']) ? $request->post['toAccount'] : null, 'target' => isset($request->post['target']) ? $request->post['target'] : null, 'last' => isset($request->post['last']) ? Helper_Date::RusDate2Mysql($request->post['last']) : '0000-00-00', 'time' => isset($request->post['time']) ? $request->post['time'] : date("H:i:s"), 'every' => isset($request->post['every']) ? (int) $request->post['every'] : 0, 'repeat' => isset($request->post['repeat']) ? (int) $request->post['repeat'] : 1, 'week' => isset($request->post['week']) ? $request->post['week'] : '0000000');
$notifications = $this->_readNotificationsFromRequest($request);
$event_array = array_merge($event_array, $notifications);
$event = new Calendar_Event(new Calendar_Model($event_array, $user), $user);
if (!$event->checkData()) {
$this->tpl->assign('error', array('text' => implode(",\n", $event->getErrors())));
} else {
$calendar = new Calendar($user);
$calendar->create($event);
$this->tpl->assign('result', array('text' => 'Операция успешно запланирована'));
// @FIXME Перенести этот блок кода в календарь
Core::getInstance()->user->initUserEvents();
Core::getInstance()->user->save();
$this->tpl->assign('future', Core::getInstance()->user->getUserEvents('reminder'));
$this->tpl->assign('overdue', Core::getInstance()->user->getUserEvents('overdue'));
$this->tpl->assign('calendar', Core::getInstance()->user->getUserEvents('calendar'));
}
}
示例2: importEvents_MyEventOn_Step2
/**
* Import events created with: http://www.myeventon.com/
* into a 'CalendarEvent' Page type from Unclecheese's "Event Calendar" module
*
* Step 2) Update the page to 'CalendarEvent' page type and add event data appropriately
*/
public function importEvents_MyEventOn_Step2($calendarHolder = null)
{
$this->logFunctionStart(__FUNCTION__);
if (!class_exists('CalendarDateTime')) {
throw new WordpressImportException(__FUNCTION__ . ' requires Unclecheese\'s "Event Calendar" module');
}
if (!CalendarDateTime::has_extension('WordpressImportDataExtension')) {
throw new WordpressImportException('CalendarDateTime requires WordpressImportDataExtension.');
}
// Debug
//Debug::dump($this->_db->getPosts('ajde_events', true)); exit;
// Get the calendar holder the events should belong to.
if ($calendarHolder === null) {
$calendarHolder = Calendar::get()->filter(array('WordpressData' => '1'))->first();
if (!$calendarHolder) {
$calendarHolder = Calendar::create();
$calendarHolder->Title = 'Wordpress Imported Events';
$calendarHolder->URLSegment = 'events';
$calendarHolder->WordpressData = 1;
try {
$this->writeAndPublishRecord($calendarHolder);
} catch (Exception $e) {
$this->log($calendarHolder, 'error', $e);
}
}
}
// Convert to CalendarEvent and attach relevant event data
$existingWpRecords = singleton('Page')->WordpressRecordsByWordpressID();
foreach ($this->_db->getPosts('ajde_events') as $wpData) {
$wpID = $wpData['ID'];
if (!isset($existingWpRecords[$wpID])) {
$this->log('Unable to find Wordpress ID #' . $wpID, 'error');
continue;
}
$record = $existingWpRecords[$wpID];
$wpMeta = $this->_db->attachAndGetPostMeta($wpData);
if ($record->ClassName !== 'CalendarEvent') {
$record = $record->newClassInstance('CalendarEvent');
}
$record->ParentID = $calendarHolder->ID;
$startDate = isset($wpMeta['evcal_srow']) && $wpMeta['evcal_srow'] ? (int) $wpMeta['evcal_srow'] : null;
$endDate = isset($wpMeta['evcal_erow']) && $wpMeta['evcal_erow'] ? (int) $wpMeta['evcal_erow'] : null;
if ($startDate && $endDate) {
$subRecord = null;
if ($record->exists()) {
$subRecord = $record->DateTimes()->find('WordpressID', $wpID);
}
if (!$subRecord) {
$subRecord = CalendarDateTime::create();
}
$subRecord->AllDay = isset($wpMeta['evcal_allday']) && $wpMeta['evcal_allday'] === 'yes';
$subRecord->StartDate = date('Y-m-d', $startDate);
$subRecord->StartTime = date('H:i:s', $startDate);
$subRecord->EndDate = date('Y-m-d', $endDate);
$subRecord->EndTime = date('H:i:s', $endDate);
$subRecord->WordpressData = $record->WordpressData;
if (!$subRecord->exists()) {
// NOTE(Jake): Will write $subRecord when $record is written if not exists, otherwise
// it will write it when it's ->add()'d
$record->DateTimes()->add($subRecord);
} else {
try {
$record->write();
$this->log($record, 'changed');
} catch (Exception $e) {
$this->log($record, 'error', $e);
}
}
}
// Support Addressable extension from Addressable module
if (isset($wpMeta['evcal_location'])) {
if ($record->Address !== $wpMeta['evcal_location']) {
$record->Address = $wpMeta['evcal_location'];
}
}
// Support Geocodable extension from Addressable module
if (isset($wpMeta['evcal_lat'])) {
$record->Lat = $wpMeta['evcal_lat'];
}
if (isset($wpMeta['evcal_lng'])) {
$record->Lng = $wpMeta['evcal_lng'];
}
$changedFields = $record->getChangedFields(true, DataObject::CHANGE_VALUE);
unset($changedFields['Lat']);
unset($changedFields['Lng']);
if ($changedFields) {
try {
$isPublished = isset($wpData['post_status']) && $wpData['post_status'] === 'publish' || $record->isPublished();
$this->writeAndPublishRecord($record, $isPublished);
} catch (Exception $e) {
$this->log($record, 'error', $e);
}
} else {
$this->log($record, 'nochange');
//.........这里部分代码省略.........
开发者ID:silbinarywolf,项目名称:silverstripe-wordpressmigrationtools,代码行数:101,代码来源:WordpressImportService.php
示例3: getcalendar
protected function getcalendar()
{
global $user;
global $objPDO;
$student = new student($objPDO, $user->getuserId());
$headMenu = array("username" => $student->getName());
if ($user->checkAdmin() == true || $student->checkTeacher() || $student->checkStudent()) {
$role = $student->getacctType();
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/calendar_class.php';
$calendar = new Calendar();
$month = $calendar->getmonth();
$year = $calendar->getyear();
if (isset($_GET['uid']) && isset($_GET['ref'])) {
$month = $_GET['uid'];
$year = $_GET['ref'];
$calendar->setmonth($month);
$calendar->setyear($year);
}
$calendar->create();
$week = $calendar->getweek();
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/events_class.php';
$event = new Events($objPDO);
$datePattern = "-" . $calendar->getmonth() . "-" . $calendar->getyear();
$events_array = $event->getByDateLike($datePattern);
$day_events = array();
foreach ($events_array as $key => $value) {
$day_events[$value['date']][] = $key;
}
$events_type = array('1' => 'holiday.png', '2' => 'fees.png', '3' => 'function.png', '4' => 'test.png');
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/events_calendar.php';
} else {
header('Location:http://localhost/cloud');
}
}
示例4: h
<?php
// カレンダークラスファイル読み込み
require_once 'calendar.php';
// エスケープ関数
function h($s)
{
return htmlspecialchars($s, ENT_QUOTES, "UTF-8");
}
// Queryパラメータから年月を取得
// パラメータなしもしくは不正の場合は今月を表示する
$ym = isset($_GET['ym']) ? $_GET['ym'] : date("Y-m");
// カレンダーオブジェクトの生成
$cal = new Calendar($ym);
$cal->create();
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>PHPでカレンダー</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<table>
<thead>
<tr>
<th><a href="?ym=<?php
echo h($cal->prev());
示例5: run
public function run($request)
{
Restrictable::set_enabled(false);
Versioned::reading_stage('Stage');
$admin = Security::findAnAdministrator();
Session::set("loggedInAs", $admin->ID);
$toPublish = array();
$home = SiteTree::get()->filter('URLSegment', 'home')->first();
if ($home) {
$this->o("Home page already exists, _not_ bootstrapping");
return;
}
$site = Multisites::inst()->getCurrentSite();
$toPublish[] = $site;
$dashboard = SiteDashboardPage::create(array('Title' => 'Dashboard', 'URLSegment' => 'dashboard', 'ParentID' => $site->ID));
$dashboard->write();
$this->o("Created Dashboard");
$toPublish[] = $dashboard;
$home = RedirectorPage::create(array('Title' => 'Home', 'URLSegment' => 'home', 'ParentID' => $site->ID));
$home->LinkToID = $dashboard->ID;
$home->write();
$toPublish[] = $home;
$this->o("Created homepage");
$group = Group::create(array('Title' => 'All members'));
$events = Calendar::create(array('Title' => 'Events', 'URLSegment' => 'events', 'ParentID' => $site->ID));
$events->write();
$toPublish[] = $events;
$dummyEvent = CalendarEvent::create(array('Title' => 'Sample event', 'ParentID' => $events->ID));
$dummyEvent->write();
$toPublish[] = $dummyEvent;
$dateTime = CalendarDateTime::create(array('StartDate' => strtotime('+1 week'), 'AllDay' => 1, 'EventID' => $dummyEvent->ID));
$dateTime->write();
$files = FileListingPage::create(array('Title' => 'File Listing', 'ParentID' => $site->ID));
$files->write();
$toPublish[] = $files;
$news = MediaHolder::create(array('Title' => 'News', 'MediaTypeID' => 3, 'ParentID' => $site->ID));
$news->write();
$toPublish[] = $news;
$text = <<<WORDS
\t\t\t<p>Oh no! Pull a sickie, this epic cuzzie is as rip-off as a snarky morepork. Mean while, in behind the
\t\t\t\tbicycle shed, Lomu and The Hungery Caterpilar were up to no good with a bunch of cool jelly tip icecreams.
\t\t\t\t\tThe flat stick force of his chundering was on par with Rangi's solid rimu chilly bin. Put the jug on
\t\t\twill you bro, all these hard yakka utes can wait till later. The first prize for frying up goes to...
\t\t\t\t\t\t\tsome uni student and his wicked wet blanket, what a egg. Bro, giant wekas are really tip-top good
\t\twith dodgy fellas, aye. You have no idea how nuclear-free our bung kiwis were aye. Every time</p><p>
\t\t\t\t\t\tI see those carked it wifebeater singlets it's like Castle Hill all over again aye, pissed
\t\t\t\t\t\t\t\t\t\tas a rat. Anyway, Uncle Bully is just Mr Whippy in disguise, to find the true meaning of
\t\t\t\t\t\t\t\t\t\t\tlife, one must start whale watching with the box of fluffies, mate. After the trotie
\t\t\t\t\t\t\t\t\t\t\t\tis jumped the ditch, you add all the heaps good whitebait fritters to
\t\t\t\t\t\t\t\t\t\t\t\t\tthe paua you've got yourself a meal.</p><p>Technology has allowed
\t\t\t\t\t\t\t\t\t\t\t\t\t\tmint pukekos to participate in the global conversation of
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tchoice keas. The next Generation of pearler dole bludgers have already packed a sad over at the beach. What's the hurry The Topp Twins? There's plenty of twink sticks in that one episode of Tux Wonder Dogs, you know the one bro. The sausage sizzle holds the most sweet as community in the country.. A Taniwha was playing rugby when the random reffing the game event occured. Those bloody Jaffa's, this outrageously awesome seabed is as tapu as a naff bloke. Pavalova is definitely not Australian, you don't know his story, bro. Mean while, in the sleepout, Jim Hickey and Sir Edmond Hillary were up to no good with a bunch of beautiful whanaus. The stuffed force of his cruising for a brusing was on par with James Cook's pretty suss pikelet. Put the jug on will you bro, all these buzzy stubbiess can wait till later.</p><p>The first prize for preparing the hungi goes to... Bazza and his rough as guts pohutukawa, what a sad guy. Bro, Monopoly money, from the New Zealand version with Queen Street and stuff are really hard case good with stink girl guide biscuits, aye. You have no idea how thermo-nuclear our sweet as mates were aye. Every time I see those fully sick packets of Wheetbix it's like Mt Cook all over again aye, see you right. Anyway, Mrs Falani is just Jonah Lomu in disguise, to find the true meaning of life, one must start rooting with the milk, mate. After the native vegetable is munted, you add all the beached as pieces of pounamu to the cheese on toast you've got yourself a meal. Technology has allowed primo kumaras to participate in the global conversation of sweet gumboots. The next Generation of beaut manuses have already cooked over at Pack n' Save. What's the hurry Manus Morissette? There's plenty of onion dips in West Auckland. The tinny house holds the most same same but different community in the country.. Helen Clarke was packing a sad when the pretty suss whinging event occured. Eh, this stoked hongi is as cracker as a kiwi as chick.</p><p>Mean while, in the pub, Hercules Morse, as big as a horse and James and the Giant Peach were up to no good with a bunch of paru pinapple lumps. The bloody force of his wobbling was on par with Dr Ropata's crook lamington. Put the jug on will you bro, all these mean as foreshore and seabed issues can wait till later. The first prize for rooting goes to... Maui and his good as L&P, what a hottie. Bro, marmite shortages are really shithouse good with hammered toasted sandwiches, aye. You have no idea how chocka full our chronic Bell Birds were aye. Every time I see those rip-off rugby balls it's like smoko time all over again aye, cook your own eggs Jake. Anyway, Cardigan Bay is just Spot, the Telecom dog in disguise, to find the true meaning of life, one must start pashing with the mince pie, mate.</p>
\t\t\t
WORDS;
$story = MediaPage::create(array('Title' => 'Sample news item', 'Content' => $text, 'ParentID' => $news->ID));
$story->write();
$toPublish[] = $story;
$group->write();
$this->o("Created All Members group");
$member = Member::create(array('FirstName' => 'Anon', 'Surname' => 'Ymous', 'Email' => 'anon@test.com'));
$member->write();
$member->Groups()->add($group);
$site->Theme = 'ssau-minimalist';
$site->LoggedInGroups()->add($group);
$site->write();
$this->o("Configured Site object");
foreach ($toPublish as $item) {
if (!is_object($item)) {
print_r($item);
continue;
}
$item->doPublish();
}
$this->o("Published everything");
$message = <<<MSG
Your community system has been succesfully installed! Some things you might be interested in doing from this point are...
* Replying to this post!
* Customising your dashboard
* Uploading some files and images to browse in the [file listing](file-listing)
* Create some events
* Add some RSS feeds to your Announcements dashlet (use the wrench to configure it!)
MSG;
singleton('MicroBlogService')->createPost(null, $message, 'Installed!', 0, null, array('logged_in' => 1));
Restrictable::set_enabled(true);
}