public function index()
 {
     $this->load->library('session');
     $this->load->helper(array('url', 'xcrud'));
     Xcrud_config::$scripts_url = base_url('');
     $this->output->set_output(Xcrud::get_requested_instance());
 }
Example #2
0
 function xcrud_get_instance($name = false)
 {
     $CI =& get_instance();
     $CI->load->library('session');
     $CI->load->helper('url');
     Xcrud_config::$scripts_url = base_url('');
     $xcrud = Xcrud::get_instance($name);
     return $xcrud;
 }
Example #3
0
 /**
  * This function will use to display all user list 
  *
  * @access	public
  * @return render view
  */
 public function userinfo()
 {
     $session = $this->session->userdata('admin_id');
     if (empty($session)) {
         redirect(site_url('login'), 'refresh');
     }
     $login_type = $this->session->userdata('type');
     $this->load->helper('xcrud');
     Xcrud_config::$dbname = 'iwmf_user';
     $xcruduser = Xcrud::get_instance();
     $xcruduser->table('users');
     $xcruduser->subselect('Name', "CONCAT_WS(' ',firstname,lastname)");
     $xcruduser->columns('Name,checkin_count,alert_count, language, phone, jobtitle,created_on,status,last_checkin_time,checkin_status');
     $xcruduser->change_type('checkin_status', 'select', '', array('values' => array('0' => 'Pending', '1' => 'Started', '2' => 'Confirmed', '3' => 'Deleted', '4' => 'Closed', '5' => 'Missed')));
     $xcruduser->where('delete', 0);
     $xcruduser->column_name('jobtitle', 'Title');
     $xcruduser->column_name('created_on', 'Join Date');
     $xcruduser->column_name('alert_count', '# Alerts');
     $xcruduser->column_name('checkin_count', '# Check-Ins');
     $xcruduser->column_name('last_checkin_time', 'Last Check-in');
     $xcruduser->column_name('checkin_status', 'Check-in Status');
     $xcruduser->change_type('status', 'select', '', array('values' => array('-1' => 'Locked', '0' => 'Inactive', '1' => 'Active')));
     /*view user link for normal admin*/
     if ($login_type == 1) {
         $url = site_url('userinfo/userinfo/viewuser/{id}');
     } else {
         /*Edit user link for supper admin*/
         $url = site_url('userinfo/userinfo/index/{id}');
     }
     $xcruduser->column_pattern('Name', '<a href=' . $url . ' class="" data-task="" data-primary="{id}">{Name}</a>');
     $xcruduser->change_type('status', 'select', '', array('values' => array('-1' => 'Locked', '0' => 'Inactive', '1' => 'Active')));
     $xcruduser->change_type('type', 'select', '', array('values' => array('1' => 'Admin', '2' => 'User')));
     $xcruduser->change_type('Check-in Status', 'select', '', array('values' => array('0' => 'Pending', '1' => 'Started', '2' => 'Confirmed', '3' => 'Deleted', '4' => 'Closed', '5' => 'Missed')));
     $xcruduser->search_columns('Name,language,jobtitle,status', 'Name');
     $xcruduser->unset_edit();
     $xcruduser->unset_add();
     $xcruduser->unset_view();
     $xcruduser->unset_title();
     $xcruduser->unset_print();
     $xcruduser->unset_remove();
     if ($login_type == 1) {
         $xcruduser->button(site_url('userinfo/userinfo/viewuser/{id}'), 'EDIT', 'glyphicon glyphicon-eye-open');
     } else {
         $xcruduser->button(site_url('userinfo/userinfo/index/{id}'), 'EDIT', 'glyphicon glyphicon-pencil');
         $xcruduser->button('{id}', 'Delete', 'glyphicon glyphicon-trash', 'ref', '', array('type', '!=', 3));
     }
     $data['content'] = $xcruduser->render();
     $this->load->view('home', $data);
 }
