Ejemplo n.º 1
0
// speed things up with gzip, ob_start() required for csv downloads
//if(!ob_start('ob_gzhandler'))
//  ob_start();
header('Content-Type: text/html; charset=utf-8');
include 'application/libraries/dataGrid.php';
echo "\n<html>\n<head>\n\t<meta charset='UTF-8' />\n\t<link rel='stylesheet' type='text/css' href='../css/dataGrid.css'  />\n</head>\n<body>\n";
// enter your database host, name, username, and password
include 'application/libraries/connection.php';
// connect with pdo
try {
    $dbh = new PDO("mysql:host={$db_host};dbname={$db_name};", $db_user, $db_pass);
} catch (PDOException $e) {
    die('pdo connection error: ' . $e->getMessage());
}
// create LM object, pass in PDO connection
$lm = new lazy_mofo($dbh);
// table name for updates, inserts and deletes
$lm->table = 'Scores';
// identity / primary key for table
$lm->identity_name = 'UserID';
// optional, define grid sort order
$lm->grid_default_order_by = 'UserID desc';
// optional, make friendly names for fields
$lm->rename = array('UserID' => 'ID');
// optional, define input controls on the form
$lm->form_input_control = array('photo' => '--image', 'is_active' => '--checkbox', 'country_id' => 'select country_id, country_name from country; --select');
// optional, define editable input controls on the grid
$lm->grid_input_control = array('is_active' => '--checkbox', 'UserID' => 'select UserID, Username from Users; --select');
// optional, define output control on the grid; make email clickable and the photo a clickable link
$lm->grid_output_control = array('contact_email' => '--email', 'photo' => '--image');
// optional, query for grid(). if the last column selected is the primary key identity, then the [edit] and [delete] links are displayed
Ejemplo n.º 2
0
 function __construct($dbh, $size = '')
 {
     $this->bs_size = $size;
     $this->bs_js = "\n\t// a class for clearing input, usage (useful for bootstrap feedback classes): <input /><span class='clearer' />\n\t\$('.form-control-feedback.clearer').css('pointer-events','auto');\n\t\$('.clearer').click(function () { \$(this).prev('input').val('').focus(); });\n\t\$('#lm').addClass('table-responsive');\n\t\$('#lm table').addClass('table table-condensed');\n\t\$('#lm .lm_grid_add_link').addClass('btn btn-default btn-{$this->bs_size}');\n\t\$('#lm .lm_pagination a').addClass('btn btn-default btn-{$this->bs_size}');\n\t\$('#lm input[type=button]').addClass('btn btn-default btn-{$this->bs_size}');\n\t\$('#lm input[type=submit]').addClass('btn btn-primary btn-{$this->bs_size}');\n\t\$('#lm select').addClass('form-control input-{$this->bs_size}');\n\t\$('#lm form select').css({ 'min-width': '0px', width: 'auto', display: 'inline' });\n\t\$('#lm .lm_form input').addClass('form-control input-{$this->bs_size}');\n\t\$('#lm .lm_form textarea').addClass('form-control input-{$this->bs_size}');\n\t\$('#lm .lm_form input[type=radio]').removeClass('form-control');\n\t\$('#lm .lm_form input[type=checkbox]').removeClass('form-control');\n\t\$('#lm .lm_form input[type=file]').removeClass('form-control');\n\t\$('#lm .lm_search_input').addClass('form-control input-{$this->bs_size}');\n\t\$('#lm .lm_search_box').addClass('form-inline');\n\t//\$('#lm label').removeClass('checkbox');\n\t//\$('#lm label').removeClass('select');\n\t//\$('#lm label').removeClass('radio');\n\t//\$(\"\tinput:text[name='_search']\").css({ width: '50%' });\n\t//\$('#lm form .lm_pagination select').css({ 'min-width': '0px', width: 'auto', display: 'inline' });\n\t//\$('#lm form .lm_pagination select').removeClass('form-control');\n";
     parent::__construct($dbh);
 }
Ejemplo n.º 3
0
    ob_start();
}
header('Content-Type: text/html; charset=utf-8');
include 'lazy_mofo.php';
$db_host = 'localhost';
$db_name = 'nhneui7r_mysql';
$db_user = '******';
$db_pass = '******';
// connect with pdo
try {
    $dbh = new PDO("mysql:host={$db_host};dbname={$db_name};", $db_user, $db_pass);
} catch (PDOException $e) {
    die('pdo connection error: ' . $e->getMessage());
}
// create LM object, pass in PDO connection
$lm = new lazy_mofo($dbh);
// table name for updates, inserts and deletes
$lm->table = $tablename;
// identity / primary key for table
if (strtolower(substr($lm->table, 0, 5)) == "code_") {
    $lm->identity_name = 'id';
} else {
    if (strtolower(substr($lm->table, 0, 3)) == "lo_") {
        $lm->identity_name = 'id';
    } else {
        $lm->identity_name = 'id';
    }
}
$sSQL = "SHOW COLUMNS FROM {$tablename}";
$result = $lm->query($sSQL);
//$result=mysql_query($sSQL) or die("error:".mysql_error());
Ejemplo n.º 4
0
//echo $tablename;
// enter your database host, name, username, and password
header('Content-Type: text/html; charset=utf-8');
include 'lazy_mofo.php';
$db_host = 'localhost';
$db_name = 'energy_builder';
$db_user = '******';
$db_pass = '';
// connect with pdo
try {
    $dbh = new PDO("mysql:host={$db_host};dbname={$db_name};", $db_user, $db_pass);
} catch (PDOException $e) {
    die('pdo connection error: ' . $e->getMessage());
}
// create LM object, pass in PDO connection
$lm = new lazy_mofo($dbh);
// table name for updates, inserts and deletes
$lm->table = $tablename;
// identity / primary key for table
if (strtolower(substr($lm->table, 0, 5)) == "code_") {
    $lm->identity_name = 'id';
} else {
    if (strtolower(substr($lm->table, 0, 3)) == "lo_") {
        $lm->identity_name = 'id';
    } else {
        $lm->identity_name = 'id';
    }
}
$rel_parents = array();
$rel_columns = array();
$rel_tables = array();