本文整理汇总了PHP中JHtml::date方法的典型用法代码示例。如果您正苦于以下问题:PHP JHtml::date方法的具体用法?PHP JHtml::date怎么用?PHP JHtml::date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JHtml
的用法示例。
在下文中一共展示了JHtml::date方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
$this->state = $this->get('State');
$from_date = $this->state->get('filter.from_date');
if (empty($from_date)) {
$this->state->set('filter.from_date', JHtml::date('now', 'Y-m-d'));
}
$to_date = $this->state->get('filter.to_date');
if (empty($to_date)) {
$this->state->set('filter.to_date', JHtml::date('now', 'Y-m-d'));
}
$order_status = $this->state->get('filter.order_status');
$this->state->set('filter.order_status', 'CONFIRMED');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$model = new BookProModelTransports();
$this->airport = $model->getGroupAirportList();
$this->dest_list = $model->dest_list;
$this->route_list = $model->getRouteList();
$this->total_order = $this->get('TotalBooking');
$this->total_pass = $this->get('Total');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Set the toolbar
$this->addToolBar();
// Display the template
parent::display($tpl);
}
示例2: exportpdf
/**
* Print passenger manifest to pdf
*/
function exportpdf()
{
AImporter::model('passengers');
$app = JFactory::getApplication();
$input = $app->input;
AImporter::helper('pdf', 'date');
$model = new BookproModelpassengers(array('ignore_request' => 0));
if ($app->isAdmin()) {
$ticket_view = $this->getView('passengers', 'html', 'BookProView');
} else {
$ticket_view = $this->getView('AgentPassengers', 'html', 'BookProView');
$ticket_view->is_admin = 1;
}
$ticket_view->setModel($model, true);
$ticket_view->setLayout('report');
ob_start();
$ticket_view->display();
$pdf = ob_get_contents();
ob_end_clean();
$order = new JObject();
$order->name = 'Tour_report' . '_export_time_' . JHtml::date('now', 'Y-m-d-H-i-s');
$order->fontsize = 7;
PrintPdfHelper::printTicket($pdf, $order, 'P');
return;
}
示例3: display
/**
* Display the view
*
* @access public
*/
function display($tpl = null)
{
$app = JFactory::getApplication();
$state = $this->get('State');
$item = $this->get('Item');
$form = $this->get('Form');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
JHTML::stylesheet('administrator/components/com_xmap/css/xmap.css');
// Convert dates from UTC
$offset = $app->getCfg('offset');
if (intval($item->created)) {
$item->created = JHtml::date($item->created, '%Y-%m-%d %H-%M-%S', $offset);
}
$form->bind($item);
$this->assignRef('state', $state);
$this->assignRef('item', $item);
$this->assignRef('form', $form);
$this->_setToolbar();
parent::display($tpl);
JRequest::setVar('hidemainmenu', true);
}
示例4: getShortDate
/**
* Returns date/time in short format. i.e. 6m, 6h, 6d, 6w, 6m, 6y etc
* @param unknown $date
* @return Ambigous <string, string, mixed, multitype:>|Ambigous <string, string, mixed>
*/
public static function getShortDate($date)
{
if (empty($date) || $date == '0000-00-00 00:00:00') {
return JText::_('LBL_NA');
}
jimport('joomla.utilities.date');
$user = JFactory::getUser();
// Given time
$date = new JDate(JHtml::date($date, 'Y-m-d H:i:s'));
$compareTo = new JDate(JHtml::date('now', 'Y-m-d H:i:s'));
$diff = $compareTo->toUnix() - $date->toUnix();
$diff = abs($diff);
$dayDiff = floor($diff / 86400);
if ($dayDiff == 0) {
if ($diff < 120) {
return '1m';
} elseif ($diff < 3600) {
return floor($diff / 60) . 'm';
} else {
return floor($diff / 3600) . 'h';
}
} elseif ($dayDiff < 7) {
return $dayDiff . 'd';
} elseif ($dayDiff < 7 * 6) {
return ceil($dayDiff / 7) . 'w';
} elseif ($dayDiff < 365) {
return ceil($dayDiff / (365 / 12)) . 'm';
} else {
return round($dayDiff / 365) . 'y';
}
}
示例5: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
// Initialize some field attributes.
$format = $this->element['format'] ? (string) $this->element['format'] : 'd.m.Y H:i';
$readonly = $this->element['readonly'] ? 'readonly="readonly"' : null;
if ($this->value && $this->value !== '0000-00-00 00:00:00') {
$this->value = JHtml::date($this->value, $format);
} else {
$this->value = null;
}
$jformat = str_replace('d', '%d', $format);
$jformat = str_replace('m', '%m', $jformat);
$jformat = str_replace('Y', '%Y', $jformat);
$jformat = str_replace('H', '%H', $jformat);
$jformat = str_replace('i', '%M', $jformat);
$time = JHtml::date('now', 'Hi');
$html = '<input name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value . '"' . $readonly . ' /><img onmouseover="this.style.cursor=\'pointer\'" src="media/com_smfaq/images/calendar_icon.png" alt="Calendar" id="cal-' . $this->element['name'] . '" />';
$html .= '<script type="text/javascript">
Calendar.setup({
trigger : "cal-' . $this->element['name'] . '",
inputField : "' . $this->id . '",
dateFormat : "' . $jformat . '",
onSelect : function() { this.hide() },
showTime: true,
time: "' . $time . '",
});
</script>';
return $html;
}
示例6: check
function check()
{
if (empty($this->id)) {
$this->created = JHtml::date('now', 'Y-m-d H:i:s');
}
return true;
}
示例7: setData
public function setData($order)
{
$form_data = $this->app->data->create();
$billto = array($order->elements->get('billing.name'), $order->elements->get('billing.street1'), $order->elements->get('billing.street2') ? $order->elements->get('billing.street2') : null, $order->elements->get('billing.city') . ', ' . $order->elements->get('billing.state') . ' ' . $order->elements->get('billing.postalCode'), $order->elements->get('billing.phoneNumber') . ' ' . $order->elements->get('billing.altNumber'), $order->elements->get('email'));
$form_data->set('billto', $billto);
if ($order->elements->get('shipping_method') != 'LP') {
$shipto = array($order->elements->get('shipping.name'), $order->elements->get('shipping.street1'), $order->elements->get('shipping.street2'), $order->elements->get('shipping.city') . ', ' . $order->elements->get('shipping.state') . ' ' . $order->elements->get('shipping.postalCode'), $order->elements->get('shipping.phoneNumber') . ' ' . $order->elements->get('shipping.altNumber'));
$form_data->set('shipto', $shipto);
}
$item_array = array();
foreach ($order->elements->get('items.', array()) as $item) {
$options = array();
foreach ($item->options as $option) {
$options[] = $option['name'] . ': ' . $option['text'];
}
$item_array[] = array('item_description' => array(array('format' => 'item-name', 'text' => $item->name), array('format' => 'item-options', 'text' => implode("\n", $options))), 'qty' => array('text' => $item->qty), 'price' => array('text' => $item->getTotal('base')));
}
$form_data->set('items', $item_array);
$form_data->set('id', $order->id);
$form_data->set('created', JHtml::date($order->created, JText::_('DATE_STORE_RECEIPT')));
$form_data->set('salesperson', $order->getCreator());
$form_data->set('payment_info', $order->params->get('payment.creditcard.card_name') . ' ' . $order->params->get('payment.creditcard.cardNumber'));
$form_data->set('delivery_method', JText::_(($ship = $order->elements->get('shipping_method')) ? 'SHIPPING_METHOD_' . $ship : ''));
$form_data->set('terms', JText::_(($terms = $order->params->get('terms')) ? 'ACCOUNT_TERMS_' . $terms : ''));
$form_data->set('subtotal', $order->getSubtotal());
$form_data->set('tax_total', $order->getTaxTotal());
$form_data->set('ship_total', $order->getShippingTotal());
$form_data->set('total', $order->getTotal());
return parent::setData($form_data);
}
示例8: display
/**
* Display the view
*
* @access public
*/
function display($tpl = null)
{
$app = JFactory::getApplication();
$this->state = $this->get('State');
$this->item = $this->get('Item');
$this->form = $this->get('Form');
$version = new JVersion();
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
JHTML::stylesheet('administrator/components/com_xmap/css/xmap.css');
// Convert dates from UTC
$offset = $app->getCfg('offset');
if (intval($this->item->created)) {
$this->item->created = JHtml::date($this->item->created, '%Y-%m-%d %H-%M-%S', $offset);
}
$this->_setToolbar();
if (version_compare($version->getShortVersion(), '3.0.0', '<')) {
$tpl = 'legacy';
}
parent::display($tpl);
JRequest::setVar('hidemainmenu', true);
}
示例9: calendar
static function calendar($isodate, $name)
{
$cfg = BidsHelperTools::getConfig();
$result = JHTML::_('calendar', $isodate, $name, $name, BidsHelperDateTime::dateFormatConversion($cfg->date_format));
if ($isodate) {
//ISODATES and JHtml::_('calendar') doesn't take kindly all formats
$result = str_replace(' value="' . htmlspecialchars($isodate, ENT_COMPAT, 'UTF-8') . '"', ' value="' . htmlspecialchars(JHtml::date($isodate, $cfg->date_format, false), ENT_COMPAT, 'UTF-8') . '"', $result);
}
return $result;
}
示例10: showDate
public static function showDate($date = null, $date_format = null)
{
if (is_null($date)) {
$date = JFactory::getDate()->toSql();
}
if (is_null($date_format)) {
$date_format = RSMembershipHelper::getConfig('date_format');
}
return JHtml::date($date, $date_format);
}
示例11: display
/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return mixed JError object on failure, void on success.
*
* @since 2.5
*/
public function display($tpl = null)
{
// Get the application
$app = JFactory::getApplication();
// Adjust the list limit to the feed limit.
$app->input->set('limit', $app->getCfg('feed_limit'));
// Get view data.
$state = $this->get('State');
$params = $state->get('params');
$query = $this->get('Query');
$results = $this->get('Results');
// Push out the query data.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
$suggested = JHtml::_('query.suggested', $query);
$explained = JHtml::_('query.explained', $query);
// Set the document title.
$title = $params->get('page_title', '');
if (empty($title)) {
$title = $app->getCfg('sitename');
} elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
} elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
}
$this->document->setTitle($title);
// Configure the document description.
if (!empty($explained)) {
$this->document->setDescription(html_entity_decode(strip_tags($explained), ENT_QUOTES, 'UTF-8'));
}
// Set the document link.
$this->document->link = JRoute::_($query->toURI());
// If we don't have any results, we are done.
if (empty($results)) {
return;
}
// Convert the results to feed entries.
foreach ($results as $result) {
// Convert the result to a feed entry.
$item = new JFeedItem();
$item->title = $result->title;
$item->link = JRoute::_($result->route);
$item->description = $result->description;
$item->date = intval($result->start_date) ? JHtml::date($result->start_date, 'l d F Y') : $result->indexdate;
// Get the taxonomy data.
$taxonomy = $result->getTaxonomy();
// Add the category to the feed if available.
if (isset($taxonomy['Category'])) {
$node = array_pop($taxonomy['Category']);
$item->category = $node->title;
}
// Loads item info into rss array.
$this->document->addItem($item);
}
}
示例12: register
function register()
{
$option = JRequest::getCmd('option');
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
//$mainframe->enqueueMessage(JText::_('PredictionEntry Task -> '.$this->getTask()),'');
JRequest::checkToken() or jexit(JText::_('COM_JOOMLEAGUE_PRED_INVALID_TOKEN_REFUSED'));
$msg = '';
$link = '';
$post = JRequest::get('post');
$predictionGameID = JRequest::getVar('prediction_id', '', 'post', 'int');
$joomlaUserID = JRequest::getVar('user_id', '', 'post', 'int');
$approved = JRequest::getVar('approved', 0, '', 'int');
$model = $this->getModel('predictionentry');
$user =& JFactory::getUser();
$isMember = $model->checkPredictionMembership();
if ($user->id != $joomlaUserID) {
$msg .= JText::_('COM_JOOMLEAGUE_PRED_ENTRY_CONTROLLER_ERROR_1');
$link = JFactory::getURI()->toString();
} else {
if ($isMember) {
$msg .= JText::_('COM_JOOMLEAGUE_PRED_ENTRY_CONTROLLER_ERROR_4');
$link = JFactory::getURI()->toString();
} else {
//$post['registerDate'] = JHTML::date(time(),'Y-m-d h:i:s');
$post['registerDate'] = JHtml::date($input = 'now', 'Y-m-d h:i:s', false);
//if (!$model->store($post,'PredictionEntry'))
if (!$model->store($post)) {
$msg .= JText::_('COM_JOOMLEAGUE_PRED_ENTRY_CONTROLLER_ERROR_5');
$link = JFactory::getURI()->toString();
} else {
$cids = array();
$cids[] = $model->getDbo()->insertid();
JArrayHelper::toInteger($cids);
$msg .= JText::_('COM_JOOMLEAGUE_PRED_ENTRY_CONTROLLER_MSG_2');
if ($model->sendMembershipConfirmation($cids)) {
$msg .= ' - ';
$msg .= JText::_('COM_JOOMLEAGUE_PRED_ENTRY_CONTROLLER_MSG_3');
} else {
$msg .= ' - ';
$msg .= JText::_('COM_JOOMLEAGUE_PRED_ENTRY_CONTROLLER_ERROR_6');
}
$params = array('option' => 'com_joomleague', 'view' => 'predictionentry', 'prediction_id' => $predictionGameID, 's' => '1');
$query = JoomleagueHelperRoute::buildQuery($params);
$link = JRoute::_('index.php?' . $query, false);
}
}
}
echo '<br /><br />';
echo '#' . $msg . '#<br />';
$this->setRedirect($link, $msg);
}
示例13: editEndDate
static function editEndDate(&$auction, $isAdmin = false)
{
$cfg = BidsHelperTools::getConfig();
$dateFormat = BidsHelperDateTime::dateFormatConvert2JHTML(false);
$fType = CustomFieldsFactory::getFieldType('date');
$calendarFormat = $fType->dateFormatConversion($dateFormat);
$dateFormat = BidsHelperDateTime::dateFormatConvert2JHTML(false);
if (!$cfg->bid_opt_enable_date) {
if ($auction->id && $auction->published) {
$html = JHTML::date(JFactory::getDate($auction->end_date)->toUnix(), $dateFormat);
} else {
$tooltipMsg = array();
if (intval($cfg->bid_opt_default_period) > 0) {
$tooltipMsg[] = JText::_('COM_BIDS_AUTO_END_DATE_TOOLTIP_1') . ' ' . $cfg->bid_opt_default_period . ' ' . JText::_('COM_BIDS_DAYS');
}
if ($cfg->bid_opt_allow_proxy && intval($cfg->bid_opt_proxy_default_period) > 0) {
$tooltipMsg[] = JText::_('COM_BIDS_AUTO_END_DATE_TOOLTIP_2') . ' ' . $cfg->bid_opt_proxy_default_period . ' ' . JText::_('COM_BIDS_DAYS');
}
if (($cfg->bid_opt_global_enable_bin || $cfg->bid_opt_enable_bin_only) && intval($cfg->bid_opt_bin_default_period) > 0) {
$tooltipMsg[] = JText::_('COM_BIDS_AUTO_END_DATE_TOOLTIP_3') . ' ' . $cfg->bid_opt_bin_default_period . ' ' . JText::_('COM_BIDS_DAYS');
}
if ($cfg->bid_opt_global_enable_reserve_price && intval($cfg->bid_opt_reserve_price_default_period) > 0) {
$tooltipMsg[] = JText::_('COM_BIDS_AUTO_END_DATE_TOOLTIP_4') . ' ' . $cfg->bid_opt_reserve_price_default_period . ' ' . JText::_('COM_BIDS_DAYS');
}
$html = count($tooltipMsg) ? JHtml::tooltip(implode('<br />', $tooltipMsg)) : '-';
}
} else {
if ($auction->published && !$isAdmin) {
$html = JHTML::date(JFactory::getDate($auction->end_date)->toUnix(), $dateFormat);
} else {
$attribs = array('class' => 'inputbox required validate-start-date');
$date = $auction->end_date ? $auction->end_date : '';
$d = $date ? $date : '';
if (preg_match('/^[0-9][0-9]:[0-9][0-9]$/', $date)) {
//if it's only end hour
$d = "";
}
$html = JHTML::calendar($d, 'end_date', 'end_date', $calendarFormat, $attribs);
if ($d) {
$html = str_replace(' value="' . htmlspecialchars($d, ENT_COMPAT, 'UTF-8') . '"', ' value="' . htmlspecialchars(JHtml::date($d, $cfg->bid_opt_date_format, false), ENT_COMPAT, 'UTF-8') . '"', $html);
}
if ($cfg->bid_opt_enable_hour) {
$endHours = $auction->end_date ? JHTML::date($auction->end_date, 'H') : '00';
$endMinutes = $auction->end_date ? JHTML::date($auction->end_date, 'i') : '00';
$html .= ' <input name="end_hour" size="1" value="' . $endHours . '" maxlength="2" class="inputbox required" onblur="bidCheckHours(this)" /> :
<input name="end_minutes" size="1" value="' . $endMinutes . '" maxlength="2" class="inputbox required" onblur="bidCheckMinutes(this)" />';
}
$html .= ' ' . JHtml::image(JUri::root() . 'components/com_bids/images/requiredfield.gif', 'Required');
}
}
return $html;
}
示例14: store
public function store($data = null)
{
$data = $data ? $data : JRequest::getVar('jform', array(), 'post', 'array');
$row = JTable::getInstance($data['table'], 'Table');
$date = date("Y-m-d H:i:s");
// Bind the form fields to the table
if (!$row->bind($data)) {
return false;
}
$row->modified = $date;
if (!$row->created) {
$row->created = $date;
}
if ($data['table'] == 'ddcaccounts') {
if ($this->data['alias'] == null) {
$row->alias = JFilterOutput::stringURLSafe($data['account_name']);
}
}
if ($data['table'] == 'ddcgoals') {
if ($data['alias'] == null) {
$row->alias = JFilterOutput::stringURLSafe($data['title']);
}
$row->target_date = JHtml::date($data['target_date'], "Y-m-d");
if ($data['end_date'] != null) {
$row->end_date = JHtml::date($data['end_date'], "Y-m-d");
}
}
if ($data['table'] == 'ddcaccount_types') {
if ($data['alias'] == null) {
$row->alias = JFilterOutput::stringURLSafe($data['account_type']);
}
}
if ($data['table'] == "ddcbalances") {
$row->balance = $data['balance_dr'] - $data['balance_cr'];
$row->record_date = JHtml::date($data['record_date'], "Y-m-d");
}
// Make sure the record is valid
if (!$row->check()) {
return false;
}
if (!$row->store()) {
return false;
}
return $row;
}
示例15: backup
function backup()
{
$sqlFileName = 'bids.sql';
$imagesDir = AUCTION_PICTURES_PATH;
jimport('joomla.filesystem.archive');
jimport('joomla.filesystem.file');
if (!is_writable(AUCTION_BACKUPS_PATH)) {
JError::raiseWarning(500, '<strong style="color:red;">' . AUCTION_BACKUPS_PATH . ' not writable!</strong>');
return false;
}
$sqlData = $this->backupSQL();
$imagesData = $this->backupImages();
$backupFile = AUCTION_BACKUPS_PATH . DS . 'Auction_Factory_BKP_' . JHtml::date('now', 'd-M-Y_H-i-s') . '.zip';
$aFilesData = array_merge($sqlData, $imagesData);
$zip = JArchive::getAdapter('zip');
//the second parameter for this function is very odd
//as you can see above, each "file" entity needs to be an array with 2 keys: 'name' and 'data'
$zip->create($backupFile, $aFilesData);
return $backupFile;
}