<?php
//Include Common Files @1-855D3870
define("RelativePath", "../../../..");
define("PathToCurrentPage", "/core.sym/fe/winkelwagen/bm_std/");
define("FileName", "element_plaatsen.php");
include_once(RelativePath . "/Common.php");
include_once(RelativePath . "/Template.php");
include_once(RelativePath . "/Sorter.php");
include_once(RelativePath . "/Navigator.php");
//End Include Common Files

//Include Page implementation @81-63A90D11
include_once(RelativePath . "/core.sym/fe/header_footer/inc_header.php");
//End Include Page implementation

//DEL      function CheckInsert()
//DEL      {
//DEL          $filed = false;
//DEL          $filed = ($filed || strlen($this->FormParameters["listboxOptions"][$this->RowNumber]));
//DEL          //$filed = ($filed || strlen($this->FormParameters["checkboxList"][$this->RowNumber]));
//DEL          return $filed;
//DEL      }



//Include Page implementation @82-06A0432E
include_once(RelativePath . "/core.sym/fe/header_footer/inc_footer.php");
//End Include Page implementation

class clsRecordboekingselementGrid { //boekingselementGrid Class @111-10681190

//Variables @111-9E315808

    // Public variables
    public $ComponentType = "Record";
    public $ComponentName;
    public $Parent;
    public $HTMLFormAction;
    public $PressedButton;
    public $Errors;
    public $ErrorBlock;
    public $FormSubmitted;
    public $FormEnctype;
    public $Visible;
    public $IsEmpty;

    public $CCSEvents = [];
    public $CCSEventResult;

    public $RelativePath = "";

    public $InsertAllowed = false;
    public $UpdateAllowed = false;
    public $DeleteAllowed = false;
    public $ReadAllowed   = false;
    public $EditMode      = false;
    public $ds;
    public $DataSource;
    public $ValidatingControls;
    public $Controls;
    public $Attributes;

    // Class variables
//End Variables

//Class_Initialize Event @111-46DA0462
    function __construct($RelativePath, & $Parent)
    {

        global $FileName;
        global $CCSLocales;
        global $DefaultDateFormat;
        $this->Visible = true;
        $this->Parent = & $Parent;
        $this->RelativePath = $RelativePath;
        $this->Errors = new clsErrors();
        $this->ErrorBlock = "Record boekingselementGrid/Error";
        $this->DataSource = new clsboekingselementGridDataSource($this);
        $this->ds = & $this->DataSource;
        $this->UpdateAllowed = true;
        $this->ReadAllowed = true;
        if($this->Visible)
        {
            $this->ComponentName = "boekingselementGrid";
            $this->Attributes = new clsAttributes($this->ComponentName . ":");
            $CCSForm = explode(":", CCGetFromGet("ccsForm", ""), 2);
            if(sizeof($CCSForm) == 1)
                $CCSForm[1] = "";
            list($FormName, $FormMethod) = $CCSForm;
            $this->EditMode = ($FormMethod == "Edit");
            $this->FormEnctype = "application/x-www-form-urlencoded";
            $this->FormSubmitted = ($FormName == $this->ComponentName);
            $Method = $this->FormSubmitted ? ccsPost : ccsGet;
            $this->Button_Update = new clsButton("Button_Update", $Method, $this);
            $this->lblDatumDuur = new clsControl(ccsLabel, "lblDatumDuur", "lblDatumDuur", ccsText, "", CCGetRequestParam("lblDatumDuur", $Method, NULL), $this);
            $this->lblDatumDuur->HTML = true;
            $this->panelPromos = new clsPanel("panelPromos", $this);
            $this->lblUitlPromo = new clsControl(ccsLabel, "lblUitlPromo", "lblUitlPromo", ccsText, "", CCGetRequestParam("lblUitlPromo", $Method, NULL), $this);
            $this->lblUitlPromo->HTML = true;
            $this->lblVragenlijstPromo = new clsControl(ccsLabel, "lblVragenlijstPromo", "lblVragenlijstPromo", ccsText, "", CCGetRequestParam("lblVragenlijstPromo", $Method, NULL), $this);
            $this->lblVragenlijstPromo->HTML = true;
            $this->lblItemSelectieAjax = new clsControl(ccsLabel, "lblItemSelectieAjax", "lblItemSelectieAjax", ccsText, "", CCGetRequestParam("lblItemSelectieAjax", $Method, NULL), $this);
            $this->lblItemSelectieAjax->HTML = true;
            $this->panelPromos->AddComponent("lblUitlPromo", $this->lblUitlPromo);
            $this->panelPromos->AddComponent("lblVragenlijstPromo", $this->lblVragenlijstPromo);
        }
    }
//End Class_Initialize Event

//Initialize Method @111-5D060BAC
    function Initialize()
    {

        if(!$this->Visible)
            return;

    }
//End Initialize Method

//Validate Method @111-367945B8
    function Validate()
    {
        global $CCSLocales;
        $Validation = true;
        $Where = "";
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this);
        return (($this->Errors->Count() == 0) && $Validation);
    }
