Beispiel #1
0
 public function onPrepareStoryPanel($story)
 {
     $config = Foundry::config();
     if (!$config->get('photos.enabled')) {
         return;
     }
     // Get current logged in user.
     $my = Foundry::user();
     // Get user access
     $access = Foundry::access($my->id, SOCIAL_TYPE_USER);
     $plugin = $story->createPlugin("photos", "panel");
     $theme = Foundry::get('Themes');
     // check max photos upload here.
     if ($access->exceeded('photos.uploader.max', $my->getTotalPhotos())) {
         $theme->set('exceeded', JText::sprintf('COM_EASYSOCIAL_PHOTOS_EXCEEDED_MAX_UPLOAD', $access->get('photos.uploader.max')));
     }
     // check max photos upload daily here.
     if ($access->exceeded('photos.uploader.maxdaily', $my->getTotalPhotos(true))) {
         $theme->set('exceeded', JText::sprintf('COM_EASYSOCIAL_PHOTOS_EXCEEDED_DAILY_MAX_UPLOAD', $access->get('photos.uploader.maxdaily')));
     }
     $plugin->button->html = $theme->output('themes:/apps/user/photos/story/panel.button');
     $plugin->content->html = $theme->output('themes:/apps/user/photos/story/panel.content');
     $script = Foundry::get('Script');
     $script->set('maxFileSize', $access->get('photos.uploader.maxsize') . 'M');
     $plugin->script = $script->output('apps:/user/photos/story');
     return $plugin;
 }