Esempio n. 1
0
 /**
  * Generate a customized form instance for the specified convention.
  *
  * @param Convention $con
  * @return \DF\Form
  */
 public static function getForm(Convention $con)
 {
     $di = \Phalcon\Di::getDefault();
     $module_config = $di->get('module_config');
     $form_config = $module_config['admin']->forms->conventionsignup->toArray();
     $con_info = array('<big>' . $con->name . '</big>', $con->location, $con->getRange());
     $form_config['groups']['con_info']['elements']['about_con'][1]['markup'] = '<div>' . implode('</div><div>', $con_info) . '</div>';
     if ($con->signup_notes) {
         $form_config['groups']['con_info']['elements']['special_con_notes'][1]['markup'] = '<p>' . nl2br($con->signup_notes) . '</p>';
     } else {
         unset($form_config['groups']['con_info']['elements']['special_con_notes']);
     }
     return new \DF\Form($form_config);
 }
Esempio n. 2
0
 public function indexAction()
 {
     $urls = $this->em->createQuery('SELECT su, s FROM Entity\\ShortUrl su LEFT JOIN su.station s ORDER BY su.station_id, su.short_url ASC')->getArrayResult();
     $global_custom_urls = array();
     $station_custom_urls = array();
     foreach ($urls as $url) {
         if ($url['station']) {
             $station_custom_urls[] = $url;
         } else {
             $global_custom_urls[] = $url;
         }
     }
     $this->view->station_custom_urls = $station_custom_urls;
     $this->view->global_custom_urls = $global_custom_urls;
     // Auto-Generated Station URLs.
     $station_details = Station::getShortNameLookup();
     $station_categories = Station::getCategories();
     $station_urls = array();
     foreach ($station_details as $short_name => $station) {
         $station['url'] = ShortUrl::getFullUrl($short_name);
         $station['icon'] = $station_categories[$station['category']]['icon'];
         $station_urls[$short_name] = $station;
     }
     $this->view->station_urls = $station_urls;
     // Auto-Generated Convention Archive URLs
     $convention_details = Convention::getShortNameLookup();
     $convention_urls = array();
     foreach ($convention_details as $short_name => $convention) {
         $convention['url'] = ShortUrl::getFullUrl($short_name);
         $convention_urls[$short_name] = $convention;
     }
     $this->view->convention_urls = $convention_urls;
 }
Esempio n. 3
0
 public function indexAction()
 {
     $this->forceInsecure();
     // Pull podcasts.
     $podcasts = Podcast::fetchLatest();
     $this->view->podcasts = $podcasts;
     // Pull large photos and news for rotator.
     $network_news = NetworkNews::fetchFeatured();
     $this->view->network_news = $network_news;
     // Pull stations and calendar events.
     $this->_initStations();
     $this->_initEvents();
     // Pull conventions.
     $conventions = Convention::getAllConventions();
     $this->view->conventions_upcoming = $conventions['upcoming'];
     $this->view->conventions_archived = $conventions['archived'];
     /*
     // Pull rotators.
     $rotators = Rotator::fetch();
     $this->view->rotators = $rotators;
     */
     // Special event flagging and special formatting.
     $special_event = \PVL\Utilities::showSpecialEventsMode();
     $this->view->special_event = $special_event;
     if ($special_event) {
         $autoplay_station = Settings::getSetting('special_event_station_id', 0);
         if ($autoplay_station != 0) {
             $this->view->station_id = $autoplay_station;
             $this->view->autoplay = true;
         }
         $this->view->special_event_embed = trim(Settings::getSetting('special_event_embed_code'));
         $this->view->special_chat_embed = trim(Settings::getSetting('special_event_chat_code'));
     }
     $this->view->autoplay = (bool) $this->getParam('autoplay', true);
 }
Esempio n. 4
0
 public function deleteAction()
 {
     $record = Record::find($this->getParam('id'));
     if ($record) {
         $record->delete();
     }
     $this->_flushConventionCache();
     $this->alert('Record deleted.', 'green');
     $this->redirectFromHere(array('action' => 'index', 'id' => NULL, 'csrf' => NULL));
 }
Esempio n. 5
0
 public function viewAction()
 {
     $id = $this->getParam('id');
     $record = Convention::find($id);
     if (!$record instanceof Convention) {
         return $this->returnError('Convention not found.');
     }
     $export_data = Convention::api($record);
     if (count($record->archives) > 0) {
         $export_data['archives'] = array('videos' => array(), 'sources' => array());
         foreach ($record->archives as $row) {
             if ($row->isPlayable()) {
                 $export_data['archives']['videos'][] = $row->toArray();
             } else {
                 $export_data['archives']['sources'][] = $row->toArray();
             }
         }
     }
     return $this->returnSuccess($export_data);
 }