//End Validate Method

//CheckErrors Method @111-366145F5
    function CheckErrors()
    {
        $errors = false;
        $errors = ($errors || $this->lblDatumDuur->Errors->Count());
        $errors = ($errors || $this->lblUitlPromo->Errors->Count());
        $errors = ($errors || $this->lblVragenlijstPromo->Errors->Count());
        $errors = ($errors || $this->lblItemSelectieAjax->Errors->Count());
        $errors = ($errors || $this->Errors->Count());
        $errors = ($errors || $this->DataSource->Errors->Count());
        return $errors;
    }
//End CheckErrors Method

//MasterDetail @111-ED598703
function SetPrimaryKeys($keyArray)
{
    $this->PrimaryKeys = $keyArray;
}
function GetPrimaryKeys()
{
    return $this->PrimaryKeys;
}
function GetPrimaryKey($keyName)
{
    return $this->PrimaryKeys[$keyName];
}
//End MasterDetail

//Operation Method @111-8FAFD838
    function Operation()
    {
        if(!$this->Visible)
            return;

        global $Redirect;
        global $FileName;

        $this->DataSource->Prepare();
        if(!$this->FormSubmitted) {
            $this->EditMode = true;
            return;
        }

        if($this->FormSubmitted) {
            $this->PressedButton = $this->EditMode ? "Button_Update" : "";
            if($this->Button_Update->Pressed) {
                $this->PressedButton = "Button_Update";
            }
        }
        $Redirect = $FileName . "?" . CCGetQueryString("QueryString", array("ccsForm"));
        if($this->Validate()) {
            if($this->PressedButton == "Button_Update") {
                if(!CCGetEvent($this->Button_Update->CCSEvents, "OnClick", $this->Button_Update) || !$this->UpdateRow()) {
                    $Redirect = "";
                }
            }
        } else {
            $Redirect = "";
        }
        if ($Redirect)
            $this->DataSource->close();
    }
//End Operation Method

//UpdateRow Method @111-92E06AB0
    function UpdateRow()
    {
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate", $this);
        if(!$this->UpdateAllowed) return false;
        $this->DataSource->Update();
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterUpdate", $this);
        return (!$this->CheckErrors());
    }
//End UpdateRow Method

//Show Method @111-FAB692B3
    function Show()
    {
        global $CCSUseAmp;
        global $Tpl;
        global $FileName;
        global $CCSLocales;
        $Error = "";

        if(!$this->Visible)
            return;

        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);


        $RecordBlock = "Record " . $this->ComponentName;
        $ParentPath = $Tpl->block_path;
        $Tpl->block_path = $ParentPath . "/" . $RecordBlock;
        $this->EditMode = $this->EditMode && $this->ReadAllowed;
        if($this->EditMode) {
            if($this->DataSource->Errors->Count()){
                $this->Errors->AddErrors($this->DataSource->Errors);
                $this->DataSource->Errors->clear();
            }
            $this->DataSource->Open();
            if($this->DataSource->Errors->Count() == 0 && $this->DataSource->next_record()) {
                $this->DataSource->SetValues();
            } else {
                $this->EditMode = false;
            }
        }

        if($this->FormSubmitted || $this->CheckErrors()) {
            $Error = "";
            $Error = ComposeStrings($Error, $this->lblDatumDuur->Errors->ToString());
            $Error = ComposeStrings($Error, $this->lblUitlPromo->Errors->ToString());
            $Error = ComposeStrings($Error, $this->lblVragenlijstPromo->Errors->ToString());
            $Error = ComposeStrings($Error, $this->lblItemSelectieAjax->Errors->ToString());
            $Error = ComposeStrings($Error, $this->Errors->ToString());
            $Error = ComposeStrings($Error, $this->DataSource->Errors->ToString());
            $Tpl->SetVar("Error", $Error);
            $Tpl->Parse("Error", false);
        }
        $CCSForm = $this->EditMode ? $this->ComponentName . ":" . "Edit" : $this->ComponentName;
        $this->HTMLFormAction = $FileName . "?" . CCAddParam(CCGetQueryString("QueryString", ""), "ccsForm", $CCSForm);
        $Tpl->SetVar("Action", !$CCSUseAmp ? $this->HTMLFormAction : str_replace("&", "&amp;", $this->HTMLFormAction));
        $Tpl->SetVar("HTMLFormName", $this->ComponentName);
        $Tpl->SetVar("HTMLFormEnctype", $this->FormEnctype);
        $this->Button_Update->Visible = $this->EditMode && $this->UpdateAllowed;

        $this->Button_Update->Attributes->SetValue("addButton", "");
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow", $this);
        $this->Attributes->Show();
        if(!$this->Visible) {
            $Tpl->block_path = $ParentPath;
            return;
        }

        $this->Button_Update->Show();
        $this->lblDatumDuur->Show();
        $this->panelPromos->Show();
        $this->lblItemSelectieAjax->Show();
        $Tpl->parse();
        $Tpl->block_path = $ParentPath;
        $this->DataSource->close();
    }