Example #4
0
 public static function load_js()
 {
     $out = '';
     if (self::$instance) {
         $instance = reset(self::$instance);
         $language = $instance->language;
         $lang_arr = $instance->lang_arr;
     } else {
         $language = Xcrud_config::$language;
         $lang_arr = self::_get_language_static();
     }
     if (!self::$css_loaded && !self::$instance) {
         Xcrud_config::$scripts_url = self::check_url(Xcrud_config::$scripts_url, true);
         Xcrud_config::$editor_url = self::check_url(Xcrud_config::$editor_url);
         Xcrud_config::$editor_init_url = self::check_url(Xcrud_config::$editor_init_url);
     }
     if (self::$js_loaded) {
         self::error('Xcrud\'s scripts already rendered! Please, set <strong>$manual_load = true</strong> in your configuration file');
     }
     self::$js_loaded = true;
     if (Xcrud_config::$load_jquery) {
         $out .= '<script src="' . Xcrud_config::$scripts_url . '/' . Xcrud_config::$plugins_uri . '/jquery.min.js"></script>';
     }
     if (Xcrud_config::$jquery_no_conflict) {
         $out .= '
         <script type="text/javascript">
         <!--
         
         jQuery.noConflict();
         
         -->
         </script>';
     }
     if (Xcrud_config::$load_jquery_ui) {
         $out .= '<script src="' . Xcrud_config::$scripts_url . '/' . Xcrud_config::$plugins_uri . '/jquery-ui/jquery-ui.min.js"></script>';
     }
     if (Xcrud_config::$load_jcrop) {
         $out .= '<script src="' . Xcrud_config::$scripts_url . '/' . Xcrud_config::$plugins_uri . '/jcrop/jquery.Jcrop.min.js"></script>';
     }
     if (Xcrud_config::$load_bootstrap) {
         $out .= '<script src="' . Xcrud_config::$scripts_url . '/' . Xcrud_config::$plugins_uri . '/bootstrap/js/bootstrap.min.js"></script>';
     }
     $out .= '<script src="' . Xcrud_config::$scripts_url . '/' . Xcrud_config::$plugins_uri . '/timepicker/jquery-ui-timepicker-addon.js"></script>';
     if (Xcrud_config::$editor_url) {
         $out .= '<script src="' . Xcrud_config::$editor_url . '"></script>';
     }
     if (Xcrud_config::$load_googlemap) {
         $out .= '<script src="//maps.google.com/maps/api/js?sensor=false&language=' . $language . '"></script>';
     }
     $out .= '<script src="' . Xcrud_config::$scripts_url . '/' . Xcrud_config::$plugins_uri . '/xcrud.js"></script>';
     $config = array('url' => Xcrud_config::$scripts_url . '/' . Xcrud_config::$ajax_uri, 'editor_url' => Xcrud_config::$editor_url, 'editor_init_url' => Xcrud_config::$editor_init_url, 'force_editor' => Xcrud_config::$force_editor, 'date_first_day' => Xcrud_config::$date_first_day, 'date_format' => Xcrud_config::$date_format, 'time_format' => Xcrud_config::$time_format, 'lang' => $lang_arr, 'rtl' => Xcrud_config::$is_rtl ? 1 : 0);
     $out .= '
         <script type="text/javascript">
         <!--
         
        	var xcrud_config = ' . json_encode($config) . ';
                         
         -->
         </script>';
     if ($language != 'en') {
         if (is_file(XCRUD_PATH . '/' . Xcrud_config::$lang_path . '/datepicker/jquery.ui.datepicker-' . $language . '.js')) {
             $out .= '<script src="' . Xcrud_config::$scripts_url . '/' . Xcrud_config::$lang_uri . '/datepicker/jquery.ui.datepicker-' . $language . '.js"></script>';
         }
         if (is_file(XCRUD_PATH . '/' . Xcrud_config::$lang_path . '/timepicker/jquery-ui-timepicker-' . $language . '.js')) {
             $out .= '<script src="' . Xcrud_config::$scripts_url . '/' . Xcrud_config::$lang_uri . '/timepicker/jquery-ui-timepicker-' . $language . '.js"></script>';
         }
     }
     return $out;
 }
Example #5
0
<?php

