*** empty log message ***

This commit is contained in:
sebastian 2005-06-08 19:27:10 +00:00
parent 9e8ab83dca
commit 089134adf2
20 changed files with 218 additions and 261 deletions

View file

@ -435,19 +435,7 @@ $ui_fmask = array(
'element' => 'langid',
'type' => 'select',
'label' => 'Language',
'options' => array(
'ar_JO' => 'Arabic(JO)',
'am_AM' => 'Armenian(AM)',
'en_GB' => 'English (GB)',
'en_US' => 'English (US)',
'es_CO' => 'Español (CO)',
'cz_CZ' => 'Česky (CZ)',
'de_DE' => 'Deutsch (DE)',
'hu_HU' => 'Magyar (HU)',
'nl_NL' => 'Nederlands (NL)',
'sr_CS' => 'Srpski (CS)',
'ru_RU' => 'Russia(RU)'
),
'options' => _getLanguages(),
'default' => UI_DEFAULT_LANGID
)
),

View file

@ -58,15 +58,7 @@ $mask = array(
'element' => 'target_langid',
'type' => 'select',
'label' => 'Language',
'options' => array(
'en_GB' => 'English (GB)',
'nl_NL' => 'Nederlands (NL)',
'cz_CZ' => 'ÄŒesky (CZ)',
'de_DE' => 'Deutsch (DE)',
'hu_HU' => 'Magyar (HU)',
'sr_CS' => 'Srpski (CS)',
'es_CO' => "Español (CO)"
),
'options' => _getLanguages(),
'attributes'=> array('onChange' => 'MData_switchLang()')
)
),
@ -250,17 +242,17 @@ $mask = array(
'label' => 'Channels',
'options' => array(
'' => '',
'mono' => 'Mono',
'stereo' => 'Stereo',
'5.1' => '5.1'
1 => 'Mono',
2 => 'Stereo',
6 => '5.1'
),
'id3' => 'Channels'
),
array(
'element' => 'ls:samplerate',
'type' => 'select',
'type' => 'text',
'label' => 'Sample rate',
'options' => array(), ## vervollständigen!
'rule' => 'numeric',
'id3' => 'Samplerate'
),
array(

View file

@ -57,7 +57,6 @@ if (is_array($_REQUEST['popup'])){
break;
case "deleteItem":
$Smarty->assign('id', $_REQUEST['id']);
$Smarty->assign('filename', $uiBrowser->_getMDataValue($_REQUEST['id'], UI_MDATA_KEY_TITLE));
$Smarty->display('popup/deleteItem.tpl');
break;
@ -84,13 +83,11 @@ if (is_array($_REQUEST['popup'])){
break;
case "SCHEDULER.removeItem":
$Smarty->assign('scheduleId', $_REQUEST['scheduleId']);
$Smarty->assign('playlistName', $uiBrowser->_getMDataValue($_REQUEST['playlistId'], UI_MDATA_KEY_TITLE));
$Smarty->display('popup/SCHEDULER.removeItem.tpl');
break;
case "SUBJECTS.confirmRemoveSubj":
$Smarty->assign('lgoin', $_REQUEST['login']);
$Smarty->display('popup/SUBJECTS.confirmRemoveSubj.tpl');
break;

View file

@ -253,8 +253,8 @@ switch($_REQUEST['act']){
$uiHandler->SCHEDULER->setReload();
break;
case "SCHEDULER.setScheduleTime":
$uiHandler->SCHEDULER->setScheduleAt($_REQUEST);
case "SCHEDULER.setScheduleAtTime":
$uiHandler->SCHEDULER->setScheduleAtTime($_REQUEST);
$uiHandler->SCHEDULER->setClose();
break;
@ -277,7 +277,7 @@ switch($_REQUEST['act']){
if ($uiHandler->alertMsg) $_SESSION['alertMsg'] = $uiHandler->alertMsg;
#header('Location: '.$uiHandler->redirUrl);
if (ob_get_contents()) {
$ui_wait = 5;
$ui_wait = 10;
}
ob_end_clean;
?>

View file

@ -25,10 +25,10 @@ onClick="return contextmenu('{$i.id}'
{if $_PL_activeId == $i.id}
, 'PL.release'
{else}
, 'PL.addItem', 'delete'
, 'SCHEDULER.addPL', 'PL.addItem', 'delete'
{/if}
{else}
, 'PL.activate', 'PL.create', 'delete'
, 'SCHEDULER.addPL', 'PL.activate', 'PL.create', 'delete'
{/if}
{/if}
)"

View file

@ -1,6 +1,6 @@
{include file="popup/header.tpl"}
{if $SCHEDULER->copyPlFromSP()}
{if $SCHEDULER->getPLtoSchedule($_REQUEST.playlistId)}
{assign var="dynform" value=$SCHEDULER->getScheduleForm()}
<table height="100%" width="100%">
<tr>
@ -32,7 +32,7 @@ function SCHEDULE_submit()
function SCHEDULE_snap2Hour()
{
{/literal}
document.forms["schedule"].elements["time[H]"].value = "{$SCHEDULER->scheduleAt.hour|string_format:'%d'}";
document.forms["schedule"].elements["time[H]"].value = "{$SCHEDULER->scheduleAtTime.hour|string_format:'%d'}";
document.forms["schedule"].elements["time[i]"].value = "0";
document.forms["schedule"].elements["time[s]"].value = "0";
{literal}

View file

@ -4,7 +4,7 @@
{tra 0='Are you sure to remove playlist "$1"?' 1=$playlistName}
<br><br>
<input type="button" class="button" onClick="window.close()" value="Cancel">
<input type="button" class="button" onClick="location.href='{$UI_HANDLER}?act=SCHEDULER.removeItem&scheduleId={$scheduleId}'" value="OK">
<input type="button" class="button" onClick="location.href='{$UI_HANDLER}?act=SCHEDULER.removeItem&scheduleId={$_REQUEST.scheduleId}'" value="OK">
</center>
</body>

View file

@ -4,7 +4,7 @@
{tra 0='Are you sure to delete file "$1"?' 1=$filename}
<br><br>
<input type="button" class="button" onClick="window.close()" value="Cancel">
<input type="button" class="button" onClick="location.href='{$UI_HANDLER}?act=delete&id={$id}'" value="OK">
<input type="button" class="button" onClick="location.href='{$UI_HANDLER}?act=delete&id={$_REQUEST.id}'" value="OK">
</center>
</body>

View file

@ -1,2 +1,2 @@
style="cursor: pointer"
onClick="hidealttext(); return contextmenu('scheduleId={$i.scheduleid}&playlistId={$i.id}', 'SCHEDULER.removeItem')"
onClick="return contextmenu('scheduleId={$i.scheduleid}&playlistId={$i.id}', 'SCHEDULER.removeItem')"

View file

@ -25,10 +25,10 @@ onClick="return contextmenu('{$i.id}'
{if $_PL_activeId == $i.id}
, 'PL.release'
{elseif $PL->isAvailable($i.id) == true}
, 'PL.addItem', 'PL.activate', 'delete'
, 'SCHEDULER.addPL', 'PL.addItem', 'PL.activate', 'delete'
{/if}
{elseif $PL->isAvailable($i.id) == true}
, 'PL.activate', 'PL.create', 'delete'
, 'SCHEDULER.addPL', 'PL.activate', 'PL.create', 'delete'
{/if}
{/if}
)"

View file

@ -50,19 +50,20 @@
Pheight = window.innerHeight;
}
url = url + '&is_popup=1';
screenX = (Xpos + Pwidth/2 - width/2);
screenY = (Ypos + Pheight/2 - height/2);
url = url + '&is_popup=1';
arg = 'width='+width+', height='+height+', scrollbars=no, menubar=no, depend=yes, left='+screenX+', top='+screenY;
popupwin = window.open(url, name, arg);
window.popupwin.focus();
}
function hpopup(url, name)
function hpopup(url)
{
var width = 160;
var height = 120;
var name = Math.random();
var screenX;
var screenY;
var Xpos;
@ -81,9 +82,10 @@
Pwidth = window.innerWidth;
Pheight = window.innerHeight;
}
url = url + '&is_popup=1';
screenX = (Xpos + Pwidth/2 - width/2);
screenY = (Ypos + Pheight/2 - height/2);
url = url + '&is_popup=1';
arg = 'width='+width+', height='+height+', scrollbars=no, menubar=no, depend=yes, left='+screenX+', top='+screenY;
popupwin = window.open(url, name, arg);

View file

@ -21,35 +21,42 @@ function pre0_incClock() {
}
function elapsed_myClock(y, m, d, h, i, s, interval) {
elapsed_clock = new Array();
elapsed_clock['interval'] = interval;
elapsed_clock['time'] = new Date(y, m, d, h, i, s);
elapsed_clock['run'] = setInterval("elapsed_incClock();", elapsed_clock['interval']);
function myClock(eh, ei, es, dh, di, ds, next, interval) {
clock = new Array();
clock['next'] = next;
clock['interval'] = interval;
clock['correction'] = new Date();
//clock['correction'].setTime(0);
//clock['corr_h'] = clock['correction'].getHours();
clock['elapsed'] = new Date();
clock['duration'] = new Date();
clock['remaining'] = new Date();
clock['elapsed'].setTime(Date.UTC(1970, 0, 1, eh, ei, es));
clock['duration'].setTime(Date.UTC(1970, 0, 1, dh, di, ds));
clock['run'] = setInterval("incClock();", clock['interval']);
}
function elapsed_incClock() {
elapsed_clock['time'].setTime(elapsed_clock['time'].getTime() + elapsed_clock['interval']);
document.getElementById("statusbar_elapsed").innerHTML = twoDigit(elapsed_clock['time'].getHours()) + ":" + twoDigit(elapsed_clock['time'].getMinutes()) + ":" + twoDigit(elapsed_clock['time'].getSeconds());
function incClock() {
if (clock['remaining'].getTime() <= clock['interval']) stopClock();
clock['elapsed'].setTime(clock['elapsed'].getTime() + clock['interval']);
clock['remaining'].setTime(clock['duration'].getTime() - clock['elapsed'].getTime());
document.getElementById("statusbar_elapsed").innerHTML = twoDigit(clock['elapsed'].getUTCHours()) + ":" + twoDigit(clock['elapsed'].getUTCMinutes()) + ":" + twoDigit(clock['elapsed'].getUTCSeconds());
document.getElementById("statusbar_remaining").innerHTML = twoDigit(clock['remaining'].getUTCHours()) + ":" + twoDigit(clock['remaining'].getUTCMinutes()) + ":" + twoDigit(clock['remaining'].getUTCSeconds());
document.getElementById("statusbar_scala").style.width = (100 / clock['duration'].getTime() * clock['elapsed'].getTime()) + "%";
}
function stopClock() {
clearInterval(clock['run']);
function remaining_myClock(y, m, d, h, i, s, interval) {
remaining_clock = new Array();
remaining_clock['interval'] = interval;
remaining_clock['time'] = new Date(y, m, d, h, i, s);
remaining_clock['run'] = setInterval("remaining_incClock();", remaining_clock['interval']);
}
function remaining_incClock() {
remaining_clock['time'].setTime(remaining_clock['time'].getTime() - remaining_clock['interval']);
document.getElementById("statusbar_remaining").innerHTML = twoDigit(remaining_clock['time'].getHours()) + ":" + twoDigit(remaining_clock['time'].getMinutes()) + ":" + twoDigit(remaining_clock['time'].getSeconds());
if (remaining_clock['time'].getHours() == 0 && remaining_clock['time'].getMinutes() == 0 && remaining_clock['time'].getSeconds() == 0) {
clearInterval(elapsed_clock['run']);
clearInterval(remaining_clock['run']);
if (clock['next'] == 0) {
// just if no next item to play
document.getElementById("statusbar_indicator").innerHTML = '<img src="img/el_offair.gif" alt="off air">';
document.getElementById("statusbar_whatsplaying").innerHTML = '';
document.getElementById("statusbar_whatsplaying").innerHTML = "";
}
}
@ -58,8 +65,7 @@ function remaining_incClock() {
pre0_myClock({$smarty.now|date_format:"%Y, %m, %d, %H, %M, %S"}, 1000);
{if (is_array($_nowplaying.duration))}
elapsed_myClock ({$smarty.now|date_format:"%Y, %m, %d"}, {$_nowplaying.elapsed.h}, {$_nowplaying.elapsed.m}, {$_nowplaying.elapsed.s|truncate:2:""}, 100);
remaining_myClock({$smarty.now|date_format:"%Y, %m, %d"}, {$_nowplaying.remaining.h}, {$_nowplaying.remaining.m}, {$_nowplaying.remaining.s|truncate:2:""}, 100);
myClock ({$_nowplaying.elapsed.h}, {$_nowplaying.elapsed.m}, {$_nowplaying.elapsed.s|truncate:2:""}, {$_nowplaying.duration.h}, {$_nowplaying.duration.m}, {$_nowplaying.duration.s|truncate:2:""}, {if is_array($_nextplaying)}1{else}0{/if}, 333);
{/if}
</script>

View file

@ -29,7 +29,7 @@
switch (contextmenu.arguments[i]) {
{/literal}
case "PL.release":
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: popup('{$UI_BROWSER}?popup[]=PL.confirmRelease', 'PL.confirmRelease', 400, 50)\" "+oF+">&nbsp;##Close playlist##&nbsp;</a></li>";
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: popup('{$UI_BROWSER}?popup[]=PL.confirmRelease', 'PL.confirmRelease', 400, 50)\" "+oF+">&nbsp;##Close Playlist##&nbsp;</a></li>";
break;
case "PL.addItem":
@ -86,13 +86,21 @@
break;
case "SCHEDULER.addItem":
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: hpopup('{$UI_HANDLER}?act=SCHEDULER.setScheduleTime&"+param+"'); popup('{$UI_BROWSER}?popup[]=SCHEDULER.addItem', 'Schedule', 420, 200)\" "+oF+">&nbsp;##Insert Playlist here##&nbsp;</a></li>";
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: hpopup('{$UI_HANDLER}?act=SCHEDULER.setScheduleAtTime&"+param+"'); popup('{$UI_BROWSER}?popup[]=SCHEDULER.addItem', 'Schedule', 420, 200)\" "+oF+">&nbsp;##Insert Playlist here##&nbsp;</a></li>";
break;
case "SCHEDULER.removeItem":
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: popup('{$UI_BROWSER}?popup[]=SCHEDULER.removeItem&"+param+"', 'Schedule', 400, 50)\" "+oF+">&nbsp;##Remove Playlist##&nbsp;</a></li>";
break;
case "SCHEDULER.addPL":
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=day&today=1');"+
"hpopup('{$UI_HANDLER}?act=SCHEDULER.setScheduleAtTime&today=1&hour=0&minute=0');"+
"location.href='ui_browser.php?act=SCHEDULER';"+
"popup('{$UI_BROWSER}?popup[]=SCHEDULER.addItem&playlistId="+param+"', 'Schedule', 420, 200)\" "+oF+
">&nbsp;##Schedule Playlist##&nbsp;</a></li>";
break;
case "SUBJECTS.chgPasswd":
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href='{$UI_BROWSER}?act=SUBJECTS.chgPasswd&"+param+"' "+oF+">&nbsp;##Change password##&nbsp;</a></li>";
break;

View file

@ -39,7 +39,7 @@
<!-- start what playing -->
<div class="whatplaying" id="statusbar_whatsplaying">
{if $_nowplaying}
<div class="nowplaying">Now Playing: {$_nowplaying.title}</div>
<div class="nowplaying">Now Playing: {$_nowplaying.title|truncate:33}</div>
<div class="scala">
<div class="scala_in" id="statusbar_scala" style="width: {$_nowplaying.percentage}%;">&nbsp;</div>
</div>
@ -50,7 +50,7 @@
{/if}
<div class="clearer"></div>
{if $_nextplaying}
<p>Playing Next: {$_nextplaying.title} {$_nextplaying.duration|truncate:8:""}</p>
<p>Playing Next: {$_nextplaying.title|truncate:22} {$_nextplaying.duration.h}:{$_nextplaying.duration.m}:{$_nextplaying.duration.s|truncate:2:""}</p>
{/if}
</div>
<!-- end what playing -->

View file

@ -26,10 +26,10 @@ onClick="return contextmenu('{$i.id}'
{if $_PL_activeId == $i.id}
, 'PL.release'
{else}
, 'PL.addItem', 'delete'
, 'SCHEDULER.addPL', 'PL.addItem', 'delete'
{/if}
{else}
, 'PL.activate', 'PL.create', 'delete'
, 'SCHEDULER.addPL', 'PL.activate', 'PL.create', 'delete'
{/if}
{/if}

View file

@ -77,6 +77,13 @@ function _getNumArr($start, $end, $step=1)
}
function _getLanguages()
{
global $config;
return $config['languages'];
}
/**
* uiBase class
*

View file

@ -73,7 +73,6 @@ class uiBrowser extends uiBase {
function login(&$mask)
{
$form = new HTML_QuickForm('login', UI_STANDARD_FORM_METHOD, UI_HANDLER);
#$form->setRequiredNote(file_get_contents(UI_QFORM_REQUIREDNOTE));
$this->_parseArr2Form($form, $mask['languages']);
$this->_parseArr2Form($form, $mask['login']);
@ -274,6 +273,8 @@ class uiBrowser extends uiBase {
*
* Get file's metadata as XML
*
* Note: this does not work right with multiple languages
*
* @param id int, local id of stored file
* @return array
*/
@ -297,10 +298,15 @@ class uiBrowser extends uiBase {
$handler =& new XML_Unserializer;
$handler->unserialize($this->getMdata($id));
$arr = $handler->getUnserializedData();
if (!is_array($arr))
return FALSE;
if (!is_array($arr)) return FALSE;
foreach ($arr['metadata'] as $key=>$val) {
if (is_array($val)) { ## just workaround
$val = current($val);
}
if ($relations[$key]) {
unset($arr['metadata'][$key]);
$arr['metadata'][$relations[tra($key)]] = $val;
@ -326,7 +332,7 @@ class uiBrowser extends uiBase {
include dirname(__FILE__).'/formmask/metadata.inc.php';
extract ($parms);
$langid = $langid ? $langid : UI_DEFAULT_LANGID;
$langid = $langid ? $langid : $this->langid;
$form = new HTML_QuickForm('langswitch', UI_STANDARD_FORM_METHOD, UI_BROWSER);
$this->_parseArr2Form($form, $mask['langswitch']);

View file

@ -44,6 +44,10 @@ define('UI_MDATA_KEY_DURATION', 'dcterms:extent');
define('UI_MDATA_KEY_URL', 'ls:url');
define('UI_MDATA_KEY_FORMAT', 'dc:format');
define('UI_MDATA_KEY_DESCRIPTION', 'dc:description');
define('UI_MDATA_KEY_CHANNELS', 'ls:channels');
define('UI_MDATA_KEY_SAMPLERATE', 'ls:samplerate');
define('UI_MDATA_KEY_BITRATE', 'ls:bitrate');
define('UI_MDATA_KEY_ENCODER', 'ls:encoder');
define('UI_MDATA_VALUE_FORMAT_FILE', 'File');
define('UI_MDATA_VALUE_FORMAT_STREAM', 'live stream');
@ -89,6 +93,33 @@ define('UI_PL_ELEM_FADEOUT', 'fadeOut');
## LS stuff
require_once dirname(__FILE__).'/../../storageServer/var/conf.php';
## extent config
$config = array_merge($config,
array(
'file_types' => array(
'.mp3',
'.wav',
'.ogg'
),
'stream_types' => array(
'application/ogg',
'audio/mpeg'
),
'languages' => array(
'ar_JO' => 'Arabic(JO)',
'am_AM' => 'Armenian(AM)',
'en_GB' => 'English (GB)',
'en_US' => 'English (US)',
'es_CO' => 'Español (CO)',
'cz_CZ' => 'Česky (CZ)',
'de_DE' => 'Deutsch (DE)',
'hu_HU' => 'Magyar (HU)',
'nl_NL' => 'Nederlands (NL)',
'sr_CS' => 'Srpski (CS)',
'ru_RU' => 'Russia(RU)'
),
)
);
require_once dirname(__FILE__).'/ui_base.inc.php';
require_once dirname(__FILE__).'/ui_scratchpad.class.php';
require_once dirname(__FILE__).'/ui_playlist.class.php';
@ -108,20 +139,4 @@ require_once 'HTML/QuickForm.php';
#PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'errCallBack');
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
#PEAR::setErrorHandling(PEAR_ERROR_PRINT);
## extent config
$config = array_merge($config,
array(
'file_types' => array(
'.mp3',
'.wav',
'.ogg'
),
'stream_types' => array(
'application/ogg',
'audio/mpeg'
)
)
);
?>

View file

@ -97,50 +97,6 @@ class uiHandler extends uiBase {
}
// --- files ---
/**
* uploadFileM
*
* Provides file upload and store it to the storage
*
* @param filename string, name for the uploaded file
* @param mediafile file uploded by HTTP, raw binary media file
* @param mdatafile file uploded by HTTP, metadata XML file
* @param id int, destination folder id
*/
function uploadFileM(&$formdata, $id, &$mask)
{
if (!$this->_isFolder($id)) {
$this->_retMsg('Target is not Folder');
$this->redirUrl = UI_BROWSER.'?act=fileList&id='.$id;
return FALSE;
}
if (!$this->_validateForm($formdata, $mask)) {
$this->redirUrl = UI_BROWSER."?act=uploadFileM&id=".$id;
return FALSE;
}
$tmpgunid = md5(microtime().$_SERVER['SERVER_ADDR'].rand()."org.mdlf.livesupport");
$ntmp = $this->gb->bufferDir.'/'.$tmpgunid;
move_uploaded_file($formdata['mediafile']['tmp_name'], $ntmp);
chmod($ntmp, 0664);
if($formdata['mdatafile']['tmp_name']){
$mdtmp = "$ntmp.xml";
if(move_uploaded_file($formdata['mdatafile']['tmp_name'], $mdtmp)){
chmod($mdtmp, 0664);
}
}
$r = $this->gb->putFile($id, $formdata['mediafile']['name'], $ntmp, $mdtmp, $this->sessid);
@unlink($ntmp);
@unlink($mdtmp);
if(PEAR::isError($r)) {
$this->_retMsg($r->getMessage());
$this->redirUrl = UI_BROWSER."?act=uploadFileM&id=".$id;
return FALSE;
}
$this->redirUrl = UI_BROWSER."?act=fileList&id=".$id;
return $r;
}
/**
* uploadFile
*
@ -213,6 +169,13 @@ class uiHandler extends uiBase {
$this->_setMdataValue($id, UI_MDATA_KEY_DURATION, $this->gb->_secsToPlTime($ia['playtime_seconds']));
$this->_setMDataValue($id, UI_MDATA_KEY_FORMAT, UI_MDATA_VALUE_FORMAT_FILE);
// some data from raw audio
if ($ia['audio']['channels']) $this->_setMDataValue($id, UI_MDATA_KEY_CHANNELS, $ia['audio']['channels']);
if ($ia['audio']['sample_rate'])$this->_setMDataValue($id, UI_MDATA_KEY_SAMPLERATE, $ia['audio']['sample_rate']);
if ($ia['audio']['bitrate']) $this->_setMDataValue($id, UI_MDATA_KEY_BITRATE, $ia['audio']['bitrate']);
if ($ia['audio']['codec']) $this->_setMDataValue($id, UI_MDATA_KEY_ENCODER, $ia['audio']['codec']);
// from id3 Tags
foreach ($mask['pages'] as $key=>$val) {
foreach ($mask['pages'][$key] as $k=>$v) {
if ($v['id3'] != FALSE) {

View file

@ -4,7 +4,7 @@ class uiScheduler extends uiCalendar
function uiScheduler(&$uiBase)
{
$this->curr =& $_SESSION[UI_CALENDAR_SESSNAME]['current'];
$this->scheduleAt =& $_SESSION[UI_CALENDAR_SESSNAME]['scheduleAt'];
$this->scheduleAtTime =& $_SESSION[UI_CALENDAR_SESSNAME]['scheduleAtTime'];
$this->schedulePrev =& $_SESSION[UI_CALENDAR_SESSNAME]['schedulePrev'];
$this->scheduleNext =& $_SESSION[UI_CALENDAR_SESSNAME]['scheduleNext'];
@ -44,10 +44,10 @@ class uiScheduler extends uiCalendar
function set($arr)
{
extract($arr);
#print_r($arr);
if (isset($view)) $this->curr['view'] = $view;
if (is_numeric($year)) $this->curr['year'] = $year;
if (isset($view)) $this->curr['view'] = $view;
if (isset($today)) list($year, $month, $day) = explode("-", strftime("%Y-%m-%d"));
if (is_numeric($year)) $this->curr['year'] = sprintf('%04d', $year);
if (is_numeric($month)) $this->curr['month'] = sprintf('%02d', $month);
if (is_numeric($day)) $this->curr['day'] = sprintf('%02d', $day);
if (is_numeric($hour)) $this->curr['hour'] = sprintf('%02d', $hour);
@ -55,21 +55,12 @@ class uiScheduler extends uiCalendar
$stampNow = $this->_datetime2timestamp($this->curr['year'].$this->curr['month'].$this->curr['day'].'T'.$this->curr['hour'].':00:00');
$stampTarget = $stampNow;
if ($month==='++')
$stampTarget = strtotime("+1 month", $stampNow);
if ($month==='--')
$stampTarget = strtotime("-1 month", $stampNow);
if ($week==='++')
$stampTarget = strtotime("+1 week", $stampNow);
if ($week==='--')
$stampTarget = strtotime("-1 week", $stampNow);
if ($day==='++')
$stampTarget = strtotime("+1 day", $stampNow);
if ($day==='--')
$stampTarget = strtotime("-1 day", $stampNow);
if ($today)
$stampTarget = time();
if ($month==='++') $stampTarget = strtotime("+1 month", $stampNow);
if ($month==='--') $stampTarget = strtotime("-1 month", $stampNow);
if ($week==='++') $stampTarget = strtotime("+1 week", $stampNow);
if ($week==='--') $stampTarget = strtotime("-1 week", $stampNow);
if ($day==='++') $stampTarget = strtotime("+1 day", $stampNow);
if ($day==='--') $stampTarget = strtotime("-1 day", $stampNow);
$this->curr['year'] = strftime("%Y", $stampTarget);
$this->curr['month'] = strftime("%m", $stampTarget);
@ -87,29 +78,44 @@ class uiScheduler extends uiCalendar
}
function setScheduleAt($arr)
/**
* setScheduleAtTime
*
* set the schedule time given by parameters,
* calculate previous and next clip to snap with it
*
* @param input array, contains date and time
* @return void
*/
function setScheduleAtTime($arr)
{
extract($arr);
#print_r($arr);
if (is_numeric($year)) $this->scheduleAt['year'] = $year;
if (is_numeric($month)) $this->scheduleAt['month'] = sprintf('%02d', $month);
if (is_numeric($day)) $this->scheduleAt['day'] = sprintf('%02d', $day);
if (is_numeric($hour)) $this->scheduleAt['hour'] = sprintf('%02d', $hour);
if (is_numeric($minute)) $this->scheduleAt['minute'] = sprintf('%02d', $minute);
if (is_numeric($second)) $this->scheduleAt['second'] = sprintf('%02d', $second);
if (isset($today)) list($year, $month, $day) = explode("-", strftime("%Y-%m-%d"));
if (is_numeric($year)) $this->scheduleAtTime['year'] = sprintf('%04d', $year);
if (is_numeric($month)) $this->scheduleAtTime['month'] = sprintf('%02d', $month);
if (is_numeric($day)) $this->scheduleAtTime['day'] = sprintf('%02d', $day);
if (is_numeric($hour)) $this->scheduleAtTime['hour'] = sprintf('%02d', $hour);
if (is_numeric($minute)) $this->scheduleAtTime['minute'] = sprintf('%02d', $minute);
if (is_numeric($second)) $this->scheduleAtTime['second'] = sprintf('%02d', $second);
$this->scheduleAtTime['stamp'] = $this->_datetime2timestamp($this->scheduleAtTime['year'].$this->scheduleAtTime['month'].$this->scheduleAtTime['day'].'T'.
$this->scheduleAtTime['hour'].':'.$this->scheduleAtTime['minute'].':'.$this->scheduleAtTime['second']);
$week = $this->getWeekEntrys();
## search for previous entry
if (count($week[$this->scheduleAt['day']]) >= 1) {
foreach (array_reverse($week[$this->scheduleAt['day']]) as $entry) {
if (strtotime($entry[0]['end']) <= strtotime($this->scheduleAt['hour'].':'.$this->scheduleAt['minute'].':'.$this->scheduleAt['second'])) {
if (count($week[$this->scheduleAtTime['day']]) >= 1) {
foreach (array_reverse($week[$this->scheduleAtTime['day']]) as $hourly) {
foreach (array_reverse($hourly) as $entry) {
if ($entry['end_stamp'] <= $this->scheduleAtTime['stamp']) {
$prev = TRUE;
list ($this->schedulePrev['hour'], $this->schedulePrev['minute'], $this->schedulePrev['second'])
= explode (':', strftime('%H:%M:%S', strtotime('+'.UI_SCHEDULER_PAUSE_PL2PL, strtotime($entry[0]['end'])))
list ($this->schedulePrev['hour'], $this->schedulePrev['minute'], $this->schedulePrev['second']) =
explode (':', strftime('%H:%M:%S', strtotime('+'.UI_SCHEDULER_PAUSE_PL2PL, strtotime($entry['end'])))
);
break;
break 2;
}
}
}
}
@ -123,26 +129,28 @@ class uiScheduler extends uiCalendar
reset ($week);
## search for next entry
if (count($week[$this->scheduleAt['day']]) >= 1) {
foreach ($week[$this->scheduleAt['day']] as $entry) {
if (strtotime($entry[0]['start']) >= strtotime($this->scheduleAt['hour'].':'.$this->scheduleAt['minute'].':'.$this->scheduleAt['second'])) {
if (count($week[$this->scheduleAtTime['day']]) >= 1) {
foreach ($week[$this->scheduleAtTime['day']] as $hourly) {
foreach (array_reverse($hourly) as $entry) {
if ($entry['start_stamp'] >= $this->scheduleAtTime['stamp']) {
$next = TRUE;
list ($this->scheduleNext['hour'], $this->scheduleNext['minute'], $this->scheduleNext['second'])
= explode (':', strftime('%H:%M:%S', strtotime('-'.UI_SCHEDULER_PAUSE_PL2PL, strtotime($entry[0]['start']))));
break;
list ($this->scheduleNext['hour'], $this->scheduleNext['minute'], $this->scheduleNext['second']) =
explode (':', strftime('%H:%M:%S', strtotime('-'.UI_SCHEDULER_PAUSE_PL2PL, strtotime($entry['start']))));
break 2;
}
}
}
}
if ($next !== TRUE) {
## end at midnight
$thisDay = $this->scheduleAt['year']."-".$this->scheduleAt['month']."-".$this->scheduleAt['day'];
## end one sec. before midnight
$thisDay = $this->scheduleAtTime['year']."-".$this->scheduleAtTime['month']."-".$this->scheduleAtTime['day'];
$nextDayStamp = strtotime('+1 day', $thisDay);
$this->scheduleNext['year'] = strftime('%Y', $nextDayStamp);
$this->scheduleNext['month'] = strftime('%m', $nextDayStamp);;
$this->scheduleNext['day'] = strftime('%d', $nextDayStamp);
$this->scheduleNext['hour'] = 0;
$this->scheduleNext['minute'] = 0;
$this->scheduleNext['second'] = 0;
$this->scheduleNext['hour'] = 23;
$this->scheduleNext['minute'] = 59;
$this->scheduleNext['second'] = 59;
}
#print_r($this->schedulePrev);
@ -169,6 +177,8 @@ class uiScheduler extends uiCalendar
'scheduleid'=> $val['id'],
'start' => substr($val['start'], strpos($val['start'], 'T')+1),
'end' => substr($val['end'], strpos($val['end'], 'T')+1),
'start_stamp' => $this->_datetime2timestamp($val['start']),
'end_stamp' => $this->_datetime2timestamp($val['end']),
'title' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_TITLE),
'creator' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_CREATOR),
'type' => 'Playlist'
@ -257,58 +267,6 @@ class uiScheduler extends uiCalendar
}
/*
function getDayTiming($year, $month, $day)
{
#echo $year.$month.$day;
$day_start = $this->_datetime2timestamp($year.$month.$day.'T00:00:00');
$day_end = $this->_datetime2timestamp($year.$month.$day.'T23:59:59');
if (!$arr = $this->getDayUsage($year, $month, $day))
return array(array( ## empty day
'type' => 'gap',
'length' => $day_end - $day_start
));
$curr = current($arr);
if ($this->_strtotime($curr['start']) > $day_start) ## insert gap if first entry start after 00:00:00
$list[] = array(
'type' => 'gap',
#'pos' => 0,
'length' => $this->_strtotime($curr['start']) - $day_start
);
while ($curr = current($arr)) {
$list[] = array(
'type' => 'entry',
#'pos' => $this->_strtotime($curr['start']) - $day_start,
'length' => $this->_strtotime($curr['end']) - $this->_strtotime($curr['start']),
'entry' => $curr
);
if ($next = next($arr)) {
if ($this->_strtotime($next['start']) > $this->_strtotime($curr['end'])+1) ## insert gap between entrys
$list[] = array(
'type' => 'gap',
#'pos' => $this->_strtotime($curr['start'])-$day_start,
'length' => $this->_strtotime($next['start']) - $this->_strtotime($curr['end']),
);
}
else {
if ($this->_strtotime($curr['end']) < $day_end) ## insert gap if prev entry was not until midnight
$list[] = array(
'type' => 'gap',
#'pos' => $this->_strtotime($curr['end']) - $day_start,
'length' => $day_end - $this->_strtotime($curr['end']),
);
}
}
#print_r($list);
return $list;
}
*/
function getDayTimingScale()
{
for ($n = 0; $n <= 23; $n++) {
@ -331,13 +289,13 @@ class uiScheduler extends uiCalendar
$form = new HTML_QuickForm('schedule', UI_STANDARD_FORM_METHOD, UI_HANDLER);
$this->Base->_parseArr2Form($form, $ui_fmask['schedule']);
$settime = array('H' => $this->scheduleAt['hour'],
'i' => $this->scheduleAt['minute'],
's' => $this->scheduleAt['second']
$settime = array('H' => $this->scheduleAtTime['hour'],
'i' => $this->scheduleAtTime['minute'],
's' => $this->scheduleAtTime['second']
);
$setdate = array('Y' => $this->scheduleAt['year'],
'm' => $this->scheduleAt['month'],
'd' => $this->scheduleAt['day']
$setdate = array('Y' => $this->scheduleAtTime['year'],
'm' => $this->scheduleAtTime['month'],
'd' => $this->scheduleAtTime['day']
);
$form->setDefaults(array('time' => $settime,
'date' => $setdate,
@ -351,8 +309,23 @@ class uiScheduler extends uiCalendar
}
function getPLtoSchedule($id)
{
if ($id) {
$this->Base->SCRATCHPAD->addItem($id);
$this->availablePlaylists[] = array(
'gunid' => $this->Base->gb->_gunidFromId($id),
'title' => $this->Base->_getMDataValue($id, UI_MDATA_KEY_TITLE),
'duration' => $this->Base->_getMDataValue($id, UI_MDATA_KEY_DURATION),
);
return TRUE;
} else {
return $this->copyPLfromSP();
}
function copyPlFromSP()
}
function copyPlfromSP()
{
foreach ($this->Base->SCRATCHPAD->get() as $val) {
if ($val['type'] === 'playlist' && $this->Base->gb->playlistIsAvailable($val['id'], $this->Base->sessid) === TRUE && $val['id'] != $this->Base->PLAYLIST->activeId)
@ -374,7 +347,7 @@ class uiScheduler extends uiCalendar
if (!is_array($pl) || !count($pl)) return FALSE;
$pl = current($pl);
$offset = strftime('%H:%M:%S', time() - $this->_datetime2timestamp($pl['start']) - 3600); ## subtract 3600 sec. becausefor some reason strftime('%H:%M:%S', 0) is 01:00:00
$offset = strftime('%H:%M:%S', time() - $this->_datetime2timestamp($pl['start']) - 3600 * strftime('%H', 0)); ## subtract difference to UTC
$clip = $this->Base->gb->displayPlaylistClipAtOffset($this->Base->sessid, $pl['playlistId'], $offset, $distance);