本文整理汇总了PHP中Events::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Events::create方法的具体用法?PHP Events::create怎么用?PHP Events::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events::create方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postCreate
public function postCreate()
{
$rules = array('title' => 'required', 'description' => 'required', 'broadcasted_in' => 'required');
$v = Validator::make(Input::all(), $rules);
if ($v->fails()) {
return Redirect::back()->withErrors($v);
}
Events::create(Input::all());
return Redirect::back()->with('success', 'New Event Added Successfully');
}
示例2: new_eventAction
public function new_eventAction()
{
if ($this->request->isPost()) {
$countryId = $this->request->getPost('country_id');
$country = Countries::findFirst(array('columns' => '*', 'conditions' => 'id LIKE :id:', 'bind' => array('id' => $countryId)));
$countryName = '';
if ($country) {
$countryName = $country->country;
}
$address = str_replace(' ', '+', $this->request->getPost('street') . '+' . $this->request->getPost('city') . '+' . $countryName);
$userSession = $this->session->get("userSession");
$content = file_get_contents('https://maps.googleapis.com/maps/api/geocode/json?address=' . $address . '&key=AIzaSyAbpLPfBH8sNdVSzMULD_BZN9qrAqbL3V8');
$json = json_decode($content, true);
$lat = $json['results'][0]['geometry']['location']['lat'];
$lng = $json['results'][0]['geometry']['location']['lng'];
//error_log('LAT : '.$lat.' LONG : '.$lng);
$events = new Events();
$events->created = date('Y-m-d H:i:s');
$events->modified = date('Y-m-d H:i:s');
$events->member_id = $userSession['id'];
$events->name = $this->request->getPost('name');
$events->website = $this->request->getPost('website');
$events->telephone = $this->request->getPost('telephone');
$events->street = $this->request->getPost('street');
$events->city = $this->request->getPost('city');
$events->country_id = $this->request->getPost('country_id');
$events->lat = $lat;
$events->lng = $lng;
$events->event_date = $this->request->getPost('eventdate');
$events->event_category_id = $this->request->getPost('event_category_id');
$events->eventinfo = $this->request->getPost('eventinfo');
if ($events->create()) {
$id = $events->id;
$this->flash->success('<button type="button" class="close" data-dismiss="alert">×</button>New event has been created');
if (!empty($this->request->getPost('review'))) {
$review = new Reviews();
$review->created = date('Y-m-d H:i:s');
$review->modified = date('Y-m-d H:i:s');
$review->member_id = $userSession['id'];
$review->event_id = $events->id;
$review->content = $this->request->getPost('review');
$review->rate = $this->request->getPost('rate');
if ($review->create()) {
$this->flash->success('<button type="button" class="close" data-dismiss="alert">×</button>You\'re review has been submitted.');
}
}
return $this->response->redirect('events/view/' . $id);
}
}
$countries = Countries::find();
$this->view->setVar('countries', $countries);
$eventsCategories = EventsCategories::find();
$this->view->setVar('eventsCategories', $eventsCategories);
}
示例3: eventEntered
public function eventEntered()
{
$event = Events::create(array('evName' => Input::get('evName'), 'evIntro' => Input::get('evIntro'), 'evRules' => Input::get('evRules'), 'evCat' => Input::get('evCat')));
$phone = Input::get('phone');
foreach (Input::get('name') as $key => $name) {
if (strlen($name) > 0) {
$organizer = new Organizer();
$organizer->name = $name;
if (strlen($phone[$key]) > 0) {
$organizer->phone = $phone[$key];
}
$organizer->evId = $event->evId;
$organizer->save();
}
}
return Redirect::to('admin/eventEntry')->with('isErr', false)->with('msg', 'Successfully inserted event.');
}
示例4: store
/**
* Store a newly created event in storage.
*
* @return Response
*/
public function store()
{
$data = Input::all();
$events = Events::create($data);
if ($events) {
$oc = Occupency::where('area_name', '=', $events->area)->first();
if ($events->event == 'ENTER') {
$oc->user_count = $oc->user_count + 1;
} else {
$oc->user_count = $oc->user_count - 1;
}
if ($oc->user_count < 0) {
$oc->user_count = 0;
}
$oc->save();
return Response::json(['error' => 'false', 'data' => $events->toArray()], 200);
}
return Response::json(['error' => 'true', 'message' => 'Could not create Event'], 400);
}
示例5: Events
$securityevents = new Events($db);
// Delete events
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "events";
$sql .= " WHERE entity = " . $conf->entity;
$resql = $db->query($sql);
if (!$resql) {
$error++;
$mesg = '<div class="error">' . $db->lasterror() . '</div>';
}
// Add event purge
$text = $langs->trans("SecurityEventsPurged");
$securityevent = new Events($db);
$securityevent->type = 'SECURITY_EVENTS_PURGE';
$securityevent->dateevent = $now;
$securityevent->description = $text;
$result = $securityevent->create($user);
if ($result > 0) {
$db->commit();
dol_syslog($text, LOG_WARNING);
} else {
$error++;
dol_syslog($securityevent->error, LOG_ERR);
$db->rolback();
}
}
/*
* View
*/
llxHeader();
$form = new Form($db);
$userstatic = new User($db);
示例6: Events
if (!$session->is_logged_in()) {
session_start();
}
if (!isset($_SESSION['u_id'])) {
redirect_to('../homepage.php');
}
$user = Users::find_by_id($_SESSION['u_id']);
if (isset($_POST['evnt'])) {
$evnts = new Events();
$evnts->e_name = $_POST['name'];
$evnts->e_description = $_POST['description'];
$evnts->e_venue = $_POST['venue'];
$evnts->e_time = $_POST['time'];
$evnts->e_date = $_POST['date'];
$evnts->e_duration = $_POST['duration'];
$evnts->create();
}
?>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Debate Club</title>
<!-- CSS -->
<link href="../wp-content/themes/openmind/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="../wp-content/themes/openmind/css/font-awesome.min.css" rel="stylesheet" media="screen">
<link href="../wp-content/themes/openmind/css/animate.min.css" rel="stylesheet" media="screen">
<link href="../wp-content/themes/openmind/css/lightbox.css" rel="stylesheet" media="screen">
示例7: runTrigger
//.........这里部分代码省略.........
$text .= empty($object->trigger_mesg) ? '' : ' - ' . $object->trigger_mesg;
$desc = "(UserLogged," . $object->login . ")";
$desc .= empty($object->trigger_mesg) ? '' : ' - ' . $object->trigger_mesg;
}
if ($action == 'USER_LOGIN_FAILED') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
// Initialisation donnees (date,duree,texte,desc)
$text = $object->trigger_mesg;
// Message direct
$desc = $object->trigger_mesg;
// Message direct
}
if ($action == 'USER_LOGOUT') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
// Initialisation donnees (date,duree,texte,desc)
$text = "(UserLogoff," . $object->login . ")";
$desc = "(UserLogoff," . $object->login . ")";
}
if ($action == 'USER_CREATE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$text = $langs->transnoentities("NewUserCreated", $object->login);
$desc = $langs->transnoentities("NewUserCreated", $object->login);
} elseif ($action == 'USER_MODIFY') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$text = $langs->transnoentities("EventUserModified", $object->login);
$desc = $langs->transnoentities("EventUserModified", $object->login);
} elseif ($action == 'USER_NEW_PASSWORD') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$text = $langs->transnoentities("NewUserPassword", $object->login);
$desc = $langs->transnoentities("NewUserPassword", $object->login);
} elseif ($action == 'USER_ENABLEDISABLE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
if ($object->statut == 0) {
$text = $langs->transnoentities("UserEnabled", $object->login);
$desc = $langs->transnoentities("UserEnabled", $object->login);
}
if ($object->statut == 1) {
$text = $langs->transnoentities("UserDisabled", $object->login);
$desc = $langs->transnoentities("UserDisabled", $object->login);
}
} elseif ($action == 'USER_DELETE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$text = $langs->transnoentities("UserDeleted", $object->login);
$desc = $langs->transnoentities("UserDeleted", $object->login);
} elseif ($action == 'GROUP_CREATE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$text = $langs->transnoentities("NewGroupCreated", $object->name);
$desc = $langs->transnoentities("NewGroupCreated", $object->name);
} elseif ($action == 'GROUP_MODIFY') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$text = $langs->transnoentities("GroupModified", $object->name);
$desc = $langs->transnoentities("GroupModified", $object->name);
} elseif ($action == 'GROUP_DELETE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$text = $langs->transnoentities("GroupDeleted", $object->name);
$desc = $langs->transnoentities("GroupDeleted", $object->name);
}
// If not found
/*
else
{
dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action.");
return 0;
}
*/
// Add entry in event table
include_once DOL_DOCUMENT_ROOT . '/core/class/events.class.php';
$event = new Events($this->db);
$event->type = $action;
$event->dateevent = $date;
$event->label = $text;
$event->description = $desc;
$event->user_agent = $_SERVER["HTTP_USER_AGENT"];
$result = $event->create($user);
if ($result > 0) {
return 1;
} else {
$error = "Failed to insert security event: " . $event->error;
$this->error = $error;
dol_syslog(get_class($this) . ": " . $this->error, LOG_ERR);
return -1;
}
return 0;
}
示例8: newAction
public function newAction()
{
if ($this->request->isPost()) {
$messages = $this->formValidate();
if (count($messages)) {
$this->view->disable();
$errorMsg = '';
foreach ($messages as $msg) {
$errorMsg .= $msg . "<br>";
}
$this->flash->error('<button type="button" class="close" data-dismiss="alert">×</button>' . $errorMsg);
return $this->response->redirect('event/new/');
} else {
$this->view->disable();
echo "validation is either failed or passed";
}
$userSession = $this->session->get("userSession");
$eventName = $this->request->getPost("name");
$website = $this->request->getPost("website");
$telephone = $this->request->getPost("telephone");
$street = $this->request->getPost("street");
$city = $this->request->getPost("city");
$info = $this->request->getPost("event_info");
$category = $this->request->getPost("category");
$country = $this->request->getPost("country");
$raw_address = $this->request->getPost("address");
$latitude = $this->request->getPost("lat");
$longitude = $this->request->getPost("lng");
$dates = $this->request->getPost("date");
$fromTimes = $this->request->getPost("fromTime");
$toTimes = $this->request->getPost("toTime");
$event = new Events();
$event->created = date('Y-m-d H:i:s');
$event->modified = date('Y-m-d H:i:s');
$event->member_id = $userSession['id'];
$event->name = $eventName;
$event->event_date = $this->request->getPost("date");
$event->website = $website;
$event->telephone = $telephone;
$event->street = $street;
$event->city = $city;
$event->country_id = $country;
$event->event_category_id = $category;
$event->lng = $longitude;
$event->lat = $latitude;
$event->eventinfo = $info;
if ($event->create()) {
$id = $event->id;
$i = 0;
foreach ($dates as $date) {
$eventDatetime = new EventDatetimes();
$eventDatetime->event_id = $id;
$eventDatetime->date = $date;
$eventDatetime->from_time = $fromTimes[$i];
$eventDatetime->to_time = $toTimes[$i];
$i++;
if (!$eventDatetime->create()) {
$this->view->disable();
echo "failed to insert event date and time in event_datetimes table. :(";
}
}
$this->flash->success('<button type="button" class="close" data-dismiss="alert">×</button>New event has been posted');
if ($this->request->hasFiles() == true) {
$uploads = $this->request->getUploadedFiles();
$isUploaded = false;
$ctr = 1;
foreach ($uploads as $upload) {
# define a "unique" name and a path to where our file must go
$fileName = $upload->getname();
$fileInfo = new SplFileInfo($fileName);
$fileExt = $fileInfo->getExtension();
$fileExt = strtolower($fileExt);
$newFileName = substr(md5(uniqid(rand(), true)), 0, 10) . date('ymdhis') . '.' . $fileExt;
$fileImageExt = array('jpeg', 'jpg', 'png');
$fileType = '';
$filePath = '';
$path = '';
if (in_array($fileExt, $fileImageExt)) {
$path = 'img/event/' . $newFileName;
$filePath = 'img/event/';
//$fileType = 'Image';
}
# move the file and simultaneously check if everything was ok
$upload->moveTo($path) ? $isUploaded = true : ($isUploaded = false);
if ($isUploaded) {
$eventPhotos = new EventPhotos();
$eventPhotos->created = date('Y-m-d H:i:s');
$eventPhotos->modified = date('Y-m-d H:i:s');
$eventPhotos->member_id = $userSession['id'];
$eventPhotos->event_id = $id;
$eventPhotos->file_path = $filePath;
$eventPhotos->filename = $newFileName;
$eventPhotos->caption = $this->request->getPost('caption');
//$ctr++;
if ($eventPhotos->create()) {
echo "success";
} else {
$this->view->disable();
print_r($eventPhotos->getMessages());
}
//.........这里部分代码省略.........
示例9: runFactory
/**
* Run Behavior factory when contoller is comletly loaded
* @return void
* @access public
* @author Kaero
* @copyright ImageCMS (c) 2012, Kaero <dev@imagecms.net>
*/
public function runFactory($eventAlias = null, $cleanQueue = false)
{
defined('BASEPATH') or exit('No direct script access allowed');
foreach (Events::create()->storage as $storageKey => $value) {
if (!is_null($eventAlias) && $eventAlias != $storageKey) {
continue;
}
if (isset($value['run'])) {
if ($value['run'] === TRUE && isset($value['collable'])) {
foreach ($value['collable'] as $collableKey => $run) {
if ($run['isClosure'] === false) {
call_user_func(array($run['collClass'], $run['collMethod']), $value['params']);
} else {
call_user_func($run['collMethod'], $value['params']);
}
if ($cleanQueue === true) {
unset(Events::create()->storage[$storageKey]['collable'][$collableKey]);
}
}
}
}
}
// \CMSFactory\Events::create()->get();
}
示例10: run
public function run()
{
Events::create(['user_id' => 1, 'event' => 'enter', 'area' => 'Office']);
}
示例11: process_request
protected final function process_request()
{
// Process
//
if ($this->request_noun === REQUEST_NOUN_USERS) {
if ($this->request_verb === 'show') {
// Show
//
if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_GET) {
Users::show($this->inputter, $this->outputter);
} else {
$this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
}
} else {
if ($this->request_verb === 'search' && $this->http_method === HTTP_METHOD_GET) {
// Search
//
Users::search($this->inputter, $this->outputter);
} else {
if ($this->request_verb === 'lookup' && $this->http_method === HTTP_METHOD_GET) {
// Lookup
//
Users::lookup($this->inputter, $this->outputter);
} else {
$this->invalid_process_verb();
}
}
}
} else {
if ($this->request_noun === REQUEST_NOUN_FRIENDS) {
if ($this->request_verb === 'list' && $this->http_method === HTTP_METHOD_GET) {
// List
//
Friends::_list($this->inputter, $this->outputter);
} else {
if ($this->request_verb === 'ids' && $this->http_method === HTTP_METHOD_GET) {
// User IDs
//
Friends::ids($this->inputter, $this->outputter);
} else {
$this->invalid_process_verb();
}
}
} else {
if ($this->request_noun === REQUEST_NOUN_FOLLOWERS) {
if ($this->request_verb === 'list' && $this->http_method === HTTP_METHOD_GET) {
// List
//
Followers::_list($this->inputter, $this->outputter);
} else {
if ($this->request_verb === 'ids' && $this->http_method === HTTP_METHOD_GET) {
// User IDs
//
Followers::ids($this->inputter, $this->outputter);
} else {
$this->invalid_process_verb();
}
}
} else {
if ($this->request_noun === REQUEST_NOUN_IN_PRODUCT_PROMOTIONS) {
if ($this->request_verb === 'show') {
// Show
//
if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_GET) {
// In Product Promotion ID
//
InProductPromotions::show($this->inputter, $this->outputter);
} else {
$this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
}
} else {
if ($this->request_verb === 'create' && $this->http_method === HTTP_METHOD_POST) {
// Create
//
InProductPromotions::create($this->inputter, $this->outputter);
} else {
if ($this->request_verb === 'update' && $this->http_method === HTTP_METHOD_POST) {
// Update
//
InProductPromotions::update($this->inputter, $this->outputter);
} else {
if ($this->request_verb === 'destroy') {
// Destroy
//
if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_DELETE) {
// In Product Promotion ID
//
InProductPromotions::destroy($this->inputter, $this->outputter);
} else {
$this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
}
} else {
$this->invalid_process_verb();
}
}
}
}
} else {
if ($this->request_noun === REQUEST_NOUN_INVITATIONS) {
if ($this->request_verb === 'show') {
//.........这里部分代码省略.........
开发者ID:adamcarter93,项目名称:university-final-year-project-rest-api,代码行数:101,代码来源:EventsRESTController.php