Inheritance: extends BaseEventModel
Esempio n. 1
0
 public function createEvent(string $eventName, string $eventDescription, int $location)
 {
     $session = CustomSession::getInstance();
     $creator = $session->getCurrentUser();
     $userID = $creator['id_person'];
     $model = new EventModel();
     $model->createEvent($userID, $eventName, $eventDescription, $location);
 }
 protected function build()
 {
     if ($this->event) {
         $this->where[] = "  event_comment_information.event_id = :event_id ";
         $this->params['event_id'] = $this->event->getId();
     }
     if (!$this->include_deleted) {
         $this->where[] = " event_comment_information.is_deleted = '0' ";
     }
     if (!$this->include_closed_by_admin) {
         $this->where[] = " event_comment_information.is_closed_by_admin = '0' ";
     }
 }
Esempio n. 3
0
 public function index()
 {
     $this->assign('event', EventModel::hotEvents(1));
     $users = model('User')->getUserList(10);
     foreach ($users['data'] as &$user) {
         $user = model('User')->formatForApi($user, $user['uid']);
     }
     $this->assign('users', $users['data']);
     $blogs = BlogModel::hotBlogs(10);
     $this->assign('blogs', $blogs);
     $video = M('V')->hotVideo(8);
     foreach ($video as &$row) {
         $row['user'] = model('User')->formatForApi($row, $row['uid']);
     }
     $this->assign('videos', $video);
     //$this->ajaxReturn($video);
     //热门图片
     $photos = M('Photo')->where(array('is_del' => 0))->limit(10)->order('commentCount desc,cTime desc')->select();
     $this->assign('photos', $photos);
     //热门专题
     $album = M('Album')->order('comment_count desc')->find();
     $album['intro'] = htmlspecialchars_decode($album['intro']);
     $album['attach_info'] = model('attach')->getAttachById($album['attach']);
     $this->assign('album', $album);
     $this->display();
 }
Esempio n. 4
0
 /**
  * Статистика просмотров поста:
  */
 public static function updatePostStats($board, $id, $writing = false)
 {
     $ip = $_SERVER['REMOTE_ADDR'];
     $cache = KVS::getInstance();
     if ($cache->exists(__CLASS__, $board . ':' . $id, 'stats')) {
         $stats = unserialize($cache->get(__CLASS__, $board . ':' . $id, 'stats'));
     } else {
         $stats = array('online' => array(), 'writers' => array());
     }
     $stats['online'][$ip] = time();
     $stats['online'] = array_filter($stats['online'], function ($value) {
         return time() - $value < 60 * 2;
     });
     if (array_key_exists($ip, $stats['writers']) && !$writing) {
         unset($stats['writers'][$ip]);
     } elseif ($writing) {
         $stats['writers'][$ip] = time();
     }
     foreach ($stats['writers'] as $ip => $time) {
         if (time() - $time > 20) {
             unset($stats['writers'][$ip]);
         }
     }
     $cache->set(__CLASS__, $board . ':' . $id, 'stats', serialize($stats));
     EventModel::getInstance()->Broadcast('board_stats_updated', array($board, $id));
     return true;
 }
Esempio n. 5
0
 public function getAction($request, $db)
 {
     $event_id = $this->getItemId($request);
     // verbosity
     $verbose = $this->getVerbosity($request);
     // pagination settings
     $start = $this->getStart($request);
     $resultsperpage = $this->getResultsPerPage($request);
     if (isset($request->url_elements[4])) {
         switch ($request->url_elements[4]) {
             case 'talks':
                 $list = TalkModel::getTalksByEventId($db, $event_id, $resultsperpage, $start, $verbose);
                 $list = TalkModel::addHypermedia($list, $request);
                 break;
             case 'comments':
                 $list = EventCommentModel::getEventCommentsByEventId($db, $event_id, $resultsperpage, $start, $verbose);
                 break;
             default:
                 throw new InvalidArgumentException('Unknown Subrequest', 404);
                 break;
         }
     } else {
         if ($event_id) {
             $list = EventModel::getEventById($db, $event_id, $verbose);
         } else {
             $list = EventModel::getEventList($db, $resultsperpage, $start, $verbose);
         }
         // add links
         $list = EventModel::addHypermedia($list, $request);
     }
     return $list;
 }
 public function updateEventsTable()
 {
     $events = EventModel::all();
     foreach ($events as $event) {
         $count = Subscription::findEventCount($event->id);
         EventModel::fixEventCounts($event->id, $count);
     }
 }
