function Page_Main()
 {
     global $objForm, $Language, $gsFormError;
     // Set up master/detail parameters
     $this->SetUpMasterParms();
     // Process form if post back
     if (@$_POST["a_add"] != "") {
         $this->CurrentAction = $_POST["a_add"];
         // Get form action
         $this->CopyRecord = $this->LoadOldRecord();
         // Load old recordset
         $this->LoadFormValues();
         // Load form values
     } else {
         // Not post back
         // Load key values from QueryString
         $this->CopyRecord = TRUE;
         if (@$_GET["idservicio_medico_prestado"] != "") {
             $this->idservicio_medico_prestado->setQueryStringValue($_GET["idservicio_medico_prestado"]);
             $this->setKey("idservicio_medico_prestado", $this->idservicio_medico_prestado->CurrentValue);
             // Set up key
         } else {
             $this->setKey("idservicio_medico_prestado", "");
             // Clear key
             $this->CopyRecord = FALSE;
         }
         if ($this->CopyRecord) {
             $this->CurrentAction = "C";
             // Copy record
         } else {
             $this->CurrentAction = "I";
             // Display blank record
             $this->LoadDefaultValues();
             // Load default values
         }
     }
     // Set up Breadcrumb
     $this->SetupBreadcrumb();
     // Set up detail parameters
     $this->SetUpDetailParms();
     // Validate form if post back
     if (@$_POST["a_add"] != "") {
         if (!$this->ValidateForm()) {
             $this->CurrentAction = "I";
             // Form error, reset action
             $this->EventCancelled = TRUE;
             // Event cancelled
             $this->RestoreFormValues();
             // Restore form values
             $this->setFailureMessage($gsFormError);
         }
     }
     // Perform action based on action code
     switch ($this->CurrentAction) {
         case "I":
             // Blank record, no action required
             break;
         case "C":
             // Copy an existing record
             if (!$this->LoadRow()) {
                 // Load record based on key
                 if ($this->getFailureMessage() == "") {
                     $this->setFailureMessage($Language->Phrase("NoRecord"));
                 }
                 // No record found
                 $this->Page_Terminate("servicio_medico_prestadolist.php");
                 // No matching record, return to list
             }
             // Set up detail parameters
             $this->SetUpDetailParms();
             break;
         case "A":
             // Add new record
             $this->SendEmail = TRUE;
             // Send email on add success
             if ($this->AddRow($this->OldRecordset)) {
                 // Add successful
                 if ($this->getSuccessMessage() == "") {
                     $this->setSuccessMessage($Language->Phrase("AddSuccess"));
                 }
                 // Set up success message
                 if ($this->getCurrentDetailTable() != "") {
                     // Master/detail add
                     $sReturnUrl = $this->GetDetailUrl();
                 } else {
                     $sReturnUrl = $this->getReturnUrl();
                 }
                 if (ew_GetPageName($sReturnUrl) == "servicio_medico_prestadoview.php") {
                     $sReturnUrl = $this->GetViewUrl();
                 }
                 // View paging, return to view page with keyurl directly
                 $this->Page_Terminate($sReturnUrl);
                 // Clean up and return
             } else {
                 $this->EventCancelled = TRUE;
                 // Event cancelled
                 $this->RestoreFormValues();
                 // Add failed, restore form values
                 // Set up detail parameters
                 $this->SetUpDetailParms();
             }
     }
     // Render row based on row type
     $this->RowType = EW_ROWTYPE_ADD;
     // Render add type
     // Render row
     $this->ResetAttrs();
     $this->RenderRow();
 }
