예제 #1
0
 /**
  * Export the date value in MySQL format
  * @return string YYYY-MM-DD HH:II:SS
  */
 function exportValue(&$submitValues, $assoc = false)
 {
     $values = parent::getValue();
     $y = $values['Y'][0];
     $m = $values['F'][0];
     $d = $values['d'][0];
     $m = $m < 10 ? '0' . $m : $m;
     $d = $d < 10 ? '0' . $d : $d;
     $datetime = $y . '-' . $m . '-' . $d;
     $result[$this->getName()] = $datetime;
     return $result;
 }
예제 #2
0
 /**
  * Export the date value in MySQL format
  * @return string YYYY-MM-DD HH:II:SS
  */
 public function exportValue(&$submitValues, $assoc = false)
 {
     $values = parent::getValue();
     $y = $values['Y'][0];
     $m = $values['F'][0];
     $d = $values['d'][0];
     $h = $values['H'][0];
     $i = $values['i'][0];
     $m = $m < 10 ? '0' . $m : $m;
     $d = $d < 10 ? '0' . $d : $d;
     $h = $h < 10 ? '0' . $h : $h;
     $i = $i < 10 ? '0' . $i : $i;
     $datetime = $y . '-' . $m . '-' . $d . ' ' . $h . ':' . $i . ':00';
     $result[$this->getName()] = $datetime;
     return $result;
 }
예제 #3
0
파일: jdate.php 프로젝트: demental/m
 function toHtml()
 {
     return '<div class="jcalendar-selects">' . parent::toHtml() . '</div>';
 }
예제 #4
0
파일: Form.php 프로젝트: radicaldesigns/amp
 function render_date_options($field_def)
 {
     if (!(isset($field_def['options']) && is_array($field_def['options']))) {
         $field_def['options'] = array();
     }
     $date_options = array_merge($this->_default_date_options, $field_def['options']);
     require_once 'HTML/QuickForm/date.php';
     $date_renderer = new HTML_QuickForm_date();
     $locale = $date_renderer->_locale[$date_options['language']];
     for ($i = 0, $length = strlen($date_options['format']); $i < $length; $i++) {
         $sign = $date_options['format'][$i];
         $options = array();
         switch ($sign) {
             case 'D':
                 // Sunday is 0 like with 'w' in date()
                 $options = $locale['weekdays_short'];
                 break;
             case 'l':
                 $options = $locale['weekdays_long'];
                 break;
             case 'd':
                 $options = $date_renderer->_createOptionList(1, 31);
                 break;
             case 'M':
                 $options = $locale['months_short'];
                 array_unshift($options, '');
                 unset($options[0]);
                 break;
             case 'm':
                 $options = $date_renderer->_createOptionList(1, 12);
                 break;
             case 'F':
                 $options = $locale['months_long'];
                 array_unshift($options, '');
                 unset($options[0]);
                 break;
             case 'Y':
                 $options = $date_renderer->_createOptionList($date_options['minYear'], $date_options['maxYear'], $date_options['minYear'] > $date_options['maxYear'] ? -1 : 1);
                 break;
             case 'y':
                 $options = $date_renderer->_createOptionList($date_options['minYear'], $date_options['maxYear'], $date_options['minYear'] > $date_options['maxYear'] ? -1 : 1);
                 array_walk($options, create_function('&$v,$k', '$v = substr($v,-2);'));
                 break;
             case 'h':
                 $options = $date_renderer->_createOptionList(1, 12);
                 break;
             case 'H':
                 $options = $date_renderer->_createOptionList(0, 23);
                 break;
             case 'i':
                 $options = $date_renderer->_createOptionList(0, 59, $date_options['optionIncrement']['i']);
                 break;
             case 's':
                 $options = $date_renderer->_createOptionList(0, 59, $date_options['optionIncrement']['s']);
                 break;
             case 'a':
                 $options = array('am' => 'am', 'pm' => 'pm');
                 break;
             case 'A':
                 $options = array('AM' => 'AM', 'PM' => 'PM');
                 break;
             default:
                 break;
         }
         if (empty($options)) {
             continue;
         }
         $date_options['selects'][$sign] = $options;
     }
     return $date_options;
 }