Esempio n. 7
0
 public function getEventBuy($id)
 {
     $user_id = Auth::user()->id;
     $user = User::find($user_id);
     $order = EventModel::find($id);
     $date = DateTime::createFromFormat('Y-m-d H:i:s', $order->time);
     $date = $date->format('j/m/y @ gA');
     return View::make('events.event-buy')->with('order', $order)->with('date', $date)->with('user', $user);
 }
 public function index()
 {
     //code should be inside a method
     $events[] = \Calendar::event('Event One', false, '2015-06-05T0800', '2015-06-05T0800', 0);
     $eloquentEvent = EventModel::first();
     //EventModel implements MaddHatter\LaravelFullcalendar\Event
     $calendar = \Calendar::addEvents($events)->setOptions(['firstDay' => 1])->setCallbacks(['viewRender' => 'function() {alert("Callbacks!");}']);
     return view('pages.calendar', compact('calendar'));
 }
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 50) as $index) {
         $event = EventModel::orderBy(DB::raw('RAND()'))->first()->id;
         $tag = Tag::orderBy(DB::raw('RAND()'))->first()->id;
         $array = ['tag_id' => $tag, 'taggable_id' => $event, 'taggable_type' => 'EventModel'];
         DB::table('taggables')->insert($array);
     }
 }
Esempio n. 10
0
 /**
  * Poo chan:
  */
 public function pooAjaxAction(Application $application)
 {
     $cache = KVS::getInstance();
     if ($cache->exists(__CLASS__, 'poo', $_SERVER['REMOTE_ADDR'])) {
         return false;
     }
     EventModel::getInstance()->ClientBroadcast('page_' . $_POST['target'], "poo", array('top' => $_POST['top'], 'left' => $_POST['left']));
     $cache->set(__CLASS__, 'poo', $_SERVER['REMOTE_ADDR'], 1);
     $cache->expire(__CLASS__, 'poo', $_SERVER['REMOTE_ADDR'], 1);
     return true;
 }
Esempio n. 11
0
 public function getAction($request, $db)
 {
     $event_id = $this->getItemId($request);
     // verbosity
     $verbose = $this->getVerbosity($request);
     // pagination settings
     $start = $this->getStart($request);
     $resultsperpage = $this->getResultsPerPage($request);
     if (isset($request->url_elements[4])) {
         switch ($request->url_elements[4]) {
             case 'talks':
                 $list = TalkModel::getTalksByEventId($db, $event_id, $resultsperpage, $start, $verbose);
                 $list = TalkModel::addHypermedia($list, $request);
                 break;
             case 'comments':
                 $list = EventCommentModel::getEventCommentsByEventId($db, $event_id, $resultsperpage, $start, $verbose);
                 break;
             default:
                 throw new InvalidArgumentException('Unknown Subrequest', 404);
                 break;
         }
     } else {
         if ($event_id) {
             $list = EventModel::getEventById($db, $event_id, $verbose);
         } else {
             // check if we're filtering
             if (isset($request->parameters['filter'])) {
                 switch ($request->parameters['filter']) {
                     case "hot":
                         $list = EventModel::getHotEventList($db, $resultsperpage, $start, $verbose);
                         break;
                     case "upcoming":
                         $list = EventModel::getUpcomingEventList($db, $resultsperpage, $start, $verbose);
                         break;
                     case "past":
                         $list = EventModel::getPastEventList($db, $resultsperpage, $start, $verbose);
                         break;
                     case "cfp":
                         $list = EventModel::getOpenCfPEventList($db, $resultsperpage, $start, $verbose);
                         break;
                     default:
                         throw new InvalidArgumentException('Unknown event filter', 404);
                         break;
                 }
             } else {
                 $list = EventModel::getEventList($db, $resultsperpage, $start, $verbose);
             }
         }
         // add links
         $list = EventModel::addHypermedia($list, $request);
     }
     return $list;
 }
