2012-07-18 03:07:57 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Application_Model_Webstream{
|
|
|
|
|
2012-07-26 00:41:52 +02:00
|
|
|
public static function getName()
|
|
|
|
{
|
2012-07-18 03:07:57 +02:00
|
|
|
return "Default";
|
|
|
|
}
|
|
|
|
|
2012-07-26 00:41:52 +02:00
|
|
|
public static function getId()
|
|
|
|
{
|
2012-07-18 03:07:57 +02:00
|
|
|
return "id";
|
|
|
|
}
|
|
|
|
|
2012-07-26 00:41:52 +02:00
|
|
|
public static function getLastModified($p_type)
|
|
|
|
{
|
2012-07-18 03:07:57 +02:00
|
|
|
return "modified";
|
|
|
|
}
|
|
|
|
|
2012-07-26 00:41:52 +02:00
|
|
|
public static function getDefaultLength()
|
|
|
|
{
|
2012-07-18 03:07:57 +02:00
|
|
|
return "length";
|
|
|
|
}
|
|
|
|
|
2012-07-26 00:41:52 +02:00
|
|
|
public static function getDescription()
|
|
|
|
{
|
2012-07-18 03:07:57 +02:00
|
|
|
return "desc";
|
|
|
|
}
|
2012-07-19 00:27:39 +02:00
|
|
|
|
2012-07-26 00:41:52 +02:00
|
|
|
public static function save($request)
|
|
|
|
{
|
2012-07-19 00:27:39 +02:00
|
|
|
Logging::log($request->getParams());
|
2012-07-26 00:41:52 +02:00
|
|
|
$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.
|
2012-07-19 00:27:39 +02:00
|
|
|
$webstream = new CcWebstream();
|
|
|
|
$webstream->setDbName($request->getParam("name"));
|
|
|
|
$webstream->setDbDescription($request->getParam("description"));
|
|
|
|
$webstream->setDbUrl($request->getParam("url"));
|
2012-07-26 00:41:52 +02:00
|
|
|
|
|
|
|
$webstream->setDbLength($dblength);
|
|
|
|
$webstream->setDbLogin($userInfo->id);
|
2012-07-27 20:47:15 +02:00
|
|
|
$webstream->setDbUtime(new DateTime("now", new DateTimeZone('UTC')));
|
|
|
|
$webstream->setDbMtime(new DateTime("now", new DateTimeZone('UTC')));
|
2012-07-19 00:27:39 +02:00
|
|
|
$webstream->save();
|
|
|
|
}
|
2012-07-18 03:07:57 +02:00
|
|
|
}
|