Ejemplo n.º 2
0
 function Page_Main()
 {
     global $objForm, $Language, $gsFormError, $tbl_user_level;
     // Load key from QueryString
     if (@$_GET["userlevelid"] != "") {
         $tbl_user_level->userlevelid->setQueryStringValue($_GET["userlevelid"]);
     }
     if (@$_POST["a_edit"] != "") {
         $tbl_user_level->CurrentAction = $_POST["a_edit"];
         // Get action code
         $this->LoadFormValues();
         // Get form values
         // Validate form
         if (!$this->ValidateForm()) {
             $tbl_user_level->CurrentAction = "";
             // Form error, reset action
             $this->setMessage($gsFormError);
             $tbl_user_level->EventCancelled = TRUE;
             // Event cancelled
             $this->RestoreFormValues();
         }
     } else {
         $tbl_user_level->CurrentAction = "I";
         // Default action is display
     }
     // Check if valid key
     if ($tbl_user_level->userlevelid->CurrentValue == "") {
         $this->Page_Terminate("tbl_user_levellist.php");
     }
     // Invalid key, return to list
     switch ($tbl_user_level->CurrentAction) {
         case "I":
             // Get a record to display
             if (!$this->LoadRow()) {
                 // Load record based on key
                 $this->setMessage($Language->Phrase("NoRecord"));
                 // No record found
                 $this->Page_Terminate("tbl_user_levellist.php");
                 // No matching record, return to list
             }
             break;
         case "U":
             // Update
             $tbl_user_level->SendEmail = TRUE;
             // Send email on update success
             if ($this->EditRow()) {
                 // Update record based on key
                 $this->setMessage($Language->Phrase("UpdateSuccess"));
                 // Update success
                 $sReturnUrl = $tbl_user_level->getReturnUrl();
                 if (ew_GetPageName($sReturnUrl) == "tbl_user_levelview.php") {
                     $sReturnUrl = $tbl_user_level->ViewUrl();
                 }
                 // View paging, return to View page directly
                 $this->Page_Terminate($sReturnUrl);
                 // Return to caller
             } else {
                 $tbl_user_level->EventCancelled = TRUE;
                 // Event cancelled
                 $this->RestoreFormValues();
                 // Restore form values if update failed
             }
     }
     // Render the record
     $tbl_user_level->RowType = EW_ROWTYPE_EDIT;
     // Render as Edit
     $this->RenderRow();
 }
Ejemplo n.º 3
0
 function Page_Main()
 {
     global $objForm, $Language, $gsFormError, $tbl_target;
     // Load key values from QueryString
     $bCopy = TRUE;
     if (@$_GET["id_profile"] != "") {
         $tbl_target->id_profile->setQueryStringValue($_GET["id_profile"]);
     } else {
         $bCopy = FALSE;
     }
     if (@$_GET["year"] != "") {
         $tbl_target->year->setQueryStringValue($_GET["year"]);
     } else {
         $bCopy = FALSE;
     }
     if (@$_GET["month"] != "") {
         $tbl_target->month->setQueryStringValue($_GET["month"]);
     } else {
         $bCopy = FALSE;
     }
     // Process form if post back
     if (@$_POST["a_add"] != "") {
         $tbl_target->CurrentAction = $_POST["a_add"];
         // Get form action
         $this->LoadFormValues();
         // Load form values
         // Validate form
         if (!$this->ValidateForm()) {
             $tbl_target->CurrentAction = "I";
             // Form error, reset action
             $this->setMessage($gsFormError);
         }
     } else {
         // Not post back
         if ($bCopy) {
             $tbl_target->CurrentAction = "C";
             // Copy record
         } else {
             $tbl_target->CurrentAction = "I";
             // Display blank record
             $this->LoadDefaultValues();
             // Load default values
         }
     }
     // Perform action based on action code
     switch ($tbl_target->CurrentAction) {
         case "I":
             // Blank record, no action required
             break;
         case "C":
             // Copy an existing record
             if (!$this->LoadRow()) {
                 // Load record based on key
                 $this->setMessage($Language->Phrase("NoRecord"));
                 // No record found
                 $this->Page_Terminate("tbl_targetlist.php");
                 // No matching record, return to list
             }
             break;
         case "A":
             // ' Add new record
             $tbl_target->SendEmail = TRUE;
             // Send email on add success
             if ($this->AddRow()) {
                 // Add successful
                 $this->setMessage($Language->Phrase("AddSuccess"));
                 // Set up success message
                 $sReturnUrl = $tbl_target->getReturnUrl();
                 if (ew_GetPageName($sReturnUrl) == "tbl_targetview.php") {
                     $sReturnUrl = $tbl_target->ViewUrl();
                 }
                 // View paging, return to view page with keyurl directly
                 $this->Page_Terminate($sReturnUrl);
                 // Clean up and return
             } else {
                 $this->RestoreFormValues();
                 // Add failed, restore form values
             }
     }
     // Render row based on row type
     $tbl_target->RowType = EW_ROWTYPE_ADD;
     // Render add type
     // Render row
     $this->RenderRow();
 }
