<?php /* Smarty version 2.6.26, created on 2017-04-13 03:15:39
         compiled from controllers/map_amenities.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'rlHook', 'controllers/map_amenities.tpl', 5, false),array('modifier', 'cat', 'controllers/map_amenities.tpl', 15, false),array('modifier', 'count', 'controllers/map_amenities.tpl', 21, false),)), $this); ?>
<!-- map amenities tpl -->

<!-- navigation bar -->
<?php if ($this->_tpl_vars['aRights'][$this->_tpl_vars['cKey']]['add']): ?>
	<?php echo rlHook::load(array('name' => 'apTplMapAmenitiesNavBar'), $this);?>

	
	<div id="nav_bar">
		<a href="javascript:void(0)" onclick="show('new_item');$('#edit_item').slideUp('fast');" class="button_bar"><span class="left"></span><span class="center_add"><?php echo $this->_tpl_vars['lang']['add_amenity']; ?>
</span><span class="right"></span></a>
	</div>
<?php endif; ?>
<!-- navigation bar end -->

<!-- add new item -->
<div id="new_item" class="hide">
	<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array('block_caption' => $this->_tpl_vars['lang']['add_item'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
	<form onsubmit="addItem();$('input[name=add_item_submit]').val('<?php echo $this->_tpl_vars['lang']['loading']; ?>
');return false;" action="" method="post">
	<table class="form">	
	<tr>
		<td class="name"><span class="red">*</span><?php echo $this->_tpl_vars['lang']['name']; ?>
</td>
		<td class="field">
			<?php if (count($this->_tpl_vars['allLangs']) > 1): ?>
				<ul class="tabs">
					<?php $_from = $this->_tpl_vars['allLangs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['langF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['langF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['language']):
        $this->_foreach['langF']['iteration']++;
?>
					<li lang="<?php echo $this->_tpl_vars['language']['Code']; ?>
" <?php if (($this->_foreach['langF']['iteration'] <= 1)): ?>class="active"<?php endif; ?>><?php echo $this->_tpl_vars['language']['name']; ?>
</li>
					<?php endforeach; endif; unset($_from); ?>
				</ul>
			<?php endif; ?>
			
			<?php $_from = $this->_tpl_vars['allLangs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['langF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['langF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['language']):
        $this->_foreach['langF']['iteration']++;
?>
				<?php if (count($this->_tpl_vars['allLangs']) > 1): ?><div class="tab_area<?php if (! ($this->_foreach['langF']['iteration'] <= 1)): ?> hide<?php endif; ?> <?php echo $this->_tpl_vars['language']['Code']; ?>
"><?php endif; ?>
				<input id="ni_<?php echo $this->_tpl_vars['language']['Code']; ?>
" type="text" style="width: 250px;" />
				<?php if (count($this->_tpl_vars['allLangs']) > 1): ?>
					<span class="field_description_noicon"><?php echo $this->_tpl_vars['lang']['name']; ?>
 (<b><?php echo $this->_tpl_vars['language']['name']; ?>
</b>)</span>
				</div>
				<?php endif; ?>
			<?php endforeach; endif; unset($_from); ?>
		</td>
	</tr>
	
	<?php echo rlHook::load(array('name' => 'apTplMapAmenitiesAddField'), $this);?>

	
	<tr>
		<td></td>
		<td class="field">
			<input type="submit" name="add_item_submit" value="<?php echo $this->_tpl_vars['lang']['add']; ?>
" />
			<a onclick="$('#new_item').slideUp('normal')" href="javascript:void(0)" class="cancel"><?php echo $this->_tpl_vars['lang']['close']; ?>
</a>
		</td>
	</tr>
	</table>
	</form>
	<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
</div>
<!-- add new item end -->

<!-- edit item -->
<div id="edit_item" class="hide">
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array('block_caption' => $this->_tpl_vars['lang']['edit_item'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
	<form onsubmit="editItem();$('input[name=edit_item_submit]').val('<?php echo $this->_tpl_vars['lang']['loading']; ?>
');return false;" action="" method="post">
	<table class="form">	
	<tr>
		<td class="name"><span class="red">*</span><?php echo $this->_tpl_vars['lang']['name']; ?>
</td>
		<td class="field">
			<?php if (count($this->_tpl_vars['allLangs']) > 1): ?>
				<ul class="tabs">
					<?php $_from = $this->_tpl_vars['allLangs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['langF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['langF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['language']):
        $this->_foreach['langF']['iteration']++;
?>
					<li lang="<?php echo $this->_tpl_vars['language']['Code']; ?>
" <?php if (($this->_foreach['langF']['iteration'] <= 1)): ?>class="active"<?php endif; ?>><?php echo $this->_tpl_vars['language']['name']; ?>
</li>
					<?php endforeach; endif; unset($_from); ?>
				</ul>
			<?php endif; ?>
			
			<?php $_from = $this->_tpl_vars['allLangs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['langF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['langF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['language']):
        $this->_foreach['langF']['iteration']++;
?>
				<?php if (count($this->_tpl_vars['allLangs']) > 1): ?><div class="tab_area<?php if (! ($this->_foreach['langF']['iteration'] <= 1)): ?> hide<?php endif; ?> <?php echo $this->_tpl_vars['language']['Code']; ?>
"><?php endif; ?>
				<input lang="<?php echo $this->_tpl_vars['language']['Code']; ?>
" id="ei_<?php echo $this->_tpl_vars['language']['Code']; ?>
" type="text" style="width: 250px;" />
				<?php if (count($this->_tpl_vars['allLangs']) > 1): ?>
					<span class="field_description_noicon"><?php echo $this->_tpl_vars['lang']['name']; ?>
 (<b><?php echo $this->_tpl_vars['language']['name']; ?>
</b>)</span>
				</div>
				<?php endif; ?>
			<?php endforeach; endif; unset($_from); ?>
		</td>
	</tr>
	
	<?php echo rlHook::load(array('name' => 'apTplMapAmenitiesEditField'), $this);?>

	
	<tr>
		<td></td>
		<td class="field">
			<input type="submit" name="edit_item_submit" value="<?php echo $this->_tpl_vars['lang']['edit']; ?>
" />
			<a onclick="$('#edit_item').slideUp('normal')" href="javascript:void(0)" class="cancel"><?php echo $this->_tpl_vars['lang']['close']; ?>
</a>
		</td>
	</tr>
	</table>
	</form>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
</div>
<!-- edit item end -->

<?php echo '
<script type="text/javascript">
var editKey = \'\';

var addItem = function()
{
	var names = new Array();
	'; ?>

	<?php $_from = $this->_tpl_vars['allLangs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['languages']):
?>
	names['<?php echo $this->_tpl_vars['languages']['Code']; ?>
'] = $('#ni_<?php echo $this->_tpl_vars['languages']['Code']; ?>
').val();
	<?php endforeach; endif; unset($_from); ?>
	<?php echo '

	xajax_addAmenity(names);
}

var prepareEdit = function(key)
{
	$(\'#new_item\').slideUp(\'fast\');
	$(\'#edit_item\').slideDown();
	
	$(\'#edit_item input[type=text]\').flPhrase({
		key: \'map_amenities+name+\'+key
	});
	
	editKey = key;
}

var editItem = function()
{
	var names = new Array();
	'; ?>

	<?php $_from = $this->_tpl_vars['allLangs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['languages']):
?>
	names['<?php echo $this->_tpl_vars['languages']['Code']; ?>
'] = $('#ei_<?php echo $this->_tpl_vars['languages']['Code']; ?>
').val();
	<?php endforeach; endif; unset($_from); ?>
	<?php echo '

	xajax_editAmenity(editKey, names);
}
</script>
'; ?>


<!-- amenities grid -->
<div id="grid"></div>
<script type="text/javascript">//<![CDATA[
var listingGroupsGrid;

<?php echo '
$(document).ready(function(){
	
	Ext.grid.defaultColumn = function(config){
	    Ext.apply(this, config);
	    if(!this.id){
	        this.id = Ext.id();
	    }
	    this.renderer = this.renderer.createDelegate(this);
	};

	Ext.grid.defaultColumn.prototype = {
	    init : function(grid){
	        this.grid = grid;
	        this.grid.on(\'render\', function(){
	            var view = this.grid.getView();
	            view.mainBody.on(\'mousedown\', this.onMouseDown, this);
	        }, this);
	    },
	    onMouseDown : function(e, t){
	        if( t.className && t.className.indexOf(\'x-grid3-cc-\'+this.id) != -1 )
	        {
	            e.stopEvent();
	            var index = this.grid.getView().findRowIndex(t);
	            var record = this.grid.store.getAt(index);
	            record.set(this.dataIndex, !record.data[this.dataIndex]);
				Ext.Ajax.request({
					waitMsg: \'Saving changes...\',
					url: rlUrlHome + \'controllers/map_amenities.inc.php?q=ext\',
					method: \'GET\',
					params:
					{
						action: \'update\',
						id: record.id,
						field: this.dataIndex,
						value: record.data[this.dataIndex]
					},
					failure: function()
					{
						Ext.MessageBox.alert(\'Error saving changes...\');
					},
					success: function()
					{
						mapAmenitiesGrid.store.commitChanges();
						mapAmenitiesGrid.reload();
					}
				});
	        }
	    },
	    renderer : function(v, p, record){
	        p.css += \' x-grid3-check-col-td\'; 	
			return \'<div ext:qtip="\'+lang[\'ext_set_default\']+\'" class="x-grid3-check-col\'+(v?\'-on\':\'\')+\' x-grid3-cc-\'+this.id+\'">&#160;</div>\';
	    }
	};

	var defaultColumn = new Ext.grid.defaultColumn({
		header: lang[\'ext_default\'],
		dataIndex: \'Default\',
		width: 5
	});
	
	mapAmenitiesGrid = new gridObj({
		key: \'mapAmenities\',
		id: \'grid\',
		ajaxUrl: rlUrlHome + \'controllers/map_amenities.inc.php?q=ext\',
		defaultSortField: \'name\',
		title: lang[\'ext_amenities_manager\'],
		fields: [
			{name: \'name\', mapping: \'name\', type: \'string\'},
			{name: \'Position\', mapping: \'Position\', type: \'int\'},
			{name: \'Status\', mapping: \'Status\'},
			{name: \'Default\', mapping: \'Default\'},
			{name: \'Key\', mapping: \'Key\'}
		],
		columns: [
			{
				header: lang[\'ext_name\'],
				dataIndex: \'name\',
				width: 60,
				id: \'rlExt_item_bold\'
			},defaultColumn,{
				header: lang[\'ext_position\'],
				dataIndex: \'Position\',
				width: 6,
				editor: new Ext.form.NumberField({
					allowBlank: false,
					allowDecimals: false
				}),
				renderer: function(val){
					return \'<span ext:qtip="\'+lang[\'ext_click_to_edit\']+\'">\'+val+\'</span>\';
				}
			},{
				header: lang[\'ext_status\'],
				dataIndex: \'Status\',
				width: 100,
				fixed: true,
				editor: new Ext.form.ComboBox({
					store: [
						[\'active\', lang[\'ext_active\']],
						[\'approval\', lang[\'ext_approval\']]
					],
					displayField: \'value\',
					valueField: \'key\',
					typeAhead: true,
					mode: \'local\',
					triggerAction: \'all\',
					selectOnFocus:true
				})
			},{
				header: lang[\'ext_actions\'],
				width: 70,
				fixed: true,
				dataIndex: \'Key\',
				sortable: false,
				renderer: function(data) {
					var out = "<center>";
					var splitter = false;
					
					if ( rights[cKey].indexOf(\'edit\') >= 0 )
					{
						out += \'<img class="edit" ext:qtip="\'+lang[\'ext_edit\']+\'" src="\'+rlUrlHome+\'img/blank.gif" onclick="prepareEdit(\\\'\'+data+\'\\\')" />\';
					}
					if ( rights[cKey].indexOf(\'delete\') >= 0 )
					{
						out += "<img class=\'remove\' ext:qtip=\'"+lang[\'ext_delete\']+"\' src=\'"+rlUrlHome+"img/blank.gif\' onclick=\'rlConfirm( \\""+lang[\'ext_notice_\'+delete_mod]+"\\", \\"xajax_deleteAmenity\\", \\""+Array(data)+"\\", \\"section_load\\" )\' />";
					}
					out += "</center>";
					
					return out;
				}
			}
		]
	});
	
	mapAmenitiesGrid.plugins.push(defaultColumn);
	
	'; ?>
<?php echo rlHook::load(array('name' => 'apTplMapAmenitiesGrid'), $this);?>
<?php echo '
	
	mapAmenitiesGrid.init();
	grid.push(mapAmenitiesGrid.grid);
	
});
'; ?>

//]]>
</script>
<!-- amenities grid end -->

<?php echo rlHook::load(array('name' => 'apTplMapAmenitiesBottom'), $this);?>


<!-- map amenities tpl end -->