Esempio n. 6
0
 public function indexAction()
 {
     $urls = $this->em->createQuery('SELECT su FROM Entity\\ShortUrl su WHERE su.station_id = :station_id ORDER BY su.timestamp ASC')->setParameter('station_id', $this->station->id)->execute();
     $this->view->urls = $urls;
     // Auto-Generated Station URLs.
     $station_details = Station::getShortNameLookup();
     $station_categories = Station::getCategories();
     $station_urls = array();
     foreach ($station_details as $short_name => $station) {
         $station['url'] = ShortUrl::getFullUrl($short_name);
         $station['icon'] = $station_categories[$station['category']]['icon'];
         $station_urls[$short_name] = $station;
     }
     $this->view->station_urls = $station_urls;
     // Auto-Generated Convention Archive URLs
     $convention_details = Convention::getShortNameLookup();
     $convention_urls = array();
     foreach ($convention_details as $short_name => $convention) {
         $convention['url'] = ShortUrl::getFullUrl($short_name);
         $convention_urls[$short_name] = $convention;
     }
     $this->view->convention_urls = $convention_urls;
 }
Esempio n. 7
0
 public function signupAction()
 {
     $this->acl->checkPermission('is logged in');
     $user = $this->auth->getLoggedInUser();
     // Get conventions that are available for signup.
     $upcoming_cons = array();
     $previous_cons = array();
     $cons_raw = $this->em->createQuery('SELECT c FROM Entity\\Convention c WHERE (c.signup_enabled = 1 AND c.end_date >= :now) ORDER BY c.start_date ASC')->setParameter('now', gmdate('Y-m-d'))->getArrayResult();
     foreach ($cons_raw as $row) {
         $row['range'] = Convention::getDateRange($row['start_date'], $row['end_date']);
         $upcoming_cons[$row['id']] = $row;
     }
     // Get conventions that the user has signed up for.
     $cons_signed_up = $this->em->createQuery('SELECT cs, c FROM Entity\\ConventionSignup cs JOIN cs.convention c WHERE (cs.user_id = :user_id) ORDER BY c.start_date DESC')->setParameter('user_id', $user->id)->getArrayResult();
     foreach ($cons_signed_up as $row) {
         $con_id = $row['convention_id'];
         if (isset($upcoming_cons[$con_id])) {
             $upcoming_cons[$con_id]['signup'] = $row;
         } else {
             $con = $row['convention'];
             $con['range'] = Convention::getDateRange($con['start_date'], $con['end_date']);
             $previous_cons[$con_id] = $con;
             $previous_cons[$con_id]['signup'] = $row;
         }
     }
     $this->view->upcoming_cons = $upcoming_cons;
     $this->view->previous_cons = $previous_cons;
 }
Esempio n. 8
0
 public static function conventionUrls()
 {
     $urls = array();
     $short_names = Convention::getShortNameLookup();
     foreach ($short_names as $short_name => $record) {
         $urls[$short_name] = \DF\Url::route(array('module' => 'default', 'controller' => 'convention', 'action' => 'archive', 'id' => $record['id']));
     }
     return $urls;
 }
Esempio n. 9
0
<?php

