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']; }
/** * Convention Archive Management */ public function archivesAction() { $con = $this->_getConvention(); $folders = ConventionArchive::getFolders(); $this->view->folders = $folders; $types = ConventionArchive::getTypes(); $archives_raw = $con->archives; $archives = array(); if (count($archives_raw) > 0) { foreach ($archives_raw as $row) { $row_arr = $row->toArray(); $row_arr['type_text'] = $types[$row_arr['type']]; if ($row->playlist_id) { $archives[$row->playlist_id]['videos'][] = $row_arr; } else { $row_arr['videos'] = array(); $archives[$row->id] = $row_arr; } } } $archives_by_folder = array(); foreach ($archives as $id => $row) { $archives_by_folder[$row['folder']][$id] = $row; } $this->view->archives = $archives_by_folder; }
<?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'))));