本文整理汇总了PHP中Zend_Date::now方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Date::now方法的具体用法?PHP Zend_Date::now怎么用?PHP Zend_Date::now使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Date
的用法示例。
在下文中一共展示了Zend_Date::now方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForm
protected function getForm()
{
// Create object Snep_Form
$form = new Snep_Form();
// Set form action
$form->setAction($this->getFrontController()->getBaseUrl() . '/ranking-report/index');
$form_xml = new Zend_Config_Xml('./modules/default/forms/ranking_report.xml');
$config = Zend_Registry::get('config');
$period = new Snep_Form_SubForm($this->view->translate("Period"), $form_xml->period);
$locale = Snep_Locale::getInstance()->getLocale();
$now = Zend_Date::now();
if ($locale == 'en_US') {
$now = $now->toString('YYYY-MM-dd HH:mm');
} else {
$now = $now->toString('dd/MM/YYYY HH:mm');
}
$yesterday = Zend_Date::now()->subDate(1);
$initDay = $period->getElement('init_day');
$initDay->setValue($now);
$tillDay = $period->getElement('till_day');
$tillDay->setValue($now);
$form->addSubForm($period, "period");
$rank = new Snep_Form_SubForm($this->view->translate("Ranking Options"), $form_xml->rank);
$selectNumView = $rank->getElement('view');
for ($index = 1; $index <= 30; $index++) {
$selectNumView->addMultiOption($index, $index);
}
$form->addSubForm($rank, "rank");
$form->getElement('submit')->setLabel($this->view->translate("Show Report"));
$form->removeElement("cancel");
return $form;
}
示例2: logAction
public function logAction()
{
$pageSize = 4096;
$overlapSize = 128;
$dir = APPLICATION_PATH . '/../data/logs/';
$file = $this->_getParam('file', null);
$this->view->page = $this->_getParam('page', 0);
if ($file === null) {
$file = sprintf('%s_application.log', Zend_Date::now()->toString('yyyy.MM.dd'));
}
$fp = fopen($dir . $file, 'r');
fseek($fp, -$pageSize * ($this->view->page + 1) + $overlapSize, SEEK_END);
$this->view->errorLog = fread($fp, $pageSize + $overlapSize * 2);
fclose($fp);
$iterator = new DirectoryIterator($dir);
while ($iterator->valid()) {
if (!$iterator->isDot()) {
if ($iterator->isFile()) {
$files[$iterator->getFilename()] = $iterator->getPathName();
}
}
$iterator->next();
}
$this->view->itemCountPerPage = $pageSize;
$this->view->totalItemCount = filesize($dir . $file);
$this->view->files = $files;
}
示例3: saveBilling
/**
* Checks the legal age
*
* @param array $data
* @param int $customerAddressId
* @return Mage_Checkout_Model_Type_Onepage
*/
public function saveBilling($data, $customerAddressId)
{
$result = parent::saveBilling($data, $customerAddressId);
if (isset($result['error'])) {
return $result;
}
$dobIso = $this->getQuote()->getCustomerDob();
$dob = new Zend_Date($dobIso, Zend_Date::ISO_8601);
$legalBirthDay = $dob->add(self::LIMITED_AGE, Zend_Date::YEAR);
$legal1 = Zend_Date::now()->isLater($legalBirthDay);
if (!$legal1) {
// not even limited legal
$result['error'] = 1;
$result['message'] = Mage::helper('n98legalage')->__('You are not yet limited contractually capable. You can ask your legal guardian to purchase.');
return $result;
}
$dob = new Zend_Date($dobIso, Zend_Date::ISO_8601);
$legalBirthDay = $dob->add(self::LEGAL_AGE, Zend_Date::YEAR);
$legal2 = Zend_Date::now()->isLater($legalBirthDay);
if (!$legal2) {
$result['error'] = 1;
$result['message'] = Mage::helper('n98legalage')->__('You are not yet contractually capable. You can ask your legal guardian to purchase on your behalf.');
return $result;
}
return $result;
}
示例4: access
/** Create the token for yahoo access and save to database.
*
*/
public function access()
{
$config = array('siteUrl' => self::YAHOOTOKENGET, 'callbackUrl' => 'http://beta.finds.org.uk/admin/oauth/', 'consumerKey' => $this->_consumerKey, 'consumerSecret' => $this->_consumerSecret);
$session = new Zend_Session_Namespace('yahoo_oauth');
// build the token request based on the original token and secret
$request = new Zend_Oauth_Token_Request();
$request->setToken($session->token)->setTokenSecret($session->secret);
unset($session->token);
unset($session->secret);
$now = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
$date = new Zend_Date();
$expires = $date->add('1', Zend_Date::HOUR)->toString('YYYY-MM-dd HH:mm:ss');
$consumer = new Zend_Oauth_Consumer($config);
$token = $consumer->getAccessToken($_GET, $request);
$oauth_guid = $token->xoauth_yahoo_guid;
$oauth_session = $token->oauth_session_handle;
$oauth_token = $token->getToken();
$oauth_token_secret = $token->getTokenSecret();
$tokenRow = $this->createRow();
$tokenRow->service = 'yahooAccess';
$tokenRow->accessToken = serialize($oauth_token);
$tokenRow->tokenSecret = serialize($oauth_token_secret);
$tokenRow->guid = serialize($oauth_guid);
$tokenRow->sessionHandle = serialize($oauth_session);
$tokenRow->created = $now;
$tokenRow->expires = $expires;
$tokenRow->save();
}
示例5: newLog
/**
* @return \Application\Model\Bean\ProductLog
*/
private function newLog(Product $product, $eventType)
{
$now = \Zend_Date::now();
$log = ProductLogFactory::createFromArray(array('id_product' => $product->getItemCode(), 'id_user' => $this->getUser()->getIdUser(), 'date_log' => $now->get('yyyy-MM-dd HH:mm:ss'), 'event_type' => $eventType, 'note' => ''));
$this->getCatalog('ProductLogCatalog')->create($log);
return $log;
}
示例6: __construct
/** This probably needs changing for construction methods.
* @todo remove need for calling config
* @todo pass variables to the constructor
*/
public function __construct()
{
$this->_config = Zend_Registry::get('config');
$this->_consumerKey = $this->_config->webservice->ydnkeys->consumerKey;
$this->_consumerSecret = $this->_config->webservice->ydnkeys->consumerSecret;
$this->_now = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss');
}
示例7: getActiveMotds
/**
* Retrieves all active MOTDs.
*
* @return array
* An associative array containing the details of the active MOTDs, or null
* if there are no active MOTDs.
*/
public function getActiveMotds()
{
$returnArray = array();
//Retrieve all MOTDs.
$motds = new Datasource_Cms_Connect_Motd();
$motdsArray = $motds->getAll();
foreach ($motdsArray as $currentMotd) {
if ($currentMotd['active'] == 1) {
//Ensure the today is captured in the MOTD date range.
$displayFrom = new Zend_Date($currentMotd['displayFrom'], Zend_Date::ISO_8601);
$displayTo = new Zend_Date($currentMotd['displayTo'], Zend_Date::ISO_8601);
$now = Zend_Date::now();
if ($displayFrom->isToday() || $displayTo->isToday()) {
$returnArray[] = $currentMotd;
} else {
if ($now->isLater($displayFrom) && $now->isEarlier($displayTo)) {
$returnArray[] = $currentMotd;
}
}
}
}
//Clean up the return value consistent with this function's contract.
if (empty($returnArray)) {
$returnVal = null;
} else {
$returnVal = $returnArray;
}
return $returnVal;
}
示例8: getLoadedProductCollection
/**
* Get product collection.
* @return array
* @throws Exception
*/
public function getLoadedProductCollection()
{
$mode = $this->getRequest()->getActionName();
$limit = Mage::helper('ddg/recommended')->getDisplayLimitByMode($mode);
$from = Mage::helper('ddg/recommended')->getTimeFromConfig($mode);
$locale = Mage::app()->getLocale()->getLocale();
$to = Zend_Date::now($locale)->toString(Zend_Date::ISO_8601);
$productCollection = Mage::getResourceModel('reports/product_collection')->addAttributeToSelect('*')->addOrderedQty($from, $to)->setOrder('ordered_qty', 'desc')->setPageSize($limit);
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($productCollection);
$productCollection->addAttributeToFilter('is_saleable', TRUE);
//filter collection by category by category_id
if ($cat_id = Mage::app()->getRequest()->getParam('category_id')) {
$category = Mage::getModel('catalog/category')->load($cat_id);
if ($category->getId()) {
$productCollection->getSelect()->joinLeft(array("ccpi" => 'catalog_category_product_index'), "e.entity_id = ccpi.product_id", array("category_id"))->where('ccpi.category_id =?', $cat_id);
} else {
Mage::helper('ddg')->log('Best seller. Category id ' . $cat_id . ' is invalid. It does not exist.');
}
}
//filter collection by category by category_name
if ($cat_name = Mage::app()->getRequest()->getParam('category_name')) {
$category = Mage::getModel('catalog/category')->loadByAttribute('name', $cat_name);
if ($category) {
$productCollection->getSelect()->joinLeft(array("ccpi" => 'catalog_category_product_index'), "e.entity_id = ccpi.product_id", array("category_id"))->where('ccpi.category_id =?', $category->getId());
} else {
Mage::helper('ddg')->log('Best seller. Category name ' . $cat_name . ' is invalid. It does not exist.');
}
}
return $productCollection;
}
示例9: register
/**
* @param Core_Dto_Entity
* @throws Exception
* */
public function register(\Core_Dto_Entity $dto)
{
# @todo implementar regra de negocio que verifica se o comentario pode ser alterado
# falta a definicao da estrutura tabela
# recupera referencia da pessoa que está realizando operacao
$pessoa = $this->_getRepository('app:VwPessoa')->find(\Core_Integration_Sica_User::getPersonId());
# verifica o autor existe (usuario da sessao existe na base)
# isso poderá ocorrer quando a sessao cair perando a realizacao
# da operacao
if (!count($pessoa)) {
throw new \Exception(self::T_COMENTARIO_AUTHOR_NOT_FOUND);
}
$dto->setSqPessoa($pessoa);
# recupera a unidade organizacional da pessoa que esta manipulando o comentario
$dto->setSqUnidadeOrg($this->_getRepository('app:VwUnidadeOrg')->find(\Core_Integration_Sica_User::getUserUnit()));
# verifica se o registro já existe
$this->_alreadyExists($dto);
# se o sq_comentario_artefato existir indica uma alteracao.
# Devido a propriedade de tempo nunca será possível repedir um registro
# se levar esta propriedade em consideracao
if ($dto->getSqComentarioArtefato()) {
$this->_update($dto);
$this->getMessaging()->addSuccessMessage('MD002', 'User');
} else {
# define a hora de registro/alteracao
$dto->setDtComentario(\Zend_Date::now());
# delega a operação de salvar os dados para superclasse
$this->_save($dto);
$this->getMessaging()->addSuccessMessage('MD001', 'User');
}
$this->finish();
$this->getMessaging()->dispatchPackets();
}
示例10: logUpdate
private function logUpdate($eventType, $table, $oldValue, $newValue, $user)
{
$timestamp = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss');
if ($this->trackFields != null) {
// insert a log for each tracked field
foreach ($this->trackFields as $field) {
if (isset($oldValue[$field]) && isset($newValue[$field])) {
if ($oldValue[$field] != $newValue[$field]) {
$this->setColEventType(self::EVENT_TYPE_UPDATE);
$this->setColEventDate($timestamp);
$this->setColFieldName($field);
$this->setColRecordId($oldValue['id']);
$this->setColAppAccountId($user['appaccount_id']);
$this->setColUserId($user['user_id']);
$this->setColTableName($table);
$this->setColFieldTextType(false);
$this->setColValue($oldValue[$field]);
$this->log->log('UPDATE on database', Zend_Log::INFO);
}
}
}
} else {
throw new Agana_Exception('Track Fields for audit trail is not set');
}
}
示例11: _init
/**
* Initialize feedback, sets feedback_id from UUID value
* This value can be provided via the url or a cookie and
* will be stored in a session
*
* If no valid feedback code is found in the request string, the cookie
* or in the session (also a cookie) then return false
*
* @return integer feeback_id
*/
private function _init()
{
$request = Zend_Controller_Front::getInstance()->getRequest();
$conference = Zend_Registry::get('conference');
$sessionNs = $conference['abbreviation'] . '_feedback';
// check if feedback deadline has passed
if (isset($conference['feedback_end'])) {
if (Zend_Date::now()->isLater($conference['feedback_end'])) {
return false;
}
}
// check if session is set
if (Zend_Session::namespaceIsset($sessionNs)) {
$session = new Zend_Session_Namespace($sessionNs, true);
return $this->_feedback_id = $session->feedback_id;
}
// for uuid parameter, first try Request value, if not available use Cookie value
$uuid = $request->getParam('uuid', $request->getCookie('feedback_code'));
// use parameter to set session and cookie
if ($uuid) {
if ($feedback = $this->getFeedbackByUuid($uuid)) {
$session = new Zend_Session_Namespace($sessionNs, true);
// cookie expires in 14 days
if ($request->getParam('uuid')) {
// only set cookie if it is not already set
setcookie('feedback_code', $uuid, time() + 14 * 3600 * 24, '/', $conference['hostname']);
}
return $this->_feedback_id = $session->feedback_id = (int) $feedback->code_id;
}
}
// If no UUID is found in Request, Cookie or Session then return
return false;
}
示例12: indexAction
/**
*
*/
public function indexAction()
{
$module = $this->_getParam('module');
if (empty($module)) {
$this->_helper->redirector->goToSimple('index', 'index', 'external');
}
$client = $this->view->session->client->id_perdata;
$businessPlan = $this->_mapper->fetchBusinessPlanByClient($client, $module);
if ($businessPlan) {
$this->view->businessPlan = $businessPlan;
$this->view->date_ini = $this->view->date($businessPlan->date_inserted);
$this->view->hasBudgetCategory = $this->_mapper->hasBudgetCategory($businessPlan->id_businessplan);
if (!$businessPlan->submitted) {
$this->view->revision = $this->_mapper->getLastRevision($businessPlan->id_businessplan);
}
if (!empty($businessPlan->business_group)) {
$this->view->is_group = true;
}
if (!empty($businessPlan->fk_id_fefop_contract)) {
$mapperContract = new Fefop_Model_Mapper_Contract();
$this->view->contract = $mapperContract->detail($businessPlan->fk_id_fefop_contract);
}
} else {
$this->view->date_ini = Zend_Date::now()->toString('dd/MM/yyyy');
}
$this->view->can_create = $this->_mapper->canCreateBusinessPlan($client, $module);
$this->view->module = $module;
}
示例13: isVisible
public function isVisible($identity = null)
{
if (!$this->isPublished()) {
return false;
}
return $this->getDateObjectBy('published_at')->compare(Zend_Date::now()) < 0;
}
示例14: checkUpdate
/**
* Check feed for modification
*
* @return Belvg_All_Model_Feed
*/
public function checkUpdate()
{
$now = Zend_Date::now()->getTimestamp();
if ($this->_helper->getFrequency() + $this->_helper->getLastUpdate() > $now) {
return $this;
}
$this->_helper->setLastUpdate($now);
if (!extension_loaded('curl')) {
return $this;
}
$feed_data = array();
$feed_xml = $this->getFeedData();
$was_installed = gmdate('Y-m-d H:i:s', $this->_helper->getInstalledDate());
if ($feed_xml && $feed_xml->channel && $feed_xml->channel->item) {
foreach ($feed_xml->channel->item as $item) {
$date = $this->getDate((string) $item->pubDate);
if ($date < $was_installed) {
continue;
}
if (!$this->isInteresting($item)) {
continue;
}
$feed_data[] = array('severity' => 3, 'date_added' => $this->getDate($date), 'title' => (string) $item->title, 'description' => (string) $item->description, 'url' => (string) $item->link);
}
if ($feed_data) {
Mage::getModel('adminnotification/inbox')->parse($feed_data);
}
}
}
示例15: indexAction
public function indexAction()
{
// Display the send_us_a_file.html page if the "Send us a file" feature is on and the user is not logged in.
if (fz_config_get('app', 'send_us_a_file_feature') && false == $this->getUser()) {
set('start_from', Zend_Date::now()->get(Zend_Date::DATE_SHORT));
$maxUploadSize = min(Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('upload_max_filesize')), Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('post_max_size')));
set('max_upload_size', $maxUploadSize);
return html('send_us_a_file.html');
}
$this->secure();
$user = $this->getUser();
$freeSpaceLeft = max(0, Fz_Db::getTable('File')->getRemainingSpaceForUser($user));
$maxUploadSize = min(Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('upload_max_filesize')), Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('post_max_size')), $freeSpaceLeft);
$progressMonitor = fz_config_get('app', 'progress_monitor');
$progressMonitor = new $progressMonitor();
set('upload_id', md5(uniqid(mt_rand(), true)));
set('start_from', Zend_Date::now()->get(Zend_Date::DATE_SHORT));
set('refresh_rate', 1200);
set('files', Fz_Db::getTable('File')->findByOwnerOrderByUploadDateDesc($user));
set('use_progress_bar', $progressMonitor->isInstalled());
set('upload_id_name', $progressMonitor->getUploadIdName());
set('free_space_left', $freeSpaceLeft);
set('max_upload_size', $maxUploadSize);
set('sharing_destinations', fz_config_get('app', 'sharing_destinations', array()));
set('disk_usage', array('space' => '<b id="disk-usage-value">' . bytesToShorthand(Fz_Db::getTable('File')->getTotalDiskSpaceByUser($user)) . '</b>', 'quota' => fz_config_get('app', 'user_quota')));
return html('main/index.php');
}