"; $grid = new DataGrid(DataGridTemplate); // if you use a different database $grid->db = new DB("".$crypt->decrypt(MYSQL_HOST)."", "".$crypt->decrypt(MYSQL_USER)."", "".$crypt->decrypt(MYSQL_PASSWORD)."", "".$crypt->decrypt(MYSQL_DB).""); $grid->TableName = "tbl_films"; // add columns $grid->AddTextBoxColumn("omschrijving", "Omschrijving",true); $grid->AddTextBoxColumn("embed", "embed"); /* $tpl = new Template(); $tpl->SetContent('
'); $col = new DataGridCommandColumn("url", "Voobeeld", $tpl,"cmd_name", "my_column_clicked"); $grid->Columns[] = $col; */ $grid->AddCheckBoxColumn("enabled", "enabled"); //$grid->Columns[2]->Width = "100px"; //$grid->Columns[4]->Width = "200px"; $grid->AllowSelect = true; $grid->CommandsRight = true; $grid->AllowDeleteSelected = $_SESSION['AllowDelete']; $grid->AllowCancelSort = true; $grid->AllowInsert = $_SESSION['AllowInsert']; //$grid->AllowInsert = true; $grid->AllowPage = true; $grid->AllowDelete = $_SESSION['AllowDelete']; $grid->AllowEdit = $_SESSION['AllowEdit']; $grid->AllowSort = true; $grid->ShowCaption = true; // listen for an event /* $grid->OnInsertCall ("datagrid_on_insert"); function datagrid_on_insert ($new_values, $cancel) { echo "here you must insert these values:
"; print_r ($new_values); echo "
insert has been cancelled by the user"; $cancel = true; // cancel it if you don't want DataGrid to insert by itself }*/ // at last but not least render the grid $grid->OnInsertCall ("datagrid_on_insert"); function datagrid_on_insert ($new_values, $cancel) { //echo "here you must insert these values:
"; //print_r ($new_values); GLOBAL $crypt; $cancel = true; //haal de laatste possision op $sql = 'INSERT INTO tbl_films (embed,omschrijving,users_id,enabled) VALUES (\''.addslashes($new_values[1]).'\', \''.addslashes($crypt->encrypt($new_values[0])).'\', \''.$crypt->decrypt($_SESSION['user_id']).'\',\''.addslashes($new_values[2]).'\')'; //$sql2 = 'INSERT INTO tbl_factuur_facturen_data (description,bedrag) VALUES (\''.$new_values[0].'\', \''.$new_values[1].'\')'; //echo $_SESSION['test'] = $_SESSION['test'] + 1; $result = mysql_query($sql) or die (mysql_error()); } $grid->Render(); echo ""; ?>