CC-4434: Make Application_Model_Preference::getValue and setValue private methods
-initial commit
This commit is contained in:
parent
cd530fc556
commit
e3c1a3ac0e
|
@ -35,8 +35,8 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', '' );");
|
||||
}
|
||||
|
||||
$data = Application_Model_Preference::getValue("timeline_datatable", true);
|
||||
if ($data != "") {
|
||||
$data = Application_Model_Preference::getTimelineDatatableSetting();
|
||||
if (!is_null($data)) {
|
||||
$timelineTable = json_encode(unserialize($data));
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', JSON.stringify($timelineTable) );");
|
||||
} else {
|
||||
|
@ -127,11 +127,10 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$showLib = false;
|
||||
if (!$user->isGuest()) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,15 +23,14 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
$data = serialize($settings);
|
||||
Application_Model_Preference::setValue("nowplaying_screen", $data, true);
|
||||
Application_Model_Preference::setNowPlayingScreenSettings($data);
|
||||
}
|
||||
|
||||
public function getNowPlayingScreenSettingsAction()
|
||||
{
|
||||
$data = Application_Model_Preference::getValue("nowplaying_screen", true);
|
||||
if ($data != "") {
|
||||
$this->view->settings = unserialize($data);
|
||||
$data = Application_Model_Preference::getNowPlayingScreenSettings();
|
||||
if (!is_null($data)) {
|
||||
$this->view->settings = $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,8 +39,7 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
$data = serialize($settings);
|
||||
Application_Model_Preference::setValue("library_datatable", $data, true);
|
||||
Application_Model_Preference::setCurrentLibraryTableSetting($settings);
|
||||
}
|
||||
|
||||
public function getLibraryDatatableAction()
|
||||
|
@ -59,9 +57,7 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
$data = serialize($settings);
|
||||
Application_Model_Preference::setValue("timeline_datatable", $data, true);
|
||||
|
||||
Application_Model_Preference::setTimelineDatatableSetting($settings);
|
||||
$end = microtime(true);
|
||||
|
||||
Logging::debug("saving timeline datatables info took:");
|
||||
|
@ -72,9 +68,9 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
{
|
||||
$start = microtime(true);
|
||||
|
||||
$data = Application_Model_Preference::getValue("timeline_datatable", true);
|
||||
if ($data != "") {
|
||||
$this->view->settings = unserialize($data);
|
||||
$data = Application_Model_Preference::getTimelineDatatableSetting();
|
||||
if (!is_null($data)) {
|
||||
$this->view->settings = $data;
|
||||
}
|
||||
|
||||
$end = microtime(true);
|
||||
|
|
|
@ -24,7 +24,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
|||
'label' => 'Station Name',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'value' => Application_Model_Preference::getValue("station_name"),
|
||||
'value' => Application_Model_Preference::GetStationName(),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
|
|
|
@ -24,7 +24,7 @@ class Application_Form_SupportSettings extends Zend_Form
|
|||
'required' => true,
|
||||
'filters' => array('StringTrim'),
|
||||
'validator' => array('NotEmpty'),
|
||||
'value' => Application_Model_Preference::getValue("station_name"),
|
||||
'value' => Application_Model_Preference::GetStationName(),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
|
|
|
@ -1085,16 +1085,17 @@ class Application_Model_Preference
|
|||
$remindDate = Application_Model_Preference::GetRemindMeDate();
|
||||
$retVal = false;
|
||||
|
||||
if ($remindDate == NULL || ($remindDate != -1 && $today >= $remindDate)) {
|
||||
if (is_null($remindDate) || ($remindDate != -1 && $today >= $remindDate)) {
|
||||
$retVal = true;
|
||||
}
|
||||
|
||||
return $retVal;
|
||||
}
|
||||
|
||||
|
||||
public static function getCurrentLibraryTableSetting()
|
||||
{
|
||||
$v = self::getValue("library_datatable");
|
||||
$v = self::getValue("library_datatable", true);
|
||||
|
||||
if ( $v === '' ) {
|
||||
return function ($x) { return $x; };
|
||||
|
@ -1102,6 +1103,44 @@ class Application_Model_Preference
|
|||
$ds = unserialize($v);
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
|
||||
|
||||
$displayColumns = 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"
|
||||
);
|
||||
|
||||
//Logging::info($datatables);
|
||||
$displayColumns = self::getLibraryColumns();
|
||||
|
||||
$plSelect = array();
|
||||
$blSelect = array();
|
||||
|
|
Loading…
Reference in New Issue