当前位置: 首页>>代码示例>>PHP>>正文


PHP JDate::toFormat方法代码示例

本文整理汇总了PHP中JDate::toFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP JDate::toFormat方法的具体用法?PHP JDate::toFormat怎么用?PHP JDate::toFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JDate的用法示例。


在下文中一共展示了JDate::toFormat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: authenticate

 /**
  * Tries to authenticate the user and start the backup, or send him back to the default task
  */
 function authenticate()
 {
     // Enforce raw mode - I need to be in full control!
     $format = JRequest::getCmd('format', 'html');
     if ($format != 'raw') {
         $this->setRedirect(JURI::base() . 'index.php?option=com_joomlapack&view=light&format=raw');
         parent::redirect();
     } else {
         if (!$this->_checkPermissions()) {
             parent::redirect();
         } else {
             $this->_setProfile();
             jimport('joomla.utilities.date');
             jpimport('core.cube');
             JoomlapackCUBE::reset();
             $cube =& JoomlapackCUBE::getInstance();
             $user =& JFactory::getUser();
             $userTZ = $user->getParam('timezone', 0);
             $dateNow = new JDate();
             $dateNow->setOffset($userTZ);
             $cube->start(JText::_('DEFAULT_COMMENT') . ' ' . $dateNow->toFormat(JText::_('DATE_FORMAT_LC2'), ''));
             $cube->save();
             $this->setRedirect(JURI::base() . 'index.php?option=com_joomlapack&view=light&task=step&key=' . JRequest::getVar('key') . '&profile=' . JRequest::getInt('profile') . '&format=raw');
         }
     }
 }
开发者ID:albertobraschi,项目名称:Hab,代码行数:29,代码来源:light.php

示例2: loadChartData

 function loadChartData()
 {
     $db = $this->getDBO();
     $type = JRequest::getCmd('type');
     switch ($type) {
         case 'sales':
             jimport('joomla.utilities.date');
             $date = JFactory::getDate();
             $interval = JRequest::getInt('interval', '14');
             $today = $date->toFormat('%Y-%m-%d');
             $startDate = strtotime('-' . $interval . ' day', strtotime($today));
             $startDate = new JDate($startDate);
             $query = "SELECT COUNT(virtuemart_order_id) AS sales, DATE(created_on) as `date` FROM #__virtuemart_orders WHERE created_on > " . $db->Quote($startDate->toMySQL()) . " GROUP BY `date` ORDER BY `date`";
             $db->setQuery($query);
             $rows = $db->loadObjectList();
             $data = array();
             foreach ($rows as $row) {
                 $data[$row->date] = (int) $row->sales;
             }
             $today = $date->toUnix();
             for ($time = $startDate->toUnix(); $time <= $today; $time += 86400) {
                 $date = date('Y', $time) . '-' . date('m', $time) . '-' . date('d', $time);
                 if (!array_key_exists($date, $data)) {
                     $data[$date] = 0;
                 }
             }
             ksort($data);
             $startYear = $startDate->toFormat('%Y');
             $startMonth = $startDate->toFormat('%m') - 1;
             $startDay = $startDate->toFormat('%d');
             $script = "\r\n                k2martSalesChartOptions.title.text = '" . JText::_('K2MART_TOTAL_SALES', true) . "';\r\n                k2martSalesChartOptions.subtitle.text = '* " . JText::_('K2MART_CLICK_AND_DRAG_IN_THE_PLOT_AREA_TO_ZOOM_IN', true) . "';\r\n                k2martSalesChartOptions.yAxis.title.text = '" . JText::_('K2MART_SALES', true) . "';\r\n                k2martSalesChartOptions.series[0].pointStart=Date.UTC(" . $startYear . ", " . $startMonth . ", " . $startDay . "); \r\n                k2martSalesChartOptions.series[0].data=[" . implode(',', $data) . "];\r\n                ";
             break;
         case 'products':
             $limit = JRequest::getInt('limit', '20');
             $query = "SELECT product.product_sales, productData.product_name FROM #__virtuemart_products AS product \r\n                LEFT JOIN #__virtuemart_products_" . VMLANG . " AS productData ON product.virtuemart_product_id = productData.virtuemart_product_id\r\n                WHERE  product.product_sales > 0 ORDER BY product.product_sales DESC LIMIT 0, {$limit}";
             $db->setQuery($query);
             $rows = $db->loadObjectList();
             $data = array();
             $categories = array();
             foreach ($rows as $row) {
                 $data[] = (int) $row->product_sales;
                 $categories[] = "'" . $row->product_name . "'";
             }
             $script = "\r\n                k2martProductsChartOptions.title.text = '" . JText::_('K2MART_TOP_SELLING_PRODUCTS', true) . "';\r\n                k2martProductsChartOptions.yAxis.title.text = '" . JText::_('K2MART_SALES', true) . "';\r\n                k2martProductsChartOptions.xAxis.categories =[" . implode(',', $categories) . "]; \r\n                k2martProductsChartOptions.series[0].data=[" . implode(',', $data) . "];\r\n                ";
             break;
     }
     $script .= "k2martChartType = '{$type}';";
     echo $script;
 }
