本文整理汇总了PHP中Event::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::create方法的具体用法?PHP Event::create怎么用?PHP Event::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Event::create([]);
}
}
示例2: createEvent
public function createEvent($testKey, $variantKey, $eventKey, $participantId, $metadata = null)
{
$value = null;
if (isset($metadata['value'])) {
$value = $metadata['value'];
unset($metadata['value']);
}
Event::create(array('testkey' => $testKey, 'variantkey' => $variantKey, 'eventkey' => $eventKey, 'participantid' => $participantId, 'value' => $value, 'metadata' => json_encode($metadata)));
}
示例3: testEventObserverClosure
/**
* @covers ::create
* @covers Nora\Core\Event\EventObserverClosure::__construct
* @covers Nora\Core\Event\EventObserverClosure::notify
*/
public function testEventObserverClosure()
{
$observer = EventObserver::create(function (EventIF $event) {
$this->assertTrue($event->match('test'));
$this->assertTrue($event->match('test1'));
});
$ev = Event::create('test');
$ev->addTag('test1');
$observer->notify($ev);
}
示例4: createNewEvent
/**
* Create a new event based data in this model
*/
public function createNewEvent($writeUpdate = true)
{
$event = Event::create()->update(array('Title' => "{$this->Gallery()->Title} - {$this->ArtistName}", 'ArtistName' => $this->ArtistName, 'StartDate' => $this->StartDate, 'EndDate' => $this->EndDate, 'HasFreeDrinks' => $this->HasFreeDrinks, 'GalleryID' => $this->GalleryID));
$event->write();
$this->update(array('State' => 'Merged', 'EventID' => $event->ID));
if ($writeUpdate) {
$this->write();
}
return $event;
}
示例5: create
public function create()
{
if ($this->checkData()) {
if (isset($_GET['url'])) {
$tempUrl = $_GET['url'];
}
Event::create(['title' => $_GET['title'], 'description' => $_GET['description'], 'location' => $_GET['location'], 'url' => $this->tempUrl, 'start' => $_GET['start'], 'end' => $_GET['end'], 'color' => $_GET['color'], 'textColor' => $_GET['textColor']]);
} else {
}
}
示例6: Event
function action_create()
{
$event = new Event($_POST);
$event->uid = User::$current_user->uid;
if ($event->create()) {
Notification::add("Event created (updated) successfully.");
Page::redirect("/events/view?eid={$event->eid}");
}
Notification::add("Event not created. Please try again.");
Page::redirect("/events/create");
}
示例7: createEvent
static function createEvent($eventType, $team, $station, $points, $data = "")
{
if (is_array($data)) {
$data = json_encode($data);
}
// if data is an array assume its json and convert it to text
$o = new Event();
$o->set('eventType', $eventType);
$o->set('teamId', $team->get('OID'));
$o->set('stationId', $station->get('OID'));
$o->set('points', $points);
$o->set('data', $data);
return $o->create();
}
示例8: _ops_update
function _ops_update()
{
$OID = max(0, intval($_POST['OID']));
$CID = max(0, intval($_POST['CID']));
$msg = '';
loginRequireMgmt();
if (!loginCheckPermission(USER::TEST_EVENT)) {
redirect("errors/401");
}
$itemName = "Event";
$urlPrefix = "test_event";
$object = new Event();
if ($OID) {
$object->retrieve($OID, $CID);
if (!$object->exists()) {
$msg = "{$itemName} not found!";
} else {
transactionBegin();
$object->merge($_POST);
if ($object->update()) {
transactionCommit();
$msg = "{$itemName} updated!";
} else {
transactionRollback();
$msg = "{$itemName} update failed";
}
}
} else {
$object->merge($_POST);
transactionBegin();
if ($object->create()) {
transactionCommit();
$msg = "{$itemName} created!";
} else {
transactionRollback();
$msg = "{$itemName} Create failed";
}
}
redirect("{$urlPrefix}/manage", $msg);
}
示例9: createModels
/**
* Return Event and Gallery data
*/
public function createModels()
{
$eventData = array();
$galleryData = array();
// 1:1 data
$eventData['Title'] = $this->summary;
$eventData['StartDate'] = $this->start_dateTime;
$eventData['EndDate'] = $this->end_dateTime;
// Extract from summary format
$summary = trim($this->summary);
if (is_string($summary) && strlen($summary)) {
$summary_parts = explode(' - ', $summary);
if (count($summary_parts) === 2) {
$galleryData['Title'] = $summary_parts[0];
$eventData['ArtistName'] = $summary_parts[1];
}
}
// Create models
$event = Event::create()->update($eventData);
$gallery = Gallery::create()->update($galleryData);
return array('Event' => $event, 'Gallery' => $gallery);
}
示例10: create
/**
* create
*/
public function create()
{
$res = new Response();
// Ugh, php...check if !hash
if (is_array($this->params) && !empty($this->params) && preg_match('/^\\d+$/', implode('', array_keys($this->params)))) {
foreach ($this->params as $data) {
array_push($res->data, Event::create($data)->to_hash());
}
$res->success = true;
$res->message = "Created " . count($res->data) . ' records';
} else {
if ($rec = Event::create($this->params)) {
$res->data = $rec->to_hash();
$res->success = true;
$res->message = "Created record";
} else {
$res->success = false;
$res->message = "Failed to create record";
}
}
return $res->to_json();
}
示例11: __construct
public function __construct()
{
self::authorizeFromEnv();
$this->data = array('parameters' => array("key" => "value"));
$this->datas = array();
// CRUD ___________________________________
// Create
for ($x = 0; $x <= 2; $x++) {
$this->datas[] = Event::create($this->data);
}
$this->created = $this->datas[0];
// Retrieve
$this->retrieved = Event::retrieve($this->created->id);
// Update
// Delete
$this->deleted = $this->created->delete();
// List
$this->order = Event::all(array("order" => "id"));
$this->orderInv = Event::all(array("order" => "-id"));
$this->limit5 = Event::all(array("limit" => "5", "order" => "id"));
$this->limit1 = Event::all(array("start_after" => $this->limit5[1]->id, "end_before" => $this->limit5[3]->id));
$this->oneId = Event::all(array("id" => $this->limit5[1]->id));
}
示例12: saveEvent
function saveEvent($arr, $name)
{
$now = new DateTime();
if (strtotime($arr['start_time']) > $now->getTimestamp()) {
echo $arr['name'] . ', ';
var_dump($arr);
$date = date('Y-m-d H:i:s', strtotime($arr['start_time']));
if (!isset($arr['place']['location']['longitude']) || !isset($arr['place']['location']['latitude'])) {
$loc = getLngLat($arr['place']['name']);
} else {
$loc = getPlaceName($arr['place']['location']['longitude'] . ' ' . $arr['place']['location']['latitude']);
}
if ($loc) {
$lnglat = $loc['lng'] . ' ' . $loc['lat'];
$place = $loc['place'];
} else {
$place = $arr['place']['name'];
$loc = $arr['place']['location']['longitude'] . ' ' . $arr['place']['location']['latitude'];
}
$event = array('TITLE' => $arr['name'], 'DESCRIPTION' => $arr['description'], 'PLACE' => $place, 'EVENTDATE' => $date, 'PLACELNGLAT' => $lnglat, 'FACEBOOKID' => $id, 'EMAIL' => '', 'URL' => '', 'FACEBOOKEVENTID' => $arr['id'], 'FACEBOOKID' => $name);
$addEvent = new Event();
$addEvent->create($event);
}
}
示例13: or
require_once 'MysqlEntity.class.php';
class_exists('Update') or (require_once 'Update.class.php');
Update::ExecutePatch(true);
require_once 'Feed.class.php';
require_once 'Event.class.php';
require_once 'User.class.php';
require_once 'Folder.class.php';
require_once 'Configuration.class.php';
$cryptographicSalt = User::generateSalt();
$synchronisationCode = substr(sha1(rand(0, 30) . time() . rand(0, 30)), 0, 10);
$root = substr($_['root'], strlen($_['root']) - 1) == '/' ? $_['root'] : $_['root'] . '/';
// DOSSIERS À CONSERVER TELS QUELS, SI DÉJÀ EXISTANTS
$feedManager = new Feed();
$feedManager->create();
$eventManager = new Event();
$eventManager->create();
// COMPTE ADMINISTRATEUR, RÀZ SI NÉCESSAIRE
$userManager = new User();
if ($userManager->tableExists()) {
// Suppose qu'il n'y a qu'un seul utilisateur
$userManager->truncate();
}
$userManager->create();
$admin = new User();
$admin->setLogin($_['login']);
$admin->setPassword($_['password'], $cryptographicSalt);
$admin->save();
$_SESSION['currentUser'] = serialize($admin);
// DOSSIERS DE FLUX, RECRÉE LE DOSSIER GÉNÉRAL SI NÉCESSAIRE
$folderManager = new Folder();
$folderManager->create();
示例14: testCancelWithParticipant
/**
* Test cancel order api
*/
public function testCancelWithParticipant()
{
$this->_eventId = Event::create($this->_individualId);
$eventParams = array('id' => $this->_eventId, 'financial_type_id' => 4, 'is_monetary' => 1);
$this->callAPISuccess('event', 'create', $eventParams);
$participantParams = array('financial_type_id' => 4, 'event_id' => $this->_eventId, 'role_id' => 1, 'status_id' => 1, 'fee_currency' => 'USD', 'contact_id' => $this->_individualId);
$participant = $this->callAPISuccess('Participant', 'create', $participantParams);
$extraParams = array('contribution_mode' => 'participant', 'participant_id' => $participant['id']);
$contribution = $this->addOrder(TRUE, 100, $extraParams);
$paymentParticipant = array('participant_id' => $participant['id'], 'contribution_id' => $contribution['id']);
$this->callAPISuccess('ParticipantPayment', 'create', $paymentParticipant);
$params = array('contribution_id' => $contribution['id']);
$this->callAPISuccess('order', 'cancel', $params);
$order = $this->callAPISuccess('Order', 'get', $params);
$expectedResult = array($contribution['id'] => array('total_amount' => 100, 'contribution_id' => $contribution['id'], 'contribution_status' => 'Cancelled', 'net_amount' => 100));
$this->checkPaymentResult($order, $expectedResult);
$participantPayment = $this->callAPISuccess('ParticipantPayment', 'getsingle', $params);
$participant = $this->callAPISuccess('participant', 'get', array('id' => $participantPayment['participant_id']));
$this->assertEquals($participant['values'][$participant['id']]['participant_status'], 'Cancelled');
$this->callAPISuccess('Contribution', 'Delete', array('id' => $contribution['id']));
}
示例15: Event
<?php
/**
* Création d'un nouvel événement
*
* PHP version 5
*
* @category Ajax
* @package LeQG
* @author Damien Senger <hi@hiwelo.co>
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0
* @link http://leqg.info
*/
$event = Event::create($_GET['contact']);
$event = new Event($event);
echo $event->json();