Esempio n. 12
0
 public function comment()
 {
     $event_id = $_GET['id'];
     $event = EventModel::detail($event_id);
     $data = array('app' => 'public', 'table' => 'event', 'row_id' => $event_id, 'app_uid' => $event['uid'], 'uid' => $this->uid, 'content' => strip_tags($_REQUEST['content'], '<img><a><p><b><i>'), 'to_comment_id' => 0, 'to_uid' => 0, 'client_type' => 0, 'ctime' => time());
     $info = M('comment')->add($data);
     if ($info) {
         M('event')->updateCommentCount($photo_id);
         $this->ajaxReturn(null, '评论成功');
     }
     $this->ajaxReturn(null, '评论失败', false);
 }
 public function run()
 {
     // Uncomment the below to wipe the table clean before populating
     DB::table('photos')->truncate();
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 50; $i++) {
         $event = EventModel::orderBy(DB::raw('RAND()'))->first()->id;
         $images = array(['name' => $faker->imageUrl(120, 120), 'imageable_id' => $event, 'imageable_type' => $faker->randomElement(['EventModel', 'Blog']), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
         //            DB::table('photos')->insert($images);
     }
     // Uncomment the below to run the seeder
 }
 public function run()
 {
     DB::table('comments')->truncate();
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 1; $i++) {
         $user = User::orderBy(DB::raw('RAND()'))->first()->id;
         $event = EventModel::orderBy(DB::raw('RAND()'))->first()->id;
         // $post = Event::orderBy(DB::raw('RAND()'))->first()->id;
         $comments = array(['user_id' => $user, 'commentable_id' => $faker->randomElement([$event]), 'commentable_type' => $faker->randomElement(['EventModel']), 'content' => $faker->sentence(30), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
         DB::table('comments')->insert($comments);
     }
 }
 public function run()
 {
     // Uncomment the below to wipe the table clean before populating
     DB::table('favorites')->truncate();
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 30; $i++) {
         $event = EventModel::orderBy(DB::raw('RAND()'))->first()->id;
         $user = User::orderBy(DB::raw('RAND()'))->first()->id;
         $favorites = array(['user_id' => $user, 'event_id' => $event, 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
         DB::table('favorites')->insert($favorites);
     }
     // Uncomment the below to run the seeder
 }
 public function run()
 {
     // Uncomment the below to wipe the table clean before populating
     DB::table('event_prices')->truncate();
     for ($i = 0; $i < 3; $i++) {
         $event = EventModel::orderBy(DB::raw('RAND()'))->first()->id;
         $country = ['1' => 1, '2' => 2];
         $price = [200, 300, 400, 500, 600];
         $registration_types = ['VIP' => 'VIP', 'NORMAL' => 'NORMAL', 'ONLINE' => 'ONLINE'];
         $k = array_rand($price);
         $favorites = array(['country_id' => array_rand($country), 'event_id' => $event, 'price' => $price[$k], 'type' => array_rand($registration_types), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
         DB::table('event_prices')->insert($favorites);
     }
     // Uncomment the below to run the seeder
 }
Esempio n. 17
0
 public function ShowEvents(int $location, string $locationName)
 {
     $model = new EventModel();
     $events = $model->loadEventsByLocation($location);
     echo "<p>" . $locationName . "</p>";
     echo '
                 <table>
                     <tr>
                         <td>Name</td>
                         <td>Beschreibung</td>
                     </tr>
              ';
     while ($event = sqlsrv_fetch_array($events)) {
         $name = $event['name'];
         $description = $event['description'];
         echo '
                     <tr>
                         <td>' . $name . '</td>
                         <td>' . $description . '</td>
                     </tr>
              ';
     }
     echo '</table>';
 }
 public function run()
 {
     // Uncomment the below to wipe the table clean before populating
     DB::table('followers')->truncate();
     $dt = Carbon::now();
     $dateNow = $dt->toDateTimeString();
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 40; $i++) {
         $this->setEvent(EventModel::orderBy(DB::raw('RAND()'))->first()->id);
         $this->setUser(User::orderBy(DB::raw('RAND()'))->first()->id);
         //            $this->checkUnique();
         $followers = array(['user_id' => $this->getUser(), 'event_id' => $this->getEvent(), 'created_at' => $dateNow, 'updated_at' => $dateNow]);
         DB::table('followers')->insert($followers);
     }
     // Uncomment the below to run the seeder
 }
Esempio n. 19
0
 /**
  * Удаление комментария:
  */
 public static function RemoveComment($id)
 {
     $comment = self::GetComment($id);
     $kvs = KVS::getInstance();
     $cache = KVS::getInstance();
     if ($comment) {
         if ($kvs->exists('ControlModel', 'timeblock', $comment['ip'])) {
             $kvs->set('ControlModel', 'timeban', $comment['ip'], true);
             $kvs->expire('ControlModel', 'timeban', $comment['ip'], 60 * 60);
         }
         if ($kvs->exists('ControlModel', 'timeban', $comment['ip'])) {
             $life = $kvs->lifetime('ControlModel', 'timeban', $comment['ip']);
             $kvs->expire('ControlModel', 'timeban', $comment['ip'], $life + 60 * 60);
         }
         $kvs->set('ControlModel', 'timeblock', $comment['ip'], true);
         $kvs->expire('ControlModel', 'timeblock', $comment['ip'], 60 * 60);
         $dbh = PDOQuery::getInstance();
         $dbh->update_insecure('1chan_post', array('comments' => '`comments`-1'), 'id = ' . $dbh->q($comment['post_id']), 1, true);
         $cache->listRemove(__CLASS__, null, 'lastComments', $id);
         EventModel::getInstance()->Broadcast('remove_comment', array('id' => $id, 'post_id' => $comment['post_id']));
         return $dbh->delete('1chan_comment', 'id = ' . $dbh->q($id), 1);
     }
     return false;
 }
Esempio n. 20
0
 /**
  * Установка количества участников в комнате:
  */
 public static function SetRoomOnline($id)
 {
     $ip = $_SERVER['REMOTE_ADDR'];
     $cache = KVS::getInstance();
     if ($cache->exists(__CLASS__, $id, 'stats')) {
         $stats = unserialize($cache->get(__CLASS__, $id, 'stats'));
     } else {
         $stats = array('online' => 0, 'visitors' => array());
     }
     $online_cache = $stats['online'];
     foreach ($stats['visitors'] as $is => $time) {
         if (time() - $time > 60 * 4) {
             unset($stats['visitors'][$is]);
             $stats['online']--;
         }
     }
     if (!array_key_exists($ip, $stats['visitors'])) {
         $stats['visitors'][$ip] = time();
         $stats['online']++;
     }
     $cache->set(__CLASS__, $id, 'stats', serialize($stats));
     if ($stats['online'] != $online_cache) {
         EventModel::getInstance()->Broadcast('room_stats_updated', array('room_id' => $id, 'stats' => $stats));
     }
     return true;
 }
Esempio n. 21
0
function counterString()
{
    // rows to be listed
    $datamap = $_SESSION['event_datamap'];
    $partial = count($datamap);
    // total rows
    include_once 'model.php';
    $model = EventModel::getInstance();
    $total = $model->countRows();
    // display counter
    $string = $partial . " of " . $total . " records";
    return $string;
}
Esempio n. 22
0
$app->response->headers->set("Content-Type", "application/json");
// end view setup
// start events list
$app->get('/events', function () use($app) {
    $db = $app->config('container')['db'];
    $data = array();
    $model = new EventModel($db);
    $data['events'] = $model->getSomeEvents();
    $app->render("foo.php", array("mydata" => $data));
});
// end events list
// start one event
$app->get('/events/:event_id', function ($event_id) use($app) {
    $db = $app->config('container')['db'];
    $data = array();
    $model = new EventModel($db);
    $data['events'] = $model->getOneEvent($event_id);
    $app->render("foo.php", array("mydata" => $data));
});
// end one event
// start auth
$app->post('/authorizations', function () use($app) {
    $db = $app->config('container')['db'];
    $data = array();
    // horribly assuming JSON. Real code checks first
    $in = json_decode(file_get_contents("php://input"), true);
    $model = new AuthModel($db);
    $data['access_token'] = $model->getAccessTokenFromCreds($in['username'], $in['password']);
    $app->render("foo.php", array("mydata" => $data));
});
// end auth
Esempio n. 23
0
 /**
  * Скрытие поста:
  */
 public static function HidePost($id, $hidden = true, $comment = '')
 {
     $dbh = PDOQuery::getInstance();
     EventModel::getInstance()->Broadcast('info_post', array($id, $comment));
     return $dbh->update('1chan_post', array('hidden' => $hidden), 'id = ' . $dbh->q($id));
 }
 public function applyToEvent(EventModel $event, EventModel $originalEvent)
 {
     $changes = false;
     if ($this->summary_change_possible && $this->summary_change_selected) {
         $event->setSummary($this->summary);
         $changes = true;
     }
     if ($this->description_change_possible && $this->description_change_selected) {
         $event->setDescription($originalEvent->getDescription());
         $changes = true;
     }
     if ($this->timezone_change_possible && $this->timezone_change_selected) {
         $event->setTimezone($originalEvent->getTimezone());
         $changes = true;
     }
     if ($this->country_area_venue_id_change_possible && $this->country_area_venue_id_change_selected) {
         $event->setCountryId($originalEvent->getCountryId());
         $event->setAreaId($originalEvent->getAreaId());
         $event->setVenueId($originalEvent->getVenueId());
         $changes = true;
     }
     if ($this->url_change_possible && $this->url_change_selected) {
         $event->setUrl($originalEvent->getUrl());
         $changes = true;
     }
     if ($this->ticket_url_change_possible && $this->ticket_url_change_selected) {
         $event->setTicketUrl($originalEvent->getTicketUrl());
         $changes = true;
     }
     if ($this->is_virtual_change_possible && $this->is_virtual_change_selected) {
         $event->setIsVirtual($originalEvent->getIsVirtual());
         $changes = true;
     }
     if ($this->is_physical_change_possible && $this->is_physical_change_selected) {
         $event->setIsPhysical($originalEvent->getIsPhysical());
         $changes = true;
     }
     if ($this->start_end_at_change_possible && $this->start_end_at_change_selected) {
         $event->setStartAt($this->start_at);
         $event->setEndAt($this->end_at);
         $changes = true;
     }
     if ($this->is_cancelled_change_possible && $this->is_cancelled_change_selected) {
         $event->setIsCancelled($originalEvent->getIsCancelled());
         $changes = true;
     }
     foreach ($this->custom_fields as $customField) {
         if ($this->getCustomFieldChangePossible($customField) && $this->getCustomFieldChangeSelected($customField)) {
             $event->setCustomField($customField, $originalEvent->getCustomField($customField));
             $changes = true;
         }
     }
     return $changes;
 }
Esempio n. 25
0
 /**
  * Отправка информационного сообщения в канал:
  */
 public static function AddInfoMessage($id, $message, $password = false)
 {
     $channel = self::GetChatChannel($id, $password);
     EventModel::getInstance()->ClientBroadcast('chat_' . $channel, 'message', array('type' => 'info', 'message' => $message));
     return true;
 }
Esempio n. 26
0
<?php

$this->pageLabel = Yii::t("admin", "Quản lý Sự Kiện");
$this->menu = array(array('label' => Yii::t('admin', 'Danh sách'), 'url' => array('admin')), array('label' => Yii::t('admin', 'Thêm mới'), 'url' => array('create')), array('label' => Yii::t('admin', 'Tìm kiếm'), 'url' => '#', 'linkOptions' => array('class' => 'search-button')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('admin-event-model-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'admin-event-model-grid', 'dataProvider' => $dataProvider, 'columns' => array(array('name' => 'name', 'header' => EventModel::model()->getAttributeLabel("name"), 'value' => 'CHtml::link($data->name,array("update","id"=>$data->_id))', 'type' => 'raw'), array('name' => 'description', 'header' => EventModel::model()->getAttributeLabel("description")), array('name' => 'group_id', 'header' => EventModel::model()->getAttributeLabel("group_id"), 'value' => 'AdminEventGroupModel::model()->findByPk(new MongoId($data->group_id))->name', 'type' => 'raw'), array('name' => 'point', 'header' => EventModel::model()->getAttributeLabel("point")), 'reset', array('name' => 'status', 'header' => EventModel::model()->getAttributeLabel("status"), 'value' => '($data->status==1)?"<span class=\\"s_label s_1\\">Actived</span>":"<span class=\\"s_label s_2\\">Not Active</span>"', 'type' => 'raw'), array('class' => 'CButtonColumn'))));
Esempio n. 27
0
 /**
  * Функция счетчика переходов:
  */
 public static function Click($id)
 {
     $cache = KVS::getInstance();
     $link = unserialize($cache->get(__CLASS__, 'links', $id));
     if (!in_array($_SERVER['REMOTE_ADDR'], $link['visitors'])) {
         $link['visitors'][] = $_SERVER['REMOTE_ADDR'];
         $link['clicks']++;
         $ttl = $cache->lifetime(__CLASS__, 'links', $id);
         $cache->set(__CLASS__, 'links', $id, serialize($link));
         $cache->expire(__CLASS__, 'links', $id, $ttl);
         EventModel::getInstance()->Broadcast('visit_online_link', array('id' => $id, 'clicks' => $link['clicks']));
     }
     return true;
 }
Esempio n. 28
0
 public function wLogEvent($user_id, $user_phone, $eventId, $source, $contentId = '', $contentName = '', $transaction = '', $transactionId = 0, $transaction_name, $log_point)
 {
     try {
         $log = new KLogger('log_event_users_transaction', KLogger::INFO);
         $event = EventModel::model()->findByPk(new MongoId($eventId));
         $point = $event->point;
         if ($log_point == 0) {
             $point = 0;
         }
         $log->LogInfo("{$transaction}|{$user_phone}|{$contentId}|{$point}", false);
         $userSubscribe = true;
         switch ($transaction) {
             case 'play_song':
                 $transactionValid = $this->isContent24h($contentId, $eventId, $user_phone, $transaction);
                 $point = $this->getPoint($contentId, $transaction, $point);
                 $pointValid = $this->isPoint24h($point, $user_phone);
                 break;
             case 'play_video':
                 $transactionValid = $this->isContent24h($contentId, $eventId, $user_phone, $transaction);
                 $point = $this->getPoint($contentId, $transaction, $point);
                 $pointValid = $this->isPoint24h($point, $user_phone);
                 break;
             case 'play_album':
                 $transactionValid = $this->isContent24h($contentId, $eventId, $user_phone, $transaction);
                 $point = $this->getPoint($contentId, $transaction, $point);
                 $pointValid = $this->isPoint24h($point, $user_phone);
                 $userSubscribe = UserSubscribeModel::model()->get($user_phone);
                 break;
             default:
                 $transactionValid = true;
                 $pointValid = true;
                 break;
         }
         if ($transactionValid && $pointValid && $userSubscribe) {
             if ($event && (!empty($user_id) || !empty($user_phone))) {
                 $eventName = $event->name;
                 $groupEventId = $event->group_id;
                 $groupEventName = $event->group_name;
                 $model = new self();
                 $model->user_id = (int) $user_id;
                 $model->user_phone = !empty($user_phone) ? $user_phone : 0;
                 $model->event_id = $eventId;
                 $model->event_name = $eventName;
                 $model->group_id = $groupEventId;
                 $model->group_name = $groupEventName;
                 $model->content_id = $contentId;
                 $model->content_name = $contentName;
                 $model->transaction = $transaction;
                 $model->transaction_name = $transaction_name;
                 $model->transaction_id = (string) $transactionId;
                 $model->point = (int) $point;
                 $model->method = $source;
                 $model->created_time = date('Y-m-d H:i:s');
                 $model->updated_time = date('Y-m-d H:i:s');
                 $res = $model->save();
                 $log->LogInfo('write log ' . $transaction . ' | ' . $user_phone . '|' . $transaction . '|event:' . $eventId . '|' . json_encode($res), false);
                 if (!$res) {
                     $errors = $model->getErrors();
                     $log->LogInfo('update log new:' . json_encode($errors), false);
                 } else {
                     $updatePoint = self::model()->updatePoint($user_id, $user_phone, $point, $event->reset);
                     $log->LogInfo('update point|' . $user_id . '|' . json_encode($user_phone) . ':' . json_encode($updatePoint), false);
                     return $updatePoint;
                 }
                 //return $res;
             }
         }
     } catch (Exception $e) {
         //$e->getMessage();
         $log->LogInfo('update log exception:' . $e->getMessage());
         return false;
     }
     return false;
 }
Esempio n. 29
0
 static function deleteEvent($id)
 {
     // retrieve model instance
     $model = EventModel::getInstance();
     // delegate deletion to the model
     $result = $model->delete($id);
     // reload events list
     $id = $_SESSION['activation_id'];
     //use if present
     EventsController::listRows($id);
 }
 public static function delete($id)
 {
     EventModel::delete($id);
 }