public function archiveAction()
 {
     $convention = $this->_getConvention();
     if (!$convention) {
         $this->redirectFromHere(array('action' => 'index', 'id' => NULL));
     }
     $this->view->convention = $convention;
     $videos = array();
     $sources = array();
     $folders = ConventionArchive::getFolders();
     foreach ($folders as $folder_key => $folder_name) {
         $videos[$folder_name] = array('key' => $folder_key, 'name' => $folder_name, 'videos' => array());
     }
     foreach ($convention->archives as $row) {
         if ($row->isPlayable()) {
             $folder_name = $folders[$row->folder];
             $videos[$folder_name]['videos'][] = $row;
         } else {
             $sources[] = $row;
         }
     }
     foreach ($videos as $folder_name => $row) {
         if (empty($row['videos'])) {
             unset($videos[$folder_name]);
         }
     }
     $this->view->videos = $videos;
     $this->view->sources = $sources;
     // Pull conventions.
     $conventions = Convention::getAllConventions();
     $this->view->conventions_archived = $conventions['archived'];
 }
 public function listAction()
 {
     $all_conventions = $this->em->createQuery('SELECT c, ca FROM Entity\\Convention c LEFT JOIN c.archives ca ORDER BY c.start_date DESC')->getArrayResult();
     $export_data = array();
     foreach ($all_conventions as $row) {
         $api_row = Convention::api($row);
         $api_row['archives_count'] = 0;
         if (count($row['archives']) > 0) {
             foreach ($row['archives'] as $a_row) {
                 if (ConventionArchive::typeIsPlayable($a_row['type'])) {
                     $api_row['archives_count']++;
                 }
             }
         }
         $export_data[] = $api_row;
     }
     return $this->returnSuccess($export_data);
 }
 public function deletearchiveAction()
 {
     $con = $this->_getConvention();
     $record = ConventionArchive::find($this->getParam('id'));
     if ($record instanceof ConventionArchive) {
         $record->delete();
     }
     $this->alert('Record deleted.', 'green');
     $this->redirectFromHere(array('action' => 'archives', 'convention' => $con->id, 'id' => NULL, 'csrf' => NULL));
 }
<?php

$types = \Entity\ConventionArchive::getTypes();
$folders = \Entity\ConventionArchive::getFolders();
return array('method' => 'post', 'enctype' => 'multipart/form-data', 'elements' => array('web_url' => array('text', array('label' => 'Archive Video URL', 'class' => 'half-width', 'required' => true)), 'type' => array('radio', array('label' => 'Type of URL', 'multiOptions' => $types, 'required' => true, 'default' => 'yt_playlist')), 'folder' => array('radio', array('label' => 'Archive Folder', 'multiOptions' => $folders, 'required' => true, 'default' => 'pvl')), 'submit' => array('submit', array('type' => 'submit', 'label' => 'Save Changes', 'helper' => 'formButton', 'class' => 'ui-button'))));