本文整理汇总了PHP中self::setDate方法的典型用法代码示例。如果您正苦于以下问题:PHP self::setDate方法的具体用法?PHP self::setDate怎么用?PHP self::setDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::setDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getByKey
/**
* @static
* @param $id - translation key
* @param bool $create - creates an empty translation entry if the key doesn't exists
* @param bool $returnIdIfEmpty - returns $id if no translation is available
* @return Translation_Website
*/
public static function getByKey($id, $create = false, $returnIdIfEmpty = false)
{
$translation = new self();
try {
$translation->getResource()->getByKey($id);
} catch (Exception $e) {
if (!$create) {
throw new Exception($e->getMessage());
} else {
$translation->setKey($id);
$translation->setDate(time());
$translations = array();
foreach (Pimcore_Tool::getValidLanguages() as $lang) {
$translations[$lang] = "";
}
$translation->setTranslations($translations);
$translation->save();
}
}
if ($returnIdIfEmpty) {
$translations = $translation->getTranslations();
foreach ($translations as $key => $value) {
$translations[$key] = $value ?: $id;
}
$translation->setTranslations($translations);
}
return $translation;
}
示例2: getFromId
public static function getFromId($id)
{
$db = Neuron_DB_Database::getInstance();
$id = intval($id);
$d = $db->query("\n\t\t\tSELECT\n\t\t\t\t*,\n\t\t\t\tUNIX_TIMESTAMP(er_date) AS datum\n\t\t\tFROM\n\t\t\t\teffect_report\n\t\t\tWHERE\n\t\t\t\ter_id = {$id}\n\t\t");
if (count($d) > 0) {
$village = Dolumar_Registry_Village::getInstance()->get($d[0]['er_vid']);
$classname = 'Dolumar_Report_' . $d[0]['er_type'];
if (class_exists($classname)) {
$report = new $classname($village);
} else {
$report = new self($village);
}
$report->setId($id);
foreach (self::getObjectsFromLog($d[0]['er_data']) as $v) {
$report->addItem($v);
}
$report->setDate($d[0]['datum']);
if (isset($d[0]['er_target_v_id'])) {
$report->setTarget(Dolumar_Registry_Village::getInstance()->get($d[0]['er_target_v_id']));
}
return $report;
}
return false;
}
示例3: collectDay
public static function collectDay($date)
{
$instance = new self();
$instance->load($date, 'date');
$instance->setDate($date);
$carts = Mage::getModel('adjcartalert/quotestat')->getCollection();
$carts->getSelect()->where('`cart_abandon_date` BETWEEN \'' . $instance->getDate() . '\' AND \'' . $instance->getDate() . '\' + INTERVAL 1 DAY');
$abandonedItemsNum = 0;
$abandonedCartsPrice = 0;
$recoveredCarts = 0;
$orderedItemsNum = 0;
$orderedCartsPrice = 0;
$orderedCarts = 0;
$letterStep = 0;
//$orderTime = 0;
$moduleCouponsUsed = 0;
foreach ($carts as $cart) {
$abandonedCartsPrice += $cart->getCartPrice();
$items = unserialize($cart->getCartItems());
foreach ($items as $item) {
$abandonedItemsNum += $item;
}
if ($cart->getRecoveryDate()) {
$recoveredCarts++;
}
if ($cart->getOrderDate()) {
$orderedCarts++;
$orderedCartsPrice += $cart->getOrderPrice();
$items = unserialize($cart->getOrderItems());
foreach ($items as $item) {
$orderedItemsNum += $item;
}
$letterStep += $cart->getAlertNumber();
}
if ($cart->getAlertCouponGenerated() != '' && $cart->getAlertCouponGenerated() == $cart->getOrderCouponUsed()) {
$moduleCouponsUsed++;
}
}
$instance->setAbandonedCartsNum(count($carts));
$instance->setAbandonedCartsPrice($abandonedCartsPrice);
$instance->setAbandonedItemsNum($abandonedItemsNum);
$instance->setRecoveredCartsNum($recoveredCarts);
$instance->setOrderedCartsNum($orderedCarts);
$instance->setOrderedCartsPrice($orderedCartsPrice);
$instance->setOrderedItemsNum($orderedItemsNum);
$instance->setOrderedItemsNum($orderedItemsNum);
$instance->setCouponsUsed($moduleCouponsUsed);
if ($orderedCarts) {
/*$orderTime = round($orderTime / $orderedCarts);
$orderTimeS = $orderTime % 60;
$orderTime = (int)$orderTime/60;
$orderTimeM = $orderTime % 60;
$orderTime = (int)$orderTime/60;
$instance->setAvBackTime($orderTime.':'.$orderTimeM.':'.$orderTimeS);*/
$instance->setTargetLetterStep($letterStep / $orderedCarts);
}
$instance->save();
}
示例4: createFromInterface
public static function createFromInterface(InvoicePainterItemInterface $invoicePainterItemInterface)
{
$obj = new self();
$obj->setAmountEx($invoicePainterItemInterface->getInvoicePainterAmountEx());
$obj->setTaxRate($invoicePainterItemInterface->getInvoicePainterTaxRate());
$obj->setDescription($invoicePainterItemInterface->getInvoicePainterDescription());
$obj->setDate($invoicePainterItemInterface->getInvoicePainterDate());
return $obj;
}
示例5: createFromArray
public static function createFromArray(array $data)
{
$movement = new self();
$movement->setId(isset($data['id']) ? $data['id'] : null);
$movement->setDate(new \DateTime($data['date']));
$movement->setAmount(new \InFog\SimpleFinance\Types\Money($data['amount']));
$movement->setName(new \InFog\SimpleFinance\Types\SmallString($data['name']));
$movement->setDescription(new \InFog\SimpleFinance\Types\Text($data['description']));
return $movement;
}
示例6: createFromFormat
/**
* Create DateTime object defaults to something that will accept
* the default MySQL datetime format of "Y-m-d H:i:s".
*
* @param string $formatOrTime
* @param string $time -OPTIONAL
* @param DateTimeZone $timezone -OPTIONAL
* @return DateTime
*/
public static function createFromFormat($formatOrTime, $time = '', $timezone = null)
{
if ($time === '') {
$parsed = date_parse($formatOrTime);
} else {
$parsed = date_parse_from_format($formatOrTime, $time);
}
$d = new self();
if ($timezone !== null) {
$d->setTimezone($timezone);
}
$d->setDate($parsed);
$d->setTime($parsed);
return $d;
}
示例7: lock
public static function lock($cid, $ctype)
{
// try to get user
if (!($user = Pimcore_Tool_Admin::getCurrentUser())) {
return false;
}
$lock = new self();
$lock->setCid($cid);
$lock->setCtype($ctype);
$lock->setDate(time());
$lock->setUserId($user->getId());
$lock->setSessionId(session_id());
$lock->save();
return $lock;
}
示例8: lock
public static function lock($cid, $ctype)
{
// try to get user
try {
$user = Zend_Registry::get("pimcore_admin_user");
} catch (Exception $e) {
return false;
}
$lock = new self();
$lock->setCid($cid);
$lock->setCtype($ctype);
$lock->setDate(time());
$lock->setUserId($user->getId());
$lock->setSessionId(session_id());
$lock->save();
return $lock;
}
示例9: parseOverview
/**
* Sets the Mail Headers
* @param Object $result
* @return self
*/
static function parseOverview($result)
{
$instance = new self();
$instance->setSubject($result->subject);
$instance->setFrom($result->from);
$instance->setDate($result->date);
$instance->setRead($result->seen);
$instance->setMsgNo($result->msgno);
return $instance;
}
示例10: fromAnnouncement
/**
* @param Announcement $announcement
* @return self
*/
public static function fromAnnouncement(Announcement $announcement)
{
$self = new self();
$self->setCity($announcement->getCity());
$self->setDate($announcement->getDate());
$lectures = new ArrayCollection();
foreach ($announcement->getLectures() as $lectureAnnouncement) {
$lecture = new Lecture();
$lecture->setTitle($lectureAnnouncement->getTitle());
$lecture->setTeaser($lectureAnnouncement->getTeaser());
$lecture->setLecturer($lectureAnnouncement->getLecturer());
$lecture->setField($lectureAnnouncement->getField());
$lecture->setEvent($self);
$lectures->add($lecture);
}
$self->lectures = $lectures;
$self->created = new \DateTime();
//todo this should be set automatically, why it is not?
return $self;
}
示例11: _createFromFormat
/**
* Internal _createFromFormat implementation for 5.2
* @internal
* @param string $format Format like in date()
* @param string $time Time string to parse
* @param DateTimeZone $timezone TZ
* @return SugarDateTime
* @see DateTime::createFromFormat
*/
protected static function _createFromFormat($format, $time, DateTimeZone $timezone = null)
{
$res = new self();
if (!empty($timezone)) {
$res->setTimezone($timezone);
}
if (self::$use_strptime && function_exists("strptime")) {
$str_format = str_replace(array_keys(TimeDate::$format_to_str), array_values(TimeDate::$format_to_str), $format);
// for a reason unknown to modern science, %P doesn't work in strptime
$str_format = str_replace("%P", "%p", $str_format);
// strip spaces before am/pm as our formats don't have them
$time = preg_replace('/\\s+(AM|PM)/i', '\\1', $time);
// TODO: better way to not risk locale stuff problems?
$data = strptime($time, $str_format);
if (empty($data)) {
$GLOBALS['log']->error("Cannot parse {$time} for format {$format}");
return null;
}
if ($data["tm_year"] == 0) {
unset($data["tm_year"]);
}
if ($data["tm_mday"] == 0) {
unset($data["tm_mday"]);
}
if (isset($data["tm_year"])) {
$data["tm_year"] += 1900;
}
if (isset($data["tm_mon"])) {
$data["tm_mon"]++;
}
$data += self::$data_init;
// fill in missing parts
} else {
// Windows, etc. might not have strptime - we'd have to work harder here
$data = $res->_strptime($time, $format);
}
if (empty($data)) {
$GLOBALS['log']->error("Cannot parse {$time} for format {$format}");
return null;
}
if (isset($data["tm_year"])) {
$res->setDate($data["tm_year"], $data["tm_mon"], $data["tm_mday"]);
}
$res->setTime($data["tm_hour"], $data["tm_min"], $data["tm_sec"]);
return $res;
}
示例12: _getObject
private static function _getObject(Resultset $rs, Project_Build $build)
{
$ret = new self($build);
$ret->setDate($rs->getDate());
$ret->setVersion($rs->getVersion());
$ret->resetSignature();
return $ret;
}
示例13: recordStatusChange
private static function recordStatusChange(StoreOrder $order, $statusHandle)
{
$user = new user();
$now = new \DateTime();
$newHistoryItem = new self();
$newHistoryItem->setOrder($order);
$newHistoryItem->setOrderStatusHandle($statusHandle);
$newHistoryItem->setDate($now);
$newHistoryItem->setUserID($user->uID);
$newHistoryItem->save();
return $newHistoryItem->getOrderStatusHandle();
}
示例14: _getObject
private static function _getObject(Resultset $rs, Project_Build $build)
{
$ret = new self($build);
$ret->setDate($rs->getDate());
$ret->setVersion($rs->getVersion());
$ret->setAhh($rs->getAhh());
$ret->setAndc($rs->getAndc());
$ret->setCalls($rs->getCalls());
$ret->setCcn($rs->getCcn());
$ret->setCcn2($rs->getCcn2());
$ret->setCloc($rs->getCloc());
$ret->setClsa($rs->getClsa());
$ret->setClsc($rs->getClsc());
$ret->setEloc($rs->getEloc());
$ret->setFanout($rs->getFanout());
$ret->setLeafs($rs->getLeafs());
$ret->setLloc($rs->getLloc());
$ret->setLoc($rs->getLoc());
$ret->setMaxDit($rs->getMaxDit());
$ret->setNcloc($rs->getNcloc());
$ret->setNoc($rs->getNoc());
$ret->setNof($rs->getNof());
$ret->setNoi($rs->getNoi());
$ret->setNom($rs->getNom());
$ret->setNop($rs->getNop());
$ret->setRoots($rs->getRoots());
$ret->resetSignature();
return $ret;
}
示例15: create
private static function create(FingerPrint $fingerPrint, $id, DateTime $date, $email, $totalItems, $totalOrder, $quantityInstallments, $ip, $origin, CustomerBillingData $customerBillingData, CustomerShippingData $shippingData, Payment $payment, Item $item, Passenger $passenger = null, Connection $connection = null, HotelReservation $hotelReservation = null)
{
$instance = new self();
$instance->setFingerPrint($fingerPrint);
$instance->setId($id);
$instance->setDate($date);
$instance->setEmail($email);
$instance->setTotalItems($totalItems);
$instance->setTotalOrder($totalOrder);
$instance->setQuantityInstallments($quantityInstallments);
$instance->setIp($ip);
$instance->setOrigin($origin);
$instance->setBillingData($customerBillingData);
$instance->setShippingData($shippingData);
$instance->addPayment($payment);
$instance->addItem($item);
if (null !== $passenger) {
$instance->addPassenger($passenger);
}
if (null !== $connection) {
$instance->addConnection($connection);
}
if (null !== $hotelReservation) {
$instance->addHotelReservation($hotelReservation);
}
return $instance;
}