<?php
class jqReu2 extends jqGrid
{
protected function init()
{
$this->nav = array(
#Set common nav actions
'add' => true,
'edit' => true,
'del' => true,
'view' => true,
);
$this->options = array(
'width' => 1000,
'height' => 'auto'
);
$this->render_extend = '{}';
$this->render_suffix_col = 'id_uk';
#Set database table
$this->table = 'reu';
$this->query = "
SELECT {fields}
FROM reu
JOIN uk ON (reu.id_uk = uk.id_uk)
WHERE {where}
";
#Set columns
$this->cols = array(
'id_reu' => array('hidden' => true,
'db' => 'reu.id_reu',
),
'id_uk' => array('hidden' => true,
'db' => 'reu.id_uk',
),
'name_reu' => array('label' => 'REU',
'db' => 'reu.name_reu',
'width' => 100,
'editrules' => array('required' => true),
),
);
#Set essential condition
$this->where[] = 'reu.id_uk = ' . intval($this->input['id_uk']);
}
#prevent common html rendering
protected function renderHtml($data)
{
return '';
}
#Save columns to different tables
protected function opEdit($id, $upd)
{
#Get editing row
$result = $this->DB->query('SELECT * FROM reu WHERE id_reu=' . intval($id));
$row = $this->DB->fetch($result);
#Save other vars to items table
$this->DB->update('reu', $upd, array('id_reu' => $id));
}
}