//End Show Method

} //End boekingselementGrid Class @111-FCB6E20C

class clsboekingselementGridDataSource extends clsDBnrv {  //boekingselementGridDataSource Class @111-B43B0D85

//DataSource Variables @111-05CE6B70
    public $Parent = "";
    public $CCSEvents = [];
    public $CCSEventResult;
    public $ErrorBlock;
    public $CmdExecution;

    public $UpdateParameters;
    public $wp;
    public $AllParametersSet;


    // Datasource fields
    public $lblDatumDuur;
    public $lblUitlPromo;
    public $lblVragenlijstPromo;
    public $lblItemSelectieAjax;
//End DataSource Variables

//DataSourceClass_Initialize Event @111-197335E0
    function __construct(& $Parent)
    {
        $this->Parent = & $Parent;
        $this->ErrorBlock = "Record boekingselementGrid/Error";
        $this->Initialize();
        $this->lblDatumDuur = new clsField("lblDatumDuur", ccsText, "");
        
        $this->lblUitlPromo = new clsField("lblUitlPromo", ccsText, "");
        
        $this->lblVragenlijstPromo = new clsField("lblVragenlijstPromo", ccsText, "");
        
        $this->lblItemSelectieAjax = new clsField("lblItemSelectieAjax", ccsText, "");
        

    }
//End DataSourceClass_Initialize Event

//Prepare Method @111-14D6CD9D
    function Prepare()
    {
        global $CCSLocales;
        global $DefaultDateFormat;
    }
//End Prepare Method

//Open Method @111-EDB4038E
    function Open()
    {
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
        $this->SQL = "SELECT FALSE";
        $this->Order = "";
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect", $this->Parent);
        $this->PageSize = 1;
        $this->query($this->OptimizeSQL(CCBuildSQL($this->SQL, $this->Where, $this->Order)));
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect", $this->Parent);
    }
//End Open Method

//SetValues Method @111-BAF0975B
    function SetValues()
    {
    }
//End SetValues Method

//Update Method @111-DB2F140B
    function Update()
    {
        global $CCSLocales;
        global $DefaultDateFormat;
        $this->CmdExecution = true;
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate", $this->Parent);
        $this->SQL = "SELECT FALSE";
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteUpdate", $this->Parent);
        if($this->Errors->Count() == 0 && $this->CmdExecution) {
            $this->query($this->SQL);
            $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteUpdate", $this->Parent);
        }
    }
//End Update Method

} //End boekingselementGridDataSource Class @111-FCB6E20C

//Initialize Page @1-C9273754
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
$Attributes = "";

// Events;
$CCSEvents = [];
$CCSEventResult = "";

$FileName = FileName;
$Redirect = "";
$TemplateFileName = "element_plaatsen.html";
$BlockToParse = "main";
$TemplateEncoding = "CP1252";
$ContentType = "text/html";
$PathToRoot = "../../../../";
//End Initialize Page

//Include events file @1-6DF95656
include_once("./element_plaatsen_events.php");
//End Include events file

//Before Initialize @1-E870CEBC
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeInitialize", $MainPage);
//End Before Initialize