require '../xcrud/xcrud.php';
require 'html/pagedata.php';
session_start();
Xcrud_config::$jquery_no_conflict = true;
// jquery conflicts with SyntaxHighlighter
$theme = isset($_GET['theme']) ? $_GET['theme'] : 'default';
switch ($theme) {
    case 'bootstrap':
        Xcrud_config::$theme = 'bootstrap';
        $title_2 = 'Bootstrap theme';
        break;
    case 'minimal':
        Xcrud_config::$theme = 'minimal';
        $title_2 = 'Minimal theme';
        break;
    default:
        Xcrud_config::$theme = 'default';
        $title_2 = 'Default theme';
        break;
}
$page = isset($_GET['page']) && isset($pagedata[$_GET['page']]) ? $_GET['page'] : 'default';
extract($pagedata[$page]);
$file = dirname(__FILE__) . '/pages/' . $filename;
$code = file_get_contents($file);
include 'html/template.php';
Example #6
0
function update_price()
{
    //mengupdate field lpb_detail yang belum memiliki price HANYA UNTUK PR (cukup dijalankan sekali)
    Xcrud_config::$dbname = 'bcspurchase_2015';
    Xcrud_config::$dbuser = '******';
    Xcrud_config::$dbpass = '******';
    Xcrud_config::$dbhost = '10.2.2.32';
    $db = Xcrud_db::get_instance();
    $select = "select lpb_id from lpb_detail";
    $db->query($select);
    $arr = $db->result();
    $count = 0;
    //die("Arr :".$arr[0]['lpb_id']);
    foreach ($arr as $ar) {
        foreach ($ar as $a) {
            $count++;
        }
    }
    for ($x = 0; $x < $count; $x++) {
        $query = "select po_item_id from lpb_detail where lpb_id='" . $arr[$x]['lpb_id'] . "'";
        $db->query($query);
        $po_item_id = $db->row()['po_item_id'];
        //die("po item id : ".$po_item_id);
        if ($po_item_id != '') {
            $query2 = "select price from po_item  where po_item_id='{$po_item_id}'";
            $db->query($query2);
            $price = $db->row()['price'];
            //die("material id : ".$material_id);
            $query3 = "update lpb_detail set price='{$price}' where lpb_id='" . $arr[$x]['lpb_id'] . "'";
            $db->query($query3);
        }
    }
    die;
}
Example #7
0
    // paths (relative to xcrud's folder)
    public static $themes_path = 'themes';
    // php and ini files
    public static $lang_path = 'languages';
    // ini files
    // external session
    public static $external_session = false;
    // use only when you use integration with externall session
    // loading events
    public static $before_construct = false;
    // callable param, runs before instance creation
    public static $after_render = false;
    // callable param, runs after instance was rendered
    // system
    public static $demo_mode = false;
    // disables any changing data in database
    public static $performance_mode = false;
    // experimental, disables {field_tags} features
    public static $autoclean_timeout = 3;
    // in seconds. Do not change, if not sure. Xcrud clears old instances in session when you reload browser tab or open new tab with xcrud. In this case Xcrud can't work in two tabs in the same time. You can increase timeout on your risk.
    // anti XSS
    public static $auto_xss_filtering = false;
    // enable all xcrud's POST and GET data filtering
    public static $xss_disalowed_attibutes = array('on\\w*', 'xmlns', 'formaction');
    // Remove bad attributes such as style, onclick and xmlns
    public static $xss_naughty_html = 'alert|applet|audio|basefont|base|behavior|bgsound|blink|body|embed|expression|form|frameset|frame|head|html|ilayer|input|isindex|layer|link|meta|object|plaintext|script|textarea|title|video|xml|xss';
    // If a tag containing any of the words in the list below is found, the tag gets converted to entities.
    public static $xss_naughty_scripts = 'alert|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink';
}
Xcrud_config::init();
Example #8
0
 /** constructor, sets basic xcrud vars (they can be changed by public pethods) */
 protected function __construct()
 {
     Xcrud_config::$scripts_url = $this->_check_url(Xcrud_config::$scripts_url, true);
     Xcrud_config::$editor_url = $this->_check_url(Xcrud_config::$editor_url);
     Xcrud_config::$editor_init_url = $this->_check_url(Xcrud_config::$editor_init_url);
     $this->limit = Xcrud_config::$limit;
     $this->limit_list = Xcrud_config::$limit_list;
     $this->column_cut = Xcrud_config::$column_cut;
     $this->show_primary_ai_field = Xcrud_config::$show_primary_ai_field;
     $this->show_primary_ai_column = Xcrud_config::$show_primary_ai_column;
     $this->benchmark = Xcrud_config::$benchmark;
     $this->start_minimized = Xcrud_config::$start_minimized;
     $this->remove_confirm = Xcrud_config::$remove_confirm;
     $this->upload_folder_def = Xcrud_config::$upload_folder_def;
     $this->theme = Xcrud_config::$theme;
     $this->is_print = Xcrud_config::$enable_printout;
     $this->is_title = Xcrud_config::$enable_table_title;
     $this->is_csv = Xcrud_config::$enable_csv_export;
     $this->is_numbers = Xcrud_config::$enable_numbers;
     $this->is_pagination = Xcrud_config::$enable_pagination;
     $this->is_search = Xcrud_config::$enable_search;
     $this->is_limitlist = Xcrud_config::$enable_limitlist;
     $this->is_sortable = Xcrud_config::$enable_sorting;
     $this->language = Xcrud_config::$language;
     $this->search_pattern = Xcrud_config::$search_pattern;
     $this->demo_mode = Xcrud_config::$demo_mode;
 }
