public function goToEvent($user_id, $event_id) { $userEvent = new UserEvent(); $userEvent->setUserId($user_id); $userEvent->setEventId($event_id); $userEvent->setGoing(true); $this->getEntityManager()->persist($userEvent); $this->getEntityManager()->flush(); }
public function batal_bergabung($id) { $iduser = Users::where('id', '=', Session::get('user_id'))->first()->id; $slug = Acara::where('id', '=', $id)->first()->slug; UserEvent::where('id_user', '=', $iduser)->where('id_acara', '=', $id)->delete(); return Redirect::to('/acara/' . $slug); }
private function setup() { $this->environment->addService("authentication", "AuthenticationServices"); $this->environment->addService("session", "SessionServices"); $this->environment->addService("configuration", "ConfigurationServices"); $this->environment->addService("filesystem", "FilesystemServices"); $this->environment->addService("events", "EventServices"); $this->environment->addService("permissions", "PermissionServices"); if (Logging::isDebug()) { $this->environment->addService("debug", "DebugServices"); $this->environment->response()->addListener($this); } UserEvent::register($this->environment->events()); $this->environment->permissions()->registerPermission("change_password"); $this->environment->plugins()->setup(); }
/** * Get a list of the most recent event of a given type (e.g., "sign_in") for each user. * * On success, this will set the event times for the specified event type as attributes of the User models. * Unfortunately, we can't store $recent_event_times directly in the collection, because it won't get copied in other operations. * So, it must be returned by this method instead. * @see https://github.com/laravel/framework/issues/10695 * @param string $type The type of event, matching the `event_type` field in the user_event table. * @param string $field_name optional The attribute name to use for this event in the User model. If not specified, defaults to last_{$type}_time. * @return array An array of datetime strings, keyed by the `id` of each User. */ public function getRecentEvents($type, $field_name = null) { if (!$field_name) { $field_name = "last_" . $type . "_time"; } $recentEventsQuery = UserEvent::mostRecentEventsByType($type); $recent_events = $recentEventsQuery->get(); $recent_event_times = []; // extract sign-in times foreach ($recent_events as $event) { $recent_event_times[$event['user_id']] = $event['occurred_at']; } // Merge in recent event times, and set any missing values foreach ($this as $user) { if (isset($recent_event_times[$user->id])) { $user->{$field_name} = $recent_event_times[$user->id]; } else { $user->{$field_name} = 0; // Should be an integer, so it can be properly parsed on client-side $recent_event_times[$user->id] = 0; } } return $recent_event_times; }
private function processDeleteUserGroups() { if (count($this->path) != 2) { throw $this->invalidRequestException(); } $id = $this->path[1]; $this->env->configuration()->removeUserGroup($id); $this->env->events()->onEvent(UserEvent::groupRemoved($id)); $this->response()->success(TRUE); }
$XML_debug = true; } if (isset($_REQUEST['action'])) { if ($_REQUEST['action'] == "rsvp") { $fp->log("rsvp"); $eid = $_REQUEST['eid']; if (isset($_REQUEST['ans']) && $_REQUEST['ans'] == 'yes') { $ans = 1; } else { if (isset($_REQUEST['ans']) && $_REQUEST['ans'] == 'no') { $ans = -1; } else { error('rsvp needs "ans" set to "yes" or "no"'); } } if (!UserEvent::rsvp($u, $eid, $ans)) { echo '{"status":"ERROR","results":"Problem on DB"}'; } else { echo '{"status":"OK","results":"DONE"}'; } } else { error('action unrecognized'); } } else { error('no action specified'); } //$timer->setMarker('setup'); //$timer->setMarker('query'); //InsertBenchmarkDB($timer); //Save the data on DB //echo '{""status": "OK", "results": "Done"}'; /*
public function _assignToEvent($id, $idEvent) { $data['id_euser'] = $id; $data['id_event'] = $idEvent; $model = new UserEvent(); $sData = $model->createRow($data); $sData->save(); $message['messages']['Contact'][$id] = 'User was assigned to event.'; $logger = Zend_Registry::get('logger'); Zend_Registry::set('logger', array_merge($logger, $message)); }
private function processDeleteUserGroups() { if (count($this->path) > 2) { throw $this->invalidRequestException(); } // configuration/usergroups if (count($this->path) == 1) { $data = $this->request->data; if (!isset($data['ids'])) { throw $this->invalidRequestException(); } $ids = $data['ids']; if (!$ids or !is_array($ids) or count($ids) == 0) { throw $this->invalidRequestException(); } $this->env->configuration()->removeUserGroups($ids); foreach ($ids as $id) { $this->env->events()->onEvent(UserEvent::groupRemoved($id)); } $this->response()->success(TRUE); return; } $id = $this->path[1]; $this->env->configuration()->removeUserGroup($id); $this->env->events()->onEvent(UserEvent::groupRemoved($id)); $this->response()->success(TRUE); }
public function bindEvent($user) { $this->loadModel('Invitation'); $invitation = new Invitation(); $conditions = ['Invitation.email' => $user['username']]; $result = $invitation->find('first', compact('conditions')); if (!empty($result)) { $this->loadModel('UserEvent'); $this->loadModel('UserEventShare'); $userEvent = new UserEvent(); $userEventShare = new UserEventShare(); $event = $result['UserEvent']; $invitation = $result['Invitation']; $ueShare = array('user_id' => $user['id'], 'user_event_id' => $invitation['object_id']); $event['recipient_id'] = $user['id']; $userEvent->create(); $userEvent->set($event); $userEvent->save(); $userEventShare->create(); $userEventShare->set($ueShare); $userEventShare->save(); } }
// Подключаем драйвер include_once __DIR__ . '/../include.php'; // Для упрощения выставляем принудительно таймзону date_default_timezone_set('Europe/Moscow'); // класс userevent include_once 'article_01_userevent.php'; // Конфигурация $config = ['host' => '192.168.1.20', 'port' => '8123', 'username' => 'default', 'password' => '']; $client = new \ClickHouseDB\Client($config); //$client->write('DROP TABLE IF EXISTS articles.events'); if (!$client->isExists('articles', 'events')) { $client->write('DROP TABLE IF EXISTS articles.events'); $client->write('CREATE DATABASE IF NOT EXISTS articles'); $client->write("\n CREATE TABLE articles.events (\n event_date Date DEFAULT toDate(event_time),\n event_time DateTime,\n event_type Enum8('VIEWS' = 1, 'CLICKS' = 2),\n site_id Int32,\n article_id Int32,\n ip String,\n city String,\n user_uuid String,\n referer String,\n utm String DEFAULT extractURLParameter(referer, 'utm_campaign')\n ) ENGINE = MergeTree(event_date, (site_id,event_type, article_id), 8192)\n"); // ---------------------------- создадим тестовый набор данных --------------- $userEvent = new UserEvent(); @unlink($fileName); echo "Write data to : " . $fileName . "\n\n"; for ($z = 0; $z < $count_rows; $z++) { $row = ['event_date' => $userEvent->getDate(), 'event_time' => $userEvent->getTime(), 'event_type' => $userEvent->getType(), 'site_id' => $userEvent->getSiteId(), 'article_id' => $userEvent->getArticleId(), 'ip' => $userEvent->getIp(), 'city' => $userEvent->getCity(), 'user_uuid' => $userEvent->getUserUuid(), 'referer' => $userEvent->getReferer(), 'utm' => $userEvent->getUtm()]; file_put_contents($fileName, \ClickHouseDB\FormatLine::TSV($row) . "\n", FILE_APPEND); if ($z % 100 == 0) { echo "{$z}\r"; } } // Включаем сжатие $client->setTimeout(300); $client->database('articles'); $client->enableHttpCompression(true); echo "\n> insertBatchFiles....\n"; $result_insert = $client->insertBatchTSVFiles('events', [$fileName], ['event_date', 'event_time', 'event_type', 'site_id', 'article_id', 'ip', 'city', 'user_uuid', 'referer', 'utm']);
/** * Pobranie dopisanych doradców do spotkania * * @param integer $id id użytkownika * @return Row_Uzytkownik */ public function showUsers($id_event) { $model = new UserEvent(); $data = $model->getAssignedUsers($id_event); return $data; }
if ($_REQUEST['action'] == "rsvp") { $fp->log("rsvp"); $eid = $_REQUEST['eid']; if (isset($_REQUEST['ans']) && $_REQUEST['ans'] == 'yes') { $ans = 1; } else { if (isset($_REQUEST['ans']) && $_REQUEST['ans'] == 'no') { $ans = -1; } else { error('rsvp needs "ans" set to "yes" or "no"'); } } if (!UserEvent::rsvp($u, $eid, $ans)) { echo '{"status":"ERROR","results":"Problem on DB"}'; } else { $users = UserEvent::getYesUsers($eid); $fp->log($users); if ($users->num >= $users->quota) { $recipents = $users->users; $sender['email'] = "*****@*****.**"; $sender['f_name'] = "Togethr.Us"; $sender['l_name'] = ""; $sub = "Bingo!!!"; $body = ""; emailNotificationAll($sender, $recipents, $sub, $body); echo "Quota Full Email Notification Sent {$recipents}"; } else { echo "RSVP Confirmed"; } } } else {