<?php

/**
 * inoERP
 *
 * @copyright   2014 Nishit R. Das
 * @license     https://www.mozilla.org/MPL/2.0/
 * @link        http://inoideas.org
 * @source code https://github.com/inoerp/inoERP
 */

/**
 * 
 *
 */
class site_info extends dbObject {

 public static $table_name = "site_info";
 public static $primary_column = "";
 public static $key_column = 'site_name';
 public static $module = "extension";
 public static $system_info = [
  'name' => 'Site Info',
  'number' => '10021',
  'description' => 'Site Information',
  'version' => '0.1.1',
  'db_version' => '1001',
  'mod_version' => '1.1.1',
  'primary_entity_cb' => '',
  'module_name' => 'extn',
  'weight' => 21
 ];
 public static $disabled_action_a = [
  'DISABLE_TRANSACTION' => 'Disable Transaction',
  'DISABLE_SEARCH' => 'Disable Search',
  'DISABLE_TRANSACTION_SEARCH' => 'Disable Transaction & Search',
 ];
 public static $move_line_wo_header_a = [
  'SAVE_HEADER' => 'Save Header',
  'SHOW_WARNING' => 'Show Warning',
  'NO_ACTION' => 'No Action',
 ];
 public $field_a = [
  'default_home_page',
  'site_name',
  'maintenance_cb',
  'maintenance_msg',
  'email',
  'phone_no',
  'disabled_action',
  'logo_path',
  'posts_in_fp',
  'summary_char_fp',
  'footer_message',
  'anonymous_user',
  'anonymous_user_role',
  'basic_user_role',
  'access_denied',
  'analytics_code',
  'move_line_wo_header',
  'mandatory_field_color',
  'heading_color',
  'content_color',
  'bg_image_path',
  'bg_opacity',
  'show_bg_image_cb',
  'ar_revenue_schedule_cb',
  'last_update_by',
  'last_update_date',
 ];
 public $initial_search = [
 ];
 public $column = [
  'default_home_page',
  'site_name',
  'email',
  'posts_in_fp',
 ];
 public $requiredField = [
//   'default_home_page',
  'site_name',
  'email',
  'posts_in_fp',
 ];
 public $search = [
  '_show_update_path' => 1,
  '_update_action_meassge' => 'Update',
  '_show_view_path' => 1,
 ];
 public $pageTitle = " Site Information "; //page Title
 public $default_home_page;
 public $site_name;
 public $maintenance_cb;
 public $maintenance_msg;
 public $email;
 public $phone_no;
 public $disabled_action;
 public $logo_path;
 public $posts_in_fp;
 public $summary_char_fp;
 public $footer_message;
 public $access_denied;
 public $anonymous_user;
 public $anonymous_user_role;
 public $basic_user_role;
 public $move_line_wo_header;
 public $heading_color;
 public $content_color;
 public $mandatory_field_color;
 public $bg_opacity;
 public $show_bg_image_cb;
 public $bg_image_path;
 public $ar_revenue_schedule_cb;
 public $created_by;
 public $creation_date;
 public $last_update_by;
 public $last_update_date;
 public $analytics_code;

 

 Public function save_onWebForm() {
  $this->save_singeRecord_db();
 }

//  public function _before_save(){
//   pa($this);
//  }
}

$site_info = new site_info();
$si = &$site_info;
$si_i = $si->findAll_singleRecord_db();
if ($si_i) {
 foreach ($si->field_a as $key => $val) {
  $si->$val = $si_i->$val;
 }
}


if ($si->maintenance_cb == 1) {
 $admin_role = false;
 foreach ($_SESSION['user_roles'] as $k_s => $k_v) {
  if ($k_v == 'ADMIN') {
   $admin_role = true;
   break;
  }
 }
 if (!$admin_role) {
  die("<h2> $si->maintenance_msg </h2>");
 }
}

//end of path class
?>