function update_balance($postdata, $xcrud)
{
    Xcrud_config::$dbname = 'bcspurchase_2015';
    Xcrud_config::$dbuser = '******';
    Xcrud_config::$dbpass = '';
    Xcrud_config::$dbhost = 'localhost';
    $db = Xcrud_db::get_instance();
    //$db->query("INSERT INTO test(test) values ('".$postdata->get('po_item_id')."')");
    $qty_lpb = $postdata->get('qty');
    $po_item_id = $postdata->get('po_item_id');
    $unit = $postdata->get('unit');
    $a = 'select po_item.qty from po_item where po_item_id="' . $po_item_id . '"';
    $db->query($a);
    $qty_po = $db->row()['qty'];
    $balance = $qty_po - $qty_lpb;
    $query = $db->query("UPDATE po_item SET lpb_balance ='" . $balance . "' WHERE po_item_id ='" . $po_item_id . "'");
    $db->query($query);
}
Example #10
0
<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);
include '../inc/commons.php';
include BASE_URL . 'xcrud/xcrud.php';
if (!function_exists('xcrud_get_instance')) {
    function xcrud_get_instance($name = true)
    {
        return Xcrud::get_instance($name);
    }
}
Xcrud_config::$dbname = 'shop';
Xcrud_config::$dbuser = '******';
Xcrud_config::$dbpass = '******';
Xcrud_config::$dbhost = 'localhost';
$db = Xcrud_db::get_instance('shop');
$exec = $db->query("SELECT counter from counter");
$array = $db->result();
$counter = $array[0]['counter'];
$exec = $db->query("SELECT count(*),country from visitors group by country order by count(*) desc");
$array = $db->result();
$country = $array[0]['country'];
$exec = $db->query("SELECT count(*) as items from items");
$array = $db->result();
$items = $array[0]['items'];
$exec = $db->query("SELECT count(*) as count_category from (select distinct category from items group by category) as tbl1");
$array = $db->result();
$category = $array[0]['count_category'];
$exec = $db->query("SELECT count(*) as new from (select * from items where date_created+INTERVAL 1 WEEK > NOW()) as tbl1");
$array = $db->result();
<?php

Xcrud_config::$editor_url = dirname($_SERVER["SCRIPT_NAME"]) . '/../editors/ckeditor/ckeditor.js';
// can be set in config
$xcrud = Xcrud::get_instance();
$xcrud->table('orders');
$xcrud->change_type('status', 'select', '', 'On Hold,In Process,Resolved,Shipped,Disputed,Cancelled');
$xcrud->change_type('orderDate', 'none');
echo $xcrud->render();