本文整理汇总了PHP中Zend_Date::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Date::toString方法的具体用法?PHP Zend_Date::toString怎么用?PHP Zend_Date::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Date
的用法示例。
在下文中一共展示了Zend_Date::toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getkey
public function getkey($actionUrl = null, $mktime = null)
{
$actionUrl = $this->_getActionUrl($actionUrl);
if ($mktime == null) {
$lifetime = Centurion_Config_Manager::get('ticket.lifetime');
list($lifetimeValue, $lifetimeUnit) = sscanf($lifetime, '%d%s');
$mktime = new Zend_Date();
switch ($lifetimeUnit) {
case 'j':
case 'd':
$mktime->setHour(0);
case 'h':
$mktime->setMinute(0);
case 'm':
default:
$mktime->setSecond(0);
}
}
if ($mktime instanceof Zend_Date) {
$date = $mktime->toString('YYYYMMdd-HH:mm');
} else {
$date = date('Ymd-H:i', $mktime);
}
$salt = Centurion_Config_Manager::get('ticket.salt');
$ticket = md5($salt . $actionUrl . $date);
return $ticket;
}
示例2: date
public function date($value, $displayTime = false)
{
if ($displayTime) {
$translate = Zend_Registry::get('Zend_Translate');
$locale = key(Zend_Registry::get('Zend_Locale')->getDefault());
$date = new Zend_Date($value, null, $locale);
if ($date->isToday()) {
$h = $date->toString('H');
$m = $date->toString('m');
$s = $date->toString('s');
if (date('H') == $h) {
$min = (int) date('i') - (int) $m;
if ($min < 1) {
$sec = (int) date('s') - (int) $s;
if ($sec < 10) {
return $translate->_('now');
}
return $sec . ' ' . $translate->_('seconds ago');
}
return $min . ' ' . $translate->_('minutes ago');
} elseif (date('H') > $h) {
return (int) date('H') - (int) $h . ' ' . $translate->_('hours ago');
}
return $date->toString('H:m');
} else {
return $date->toString('dd/MM/y H:m');
}
}
return Zend_Filter::filterStatic($value, 'date', array(), 'Tri_Filter');
}
示例3: indexAction
/**
* Enter description here...
*
*/
public function indexAction()
{
$currentDate = new Zend_Date();
$currentMonth = $currentDate->toString(Zend_Date::MONTH_SHORT);
$currentDay = $currentDate->toString(Zend_Date::DAY_SHORT);
$month = $this->_getParam('month', $currentMonth);
if (false === is_numeric($month)) {
$month = $this->_monthMap[urldecode($month)];
}
$currentDate->setMonth($month);
$currentDate->setDay(1);
$days = $currentDate->toString(Zend_Date::MONTH_DAYS);
$this->view->selectedMonth = $month;
$this->view->currentMonth = $currentMonth;
$this->view->currentDay = $currentDay;
$result = Bc_UserDTO::fetchAsArray(array('month' => $month));
$month = array();
for ($i = 1; $i <= $days; $i++) {
$data = array();
$data['date'] = $currentDate->toString(Zend_Date::DAY . '.' . Zend_Date::MONTH . '.' . Zend_Date::YEAR);
$user = array();
foreach ($result as $birthday) {
if ($i == $birthday['birthday']) {
$user[] = $birthday;
}
}
$data['user'] = empty($user) ? null : $user;
$month[$i] = $data;
$currentDate->add('24:00:00', Zend_Date::TIMES);
}
$this->view->month = $month;
}
示例4: indexAction
public function indexAction()
{
$translate = Zend_Registry::get('Zend_Translate');
$this->view->title = 'Duyệt chấm công - ' . $translate->_('TEXT_DEFAULT_TITLE');
$this->view->headTitle($this->view->title);
$layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
$option = array('layout' => '1_column/layout', 'layoutPath' => $layoutPath);
Zend_Layout::startMvc($option);
$date = new Zend_Date();
$date->subMonth(1);
$thang = $this->_getParam('thang', $date->toString("M"));
$nam = $this->_getParam('nam', $date->toString("Y"));
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
$em_id = $identity->em_id;
$emModel = new Front_Model_Employees();
$phongbanModel = new Front_Model_Phongban();
$my_info = $emModel->fetchRow('em_id=' . $em_id . ' and em_status=1');
$phong_ban_id = $list_phongban = $phong_ban = array();
if ($my_info) {
$phong_ban_id[] = $my_info->em_phong_ban;
$list_phongban = $phongbanModel->fetchDataStatus($my_info->em_phong_ban, $phong_ban);
}
if (sizeof($list_phongban)) {
foreach ($list_phongban as $phong_ban_info) {
$phong_ban_id[] = $phong_ban_info->pb_parent;
}
}
$phong_ban_id = implode(',', $phong_ban_id);
$list_nhan_vien = $emModel->fetchAll("em_phong_ban in ({$phong_ban_id}) and em_status=1");
$this->view->list_nhan_vien = $list_nhan_vien;
$this->view->thang = $thang;
$this->view->nam = $nam;
}
示例5: 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();
$filter = new Zend_Filter_LocalizedToNormalized(array('precision' => 2));
$number = self::returnApiData("https://api.clickbank.com/rest/1.3/orders/count?startDate=" . $dStartDate->toString("yyyy-MM-dd") . "&endDate=" . $dEndDate->toString("yyyy-MM-dd"));
if ($number[0] != 0) {
$transactionXMLList = self::returnApiData("https://api.clickbank.com/rest/1.3/orders/list?startDate=" . $dStartDate->toString("yyyy-MM-dd") . "&endDate=" . $dEndDate->toString("yyyy-MM-dd"));
foreach ($transactionXMLList as $transactionXML) {
$transactionXML = simplexml_load_string($transactionXML, null, LIBXML_NOERROR | LIBXML_NOWARNING);
foreach ($transactionXML->orderData as $singleTransaction) {
$transaction = array();
$transaction['merchantId'] = 1;
$transactionDate = new Zend_Date(self::findAttribute($singleTransaction, 'date'), 'yyyy-MM-ddTHH:mm:ss');
$transaction['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
unset($transactionDate);
if (self::findAttribute($singleTransaction, 'affi') != null) {
$transaction['custom_id'] = self::findAttribute($singleTransaction, 'affi');
}
$transaction['unique_id'] = self::findAttribute($singleTransaction, 'receipt');
$transaction['amount'] = (double) $filter->filter(self::findAttribute($singleTransaction, 'amount'));
$transaction['commission'] = (double) $filter->filter(self::findAttribute($singleTransaction, 'amount'));
//if (self::findAttribute($singleTransaction, 'txnType') == 'RFND'){
// $transaction['status'] = Oara_Utilities::STATUS_DECLINED;
//} else {
$transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
//}
$totalTransactions[] = $transaction;
}
}
}
return $totalTransactions;
}
示例6: getTransactionList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate, $sTransactionStatus)
*/
public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
{
$totalTransactions = array();
$urls = array();
$url = "http://www.foxtransfer.eu/index.php?q=prices.en.html&page=affiliate_orders&language=1&basedir=theme2&what=record_time&what=record_time&fy={$dStartDate->toString("yyyy")}&fm={$dStartDate->toString("M")}&fd={$dStartDate->toString("d")}&ty={$dEndDate->toString("yyyy")}&tm={$dEndDate->toString("M")}&td={$dEndDate->toString("d")}";
$urls[] = new Oara_Curl_Request($url, array());
$exportReport = array();
$exportReport = $this->_client->get($urls);
$exportReport = str_replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "", $exportReport);
$dom = new Zend_Dom_Query($exportReport[0]);
$tableList = $dom->query('#tartalom-hatter table[cellspacing="0"][cellpadding="3"][border="0"]');
$exportData = self::htmlToCsv(self::DOMinnerHTML($tableList->current()));
$num = count($exportData);
for ($i = 3; $i < $num; $i++) {
$transactionExportArray = str_getcsv($exportData[$i], ";");
$transaction = array();
$transaction['merchantId'] = 1;
$transaction['unique_id'] = $transactionExportArray[0];
$transaction['date'] = "{$dStartDate->toString("yyyy")}-{$dStartDate->toString("MM")}-01 00:00:00";
if ($transactionExportArray[7] == "Confirmed") {
$transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
} else {
if ($transactionExportArray[7] == "Cancelled") {
$transaction['status'] = Oara_Utilities::STATUS_DECLINED;
} else {
throw new Exception("New status found");
}
}
$transaction['amount'] = Oara_Utilities::parseDouble(preg_replace("/[^0-9\\.,]/", "", $transactionExportArray[10]));
$transaction['commission'] = Oara_Utilities::parseDouble(preg_replace("/[^0-9\\.,]/", "", $transactionExportArray[13]));
$totalTransactions[] = $transaction;
}
return $totalTransactions;
}
示例7: indexAction
public function indexAction()
{
$translate = Zend_Registry::get('Zend_Translate');
$this->view->title = 'Thống kê tháng - ' . $translate->_('TEXT_DEFAULT_TITLE');
$this->view->headTitle($this->view->title);
$layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
$option = array('layout' => '1_column/layout', 'layoutPath' => $layoutPath);
Zend_Layout::startMvc($option);
$date = new Zend_Date();
$date->subMonth(1);
$thang = $this->_getParam('thang', $date->toString("M"));
$nam = $this->_getParam('nam', $date->toString("Y"));
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
$em_id = $identity->em_id;
$holidaysModel = new Front_Model_Holidays();
$list_holidays = $holidaysModel->fetchData(array(), 'hld_order ASC');
$xinnghiphepModel = new Front_Model_XinNghiPhep();
$list_nghi_phep = $xinnghiphepModel->fetchByDate($em_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59");
$chamcongModel = new Front_Model_ChamCong();
$cham_cong = $chamcongModel->fetchOneData(array('c_em_id' => $em_id, 'c_thang' => $thang, 'c_nam' => $nam));
$khenthuongModel = new Front_Model_KhenThuong();
$khen_thuong = $khenthuongModel->fetchByDate($em_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59");
$kyluatModel = new Front_Model_KyLuat();
$ky_luat = $kyluatModel->fetchByDate($em_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59");
$this->view->cham_cong = $cham_cong;
$this->view->thang = $thang;
$this->view->nam = $nam;
$this->view->list_holidays = $list_holidays;
$this->view->list_nghi_phep = $list_nghi_phep;
$this->view->khen_thuong = $khen_thuong;
$this->view->ky_luat = $ky_luat;
}
示例8: createBackupFile
/**
* Set the backup file content
*
* @param string $content
* @return AW_Lib_Model_Log_Logger
*/
public function createBackupFile($content)
{
if (!extension_loaded("zlib") || !$content) {
return $this;
}
$date = new Zend_Date();
$fileName = $date->toString(Varien_Date::DATE_INTERNAL_FORMAT) . self::BACKUP_DEFAULT_FILE_NAME;
$pathToBackupDir = Mage::getBaseDir() . self::PATH_TO_BACKUP_DIR;
$pathToBackupFile = $pathToBackupDir . $fileName;
$backupFile = fopen($pathToBackupFile, 'w');
if (!$backupFile) {
return $this;
}
$fwrite = fwrite($backupFile, $content);
if (!$fwrite) {
fclose($backupFile);
unlink($pathToBackupFile);
return $this;
}
$archiveName = $date->toString(Varien_Date::DATE_INTERNAL_FORMAT) . self::BACKUP_DEFAULT_ARCHIVE_NAME;
$pathToBackupArchive = $pathToBackupDir . $archiveName;
$zipArchive = new ZipArchive();
$zipArchive->open($pathToBackupArchive, ZIPARCHIVE::CREATE);
$zipArchive->addFile($pathToBackupFile, $fileName);
$zipArchive->close();
fclose($backupFile);
unlink($pathToBackupFile);
return $this;
}
示例9: findallAction
public function findallAction()
{
if ($value_id = $this->getRequest()->getParam('value_id')) {
try {
$option = $this->getCurrentOptionValue();
$start_at = new Zend_Date();
$end_at = new Zend_Date();
$format = 'y-MM-dd HH:mm:ss';
$offset = $this->getRequest()->getParam('offset', 0);
$events = $option->getObject()->getEvents($offset);
$data = array('collection' => array());
foreach ($events as $key => $event) {
$start_at->set($event->getStartAt(), $format);
$end_at->set($event->getEndAt(), $format);
$formatted_start_at = $start_at->toString($this->_("MM.dd.y"));
$subtitle2 = $this->_("Entrance: %s", $event->getStartTimeAt());
if ($event->getLocationLabel()) {
$subtitle2 .= " | " . $this->_("Location: %s", $event->getLocationLabel());
}
$data['collection'][] = array("id" => $key, "title" => $event->getName(), "title2" => "{$start_at->toString(Zend_Date::WEEKDAY_NAME)} {$formatted_start_at}", "name" => $event->getName(), "subtitle" => $event->getSubtitle(), "subtitle2" => $subtitle2, "description" => $event->getDescription(), "month_name_short" => $start_at->toString(Zend_Date::MONTH_NAME_SHORT), "day" => $start_at->toString('dd'), "weekday_name" => $start_at->toString(Zend_Date::WEEKDAY_NAME), "start_time_at" => $event->getStartTimeAt(), "location" => $event->getLocation(), "url" => $this->getPath("event/mobile_view/index", array('value_id' => $option->getId(), "event_id" => $key)));
}
$data['page_title'] = $option->getTabbarName();
$data['displayed_per_page'] = Event_Model_Event::DISPLAYED_PER_PAGE;
} catch (Exception $e) {
$data = array('error' => 1, 'message' => $e->getMessage());
}
$this->_sendHtml($data);
}
}
示例10: selectedrequestcovenantAction
public function selectedrequestcovenantAction()
{
$responce = new stdClass();
$cdrequest = $_POST["idrequest"];
$requestModel = new RequestModel();
$clientCovenant = $requestModel->fetchRow($requestModel->getClientCovenantForward($cdrequest));
if ($clientCovenant['dtbirth'] != '') {
$dtbirth = new Zend_Date($clientCovenant['dtbirth'], 'dd-MM-YYYY');
$year = $dtbirth->toString('YYYY');
$month = $dtbirth->toString('MM');
$day = $dtbirth->toString('dd');
$today = new Zend_Date();
$tdYear = $today->toString('YYYY');
$tdMonth = $today->toString('MM');
$tdDay = $today->toString('dd');
$nrage = 0;
$nrage = GslabUtils::calcAgeDifferenceShort($clientCovenant['dtbirth']);
if ($tdMonth < $month || $tdMonth == $month && $tdDay < $day) {
$nrage--;
}
} else {
$nrage = " ";
}
$responce->forward = $clientCovenant['nmforward'];
$responce->covenant = $clientCovenant['nmcovenant'];
$responce->client = $clientCovenant['nmclient'];
$responce->fgsex = $clientCovenant['fgsex'];
$responce->age = $nrage;
$responce = json_encode($responce);
print_r($responce);
return $responce;
}
示例11: getSavedTime
public function getSavedTime()
{
$seconds = intval(Mage::helper('asyncindex')->getVariable('time'));
$time = new Zend_Date();
$time->setTime('00:00:00');
$time->addSecond($seconds);
return $time->toString('HH') . ' hr ' . $time->toString('mm') . ' min ' . $time->toString('ss') . ' sec';
}
示例12: viewCheckChuNhatThuBay
public function viewCheckChuNhatThuBay($day = 0, $month = 0, $year = 0)
{
Zend_Date::setOptions(array('format_type' => 'php'));
$date = new Zend_Date($day . '/' . $month . '/' . $year, 'd/m/Y');
if ($date->toString('D') == 'CN' || $date->toString('D') == 'Th 7') {
return 'class="error"';
}
}
示例13: toDate
/**
* Переводит строку datestamp, datetime из формата mysql в dd.MM.yyy
*
* @param $date строка даты
* @param bool $showTime показывать время
* @return string дата в необходимом формате
*/
public function toDate($date, $showTime = false)
{
$d = new Zend_Date($date);
if ($showTime) {
return $d->toString('dd.MM.yyyy, HH:mm');
}
return $d->toString('dd.MM.yyyy');
}
示例14: 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();
$pathGsutil = realpath(dirname(__FILE__)) . '/../../../../../gsutil/gsutil';
$dirDestination = realpath(dirname(__FILE__)) . '/../../data/pdf';
$file = "{$this->_bucket}/sales/salesreport_" . $dStartDate->toString("yyyyMM") . ".zip";
$url = "http://affjet.dc.fubra.net/tools/gsutil/gs.php?bucket=" . urlencode($file) . "&type=cp";
$context = \stream_context_create(array('http' => array('header' => "Authorization: Basic " . base64_encode("{$this->_httpLogin}"))));
\file_put_contents($dirDestination . "/report.zip", \file_get_contents($url, false, $context));
$zip = new \ZipArchive();
if ($zip->open($dirDestination . "/report.zip") === TRUE) {
$zip->extractTo($dirDestination);
$zip->close();
} else {
return $totalTransactions;
}
unlink($dirDestination . "/report.zip");
$salesReport = file_get_contents($dirDestination . "/salesreport_" . $dStartDate->toString("yyyyMM") . ".csv");
$salesReport = explode("\n", $salesReport);
for ($i = 1; $i < count($salesReport) - 1; $i++) {
$row = str_getcsv($salesReport[$i], ",");
$sub = false;
if ($row[12] < 0) {
$sub = true;
}
$obj = array();
$obj['unique_id'] = $row[0] . $row[3];
$obj['merchantId'] = "1";
$obj['date'] = $row[1] . " 00:00:00";
$obj['custom_id'] = $row[5];
$comission = 0.3;
if ($row[6] == "com.petrolprices.app") {
$value = 2.99;
$obj['amount'] = Oara_Utilities::parseDouble($value);
$obj['commission'] = Oara_Utilities::parseDouble($value - $value * $comission);
} else {
if ($row[6] == "com.fubra.wac") {
if ($obj['date'] < "2013-04-23 00:00:00") {
$value = 0.6899999999999999;
$obj['amount'] = Oara_Utilities::parseDouble($value);
$obj['commission'] = Oara_Utilities::parseDouble($value - $value * $comission);
} else {
$value = 1.49;
$obj['amount'] = Oara_Utilities::parseDouble($value);
$obj['commission'] = Oara_Utilities::parseDouble($value - $value * $comission);
}
}
}
if ($sub) {
$obj['amount'] = -$obj['amount'];
$obj['commission'] = -$obj['commission'];
}
$obj['status'] = Oara_Utilities::STATUS_CONFIRMED;
$totalTransactions[] = $obj;
}
unlink($dirDestination . "/salesreport_" . $dStartDate->toString("yyyyMM") . ".csv");
return $totalTransactions;
}
示例15: formatValue
public function formatValue($str = null, $fancy = false)
{
if (!is_null($str)) {
$date = new \Zend_Date($str);
return $fancy ? $date->toString(\Zend_Date::DATE_LONG) : $date->toString('dd/MM/yyyy');
} else {
return $str;
}
}