CC-4434: Make Application_Model_Preference::getValue and setValue private methods
-initial commit
This commit is contained in:
parent
cd530fc556
commit
e3c1a3ac0e
|
@ -35,14 +35,14 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', '' );");
|
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', '' );");
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = Application_Model_Preference::getValue("timeline_datatable", true);
|
$data = Application_Model_Preference::getTimelineDatatableSetting();
|
||||||
if ($data != "") {
|
if (!is_null($data)) {
|
||||||
$timelineTable = json_encode(unserialize($data));
|
$timelineTable = json_encode(unserialize($data));
|
||||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', JSON.stringify($timelineTable) );");
|
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', JSON.stringify($timelineTable) );");
|
||||||
} else {
|
} else {
|
||||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', '' );");
|
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', '' );");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
@ -127,11 +127,10 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
$showLib = false;
|
$showLib = false;
|
||||||
if (!$user->isGuest()) {
|
if (!$user->isGuest()) {
|
||||||
$disableLib = false;
|
$disableLib = false;
|
||||||
$data = Application_Model_Preference::getValue("nowplaying_screen", true);
|
|
||||||
if ($data != "") {
|
|
||||||
$settings = unserialize($data);
|
|
||||||
|
|
||||||
if ($settings["library"] == "true") {
|
$data = Application_Model_Preference::getNowPlayingScreenSettings();
|
||||||
|
if (!is_null($data)) {
|
||||||
|
if ($data["library"] == "true") {
|
||||||
$showLib = true;
|
$showLib = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,15 +23,14 @@ class UsersettingsController extends Zend_Controller_Action
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$settings = $request->getParam("settings");
|
$settings = $request->getParam("settings");
|
||||||
|
|
||||||
$data = serialize($settings);
|
Application_Model_Preference::setNowPlayingScreenSettings($data);
|
||||||
Application_Model_Preference::setValue("nowplaying_screen", $data, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNowPlayingScreenSettingsAction()
|
public function getNowPlayingScreenSettingsAction()
|
||||||
{
|
{
|
||||||
$data = Application_Model_Preference::getValue("nowplaying_screen", true);
|
$data = Application_Model_Preference::getNowPlayingScreenSettings();
|
||||||
if ($data != "") {
|
if (!is_null($data)) {
|
||||||
$this->view->settings = unserialize($data);
|
$this->view->settings = $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +39,7 @@ class UsersettingsController extends Zend_Controller_Action
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$settings = $request->getParam("settings");
|
$settings = $request->getParam("settings");
|
||||||
|
|
||||||
$data = serialize($settings);
|
Application_Model_Preference::setCurrentLibraryTableSetting($settings);
|
||||||
Application_Model_Preference::setValue("library_datatable", $data, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLibraryDatatableAction()
|
public function getLibraryDatatableAction()
|
||||||
|
@ -59,9 +57,7 @@ class UsersettingsController extends Zend_Controller_Action
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$settings = $request->getParam("settings");
|
$settings = $request->getParam("settings");
|
||||||
|
|
||||||
$data = serialize($settings);
|
Application_Model_Preference::setTimelineDatatableSetting($settings);
|
||||||
Application_Model_Preference::setValue("timeline_datatable", $data, true);
|
|
||||||
|
|
||||||
$end = microtime(true);
|
$end = microtime(true);
|
||||||
|
|
||||||
Logging::debug("saving timeline datatables info took:");
|
Logging::debug("saving timeline datatables info took:");
|
||||||
|
@ -72,9 +68,9 @@ class UsersettingsController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
|
|
||||||
$data = Application_Model_Preference::getValue("timeline_datatable", true);
|
$data = Application_Model_Preference::getTimelineDatatableSetting();
|
||||||
if ($data != "") {
|
if (!is_null($data)) {
|
||||||
$this->view->settings = unserialize($data);
|
$this->view->settings = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
$end = microtime(true);
|
$end = microtime(true);
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
'label' => 'Station Name',
|
'label' => 'Station Name',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'value' => Application_Model_Preference::getValue("station_name"),
|
'value' => Application_Model_Preference::GetStationName(),
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Application_Form_SupportSettings extends Zend_Form
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validator' => array('NotEmpty'),
|
'validator' => array('NotEmpty'),
|
||||||
'value' => Application_Model_Preference::getValue("station_name"),
|
'value' => Application_Model_Preference::GetStationName(),
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
|
|
|
@ -1085,16 +1085,17 @@ class Application_Model_Preference
|
||||||
$remindDate = Application_Model_Preference::GetRemindMeDate();
|
$remindDate = Application_Model_Preference::GetRemindMeDate();
|
||||||
$retVal = false;
|
$retVal = false;
|
||||||
|
|
||||||
if ($remindDate == NULL || ($remindDate != -1 && $today >= $remindDate)) {
|
if (is_null($remindDate) || ($remindDate != -1 && $today >= $remindDate)) {
|
||||||
$retVal = true;
|
$retVal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $retVal;
|
return $retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function getCurrentLibraryTableSetting()
|
public static function getCurrentLibraryTableSetting()
|
||||||
{
|
{
|
||||||
$v = self::getValue("library_datatable");
|
$v = self::getValue("library_datatable", true);
|
||||||
|
|
||||||
if ( $v === '' ) {
|
if ( $v === '' ) {
|
||||||
return function ($x) { return $x; };
|
return function ($x) { return $x; };
|
||||||
|
@ -1102,6 +1103,44 @@ class Application_Model_Preference
|
||||||
$ds = unserialize($v);
|
$ds = unserialize($v);
|
||||||
return function ($x) use ($ds) { return $ds['ColReorder'][$x]; } ;
|
return function ($x) use ($ds) { return $ds['ColReorder'][$x]; } ;
|
||||||
}
|
}
|
||||||
//return unserialize(self::getValue("library_datatable"));
|
}
|
||||||
|
|
||||||
|
public static function setCurrentLibraryTableSetting($settings)
|
||||||
|
{
|
||||||
|
$num_columns = count(Application_Model_StoredFile::getLibraryColumns());
|
||||||
|
$new_columns_num = count($settings['abVisCols']);
|
||||||
|
|
||||||
|
if ($num_columns != $new_columns_num) {
|
||||||
|
throw new Exception("Trying to write a user column preference with incorrect number of columns!");
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = serialize($settings);
|
||||||
|
$v = self::setValue("library_datatable", $data, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function setTimelineDatatableSetting($settings)
|
||||||
|
{
|
||||||
|
$data = serialize($settings);
|
||||||
|
self::setValue("timeline_datatable", $data, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getTimelineDatatableSetting()
|
||||||
|
{
|
||||||
|
$data = self::getValue("timeline_datatable", true);
|
||||||
|
return ($data != "") ? unserialize($data) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function setNowPlayingScreenSettings($settings)
|
||||||
|
{
|
||||||
|
$data = serialize($settings);
|
||||||
|
self::setValue("nowplaying_screen", $data, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNowPlayingScreenSettings()
|
||||||
|
{
|
||||||
|
$data = self::getValue("nowplaying_screen", true);
|
||||||
|
return ($data != "") ? unserialize($data) : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -608,17 +608,22 @@ SQL;
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getLibraryColumns()
|
||||||
|
{
|
||||||
|
return array("id", "track_title", "artist_name", "album_title",
|
||||||
|
"genre", "length", "year", "utime", "mtime", "ftype",
|
||||||
|
"track_number", "mood", "bpm", "composer", "info_url",
|
||||||
|
"bit_rate", "sample_rate", "isrc_number", "encoded_by", "label",
|
||||||
|
"copyright", "mime", "language", "filepath", "owner_id",
|
||||||
|
"conductor", "replay_gain", "lptime" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function searchLibraryFiles($datatables)
|
public static function searchLibraryFiles($datatables)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
|
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
|
||||||
|
|
||||||
$displayColumns = array("id", "track_title", "artist_name", "album_title", "genre", "length",
|
$displayColumns = self::getLibraryColumns();
|
||||||
"year", "utime", "mtime", "ftype", "track_number", "mood", "bpm", "composer", "info_url",
|
|
||||||
"bit_rate", "sample_rate", "isrc_number", "encoded_by", "label", "copyright", "mime",
|
|
||||||
"language", "filepath", "owner_id", "conductor", "replay_gain", "lptime"
|
|
||||||
);
|
|
||||||
|
|
||||||
//Logging::info($datatables);
|
|
||||||
|
|
||||||
$plSelect = array();
|
$plSelect = array();
|
||||||
$blSelect = array();
|
$blSelect = array();
|
||||||
|
|
Loading…
Reference in New Issue