Ejemplo n.º 4
0
 function Page_Main()
 {
     global $objForm, $Language, $gsFormError;
     // Load key from QueryString
     if (@$_GET["BANK_ACCOUNT_ID"] != "") {
         $this->BANK_ACCOUNT_ID->setQueryStringValue($_GET["BANK_ACCOUNT_ID"]);
     }
     // Set up Breadcrumb
     $this->SetupBreadcrumb();
     // Process form if post back
     if (@$_POST["a_edit"] != "") {
         $this->CurrentAction = $_POST["a_edit"];
         // Get action code
         $this->LoadFormValues();
         // Get form values
     } else {
         $this->CurrentAction = "I";
         // Default action is display
     }
     // Check if valid key
     if ($this->BANK_ACCOUNT_ID->CurrentValue == "") {
         $this->Page_Terminate("bank_accountlist.php");
     }
     // Invalid key, return to list
     // Validate form if post back
     if (@$_POST["a_edit"] != "") {
         if (!$this->ValidateForm()) {
             $this->CurrentAction = "";
             // Form error, reset action
             $this->setFailureMessage($gsFormError);
             $this->EventCancelled = TRUE;
             // Event cancelled
             $this->RestoreFormValues();
         }
     }
     switch ($this->CurrentAction) {
         case "I":
             // Get a record to display
             if (!$this->LoadRow()) {
                 // Load record based on key
                 if ($this->getFailureMessage() == "") {
                     $this->setFailureMessage($Language->Phrase("NoRecord"));
                 }
                 // No record found
                 $this->Page_Terminate("bank_accountlist.php");
                 // No matching record, return to list
             }
             break;
         case "U":
             // Update
             $sReturnUrl = $this->getReturnUrl();
             if (ew_GetPageName($sReturnUrl) == "bank_accountlist.php") {
                 $sReturnUrl = $this->AddMasterUrl($this->GetListUrl());
             }
             // List page, return to list page with correct master key if necessary
             $this->SendEmail = TRUE;
             // Send email on update success
             if ($this->EditRow()) {
                 // Update record based on key
                 if ($this->getSuccessMessage() == "") {
                     $this->setSuccessMessage($Language->Phrase("UpdateSuccess"));
                 }
                 // Update success
                 $this->Page_Terminate($sReturnUrl);
                 // Return to caller
             } elseif ($this->getFailureMessage() == $Language->Phrase("NoRecord")) {
                 $this->Page_Terminate($sReturnUrl);
                 // Return to caller
             } else {
                 $this->EventCancelled = TRUE;
                 // Event cancelled
                 $this->RestoreFormValues();
                 // Restore form values if update failed
             }
     }
     // Render the record
     $this->RowType = EW_ROWTYPE_EDIT;
     // Render as Edit
     $this->ResetAttrs();
     $this->RenderRow();
 }
