public function GetValue(Renderer $renderer) { $result = ''; $primaryKeyValues = array(); ExtractPrimaryKeyValues($primaryKeyValues, METHOD_GET); $this->dataset->SetSingleRecordState($primaryKeyValues); $this->dataset->Open(); if ($this->dataset->Next()) { if ($this->column == null) { } else { $result = $renderer->Render($this->column); } } $this->dataset->Close(); return $result; }
public function ProcessMessages() { $primaryKeyValues = array(); if ($this->useGetToExtractPrimaryKeys) { ExtractPrimaryKeyValues($primaryKeyValues, METHOD_GET); } else { ExtractPrimaryKeyValues($primaryKeyValues, METHOD_POST); } $this->grid->GetDataset()->SetSingleRecordState($primaryKeyValues); $this->grid->GetDataset()->Open(); if ($this->grid->GetDataset()->Next()) { $message = ''; $fieldValues = $this->grid->GetDataset()->GetCurrentFieldValues(); if ($this->CanChangeData($fieldValues, $message)) { try { $this->grid->GetDataset()->Delete(); $this->DoAfterChangeData($fieldValues); } catch (Exception $e) { $this->ChangeState(OPERATION_DELETE); $this->SetGridErrorMessage($e); return; } } else { $this->ChangeState(OPERATION_DELETE); $this->SetGridSimpleErrorMessage($message); return; } $this->grid->SetGridMessage($message); } $this->grid->GetDataset()->Close(); $this->grid->GetDataset()->Open(); $this->ApplyState(OPERATION_VIEWALL); }
function GetPrimaryKeyValuesFromGet() { if ($this->internalStateSwitch) { return $this->internalStateSwitchPrimaryKeys; } else { $primaryKeyValues = array(); ExtractPrimaryKeyValues($primaryKeyValues, METHOD_GET); return $primaryKeyValues; } }
public function ProcessMessages() { $primaryKeyValues = array(); // TODO : this function can extract values from any array ExtractPrimaryKeyValues($primaryKeyValues, METHOD_POST); $action = ''; if (GetApplication()->GetSuperGlobals()->IsPostValueSet('submit1')) { $action = GetApplication()->GetSuperGlobals()->GetPostValue('submit1'); } $redirect = null; $detailToRedirect = null; if (GetApplication()->GetSuperGlobals()->IsGetValueSet('details-redirect')) { $detailToRedirect = GetApplication()->GetSuperGlobals()->GetGetValue('details-redirect'); } $this->GetDataset()->SetSingleRecordState($primaryKeyValues); $this->GetDataset()->Open(); if ($this->GetDataset()->Next()) { $this->CheckRLSEditGrant(); $this->GetDataset()->Edit(); $exceptions = array(); foreach ($this->grid->GetEditColumns() as $column) { try { $column->ProcessMessages(); } catch (Exception $e) { $exceptions[] = $e; } } foreach ($this->grid->GetEditColumns() as $column) { try { $column->AfterSetAllDatasetValues(); } catch (Exception $e) { $exceptions[] = $e; } } $message = ''; $oldFieldValues = array_merge($this->GetDataset()->GetFieldValues(), $this->GetDataset()->GetCurrentFieldValues()); $fieldValues = array_merge($this->GetDataset()->GetFieldValues(), $this->GetDataset()->GetCurrentFieldValues()); if ($this->CanChangeData($fieldValues, $message)) { if (count($exceptions) > 0) { $this->HandleError($this->ExceptionsToErrorMessage($exceptions), false); return; } try { $this->WriteChangesToDataset($oldFieldValues, $fieldValues, $this->GetDataset()); $this->GetDataset()->Post(); $this->DoAfterChangeData($fieldValues); if ($detailToRedirect) { $detail = $this->grid->FindDetail($detailToRedirect); $redirect = $detail->GetSeparateViewLink(); } } catch (Exception $e) { $this->HandleError($this->ExceptionToErrorMessage($e), false); return; } } else { $this->HandleError($message, true); return; } $this->grid->SetGridMessage($message); } if ($action != 'saveedit') { if (!$this->isInline) { header('Location: ' . $this->grid->GetReturnUrl()); if ($redirect) { header('Location: ' . $redirect); } exit; } } else { if (!$this->isInline) { $newPrimaryKeyValues = $this->grid->GetDataset()->GetPrimaryKeyValuesAfterEdit(); header('Location: ' . $this->grid->GetEditCurrentRecordLink($newPrimaryKeyValues)); $this->grid->GetDataset()->Close(); exit; } } }