<? global $vis_language; ?>
<link href="<?= VIS_PATH_SCRIPT; ?>colorpicker/css/bootstrap-colorpicker.min.css" rel="stylesheet">
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
	<div class="col-sm-6">
		<h3 class="m-b-xs text-black"><? echo$vis_language['TXTMANAGEPORTAL']; ?></h3>
		<ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
			<li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME']; ?></a></li>
            <li><a class="link" href="#/setting/setting_menu/<? echo $vis_language['TXTSETTINGS'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTSETTINGS'];?>',{'vis_module':'setting','vis_operation':'setting_menu'});"><? echo $vis_language['TXTSETTINGS']; ?></a></li>
			<li class="active"><? echo$vis_language['TXTMANAGEPORTAL']; ?></li>
		</ul>
	</div>
</section>
<section class="padder">
 <section class="panel panel-default">
  <header class="panel-heading sub_header"><? echo $vis_language['TXTMANAGEPORTAL']; ?></header>
  <div class="panel-body">
    <form action="index.php" class="form-horizontal" method="post" name="vis_mng_portal_setting" id="vis_mng_portal_setting" enctype="multipart/form-data">
        <div class="form-group">
			<label class="col-sm-2 control-label"><? echo $vis_language['TXTMANAGEPORTALLOGO']; ?></label>
			<div class="col-sm-10">
				<div class="col-sm-2">
					<div class="radio i-checks pull-left">
					  <label>
						<input type="radio" value="image" name="vis_logo" onclick="toggle_logo(this);" <? if($poral_setting['vis_manage_logo']=='image' || empty($poral_setting['vis_manage_logo'])) echo 'checked="checked"'; ?>><i></i><?= $vis_language['TXTIMG'];?>
					  </label>
					</div>
				</div>
				<div class="col-sm-2">
					<div class="radio i-checks m-l-xl">
					  <label>
						<input type="radio" value="text" name="vis_logo" onclick="toggle_logo(this);" <? if($poral_setting['vis_manage_logo']=='text') echo 'checked="checked"'; ?>><i></i><?= $vis_language['TXTTEXT'];?>
					  </label>
					</div>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label" id="image_logo" <? echo (((isset($poral_setting['vis_manage_logo'])) && $poral_setting['vis_manage_logo']=='image') || empty($poral_setting['vis_manage_logo']))?'style="display:"':'style="display:none"'; ?>></label>
				<label class="col-sm-2 control-label" id="text_logo" <?echo ((isset($poral_setting['vis_manage_logo'])) && $poral_setting['vis_manage_logo']=='text')?'style="display:"':'style="display:none"'; ?>><? echo $vis_language['TXTENTTXTLOGO']; ?></label>
			<div class="col-sm-10">
				<span id="vis_logo_image" class="m-l-xl" <? echo ($poral_setting['vis_manage_logo']=='image' || empty($poral_setting['vis_manage_logo']))?'style="display:"':'style="display:none"'; ?>>
				<span id="vis_manage_logo" class="pull-left m-r-xl"><img width="200px" src="<? echo (isset($poral_setting['vis_manage_portal_logo']) && $poral_setting['vis_manage_portal_logo']!='image')?(VIS_PATH_PROFILE.$poral_setting['vis_manage_portal_logo']):(VIS_PATH_IMAGES.'vh-logo.svg?ver=02122014'); ?>" /></span>
				<span id="vis_portal_logo" class="pull-left m-t-md">
					<input type="file" name=vis_portal_img class="filestyle" data-icon="false" data-classButton="btn btn-link link m-t-xs" data-buttonText="<? echo $vis_language['TXTUPLOADIMG']; ?>" data-input="false"  onchange="$(this).visExecution('upload_file', {'vis_static_area':'#vis_profile_image', 'vis_form':'vis_mng_portal_setting', 'vis_upload_area':'#vis_portal_logo', 'vis_action':'index.php?vis_module=setting&vis_operation=upload_logo&portal=manage'})">
				</span>
				<span id="clear_manage_logo_Img">
					<? if(isset($poral_setting['vis_manage_portal_logo']) && $poral_setting['vis_manage_portal_logo']!='image') {?>
						<button type="button" id="clear_manage_logo_Btn" class="btn btn-primary btn-xs pull-left m-t-lg" onclick="javascript:clear_manage_logo();"><? echo $vis_language['TXTCLEAR']; ?></button>
					<? }?>
				</span>
				</span>
				 <span id="vis_logo_text" <? echo ($poral_setting['vis_manage_logo']=='text')?'style="display:"':'style="display:none"'; ?>>
					<div class="row">
					  <div class="col-sm-9">
						<input class="form-control input-sm" id="logo_text" name="logo_text" value="<?= $poral_setting['vis_manage_portal_text']; ?>" type="text">
					  </div>
					  <div class="col-sm-3">
						<div class="input-group">
							<input class="form-control input-sm demo-auto" placeholder="Text color" name="logo_text_colour" type="text" value="<?= $poral_setting['vis_manage_portal_text_colour'];?>">
							<span class="input-group-addon input-sm">
								<label class="i-checks m-b-n m-l-xs">
									<input type="checkbox" name="logo_text_bold"<? if($poral_setting['vis_manage_portal_text_bold'] == 1) echo ' checked="checked"';?>><i></i> Bold
								</label>
							</span>
							<span class="input-group-addon input-sm">
								<label class="i-checks m-b-n m-l-xs">
									<input type="checkbox" name="logo_text_italic"<? if($poral_setting['vis_manage_portal_text_italic'] == 1) echo ' checked="checked"';?>><i></i> Italic
								</label>
							</span>
						</div>
					  </div>
					</div>
				 </span>
			</div>
		</div>
		
		<div class="form-group">
				<label class="col-sm-2 control-label"><? echo $vis_language['TXTFAVICON']; ?></label>
			<div class="col-sm-10">
					
					<span id="vis_manage_favicon_img" class="pull-left m-r-xl"><img height="30" src="<? echo (isset($poral_setting['vis_manage_favicon']) && $poral_setting['vis_manage_favicon']!='image')?(VIS_PATH_PROFILE.$poral_setting['vis_manage_favicon']):(VIS_PATH_IMAGES.'favicon.ico'); ?>" /></span>
					<span id="vis_manage_favicon" class="pull-left ">
						<input type="file" name="vis_favicon_manage_img" class="filestyle" data-icon="false" data-classButton="btn btn-link link" data-buttonText="<? echo $vis_language['TXTUPLOADIMG']; ?>" data-input="false" onchange="$(this).visExecution('upload_file', { 'vis_form':'vis_mng_portal_setting', 'vis_upload_area':'#vis_manage_favicon', 'portal': 'manage_favicon','vis_action':'index.php?vis_module=setting&vis_operation=upload_logo&portal=manage_favicon'})">
					</span>
					<span id="clear_manage_favicon_Img">
					<? if(isset($poral_setting['vis_manage_favicon']) && $poral_setting['vis_manage_favicon']!='image') {?>
						<button type="button" id="clear_manage_favicon_Btn" class="btn btn-primary btn-xs pull-left" onclick="javascript:clear_manage_favicon();"><? echo $vis_language['TXTCLEAR']; ?></button>
					<? }?>
				</span>
				</div>
				</div>
		
        <div class="form-group">
			<label class="col-sm-2 control-label"><? echo $vis_language['TXTTHEME']; ?></label>
			<div class="col-sm-10">
                <select class="form-control input-sm selectpicker" name="vis_theme" id="vis_theme" <? if(count($themes)>10) echo 'data-live-search="true"';?>><? for($i=0;$i<count($themes);$i++) {
			echo '<option value="'.$themes[$i]['theme'].'"'.(((empty($poral_setting['vis_manage_portal_theme']) && $themes[$i]['theme'] == 'default') || $themes[$i]['theme']==$poral_setting['vis_manage_portal_theme']) ? ' selected="selected"':'').' style="'.$themes[$i]['style'].'">';
			if($themes[$i]['theme'] == 'dark_blue')
				echo ucwords(str_replace('_', ' ', $themes[$i]['theme']));
			else
				echo ucwords($themes[$i]['theme']);
			echo '</option>';
			} echo '</select>';?>
			</div>
		</div>
		   <div class="form-group">
			<label class="col-sm-2 control-label"><? echo $vis_language['TXTLANGUAGE']; ?></label>
			<div class="col-sm-10">
				<select class="form-control input-sm selectpicker" name="vis_language" <? if(count($language_list)>10) echo 'data-live-search="true"';?>> <?
				for($i=0;$i<count($language_list);$i++) { ?>
					<option value="<? echo $language_list[$i]['language_id']; ?>"<? if($poral_setting['vis_manage_language']==$language_list[$i]['language_id']) echo ' selected="selected"'?>><? echo $language_list[$i]['language_name']; ?></option><?
				} ?> </select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label"><? echo $vis_language['TXTDATEFORMAT']; ?></label>
			<div class="col-sm-10">
				<input class="form-control input-sm" type="text" name="vis_date_format" id="vis_date_format" value="<? if($poral_setting['vis_date_format']=='') echo VIS_DATE_FORMAT;else echo $poral_setting['vis_date_format']; ?>" >
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label"><? echo $vis_language['TXTDATETIMEFORMAT']; ?></label>
			<div class="col-sm-10">
   <? $dtformat=array("M-jS, Y G:i","js-M, Y G:i","M-jS, Y g:i","M-jS, Y h:i:s","m-jS, Y g:i","d-m-Y h:i","d-m-Y h:i:s","D-m-Y h:i","D-m-Y h:i:s");
			$datetimeformat=(isset($poral_setting['vis_datetime_format']) && $poral_setting['vis_datetime_format']!='')?$poral_setting['vis_datetime_format']:VIS_DATETIME_FORMAT;
			if(!in_array($datetimeformat,$dtformat)){$customselected='selected="selected"'; $showcustom='show';}else{$showcustom='hide';}
			 ?>
   <select name="vis_datetime_format" id="vis_datetime_format" class="form-control input-sm selectpicker" onchange="showcustomdatetime(this.value);">
   <? for($c=0; $c<count($dtformat); $c++){?>
   <? if($dtformat[$c]==$datetimeformat){?>
   <option value="<?php echo $dtformat[$c];?>" selected="selected"><?php echo $dtformat[$c];?></option>
   <?php }else{?>
   <option value="<?php echo $dtformat[$c];?>"><?php echo $dtformat[$c];?></option>
   <? }}?>
   <option value="custom" <?=$customselected?>>Custom</option>
   </select>
   <div id="customdtm" class="m-t-sm <?php echo $showcustom;?>">
				<input class="form-control input-sm" type="text" name="vis_cdatetime_format" id="vis_cdatetime_format" value="<? echo $datetimeformat;?>">
    </div>
			</div>
		</div>
		<div class="form-group">
	   <label class="col-sm-2 control-label"><? echo $vis_language['TXTHTMLEDITOR']; ?></label>
	   <div class="col-sm-10">
		  <label class="checkbox-inline i-checks">
		  <input type="checkbox" name="vis_editor" id="vis_editor" <? echo ($poral_setting['vis_html_editor_status']==1 || $poral_setting['vis_html_editor_status']=='')?' checked="checked"':''; ?>><i></i> <? echo $vis_language['TXTENABLE']; ?>
		  </label>
	   </div>
	</div>
	
	<div class="form-group">
				<label class="col-sm-2 control-label"><? echo $vis_language['TXTLEFTPANELVIEW']; ?></label>
				<div class="col-sm-10">
    <label class="radio-inline i-checks"><input type="radio" name="vis_left_panel_view"  id="vis_left_panel_view_no" value="0"<?= (isset($poral_setting['vis_left_panel_view']) && $poral_setting['vis_left_panel_view']==0) || !isset($poral_setting['vis_left_panel_view'])?' checked="checked"':''; ?>><i></i> <?= $vis_language['TXTDEFAULT']?></label>
					<label class="radio-inline i-checks"><input type="radio" name="vis_left_panel_view" id="vis_left_panel_view_yes" value="1"<?= (isset($poral_setting['vis_left_panel_view']) && $poral_setting['vis_left_panel_view']==1)?' checked="checked"':''; ?>><i></i> <?= $vis_language['TXTLABELS']?></label>
					
				</div>				
        </div>
			
		<div class="form-group">
				<label class="col-sm-2 control-label"><? echo $vis_language['TXTHELP']; ?></label>
				<div class="col-sm-10">
				<label class="radio-inline i-checks"><input type="radio" name="vis_help_panel_view" id="vis_help_panel_view_yes" value="1"<?= ((isset($poral_setting['vis_help_panel_view']) && $poral_setting['vis_help_panel_view']==1)|| !isset($poral_setting['vis_help_panel_view']))?' checked="checked"':''; ?>><i></i> <?= $vis_language['TXTYES']?></label>
				<label class="radio-inline i-checks"><input type="radio" name="vis_help_panel_view"  id="vis_help_panel_view_no" value="0"<?=(isset($poral_setting['vis_help_panel_view']) && $poral_setting['vis_help_panel_view']==0)?' checked="checked"':''; ?>><i></i> <?= $vis_language['TXTNO']?></label>
					
					
				</div>				
        </div>	
			
			
			
			
			
		<div class="line b-b line-lg pull-in"></div><br/>
		<div class="form-group">
			<div class="col-sm-4 col-sm-offset-2">
				<button onclick="$(this).visExecution('submit_form',{'vis_module':'setting', 'vis_operation':'update_manage_portal', 'vis_form':'vis_mng_portal_setting'});" class="btn btn-primary" type="button"><? echo $vis_language['TXTUPDATE']; ?></button>
			</div>
		</div>
      </form>
    </div>
   </section>
  </section>
