本文整理汇总了PHP中Zend_Date::setTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Date::setTimestamp方法的具体用法?PHP Zend_Date::setTimestamp怎么用?PHP Zend_Date::setTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Date
的用法示例。
在下文中一共展示了Zend_Date::setTimestamp方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDateFromTimestamp
/**
* @param $timestamp
*/
protected function setDateFromTimestamp($timestamp)
{
if (\Pimcore\Config::getFlag("useZendDate")) {
$this->date = new \Pimcore\Date($timestamp);
} else {
$this->date = new \Carbon\Carbon();
$this->date->setTimestamp($timestamp);
}
}
示例2: dateProvider
/**
* @return array
*
* @author Luke Rodgers <lukerodgers90@gmail.com>
*/
public function dateProvider()
{
$rowA = new Varien_Object(array('field' => '2015-01-06'));
$rowB = new Varien_Object(array('field' => '2015-01-08'));
$rowC = new Varien_Object(array('field' => '2015-01-10'));
$rowD = new Varien_Object();
$timestamp1 = new Zend_Date();
$timestamp1->setTimestamp(strtotime('2015-01-07'));
$timestamp2 = new Zend_Date();
$timestamp2->setTimestamp(strtotime('2015-01-09'));
return array(array(array($rowA, $rowB, $rowC, $rowD), array('field' => array(new Varien_Object(array('value' => array('date' => true, 'from' => $timestamp1, 'to' => $timestamp2))))), array($rowB)));
}
示例3: testShouldReturnTrueWhenCheckNotExpiredPayment
public function testShouldReturnTrueWhenCheckNotExpiredPayment()
{
//GIVEN
$oPurchase = AM_Model_Db_Table_Abstract::factory('purchase')->findOneBy(array('id' => 1));
$oDate = new Zend_Date();
$oDate->setTimestamp(time() + 3600000);
$oPurchase->expires_date = $oDate->toString('Y-m-d H:i:s');
$oPurchase->save();
//WHEN
$bResult = $oPurchase->isExpired();
//THEN
$this->assertFalse($bResult);
}
示例4: testSetTimestamp2
/**
* Test for setTimestamp
*/
public function testSetTimestamp2()
{
try {
$locale = new Zend_Locale('de_AT');
$date = new Zend_Date(0, null, $locale);
$result = $date->setTimestamp('notimestamp');
$this->Fail("exception expected");
} catch (Zend_Date_Exception $e) {
// success
}
}
示例5: _getMainSection
protected function _getMainSection()
{
try {
$list = array();
$markedRows = $this->_controller->getMarkedRows();
#Sitengine_Debug::print_r($markedRows);
$dir = $this->_controller->getTempDir();
if (is_dir($dir)) {
$dirIterator = new DirectoryIterator($dir);
$date = new Zend_Date(null, Zend_Date::ISO_8601, $this->_controller->getLocale());
$date->setTimezone($this->_controller->getPreferences()->getTimezone());
foreach ($dirIterator as $count => $file) {
if (is_file($dir . '/' . $file->getFilename()) && !preg_match('/^(\\.|\\.\\.|\\.DS_Store)$/', $file->getFilename())) {
$filename = $file->getFilename();
$id = 'item' . $count;
$size = round($file->getSize() / 1024 / 1024, 1);
if ($size >= 1) {
$size .= 'MB';
} else {
$size = round($file->getSize() / 1024, 0) . 'KB';
}
$date->setTimestamp($file->getCTime());
$udate = $date->get(Zend_Date::DATE_FULL) . ' ';
$udate .= $date->get(Zend_Date::TIME_FULL);
$p = 'SELECTROWITEM' . $id;
$s = sizeof($markedRows) && isset($markedRows[$id]) ? $this->_controller->getRequest()->getPost($p) : 0;
$e = new Sitengine_Form_Element($p, 1);
$e->setClass('listformCheckbox');
$checkbox = $e->getCheckbox($s);
$checkbox .= Sitengine_Form_Element::getHidden('FILENAME' . $id, $filename);
$n = 'type';
$p = 'UPDATEROWITEM' . $n . 'ITEMID' . $id;
$h = 'UPDATEROWITEMCURRENT' . $n . 'ITEMID' . $id;
$v = sizeof($markedRows) && isset($markedRows[$id]) ? $this->_controller->getRequest()->getPost($p) : Sitengine_Proto_Backend_Goodies_Shouldies_Controller::VALUE_NONESELECTED;
$e = new Sitengine_Form_Element($p, $v);
$e->setClass('listformSelect');
$type = $e->getSelect($this->_controller->getTranslate()->translateGroup('fieldValsType')->toArray());
$type .= Sitengine_Form_Element::getHidden($h, Sitengine_Proto_Backend_Goodies_Shouldies_Controller::VALUE_NONESELECTED);
$args = array(Sitengine_Env::PARAM_CONTROLLER => 'shouldiesUploads', Sitengine_Env::PARAM_FILE => $filename);
$uriDownload = $this->_controller->getFrontController()->getProtoPackage()->getDownloadHandler();
$uriDownload .= Sitengine_Controller_Request_Http::makeNameValueQuery($args);
$list[] = array('id' => $id, 'name' => $filename, 'size' => $size, 'udate' => $udate, 'rowSelectCheckbox' => $checkbox, 'type' => $type, 'uriDownload' => $uriDownload, 'isMarked' => isset($markedRows[$id]) ? $markedRows[$id] : 0);
}
}
}
#Sitengine_Debug::print_r($list);
########################################################################
#### PAGER DATA
#######################################################################
$pagerData = array('hiddens' => '', 'currPageInput' => '', 'currPage' => 1, 'nextPage' => 1, 'prevPage' => 1, 'numPages' => 1, 'numItems' => sizeof($list), 'firstItem' => 1, 'lastItem' => sizeof($list), 'uriPrevPage' => '', 'uriNextPage' => '');
########################################################################
#### URIS
########################################################################
$args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
$route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_SHOULDIES_UPLOAD);
$uriDoBatchUnlink = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
$args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
$route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_SHOULDIES_ASSIGN);
$uriDoBatchAssign = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
$uris = array('submitDoBatchAssign' => $uriDoBatchAssign, 'submitDoBatchUnlink' => $uriDoBatchUnlink);
########################################################################
#### METHODS
########################################################################
$methods = array('doBatchUnlink' => Sitengine_Env::METHOD_DELETE, 'doBatchAssign' => Sitengine_Env::METHOD_POST);
########################################################################
#### COLLECT ALL DATA
########################################################################
$hiddens = array(Sitengine_Env::PARAM_METHOD => '');
foreach ($hiddens as $k => $v) {
$hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
}
return array('hiddens' => implode('', $hiddens), 'title' => $this->_controller->getTranslate()->translate('assignViewAssignFormTitle'), 'URIS' => $uris, 'METHODS' => $methods, 'DATA' => $list, 'PAGER' => $pagerData);
} catch (Exception $exception) {
require_once 'Sitengine/Proto/Backend/Goodies/Shouldies/Exception.php';
throw new Sitengine_Proto_Backend_Goodies_Shouldies_Exception('list page error', $exception);
}
}
示例6: detailAction
/**
* details der bestellung anzeigen
*/
public function detailAction()
{
// init
$order = Object_OnlineShopOrder::getById($this->getParam('id'));
/* @var OnlineShop_Framework_AbstractOrder $order */
$orderAgent = $this->view->orderAgent = $this->orderManager->createOrderAgent($order);
/**
* @param array $address
*
* @return string
*/
$geoPoint = function (array $address) {
# https://developers.google.com/maps/documentation/geocoding/index?hl=de#JSON
$url = sprintf('http://maps.googleapis.com/maps/api/geocode/json?address=%1$s&sensor=false', urlencode($address[0] . ' ' . $address[1] . ' ' . $address[2] . ' ' . $address[3]));
$json = json_decode(file_get_contents($url));
return $json->results[0]->geometry->location;
};
// get geo point
$this->view->geoAddressInvoice = $geoPoint([$order->getCustomerStreet(), $order->getCustomerZip(), $order->getCustomerCity(), $order->getCustomerCountry()]);
if ($order->getDeliveryStreet() && $order->getDeliveryZip()) {
$this->view->geoAddressDelivery = $geoPoint([$order->getDeliveryStreet(), $order->getDeliveryZip(), $order->getDeliveryCity(), $order->getDeliveryCountry()]);
}
// get customer info
if ($order->getCustomer()) {
// init
$arrCustomerAccount = [];
$customer = $order->getCustomer();
// register
$register = new Zend_Date($order->getCreationDate());
$arrCustomerAccount['created'] = $register->get(Zend_Date::DATE_MEDIUM);
// mail
if (method_exists($customer, 'getEMail')) {
$arrCustomerAccount['email'] = $customer->getEMail();
}
// order count
$addOrderCount = function () use($customer, $arrCustomerAccount) {
$order = new Object_OnlineShopOrder();
$field = $order->getClass()->getFieldDefinition('customer');
if ($field instanceof \Pimcore\Model\Object\ClassDefinition\Data\Href) {
if (count($field->getClasses()) == 1) {
$class = 'Pimcore\\Model\\Object\\' . reset($field->getClasses())['classes'];
/* @var \Pimcore\Model\Object\Concrete $class */
$orderList = $this->orderManager->createOrderList();
$orderList->joinCustomer($class::classId());
$orderList->getQuery()->where('customer.o_id = ?', $customer->getId());
$arrCustomerAccount['orderCount'] = $orderList->count();
}
}
};
$addOrderCount();
$this->view->arrCustomerAccount = $arrCustomerAccount;
}
// create timeline
$arrIcons = ['itemChangeAmount' => 'glyphicon glyphicon-pencil', 'itemCancel' => 'glyphicon glyphicon-remove', 'itemComplaint' => 'glyphicon glyphicon-alert'];
$arrContext = ['itemChangeAmount' => 'default', 'itemCancel' => 'danger', 'itemComplaint' => 'warning'];
$arrTimeline = [];
$date = new Zend_Date();
foreach ($orderAgent->getFullChangeLog() as $note) {
/* @var \Pimcore\Model\Element\Note $note */
// get avatar
$user = Pimcore_Model_User::getById($note->getUser());
/* @var \Pimcore\Model\User $user */
$avatar = sprintf('/admin/user/get-image?id=%d', $user->getId());
// group events
$group = $date->setTimestamp($note->getDate())->get(Zend_Date::DATE_MEDIUM);
// load reference
$reference = Pimcore\Model\Object\Concrete::getById($note->getCid());
$title = $reference instanceof OnlineShop_Framework_AbstractOrderItem ? $reference->getProduct()->getOSName() : null;
// add
$arrTimeline[$group][] = ['icon' => $arrIcons[$note->getTitle()], 'context' => $arrContext[$note->getTitle()] ?: 'default', 'type' => $note->getTitle(), 'date' => $date->setTimestamp($note->getDate())->get(Zend_Date::DATETIME_MEDIUM), 'avatar' => $avatar, 'user' => $user->getName(), 'message' => $note->getData()['message']['data'], 'title' => $title ?: $note->getTitle()];
}
$this->view->timeLine = $arrTimeline;
}
示例7: parseDate
/**
* Enter description here...
*
* @return Zend_Date
*/
protected function parseDate($date)
{
$epoch = strtotime($date);
if (false === $epoch) {
$date = new Zend_Date($date, $this->_format);
} else {
$date = new Zend_Date();
$date->setTimestamp($epoch);
}
return $date;
}
示例8: fromTimestamp
public function fromTimestamp($timestamp, $format = Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)
{
$dateFormat = Mage::app()->getLocale()->getDateFormat($format);
$date = new Zend_Date();
$date->setTimestamp($timestamp);
return $date->toString($dateFormat);
}
示例9: calcDate
/**
* Calculate date
*
* @param number $value
* @param string $unit
* @param number $roundDate
* @return Zend_Date
*/
public function calcDate($value, $unit, $roundDate = null, $sign = '-')
{
// validate unit
if (!key_exists($unit, $this->getTimeUnitOptions())) {
return null;
}
$timestamp = strtotime("{$sign}{$value} {$unit}");
if ($timestamp) {
// don't calculate with extrem high numbers (preformance)
$timestamp = min(max($timestamp, 0), 10000000000.0);
$date = new Zend_Date();
$date->setTimestamp($timestamp);
if ($roundDate === self::DAY_START) {
$date->setHour(0);
$date->setMinute(0);
$date->setSecond(0);
} else {
if ($roundDate === self::DAY_END) {
$date->setHour(23);
$date->setMinute(59);
$date->setSecond(59);
}
}
return $date;
}
return null;
}
示例10: hasTile
/**
* it checks if there is such valid tile image in cache
*
* @param int $x
* @param int $y
* @param int $zoom
* @return bool
*/
public function hasTile($x, $y, $zoom)
{
$fileName = $this->_getFileName($x, $y, $zoom);
$actualTime = new Zend_Date();
if (file_exists($fileName)) {
$fileTime = new Zend_Date();
$fileTime->setTimestamp(filemtime($this->_getFileName($x, $y, $zoom)));
$fileTime->addDay(self::$daysToRemember);
if ($fileTime->isLater($actualTime)) {
return true;
}
}
return false;
}