Merge branch 'CC-3174' into devel
Conflicts: airtime_mvc/application/models/StoredFile.php
This commit is contained in:
commit
ac11d8bcf6
26 changed files with 710 additions and 450 deletions
|
@ -1,65 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AdvancedSearch extends Zend_Form
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Add the add button
|
||||
$this->addElement('button', 'search_add_group', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Add',
|
||||
'order' => '-2'
|
||||
));
|
||||
$this->getElement('search_add_group')->removeDecorator('DtDdWrapper');
|
||||
|
||||
// Add the submit button
|
||||
$this->addElement('button', 'search_submit', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Save',
|
||||
'order' => '-1'
|
||||
));
|
||||
$this->getElement('search_submit')->removeDecorator('DtDdWrapper');
|
||||
}
|
||||
|
||||
public function addGroup($group_id, $row_id=null) {
|
||||
|
||||
$this->addSubForm(new Application_Form_AdvancedSearchGroup(), 'group_'.$group_id, $group_id);
|
||||
$this->getSubForm('group_'.$group_id)->removeDecorator('DtDdWrapper');
|
||||
|
||||
if(!is_null($row_id)) {
|
||||
$subGroup = $this->getSubForm('group_'.$group_id);
|
||||
$subGroup->addRow($row_id);
|
||||
}
|
||||
}
|
||||
|
||||
public function preValidation(array $data) {
|
||||
|
||||
function findId($name) {
|
||||
$t = explode("_", $name);
|
||||
return $t[1];
|
||||
}
|
||||
|
||||
function findFields($field) {
|
||||
return strpos($field, 'group') !== false;
|
||||
}
|
||||
|
||||
$groups = array_filter(array_keys($data), 'findFields');
|
||||
|
||||
foreach ($groups as $group) {
|
||||
|
||||
$group_id = findId($group);
|
||||
$this->addGroup($group_id);
|
||||
|
||||
$subGroup = $this->getSubForm($group);
|
||||
|
||||
foreach (array_keys($data[$group]) as $row) {
|
||||
|
||||
$row_id = findId($row);
|
||||
$subGroup->addRow($row_id, $data[$group][$row]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AdvancedSearchGroup extends Zend_Form_SubForm
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
// Add the add button
|
||||
$this->addElement('button', 'search_add_row', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Add',
|
||||
'order' => '-2'
|
||||
));
|
||||
$this->getElement('search_add_row')->removeDecorator('DtDdWrapper');
|
||||
|
||||
// Add the add button
|
||||
$this->addElement('button', 'search_remove_group', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Remove',
|
||||
'order' => '-1'
|
||||
));
|
||||
$this->getElement('search_remove_group')->removeDecorator('DtDdWrapper');
|
||||
}
|
||||
|
||||
public function addRow($row_id, $data=null) {
|
||||
|
||||
$this->addSubForm(new Application_Form_AdvancedSearchRow(), 'row_'.$row_id, $row_id);
|
||||
$row = $this->getSubForm('row_'.$row_id);
|
||||
$row->removeDecorator('DtDdWrapper');
|
||||
|
||||
if(!is_null($data)) {
|
||||
$row->setDefaults($data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AdvancedSearchRow extends Zend_Form_SubForm
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$this->addElement(
|
||||
'select',
|
||||
'metadata',
|
||||
array(
|
||||
'required' => true,
|
||||
'multiOptions' => array(
|
||||
"dc:title" => "Title",
|
||||
"dc:format" => "Format",
|
||||
"dc:creator" => "Artist/Creator",
|
||||
"dc:source" => "Album",
|
||||
"ls:bitrate" => "Bitrate",
|
||||
"ls:samplerate" => "Samplerate",
|
||||
"dcterms:extent" => "Length",
|
||||
"dc:description" => "Comments",
|
||||
"dc:type" => "Genre",
|
||||
"ls:channels" => "channels",
|
||||
"ls:year" => "Year",
|
||||
"ls:track_num" => "track_number",
|
||||
"ls:mood" => "mood",
|
||||
"ls:bpm" => "BPM",
|
||||
"ls:rating" => "rating",
|
||||
"ls:encoded_by" => "encoded_by",
|
||||
"dc:publisher" => "label",
|
||||
"ls:composer" => "Composer",
|
||||
"ls:encoder" => "Encoder",
|
||||
"ls:lyrics" => "lyrics",
|
||||
"ls:orchestra" => "orchestra",
|
||||
"ls:conductor" => "conductor",
|
||||
"ls:lyricist" => "lyricist",
|
||||
"ls:originallyricist" => "original_lyricist",
|
||||
"ls:isrcnumber" => "isrc_number",
|
||||
"dc:language" => "Language",
|
||||
),
|
||||
)
|
||||
);
|
||||
$this->getElement('metadata')->removeDecorator('Label')->removeDecorator('HtmlTag');
|
||||
|
||||
$this->addElement(
|
||||
'select',
|
||||
'match',
|
||||
array(
|
||||
'required' => true,
|
||||
'multiOptions' => array(
|
||||
"0" => "partial",
|
||||
"1" => "=",
|
||||
"2" => "<",
|
||||
"3" => "<=",
|
||||
"4" => ">",
|
||||
"5" => ">=",
|
||||
"6" => "!=",
|
||||
),
|
||||
)
|
||||
);
|
||||
$this->getElement('match')->removeDecorator('Label')->removeDecorator('HtmlTag');
|
||||
|
||||
$this->addElement('text', 'search', array(
|
||||
'required' => true,
|
||||
));
|
||||
$this->getElement('search')->removeDecorator('Label')->removeDecorator('HtmlTag');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
104
airtime_mvc/application/forms/ShowBuilder.php
Normal file
104
airtime_mvc/application/forms/ShowBuilder.php
Normal file
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_ShowBuilder extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/showbuilder.phtml'))
|
||||
));
|
||||
|
||||
// Add start date element
|
||||
$startDate = new Zend_Form_Element_Text('sb_date_start');
|
||||
$startDate->class = 'input_text';
|
||||
$startDate->setRequired(true)
|
||||
->setLabel('Date Start:')
|
||||
->setValue(date("Y-m-d"))
|
||||
->setFilters(array('StringTrim'))
|
||||
->setValidators(array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('YYYY-MM-DD'))))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$startDate->setAttrib('alt', 'date');
|
||||
$this->addElement($startDate);
|
||||
|
||||
// Add start time element
|
||||
$startTime = new Zend_Form_Element_Text('sb_time_start');
|
||||
$startTime->class = 'input_text';
|
||||
$startTime->setRequired(true)
|
||||
->setValue('00:00')
|
||||
->setFilters(array('StringTrim'))
|
||||
->setValidators(array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$startTime->setAttrib('alt', 'time');
|
||||
$this->addElement($startTime);
|
||||
|
||||
// Add end date element
|
||||
$endDate = new Zend_Form_Element_Text('sb_date_end');
|
||||
$endDate->class = 'input_text';
|
||||
$endDate->setRequired(true)
|
||||
->setLabel('Date End:')
|
||||
->setValue(date("Y-m-d"))
|
||||
->setFilters(array('StringTrim'))
|
||||
->setValidators(array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('YYYY-MM-DD'))))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$endDate->setAttrib('alt', 'date');
|
||||
$this->addElement($endDate);
|
||||
|
||||
// Add end time element
|
||||
$endTime = new Zend_Form_Element_Text('sb_time_end');
|
||||
$endTime->class = 'input_text';
|
||||
$endTime->setRequired(true)
|
||||
->setValue('01:00')
|
||||
->setFilters(array('StringTrim'))
|
||||
->setValidators(array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$endTime->setAttrib('alt', 'time');
|
||||
$this->addElement($endTime);
|
||||
|
||||
|
||||
// add a select to choose a show.
|
||||
$showSelect = new Zend_Form_Element_Select("sb_show_filter");
|
||||
$showSelect->setLabel("Filter By Show:");
|
||||
$showSelect->setMultiOptions($this->getShowNames());
|
||||
$showSelect->setValue(null);
|
||||
$showSelect->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($showSelect);
|
||||
|
||||
if ($user->getType() === 'H') {
|
||||
$myShows = new Zend_Form_Element_Checkbox('sb_my_shows');
|
||||
$myShows->setLabel('All My Shows')
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($myShows);
|
||||
}
|
||||
}
|
||||
|
||||
private function getShowNames() {
|
||||
|
||||
$showNames = array("0" => "-------------------------");
|
||||
|
||||
$shows = CcShowQuery::create()
|
||||
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
|
||||
->orderByDbName()
|
||||
->find();
|
||||
|
||||
foreach ($shows as $show) {
|
||||
|
||||
$showNames[$show->getDbId()] = $show->getDbName();
|
||||
}
|
||||
|
||||
return $showNames;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue