diff --git a/airtime_mvc/application/models/Playlist.php b/airtime_mvc/application/models/Playlist.php index 90ba846c6..e8f894575 100644 --- a/airtime_mvc/application/models/Playlist.php +++ b/airtime_mvc/application/models/Playlist.php @@ -190,7 +190,7 @@ EOT; $clipSec = Application_Model_Playlist::playlistTimeToSeconds($row['length']); $offset += $clipSec; - $offset_cliplength = Application_Model_Playlist::secondsToPlaylistTime($offset); + $offset_cliplength = Application_Common_DateHelper::secondsToPlaylistTime($offset); //format the length for UI. $formatter = new LengthFormatter($row['length']); diff --git a/airtime_mvc/application/models/Webstream.php b/airtime_mvc/application/models/Webstream.php index f5a58665b..a32f275b1 100644 --- a/airtime_mvc/application/models/Webstream.php +++ b/airtime_mvc/application/models/Webstream.php @@ -2,34 +2,52 @@ class Application_Model_Webstream{ - public static function getName(){ + public static function getName() + { return "Default"; } - public static function getId(){ + public static function getId() + { return "id"; } - public static function getLastModified($p_type){ + public static function getLastModified($p_type) + { return "modified"; } - public static function getDefaultLength(){ + public static function getDefaultLength() + { return "length"; } - public static function getDescription(){ + public static function getDescription() + { return "desc"; } - public static function save($request){ + public static function save($request) + { Logging::log($request->getParams()); + $userInfo = Zend_Auth::getInstance()->getStorage()->read(); + Logging::log($userInfo); + + $length = trim($request->getParam("length")); + preg_match("/^([0-9]{1,2})h ([0-5][0-9])m$/", $length, $matches); + $hours = $matches[1]; + $minutes = $matches[2]; + $di = new DateInterval("PT{$hours}H{$minutes}M"); + $dblength = $di->format("%H:%I"); + + #TODO: These should be validated by a Zend Form. $webstream = new CcWebstream(); $webstream->setDbName($request->getParam("name")); $webstream->setDbDescription($request->getParam("description")); $webstream->setDbUrl($request->getParam("url")); - $webstream->setDbLength("00:05:00"); - $webstream->setDbLogin("xxx"); + + $webstream->setDbLength($dblength); + $webstream->setDbLogin($userInfo->id); $webstream->setDbUtime(new DateTime()); $webstream->setDbMtime(new DateTime()); $webstream->save();