开发者ID:Gskflute,项目名称:joomla25,代码行数:49,代码来源:dashboard.php

示例3: getToday

 static function getToday($ym = false)
 {
     jimport('joomla.utilities.date');
     $format = $ym == true ? '%Y-%m' : '%Y-%m-%d';
     $today_do = new JDate();
     return $today_do->toFormat($format);
 }
开发者ID:Rayvid,项目名称:joomla-jobboard,代码行数:7,代码来源:jobboard.php

示例4: authenticate

 /**
  * Tries to authenticate the user and start the backup, or send him back to the default task
  */
 public function authenticate()
 {
     // Enforce raw mode - I need to be in full control!
     $document =& JFactory::getDocument();
     $document->setType('raw');
     if (!$this->_checkPermissions()) {
         parent::redirect();
     } else {
         $session =& JFactory::getSession();
         $session->set('litemodeauthorized', 1, 'akeeba');
         $this->_setProfile();
         jimport('joomla.utilities.date');
         AECoreKettenrad::reset();
         $memory_filename = AEUtilTempvars::get_storage_filename(AKEEBA_BACKUP_ORIGIN);
         @unlink($memory_filename);
         $kettenrad =& AECoreKettenrad::load(AKEEBA_BACKUP_ORIGIN);
         $user =& JFactory::getUser();
         $userTZ = $user->getParam('timezone', 0);
         $dateNow = new JDate();
         $dateNow->setOffset($userTZ);
         if (AKEEBA_JVERSION == '16') {
             $description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true);
         } else {
             $description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->toFormat(JText::_('DATE_FORMAT_LC2'));
         }
         $options = array('description' => $description, 'comment' => '');
         $kettenrad->setup($options);
         $ret = $kettenrad->tick();
         AECoreKettenrad::save(AKEEBA_BACKUP_ORIGIN);
         $this->setRedirect(JURI::base() . 'index.php?option=com_akeeba&view=light&task=step&key=' . urlencode(JRequest::getVar('key')) . '&profile=' . JRequest::getInt('profile') . '&format=raw');
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:35,代码来源:light.php

示例5: display

 /**
  * Starts a backup
  * @return 
  */
 function display()
 {
     // Check permissions
     $this->_checkPermissions();
     // Set the profile
     $this->_setProfile();
     // Force the output to be of the raw format type
     JRequest::setVar('format', 'raw');
     $document =& JFactory::getDocument();
     $document->setType('raw');
     // Get the description, if present; otherwise use the default description
     jimport('joomla.utilities.date');
     $user =& JFactory::getUser();
     $userTZ = $user->getParam('timezone', 0);
     $dateNow = new JDate();
     $dateNow->setOffset($userTZ);
     $default_description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->toFormat(JText::_('DATE_FORMAT_LC2'));
     $description = JRequest::getString('description', $default_description);
     // Start the backup (CUBE Operation)
     jpimport('core.cube');
     JoomlapackCUBE::reset();
     $cube =& JoomlapackCUBE::getInstance();
     $cube->start($description, '');
     $cube->save();
     // Return the JSON output
     parent::display(false);
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:31,代码来源:json.php

示例6: display

 function display()
 {
     // Check permissions
     $this->_checkPermissions();
     // Set the profile
     $this->_setProfile();
     // Force the output to be of the raw format type
     JRequest::setVar('format', 'raw');
     $document =& JFactory::getDocument();
     $document->setType('raw');
     // Start the backup
     jimport('joomla.utilities.date');
     jpimport('core.cube');
     JoomlapackCUBE::reset();
     $cube =& JoomlapackCUBE::getInstance();
     $jconfig =& JFactory::getConfig();
     $userTZ = $jconfig->get('config.offset');
     /*
     $user =& JFactory::getUser();
     $userTZ = $user->getParam('timezone',0);
     */
     $dateNow = new JDate();
     $dateNow->setOffset($userTZ);
     $cube->start(JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->toFormat(JText::_('DATE_FORMAT_LC2'), ''));
     $cube->save();
     $this->setRedirect(JURI::base() . 'index.php?option=com_joomlapack&view=backup&task=step&key=' . JRequest::getVar('key') . '&profile=' . JRequest::getInt('profile', 1) . '&format=raw');
     parent::display();
 }
开发者ID:Ratmir15,项目名称:Joomla---formula-of-success,代码行数:28,代码来源:backup.php

示例7: export

 function export($event)
 {
     CFactory::load('helpers', 'event');
     $handler = CEventHelper::getHandler($event);
     if (!$handler->showExport()) {
         echo JText::_('CC ACCESS FORBIDDEN');
         return;
     }
     header('Content-type: text/Calendar');
     header('Content-Disposition: attachment; filename="calendar.ics"');
     $creator = CFactory::getUser($event->creator);
     $offset = $creator->getUtcOffset();
     $date = new JDate($event->startdate);
     $dtstart = $date->toFormat('%Y%m%dT%H%M%S');
     $date = new JDate($event->enddate);
     $dtend = $date->toFormat('%Y%m%dT%H%M%S');
     $url = $handler->getFormattedLink('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id, false, true);
     $tmpl = new CTemplate();
     $tmpl->set('dtstart', $dtstart);
     $tmpl->set('dtend', $dtend);
     $tmpl->set('url', $url);
     $tmpl->set('event', $event);
     $raw = $tmpl->fetch('events.ical');
     unset($tmpl);
     echo $raw;
     exit;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:27,代码来源:view.raw.php

示例8: formatDate

 public static function formatDate($date)
 {
     if (count($date) > 0) {
         $i = 0;
         $cur_date = new JDate($date);
         $f_date = $cur_date->toFormat("%B %d, %Y");
     }
     return $f_date;
 }
开发者ID:Rayvid,项目名称:joomla-jobboard,代码行数:9,代码来源:jobboard_job.php

示例9: get_local_timestamp

 /**
  * Returns the current timestamp, taking into account any TZ information,
  * in the format specified by $format.
  * @param string $format Timestamp format string (standard PHP format string)
  * @return string
  */
 public function get_local_timestamp($format)
 {
     jimport('joomla.utilities.date');
     $jregistry = JFactory::getConfig();
     $tzDefault = $jregistry->getValue('config.offset');
     $user = JFactory::getUser();
     $tz = $user->getParam('timezone', $tzDefault);
     $dateNow = new JDate('now', $tz);
     return $dateNow->toFormat($format);
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:16,代码来源:platform.php

示例10: display

	public function display()
	{
		// Check permissions
		$this->_checkPermissions();
		// Set the profile
		$this->_setProfile();

		// Start the backup
		jimport('joomla.utilities.date');
		AECoreKettenrad::reset();
		$memory_filename = AEUtilTempvars::get_storage_filename(AKEEBA_BACKUP_ORIGIN);
		@unlink($memory_filename);

		$kettenrad =& AECoreKettenrad::load(AKEEBA_BACKUP_ORIGIN);
		$user =& JFactory::getUser();
		$userTZ = $user->getParam('timezone',0);
		$dateNow = new JDate();
		$dateNow->setOffset($userTZ);
		if( AKEEBA_JVERSION == '16' ) {
			$description = JText::_('BACKUP_DEFAULT_DESCRIPTION').' '.$dateNow->format(JText::_('DATE_FORMAT_LC2'), true);
		} else {
			$description = JText::_('BACKUP_DEFAULT_DESCRIPTION').' '.$dateNow->toFormat(JText::_('DATE_FORMAT_LC2'));
		}
		$options = array(
			'description'	=> $description,
			'comment'		=> ''
		);
		$kettenrad->setup($options);
		$array = $kettenrad->tick();
		$array = $kettenrad->tick();
		AECoreKettenrad::save(AKEEBA_BACKUP_ORIGIN);
		
		if($array['Error'] != '')
		{
			// An error occured
			die('500 ERROR -- '.$array['Error']);
		}
		else
		{
			$noredirect = JRequest::getInt('noredirect', 0);
			if($noredirect != 0)
			{
				@ob_end_clean();
				echo "301 More work required";
				flush();
				JFactory::getApplication()->close();
			}
			else
			{
				$this->setRedirect(JURI::base().'index.php?option=com_akeeba&view=backup&task=step&key='.JRequest::getVar('key').'&profile='.JRequest::getInt('profile',1));
			}
		}
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:53,代码来源:backup.php

示例11: check

 /**
  * Overloaded check function
  *
  * @access public
  * @return boolean
  * @see JTable::check
  * @since 1.5
  */
 function check()
 {
     if (empty($this->alias)) {
         $this->alias = $this->name;
     }
     $this->alias = JFilterOutput::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $datenow = new JDate();
         $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
     }
     return true;
 }
开发者ID:Fellah,项目名称:govnobaki,代码行数:20,代码来源:newsfeed.php

示例12: getDescription

 /**
  * Returns the backup description
  * 
  * @param bool $noDefault Set to true to avoid setting a default
  * @return string
  */
 function getDescription($noDefault = false)
 {
     $description = JRequest::getString('description');
     if (empty($description) && !$noDefault) {
         jimport('joomla.utilities.date');
         $user =& JFactory::getUser();
         $userTZ = $user->getParam('timezone', 0);
         $dateNow = new JDate();
         $dateNow->setOffset($userTZ);
         return JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->toFormat(JText::_('DATE_FORMAT_LC2'));
     }
     return $description;
 }
开发者ID:albertobraschi,项目名称:Hab,代码行数:19,代码来源:backup.php

示例13: build

 function build()
 {
     return JDom::_('html.fly.datetime', $this->options);
     //DEPRECATED : Use fly.datetime
     $formatedDate = "";
     if ($this->dataValue && $this->dataValue != "0000-00-00" && $this->dataValue != "00:00:00" && $this->dataValue != "0000-00-00 00:00:00") {
         jimport("joomla.utilities.date");
         $date = new JDate($this->dataValue);
         $formatedDate = $date->toFormat($this->dateFormat);
     }
     $this->addClass('grid-date');
     $html = '<span <%STYLE%><%CLASS%><%SELECTORS%>>' . $formatedDate . '</span>';
     return $html;
 }
开发者ID:gwtrains,项目名称:comRTiPrint,代码行数:14,代码来源:datetime.php

示例14: getList

 function getList(&$params)
 {
     //get database
     $db =& JFactory::getDBO();
     $query = 'SELECT MONTH( created ) AS created_month, created, id, sectionid, title, YEAR(created) AS created_year' . ' FROM #__content' . ' WHERE ( state = -1 AND checked_out = 0 )' . ' GROUP BY created_year DESC, created_month DESC';
     $db->setQuery($query, 0, intval($params->get('count')));
     $rows = $db->loadObjectList();
     $menu =& JSite::getMenu();
     $item = $menu->getItems('link', 'index.php?option=com_content&view=archive', true);
     $itemid = isset($item) ? '&Itemid=' . $item->id : '';
     $i = 0;
     $lists = array();
     foreach ($rows as $row) {
         $date = new JDate($row->created);
         $created_month = $date->toFormat("%m");
         $month_name = $date->toFormat("%B");
         $created_year = $date->toFormat("%Y");
         $lists[$i]->link = JRoute::_('index.php?option=com_content&view=archive&year=' . $created_year . '&month=' . $created_month . $itemid);
         $lists[$i]->text = $month_name . ', ' . $created_year;
         $i++;
     }
     return $lists;
 }
开发者ID:Fellah,项目名称:govnobaki,代码行数:23,代码来源:helper.php

示例15: check

 /**
  * Overloaded check function
  *
  * @access public
  * @return boolean
  * @see JTable::check
  * @since 1.5
  */
 function check()
 {
     // check for valid name
     if (trim($this->title) == '') {
         $this->setError(JText::_('Your Poll must contain a title.'));
         return false;
     }
     // check for valid lag
     $this->lag = intval($this->lag);
     if ($this->lag == 0) {
         $this->setError(JText::_('Your Poll must have a non-zero lag time.'));
         return false;
     }
     if (empty($this->alias)) {
         $this->alias = $this->title;
     }
     $this->alias = JFilterOutput::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $datenow = new JDate();
         $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
     }
     return true;
 }
开发者ID:Fellah,项目名称:govnobaki,代码行数:31,代码来源:poll.php


注:本文中的JDate::toFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。