本文整理汇总了PHP中Zend_Date::subMinute方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Date::subMinute方法的具体用法?PHP Zend_Date::subMinute怎么用?PHP Zend_Date::subMinute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Date
的用法示例。
在下文中一共展示了Zend_Date::subMinute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cancelOrdersInPending
/**
* Cancel orders stayed in pending because customer not validated payment form
*/
public function cancelOrdersInPending()
{
$methodCodes = array();
//Select only method with cancel orders enabled
foreach (Mage::helper('hipay')->getHipayMethods() as $code => $model) {
if (Mage::getStoreConfigFlag('payment/' . $code . "/cancel_pending_order")) {
$methodCodes[] = $code;
}
}
if (count($methodCodes) < 1) {
return $this;
}
//Limited time in minutes
$limitedTime = 30;
$date = new Zend_Date();
/* @var $collection Mage_Sales_Model_Resource_Order_Collection */
$collection = Mage::getResourceModel('sales/order_collection');
$collection->addFieldToSelect(array('entity_id', 'increment_id', 'store_id', 'state'))->addFieldToFilter('main_table.state', Mage_Sales_Model_Order::STATE_NEW)->addFieldToFilter('op.method', array('in' => array_values($methodCodes)))->addAttributeToFilter('created_at', array('to' => $date->subMinute($limitedTime)->toString('Y-MM-dd HH:mm:ss')))->join(array('op' => 'sales/order_payment'), 'main_table.entity_id=op.parent_id', array('method'));
/* @var $order Mage_Sales_Model_Order */
foreach ($collection as $order) {
if ($order->canCancel()) {
try {
$order->cancel();
$order->addStatusToHistory($order->getStatus(), Mage::helper('hipay')->__("Order canceled automatically by cron because order is pending since %d minutes", $limitedTime));
$order->save();
} catch (Exception $e) {
Mage::logException($e);
}
}
}
return $this;
}
示例2: testLoose
//.........这里部分代码省略.........
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->setHour(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->addHour(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->subHour(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->compareHour(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->setMinute(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->addMinute(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->subMinute(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->compareMinute(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->setSecond(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->addSecond(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->subSecond(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->compareSecond(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->setWeek(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->addWeek(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->subWeek(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->compareWeek(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
}
示例3: passwordResetAction
/**
* Action for forgetting a password
*
*/
public function passwordResetAction()
{
if (Zend_Auth::getInstance()->hasIdentity()) {
$this->_helper->redirector->gotoRoute(array(), 'default', true);
return;
}
$userKey = $this->_getParam('key', null);
if (is_null($userKey)) {
throw new Ot_Exception_Input('msg-error-noKeyFound');
}
$loginOptions = Zend_Registry::get('applicationLoginOptions');
$key = $loginOptions['forgotpassword']['key'];
$iv = $loginOptions['forgotpassword']['iv'];
$cipher = $loginOptions['forgotpassword']['cipher'];
$string = pack("H*", $userKey);
$decryptKey = trim(mcrypt_decrypt($cipher, $key, $string, MCRYPT_MODE_CBC, $iv));
if (!preg_match('/[^@]*@[^-]*-[0-9]*/', $decryptKey)) {
throw new Ot_Exception_Input('msg-error-invalidKey');
}
$userId = preg_replace('/\\-.*/', '', $decryptKey);
$ts = preg_replace('/^[^-]*-/', '', $decryptKey);
$timestamp = new Zend_Date($ts);
$now = new Zend_Date();
$now->subMinute((int) $loginOptions['forgotpassword']['numberMinutesKeyIsActive']);
if ($timestamp->getTimestamp() < $now->getTimestamp()) {
throw new Ot_Exception_Input('msg-error-keyExpired');
}
$realm = preg_replace('/^[^@]*@/', '', $userId);
$username = preg_replace('/@.*/', '', $userId);
// Set up the auth adapter
$authAdapter = new Ot_Model_DbTable_AuthAdapter();
$adapter = $authAdapter->find($realm);
if (is_null($adapter)) {
throw new Ot_Exception_Data($this->view->translate('ot-login-signup:realmNotFound', array('<b>' . $realm . '</b>')));
}
if ($adapter->enabled == 0) {
throw new Ot_Exception_Access('msg-error-authNotSupported');
}
$className = (string) $adapter->class;
$auth = new $className();
if (!$auth->manageLocally()) {
throw new Ot_Exception_Access('msg-error-authNotSupported');
}
$account = new Ot_Model_DbTable_Account();
$thisAccount = $account->getByUsername($username, $realm);
if (is_null($thisAccount)) {
throw new Ot_Exception_Data('msg-error-userAccountNotFound');
}
$form = new Ot_Form_PasswordReset();
if ($this->_request->isPost()) {
if ($form->isValid($_POST)) {
if ($form->getValue('password') == $form->getValue('passwordConf')) {
$data = array('accountId' => $thisAccount->accountId, 'password' => md5($form->getValue('password')));
$account->update($data, null);
$this->_helper->messenger->addSuccess('msg-info-passwordReset');
$loggerOptions = array('attributeName' => 'accountId', 'attributeId' => $data['accountId']);
$this->_helper->log(Zend_Log::INFO, 'User reset their password', $loggerOptions);
$this->_helper->redirector->gotoRoute(array('realm' => $realm), 'login', true);
} else {
$this->_helper->messenger->addError('msg-error-passwordsNotMatch');
}
} else {
$this->_helper->messenger->addError('msg-error-invalidFormInfo');
}
}
$this->view->headScript()->appendFile($this->view->baseUrl() . '/public/scripts/ot/jquery.plugin.passStrength.js');
$this->_helper->pageTitle('ot-login-passwordReset:title');
$this->view->assign(array('form' => $form));
}
示例4: setHorarios
/**
*
* @param type $horarios
* @param type $intervalo
*/
private function setHorarios($salao_id, $dia_semana, $horario_fechamento, $horario_abertura)
{
$horarios = ($horario_fechamento - $horario_abertura) * 2;
$date = date('Y-m-d') . ' ' . $horario_abertura;
$zendDate = new Zend_Date($date);
$horario = $zendDate->subMinute(30);
for ($i = 0; $i <= $horarios; $i++) {
$horario = $zendDate->addMinute(30)->get(Zend_Date::TIME_SHORT);
$insertHorario = array('salao_id' => $salao_id, 'salao_horario_dia_semana' => $dia_semana, 'salao_horario' => $horario);
$modelSalaoHorario = new Model_DbTable_SalaoHorario();
if (!$modelSalaoHorario->insert($insertHorario)) {
throw new Exception("Falha ao cadastrar os horários");
}
}
}
示例5: chartAction
/**
* 在线人数曲线
*/
public function chartAction()
{
$data = array();
// 当前时间戳
$nowOffsetTimestamp = Zend_Date::now()->subMinute(abs($this->_getParam('offset')))->getTimestamp();
foreach ($this->_getParam('allowedGameTypes') as $gameType) {
if (ZtChart_Model_GameType::isQule($gameType)) {
// 取Qule游戏的数据
$qule = new ZtChart_Model_Qule();
// 取当前偏移量的数据
$nowData = $qule->getGamedata(array('gametype' => $gameType, 'zoneid' => $this->_getParam('zoneid'), 'loadnumber' => $this->_getParam('range'), 'querydate' => $nowOffsetTimestamp));
if (array_key_exists('data', $nowData) && !empty($nowData['data'])) {
foreach ($nowData['data'] as $item) {
$data['datetime'][] = $item[0];
$data['data'][0][] = $item[1];
}
}
// 取同比偏移量的数据
if ($this->_hasParam('pdate')) {
foreach (explode(',', $this->_getParam('pdate')) as $pdate) {
$sameOffsetTimestamp = ZtChart_Model_Assemble_Datetime::getPredefinedStartTimestamp($pdate, $nowOffsetTimestamp);
$sameData = $qule->getGamedata(array('gametype' => $gameType, 'zoneid' => $this->_getParam('zoneid'), 'loadnumber' => $this->_getParam('range'), 'querydate' => $sameOffsetTimestamp));
if (array_key_exists('data', $sameData) && !empty($sameData['data'])) {
foreach ($sameData['data'] as $item) {
$data['data'][$pdate][] = $item[1];
}
}
}
}
} else {
// 取InfoServer中的数据
try {
if (ZtChart_Model_DbTable_Infoserver::isSingleAdapter($gameType)) {
// 游戏只有一个数据库的情况
$infoserver = ZtChart_Model_DbTable_Infoserver::factory($gameType);
// 取当前偏移量的数据
$nowOffsetDate = new Zend_Date($nowOffsetTimestamp);
$startNowOffsetTimestamp = $nowOffsetDate->subMinute($this->_getParam('range'))->getTimestamp();
for ($i = 0; $i < $this->_getParam('range'); $i++) {
$data['datetime'][$i] = $startNowOffsetTimestamp + $i * 60;
$data['tmp'][$i] = date('H:i', $data['datetime'][$i]);
}
foreach ($infoserver->fetchSumGroup($startNowOffsetTimestamp) as $item) {
if (in_array(date('H:i', $item[0]), $data['tmp'])) {
$data['data'][0][] = $item[1];
} else {
$data['data'][0][] = -1;
}
}
$data['data'][0] = array_pad($data['data'][0], $this->_getParam('range'), -1);
// 取同比偏移量的数据
if ($this->_hasParam('pdate')) {
foreach (explode(',', $this->_getParam('pdate')) as $pdate) {
$startSameOffsetTimestamp = ZtChart_Model_Assemble_Datetime::getPredefinedStartTimestamp($pdate, $startNowOffsetTimestamp);
$infoserver->setTablename($startSameOffsetTimestamp);
foreach ($infoserver->fetchSumGroup($startSameOffsetTimestamp, $this->_getParam('range')) as $item) {
if (in_array(date('H:i', $item[0]), $data['tmp'])) {
$data['data'][$pdate][] = $item[1];
} else {
$data['data'][$pdate][] = -1;
}
}
$data['data'][$pdate] = array_pad($data['data'][$pdate], $this->_getParam('range'), -1);
}
}
unset($data['tmp']);
} else {
// @todo 游戏含有多个数据库的情况
}
} catch (Zend_Db_Exception $e) {
ZtChart_Model_Logger::err($e->getMessage());
continue;
}
}
}
$this->_helper->json($data);
}