本文整理汇总了PHP中Events::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Events::add方法的具体用法?PHP Events::add怎么用?PHP Events::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events::add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addAction
/** Add an event
* @access public
* @return void
* @todo geocoding and processing in view
*/
public function addAction()
{
$form = new EventForm();
$form->details->setLegend('Add a new event');
$form->submit->setLabel('Save event');
$this->view->form = $form;
if ($this->_request->isPost() && $form->isValid($this->_request->getPost())) {
$this->_events->add($form->getValues());
$this->getFlash()->addMessage('New event created!');
$this->redirect('/admin/events/');
} else {
$form->populate($this->_request->getPost());
}
}
示例2: addAddsEventToList
/**
* @test
*/
public function addAddsEventToList()
{
$event = $this->getMockBuilder(Event::class)->getMock();
$instance = new Events();
$instance->add($event);
self::assertCount(1, $instance->getIterator());
}
示例3: Land
//Haal landen op
$landen = new Land();
$landen = $landen->get_all();
$events = new Events();
//Check of er POST waarde is
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
//Valideer post attr
if ($_POST && isset($_POST['naam'], $_POST['omschrijving'], $_POST['datum'], $_POST['type'], $_POST['genre'], $_POST['plaatsnaam'], $_POST['land'])) {
$naam = test_input($_POST['naam']);
$omschrijving = test_input($_POST['omschrijving']);
$datum = test_input($_POST['datum']);
$type = test_input($_POST['type']);
$genre = test_input($_POST['genre']);
$plaatsnaam = test_input($_POST['plaatsnaam']);
$land = test_input($_POST['land']);
$event = $events->add($type, $genre, $land, $plaatsnaam, $naam, $omschrijving, $datum, $usr['id']);
if ($event) {
$event = $events->get($event);
if ($event) {
?>
<script>
$.notify("Evenement is succesvol aangemaakt!", "success");
</script>
<?php
header('HTTP/1.0 302 Found');
header("Location: index.php?map=events&page=edit&id=" . $event['events_id']);
} else {
?>
<script>
$.notify("Evenement kon niet worden aangemaakt", "error");
</script>