Current File : /home/pacjaorg/public_html/km/administrator/components/com_djclassifieds/views/item/tmpl/edit.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');
JHtml::_('behavior.formvalidator');
$app = JFactory::getApplication();
$par = $this->par;
?>
<?php if($this->item->id){ ?>
<a href="<?php echo JRoute::link('site', DJClassifiedsSEO::getItemRoute($this->item->id.':'.$this->item->alias, $this->item->cat_id.':'.$this->item->c_alias, $this->item->region_id.':'.$this->item->r_alias), true, null, true); ?>" target="_blank" title="<?php echo JText::_('COM_DJCLASSIFIEDS_ITEMS_SHOW_FRONT_PAGE'); ?>" class="show-front"><?php echo JText::_('COM_DJCLASSIFIEDS_SHOW_ON_FRONT'); ?></a>
<?php } ?>
<form action="<?php echo JRoute::_('index.php?option=com_djclassifieds&view=item&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="edit-form" class="form-validate" enctype="multipart/form-data">
<div class="form-horizontal">
<?php echo JHTML::_($this->bs_cl->tab.'.startTabSet', 'myTab', array('active' => 'details')); ?>
<?php echo JHTML::_($this->bs_cl->tab.'.addTab', 'myTab', 'details', empty($this->item->id) ? JText::_('COM_DJCLASSIFIEDS_NEW') : JText::_('COM_DJCLASSIFIEDS_EDIT')); ?>
<div class="<?php echo $this->bs_cl->row; ?>">
<div class="<?php echo $this->bs_cl->col; ?>9">
<?php echo $this->form->getField('name')->renderField(); ?>
<?php echo $this->form->getField('alias')->renderField(); ?>
<?php echo $this->form->getField('type_id')->renderField(); ?>
<?php echo $this->form->getField('price')->renderField(); ?>
<?php echo $this->form->getField('price_negotiable')->renderField(); ?>
<?php echo $this->form->getField('currency')->renderField(); ?>
<?php echo $this->form->getField('website')->renderField(); ?>
<?php echo $this->form->getField('video')->renderField(); ?>
<?php echo $this->form->getField('contact')->renderField(); ?>
<div id="contact_ex_fields"></div>
<script>
jQuery(function($){
var $el = jQuery('#contact_ex_fields');
$el.html('<img src="<?php echo JURI::base(); ?>components/com_djclassifieds/assets/images/loading.gif" />');
var ajax_data = {
'option': 'com_djclassifieds',
'task': 'item.getContactFields',
'id': '<?php echo $this->item->id ? $this->item->id : 0; ?>'
};
jQuery.ajax({
url: '<?php echo JRoute::_('index.php'); ?>',
type: 'post',
data: ajax_data
}).done(function (response, textStatus, jqXHR){
if(textStatus == 'success'){
$el.html(response);
$el.find('.djcalendar').each(function(){
if(typeof Calendar !== 'undefined'){
Calendar.setup({
inputField: $(this).attr('id'),
button: $(this).attr('id') + '_btn'
});
}
});
jQuery(document).trigger('djclassifieds.loaded', {type: 'contact', context: 'item', client: 'admin', ajax_data: ajax_data});
}
});
});
</script>
<?php echo $this->form->getField('intro_desc')->renderField(); ?>
<?php if(intval($par->get('introdesc_char_limit','120'))){ ?>
<script>
jQuery(function($){
var char_limit = <?php echo intval($par->get('introdesc_char_limit','120')); ?>;
var text_len = <?php echo $this->item->intro_desc ? strlen($this->item->intro_desc) : 0; ?>;
$('#jform_intro_desc-lbl').after('<div id="intro_desc_char_count">('+(char_limit - text_len)+')</div>');
$('#jform_intro_desc').keyup(function(){
if($(this).val().length > char_limit){
$(this).val($(this).val().substring(0, char_limit));
}
$('#intro_desc_char_count').text('('+ (char_limit - $(this).val().length) +')');
});
});
</script>
<?php } ?>
<?php echo $this->form->getField('description')->renderField(); ?>
</div>
<div class="<?php echo $this->bs_cl->col; ?>3">
<fieldset class="form-vertical">
<?php echo $this->form->getInput('pay_info'); ?>
<?php echo $this->form->getField('published')->renderField(); ?>
<?php echo $this->form->getField('blocked')->renderField(); ?>
<?php echo $this->form->getField('user_id')->renderField(); ?>
<?php echo $this->form->getField('email')->renderField(); ?>
<?php echo $this->form->getField('token')->renderField(); ?>
<?php echo $this->form->getField('exp_days')->renderField(); ?>
<?php echo $this->form->getField('date_exp')->renderField(); ?>
<?php echo $this->form->getField('date_sort')->renderField(); ?>
<?php echo $this->form->getField('date_start')->renderField(); ?>
<?php echo $this->form->getField('date_mod')->renderField(); ?>
<?php echo $this->form->getField('date_renew')->renderField(); ?>
<?php echo $this->form->getField('ip_address')->renderField(); ?>
<?php echo $this->form->getField('display')->renderField(); ?>
</fieldset>
</div>
</div>
<?php echo JHTML::_($this->bs_cl->tab.'.endTab'); ?>
<?php echo JHTML::_($this->bs_cl->tab.'.addTab', 'myTab', 'category_custom_fields', JText::_('COM_DJCLASSIFIEDS_CATEGORY_AND_CUSTOM_FIELDS')); ?>
<div class="<?php echo $this->bs_cl->row; ?>">
<div class="<?php echo $this->bs_cl->col; ?>6">
<?php echo str_replace('id="jformcat_id"', 'id="jform_cat_id"', $this->form->getField('cat_id')->renderField()); ?>
<?php foreach($app->triggerEvent('onAdminItemEditCategory', array($this->item)) as $plug_out) echo $plug_out; ?>
<div id="ex_fields"><?php echo JText::_('COM_DJCLASSIFIEDS_PLEASE_SELECT_CATEGORY');?></div>
<script>
jQuery(function($){
getFields();
$('[name="jform[cat_id]"]').change(function(){
getFields();
});
});
function getFields()
{
var $el = jQuery('#ex_fields');
var cat_id = jQuery('[name="jform[cat_id]"]').val();
var mcat_v = '';
var mcat_s = document.getElementById('mcat_ids');
if(mcat_s){
var mcat_o = mcat_s.getElementsByTagName('option');
for(var im=mcat_o.length; im--;){
if (mcat_o[im].selected){
mcat_v += mcat_o[im].value+',';
}
}
}
if(cat_id || mcat_v){
var $prev_el = $el.clone();
$el.find('select').each(function(i){
$prev_el.find('select').eq(i).val(jQuery(this).val());
});
$el.html('<img src="<?php echo JURI::base(); ?>components/com_djclassifieds/assets/images/loading.gif" />');
var ajax_data = {
'option': 'com_djclassifieds',
'task': 'item.getFields',
'cat_id': cat_id,
'mcat_ids': mcat_v,
'id': '<?php echo $this->item->id ? $this->item->id : 0; ?>'
}
jQuery.ajax({
url: '<?php echo JRoute::_('index.php'); ?>',
type: 'post',
data: ajax_data
}).done(function (response, textStatus, jqXHR){
if(textStatus == 'success'){
$el.html(response).find(':input').each(function(){
if(typeof jQuery(this).attr('id') !== 'undefined' && $prev_el.find(':input[id="'+jQuery(this).attr('id')+'"]').length){
jQuery(this).closest('.controls').replaceWith($prev_el.find(':input[id="'+jQuery(this).attr('id')+'"]').closest('.controls'));
}
});
if(typeof Calendar !== 'undefined'){
$el.find('.djcalendar').each(function(){
Calendar.setup({inputField: jQuery(this).attr('id'), button: jQuery(this).attr('id') + '_btn'});
});
}
jQuery(document).trigger('djclassifieds.loaded', {type: 'category', context: 'item', client: 'admin', ajax_data: ajax_data});
}
});
}else{
$el.html('<?php echo JText::_('COM_DJCLASSIFIEDS_PLEASE_SELECT_CATEGORY'); ?>');
}
}
</script>
</div>
<div class="<?php echo $this->bs_cl->col; ?>6"></div>
</div>
<?php echo JHTML::_($this->bs_cl->tab.'.endTab'); ?>
<?php echo JHTML::_($this->bs_cl->tab.'.addTab', 'myTab', 'location', JText::_('COM_DJCLASSIFIEDS_LOCATION')); ?>
<div class="<?php echo $this->bs_cl->row; ?>">
<div class="<?php echo $this->bs_cl->col; ?>6">
<?php echo $this->form->getField('region_id')->renderField(); ?>
<?php foreach($app->triggerEvent('onAdminItemEditRegion', array($this->item)) as $plug_out) echo $plug_out; ?>
<?php echo $this->form->getField('address')->renderField(); ?>
<?php echo $this->form->getField('post_code')->renderField(); ?>
<?php echo $this->form->getField('latitude')->renderField(); ?>
<?php echo $this->form->getField('longitude')->renderField(); ?>
<?php if($this->item->id && floatval($this->item->latitude) && floatval($this->item->longitude)){ ?>
<?php if($par->get('show_googlemap','0')){ ?>
<?php
$layout = new JLayoutFile('adminformgooglemap');
echo $layout->render(array('item' => $this->item, 'par' => $par));
?>
<?php }else{ ?>
<?php if($this->item->event->onBeforeDJClassifiedsDisplayAdvertMap) { ?>
<div class="djcf_custom_map">
<?php echo $this->item->event->onBeforeDJClassifiedsDisplayAdvertMap; ?>
</div>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
<div class="<?php echo $this->bs_cl->col; ?>6"></div>
</div>
<?php echo JHTML::_($this->bs_cl->tab.'.endTab'); ?>
<?php echo JHTML::_($this->bs_cl->tab.'.addTab', 'myTab', 'publishing', JText::_('JGLOBAL_FIELDSET_METADATA_OPTIONS')); ?>
<div class="<?php echo $this->bs_cl->row; ?>">
<div class="<?php echo $this->bs_cl->col; ?>6">
<?php echo $this->form->getField('access_view')->renderField(); ?>
<?php echo $this->form->getField('metakey')->renderField(); ?>
<?php echo $this->form->getField('metadesc')->renderField(); ?>
<?php echo $this->form->getField('metarobots')->renderField(); ?>
</div>
<div class="<?php echo $this->bs_cl->col; ?>6">
<fieldset class="form-vertical">
</fieldset>
</div>
</div>
<?php echo JHTML::_($this->bs_cl->tab.'.endTab'); ?>
<?php echo JHTML::_($this->bs_cl->tab.'.addTab', 'myTab', 'promotions', JText::_('COM_DJCLASSIFIEDS_PROMOTIONS').($this->form->getData()->get('active_proms_count') ? ' <span class="badge">'.$this->form->getData()->get('active_proms_count').'</span>' : '')); ?>
<?php echo $this->form->getInput('proms'); ?>
<?php echo JHTML::_($this->bs_cl->tab.'.endTab'); ?>
<?php echo JHTML::_($this->bs_cl->tab.'.addTab', 'myTab', 'images', JText::_('COM_DJCLASSIFIEDS_IMAGES').($this->form->getData()->get('images_count') ? ' <span class="badge">'.$this->form->getData()->get('images_count').'</span>' : '')); ?>
<?php echo $this->form->getInput('images'); ?>
<?php echo JHTML::_($this->bs_cl->tab.'.endTab'); ?>
<?php if($par->get('auctions','0')){ ?>
<?php echo JHTML::_($this->bs_cl->tab.'.addTab', 'myTab', 'auctions', JText::_('COM_DJCLASSIFIEDS_AUCTIONS').($this->form->getData()->get('bids') ? ' <span class="badge">'.count($this->form->getData()->get('bids')).'</span>' : '')); ?>
<?php echo $this->form->getField('auction')->renderField(); ?>
<?php echo $this->form->getField('auction_assist')->renderField(); ?>
<?php echo $this->form->getField('price_start')->renderField(); ?>
<?php echo $this->form->getField('bid_min')->renderField(); ?>
<?php echo $this->form->getField('bid_max')->renderField(); ?>
<?php echo $this->form->getField('price_reserve')->renderField(); ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('bids'); ?>
</div>
<div class="controls">
<?php if($this->form->getData()->get('bids')){ ?>
<?php echo $this->form->getInput('bids'); ?>
<?php }else{ ?>
<div class="no-rows"><?php echo JText::_('COM_DJCLASSIFIEDS_NOTHING_TO_DISPLAY'); ?></div>
<?php } ?>
</div>
</div>
<?php echo JHTML::_($this->bs_cl->tab.'.endTab'); ?>
<?php } ?>
<?php if($par->get('buynow','0')){ ?>
<?php echo JHTML::_($this->bs_cl->tab.'.addTab', 'myTab', 'buynow', JText::_('COM_DJCLASSIFIEDS_BUYNOW').($this->form->getData()->get('orders') ? ' <span class="badge badge-info">'.count($this->form->getData()->get('orders')).'</span>' : '')); ?>
<?php echo $this->form->getField('buynow')->renderField(); ?>
<?php echo $this->form->getField('quantity')->renderField(); ?>
<?php echo $this->form->getField('unit_id')->renderField(); ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('orders'); ?>
</div>
<div class="controls">
<?php if($this->form->getData()->get('orders')){ ?>
<?php echo $this->form->getInput('orders'); ?>
<?php }else{ ?>
<div class="no-rows"><?php echo JText::_('COM_DJCLASSIFIEDS_NOTHING_TO_DISPLAY'); ?></div>
<?php } ?>
</div>
</div>
<?php echo JHTML::_($this->bs_cl->tab.'.endTab'); ?>
<?php } ?>
<?php echo JHTML::_($this->bs_cl->tab.'.addTab', 'myTab', 'ask', JText::_('COM_DJCLASSIFIEDS_MESSAGES').($this->form->getData()->get('askmessages') ? ' <span class="badge badge-info">'.count($this->form->getData()->get('askmessages')).'</span>' : '')); ?>
<?php if($this->form->getData()->get('askmessages')){ ?>
<?php echo $this->form->getInput('askmessages'); ?>
<?php }else{ ?>
<div class="no-rows"><?php echo JText::_('COM_DJCLASSIFIEDS_NOTHING_TO_DISPLAY'); ?></div>
<?php } ?>
<?php echo JHTML::_($this->bs_cl->tab.'.endTab'); ?>
<?php echo JHTML::_($this->bs_cl->tab.'.addTab', 'myTab', 'abuse', JText::_('COM_DJCLASSIFIEDS_ABUSE_RAPORTS').($this->form->getData()->get('abusereports') ? ' <span class="badge badge-important">'.count($this->form->getData()->get('abusereports')).'</span>' : '')); ?>
<?php if($this->form->getData()->get('abusereports')){ ?>
<?php echo $this->form->getInput('abusereports'); ?>
<?php }else{ ?>
<div class="no-rows"><?php echo JText::_('COM_DJCLASSIFIEDS_NOTHING_TO_DISPLAY'); ?></div>
<?php } ?>
<?php echo JHTML::_($this->bs_cl->tab.'.endTab'); ?>
<?php
$tab_titles = array_values(array_filter($app->triggerEvent('onAdminItemEditTabTitle', array($this->item))));
$tab_contents = array_values(array_filter($app->triggerEvent('onAdminItemEditTabContent', array($this->item))));
?>
<?php foreach($tab_titles as $key => $tab_title){ ?>
<?php echo JHTML::_($this->bs_cl->tab.'.addTab', 'myTab', preg_replace("/[^a-zA-Z]+/", "", strip_tags($tab_title)), strip_tags($tab_title, '<span>')); ?>
<?php echo $tab_contents[$key]; ?>
<?php echo JHTML::_($this->bs_cl->tab.'.endTab'); ?>
<?php } ?>
<?php echo JHTML::_($this->bs_cl->tab.'.endTabSet'); ?>
</div>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
<?php echo DJCFFOOTER; ?>
<script>
Joomla.submitbutton = function(task)
{
var form = document.getElementById('edit-form');
if (task == 'item.cancel') {
Joomla.submitform(task, form);
} else if(document.formvalidator.isValid(form)) {
Joomla.submitform(task, form);
}
else {
alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
}
}
</script>