<?php
include_once("_dirinfo.php");
include_once(PATH_TO_ROOT."init.php");
include_once(PATH_TO_ROOT."_class/class.Extjs_grid.php");



	$grid = new MakeGrid('wupShowGroup_'.$_POST['group_id'] );
	
	//$grid->setGridName('skupina')
	
	$grid->setMainTable('interviwer',DB_WARPIT_USERSPOOL)->setTitle("Group: ".$_POST['name']);
	if($_POST['group_id'] != 0 )
	{
		$grid->selectSQL = 'SELECT * from interviwer a INNER JOIN _group_link b ON a.id = b.id';// WHERE b.id_group = '.$_POST['group_id'];
	}
	else 
	{
		$grid->selectSQL = 'SELECT * from interviwer';
	}
	$grid->setReqUrl('webuserspool/_ajax/ajax.showgroup.php');
	$grid->baseParams = 'group_id:'.$_POST['group_id'];
	
	$grid->addColumn('id');
	$grid->addColumn('firstname')->header('Firstname')->editor('new Ext.form.TextField()')->defaultValue('');
    $grid->addColumn('surname')->header('Surname')->editor('new Ext.form.TextField()')->defaultValue('');
   
    $grid->addColumn(array(dataIndex=>'gender',header=>'Gender',minWidth=>100) )
					  ->type('combo')
					  ->comboSQL('SELECT * FROM user_input_labels  WHERE lab_field=\'gender\' ORDER BY lab_position')
					  ->comboValue('lab_code')
					  ->comboDisplay('lab_label');
					  
					  
    $grid->addColumn('adress')->header('Adress')->editor('new Ext.form.TextField()')->defaultValue('');
    $grid->addColumn('zip','City')->type('combo')
    	 			->comboSQL('SELECT * FROM user_input_labels  WHERE lab_field=\'zip\' ORDER BY lab_position')
    	 			->comboValue('lab_code')
					->comboDisplay('lab_label');
					
    $grid->addColumn('email')->header('Email')->editor('new Ext.form.TextField()')->defaultValue('');
    $grid->addColumn('tel')->header('Telephone')->editor('new Ext.form.TextField()')->defaultValue('');
    $grid->addColumn('verhalten')->type('checkColumn')->header('Verhalten');
    $grid->addColumn('einladen')->type('checkColumn')->header('Einladen');
	


    $grid->activateAdd('Add')
		->activateRemove('Delete')
		->setPaging(15)
		->setAutoExpand('email')
		->setCheckBoxSelectionModel(true)
		->setFiltering(true)
		->addExportButton('Export')
		->setSearchField('Search')
		->addConfig('enableDragDrop','true')
		->addConfig('ddGroup',"'wupGrouplink'")
		;
 	$grid->addTbarItem ("{ text:'Import', handler: function() { CallScript('webuserspool/_forms/window.fileUpload.php',{}); }   }  ");
	
 	
 	
 	
 	//echo $grid->createStore();
	echo $grid->createGrid();
	
	echo "mainTabPanel.add( Ext.getCmp( '".$grid->getGridName()."')).show();"; ?>