![]()
|
|
PHP Source code |
1 |
require_once(WCF_DIR.'lib/page/util/InlineCalendar.class.php');
|
|
|
PHP Source code |
1 |
InlineCalendar::assignVariables();
|
(Hab mich am UserEditForm orientiert).
This post has been edited 1 times, last edit by "dominik4545" (Jul 16th 2012, 11:06am)
|
|
HTML |
1 2 |
<a id="fooButton"><img src="{icon}datePickerOptionsM.png{/icon}" alt="" /></a> <div id="fooCalendar" class="inlineCalendar"></div> |
|
|
Javascript source code |
1 |
calendar.init('foo');
|


This post has been edited 1 times, last edit by "dominik4545" (Jul 18th 2012, 2:05pm)
Während der Winterzeit nur eine Stunde
Quoted
Das heißt, dass ich da 2 Stunden drauf rechnen muss?
|
|
PHP Source code |
1 2 3 4 5 6 7 8 |
$this->timeNow = TIME_NOW;
$timeOffset = 3600 * TIMEZONE;
// check summer time status
if (defined('ENABLE_DAYLIGHT_SAVING_TIME')) {
if(ENABLE_DAYLIGHT_SAVING_TIME && @date('I', TIME_NOW+$timeOffset) == 1) {
$timeOffset += 3600;
}
}
|
Warum verwendet ihr nicht die Datumsfunktionen vom WCF?

