function handle(&$params) { if (isset($_POST['--cleargrids']) and $_POST['--cleargrids'] == 1) { Dataface_dhtmlXGrid_activegrid::clearGrids(); } $cells = @$_REQUEST['cells']; $gridid = @$_REQUEST['-gridid']; $rowid = @$_REQUEST['-rowid']; $grid = Dataface_dhtmlXGrid_activegrid::getGrid($gridid); if (!is_object($grid)) { echo $this->error('Could not find grid with id "' . $gridid . '"'); exit; } if (!is_array($cells)) { echo $this->notice('No cells were submitted to be updated.'); exit; } //$cells = array_map('trim',$cells); foreach (array_keys($cells) as $key) { $cells[$key] = trim($cells[$key], "..ÿ.."); } print_r($cells); $res = $grid->setRowValues($rowid, $cells); if (PEAR::isError($res)) { echo $this->error($res->getMessage()); } $grid->update(); $grid2 = Dataface_dhtmlXGrid_activegrid::getGrid($gridid); echo $this->json(array('success' => 1)); exit; }
function init_portal($properties = null) { $elementName = $this->getName(); if (isset($_POST[$elementName])) { $this->grid = Dataface_dhtmlXGrid_activegrid::getGrid($_POST[$elementName]); } else { // Let's get the name of the relationship that this element should edit if (isset($properties['relationship'])) { $relationship = $properties['relationship']; } else { $relationship = $elementName; } // first let's get the source record of the relationship $record =& $properties['record']; if (!isset($record)) { $records = array(); } else { $records =& $record->getRelatedRecordObjects($relationship); } $r =& $record->_table->getRelationship($relationship); // Let's see if some columns were specified. if (isset($properties['columns'])) { $flds = explode(',', $properties['columns']); } else { $flds_temp = $r->fields(); $flds = array(); foreach ($flds_temp as $fld) { if (strpos($fld, '.') !== false) { list($dummy, $flds[]) = explode('.', $fld); } else { $flds[] = $fld; } } } $colnames = array(); foreach ($flds as $fld) { //list($dummy, $fld) = explode('.',$fld); $tbl =& $r->getTable($fld); $fld_data =& $tbl->getField($fld); if (strcasecmp($fld_data['visibility']['list'], 'hidden') and !in_array($fld_data['widget']['type'], array('static', 'hidden', 'portal', 'table', 'file', 'webcam'))) { $colnames[$fld] =& $fld_data; $colnames[$fld]['table'] = $tbl->tablename; } unset($tbl); unset($fld_data); } $this->grid = new Dataface_dhtmlXGrid_activegrid(array('-records' => &$records, '-columns' => &$colnames, '-parent_id' => $record->getId(), '-relationship' => $relationship)); $this->grid->relationship = $relationship; $this->grid->parent_id = $record->getId(); } }