예제 #5
0
파일: QuickFormEx.php 프로젝트: uisluu/emst
    function toHtml()
    {
        $this->_options['maxYear'] = 2200;
        if (!defined('HTML_QUICKFORM_DATEEX_EXISTS')) {
            $js = <<<EOS
<script language="JavaScript" src="../scripts/AnchorPosition.js"></script>
<script language="JavaScript" src="../scripts/PopupWindow.js"></script>
<script language="JavaScript" src="../scripts/date.js"></script>
<script language="JavaScript" src="../scripts/CalendarPopup.js"></script>
<div id="dateexplaceholder" name="dateexplaceholder"   style="position:absolute;visibility:hidden;background-color:white;layer-background-color:white; z-index:1">1</DIV>
<DIV name="dateexplaceholder2" id="dateexplaceholder2" style='position:absolute; width:12pt; height:12pt; z-index:1; visibility:hidden'>1</DIV>

<IFRAME
    name="dateexplaceholder"
    id="dateexplaceholder"
    style="position:absolute; z-index:1; visibility:hidden; border-style:none; background-color:white; layer-background-color:white; overflow:visible"
    marginheight="0"
    marginwidth="0"
    frameborder="0"
    src="display.html"
    width=100%
    height=100%
>
<DIV ID="dateexplaceholder" STYLE="position:absolute;visibility:hidden;background-color:white;layer-background-color:white;"></DIV>
</IFRAME>


<script language="JavaScript">
    document.writeln(getCalendarStyles());

    function PopupDateEx(AnchorName, FieldName, EnableClear, AddDays, ARetFunc)
    {
        var cal = new CalendarPopup("dateexplaceholder");
//        var cal = new CalendarPopup();
        cal.setReturnFunction(ARetFunc);
        cal.setMonthNames("Январь","Февраль","Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь");
        cal.setMonthAbbreviations("Янв","Фев","Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек");
        cal.setDayHeaders("Вс","Пн","Вт","Ср","Чт","Пт","Сб");
        cal.setWeekStartDay(1);
        cal.showNavigationDropdowns();
        cal.setYearSelectStartOffset(100);
        cal.showYearNavigation();
        cal.showYearNavigationInput();
        cal.setTodayText("Сегодня");
        cal.setEnableClear(EnableClear);
        cal.setClearText("Пусто");
        cal.setAddDays(AddDays);
        var y = parseInt(document.forms[0][FieldName+"[Y]"].value);
        var m = parseInt(document.forms[0][FieldName+"[M]"].value);
        var d = parseInt(document.forms[0][FieldName+"[d]"].value);
        if ( isNaN(y) || isNaN(m) || isNaN(d) )
            cal.currentDate=null;
        else
            cal.currentDate=new Date(y,m-1,d,0,0,0);

        cal.autoHide();
        cal.showCalendar(AnchorName);
        return false;
    }
</script>
EOS;
        } else {
            $js = '';
        }
        $vName = $this->_name;
        $vAnchorName = 'Anchor_' . $vName;
        $vRetFunctionName = 'OnSet_' . $vName;
        $vEnableClear = @$this->_options['addEmptyOption'] ? 'true' : 'false';
        $vAddDays = @$this->_options['addDays'];
        if (!is_int($vAddDays)) {
            $vAddDays = 0;
        }
        $vRetFunction = <<<EOS
<script language="JavaScript">
function {$vRetFunctionName}(y,m,d)
{
//        document.forms[0]["{$vName}[Y]"].selectedIndex=y;
//        document.forms[0]["{$vName}[M]"].selectedIndex=m-1;
//        document.forms[0]["{$vName}[d]"].selectedIndex=d-1;
        document.forms[0]["{$vName}[Y]"].value=y;
        document.forms[0]["{$vName}[M]"].value=m;
        document.forms[0]["{$vName}[d]"].value=d;
}
</script>
EOS;
        return $js . $vRetFunction . parent::toHtml() . '<a name="' . $vAnchorName . '" id="' . $vAnchorName . '">' . '<button onclick="return PopupDateEx(\'' . $vAnchorName . '\', \'' . $vName . '\', ' . $vEnableClear . ', ' . $vAddDays . ', \'' . $vRetFunctionName . '\')" style="height:20px">' . '<img    onclick="return PopupDateEx(\'' . $vAnchorName . '\', \'' . $vName . '\', ' . $vEnableClear . ', ' . $vAddDays . ', \'' . $vRetFunctionName . '\')" src="../images/popupCalendar.gif">' . '</button>';
    }