propel changes for playlist.

This commit is contained in:
naomiaro 2010-11-11 20:48:53 -05:00
parent f7dc117417
commit e1b6ee8d46
4 changed files with 66 additions and 67 deletions

View File

@ -67,7 +67,8 @@ class Playlist {
// Create the StoredPlaylist object
$storedPlaylist = new Playlist();
$storedPlaylist->name = isset($p_values['filename']) ? $p_values['filename'] : date("H:i:s");
$storedPlaylist->mtime = new DateTime("now");
$tz = ini_get('date.timezone');
$storedPlaylist->mtime = new DateTime("now", new DateTimeZone($tz));
$pl = new CcPlaylist();
$pl->setDbName($storedPlaylist->name);
@ -131,7 +132,7 @@ class Playlist {
return FALSE;
$pl->setDbName($p_newname);
$pl->setDbMtime(new DateTime("now"));
$pl->setDbMtime(new DateTime("now", new DateTimeZone(ini_get('date.timezone'))));
$pl->save();
$this->name = $p_newname;
@ -174,7 +175,7 @@ class Playlist {
return FALSE;
$pl->setDbState($p_state);
$pl->setDbMtime(new DateTime("now"));
$pl->setDbMtime(new DateTime("now", new DateTimeZone(ini_get('date.timezone'))));
$eb = (!is_null($p_editedby) ? $p_editedby : NULL);
$pl->setDbEditedby($eb);
@ -929,12 +930,14 @@ class Playlist {
$row->setDbPlaylistId($plId);
$row->setDbFileId($fileId);
$row->setDbPosition($pos);
$row->save();
$row->setDbCliplength($clipLength);
$row->setDbCuein($cuein);
$row->setDbCueout($cueout);
$row->setDbFadein($fadeIn);
$row->setDbFadeout($fadeOut);
$row->save();
return TRUE;
}

View File

@ -16,14 +16,16 @@ require_once('Common.php');
class CcFiles extends BaseCcFiles {
public function getDbLength()
{
return Common::getTimeInSub($this, 'LENGTH');
}
{
return $this->length;
}
public function setDbLength($time)
{
return Common::setTimeInSub($this, 'LENGTH', $time);
}
public function setDbLength($time)
{
$this->length = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::LENGTH;
return Common::setTimeInSub($this, 'LENGTH', $time);
}
} // CcFiles

View File

@ -17,53 +17,63 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents {
public function getDbFadein()
{
return Common::getTimeInSub($this, 'FADEIN');
return $this->fadein;
}
public function setDbFadein($time)
{
return Common::setTimeInSub($this, 'FADEIN', $time);
}
{
$this->fadein = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN;
return Common::setTimeInSub($this, 'FADEIN', $time);
}
public function getDbFadeout()
{
return Common::getTimeInSub($this, 'FADEOUT');
}
{
return $this->fadeout;
}
public function setDbFadeout($time)
{
return Common::setTimeInSub($this, 'FADEOUT', $time);
}
{
$this->fadeout = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT;
return Common::setTimeInSub($this, 'FADEOUT', $time);
}
public function getDbCuein()
{
return Common::getTimeInSub($this, 'CUEIN');
}
{
return $this->cuein;
}
public function setDbCuein($time)
{
return Common::setTimeInSub($this, 'CUEIN', $time);
}
{
$this->cuein = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN;
return Common::setTimeInSub($this, 'CUEIN', $time);
}
public function getDbCueout()
{
return Common::getTimeInSub($this, 'CUEOUT');
}
{
return $this->cueout;
}
public function setDbCueout($time)
{
return Common::setTimeInSub($this, 'CUEOUT', $time);
}
public function setDbCueout($time)
{
$this->cueout = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT;
return Common::setTimeInSub($this, 'CUEOUT', $time);
}
public function getDbCliplength()
{
return Common::getTimeInSub($this, 'CLIPLENGTH');
}
{
return $this->cliplength;
}
public function setDbCliplength($time)
{
return Common::setTimeInSub($this, 'CLIPLENGTH', $time);
}
public function setDbCliplength($time)
{
$this->cliplength = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH;
return Common::setTimeInSub($this, 'CLIPLENGTH', $time);
}

View File

@ -4,32 +4,16 @@ class Common {
public static function setTimeInSub($row, $col, $time)
{
$class = get_class($row).'Peer';
$con = Propel::getConnection($class::DATABASE_NAME);
$class = get_class($row).'Peer';
$con = Propel::getConnection($class::DATABASE_NAME);
$sql = 'UPDATE '.$class::TABLE_NAME
. ' SET '.$col.' = :f1'
. ' WHERE ' .$class::ID. ' = :p1';
$stmt = $con->prepare($sql);
$stmt->bindValue(':f1', $time);
$stmt->bindValue(':p1', $row->getDbId());
$stmt->execute();
$sql = 'UPDATE '.$class::TABLE_NAME
. ' SET '.$col.' = :f1'
. ' WHERE ' .$class::ID. ' = :p1';
$stmt = $con->prepare($sql);
$stmt->bindValue(':f1', $time);
$stmt->bindValue(':p1', $row->getDbId());
$stmt->execute();
}
public static function getTimeInSub($row, $col)
{
$class = get_class($row).'Peer';
$con = Propel::getConnection($class::DATABASE_NAME);
$sql = 'SELECT '.$col
. ' FROM '.$class::TABLE_NAME
. ' WHERE ' .$class::ID. ' = :p1';
$stmt = $con->prepare($sql);
$stmt->bindValue(':p1', $row->getDbId());
$stmt->execute();
return $stmt->fetchColumn();
}
}