本文整理汇总了PHP中DJClassifiedsSEO::getAliasName方法的典型用法代码示例。如果您正苦于以下问题:PHP DJClassifiedsSEO::getAliasName方法的具体用法?PHP DJClassifiedsSEO::getAliasName怎么用?PHP DJClassifiedsSEO::getAliasName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DJClassifiedsSEO
的用法示例。
在下文中一共展示了DJClassifiedsSEO::getAliasName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$Itemid = JRequest::getVar('Itemid', 0, 'int');
//$document->link = JRoute::_(WeblinksHelperRoute::getCategoryRoute(JRequest::getVar('id', null, '', 'int')));
JRequest::setVar('limit', $app->getCfg('feed_limit'));
$siteEmail = $app->getCfg('mailfrom');
$fromName = $app->getCfg('fromname');
$document->editor = $fromName;
$document->editorEmail = $siteEmail;
// Get some data from the model
$model = $this->getModel();
$cat_id = JRequest::getVar('cid', 0, '', 'int');
$catlist = '';
$maincat = '';
if ($cat_id > 0) {
$main_cat = $model->getMainCat($cat_id);
$document->title = $main_cat->name;
$cats = DJClassifiedsCategory::getSubCatIemsCount($cat_id, 1);
$catlist = $cat_id;
foreach ($cats as $c) {
$catlist .= ',' . $c->id;
}
}
$items = $model->getItems($catlist);
foreach ($items as $item) {
// strip html from feed item title
$title = $this->escape($item->name);
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
// url link to article
//$link = JRoute::_('index.php?option=com_djclassifieds&view=item&cid='.$item->cat_id.'&id='.$item->id.'&Itemid='.$Itemid);
if (!$item->alias) {
$item->alias = DJClassifiedsSEO::getAliasName($item->name);
}
if (!$item->c_alias) {
$item->c_alias = DJClassifiedsSEO::getAliasName($item->c_name);
}
$link = JRoute::_(DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias));
//echo $link;die();
// strip html from feed item description text
$description = $item->intro_desc;
$date = $item->date_start ? date('r', strtotime($item->date_start)) : '';
if ($item->image_url != '') {
$images = explode(';', $item->image_url);
$description .= '<img align="right" src="' . JURI::base() . '/components/com_djclassifieds/images/' . $images[0] . '.ths.jpg" />';
}
// load individual item creator class
$feeditem = new JFeedItem();
$feeditem->title = $title;
$feeditem->link = $link;
$feeditem->description = $description;
$feeditem->date = $date;
$feeditem->category = $item->c_name;
// loads item info into rss array
$document->addItem($feeditem);
}
}
示例2: foreach
?>
= new google.maps.Map(document.getElementById("djmod_map<?php
echo $module->id;
?>
"), opcjeMapy);
var size = new google.maps.Size(32,32);
var start_point = new google.maps.Point(0,0);
var anchor_point = new google.maps.Point(0,16);
<?php
$ia = 0;
foreach ($items as $item) {
if (!$item->alias) {
$item->alias = DJClassifiedsSEO::getAliasName($item->name);
}
if (!$item->c_alias) {
$item->c_alias = DJClassifiedsSEO::getAliasName($item->c_name);
}
if (isset($gm_cat_icons[$item->cat_id])) {
$gm_icon_a = $gm_cat_icons[$item->cat_id]['width'] / 2;
?>
var size = new google.maps.Size(<?php
echo $gm_cat_icons[$item->cat_id]['width'] . ',' . $gm_cat_icons[$item->cat_id]['height'];
?>
);
var start_point = new google.maps.Point(0,0);
var anchor_point = new google.maps.Point(<?php
echo $gm_icon_a . ',' . $gm_cat_icons[$item->cat_id]['height'];
?>
);
var icon = new google.maps.MarkerImage("<?php
echo $gm_cat_icons[$item->cat_id]['img'];
示例3: onAfterDJClassifiedsDisplayProfile
public function onAfterDJClassifiedsDisplayProfile(&$profile, $params, $view)
{
$app = JFactory::getApplication();
if (!$profile['id']) {
return false;
}
$group_id = $this->params->get('rating_group_author', false);
if (!$group_id) {
return false;
}
require_once JPath::clean(JPATH_ROOT . '/components/com_djreviews/lib/api.php');
require_once JPath::clean(JPATH_ROOT . '/administrator/components/com_djclassifieds/lib/djseo.php');
$uid_slug = $profile['id'] . ':' . DJClassifiedsSEO::getAliasName($profile['name']);
$name = $profile['name'] ? $profile['name'] : $profile['id'];
$review = DJReviewsAPI::getInstance(array('group' => $group_id, 'type' => 'com_djclassifieds.author', 'name' => $name, 'link' => 'index.php?option=com_djclassifieds&view=profile&uid=' . $uid_slug, 'id' => $profile['id']));
return $review->getFullReview();
}
示例4:
</div>
<?php
}
if ($par->get('showauthor', '1') == 1) {
?>
<div class="row_gd user_name">
<span class="row_label"><?php
echo JText::_('COM_DJCLASSIFIEDS_CREATED_BY');
?>
</span>
<span class="row_value">
<?php
if ($item->user_id == 0) {
echo JText::_('COM_DJCLASSIFIEDS_GUEST');
} else {
$uid_slug = $item->user_id . ':' . DJClassifiedsSEO::getAliasName($item->username);
?>
<div class="profile_item_box">
<?php
if ($this->profile['img']) {
echo '<a class="profile_img" href="index.php?option=com_djclassifieds&view=profile&uid=' . $uid_slug . '&Itemid=' . $Itemid . '"><img src="' . JURI::base() . $this->profile['img']->path . $this->profile['img']->name . '_ths.' . $this->profile['img']->ext . '" /></a>';
}
?>
<div class="profile_name_data">
<?php
echo '<a class="profile_name" href="index.php?option=com_djclassifieds&view=profile&uid=' . $uid_slug . '&Itemid=' . $Itemid . '">' . $item->username . ' <span>(' . $this->user_items_c . ')</span></a>';
?>
<?php
if ($this->profile['data']) {
?>
<div class="profile_data">
示例5: getCategoriesSortParent
public static function getCategoriesSortParent($p = '0', $ord = 'ord')
{
if (!self::$_categories_sparent) {
self::$_categories_sparent = array();
}
if (isset(self::$_categories_sparent[$p . '_' . $ord])) {
return self::$_categories_sparent[$p . '_' . $ord];
}
if ($p) {
$pub = 'WHERE c.published=1 ';
} else {
$pub = '';
}
if ($ord == 'name') {
$order = 'c.name';
} else {
$order = 'c.ordering';
}
$db = JFactory::getDBO();
$query = "SELECT c.*, cc.name as parent_name,IFNULL(i.items_count,0) items_count FROM #__djcf_categories c " . "LEFT JOIN #__djcf_categories cc ON c.parent_id=cc.id " . "LEFT JOIN (SELECT i.cat_id, count(i.id) as items_count " . "FROM #__djcf_items i WHERE i.published=1 AND i.date_exp > NOW() GROUP BY i.cat_id) i ON i.cat_id=c.id " . $pub . "ORDER BY c.parent_id, " . $order;
$db->setQuery($query);
$allcategories = $db->loadObjectList();
$categories = array();
foreach ($allcategories as $cat) {
if (!$cat->alias) {
$cat->alias = DJClassifiedsSEO::getAliasName($cat->name);
}
if (!isset($categories[$cat->parent_id])) {
$categories[$cat->parent_id] = array();
}
$categories[$cat->parent_id][] = $cat;
}
//echo '<pre>';print_r($db);print_r($allcategories);die();
self::$_categories_sparent[$p . '_' . $ord] = $categories;
return self::$_categories_sparent[$p . '_' . $ord];
}
示例6: save
//.........这里部分代码省略.........
}
//echo '<pre>';print_r($row);die();
$row->user_id = $user->id;
$row->ip_address = $_SERVER['REMOTE_ADDR'];
$row->promotions = '';
if ($par->get('promotion', '1') == '1') {
$query = "SELECT p.* FROM #__djcf_promotions p WHERE p.published=1 ORDER BY p.id ";
$db->setQuery($query);
$promotions = $db->loadObjectList();
foreach ($promotions as $prom) {
if (JRequest::getVar($prom->name, '0')) {
$row->promotions .= $prom->name . ',';
}
}
if ($row->promotions) {
$row->promotions = substr($row->promotions, 0, -1);
}
} else {
if ($row->id > 0) {
$row->promotions = $old_row->promotions;
}
}
if (strstr($row->promotions, 'p_first')) {
$row->special = 1;
} else {
$row->special = 0;
}
$cat = '';
if ($row->cat_id) {
$query = "SELECT name,alias,price,autopublish FROM #__djcf_categories WHERE id = " . $row->cat_id;
$db->setQuery($query);
$cat = $db->loadObject();
if (!$cat->alias) {
$cat->alias = DJClassifiedsSEO::getAliasName($cat->name);
}
}
$is_new = 1;
if ($row->id > 0) {
$query = "SELECT * FROM #__djcf_items WHERE id = " . $row->id;
$db->setQuery($query);
$old_row = $db->loadObject();
$query = "DELETE FROM #__djcf_fields_values WHERE item_id= " . $row->id . " ";
$db->setQuery($query);
$db->query();
$query = "DELETE FROM #__djcf_fields_values_sale WHERE item_id= " . $row->id . " ";
$db->setQuery($query);
$db->query();
$row->payed = $old_row->payed;
$row->pay_type = $old_row->pay_type;
$row->exp_days = $old_row->exp_days;
$row->alias = $old_row->alias;
$row->published = $old_row->published;
$is_new = 0;
}
if (!$row->alias) {
$row->alias = DJClassifiedsSEO::getAliasName($row->name);
}
$dispatcher->trigger('onBeforePaymentsDJClassifiedsSaveAdvert', array(&$row, $is_new, &$cat, &$promotions));
if ($cat->autopublish == '0') {
if ($par->get('autopublish') == '1') {
$row->published = 1;
if ($row->id) {
$message = JText::_('COM_DJCLASSIFIEDS_AD_SAVED_SUCCESSFULLY');
} else {
$message = JText::_('COM_DJCLASSIFIEDS_AD_ADDED_SUCCESSFULLY');
}
示例7: save
public function save()
{
$app = JFactory::getApplication();
$model = $this->getModel('category');
$row = JTable::getInstance('Categories', 'DJClassifiedsTable');
$par = JComponentHelper::getParams('com_djclassifieds');
$db = JFactory::getDBO();
$row->bind(JRequest::get('post'));
$icon_url = $row->icon_url;
$row->description = JRequest::getVar('description', '', 'post', 'string', JREQUEST_ALLOWRAW);
if ($row->alias) {
$row->alias = DJClassifiedsSEO::getAliasName($row->alias);
} else {
$row->alias = DJClassifiedsSEO::getAliasName($row->name);
}
$del_icon_id = JRequest::getInt('del_icon_id', 0);
$del_icon_path = JRequest::getVar('del_icon_path', '');
$del_icon_name = JRequest::getVar('del_icon_name', '');
$del_icon_ext = JRequest::getVar('del_icon_ext', '');
if (JRequest::getVar('del_icon', '0', '', 'int')) {
if ($del_icon_path && $del_icon_name && $del_icon_ext) {
$path_to_delete = JPATH_SITE . $del_icon_path . $del_icon_name;
if (JFile::exists($path_to_delete . '.' . $del_icon_ext)) {
JFile::delete($path_to_delete . '.' . $del_icon_ext);
}
if (JFile::exists($path_to_delete . '_ths.' . $del_icon_ext)) {
JFile::delete($path_to_delete . '_ths.' . $del_icon_ext);
}
$query = "DELETE FROM #__djcf_images WHERE type='category' AND item_id=" . $row->id . " AND id=" . $del_icon_id . " ";
$db->setQuery($query);
$db->query();
}
}
$row->price = $row->price * 100;
//echo '<pre>';print_r($row);die();
if (!$row->ordering) {
$query = "SELECT ordering FROM #__djcf_categories WHERE parent_id = " . $row->parent_id . " ORDER BY ordering DESC LIMIT 1";
$db = JFactory::getDBO();
$db->setQuery($query);
$order = $db->loadObject();
$row->ordering = $order->ordering + 1;
}
if (!$row->store()) {
echo $row->getError();
exit;
}
$new_icon = $_FILES['icon'];
if (substr($new_icon['type'], 0, 5) == "image") {
$path_to_delete = JPATH_SITE . $del_icon_path . $del_icon_name;
if (JFile::exists($path_to_delete . '.' . $del_icon_ext)) {
JFile::delete($path_to_delete . '.' . $del_icon_ext);
}
if (JFile::exists($path_to_delete . '_ths.' . $del_icon_ext)) {
JFile::delete($path_to_delete . '_ths.' . $del_icon_ext);
}
$query = "DELETE FROM #__djcf_images WHERE type='category' AND item_id=" . $row->id . " AND id=" . $del_icon_id . " ";
$db->setQuery($query);
$db->query();
$last_id = $row->id;
$lang = JFactory::getLanguage();
$icon_name = str_ireplace(' ', '_', $new_icon['name']);
$icon_name = $lang->transliterate($icon_name);
$icon_name = strtolower($icon_name);
$icon_name = JFile::makeSafe($icon_name);
$icon_name = $last_id . '_' . $icon_name;
$icon_url = $icon_name;
$path = JPATH_SITE . "/components/com_djclassifieds/images/category/" . $icon_name;
move_uploaded_file($new_icon['tmp_name'], $path);
$nw = $par->get('catth_width', -1);
$nh = $par->get('catth_height', -1);
$name_parts = pathinfo($path);
$img_name = $name_parts['filename'];
$img_ext = $name_parts['extension'];
$new_path = JPATH_SITE . "/components/com_djclassifieds/images/category/";
//DJClassifiedsImage::makeThumb($path, $nw, $nh, 'ths');
DJClassifiedsImage::makeThumb($path, $new_path . $img_name . '_ths.' . $img_ext, $nw, $nh);
$query = "INSERT INTO #__djcf_images(`item_id`,`type`,`name`,`ext`,`path`,`caption`,`ordering`) VALUES ";
$query .= "('" . $row->id . "','category','" . $img_name . "','" . $img_ext . "','/components/com_djclassifieds/images/category/','','1'); ";
$db->setQuery($query);
$db->query();
}
$db = JFactory::getDBO();
$query = "DELETE FROM #__djcf_categories_groups WHERE cat_id= " . $row->id . " ";
$db->setQuery($query);
$db->query();
if (isset($_POST['cat_groups'])) {
$query = "INSERT INTO #__djcf_categories_groups(`cat_id`,`group_id`) VALUES ";
for ($i = 0; $i < count($_POST['cat_groups']); $i++) {
$group_id = $_POST['cat_groups'][$i];
$query .= "('" . $row->id . "','" . $group_id . "'), ";
}
$query = substr($query, 0, -2) . ';';
$db->setQuery($query);
$db->query();
}
switch (JRequest::getVar('task')) {
case 'apply':
$link = 'index.php?option=com_djclassifieds&task=category.edit&id=' . $row->id;
$msg = JText::_('COM_DJCLASSIFIEDS_CATEGORY_SAVED');
break;
//.........这里部分代码省略.........
示例8: regenerateAliases
function regenerateAliases()
{
$app = JFactory::getApplication();
$par = JComponentHelper::getParams('com_djclassifieds');
$db = JFactory::getDBO();
$query = "SELECT * FROM #__djcf_categories";
$db->setQuery($query);
$cats = $db->loadObjectList();
foreach ($cats as $c) {
$alias = DJClassifiedsSEO::getAliasName($c->name);
$query = "UPDATE #__djcf_categories SET alias='" . $alias . "' WHERE id=" . $c->id;
$db->setQuery($query);
$db->query();
}
$redirect = 'index.php?option=com_djclassifieds&view=categories';
$app->redirect($redirect, JText::_('COM_DJCLASSIFIEDS_ALIASES_RECREATED'));
}
示例9: save
public function save()
{
$app = JFactory::getApplication();
$model = $this->getModel('item');
$row = JTable::getInstance('Items', 'DJClassifiedsTable');
$par = JComponentHelper::getParams('com_djclassifieds');
$db = JFactory::getDBO();
$lang = JFactory::getLanguage();
$dispatcher = JDispatcher::getInstance();
$row->bind(JRequest::get('post'));
$row->description = JRequest::getVar('description', '', 'post', 'string', JREQUEST_ALLOWRAW);
$row->intro_desc = JRequest::getVar('intro_desc', '', 'post', 'string', JREQUEST_ALLOWRAW);
$row->contact = nl2br(JRequest::getVar('contact', '', 'post', 'string'));
if ($row->alias) {
$row->alias = DJClassifiedsSEO::getAliasName($row->alias);
} else {
$row->alias = DJClassifiedsSEO::getAliasName($row->name);
}
$row->image_url = '';
//$exp_date = explode('-', $_POST['date_expir']);
//$exp_time = explode(':', $_POST['time_expir']);
//$row->date_exp = mktime($exp_time[0],$exp_time[1],0,$exp_date[1],$exp_date[2],$exp_date[0]);
$row->date_exp = $_POST['date_expir'] . ' ' . $_POST['time_expir'] . ':00';
$is_new = 1;
if ($row->id > 0) {
$old_date_exp = JRequest::getVar('date_exp_old', '');
if ($old_date_exp != $row->date_exp) {
$row->notify = 0;
}
$is_new = 0;
}
if ($row->id == 0) {
$row->exp_days = ceil((strtotime($row->date_exp) - time()) / (60 * 60 * 24));
}
if ($row->user_id == 0 && $row->id == 0) {
$user = JFactory::getUser();
$row->user_id = $user->id;
$row->ip_address = $_SERVER['REMOTE_ADDR'];
}
$row->region_id = end($_POST['regions']);
if (!$row->region_id) {
$row->region_id = $_POST['regions'][count($_POST['regions']) - 2];
if (!reset($_POST['regions'])) {
$row->region_id = 0;
}
}
if ($row->id > 0) {
$query = "DELETE FROM #__djcf_fields_values WHERE item_id= " . $row->id . " ";
$db->setQuery($query);
$db->query();
if ($row->payed == 1) {
$row->pay_type = '';
$query = "UPDATE #__djcf_payments SET status='Completed' WHERE item_id= " . $row->id . " AND type=0 ";
$db->setQuery($query);
$db->query();
}
}
$row->promotions = '';
$query = "SELECT p.* FROM #__djcf_promotions p ORDER BY p.id ";
$db->setQuery($query);
$promotions = $db->loadObjectList();
foreach ($promotions as $prom) {
if (JRequest::getVar($prom->name, '0')) {
$row->promotions .= $prom->name . ',';
}
}
if ($row->promotions) {
$row->promotions = substr($row->promotions, 0, -1);
}
if (strstr($row->promotions, 'p_first')) {
$row->special = 1;
} else {
$row->special = 0;
}
if (($row->region_id || $row->address) && ($row->latitude == '0.000000000000000' && $row->longitude == '0.000000000000000' || !$row->latitude && !$row->longitude)) {
$address = '';
if ($row->region_id) {
$reg_path = DJClassifiedsRegion::getParentPath($row->region_id);
for ($r = count($reg_path) - 1; $r >= 0; $r--) {
if ($reg_path[$r]->country) {
$address = $reg_path[$r]->name;
}
if ($reg_path[$r]->city) {
if ($address) {
$address .= ', ';
}
$address .= $reg_path[$r]->name;
}
}
}
if ($address) {
$address .= ', ';
}
$address .= $row->address;
if ($row->post_code) {
$address .= ', ' . $row->post_code;
}
$loc_coord = DJClassifiedsGeocode::getLocation($address);
if (is_array($loc_coord)) {
$row->latitude = $loc_coord['lat'];
//.........这里部分代码省略.........
示例10: removeFavourite
function removeFavourite()
{
$app = JFactory::getApplication();
$id = JRequest::getInt('id', 0);
$cid = JRequest::getVar('cid', 0, '', 'int');
$db = JFactory::getDBO();
$user = JFactory::getUser();
$itemid = JRequest::getVar('Itemid');
$par = JComponentHelper::getParams('com_djclassifieds');
$query = "SELECT i.id, i.name, i.alias,i.cat_id,c.name as c_name, c.alias as c_alias FROM #__djcf_items i " . "LEFT JOIN #__djcf_categories c ON c.id=i.cat_id " . "WHERE i.id = " . $id;
$db->setQuery($query);
$item = $db->loadObject();
if (!$item->alias) {
$item->alias = DJClassifiedsSEO::getAliasName($item->name);
}
if (!$item->c_alias) {
$item->c_alias = DJClassifiedsSEO::getAliasName($item->c_name);
}
$link = DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias);
$m_type = '';
if ($par->get('favourite', '1')) {
if ($user->id > 0) {
$query = "DELETE FROM #__djcf_favourites WHERE item_id=" . $id . " AND user_id=" . $user->id . " ";
$db->setQuery($query);
$db->query();
$msg = JText::_('COM_DJCLASSIFIEDS_AD_REMOVED_FROM_FAVOURITES');
} else {
$msg = JText::_('COM_DJCLASSIFIEDS_PLEASE_LOGIN');
$m_type = 'error';
}
} else {
$msg = JText::_('COM_DJCLASSIFIEDS_FUNCTION_NOT_AVAILABLE');
$m_type = 'error';
}
//$link = 'index.php?option=com_djclassifieds&view=item&cid='.$cid.'&id='.$id.'&Itemid='.$itemid;
$link = JRoute::_($link);
$app->redirect($link, $msg, $m_type);
}
示例11: delBid
function delBid()
{
header("Content-type: text/html; charset=utf-8");
$app = JFactory::getApplication();
$id = JRequest::getInt('id', 0);
$cid = JRequest::getInt('cid', 0);
$bid = JRequest::getFloat('bid', 0);
$db = JFactory::getDBO();
$user = JFactory::getUser();
$itemid = JRequest::getVar('Itemid');
$par = JComponentHelper::getParams('com_djclassifieds');
$m_type = '';
$query = "SELECT i.*, c.name as c_name, c.alias as c_alias FROM #__djcf_items i " . "LEFT JOIN #__djcf_categories c ON c.id=i.cat_id " . "WHERE i.id = " . $id . " ";
$db->setQuery($query);
$item = $db->loadObject();
if (!$item->alias) {
$item->alias = DJClassifiedsSEO::getAliasName($item->name);
}
if (!$item->c_alias) {
$item->c_alias = DJClassifiedsSEO::getAliasName($item->c_name);
}
$link = DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias);
if ($user->id > 0) {
if ($item) {
if ($item->user_id == $user->id && $item->user_id > 0) {
$query = "DELETE FROM #__djcf_auctions WHERE item_id = " . $item->id . " AND id=" . $bid;
$db->setQuery($query);
$db->query();
$price_start = $item->price_start;
$query = "SELECT a.* FROM #__djcf_auctions a " . " WHERE a.item_id=" . $item->id . " ORDER BY a.date DESC LIMIT 1";
$db->setQuery($query);
$last_bid = $db->loadObject();
if ($last_bid) {
$price_start = $last_bid->price;
}
$query = "UPDATE #__djcf_items SET price='" . $price_start . "' " . " WHERE id=" . $item->id;
$db->setQuery($query);
$db->query();
$msg = JText::_('COM_DJCLASSIFIEDS_BID_DELETED');
} else {
$msg = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
$m_type = 'error';
}
} else {
$msg = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
$m_type = 'error';
}
} else {
$msg = JText::_('COM_DJCLASSIFIEDS_PLEASE_LOGIN');
$m_type = 'error';
}
$link = JRoute::_($link);
$app->redirect($link, $msg, $m_type);
die('aaaa');
}
示例12: getCategoriesSortParent
public static function getCategoriesSortParent($p = '0', $ord = 'ord', $ord_dir = 'ASC')
{
$user = JFactory::getUser();
if (!self::$_categories_sparent) {
self::$_categories_sparent = array();
}
if (isset(self::$_categories_sparent[$p . '_' . $ord])) {
return self::$_categories_sparent[$p . '_' . $ord];
}
if ($p) {
$pub = 'WHERE c.published=1 ';
$groups_acl = implode(',', $user->getAuthorisedViewLevels());
$access_view = " AND c.access_view IN (" . $groups_acl . ") ";
} else {
$pub = '';
$access_view = '';
}
if ($ord == 'name') {
$order = 'c.name';
} else {
if ($ord == 'id') {
$order = 'c.id';
} else {
if ($ord == 'price') {
$order = 'c.price';
} else {
if ($ord == 'pub') {
$order = 'c.published';
} else {
$order = 'c.ordering';
}
}
}
}
$db = JFactory::getDBO();
$date_now = date("Y-m-d H:i:s");
$query = "SELECT c.*, cc.name as parent_name,IFNULL(i.items_count,0) items_count FROM #__djcf_categories c " . "LEFT JOIN #__djcf_categories cc ON c.parent_id=cc.id " . "LEFT JOIN (SELECT i.cat_id, count(i.id) as items_count " . "FROM #__djcf_items i WHERE i.published=1 AND i.date_exp > '" . $date_now . "' GROUP BY i.cat_id) i ON i.cat_id=c.id " . $pub . $access_view . "ORDER BY c.parent_id, " . $order . " " . $ord_dir;
$db->setQuery($query);
$allcategories = $db->loadObjectList();
$categories = array();
foreach ($allcategories as $cat) {
if (!$cat->alias) {
$cat->alias = DJClassifiedsSEO::getAliasName($cat->name);
}
if (!isset($categories[$cat->parent_id])) {
$categories[$cat->parent_id] = array();
}
$categories[$cat->parent_id][] = $cat;
}
//echo '<pre>';print_r($db);print_r($allcategories);die();
self::$_categories_sparent[$p . '_' . $ord] = $categories;
return self::$_categories_sparent[$p . '_' . $ord];
}
示例13:
</div>
<div class="djcf_prow_desc_row djcf_prow_date">
<span class="djcf_prow_desc_label" ><?php
echo JText::_("COM_DJCLASSIFIEDS_ORDER_DATE");
?>
:</span>
<span class="djcf_prow_desc_value" ><?php
echo DJClassifiedsTheme::formatDate(strtotime($order->date));
?>
</span>
<div class="clear_both"></div>
</div>
</div>
<div class="item_col">
<?php
$uid_slug = $order->user_id . ':' . DJClassifiedsSEO::getAliasName($order->username);
echo '<a class="profile_name" href="index.php?option=com_djclassifieds&view=profile&uid=' . $uid_slug . DJClassifiedsSEO::getMainAdvertsItemid() . '">' . $order->username;
if ($order->i_user_items_count) {
echo ' <span>(' . $order->i_user_items_count . ')</span>';
}
echo '</a>';
echo '<div class="profile_email_outer"><a class="profile_email button" href="mailto:' . $order->email . '">' . JText::_('COM_DJCLASSIFIEDS_CONTACT_SELLER') . '</a></div>';
?>
</div>
<?php
echo '</div>';
}
?>
</div>
<div class="pagination">