switch ($categories->CurrentAction) { case "I": // Get a record to display if (!LoadRow()) { // Load Record based on key $_SESSION[EW_SESSION_MESSAGE] = "No records found"; // No record found Page_Terminate($categories->getReturnUrl()); // Return to caller } break; case "U": // Update $categories->SendEmail = TRUE; // Send email on update success if (EditRow()) { // Update Record based on key $_SESSION[EW_SESSION_MESSAGE] = "Update successful"; // Update success Page_Terminate($categories->getReturnUrl()); // Return to caller } else { RestoreFormValues(); // Restore form values if update failed } } // Render the record $categories->RowType = EW_ROWTYPE_EDIT; // Render as edit RenderRow(); include "header.php";
function GridUpdate() { global $conn, $objForm, $logs; $rowindex = 1; $bGridUpdate = TRUE; // Begin transaction $conn->BeginTrans(); $sKey = ""; // Update row index and get row key $objForm->Index = $rowindex; $sThisKey = strval($objForm->GetValue("k_key")); // Update all rows based on key while ($sThisKey != "") { // Load all values & keys LoadFormValues(); // Get form values if (LoadKeyValues($sThisKey)) { // Get key values $logs->SendEmail = FALSE; // Do not send email on update success $bGridUpdate = EditRow(); // Update this row } else { $bGridUpdate = FALSE; // update failed } if ($bGridUpdate) { if ($sKey != "") { $sKey .= ", "; } $sKey .= $sThisKey; } else { break; } // Update row index and get row key $rowindex++; // next row $objForm->Index = $rowindex; $sThisKey = strval($objForm->GetValue("k_key")); } if ($bGridUpdate) { $conn->CommitTrans(); // Commit transaction $_SESSION[EW_SESSION_MESSAGE] = "Update successful"; // Set update success message ClearInlineMode(); // Clear inline edit mode } else { $conn->RollbackTrans(); // Rollback transaction if (@$_SESSION[EW_SESSION_MESSAGE] == "") { $_SESSION[EW_SESSION_MESSAGE] = "Update failed"; // Set update failed message } $logs->EventCancelled = TRUE; // Set event cancelled $logs->CurrentAction = "gridedit"; // Stay in gridedit mode } }