//Initialize Objects @1-E08CF79A
$DBnrv = new clsDBnrv();
$MainPage->Connections["nrv"] = & $DBnrv;
$Attributes = new clsAttributes("page:");
$MainPage->Attributes = & $Attributes;

// Controls
$inc_header = new clsinc_header("../../header_footer/", "inc_header", $MainPage);
$inc_header->Initialize();
$lblElementnaam = new clsControl(ccsLabel, "lblElementnaam", "lblElementnaam", ccsText, "", CCGetRequestParam("lblElementnaam", ccsGet, NULL), $MainPage);
$lblUitleg = new clsControl(ccsLabel, "lblUitleg", "lblUitleg", ccsText, "", CCGetRequestParam("lblUitleg", ccsGet, NULL), $MainPage);
$lblUitleg->HTML = true;
$lblDeelnemers = new clsControl(ccsLabel, "lblDeelnemers", "lblDeelnemers", ccsText, "", CCGetRequestParam("lblDeelnemers", ccsGet, NULL), $MainPage);
$lblPreviousNext = new clsControl(ccsLabel, "lblPreviousNext", "lblPreviousNext", ccsText, "", CCGetRequestParam("lblPreviousNext", ccsGet, NULL), $MainPage);
$lblPreviousNext->HTML = true;
$lblWinkelwagenOverzicht = new clsControl(ccsLabel, "lblWinkelwagenOverzicht", "lblWinkelwagenOverzicht", ccsText, "", CCGetRequestParam("lblWinkelwagenOverzicht", ccsGet, NULL), $MainPage);
$lblWinkelwagenOverzicht->HTML = true;
$inc_footer = new clsinc_footer("../../header_footer/", "inc_footer", $MainPage);
$inc_footer->Initialize();
$boekingselementGrid = new clsRecordboekingselementGrid("", $MainPage);
$MainPage->inc_header = & $inc_header;
$MainPage->lblElementnaam = & $lblElementnaam;
$MainPage->lblUitleg = & $lblUitleg;
$MainPage->lblDeelnemers = & $lblDeelnemers;
$MainPage->lblPreviousNext = & $lblPreviousNext;
$MainPage->lblWinkelwagenOverzicht = & $lblWinkelwagenOverzicht;
$MainPage->inc_footer = & $inc_footer;
$MainPage->boekingselementGrid = & $boekingselementGrid;
$boekingselementGrid->Initialize();

BindEvents();

$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize", $MainPage);

if ($Charset) {
    header("Content-Type: " . $ContentType . "; charset=" . $Charset);
} else {
    header("Content-Type: " . $ContentType);
}
//End Initialize Objects

//Initialize HTML Template @1-B101C023
$CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView", $MainPage);
$Tpl = new clsTemplate($FileEncoding, $TemplateEncoding);
$Tpl->LoadTemplate(PathToCurrentPage . $TemplateFileName, $BlockToParse, "CP1252", "replace");
$Tpl->block_path = "/$BlockToParse";
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow", $MainPage);
$Attributes->SetValue("pathToRoot", "../../../../");
$Attributes->Show();
//End Initialize HTML Template

//Execute Components @1-2D086C2E
$inc_header->Operations();
$inc_footer->Operations();
$boekingselementGrid->Operation();
//End Execute Components

//Go to destination page @1-59F93219
if($Redirect)
{
    $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
    $DBnrv->close();
    header("Location: " . $Redirect);
    $inc_header->Class_Terminate();
    unset($inc_header);
    $inc_footer->Class_Terminate();
    unset($inc_footer);
    unset($boekingselementGrid);
    unset($Tpl);
    exit;
}
//End Go to destination page

//Show Page @1-FD4EDE3C
$inc_header->Show();
$inc_footer->Show();
$boekingselementGrid->Show();
$lblElementnaam->Show();
$lblUitleg->Show();
$lblDeelnemers->Show();
$lblPreviousNext->Show();
$lblWinkelwagenOverzicht->Show();
$Tpl->block_path = "";
$Tpl->Parse($BlockToParse, false);
if (!isset($main_block)) $main_block = $Tpl->GetVar($BlockToParse);
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeOutput", $MainPage);
if ($CCSEventResult) echo $main_block;
//End Show Page

//Unload Page @1-40E86E95
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBnrv->close();
$inc_header->Class_Terminate();
unset($inc_header);
$inc_footer->Class_Terminate();
unset($inc_footer);
unset($boekingselementGrid);
unset($Tpl);
//End Unload Page


?>
