本文整理汇总了PHP中Zend_Date::setSecond方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Date::setSecond方法的具体用法?PHP Zend_Date::setSecond怎么用?PHP Zend_Date::setSecond使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Date
的用法示例。
在下文中一共展示了Zend_Date::setSecond方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTransactionList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate)
*/
public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
{
$totalTransactions = array();
$report = $this->_adsense->reports->generate($dStartDate->toString("YYYY-MM-dd"), $dEndDate->toString("YYYY-MM-dd"), array("dimension" => "DATE", "metric" => array("PAGE_VIEWS", "CLICKS", "EARNINGS"), "sort" => "DATE"));
$firstDayMonth = new Zend_Date();
$firstDayMonth->setDay(1);
$firstDayMonth->setHour("00");
$firstDayMonth->setMinute("00");
$firstDayMonth->setSecond("00");
if (isset($report["rows"])) {
foreach ($report["rows"] as $row) {
$obj = array();
$obj['merchantId'] = 1;
$tDate = new Zend_Date($row[0], "yyyy-MM-dd");
$tDate->setHour("00");
$tDate->setMinute("00");
$tDate->setSecond("00");
$obj['date'] = $tDate->toString("yyyy-MM-dd HH:mm:ss");
$obj['impression_number'] = (int) Oara_Utilities::parseDouble($row[1]);
$obj['click_number'] = Oara_Utilities::parseDouble($row[2]);
if ($firstDayMonth->compare($tDate) <= 0) {
$obj['amount'] = Oara_Utilities::parseDouble($row[3]);
$obj['commission'] = Oara_Utilities::parseDouble($row[3]);
$obj['status'] = Oara_Utilities::STATUS_PENDING;
} else {
$obj['amount'] = Oara_Utilities::parseDouble($row[3]);
$obj['commission'] = Oara_Utilities::parseDouble($row[3]);
$obj['status'] = Oara_Utilities::STATUS_CONFIRMED;
}
$totalTransactions[] = $obj;
}
}
return $totalTransactions;
}
示例2: _convertDate
protected function _convertDate($date, $locale)
{
$dateObj = new Zend_Date();
//set begining of day
$dateObj->setHour(00);
$dateObj->setMinute(00);
$dateObj->setSecond(00);
//set date with applying timezone of store
$dateObj->set($date, Zend_Date::DATE_SHORT, $locale);
return $dateObj;
}
示例3: getDateRange
public function getDateRange($range, $customStart, $customEnd, $returnObjects = false)
{
$dateEnd = new Zend_Date(Mage::getModel('core/date')->gmtTimestamp());
$dateStart = clone $dateEnd;
// go to the end of a day
$dateEnd->setHour(23);
$dateEnd->setMinute(59);
$dateEnd->setSecond(59);
$dateStart->setHour(0);
$dateStart->setMinute(0);
$dateStart->setSecond(0);
switch ($range) {
case '24h':
$dateEnd = new Zend_Date(Mage::getModel('core/date')->gmtTimestamp());
$dateEnd->addHour(1);
$dateStart = clone $dateEnd;
$dateStart->subDay(1);
break;
case '7d':
// substract 6 days we need to include
// only today and not hte last one from range
$dateStart->subDay(6);
break;
case '1m':
$dateStart->setDay(Mage::getStoreConfig('reports/dashboard/mtd_start'));
break;
case 'custom':
$dateStart = $customStart ? $customStart : $dateEnd;
$dateEnd = $customEnd ? $customEnd : $dateEnd;
break;
case '1y':
case '2y':
$startMonthDay = explode(',', Mage::getStoreConfig('reports/dashboard/ytd_start'));
$startMonth = isset($startMonthDay[0]) ? (int) $startMonthDay[0] : 1;
$startDay = isset($startMonthDay[1]) ? (int) $startMonthDay[1] : 1;
$dateStart->setMonth($startMonth);
$dateStart->setDay($startDay);
if ($range == '2y') {
$dateStart->subYear(1);
}
break;
}
if ($returnObjects) {
return array($dateStart, $dateEnd);
} else {
return array('from' => $dateStart, 'to' => $dateEnd, 'datetime' => true);
}
}
示例4: getDateRange
public function getDateRange($range, $customStart, $customEnd, $returnObjects = false)
{
$dateEnd = new Zend_Date(Mage::getModel('core/date')->gmtTimestamp());
$dateStart = clone $dateEnd;
// go to the end of a day
$dateEnd->setHour(23);
$dateEnd->setMinute(59);
$dateEnd->setSecond(59);
$dateStart->setHour(0);
$dateStart->setMinute(0);
$dateStart->setSecond(0);
switch ($range) {
case '24h':
$dateEnd = new Zend_Date(Mage::getModel('core/date')->gmtTimestamp());
$dateEnd->addHour(1);
$dateStart = clone $dateEnd;
$dateStart->subDay(1);
break;
case '7d':
// substract 6 days we need to include
// only today and not hte last one from range
$dateStart->subDay(6);
break;
case '1m':
$dateStart->setDay(1);
break;
case 'custom':
$dateStart = $customStart ? $customStart : $dateEnd;
$dateEnd = $customEnd ? $customEnd : $dateEnd;
break;
case '1y':
$dateStart->setMonth(1);
$dateStart->setDay(1);
break;
case '2y':
$dateStart->setMonth(1);
$dateStart->setDay(1);
$dateStart->subYear(1);
break;
}
if ($returnObjects) {
return array($dateStart, $dateEnd);
} else {
return array('from' => $dateStart, 'to' => $dateEnd, 'datetime' => true);
}
}
示例5: 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
}
}
示例6: filterListQuery
/**
* Filters the displayed fields by the passed filter value.
*
* @param \Doctrine\ORM\QueryBuilder $builder
* @param array|null $filters
* @return \Doctrine\ORM\QueryBuilder
*/
protected function filterListQuery(\Doctrine\ORM\QueryBuilder $builder, $filters = null)
{
$expr = Shopware()->Models()->getExpressionBuilder();
if (!empty($filters)) {
foreach ($filters as $filter) {
if (empty($filter['property']) || $filter['value'] === null || $filter['value'] === '') {
continue;
}
switch ($filter['property']) {
case "free":
$builder->andWhere($expr->orX($expr->like('orders.number', '?1'), $expr->like('orders.invoiceAmount', '?1'), $expr->like('orders.transactionId', '?1'), $expr->like('payment.description', '?1'), $expr->like('dispatch.name', '?1'), $expr->like('orderStatus.description', '?1'), $expr->like('paymentStatus.description', '?1'), $expr->like('orders.orderTime', '?2'), $expr->like('billing.company', '?3'), $expr->like('customer.email', '?3'), $expr->like('billing.lastName', '?3'), $expr->like('billing.firstName', '?3'), $expr->like('shop.name', '?3'), $expr->like('orders.comment', '?3'), $expr->like('orders.customerComment', '?3'), $expr->like('orders.internalComment', '?3')));
$builder->setParameter(1, $filter['value'] . '%');
$builder->setParameter(2, '%' . $filter['value']);
$builder->setParameter(3, '%' . $filter['value'] . '%');
break;
case "from":
$tmp = new \DateTime($filter['value']);
$builder->andWhere($expr->gte('orders.orderTime', $tmp->format('Ymd')));
break;
case "to":
$tmp = new \Zend_Date($filter['value']);
$tmp->setHour('23');
$tmp->setMinute('59');
$tmp->setSecond('59');
$builder->andWhere('orders.orderTime <= :orderTimeTo');
$builder->setParameter('orderTimeTo', $tmp->get('yyyy-MM-dd HH:mm:ss'));
break;
case 'details.articleNumber':
$builder->andWhere('details.articleNumber LIKE :articleNumber');
$builder->setParameter('articleNumber', $filter['value'] . "%");
break;
case 'customer.groupKey':
$builder->andWhere($expr->eq($filter['property'], "'" . $filter['value'] . "'"));
break;
default:
$builder->andWhere($expr->eq($filter['property'], $filter['value']));
}
}
}
return $builder;
}
示例7: exportOrdersAction
/**
* Export orders
*/
public function exportOrdersAction()
{
$this->Front()->Plugins()->Json()->setRenderer(false);
$format = strtolower($this->Request()->getParam('format', 'csv'));
/** @var \Shopware\Models\Order\Repository $repository */
$repository = $this->getManager()->getRepository('Shopware\\Models\\Order\\Order');
/** @var \Shopware\Components\Model\ModelRepository $currencyRepostiroy */
$currencyRepository = $this->getManager()->getRepository('Shopware\\Models\\Shop\\Currency');
$builder = $repository->createQueryBuilder('orders');
$orderState = $this->Request()->getParam('orderstate');
if (is_numeric($orderState)) {
$builder->andWhere('orders.status = :orderstate');
$builder->setParameter('orderstate', $orderState);
}
$paymentState = $this->Request()->getParam('paymentstate');
if (is_numeric($paymentState)) {
$builder->andWhere('orders.cleared = :paymentstate');
$builder->setParameter('paymentstate', $paymentState);
}
$orderNumberFrom = $this->Request()->getParam('ordernumberFrom');
if (is_numeric($orderNumberFrom)) {
$builder->andWhere('orders.number > :orderNumberFrom');
$builder->setParameter('orderNumberFrom', $orderNumberFrom);
}
$dateFrom = $this->Request()->getParam('dateFrom');
if ($dateFrom) {
$dateFrom = new \DateTime($dateFrom);
$builder->andWhere('orders.orderTime >= :dateFrom');
$builder->setParameter('dateFrom', $dateFrom);
}
$dateTo = $this->Request()->getParam('dateTo');
if ($dateTo) {
$dateTo = new Zend_Date($dateTo);
$dateTo->setHour('23');
$dateTo->setMinute('59');
$dateTo->setSecond('59');
$builder->andWhere('orders.orderTime <= :dateTo');
$builder->setParameter('dateTo', $dateTo->get('yyyy-MM-dd HH:mm:ss'));
}
if ($format == 'xml') {
$selectFields = array('orders', 'details', 'documents', 'payment', 'customer', 'shipping', 'billing', 'billingCountry', 'shippingCountry', 'shop', 'dispatch', 'paymentStatus', 'orderStatus', 'documentType');
}
if ($format == 'csv' || $format == 'excel') {
$selectFields = array('orders.id as orderId', 'orders.number as ordernumber', 'orders.orderTime as ordertime', 'orders.customerId as customerID', 'orders.paymentId as paymentID', 'orders.transactionId as transactionID', 'orders.partnerId as partnerID', 'orders.cleared as clearedID', 'orders.status as statusID', 'dispatch.id as dispatchID', 'orders.shopId as subshopID', 'orders.invoiceAmount as invoice_amount', 'orders.invoiceAmountNet as invoice_amount_net', 'orders.invoiceShipping as invoice_shipping', 'orders.invoiceShippingNet as invoice_shipping_net', 'orders.net as netto', 'paymentStatus.description as cleared_description', 'orderStatus.description as status_description', 'payment.description as payment_description', 'dispatch.description as dispatch_description', 'orders.id as currency_description', 'orders.referer as referer', 'orders.clearedDate as cleareddate', 'orders.trackingCode as trackingcode', 'orders.languageIso as language', 'orders.currency as currency', 'orders.currencyFactor as currencyFactor', 'orders.id as count_positions', 'details.id as orderdetailsID', 'details.articleId as articleID', 'details.articleNumber as articleordernumber', 'details.articleName as name', 'details.price as price', 'details.quantity as quantity', 'details.ean as ean', 'details.unit as unit', 'details.packUnit as packUnit', 'details.price * details.quantity as invoice', 'details.releaseDate as releasedate', 'taxes.tax as tax', 'details.esdArticle as esd', 'details.mode as modus', 'customerBilling.number as customernumber', 'billing.company as billing_company', 'billing.department as billing_department', 'billing.salutation as billing_salutation', 'billing.firstName as billing_firstname', 'billing.lastName as billing_lastname', 'billing.street as billing_street', 'billing.streetNumber as billing_streetnumber', 'billing.zipCode as billing_zipcode', 'billing.city as billing_city', 'billingCountry.name as billing_country', 'billingCountry.isoName as billing_countryen', 'billingCountry.iso as billing_countryiso', 'shipping.company as shipping_company', 'shipping.department as shipping_department', 'shipping.salutation as shipping_salutation', 'shipping.firstName as shipping_firstname', 'shipping.lastName as shipping_lastname', 'shipping.street as shipping_street', 'shipping.streetNumber as shipping_streetnumber', 'shipping.zipCode as shipping_zipcode', 'shipping.city as shipping_city', 'shippingCountry.name as shipping_country', 'shippingCountry.isoName as shipping_countryen', 'shippingCountry.iso as shipping_countryiso', 'billing.vatId as ustid', 'billing.phone as phone', 'billing.fax as fax', 'customer.email as email', 'customer.groupKey as customergroup', 'customer.newsletter as newsletter', 'customer.affiliate as affiliate');
$builder->addGroupBy('orderdetailsID');
}
$builder->select($selectFields);
$builder->leftJoin('orders.details', 'details')->leftJoin('details.tax', 'taxes')->leftJoin('orders.documents', 'documents')->leftJoin('documents.type', 'documentType')->leftJoin('orders.payment', 'payment')->leftJoin('orders.paymentStatus', 'paymentStatus')->leftJoin('orders.orderStatus', 'orderStatus')->leftJoin('orders.customer', 'customer')->leftJoin('customer.billing', 'customerBilling')->leftJoin('orders.billing', 'billing')->leftJoin('billing.country', 'billingCountry')->leftJoin('orders.shipping', 'shipping')->leftJoin('orders.shop', 'shop')->leftJoin('orders.dispatch', 'dispatch')->leftJoin('shipping.country', 'shippingCountry');
$builder->addOrderBy('orders.orderTime');
$query = $builder->getQuery();
$result = $query->getArrayResult();
$updateStateId = $this->Request()->getParam('updateOrderstate');
if (!empty($updateStateId)) {
$orderIds = array();
if ($format == 'csv' || $format == 'excel') {
foreach ($result as $item) {
$orderIds[] = $item['orderId'];
}
$orderIds = array_unique($orderIds);
}
if ($format == 'xml') {
foreach ($result as $item) {
$orderIds[] = $item['id'];
}
}
$this->updateOrderStatus($orderIds, $updateStateId);
}
if ($format == 'csv' || $format == 'excel') {
$builder = $repository->createQueryBuilder('orders');
$builder->select(array('count(details.id) as count_positions'));
$builder->leftJoin('orders.details', 'details')->andWhere('details.orderId = :orderId')->groupBy('orders.id');
foreach ($result as &$item) {
$builder->setParameter('orderId', $item['orderId']);
try {
$item['count_positions'] = $builder->getQuery()->getSingleScalarResult();
} catch (\Exception $e) {
$item['count_positions'] = 0;
}
$currencyModel = $currencyRepository->findOneBy(array('currency' => $item['currency']));
if ($currencyModel) {
$item['currency_description'] = $currencyModel->getName();
} else {
$item['currency_description'] = '';
}
// Format tax
$item['tax'] = (double) $item['tax'];
}
array_walk_recursive($result, function (&$value) {
if ($value instanceof DateTime) {
$value = $value->format('Y-m-d H:i:s');
}
});
if ($format === 'excel') {
$this->Response()->setHeader('Content-Type', 'application/vnd.ms-excel;charset=UTF-8');
$this->Response()->setHeader('Content-Disposition', 'attachment; filename="export.orders.' . date("Y.m.d") . '.xls"');
$this->Response()->setHeader('Content-Transfer-Encoding', 'binary');
$excel = new Shopware_Components_Convert_Excel();
//.........这里部分代码省略.........
示例8: getSumGroupSelect
/**
* 取得InfoServer数据表中某个时间段的分组数据SQL语句
*
* @param integer $startTimestamp
* @param integer $range
* @param array|string $spec
* @return Zend_Db_Select
*/
public function getSumGroupSelect($startTimestamp = null, $range = null, $spec = 'rTimestamp')
{
$select = $this->select(true)->reset(self::COLUMNS)->columns(array('rTimestamp', 'OnlineNum' => $this->_exprSumOnlineNum));
if (!empty($startTimestamp)) {
$startDate = new Zend_Date($startTimestamp);
$select->where('rTimestamp >= ?', $startDate->setSecond(0)->getTimestamp(), Zend_DB::INT_TYPE);
if (!empty($range)) {
$select->where('rTimestamp <= ?', $startDate->addMinute($range - 1)->setSecond(59)->getTimestamp(), Zend_DB::INT_TYPE);
}
}
$select->group($spec);
return $select;
}
示例9: _getDate
/**
* @return Zend_Date current date, with unit reset depending of current lifetime.
* @todo lifetime should be a parameter
*/
protected function _getDate()
{
$lifetime = Centurion_Config_Manager::get('ticket.lifetime');
list(, $lifetimeUnit) = sscanf($lifetime, '%d%s');
$date = new Zend_Date();
//We reset all unit that are below the ticket lifetime
//Ex: if the lifetime if 1d, we reset hours, minute, second
switch ($lifetimeUnit) {
case 'j':
case 'd':
$date->setHour(0);
case 'h':
$date->setMinute(0);
case 'm':
default:
$date->setSecond(0);
}
return $date;
}
示例10: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$totalOverviews = array();
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$affjetNetClickDao = Dao_Factory_Doctrine::createDoctrineDaoInstance('AffjetNetClick');
$criteriaList = array();
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Select('AffjetNetUserRAffjetNetMerchant->AffjetNetMerchant->id', "_merchantId");
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Select('date', "_date");
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Select('COUNT(*)', "_clickNumber", true);
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_In('AffjetNetUserRAffjetNetMerchant->AffjetNetMerchant->id', $merchantList, false);
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Eq('AffjetNetUserRAffjetNetMerchant->AffjetNetMerchant->AffjetNetPartner->id', $this->_partnerId);
if (!$this->_isAdmin) {
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Eq('AffjetNetUserRAffjetNetMerchant->AffjetNetUser->id', $this->_userId);
}
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Ge('date', $dStartDate->toString("yyyy-MM-dd HH:mm:ss"));
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Le('date', $dEndDate->toString("yyyy-MM-dd HH:mm:ss"));
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Groupby('AffjetNetUserRAffjetNetMerchant->AffjetNetMerchant->id');
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Groupby('date', 'DAY');
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Groupby('date', 'MONTH');
$criteriaList[] = new Dao_Doctrine_Criteria_Restriction_Groupby('date', 'YEAR');
$affjetNetClickList = $affjetNetClickDao->findBy($criteriaList);
foreach ($affjetNetClickList as $affjetNetClick) {
$overview = array();
$overviewDate = new Zend_Date($affjetNetClick->_date, "yyyy-MM-dd HH:mm:ss");
$overviewDate->setHour(0);
$overviewDate->setMinute(0);
$overviewDate->setSecond(0);
$overview['merchantId'] = $affjetNetClick->_merchantId;
$overview['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$overview['click_number'] = $affjetNetClick->_clickNumber;
$overview['impression_number'] = 0;
$overview['transaction_number'] = 0;
$overview['transaction_confirmed_value'] = 0;
$overview['transaction_confirmed_commission'] = 0;
$overview['transaction_pending_value'] = 0;
$overview['transaction_pending_commission'] = 0;
$overview['transaction_declined_value'] = 0;
$overview['transaction_declined_commission'] = 0;
$transactionList = Oara_Utilities::getDayFromArray($affjetNetClick->_merchantId, $transactionArray, $overviewDate);
foreach ($transactionList as $transaction) {
$overview['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$overview['transaction_confirmed_value'] += $transaction['amount'];
$overview['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$overview['transaction_pending_value'] += $transaction['amount'];
$overview['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$overview['transaction_declined_value'] += $transaction['amount'];
$overview['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
$totalOverviews[] = $overview;
}
return $totalOverviews;
}
示例11: setStartDate
/**
* Set the start date for this event
*
* @param Zend_Date $date
* @param boolean $wholeDay
* @return Zym_Calendar_Event
*/
public function setStartDate(Zend_Date $date, $wholeDay = false)
{
if ($wholeDay) {
$date->setHour(0);
$date->setMinute(0);
$date->setSecond(0);
$date->setMilliSecond(0);
$endDate = clone $date;
$endDate->setHour(23);
$endDate->setMinute(59);
$endDate->setSecond(59);
$this->setEndDate($endDate);
}
$this->_startDate = $date;
return $this;
}
示例12: array
define('APPLICATION_ENV', 'development');
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../vendor/ZendFramework/library'), get_include_path())));
require_once 'Zend/Application.php';
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$application->bootstrap();
// the needed resources
$frontController = $application->getBootstrap()->getResource('FrontController');
$view = $application->getBootstrap()->getResource('View');
// init request
$request = new Zend_Controller_Request_Http();
$request->setControllerName('partner-usage');
$request->setActionName('export-csv');
$fromDate = new Zend_Date();
$fromDate->setHour(0);
$fromDate->setMinute(0);
$fromDate->setSecond(0);
$fromDate->setDay(1);
$fromDate->addMonth(-1);
$request->setParam('from_date', $fromDate->getTimestamp());
// beginning of last month
$toDate = new Zend_Date($fromDate);
$toDate->addMonth(1);
$toDate->addSecond(-1);
$request->setParam('to_date', $toDate->getTimestamp());
// end of last month
// init response
$response = new Zend_Controller_Response_Cli();
// dispatch
$frontController->getDispatcher()->dispatch($request, $response);
// send mail
$config = Zend_Registry::get('config');
示例13: 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;
}
示例14: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Interface#getOverviewList($aMerchantIds, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$overviewArray = array();
$firstDayMonth = new Zend_Date();
$firstDayMonth->setDay(1);
$firstDayMonth->setHour("00");
$firstDayMonth->setMinute("00");
$firstDayMonth->setSecond("00");
$modeArray = array("AdSense for Content", "AdSense for Search", "AdSense for Feeds", "AdSense for Domains");
$valuesExport = array();
$valuesExport[] = new Oara_Curl_Parameter('d', $dStartDate->toString("yyyy/M/d") . "-" . $dEndDate->toString("yyyy/M/d"));
$valuesExportReport[] = new Oara_Curl_Parameter('ag', 'date');
$valuesExport[] = new Oara_Curl_Parameter('oc', 'earnings');
$valuesExport[] = new Oara_Curl_Parameter('oo', 'descending');
$valuesExport[] = new Oara_Curl_Parameter('hl', 'en_GB');
$urls = array();
$valuesExportReport = Oara_Utilities::cloneArray($valuesExport);
$valuesExportReport[] = new Oara_Curl_Parameter('dd', '1YproductY1YAFCYAdSense for Content');
$urls[] = new Oara_Curl_Request('https://www.google.com/adsense/v3/gwt/exportCsv?', $valuesExportReport);
$valuesExportReport = Oara_Utilities::cloneArray($valuesExport);
$valuesExportReport[] = new Oara_Curl_Parameter('dd', '1YproductY1YAFSYAdSense for Search');
$urls[] = new Oara_Curl_Request('https://www.google.com/adsense/v3/gwt/exportCsv?', $valuesExportReport);
$valuesExportReport = Oara_Utilities::cloneArray($valuesExport);
$valuesExportReport[] = new Oara_Curl_Parameter('dd', '1YproductY1YAFFYAdSense for Feeds');
$urls[] = new Oara_Curl_Request('https://www.google.com/adsense/v3/gwt/exportCsv?', $valuesExportReport);
$valuesExportReport = Oara_Utilities::cloneArray($valuesExport);
$valuesExportReport[] = new Oara_Curl_Parameter('dd', '1YproductY1YAFDYAdSense for Domains');
$urls[] = new Oara_Curl_Request('https://www.google.com/adsense/v3/gwt/exportCsv?', $valuesExportReport);
$content = $this->_client->post($urls);
for ($i = 0; $i < count($content); $i++) {
$exportData = str_getcsv(@iconv('UTF-16', 'UTF-8', $content[$i]), "\n");
for ($j = 1; $j < count($exportData); $j++) {
$overviewExportArray = str_getcsv($exportData[$j], "\t");
$obj = array();
$obj['merchantId'] = 1;
$overviewDate = new Zend_Date($overviewExportArray[0], "yyyy-MM-dd");
$overviewDate->setHour("00");
$overviewDate->setMinute("00");
$overviewDate->setSecond("00");
$obj['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$obj['link'] = $modeArray[$i];
$obj['transaction_number'] = 0;
$obj['transaction_confirmed_commission'] = 0;
$obj['transaction_confirmed_value'] = 0;
$obj['transaction_pending_commission'] = 0;
$obj['transaction_pending_value'] = 0;
$obj['transaction_declined_commission'] = 0;
$obj['transaction_declined_value'] = 0;
$obj['impression_number'] = (int) Oara_Utilities::parseDouble($overviewExportArray[1]);
$obj['click_number'] = Oara_Utilities::parseDouble($overviewExportArray[2]);
if ($firstDayMonth->compare($overviewDate) <= 0) {
$obj['transaction_pending_commission'] = Oara_Utilities::parseDouble($overviewExportArray[6]);
$obj['transaction_pending_value'] = Oara_Utilities::parseDouble($overviewExportArray[6]);
} else {
$obj['transaction_confirmed_commission'] = Oara_Utilities::parseDouble($overviewExportArray[6]);
$obj['transaction_confirmed_value'] = Oara_Utilities::parseDouble($overviewExportArray[6]);
}
if (Oara_Utilities::checkRegister($obj)) {
$overviewArray[] = $obj;
}
}
}
unset($urls);
return $overviewArray;
}
示例15: calculaExpiracao
public function calculaExpiracao($vencimentoBoleto, $diasExpiracao)
{
//$dataTeste = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
//$dataAtual = Mage::getModel('core/date')->date('Y-m-d H:i:s');
$dataHoraVencimentoBoleto = new Zend_Date($vencimentoBoleto);
$dataHoraVencimentoBoleto->setHour(23);
$dataHoraVencimentoBoleto->setMinute(59);
$dataHoraVencimentoBoleto->setSecond(59);
$dataHoraVencimentoBoleto = $dataHoraVencimentoBoleto->get('yyyy-MM-dd HH:mm:ss');
//Ideasa_Base_Helper_LogUtils::varDump($dataAtual);
//$soma = ($validade + $diasUteis);
//$dataVencimentoBoleto = Mage::helper('base/date')->addDaysToUs($soma, $dataAtual);
return Mage::helper('base/date')->addDaysToUs($diasExpiracao, $dataHoraVencimentoBoleto);
}