本文整理汇总了PHP中JHtml::Date方法的典型用法代码示例。如果您正苦于以下问题:PHP JHtml::Date方法的具体用法?PHP JHtml::Date怎么用?PHP JHtml::Date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JHtml
的用法示例。
在下文中一共展示了JHtml::Date方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
$app = JFactory::getApplication();
$user = JFactory::getUser();
$userLevels = implode(',', $user->authorisedLevels());
$db =& JFactory::getDBO();
//$menu = &JSite::getMenu();
$menu = JFactory::getApplication()->getMenu();
$document =& JFactory::getDocument();
$params = $app->getParams();
// Specific category
$id = JRequest::getVar('id', 0, '', 'int');
// Params
$categories = $params->get('feed_cat_ids', '');
$ordering = $params->get('feed_img_ordering', 6);
$imgCount = $params->get('feed_img_count', 5);
$feedTitle = $params->get('feed_title', JText::_('COM_PHOCAGALLERY_GALLERY'));
$tmpl['picasa_correct_width_m'] = (int) $params->get('medium_image_width', 100);
$tmpl['picasa_correct_height_m'] = (int) $params->get('medium_image_height', 100);
$document->setTitle($this->escape(html_entity_decode($feedTitle)));
if ($id > 0) {
$wheres[] = ' c.id =' . (int) $id;
} else {
if (count($categories) > 1) {
JArrayHelper::toInteger($categories);
$categoriesString = implode(',', $categories);
$wheres[] = ' c.id IN ( ' . $categoriesString . ' ) ';
} else {
if ((int) $categories > 0) {
$wheres[] = ' c.id IN ( ' . $categories . ' ) ';
}
}
}
$imageOrdering = PhocaGalleryOrdering::getOrderingString($ordering, 6);
$wheres[] = ' a.published = 1';
$wheres[] = ' a.approved = 1';
$wheres[] = ' c.published = 1';
$wheres[] = ' c.approved = 1';
$wheres[] = ' c.access IN (' . $userLevels . ')';
$u = " (c.accessuserid LIKE '%0%' OR c.accessuserid LIKE '%-1%' OR c.accessuserid LIKE '%," . (int) $user->id . "' OR c.accessuserid LIKE '" . (int) $user->id . ",%' OR c.accessuserid LIKE '%," . (int) $user->id . ",%' OR c.accessuserid =" . (int) $user->id . ") ";
$e = 'c.accessuserid IS NULL';
$wheres[] = ' CASE WHEN c.accessuserid IS NOT NULL THEN ' . $u . ' ELSE ' . $e . ' END';
$query = 'SELECT a.*, c.alias as catalias, c.title as categorytitle' . ' FROM #__phocagallery AS a' . ' LEFT JOIN #__phocagallery_categories AS c ON a.catid = c.id' . ' WHERE ' . implode(' AND ', $wheres) . $imageOrdering['output'];
$db->setQuery($query, 0, $imgCount);
$images = $db->loadObjectList();
foreach ($images as $keyI => $value) {
$item = new JFeedItem();
$title = $this->escape($value->title);
$title = html_entity_decode($title);
$item->title = $title;
$link = PhocaGalleryRoute::getCategoryRoute($value->catid, $value->catalias);
$item->link = JRoute::_($link);
// imgDate
$imgDate = '';
$imgDate = JHtml::Date($value->date, "Y-m-d h:m:s");
if ($imgDate != '') {
$item->date = $imgDate;
}
$item->description = '';
if ($value->description != '') {
$item->description .= '<div>' . $value->description . '</div>';
}
$extImage = false;
if (isset($value->extid)) {
$extImage = PhocaGalleryImage::isExtImage($value->extid);
}
// Trying to fix but in Joomla! method $this->_relToAbs - it cannot work with JRoute links :-(
$itemL = str_replace(JURI::base(true), '', $item->link);
if (substr($itemL, 0, 1) == '/') {
$itemL = substr_replace($itemL, '', 0, 1);
}
$itemL = JURI::base() . $itemL;
// Should really not happen
$itemLTmp = str_replace('http://', '', $itemL);
$pos = stripos($itemLTmp, '//');
if ($pos !== false) {
$itemLTmp = str_replace('//', '/', $itemLTmp);
$itemL = 'http://' . $itemLTmp;
}
// - - - - - - - - - - -
if ($extImage) {
$correctImageRes = PhocaGalleryPicasa::correctSizeWithRate($value->extw, $value->exth, $tmpl['picasa_correct_width_m'], $tmpl['picasa_correct_height_m']);
$imgLink = $value->extm;
//$i = '<div><a href="'.JRoute::_($link).'"><img src="'.$imgLink .'" border="0" width="'.$correctImageRes['width'].'" height="'.$correctImageRes['height'].'" /></a></div>';
$i = '<div><a href="' . $itemL . '"><img src="' . $imgLink . '" border="0" /></a></div>';
} else {
$imgLink = PhocaGalleryImageFront::displayCategoryImageOrNoImage($value->filename, 'medium');
$i = '<div><a href="' . $itemL . '"><img src="' . $imgLink . '" border="0" /></a></div>';
}
$item->description .= $i;
$item->category = $value->categorytitle;
/*if ($value->author != '') {
$item->author = $value->author;
}*/
$document->addItem($item);
}
}
示例2: echo
?>
<?php
echo JHtml::date($item->datum, JText::_('DATE_FORMAT_LC4'));
?>
<?php
}
?>
</td>
<td class="nowrap">
<?php
echo $item->tauchplatz;
?>
</td>
<td class="hidden-phone">
<?php
echo JHtml::Date($item->meldedatum, JText::_('DATE_FORMAT_LC2'));
?>
</td>
<td class="nowrap hidden-phone">
<?php
echo (int) $item->id;
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
示例3:
</a>
</div>
</div>
</div><?php
// subfolder
if ($value->type == 1) {
if ($value->display_name == 1 || $value->display_name == 2) {
echo '<div class="pg-name">' . PhocaGalleryText::wordDelete($value->title, $this->tmpl['charlengthname'], '...') . '</div>';
}
}
// image
if ($value->type == 2) {
if ($value->display_name == 1) {
echo '<div class="pg-name">' . PhocaGalleryText::wordDelete($value->title, $this->tmpl['charlengthname'], '...') . '</div>';
}
if ($value->display_name == 2) {
echo '<div class="pg-name"> </div>';
}
}
echo '<div class="detail" style="margin-top:2px;text-align:left">';
echo JHtml::_('image', 'media/com_phocagallery/images/icon-date.png', JText::_('COM_PHOCAGALLERY_IMAGE_DETAIL'));
echo ' ' . JHtml::Date($value->date, "d. m. Y");
echo '</div>';
echo '<div class="ph-cb"></div>';
echo '</div>';
}
echo '<div class="ph-cb"></div>';
}
}
// END MOST VIEWED
echo '</div>' . "\n";
示例4: onVenueEdited
/**
* This method handles any mailings triggered by an venue store action
*
* @access public
* @param int $venue_id Integer Venue identifier
* @param int $is_new Integer Venue new or edited
* @return boolean
*
*/
public function onVenueEdited($venue_id, $is_new)
{
// Sendto
$send_to = array(
'user' => $is_new ? $this->params->get('newvenue_mail_user', '1') : $this->params->get('editvenue_mail_user', '0'),
'admin' => $is_new ? $this->params->get('newvenue_mail_admin', '1') : $this->params->get('editvenue_mail_admin', '0'),
);
// Skip if processing not needed
if (!array_filter($send_to)) return true;
$user = JFactory::getUser();
$username = empty($this->_UseLoginName) ? $user->name : $user->username;
// get data
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('alias');
$case_when .= ' THEN ';
$id = $query->castAsChar('id');
$case_when .= $query->concatenate(array($id, 'alias'), ':');
$case_when .= ' ELSE ';
$case_when .= $id.' END as slug';
$query->select(array('id','published','venue','city','street','postalCode','url','country','locdescription','created','modified',$case_when));
$query->from('#__jem_venues');
$query->where(array('id= '.$db->quote($venue_id)));
$db->setQuery($query);
if (is_null($venue = $db->loadObject())) return false;
# at this point we do have a result
// Define link for venue
$link = JRoute::_(JUri::base().JEMHelperRoute::getVenueRoute($venue->slug), false);
// Define published-state message
$adminstate = $venue->published ? JText::sprintf('PLG_JEM_MAILER_VENUE_PUBLISHED', $link) : JText::_('PLG_JEM_MAILER_VENUE_UNPUBLISHED');
$userstate = $venue->published ? JText::sprintf('PLG_JEM_MAILER_USER_MAIL_VENUE_PUBLISHED', $link) : JText::_('PLG_JEM_MAILER_USER_MAIL_VENUE_UNPUBLISHED');
// Strip tags/scripts,etc from description
$text_description = JFilterOutput::cleanText($venue->locdescription);
#######################
## RECEIVERS - ADMIN ##
#######################
# in here we selected the option to send to admin.
# we selected admin so we can use the adminDBList.
# if the adminDBList is empty mailing should stop!
if ($send_to['admin']) {
$admin_receivers = $this->_AdminDBList;
if ($admin_receivers) {
$data = new stdClass();
# is the venue new or edited?
if ($is_new) {
# the venue is new and we send a mail to adminDBList
$created = JHtml::Date($venue->created, JText::_('DATE_FORMAT_LC2'));
$data->subject = JText::sprintf('PLG_JEM_MAILER_NEW_VENUE_MAIL', $this->_SiteName, $venue->venue);
$data->body = JText::sprintf('PLG_JEM_MAILER_NEW_VENUE_A', $username, $created, $venue->venue, $venue->url, $venue->street, $venue->postalCode, $venue->city, $venue->country, $text_description, $adminstate);
} else {
# the venue is edited and we send a mail to adminDBList
$modified = JHtml::Date($venue->modified, JText::_('DATE_FORMAT_LC2'));
$data->subject = JText::sprintf('PLG_JEM_MAILER_EDIT_VENUE_MAIL', $this->_SiteName, $venue->venue);
$data->body = JText::sprintf('PLG_JEM_MAILER_EDIT_VENUE_A', $username, $modified, $venue->venue, $venue->url, $venue->street, $venue->postalCode, $venue->city, $venue->country, $text_description, $adminstate);
}
$data->receivers = $admin_receivers;
$this->_mailer($data);
} else {
return false;
}
}
######################
## RECEIVERS - USER ##
######################
# here we selected the option to send to a logged in user
# we make a selection between added/edited venue
# -> here we don't specify an extra variable
if ($send_to['user']) {
//.........这里部分代码省略.........
示例5: getData
public function getData()
{
$app = JFactory::getApplication();
$eventTimeZone = null;
$error_messages = array();
jimport('joomla.filter.output');
// Get Params
$params = $app->getParams();
$submitAccess = $params->get('submitAccess', '');
$approvalGroups = $params->get('approvalGroups', array("8"));
// Get User
$user = JFactory::getUser();
// Get User Groups
// Joomla 3.x/2.5 SWITCH
if (version_compare(JVERSION, '3.0', 'ge')) {
$userGroups = $user->groups;
} else {
$userGroups = $user->getAuthorisedGroups();
}
$user_id = $user->get('id');
// logged-in Users: Name/User Name Option
$nameJoomlaUser = $params->get('nameJoomlaUser', 1);
$u_name = $nameJoomlaUser == 1 ? $user->get('name') : $user->get('username');
$this->data = new stdClass();
$this->data->id = null;
$this->data->asset_id = JRequest::getVar('asset_id', '', 'post');
$this->data->ordering = 0;
$this->data->state = 1;
// Control: if Manager
jimport('joomla.access.access');
$adminUsersArray = array();
foreach ($approvalGroups as $ag) {
$adminUsers = JAccess::getUsersByGroup($ag, False);
$adminUsersArray = array_merge($adminUsersArray, $adminUsers);
}
$this->data->approval = in_array($user_id, $adminUsersArray) ? '0' : '1';
$this->data->access = 1;
$this->data->language = '*';
// $menuID = JRequest::getVar('menuID', '', 'post');
// USER NAME
$this->data->username = JRequest::getVar('username', '', 'post');
if (!$this->data->username) {
$error_messages[] = JText::sprintf('COM_ICAGENDA_FORM_VALIDATE_FIELD_REQUIRED_NAME', JText::_('COM_ICAGENDA_SUBMIT_FORM_USER_NAME'));
}
// USER EMAIL
$this->data->created_by_email = JRequest::getVar('created_by_email', '', 'post');
if (!$this->data->created_by_email) {
$error_messages[] = JText::sprintf('COM_ICAGENDA_FORM_VALIDATE_FIELD_REQUIRED_NAME', JText::_('COM_ICAGENDA_SUBMIT_FORM_USER_EMAIL'));
}
// EVENT TITLE
$this->data->title = JRequest::getVar('title', '', 'post');
if (!$this->data->title) {
$error_messages[] = JText::sprintf('COM_ICAGENDA_FORM_VALIDATE_FIELD_REQUIRED_NAME', JText::_('COM_ICAGENDA_FORM_LBL_EVENT_TITLE'));
}
// EVENT CATEGORY
$this->data->catid = JRequest::getVar('catid', '', 'post');
if (!$this->data->catid) {
$error_messages[] = JText::sprintf('COM_ICAGENDA_FORM_VALIDATE_FIELD_REQUIRED_NAME', JText::_('COM_ICAGENDA_FORM_LBL_EVENT_CATID'));
}
// EVENT IMAGE - Get and Upload Image
$image = JRequest::getVar('image', null, 'files', 'array');
$image_session = JRequest::getVar('image_session', '', 'post');
if ($image_session && empty($image)) {
$this->data->image = $image_session;
} else {
$this->data->image = $image;
// Process upload of files
$this->data->image = $this->frontendImageUpload($this->data->image);
}
$noDateTime = '0000-00-00 00:00:00';
$noDateTimeShort = '0000-00-00 00:00';
// Get Single Dates
$single_dates = JRequest::getVar('dates', '', 'post');
$dates = iCString::isSerialized($single_dates) ? unserialize($single_dates) : $this->getDates($single_dates);
// $dates = !empty($dates[0]) ? $dates : array($noDateTime);
rsort($dates);
$datesall = iCDate::isDate($dates[0]) ? $dates[0] : $noDateTimeShort;
if ($datesall != $noDateTimeShort) {
$this->data->dates = serialize($dates);
} else {
$no_date_array = array($noDateTimeShort);
$this->data->dates = serialize($no_date_array);
}
// Set Next Date from Single Dates
$dates_array = unserialize($this->data->dates);
$today = JHtml::date('now', 'Y-m-d H:i:s', $eventTimeZone);
$next = JHtml::date($this->data->dates[0], 'Y-m-d H:i:s', $eventTimeZone);
rsort($dates_array);
$nextDate = $next;
if ($next <= $today) {
foreach ($dates_array as $date) {
$single_date = JHtml::date($date, 'Y-m-d H:i:s', $eventTimeZone);
if ($single_date >= $today) {
$nextDate = $single_date;
}
}
}
$single_dates_next = $nextDate;
// PERIOD DATES
$this->data->startdate = JRequest::getVar('startdate', '', 'post');
//.........这里部分代码省略.........
示例6: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
* @since 1.6
*/
public function getOptions()
{
// Initialize variables.
$options = array();
$date = JHtml::Date('', 'Y-m-d H:m:s', true);
$dateformats = array('DATE_FORMAT_LC', 'DATE_FORMAT_LC1', 'DATE_FORMAT_LC2', 'DATE_FORMAT_LC3', 'DATE_FORMAT_LC4');
foreach ($dateformats as $key => $format) {
$options[$key]['value'] = $format;
$options[$key]['text'] = JHtml::Date($date, JText::_($format), true);
}
return $options;
}