Current File : /home/pacjaorg/public_html/kmm/components/com_djclassifieds/views/renewitem/view.html.php |
<?php
/**
* @package DJ-Classifieds
* @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email contact@dj-extensions.com
*/
defined ('_JEXEC') or die('Restricted access');
class DJClassifiedsViewRenewitem extends JViewLegacy
{
private static $_viewname = 'renewitem';
public function __construct($config = array())
{
parent::__construct($config);
$par = JFactory::getApplication()->getParams('com_djclassifieds');
$this->_addPath('template', JPATH_ROOT.'/components/com_djclassifieds/themes/'.$par->get('theme','default').'/views/'.self::$_viewname);
}
function display($tpl = NULL)
{
$app = JFactory::getApplication();
$user = JFactory::getUser();
$par = $app->getParams('com_djclassifieds');
$id = $app->input->getInt('id', 0);
$app->triggerEvent('onDJClassifiedsPrepareItemRenewForm', array(&$id, &$par));
if(!$user->id){
DJClassifiedsSEO::redirectLogIn();
}
if(!$id){
DJClassifiedsSEO::redirectWrongItem(DJClassifiedsSEO::getViewUri('useritems'));
}
$model = $this->getModel();
$item = $model->getItemById($id);
if($user->id != $item->user_id){
DJClassifiedsSEO::redirectWrongItem(DJClassifiedsSEO::getViewUri('useritems'));
}
if($item->auction && $par->get('auction_renew_lock') && !DJClassifiedsAccess::canRenewAuctionItem($item, $par)){
DJCLassifiedsSEO::redirectWrongItem(DJClassifiedsSEO::getViewUri('useritems'), 'COM_DJCLASSIFIEDS_AUCTION_RENEW_LOCK_MESSAGE', 'warning');
}
$category = $model->getCategory($item->cat_id);
if(!$category){
DJCLassifiedsSEO::handleCategoryNotFound();
}
$mcat_list = $model->getItemCategories($item->id);
$days = array();
if($par->get('durations_list','1')){
$days = $model->getDays($item->cat_id);
}
$promotions = array();
$item_promotions = array();
if($par->get('promotion')=='1'){
$promotions = $model->getPromotionsPrices($item);
$item_promotions = $model->getItemPromotions($item->id);
}
$types = $par->get('types_display_layout','0')==1 ? DJClassifiedsType::getTypesLabels(true) : DJClassifiedsType::getTypesSelect(true);
DJClassifiedsSEO::setMeta();
DJClassifiedsSEO::setSiteNameInPageTitle();
// view backward compatibility
$cfpar = JComponentHelper::getParams('com_djclassifieds');
$app->triggerEvent('onDJClassifiedsItemRenewForm', array(&$item, &$cfpar, &$promotions, &$category, &$types, &$days));
$app->triggerEvent('onDJClassifiedsItemRenewForm', array(&$item, &$par, &$promotions, &$category, &$types, &$days));
$this->plugin_title = $app->triggerEvent('onDJClassifiedsItemRenewFormTitle', array(&$item, &$par));
$this->plugin_rows = $app->triggerEvent('onDJClassifiedsItemRenewFormRows', array(&$item, &$par));
$this->item = $item;
$this->category = $category;
$this->mcats = $mcat_list;
$this->days = $days;
$this->types = $types;
$this->promotions = $promotions;
$this->item_promotions = $item_promotions;
$this->par = $par;
parent::display();
}
}