コード例 #1
0
 /**
  * @param HookEvent $event
  */
 public function onRoutingStart(HookEvent $event)
 {
     $routing = $event->getPayload();
     if (!$routing instanceof RoutingManager) {
         return;
     }
 }
コード例 #2
0
 /**
  * @param \Kendo\Hook\HookEvent $event
  */
 public function onBeforeBuildBundleJS(HookEvent $event)
 {
     $requirejs = $event->getPayload();
     if (!$requirejs instanceof Requirejs) {
         return;
     }
     $requirejs->addDependency(['platform/layout/main']);
 }
コード例 #3
0
 /**
  * @param \Kendo\Hook\HookEvent $event
  */
 public function onCompleteCreatePoster(HookEvent $event)
 {
     $item = $event->getPayload('poster');
     $data = $event->getPayload('data', []);
     if (!$item instanceof CatalogInterface) {
         return;
     }
     app()->catalogService()->updateItemAttribute($item, $data);
 }
コード例 #4
0
 /**
  * @param HookEvent $event
  */
 public function onAdminStatisticBlockRender(HookEvent $event)
 {
     $payload = $event->getPayload();
     if (!$payload instanceof View) {
         return;
     }
     $stats = $payload->__get('stats');
     $stats['page'] = ['label' => app()->text('page.pages'), 'value' => app()->pageService()->getActivePageCount()];
     $payload->__set('stats', $stats);
 }
コード例 #5
0
 /**
  * @param HookEvent $event
  */
 public function onRoutingStart(HookEvent $event)
 {
     $routing = $event->getPayload();
     if (!$routing instanceof RoutingManager) {
         return;
     }
     $routing->add(['name' => 'messages', 'uri' => 'messages', 'defaults' => ['controller' => 'Platform\\Message\\Controller\\HomeController', 'action' => 'inbox-message']]);
     $routing->add(['name' => 'message_inbox', 'uri' => 'messages', 'defaults' => ['controller' => 'Platform\\Message\\Controller\\HomeController', 'action' => 'inbox-message']]);
     $routing->add(['name' => 'message_unread', 'uri' => 'unread-messages', 'defaults' => ['controller' => 'Platform\\Message\\Controller\\HomeController', 'action' => 'unread-message']]);
     $routing->add(['name' => 'message_sent', 'uri' => 'sent-message', 'defaults' => ['controller' => 'Platform\\Message\\Controller\\HomeController', 'action' => 'sent-message']]);
     $routing->add(['name' => 'message_compose', 'uri' => 'compose-message(/<recipientType>)(/<recipientId>)', 'defaults' => ['controller' => 'Platform\\Message\\Controller\\HomeController', 'action' => 'compose-message']]);
 }
コード例 #6
0
 /**
  * @param HookEvent $event
  */
 public function onRequirejsRender(HookEvent $event)
 {
     $requirejs = $event->getPayload();
     if (!$requirejs instanceof Requirejs) {
         return;
     }
     $staticUrl = app()->staticBaseUrl();
     $requirejs->baseUrl($staticUrl . 'static/jscript');
     // you have shim to bundles, do not shim here!
     $requirejs->addPaths(['jquery' => 'kendo/jquery/jquery', 'bootstrap' => 'kendo/bootstrap/bootstrap', 'jqueryui' => 'kendo/jquery-ui/jqueryui', 'underscore' => 'kendo/underscore/underscore.min', 'jquery-ext' => 'kendo/jquery-ext/jquery-ext', 'kd' => 'kendo/core/main'])->addDependency(['jquery', 'underscore', 'bootstrap', 'kd', 'jquery-ext'])->addPrimaryBundle(['jquery', 'underscore', 'bootstrap', 'kd', 'jquery-ext']);
     $options = ['baseUrl' => KENDO_BASE_URL, 'staticUrl' => $staticUrl, 'logged' => app()->auth()->logged(), 'isUser' => app()->auth()->isUser()];
     $script = '$kd.setOptions(' . json_encode($options, JSON_PRETTY_PRINT) . ')';
     $requirejs->prependScript('options', $script);
 }
コード例 #7
0
 /**
  * @param \Kendo\Hook\HookEvent $event
  */
 public function onAfterDeleteShare(HookEvent $event)
 {
     $share = $event->getPayload();
     if (!$share instanceof Share) {
         return;
     }
     $about = $share->getAbout();
     if ($about instanceof AtomInterface) {
         $about->modify('share_count', 'share_count-1');
     }
 }