Ejemplo n.º 5
0
function ew_ReferPage()
{
    return ew_GetPageName(ew_ReferURL());
}
Ejemplo n.º 6
0
function ew_ReferPage()
{
    return ew_GetPageName(ew_ServerVar("HTTP_REFERER"));
}
Ejemplo n.º 7
0
 function Page_Main()
 {
     global $objForm, $Language, $gsFormError, $t_promotions_vins;
     // Process form if post back
     if (@$_POST["a_add"] != "") {
         $t_promotions_vins->CurrentAction = $_POST["a_add"];
         // Get form action
         $this->LoadOldRecord();
         // Load old recordset
         $this->LoadFormValues();
         // Load form values
         // Validate form
         if (!$this->ValidateForm()) {
             $t_promotions_vins->CurrentAction = "I";
             // Form error, reset action
             $t_promotions_vins->EventCancelled = TRUE;
             // Event cancelled
             $this->RestoreFormValues();
             // Restore form values
             $this->setFailureMessage($gsFormError);
         }
     } else {
         // Not post back
         // Load key values from QueryString
         $bCopy = TRUE;
         if (@$_GET["promotion"] != "") {
             $t_promotions_vins->promotion->setQueryStringValue($_GET["promotion"]);
             $t_promotions_vins->setKey("promotion", $t_promotions_vins->promotion->CurrentValue);
             // Set up key
         } else {
             $t_promotions_vins->setKey("promotion", "");
             // Clear key
             $bCopy = FALSE;
         }
         if (@$_GET["produit_vin"] != "") {
             $t_promotions_vins->produit_vin->setQueryStringValue($_GET["produit_vin"]);
             $t_promotions_vins->setKey("produit_vin", $t_promotions_vins->produit_vin->CurrentValue);
             // Set up key
         } else {
             $t_promotions_vins->setKey("produit_vin", "");
             // Clear key
             $bCopy = FALSE;
         }
         if ($bCopy) {
             $t_promotions_vins->CurrentAction = "C";
             // Copy record
         } else {
             $t_promotions_vins->CurrentAction = "I";
             // Display blank record
             $this->LoadDefaultValues();
             // Load default values
         }
     }
     // Perform action based on action code
     switch ($t_promotions_vins->CurrentAction) {
         case "I":
             // Blank record, no action required
             break;
         case "C":
             // Copy an existing record
             if (!$this->LoadRow()) {
                 // Load record based on key
                 $this->setFailureMessage($Language->Phrase("NoRecord"));
                 // No record found
                 $this->Page_Terminate("t_promotions_vinslist.php");
                 // No matching record, return to list
             }
             break;
         case "A":
             // ' Add new record
             $t_promotions_vins->SendEmail = TRUE;
             // Send email on add success
             if ($this->AddRow($this->OldRecordset)) {
                 // Add successful
                 $this->setSuccessMessage($Language->Phrase("AddSuccess"));
                 // Set up success message
                 $sReturnUrl = $t_promotions_vins->getReturnUrl();
                 if (ew_GetPageName($sReturnUrl) == "t_promotions_vinsview.php") {
                     $sReturnUrl = $t_promotions_vins->ViewUrl();
                 }
                 // View paging, return to view page with keyurl directly
                 $this->Page_Terminate($sReturnUrl);
                 // Clean up and return
             } else {
                 $this->RestoreFormValues();
                 // Add failed, restore form values
             }
     }
     // Render row based on row type
     $t_promotions_vins->RowType = EW_ROWTYPE_ADD;
     // Render add type
     // Render row
     $t_promotions_vins->ResetAttrs();
     $this->RenderRow();
 }
Ejemplo n.º 8
0
 function Render($ret = FALSE)
 {
     if (function_exists("Menu_Rendering") && $this->IsRoot) {
         Menu_Rendering($this);
     }
     if (!$this->RenderMenu()) {
         return;
     }
     if (!$this->IsMobile) {
         if ($this->IsRoot) {
             $str = "<ul";
             if ($this->Id != "") {
                 if (is_numeric($this->Id)) {
                     $str .= " id=\"menu_" . $this->Id . "\"";
                 } else {
                     $str .= " id=\"" . $this->Id . "\"";
                 }
             }
             $str .= " class=\"" . $this->MenuClassName . "\">\n";
         } else {
             $str = "<ul class=\"" . $this->SubMenuClassName . "\" role=\"menu\">\n";
         }
     } else {
         $str = "";
     }
     $gcnt = 0;
     // Group count
     $gtitle = FALSE;
     // Last item is group title
     $i = 0;
     // Menu item count
     $cururl = substr(ew_CurrentUrl(), strrpos(ew_CurrentUrl(), "/") + 1);
     foreach ($this->ItemData as $item) {
         if ($this->RenderItem($item)) {
             $i++;
             if (!$this->IsMobile && $gtitle && ($gcnt >= 1 || $this->IsRoot)) {
                 // add divider for previous group
                 $str .= "<li class=\"" . $this->MenuDividerClassName . "\"></li>\n";
             }
             if ($item->GroupTitle && (!$this->IsRoot || !$this->MenuRootGroupTitleAsSubMenu)) {
                 // Group title
                 $gtitle = TRUE;
                 $gcnt += 1;
                 if (strval($item->Text) != "") {
                     if ($this->IsMobile) {
                         $str .= "<li data-role=\"list-divider\">" . $item->Text . "</li>\n";
                     } else {
                         $str .= "<li class=\"dropdown-header\">" . $item->Text . "</li>\n";
                     }
                 }
                 if (!is_null($item->SubMenu)) {
                     foreach ($item->SubMenu->ItemData as $subitem) {
                         $liclass = !is_null($subitem->SubMenu) && $this->RenderSubMenu($subitem) ? $this->SubMenuItemClassName : "";
                         $aclass = "";
                         if (!$subitem->IsCustomUrl && ew_CurrentPage() == ew_GetPageName($subitem->Url) || $subitem->IsCustomUrl && $cururl == $subitem->Url) {
                             ew_AppendClass($liclass, $this->MenuActiveItemClassName);
                             $subitem->Url = "javascript:void(0);";
                         }
                         if ($this->RenderItem($subitem)) {
                             if ($this->IsMobile && $item->GroupTitle) {
                                 ew_AppendClass($aclass, "ewIndent");
                             }
                             $str .= $subitem->Render($aclass, $liclass, $this->IsMobile) . "\n";
                             // Create <LI>
                         }
                     }
                 }
             } else {
                 $gtitle = FALSE;
                 $liclass = !is_null($item->SubMenu) && $this->RenderSubMenu($item) ? $this->IsRoot ? $this->MenuItemClassName : $this->SubMenuItemClassName : "";
                 $aclass = "";
                 if (!$item->IsCustomUrl && ew_CurrentPage() == ew_GetPageName($item->Url) || $item->IsCustomUrl && $cururl == $item->Url) {
                     if ($this->IsRoot) {
                         ew_AppendClass($liclass, $this->MenuActiveItemClassName);
                     } else {
                         ew_AppendClass($liclass, $this->SubMenuActiveItemClassName);
                     }
                     $item->Url = "javascript:void(0);";
                 }
                 $str .= $item->Render($aclass, $liclass, $this->IsMobile) . "\n";
                 // Create <LI>
             }
         }
     }
     if ($this->IsMobile) {
         $str = "<ul data-role=\"listview\" data-filter=\"true\">" . $str . "</ul>\n";
     } elseif ($this->IsRoot) {
         $str .= "</ul>\n";
         if (EW_MENUBAR_BRAND != "") {
             $brandhref = EW_MENUBAR_BRAND_HYPERLINK == "" ? "#" : EW_MENUBAR_BRAND_HYPERLINK;
             $str = "<a class=\"navbar-brand hidden-xs\" href=\"" . ew_HtmlEncode($brandhref) . "\">" . EW_MENUBAR_BRAND . "</a>" . $str;
         }
         // Add right menu
         if ($this->ShowRightMenu) {
             $str .= "<ul class=\"nav navbar-nav navbar-right\"></ul>";
         }
         if ($this->MenuBarClassName != "") {
             $str = "<div class=\"" . $this->MenuBarClassName . "\">" . $str . "</div>";
         }
     } else {
         $str .= "</ul>\n";
     }
     if ($ret) {
         // Return as string
         return $str;
     }
     echo $str;
     // Output
 }
