function getChart($REQUEST) { $grid = new grid(true); $grid->setTable("grafik"); $grid->setGroupBy("tahun"); $grid->addField(array("field" => "tahun", "name" => "tahun")); $grid->addField(array("field" => "SUM(page_view)", "name" => "page_view")); $grid->addField(array("field" => "SUM(page_visit)", "name" => "page_visit")); return $grid->doRead($REQUEST); }
function doRead($REQUEST, $report = 0) { $grid = new grid(true); $grid->setTable("sppk"); //set tablenya //$grid->setGroupBy($REQUEST['groupBy']); $grid->addField(array("field" => "id", "name" => "id", "primary" => true)); $grid->addField(array("field" => "jenis", "name" => "jenis")); $grid->addField(array("field" => "tanggal", "name" => "tanggal")); $grid->addField(array("field" => "perihal", "name" => "perihal")); $grid->addField(array("field" => "kode", "name" => "kode")); $grid->addField(array("field" => "tahun", "name" => "tahun")); if ($report) { return $grid->doSql($REQUEST); } else { return $grid->doRead($REQUEST); } }
function sortMenu($REQUEST,$parent_id,$update=0){ $grid = new grid(true); $grid->setTable("menu"); $grid->setJoin("LEFT JOIN iconcls ON menu.iconcls = iconcls.clsname"); $grid->setManualFilter(" AND parent_id = '$parent_id'"); $grid->addField(Array('field'=>'menu.id','name'=>'id','primary'=>true)); $grid->addField(Array('field'=>'menu.title','name'=>'title')); $grid->addField(Array('field'=>'iconcls.icon','name'=>'iconcls')); $grid->addField(Array('field'=>'menu.sort_id','name'=>'sort_id')); if ($update) return $grid->doUpdate($REQUEST['data']); else return $grid->doRead($REQUEST); }
<?php include_once("config_sistem.php"); include_once("class/mssql.inc.php"); include_once("class/class.grid.php"); $grid = new grid(true); $task = $_REQUEST['task']; switch($task) { case 'getIcon': $grid->setTable("iconcls"); $grid->addField( array( "field"=>"id", "name"=>"id" )); $grid->addField( array( "field"=>"title", "name"=>"title" )); $grid->addField( array( "field"=>"clsname", "name"=>"clsname" )); $grid->addField( array( "field"=>"icon", "name"=>"icon"
function createRoleMenuEvent($data){ $data = json_decode(stripslashes($data)); if ($data->data){ $data = $data->data; $sql = "select id from menu_event"; $this->setSQL($sql); $rs = $this->executeSQL(); $temp = Array(); while ($row = $rs->FetchNextObject()){ $insert_array = Array(); if (is_array($data)){ foreach($data as $field){ $insert_array['group_id'] = $field->group_id; $insert_array['role_id'] = $row->ID; $temp[] = $insert_array; } }else{ $insert_array['group_id'] = $data->group_id; $insert_array['role_id'] = $row->ID; $temp[] = $insert_array; } } $grid = new grid(true); $grid->setTable("role_menu_event_group"); $grid->addField( array( "field"=>"role_menu_event_id", "name"=>"role_menu_event_id", "primary"=>true ) ); $grid->addField( array( "field"=>"role_id", "name"=>"role_id" ) ); $grid->addField( array( "field"=>"group_id", "name"=>"group_id" ) ); $grid->doCreate(json_encode($temp)); } }