function p_role_Navigator_BeforeShow(&$sender) { $p_role_Navigator_BeforeShow = true; $Component =& $sender; $Container =& CCGetParentContainer($sender); global $p_role; //Compatibility //End p_role_Navigator_BeforeShow //Hide-Show Component @50-0DB41530 $Parameter1 = $Container->DataSource->PageCount(); $Parameter2 = 2; if ((is_array($Parameter1) || strlen($Parameter1)) && (is_array($Parameter2) || strlen($Parameter2)) && 0 > CCCompareValues($Parameter1, $Parameter2, ccsInteger)) { $Component->Visible = false; } //End Hide-Show Component //Close p_role_Navigator_BeforeShow @49-6BE28B6D return $p_role_Navigator_BeforeShow; }
function CCCompareValues($Value1, $Value2, $DataType = ccsText, $Format = "") { switch ($DataType) { case ccsInteger: case ccsFloat: if (strcmp(trim($Value1), "") == 0 || strcmp(trim($Value2), "") == 0) { return strcmp($Value1, $Value2); } else { if ($Value1 > $Value2) { return 1; } else { if ($Value1 < $Value2) { return -1; } else { return 0; } } } case ccsText: case ccsMemo: return strcmp($Value1, $Value2); case ccsBoolean: if (is_bool($Value1)) { $val1 = $Value1; } else { if (strlen($Value1) != 0 && CCValidateBoolean($Value1, $Format)) { $val1 = CCParseBoolean($Value1, $Format); } else { return 1; } } if (is_bool($Value2)) { $val2 = $Value2; } else { if (strlen($Value2) != 0 && CCValidateBoolean($Value2, $Format)) { $val2 = CCParseBoolean($Value2, $Format); } else { return 1; } } return $val1 xor $val2; case ccsDate: if (is_array($Value1) && is_array($Value2)) { $compare = array(ccsYear, ccsMonth, ccsDay, ccsHour, ccsMinute, ccsSecond); foreach ($compare as $ind => $val) { if ($Value1[$val] < $Value2[$val]) { return -1; } elseif ($Value1[$val] > $Value2[$val]) { return 1; } } return 0; } else { if (is_array($Value1)) { $FormattedValue = CCFormatValue($Value1, $Format, $DataType); return CCCompareValues($FormattedValue, $Value2); } else { if (is_array($Value2)) { $FormattedValue = CCFormatValue($Value2, $Format, $DataType); return CCCompareValues($Value1, $FormattedValue); } else { return CCCompareValues($Value1, $Value2); } } } } }
function Show() { global $CCSUseAmp; global $Tpl; global $FileName; $this->EventResult = CCGetEvent($this->CCSEvents, "BeforeShow", $this); if (!$this->Visible) { return; } $RemoveFromUrl = array($this->TargetName . "Year", $this->TargetName . "Month", $this->TargetName . "Date"); $QueryString = CCGetQueryString("QueryString", $RemoveFromUrl); $ParentPath = $Tpl->block_path; $CalendarNavigatorBlock = "CalendarNavigator " . $this->CalendarNavigatorName; $Tpl->block_path = $ParentPath . "/" . $CalendarNavigatorBlock; $Tpl->SetBlockVar("", ""); $Tpl->SetBlockVar("Years", ""); $Tpl->SetBlockVar("Months", ""); $Tpl->SetBlockVar("Quarters", ""); $this->Attributes->Show(); $Blocks = array("Months", "Quarters", "Years"); foreach ($Blocks as $Block) { if ($Tpl->BlockExists($Block)) { if ($Block == "Years") { $this->CurrentProcessingDate = CCDateAdd($this->CurrentDate, "-" . $this->YearsRange . "years"); $LastDate = CCDateAdd($this->CurrentDate, "+" . $this->YearsRange . "years"); $add = "1year"; $name = "Year"; } elseif ($Block == "Quarters" && $this->CalendarType == "Quarter") { $this->CurrentProcessingDate = CCParseDate(CCFormatDate($this->CurrentDate, array("yyyy", "-01-01 00:00:00")), array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss")); $LastDate = CCDateAdd($this->CurrentProcessingDate, "+1year -1sec"); $add = "3month"; $name = "Quarter"; } elseif ($this->CalendarType != 12) { $this->CurrentProcessingDate = CCParseDate(CCFormatDate($this->CurrentDate, array("yyyy", "-01-01 00:00:00")), array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss")); $LastDate = CCDateAdd($this->CurrentProcessingDate, "+1year -1sec"); $add = "1month"; $name = "Month"; } else { continue; } while (CCCompareValues($this->CurrentProcessingDate, $LastDate, ccsDate) <= 0) { $NextDate = CCDateAdd($this->CurrentProcessingDate, $add); if ($Block == "Years" && $this->CurrentProcessingDate[ccsYear] == $this->CurrentDate[ccsYear] || $Block == "Months" && $this->CurrentProcessingDate[ccsMonth] == $this->CurrentDate[ccsMonth] || $Block == "Quarters" && ceil($this->CurrentProcessingDate[ccsMonth] / 3 + 0.1) == ceil($this->CurrentDate[ccsMonth] / 3)) { $this->ShowBlock($QueryString, $Block . "/Current_" . $name, $Block . "/Regular_" . $name); } else { $this->ShowBlock($QueryString, $Block . "/Regular_" . $name); } $this->CurrentProcessingDate = $NextDate; } $this->ShowBlock($QueryString, $Block); } } if ($Tpl->BlockExists("Prev_Year")) { $this->CurrentProcessingDate = CCDateAdd($this->CurrentDate, "-1year"); $this->ShowBlock($QueryString, "Prev_Year", "", false); } if ($Tpl->BlockExists("Next_Year")) { $this->CurrentProcessingDate = CCDateAdd($this->CurrentDate, "+1year"); $this->ShowBlock($QueryString, "Next_Year", "", false); } if ($this->CalendarType != 12) { if ($Tpl->BlockExists("Prev")) { $this->CurrentProcessingDate = $this->PrevProcessingDate; $this->ShowBlock($QueryString, "Prev", "", false); } if ($Tpl->BlockExists("Next")) { $this->CurrentProcessingDate = $this->NextProcessingDate; $this->ShowBlock($QueryString, "Next", "", false); } } $Tpl->block_path = $ParentPath; $ActionStr = $FileName . "?" . CCAddParam($QueryString, "ccsForm", $this->TargetName); if ($CCSUseAmp) { $ActionStr = str_replace('&', '&', $ActionStr); } $Tpl->SetVar("Action", $ActionStr); $Tpl->SetVar("CalendarName", $this->TargetName); $this->CurrentProcessingDate = $this->CurrentDate; $this->ShowBlock($QueryString, $CalendarNavigatorBlock, "", false); }
function SetValue($Value) { if ($this->ControlType == ccsCheckBox) { $this->Value = CCCompareValues($Value, $this->CheckedValue, $this->DataType) == 0 || CCCompareValues($Value, $this->UncheckedValue, $this->DataType) != 0 && (is_array($Value) || strlen($Value)) ? true : false; $this->IsNull = false; } else { $this->Value = $Value; $this->IsNull = is_null($Value); } $this->Text = $this->GetFormattedValue(); if (!$this->isInternal) { $this->initialValue = $this->Value; } }
function p_company_client_BeforeShow(&$sender) { $p_company_client_BeforeShow = true; $Component =& $sender; $Container =& CCGetParentContainer($sender); global $p_company_client; //Compatibility //End p_company_client_BeforeShow //Hide-Show Component @45-16FE48D1 $Parameter1 = 1; $Parameter2 = 1; if (0 == CCCompareValues($Parameter1, $Parameter2, ccsInteger)) { $Component->Button_Submit->Visible = false; } //End Hide-Show Component //Close p_company_client_BeforeShow @26-EC50B8C9 return $p_company_client_BeforeShow; }
function Show() { global $Tpl; global $CCSLocales; global $DefaultDateFormat; if (!$this->Visible) { return; } $this->CalculateCalendarPeriod(); $this->DataSource->Parameters["urldepartment_id"] = CCGetFromGet("department_id", NULL); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this); $this->DataSource->Prepare(); $this->DataSource->Open(); while ($this->DataSource->next_record()) { $DateField = CCParseDate($this->DataSource->f("appointment_date"), array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss")); if (!is_array($DateField)) { continue; } if (CCCompareValues($DateField, $this->StartDate, ccsDate) >= 0 && CCCompareValues($DateField, $this->EndDate, ccsDate) <= 0) { $this->DataSource->SetValues(); $Event = new clsEventresult_users(); $Event->_Time = CCParseDate($this->DataSource->f("appointment_time"), array("HH", ":", "nn", ":", "ss")); $Event->EventTime = $this->DataSource->EventTime->GetValue(); $Event->EventDescription = $this->DataSource->EventDescription->GetValue(); $Event->Attributes = $this->Attributes->GetAsArray(); $datestr = CCFormatDate($DateField, array("yyyy", "mm", "dd")); if (!isset($this->Events[$datestr])) { $this->Events[$datestr] = array(); } $this->Events[$datestr][] = $Event; } } $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow", $this); if (!$this->Visible) { return; } $this->Attributes->Show(); $CalendarBlock = "Calendar " . $this->ComponentName; $ParentPath = $Tpl->block_path; $Tpl->block_path = $ParentPath . "/" . $CalendarBlock; $this->Errors->AddErrors($this->DataSource->Errors); if ($this->Errors->Count()) { $Tpl->replaceblock("", $this->Errors->ToString()); $Tpl->block_path = $ParentPath; return; } else { $month = 0; $this->CurrentProcessingDate = $this->FirstProcessingDate; $this->NextProcessingDate = CCDateAdd($this->CurrentProcessingDate, "1month"); $this->PrevProcessingDate = CCDateAdd($this->CurrentProcessingDate, "-1month"); $Tpl->block_path = $ParentPath . "/" . $CalendarBlock . "/Month"; while ($this->MonthsCount > $month++) { $this->ShowMonth(); if ($this->MonthsCount != $month && $month % $this->MonthsInRow == 0) { $this->Attributes->Show(); $Tpl->SetVar("MonthsInRow", $this->MonthsInRow); $Tpl->block_path = $ParentPath . "/" . $CalendarBlock; $Tpl->ParseTo("MonthsRowSeparator", true, "Month"); $Tpl->block_path = $ParentPath . "/" . $CalendarBlock . "/Month"; } $Tpl->SetBlockVar("Week", ""); $Tpl->SetBlockVar("Week/Day", ""); $this->ProcessNextDate(CCDateAdd($this->NextProcessingDate, "+1month")); } $this->CurrentProcessingDate = $this->FirstProcessingDate; $this->NextProcessingDate = CCDateAdd($this->CurrentProcessingDate, "1month"); $this->PrevProcessingDate = CCDateAdd($this->CurrentProcessingDate, "-1month"); $Tpl->SetVar("MonthsInRow", $this->MonthsInRow); $Tpl->block_path = $ParentPath . "/" . $CalendarBlock; $this->Navigator->CurrentDate = $this->CurrentDate; $this->Navigator->PrevProcessingDate = $this->PrevProcessingDate; $this->Navigator->NextProcessingDate = $this->NextProcessingDate; $this->Navigator->Show(); $Tpl->Parse(); } $Tpl->block_path = $ParentPath; }