converting more of playlist.php to propel ORM.

This commit is contained in:
naomiaro 2010-11-08 17:19:01 -05:00
parent d5546c3952
commit 9f79b1bf89
20 changed files with 537 additions and 570 deletions

View file

@ -2,6 +2,12 @@
# NOTE: You have to load all classes that use session variables BEFORE you make a call to session_start()!!!
session_start();
// Initialize Propel with the runtime configuration
Propel::init(__DIR__."/../backend/propel-db/build/conf/campcaster-conf.php");
// Add the generated 'classes' directory to the include path
set_include_path(__DIR__."/../backend/propel-db/build/classes" . PATH_SEPARATOR . get_include_path());
// initialize objects ###############################################
$Smarty = new Smarty;
$Smarty->caching = false;
@ -22,14 +28,13 @@ $uiBase =& $uiBrowser;
$jscom = new jscom(array("jscom_wrapper"));
$jscom->handler();
// load Smarty+filters ##############################################
require_once(dirname(__FILE__).'/ui_smartyExtensions.inc.php');
//$Smarty->load_filter('output', 'trimwhitespace');
//$Smarty->load_filter('post', 'template_marker');
$Smarty->load_filter('output', 'localizer');
// some basic things ################################################
foreach (get_defined_constants() as $k=>$v) {
$Smarty->assign($k, $v);
@ -64,4 +69,4 @@ if (isset($_SESSION['retransferFormData']) && is_array($_SESSION['retransferForm
unset($_SESSION['retransferFormData']);
}
?>
?>

View file

@ -35,13 +35,13 @@ onClick="return contextmenu('{$i.id}' , '{$i.type}'
, 'SCHEDULER.addPL'
, 'PL.addItem'
, 'PL.activate'
, 'delete'
, 'PL.delete'
{/if}
{else}
, 'SCHEDULER.addPL'
, 'PL.activate'
, 'PL.create'
, 'delete'
, 'PL.delete'
, 'PL.export'
{/if}
{/if}

View file

@ -45,7 +45,7 @@ onClick="return contextmenu('{$i.id}'
, 'SCHEDULER.addPL'
, 'PL.activate'
, 'PL.create'
, 'delete'
, 'PL.delete'
, 'PL.export'
{/if}
{/if}

View file

@ -49,6 +49,10 @@ function contextmenu(param, type) {
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: hpopup('{$UI_HANDLER}?act=PL.activate&id="+param+"')\" "+oF+">&nbsp;##Edit##&nbsp;</a></li>";
break;
case "PL.delete":
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: hpopup('{$UI_HANDLER}?act=PL.delete&id="+param+"')\" "+oF+">&nbsp;##Delete##&nbsp;</a></li>";
break;
case "PL.create":
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: hpopup('{$UI_HANDLER}?act=PL.create&id="+param+"')\" "+oF+">&nbsp;##Use to create playlist##&nbsp;</a></li>";
break;

View file

@ -6,6 +6,7 @@ require_once(dirname(__FILE__).'/ui_browser.class.php');
require_once(dirname(__FILE__).'/ui_handler.class.php');
// often used classes ###############################################
require_once(dirname(__FILE__).'/../3rd_party/php/propel/runtime/lib/Propel.php');
require_once(dirname(__FILE__).'/../3rd_party/php/Smarty/libs/Smarty.class.php');
require_once(dirname(__FILE__).'/../3rd_party/php/pear/HTML/QuickForm/Renderer/ArraySmarty.php');
require_once(dirname(__FILE__).'/ui_scratchpad.class.php');
@ -28,4 +29,4 @@ if (isset($WHITE_SCREEN_OF_DEATH) && ($WHITE_SCREEN_OF_DEATH == TRUE)) {
}
?>
?>

View file

@ -403,6 +403,13 @@ switch ($_REQUEST['act']) {
}
$uiHandler->PLAYLIST->setReload();
break;
case "PL.delete":
if (($ui_tmpid = $uiHandler->PLAYLIST->delete($_REQUEST['id'])) !== FALSE) {
$uiHandler->SCRATCHPAD->removeItems($ui_tmpid);
}
$uiHandler->PLAYLIST->setReload();
break;
case "PL.export":
$uiHandler->redirUrl = UI_BROWSER."?popup[]=PL.redirect2DownloadExportedFile&id={$_REQUEST['id']}&playlisttype={$_REQUEST['playlisttype']}&exporttype={$_REQUEST['exporttype']}";
@ -436,7 +443,6 @@ switch ($_REQUEST['act']) {
$Smarty->assign("USER_ERROR", "Scheduling conflict.");
}
//$uiHandler->SCHEDULER->setReload();
$NO_REDIRECT = true;
$_REQUEST["act"] = "SCHEDULER";
include("ui_browser.php");

View file

@ -100,7 +100,7 @@ class uiPlaylist
return FALSE;
}
$res = $this->Base->gb->lockPlaylistForEdit($plid, $this->Base->sessid);
if (PEAR::isError($res)) {
if (PEAR::isError($res) || $res === FALSE) {
if (UI_VERBOSE === TRUE) {
print_r($res);
}
@ -130,7 +130,7 @@ class uiPlaylist
return FALSE;
}
$res = $this->Base->gb->releaseLockedPlaylist($this->activeId, $this->Base->sessid);
if (PEAR::isError($res)) {
if (PEAR::isError($res) || $res === FALSE) {
if (UI_VERBOSE === TRUE) {
print_r($res);
}
@ -438,7 +438,17 @@ class uiPlaylist
$this->Base->_retMsg('Cannot delete this playlist.');
return FALSE;
} // fn deleteActive
public function delete($id)
{
$res = $this->Base->gb->deletePlaylist($id);
if ($res === TRUE) {
return $id;
}
$this->Base->_retMsg('Cannot delete this playlist.');
return FALSE;
}
public function isAvailable($id)
{