<script src="<?= VIS_PATH_SCRIPT; ?>file-input/bootstrap-filestyle.min.js"></script>
<script src="<?= VIS_PATH_SCRIPT; ?>colorpicker/js/bootstrap-colorpicker.js"></script>
<script>
   $(".selectpicker").selectpicker();
	$(function() {
		function createColorpickers() {
			$('.demo-auto').colorpicker();
		}
		createColorpickers();
	});
	function toggle_logo(e) {
	if(e.value=='image') {
		$("#vis_logo_image").css("display","");
		$("#vis_logo_text").css("display","none");
		$("#text_logo").css("display","none");
		$("#image_logo").css("display","");
	}
	else {
		$("#vis_logo_text").css("display","");
		$("#vis_logo_image").css("display","none");
		$("#text_logo").css("display","");
		$("#image_logo").css("display","none");
	}
}
function clear_manage_logo()
	{
		$('#clear_manage_logo_Img').visExecution('load_area', {'vis_module':'setting', 'vis_operation':'remove_logo','vis_manage':1});
	}
	function clear_manage_favicon()
	{
		$('#clear_manage_favicon_Img').visExecution('load_area', {'vis_module':'setting', 'vis_operation':'remove_logo','vis_manage_favicon_clear':1});
	}
	function showcustomdatetime(setv){
		if(setv=='custom'){
			$('#customdtm').removeClass('hide');
			$('#customdtm').addClass('show');
		}else{
			$('#customdtm').removeClass('show');
			$('#customdtm').addClass('hide');
		}
		
	}
</script>

