parent
7ce4934cdc
commit
b7cd90bc28
|
@ -72,6 +72,10 @@ class PlaylistController extends Zend_Controller_Action
|
|||
if (isset($pl)) {
|
||||
$formatter = new LengthFormatter($pl->getLength());
|
||||
$this->view->length = $formatter->format();
|
||||
|
||||
$form = new Application_Form_SmartPlaylistCriteria();
|
||||
$form->removeDecorator('DtDdWrapper');
|
||||
$this->view->form = $form;
|
||||
|
||||
$this->view->pl = $pl;
|
||||
$this->view->id = $pl->getId();
|
||||
|
@ -133,12 +137,15 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/smart_playlistbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
try {
|
||||
if (isset($this->pl_sess->id)) {
|
||||
$pl = new Application_Model_Playlist($this->pl_sess->id);
|
||||
$this->view->pl = $pl;
|
||||
$form = new Application_Form_SmartPlaylistCriteria();
|
||||
$this->view->form = $form;
|
||||
|
||||
$formatter = new LengthFormatter($pl->getLength());
|
||||
$this->view->length = $formatter->format();
|
||||
|
@ -169,6 +176,8 @@ class PlaylistController extends Zend_Controller_Action
|
|||
{
|
||||
$id = $this->_getParam('id', null);
|
||||
Logging::log("editing playlist {$id}");
|
||||
//$form = new Application_Form_SmartPlaylistCriteria();
|
||||
|
||||
|
||||
if (!is_null($id)) {
|
||||
$this->changePlaylist($id);
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
<?php
|
||||
class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
//temporary solution
|
||||
//get criteria ids
|
||||
$ids = array(1,2,3);
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/smart-playlist-criteria.phtml', 'ids' => $ids))
|
||||
));
|
||||
|
||||
$criteriaOptions = array(
|
||||
0 => "Select criteria",
|
||||
"track_title" => "Title",
|
||||
"artist_name" => "Artist",
|
||||
"bit_rate" => "Bit Rate",
|
||||
"sample_rate" => "Sample Rate",
|
||||
"length" => "Length",
|
||||
"album_title" => "Album",
|
||||
"genre" => "Genre",
|
||||
"year" => "Year",
|
||||
"track_num" => "Track Number",
|
||||
"bmp" => "Bpm",
|
||||
"rating" => "Rating",
|
||||
"disc_number" => "Disc Number",
|
||||
"mood" => "Mood",
|
||||
"label" => "Label",
|
||||
"composer" => "Composer",
|
||||
"lyricist" => "Lyricist",
|
||||
"name" => "Name",
|
||||
"isrc_number" => "ISRC Number",
|
||||
"language" => "Language",
|
||||
"utime" => "Date Added",
|
||||
"mtime" => "Date Modified",
|
||||
"comments" => "Comments",
|
||||
"orchestra" => "Orchestra",
|
||||
"composer" => "Composer",
|
||||
"conductor" => "Conductor",
|
||||
"radio_station_name" => "Radio Station Name",
|
||||
"soundcloud_id" => "Soundcloud Upload"
|
||||
);
|
||||
|
||||
$stringCriteriaOptions = array(
|
||||
"contains",
|
||||
"does not contain",
|
||||
"is",
|
||||
"is not",
|
||||
"starts with",
|
||||
"ends with"
|
||||
);
|
||||
|
||||
$numericCriteriaOptions = array(
|
||||
"is",
|
||||
"is not",
|
||||
"is greater than",
|
||||
"is less than",
|
||||
"is in the range"
|
||||
);
|
||||
|
||||
$limitOptions = array(
|
||||
"hours",
|
||||
"minutes",
|
||||
"items"
|
||||
);
|
||||
|
||||
$spType = new Zend_Form_Element_Radio('sp_type');
|
||||
$spType->setLabel('Set smart playlist type:');
|
||||
$spType->setDecorators(array('viewHelper'));
|
||||
$spType->setMultiOptions(array(
|
||||
'Static',
|
||||
'Dynamic'
|
||||
));
|
||||
$spType->setValue('Static');
|
||||
$this->addElement($spType);
|
||||
|
||||
foreach($ids as $id) {
|
||||
$criteria = new Zend_Form_Element_Select('sp_criteria_'.$id);
|
||||
$criteria->setAttrib('id', $id);
|
||||
$criteria->setAttrib('class', 'input_select');
|
||||
$criteria->setDecorators(array('viewHelper'));
|
||||
$criteria->setMultiOptions($criteriaOptions);
|
||||
$this->addElement($criteria);
|
||||
}
|
||||
|
||||
foreach($ids as $id) {
|
||||
$criteriaOptions = new Zend_Form_Element_Select('sp_criteria_options_'.$id);
|
||||
$criteriaOptions->setAttrib('id', $id);
|
||||
$criteriaOptions->setAttrib('class', 'input_select');
|
||||
$criteriaOptions->setDecorators(array('viewHelper'));
|
||||
$criteriaOptions->setMultiOptions($stringCriteriaOptions);
|
||||
$this->addElement($criteriaOptions);
|
||||
}
|
||||
|
||||
foreach($ids as $id) {
|
||||
$criteriaValue = new Zend_Form_Element_Text('sp_criteria_value_'.$id);
|
||||
$criteriaValue->setAttrib('id', $id);
|
||||
$criteriaValue->setAttrib('class', 'input_text');
|
||||
$criteriaValue->setDecorators(array('viewHelper'));
|
||||
$this->addElement($criteriaValue);
|
||||
}
|
||||
|
||||
$limitCheck = new Zend_Form_Element_Checkbox('sp_limit_check');
|
||||
$limitCheck->setLabel('Limit to');
|
||||
$limitCheck->setDecorators(array('viewHelper'));
|
||||
$limitCheck->setValue(true);
|
||||
$this->addElement($limitCheck);
|
||||
|
||||
$limit = new Zend_Form_Element_Select('sp_limit_options');
|
||||
$limit->setAttrib('class', 'input_select');
|
||||
$limit->setDecorators(array('viewHelper'));
|
||||
$limit->setMultiOptions($limitOptions);
|
||||
$this->addElement($limit);
|
||||
|
||||
$limitValue = new Zend_Form_Element_Text('sp_limit_value');
|
||||
$limitValue->setAttrib('class', 'input_text');
|
||||
$limitValue->setDecorators(array('viewHelper'));
|
||||
$this->addElement($limitValue);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<form id="smart-playlist-form" method="post" action="">
|
||||
<fieldset class='toggle closed' id='smart_playlist_options'>
|
||||
<legend style='cursor: pointer;'><span class='ui-icon ui-icon-triangle-2-n-s'></span>Smart Playlist Options</legend>
|
||||
<dl class='zend_form'>
|
||||
<dd id='sp_type-element' class='radio-inline-list'>
|
||||
<label for='sp_type'>
|
||||
<?php echo $this->element->getElement('sp_type')->getLabel() ?>
|
||||
<?php $i=0;
|
||||
$value = $this->element->getElement('sp_type')->getValue();
|
||||
foreach ($this->element->getElement('sp_type')->getMultiOptions() as $radio) : ?>
|
||||
<input type="radio" value="<?php echo $i ?>" id="sp_type-<?php echo $i ?>" name="sp_type" <?php if($i == $value){echo 'checked="checked"';}?> >
|
||||
<?php echo $radio ?>
|
||||
</input>
|
||||
<?php $i = $i + 1; ?>
|
||||
<?php endforeach; ?>
|
||||
</label>
|
||||
</dd>
|
||||
|
||||
<dd id='sp_criteria-element'>
|
||||
<?php foreach($this->ids as $id) {?>
|
||||
<?php echo $this->element->getElement('sp_criteria_'.$id) ?>
|
||||
<?php echo $this->element->getElement('sp_criteria_options_'.$id) ?>
|
||||
<?php echo $this->element->getElement('sp_criteria_value_'.$id) ?>
|
||||
<a href='#' class='criteria-remove' id=<?php echo $id ?>>Remove</a>
|
||||
<br />
|
||||
<?php } ?>
|
||||
<a href='#' class='criteria-add'>Add</a>
|
||||
</dd>
|
||||
|
||||
<dd id='sp_limit-element'>
|
||||
<label>
|
||||
<?php echo $this->element->getElement('sp_limit_check') ?>
|
||||
<?php echo $this->element->getElement('sp_limit_check')->getLabel() ?>
|
||||
<?php echo $this->element->getElement('sp_limit_options') ?>
|
||||
<?php echo $this->element->getElement('sp_limit_value')?>
|
||||
</label>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
</fieldset>
|
||||
</form>
|
|
@ -30,6 +30,10 @@
|
|||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<?php
|
||||
|
||||
echo $this->form; ?>
|
||||
|
||||
<div id="crossfade_main" class="crossfade-main clearfix" style="display:none;">
|
||||
<span class="ui-icon ui-icon-closethick"></span>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
$(document).ready(function() {
|
||||
setSmartPlaylistEvents();
|
||||
});
|
||||
|
||||
function setSmartPlaylistEvents() {
|
||||
var form = $('#smart-playlist-form');
|
||||
|
||||
form.find('a[class="criteria-add"]').click(function(){
|
||||
|
||||
});
|
||||
|
||||
}
|
Loading…
Reference in New Issue