mayEdit(); } function build_form($mask) { $ret = array(); $form_checks = array(); $label_class = ''; $hallinta = Hallinta::instance(); $ret[] = '
'; return array('form' => implode('', $ret), 'checks' => $form_checks);; } function grid_details($source, $name, $def) { $hallinta = Hallinta::instance(); if ($name == 'main') $gridName = $source; else $gridName = $source . '__' . $name . '__second'; $options = array(); $options['onscroll'] = 'gridOnScroll'; $options['menuEvent'] = 'contextmenu'; $options['highlightElem'] = 'menuRow'; if ($name == 'main') $options['click'] = 'gridDrillDown'; if (array_key_exists('onclick', $def)) $options['click'] = $def['onclick']; if (array_key_exists('rows', $def)) $options['visibleRows'] = intval($def['rows']); if (array_key_exists('sort', $def)) $options['sortCol'] = intval($def['sort']); if (array_key_exists('sortdir', $def)) $options['sortDir'] = $def['sortdir']; if (array_key_exists('prefetch', $def) && $def['prefetch'] == false) $options['prefetchBuffer'] = false; if (array_key_exists('maxprint', $def)) $options['maxPrint'] = intval($def['maxprint']); else $options['maxPrint'] = 100000; $options['saveColumnInfo'] = array('width' => true, 'filter' => true, 'sort' => true); $canEdit = array_key_exists('table_edit', $def); if ($canEdit) { $options['canEdit'] = true; $options['updateURL'] = $hallinta->urlbase().'ajax/ajax.php'; } $hasFilter = false; $columnSpecs = array(); $html = array(); $html[] = sprintf('%s | ', $data['name']); if ($canEdit && array_key_exists('edit', $data)) { if (!is_array($data['edit'])) throw new Exception(sprintf('Grid %s column %s edit is not an array', $name, $data['name'])); $s = $data['edit']; $s['FieldName'] = sprintf('listinput_%s', $field); $s['ColName'] = $data['name']; } else { $s = array(); } if (isset($data['visible'])) { if ($data['visible'] === false) $s['visible'] = false; elseif ($data['visible'] === 'mobile' && !$hallinta->isMobile()) $s['visible'] = false; elseif ($data['visible'] === 'desktop' && $hallinta->isMobile()) $s['visible'] = false; } if (isset($data['width']) && $data['width'] > 0) $s['width'] = intval($data['width']); if (array_key_exists('type', $data)) $s['type'] = $data['type']; if (array_key_exists('filter', $data)) { $s['filterUI'] = $data['filter']; $hasFilter = true; } if (array_key_exists('control', $data)) $s['control'] = $data['control']; if (array_key_exists('specs', $data)) { if (!is_array($data['specs'])) throw new Exception(sprintf('Grid %s column %s specs is not an array', $name, $data['name'])); $s = array_merge($s, $data['specs']); } $columnSpecs[] = $s; } $options['columnSpecs'] = $columnSpecs; if ($hasFilter) { $options['AutoFilter'] = true; $options['FilterLocation'] = -1; } $html[] = '
---|