function EditRow() { global $Security, $Language; $sFilter = $this->KeyFilter(); $conn =& $this->Connection(); $this->CurrentFilter = $sFilter; $sSql = $this->SQL(); $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; $rs = $conn->Execute($sSql); $conn->raiseErrorFn = ''; if ($rs === FALSE) { return FALSE; } if ($rs->EOF) { $EditRow = FALSE; // Update Failed } else { // Save old values $rsold =& $rs->fields; $this->LoadDbValues($rsold); $rsnew = array(); // category_id $this->category_id->SetDbValueDef($rsnew, $this->category_id->CurrentValue, 0, $this->category_id->ReadOnly); // scat_id $this->scat_id->SetDbValueDef($rsnew, $this->scat_id->CurrentValue, 0, $this->scat_id->ReadOnly); // product_name $this->product_name->SetDbValueDef($rsnew, $this->product_name->CurrentValue, "", $this->product_name->ReadOnly); // product_image if (!$this->product_image->ReadOnly && !$this->product_image->Upload->KeepFile) { $this->product_image->Upload->DbValue = $rsold['product_image']; // Get original value if ($this->product_image->Upload->FileName == "") { $rsnew['product_image'] = NULL; } else { $rsnew['product_image'] = $this->product_image->Upload->FileName; } } // product_secimage if (!$this->product_secimage->ReadOnly && !$this->product_secimage->Upload->KeepFile) { $this->product_secimage->Upload->DbValue = $rsold['product_secimage']; // Get original value if ($this->product_secimage->Upload->FileName == "") { $rsnew['product_secimage'] = NULL; } else { $rsnew['product_secimage'] = $this->product_secimage->Upload->FileName; } } // product_description $this->product_description->SetDbValueDef($rsnew, $this->product_description->CurrentValue, "", $this->product_description->ReadOnly); // feature_ledtype $this->feature_ledtype->SetDbValueDef($rsnew, $this->feature_ledtype->CurrentValue, NULL, $this->feature_ledtype->ReadOnly); // feature_power $this->feature_power->SetDbValueDef($rsnew, $this->feature_power->CurrentValue, NULL, $this->feature_power->ReadOnly); // feature_lumen $this->feature_lumen->SetDbValueDef($rsnew, $this->feature_lumen->CurrentValue, NULL, $this->feature_lumen->ReadOnly); // feature_viewangle $this->feature_viewangle->SetDbValueDef($rsnew, $this->feature_viewangle->CurrentValue, NULL, $this->feature_viewangle->ReadOnly); // feature_cri $this->feature_cri->SetDbValueDef($rsnew, $this->feature_cri->CurrentValue, NULL, $this->feature_cri->ReadOnly); // feature_iprating $this->feature_iprating->SetDbValueDef($rsnew, $this->feature_iprating->CurrentValue, NULL, $this->feature_iprating->ReadOnly); // feature_colortemp $this->feature_colortemp->SetDbValueDef($rsnew, $this->feature_colortemp->CurrentValue, NULL, $this->feature_colortemp->ReadOnly); // feature_body $this->feature_body->SetDbValueDef($rsnew, $this->feature_body->CurrentValue, NULL, $this->feature_body->ReadOnly); // feature_cutoutsize $this->feature_cutoutsize->SetDbValueDef($rsnew, $this->feature_cutoutsize->CurrentValue, NULL, $this->feature_cutoutsize->ReadOnly); // feature_colors $this->feature_colors->SetDbValueDef($rsnew, $this->feature_colors->CurrentValue, NULL, $this->feature_colors->ReadOnly); // feature_dimmable $this->feature_dimmable->SetDbValueDef($rsnew, $this->feature_dimmable->CurrentValue, NULL, $this->feature_dimmable->ReadOnly); // feature_warranty $this->feature_warranty->SetDbValueDef($rsnew, $this->feature_warranty->CurrentValue, NULL, $this->feature_warranty->ReadOnly); // feature_application $this->feature_application->SetDbValueDef($rsnew, $this->feature_application->CurrentValue, NULL, $this->feature_application->ReadOnly); if (!$this->product_image->Upload->KeepFile) { if (!ew_Empty($this->product_image->Upload->Value)) { if ($this->product_image->Upload->FileName == $this->product_image->Upload->DbValue) { // Overwrite if same file name $this->product_image->Upload->DbValue = ""; // No need to delete any more } else { $rsnew['product_image'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->product_image->UploadPath), $rsnew['product_image']); // Get new file name } } } if (!$this->product_secimage->Upload->KeepFile) { if (!ew_Empty($this->product_secimage->Upload->Value)) { if ($this->product_secimage->Upload->FileName == $this->product_secimage->Upload->DbValue) { // Overwrite if same file name $this->product_secimage->Upload->DbValue = ""; // No need to delete any more } else { $rsnew['product_secimage'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->product_secimage->UploadPath), $rsnew['product_secimage']); // Get new file name } } } // Call Row Updating event $bUpdateRow = $this->Row_Updating($rsold, $rsnew); if ($bUpdateRow) { $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; if (count($rsnew) > 0) { $EditRow = $this->Update($rsnew, "", $rsold); } else { $EditRow = TRUE; } // No field to update $conn->raiseErrorFn = ''; if ($EditRow) { if (!$this->product_image->Upload->KeepFile) { if (!ew_Empty($this->product_image->Upload->Value)) { $this->product_image->Upload->SaveToFile($this->product_image->UploadPath, $rsnew['product_image'], TRUE); } if ($this->product_image->Upload->DbValue != "") { @unlink(ew_UploadPathEx(TRUE, $this->product_image->OldUploadPath) . $this->product_image->Upload->DbValue); } } if (!$this->product_secimage->Upload->KeepFile) { if (!ew_Empty($this->product_secimage->Upload->Value)) { $this->product_secimage->Upload->SaveToFile($this->product_secimage->UploadPath, $rsnew['product_secimage'], TRUE); } if ($this->product_secimage->Upload->DbValue != "") { @unlink(ew_UploadPathEx(TRUE, $this->product_secimage->OldUploadPath) . $this->product_secimage->Upload->DbValue); } } } } else { if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") { // Use the message, do nothing } elseif ($this->CancelMessage != "") { $this->setFailureMessage($this->CancelMessage); $this->CancelMessage = ""; } else { $this->setFailureMessage($Language->Phrase("UpdateCancelled")); } $EditRow = FALSE; } } // Call Row_Updated event if ($EditRow) { $this->Row_Updated($rsold, $rsnew); } $rs->Close(); // product_image ew_CleanUploadTempPath($this->product_image, $this->product_image->Upload->Index); // product_secimage ew_CleanUploadTempPath($this->product_secimage, $this->product_secimage->Upload->Index); return $EditRow; }
function EditRow() { global $conn, $Security, $Language; $sFilter = $this->KeyFilter(); $this->CurrentFilter = $sFilter; $sSql = $this->SQL(); $conn->raiseErrorFn = 'ew_ErrorFn'; $rs = $conn->Execute($sSql); $conn->raiseErrorFn = ''; if ($rs === FALSE) { return FALSE; } if ($rs->EOF) { $EditRow = FALSE; // Update Failed } else { // Begin transaction if ($this->getCurrentDetailTable() != "") { $conn->BeginTrans(); } // Save old values $rsold =& $rs->fields; $this->LoadDbValues($rsold); $rsnew = array(); // Titulo $this->Titulo->SetDbValueDef($rsnew, $this->Titulo->CurrentValue, NULL, $this->Titulo->ReadOnly); // Descripcion $this->Descripcion->SetDbValueDef($rsnew, $this->Descripcion->CurrentValue, NULL, $this->Descripcion->ReadOnly); // archivo if (!$this->archivo->ReadOnly && !$this->archivo->Upload->KeepFile) { $this->archivo->Upload->DbValue = $rsold['archivo']; // Get original value if ($this->archivo->Upload->FileName == "") { $rsnew['archivo'] = NULL; } else { $rsnew['archivo'] = $this->archivo->Upload->FileName; } } // estado $this->estado->SetDbValueDef($rsnew, $this->estado->CurrentValue, NULL, $this->estado->ReadOnly); if (!$this->archivo->Upload->KeepFile) { $OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->DbValue); if (!ew_Empty($this->archivo->Upload->FileName)) { $NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->FileName); $FileCount = count($NewFiles); for ($i = 0; $i < $FileCount; $i++) { $fldvar = $this->archivo->Upload->Index < 0 ? $this->archivo->FldVar : substr($this->archivo->FldVar, 0, 1) . $this->archivo->Upload->Index . substr($this->archivo->FldVar, 1); if ($NewFiles[$i] != "") { $file = $NewFiles[$i]; if (file_exists(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file)) { if (!in_array($file, $OldFiles)) { $file1 = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->archivo->UploadPath), $file); // Get new file name if ($file1 != $file) { // Rename temp file while (file_exists(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file1)) { // Make sure did not clash with existing upload file $file1 = ew_UniqueFilename(ew_UploadPathEx(TRUE, $this->archivo->UploadPath), $file1, TRUE); } // Use indexed name rename(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file, ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file1); $NewFiles[$i] = $file1; } } } } } $this->archivo->Upload->FileName = implode(EW_MULTIPLE_UPLOAD_SEPARATOR, $NewFiles); $rsnew['archivo'] = $this->archivo->Upload->FileName; } else { $NewFiles = array(); } } // Call Row Updating event $bUpdateRow = $this->Row_Updating($rsold, $rsnew); if ($bUpdateRow) { $conn->raiseErrorFn = 'ew_ErrorFn'; if (count($rsnew) > 0) { $EditRow = $this->Update($rsnew, "", $rsold); } else { $EditRow = TRUE; } // No field to update $conn->raiseErrorFn = ''; if ($EditRow) { if (!$this->archivo->Upload->KeepFile) { $OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->DbValue); if (!ew_Empty($this->archivo->Upload->FileName)) { $NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->FileName); $NewFiles2 = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $rsnew['archivo']); $FileCount = count($NewFiles); for ($i = 0; $i < $FileCount; $i++) { $fldvar = $this->archivo->Upload->Index < 0 ? $this->archivo->FldVar : substr($this->archivo->FldVar, 0, 1) . $this->archivo->Upload->Index . substr($this->archivo->FldVar, 1); if ($NewFiles[$i] != "") { $file = ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $NewFiles[$i]; if (file_exists($file)) { $this->archivo->Upload->SaveToFile($this->archivo->UploadPath, @$NewFiles2[$i] != "" ? $NewFiles2[$i] : $NewFiles[$i], TRUE, $i); // Just replace } } } } else { $NewFiles = array(); } $FileCount = count($OldFiles); for ($i = 0; $i < $FileCount; $i++) { if ($OldFiles[$i] != "" && !in_array($OldFiles[$i], $NewFiles)) { @unlink(ew_UploadPathEx(TRUE, $this->archivo->OldUploadPath) . $OldFiles[$i]); } } } } // Update detail records if ($EditRow) { $DetailTblVar = explode(",", $this->getCurrentDetailTable()); if (in_array("seguimiento_tramites", $DetailTblVar) && $GLOBALS["seguimiento_tramites"]->DetailEdit) { if (!isset($GLOBALS["seguimiento_tramites_grid"])) { $GLOBALS["seguimiento_tramites_grid"] = new cseguimiento_tramites_grid(); } // Get detail page object $EditRow = $GLOBALS["seguimiento_tramites_grid"]->GridUpdate(); } } // Commit/Rollback transaction if ($this->getCurrentDetailTable() != "") { if ($EditRow) { $conn->CommitTrans(); // Commit transaction } else { $conn->RollbackTrans(); // Rollback transaction } } } else { if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") { // Use the message, do nothing } elseif ($this->CancelMessage != "") { $this->setFailureMessage($this->CancelMessage); $this->CancelMessage = ""; } else { $this->setFailureMessage($Language->Phrase("UpdateCancelled")); } $EditRow = FALSE; } } // Call Row_Updated event if ($EditRow) { $this->Row_Updated($rsold, $rsnew); } $rs->Close(); // archivo ew_CleanUploadTempPath($this->archivo, $this->archivo->Upload->Index); return $EditRow; }
function RenderRow() { global $Security, $Language, $gsLanguage; // Initialize URLs // Call Row_Rendering event $this->Row_Rendering(); // Common render codes for all row types // memberID // name // email // joined // facebook // twitter // twitch // skype // birthday // profession // game_type // division // has_expansion // notes if ($this->RowType == EW_ROWTYPE_VIEW) { // View row // memberID $this->memberID->ViewValue = $this->memberID->CurrentValue; $this->memberID->ViewCustomAttributes = ""; // name $this->name->ViewValue = $this->name->CurrentValue; $this->name->ViewCustomAttributes = ""; // email $this->_email->ViewValue = $this->_email->CurrentValue; $this->_email->ViewCustomAttributes = ""; // joined $this->joined->ViewValue = $this->joined->CurrentValue; $this->joined->ViewValue = ew_FormatDateTime($this->joined->ViewValue, undefined); $this->joined->ViewCustomAttributes = ""; // facebook $this->facebook->ViewValue = $this->facebook->CurrentValue; $this->facebook->ViewCustomAttributes = ""; // twitter $this->twitter->ViewValue = $this->twitter->CurrentValue; $this->twitter->ViewCustomAttributes = ""; // twitch $this->twitch->ViewValue = $this->twitch->CurrentValue; $this->twitch->ViewCustomAttributes = ""; // skype $this->skype->ViewValue = $this->skype->CurrentValue; $this->skype->ViewCustomAttributes = ""; // birthday $this->birthday->ViewValue = $this->birthday->CurrentValue; $this->birthday->ViewValue = ew_FormatDateTime($this->birthday->ViewValue, 5); $this->birthday->ViewCustomAttributes = ""; // profession if (strval($this->profession->CurrentValue) != "") { $this->profession->ViewValue = ""; $arwrk = explode(",", strval($this->profession->CurrentValue)); $cnt = count($arwrk); for ($ari = 0; $ari < $cnt; $ari++) { $this->profession->ViewValue .= $this->profession->OptionCaption(trim($arwrk[$ari])); if ($ari < $cnt - 1) { $this->profession->ViewValue .= ew_ViewOptionSeparator($ari); } } } else { $this->profession->ViewValue = NULL; } $this->profession->ViewCustomAttributes = ""; // game_type if (strval($this->game_type->CurrentValue) != "") { $this->game_type->ViewValue = ""; $arwrk = explode(",", strval($this->game_type->CurrentValue)); $cnt = count($arwrk); for ($ari = 0; $ari < $cnt; $ari++) { $this->game_type->ViewValue .= $this->game_type->OptionCaption(trim($arwrk[$ari])); if ($ari < $cnt - 1) { $this->game_type->ViewValue .= ew_ViewOptionSeparator($ari); } } } else { $this->game_type->ViewValue = NULL; } $this->game_type->ViewCustomAttributes = ""; // division if (strval($this->division->CurrentValue) != "") { $this->division->ViewValue = ""; $arwrk = explode(",", strval($this->division->CurrentValue)); $cnt = count($arwrk); for ($ari = 0; $ari < $cnt; $ari++) { $this->division->ViewValue .= $this->division->OptionCaption(trim($arwrk[$ari])); if ($ari < $cnt - 1) { $this->division->ViewValue .= ew_ViewOptionSeparator($ari); } } } else { $this->division->ViewValue = NULL; } $this->division->ViewCustomAttributes = ""; // has_expansion if (strval($this->has_expansion->CurrentValue) != "") { $this->has_expansion->ViewValue = $this->has_expansion->OptionCaption($this->has_expansion->CurrentValue); } else { $this->has_expansion->ViewValue = NULL; } $this->has_expansion->ViewCustomAttributes = ""; // notes $this->notes->ViewValue = $this->notes->CurrentValue; $this->notes->ViewCustomAttributes = ""; // name $this->name->LinkCustomAttributes = ""; $this->name->HrefValue = ""; $this->name->TooltipValue = ""; // email $this->_email->LinkCustomAttributes = ""; $this->_email->HrefValue = ""; $this->_email->TooltipValue = ""; // joined $this->joined->LinkCustomAttributes = ""; $this->joined->HrefValue = ""; $this->joined->TooltipValue = ""; // facebook $this->facebook->LinkCustomAttributes = ""; if (!ew_Empty($this->facebook->CurrentValue)) { $this->facebook->HrefValue = !empty($this->facebook->ViewValue) ? ew_RemoveHtml($this->facebook->ViewValue) : $this->facebook->CurrentValue; // Add prefix/suffix $this->facebook->LinkAttrs["target"] = "_blank"; // Add target if ($this->Export != "") { $this->facebook->HrefValue = ew_ConvertFullUrl($this->facebook->HrefValue); } } else { $this->facebook->HrefValue = ""; } $this->facebook->TooltipValue = ""; // twitter $this->twitter->LinkCustomAttributes = ""; if (!ew_Empty($this->twitter->CurrentValue)) { $this->twitter->HrefValue = !empty($this->twitter->ViewValue) ? ew_RemoveHtml($this->twitter->ViewValue) : $this->twitter->CurrentValue; // Add prefix/suffix $this->twitter->LinkAttrs["target"] = "_blank"; // Add target if ($this->Export != "") { $this->twitter->HrefValue = ew_ConvertFullUrl($this->twitter->HrefValue); } } else { $this->twitter->HrefValue = ""; } $this->twitter->TooltipValue = ""; // twitch $this->twitch->LinkCustomAttributes = ""; if (!ew_Empty($this->twitch->CurrentValue)) { $this->twitch->HrefValue = !empty($this->twitch->ViewValue) ? ew_RemoveHtml($this->twitch->ViewValue) : $this->twitch->CurrentValue; // Add prefix/suffix $this->twitch->LinkAttrs["target"] = "_blank"; // Add target if ($this->Export != "") { $this->twitch->HrefValue = ew_ConvertFullUrl($this->twitch->HrefValue); } } else { $this->twitch->HrefValue = ""; } $this->twitch->TooltipValue = ""; // skype $this->skype->LinkCustomAttributes = ""; $this->skype->HrefValue = ""; $this->skype->TooltipValue = ""; // birthday $this->birthday->LinkCustomAttributes = ""; $this->birthday->HrefValue = ""; $this->birthday->TooltipValue = ""; // profession $this->profession->LinkCustomAttributes = ""; $this->profession->HrefValue = ""; $this->profession->TooltipValue = ""; // game_type $this->game_type->LinkCustomAttributes = ""; $this->game_type->HrefValue = ""; $this->game_type->TooltipValue = ""; // division $this->division->LinkCustomAttributes = ""; $this->division->HrefValue = ""; $this->division->TooltipValue = ""; // has_expansion $this->has_expansion->LinkCustomAttributes = ""; $this->has_expansion->HrefValue = ""; $this->has_expansion->TooltipValue = ""; // notes $this->notes->LinkCustomAttributes = ""; if (!ew_Empty($this->notes->CurrentValue)) { $this->notes->HrefValue = !empty($this->notes->ViewValue) ? ew_RemoveHtml($this->notes->ViewValue) : $this->notes->CurrentValue; // Add prefix/suffix $this->notes->LinkAttrs["target"] = ""; // Add target if ($this->Export != "") { $this->notes->HrefValue = ew_ConvertFullUrl($this->notes->HrefValue); } } else { $this->notes->HrefValue = ""; } $this->notes->TooltipValue = ""; } elseif ($this->RowType == EW_ROWTYPE_EDIT) { // Edit row // name $this->name->EditAttrs["class"] = "form-control"; $this->name->EditCustomAttributes = ""; $this->name->EditValue = ew_HtmlEncode($this->name->CurrentValue); $this->name->PlaceHolder = ew_RemoveHtml($this->name->FldCaption()); // email $this->_email->EditAttrs["class"] = "form-control"; $this->_email->EditCustomAttributes = ""; $this->_email->EditValue = ew_HtmlEncode($this->_email->CurrentValue); $this->_email->PlaceHolder = ew_RemoveHtml($this->_email->FldCaption()); // joined // facebook $this->facebook->EditAttrs["class"] = "form-control"; $this->facebook->EditCustomAttributes = ""; $this->facebook->EditValue = ew_HtmlEncode($this->facebook->CurrentValue); $this->facebook->PlaceHolder = ew_RemoveHtml($this->facebook->FldCaption()); // twitter $this->twitter->EditAttrs["class"] = "form-control"; $this->twitter->EditCustomAttributes = ""; $this->twitter->EditValue = ew_HtmlEncode($this->twitter->CurrentValue); $this->twitter->PlaceHolder = ew_RemoveHtml($this->twitter->FldCaption()); // twitch $this->twitch->EditAttrs["class"] = "form-control"; $this->twitch->EditCustomAttributes = ""; $this->twitch->EditValue = ew_HtmlEncode($this->twitch->CurrentValue); $this->twitch->PlaceHolder = ew_RemoveHtml($this->twitch->FldCaption()); // skype $this->skype->EditAttrs["class"] = "form-control"; $this->skype->EditCustomAttributes = ""; $this->skype->EditValue = ew_HtmlEncode($this->skype->CurrentValue); $this->skype->PlaceHolder = ew_RemoveHtml($this->skype->FldCaption()); // birthday $this->birthday->EditAttrs["class"] = "form-control"; $this->birthday->EditCustomAttributes = ""; $this->birthday->EditValue = ew_HtmlEncode(ew_FormatDateTime($this->birthday->CurrentValue, 5)); $this->birthday->PlaceHolder = ew_RemoveHtml($this->birthday->FldCaption()); // profession $this->profession->EditAttrs["class"] = "form-control"; $this->profession->EditCustomAttributes = ""; $this->profession->EditValue = $this->profession->Options(FALSE); // game_type $this->game_type->EditCustomAttributes = ""; $this->game_type->EditValue = $this->game_type->Options(FALSE); // division $this->division->EditCustomAttributes = ""; $this->division->EditValue = $this->division->Options(FALSE); // has_expansion $this->has_expansion->EditCustomAttributes = ""; $this->has_expansion->EditValue = $this->has_expansion->Options(TRUE); // notes $this->notes->EditAttrs["class"] = "form-control"; $this->notes->EditCustomAttributes = ""; $this->notes->EditValue = ew_HtmlEncode($this->notes->CurrentValue); $this->notes->PlaceHolder = ew_RemoveHtml($this->notes->FldCaption()); // Edit refer script // name $this->name->LinkCustomAttributes = ""; $this->name->HrefValue = ""; // email $this->_email->LinkCustomAttributes = ""; $this->_email->HrefValue = ""; // joined $this->joined->LinkCustomAttributes = ""; $this->joined->HrefValue = ""; // facebook $this->facebook->LinkCustomAttributes = ""; if (!ew_Empty($this->facebook->CurrentValue)) { $this->facebook->HrefValue = !empty($this->facebook->EditValue) ? ew_RemoveHtml($this->facebook->EditValue) : $this->facebook->CurrentValue; // Add prefix/suffix $this->facebook->LinkAttrs["target"] = "_blank"; // Add target if ($this->Export != "") { $this->facebook->HrefValue = ew_ConvertFullUrl($this->facebook->HrefValue); } } else { $this->facebook->HrefValue = ""; } // twitter $this->twitter->LinkCustomAttributes = ""; if (!ew_Empty($this->twitter->CurrentValue)) { $this->twitter->HrefValue = !empty($this->twitter->EditValue) ? ew_RemoveHtml($this->twitter->EditValue) : $this->twitter->CurrentValue; // Add prefix/suffix $this->twitter->LinkAttrs["target"] = "_blank"; // Add target if ($this->Export != "") { $this->twitter->HrefValue = ew_ConvertFullUrl($this->twitter->HrefValue); } } else { $this->twitter->HrefValue = ""; } // twitch $this->twitch->LinkCustomAttributes = ""; if (!ew_Empty($this->twitch->CurrentValue)) { $this->twitch->HrefValue = !empty($this->twitch->EditValue) ? ew_RemoveHtml($this->twitch->EditValue) : $this->twitch->CurrentValue; // Add prefix/suffix $this->twitch->LinkAttrs["target"] = "_blank"; // Add target if ($this->Export != "") { $this->twitch->HrefValue = ew_ConvertFullUrl($this->twitch->HrefValue); } } else { $this->twitch->HrefValue = ""; } // skype $this->skype->LinkCustomAttributes = ""; $this->skype->HrefValue = ""; // birthday $this->birthday->LinkCustomAttributes = ""; $this->birthday->HrefValue = ""; // profession $this->profession->LinkCustomAttributes = ""; $this->profession->HrefValue = ""; // game_type $this->game_type->LinkCustomAttributes = ""; $this->game_type->HrefValue = ""; // division $this->division->LinkCustomAttributes = ""; $this->division->HrefValue = ""; // has_expansion $this->has_expansion->LinkCustomAttributes = ""; $this->has_expansion->HrefValue = ""; // notes $this->notes->LinkCustomAttributes = ""; if (!ew_Empty($this->notes->CurrentValue)) { $this->notes->HrefValue = !empty($this->notes->EditValue) ? ew_RemoveHtml($this->notes->EditValue) : $this->notes->CurrentValue; // Add prefix/suffix $this->notes->LinkAttrs["target"] = ""; // Add target if ($this->Export != "") { $this->notes->HrefValue = ew_ConvertFullUrl($this->notes->HrefValue); } } else { $this->notes->HrefValue = ""; } } if ($this->RowType == EW_ROWTYPE_ADD || $this->RowType == EW_ROWTYPE_EDIT || $this->RowType == EW_ROWTYPE_SEARCH) { // Add / Edit / Search row $this->SetupFieldTitles(); } // Call Row Rendered event if ($this->RowType != EW_ROWTYPE_AGGREGATEINIT) { $this->Row_Rendered(); } }
function AddRow($rsold = NULL) { global $Language, $Security; $conn =& $this->Connection(); // Load db values from rsold if ($rsold) { $this->LoadDbValues($rsold); } $rsnew = array(); // PATH if ($this->PATH->Visible && !$this->PATH->Upload->KeepFile) { $this->PATH->Upload->DbValue = ""; // No need to delete old file if ($this->PATH->Upload->FileName == "") { $rsnew['PATH'] = NULL; } else { $rsnew['PATH'] = $this->PATH->Upload->FileName; } } // PROCESS $this->PROCESS->SetDbValueDef($rsnew, $this->PROCESS->CurrentValue, 0, FALSE); // BANK_ACCOUNT_ID $this->BANK_ACCOUNT_ID->SetDbValueDef($rsnew, $this->BANK_ACCOUNT_ID->CurrentValue, 0, FALSE); // UPLOAD_FILE_STATUS_ID $this->UPLOAD_FILE_STATUS_ID->SetDbValueDef($rsnew, $this->UPLOAD_FILE_STATUS_ID->CurrentValue, 0, FALSE); // DATETIME $this->DATETIME->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->DATETIME->CurrentValue, 7), ew_CurrentDate(), FALSE); if ($this->PATH->Visible && !$this->PATH->Upload->KeepFile) { if (!ew_Empty($this->PATH->Upload->Value)) { $rsnew['PATH'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->PATH->UploadPath), $rsnew['PATH']); // Get new file name } } // Call Row Inserting event $rs = $rsold == NULL ? NULL : $rsold->fields; $bInsertRow = $this->Row_Inserting($rs, $rsnew); if ($bInsertRow) { $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; $AddRow = $this->Insert($rsnew); $conn->raiseErrorFn = ''; if ($AddRow) { // Get insert id if necessary $this->UPLOAD_FILE_ID->setDbValue($conn->Insert_ID()); $rsnew['UPLOAD_FILE_ID'] = $this->UPLOAD_FILE_ID->DbValue; if ($this->PATH->Visible && !$this->PATH->Upload->KeepFile) { if (!ew_Empty($this->PATH->Upload->Value)) { $this->PATH->Upload->SaveToFile($this->PATH->UploadPath, $rsnew['PATH'], TRUE); } } } } else { if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") { // Use the message, do nothing } elseif ($this->CancelMessage != "") { $this->setFailureMessage($this->CancelMessage); $this->CancelMessage = ""; } else { $this->setFailureMessage($Language->Phrase("InsertCancelled")); } $AddRow = FALSE; } if ($AddRow) { // Call Row Inserted event $rs = $rsold == NULL ? NULL : $rsold->fields; $this->Row_Inserted($rs, $rsnew); } // PATH ew_CleanUploadTempPath($this->PATH, $this->PATH->Upload->Index); return $AddRow; }
function RenderListRow() { global $conn, $Security; // Call Row Rendering event $this->Row_Rendering(); // Common render codes // cliente $this->cliente->CellCssStyle = "white-space: nowrap;"; // objetos $this->objetos->CellCssStyle = "white-space: nowrap;"; // precio $this->precio->CellCssStyle = "white-space: nowrap;"; // entrega $this->entrega->CellCssStyle = "white-space: nowrap;"; // saldo $this->saldo->CellCssStyle = "white-space: nowrap;"; // estado $this->estado->CellCssStyle = "white-space: nowrap;"; // fecha_recepcion $this->fecha_recepcion->CellCssStyle = "white-space: nowrap;"; // fecha_entrega $this->fecha_entrega->CellCssStyle = "white-space: nowrap;"; // foto1 $this->foto1->CellCssStyle = "white-space: nowrap;"; // foto2 $this->foto2->CellCssStyle = "white-space: nowrap;"; // cliente $this->cliente->ViewValue = $this->cliente->CurrentValue; $this->cliente->ViewCustomAttributes = ""; // objetos $this->objetos->ViewValue = $this->objetos->CurrentValue; $this->objetos->ViewCustomAttributes = ""; // precio $this->precio->ViewValue = $this->precio->CurrentValue; $this->precio->ViewCustomAttributes = ""; // entrega $this->entrega->ViewValue = $this->entrega->CurrentValue; $this->entrega->ViewCustomAttributes = ""; // saldo $this->saldo->ViewValue = $this->saldo->CurrentValue; $this->saldo->ViewCustomAttributes = ""; // estado if (strval($this->estado->CurrentValue) != "") { $sFilterWrk = "`estado`" . ew_SearchString("=", $this->estado->CurrentValue, EW_DATATYPE_STRING); $sSqlWrk = "SELECT `estado`, `estado` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `estados`"; $sWhereWrk = ""; $lookuptblfilter = "`activo`='S'"; if (strval($lookuptblfilter) != "") { ew_AddFilter($sWhereWrk, $lookuptblfilter); } if ($sFilterWrk != "") { ew_AddFilter($sWhereWrk, $sFilterWrk); } // Call Lookup selecting $this->Lookup_Selecting($this->estado, $sWhereWrk); if ($sWhereWrk != "") { $sSqlWrk .= " WHERE " . $sWhereWrk; } $sSqlWrk .= " ORDER BY `codigo` ASC"; $rswrk = $conn->Execute($sSqlWrk); if ($rswrk && !$rswrk->EOF) { // Lookup values found $this->estado->ViewValue = $rswrk->fields('DispFld'); $rswrk->Close(); } else { $this->estado->ViewValue = $this->estado->CurrentValue; } } else { $this->estado->ViewValue = NULL; } $this->estado->ViewCustomAttributes = ""; // fecha_recepcion $this->fecha_recepcion->ViewValue = $this->fecha_recepcion->CurrentValue; $this->fecha_recepcion->ViewValue = ew_FormatDateTime($this->fecha_recepcion->ViewValue, 7); $this->fecha_recepcion->ViewCustomAttributes = ""; // fecha_entrega $this->fecha_entrega->ViewValue = $this->fecha_entrega->CurrentValue; $this->fecha_entrega->ViewValue = ew_FormatDateTime($this->fecha_entrega->ViewValue, 7); $this->fecha_entrega->ViewCustomAttributes = ""; // foto1 if (!ew_Empty($this->foto1->Upload->DbValue)) { $this->foto1->ImageWidth = 40; $this->foto1->ImageHeight = 40; $this->foto1->ImageAlt = $this->foto1->FldAlt(); $this->foto1->ViewValue = ew_UploadPathEx(FALSE, $this->foto1->UploadPath) . $this->foto1->Upload->DbValue; } else { $this->foto1->ViewValue = ""; } $this->foto1->ViewCustomAttributes = ""; // foto2 if (!ew_Empty($this->foto2->Upload->DbValue)) { $this->foto2->ImageWidth = 10; $this->foto2->ImageHeight = 10; $this->foto2->ImageAlt = $this->foto2->FldAlt(); $this->foto2->ViewValue = ew_UploadPathEx(FALSE, $this->foto2->UploadPath) . $this->foto2->Upload->DbValue; } else { $this->foto2->ViewValue = ""; } $this->foto2->ViewCustomAttributes = ""; // cliente $this->cliente->LinkCustomAttributes = ""; $this->cliente->HrefValue = ""; $this->cliente->TooltipValue = ""; // objetos $this->objetos->LinkCustomAttributes = ""; $this->objetos->HrefValue = ""; $this->objetos->TooltipValue = ""; // precio $this->precio->LinkCustomAttributes = ""; $this->precio->HrefValue = ""; $this->precio->TooltipValue = ""; // entrega $this->entrega->LinkCustomAttributes = ""; $this->entrega->HrefValue = ""; $this->entrega->TooltipValue = ""; // saldo $this->saldo->LinkCustomAttributes = ""; $this->saldo->HrefValue = ""; $this->saldo->TooltipValue = ""; // estado $this->estado->LinkCustomAttributes = ""; $this->estado->HrefValue = ""; $this->estado->TooltipValue = ""; // fecha_recepcion $this->fecha_recepcion->LinkCustomAttributes = ""; $this->fecha_recepcion->HrefValue = ""; $this->fecha_recepcion->TooltipValue = ""; // fecha_entrega $this->fecha_entrega->LinkCustomAttributes = ""; $this->fecha_entrega->HrefValue = ""; $this->fecha_entrega->TooltipValue = ""; // foto1 $this->foto1->LinkCustomAttributes = ""; $this->foto1->HrefValue = ""; $this->foto1->HrefValue2 = $this->foto1->UploadPath . $this->foto1->Upload->DbValue; $this->foto1->TooltipValue = ""; // foto2 $this->foto2->LinkCustomAttributes = ""; $this->foto2->HrefValue = ""; $this->foto2->HrefValue2 = $this->foto2->UploadPath . $this->foto2->Upload->DbValue; $this->foto2->TooltipValue = ""; // Call Row Rendered event $this->Row_Rendered(); }
function RenderRow() { global $Security, $Language, $gsLanguage; // Initialize URLs // Call Row_Rendering event $this->Row_Rendering(); // Common render codes for all row types // product_id // category_id // scat_id // product_name // product_image // product_secimage // product_description // feature_ledtype // feature_power // feature_lumen // feature_viewangle // feature_cri // feature_iprating // feature_colortemp // feature_body // feature_cutoutsize // feature_colors // feature_dimmable // feature_warranty // feature_application if ($this->RowType == EW_ROWTYPE_VIEW) { // View row // product_id $this->product_id->ViewValue = $this->product_id->CurrentValue; $this->product_id->ViewCustomAttributes = ""; // category_id if (strval($this->category_id->CurrentValue) != "") { $sFilterWrk = "`category_id`" . ew_SearchString("=", $this->category_id->CurrentValue, EW_DATATYPE_NUMBER, ""); $sSqlWrk = "SELECT `category_id`, `category_name` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `category`"; $sWhereWrk = ""; ew_AddFilter($sWhereWrk, $sFilterWrk); $this->Lookup_Selecting($this->category_id, $sWhereWrk); // Call Lookup selecting if ($sWhereWrk != "") { $sSqlWrk .= " WHERE " . $sWhereWrk; } $rswrk = Conn()->Execute($sSqlWrk); if ($rswrk && !$rswrk->EOF) { // Lookup values found $arwrk = array(); $arwrk[1] = $rswrk->fields('DispFld'); $this->category_id->ViewValue = $this->category_id->DisplayValue($arwrk); $rswrk->Close(); } else { $this->category_id->ViewValue = $this->category_id->CurrentValue; } } else { $this->category_id->ViewValue = NULL; } $this->category_id->ViewCustomAttributes = ""; // scat_id if (strval($this->scat_id->CurrentValue) != "") { $sFilterWrk = "`scat_id`" . ew_SearchString("=", $this->scat_id->CurrentValue, EW_DATATYPE_NUMBER, ""); $sSqlWrk = "SELECT `scat_id`, `scat_name` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `sub_category`"; $sWhereWrk = ""; ew_AddFilter($sWhereWrk, $sFilterWrk); $this->Lookup_Selecting($this->scat_id, $sWhereWrk); // Call Lookup selecting if ($sWhereWrk != "") { $sSqlWrk .= " WHERE " . $sWhereWrk; } $rswrk = Conn()->Execute($sSqlWrk); if ($rswrk && !$rswrk->EOF) { // Lookup values found $arwrk = array(); $arwrk[1] = $rswrk->fields('DispFld'); $this->scat_id->ViewValue = $this->scat_id->DisplayValue($arwrk); $rswrk->Close(); } else { $this->scat_id->ViewValue = $this->scat_id->CurrentValue; } } else { $this->scat_id->ViewValue = NULL; } $this->scat_id->ViewCustomAttributes = ""; // product_name $this->product_name->ViewValue = $this->product_name->CurrentValue; $this->product_name->ViewCustomAttributes = ""; // product_image if (!ew_Empty($this->product_image->Upload->DbValue)) { $this->product_image->ViewValue = $this->product_image->Upload->DbValue; } else { $this->product_image->ViewValue = ""; } $this->product_image->ViewCustomAttributes = ""; // product_secimage if (!ew_Empty($this->product_secimage->Upload->DbValue)) { $this->product_secimage->ViewValue = $this->product_secimage->Upload->DbValue; } else { $this->product_secimage->ViewValue = ""; } $this->product_secimage->ViewCustomAttributes = ""; // feature_ledtype $this->feature_ledtype->ViewValue = $this->feature_ledtype->CurrentValue; $this->feature_ledtype->ViewCustomAttributes = ""; // feature_power $this->feature_power->ViewValue = $this->feature_power->CurrentValue; $this->feature_power->ViewCustomAttributes = ""; // feature_lumen $this->feature_lumen->ViewValue = $this->feature_lumen->CurrentValue; $this->feature_lumen->ViewCustomAttributes = ""; // feature_viewangle $this->feature_viewangle->ViewValue = $this->feature_viewangle->CurrentValue; $this->feature_viewangle->ViewCustomAttributes = ""; // feature_cri $this->feature_cri->ViewValue = $this->feature_cri->CurrentValue; $this->feature_cri->ViewCustomAttributes = ""; // feature_iprating $this->feature_iprating->ViewValue = $this->feature_iprating->CurrentValue; $this->feature_iprating->ViewCustomAttributes = ""; // feature_colortemp $this->feature_colortemp->ViewValue = $this->feature_colortemp->CurrentValue; $this->feature_colortemp->ViewCustomAttributes = ""; // feature_body $this->feature_body->ViewValue = $this->feature_body->CurrentValue; $this->feature_body->ViewCustomAttributes = ""; // feature_cutoutsize $this->feature_cutoutsize->ViewValue = $this->feature_cutoutsize->CurrentValue; $this->feature_cutoutsize->ViewCustomAttributes = ""; // feature_dimmable $this->feature_dimmable->ViewValue = $this->feature_dimmable->CurrentValue; $this->feature_dimmable->ViewCustomAttributes = ""; // feature_warranty $this->feature_warranty->ViewValue = $this->feature_warranty->CurrentValue; $this->feature_warranty->ViewCustomAttributes = ""; // product_id $this->product_id->LinkCustomAttributes = ""; $this->product_id->HrefValue = ""; $this->product_id->TooltipValue = ""; // category_id $this->category_id->LinkCustomAttributes = ""; $this->category_id->HrefValue = ""; $this->category_id->TooltipValue = ""; // scat_id $this->scat_id->LinkCustomAttributes = ""; $this->scat_id->HrefValue = ""; $this->scat_id->TooltipValue = ""; // product_name $this->product_name->LinkCustomAttributes = ""; $this->product_name->HrefValue = ""; $this->product_name->TooltipValue = ""; // product_image $this->product_image->LinkCustomAttributes = ""; $this->product_image->HrefValue = ""; $this->product_image->HrefValue2 = $this->product_image->UploadPath . $this->product_image->Upload->DbValue; $this->product_image->TooltipValue = ""; // product_secimage $this->product_secimage->LinkCustomAttributes = ""; $this->product_secimage->HrefValue = ""; $this->product_secimage->HrefValue2 = $this->product_secimage->UploadPath . $this->product_secimage->Upload->DbValue; $this->product_secimage->TooltipValue = ""; } // Call Row Rendered event if ($this->RowType != EW_ROWTYPE_AGGREGATEINIT) { $this->Row_Rendered(); } }
function AddRow($rsold = NULL) { global $Language, $Security; $conn =& $this->Connection(); // Load db values from rsold if ($rsold) { $this->LoadDbValues($rsold); $this->image_name->OldUploadPath = "/projectimages"; $this->image_name->UploadPath = $this->image_name->OldUploadPath; } $rsnew = array(); // p_id $this->p_id->SetDbValueDef($rsnew, $this->p_id->CurrentValue, 0, FALSE); // image_name if (!$this->image_name->Upload->KeepFile) { $this->image_name->Upload->DbValue = ""; // No need to delete old file if ($this->image_name->Upload->FileName == "") { $rsnew['image_name'] = NULL; } else { $rsnew['image_name'] = $this->image_name->Upload->FileName; } } // image_detail $this->image_detail->SetDbValueDef($rsnew, $this->image_detail->CurrentValue, "", FALSE); if (!$this->image_name->Upload->KeepFile) { $this->image_name->UploadPath = "/projectimages"; if (!ew_Empty($this->image_name->Upload->Value)) { $rsnew['image_name'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->image_name->UploadPath), $rsnew['image_name']); // Get new file name } } // Call Row Inserting event $rs = $rsold == NULL ? NULL : $rsold->fields; $bInsertRow = $this->Row_Inserting($rs, $rsnew); if ($bInsertRow) { $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; $AddRow = $this->Insert($rsnew); $conn->raiseErrorFn = ''; if ($AddRow) { // Get insert id if necessary $this->image_id->setDbValue($conn->Insert_ID()); $rsnew['image_id'] = $this->image_id->DbValue; if (!$this->image_name->Upload->KeepFile) { if (!ew_Empty($this->image_name->Upload->Value)) { $this->image_name->Upload->SaveToFile($this->image_name->UploadPath, $rsnew['image_name'], TRUE); } } } } else { if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") { // Use the message, do nothing } elseif ($this->CancelMessage != "") { $this->setFailureMessage($this->CancelMessage); $this->CancelMessage = ""; } else { $this->setFailureMessage($Language->Phrase("InsertCancelled")); } $AddRow = FALSE; } if ($AddRow) { // Call Row Inserted event $rs = $rsold == NULL ? NULL : $rsold->fields; $this->Row_Inserted($rs, $rsnew); } // image_name ew_CleanUploadTempPath($this->image_name, $this->image_name->Upload->Index); return $AddRow; }
function EditRow() { global $Security, $Language; $sFilter = $this->KeyFilter(); $sFilter = $this->ApplyUserIDFilters($sFilter); $conn =& $this->Connection(); $this->CurrentFilter = $sFilter; $sSql = $this->SQL(); $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; $rs = $conn->Execute($sSql); $conn->raiseErrorFn = ''; if ($rs === FALSE) { return FALSE; } if ($rs->EOF) { $this->setFailureMessage($Language->Phrase("NoRecord")); // Set no record message $EditRow = FALSE; // Update Failed } else { // Save old values $rsold =& $rs->fields; $this->LoadDbValues($rsold); $this->s_image->OldUploadPath = "/uploads/"; $this->s_image->UploadPath = $this->s_image->OldUploadPath; $this->s_images->OldUploadPath = "/uploads/"; $this->s_images->UploadPath = $this->s_images->OldUploadPath; $rsnew = array(); // s_title $this->s_title->SetDbValueDef($rsnew, $this->s_title->CurrentValue, "", $this->s_title->ReadOnly); // s_image if (!$this->s_image->ReadOnly && !$this->s_image->Upload->KeepFile) { $this->s_image->Upload->DbValue = $rsold['s_image']; // Get original value if ($this->s_image->Upload->FileName == "") { $rsnew['s_image'] = NULL; } else { $rsnew['s_image'] = $this->s_image->Upload->FileName; } } // s_desc $this->s_desc->SetDbValueDef($rsnew, $this->s_desc->CurrentValue, "", $this->s_desc->ReadOnly); // s_longdesc $this->s_longdesc->SetDbValueDef($rsnew, $this->s_longdesc->CurrentValue, "", $this->s_longdesc->ReadOnly); // s_images if (!$this->s_images->ReadOnly && !$this->s_images->Upload->KeepFile) { $this->s_images->Upload->DbValue = $rsold['s_images']; // Get original value if ($this->s_images->Upload->FileName == "") { $rsnew['s_images'] = NULL; } else { $rsnew['s_images'] = $this->s_images->Upload->FileName; } } // s_caption $this->s_caption->SetDbValueDef($rsnew, $this->s_caption->CurrentValue, "", $this->s_caption->ReadOnly); if (!$this->s_image->Upload->KeepFile) { $this->s_image->UploadPath = "/uploads/"; if (!ew_Empty($this->s_image->Upload->Value)) { $rsnew['s_image'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->s_image->UploadPath), $rsnew['s_image']); // Get new file name } } if (!$this->s_images->Upload->KeepFile) { $this->s_images->UploadPath = "/uploads/"; $OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->s_images->Upload->DbValue); if (!ew_Empty($this->s_images->Upload->FileName)) { $NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->s_images->Upload->FileName); $FileCount = count($NewFiles); for ($i = 0; $i < $FileCount; $i++) { $fldvar = $this->s_images->Upload->Index < 0 ? $this->s_images->FldVar : substr($this->s_images->FldVar, 0, 1) . $this->s_images->Upload->Index . substr($this->s_images->FldVar, 1); if ($NewFiles[$i] != "") { $file = $NewFiles[$i]; if (file_exists(ew_UploadTempPath($fldvar, $this->s_images->TblVar) . EW_PATH_DELIMITER . $file)) { if (!in_array($file, $OldFiles)) { $file1 = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->s_images->UploadPath), $file); // Get new file name if ($file1 != $file) { // Rename temp file while (file_exists(ew_UploadTempPath($fldvar, $this->s_images->TblVar) . EW_PATH_DELIMITER . $file1)) { // Make sure did not clash with existing upload file $file1 = ew_UniqueFilename(ew_UploadPathEx(TRUE, $this->s_images->UploadPath), $file1, TRUE); } // Use indexed name rename(ew_UploadTempPath($fldvar, $this->s_images->TblVar) . EW_PATH_DELIMITER . $file, ew_UploadTempPath($fldvar, $this->s_images->TblVar) . EW_PATH_DELIMITER . $file1); $NewFiles[$i] = $file1; } } } } } $this->s_images->Upload->FileName = implode(EW_MULTIPLE_UPLOAD_SEPARATOR, $NewFiles); $rsnew['s_images'] = $this->s_images->Upload->FileName; } else { $NewFiles = array(); } } // Call Row Updating event $bUpdateRow = $this->Row_Updating($rsold, $rsnew); if ($bUpdateRow) { $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; if (count($rsnew) > 0) { $EditRow = $this->Update($rsnew, "", $rsold); } else { $EditRow = TRUE; } // No field to update $conn->raiseErrorFn = ''; if ($EditRow) { if (!$this->s_image->Upload->KeepFile) { if (!ew_Empty($this->s_image->Upload->Value)) { $this->s_image->Upload->SaveToFile($this->s_image->UploadPath, $rsnew['s_image'], TRUE); } } if (!$this->s_images->Upload->KeepFile) { $OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->s_images->Upload->DbValue); if (!ew_Empty($this->s_images->Upload->FileName)) { $NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->s_images->Upload->FileName); $NewFiles2 = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $rsnew['s_images']); $FileCount = count($NewFiles); for ($i = 0; $i < $FileCount; $i++) { $fldvar = $this->s_images->Upload->Index < 0 ? $this->s_images->FldVar : substr($this->s_images->FldVar, 0, 1) . $this->s_images->Upload->Index . substr($this->s_images->FldVar, 1); if ($NewFiles[$i] != "") { $file = ew_UploadTempPath($fldvar, $this->s_images->TblVar) . EW_PATH_DELIMITER . $NewFiles[$i]; if (file_exists($file)) { $this->s_images->Upload->SaveToFile($this->s_images->UploadPath, @$NewFiles2[$i] != "" ? $NewFiles2[$i] : $NewFiles[$i], TRUE, $i); // Just replace } } } } else { $NewFiles = array(); } } } } else { if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") { // Use the message, do nothing } elseif ($this->CancelMessage != "") { $this->setFailureMessage($this->CancelMessage); $this->CancelMessage = ""; } else { $this->setFailureMessage($Language->Phrase("UpdateCancelled")); } $EditRow = FALSE; } } // Call Row_Updated event if ($EditRow) { $this->Row_Updated($rsold, $rsnew); } $rs->Close(); // s_image ew_CleanUploadTempPath($this->s_image, $this->s_image->Upload->Index); // s_images ew_CleanUploadTempPath($this->s_images, $this->s_images->Upload->Index); return $EditRow; }
function EditRow() { global $Security, $Language; $sFilter = $this->KeyFilter(); $sFilter = $this->ApplyUserIDFilters($sFilter); $conn =& $this->Connection(); $this->CurrentFilter = $sFilter; $sSql = $this->SQL(); $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; $rs = $conn->Execute($sSql); $conn->raiseErrorFn = ''; if ($rs === FALSE) { return FALSE; } if ($rs->EOF) { $this->setFailureMessage($Language->Phrase("NoRecord")); // Set no record message $EditRow = FALSE; // Update Failed } else { // Save old values $rsold =& $rs->fields; $this->LoadDbValues($rsold); $this->vl_media_file_custom->OldUploadPath = "uploads_custom/"; $this->vl_media_file_custom->UploadPath = $this->vl_media_file_custom->OldUploadPath; $rsnew = array(); // vl_media_type $this->vl_media_type->SetDbValueDef($rsnew, $this->vl_media_type->CurrentValue, NULL, $this->vl_media_type->ReadOnly); // vl_media_name $this->vl_media_name->SetDbValueDef($rsnew, $this->vl_media_name->CurrentValue, NULL, $this->vl_media_name->ReadOnly); // vl_media_file if ($this->vl_media_file->Visible && !$this->vl_media_file->ReadOnly && !$this->vl_media_file->Upload->KeepFile) { $this->vl_media_file->Upload->DbValue = $rsold['vl_media_file']; // Get original value if ($this->vl_media_file->Upload->FileName == "") { $rsnew['vl_media_file'] = NULL; } else { $rsnew['vl_media_file'] = $this->vl_media_file->Upload->FileName; } } // vl_media_file_custom if ($this->vl_media_file_custom->Visible && !$this->vl_media_file_custom->ReadOnly && !$this->vl_media_file_custom->Upload->KeepFile) { $this->vl_media_file_custom->Upload->DbValue = $rsold['vl_media_file_custom']; // Get original value if ($this->vl_media_file_custom->Upload->FileName == "") { $rsnew['vl_media_file_custom'] = NULL; } else { $rsnew['vl_media_file_custom'] = $this->vl_media_file_custom->Upload->FileName; } } if ($this->vl_media_file->Visible && !$this->vl_media_file->Upload->KeepFile) { if (!ew_Empty($this->vl_media_file->Upload->Value)) { $rsnew['vl_media_file'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->vl_media_file->UploadPath), $rsnew['vl_media_file']); // Get new file name } } if ($this->vl_media_file_custom->Visible && !$this->vl_media_file_custom->Upload->KeepFile) { $this->vl_media_file_custom->UploadPath = "uploads_custom/"; if (!ew_Empty($this->vl_media_file_custom->Upload->Value)) { $rsnew['vl_media_file_custom'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->vl_media_file_custom->UploadPath), $rsnew['vl_media_file_custom']); // Get new file name } } // Call Row Updating event $bUpdateRow = $this->Row_Updating($rsold, $rsnew); if ($bUpdateRow) { $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; if (count($rsnew) > 0) { $EditRow = $this->Update($rsnew, "", $rsold); } else { $EditRow = TRUE; } // No field to update $conn->raiseErrorFn = ''; if ($EditRow) { if ($this->vl_media_file->Visible && !$this->vl_media_file->Upload->KeepFile) { if (!ew_Empty($this->vl_media_file->Upload->Value)) { $this->vl_media_file->Upload->SaveToFile($this->vl_media_file->UploadPath, $rsnew['vl_media_file'], TRUE); } } if ($this->vl_media_file_custom->Visible && !$this->vl_media_file_custom->Upload->KeepFile) { if (!ew_Empty($this->vl_media_file_custom->Upload->Value)) { $this->vl_media_file_custom->Upload->SaveToFile($this->vl_media_file_custom->UploadPath, $rsnew['vl_media_file_custom'], TRUE); } } } } else { if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") { // Use the message, do nothing } elseif ($this->CancelMessage != "") { $this->setFailureMessage($this->CancelMessage); $this->CancelMessage = ""; } else { $this->setFailureMessage($Language->Phrase("UpdateCancelled")); } $EditRow = FALSE; } } // Call Row_Updated event if ($EditRow) { $this->Row_Updated($rsold, $rsnew); } $rs->Close(); // vl_media_file ew_CleanUploadTempPath($this->vl_media_file, $this->vl_media_file->Upload->Index); // vl_media_file_custom ew_CleanUploadTempPath($this->vl_media_file_custom, $this->vl_media_file_custom->Upload->Index); return $EditRow; }
function EditRow() { global $conn, $Security, $Language; $sFilter = $this->KeyFilter(); $this->CurrentFilter = $sFilter; $sSql = $this->SQL(); $conn->raiseErrorFn = 'ew_ErrorFn'; $rs = $conn->Execute($sSql); $conn->raiseErrorFn = ''; if ($rs === FALSE) { return FALSE; } if ($rs->EOF) { $EditRow = FALSE; // Update Failed } else { // Save old values $rsold =& $rs->fields; $this->LoadDbValues($rsold); $this->g_image->OldUploadPath = "/gallery"; $this->g_image->UploadPath = $this->g_image->OldUploadPath; $this->gd_images->OldUploadPath = "/gallery"; $this->gd_images->UploadPath = $this->gd_images->OldUploadPath; $rsnew = array(); // g_name $this->g_name->SetDbValueDef($rsnew, $this->g_name->CurrentValue, "", $this->g_name->ReadOnly); // g_image if (!$this->g_image->ReadOnly && !$this->g_image->Upload->KeepFile) { $this->g_image->Upload->DbValue = $rs->fields('g_image'); // Get original value if ($this->g_image->Upload->FileName == "") { $rsnew['g_image'] = NULL; } else { $rsnew['g_image'] = $this->g_image->Upload->FileName; } } // gd_images if (!$this->gd_images->ReadOnly && !$this->gd_images->Upload->KeepFile) { $this->gd_images->Upload->DbValue = $rs->fields('gd_images'); // Get original value if ($this->gd_images->Upload->FileName == "") { $rsnew['gd_images'] = NULL; } else { $rsnew['gd_images'] = $this->gd_images->Upload->FileName; } } if (!$this->g_image->Upload->KeepFile) { $this->g_image->UploadPath = "/gallery"; if (!ew_Empty($this->g_image->Upload->Value)) { $rsnew['g_image'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->g_image->UploadPath), $rsnew['g_image']); // Get new file name } } if (!$this->gd_images->Upload->KeepFile) { $this->gd_images->UploadPath = "/gallery"; $OldFiles = explode(",", $this->gd_images->Upload->DbValue); if (!ew_Empty($this->gd_images->Upload->FileName)) { $NewFiles = explode(",", $this->gd_images->Upload->FileName); $FileCount = count($NewFiles); for ($i = 0; $i < $FileCount; $i++) { $fldvar = $this->gd_images->Upload->Index < 0 ? $this->gd_images->FldVar : substr($this->gd_images->FldVar, 0, 1) . $this->gd_images->Upload->Index . substr($this->gd_images->FldVar, 1); if ($NewFiles[$i] != "") { $file = ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $NewFiles[$i]; if (file_exists($file)) { if (!in_array($NewFiles[$i], $OldFiles)) { $NewFiles[$i] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->gd_images->UploadPath), $NewFiles[$i]); // Get new file name $file1 = ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $NewFiles[$i]; if ($file1 != $file) { // Rename temp file rename($file, $file1); } } } } } $this->gd_images->Upload->FileName = implode(",", $NewFiles); $rsnew['gd_images'] = $this->gd_images->Upload->FileName; } else { $NewFiles = array(); } } // Call Row Updating event $bUpdateRow = $this->Row_Updating($rsold, $rsnew); if ($bUpdateRow) { $conn->raiseErrorFn = 'ew_ErrorFn'; if (count($rsnew) > 0) { $EditRow = $this->Update($rsnew, "", $rsold); } else { $EditRow = TRUE; } // No field to update $conn->raiseErrorFn = ''; if ($EditRow) { if (!$this->g_image->Upload->KeepFile) { if (!ew_Empty($this->g_image->Upload->Value)) { $this->g_image->Upload->SaveToFile($this->g_image->UploadPath, $rsnew['g_image'], TRUE); } } if (!$this->gd_images->Upload->KeepFile) { $OldFiles = explode(",", $this->gd_images->Upload->DbValue); if (!ew_Empty($this->gd_images->Upload->FileName)) { $NewFiles = explode(",", $this->gd_images->Upload->FileName); $NewFiles2 = explode(",", $rsnew['gd_images']); $FileCount = count($NewFiles); for ($i = 0; $i < $FileCount; $i++) { $fldvar = $this->gd_images->Upload->Index < 0 ? $this->gd_images->FldVar : substr($this->gd_images->FldVar, 0, 1) . $this->gd_images->Upload->Index . substr($this->gd_images->FldVar, 1); if ($NewFiles[$i] != "") { $file = ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $NewFiles[$i]; if (file_exists($file)) { $this->gd_images->Upload->Value = file_get_contents($file); $this->gd_images->Upload->SaveToFile($this->gd_images->UploadPath, @$NewFiles2[$i] != "" ? $NewFiles2[$i] : $NewFiles[$i], TRUE); // Just replace } } } } else { $NewFiles = array(); } } } } else { if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") { // Use the message, do nothing } elseif ($this->CancelMessage != "") { $this->setFailureMessage($this->CancelMessage); $this->CancelMessage = ""; } else { $this->setFailureMessage($Language->Phrase("UpdateCancelled")); } $EditRow = FALSE; } } // Call Row_Updated event if ($EditRow) { $this->Row_Updated($rsold, $rsnew); } $rs->Close(); // g_image ew_CleanUploadTempPath($this->g_image, $this->g_image->Upload->Index); // gd_images ew_CleanUploadTempPath($this->gd_images, $this->gd_images->Upload->Index); return $EditRow; }
function EditRow() { global $Security, $Language; $sFilter = $this->KeyFilter(); $conn =& $this->Connection(); $this->CurrentFilter = $sFilter; $sSql = $this->SQL(); $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; $rs = $conn->Execute($sSql); $conn->raiseErrorFn = ''; if ($rs === FALSE) { return FALSE; } if ($rs->EOF) { $EditRow = FALSE; // Update Failed } else { // Begin transaction if ($this->getCurrentDetailTable() != "") { $conn->BeginTrans(); } // Save old values $rsold =& $rs->fields; $this->LoadDbValues($rsold); $this->images->OldUploadPath = "/uploads"; $this->images->UploadPath = $this->images->OldUploadPath; $rsnew = array(); // title $this->title->SetDbValueDef($rsnew, $this->title->CurrentValue, "", $this->title->ReadOnly); // images if (!$this->images->ReadOnly && !$this->images->Upload->KeepFile) { $this->images->Upload->DbValue = $rsold['images']; // Get original value if ($this->images->Upload->FileName == "") { $rsnew['images'] = NULL; } else { $rsnew['images'] = $this->images->Upload->FileName; } } // intro $this->intro->SetDbValueDef($rsnew, $this->intro->CurrentValue, "", $this->intro->ReadOnly); // full_intro $this->full_intro->SetDbValueDef($rsnew, $this->full_intro->CurrentValue, "", $this->full_intro->ReadOnly); // details $this->details->SetDbValueDef($rsnew, $this->details->CurrentValue, "", $this->details->ReadOnly); // livelink $this->livelink->SetDbValueDef($rsnew, $this->livelink->CurrentValue, NULL, $this->livelink->ReadOnly); if (!$this->images->Upload->KeepFile) { $this->images->UploadPath = "/uploads"; if (!ew_Empty($this->images->Upload->Value)) { $rsnew['images'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->images->UploadPath), $rsnew['images']); // Get new file name } } // Call Row Updating event $bUpdateRow = $this->Row_Updating($rsold, $rsnew); if ($bUpdateRow) { $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; if (count($rsnew) > 0) { $EditRow = $this->Update($rsnew, "", $rsold); } else { $EditRow = TRUE; } // No field to update $conn->raiseErrorFn = ''; if ($EditRow) { if (!$this->images->Upload->KeepFile) { if (!ew_Empty($this->images->Upload->Value)) { $this->images->Upload->SaveToFile($this->images->UploadPath, $rsnew['images'], TRUE); } } } // Update detail records if ($EditRow) { $DetailTblVar = explode(",", $this->getCurrentDetailTable()); if (in_array("images", $DetailTblVar) && $GLOBALS["images"]->DetailEdit) { if (!isset($GLOBALS["images_grid"])) { $GLOBALS["images_grid"] = new cimages_grid(); } // Get detail page object $EditRow = $GLOBALS["images_grid"]->GridUpdate(); } } // Commit/Rollback transaction if ($this->getCurrentDetailTable() != "") { if ($EditRow) { $conn->CommitTrans(); // Commit transaction } else { $conn->RollbackTrans(); // Rollback transaction } } } else { if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") { // Use the message, do nothing } elseif ($this->CancelMessage != "") { $this->setFailureMessage($this->CancelMessage); $this->CancelMessage = ""; } else { $this->setFailureMessage($Language->Phrase("UpdateCancelled")); } $EditRow = FALSE; } } // Call Row_Updated event if ($EditRow) { $this->Row_Updated($rsold, $rsnew); } $rs->Close(); // images ew_CleanUploadTempPath($this->images, $this->images->Upload->Index); return $EditRow; }
function AddRow($rsold = NULL) { global $conn, $Language, $Security; // Load db values from rsold if ($rsold) { $this->LoadDbValues($rsold); $this->cat_file->OldUploadPath = "/catalogues/"; $this->cat_file->UploadPath = $this->cat_file->OldUploadPath; } $rsnew = array(); // cat_name $this->cat_name->SetDbValueDef($rsnew, $this->cat_name->CurrentValue, "", FALSE); // cat_file if (!$this->cat_file->Upload->KeepFile) { if ($this->cat_file->Upload->FileName == "") { $rsnew['cat_file'] = NULL; } else { $rsnew['cat_file'] = $this->cat_file->Upload->FileName; } $this->cat_file->ImageWidth = EW_THUMBNAIL_DEFAULT_WIDTH; // Resize width $this->cat_file->ImageHeight = EW_THUMBNAIL_DEFAULT_HEIGHT; // Resize height } // cat_date $this->cat_date->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->cat_date->CurrentValue, 5), ew_CurrentDate(), FALSE); if (!$this->cat_file->Upload->KeepFile) { $this->cat_file->UploadPath = "/catalogues/"; if (!ew_Empty($this->cat_file->Upload->Value)) { $rsnew['cat_file'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->cat_file->UploadPath), $rsnew['cat_file']); // Get new file name } } // Call Row Inserting event $rs = $rsold == NULL ? NULL : $rsold->fields; $bInsertRow = $this->Row_Inserting($rs, $rsnew); if ($bInsertRow) { $conn->raiseErrorFn = 'ew_ErrorFn'; $AddRow = $this->Insert($rsnew); $conn->raiseErrorFn = ''; if ($AddRow) { if (!$this->cat_file->Upload->KeepFile) { if (!ew_Empty($this->cat_file->Upload->Value)) { $this->cat_file->Upload->Resize($this->cat_file->ImageWidth, $this->cat_file->ImageHeight, EW_THUMBNAIL_DEFAULT_QUALITY); $this->cat_file->Upload->SaveToFile($this->cat_file->UploadPath, $rsnew['cat_file'], TRUE); } } } } else { if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") { // Use the message, do nothing } elseif ($this->CancelMessage != "") { $this->setFailureMessage($this->CancelMessage); $this->CancelMessage = ""; } else { $this->setFailureMessage($Language->Phrase("InsertCancelled")); } $AddRow = FALSE; } // Get insert id if necessary if ($AddRow) { $this->cat_id->setDbValue($conn->Insert_ID()); $rsnew['cat_id'] = $this->cat_id->DbValue; } if ($AddRow) { // Call Row Inserted event $rs = $rsold == NULL ? NULL : $rsold->fields; $this->Row_Inserted($rs, $rsnew); } // cat_file ew_CleanUploadTempPath($this->cat_file, $this->cat_file->Upload->Index); return $AddRow; }
function RenderListRow() { global $conn, $Security; // Call Row Rendering event $this->Row_Rendering(); // Common render codes // cat_id $this->cat_id->CellCssStyle = "white-space: nowrap;"; // cat_name // cat_file // cat_date // cat_id $this->cat_id->ViewValue = $this->cat_id->CurrentValue; $this->cat_id->ViewCustomAttributes = ""; // cat_name $this->cat_name->ViewValue = $this->cat_name->CurrentValue; $this->cat_name->ViewCustomAttributes = ""; // cat_file $this->cat_file->UploadPath = "/catalogues/"; if (!ew_Empty($this->cat_file->Upload->DbValue)) { $this->cat_file->ViewValue = $this->cat_file->Upload->DbValue; } else { $this->cat_file->ViewValue = ""; } $this->cat_file->ViewCustomAttributes = ""; // cat_date $this->cat_date->ViewValue = $this->cat_date->CurrentValue; $this->cat_date->ViewValue = ew_FormatDateTime($this->cat_date->ViewValue, 5); $this->cat_date->ViewCustomAttributes = ""; // cat_id $this->cat_id->LinkCustomAttributes = ""; $this->cat_id->HrefValue = ""; $this->cat_id->TooltipValue = ""; // cat_name $this->cat_name->LinkCustomAttributes = ""; $this->cat_name->HrefValue = ""; $this->cat_name->TooltipValue = ""; // cat_file $this->cat_file->LinkCustomAttributes = ""; $this->cat_file->UploadPath = "/catalogues/"; if (!ew_Empty($this->cat_file->Upload->DbValue)) { $this->cat_file->HrefValue = ew_UploadPathEx(FALSE, $this->cat_file->UploadPath) . $this->cat_file->Upload->DbValue; // Add prefix/suffix $this->cat_file->LinkAttrs["target"] = ""; // Add target if ($this->Export != "") { $this->cat_file->HrefValue = ew_ConvertFullUrl($this->cat_file->HrefValue); } } else { $this->cat_file->HrefValue = ""; } $this->cat_file->HrefValue2 = $this->cat_file->UploadPath . $this->cat_file->Upload->DbValue; $this->cat_file->TooltipValue = ""; // cat_date $this->cat_date->LinkCustomAttributes = ""; $this->cat_date->HrefValue = ""; $this->cat_date->TooltipValue = ""; // Call Row Rendered event $this->Row_Rendered(); }
function AddRow($rsold = NULL) { global $Language, $Security; $conn =& $this->Connection(); // Load db values from rsold if ($rsold) { $this->LoadDbValues($rsold); $this->s_image->OldUploadPath = "/uploads/"; $this->s_image->UploadPath = $this->s_image->OldUploadPath; $this->s_images->OldUploadPath = "/uploads/"; $this->s_images->UploadPath = $this->s_images->OldUploadPath; } $rsnew = array(); // s_title $this->s_title->SetDbValueDef($rsnew, $this->s_title->CurrentValue, "", FALSE); // s_image if (!$this->s_image->Upload->KeepFile) { $this->s_image->Upload->DbValue = ""; // No need to delete old file if ($this->s_image->Upload->FileName == "") { $rsnew['s_image'] = NULL; } else { $rsnew['s_image'] = $this->s_image->Upload->FileName; } } // s_desc $this->s_desc->SetDbValueDef($rsnew, $this->s_desc->CurrentValue, "", FALSE); // s_longdesc $this->s_longdesc->SetDbValueDef($rsnew, $this->s_longdesc->CurrentValue, "", FALSE); // s_images if (!$this->s_images->Upload->KeepFile) { $this->s_images->Upload->DbValue = ""; // No need to delete old file if ($this->s_images->Upload->FileName == "") { $rsnew['s_images'] = NULL; } else { $rsnew['s_images'] = $this->s_images->Upload->FileName; } } // s_caption $this->s_caption->SetDbValueDef($rsnew, $this->s_caption->CurrentValue, "", FALSE); if (!$this->s_image->Upload->KeepFile) { $this->s_image->UploadPath = "/uploads/"; if (!ew_Empty($this->s_image->Upload->Value)) { $rsnew['s_image'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->s_image->UploadPath), $rsnew['s_image']); // Get new file name } } if (!$this->s_images->Upload->KeepFile) { $this->s_images->UploadPath = "/uploads/"; $OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->s_images->Upload->DbValue); if (!ew_Empty($this->s_images->Upload->FileName)) { $NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->s_images->Upload->FileName); $FileCount = count($NewFiles); for ($i = 0; $i < $FileCount; $i++) { $fldvar = $this->s_images->Upload->Index < 0 ? $this->s_images->FldVar : substr($this->s_images->FldVar, 0, 1) . $this->s_images->Upload->Index . substr($this->s_images->FldVar, 1); if ($NewFiles[$i] != "") { $file = $NewFiles[$i]; if (file_exists(ew_UploadTempPath($fldvar, $this->s_images->TblVar) . EW_PATH_DELIMITER . $file)) { if (!in_array($file, $OldFiles)) { $file1 = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->s_images->UploadPath), $file); // Get new file name if ($file1 != $file) { // Rename temp file while (file_exists(ew_UploadTempPath($fldvar, $this->s_images->TblVar) . EW_PATH_DELIMITER . $file1)) { // Make sure did not clash with existing upload file $file1 = ew_UniqueFilename(ew_UploadPathEx(TRUE, $this->s_images->UploadPath), $file1, TRUE); } // Use indexed name rename(ew_UploadTempPath($fldvar, $this->s_images->TblVar) . EW_PATH_DELIMITER . $file, ew_UploadTempPath($fldvar, $this->s_images->TblVar) . EW_PATH_DELIMITER . $file1); $NewFiles[$i] = $file1; } } } } } $this->s_images->Upload->FileName = implode(EW_MULTIPLE_UPLOAD_SEPARATOR, $NewFiles); $rsnew['s_images'] = $this->s_images->Upload->FileName; } else { $NewFiles = array(); } } // Call Row Inserting event $rs = $rsold == NULL ? NULL : $rsold->fields; $bInsertRow = $this->Row_Inserting($rs, $rsnew); if ($bInsertRow) { $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; $AddRow = $this->Insert($rsnew); $conn->raiseErrorFn = ''; if ($AddRow) { // Get insert id if necessary $this->s_id->setDbValue($conn->Insert_ID()); $rsnew['s_id'] = $this->s_id->DbValue; if (!$this->s_image->Upload->KeepFile) { if (!ew_Empty($this->s_image->Upload->Value)) { $this->s_image->Upload->SaveToFile($this->s_image->UploadPath, $rsnew['s_image'], TRUE); } } if (!$this->s_images->Upload->KeepFile) { $OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->s_images->Upload->DbValue); if (!ew_Empty($this->s_images->Upload->FileName)) { $NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->s_images->Upload->FileName); $NewFiles2 = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $rsnew['s_images']); $FileCount = count($NewFiles); for ($i = 0; $i < $FileCount; $i++) { $fldvar = $this->s_images->Upload->Index < 0 ? $this->s_images->FldVar : substr($this->s_images->FldVar, 0, 1) . $this->s_images->Upload->Index . substr($this->s_images->FldVar, 1); if ($NewFiles[$i] != "") { $file = ew_UploadTempPath($fldvar, $this->s_images->TblVar) . EW_PATH_DELIMITER . $NewFiles[$i]; if (file_exists($file)) { $this->s_images->Upload->SaveToFile($this->s_images->UploadPath, @$NewFiles2[$i] != "" ? $NewFiles2[$i] : $NewFiles[$i], TRUE, $i); // Just replace } } } } else { $NewFiles = array(); } } } } else { if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") { // Use the message, do nothing } elseif ($this->CancelMessage != "") { $this->setFailureMessage($this->CancelMessage); $this->CancelMessage = ""; } else { $this->setFailureMessage($Language->Phrase("InsertCancelled")); } $AddRow = FALSE; } if ($AddRow) { // Call Row Inserted event $rs = $rsold == NULL ? NULL : $rsold->fields; $this->Row_Inserted($rs, $rsnew); } // s_image ew_CleanUploadTempPath($this->s_image, $this->s_image->Upload->Index); // s_images ew_CleanUploadTempPath($this->s_images, $this->s_images->Upload->Index); return $AddRow; }
function AddRow($rsold = NULL) { global $Language, $Security; $conn =& $this->Connection(); // Begin transaction if ($this->getCurrentDetailTable() != "") { $conn->BeginTrans(); } // Load db values from rsold if ($rsold) { $this->LoadDbValues($rsold); } $rsnew = array(); // category_id $this->category_id->SetDbValueDef($rsnew, $this->category_id->CurrentValue, 0, FALSE); // scat_name $this->scat_name->SetDbValueDef($rsnew, $this->scat_name->CurrentValue, "", FALSE); // scat_description $this->scat_description->SetDbValueDef($rsnew, $this->scat_description->CurrentValue, "", FALSE); // scat_picture if (!$this->scat_picture->Upload->KeepFile) { $this->scat_picture->Upload->DbValue = ""; // No need to delete old file if ($this->scat_picture->Upload->FileName == "") { $rsnew['scat_picture'] = NULL; } else { $rsnew['scat_picture'] = $this->scat_picture->Upload->FileName; } } if (!$this->scat_picture->Upload->KeepFile) { if (!ew_Empty($this->scat_picture->Upload->Value)) { if ($this->scat_picture->Upload->FileName == $this->scat_picture->Upload->DbValue) { // Overwrite if same file name $this->scat_picture->Upload->DbValue = ""; // No need to delete any more } else { $rsnew['scat_picture'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->scat_picture->UploadPath), $rsnew['scat_picture']); // Get new file name } } } // Call Row Inserting event $rs = $rsold == NULL ? NULL : $rsold->fields; $bInsertRow = $this->Row_Inserting($rs, $rsnew); if ($bInsertRow) { $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; $AddRow = $this->Insert($rsnew); $conn->raiseErrorFn = ''; if ($AddRow) { // Get insert id if necessary $this->scat_id->setDbValue($conn->Insert_ID()); $rsnew['scat_id'] = $this->scat_id->DbValue; if (!$this->scat_picture->Upload->KeepFile) { if (!ew_Empty($this->scat_picture->Upload->Value)) { $this->scat_picture->Upload->SaveToFile($this->scat_picture->UploadPath, $rsnew['scat_picture'], TRUE); } if ($this->scat_picture->Upload->DbValue != "") { @unlink(ew_UploadPathEx(TRUE, $this->scat_picture->OldUploadPath) . $this->scat_picture->Upload->DbValue); } } } } else { if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") { // Use the message, do nothing } elseif ($this->CancelMessage != "") { $this->setFailureMessage($this->CancelMessage); $this->CancelMessage = ""; } else { $this->setFailureMessage($Language->Phrase("InsertCancelled")); } $AddRow = FALSE; } // Add detail records if ($AddRow) { $DetailTblVar = explode(",", $this->getCurrentDetailTable()); if (in_array("products", $DetailTblVar) && $GLOBALS["products"]->DetailAdd) { $GLOBALS["products"]->scat_id->setSessionValue($this->scat_id->CurrentValue); // Set master key if (!isset($GLOBALS["products_grid"])) { $GLOBALS["products_grid"] = new cproducts_grid(); } // Get detail page object $AddRow = $GLOBALS["products_grid"]->GridInsert(); if (!$AddRow) { $GLOBALS["products"]->scat_id->setSessionValue(""); } // Clear master key if insert failed } } // Commit/Rollback transaction if ($this->getCurrentDetailTable() != "") { if ($AddRow) { $conn->CommitTrans(); // Commit transaction } else { $conn->RollbackTrans(); // Rollback transaction } } if ($AddRow) { // Call Row Inserted event $rs = $rsold == NULL ? NULL : $rsold->fields; $this->Row_Inserted($rs, $rsnew); } // scat_picture ew_CleanUploadTempPath($this->scat_picture, $this->scat_picture->Upload->Index); return $AddRow; }
function RenderRow() { global $Security, $Language, $gsLanguage; // Initialize URLs // Call Row_Rendering event $this->Row_Rendering(); // Common render codes for all row types // vl_media_id // vl_media_type // vl_media_name // vl_media_file // vl_media_file_custom if ($this->RowType == EW_ROWTYPE_VIEW) { // View row // vl_media_id $this->vl_media_id->ViewValue = $this->vl_media_id->CurrentValue; $this->vl_media_id->ViewCustomAttributes = ""; // vl_media_type if (strval($this->vl_media_type->CurrentValue) != "") { $sFilterWrk = "`vl_media_type_id`" . ew_SearchString("=", $this->vl_media_type->CurrentValue, EW_DATATYPE_NUMBER, ""); $sSqlWrk = "SELECT `vl_media_type_id`, `vl_media_type_name` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `vl_media_type_list`"; $sWhereWrk = ""; ew_AddFilter($sWhereWrk, $sFilterWrk); $this->Lookup_Selecting($this->vl_media_type, $sWhereWrk); // Call Lookup selecting if ($sWhereWrk != "") { $sSqlWrk .= " WHERE " . $sWhereWrk; } $sSqlWrk .= " ORDER BY `vl_media_type_name` ASC"; $rswrk = Conn()->Execute($sSqlWrk); if ($rswrk && !$rswrk->EOF) { // Lookup values found $arwrk = array(); $arwrk[1] = $rswrk->fields('DispFld'); $this->vl_media_type->ViewValue = $this->vl_media_type->DisplayValue($arwrk); $rswrk->Close(); } else { $this->vl_media_type->ViewValue = $this->vl_media_type->CurrentValue; } } else { $this->vl_media_type->ViewValue = NULL; } $this->vl_media_type->ViewCustomAttributes = ""; // vl_media_name $this->vl_media_name->ViewValue = $this->vl_media_name->CurrentValue; $this->vl_media_name->ViewCustomAttributes = ""; // vl_media_file if (!ew_Empty($this->vl_media_file->Upload->DbValue)) { $this->vl_media_file->ImageWidth = 200; $this->vl_media_file->ImageHeight = 200; $this->vl_media_file->ImageAlt = $this->vl_media_file->FldAlt(); $this->vl_media_file->ViewValue = $this->vl_media_file->Upload->DbValue; } else { $this->vl_media_file->ViewValue = ""; } $this->vl_media_file->ViewCustomAttributes = ""; // vl_media_file_custom $this->vl_media_file_custom->UploadPath = "uploads_custom/"; if (!ew_Empty($this->vl_media_file_custom->Upload->DbValue)) { $this->vl_media_file_custom->ImageWidth = 200; $this->vl_media_file_custom->ImageHeight = 200; $this->vl_media_file_custom->ImageAlt = $this->vl_media_file_custom->FldAlt(); $this->vl_media_file_custom->ViewValue = $this->vl_media_file_custom->Upload->DbValue; } else { $this->vl_media_file_custom->ViewValue = ""; } $this->vl_media_file_custom->ViewCustomAttributes = ""; // vl_media_id $this->vl_media_id->LinkCustomAttributes = ""; $this->vl_media_id->HrefValue = ""; $this->vl_media_id->TooltipValue = ""; // vl_media_type $this->vl_media_type->LinkCustomAttributes = ""; $this->vl_media_type->HrefValue = ""; $this->vl_media_type->TooltipValue = ""; // vl_media_name $this->vl_media_name->LinkCustomAttributes = ""; $this->vl_media_name->HrefValue = ""; $this->vl_media_name->TooltipValue = ""; // vl_media_file $this->vl_media_file->LinkCustomAttributes = ""; if (!ew_Empty($this->vl_media_file->Upload->DbValue)) { $this->vl_media_file->HrefValue = ew_GetFileUploadUrl($this->vl_media_file, $this->vl_media_file->Upload->DbValue); // Add prefix/suffix $this->vl_media_file->LinkAttrs["target"] = "_blank"; // Add target if ($this->Export != "") { $this->vl_media_file->HrefValue = ew_ConvertFullUrl($this->vl_media_file->HrefValue); } } else { $this->vl_media_file->HrefValue = ""; } $this->vl_media_file->HrefValue2 = $this->vl_media_file->UploadPath . $this->vl_media_file->Upload->DbValue; $this->vl_media_file->TooltipValue = ""; if ($this->vl_media_file->UseColorbox) { if (ew_Empty($this->vl_media_file->TooltipValue)) { $this->vl_media_file->LinkAttrs["title"] = $Language->Phrase("ViewImageGallery"); } $this->vl_media_file->LinkAttrs["data-rel"] = "vl_media_list_x_vl_media_file"; ew_AppendClass($this->vl_media_file->LinkAttrs["class"], "ewLightbox"); } // vl_media_file_custom $this->vl_media_file_custom->LinkCustomAttributes = ""; $this->vl_media_file_custom->UploadPath = "uploads_custom/"; if (!ew_Empty($this->vl_media_file_custom->Upload->DbValue)) { $this->vl_media_file_custom->HrefValue = ew_GetFileUploadUrl($this->vl_media_file_custom, $this->vl_media_file_custom->Upload->DbValue); // Add prefix/suffix $this->vl_media_file_custom->LinkAttrs["target"] = "_blank"; // Add target if ($this->Export != "") { $this->vl_media_file_custom->HrefValue = ew_ConvertFullUrl($this->vl_media_file_custom->HrefValue); } } else { $this->vl_media_file_custom->HrefValue = ""; } $this->vl_media_file_custom->HrefValue2 = $this->vl_media_file_custom->UploadPath . $this->vl_media_file_custom->Upload->DbValue; $this->vl_media_file_custom->TooltipValue = ""; if ($this->vl_media_file_custom->UseColorbox) { if (ew_Empty($this->vl_media_file_custom->TooltipValue)) { $this->vl_media_file_custom->LinkAttrs["title"] = $Language->Phrase("ViewImageGallery"); } $this->vl_media_file_custom->LinkAttrs["data-rel"] = "vl_media_list_x_vl_media_file_custom"; ew_AppendClass($this->vl_media_file_custom->LinkAttrs["class"], "ewLightbox"); } } // Call Row Rendered event if ($this->RowType != EW_ROWTYPE_AGGREGATEINIT) { $this->Row_Rendered(); } }
function RenderRow() { global $Security, $Language, $gsLanguage; // Initialize URLs $this->AddUrl = $this->GetAddUrl(); $this->EditUrl = $this->GetEditUrl(); $this->CopyUrl = $this->GetCopyUrl(); $this->DeleteUrl = $this->GetDeleteUrl(); $this->ListUrl = $this->GetListUrl(); $this->SetupOtherOptions(); // Call Row_Rendering event $this->Row_Rendering(); // Common render codes for all row types // id // title // images // intro // full_intro // details // livelink if ($this->RowType == EW_ROWTYPE_VIEW) { // View row // id $this->id->ViewValue = $this->id->CurrentValue; $this->id->ViewCustomAttributes = ""; // title $this->title->ViewValue = $this->title->CurrentValue; $this->title->ViewCustomAttributes = ""; // images $this->images->UploadPath = "/uploads"; if (!ew_Empty($this->images->Upload->DbValue)) { $this->images->ViewValue = $this->images->Upload->DbValue; } else { $this->images->ViewValue = ""; } $this->images->ViewCustomAttributes = ""; // intro $this->intro->ViewValue = $this->intro->CurrentValue; $this->intro->ViewCustomAttributes = ""; // full_intro $this->full_intro->ViewValue = $this->full_intro->CurrentValue; $this->full_intro->ViewCustomAttributes = ""; // details $this->details->ViewValue = $this->details->CurrentValue; $this->details->ViewCustomAttributes = ""; // livelink $this->livelink->ViewValue = $this->livelink->CurrentValue; $this->livelink->ViewCustomAttributes = ""; // id $this->id->LinkCustomAttributes = ""; $this->id->HrefValue = ""; $this->id->TooltipValue = ""; // title $this->title->LinkCustomAttributes = ""; $this->title->HrefValue = ""; $this->title->TooltipValue = ""; // images $this->images->LinkCustomAttributes = ""; $this->images->HrefValue = ""; $this->images->HrefValue2 = $this->images->UploadPath . $this->images->Upload->DbValue; $this->images->TooltipValue = ""; // intro $this->intro->LinkCustomAttributes = ""; $this->intro->HrefValue = ""; $this->intro->TooltipValue = ""; // full_intro $this->full_intro->LinkCustomAttributes = ""; $this->full_intro->HrefValue = ""; $this->full_intro->TooltipValue = ""; // details $this->details->LinkCustomAttributes = ""; $this->details->HrefValue = ""; $this->details->TooltipValue = ""; // livelink $this->livelink->LinkCustomAttributes = ""; $this->livelink->HrefValue = ""; $this->livelink->TooltipValue = ""; } // Call Row Rendered event if ($this->RowType != EW_ROWTYPE_AGGREGATEINIT) { $this->Row_Rendered(); } }
function EditRow() { global $conn, $Security, $Language; $sFilter = $this->KeyFilter(); $this->CurrentFilter = $sFilter; $sSql = $this->SQL(); $conn->raiseErrorFn = 'ew_ErrorFn'; $rs = $conn->Execute($sSql); $conn->raiseErrorFn = ''; if ($rs === FALSE) { return FALSE; } if ($rs->EOF) { $EditRow = FALSE; // Update Failed } else { // Save old values $rsold =& $rs->fields; $this->LoadDbValues($rsold); $rsnew = array(); // fecha_recepcion $this->fecha_recepcion->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->fecha_recepcion->CurrentValue, 7), ew_CurrentDate(), $this->fecha_recepcion->ReadOnly); // cliente $this->cliente->SetDbValueDef($rsnew, $this->cliente->CurrentValue, NULL, $this->cliente->ReadOnly); // id_tipo_cliente $this->id_tipo_cliente->SetDbValueDef($rsnew, $this->id_tipo_cliente->CurrentValue, NULL, $this->id_tipo_cliente->ReadOnly); // tel $this->tel->SetDbValueDef($rsnew, $this->tel->CurrentValue, NULL, $this->tel->ReadOnly); // cel $this->cel->SetDbValueDef($rsnew, $this->cel->CurrentValue, NULL, $this->cel->ReadOnly); // objetos $this->objetos->SetDbValueDef($rsnew, $this->objetos->CurrentValue, NULL, $this->objetos->ReadOnly); // detalle_a_realizar $this->detalle_a_realizar->SetDbValueDef($rsnew, $this->detalle_a_realizar->CurrentValue, NULL, $this->detalle_a_realizar->ReadOnly); // fecha_entrega $this->fecha_entrega->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->fecha_entrega->CurrentValue, 7), NULL, $this->fecha_entrega->ReadOnly); // observaciones $this->observaciones->SetDbValueDef($rsnew, $this->observaciones->CurrentValue, NULL, $this->observaciones->ReadOnly); // id_estado $this->id_estado->SetDbValueDef($rsnew, $this->id_estado->CurrentValue, 0, $this->id_estado->ReadOnly); // precio $this->precio->SetDbValueDef($rsnew, $this->precio->CurrentValue, NULL, $this->precio->ReadOnly); // entrega $this->entrega->SetDbValueDef($rsnew, $this->entrega->CurrentValue, NULL, $this->entrega->ReadOnly); // foto1 if (!$this->foto1->ReadOnly && !$this->foto1->Upload->KeepFile) { $this->foto1->Upload->DbValue = $rs->fields('foto1'); // Get original value if ($this->foto1->Upload->FileName == "") { $rsnew['foto1'] = NULL; } else { $rsnew['foto1'] = $this->foto1->Upload->FileName; } } // foto2 if (!$this->foto2->ReadOnly && !$this->foto2->Upload->KeepFile) { $this->foto2->Upload->DbValue = $rs->fields('foto2'); // Get original value if ($this->foto2->Upload->FileName == "") { $rsnew['foto2'] = NULL; } else { $rsnew['foto2'] = $this->foto2->Upload->FileName; } } if (!$this->foto1->Upload->KeepFile) { if (!ew_Empty($this->foto1->Upload->Value)) { if ($this->foto1->Upload->FileName == $this->foto1->Upload->DbValue) { // Overwrite if same file name $this->foto1->Upload->DbValue = ""; // No need to delete any more } else { $rsnew['foto1'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->foto1->UploadPath), $rsnew['foto1']); // Get new file name } } } if (!$this->foto2->Upload->KeepFile) { if (!ew_Empty($this->foto2->Upload->Value)) { if ($this->foto2->Upload->FileName == $this->foto2->Upload->DbValue) { // Overwrite if same file name $this->foto2->Upload->DbValue = ""; // No need to delete any more } else { $rsnew['foto2'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->foto2->UploadPath), $rsnew['foto2']); // Get new file name } } } // Call Row Updating event $bUpdateRow = $this->Row_Updating($rsold, $rsnew); if ($bUpdateRow) { $conn->raiseErrorFn = 'ew_ErrorFn'; if (count($rsnew) > 0) { $EditRow = $this->Update($rsnew, "", $rsold); } else { $EditRow = TRUE; } // No field to update $conn->raiseErrorFn = ''; if ($EditRow) { if (!$this->foto1->Upload->KeepFile) { if (!ew_Empty($this->foto1->Upload->Value)) { $this->foto1->Upload->SaveToFile($this->foto1->UploadPath, $rsnew['foto1'], TRUE); } if ($this->foto1->Upload->DbValue != "") { @unlink(ew_UploadPathEx(TRUE, $this->foto1->OldUploadPath) . $this->foto1->Upload->DbValue); } } if (!$this->foto2->Upload->KeepFile) { if (!ew_Empty($this->foto2->Upload->Value)) { $this->foto2->Upload->SaveToFile($this->foto2->UploadPath, $rsnew['foto2'], TRUE); } if ($this->foto2->Upload->DbValue != "") { @unlink(ew_UploadPathEx(TRUE, $this->foto2->OldUploadPath) . $this->foto2->Upload->DbValue); } } } } else { if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") { // Use the message, do nothing } elseif ($this->CancelMessage != "") { $this->setFailureMessage($this->CancelMessage); $this->CancelMessage = ""; } else { $this->setFailureMessage($Language->Phrase("UpdateCancelled")); } $EditRow = FALSE; } } // Call Row_Updated event if ($EditRow) { $this->Row_Updated($rsold, $rsnew); } $rs->Close(); // foto1 ew_CleanUploadTempPath($this->foto1, $this->foto1->Upload->Index); // foto2 ew_CleanUploadTempPath($this->foto2, $this->foto2->Upload->Index); return $EditRow; }
function ResizeAndSaveToFile($Width, $Height, $Quality, $Path, $NewFileName, $OverWrite, $idx = -1) { $bResult = FALSE; if (!ew_Empty($this->Value)) { $OldValue = $this->Value; $bResult = $this->Resize($Width, $Height)->SaveToFile($Path, $NewFileName, $OverWrite); $this->Value = $OldValue; } elseif ($idx >= 0) { // Use file from upload temp folder $file = $this->GetTempFile($idx); if (file_exists($file)) { $this->Value = file_get_contents($file); $bResult = $this->Resize($Width, $Height)->SaveToFile($Path, $NewFileName, $OverWrite); $this->Value = NULL; } } return $bResult; }
function RenderRow() { global $conn, $Security, $Language; global $gsLanguage; // Initialize URLs // Call Row_Rendering event $this->Row_Rendering(); // Common render codes for all row types // cat_id $this->cat_id->CellCssStyle = "white-space: nowrap;"; // cat_name // cat_file // cat_date if ($this->RowType == EW_ROWTYPE_VIEW) { // View row // cat_name $this->cat_name->ViewValue = $this->cat_name->CurrentValue; $this->cat_name->ViewCustomAttributes = ""; // cat_file $this->cat_file->UploadPath = "/catalogues/"; if (!ew_Empty($this->cat_file->Upload->DbValue)) { $this->cat_file->ViewValue = $this->cat_file->Upload->DbValue; } else { $this->cat_file->ViewValue = ""; } $this->cat_file->ViewCustomAttributes = ""; // cat_date $this->cat_date->ViewValue = $this->cat_date->CurrentValue; $this->cat_date->ViewValue = ew_FormatDateTime($this->cat_date->ViewValue, 5); $this->cat_date->ViewCustomAttributes = ""; // cat_name $this->cat_name->LinkCustomAttributes = ""; $this->cat_name->HrefValue = ""; $this->cat_name->TooltipValue = ""; // cat_file $this->cat_file->LinkCustomAttributes = ""; $this->cat_file->UploadPath = "/catalogues/"; if (!ew_Empty($this->cat_file->Upload->DbValue)) { $this->cat_file->HrefValue = ew_UploadPathEx(FALSE, $this->cat_file->UploadPath) . $this->cat_file->Upload->DbValue; // Add prefix/suffix $this->cat_file->LinkAttrs["target"] = ""; // Add target if ($this->Export != "") { $this->cat_file->HrefValue = ew_ConvertFullUrl($this->cat_file->HrefValue); } } else { $this->cat_file->HrefValue = ""; } $this->cat_file->HrefValue2 = $this->cat_file->UploadPath . $this->cat_file->Upload->DbValue; $this->cat_file->TooltipValue = ""; // cat_date $this->cat_date->LinkCustomAttributes = ""; $this->cat_date->HrefValue = ""; $this->cat_date->TooltipValue = ""; } // Call Row Rendered event if ($this->RowType != EW_ROWTYPE_AGGREGATEINIT) { $this->Row_Rendered(); } }
function ResizeAndSaveToFile($Width, $Height, $Quality, $Path, $NewFileName, $OverWrite) { $bResult = FALSE; if (!ew_Empty($this->Value)) { $OldValue = $this->Value; $this->Resize($Width, $Height, $Quality); $bResult = $this->SaveToFile($Path, $NewFileName, $OverWrite); $this->Value = $OldValue; } return $bResult; }
function ResizeAndSaveToFile($Width, $Height, $Quality, $Path, $NewFileName, $OverWrite, $idx = -1) { $bResult = FALSE; if (!ew_Empty($this->Value)) { $OldValue = $this->Value; $this->Resize($Width, $Height, $Quality); $bResult = $this->SaveToFile($Path, $NewFileName, $OverWrite); $this->Value = $OldValue; } elseif ($idx >= 0) { // Use file from upload temp folder $ar = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->FileName); if ($idx < count($ar)) { $fn = $ar[$idx]; $fldvar = $this->Index < 0 ? $this->FldVar : substr($this->FldVar, 0, 1) . $this->Index . substr($this->FldVar, 1); $file = ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $fn; if (file_exists($file)) { $this->Value = file_get_contents($file); $this->Resize($Width, $Height, $Quality); $bResult = $this->SaveToFile($Path, $NewFileName, $OverWrite); $this->Value = NULL; } } } return $bResult; }
function RenderEditRow() { global $conn, $Security, $gsLanguage, $Language; // Call Row Rendering event $this->Row_Rendering(); // codigo $this->codigo->EditAttrs["class"] = "form-control"; $this->codigo->EditCustomAttributes = ""; $this->codigo->EditValue = $this->codigo->CurrentValue; $this->codigo->ViewCustomAttributes = ""; // Titulo $this->Titulo->EditAttrs["class"] = "form-control"; $this->Titulo->EditCustomAttributes = ""; $this->Titulo->EditValue = ew_HtmlEncode($this->Titulo->CurrentValue); $this->Titulo->PlaceHolder = ew_RemoveHtml($this->Titulo->FldCaption()); // Descripcion $this->Descripcion->EditAttrs["class"] = "form-control"; $this->Descripcion->EditCustomAttributes = ""; $this->Descripcion->EditValue = ew_HtmlEncode($this->Descripcion->CurrentValue); $this->Descripcion->PlaceHolder = ew_RemoveHtml($this->Descripcion->FldCaption()); // fecha // id_usuario // archivo $this->archivo->EditAttrs["class"] = "form-control"; $this->archivo->EditCustomAttributes = ""; if (!ew_Empty($this->archivo->Upload->DbValue)) { $this->archivo->EditValue = $this->archivo->Upload->DbValue; } else { $this->archivo->EditValue = ""; } if (!ew_Empty($this->archivo->CurrentValue)) { $this->archivo->Upload->FileName = $this->archivo->CurrentValue; } // estado $this->estado->EditCustomAttributes = ""; $arwrk = array(); $arwrk[] = array($this->estado->FldTagValue(1), $this->estado->FldTagCaption(1) != "" ? $this->estado->FldTagCaption(1) : $this->estado->FldTagValue(1)); $arwrk[] = array($this->estado->FldTagValue(2), $this->estado->FldTagCaption(2) != "" ? $this->estado->FldTagCaption(2) : $this->estado->FldTagValue(2)); $arwrk[] = array($this->estado->FldTagValue(3), $this->estado->FldTagCaption(3) != "" ? $this->estado->FldTagCaption(3) : $this->estado->FldTagValue(3)); $this->estado->EditValue = $arwrk; // Call Row Rendered event $this->Row_Rendered(); }
function RenderRow() { global $conn, $Security, $Language; global $gsLanguage; // Initialize URLs $this->AddUrl = $this->GetAddUrl(); $this->EditUrl = $this->GetEditUrl(); $this->CopyUrl = $this->GetCopyUrl(); $this->DeleteUrl = $this->GetDeleteUrl(); $this->ListUrl = $this->GetListUrl(); // Convert decimal values if posted back if ($this->teacher_rate->FormValue == $this->teacher_rate->CurrentValue && is_numeric(ew_StrToFloat($this->teacher_rate->CurrentValue))) { $this->teacher_rate->CurrentValue = ew_StrToFloat($this->teacher_rate->CurrentValue); } // Call Row_Rendering event $this->Row_Rendering(); // Common render codes for all row types // teacher_id // teacher_name // teacher_personal_page // teacher_avatar // teacher_description // teacher_work_place // teacher_active // teacher_acadamic_title // teacher_birthday // teacher_sex // teacher_faculty // teacher_dept // teacher_rate // teacher_personality // advices // teacher_research if ($this->RowType == EW_ROWTYPE_VIEW) { // View row // teacher_id $this->teacher_id->ViewValue = $this->teacher_id->CurrentValue; $this->teacher_id->ViewCustomAttributes = ""; // teacher_name $this->teacher_name->ViewValue = $this->teacher_name->CurrentValue; $this->teacher_name->ViewCustomAttributes = ""; // teacher_personal_page $this->teacher_personal_page->ViewValue = $this->teacher_personal_page->CurrentValue; $this->teacher_personal_page->ViewCustomAttributes = ""; // teacher_avatar $this->teacher_avatar->UploadPath = 'themes\\classic\\assets\\img\\Teacher_img'; if (!ew_Empty($this->teacher_avatar->Upload->DbValue)) { $this->teacher_avatar->ImageAlt = $this->teacher_avatar->FldAlt(); $this->teacher_avatar->ViewValue = ew_UploadPathEx(FALSE, $this->teacher_avatar->UploadPath) . $this->teacher_avatar->Upload->DbValue; } else { $this->teacher_avatar->ViewValue = ""; } $this->teacher_avatar->ViewCustomAttributes = ""; // teacher_description $this->teacher_description->ViewValue = $this->teacher_description->CurrentValue; $this->teacher_description->ViewCustomAttributes = ""; // teacher_work_place $this->teacher_work_place->ViewValue = $this->teacher_work_place->CurrentValue; $this->teacher_work_place->ViewCustomAttributes = ""; // teacher_active $this->teacher_active->ViewValue = $this->teacher_active->CurrentValue; $this->teacher_active->ViewCustomAttributes = ""; // teacher_acadamic_title $this->teacher_acadamic_title->ViewValue = $this->teacher_acadamic_title->CurrentValue; $this->teacher_acadamic_title->ViewCustomAttributes = ""; // teacher_birthday $this->teacher_birthday->ViewValue = $this->teacher_birthday->CurrentValue; $this->teacher_birthday->ViewCustomAttributes = ""; // teacher_sex $this->teacher_sex->ViewValue = $this->teacher_sex->CurrentValue; $this->teacher_sex->ViewCustomAttributes = ""; // teacher_faculty if (strval($this->teacher_faculty->CurrentValue) != "") { $sFilterWrk = "`faculty_id`" . ew_SearchString("=", $this->teacher_faculty->CurrentValue, EW_DATATYPE_NUMBER); $sSqlWrk = "SELECT `faculty_id`, `faculty_name` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tbl_faculty`"; $sWhereWrk = ""; if ($sFilterWrk != "") { ew_AddFilter($sWhereWrk, $sFilterWrk); } if ($sWhereWrk != "") { $sSqlWrk .= " WHERE " . $sWhereWrk; } $rswrk = $conn->Execute($sSqlWrk); if ($rswrk && !$rswrk->EOF) { // Lookup values found $this->teacher_faculty->ViewValue = $rswrk->fields('DispFld'); $rswrk->Close(); } else { $this->teacher_faculty->ViewValue = $this->teacher_faculty->CurrentValue; } } else { $this->teacher_faculty->ViewValue = NULL; } $this->teacher_faculty->ViewCustomAttributes = ""; // teacher_dept if (strval($this->teacher_dept->CurrentValue) != "") { $sFilterWrk = "`dept_id`" . ew_SearchString("=", $this->teacher_dept->CurrentValue, EW_DATATYPE_NUMBER); $sSqlWrk = "SELECT `dept_id`, `dept_name` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tbl_dept`"; $sWhereWrk = ""; if ($sFilterWrk != "") { ew_AddFilter($sWhereWrk, $sFilterWrk); } if ($sWhereWrk != "") { $sSqlWrk .= " WHERE " . $sWhereWrk; } $rswrk = $conn->Execute($sSqlWrk); if ($rswrk && !$rswrk->EOF) { // Lookup values found $this->teacher_dept->ViewValue = $rswrk->fields('DispFld'); $rswrk->Close(); } else { $this->teacher_dept->ViewValue = $this->teacher_dept->CurrentValue; } } else { $this->teacher_dept->ViewValue = NULL; } $this->teacher_dept->ViewCustomAttributes = ""; // teacher_rate $this->teacher_rate->ViewValue = $this->teacher_rate->CurrentValue; $this->teacher_rate->ViewCustomAttributes = ""; // teacher_personality $this->teacher_personality->ViewValue = $this->teacher_personality->CurrentValue; $this->teacher_personality->ViewCustomAttributes = ""; // advices $this->advices->ViewValue = $this->advices->CurrentValue; $this->advices->ViewCustomAttributes = ""; // teacher_research $this->teacher_research->ViewValue = $this->teacher_research->CurrentValue; $this->teacher_research->ViewCustomAttributes = ""; // teacher_id $this->teacher_id->LinkCustomAttributes = ""; $this->teacher_id->HrefValue = ""; $this->teacher_id->TooltipValue = ""; // teacher_name $this->teacher_name->LinkCustomAttributes = ""; $this->teacher_name->HrefValue = ""; $this->teacher_name->TooltipValue = ""; // teacher_personal_page $this->teacher_personal_page->LinkCustomAttributes = ""; $this->teacher_personal_page->HrefValue = ""; $this->teacher_personal_page->TooltipValue = ""; // teacher_avatar $this->teacher_avatar->LinkCustomAttributes = ""; $this->teacher_avatar->HrefValue = ""; $this->teacher_avatar->TooltipValue = ""; // teacher_description $this->teacher_description->LinkCustomAttributes = ""; $this->teacher_description->HrefValue = ""; $this->teacher_description->TooltipValue = ""; // teacher_work_place $this->teacher_work_place->LinkCustomAttributes = ""; $this->teacher_work_place->HrefValue = ""; $this->teacher_work_place->TooltipValue = ""; // teacher_active $this->teacher_active->LinkCustomAttributes = ""; $this->teacher_active->HrefValue = ""; $this->teacher_active->TooltipValue = ""; // teacher_acadamic_title $this->teacher_acadamic_title->LinkCustomAttributes = ""; $this->teacher_acadamic_title->HrefValue = ""; $this->teacher_acadamic_title->TooltipValue = ""; // teacher_birthday $this->teacher_birthday->LinkCustomAttributes = ""; $this->teacher_birthday->HrefValue = ""; $this->teacher_birthday->TooltipValue = ""; // teacher_sex $this->teacher_sex->LinkCustomAttributes = ""; $this->teacher_sex->HrefValue = ""; $this->teacher_sex->TooltipValue = ""; // teacher_faculty $this->teacher_faculty->LinkCustomAttributes = ""; $this->teacher_faculty->HrefValue = ""; $this->teacher_faculty->TooltipValue = ""; // teacher_dept $this->teacher_dept->LinkCustomAttributes = ""; $this->teacher_dept->HrefValue = ""; $this->teacher_dept->TooltipValue = ""; // teacher_rate $this->teacher_rate->LinkCustomAttributes = ""; $this->teacher_rate->HrefValue = ""; $this->teacher_rate->TooltipValue = ""; // teacher_personality $this->teacher_personality->LinkCustomAttributes = ""; $this->teacher_personality->HrefValue = ""; $this->teacher_personality->TooltipValue = ""; // advices $this->advices->LinkCustomAttributes = ""; $this->advices->HrefValue = ""; $this->advices->TooltipValue = ""; // teacher_research $this->teacher_research->LinkCustomAttributes = ""; $this->teacher_research->HrefValue = ""; $this->teacher_research->TooltipValue = ""; } // Call Row Rendered event if ($this->RowType != EW_ROWTYPE_AGGREGATEINIT) { $this->Row_Rendered(); } }
function RenderRow() { global $conn, $Security, $Language; global $gsLanguage; // Initialize URLs // Call Row_Rendering event $this->Row_Rendering(); // Common render codes for all row types // gd_id $this->gd_id->CellCssStyle = "white-space: nowrap;"; // g_name // g_image // gd_images if ($this->RowType == EW_ROWTYPE_VIEW) { // View row // gd_id $this->gd_id->ViewValue = $this->gd_id->CurrentValue; $this->gd_id->ViewCustomAttributes = ""; // g_name $this->g_name->ViewValue = $this->g_name->CurrentValue; $this->g_name->ViewCustomAttributes = ""; // g_image $this->g_image->UploadPath = "/gallery"; if (!ew_Empty($this->g_image->Upload->DbValue)) { $this->g_image->ViewValue = $this->g_image->Upload->DbValue; } else { $this->g_image->ViewValue = ""; } $this->g_image->ViewCustomAttributes = ""; // gd_id $this->gd_id->LinkCustomAttributes = ""; $this->gd_id->HrefValue = ""; $this->gd_id->TooltipValue = ""; // g_name $this->g_name->LinkCustomAttributes = ""; $this->g_name->HrefValue = ""; $this->g_name->TooltipValue = ""; // g_image $this->g_image->LinkCustomAttributes = ""; $this->g_image->HrefValue = ""; $this->g_image->HrefValue2 = $this->g_image->UploadPath . $this->g_image->Upload->DbValue; $this->g_image->TooltipValue = ""; } // Call Row Rendered event if ($this->RowType != EW_ROWTYPE_AGGREGATEINIT) { $this->Row_Rendered(); } }
function RenderRow() { global $conn, $Security, $Language; global $gsLanguage; // Initialize URLs $this->AddUrl = $this->GetAddUrl(); $this->EditUrl = $this->GetEditUrl(); $this->CopyUrl = $this->GetCopyUrl(); $this->DeleteUrl = $this->GetDeleteUrl(); $this->ListUrl = $this->GetListUrl(); $this->SetupOtherOptions(); // Call Row_Rendering event $this->Row_Rendering(); // Common render codes for all row types // gd_id // g_name // g_image // gd_images if ($this->RowType == EW_ROWTYPE_VIEW) { // View row // gd_id $this->gd_id->ViewValue = $this->gd_id->CurrentValue; $this->gd_id->ViewCustomAttributes = ""; // g_name $this->g_name->ViewValue = $this->g_name->CurrentValue; $this->g_name->ViewCustomAttributes = ""; // g_image $this->g_image->UploadPath = "/gallery"; if (!ew_Empty($this->g_image->Upload->DbValue)) { $this->g_image->ViewValue = $this->g_image->Upload->DbValue; } else { $this->g_image->ViewValue = ""; } $this->g_image->ViewCustomAttributes = ""; // gd_images $this->gd_images->UploadPath = "/gallery"; if (!ew_Empty($this->gd_images->Upload->DbValue)) { $this->gd_images->ViewValue = $this->gd_images->Upload->DbValue; } else { $this->gd_images->ViewValue = ""; } $this->gd_images->ViewCustomAttributes = ""; // g_name $this->g_name->LinkCustomAttributes = ""; $this->g_name->HrefValue = ""; $this->g_name->TooltipValue = ""; // g_image $this->g_image->LinkCustomAttributes = ""; $this->g_image->HrefValue = ""; $this->g_image->HrefValue2 = $this->g_image->UploadPath . $this->g_image->Upload->DbValue; $this->g_image->TooltipValue = ""; // gd_images $this->gd_images->LinkCustomAttributes = ""; $this->gd_images->HrefValue = ""; $this->gd_images->HrefValue2 = $this->gd_images->UploadPath . $this->gd_images->Upload->DbValue; $this->gd_images->TooltipValue = ""; } // Call Row Rendered event if ($this->RowType != EW_ROWTYPE_AGGREGATEINIT) { $this->Row_Rendered(); } }
function AddRow($rsold = NULL) { global $conn, $Language, $Security; // Check referential integrity for master table 'tramites' $bValidMasterRecord = TRUE; $sMasterFilter = $this->SqlMasterFilter_tramites(); if (strval($this->id_tramite->CurrentValue) != "") { $sMasterFilter = str_replace("@codigo@", ew_AdjustSql($this->id_tramite->CurrentValue), $sMasterFilter); } else { $bValidMasterRecord = FALSE; } if ($bValidMasterRecord) { $rsmaster = $GLOBALS["tramites"]->LoadRs($sMasterFilter); $bValidMasterRecord = $rsmaster && !$rsmaster->EOF; $rsmaster->Close(); } if (!$bValidMasterRecord) { $sRelatedRecordMsg = str_replace("%t", "tramites", $Language->Phrase("RelatedRecordRequired")); $this->setFailureMessage($sRelatedRecordMsg); return FALSE; } // Load db values from rsold if ($rsold) { $this->LoadDbValues($rsold); } $rsnew = array(); // id_tramite $this->id_tramite->SetDbValueDef($rsnew, $this->id_tramite->CurrentValue, 0, FALSE); // fecha $this->fecha->SetDbValueDef($rsnew, ew_CurrentDate(), ew_CurrentDate()); $rsnew['fecha'] =& $this->fecha->DbValue; // hora $this->hora->SetDbValueDef($rsnew, ew_CurrentTime(), ew_CurrentTime()); $rsnew['hora'] =& $this->hora->DbValue; // titulo $this->titulo->SetDbValueDef($rsnew, $this->titulo->CurrentValue, NULL, FALSE); // archivo if (!$this->archivo->Upload->KeepFile) { $this->archivo->Upload->DbValue = ""; // No need to delete old file if ($this->archivo->Upload->FileName == "") { $rsnew['archivo'] = NULL; } else { $rsnew['archivo'] = $this->archivo->Upload->FileName; } } if (!$this->archivo->Upload->KeepFile) { $OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->DbValue); if (!ew_Empty($this->archivo->Upload->FileName)) { $NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->FileName); $FileCount = count($NewFiles); for ($i = 0; $i < $FileCount; $i++) { $fldvar = $this->archivo->Upload->Index < 0 ? $this->archivo->FldVar : substr($this->archivo->FldVar, 0, 1) . $this->archivo->Upload->Index . substr($this->archivo->FldVar, 1); if ($NewFiles[$i] != "") { $file = $NewFiles[$i]; if (file_exists(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file)) { if (!in_array($file, $OldFiles)) { $file1 = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->archivo->UploadPath), $file); // Get new file name if ($file1 != $file) { // Rename temp file while (file_exists(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file1)) { // Make sure did not clash with existing upload file $file1 = ew_UniqueFilename(ew_UploadPathEx(TRUE, $this->archivo->UploadPath), $file1, TRUE); } // Use indexed name rename(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file, ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file1); $NewFiles[$i] = $file1; } } } } } $this->archivo->Upload->FileName = implode(EW_MULTIPLE_UPLOAD_SEPARATOR, $NewFiles); $rsnew['archivo'] = $this->archivo->Upload->FileName; } else { $NewFiles = array(); } } // Call Row Inserting event $rs = $rsold == NULL ? NULL : $rsold->fields; $bInsertRow = $this->Row_Inserting($rs, $rsnew); // Check if key value entered if ($bInsertRow && $this->ValidateKey && strval($rsnew['id_tramite']) == "") { $this->setFailureMessage($Language->Phrase("InvalidKeyValue")); $bInsertRow = FALSE; } // Check if key value entered if ($bInsertRow && $this->ValidateKey && strval($rsnew['fecha']) == "") { $this->setFailureMessage($Language->Phrase("InvalidKeyValue")); $bInsertRow = FALSE; } // Check if key value entered if ($bInsertRow && $this->ValidateKey && strval($rsnew['hora']) == "") { $this->setFailureMessage($Language->Phrase("InvalidKeyValue")); $bInsertRow = FALSE; } // Check for duplicate key if ($bInsertRow && $this->ValidateKey) { $sFilter = $this->KeyFilter(); $rsChk = $this->LoadRs($sFilter); if ($rsChk && !$rsChk->EOF) { $sKeyErrMsg = str_replace("%f", $sFilter, $Language->Phrase("DupKey")); $this->setFailureMessage($sKeyErrMsg); $rsChk->Close(); $bInsertRow = FALSE; } } if ($bInsertRow) { $conn->raiseErrorFn = 'ew_ErrorFn'; $AddRow = $this->Insert($rsnew); $conn->raiseErrorFn = ''; if ($AddRow) { if (!$this->archivo->Upload->KeepFile) { $OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->DbValue); if (!ew_Empty($this->archivo->Upload->FileName)) { $NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->FileName); $NewFiles2 = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $rsnew['archivo']); $FileCount = count($NewFiles); for ($i = 0; $i < $FileCount; $i++) { $fldvar = $this->archivo->Upload->Index < 0 ? $this->archivo->FldVar : substr($this->archivo->FldVar, 0, 1) . $this->archivo->Upload->Index . substr($this->archivo->FldVar, 1); if ($NewFiles[$i] != "") { $file = ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $NewFiles[$i]; if (file_exists($file)) { $this->archivo->Upload->SaveToFile($this->archivo->UploadPath, @$NewFiles2[$i] != "" ? $NewFiles2[$i] : $NewFiles[$i], TRUE, $i); // Just replace } } } } else { $NewFiles = array(); } $FileCount = count($OldFiles); for ($i = 0; $i < $FileCount; $i++) { if ($OldFiles[$i] != "" && !in_array($OldFiles[$i], $NewFiles)) { @unlink(ew_UploadPathEx(TRUE, $this->archivo->OldUploadPath) . $OldFiles[$i]); } } } } } else { if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") { // Use the message, do nothing } elseif ($this->CancelMessage != "") { $this->setFailureMessage($this->CancelMessage); $this->CancelMessage = ""; } else { $this->setFailureMessage($Language->Phrase("InsertCancelled")); } $AddRow = FALSE; } // Get insert id if necessary if ($AddRow) { } if ($AddRow) { // Call Row Inserted event $rs = $rsold == NULL ? NULL : $rsold->fields; $this->Row_Inserted($rs, $rsnew); } // archivo ew_CleanUploadTempPath($this->archivo, $this->archivo->Upload->Index); return $AddRow; }
function AddRow($rsold = NULL) { global $conn, $Language, $Security; // Load db values from rsold if ($rsold) { $this->LoadDbValues($rsold); $this->g_image->OldUploadPath = "/gallery"; $this->g_image->UploadPath = $this->g_image->OldUploadPath; $this->gd_images->OldUploadPath = "/gallery"; $this->gd_images->UploadPath = $this->gd_images->OldUploadPath; } $rsnew = array(); // g_name $this->g_name->SetDbValueDef($rsnew, $this->g_name->CurrentValue, "", FALSE); // g_image if (!$this->g_image->Upload->KeepFile) { if ($this->g_image->Upload->FileName == "") { $rsnew['g_image'] = NULL; } else { $rsnew['g_image'] = $this->g_image->Upload->FileName; } } if (!$this->g_image->Upload->KeepFile) { $this->g_image->UploadPath = "/gallery"; if (!ew_Empty($this->g_image->Upload->Value)) { $rsnew['g_image'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->g_image->UploadPath), $rsnew['g_image']); // Get new file name } } // Call Row Inserting event $rs = $rsold == NULL ? NULL : $rsold->fields; $bInsertRow = $this->Row_Inserting($rs, $rsnew); if ($bInsertRow) { $conn->raiseErrorFn = 'ew_ErrorFn'; $AddRow = $this->Insert($rsnew); $conn->raiseErrorFn = ''; if ($AddRow) { if (!$this->g_image->Upload->KeepFile) { if (!ew_Empty($this->g_image->Upload->Value)) { $this->g_image->Upload->SaveToFile($this->g_image->UploadPath, $rsnew['g_image'], TRUE); } } } } else { if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") { // Use the message, do nothing } elseif ($this->CancelMessage != "") { $this->setFailureMessage($this->CancelMessage); $this->CancelMessage = ""; } else { $this->setFailureMessage($Language->Phrase("InsertCancelled")); } $AddRow = FALSE; } // Get insert id if necessary if ($AddRow) { $this->gd_id->setDbValue($conn->Insert_ID()); $rsnew['gd_id'] = $this->gd_id->DbValue; } if ($AddRow) { // Call Row Inserted event $rs = $rsold == NULL ? NULL : $rsold->fields; $this->Row_Inserted($rs, $rsnew); } // g_image ew_CleanUploadTempPath($this->g_image, $this->g_image->Upload->Index); return $AddRow; }
function RenderRow() { global $Security, $Language, $gsLanguage; // Initialize URLs $this->AddUrl = $this->GetAddUrl(); $this->EditUrl = $this->GetEditUrl(); $this->CopyUrl = $this->GetCopyUrl(); $this->DeleteUrl = $this->GetDeleteUrl(); $this->ListUrl = $this->GetListUrl(); $this->SetupOtherOptions(); // Call Row_Rendering event $this->Row_Rendering(); // Common render codes for all row types // scat_id // category_id // scat_name // scat_description // scat_picture if ($this->RowType == EW_ROWTYPE_VIEW) { // View row // scat_id $this->scat_id->ViewValue = $this->scat_id->CurrentValue; $this->scat_id->ViewCustomAttributes = ""; // category_id if (strval($this->category_id->CurrentValue) != "") { $sFilterWrk = "`category_id`" . ew_SearchString("=", $this->category_id->CurrentValue, EW_DATATYPE_NUMBER, ""); $sSqlWrk = "SELECT `category_id`, `category_name` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `category`"; $sWhereWrk = ""; ew_AddFilter($sWhereWrk, $sFilterWrk); $this->Lookup_Selecting($this->category_id, $sWhereWrk); // Call Lookup selecting if ($sWhereWrk != "") { $sSqlWrk .= " WHERE " . $sWhereWrk; } $rswrk = Conn()->Execute($sSqlWrk); if ($rswrk && !$rswrk->EOF) { // Lookup values found $arwrk = array(); $arwrk[1] = $rswrk->fields('DispFld'); $this->category_id->ViewValue = $this->category_id->DisplayValue($arwrk); $rswrk->Close(); } else { $this->category_id->ViewValue = $this->category_id->CurrentValue; } } else { $this->category_id->ViewValue = NULL; } $this->category_id->ViewCustomAttributes = ""; // scat_name $this->scat_name->ViewValue = $this->scat_name->CurrentValue; $this->scat_name->ViewCustomAttributes = ""; // scat_description $this->scat_description->ViewValue = $this->scat_description->CurrentValue; $this->scat_description->ViewCustomAttributes = ""; // scat_picture if (!ew_Empty($this->scat_picture->Upload->DbValue)) { $this->scat_picture->ViewValue = $this->scat_picture->Upload->DbValue; } else { $this->scat_picture->ViewValue = ""; } $this->scat_picture->ViewCustomAttributes = ""; // scat_id $this->scat_id->LinkCustomAttributes = ""; $this->scat_id->HrefValue = ""; $this->scat_id->TooltipValue = ""; // category_id $this->category_id->LinkCustomAttributes = ""; $this->category_id->HrefValue = ""; $this->category_id->TooltipValue = ""; // scat_name $this->scat_name->LinkCustomAttributes = ""; $this->scat_name->HrefValue = ""; $this->scat_name->TooltipValue = ""; // scat_description $this->scat_description->LinkCustomAttributes = ""; $this->scat_description->HrefValue = ""; $this->scat_description->TooltipValue = ""; // scat_picture $this->scat_picture->LinkCustomAttributes = ""; $this->scat_picture->HrefValue = ""; $this->scat_picture->HrefValue2 = $this->scat_picture->UploadPath . $this->scat_picture->Upload->DbValue; $this->scat_picture->TooltipValue = ""; } // Call Row Rendered event if ($this->RowType != EW_ROWTYPE_AGGREGATEINIT) { $this->Row_Rendered(); } }
function RenderRow() { global $conn, $Security, $Language; global $gsLanguage; // Initialize URLs $this->ViewUrl = $this->GetViewUrl(); $this->EditUrl = $this->GetEditUrl(); $this->InlineEditUrl = $this->GetInlineEditUrl(); $this->CopyUrl = $this->GetCopyUrl(); $this->InlineCopyUrl = $this->GetInlineCopyUrl(); $this->DeleteUrl = $this->GetDeleteUrl(); // Call Row_Rendering event $this->Row_Rendering(); // Common render codes for all row types // id // account_id // image // uname // dtime // pnumber // message // m_type // M_url if ($this->RowType == EW_ROWTYPE_VIEW) { // View row // id $this->id->ViewValue = $this->id->CurrentValue; $this->id->ViewCustomAttributes = ""; // image $this->image->ViewValue = $this->image->CurrentValue; $this->image->ImageWidth = 50; $this->image->ImageHeight = 50; $this->image->ImageAlt = $this->image->FldAlt(); $this->image->ViewCustomAttributes = ""; // uname $this->uname->ViewValue = $this->uname->CurrentValue; $this->uname->ViewCustomAttributes = ""; // pnumber $this->pnumber->ViewValue = $this->pnumber->CurrentValue; $this->pnumber->ViewCustomAttributes = ""; // message $this->message->ViewValue = $this->message->CurrentValue; $this->message->ViewCustomAttributes = ""; // id $this->id->LinkCustomAttributes = ""; $this->id->HrefValue = ""; $this->id->TooltipValue = ""; // image $this->image->LinkCustomAttributes = ""; if (!ew_Empty($this->image->CurrentValue)) { $this->image->HrefValue = !empty($this->image->ViewValue) ? $this->image->ViewValue : $this->image->CurrentValue; // Add prefix/suffix $this->image->LinkAttrs["target"] = ""; // Add target if ($this->Export != "") { $this->image->HrefValue = ew_ConvertFullUrl($this->image->HrefValue); } } else { $this->image->HrefValue = ""; } if ($this->Export == "") { $this->image->TooltipValue = $this->pnumber->ViewValue != "" ? $this->pnumber->ViewValue : $this->pnumber->CurrentValue; $this->image->TooltipWidth = 50; if ($this->image->HrefValue == "") { $this->image->HrefValue = "javascript:void(0);"; } $this->image->LinkAttrs["class"] = "ewTooltipLink"; $this->image->LinkAttrs["data-tooltip-id"] = "tt_messages_x" . $this->RowCnt . "_image"; $this->image->LinkAttrs["data-tooltip-width"] = $this->image->TooltipWidth; $this->image->LinkAttrs["data-placement"] = EW_CSS_FLIP ? "left" : "right"; } if ($this->Export == "") { $this->image->ViewValue = ew_Highlight($this->HighlightName(), $this->image->ViewValue, $this->BasicSearch->getKeyword(), $this->BasicSearch->getType(), "", ""); } // uname $this->uname->LinkCustomAttributes = ""; $this->uname->HrefValue = ""; $this->uname->TooltipValue = ""; if ($this->Export == "") { $this->uname->ViewValue = ew_Highlight($this->HighlightName(), $this->uname->ViewValue, $this->BasicSearch->getKeyword(), $this->BasicSearch->getType(), "", ""); } // pnumber $this->pnumber->LinkCustomAttributes = ""; $this->pnumber->HrefValue = ""; $this->pnumber->TooltipValue = ""; if ($this->Export == "") { $this->pnumber->ViewValue = ew_Highlight($this->HighlightName(), $this->pnumber->ViewValue, $this->BasicSearch->getKeyword(), $this->BasicSearch->getType(), "", ""); } // message $this->message->LinkCustomAttributes = ""; $this->message->HrefValue = ""; $this->message->TooltipValue = ""; if ($this->Export == "") { $this->message->ViewValue = ew_Highlight($this->HighlightName(), $this->message->ViewValue, $this->BasicSearch->getKeyword(), $this->BasicSearch->getType(), "", ""); } } // Call Row Rendered event if ($this->RowType != EW_ROWTYPE_AGGREGATEINIT) { $this->Row_Rendered(); } }