コード例 #8
0
 /**
  * Check poster is user
  *
  * @param HookEvent $event
  */
 public function onUserCreated(HookEvent $event)
 {
     $config = app()->setting('register');
     $user = $event->getPayload();
     if (!$user instanceof User) {
         return;
     }
     if (!$user->isVerified()) {
         // start process verify this member
     } else {
         // if active member
     }
     if ($config['email_verify'] = 1) {
     }
     if ($config['approval'] == '2') {
     }
     if ($config['notify_admin']) {
     }
     // process add after to handler all of this case.
     $user->setApproved(1);
     $user->setActive(1);
     $user->save();
 }
コード例 #9
0
 /**
  * @param \Kendo\Hook\HookEvent $event
  */
 public function onClearMembership(HookEvent $event)
 {
     $parent = $event->getPayload('parent');
     $poster = $event->getPayload('poster');
     if (!$poster instanceof PosterInterface or !$parent instanceof PosterInterface) {
         return;
     }
     app()->relation()->clearRelationItem($parent, $poster);
     /**
      * 2 ways membership need to required to clear
      */
     if ($poster instanceof User && $parent instanceof User) {
         app()->relation()->clearRelationItem($poster, $parent);
     }
 }
コード例 #10
0
 /**
  * @param \Kendo\Hook\HookEvent $event
  */
 public function onAfterDeleteComment(HookEvent $event)
 {
     $cmt = $event->getPayload();
     if (!$cmt instanceof Comment) {
         return;
     }
     $about = $cmt->getAbout();
     if ($about instanceof AtomInterface) {
         $about->modify('comment_count', 'comment_count-1');
     }
 }
コード例 #11
0
 /**
  * @param \Kendo\Hook\HookEvent $event
  */
 public function onCompleteCreatePoster(HookEvent $event)
 {
     $poster = $event->getPayload('poster');
     $data = $event->getPayload('data', []);
     if (!empty($data['avatar'])) {
         app()->photoService()->setPosterAvatar($poster, $data['avatar']);
     }
 }
コード例 #12
0
 /**
  * @param \Kendo\Hook\HookEvent $event
  */
 public function onAfterDeletePoster(HookEvent $event)
 {
     $poster = $event->getPayload();
     if (!$poster instanceof PosterInterface) {
         return;
     }
 }
コード例 #13
0
 /**
  * @param \Kendo\Hook\HookEvent $event
  */
 public function onAcceptMembershipRequest(HookEvent $event)
 {
     $parent = $event->getPayload('parent');
     $poster = $event->getPayload('poster');
     if (!$parent instanceof PosterInterface or !$poster instanceof PosterInterface) {
         return;
     }
     app()->notificationService()->addAcceptMembershipNotification($parent, $poster);
 }
コード例 #14
0
 /**
  * @param \Kendo\Hook\HookEvent $event
  */
 public function onAfterDeleteLike(HookEvent $event)
 {
     $like = $event->getPayload();
     if (!$like instanceof Like) {
         return;
     }
     $about = $like->getAbout();
     if ($about instanceof AtomInterface) {
         $about->modify('like_count', 'like_count-1');
     }
 }
コード例 #15
0
 /**
  * @param \Kendo\Hook\HookEvent $event
  */
 public function onAcceptMembershipRequest(HookEvent $event)
 {
     $parent = $event->getPayload('parent');
     $poster = $event->getPayload('poster');
     if (!$parent instanceof PosterInterface or !$poster instanceof PosterInterface) {
         return;
     }
     app()->followService()->add($poster, $parent);
     /**
      * 2 ways friends for required.
      */
     if ($parent instanceof User && $poster instanceof User) {
         app()->followService()->add($parent, $poster);
     }
 }
コード例 #16
0
 /**
  * @param \Kendo\Hook\HookEvent $event
  */
 public function onAfterInsertMembershipRequest(HookEvent $event)
 {
     $payload = $event->getPayload();
     if (!$payload instanceof MembershipRequest) {
         return;
     }
     $poster = $payload->getPoster();
     $parent = $payload->getParent();
     if (!$poster instanceof PosterInterface or !$parent instanceof PosterInterface) {
         return;
     }
     app()->invitationService()->addMembershipRequest($poster, $parent);
 }