$coverage_options_raw = \Entity\Convention::getCoverageLevels();
$coverage_options = array();
foreach ($coverage_options_raw as $c_key => $c_opt) {
    $coverage_options[$c_key] = '&nbsp;<i class="' . $c_opt['icon'] . '"></i> ' . $c_opt['text'];
}
return array('method' => 'post', 'enctype' => 'multipart/form-data', 'elements' => array('name' => array('text', array('label' => 'Convention Name', 'class' => 'half-width', 'required' => true)), 'location' => array('text', array('label' => 'Convention Location', 'class' => 'half-width', 'required' => true)), 'coverage_level' => array('radio', array('label' => 'PVL Coverage Level', 'multiOptions' => $coverage_options, 'escape' => false, 'default' => 'full', 'required' => true)), 'start_date' => array('unixDate', array('label' => 'Start Date', 'default' => time())), 'end_date' => array('unixDate', array('label' => 'End Date', 'default' => time())), 'web_url' => array('text', array('label' => 'Homepage URL', 'class' => 'half-width')), 'image_url' => array('image', array('label' => 'Convention Image', 'description' => 'Use the same size image as the main PVL banner rotator (1150x200). PNG preferred.')), 'discount_code' => array('text', array('label' => 'Discount Code for Registration', 'description' => 'If this convention offers a discount code for PVL viewers, enter it here for it to be automatically promoted.')), 'signup_enabled' => array('radio', array('label' => 'Signup Enabled?', 'description' => 'Enable the convention signup form for camera operators and other staff.', 'multiOptions' => array(0 => 'No', 1 => 'Yes'), 'default' => 1)), 'signup_notes' => array('textarea', array('label' => 'Special Signup Notes', 'description' => 'If there are special considerations for this convention, include them here and they will appear in the signup form.', 'class' => 'full-width half-height')), 'submit' => array('submit', array('type' => 'submit', 'label' => 'Save Changes', 'helper' => 'formButton', 'class' => 'ui-button'))));
Esempio n. 10
0
 public static function _runConventionPromotions(\Phalcon\DiInterface $di)
 {
     $news_items = array();
     $em = $di->get('em');
     // Pull all recent or upcoming conventions.
     $conventions_raw = $em->createQuery('SELECT c, ca FROM Entity\\Convention c LEFT JOIN c.archives ca
         WHERE (c.start_date BETWEEN :threshold_start AND :threshold_end)
         AND (c.image_url IS NOT NULL AND c.image_url != \'\')
         ORDER BY c.start_date DESC, ca.created_at DESC')->setParameter('threshold_start', date('Y-m-d', strtotime('-2 months')))->setParameter('threshold_end', date('Y-m-d', strtotime('+1 year')))->getArrayResult();
     foreach ((array) $conventions_raw as $convention) {
         if (empty($convention['web_url'])) {
             continue;
         }
         $create_post = false;
         $start_date = $convention['start_date']->getTimestamp();
         $end_date = $convention['end_date']->add(new \DateInterval('P1D'))->getTimestamp();
         // Adjust for midnight.
         $post_item = array('id' => 'convention_' . $convention['id'], 'title' => $convention['name'], 'source' => 'convention', 'body' => '', 'image_url' => \PVL\Url::upload($convention['image_url']), 'web_url' => $convention['web_url'], 'layout' => 'vertical', 'tags' => array($convention['name'], 'Conventions'), 'sort_timestamp' => $start_date, 'display_timestamp' => $start_date);
         if ($start_date > time()) {
             // Pre-convention: Check for discount code promotion.
             if (!empty($convention['discount_code']) && $start_date >= time() + 86400 * 14) {
                 $create_post = true;
                 $convention_details = array(':convention' => $convention['name'], ':discount' => $convention['discount_code']);
                 $post_title_raw = 'Register for :convention with Discount Code ":discount"';
                 $post_item['title'] = strtr($post_title_raw, $convention_details);
                 $post_body_raw = 'Ponyville Live! is partnering with :convention to offer a special discount to our visitors. Visit the convention\'s registration page and enter discount code ":discount" to save on your registration!';
                 $post_item['body'] = strtr($post_body_raw, $convention_details);
                 // More distant conventions sort lower on the list than closer ones.
                 $time_diff = $start_date - time();
                 $post_item['sort_timestamp'] = time() - round($time_diff / 60);
             }
         } elseif ($start_date <= time() + 86400 * 7 && $end_date >= time()) {
             // Mid-convention: Check for live coverage.
             $coverage_types = array(Convention::COVERAGE_STREAMING => 'Ponyville Live! is streaming :convention live on the web! Check our web site for stream details, and check the convention\'s web site for official schedule updates and more information on the convention.', Convention::COVERAGE_FULL => 'Ponyville Live! will be providing full recording coverage of :convention. Check out the convention\'s web site for more information on the convention, and come back to our homepage for footage updates after the convention.', Convention::COVERAGE_PARTIAL => 'Ponyville Live! will be providing limited coverage of :convention. Check out the convention\'s web site for more information on the convention, and come back to our homepage for footage updates after the convention.');
             if (isset($coverage_types[$convention['coverage_level']])) {
                 $create_post = true;
                 $convention_details = array(':convention' => $convention['name'], ':range' => Convention::getDateRange($convention['start_date'], $convention['end_date']));
                 $post_title_raw = ":convention\n:range";
                 $post_item['title'] = strtr($post_title_raw, $convention_details);
                 $post_item['body'] = strtr($coverage_types[$convention['coverage_level']], $convention_details);
                 $post_item['sort_timestamp'] = $end_date;
             }
         }
         if ($create_post) {
             $news_items[] = $post_item;
         }
     }
     return $news_items;
 }
Esempio n. 11
0
 /**
  * Static Functions
  */
 public static function getUpcomingConventions()
 {
     return Convention::getUpcomingConventions();
 }