Ejemplo n.º 1
0
 function clsCalendarresult_users($RelativePath, &$Parent)
 {
     global $CCSLocales;
     global $DefaultDateFormat;
     global $FileName;
     global $Redirect;
     $this->ComponentName = "result_users";
     $this->Type = "1";
     $this->Visible = True;
     $this->RelativePath = $RelativePath;
     $this->Parent =& $Parent;
     $this->Errors = new clsErrors();
     $CCSForm = CCGetFromGet("ccsForm", "");
     if ($CCSForm == $this->ComponentName) {
         $Redirect = FileName . "?" . CCGetQueryString("All", array("ccsForm"));
         $this->Visible = false;
         return;
     }
     $this->Attributes = new clsAttributes($this->ComponentName . ":");
     $this->DataSource = new clsresult_usersDataSource($this);
     $this->ds =& $this->DataSource;
     $this->FirstWeekDay = $CCSLocales->GetFormatInfo("FirstWeekDay");
     $this->MonthsInRow = 1;
     $this->MonthsCount = 1;
     $this->DayOfWeek = new clsControl(ccsLabel, "DayOfWeek", "DayOfWeek", ccsDate, array("dddd"), CCGetRequestParam("DayOfWeek", ccsGet, NULL), $this);
     $this->DayNumber = new clsControl(ccsLabel, "DayNumber", "DayNumber", ccsDate, array("d"), CCGetRequestParam("DayNumber", ccsGet, NULL), $this);
     $this->EventTime = new clsControl(ccsLabel, "EventTime", "EventTime", ccsDate, array("h", ":", "nn", " ", "AM/PM"), CCGetRequestParam("EventTime", ccsGet, NULL), $this);
     $this->EventDescription = new clsControl(ccsLabel, "EventDescription", "EventDescription", ccsText, "", CCGetRequestParam("EventDescription", ccsGet, NULL), $this);
     $this->EventDescription->HTML = true;
     $this->Navigator = new clsCalendarNavigator($this->ComponentName, "Navigator", $this->Type, 10, $this);
     $this->Now = CCGetDateArray();
     $this->CalendarStyles["WeekdayName"] = "";
     $this->CalendarStyles["WeekendName"] = "";
     $this->CalendarStyles["Day"] = "";
     $this->CalendarStyles["Weekend"] = "";
     $this->CalendarStyles["Today"] = "";
     $this->CalendarStyles["WeekendToday"] = "";
     $this->CalendarStyles["OtherMonthDay"] = "";
     $this->CalendarStyles["OtherMonthToday"] = "";
     $this->CalendarStyles["OtherMonthWeekend"] = "";
     $this->CalendarStyles["OtherMonthWeekendToday"] = "";
 }
