-added simple configuration page
-implemented CC-1830 -issue CC-1850 closed
This commit is contained in:
parent
1e23907df1
commit
df675bd8c6
15 changed files with 179 additions and 9 deletions
44
application/models/Preference.php
Normal file
44
application/models/Preference.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
class Application_Model_Preference
|
||||
{
|
||||
|
||||
public static function UpdateStationName($name, $id){
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
//Check if key already exists
|
||||
$sql = "SELECT COUNT(*) FROM cc_pref"
|
||||
." WHERE keystr = 'station_name'";
|
||||
$result = $CC_DBC->GetOne($sql);
|
||||
|
||||
if ($result == 1){
|
||||
$sql = "UPDATE cc_pref"
|
||||
." SET subjid = $id, valstr = '$name'"
|
||||
." WHERE keystr = 'station_name'";
|
||||
} else {
|
||||
$sql = "INSERT INTO cc_pref (subjid, keystr, valstr)"
|
||||
." VALUES ($id, 'station_name', '$name')";
|
||||
}
|
||||
return $CC_DBC->query($sql);
|
||||
}
|
||||
|
||||
public static function GetStationName(){
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
//Check if key already exists
|
||||
$sql = "SELECT COUNT(*) FROM cc_pref"
|
||||
." WHERE keystr = 'station_name'";
|
||||
$result = $CC_DBC->GetOne($sql);
|
||||
|
||||
if ($result == 0)
|
||||
return "Airtime";
|
||||
else {
|
||||
$sql = "SELECT valstr FROM cc_pref"
|
||||
." WHERE keystr = 'station_name'";
|
||||
$result = $CC_DBC->GetOne($sql);
|
||||
return $result." - Airtime";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue