*** empty log message ***
This commit is contained in:
parent
0da71b6798
commit
f181ea7515
20 changed files with 137 additions and 58 deletions
|
@ -5,6 +5,7 @@ class uiPlaylist
|
|||
{
|
||||
$this->Base =& $uiBase;
|
||||
$this->active =& $_SESSION[UI_PLAYLIST_SESSNAME]['active'];
|
||||
$this->token =& $_SESSION[UI_PLAYLIST_SESSNAME]['token'];
|
||||
$this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
|
||||
}
|
||||
|
||||
|
@ -14,7 +15,7 @@ class uiPlaylist
|
|||
}
|
||||
|
||||
function get()
|
||||
{ #print_r($this->items);
|
||||
{
|
||||
return is_array($this->active) ? $this->active : FALSE;
|
||||
}
|
||||
|
||||
|
@ -22,21 +23,22 @@ class uiPlaylist
|
|||
{
|
||||
# test if PL available
|
||||
# look PL
|
||||
# store access token to ls_pref
|
||||
# store access token to ls_pref abd session
|
||||
# load PL into session
|
||||
if(is_string($this->Base->gb->loadPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY))) {
|
||||
if($this->token) {
|
||||
$this->Base->_retMsg('You have an Playlist already activated,\n first close it');
|
||||
return FALSE;
|
||||
}
|
||||
if($this->Base->gb->playlistIsAvailable($plid, $this->Base->sessid) !== TRUE) {
|
||||
$this->Base->_retMsg('Playlist is looked');
|
||||
if(($userid = $this->Base->gb->playlistIsAvailable($plid, $this->Base->sessid)) !== TRUE) {
|
||||
$this->Base->_retMsg('Playlist is looked by $1', $this->Base->gb->getSubjName($userid));
|
||||
return FALSE;
|
||||
}
|
||||
$token = $this->Base->gb->lockPlaylistForEdit($plid, $this->Base->sessid);
|
||||
$this->Base->gb->savePref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY, $token);
|
||||
$this->token = $this->Base->gb->lockPlaylistForEdit($plid, $this->Base->sessid);
|
||||
$this->Base->gb->savePref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY, $this->token);
|
||||
$this->active = $this->Base->gb->getPlaylistArray($plid, $this->Base->sessid);
|
||||
$this->active['id'] = $plid;
|
||||
$this->Base->_retMsg('Playlist "$1" activated', $this->Base->_getMDataValue($plid, 'title'));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function release()
|
||||
|
@ -45,20 +47,35 @@ class uiPlaylist
|
|||
# release PL
|
||||
# delete PL from session
|
||||
# remove token from ls_pref
|
||||
if(!is_string($token = $this->Base->gb->loadPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY))) {
|
||||
if(!$this->token) {
|
||||
$this->Base->_retMsg('No Playlist is looked by You');
|
||||
return FALSE;
|
||||
}
|
||||
$plgunid = $this->Base->gb->releaseLockedPlaylist($token, $this->Base->sessid);
|
||||
$plgunid = $this->Base->gb->releaseLockedPlaylist($this->token, $this->Base->sessid);
|
||||
$this->Base->_retMsg('Playlist "$1" released', $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($plgunid), 'title'));
|
||||
$this->active = NULL;
|
||||
$this->token = NULL;
|
||||
$this->Base->gb->delPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function testForLooked()
|
||||
{
|
||||
if(is_string($this->token = $this->Base->gb->loadPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY))) {
|
||||
$this->Base->_retMsg('Playlist looked by You was released');
|
||||
$this->release();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function addItem($id)
|
||||
{
|
||||
|
||||
if (!$this->Base->gb->addAudioClipToPlaylist($this->token, $id, $this->Base->sessid)) {
|
||||
$this->Base_retMsg('Cannot add File to Playlist');
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
|
@ -73,15 +90,31 @@ class uiPlaylist
|
|||
# create PL
|
||||
# activate
|
||||
# add clip
|
||||
if ($this->testNew() === FALSE) {
|
||||
$this->Base->_retMsg('Already active Playlist');
|
||||
return FALSE;
|
||||
}
|
||||
$this->addItem($id);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function createEmpty()
|
||||
{
|
||||
if (!$plid = $this->Base->gb->createPlaylist($this->Base->homeid, date('Y-M-D H-i-s'), $this->Base->sessid)) {
|
||||
$this->Base->_retMsg('Cannot create Playlist');
|
||||
return FALSE;
|
||||
}
|
||||
$this->activate($plid);
|
||||
if (!$this->Base->gb->addAudioClipToPlaylist($token, $id, $this->Base->sessid)) {
|
||||
$this->Base_retMsg('Cannot add File to Playlist');
|
||||
return $plid;
|
||||
}
|
||||
|
||||
function testNew()
|
||||
{
|
||||
# if not exists -> create new
|
||||
if (is_array($this->active)) {
|
||||
return FALSE;
|
||||
}
|
||||
$plid = $this->createEmpty();
|
||||
$this->activate($plid);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue