Viewing file: Classes.php (27.86 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//File Description @0-D9928A7A
//======================================================
//
// This file contains the following classes:
// class clsSQLParameters
// class clsSQLParameter
// class clsControl
// class clsField
// class clsButton
// class clsDatePicker
// class clsErrors
//
//======================================================
//End File Description
//Constant List @0-EB100734
// ------- Controls ---------------
define("ccsLabel", 1);
define("ccsLink", 2);
define("ccsTextBox", 3);
define("ccsTextArea", 4);
define("ccsListBox", 5);
define("ccsRadioButton", 6);
define("ccsButton", 7);
define("ccsCheckBox", 8);
define("ccsImage", 9);
define("ccsImageLink", 10);
define("ccsHidden", 11);
define("ccsCheckBoxList", 12);
$ControlTypes = array(
"", "Label","Link","TextBox","TextArea","ListBox","RadioButton",
"Button","CheckBox","Image","ImageLink","Hidden","CheckBoxList"
);
// ------- Operators --------------
define("opEqual", 1);
define("opNotEqual", 2);
define("opLessThan", 3);
define("opLessThanOrEqual", 4);
define("opGreaterThan", 5);
define("opGreaterThanOrEqual", 6);
define("opBeginsWith", 7);
define("opNotBeginsWith", 8);
define("opEndsWith", 9);
define("opNotEndsWith", 10);
define("opContains", 11);
define("opNotContains", 12);
define("opIsNull", 13);
define("opNotNull", 14);
// ------- Datasource types -------
define("dsTable", 1);
define("dsSQL", 2);
define("dsProcedure", 3);
define("dsListOfValues", 4);
define("dsEmpty", 5);
// ------- CheckBox states --------
define("ccsChecked", true);
define("ccsUnchecked", false);
//End Constant List
//CCCheckValue @0-962BACE6
function CCCheckValue($Value, $DataType)
{
$result = false;
if($DataType == ccsInteger)
$result = is_int($Value);
else if($DataType == ccsFloat)
$result = is_float($Value);
else if($DataType == ccsDate)
$result = (is_array($Value) || is_int($Value));
else if($DataType == ccsBoolean)
$result = is_bool($Value);
return $result;
}
//End CCCheckValue
//clsSQLParameters Class @0-6D662A8D
class clsSQLParameters
{
var $Connection;
var $Criterion;
var $AssembledWhere;
var $Errors;
var $DataSource;
var $AllParametersSet;
var $ErrorBlock;
var $Parameters;
function clsSQLParameters($ErrorBlock = "")
{
$this->ErrorBlock = $ErrorBlock;
}
function SetParameters($Name, $NewParameter)
{
$this->Parameters[$Name] = $NewParameter;
}
function AddParameter($ParameterID, $ParameterSource, $DataType, $Format, $DBFormat, $InitValue, $DefaultValue)
{
$this->Parameters[$ParameterID] = new clsSQLParameter($ParameterSource, $DataType, $Format, $DBFormat, $InitValue, $DefaultValue, $this->ErrorBlock);
}
function AllParamsSet()
{
$blnResult = true;
if(isset($this->Parameters) && is_array($this->Parameters))
{
reset($this->Parameters);
while ($blnResult && list ($key, $Parameter) = each ($this->Parameters))
{
if($Parameter->GetValue() === "" && $Parameter->GetValue() !== false)
$blnResult = false;
}
}
return $blnResult;
}
function GetDBValue($ParameterID)
{
return $this->Parameters[$ParameterID]->GetDBValue();
}
function opAND($Brackets, $strLeft, $strRight)
{
$strResult = "";
if (strlen($strLeft))
{
if (strlen($strRight))
{
$strResult = $strLeft . " AND " . $strRight;
if ($Brackets)
$strResult = " (" . $strResult . ") ";
}
else
{
$strResult = $strLeft;
}
}
else
{
if (strlen($strRight))
$strResult = $strRight;
}
return $strResult;
}
function opOR($Brackets, $strLeft, $strRight)
{
$strResult = "";
if (strlen($strLeft))
{
if (strlen($strRight))
{
$strResult = $strLeft . " OR " . $strRight;
if ($Brackets)
$strResult = " (" . $strResult . ") ";
}
else
{
$strResult = $strLeft;
}
}
else
{
if (strlen($strRight))
$strResult = $strRight;
}
return $strResult;
}
function Operation($Operation, $FieldName, $DBValue, $SQLText)
{
$Result = "";
if(strlen($DBValue) || $DBValue === false)
{
$SQLValue = $SQLText;
if(substr($SQLValue, 0, 1) == "'")
$SQLValue = substr($SQLValue, 1, strlen($SQLValue) - 2);
switch ($Operation)
{
case opEqual:
$Result = $FieldName . " = " . $SQLText;
break;
case opNotEqual:
$Result = $FieldName . " <> " . $SQLText;
break;
case opLessThan:
$Result = $FieldName . " < " . $SQLText;
break;
case opLessThanOrEqual:
$Result = $FieldName . " <= " . $SQLText;
break;
case opGreaterThan:
$Result = $FieldName . " > " . $SQLText;
break;
case opGreaterThanOrEqual:
$Result = $FieldName . " >= " . $SQLText;
break;
case opBeginsWith:
$Result = $FieldName . " like '" . $SQLValue . "%'";
break;
case opNotBeginsWith:
$Result = $FieldName . " not like '" . $SQLValue . "%'";
break;
case opEndsWith:
$Result = $FieldName . " like '%" . $SQLValue . "'";
break;
case opNotEndsWith:
$Result = $FieldName . " not like '%" . $SQLValue . "'";
break;
case opContains:
$Result = $FieldName . " like '%" . $SQLValue . "%'";
break;
case opNotContains:
$Result = $FieldName . " not like '%" . $SQLValue . "%'";
break;
case opIsNull:
$Result = $FieldName . " IS NULL";
break;
case opNotNull:
$Result = $FieldName . " IS NOT NULL";
break;
}
}
return $Result;
}
}
//End clsSQLParameters Class
//clsSQLParameter Class @0-E84DFE10
class clsSQLParameter
{
var $Errors;
var $DataType;
var $Format;
var $DBFormat;
var $Link;
var $Caption;
var $ErrorBlock;
var $Value;
var $DBValue;
var $Text;
function clsSQLParameter($ParameterSource, $DataType, $Format, $DBFormat, $InitValue, $DefaultValue, $ErrorBlock = "")
{
$this->Errors = new clsErrors();
$this->ErrorBlock = $ErrorBlock;
$this->Caption = $ParameterSource;
$this->DataType = $DataType;
$this->Format = $Format;
$this->DBFormat = $DBFormat;
if(is_array($InitValue) && $DataType != ccsDate)
$this->SetText(join(",", $InitValue));
else if(is_array($InitValue) || strlen($InitValue))
$this->SetText($InitValue);
else
$this->SetText($DefaultValue);
}
function GetParsedValue($ParsingValue, $Format)
{
global $Tpl;
$varResult = "";
if (strlen($ParsingValue))
{
switch ($this->DataType)
{
case ccsDate:
if (CCValidateDateMask($ParsingValue, $Format))
{
$varResult = CCParseDate($ParsingValue, $Format);
if(!CCValidateDate($varResult))
{
$this->Errors->addError("The value in field " . $this->Caption . " is not valid. ($ParsingValue)");
$varResult = "";
}
}
else
{
if (is_array($Format))
$this->Errors->addError("The value in field " . $this->Caption . " is not valid. Use the following format: " . join("", $this->Format) . " ($ParsingValue)");
else
$this->Errors->addError("The value in field " . $this->Caption . " is not valid. ($ParsingValue)");
}
break;
case ccsBoolean:
if (CCValidateBoolean($ParsingValue, $Format))
$varResult = CCParseBoolean($ParsingValue, $Format);
else
{
$this->Errors->addError("The value in field " . $this->Caption . " is not valid. ($ParsingValue)");
}
break;
case ccsInteger:
if (CCValidateNumber($ParsingValue, $Format))
$varResult = CCParseInteger($ParsingValue, $Format);
else
{
$this->Errors->addError("The value in field " . $this->Caption . " is not valid. ($ParsingValue)");
}
break;
case ccsFloat:
if (CCValidateNumber($ParsingValue, $Format) )
$varResult = CCParseFloat($ParsingValue, $Format);
else
{
$this->Errors->addError("The value in field " . $this->Caption . " is not valid. ($ParsingValue)");
}
break;
case ccsText:
case ccsMemo:
$varResult = strval($ParsingValue);
break;
}
if($this->Errors->Count() > 0)
{
if(strlen($this->ErrorBlock))
$Tpl->replaceblock($this->ErrorBlock, $this->Errors->ToString());
else
echo $this->Errors->ToString();
}
}
return $varResult;
}
function GetFormatedValue($Format)
{
$strResult = "";
switch($this->DataType)
{
case ccsDate:
$strResult = CCFormatDate($this->Value, $Format);
break;
case ccsBoolean:
$strResult = CCFormatBoolean($this->Value, $Format);
break;
case ccsInteger:
case ccsFloat:
$strResult = CCFormatNumber($this->Value, $Format);
break;
case ccsText:
case ccsMemo:
$strResult = strval($this->Value);
break;
}
return $strResult;
}
function SetValue($Value)
{
$this->Value = $Value;
$this->Text = $this->GetFormatedValue($this->Format);
$this->DBValue = $this->GetFormatedValue($this->DBFormat);
}
function SetText($Text)
{
if(CCCheckValue($Text, $this->DataType)) {
$this->SetValue($Text);
} else {
$this->Text = $Text;
$this->Value = $this->GetParsedValue($this->Text, $this->Format);
$this->DBValue = $this->GetFormatedValue($this->DBFormat);
}
}
function SetDBValue($DBValue)
{
$this->DBValue = $DBValue;
$this->Value = $this->GetParsedValue($this->DBValue, $this->DBFormat);
$this->Text = $this->GetFormatedValue($this->Format);
}
function GetValue()
{
return $this->Value;
}
function GetText()
{
return $this->Text;
}
function GetDBValue()
{
return $this->DBValue;
}
}
//End clsSQLParameter Class
//clsControl Class @0-7CFA14E4
Class clsControl
{
var $Errors;
var $DataType;
var $DSType;
var $Format;
var $DBFormat;
var $Caption;
var $ControlType;
var $ControlTypeName;
var $Name;
var $BlockName;
var $HTML;
var $Required;
var $CheckedValue;
var $UncheckedValue;
var $State;
var $BoundColumn;
var $TextColumn;
var $Multiple;
var $Visible;
var $Page;
var $Parameters;
var $Value;
var $Text;
var $Values;
var $CCSEvents;
var $CCSEventResult;
function clsControl($ControlType, $Name, $Caption, $DataType, $Format, $InitValue)
{
global $ControlTypes;
$this->Value = "";
$this->Text = "";
$this->Page = "";
$this->Parameters = "";
$this->CCSEvents = "";
$this->Values = "";
$this->BoundColumn = "";
$this->TextColumn = "";
$this->Visible = true;
$this->Required = false;
$this->HTML = false;
$this->Multiple = false;
$this->Errors = new clsErrors;
$this->Name = $Name;
$this->BlockName = $ControlTypes[$ControlType] . " " . $Name;
$this->ControlType = $ControlType;
$this->DataType = $DataType;
$this->DSType = dsEmpty;
$this->Format = $Format;
$this->Caption = $Caption;
if(is_array($InitValue))
$this->Value = $InitValue;
else if(strlen($InitValue))
$this->SetText($InitValue);
}
function Validate()
{
$validation = true;
if($this->Required && $this->Value === "" && $this->Errors->Count() == 0)
{
$FieldName = strlen($this->Caption) ? $this->Caption : $this->Name;
$this->Errors->addError("The value in field " . $FieldName . " is required.");
}
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
return ($this->Errors->Count() == 0);
}
function GetParsedValue($ParsingValue)
{
$varResult = "";
if(CCCheckValue($ParsingValue, $this->DataType))
$varResult = $ParsingValue;
else if(strlen($ParsingValue))
{
switch ($this->DataType)
{
case ccsDate:
if (CCValidateDateMask($ParsingValue, $this->Format))
{
$varResult = CCParseDate($ParsingValue, $this->Format);
if(!CCValidateDate($varResult))
{
$this->Errors->addError("The value in field " . $this->Caption . " is not valid.");
$varResult = "";
}
}
else if($this->Errors->Count() == 0)
{
if (is_array($this->Format))
$this->Errors->addError("The value in field " . $this->Caption . " is not valid. Use the following format: " . join("", $this->Format) . "");
else
$this->Errors->addError("The value in field " . $this->Caption . " is not valid.");
}
break;
case ccsBoolean:
if (CCValidateBoolean($ParsingValue, $this->Format))
$varResult = CCParseBoolean($ParsingValue, $this->Format);
else if($this->Errors->Count() == 0)
$this->Errors->addError("The value in field " . $this->Caption . " is not valid.");
break;
case ccsInteger:
if (CCValidateNumber($ParsingValue, $this->Format))
$varResult = CCParseInteger($ParsingValue, $this->Format);
else if($this->Errors->Count() == 0)
$this->Errors->addError("The value in field " . $this->Caption . " is not valid.");
break;
case ccsFloat:
if (CCValidateNumber($ParsingValue, $this->Format))
$varResult = CCParseFloat($ParsingValue, $this->Format);
else if($this->Errors->Count() == 0)
$this->Errors->addError("The value in field " . $this->Caption . " is not valid.");
break;
case ccsText:
case ccsMemo:
$varResult = strval($ParsingValue);
break;
}
}
return $varResult;
}
function GetFormatedValue()
{
$strResult = "";
switch($this->DataType)
{
case ccsDate:
$strResult = CCFormatDate($this->Value, $this->Format);
break;
case ccsBoolean:
$strResult = CCFormatBoolean($this->Value, $this->Format);
break;
case ccsInteger:
case ccsFloat:
$strResult = CCFormatNumber($this->Value, $this->Format);
break;
case ccsText:
case ccsMemo:
$strResult = strval($this->Value);
break;
}
return $strResult;
}
function Prepare()
{
if($this->DSType == dsTable || $this->DSType == dsSQL || $this->DSType == dsProcedure)
{
if(!isset($this->ds->CCSEvents)) $this->ds->CCSEvents = "";
if(!strlen($this->BoundColumn)) $this->BoundColumn = 0;
if(!strlen($this->TextColumn)) $this->TextColumn = 1;
$this->EventResult = CCGetEvent($this->ds->CCSEvents, "BeforeBuildSelect");
$this->EventResult = CCGetEvent($this->ds->CCSEvents, "BeforeExecuteSelect");
$this->Values = CCGetListValues($this->ds, $this->ds->SQL, $this->ds->Where, $this->ds->Order, $this->BoundColumn, $this->TextColumn);
$this->ds->close();
$this->EventResult = CCGetEvent($this->ds->CCSEvents, "AfterExecuteSelect");
}
}
function Show($RowNumber = "")
{
global $Tpl;
$this->EventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
if(!$this->Visible) {
$Tpl->SetVar($this->Name, "");
if($Tpl->BlockExists($this->BlockName))
$Tpl->setblockvar($this->BlockName, "");
return;
}
$ControlName = ($RowNumber === "") ? $this->Name : $this->Name . "_" . $RowNumber;
if($this->Multiple)
$Tpl->SetVar($this->Name . "_Name", $ControlName . "[]");
else
$Tpl->SetVar($this->Name . "_Name", $ControlName);
switch($this->ControlType)
{
case ccsLabel:
if ($this->HTML)
$Tpl->SetVar($this->Name, $this->Text);
else
$Tpl->SetVar($this->Name, nl2br(htmlspecialchars($this->Text)));
$Tpl->ParseSafe($this->BlockName, false);
break;
case ccsTextBox:
case ccsTextArea:
case ccsImage:
case ccsHidden:
$Tpl->SetVar($this->Name, htmlspecialchars($this->Text));
$Tpl->ParseSafe($this->BlockName, false);
break;
case ccsLink:
if ($this->HTML)
$Tpl->SetVar($this->Name, $this->Text);
else
$Tpl->SetVar($this->Name, nl2br(htmlspecialchars($this->Text)));
$Tpl->SetVar($this->Name . "_Src", $this->GetLink());
$Tpl->ParseSafe($this->BlockName, false);
break;
case ccsImageLink:
$Tpl->SetVar($this->Name . "_Src", htmlspecialchars($this->Text));
$Tpl->SetVar($this->Name, $this->GetLink());
$Tpl->ParseSafe($this->BlockName, false);
break;
case ccsCheckBox:
if($this->Value)
$Tpl->SetVar($this->Name, "CHECKED");
else
$Tpl->SetVar($this->Name, "");
$Tpl->ParseSafe($this->BlockName, false);
break;
case ccsRadioButton:
$BlockToParse = "RadioButton " . $this->Name;
$Tpl->SetBlockVar($BlockToParse, "");
if(is_array($this->Values))
{
for($i = 0; $i < sizeof($this->Values); $i++)
{
$Value = htmlspecialchars($this->Values[$i][0]);
$Text = $this->HTML ? $this->Values[$i][1] : htmlspecialchars($this->Values[$i][1]);
$Selected = ($Value == $this->Value) ? " CHECKED" : "";
$Tpl->SetVar("Value", $Value);
$Tpl->SetVar("Check", $Selected);
$Tpl->SetVar("Description", $Text);
$Tpl->Parse($BlockToParse, true);
}
}
break;
case ccsCheckBoxList:
$BlockToParse = "CheckBoxList " . $this->Name;
$Tpl->SetBlockVar($BlockToParse, "");
if(is_array($this->Values))
{
for($i = 0; $i < sizeof($this->Values); $i++)
{
$Value = htmlspecialchars($this->Values[$i][0]);
$Text = $this->HTML ? $this->Values[$i][1] : htmlspecialchars($this->Values[$i][1]);
if($this->Multiple && is_array($this->Value)) {
$Selected = "";
for($j = 0; $j < sizeof($this->Value); $j++)
if($Value == $this->Value[$j])
$Selected = " CHECKED";
} else
$Selected = ($Value == $this->Value) ? " CHECKED" : "";
$Tpl->SetVar("Value", $Value);
$Tpl->SetVar("Check", $Selected);
$Tpl->SetVar("Description", $Text);
$Tpl->Parse($BlockToParse, true);
}
}
break;
case ccsListBox:
$Options = "";
if(is_array($this->Values))
{
for($i = 0; $i < sizeof($this->Values); $i++)
{
$Value = htmlspecialchars($this->Values[$i][0]);
$Text = htmlspecialchars($this->Values[$i][1]);
if($this->Multiple && is_array($this->Value)) {
$Selected = "";
for($j = 0; $j < sizeof($this->Value); $j++)
if($Value == $this->Value[$j])
$Selected = " SELECTED";
} else
$Selected = ($Value == $this->Value) ? " SELECTED" : "";
$Options .= "<OPTION VALUE=\"" . $Value . "\"" . $Selected . ">" . $Text . "</OPTION>\n";
}
}
$Tpl->SetVar($this->Name . "_Options", $Options);
$Tpl->ParseSafe($this->BlockName, false);
break;
}
}
function SetValue($Value)
{
if($this->ControlType == ccsCheckBox)
$this->Value = ($Value == $this->CheckedValue) ? true : false;
else
$this->Value = $Value;
$this->Text = $this->GetFormatedValue();
}
function SetText($Text)
{
if(CCCheckValue($Text, $this->DataType)) {
$this->SetValue($Text);
} else {
$this->Text = $Text;
if($this->ControlType == ccsCheckBox)
$this->Value = strlen($Text) ? true : false;
else
$this->Value = $this->GetParsedValue($this->Text);
}
}
function GetValue()
{
if($this->ControlType == ccsCheckBox)
$value = ($this->Value) ? $this->CheckedValue : $this->UncheckedValue;
else if(is_array($this->Value))
$value = $this->Value[0];
else
$value = $this->Value;
return $value;
}
function GetText()
{
return $this->Text;
}
function GetLink()
{
if(substr($this->Page, 0, 2) == "./")
$this->Page = substr($this->Page, 2);
if($this->Parameters == "")
return $this->Page;
else
return $this->Page . "?" . $this->Parameters;
}
function SetLink($Link)
{
if(!strlen($Link))
{
$this->Page = "";
$this->Parameters = "";
}
else
{
$LinkParts = explode("?", $Link);
$this->Page = $LinkParts[0];
$this->Parameters = (sizeof($LinkParts) == 2) ? $LinkParts[1] : "";
}
}
}
//End clsControl Class
//clsField Class @0-E4D1FC47
class clsField
{
var $DataType;
var $DBFormat;
var $Name;
var $Errors;
var $Value;
var $DBValue;
function clsField($Name, $DataType, $DBFormat)
{
$this->Value = "";
$this->DBValue = "";
$this->Name = $Name;
$this->DataType = $DataType;
$this->DBFormat = $DBFormat;
$this->Errors = new clsErrors;
}
function GetParsedValue()
{
$varResult = "";
if (strlen($this->DBValue))
{
switch ($this->DataType)
{
case ccsDate:
if (CCValidateDateMask($this->DBValue, $this->DBFormat))
{
$varResult = CCParseDate($this->DBValue, $this->DBFormat);
if(!CCValidateDate($varResult))
{
$this->Errors->addError("The value in field " . $this->Name . " is not valid.");
$varResult = "";
}
}
else
{
if (is_array($this->DBFormat))
$this->Errors->addError("The value in field " . $this->Name . " is not valid. Use the following format: " . join("", $this->DBFormat) . "");
else
$this->Errors->addError("The value in field " . $this->Name . " is not valid.");
}
break;
case ccsBoolean:
if (CCValidateBoolean($this->DBValue, $this->DBFormat))
$varResult = CCParseBoolean($this->DBValue, $this->DBFormat);
else
$this->Errors->addError("The value in field " . $this->Name . " is not valid.");
break;
case ccsInteger:
if (CCValidateNumber($this->DBValue, $this->DBFormat))
$varResult = CCParseInteger($this->DBValue, $this->DBFormat);
else
$this->Errors->addError("The value in field " . $this->Name . " is not valid.");
break;
case ccsFloat:
if (CCValidateNumber($this->DBValue, $this->DBFormat) )
$varResult = CCParseFloat($this->DBValue, $this->DBFormat);
else
$this->Errors->addError("The value in field " . $this->Name . " is not valid.");
break;
case ccsText:
case ccsMemo:
$varResult = strval($this->DBValue);
break;
}
}
return $varResult;
}
function GetFormatedValue()
{
$strResult = "";
switch($this->DataType)
{
case ccsDate:
$strResult = CCFormatDate($this->Value, $this->DBFormat);
break;
case ccsBoolean:
$strResult = CCFormatBoolean($this->Value, $this->DBFormat);
break;
case ccsInteger:
case ccsFloat:
$strResult = CCFormatNumber($this->Value, $this->DBFormat);
break;
case ccsText:
case ccsMemo:
$strResult = strval($this->Value);
break;
}
return $strResult;
}
function SetDBValue($DBValue)
{
$this->DBValue = $DBValue;
$this->Value = $this->GetParsedValue();
}
function SetValue($Value)
{
$this->Value = $Value;
$this->DBValue = $this->GetFormatedValue();
}
function GetValue()
{
return $this->Value;
}
function GetDBValue()
{
return $this->DBValue;
}
}
//End clsField Class
//clsButton Class @0-41BABE2E
Class clsButton
{
var $Name;
var $Visible;
var $CCSEvents = "";
var $CCSEventResult;
function clsButton($Name)
{
$this->Name = $Name;
$this->Visible = true;
}
function Show($RowNumber = "")
{
global $Tpl;
if($this->Visible)
{
$ControlName = ($RowNumber === "") ? $this->Name : $this->Name . "_" . $RowNumber;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
$Tpl->SetVar("Button_Name", $ControlName);
$Tpl->Parse("Button " . $this->Name, false);
}
else
{
$Tpl->setblockvar("Button " . $this->Name, "");
}
}
}
//End clsButton Class
//clsDatePicker Class @0-53EF5ACB
Class clsDatePicker
{
var $Name;
var $DateFormat;
var $Style;
var $FormName;
var $ControlName;
var $Visible;
var $Errors;
var $CCSEvents = "";
var $CCSEventResult;
function clsDatePicker($Name, $DateFormat, $Style, $FormName, $ControlName)
{
$this->Name = $Name;
$this->DateFormat = $DateFormat;
$this->Style = $Style;
$this->FormName = $FormName;
$this->ControlName = $ControlName;
$this->Visible = true;
$this->Errors = new clsErrors;
}
function Show($RowNumber = "")
{
global $Tpl;
if($this->Visible)
{
$ControlName = ($RowNumber === "") ? $this->ControlName : $this->ControlName . "_" . $RowNumber;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
$Tpl->SetVar("DateFormat", $this->DateFormat);
$Tpl->SetVar("Style", $this->Style);
$Tpl->SetVar("FormName", $this->FormName);
$Tpl->SetVar("DateControl", $ControlName);
$Tpl->Parse("DatePicker " . $this->Name, false);
}
else
{
$Tpl->setblockvar("DatePicker " . $this->Name, "");
}
}
}
//End clsDatePicker Class
//clsErrors Class @0-32F63B82
class clsErrors
{
var $Errors;
var $ErrorsCount;
var $ErrorDelimiter;
function clsErrors()
{
$this->Errors = array();
$this->ErrorsCount = 0;
$this->ErrorDelimiter = "<br>";
}
function addError($Description)
{
if (strlen($Description))
{
$this->Errors[$this->ErrorsCount] = $Description;
$this->ErrorsCount++;
}
}
function AddErrors($Errors)
{
for($i = 0; $i < $Errors->Count(); $i++)
$this->addError($Errors[$i]);
}
function Clear()
{
$this->Errors = array();
$this->ErrorsCount = 0;
}
function Count()
{
return $this->ErrorsCount;
}
function ToString()
{
if(sizeof($this->Errors) > 0)
return join($this->ErrorDelimiter, $this->Errors) . $this->ErrorDelimiter;
else
return "";
}
}
//End clsErrors Class
?>
|