Ejemplo n.º 9
0
 function Render($ret = FALSE)
 {
     if (function_exists("Menu_Rendering") && $this->IsRoot) {
         Menu_Rendering($this);
     }
     if (!$this->RenderMenu()) {
         return;
     }
     if (!$this->IsMobile) {
         if ($this->IsRoot) {
             $str = "<ul";
             if ($this->Id != "") {
                 if (is_numeric($this->Id)) {
                     $str .= " id=\"menu_" . $this->Id . "\"";
                 } else {
                     $str .= " id=\"" . $this->Id . "\"";
                 }
             }
             $str .= " class=\"" . EW_MENU_CLASSNAME . "\">\n";
         } else {
             $str = "<ul class=\"" . EW_SUBMENU_CLASSNAME . "\">\n";
         }
     } else {
         $str = "";
     }
     $gcnt = 0;
     // Group count
     $gtitle = FALSE;
     // Last item is group title
     $i = 0;
     // Menu item count
     $cururl = substr(ew_CurrentUrl(), strrpos(ew_CurrentUrl(), "/") + 1);
     foreach ($this->ItemData as $item) {
         if ($this->RenderItem($item)) {
             $i++;
             if (!$this->IsMobile && $gtitle && ($gcnt >= 1 || $this->IsRoot)) {
                 // add divider for previous group
                 $str .= "<li class=\"" . EW_MENU_DIVIDER_CLASSNAME . "\"></li>\n";
             }
             if ($item->GroupTitle && (!$this->IsRoot || !EW_MENU_ROOT_GROUP_TITLE_AS_SUBMENU)) {
                 // Group title
                 $gtitle = TRUE;
                 $gcnt += 1;
                 if (strval($item->Text) != "") {
                     if ($this->IsMobile) {
                         $str .= "<li data-role=\"list-divider\">" . $item->Text . "</li>\n";
                     } else {
                         $str .= "<li class=\"dropdown-header\">" . $item->Text . "</li>\n";
                     }
                 }
                 if (!is_null($item->SubMenu)) {
                     foreach ($item->SubMenu->ItemData as $subitem) {
                         $liclass = !is_null($subitem->SubMenu) ? EW_SUBMENU_ITEM_CLASSNAME : "";
                         $aclass = "";
                         if (!$subitem->IsCustomUrl && ew_CurrentPage() == ew_GetPageName($subitem->Url) || $subitem->IsCustomUrl && $cururl == $subitem->Url) {
                             ew_AppendClass($liclass, EW_MENU_ACTIVE_ITEM_CLASS);
                         }
                         if ($this->RenderItem($subitem)) {
                             if ($this->IsMobile && $item->GroupTitle) {
                                 ew_AppendClass($aclass, "ewIndent");
                             }
                             $str .= $subitem->Render($aclass, $liclass, $this->IsMobile) . "\n";
                             // Create <LI>
                         }
                     }
                 }
             } else {
                 $gtitle = FALSE;
                 $liclass = !is_null($item->SubMenu) ? $this->IsRoot ? EW_MENU_ITEM_CLASSNAME : EW_SUBMENU_ITEM_CLASSNAME : "";
                 $aclass = "";
                 if (!$item->IsCustomUrl && ew_CurrentPage() == ew_GetPageName($item->Url) || $item->IsCustomUrl && $cururl == $item->Url) {
                     if ($this->IsRoot) {
                         ew_AppendClass($liclass, EW_MENU_ACTIVE_ITEM_CLASS);
                     } else {
                         ew_AppendClass($liclass, EW_SUBMENU_ACTIVE_ITEM_CLASS);
                     }
                 }
                 $str .= $item->Render($aclass, $liclass, $this->IsMobile) . "\n";
                 // Create <LI>
             }
         }
     }
     if ($this->IsMobile) {
         $str = "<ul data-role=\"listview\" data-filter=\"true\">" . $str . "</ul>\n";
     } elseif ($this->IsRoot) {
         $str .= "</ul>\n";
         if (EW_MENUBAR_BRAND != "") {
             $brandhref = EW_MENUBAR_BRAND_HYPERLINK == "" ? "#" : EW_MENUBAR_BRAND_HYPERLINK;
             $str = "<a class=\"brand\" href=\"" . ew_HtmlEncode($brandhref) . "\">" . EW_MENUBAR_BRAND . "</a>" . $str;
         }
         if (EW_MENUBAR_CLASSNAME != "" && EW_MENUBAR_INNER_CLASSNAME != "") {
             $str = "<div class=\"" . EW_MENUBAR_CLASSNAME . "\"><div class=\"" . EW_MENUBAR_INNER_CLASSNAME . "\">" . $str . "</div></div>";
         }
     } else {
         $str .= "</ul>\n";
     }
     if ($ret) {
         // Return as string
         return $str;
     }
     echo $str;
     // Output
 }
