Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
Conflicts: airtime_mvc/application/models/Playlist.php
This commit is contained in:
commit
32f431c584
13 changed files with 353 additions and 233 deletions
|
@ -349,6 +349,18 @@ class ApiController extends Zend_Controller_Action
|
||||||
$schedule_group_id = $this->_getParam("schedule_id");
|
$schedule_group_id = $this->_getParam("schedule_id");
|
||||||
$media_id = $this->_getParam("media_id");
|
$media_id = $this->_getParam("media_id");
|
||||||
$result = Application_Model_Schedule::UpdateMediaPlayedStatus($media_id);
|
$result = Application_Model_Schedule::UpdateMediaPlayedStatus($media_id);
|
||||||
|
|
||||||
|
//set a 'last played' timestamp for media item
|
||||||
|
//needed for smart playlists
|
||||||
|
try{
|
||||||
|
$file_id = Application_Model_Schedule::GetFileId($media_id);
|
||||||
|
$file = Application_Model_StoredFile::Recall($file_id);
|
||||||
|
$now = new DateTime("now", new DateTimeZone("UTC"));
|
||||||
|
$file->setLastPlayedTime($now);
|
||||||
|
}catch(Exception $e){
|
||||||
|
Logging::log($e);
|
||||||
|
}
|
||||||
|
|
||||||
echo json_encode(array("status"=>1, "message"=>""));
|
echo json_encode(array("status"=>1, "message"=>""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,9 +76,13 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
$formatter = new LengthFormatter($pl->getLength());
|
$formatter = new LengthFormatter($pl->getLength());
|
||||||
$this->view->length = $formatter->format();
|
$this->view->length = $formatter->format();
|
||||||
|
|
||||||
$form = new Application_Form_SmartPlaylistCriteria();
|
$form = new Application_Form_SmartPlaylist();
|
||||||
$form->removeDecorator('DtDdWrapper');
|
$form->removeDecorator('DtDdWrapper');
|
||||||
$form->startForm($pl->getId());
|
$form->startForm($pl->getId());
|
||||||
|
$subform = new Application_Form_SmartPlaylistCriteriaSubForm();
|
||||||
|
$form->removeDecorator('DtDdWrapper');
|
||||||
|
$form->addSubForm($subform, 'sp_set_1');
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
|
|
||||||
$this->view->pl = $pl;
|
$this->view->pl = $pl;
|
||||||
|
@ -171,7 +175,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
|
|
||||||
if($isAdminOrPM || $pl->getCreatorId() == $userInfo->id){
|
if($isAdminOrPM || $pl->getCreatorId() == $userInfo->id){
|
||||||
$this->view->pl = $pl;
|
$this->view->pl = $pl;
|
||||||
$form = new Application_Form_SmartPlaylistCriteria();
|
$form = new Application_Form_SmartPlaylist();
|
||||||
$form->startForm($this->pl_sess->id);
|
$form->startForm($this->pl_sess->id);
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +207,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$id = $this->_getParam('id', null);
|
$id = $this->_getParam('id', null);
|
||||||
Logging::log("editing playlist {$id}");
|
Logging::log("editing playlist {$id}");
|
||||||
//$form = new Application_Form_SmartPlaylistCriteria();
|
//$form = new Application_Form_SmartPlaylist();
|
||||||
|
|
||||||
|
|
||||||
if (!is_null($id)) {
|
if (!is_null($id)) {
|
||||||
|
|
|
@ -114,18 +114,8 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$editable = false;
|
$editable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->events = Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
|
$events = &Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
|
||||||
}
|
$this->view->events = $events;
|
||||||
|
|
||||||
public function getCurrentShowAction()
|
|
||||||
{
|
|
||||||
$currentShow = Application_Model_Show::GetCurrentShow();
|
|
||||||
if (!empty($currentShow)) {
|
|
||||||
$this->view->si_id = $currentShow[0]["instance_id"];
|
|
||||||
$this->view->current_show = true;
|
|
||||||
} else {
|
|
||||||
$this->view->current_show = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function moveShowAction()
|
public function moveShowAction()
|
||||||
|
|
89
airtime_mvc/application/forms/SmartPlaylist.php
Normal file
89
airtime_mvc/application/forms/SmartPlaylist.php
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
<?php
|
||||||
|
class Application_Form_SmartPlaylist extends Zend_Form
|
||||||
|
{
|
||||||
|
public function init(){
|
||||||
|
|
||||||
|
}
|
||||||
|
public function startForm($p_playlistId)
|
||||||
|
{
|
||||||
|
// load type
|
||||||
|
$out = CcPlaylistQuery::create()->findPk($p_playlistId);
|
||||||
|
if ($out->getDbType() == "static") {
|
||||||
|
$playlistType = 0;
|
||||||
|
} else {
|
||||||
|
$playlistType = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$spType = new Zend_Form_Element_Radio('sp_type');
|
||||||
|
$spType->setLabel('Set smart playlist type:')
|
||||||
|
->setDecorators(array('viewHelper'))
|
||||||
|
->setMultiOptions(array(
|
||||||
|
'static' => 'Static',
|
||||||
|
'dynamic' => 'Dynamic'
|
||||||
|
))
|
||||||
|
->setValue($playlistType);
|
||||||
|
$this->addElement($spType);
|
||||||
|
|
||||||
|
/*
|
||||||
|
// load criteria from db
|
||||||
|
$out = CcPlaylistcriteriaQuery::create()->findByDbPlaylistId($p_playlistId);
|
||||||
|
*/
|
||||||
|
$storedCrit = array();
|
||||||
|
foreach ($out as $crit) {
|
||||||
|
$criteria = $crit->getDbCriteria();
|
||||||
|
$modifier = $crit->getDbModifier();
|
||||||
|
$value = $crit->getDbValue();
|
||||||
|
$extra = $crit->getDbExtra();
|
||||||
|
|
||||||
|
if($criteria == "limit"){
|
||||||
|
$storedCrit["limit"] = array("value"=>$value, "modifier"=>$modifier);
|
||||||
|
}else{
|
||||||
|
$storedCrit["crit"][] = array("criteria"=>$criteria, "value"=>$value, "modifier"=>$modifier, "extra"=>$extra);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$openSmartPlaylistOption = false;
|
||||||
|
if (!empty($storedCrit)) {
|
||||||
|
$openSmartPlaylistOption = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$save = new Zend_Form_Element_Button('save_button');
|
||||||
|
$save->setAttrib('class', 'ui-button ui-state-default sp-button');
|
||||||
|
$save->setAttrib('title', 'Save criteria only');
|
||||||
|
$save->setIgnore(true);
|
||||||
|
$save->setLabel('Save');
|
||||||
|
$save->setDecorators(array('viewHelper'));
|
||||||
|
$this->addElement($save);
|
||||||
|
|
||||||
|
$generate = new Zend_Form_Element_Button('generate_button');
|
||||||
|
$generate->setAttrib('class', 'ui-button ui-state-default sp-button');
|
||||||
|
$generate->setAttrib('title', 'Save criteria and generate playlist content');
|
||||||
|
$generate->setIgnore(true);
|
||||||
|
$generate->setLabel('Generate');
|
||||||
|
$generate->setDecorators(array('viewHelper'));
|
||||||
|
$this->addElement($generate);
|
||||||
|
|
||||||
|
$shuffle = new Zend_Form_Element_Button('shuffle_button');
|
||||||
|
$shuffle->setAttrib('class', 'ui-button ui-state-default sp-button');
|
||||||
|
$shuffle->setAttrib('title', 'Shuffle playlist content');
|
||||||
|
$shuffle->setIgnore(true);
|
||||||
|
$shuffle->setLabel('Shuffle');
|
||||||
|
$shuffle->setDecorators(array('viewHelper'));
|
||||||
|
$this->addElement($shuffle);
|
||||||
|
|
||||||
|
$numOfSubForm = 3;
|
||||||
|
for ($i=0;$i<$numOfSubForm;$i++) {
|
||||||
|
$subform = new Application_Form_SmartPlaylistCriteriaSubForm();
|
||||||
|
$subform->setCriteriaSetNumber($i);
|
||||||
|
$subform->startForm($p_playlistId);
|
||||||
|
$this->addSubForm($subform, 'sp_set_'.$i);
|
||||||
|
}
|
||||||
|
|
||||||
|
//getting playlist content candidate count that meets criteria
|
||||||
|
$pl = new Application_Model_Playlist($p_playlistId);
|
||||||
|
$files = $pl->getListofFilesMeetCriteria();
|
||||||
|
|
||||||
|
$this->setDecorators(array(
|
||||||
|
array('ViewScript', array('viewScript' => 'form/smart-playlist.phtml', "openOption"=> $openSmartPlaylistOption, "parent_form"=>$this, "numOfSubForm"=>$numOfSubForm))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
class Application_Form_SmartPlaylistCriteriaSubForm extends Zend_Form_SubForm
|
||||||
{
|
{
|
||||||
|
private $setNumber;
|
||||||
|
|
||||||
public function init(){
|
public function init(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setCriteriaSetNumber($p_num)
|
||||||
|
{
|
||||||
|
$this->setNumber = $p_num;
|
||||||
|
}
|
||||||
|
|
||||||
public function startForm($p_playlistId)
|
public function startForm($p_playlistId)
|
||||||
{
|
{
|
||||||
$criteriaOptions = array(
|
$criteriaOptions = array(
|
||||||
|
@ -21,6 +29,7 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||||
"label" => "Label",
|
"label" => "Label",
|
||||||
"language" => "Language",
|
"language" => "Language",
|
||||||
"mtime" => "Last Modified",
|
"mtime" => "Last Modified",
|
||||||
|
"lptime" => "Last Played",
|
||||||
"length" => "Length",
|
"length" => "Length",
|
||||||
"lyricist" => "Lyricist",
|
"lyricist" => "Lyricist",
|
||||||
"mood" => "Mood",
|
"mood" => "Mood",
|
||||||
|
@ -29,7 +38,6 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||||
"radio_station_name" => "Radio Station Name",
|
"radio_station_name" => "Radio Station Name",
|
||||||
"rating" => "Rating",
|
"rating" => "Rating",
|
||||||
"sample_rate" => "Sample Rate",
|
"sample_rate" => "Sample Rate",
|
||||||
"soundcloud_id" => "Soundcloud Upload",
|
|
||||||
"track_title" => "Title",
|
"track_title" => "Title",
|
||||||
"track_num" => "Track Number",
|
"track_num" => "Track Number",
|
||||||
"utime" => "Uploaded",
|
"utime" => "Uploaded",
|
||||||
|
@ -47,6 +55,7 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||||
"conductor" => "s",
|
"conductor" => "s",
|
||||||
"utime" => "n",
|
"utime" => "n",
|
||||||
"mtime" => "n",
|
"mtime" => "n",
|
||||||
|
"lptime" => "n",
|
||||||
"disc_number" => "n",
|
"disc_number" => "n",
|
||||||
"genre" => "s",
|
"genre" => "s",
|
||||||
"isrc_number" => "s",
|
"isrc_number" => "s",
|
||||||
|
@ -60,7 +69,6 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||||
"radio_station_name" => "s",
|
"radio_station_name" => "s",
|
||||||
"rating" => "n",
|
"rating" => "n",
|
||||||
"sample_rate" => "n",
|
"sample_rate" => "n",
|
||||||
"soundcloud_id" => "n",
|
|
||||||
"track_title" => "s",
|
"track_title" => "s",
|
||||||
"track_num" => "n",
|
"track_num" => "n",
|
||||||
"year" => "n"
|
"year" => "n"
|
||||||
|
@ -91,6 +99,7 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||||
"items" => "items"
|
"items" => "items"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
// load type
|
// load type
|
||||||
$out = CcPlaylistQuery::create()->findPk($p_playlistId);
|
$out = CcPlaylistQuery::create()->findPk($p_playlistId);
|
||||||
if ($out->getDbType() == "static") {
|
if ($out->getDbType() == "static") {
|
||||||
|
@ -99,6 +108,7 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||||
$playlistType = 1;
|
$playlistType = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$spType = new Zend_Form_Element_Radio('sp_type');
|
$spType = new Zend_Form_Element_Radio('sp_type');
|
||||||
$spType->setLabel('Set smart playlist type:')
|
$spType->setLabel('Set smart playlist type:')
|
||||||
->setDecorators(array('viewHelper'))
|
->setDecorators(array('viewHelper'))
|
||||||
|
@ -108,6 +118,7 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||||
))
|
))
|
||||||
->setValue($playlistType);
|
->setValue($playlistType);
|
||||||
$this->addElement($spType);
|
$this->addElement($spType);
|
||||||
|
*/
|
||||||
|
|
||||||
// load criteria from db
|
// load criteria from db
|
||||||
$out = CcPlaylistcriteriaQuery::create()->findByDbPlaylistId($p_playlistId);
|
$out = CcPlaylistcriteriaQuery::create()->findByDbPlaylistId($p_playlistId);
|
||||||
|
@ -134,7 +145,8 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||||
$numElements = count($criteriaOptions);
|
$numElements = count($criteriaOptions);
|
||||||
for ($i = 0; $i < $numElements; $i++) {
|
for ($i = 0; $i < $numElements; $i++) {
|
||||||
$criteriaType = "";
|
$criteriaType = "";
|
||||||
$criteria = new Zend_Form_Element_Select('sp_criteria_field_'.$i);
|
|
||||||
|
$criteria = new Zend_Form_Element_Select("sp_criteria_field_".$this->setNumber."_".$i);
|
||||||
$criteria->setAttrib('class', 'input_select sp_input_select')
|
$criteria->setAttrib('class', 'input_select sp_input_select')
|
||||||
->setValue('Select criteria')
|
->setValue('Select criteria')
|
||||||
->setDecorators(array('viewHelper'))
|
->setDecorators(array('viewHelper'))
|
||||||
|
@ -148,7 +160,7 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
$this->addElement($criteria);
|
$this->addElement($criteria);
|
||||||
|
|
||||||
$criteriaModifers = new Zend_Form_Element_Select('sp_criteria_modifier_'.$i);
|
$criteriaModifers = new Zend_Form_Element_Select("sp_criteria_modifier_".$this->setNumber."_".$i);
|
||||||
$criteriaModifers->setValue('Select modifier')
|
$criteriaModifers->setValue('Select modifier')
|
||||||
->setAttrib('class', 'input_select sp_input_select')
|
->setAttrib('class', 'input_select sp_input_select')
|
||||||
->setDecorators(array('viewHelper'));
|
->setDecorators(array('viewHelper'));
|
||||||
|
@ -167,7 +179,7 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
$this->addElement($criteriaModifers);
|
$this->addElement($criteriaModifers);
|
||||||
|
|
||||||
$criteriaValue = new Zend_Form_Element_Text('sp_criteria_value_'.$i);
|
$criteriaValue = new Zend_Form_Element_Text("sp_criteria_value_".$this->setNumber."_".$i);
|
||||||
$criteriaValue->setAttrib('class', 'input_text sp_input_text')
|
$criteriaValue->setAttrib('class', 'input_text sp_input_text')
|
||||||
->setDecorators(array('viewHelper'));
|
->setDecorators(array('viewHelper'));
|
||||||
if ($i != 0 && !isset($storedCrit["crit"][$i])){
|
if ($i != 0 && !isset($storedCrit["crit"][$i])){
|
||||||
|
@ -178,7 +190,7 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
$this->addElement($criteriaValue);
|
$this->addElement($criteriaValue);
|
||||||
|
|
||||||
$criteriaExtra = new Zend_Form_Element_Text('sp_criteria_extra_'.$i);
|
$criteriaExtra = new Zend_Form_Element_Text("sp_criteria_extra_".$this->setNumber."_".$i);
|
||||||
$criteriaExtra->setAttrib('class', 'input_text sp_extra_input_text')
|
$criteriaExtra->setAttrib('class', 'input_text sp_extra_input_text')
|
||||||
->setDecorators(array('viewHelper'));
|
->setDecorators(array('viewHelper'));
|
||||||
if (isset($storedCrit["crit"][$i]["extra"])) {
|
if (isset($storedCrit["crit"][$i]["extra"])) {
|
||||||
|
@ -190,55 +202,34 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||||
$this->addElement($criteriaExtra);
|
$this->addElement($criteriaExtra);
|
||||||
}
|
}
|
||||||
|
|
||||||
$limit = new Zend_Form_Element_Select('sp_limit_options');
|
$limit = new Zend_Form_Element_Select('sp_limit_options_'.$this->setNumber);
|
||||||
$limit->setAttrib('class', 'sp_input_select');
|
$limit->setAttrib('class', 'sp_input_select')
|
||||||
$limit->setDecorators(array('viewHelper'));
|
->setDecorators(array('viewHelper'))
|
||||||
$limit->setMultiOptions($limitOptions);
|
->setMultiOptions($limitOptions);
|
||||||
if (isset($storedCrit["limit"])) {
|
if (isset($storedCrit["limit"])) {
|
||||||
$limit->setValue($storedCrit["limit"]["modifier"]);
|
$limit->setValue($storedCrit["limit"]["modifier"]);
|
||||||
}
|
}
|
||||||
$this->addElement($limit);
|
$this->addElement($limit);
|
||||||
|
|
||||||
$limitValue = new Zend_Form_Element_Text('sp_limit_value');
|
$limitValue = new Zend_Form_Element_Text('sp_limit_value_'.$this->setNumber);
|
||||||
$limitValue->setAttrib('class', 'sp_input_text_limit');
|
$limitValue->setAttrib('class', 'sp_input_text_limit')
|
||||||
$limitValue->setLabel('Limit to');
|
->setLabel('Limit to')
|
||||||
$limitValue->setDecorators(array('viewHelper'));
|
->setDecorators(array('viewHelper'));
|
||||||
$this->addElement($limitValue);
|
$this->addElement($limitValue);
|
||||||
if (isset($storedCrit["limit"])) {
|
if (isset($storedCrit["limit"])) {
|
||||||
$limitValue->setValue($storedCrit["limit"]["value"]);
|
$limitValue->setValue($storedCrit["limit"]["value"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$save = new Zend_Form_Element_Button('save_button');
|
|
||||||
$save->setAttrib('class', 'ui-button ui-state-default sp-button');
|
|
||||||
$save->setAttrib('title', 'Save criteria only');
|
|
||||||
$save->setIgnore(true);
|
|
||||||
$save->setLabel('Save');
|
|
||||||
$save->setDecorators(array('viewHelper'));
|
|
||||||
$this->addElement($save);
|
|
||||||
|
|
||||||
$generate = new Zend_Form_Element_Button('generate_button');
|
|
||||||
$generate->setAttrib('class', 'ui-button ui-state-default sp-button');
|
|
||||||
$generate->setAttrib('title', 'Save criteria and generate playlist content');
|
|
||||||
$generate->setIgnore(true);
|
|
||||||
$generate->setLabel('Generate');
|
|
||||||
$generate->setDecorators(array('viewHelper'));
|
|
||||||
$this->addElement($generate);
|
|
||||||
|
|
||||||
$shuffle = new Zend_Form_Element_Button('shuffle_button');
|
|
||||||
$shuffle->setAttrib('class', 'ui-button ui-state-default sp-button');
|
|
||||||
$shuffle->setAttrib('title', 'Shuffle playlist content');
|
|
||||||
$shuffle->setIgnore(true);
|
|
||||||
$shuffle->setLabel('Shuffle');
|
|
||||||
$shuffle->setDecorators(array('viewHelper'));
|
|
||||||
$this->addElement($shuffle);
|
|
||||||
|
|
||||||
//getting playlist content candidate count that meets criteria
|
//getting playlist content candidate count that meets criteria
|
||||||
$pl = new Application_Model_Playlist($p_playlistId);
|
$pl = new Application_Model_Playlist($p_playlistId);
|
||||||
$files = $pl->getListofFilesMeetCriteria();
|
$files = $pl->getListofFilesMeetCriteria();
|
||||||
|
|
||||||
|
Logging::log($this->getElements());
|
||||||
|
Logging::log(count($this->getElements()));
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/smart-playlist-criteria.phtml', "openOption"=> $openSmartPlaylistOption,
|
array('ViewScript', array('viewScript' => 'form/smart-playlist-criteria.phtml', "openOption"=> $openSmartPlaylistOption,
|
||||||
'criteriasLength' => count($criteriaOptions), 'poolCount' => $files['count']))
|
'criteriasLength' => count($criteriaOptions), 'poolCount' => $files['count'], 'setNumber' => $this->setNumber))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -68,6 +68,7 @@ class Application_Model_Playlist
|
||||||
"conductor" => "DbConductor",
|
"conductor" => "DbConductor",
|
||||||
"utime" => "DbUtime",
|
"utime" => "DbUtime",
|
||||||
"mtime" => "DbMtime",
|
"mtime" => "DbMtime",
|
||||||
|
"lptime" => "DbLPtime",
|
||||||
"disc_number" => "DbDiscNumber",
|
"disc_number" => "DbDiscNumber",
|
||||||
"genre" => "DbGenre",
|
"genre" => "DbGenre",
|
||||||
"isrc_number" => "DbIsrcNumber",
|
"isrc_number" => "DbIsrcNumber",
|
||||||
|
@ -81,7 +82,6 @@ class Application_Model_Playlist
|
||||||
"radio_station_name" => "DbRadioStation",
|
"radio_station_name" => "DbRadioStation",
|
||||||
"rating" => "DbRating",
|
"rating" => "DbRating",
|
||||||
"sample_rate" => "DbSampleRate",
|
"sample_rate" => "DbSampleRate",
|
||||||
"soundcloud_id" => "DbSoundcloudId",
|
|
||||||
"track_title" => "DbTrackTitle",
|
"track_title" => "DbTrackTitle",
|
||||||
"track_num" => "DbTrackNum",
|
"track_num" => "DbTrackNum",
|
||||||
"year" => "DbYear"
|
"year" => "DbYear"
|
||||||
|
@ -1109,18 +1109,14 @@ class Application_Model_Playlist
|
||||||
}
|
}
|
||||||
|
|
||||||
$qry = CcFilesQuery::create();
|
$qry = CcFilesQuery::create();
|
||||||
|
|
||||||
|
if (isset($storedCrit["crit"])) {
|
||||||
foreach ($storedCrit["crit"] as $criteria) {
|
foreach ($storedCrit["crit"] as $criteria) {
|
||||||
$spCriteriaPhpName = self::$criteria2PeerMap[$criteria['criteria']];
|
$spCriteriaPhpName = self::$criteria2PeerMap[$criteria['criteria']];
|
||||||
$spCriteria = $criteria['criteria'];
|
$spCriteria = $criteria['criteria'];
|
||||||
|
|
||||||
$spCriteriaModifier = $criteria['modifier'];
|
$spCriteriaModifier = $criteria['modifier'];
|
||||||
$spCriteriaValue = $criteria['value'];
|
$spCriteriaValue = $criteria['value'];
|
||||||
|
|
||||||
// change date/time to UTC is the column time is timestamp
|
|
||||||
if (CcFilesPeer::getTableMap()->getColumnByPhpName($spCriteriaPhpName)->getType() == PropelColumnTypes::TIMESTAMP) {
|
|
||||||
$spCriteriaValue = Application_Common_DateHelper::ConvertToUtcDateTimeString($spCriteriaValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($spCriteriaModifier == "starts with") {
|
if ($spCriteriaModifier == "starts with") {
|
||||||
$spCriteriaValue = "$spCriteriaValue%";
|
$spCriteriaValue = "$spCriteriaValue%";
|
||||||
} else if ($spCriteriaModifier == "ends with") {
|
} else if ($spCriteriaModifier == "ends with") {
|
||||||
|
@ -1138,8 +1134,10 @@ class Application_Model_Playlist
|
||||||
Logging::log($e);
|
Logging::log($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// construct limit restriction
|
// construct limit restriction
|
||||||
$limits = array();
|
$limits = array();
|
||||||
|
if (isset($storedCrit['limit'])) {
|
||||||
if ($storedCrit['limit']['modifier'] == "items") {
|
if ($storedCrit['limit']['modifier'] == "items") {
|
||||||
$limits['time'] = 1440 * 60;
|
$limits['time'] = 1440 * 60;
|
||||||
$limits['items'] = $storedCrit['limit']['value'];
|
$limits['items'] = $storedCrit['limit']['value'];
|
||||||
|
@ -1147,6 +1145,7 @@ class Application_Model_Playlist
|
||||||
$limits['time'] = $storedCrit['limit']['modifier'] == "hours" ? intval($storedCrit['limit']['value']) * 60 * 60 : intval($storedCrit['limit']['value'] * 60);
|
$limits['time'] = $storedCrit['limit']['modifier'] == "hours" ? intval($storedCrit['limit']['value']) * 60 * 60 : intval($storedCrit['limit']['value'] * 60);
|
||||||
$limits['items'] = null;
|
$limits['items'] = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
try{
|
try{
|
||||||
$out = $qry->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find();
|
$out = $qry->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find();
|
||||||
return array("files"=>$out, "limit"=>$limits, "count"=>$out->count());
|
return array("files"=>$out, "limit"=>$limits, "count"=>$out->count());
|
||||||
|
|
|
@ -966,4 +966,10 @@ class Application_Model_Schedule
|
||||||
|
|
||||||
return $overlapping;
|
return $overlapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function GetFileId($p_scheduleId)
|
||||||
|
{
|
||||||
|
$scheduledItem = CcScheduleQuery::create()->findPK($p_scheduleId);
|
||||||
|
return $scheduledItem->getDbFileId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1519,10 +1519,11 @@ class Application_Model_Show
|
||||||
$sql = "SELECT si1.starts AS starts, si1.ends AS ends, si1.record AS record, si1.rebroadcast AS rebroadcast, si2.starts AS parent_starts,
|
$sql = "SELECT si1.starts AS starts, si1.ends AS ends, si1.record AS record, si1.rebroadcast AS rebroadcast, si2.starts AS parent_starts,
|
||||||
si1.instance_id AS record_id, si1.show_id AS show_id, show.name AS name,
|
si1.instance_id AS record_id, si1.show_id AS show_id, show.name AS name,
|
||||||
show.color AS color, show.background_color AS background_color, si1.file_id AS file_id, si1.id AS instance_id,
|
show.color AS color, show.background_color AS background_color, si1.file_id AS file_id, si1.id AS instance_id,
|
||||||
si1.created AS created, si1.last_scheduled AS last_scheduled, si1.time_filled AS time_filled
|
si1.created AS created, si1.last_scheduled AS last_scheduled, si1.time_filled AS time_filled, f.soundcloud_id
|
||||||
FROM cc_show_instances AS si1
|
FROM cc_show_instances AS si1
|
||||||
LEFT JOIN cc_show_instances AS si2 ON si1.instance_id = si2.id
|
LEFT JOIN cc_show_instances AS si2 ON si1.instance_id = si2.id
|
||||||
LEFT JOIN cc_show AS show ON show.id = si1.show_id
|
LEFT JOIN cc_show AS show ON show.id = si1.show_id
|
||||||
|
LEFT JOIN cc_files AS f ON f.id = si1.file_id
|
||||||
WHERE si1.modified_instance = FALSE";
|
WHERE si1.modified_instance = FALSE";
|
||||||
//only want shows that are starting at the time or later.
|
//only want shows that are starting at the time or later.
|
||||||
$start_string = $start_timestamp->format("Y-m-d H:i:s");
|
$start_string = $start_timestamp->format("Y-m-d H:i:s");
|
||||||
|
@ -1538,7 +1539,6 @@ class Application_Model_Show
|
||||||
OR (si1.starts <= '{$start_string}' AND si1.ends >= '{$end_string}'))";
|
OR (si1.starts <= '{$start_string}' AND si1.ends >= '{$end_string}'))";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isset($excludeInstance)) {
|
if (isset($excludeInstance)) {
|
||||||
foreach ($excludeInstance as $instance) {
|
foreach ($excludeInstance as $instance) {
|
||||||
$sql_exclude[] = "si1.id != {$instance}";
|
$sql_exclude[] = "si1.id != {$instance}";
|
||||||
|
@ -1549,8 +1549,7 @@ class Application_Model_Show
|
||||||
$sql = $sql." AND ({$exclude})";
|
$sql = $sql." AND ({$exclude})";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $con->query($sql)->fetchAll();
|
$result = $con->query($sql);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1606,7 +1605,7 @@ class Application_Model_Show
|
||||||
* -in UTC time
|
* -in UTC time
|
||||||
* @param boolean $editable
|
* @param boolean $editable
|
||||||
*/
|
*/
|
||||||
public static function getFullCalendarEvents($p_start, $p_end, $p_editable=false)
|
public static function &getFullCalendarEvents($p_start, $p_end, $p_editable=false)
|
||||||
{
|
{
|
||||||
$events = array();
|
$events = array();
|
||||||
$interval = $p_start->diff($p_end);
|
$interval = $p_start->diff($p_end);
|
||||||
|
@ -1614,11 +1613,12 @@ class Application_Model_Show
|
||||||
$shows = Application_Model_Show::getShows($p_start, $p_end);
|
$shows = Application_Model_Show::getShows($p_start, $p_end);
|
||||||
$nowEpoch = time();
|
$nowEpoch = time();
|
||||||
|
|
||||||
|
$timezone = date_default_timezone_get();
|
||||||
|
|
||||||
foreach ($shows as $show) {
|
foreach ($shows as $show) {
|
||||||
$options = array();
|
$options = array();
|
||||||
|
|
||||||
//only bother calculating percent for week or day view.
|
//only bother calculating percent for week or day view.
|
||||||
|
|
||||||
if (intval($days) <= 7) {
|
if (intval($days) <= 7) {
|
||||||
$options["percent"] = Application_Model_Show::getPercentScheduled($show["starts"], $show["ends"], $show["time_filled"]);
|
$options["percent"] = Application_Model_Show::getPercentScheduled($show["starts"], $show["ends"], $show["time_filled"]);
|
||||||
}
|
}
|
||||||
|
@ -1627,11 +1627,17 @@ class Application_Model_Show
|
||||||
$parentStartsDT = new DateTime($show["parent_starts"], new DateTimeZone("UTC"));
|
$parentStartsDT = new DateTime($show["parent_starts"], new DateTimeZone("UTC"));
|
||||||
$parentStartsEpoch = intval($parentStartsDT->format("U"));
|
$parentStartsEpoch = intval($parentStartsDT->format("U"));
|
||||||
}
|
}
|
||||||
$startsDT = new DateTime($show["starts"], new DateTimeZone("UTC"));
|
$startsDT = DateTime::createFromFormat("Y-m-d G:i:s", $show["starts"], new DateTimeZone("UTC"));
|
||||||
$endsDT = new DateTime($show["ends"], new DateTimeZone("UTC"));
|
$endsDT = DateTime::createFromFormat("Y-m-d G:i:s", $show["ends"], new DateTimeZone("UTC"));
|
||||||
|
|
||||||
$startsEpoch = intval($startsDT->format("U"));
|
$startsEpochStr = $startsDT->format("U");
|
||||||
$endsEpoch = intval($endsDT->format("U"));
|
$endsEpochStr = $endsDT->format("U");
|
||||||
|
|
||||||
|
$startsEpoch = intval($startsEpochStr);
|
||||||
|
$endsEpoch = intval($endsEpochStr);
|
||||||
|
|
||||||
|
$startsDT->setTimezone(new DateTimeZone($timezone));
|
||||||
|
$endsDT->setTimezone(new DateTimeZone($timezone));
|
||||||
|
|
||||||
if ($p_editable && $show["record"] && $nowEpoch > $startsEpoch) {
|
if ($p_editable && $show["record"] && $nowEpoch > $startsEpoch) {
|
||||||
$options["editable"] = false;
|
$options["editable"] = false;
|
||||||
|
@ -1640,7 +1646,7 @@ class Application_Model_Show
|
||||||
} elseif ($p_editable && $nowEpoch < $endsEpoch) {
|
} elseif ($p_editable && $nowEpoch < $endsEpoch) {
|
||||||
$options["editable"] = true;
|
$options["editable"] = true;
|
||||||
}
|
}
|
||||||
$events[] = Application_Model_Show::makeFullCalendarEvent($show, $options);
|
$events[] = &self::makeFullCalendarEvent($show, $options, $startsDT, $endsDT, $startsEpochStr, $endsEpochStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $events;
|
return $events;
|
||||||
|
@ -1659,39 +1665,27 @@ class Application_Model_Show
|
||||||
return $percent;
|
return $percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function makeFullCalendarEvent($show, $options=array())
|
private static function &makeFullCalendarEvent(&$show, $options=array(), $startDateTime, $endDateTime, $startsEpoch, $endsEpoch)
|
||||||
{
|
{
|
||||||
$event = array();
|
$event = array();
|
||||||
|
|
||||||
$startDateTime = new DateTime($show["starts"], new DateTimeZone("UTC"));
|
|
||||||
$startDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
|
||||||
|
|
||||||
$endDateTime = new DateTime($show["ends"], new DateTimeZone("UTC"));
|
|
||||||
$endDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
|
||||||
|
|
||||||
$event["id"] = intval($show["instance_id"]);
|
$event["id"] = intval($show["instance_id"]);
|
||||||
$event["title"] = $show["name"];
|
$event["title"] = $show["name"];
|
||||||
$event["start"] = $startDateTime->format("Y-m-d H:i:s");
|
$event["start"] = $startDateTime->format("Y-m-d H:i:s");
|
||||||
$event["startUnix"] = $startDateTime->format("U");
|
$event["startUnix"] = $startsEpoch;
|
||||||
$event["end"] = $endDateTime->format("Y-m-d H:i:s");
|
$event["end"] = $endDateTime->format("Y-m-d H:i:s");
|
||||||
$event["endUnix"] = $endDateTime->format("U");
|
$event["endUnix"] = $endsEpoch;
|
||||||
$event["allDay"] = false;
|
$event["allDay"] = false;
|
||||||
$event["showId"] = intval($show["show_id"]);
|
$event["showId"] = intval($show["show_id"]);
|
||||||
$event["record"] = intval($show["record"]);
|
$event["record"] = intval($show["record"]);
|
||||||
$event["rebroadcast"] = intval($show["rebroadcast"]);
|
$event["rebroadcast"] = intval($show["rebroadcast"]);
|
||||||
|
$event["soundcloud_id"] = is_null($show["soundcloud_id"]) ? -1 : $show["soundcloud_id"];
|
||||||
// get soundcloud_id
|
|
||||||
if (!is_null($show["file_id"])) {
|
|
||||||
$file = Application_Model_StoredFile::Recall($show["file_id"]);
|
|
||||||
$soundcloud_id = $file->getSoundCloudId();
|
|
||||||
}
|
|
||||||
|
|
||||||
$event["soundcloud_id"] = isset($soundcloud_id) ? $soundcloud_id : -1;
|
|
||||||
|
|
||||||
//event colouring
|
//event colouring
|
||||||
if ($show["color"] != "") {
|
if ($show["color"] != "") {
|
||||||
$event["textColor"] = "#".$show["color"];
|
$event["textColor"] = "#".$show["color"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($show["background_color"] != "") {
|
if ($show["background_color"] != "") {
|
||||||
$event["color"] = "#".$show["background_color"];
|
$event["color"] = "#".$show["background_color"];
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,19 @@ class Application_Model_StoredFile
|
||||||
$this->_file->setDbFtype($p_format);
|
$this->_file->setDbFtype($p_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This function is only called after liquidsoap
|
||||||
|
* has notified that a track has started playing.
|
||||||
|
*/
|
||||||
|
public function setLastPlayedTime($p_now)
|
||||||
|
{
|
||||||
|
$this->_file->setDbLPtime($p_now);
|
||||||
|
/* Normally we would only call save after all columns have been set
|
||||||
|
* like in setDbColMetadata(). But since we are only setting one
|
||||||
|
* column in this case it is OK.
|
||||||
|
*/
|
||||||
|
$this->_file->save();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set multiple metadata values using defined metadata constants.
|
* Set multiple metadata values using defined metadata constants.
|
||||||
*
|
*
|
||||||
|
@ -120,9 +133,6 @@ class Application_Model_StoredFile
|
||||||
}
|
}
|
||||||
$this->setDbColMetadata($dbMd);
|
$this->setDbColMetadata($dbMd);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_file->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
|
||||||
$this->_file->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -153,7 +163,7 @@ class Application_Model_StoredFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_file->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
$this->_file->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||||
$this->_file->save();
|
$this->_file->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,8 +486,8 @@ Logging::log("getting media! - 2");
|
||||||
{
|
{
|
||||||
$file = new CcFiles();
|
$file = new CcFiles();
|
||||||
$file->setDbGunid(md5(uniqid("", true)));
|
$file->setDbGunid(md5(uniqid("", true)));
|
||||||
$file->setDbUtime(new DateTime("now"), new DateTimeZone("UTC"));
|
$file->setDbUtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||||
$file->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
$file->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||||
|
|
||||||
$storedFile = new Application_Model_StoredFile();
|
$storedFile = new Application_Model_StoredFile();
|
||||||
$storedFile->_file = $file;
|
$storedFile->_file = $file;
|
||||||
|
@ -714,6 +724,15 @@ Logging::log("getting media! - 2");
|
||||||
$row['bit_rate'] = $formatter->format();
|
$row['bit_rate'] = $formatter->format();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//convert mtime and utime to localtime
|
||||||
|
$row['mtime'] = new DateTime($row['mtime'], new DateTimeZone('UTC'));
|
||||||
|
$row['mtime']->setTimeZone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$row['mtime'] = $row['mtime']->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
|
$row['utime'] = new DateTime($row['utime'], new DateTimeZone('UTC'));
|
||||||
|
$row['utime']->setTimeZone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$row['utime'] = $row['utime']->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
// add checkbox row
|
// add checkbox row
|
||||||
$row['checkbox'] = "<input type='checkbox' name='cb_".$row['id']."'>";
|
$row['checkbox'] = "<input type='checkbox' name='cb_".$row['id']."'>";
|
||||||
|
|
||||||
|
|
|
@ -1,38 +1,18 @@
|
||||||
<form id="smart-playlist-form" method="post" action="">
|
<h2 class="collapsible-header close"><span class="arrow-icon"></span>Set <?php echo $this->setNumber?></h2>
|
||||||
<fieldset class='toggle <?php echo $this->openOption ? "" : "closed"?>' id='smart_playlist_options'>
|
<fieldset class='toggle <?php echo $this->openOption ? "" : "closed"?>' id='sp_set_<?php echo $this->setNumber?>'>
|
||||||
<legend style='cursor: pointer;'><span class='ui-icon ui-icon-triangle-2-n-s'></span>Smart Playlist Options</legend>
|
|
||||||
<dl class='zend_form'>
|
<dl class='zend_form'>
|
||||||
<div id='sp-success' class='success' style='display:none'></div>
|
|
||||||
<dd id='sp_type-element' class='radio-inline-list'>
|
|
||||||
<label>
|
|
||||||
<?php echo $this->element->getElement('sp_type')->getLabel() ?>
|
|
||||||
<span class='playlist_type_help_icon'></span>
|
|
||||||
</label>
|
|
||||||
<?php $i=0;
|
|
||||||
$value = $this->element->getElement('sp_type')->getValue();
|
|
||||||
foreach ($this->element->getElement('sp_type')->getMultiOptions() as $radio) : ?>
|
|
||||||
|
|
||||||
<label for='sp_type-<?php echo $i?>'>
|
|
||||||
<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 ?>
|
|
||||||
</label>
|
|
||||||
<?php $i = $i + 1; ?>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php echo $this->element->getElement('save_button') ?>
|
|
||||||
<?php echo $this->element->getElement('generate_button') ?>
|
|
||||||
<?php echo $this->element->getElement('shuffle_button') ?>
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
<dd id='sp_criteria-element'>
|
<dd id='sp_criteria-element'>
|
||||||
<?php for ($i = 0; $i < $this->criteriasLength; $i++) {?>
|
<?php for ($i = 0; $i < $this->criteriasLength; $i++) {?>
|
||||||
<div <?php if (($i > 0) && ($this->element->getElement('sp_criteria_field_'.$i)->getAttrib('disabled') == 'disabled')) {
|
<div <?php if (($i > 0) && ($this->element->getElement("sp_criteria_field_".$this->setNumber."_".$i)->getAttrib('disabled') == 'disabled')) {
|
||||||
echo 'style=display:none';
|
echo 'style=display:none';
|
||||||
} ?>>
|
} ?>>
|
||||||
|
|
||||||
<?php echo $this->element->getElement('sp_criteria_field_'.$i) ?>
|
<?php echo $this->element->getElement("sp_criteria_field_".$this->setNumber."_".$i) ?>
|
||||||
<?php echo $this->element->getElement('sp_criteria_modifier_'.$i) ?>
|
<?php echo $this->element->getElement("sp_criteria_modifier_".$this->setNumber."_".$i) ?>
|
||||||
<?php echo $this->element->getElement('sp_criteria_value_'.$i) ?>
|
<?php echo $this->element->getElement("sp_criteria_value_".$this->setNumber."_".$i) ?>
|
||||||
<span class='sp_text_font' id="extra_criteria" <?php echo $this->element->getElement('sp_criteria_extra_'.$i)->getAttrib("disabled") == "disabled"?'style="display:none;"':""?>> to <?php echo $this->element->getElement('sp_criteria_extra_'.$i) ?></span>
|
<span class='sp_text_font' id="extra_criteria" <?php echo $this->element->getElement("sp_criteria_extra_".$this->setNumber."_".$i)->getAttrib("disabled") == "disabled"?'style="display:none;"':""?>> to <?php echo $this->element->getElement('sp_criteria_extra_'.$this->setNumber.'_'.$i) ?></span>
|
||||||
<a class='ui-button sp-ui-button-icon-only' id='criteria_remove_<?php echo $i ?>'>
|
<a class='ui-button sp-ui-button-icon-only' id='criteria_remove_<?php echo $this->setNumber ?>_<?php echo $i ?>'>
|
||||||
<span class='ui-icon ui-icon-closethick'></span>
|
<span class='ui-icon ui-icon-closethick'></span>
|
||||||
</a>
|
</a>
|
||||||
<br />
|
<br />
|
||||||
|
@ -43,9 +23,9 @@
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dd id='sp_limit-element'>
|
<dd id='sp_limit-element'>
|
||||||
<span class='sp_text_font'><?php echo $this->element->getElement('sp_limit_value')->getLabel() ?></span>
|
<span class='sp_text_font'><?php echo $this->element->getElement('sp_limit_value_'.$this->setNumber)->getLabel() ?></span>
|
||||||
<?php echo $this->element->getElement('sp_limit_value')?>
|
<?php echo $this->element->getElement('sp_limit_value_'.$this->setNumber)?>
|
||||||
<?php echo $this->element->getElement('sp_limit_options') ?>
|
<?php echo $this->element->getElement('sp_limit_options_'.$this->setNumber) ?>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
</dd>
|
</dd>
|
||||||
<div class='sp_text_font sp_text_font_bold'>
|
<div class='sp_text_font sp_text_font_bold'>
|
||||||
|
@ -77,4 +57,3 @@
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<form id="smart-playlist-form" method="post" action="">
|
||||||
|
<fieldset class='toggle <?php echo $this->openOption ? "" : "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'>
|
||||||
|
<div id='sp-success' class='success' style='display:none'></div>
|
||||||
|
<dd id='sp_type-element'>
|
||||||
|
<label class='sp-label'>
|
||||||
|
<?php echo $this->element->getElement('sp_type')->getLabel() ?>
|
||||||
|
<span class='playlist_type_help_icon'></span>
|
||||||
|
</label>
|
||||||
|
<?php $i=0;
|
||||||
|
$value = $this->element->getElement('sp_type')->getValue();
|
||||||
|
foreach ($this->element->getElement('sp_type')->getMultiOptions() as $radio) : ?>
|
||||||
|
|
||||||
|
<label class='sp-label' for='sp_type-<?php echo $i?>'>
|
||||||
|
<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 ?>
|
||||||
|
</label>
|
||||||
|
<?php $i = $i + 1; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php echo $this->element->getElement('save_button') ?>
|
||||||
|
<?php echo $this->element->getElement('generate_button') ?>
|
||||||
|
<?php echo $this->element->getElement('shuffle_button') ?>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<?php
|
||||||
|
for($i=0;$i<$this->numOfSubForm;$i++){
|
||||||
|
echo $this->parent_form->getSubform('sp_set_'.$i);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
|
@ -477,6 +477,10 @@ input.input_text.sp_extra_input_text{
|
||||||
width: 16px;
|
width: 16px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sp-label{
|
||||||
|
padding: 0px !important;
|
||||||
|
}
|
||||||
/***** SMART PLAYLIST SPECIFIC STYLES END *****/
|
/***** SMART PLAYLIST SPECIFIC STYLES END *****/
|
||||||
|
|
||||||
label {
|
label {
|
||||||
|
|
|
@ -279,7 +279,7 @@ function callback(data, type) {
|
||||||
if (type == 'shuffle') {
|
if (type == 'shuffle') {
|
||||||
form.find('.success').text('Playlist shuffled');
|
form.find('.success').text('Playlist shuffled');
|
||||||
} else {
|
} else {
|
||||||
form.find('.success').text('Smart playlist generated');
|
form.find('.success').text('Smart playlist generated and saved');
|
||||||
}
|
}
|
||||||
form.find('.success').show();
|
form.find('.success').show();
|
||||||
form.find('#smart_playlist_options').removeClass("closed");
|
form.find('#smart_playlist_options').removeClass("closed");
|
||||||
|
@ -287,8 +287,9 @@ function callback(data, type) {
|
||||||
form.find('.success').text('Criteria saved');
|
form.find('.success').text('Criteria saved');
|
||||||
form.find('.success').show();
|
form.find('.success').show();
|
||||||
|
|
||||||
/* Update number of files that meet criteria and
|
/* Update number of files that meet criteria and change icon to success/warning
|
||||||
* change icon to success/warning as appropriate
|
* as appropriate. This is also done in the form but we do not pass the form
|
||||||
|
* back on a 'Save' callback.
|
||||||
*/
|
*/
|
||||||
if (json.poolCount > 1) {
|
if (json.poolCount > 1) {
|
||||||
$('#sp_pool_count').text(json.poolCount+' files meet the criteria');
|
$('#sp_pool_count').text(json.poolCount+' files meet the criteria');
|
||||||
|
@ -358,6 +359,7 @@ var criteriaTypes = {
|
||||||
"conductor" : "s",
|
"conductor" : "s",
|
||||||
"utime" : "n",
|
"utime" : "n",
|
||||||
"mtime" : "n",
|
"mtime" : "n",
|
||||||
|
"lptime" : "n",
|
||||||
"disc_number" : "n",
|
"disc_number" : "n",
|
||||||
"genre" : "s",
|
"genre" : "s",
|
||||||
"isrc_number" : "s",
|
"isrc_number" : "s",
|
||||||
|
@ -371,7 +373,6 @@ var criteriaTypes = {
|
||||||
"radio_station_name" : "s",
|
"radio_station_name" : "s",
|
||||||
"rating" : "n",
|
"rating" : "n",
|
||||||
"sample_rate" : "n",
|
"sample_rate" : "n",
|
||||||
"soundcloud_id" : "n",
|
|
||||||
"track_title" : "s",
|
"track_title" : "s",
|
||||||
"track_num" : "n",
|
"track_num" : "n",
|
||||||
"year" : "n"
|
"year" : "n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue