CC-4090: Make code style PSR compliant
-User.php -removed all trailing whitespace
This commit is contained in:
parent
3d243468a7
commit
ee3447f903
|
@ -83,7 +83,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
|
|
||||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
if (!is_null($user)){
|
if (!is_null($user)){
|
||||||
$userType = $user->getType();
|
$userType = $user->getType();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -111,7 +111,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
//array containing id and type of media to delete.
|
//array containing id and type of media to delete.
|
||||||
$mediaItems = $this->_getParam('media', null);
|
$mediaItems = $this->_getParam('media', null);
|
||||||
|
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||||
|
|
||||||
$files = array();
|
$files = array();
|
||||||
|
@ -204,7 +204,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function editFileMdAction()
|
public function editFileMdAction()
|
||||||
{
|
{
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||||
if(!$isAdminOrPM){
|
if(!$isAdminOrPM){
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -90,7 +90,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
Application_Model_Schedule::createNewFormSections($this->view);
|
Application_Model_Schedule::createNewFormSections($this->view);
|
||||||
|
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
|
|
||||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){
|
||||||
$this->view->preloadShowForm = true;
|
$this->view->preloadShowForm = true;
|
||||||
|
@ -689,7 +689,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function getFormAction() {
|
public function getFormAction() {
|
||||||
|
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
|
|
||||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){
|
||||||
Application_Model_Schedule::createNewFormSections($this->view);
|
Application_Model_Schedule::createNewFormSections($this->view);
|
||||||
|
@ -822,7 +822,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function cancelShowAction()
|
public function cancelShowAction()
|
||||||
{
|
{
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
|
|
||||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
$showInstanceId = $this->_getParam('id');
|
$showInstanceId = $this->_getParam('id');
|
||||||
|
@ -842,7 +842,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function cancelCurrentShowAction()
|
public function cancelCurrentShowAction()
|
||||||
{
|
{
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
|
|
||||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
$id = $this->_getParam('id');
|
$id = $this->_getParam('id');
|
||||||
|
|
|
@ -22,7 +22,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$baseUrl = $request->getBaseUrl();
|
$baseUrl = $request->getBaseUrl();
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
|
|
||||||
$userType = $user->getType();
|
$userType = $user->getType();
|
||||||
$this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );");
|
$this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );");
|
||||||
|
@ -184,7 +184,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
$baseUrl = $request->getBaseUrl();
|
$baseUrl = $request->getBaseUrl();
|
||||||
$menu = array();
|
$menu = array();
|
||||||
|
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
|
|
||||||
$item = CcScheduleQuery::create()->findPK($id);
|
$item = CcScheduleQuery::create()->findPK($id);
|
||||||
$instance = $item->getCcShowInstances();
|
$instance = $item->getCcShowInstances();
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/showbuilder.phtml'))
|
array('ViewScript', array('viewScript' => 'form/showbuilder.phtml'))
|
||||||
|
|
|
@ -2,27 +2,27 @@
|
||||||
|
|
||||||
class Application_Model_Auth {
|
class Application_Model_Auth {
|
||||||
|
|
||||||
const TOKEN_LIFETIME = 'P2D'; // DateInterval syntax
|
const TOKEN_LIFETIME = 'P2D'; // DateInterval syntax
|
||||||
|
|
||||||
private function generateToken($action, $user_id)
|
private function generateToken($action, $user_id)
|
||||||
{
|
{
|
||||||
$salt = md5("pro");
|
$salt = md5("pro");
|
||||||
$token = self::generateRandomString();
|
$token = self::generateRandomString();
|
||||||
|
|
||||||
$info = new CcSubjsToken();
|
$info = new CcSubjsToken();
|
||||||
$info->setDbUserId($user_id);
|
$info->setDbUserId($user_id);
|
||||||
$info->setDbAction($action);
|
$info->setDbAction($action);
|
||||||
$info->setDbToken(sha1($token.$salt));
|
$info->setDbToken(sha1($token.$salt));
|
||||||
$info->setDbCreated(gmdate('Y-m-d H:i:s'));
|
$info->setDbCreated(gmdate('Y-m-d H:i:s'));
|
||||||
$info->save();
|
$info->save();
|
||||||
|
|
||||||
Logging::debug("generated token {$token}");
|
Logging::debug("generated token {$token}");
|
||||||
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendPasswordRestoreLink($user, $view)
|
public function sendPasswordRestoreLink($user, $view)
|
||||||
{
|
{
|
||||||
$token = $this->generateToken('password.restore', $user->getDbId());
|
$token = $this->generateToken('password.restore', $user->getDbId());
|
||||||
|
|
||||||
$e_link_protocol = empty($_SERVER['HTTPS']) ? "http" : "https";
|
$e_link_protocol = empty($_SERVER['HTTPS']) ? "http" : "https";
|
||||||
|
@ -31,22 +31,22 @@ class Application_Model_Auth {
|
||||||
|
|
||||||
$message = "Click this link: {$e_link_protocol}://{$e_link_base}{$e_link_path}";
|
$message = "Click this link: {$e_link_protocol}://{$e_link_base}{$e_link_path}";
|
||||||
|
|
||||||
$success = Application_Model_Email::send('Airtime Password Reset', $message, $user->getDbEmail());
|
$success = Application_Model_Email::send('Airtime Password Reset', $message, $user->getDbEmail());
|
||||||
|
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function invalidateTokens($user, $action)
|
public function invalidateTokens($user, $action)
|
||||||
{
|
{
|
||||||
CcSubjsTokenQuery::create()
|
CcSubjsTokenQuery::create()
|
||||||
->filterByDbAction($action)
|
->filterByDbAction($action)
|
||||||
->filterByDbUserId($user->getDbId())
|
->filterByDbUserId($user->getDbId())
|
||||||
->delete();
|
->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkToken($user_id, $token, $action)
|
public function checkToken($user_id, $token, $action)
|
||||||
{
|
{
|
||||||
$salt = md5("pro");
|
$salt = md5("pro");
|
||||||
|
|
||||||
$token_info = CcSubjsTokenQuery::create()
|
$token_info = CcSubjsTokenQuery::create()
|
||||||
->filterByDbAction($action)
|
->filterByDbAction($action)
|
||||||
|
|
|
@ -2,103 +2,103 @@
|
||||||
|
|
||||||
class Application_Model_Datatables {
|
class Application_Model_Datatables {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* query used to return data for a paginated/searchable datatable.
|
* query used to return data for a paginated/searchable datatable.
|
||||||
*/
|
*/
|
||||||
public static function findEntries($con, $displayColumns, $fromTable, $data, $dataProp = "aaData")
|
public static function findEntries($con, $displayColumns, $fromTable, $data, $dataProp = "aaData")
|
||||||
{
|
{
|
||||||
$where = array();
|
$where = array();
|
||||||
|
|
||||||
if ($data["sSearch"] !== "") {
|
if ($data["sSearch"] !== "") {
|
||||||
$searchTerms = explode(" ", $data["sSearch"]);
|
$searchTerms = explode(" ", $data["sSearch"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$selectorCount = "SELECT COUNT(*) ";
|
$selectorCount = "SELECT COUNT(*) ";
|
||||||
$selectorRows = "SELECT ".join(",", $displayColumns)." ";
|
$selectorRows = "SELECT ".join(",", $displayColumns)." ";
|
||||||
|
|
||||||
$sql = $selectorCount." FROM ".$fromTable;
|
$sql = $selectorCount." FROM ".$fromTable;
|
||||||
$sqlTotalRows = $sql;
|
$sqlTotalRows = $sql;
|
||||||
|
|
||||||
if (isset($searchTerms)) {
|
if (isset($searchTerms)) {
|
||||||
$searchCols = array();
|
$searchCols = array();
|
||||||
for ($i = 0; $i < $data["iColumns"]; $i++) {
|
for ($i = 0; $i < $data["iColumns"]; $i++) {
|
||||||
if ($data["bSearchable_".$i] == "true") {
|
if ($data["bSearchable_".$i] == "true") {
|
||||||
$searchCols[] = $data["mDataProp_{$i}"];
|
$searchCols[] = $data["mDataProp_{$i}"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$outerCond = array();
|
$outerCond = array();
|
||||||
|
|
||||||
foreach ($searchTerms as $term) {
|
foreach ($searchTerms as $term) {
|
||||||
$innerCond = array();
|
$innerCond = array();
|
||||||
|
|
||||||
foreach ($searchCols as $col) {
|
foreach ($searchCols as $col) {
|
||||||
$escapedTerm = pg_escape_string($term);
|
$escapedTerm = pg_escape_string($term);
|
||||||
$innerCond[] = "{$col}::text ILIKE '%{$escapedTerm}%'";
|
$innerCond[] = "{$col}::text ILIKE '%{$escapedTerm}%'";
|
||||||
}
|
}
|
||||||
$outerCond[] = "(".join(" OR ", $innerCond).")";
|
$outerCond[] = "(".join(" OR ", $innerCond).")";
|
||||||
}
|
}
|
||||||
$where[] = "(".join(" AND ", $outerCond).")";
|
$where[] = "(".join(" AND ", $outerCond).")";
|
||||||
}
|
}
|
||||||
// End Where clause
|
// End Where clause
|
||||||
|
|
||||||
// Order By clause
|
// Order By clause
|
||||||
$orderby = array();
|
$orderby = array();
|
||||||
for ($i = 0; $i < $data["iSortingCols"]; $i++){
|
for ($i = 0; $i < $data["iSortingCols"]; $i++){
|
||||||
$num = $data["iSortCol_".$i];
|
$num = $data["iSortCol_".$i];
|
||||||
$orderby[] = $data["mDataProp_{$num}"]." ".$data["sSortDir_".$i];
|
$orderby[] = $data["mDataProp_{$num}"]." ".$data["sSortDir_".$i];
|
||||||
}
|
}
|
||||||
$orderby[] = "id";
|
$orderby[] = "id";
|
||||||
$orderby = join("," , $orderby);
|
$orderby = join("," , $orderby);
|
||||||
// End Order By clause
|
// End Order By clause
|
||||||
|
|
||||||
$displayLength = intval($data["iDisplayLength"]);
|
$displayLength = intval($data["iDisplayLength"]);
|
||||||
if (count($where) > 0) {
|
if (count($where) > 0) {
|
||||||
$where = join(" AND ", $where);
|
$where = join(" AND ", $where);
|
||||||
$sql = $selectorCount." FROM ".$fromTable." WHERE ".$where;
|
$sql = $selectorCount." FROM ".$fromTable." WHERE ".$where;
|
||||||
$sqlTotalDisplayRows = $sql;
|
$sqlTotalDisplayRows = $sql;
|
||||||
|
|
||||||
$sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby;
|
$sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby;
|
||||||
|
|
||||||
//limit the results returned.
|
//limit the results returned.
|
||||||
if ($displayLength !== -1) {
|
if ($displayLength !== -1) {
|
||||||
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
|
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby;
|
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby;
|
||||||
|
|
||||||
//limit the results returned.
|
//limit the results returned.
|
||||||
if ($displayLength !== -1) {
|
if ($displayLength !== -1) {
|
||||||
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
|
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$r = $con->query($sqlTotalRows);
|
$r = $con->query($sqlTotalRows);
|
||||||
$totalRows = $r->fetchColumn(0);
|
$totalRows = $r->fetchColumn(0);
|
||||||
|
|
||||||
if (isset($sqlTotalDisplayRows)) {
|
if (isset($sqlTotalDisplayRows)) {
|
||||||
$r = $con->query($sqlTotalDisplayRows);
|
$r = $con->query($sqlTotalDisplayRows);
|
||||||
$totalDisplayRows = $r->fetchColumn(0);
|
$totalDisplayRows = $r->fetchColumn(0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$totalDisplayRows = $totalRows;
|
$totalDisplayRows = $totalRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = $con->query($sql);
|
$r = $con->query($sql);
|
||||||
$r->setFetchMode(PDO::FETCH_ASSOC);
|
$r->setFetchMode(PDO::FETCH_ASSOC);
|
||||||
$results = $r->fetchAll();
|
$results = $r->fetchAll();
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
Logging::debug($e->getMessage());
|
Logging::debug($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
"sEcho" => intval($data["sEcho"]),
|
"sEcho" => intval($data["sEcho"]),
|
||||||
"iTotalDisplayRecords" => intval($totalDisplayRows),
|
"iTotalDisplayRecords" => intval($totalDisplayRows),
|
||||||
"iTotalRecords" => intval($totalRows),
|
"iTotalRecords" => intval($totalRows),
|
||||||
$dataProp => $results
|
$dataProp => $results
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,17 +20,17 @@ class Application_Model_Playlist {
|
||||||
*/
|
*/
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* propel object for this playlist.
|
* propel object for this playlist.
|
||||||
*/
|
*/
|
||||||
private $pl;
|
private $pl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* info needed to insert a new playlist element.
|
* info needed to insert a new playlist element.
|
||||||
*/
|
*/
|
||||||
private $plItem = array(
|
private $plItem = array(
|
||||||
"id" => "",
|
"id" => "",
|
||||||
"pos" => "",
|
"pos" => "",
|
||||||
"cliplength" => "",
|
"cliplength" => "",
|
||||||
"cuein" => "00:00:00",
|
"cuein" => "00:00:00",
|
||||||
"cueout" => "00:00:00",
|
"cueout" => "00:00:00",
|
||||||
|
@ -38,13 +38,13 @@ class Application_Model_Playlist {
|
||||||
"fadeout" => "0.0",
|
"fadeout" => "0.0",
|
||||||
);
|
);
|
||||||
|
|
||||||
//using propel's phpNames.
|
//using propel's phpNames.
|
||||||
private $categories = array(
|
private $categories = array(
|
||||||
"dc:title" => "Name",
|
"dc:title" => "Name",
|
||||||
"dc:creator" => "Creator",
|
"dc:creator" => "Creator",
|
||||||
"dc:description" => "Description",
|
"dc:description" => "Description",
|
||||||
"dcterms:extent" => "Length"
|
"dcterms:extent" => "Length"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
public function __construct($id=null, $con=null)
|
public function __construct($id=null, $con=null)
|
||||||
|
@ -90,12 +90,12 @@ class Application_Model_Playlist {
|
||||||
*/
|
*/
|
||||||
public function setName($p_newname)
|
public function setName($p_newname)
|
||||||
{
|
{
|
||||||
$this->pl->setDbName($p_newname);
|
$this->pl->setDbName($p_newname);
|
||||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||||
$this->pl->save($this->con);
|
$this->pl->save($this->con);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get mnemonic playlist name
|
* Get mnemonic playlist name
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -107,9 +107,9 @@ class Application_Model_Playlist {
|
||||||
|
|
||||||
public function setDescription($p_description)
|
public function setDescription($p_description)
|
||||||
{
|
{
|
||||||
$this->pl->setDbDescription($p_description);
|
$this->pl->setDbDescription($p_description);
|
||||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||||
$this->pl->save($this->con);
|
$this->pl->save($this->con);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescription()
|
public function getDescription()
|
||||||
|
@ -145,7 +145,7 @@ class Application_Model_Playlist {
|
||||||
/**
|
/**
|
||||||
* Get the entire playlist as a two dimentional array, sorted in order of play.
|
* Get the entire playlist as a two dimentional array, sorted in order of play.
|
||||||
* @param boolean $filterFiles if this is true, it will only return files that has
|
* @param boolean $filterFiles if this is true, it will only return files that has
|
||||||
* file_exists flag set to true
|
* file_exists flag set to true
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getContents($filterFiles=false) {
|
public function getContents($filterFiles=false) {
|
||||||
|
@ -416,7 +416,7 @@ class Application_Model_Playlist {
|
||||||
* Remove audioClip from playlist
|
* Remove audioClip from playlist
|
||||||
*
|
*
|
||||||
* @param array $p_items
|
* @param array $p_items
|
||||||
* array of unique item ids to remove from the playlist..
|
* array of unique item ids to remove from the playlist..
|
||||||
*/
|
*/
|
||||||
public function delAudioClips($p_items)
|
public function delAudioClips($p_items)
|
||||||
{
|
{
|
||||||
|
@ -452,11 +452,11 @@ class Application_Model_Playlist {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getFadeInfo($pos) {
|
public function getFadeInfo($pos) {
|
||||||
|
|
||||||
Logging::log("Getting fade info for pos {$pos}");
|
Logging::log("Getting fade info for pos {$pos}");
|
||||||
|
|
||||||
$row = CcPlaylistcontentsQuery::create()
|
$row = CcPlaylistcontentsQuery::create()
|
||||||
->joinWith(CcFilesPeer::OM_CLASS)
|
->joinWith(CcFilesPeer::OM_CLASS)
|
||||||
->filterByDbPlaylistId($this->id)
|
->filterByDbPlaylistId($this->id)
|
||||||
->filterByDbPosition($pos)
|
->filterByDbPosition($pos)
|
||||||
|
@ -466,24 +466,24 @@ class Application_Model_Playlist {
|
||||||
$fadeIn = $row->getDbFadein();
|
$fadeIn = $row->getDbFadein();
|
||||||
$fadeOut = $row->getDbFadeout();
|
$fadeOut = $row->getDbFadeout();
|
||||||
return array($fadeIn, $fadeOut);
|
return array($fadeIn, $fadeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change fadeIn and fadeOut values for playlist Element
|
* Change fadeIn and fadeOut values for playlist Element
|
||||||
*
|
*
|
||||||
* @param int $pos
|
* @param int $pos
|
||||||
* position of audioclip in playlist
|
* position of audioclip in playlist
|
||||||
* @param string $fadeIn
|
* @param string $fadeIn
|
||||||
* new value in ss.ssssss or extent format
|
* new value in ss.ssssss or extent format
|
||||||
* @param string $fadeOut
|
* @param string $fadeOut
|
||||||
* new value in ss.ssssss or extent format
|
* new value in ss.ssssss or extent format
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function changeFadeInfo($id, $fadeIn, $fadeOut)
|
public function changeFadeInfo($id, $fadeIn, $fadeOut)
|
||||||
{
|
{
|
||||||
//See issue CC-2065, pad the fadeIn and fadeOut so that it is TIME compatable with the DB schema
|
//See issue CC-2065, pad the fadeIn and fadeOut so that it is TIME compatable with the DB schema
|
||||||
//For the top level PlayList either fadeIn or fadeOut will sometimes be Null so need a gaurd against
|
//For the top level PlayList either fadeIn or fadeOut will sometimes be Null so need a gaurd against
|
||||||
//setting it to nonNull for checks down below
|
//setting it to nonNull for checks down below
|
||||||
$fadeIn = $fadeIn?'00:00:'.$fadeIn:$fadeIn;
|
$fadeIn = $fadeIn?'00:00:'.$fadeIn:$fadeIn;
|
||||||
$fadeOut = $fadeOut?'00:00:'.$fadeOut:$fadeOut;
|
$fadeOut = $fadeOut?'00:00:'.$fadeOut:$fadeOut;
|
||||||
|
|
||||||
|
@ -502,8 +502,8 @@ class Application_Model_Playlist {
|
||||||
|
|
||||||
if (!is_null($fadeIn)) {
|
if (!is_null($fadeIn)) {
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$clipLength}'";
|
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$clipLength}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)) {
|
if ($r->fetchColumn(0)) {
|
||||||
//"Fade In can't be larger than overall playlength.";
|
//"Fade In can't be larger than overall playlength.";
|
||||||
$fadeIn = $clipLength;
|
$fadeIn = $clipLength;
|
||||||
|
@ -512,8 +512,8 @@ class Application_Model_Playlist {
|
||||||
}
|
}
|
||||||
if (!is_null($fadeOut)){
|
if (!is_null($fadeOut)){
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$clipLength}'";
|
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$clipLength}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)) {
|
if ($r->fetchColumn(0)) {
|
||||||
//Fade Out can't be larger than overall playlength.";
|
//Fade Out can't be larger than overall playlength.";
|
||||||
$fadeOut = $clipLength;
|
$fadeOut = $clipLength;
|
||||||
|
@ -562,11 +562,11 @@ class Application_Model_Playlist {
|
||||||
* Change cueIn/cueOut values for playlist element
|
* Change cueIn/cueOut values for playlist element
|
||||||
*
|
*
|
||||||
* @param int $pos
|
* @param int $pos
|
||||||
* position of audioclip in playlist
|
* position of audioclip in playlist
|
||||||
* @param string $cueIn
|
* @param string $cueIn
|
||||||
* new value in ss.ssssss or extent format
|
* new value in ss.ssssss or extent format
|
||||||
* @param string $cueOut
|
* @param string $cueOut
|
||||||
* new value in ss.ssssss or extent format
|
* new value in ss.ssssss or extent format
|
||||||
* @return boolean or pear error object
|
* @return boolean or pear error object
|
||||||
*/
|
*/
|
||||||
public function changeClipLength($id, $cueIn, $cueOut)
|
public function changeClipLength($id, $cueIn, $cueOut)
|
||||||
|
@ -604,23 +604,23 @@ class Application_Model_Playlist {
|
||||||
$cueOut = $origLength;
|
$cueOut = $origLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$cueOut}'";
|
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$cueOut}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)) {
|
if ($r->fetchColumn(0)) {
|
||||||
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
||||||
return $errArray;
|
return $errArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)){
|
if ($r->fetchColumn(0)){
|
||||||
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
||||||
return $errArray;
|
return $errArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$cueIn}'";
|
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$cueIn}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
$cliplength = $r->fetchColumn(0);
|
$cliplength = $r->fetchColumn(0);
|
||||||
|
|
||||||
$row->setDbCuein($cueIn);
|
$row->setDbCuein($cueIn);
|
||||||
$row->setDbCueout($cueOut);
|
$row->setDbCueout($cueOut);
|
||||||
|
@ -629,16 +629,16 @@ class Application_Model_Playlist {
|
||||||
}
|
}
|
||||||
else if (!is_null($cueIn)) {
|
else if (!is_null($cueIn)) {
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$oldCueOut}'";
|
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$oldCueOut}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)) {
|
if ($r->fetchColumn(0)) {
|
||||||
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
||||||
return $errArray;
|
return $errArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$oldCueOut}' - INTERVAL '{$cueIn}'";
|
$sql = "SELECT INTERVAL '{$oldCueOut}' - INTERVAL '{$cueIn}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
$cliplength = $r->fetchColumn(0);
|
$cliplength = $r->fetchColumn(0);
|
||||||
|
|
||||||
$row->setDbCuein($cueIn);
|
$row->setDbCuein($cueIn);
|
||||||
$row->setDBCliplength($cliplength);
|
$row->setDBCliplength($cliplength);
|
||||||
|
@ -649,23 +649,23 @@ class Application_Model_Playlist {
|
||||||
$cueOut = $origLength;
|
$cueOut = $origLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$cueOut}' < INTERVAL '{$oldCueIn}'";
|
$sql = "SELECT INTERVAL '{$cueOut}' < INTERVAL '{$oldCueIn}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)) {
|
if ($r->fetchColumn(0)) {
|
||||||
$errArray["error"] = "Can't set cue out to be smaller than cue in.";
|
$errArray["error"] = "Can't set cue out to be smaller than cue in.";
|
||||||
return $errArray;
|
return $errArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)){
|
if ($r->fetchColumn(0)){
|
||||||
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
||||||
return $errArray;
|
return $errArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$oldCueIn}'";
|
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$oldCueIn}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
$cliplength = $r->fetchColumn(0);
|
$cliplength = $r->fetchColumn(0);
|
||||||
|
|
||||||
$row->setDbCueout($cueOut);
|
$row->setDbCueout($cueOut);
|
||||||
$row->setDBCliplength($cliplength);
|
$row->setDBCliplength($cliplength);
|
||||||
|
@ -673,15 +673,15 @@ class Application_Model_Playlist {
|
||||||
|
|
||||||
$cliplength = $row->getDbCliplength();
|
$cliplength = $row->getDbCliplength();
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$cliplength}'";
|
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$cliplength}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)){
|
if ($r->fetchColumn(0)){
|
||||||
$fadeIn = $cliplength;
|
$fadeIn = $cliplength;
|
||||||
$row->setDbFadein($fadeIn);
|
$row->setDbFadein($fadeIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$cliplength}'";
|
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$cliplength}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)){
|
if ($r->fetchColumn(0)){
|
||||||
$fadeOut = $cliplength;
|
$fadeOut = $cliplength;
|
||||||
$row->setDbFadein($fadeOut);
|
$row->setDbFadein($fadeOut);
|
||||||
|
|
|
@ -4,80 +4,80 @@ require_once 'formatters/LengthFormatter.php';
|
||||||
|
|
||||||
class Application_Model_PlayoutHistory {
|
class Application_Model_PlayoutHistory {
|
||||||
|
|
||||||
private $con;
|
private $con;
|
||||||
private $timezone;
|
private $timezone;
|
||||||
|
|
||||||
//in UTC timezone
|
//in UTC timezone
|
||||||
private $startDT;
|
private $startDT;
|
||||||
//in UTC timezone
|
//in UTC timezone
|
||||||
private $endDT;
|
private $endDT;
|
||||||
|
|
||||||
private $epoch_now;
|
private $epoch_now;
|
||||||
private $opts;
|
private $opts;
|
||||||
|
|
||||||
private $mDataPropMap = array(
|
private $mDataPropMap = array(
|
||||||
"artist" => "file.artist_name",
|
"artist" => "file.artist_name",
|
||||||
"title" => "file.track_title",
|
"title" => "file.track_title",
|
||||||
"played" => "playout.played",
|
"played" => "playout.played",
|
||||||
"length" => "file.length",
|
"length" => "file.length",
|
||||||
"composer" => "file.composer",
|
"composer" => "file.composer",
|
||||||
"copyright" => "file.copyright",
|
"copyright" => "file.copyright",
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __construct($p_startDT, $p_endDT, $p_opts) {
|
public function __construct($p_startDT, $p_endDT, $p_opts) {
|
||||||
|
|
||||||
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||||
$this->startDT = $p_startDT;
|
$this->startDT = $p_startDT;
|
||||||
$this->endDT = $p_endDT;
|
$this->endDT = $p_endDT;
|
||||||
$this->timezone = date_default_timezone_get();
|
$this->timezone = date_default_timezone_get();
|
||||||
$this->epoch_now = time();
|
$this->epoch_now = time();
|
||||||
$this->opts = $p_opts;
|
$this->opts = $p_opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* map front end mDataProp labels to proper column names for searching etc.
|
* map front end mDataProp labels to proper column names for searching etc.
|
||||||
*/
|
*/
|
||||||
private function translateColumns() {
|
private function translateColumns() {
|
||||||
|
|
||||||
for ($i = 0; $i < $this->opts["iColumns"]; $i++){
|
for ($i = 0; $i < $this->opts["iColumns"]; $i++){
|
||||||
|
|
||||||
$this->opts["mDataProp_{$i}"] = $this->mDataPropMap[$this->opts["mDataProp_{$i}"]];
|
$this->opts["mDataProp_{$i}"] = $this->mDataPropMap[$this->opts["mDataProp_{$i}"]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getItems() {
|
public function getItems() {
|
||||||
|
|
||||||
$this->translateColumns();
|
$this->translateColumns();
|
||||||
|
|
||||||
$select = array(
|
$select = array(
|
||||||
"file.track_title as title",
|
"file.track_title as title",
|
||||||
"file.artist_name as artist",
|
"file.artist_name as artist",
|
||||||
"playout.played",
|
"playout.played",
|
||||||
"playout.file_id",
|
"playout.file_id",
|
||||||
"file.composer",
|
"file.composer",
|
||||||
"file.copyright",
|
"file.copyright",
|
||||||
"file.length"
|
"file.length"
|
||||||
);
|
);
|
||||||
|
|
||||||
$start = $this->startDT->format("Y-m-d H:i:s");
|
$start = $this->startDT->format("Y-m-d H:i:s");
|
||||||
$end = $this->endDT->format("Y-m-d H:i:s");
|
$end = $this->endDT->format("Y-m-d H:i:s");
|
||||||
|
|
||||||
$historyTable = "(
|
$historyTable = "(
|
||||||
select count(schedule.file_id) as played, schedule.file_id as file_id
|
select count(schedule.file_id) as played, schedule.file_id as file_id
|
||||||
from cc_schedule as schedule
|
from cc_schedule as schedule
|
||||||
where schedule.starts >= '{$start}' and schedule.starts < '{$end}'
|
where schedule.starts >= '{$start}' and schedule.starts < '{$end}'
|
||||||
and schedule.playout_status > 0 and schedule.media_item_played != FALSE and schedule.broadcasted = 1
|
and schedule.playout_status > 0 and schedule.media_item_played != FALSE and schedule.broadcasted = 1
|
||||||
group by schedule.file_id
|
group by schedule.file_id
|
||||||
)
|
)
|
||||||
AS playout left join cc_files as file on (file.id = playout.file_id)";
|
AS playout left join cc_files as file on (file.id = playout.file_id)";
|
||||||
|
|
||||||
$results = Application_Model_Datatables::findEntries($this->con, $select, $historyTable, $this->opts, "history");
|
$results = Application_Model_Datatables::findEntries($this->con, $select, $historyTable, $this->opts, "history");
|
||||||
|
|
||||||
foreach ($results["history"] as &$row) {
|
foreach ($results["history"] as &$row) {
|
||||||
$formatter = new LengthFormatter($row['length']);
|
$formatter = new LengthFormatter($row['length']);
|
||||||
$row['length'] = $formatter->format();
|
$row['length'] = $formatter->format();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -298,75 +298,75 @@ class Application_Model_Preference
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetPhone($phone){
|
public static function SetPhone($phone){
|
||||||
self::setValue("phone", $phone);
|
self::setValue("phone", $phone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetPhone(){
|
public static function GetPhone(){
|
||||||
return self::getValue("phone");
|
return self::getValue("phone");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetEmail($email){
|
public static function SetEmail($email){
|
||||||
self::setValue("email", $email);
|
self::setValue("email", $email);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetEmail(){
|
public static function GetEmail(){
|
||||||
return self::getValue("email");
|
return self::getValue("email");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetStationWebSite($site){
|
public static function SetStationWebSite($site){
|
||||||
self::setValue("station_website", $site);
|
self::setValue("station_website", $site);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStationWebSite(){
|
public static function GetStationWebSite(){
|
||||||
return self::getValue("station_website");
|
return self::getValue("station_website");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetSupportFeedback($feedback){
|
public static function SetSupportFeedback($feedback){
|
||||||
self::setValue("support_feedback", $feedback);
|
self::setValue("support_feedback", $feedback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetSupportFeedback(){
|
public static function GetSupportFeedback(){
|
||||||
return self::getValue("support_feedback");
|
return self::getValue("support_feedback");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetPublicise($publicise){
|
public static function SetPublicise($publicise){
|
||||||
self::setValue("publicise", $publicise);
|
self::setValue("publicise", $publicise);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetPublicise(){
|
public static function GetPublicise(){
|
||||||
return self::getValue("publicise");
|
return self::getValue("publicise");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetRegistered($registered){
|
public static function SetRegistered($registered){
|
||||||
self::setValue("registered", $registered);
|
self::setValue("registered", $registered);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetRegistered(){
|
public static function GetRegistered(){
|
||||||
return self::getValue("registered");
|
return self::getValue("registered");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetStationCountry($country){
|
public static function SetStationCountry($country){
|
||||||
self::setValue("country", $country);
|
self::setValue("country", $country);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStationCountry(){
|
public static function GetStationCountry(){
|
||||||
return self::getValue("country");
|
return self::getValue("country");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetStationCity($city){
|
public static function SetStationCity($city){
|
||||||
self::setValue("city", $city);
|
self::setValue("city", $city);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStationCity(){
|
public static function GetStationCity(){
|
||||||
return self::getValue("city");
|
return self::getValue("city");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetStationDescription($description){
|
public static function SetStationDescription($description){
|
||||||
self::setValue("description", $description);
|
self::setValue("description", $description);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStationDescription(){
|
public static function GetStationDescription(){
|
||||||
return self::getValue("description");
|
return self::getValue("description");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetTimezone($timezone){
|
public static function SetTimezone($timezone){
|
||||||
|
@ -380,139 +380,139 @@ class Application_Model_Preference
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetStationLogo($imagePath){
|
public static function SetStationLogo($imagePath){
|
||||||
if(!empty($imagePath)){
|
if(!empty($imagePath)){
|
||||||
$image = @file_get_contents($imagePath);
|
$image = @file_get_contents($imagePath);
|
||||||
$image = base64_encode($image);
|
$image = base64_encode($image);
|
||||||
self::setValue("logoImage", $image);
|
self::setValue("logoImage", $image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStationLogo(){
|
public static function GetStationLogo(){
|
||||||
return self::getValue("logoImage");
|
return self::getValue("logoImage");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetUniqueId(){
|
public static function GetUniqueId(){
|
||||||
return self::getValue("uniqueId");
|
return self::getValue("uniqueId");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetCountryList()
|
public static function GetCountryList()
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$sql = "SELECT * FROM cc_country";
|
$sql = "SELECT * FROM cc_country";
|
||||||
$res = $con->query($sql)->fetchAll();
|
$res = $con->query($sql)->fetchAll();
|
||||||
$out = array();
|
$out = array();
|
||||||
$out[""] = "Select Country";
|
$out[""] = "Select Country";
|
||||||
foreach($res as $r){
|
foreach($res as $r){
|
||||||
$out[$r["isocode"]] = $r["name"];
|
$out[$r["isocode"]] = $r["name"];
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetSystemInfo($returnArray=false, $p_testing=false)
|
public static function GetSystemInfo($returnArray=false, $p_testing=false)
|
||||||
{
|
{
|
||||||
exec('/usr/bin/airtime-check-system --no-color', $output);
|
exec('/usr/bin/airtime-check-system --no-color', $output);
|
||||||
$output = preg_replace('/\s+/', ' ', $output);
|
$output = preg_replace('/\s+/', ' ', $output);
|
||||||
|
|
||||||
$systemInfoArray = array();
|
$systemInfoArray = array();
|
||||||
foreach( $output as $key => &$out){
|
foreach( $output as $key => &$out){
|
||||||
$info = explode('=', $out);
|
$info = explode('=', $out);
|
||||||
if(isset($info[1])){
|
if(isset($info[1])){
|
||||||
$key = str_replace(' ', '_', trim($info[0]));
|
$key = str_replace(' ', '_', trim($info[0]));
|
||||||
$key = strtoupper($key);
|
$key = strtoupper($key);
|
||||||
if ($key == 'WEB_SERVER' || $key == 'CPU' || $key == 'OS' || $key == 'TOTAL_RAM' ||
|
if ($key == 'WEB_SERVER' || $key == 'CPU' || $key == 'OS' || $key == 'TOTAL_RAM' ||
|
||||||
$key == 'FREE_RAM' || $key == 'AIRTIME_VERSION' || $key == 'KERNAL_VERSION' ||
|
$key == 'FREE_RAM' || $key == 'AIRTIME_VERSION' || $key == 'KERNAL_VERSION' ||
|
||||||
$key == 'MACHINE_ARCHITECTURE' || $key == 'TOTAL_MEMORY_MBYTES' || $key == 'TOTAL_SWAP_MBYTES' ||
|
$key == 'MACHINE_ARCHITECTURE' || $key == 'TOTAL_MEMORY_MBYTES' || $key == 'TOTAL_SWAP_MBYTES' ||
|
||||||
$key == 'PLAYOUT_ENGINE_CPU_PERC' ) {
|
$key == 'PLAYOUT_ENGINE_CPU_PERC' ) {
|
||||||
if($key == 'AIRTIME_VERSION'){
|
if($key == 'AIRTIME_VERSION'){
|
||||||
// remove hash tag on the version string
|
// remove hash tag on the version string
|
||||||
$version = explode('+', $info[1]);
|
$version = explode('+', $info[1]);
|
||||||
$systemInfoArray[$key] = $version[0];
|
$systemInfoArray[$key] = $version[0];
|
||||||
}else{
|
}else{
|
||||||
$systemInfoArray[$key] = $info[1];
|
$systemInfoArray[$key] = $info[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$outputArray = array();
|
$outputArray = array();
|
||||||
|
|
||||||
$outputArray['LIVE_DURATION'] = Application_Model_LiveLog::GetLiveShowDuration($p_testing);
|
$outputArray['LIVE_DURATION'] = Application_Model_LiveLog::GetLiveShowDuration($p_testing);
|
||||||
$outputArray['SCHEDULED_DURATION'] = Application_Model_LiveLog::GetScheduledDuration($p_testing);
|
$outputArray['SCHEDULED_DURATION'] = Application_Model_LiveLog::GetScheduledDuration($p_testing);
|
||||||
$outputArray['SOUNDCLOUD_ENABLED'] = self::GetUploadToSoundcloudOption();
|
$outputArray['SOUNDCLOUD_ENABLED'] = self::GetUploadToSoundcloudOption();
|
||||||
if ($outputArray['SOUNDCLOUD_ENABLED']) {
|
if ($outputArray['SOUNDCLOUD_ENABLED']) {
|
||||||
$outputArray['NUM_SOUNDCLOUD_TRACKS_UPLOADED'] = Application_Model_StoredFile::getSoundCloudUploads();
|
$outputArray['NUM_SOUNDCLOUD_TRACKS_UPLOADED'] = Application_Model_StoredFile::getSoundCloudUploads();
|
||||||
} else {
|
} else {
|
||||||
$outputArray['NUM_SOUNDCLOUD_TRACKS_UPLOADED'] = NULL;
|
$outputArray['NUM_SOUNDCLOUD_TRACKS_UPLOADED'] = NULL;
|
||||||
}
|
}
|
||||||
$outputArray['STATION_NAME'] = self::GetStationName();
|
$outputArray['STATION_NAME'] = self::GetStationName();
|
||||||
$outputArray['PHONE'] = self::GetPhone();
|
$outputArray['PHONE'] = self::GetPhone();
|
||||||
$outputArray['EMAIL'] = self::GetEmail();
|
$outputArray['EMAIL'] = self::GetEmail();
|
||||||
$outputArray['STATION_WEB_SITE'] = self::GetStationWebSite();
|
$outputArray['STATION_WEB_SITE'] = self::GetStationWebSite();
|
||||||
$outputArray['STATION_COUNTRY'] = self::GetStationCountry();
|
$outputArray['STATION_COUNTRY'] = self::GetStationCountry();
|
||||||
$outputArray['STATION_CITY'] = self::GetStationCity();
|
$outputArray['STATION_CITY'] = self::GetStationCity();
|
||||||
$outputArray['STATION_DESCRIPTION'] = self::GetStationDescription();
|
$outputArray['STATION_DESCRIPTION'] = self::GetStationDescription();
|
||||||
|
|
||||||
// get web server info
|
// get web server info
|
||||||
if(isset($systemInfoArray["AIRTIME_VERSION_URL"])){
|
if(isset($systemInfoArray["AIRTIME_VERSION_URL"])){
|
||||||
$url = $systemInfoArray["AIRTIME_VERSION_URL"];
|
$url = $systemInfoArray["AIRTIME_VERSION_URL"];
|
||||||
$index = strpos($url,'/api/');
|
$index = strpos($url,'/api/');
|
||||||
$url = substr($url, 0, $index);
|
$url = substr($url, 0, $index);
|
||||||
|
|
||||||
$headerInfo = get_headers(trim($url),1);
|
$headerInfo = get_headers(trim($url),1);
|
||||||
$outputArray['WEB_SERVER'] = $headerInfo['Server'][0];
|
$outputArray['WEB_SERVER'] = $headerInfo['Server'][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$outputArray['NUM_OF_USERS'] = Application_Model_User::getUserCount();
|
$outputArray['NUM_OF_USERS'] = Application_Model_User::getUserCount();
|
||||||
$outputArray['NUM_OF_SONGS'] = Application_Model_StoredFile::getFileCount();
|
$outputArray['NUM_OF_SONGS'] = Application_Model_StoredFile::getFileCount();
|
||||||
$outputArray['NUM_OF_PLAYLISTS'] = Application_Model_Playlist::getPlaylistCount();
|
$outputArray['NUM_OF_PLAYLISTS'] = Application_Model_Playlist::getPlaylistCount();
|
||||||
$outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Application_Model_Schedule::getSchduledPlaylistCount();
|
$outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Application_Model_Schedule::getSchduledPlaylistCount();
|
||||||
$outputArray['NUM_OF_PAST_SHOWS'] = Application_Model_ShowInstance::GetShowInstanceCount(gmdate("Y-m-d H:i:s"));
|
$outputArray['NUM_OF_PAST_SHOWS'] = Application_Model_ShowInstance::GetShowInstanceCount(gmdate("Y-m-d H:i:s"));
|
||||||
$outputArray['UNIQUE_ID'] = self::GetUniqueId();
|
$outputArray['UNIQUE_ID'] = self::GetUniqueId();
|
||||||
$outputArray['SAAS'] = self::GetPlanLevel();
|
$outputArray['SAAS'] = self::GetPlanLevel();
|
||||||
if ($outputArray['SAAS'] != 'disabled') {
|
if ($outputArray['SAAS'] != 'disabled') {
|
||||||
$outputArray['TRIAL_END_DATE'] = self::GetTrialEndingDate();
|
$outputArray['TRIAL_END_DATE'] = self::GetTrialEndingDate();
|
||||||
} else {
|
} else {
|
||||||
$outputArray['TRIAL_END_DATE'] = NULL;
|
$outputArray['TRIAL_END_DATE'] = NULL;
|
||||||
}
|
}
|
||||||
$outputArray['INSTALL_METHOD'] = self::GetInstallMethod();
|
$outputArray['INSTALL_METHOD'] = self::GetInstallMethod();
|
||||||
$outputArray['NUM_OF_STREAMS'] = self::GetNumOfStreams();
|
$outputArray['NUM_OF_STREAMS'] = self::GetNumOfStreams();
|
||||||
$outputArray['STREAM_INFO'] = Application_Model_StreamSetting::getStreamInfoForDataCollection();
|
$outputArray['STREAM_INFO'] = Application_Model_StreamSetting::getStreamInfoForDataCollection();
|
||||||
|
|
||||||
$outputArray = array_merge($systemInfoArray, $outputArray);
|
$outputArray = array_merge($systemInfoArray, $outputArray);
|
||||||
|
|
||||||
$outputString = "\n";
|
$outputString = "\n";
|
||||||
foreach($outputArray as $key => $out){
|
foreach($outputArray as $key => $out){
|
||||||
if($key == 'TRIAL_END_DATE' && ($out != '' || $out != 'NULL')){
|
if($key == 'TRIAL_END_DATE' && ($out != '' || $out != 'NULL')){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if($key == "STREAM_INFO"){
|
if($key == "STREAM_INFO"){
|
||||||
$outputString .= $key." :\n";
|
$outputString .= $key." :\n";
|
||||||
foreach($out as $s_info){
|
foreach($out as $s_info){
|
||||||
foreach($s_info as $k => $v){
|
foreach($s_info as $k => $v){
|
||||||
$outputString .= "\t".strtoupper($k)." : ".$v."\n";
|
$outputString .= "\t".strtoupper($k)." : ".$v."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if ($key == "SOUNDCLOUD_ENABLED") {
|
}else if ($key == "SOUNDCLOUD_ENABLED") {
|
||||||
if ($out) {
|
if ($out) {
|
||||||
$outputString .= $key." : TRUE\n";
|
$outputString .= $key." : TRUE\n";
|
||||||
} else if (!$out) {
|
} else if (!$out) {
|
||||||
$outputString .= $key." : FALSE\n";
|
$outputString .= $key." : FALSE\n";
|
||||||
}
|
}
|
||||||
}else if ($key == "SAAS") {
|
}else if ($key == "SAAS") {
|
||||||
if (strcmp($out, 'disabled')!=0) {
|
if (strcmp($out, 'disabled')!=0) {
|
||||||
$outputString .= $key.' : '.$out."\n";
|
$outputString .= $key.' : '.$out."\n";
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$outputString .= $key.' : '.$out."\n";
|
$outputString .= $key.' : '.$out."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($returnArray){
|
if($returnArray){
|
||||||
$outputArray['PROMOTE'] = self::GetPublicise();
|
$outputArray['PROMOTE'] = self::GetPublicise();
|
||||||
$outputArray['LOGOIMG'] = self::GetStationLogo();
|
$outputArray['LOGOIMG'] = self::GetStationLogo();
|
||||||
return $outputArray;
|
return $outputArray;
|
||||||
}else{
|
}else{
|
||||||
return $outputString;
|
return $outputString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetInstallMethod(){
|
public static function GetInstallMethod(){
|
||||||
|
@ -530,8 +530,8 @@ class Application_Model_Preference
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetRemindMeDate(){
|
public static function SetRemindMeDate(){
|
||||||
$weekAfter = mktime(0, 0, 0, gmdate("m"), gmdate("d")+7, gmdate("Y"));
|
$weekAfter = mktime(0, 0, 0, gmdate("m"), gmdate("d")+7, gmdate("Y"));
|
||||||
self::setValue("remindme", $weekAfter);
|
self::setValue("remindme", $weekAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetRemindMeDate(){
|
public static function GetRemindMeDate(){
|
||||||
|
@ -679,7 +679,7 @@ class Application_Model_Preference
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetWeekStartDay() {
|
public static function GetWeekStartDay() {
|
||||||
$val = self::getValue("week_start_day");
|
$val = self::getValue("week_start_day");
|
||||||
if (strlen($val) == 0){
|
if (strlen($val) == 0){
|
||||||
return "0";
|
return "0";
|
||||||
} else {
|
} else {
|
||||||
|
@ -721,7 +721,7 @@ class Application_Model_Preference
|
||||||
/**
|
/**
|
||||||
* Sets the time scale preference (agendaDay/agendaWeek/month) in Calendar.
|
* Sets the time scale preference (agendaDay/agendaWeek/month) in Calendar.
|
||||||
*
|
*
|
||||||
* @param $timeScale new time scale
|
* @param $timeScale new time scale
|
||||||
*/
|
*/
|
||||||
public static function SetCalendarTimeScale($timeScale) {
|
public static function SetCalendarTimeScale($timeScale) {
|
||||||
self::setValue("calendar_time_scale", $timeScale, true /* user specific */);
|
self::setValue("calendar_time_scale", $timeScale, true /* user specific */);
|
||||||
|
@ -736,16 +736,16 @@ class Application_Model_Preference
|
||||||
if(strlen($val) == 0) {
|
if(strlen($val) == 0) {
|
||||||
$val = "month";
|
$val = "month";
|
||||||
}
|
}
|
||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the number of entries to show preference in library under Playlist Builder.
|
* Sets the number of entries to show preference in library under Playlist Builder.
|
||||||
*
|
*
|
||||||
* @param $numEntries new number of entries to show
|
* @param $numEntries new number of entries to show
|
||||||
*/
|
*/
|
||||||
public static function SetLibraryNumEntries($numEntries) {
|
public static function SetLibraryNumEntries($numEntries) {
|
||||||
self::setValue("library_num_entries", $numEntries, true /* user specific */);
|
self::setValue("library_num_entries", $numEntries, true /* user specific */);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -753,7 +753,7 @@ class Application_Model_Preference
|
||||||
* Defaults to 10 if no entry exists
|
* Defaults to 10 if no entry exists
|
||||||
*/
|
*/
|
||||||
public static function GetLibraryNumEntries() {
|
public static function GetLibraryNumEntries() {
|
||||||
$val = self::getValue("library_num_entries", true /* user specific */);
|
$val = self::getValue("library_num_entries", true /* user specific */);
|
||||||
if(strlen($val) == 0) {
|
if(strlen($val) == 0) {
|
||||||
$val = "10";
|
$val = "10";
|
||||||
}
|
}
|
||||||
|
@ -763,7 +763,7 @@ class Application_Model_Preference
|
||||||
/**
|
/**
|
||||||
* Sets the time interval preference in Calendar.
|
* Sets the time interval preference in Calendar.
|
||||||
*
|
*
|
||||||
* @param $timeInterval new time interval
|
* @param $timeInterval new time interval
|
||||||
*/
|
*/
|
||||||
public static function SetCalendarTimeInterval($timeInterval) {
|
public static function SetCalendarTimeInterval($timeInterval) {
|
||||||
self::setValue("calendar_time_interval", $timeInterval, true /* user specific */);
|
self::setValue("calendar_time_interval", $timeInterval, true /* user specific */);
|
||||||
|
@ -774,7 +774,7 @@ class Application_Model_Preference
|
||||||
* Defaults to 30 min if no entry exists
|
* Defaults to 30 min if no entry exists
|
||||||
*/
|
*/
|
||||||
public static function GetCalendarTimeInterval() {
|
public static function GetCalendarTimeInterval() {
|
||||||
$val = self::getValue("calendar_time_interval", true /* user specific */);
|
$val = self::getValue("calendar_time_interval", true /* user specific */);
|
||||||
if(strlen($val) == 0) {
|
if(strlen($val) == 0) {
|
||||||
$val = "30";
|
$val = "30";
|
||||||
}
|
}
|
||||||
|
@ -908,44 +908,44 @@ class Application_Model_Preference
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetMailServerConfigured($value) {
|
public static function SetMailServerConfigured($value) {
|
||||||
self::setValue("mail_server_configured", $value, false);
|
self::setValue("mail_server_configured", $value, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetMailServerConfigured() {
|
public static function GetMailServerConfigured() {
|
||||||
return self::getValue("mail_server_configured");
|
return self::getValue("mail_server_configured");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetMailServer($value) {
|
public static function SetMailServer($value) {
|
||||||
self::setValue("mail_server", $value, false);
|
self::setValue("mail_server", $value, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetMailServer() {
|
public static function GetMailServer() {
|
||||||
return self::getValue("mail_server");
|
return self::getValue("mail_server");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetMailServerEmailAddress($value) {
|
public static function SetMailServerEmailAddress($value) {
|
||||||
self::setValue("mail_server_email_address", $value, false);
|
self::setValue("mail_server_email_address", $value, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetMailServerEmailAddress() {
|
public static function GetMailServerEmailAddress() {
|
||||||
return self::getValue("mail_server_email_address");
|
return self::getValue("mail_server_email_address");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetMailServerPassword($value) {
|
public static function SetMailServerPassword($value) {
|
||||||
self::setValue("mail_server_password", $value, false);
|
self::setValue("mail_server_password", $value, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetMailServerPassword() {
|
public static function GetMailServerPassword() {
|
||||||
return self::getValue("mail_server_password");
|
return self::getValue("mail_server_password");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetMailServerPort($value) {
|
public static function SetMailServerPort($value) {
|
||||||
self::setValue("mail_server_port", $value, false);
|
self::setValue("mail_server_port", $value, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetMailServerPort() {
|
public static function GetMailServerPort() {
|
||||||
return self::getValue("mail_server_port");
|
return self::getValue("mail_server_port");
|
||||||
}
|
}
|
||||||
/* User specific preferences end */
|
/* User specific preferences end */
|
||||||
|
|
||||||
public static function ShouldShowPopUp(){
|
public static function ShouldShowPopUp(){
|
||||||
|
|
|
@ -231,15 +231,15 @@ class Application_Model_Schedule {
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* @param DateTime $p_startDateTime
|
* @param DateTime $p_startDateTime
|
||||||
*
|
*
|
||||||
* @param DateTime $p_endDateTime
|
* @param DateTime $p_endDateTime
|
||||||
*
|
*
|
||||||
* @return array $scheduledItems
|
* @return array $scheduledItems
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function GetScheduleDetailItems($p_start, $p_end, $p_shows)
|
public static function GetScheduleDetailItems($p_start, $p_end, $p_shows)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
@ -626,18 +626,18 @@ class Application_Model_Schedule {
|
||||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
|
|
||||||
$formWhat = new Application_Form_AddShowWhat();
|
$formWhat = new Application_Form_AddShowWhat();
|
||||||
$formWho = new Application_Form_AddShowWho();
|
$formWho = new Application_Form_AddShowWho();
|
||||||
$formWhen = new Application_Form_AddShowWhen();
|
$formWhen = new Application_Form_AddShowWhen();
|
||||||
$formRepeats = new Application_Form_AddShowRepeats();
|
$formRepeats = new Application_Form_AddShowRepeats();
|
||||||
$formStyle = new Application_Form_AddShowStyle();
|
$formStyle = new Application_Form_AddShowStyle();
|
||||||
$formLive = new Application_Form_AddShowLiveStream();
|
$formLive = new Application_Form_AddShowLiveStream();
|
||||||
|
|
||||||
$formWhat->removeDecorator('DtDdWrapper');
|
$formWhat->removeDecorator('DtDdWrapper');
|
||||||
$formWho->removeDecorator('DtDdWrapper');
|
$formWho->removeDecorator('DtDdWrapper');
|
||||||
$formWhen->removeDecorator('DtDdWrapper');
|
$formWhen->removeDecorator('DtDdWrapper');
|
||||||
$formRepeats->removeDecorator('DtDdWrapper');
|
$formRepeats->removeDecorator('DtDdWrapper');
|
||||||
$formStyle->removeDecorator('DtDdWrapper');
|
$formStyle->removeDecorator('DtDdWrapper');
|
||||||
$formLive->removeDecorator('DtDdWrapper');
|
$formLive->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
$p_view->what = $formWhat;
|
$p_view->what = $formWhat;
|
||||||
$p_view->when = $formWhen;
|
$p_view->when = $formWhen;
|
||||||
|
@ -681,18 +681,18 @@ class Application_Model_Schedule {
|
||||||
$isSaas = (Application_Model_Preference::GetPlanLevel() != 'disabled');
|
$isSaas = (Application_Model_Preference::GetPlanLevel() != 'disabled');
|
||||||
|
|
||||||
$formWhat = new Application_Form_AddShowWhat();
|
$formWhat = new Application_Form_AddShowWhat();
|
||||||
$formWhen = new Application_Form_AddShowWhen();
|
$formWhen = new Application_Form_AddShowWhen();
|
||||||
$formRepeats = new Application_Form_AddShowRepeats();
|
$formRepeats = new Application_Form_AddShowRepeats();
|
||||||
$formWho = new Application_Form_AddShowWho();
|
$formWho = new Application_Form_AddShowWho();
|
||||||
$formStyle = new Application_Form_AddShowStyle();
|
$formStyle = new Application_Form_AddShowStyle();
|
||||||
$formLive = new Application_Form_AddShowLiveStream();
|
$formLive = new Application_Form_AddShowLiveStream();
|
||||||
|
|
||||||
$formWhat->removeDecorator('DtDdWrapper');
|
$formWhat->removeDecorator('DtDdWrapper');
|
||||||
$formWhen->removeDecorator('DtDdWrapper');
|
$formWhen->removeDecorator('DtDdWrapper');
|
||||||
$formRepeats->removeDecorator('DtDdWrapper');
|
$formRepeats->removeDecorator('DtDdWrapper');
|
||||||
$formWho->removeDecorator('DtDdWrapper');
|
$formWho->removeDecorator('DtDdWrapper');
|
||||||
$formStyle->removeDecorator('DtDdWrapper');
|
$formStyle->removeDecorator('DtDdWrapper');
|
||||||
$formLive->removeDecorator('DtDdWrapper');
|
$formLive->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
if(!$isSaas){
|
if(!$isSaas){
|
||||||
$formRecord = new Application_Form_AddShowRR();
|
$formRecord = new Application_Form_AddShowRR();
|
||||||
|
@ -765,22 +765,22 @@ class Application_Model_Schedule {
|
||||||
$record = false;
|
$record = false;
|
||||||
|
|
||||||
$formWhat = new Application_Form_AddShowWhat();
|
$formWhat = new Application_Form_AddShowWhat();
|
||||||
$formWho = new Application_Form_AddShowWho();
|
$formWho = new Application_Form_AddShowWho();
|
||||||
$formWhen = new Application_Form_AddShowWhen();
|
$formWhen = new Application_Form_AddShowWhen();
|
||||||
$formRepeats = new Application_Form_AddShowRepeats();
|
$formRepeats = new Application_Form_AddShowRepeats();
|
||||||
$formStyle = new Application_Form_AddShowStyle();
|
$formStyle = new Application_Form_AddShowStyle();
|
||||||
$formLive = new Application_Form_AddShowLiveStream();
|
$formLive = new Application_Form_AddShowLiveStream();
|
||||||
|
|
||||||
$formWhat->removeDecorator('DtDdWrapper');
|
$formWhat->removeDecorator('DtDdWrapper');
|
||||||
$formWho->removeDecorator('DtDdWrapper');
|
$formWho->removeDecorator('DtDdWrapper');
|
||||||
$formWhen->removeDecorator('DtDdWrapper');
|
$formWhen->removeDecorator('DtDdWrapper');
|
||||||
$formRepeats->removeDecorator('DtDdWrapper');
|
$formRepeats->removeDecorator('DtDdWrapper');
|
||||||
$formStyle->removeDecorator('DtDdWrapper');
|
$formStyle->removeDecorator('DtDdWrapper');
|
||||||
$formLive->removeDecorator('DtDdWrapper');
|
$formLive->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
$what = $formWhat->isValid($data);
|
$what = $formWhat->isValid($data);
|
||||||
$when = $formWhen->isValid($data);
|
$when = $formWhen->isValid($data);
|
||||||
$live = $formLive->isValid($data);
|
$live = $formLive->isValid($data);
|
||||||
if($when) {
|
if($when) {
|
||||||
$when = $formWhen->checkReliantFields($data, $validateStartDate, $originalStartDate, $update, $instanceId);
|
$when = $formWhen->checkReliantFields($data, $validateStartDate, $originalStartDate, $update, $instanceId);
|
||||||
}
|
}
|
||||||
|
@ -798,11 +798,11 @@ class Application_Model_Schedule {
|
||||||
$mValue = 0;
|
$mValue = 0;
|
||||||
|
|
||||||
if($hPos !== false){
|
if($hPos !== false){
|
||||||
$hValue = trim(substr($data["add_show_duration"], 0, $hPos));
|
$hValue = trim(substr($data["add_show_duration"], 0, $hPos));
|
||||||
}
|
}
|
||||||
if($mPos !== false){
|
if($mPos !== false){
|
||||||
$hPos = $hPos === FALSE ? 0 : $hPos+1;
|
$hPos = $hPos === FALSE ? 0 : $hPos+1;
|
||||||
$mValue = trim(substr($data["add_show_duration"], $hPos, -1 ));
|
$mValue = trim(substr($data["add_show_duration"], $hPos, -1 ));
|
||||||
}
|
}
|
||||||
|
|
||||||
$data["add_show_duration"] = $hValue.":".$mValue;
|
$data["add_show_duration"] = $hValue.":".$mValue;
|
||||||
|
@ -821,7 +821,7 @@ class Application_Model_Schedule {
|
||||||
}
|
}
|
||||||
|
|
||||||
if($data["add_show_repeats"]) {
|
if($data["add_show_repeats"]) {
|
||||||
$repeats = $formRepeats->isValid($data);
|
$repeats = $formRepeats->isValid($data);
|
||||||
if($repeats) {
|
if($repeats) {
|
||||||
$repeats = $formRepeats->checkReliantFields($data);
|
$repeats = $formRepeats->checkReliantFields($data);
|
||||||
}
|
}
|
||||||
|
@ -857,8 +857,8 @@ class Application_Model_Schedule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$who = $formWho->isValid($data);
|
$who = $formWho->isValid($data);
|
||||||
$style = $formStyle->isValid($data);
|
$style = $formStyle->isValid($data);
|
||||||
if ($what && $when && $repeats && $who && $style && $live) {
|
if ($what && $when && $repeats && $who && $style && $live) {
|
||||||
if(!$isSaas){
|
if(!$isSaas){
|
||||||
if($record && $rebroadAb && $rebroad){
|
if($record && $rebroadAb && $rebroad){
|
||||||
|
@ -898,7 +898,7 @@ class Application_Model_Schedule {
|
||||||
//$controller->view->newForm = $controller->view->render('schedule/add-show-form.phtml');
|
//$controller->view->newForm = $controller->view->render('schedule/add-show-form.phtml');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$controller->view->what = $formWhat;
|
$controller->view->what = $formWhat;
|
||||||
$controller->view->when = $formWhen;
|
$controller->view->when = $formWhen;
|
||||||
$controller->view->repeats = $formRepeats;
|
$controller->view->repeats = $formRepeats;
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Application_Model_Scheduler {
|
||||||
$this->nowDT = DateTime::createFromFormat("U", time(), new DateTimeZone("UTC"));
|
$this->nowDT = DateTime::createFromFormat("U", time(), new DateTimeZone("UTC"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->user = Application_Model_User::GetCurrentUser();
|
$this->user = Application_Model_User::getCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCheckUserPermissions($value) {
|
public function setCheckUserPermissions($value) {
|
||||||
|
|
|
@ -303,8 +303,6 @@ class Application_Model_Show {
|
||||||
." AND starts > TIMESTAMP '$timestamp'"
|
." AND starts > TIMESTAMP '$timestamp'"
|
||||||
." AND show_id = $showId";
|
." AND show_id = $showId";
|
||||||
|
|
||||||
//Logging::log($sql);
|
|
||||||
|
|
||||||
$con->exec($sql);
|
$con->exec($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,8 +592,8 @@ class Application_Model_Show {
|
||||||
* The start date in the format YYYY-MM-DD
|
* The start date in the format YYYY-MM-DD
|
||||||
*/
|
*/
|
||||||
public function getStartDate(){
|
public function getStartDate(){
|
||||||
list($date,) = explode(" ", $this->getStartDateAndTime());
|
list($date,) = explode(" ", $this->getStartDateAndTime());
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -606,8 +604,8 @@ class Application_Model_Show {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function getStartTime(){
|
public function getStartTime(){
|
||||||
list(,$time) = explode(" ", $this->getStartDateAndTime());
|
list(,$time) = explode(" ", $this->getStartDateAndTime());
|
||||||
return $time;
|
return $time;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1251,8 +1249,8 @@ class Application_Model_Show {
|
||||||
$rebroadcasts = $con->query($sql)->fetchAll();
|
$rebroadcasts = $con->query($sql)->fetchAll();
|
||||||
|
|
||||||
if ($showInstance->isRecorded()){
|
if ($showInstance->isRecorded()){
|
||||||
$showInstance->deleteRebroadcasts();
|
$showInstance->deleteRebroadcasts();
|
||||||
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
|
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Application_Model_ShowBuilder {
|
||||||
$this->startDT = $p_startDT;
|
$this->startDT = $p_startDT;
|
||||||
$this->endDT = $p_endDT;
|
$this->endDT = $p_endDT;
|
||||||
$this->timezone = date_default_timezone_get();
|
$this->timezone = date_default_timezone_get();
|
||||||
$this->user = Application_Model_User::GetCurrentUser();
|
$this->user = Application_Model_User::getCurrentUser();
|
||||||
$this->opts = $p_opts;
|
$this->opts = $p_opts;
|
||||||
$this->epoch_now = floatval(microtime(true));
|
$this->epoch_now = floatval(microtime(true));
|
||||||
$this->currentShow = false;
|
$this->currentShow = false;
|
||||||
|
|
|
@ -670,30 +670,30 @@ class Application_Model_ShowInstance {
|
||||||
|
|
||||||
public function getLastAudioItemEnd()
|
public function getLastAudioItemEnd()
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$sql = "SELECT ends FROM cc_schedule "
|
$sql = "SELECT ends FROM cc_schedule "
|
||||||
."WHERE instance_id = {$this->_instanceId} "
|
."WHERE instance_id = {$this->_instanceId} "
|
||||||
."ORDER BY ends DESC "
|
."ORDER BY ends DESC "
|
||||||
."LIMIT 1";
|
."LIMIT 1";
|
||||||
|
|
||||||
$query = $con->query($sql)->fetchColumn(0);
|
$query = $con->query($sql)->fetchColumn(0);
|
||||||
return ($query !== false) ? $query : NULL;
|
return ($query !== false) ? $query : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getShowEndGapTime(){
|
public function getShowEndGapTime(){
|
||||||
$showEnd = $this->getShowInstanceEnd();
|
$showEnd = $this->getShowInstanceEnd();
|
||||||
$lastItemEnd = $this->getLastAudioItemEnd();
|
$lastItemEnd = $this->getLastAudioItemEnd();
|
||||||
|
|
||||||
if (is_null($lastItemEnd)){
|
if (is_null($lastItemEnd)){
|
||||||
$lastItemEnd = $this->getShowInstanceStart();
|
$lastItemEnd = $this->getShowInstanceStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$diff = strtotime($showEnd) - strtotime($lastItemEnd);
|
$diff = strtotime($showEnd) - strtotime($lastItemEnd);
|
||||||
|
|
||||||
return ($diff < 0) ? 0 : $diff;
|
return ($diff < 0) ? 0 : $diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetLastShowInstance($p_timeNow){
|
public static function GetLastShowInstance($p_timeNow){
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
@ -777,10 +777,10 @@ class Application_Model_ShowInstance {
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$sql = "SELECT ends
|
$sql = "SELECT ends
|
||||||
FROM cc_show_instances as si
|
FROM cc_show_instances as si
|
||||||
JOIN cc_show as sh ON si.show_id = sh.id
|
JOIN cc_show as sh ON si.show_id = sh.id
|
||||||
WHERE si.ends > '$p_startTime' and si.ends < '$p_endTime' and (sh.live_stream_using_airtime_auth or live_stream_using_custom_auth)
|
WHERE si.ends > '$p_startTime' and si.ends < '$p_endTime' and (sh.live_stream_using_airtime_auth or live_stream_using_custom_auth)
|
||||||
ORDER BY si.ends";
|
ORDER BY si.ends";
|
||||||
|
|
||||||
return $con->query($sql)->fetchAll();
|
return $con->query($sql)->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Application_Model_Soundcloud {
|
||||||
|
|
||||||
private $_soundcloud;
|
private $_soundcloud;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
|
|
|
@ -161,9 +161,9 @@ class Application_Model_StoredFile {
|
||||||
* Set metadata element value
|
* Set metadata element value
|
||||||
*
|
*
|
||||||
* @param string $category
|
* @param string $category
|
||||||
* Metadata element by metadata constant
|
* Metadata element by metadata constant
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* value to store, if NULL then delete record
|
* value to store, if NULL then delete record
|
||||||
*/
|
*/
|
||||||
public function setMetadataValue($p_category, $p_value)
|
public function setMetadataValue($p_category, $p_value)
|
||||||
{
|
{
|
||||||
|
@ -176,9 +176,9 @@ class Application_Model_StoredFile {
|
||||||
* Set metadata element value
|
* Set metadata element value
|
||||||
*
|
*
|
||||||
* @param string $category
|
* @param string $category
|
||||||
* Metadata element by db column
|
* Metadata element by db column
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* value to store, if NULL then delete record
|
* value to store, if NULL then delete record
|
||||||
*/
|
*/
|
||||||
public function setDbColMetadataValue($p_category, $p_value)
|
public function setDbColMetadataValue($p_category, $p_value)
|
||||||
{
|
{
|
||||||
|
@ -273,9 +273,9 @@ class Application_Model_StoredFile {
|
||||||
* Set state of virtual file
|
* Set state of virtual file
|
||||||
*
|
*
|
||||||
* @param string $p_state
|
* @param string $p_state
|
||||||
* 'empty'|'incomplete'|'ready'|'edited'
|
* 'empty'|'incomplete'|'ready'|'edited'
|
||||||
* @param int $p_editedby
|
* @param int $p_editedby
|
||||||
* user id | 'NULL' for clear editedBy field
|
* user id | 'NULL' for clear editedBy field
|
||||||
* @return TRUE
|
* @return TRUE
|
||||||
*/
|
*/
|
||||||
public function setState($p_state, $p_editedby=NULL)
|
public function setState($p_state, $p_editedby=NULL)
|
||||||
|
@ -367,7 +367,7 @@ class Application_Model_StoredFile {
|
||||||
* Return suitable extension.
|
* Return suitable extension.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* file extension without a dot
|
* file extension without a dot
|
||||||
*/
|
*/
|
||||||
public function getFileExtension()
|
public function getFileExtension()
|
||||||
{
|
{
|
||||||
|
@ -500,9 +500,9 @@ Logging::log("getting media! - 2");
|
||||||
* be NULL.
|
* be NULL.
|
||||||
*
|
*
|
||||||
* @param int $p_id
|
* @param int $p_id
|
||||||
* local id
|
* local id
|
||||||
* @param string $p_gunid
|
* @param string $p_gunid
|
||||||
* global unique id of file
|
* global unique id of file
|
||||||
* @param string $p_md5sum
|
* @param string $p_md5sum
|
||||||
* MD5 sum of the file
|
* MD5 sum of the file
|
||||||
* @param boolean $exist
|
* @param boolean $exist
|
||||||
|
@ -570,7 +570,7 @@ Logging::log("getting media! - 2");
|
||||||
* by gunid.
|
* by gunid.
|
||||||
*
|
*
|
||||||
* @param string $p_gunid
|
* @param string $p_gunid
|
||||||
* global unique id of file
|
* global unique id of file
|
||||||
* @return Application_Model_StoredFile|NULL
|
* @return Application_Model_StoredFile|NULL
|
||||||
*/
|
*/
|
||||||
public static function RecallByGunid($p_gunid)
|
public static function RecallByGunid($p_gunid)
|
||||||
|
@ -624,7 +624,7 @@ Logging::log("getting media! - 2");
|
||||||
|
|
||||||
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 = array("id", "track_title", "artist_name", "album_title", "genre", "length",
|
||||||
"year", "utime", "mtime", "ftype", "track_number", "mood", "bpm", "composer", "info_url",
|
"year", "utime", "mtime", "ftype", "track_number", "mood", "bpm", "composer", "info_url",
|
||||||
|
@ -967,9 +967,9 @@ Logging::log("getting media! - 2");
|
||||||
public static function getSoundCloudUploads()
|
public static function getSoundCloudUploads()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$sql = "SELECT soundcloud_id as id, soundcloud_upload_time"
|
$sql = "SELECT soundcloud_id as id, soundcloud_upload_time"
|
||||||
." FROM CC_FILES"
|
." FROM CC_FILES"
|
||||||
." WHERE (id != -2 and id != -3) and"
|
." WHERE (id != -2 and id != -3) and"
|
||||||
." (soundcloud_upload_time >= (now() - (INTERVAL '1 day')))";
|
." (soundcloud_upload_time >= (now() - (INTERVAL '1 day')))";
|
||||||
|
@ -1023,8 +1023,8 @@ Logging::log("getting media! - 2");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDirectory(){
|
public function getDirectory(){
|
||||||
return $this->_file->getDbDirectory();
|
return $this->_file->getDbDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setFileExistsFlag($flag){
|
public function setFileExistsFlag($flag){
|
||||||
$this->_file->setDbFileExists($flag)
|
$this->_file->setDbFileExists($flag)
|
||||||
|
|
|
@ -11,191 +11,220 @@ class Application_Model_User {
|
||||||
|
|
||||||
public function __construct($userId)
|
public function __construct($userId)
|
||||||
{
|
{
|
||||||
if (empty($userId)){
|
if (empty($userId)) {
|
||||||
$this->_userInstance = $this->createUser();
|
$this->_userInstance = $this->createUser();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->_userInstance = CcSubjsQuery::create()->findPK($userId);
|
$this->_userInstance = CcSubjsQuery::create()->findPK($userId);
|
||||||
|
|
||||||
if (is_null($this->_userInstance)){
|
if (is_null($this->_userInstance)) {
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId() {
|
public function getId()
|
||||||
|
{
|
||||||
return $this->_userInstance->getDbId();
|
return $this->_userInstance->getDbId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isGuest() {
|
public function isGuest()
|
||||||
|
{
|
||||||
return $this->getType() == UTYPE_GUEST;
|
return $this->getType() == UTYPE_GUEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isHost($showId) {
|
public function isHost($showId)
|
||||||
return $this->isUserType(UTYPE_HOST, $showId);
|
{
|
||||||
|
return $this->isUserType(UTYPE_HOST, $showId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isPM() {
|
public function isPM()
|
||||||
|
{
|
||||||
return $this->isUserType(UTYPE_PROGRAM_MANAGER);
|
return $this->isUserType(UTYPE_PROGRAM_MANAGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isAdmin() {
|
public function isAdmin()
|
||||||
|
{
|
||||||
return $this->isUserType(UTYPE_ADMIN);
|
return $this->isUserType(UTYPE_ADMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canSchedule($p_showId) {
|
public function canSchedule($p_showId)
|
||||||
$type = $this->getType();
|
{
|
||||||
$result = false;
|
$type = $this->getType();
|
||||||
|
$result = false;
|
||||||
|
|
||||||
if ( $type === UTYPE_ADMIN ||
|
if ($type === UTYPE_ADMIN ||
|
||||||
$type === UTYPE_PROGRAM_MANAGER ||
|
$type === UTYPE_PROGRAM_MANAGER ||
|
||||||
CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0 )
|
CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0) {
|
||||||
{
|
$result = true;
|
||||||
$result = true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isUserType($type, $showId=''){
|
public function isUserType($type, $showId='')
|
||||||
if(is_array($type)){
|
{
|
||||||
$result = false;
|
if (is_array($type)) {
|
||||||
foreach($type as $t){
|
$result = false;
|
||||||
switch($t){
|
foreach ($type as $t) {
|
||||||
case UTYPE_ADMIN:
|
switch($t){
|
||||||
$result = $this->_userInstance->getDbType() === 'A';
|
case UTYPE_ADMIN:
|
||||||
break;
|
$result = $this->_userInstance->getDbType() === 'A';
|
||||||
case UTYPE_HOST:
|
break;
|
||||||
$userId = $this->_userInstance->getDbId();
|
case UTYPE_HOST:
|
||||||
$result = CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($userId)->count() > 0;
|
$userId = $this->_userInstance->getDbId();
|
||||||
break;
|
$result = CcShowHostsQuery::create()
|
||||||
case UTYPE_PROGRAM_MANAGER:
|
->filterByDbShow($showId)
|
||||||
$result = $this->_userInstance->getDbType() === 'P';
|
->filterByDbHost($userId)->count() > 0;
|
||||||
break;
|
break;
|
||||||
}
|
case UTYPE_PROGRAM_MANAGER:
|
||||||
if($result){
|
$result = $this->_userInstance->getDbType() === 'P';
|
||||||
return $result;
|
break;
|
||||||
}
|
}
|
||||||
}
|
if ($result) {
|
||||||
}else{
|
return $result;
|
||||||
switch($type){
|
}
|
||||||
case UTYPE_ADMIN:
|
}
|
||||||
return $this->_userInstance->getDbType() === 'A';
|
} else {
|
||||||
case UTYPE_HOST:
|
switch($type) {
|
||||||
$userId = $this->_userInstance->getDbId();
|
case UTYPE_ADMIN:
|
||||||
return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($userId)->count() > 0;
|
return $this->_userInstance->getDbType() === 'A';
|
||||||
case UTYPE_PROGRAM_MANAGER:
|
case UTYPE_HOST:
|
||||||
return $this->_userInstance->getDbType() === 'P';
|
$userId = $this->_userInstance->getDbId();
|
||||||
}
|
return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($userId)->count() > 0;
|
||||||
}
|
case UTYPE_PROGRAM_MANAGER:
|
||||||
|
return $this->_userInstance->getDbType() === 'P';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setLogin($login){
|
public function setLogin($login)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbLogin($login);
|
$user->setDbLogin($login);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPassword($password){
|
public function setPassword($password)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbPass(md5($password));
|
$user->setDbPass(md5($password));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setFirstName($firstName){
|
public function setFirstName($firstName)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbFirstName($firstName);
|
$user->setDbFirstName($firstName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setLastName($lastName){
|
public function setLastName($lastName)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbLastName($lastName);
|
$user->setDbLastName($lastName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setType($type){
|
public function setType($type)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbType($type);
|
$user->setDbType($type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setEmail($email){
|
public function setEmail($email)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbEmail(strtolower($email));
|
$user->setDbEmail(strtolower($email));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCellPhone($cellPhone){
|
public function setCellPhone($cellPhone)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbCellPhone($cellPhone);
|
$user->setDbCellPhone($cellPhone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSkype($skype){
|
public function setSkype($skype)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbSkypeContact($skype);
|
$user->setDbSkypeContact($skype);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setJabber($jabber){
|
public function setJabber($jabber)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbJabberContact($jabber);
|
$user->setDbJabberContact($jabber);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLogin(){
|
public function getLogin()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbLogin();
|
return $user->getDbLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPassword(){
|
public function getPassword()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbPass();
|
return $user->getDbPass();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFirstName(){
|
public function getFirstName()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbFirstName();
|
return $user->getDbFirstName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLastName(){
|
public function getLastName()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbLastName();
|
return $user->getDbLastName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType(){
|
public function getType()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbType();
|
return $user->getDbType();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEmail(){
|
public function getEmail()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbEmail();
|
return $user->getDbEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCellPhone(){
|
public function getCellPhone()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbCellPhone();
|
return $user->getDbCellPhone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSkype(){
|
public function getSkype()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbSkypeContact();
|
return $user->getDbSkypeContact();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJabber(){
|
public function getJabber()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbJabberContact();
|
return $user->getDbJabberContact();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save(){
|
public function save()
|
||||||
|
{
|
||||||
$this->_userInstance->save();
|
$this->_userInstance->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete(){
|
public function delete()
|
||||||
if (!$this->_userInstance->isDeleted())
|
{
|
||||||
|
if (!$this->_userInstance->isDeleted()) {
|
||||||
$this->_userInstance->delete();
|
$this->_userInstance->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createUser() {
|
private function createUser()
|
||||||
|
{
|
||||||
$user = new CcSubjs();
|
$user = new CcSubjs();
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUsers($type, $search=NULL)
|
public static function getUsers($type, $search=null)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
|
@ -203,12 +232,11 @@ class Application_Model_User {
|
||||||
$sql = $sql_gen;
|
$sql = $sql_gen;
|
||||||
|
|
||||||
if (is_array($type)) {
|
if (is_array($type)) {
|
||||||
for($i=0; $i<count($type); $i++) {
|
for ($i=0; $i<count($type); $i++) {
|
||||||
$type[$i] = "type = '{$type[$i]}'";
|
$type[$i] = "type = '{$type[$i]}'";
|
||||||
}
|
}
|
||||||
$sql_type = join(" OR ", $type);
|
$sql_type = join(" OR ", $type);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sql_type = "type = {$type}";
|
$sql_type = "type = {$type}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,39 +253,40 @@ class Application_Model_User {
|
||||||
return $con->query($sql)->fetchAll();;
|
return $con->query($sql)->fetchAll();;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUserCount($type=NULL){
|
public static function getUserCount($type=null)
|
||||||
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$sql = '';
|
$sql = '';
|
||||||
$sql_gen = "SELECT count(*) AS cnt FROM cc_subjs ";
|
$sql_gen = "SELECT count(*) AS cnt FROM cc_subjs ";
|
||||||
|
|
||||||
if (!isset($type)) {
|
if (!isset($type)) {
|
||||||
$sql = $sql_gen;
|
$sql = $sql_gen;
|
||||||
}
|
} else {
|
||||||
else{
|
if (is_array($type)) {
|
||||||
if (is_array($type)) {
|
for ($i=0; $i<count($type); $i++) {
|
||||||
for ($i=0; $i<count($type); $i++) {
|
$type[$i] = "type = '{$type[$i]}'";
|
||||||
$type[$i] = "type = '{$type[$i]}'";
|
}
|
||||||
}
|
$sql_type = join(" OR ", $type);
|
||||||
$sql_type = join(" OR ", $type);
|
} else {
|
||||||
}
|
$sql_type = "type = {$type}";
|
||||||
else {
|
}
|
||||||
$sql_type = "type = {$type}";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = $sql_gen ." WHERE (". $sql_type.") ";
|
$sql = $sql_gen ." WHERE (". $sql_type.") ";
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = $con->query($sql)->fetchColumn(0);
|
$query = $con->query($sql)->fetchColumn(0);
|
||||||
return ($query !== false) ? $query : NULL;
|
return ($query !== false) ? $query : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getHosts($search=NULL) {
|
public static function getHosts($search=null)
|
||||||
|
{
|
||||||
return Application_Model_User::getUsers(array('H'), $search);
|
return Application_Model_User::getUsers(array('H'), $search);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUsersDataTablesInfo($datatables) {
|
public static function getUsersDataTablesInfo($datatables)
|
||||||
|
{
|
||||||
|
|
||||||
$con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME);
|
$con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME);
|
||||||
|
|
||||||
$displayColumns = array("id", "login", "first_name", "last_name", "type");
|
$displayColumns = array("id", "login", "first_name", "last_name", "type");
|
||||||
$fromTable = "cc_subjs";
|
$fromTable = "cc_subjs";
|
||||||
|
@ -273,8 +302,8 @@ class Application_Model_User {
|
||||||
$res = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables);
|
$res = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables);
|
||||||
|
|
||||||
// mark record which is for the current user
|
// mark record which is for the current user
|
||||||
foreach($res['aaData'] as &$record){
|
foreach ($res['aaData'] as &$record) {
|
||||||
if($record['login'] == $username){
|
if ($record['login'] == $username) {
|
||||||
$record['delete'] = "self";
|
$record['delete'] = "self";
|
||||||
} else {
|
} else {
|
||||||
$record['delete'] = "";
|
$record['delete'] = "";
|
||||||
|
@ -284,7 +313,8 @@ class Application_Model_User {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUserData($id){
|
public static function getUserData($id)
|
||||||
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$sql = "SELECT login, first_name, last_name, type, id, email, cell_phone, skype_contact, jabber_contact"
|
$sql = "SELECT login, first_name, last_name, type, id, email, cell_phone, skype_contact, jabber_contact"
|
||||||
|
@ -294,24 +324,16 @@ class Application_Model_User {
|
||||||
return $con->query($sql)->fetch();
|
return $con->query($sql)->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetUserID($login){
|
public static function getCurrentUser()
|
||||||
$user = CcSubjsQuery::create()->findOneByDbLogin($login);
|
{
|
||||||
if (is_null($user)){
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
return $user->getDbId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function GetCurrentUser() {
|
|
||||||
$userinfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userinfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
|
||||||
if (is_null($userinfo)){
|
if (is_null($userinfo)) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
return new self($userinfo->id);
|
return new self($userinfo->id);
|
||||||
} catch (Exception $e){
|
} catch (Exception $e) {
|
||||||
//we get here if $userinfo->id is defined, but doesn't exist
|
//we get here if $userinfo->id is defined, but doesn't exist
|
||||||
//in the database anymore.
|
//in the database anymore.
|
||||||
Zend_Auth::getInstance()->clearIdentity();
|
Zend_Auth::getInstance()->clearIdentity();
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
class CcFiles extends BaseCcFiles {
|
class CcFiles extends BaseCcFiles {
|
||||||
|
|
||||||
public function getDbLength($format = "H:i:s.u")
|
public function getDbLength($format = "H:i:s.u")
|
||||||
{
|
{
|
||||||
return parent::getDbLength($format);
|
return parent::getDbLength($format);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
class Common {
|
class Common {
|
||||||
|
|
||||||
public static function setTimeInSub($row, $col, $time)
|
public static function setTimeInSub($row, $col, $time)
|
||||||
{
|
{
|
||||||
$class = get_class($row).'Peer';
|
$class = get_class($row).'Peer';
|
||||||
|
|
||||||
$con = Propel::getConnection($class::DATABASE_NAME);
|
$con = Propel::getConnection($class::DATABASE_NAME);
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ class StoredFileTest extends PHPUnit_TestCase {
|
||||||
|| ($metadata["audio"]["dataformat"] != "mp3")
|
|| ($metadata["audio"]["dataformat"] != "mp3")
|
||||||
|| ($metadata["dc:type"] != "Speech")) {
|
|| ($metadata["dc:type"] != "Speech")) {
|
||||||
$str = " [dc:description] = " . $metadata["dc:description"] ."\n"
|
$str = " [dc:description] = " . $metadata["dc:description"] ."\n"
|
||||||
. " [audio][dataformat] = " . $metadata["audio"]["dataformat"]."\n"
|
. " [audio][dataformat] = " . $metadata["audio"]["dataformat"]."\n"
|
||||||
. " [dc:type] = ".$metadata["dc:type"]."\n";
|
. " [dc:type] = ".$metadata["dc:type"]."\n";
|
||||||
$this->fail("Metadata has unexpected values:\n".$str);
|
$this->fail("Metadata has unexpected values:\n".$str);
|
||||||
}
|
}
|
||||||
//var_dump($metadata);
|
//var_dump($metadata);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 492242f4bb7367afebbf2f096067cb5a5d3c0449
|
Subproject commit 0653ec0b89362921f075af96ee8772538b801a7c
|
Loading…
Reference in New Issue