Ejemplo n.º 10
0
function ew_CurrentPage()
{
    return ew_GetPageName(ew_ScriptName());
}
Ejemplo n.º 11
0
 function Page_Main()
 {
     global $objForm, $Language, $gsFormError;
     $this->FormClassName = "ewForm ewAddForm";
     if (ew_IsMobile()) {
         $this->FormClassName = ew_Concat("form-horizontal", $this->FormClassName, " ");
     }
     // Process form if post back
     if (@$_POST["a_add"] != "") {
         $this->CurrentAction = $_POST["a_add"];
         // Get form action
         $this->CopyRecord = $this->LoadOldRecord();
         // Load old recordset
         $this->LoadFormValues();
         // Load form values
     } else {
         // Not post back
         // Load key values from QueryString
         $this->CopyRecord = TRUE;
         if (@$_GET["memberID"] != "") {
             $this->memberID->setQueryStringValue($_GET["memberID"]);
             $this->setKey("memberID", $this->memberID->CurrentValue);
             // Set up key
         } else {
             $this->setKey("memberID", "");
             // Clear key
             $this->CopyRecord = FALSE;
         }
         if ($this->CopyRecord) {
             $this->CurrentAction = "C";
             // Copy record
         } else {
             $this->CurrentAction = "I";
             // Display blank record
         }
     }
     // Set up Breadcrumb
     $this->SetupBreadcrumb();
     // Validate form if post back
     if (@$_POST["a_add"] != "") {
         if (!$this->ValidateForm()) {
             $this->CurrentAction = "I";
             // Form error, reset action
             $this->EventCancelled = TRUE;
             // Event cancelled
             $this->RestoreFormValues();
             // Restore form values
             $this->setFailureMessage($gsFormError);
         }
     } else {
         if ($this->CurrentAction == "I") {
             // Load default values for blank record
             $this->LoadDefaultValues();
         }
     }
     // Perform action based on action code
     switch ($this->CurrentAction) {
         case "I":
             // Blank record, no action required
             break;
         case "C":
             // Copy an existing record
             if (!$this->LoadRow()) {
                 // Load record based on key
                 if ($this->getFailureMessage() == "") {
                     $this->setFailureMessage($Language->Phrase("NoRecord"));
                 }
                 // No record found
                 $this->Page_Terminate("nos_memberslist.php");
                 // No matching record, return to list
             }
             break;
         case "A":
             // Add new record
             $this->SendEmail = TRUE;
             // Send email on add success
             if ($this->AddRow($this->OldRecordset)) {
                 // Add successful
                 if ($this->getSuccessMessage() == "") {
                     $this->setSuccessMessage($Language->Phrase("AddSuccess"));
                 }
                 // Set up success message
                 $sReturnUrl = $this->GetViewUrl();
                 if (ew_GetPageName($sReturnUrl) == "nos_memberslist.php") {
                     $sReturnUrl = $this->AddMasterUrl($sReturnUrl);
                 } elseif (ew_GetPageName($sReturnUrl) == "nos_membersview.php") {
                     $sReturnUrl = $this->GetViewUrl();
                 }
                 // View page, return to view page with keyurl directly
                 $this->Page_Terminate($sReturnUrl);
                 // Clean up and return
             } else {
                 $this->EventCancelled = TRUE;
                 // Event cancelled
                 $this->RestoreFormValues();
                 // Add failed, restore form values
             }
     }
     // Render row based on row type
     $this->RowType = EW_ROWTYPE_ADD;
     // Render add type
     // Render row
     $this->ResetAttrs();
     $this->RenderRow();
 }
