Skip to content

Commit

Permalink
Beta updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Dipu Raj committed Apr 19, 2017
1 parent 52ab0af commit 97bbe8d
Show file tree
Hide file tree
Showing 7 changed files with 341 additions and 147 deletions.
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,49 @@
*/cache/*
!*/cache/index.html
!*/cache/.htaccess
/nbproject/private/
.DS_Store

application/cache/*
application/logs/*
/vendor/

# IDE Files
#-------------------------
/nbproject/
.idea/*

## Sublime Text cache files
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
*.sublime-workspace
*.sublime-project

# CI Project
#-------------------------
.gitignore
contributing.md
index.php
/system/*
application/config/*
application/core/*
application/helpers/*
application/hooks/*
application/language/*
application/models/*
application/third_party/*
application/views/*
!application/libraries/SmartGrid/*
/license.txt
/readme.rst
/application/.htaccess
/application/index.html
/application/controllers/Welcome.php
/application/controllers/index.html
/application/libraries/index.html
!/application/views/example_smartgrid.php
/mpp.txt
!/application/views/smartgrid_and_datatables.php
!/application/views/example_smartgrid_arraygrid.php
!/application/config/smartgrid.php
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# SmartGrid for CodeIgniter with Bootstrap
A simple PHP datagrid control for CodeIgniter framework with Bootstrap.
# CodeIgniter SmartGrid
### A simple PHP datagrid control for CodeIgniter with Bootstrap support


SmartGrid focus on data display than data manipulation.
We are starting with limited features to make the code very simple and robust,
yet we will be adding more feature on the go. The code is very simple and well documented, which make it easy for customization.
Expand Down Expand Up @@ -79,7 +81,7 @@ Limitations

Version
-----
**SmartGrid v0.6.1-beta**
**SmartGrid v0.6.5-beta**
> Notice:- SmartGrid is on beta version, usage on production environment is not recommended unless tested well.
> Please report issue at [github issues](https://github.com/techlab/codeigniter-smartgrid/issues/)
Expand Down
25 changes: 25 additions & 0 deletions application/config/smartgrid.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* SmartGrid for CodeIgniter with Bootstrap
* -----------------------------------------
* SmartGrid configuration settings
* -----------------------------------------
*
* @package SmartGrid
* @version v0.6.1-beta
* @license MIT License
* @copyright Copyright (c) Dipu Raj and TechLaboratory.net
* @author Dipu Raj
* @author-website http://dipuraj.me
* @project-website http://www.techlaboratory.net/smartgrid
* @github https://github.com/techlab/codeigniter-smartgrid
*/
defined('BASEPATH') OR exit('No direct script access allowed');

$config['auto_generate_columns'] = false;
$config['paging_enabled'] = true;
$config['page_size'] = 10;
$config['toolbar_position'] = 'both';
$config['grid_form_method'] = 'GET';
$config['grid_name'] = '';
$config['debug_mode'] = false;
29 changes: 14 additions & 15 deletions application/controllers/Example_smartgrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ class Example_smartgrid extends CI_Controller {

public function index()
{
$employee_name = trim($this->input->get_post('employee_name', TRUE));

// Load the SmartGrid Library
$this->load->library('SmartGrid/Smartgrid');

$employee_name = $this->input->post_get('employee_name', TRUE);
$data['employee_name'] = $employee_name;
// SQl for grid
$where = '';
$where .= !empty($employee_name) ? " AND employee_name LIKE '%$employee_name%' " : "";
Expand All @@ -24,26 +21,28 @@ public function index()
"2"=>"Female"
);

$buttons_html = '<div class="btn-group" role="group" aria-label=""><button type="button" class="btn btn-default btn-xs" value="{field_name}">View</button><button type="button" class="btn btn-success btn-xs" value="{field_name}">Edit</button> <button type="button" class="btn btn-danger btn-xs" value="{field_name}">Delete</button></div>';

// Column settings
$columns = array(
"employee_id"=>array("header"=>"Employee ID", "type"=>"label", "align"=>"left", "width"=>"100px"),
"employee_name"=>array("header"=>"Employee Name", "type"=>"label", "align"=>"left", "width"=>"150px"),
"employee_dob"=>array("header"=>"Date of Birth", "type"=>"date", "align"=>"center", "width"=>"150px", "date_format"=>"Y-m-d", "date_format_from"=>"Y-m-d H:i:s"),
"employee_join_date"=>array("header"=>"Join Date", "type"=>"relativedate", "align"=>"left", "width"=>"150px"),
"employee_gender"=>array("header"=>"Gender", "type"=>"enum", "source"=>$gender_list, "align"=>"center", "width"=>"100px"),
"employee_salary"=>array("header"=>"Salary", "type"=>"money", "sign"=>"$", "align"=>"right", "width"=>"100px"),
"performance_index"=>array("header"=>"Performance", "type"=>"progressbar", "align"=>"center", "width"=>"100px"),
// "employee_img_url"=>array("header"=>"Image", "type"=>"image", "align"=>"center", "width"=>"50px", "image_width"=>"50px"),
"employee_id"=>array("type"=>"label", "header"=>"Employee ID", "align"=>"left", "width"=>"100px"),
"employee_name"=>array("type"=>"label", "header"=>"Employee Name", "align"=>"left", "width"=>""),
"employee_dob"=>array("type"=>"date", "header"=>"Date of Birth", "align"=>"center", "header_align"=>"center", "width"=>"150px", "date_format"=>"Y-m-d", "date_format_from"=>"Y-m-d H:i:s"),
"employee_join_date"=>array("type"=>"relativedate", "header"=>"Join Date", "align"=>"left", "width"=>"100px"),
"employee_gender"=>array("type"=>"enum", "header"=>"Gender", "source"=>$gender_list, "align"=>"center", "width"=>"80px"),
"employee_salary"=>array("type"=>"money", "header"=>"Salary", "sign"=>"$", "align"=>"right", "width"=>"100px"),
"performance_index"=>array("type"=>"progressbar", "header"=>"Performance", "align"=>"center", "width"=>"150px", "style" => "progress-bar-info"),
"employee_img_url"=>array("type"=>"custom", "header"=>"Buttons", "field_data"=>$buttons_html, "align"=>"center", "width"=>"130px"),
);

// Config settings, optional
$config = array("page_size"=> 5,
"grid_name"=> "sg_1",
"toolbar_position"=> 'both');

// Load the SmartGrid Library
$this->load->library('SmartGrid/Smartgrid');
// Set the grid
$this->smartgrid->set_grid($sql, $columns, $config);

// Render the grid and assign to data array, so it can be print to on the view
$data['grid_html'] = $this->smartgrid->render_grid();

Expand Down
Loading

0 comments on commit 97bbe8d

Please sign in to comment.