Ejemplo n.º 2
0
function CCFormatDate($DateToFormat, $FormatMask)
{
    global $CCSLocales;
    if (!is_array($DateToFormat) && strlen($DateToFormat)) {
        $DateToFormat = CCGetDateArray($DateToFormat);
    }
    if (is_array($FormatMask) && is_array($DateToFormat)) {
        $WeekdayNames = $CCSLocales->GetFormatInfo("WeekdayNames");
        $WeekdayShortNames = $CCSLocales->GetFormatInfo("WeekdayShortNames");
        $WeekdayNarrowNames = $CCSLocales->GetFormatInfo("WeekdayNarrowNames");
        $MonthNames = $CCSLocales->GetFormatInfo("MonthNames");
        $MonthShortNames = $CCSLocales->GetFormatInfo("MonthShortNames");
        $FormattedDate = "";
        for ($i = 0; $i < sizeof($FormatMask); $i++) {
            switch ($FormatMask[$i]) {
                case "GeneralDate":
                    $FormattedDate .= CCFormatDate($DateToFormat, $CCSLocales->GetFormatInfo("GeneralDate"));
                    break;
                case "LongDate":
                    $FormattedDate .= CCFormatDate($DateToFormat, $CCSLocales->GetFormatInfo("LongDate"));
                    break;
                case "ShortDate":
                    $FormattedDate .= CCFormatDate($DateToFormat, $CCSLocales->GetFormatInfo("ShortDate"));
                    break;
                case "LongTime":
                    $FormattedDate .= CCFormatDate($DateToFormat, $CCSLocales->GetFormatInfo("LongTime"));
                    break;
                case "ShortTime":
                    $FormattedDate .= CCFormatDate($DateToFormat, $CCSLocales->GetFormatInfo("ShortTime"));
                    break;
                case "d":
                    $FormattedDate .= $DateToFormat[ccsDay];
                    break;
                case "dd":
                    $FormattedDate .= sprintf("%02d", $DateToFormat[ccsDay]);
                    break;
                case "ddd":
                    $FormattedDate .= $WeekdayShortNames[CCDayOfWeek($DateToFormat) - 1];
                    break;
                case "dddd":
                    $FormattedDate .= $WeekdayNames[CCDayOfWeek($DateToFormat) - 1];
                    break;
                case "wi":
                    $FormattedDate .= $WeekdayNarrowNames[CCDayOfWeek($DateToFormat) - 1];
                    break;
                case "w":
                    $FormattedDate .= CCDayOfWeek($DateToFormat);
                    break;
                case "ww":
                    $FormattedDate .= ceil((7 + date("z", $DateToFormat[ccsTimestamp]) - date("w", $DateToFormat[ccsTimestamp])) / 7);
                    break;
                case "m":
                    $FormattedDate .= $DateToFormat[ccsMonth];
                    break;
                case "mm":
                    $FormattedDate .= sprintf("%02d", $DateToFormat[ccsMonth]);
                    break;
                case "mmm":
                    $FormattedDate .= $MonthShortNames[$DateToFormat[ccsMonth] - 1];
                    break;
                case "mmmm":
                    $FormattedDate .= $MonthNames[$DateToFormat[ccsMonth] - 1];
                    break;
                case "q":
                    $FormattedDate .= ceil($DateToFormat[ccsMonth] / 3);
                    break;
                case "y":
                    $FormattedDate .= CCDayOfYear($DateToFormat);
                    break;
                case "yy":
                    $FormattedDate .= substr($DateToFormat[ccsYear], 2);
                    break;
                case "yyyy":
                    $FormattedDate .= sprintf("%04d", $DateToFormat[ccsYear]);
                    break;
                case "h":
                    $FormattedDate .= $DateToFormat[ccsHour] % 12 == 0 ? 12 : $DateToFormat[ccsHour] % 12;
                    break;
                case "hh":
                    $FormattedDate .= sprintf("%02d", $DateToFormat[ccsHour] % 12 == 0 ? 12 : $DateToFormat[ccsHour] % 12);
                    break;
                case "H":
                    $FormattedDate .= $DateToFormat[ccsHour];
                    break;
                case "HH":
                    $FormattedDate .= sprintf("%02d", $DateToFormat[ccsHour]);
                    break;
                case "n":
                    $FormattedDate .= $DateToFormat[ccsMinute];
                    break;
                case "nn":
                    $FormattedDate .= sprintf("%02d", $DateToFormat[ccsMinute]);
                    break;
                case "s":
                    $FormattedDate .= $DateToFormat[ccsSecond];
                    break;
                case "ss":
                    $FormattedDate .= sprintf("%02d", $DateToFormat[ccsSecond]);
                    break;
                case "S":
                    $FormattedDate .= $DateToFormat[ccsMilliSecond] + 0;
                    break;
                case "AM/PM":
                case "A/P":
                    $FormattedDate .= $DateToFormat[ccsHour] < 12 ? "AM" : "PM";
                    break;
                case "am/pm":
                case "a/p":
                    $FormattedDate .= $DateToFormat[ccsHour] < 12 ? "am" : "pm";
                    break;
                case "tt":
                    $FormattedDate .= $DateToFormat[ccsHour] < 12 ? $CCSLocales->GetFormatInfo("AMDesignator") : $CCSLocales->GetFormatInfo("PMDesignator");
                    break;
                case "GMT":
                    if (strlen($DateToFormat[ccsGMT])) {
                        $GMT = intval($DateToFormat[ccsGMT]);
                    } else {
                        $GMT = intval(date("Z", $DateToFormat[ccsTimestamp]) / (60 * 60));
                    }
                    $GMT = sprintf("%02d", $GMT);
                    $GMT = $GMT > 0 ? "+" . $GMT : $GMT;
                    $FormattedDate .= $GMT;
                    break;
                default:
                    $FormattedDate .= $FormatMask[$i];
                    break;
            }
        }
    } else {
        $FormattedDate = "";
    }
    return $FormattedDate;
}
Ejemplo n.º 3
0
function CCFormatDate($DateToFormat, $FormatMask)
{
    global $ShortWeekdays;
    global $Weekdays;
    global $ShortMonths;
    global $Months;
    if (!is_array($DateToFormat) && strlen($DateToFormat)) {
        $DateToFormat = CCGetDateArray($DateToFormat);
    }
    if (is_array($FormatMask) && is_array($DateToFormat)) {
        $masks = array("GeneralDate" => "n/j/y, h:i:s A", "LongDate" => "l, F j, Y", "ShortDate" => "n/j/y", "LongTime" => "g:i:s A", "ShortTime" => "H:i", "d" => "j", "dd" => "d", "m" => "n", "mm" => "m", "h" => "g", "hh" => "h", "H" => "G", "HH" => "H", "nn" => "i", "ss" => "s", "AM/PM" => "A", "am/pm" => "a");
        $FormatedDate = "";
        for ($i = 0; $i < sizeof($FormatMask); $i++) {
            if (isset($masks[$FormatMask[$i]])) {
                $FormatedDate .= date($masks[$FormatMask[$i]], $DateToFormat[ccsTimestamp]);
            } else {
                switch ($FormatMask[$i]) {
                    case "yy":
                        $FormatedDate .= substr($DateToFormat[ccsYear], 2);
                        break;
                    case "yyyy":
                        $FormatedDate .= $DateToFormat[ccsYear];
                        break;
                    case "ddd":
                        $FormatedDate .= $ShortWeekdays[date("w", $DateToFormat[ccsTimestamp])];
                        break;
                    case "dddd":
                        $FormatedDate .= $Weekdays[date("w", $DateToFormat[ccsTimestamp])];
                        break;
                    case "w":
                        $FormatedDate .= date("w", $DateToFormat[ccsTimestamp]) + 1;
                        break;
                    case "ww":
                        $FormatedDate .= ceil((6 + date("z", $DateToFormat[ccsTimestamp]) - date("w", $DateToFormat[ccsTimestamp])) / 7);
                        break;
                    case "mmm":
                        $FormatedDate .= $ShortMonths[date("n", $DateToFormat[ccsTimestamp]) - 1];
                        break;
                    case "mmmm":
                        $FormatedDate .= $Months[date("n", $DateToFormat[ccsTimestamp]) - 1];
                        break;
                    case "q":
                        $FormatedDate .= ceil(date("n", $DateToFormat[ccsTimestamp]) / 3);
                        break;
                    case "y":
                        $FormatedDate .= date("z", $DateToFormat[ccsTimestamp]) + 1;
                        break;
                    case "n":
                        $FormatedDate .= intval(date("i", $DateToFormat[ccsTimestamp]));
                        break;
                    case "s":
                        $FormatedDate .= intval(date("s", $DateToFormat[ccsTimestamp]));
                        break;
                    case "A/P":
                        $am = date("A", $DateToFormat[ccsTimestamp]);
                        $FormatedDate .= $am[0];
                        break;
                    case "a/p":
                        $am = date("a", $DateToFormat[ccsTimestamp]);
                        $FormatedDate .= $am[0];
                        break;
                    case "GMT":
                        $gmt = date("Z", $DateToFormat[ccsTimestamp]) / (60 * 60);
                        if ($gmt >= 0) {
                            $gmt = "+" . $gmt;
                        }
                        $FormatedDate .= $gmt;
                        break;
                    default:
                        $FormatedDate .= $FormatMask[$i];
                        break;
                }
            }
        }
    } else {
        $FormatedDate = "";
    }
    return $FormatedDate;
}