Ejemplo n.º 12
0
 function Page_Main()
 {
     global $objForm, $Language, $gsFormError, $tbl_user_level;
     // Load key values from QueryString
     $bCopy = TRUE;
     if (@$_GET["userlevelid"] != "") {
         $tbl_user_level->userlevelid->setQueryStringValue($_GET["userlevelid"]);
     } else {
         $bCopy = FALSE;
     }
     // Process form if post back
     if (@$_POST["a_add"] != "") {
         $tbl_user_level->CurrentAction = $_POST["a_add"];
         // Get form action
         $this->LoadFormValues();
         // Load form values
         // Load values for user privileges
         $x_ewAllowAdd = @$_POST["x_ewAllowAdd"];
         if ($x_ewAllowAdd == "") {
             $x_ewAllowAdd = 0;
         }
         $x_ewAllowEdit = @$_POST["x_ewAllowEdit"];
         if ($x_ewAllowEdit == "") {
             $x_ewAllowEdit = 0;
         }
         $x_ewAllowDelete = @$_POST["x_ewAllowDelete"];
         if ($x_ewAllowDelete == "") {
             $x_ewAllowDelete = 0;
         }
         $x_ewAllowList = @$_POST["x_ewAllowList"];
         if ($x_ewAllowList == "") {
             $x_ewAllowList = 0;
         }
         if (defined("EW_USER_LEVEL_COMPAT")) {
             $this->lPriv = intval($x_ewAllowAdd) + intval($x_ewAllowEdit) + intval($x_ewAllowDelete) + intval($x_ewAllowList);
         } else {
             $x_ewAllowView = @$_POST["x_ewAllowView"];
             if ($x_ewAllowView == "") {
                 $x_ewAllowView = 0;
             }
             $x_ewAllowSearch = @$_POST["x_ewAllowSearch"];
             if ($x_ewAllowSearch == "") {
                 $x_ewAllowSearch = 0;
             }
             $this->lPriv = intval($x_ewAllowAdd) + intval($x_ewAllowEdit) + intval($x_ewAllowDelete) + intval($x_ewAllowList) + intval($x_ewAllowView) + intval($x_ewAllowSearch);
         }
         // Validate form
         if (!$this->ValidateForm()) {
             $tbl_user_level->CurrentAction = "I";
             // Form error, reset action
             $this->setMessage($gsFormError);
         }
     } else {
         // Not post back
         if ($bCopy) {
             $tbl_user_level->CurrentAction = "C";
             // Copy record
         } else {
             $tbl_user_level->CurrentAction = "I";
             // Display blank record
             $this->LoadDefaultValues();
             // Load default values
         }
     }
     // Perform action based on action code
     switch ($tbl_user_level->CurrentAction) {
         case "I":
             // Blank record, no action required
             break;
         case "C":
             // Copy an existing record
             if (!$this->LoadRow()) {
                 // Load record based on key
                 $this->setMessage($Language->Phrase("NoRecord"));
                 // No record found
                 $this->Page_Terminate("tbl_user_levellist.php");
                 // No matching record, return to list
             }
             break;
         case "A":
             // ' Add new record
             $tbl_user_level->SendEmail = TRUE;
             // Send email on add success
             if ($this->AddRow()) {
                 // Add successful
                 $this->setMessage($Language->Phrase("AddSuccess"));
                 // Set up success message
                 $sReturnUrl = $tbl_user_level->getReturnUrl();
                 if (ew_GetPageName($sReturnUrl) == "tbl_user_levelview.php") {
                     $sReturnUrl = $tbl_user_level->ViewUrl();
                 }
                 // View paging, return to view page with keyurl directly
                 $this->Page_Terminate($sReturnUrl);
                 // Clean up and return
             } else {
                 $this->RestoreFormValues();
                 // Add failed, restore form values
             }
     }
     // Render row based on row type
     $tbl_user_level->RowType = EW_ROWTYPE_ADD;
     // Render add type
     // Render row
     $this->RenderRow();
 }