Alternativ kann man die Zeitzone des Servers richtig einstellen …
|
|
Source code |
1 2 |
require_once(WCF_DIR.'lib/form/AbstractForm.class.php'); require_once(WCF_DIR.'lib/page/util/InlineCalendar.class.php'); |
|
|
HTML |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
{include file="documentHeader"}
<head>
<title>{lang}wcf.cashman.title{/lang} - {PAGE_TITLE}</title>
{include file='headInclude' sandbox=false}
<script src="{@RELATIVE_WCF_DIR}js/Calendar.class.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var calendar = new Calendar('{$monthList}', '{$weekdayList}', {@$startOfWeek});
//]]>
</script>
</head>
<body{if $templateName|isset} id="tpl{$templateName|ucfirst}"{/if}>
{include file='header' sandbox=false}
<div id="main">
<form enctype="multipart/form-data" method="post" action="index.php?form=CashmanCreateNewEvent">
<div class="border content">
<div class="container-1">
<fieldset>
<legend>{lang}wcf.cashman.dateselect.newevent{/lang}</legend>
<div class="floatedElement floatedElementContainer">
<div class="floatedElement">
<label for="fromDay">{lang}wcf.global.date.day{/lang}</label>
{htmlOptions options=$dayOptions selected=$eventDate->day id=fromDay name=fromDay}
</div>
<div class="floatedElement">
<label for="fromMonth">{lang}wcf.global.date.month{/lang}</label>
{htmlOptions options=$monthOptions selected=$eventDate->month id=fromMonth name=fromMonth}
</div>
<div class="floatedElement">
<label for="fromYear">{lang}wcf.global.date.year{/lang}</label>
<input id="fromYear" class="inputText fourDigitInput" type="text" name="fromYear" value="{@$eventDate->fromYear}" maxlength="4" />
</div>
<div class="floatedElement">
<a id="fromButton"><img src="{icon}datePickerOptionsM.png{/icon}" alt="" /></a>
<div id="newEvent" class="inlineCalendar"></div>
<script type="text/javascript">
//<![CDATA[
calendar.init('from');
//]]>
</script>
</div>
</fieldset>
</div>
</div>
<div class="formSubmit">
<input accesskey="s" type="submit" value="{lang}wcf.global.button.submit{/lang}" />
</div>
</form>
</div>
{include file='footer' sandbox=false}
</body>
</html>
|
|
|
HTML |
1 2 3 4 5 6 7 |
{* import calendar *}
<script src="{@RELATIVE_WCF_DIR}js/Calendar.class.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var calendar = new Calendar('{$monthList}', '{$weekdayList}', {@$startOfWeek});
//]]>
</script
|
|
|
HTML |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
<div class="formElement{if $errorField == 'resigned'} formError{/if}"> <div class="formFieldLabel"> <label for="resigned">{lang}net.auracher.guildmanagement.memberDetails.generalInformation.resigned{/lang}</label> </div> <div class="formField"> <div class="floatedElement"> <label for="resignedDay">{lang}wcf.global.date.day{/lang}</label> {htmlOptions options=$dayOptions selected=$resignedDay id=resignedDay name=resignedDay} </div> <div class="floatedElement"> <label for="resignedMonth">{lang}wcf.global.date.month{/lang}</label> {htmlOptions options=$monthOptions selected=$resignedMonth id=resignedMonth name=resignedMonth} </div> <div class="floatedElement"> <label for="resignedYear">{lang}wcf.global.date.year{/lang}</label> <input id="resignedYear" class="inputText fourDigitInput" type="text" name="resignedYear" value="{@$resignedYear}" maxlength="4" /> </div> <div class="floatedElement"> <a id="resignedButton"><img src="{icon}datePickerOptionsM.png{/icon}" alt="" /></a> <div id="resignedCalendar" class="inlineCalendar"></div> <script type="text/javascript"> //<![CDATA[ calendar.init('resigned'); //]]> </script> </div> </div> {if $errorField == 'resigned'} {if $errorType == 'invalidDate'}<p class="innerError">{lang}net.auracher.guildmanagement.error.invalidDate{/lang}</p>{/if} {if $errorType == 'dateInFuture'}<p class="innerError">{lang}net.auracher.guildmanagement.error.dateInFuture{/lang}</p>{/if} {if $errorType == 'dateBeforeJoined'}<p class="innerError">{lang}net.auracher.guildmanagement.error.dateBeforeJoined{/lang}</p>{/if} {/if} </div> |
|
|
PHP Source code |
1 |
require_once(WCF_DIR.'lib/page/util/InlineCalendar.class.php');
|
|
|
PHP Source code |
1 2 |
// assign calendar-variables
InlineCalendar::assignVariables();
|
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
// validate resigned-date
if(isset($_REQUEST['resignedDay']) && isset($_REQUEST['resignedMonth']) && isset($_REQUEST['resignedYear'])){
if(intval($_REQUEST['resignedDay']) > 0 && intval($_REQUEST['resignedMonth']) > 0 && intval($_REQUEST['resignedYear']) > 0){
try {
$d = gmmktime(null,null,null,intval($_REQUEST['resignedMonth']),intval($_REQUEST['resignedDay']),intval($_REQUEST['resignedYear']));
$this->resigned = new DateTime("@$d");
} catch (Exception $e) {
$this->resigned = null;
throw new UserInputException('resigned', 'invalidDate');
}
if($this->resigned != null){
if($this->resigned > new DateTime()){
throw new UserInputException('resigned', 'dateInFuture');
}
}
} else {
$this->resigned = null;
}
} else if(!isset($_REQUEST['resignedDay']) && !isset($_REQUEST['resignedMonth']) && !isset($_REQUEST['resignedYear'])){
$this->resigned = null;
} else {
throw new UserInputException('resigned', 'invalidDate');
}
|
|
|
Source code |
1 |
Object of class DateTime could not be converted to string |
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
/**
* @see Form::validate()
*/
public function validate() {
parent::validate();
// validate date settings
if(isset($_REQUEST['neweventDay']) && isset($_REQUEST['neweventMonth']) && isset($_REQUEST['neweventYear'])){
if(intval($_REQUEST['neweventDay']) > 0 && intval($_REQUEST['neweventMonth']) > 0 && intval($_REQUEST['neweventYear']) > 0){
try {
$d = gmmktime(null,null,null,intval($_REQUEST['neweventMonth']),intval($_REQUEST['neweventDay']),intval($_REQUEST['neweventYear']));
$this->eventDate = new DateTime("@$d");
} catch (Exception $e) {
$this->eventDate = null;
throw new UserInputException('newevent', 'invalidDate');
}
if($this->eventDate != null){
if($this->eventDate > new DateTime()){
throw new UserInputException('newevent', 'dateInFuture');
}
}
} else {
$this->eventDate = null;
}
} else if(!isset($_REQUEST['neweventDay']) && !isset($_REQUEST['neweventMonth']) && !isset($_REQUEST['neweventYear'])){
$this->eventDate = null;
} else {
throw new UserInputException('newevent', 'invalidDate');
}
}
|
|
|
PHP Source code |
1 |
$this->date->format('Y-m-d')
|
|
|
PHP Source code |
1 |
$this->date->format('Y-m-d H:i:s') // "2012-08-02 11:22:23" purzelt als String raus.
|
|
|
PHP Source code |
1 |
$query = 'INSERT INTO `wcf'.WCF_N.'_tablexyz` (`m_joined`) VALUES (\''.$this->joined->format('Y-m-d').'\');';
|

Forum Software: Burning Board® 3.1.7, developed by WoltLab® GmbH