<?php 
/********************************************************************************* 
 *  This file is part of Sentrifugo.
 *  Copyright (C) 2014 Sapplica
 *   
 *  Sentrifugo is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Sentrifugo is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Sentrifugo.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  Sentrifugo Support <support@sentrifugo.com>
 ********************************************************************************/
?>

<?php 
$sess_values = $this->sess_values;

if (count($this->messages)) {?>
    <div id="dispsyspref" class="settingssuccess">
<?php 
        foreach ($this->messages as $message)
        {
            $flag = array();				
            $flag = array_keys($message);
            echo "<div id='messageData' class='ml-alert-1-$flag[0]'><div style='display:block;'><span class='style-1-icon $flag[0]'></span>";
            echo $message[$flag[0]];
            echo "</div></div>";
        } 
?>
    </div>	
	
<?php } ?>
<span id="error_message"></span>
<?php if(empty($this->dataArray)){?>
      
	  <div class="ml-alert-1-info m1-info-set">
		  <div class="style-1-icon info">
		  </div>Site Preferences is not yet set. 
		<a href='<?php echo BASE_URL;?>sitepreference/add'>Click here</a>  to add the Site Preferences.
	  </div>
	  
<?php }else{?>

<?php 

$permission = sapp_Global::_checkprivileges(SITEPREFERENCE,$sess_values->group_id,$sess_values->emprole,'edit');
if($permission == 'Yes')
{
?>
     <!-- <div class="edit-btn"><a href='<?php //echo BASE_URL;?>sitepreference/edit/id/<?php //echo $this->dataArray[0]["id"]; ?>'>Edit</a></div> -->
	  
	  <div class="new_actions">
      	  <a class="edit_action_new" href='<?php echo BASE_URL;?>sitepreference/edit/id/<?php echo $this->dataArray[0]["id"]; ?>'><i class="fa fa-pencil"></i>Edit</a> </div>
<?php
}
?>
 <?php 
 $defaultDateFormat='';
  $defaultTimeFormat='';
 if(!empty($this->dataArray[0]['date_description']))
 $defaultDateFormat= $this->dataArray[0]['date_description'].". (Example: ".$this->dataArray[0]['date_example'].")";
 if(!empty($this->dataArray[0]['time_description']))
 $defaultTimeFormat=$this->dataArray[0]['time_description'].". (Example: ".$this->dataArray[0]['time_example'].")";
sapp_Helper::viewHeader();
sapp_Helper::viewBody('alt','Default Date Format ',(!empty($defaultDateFormat))?$defaultDateFormat:"...",'Default Time Format',(!empty( $defaultTimeFormat))? $defaultTimeFormat:"...");
sapp_Helper::viewBody('nor','Default Time Zone',(!empty($this->dataArray[0]['timezone']))?$this->dataArray[0]['timezone']:"...",'Default Currency',(!empty($this->dataArray[0]['currency']))?$this->dataArray[0]['currency']:"...");
?>

<?php 
sapp_Helper::viewBody('alt','Default Password ',(!empty($this->dataArray[0]['passwordtype']))? $this->dataArray[0]['passwordtype'].'<br>'.htmlspecialchars($this->dataArray[0]['pwddescription']):"...",'','');
?>

<?php 
sapp_Helper::viewBody('nor','Description',(!empty($this->dataArray[0]['description']))?$this->dataArray[0]['description']:"...",'','');

sapp_Helper::viewFooter();
?>

<!--  <table cellpadding="0" cellspacing="0" width="100%" border="0" >
<tr>
<td class="td-1" align="left" valign="top">
    <div class="site-info">
        <label>Default Date Format <b>:</b> </label>
       <span><?php echo $this->dataArray[0]['date_description'].". (Example: ".$this->dataArray[0]['date_example'].")"; ?> </span>   
    </div>
    <div class="site-info alter-div">
        <label>Default Time Format <b>:</b> </label>
        <span><?php echo $this->dataArray[0]['time_description'].". (Example: ".$this->dataArray[0]['time_example'].")"; ?></span>
    </div>
    <div class="site-info">
        <label>Default Time Zone <b>:</b> </label>
        <span><?php if(!empty($this->dataArray[0]['timezone'])){echo htmlspecialchars($this->dataArray[0]['timezone']);}else { echo "----" ; }?> </span>
    </div>
    <div class="site-info  alter-div">
        <label>Default Currency <b>:</b> </label>
        <span><?php if(!empty($this->dataArray[0]['currency'])){echo htmlspecialchars($this->dataArray[0]['currency']);}else {echo "----" ;}?> </span>
    </div>
    <div class="site-info">
        <label>Default Password <b>:</b> </label>
        <span><div><?php echo htmlspecialchars($this->dataArray[0]['passwordtype']); ?></div>
              <div class="password_hint_view"><?php echo htmlspecialchars($this->dataArray[0]['pwddescription']); ?></div>
        </span>		
    </div>
    <div class="site-info  alter-div">
        <label>Description  <b>:</b> </label>
       <span><?php if(!empty($this->dataArray[0]['description'])){echo htmlspecialchars($this->dataArray[0]['description']);}else { echo "----" ;}?> </span>
       
    </div>
</td>
</tr>
</table>-->
<?php } ?>

<script type='text/javascript'>
$(document).ready(function(){
<?php if (count($this->messages)) {?>
      setTimeout(function(){
			$('#dispsyspref').fadeOut('slow');
		},3000);

<?php } ?>
});
</script>