Ejemplo n.º 13
0
 function Page_Main()
 {
     global $objForm, $Language, $gsFormError;
     // Load key from QueryString
     if (@$_GET["nilai_id"] != "") {
         $this->nilai_id->setQueryStringValue($_GET["nilai_id"]);
     }
     // Set up Breadcrumb
     $this->SetupBreadcrumb();
     // Process form if post back
     if (@$_POST["a_edit"] != "") {
         $this->CurrentAction = $_POST["a_edit"];
         // Get action code
         $this->LoadFormValues();
         // Get form values
         // Set up detail parameters
         $this->SetUpDetailParms();
     } else {
         $this->CurrentAction = "I";
         // Default action is display
     }
     // Check if valid key
     if ($this->nilai_id->CurrentValue == "") {
         $this->Page_Terminate("nilailist.php");
     }
     // Invalid key, return to list
     // Validate form if post back
     if (@$_POST["a_edit"] != "") {
         if (!$this->ValidateForm()) {
             $this->CurrentAction = "";
             // Form error, reset action
             $this->setFailureMessage($gsFormError);
             $this->EventCancelled = TRUE;
             // Event cancelled
             $this->RestoreFormValues();
         }
     }
     switch ($this->CurrentAction) {
         case "I":
             // Get a record to display
             if (!$this->LoadRow()) {
                 // Load record based on key
                 if ($this->getFailureMessage() == "") {
                     $this->setFailureMessage($Language->Phrase("NoRecord"));
                 }
                 // No record found
                 $this->Page_Terminate("nilailist.php");
                 // No matching record, return to list
             }
             // Set up detail parameters
             $this->SetUpDetailParms();
             break;
         case "U":
             // Update
             $this->SendEmail = TRUE;
             // Send email on update success
             if ($this->EditRow()) {
                 // Update record based on key
                 if ($this->getSuccessMessage() == "") {
                     $this->setSuccessMessage($Language->Phrase("UpdateSuccess"));
                 }
                 // Update success
                 if ($this->getCurrentDetailTable() != "") {
                     // Master/detail edit
                     $sReturnUrl = $this->GetDetailUrl();
                 } else {
                     $sReturnUrl = $this->getReturnUrl();
                 }
                 if (ew_GetPageName($sReturnUrl) == "nilaiview.php") {
                     $sReturnUrl = $this->GetViewUrl();
                 }
                 // View paging, return to View page directly
                 $this->Page_Terminate($sReturnUrl);
                 // Return to caller
             } else {
                 $this->EventCancelled = TRUE;
                 // Event cancelled
                 $this->RestoreFormValues();
                 // Restore form values if update failed
                 // Set up detail parameters
                 $this->SetUpDetailParms();
             }
     }
     // Render the record
     $this->RowType = EW_ROWTYPE_EDIT;
     // Render as Edit
     $this->ResetAttrs();
     $this->RenderRow();
 }