本文整理汇总了PHP中get_datepicker_date_format函数的典型用法代码示例。如果您正苦于以下问题:PHP get_datepicker_date_format函数的具体用法?PHP get_datepicker_date_format怎么用?PHP get_datepicker_date_format使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_datepicker_date_format函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateWhereClausePart
/**
* This method generates the where clause part.
* @param string $fieldName
* @param string $value
* @return string
*/
public function generateWhereClausePart($fieldName, $dateRanges)
{
$fromDate = "1970-01-01";
$toDate = date("Y-m-d");
$inputDatePattern = sfContext::getInstance()->getUser()->getDateFormat();
$datepickerDateFormat = get_datepicker_date_format($inputDatePattern);
if ($dateRanges["from"] != $datepickerDateFormat && $dateRanges["to"] != $datepickerDateFormat) {
if ($dateRanges["to"] != "") {
$toDate = $dateRanges["to"];
}
if ($dateRanges["from"] != "") {
$fromDate = $dateRanges["from"];
}
} else {
if ($dateRanges["from"] == $datepickerDateFormat && $dateRanges["to"] != $datepickerDateFormat) {
if ($dateRanges["to"] != "") {
$toDate = $dateRanges["to"];
}
} else {
if ($dateRanges["from"] != $datepickerDateFormat && $dateRanges["to"] == $datepickerDateFormat) {
if ($dateRanges["from"] != "") {
$fromDate = $dateRanges["from"];
}
}
}
}
return "( " . $fieldName . " " . $this->getWhereClauseCondition() . " '" . $fromDate . "' AND '" . $toDate . "' )";
}
示例2: setStaticColumns
public function setStaticColumns($formValues)
{
$staticColumns["fromDate"] = "";
$staticColumns["toDate"] = "";
$inputDatePattern = sfContext::getInstance()->getUser()->getDateFormat();
$datepickerDateFormat = get_datepicker_date_format($inputDatePattern);
if ($formValues["project_date_range"]["from"] != $datepickerDateFormat && $formValues["project_date_range"]["to"] != $datepickerDateFormat) {
if ($formValues["project_date_range"]["from"] != '') {
$staticColumns["fromDate"] = $formValues["project_date_range"]["from"];
}
if ($formValues["project_date_range"]["to"] != '') {
$staticColumns["toDate"] = $formValues["project_date_range"]["to"];
}
} else {
if ($formValues["project_date_range"]["from"] != $datepickerDateFormat && $formValues["project_date_range"]["to"] == $datepickerDateFormat) {
if ($formValues["project_date_range"]["from"] != '') {
$staticColumns["fromDate"] = $formValues["project_date_range"]["from"];
}
} else {
if ($formValues["project_date_range"]["from"] == $datepickerDateFormat && $formValues["project_date_range"]["to"] != $datepickerDateFormat) {
if ($formValues["project_date_range"]["to"] != '') {
$staticColumns["toDate"] = $formValues["project_date_range"]["to"];
}
}
}
}
$staticColumns["projectId"] = $formValues["project_name"];
if ($formValues["only_include_approved_timesheets"] == "on") {
$staticColumns["onlyIncludeApprovedTimesheets"] = "on";
} else {
$staticColumns["onlyIncludeApprovedTimesheets"] = "off";
}
return $staticColumns;
}
示例3: doClean
/**
* @see sfValidatorBase
*/
protected function doClean($value)
{
$trimmedValue = trim($value);
$pattern = $this->getOption('date_format');
if (empty($pattern)) {
$pattern = sfContext::getInstance()->getUser()->getDateFormat();
}
$required = $this->getOption('required');
$isDefaultValue = strcasecmp(str_replace('yyyy', 'yy', $trimmedValue), get_datepicker_date_format($pattern)) == 0;
if ($trimmedValue == '' || $isDefaultValue) {
if (!$required) {
// If not required and empty or the format pattern, return valid
return null;
} else {
throw new sfValidatorError($this, 'required');
}
}
$localizationService = new LocalizationService();
$result = $localizationService->convertPHPFormatDateToISOFormatDate($pattern, $trimmedValue);
$valid = $result == "Invalid date" ? false : true;
if (!$valid) {
throw new sfValidatorError($this, 'bad_format', array('value' => $value, 'date_format' => $this->getOption('date_format_error') ? $this->getOption('date_format_error') : get_datepicker_date_format($pattern)));
}
return $result;
}
示例4: doClean
/**
* @see sfValidatorBase
*/
protected function doClean($value)
{
$from = $value["from"];
$to = $value["to"];
$inputDatePattern = sfContext::getInstance()->getUser()->getDateFormat();
$datepickerDateFormat = get_datepicker_date_format($inputDatePattern);
if ($from != $datepickerDateFormat && $to != $datepickerDateFormat) {
try {
$value["from"] = parent::doClean($value["from"]);
} catch (Exception $exc) {
try {
$value["to"] = parent::doClean($value["to"]);
} catch (Exception $exc) {
$this->setMessage('invalid', 'Insert valid "from" and "to" date');
$this->setMessage("bad_format", "From date and To date values do not match the date format " . $datepickerDateFormat);
throw $exc;
}
$this->setMessage('invalid', 'Insert a valid "from" date');
throw $exc;
}
try {
$value["to"] = parent::doClean($value["to"]);
} catch (Exception $exc) {
$this->setMessage('invalid', 'Insert a valid "to" date');
throw $exc;
}
} else {
if ($from == $datepickerDateFormat && $to != $datepickerDateFormat) {
if ($to != "") {
$value["to"] = parent::doClean($value["to"]);
$this->setMessage('invalid', 'Insert a valid "to" date');
$this->setMessage("bad_format", "To date value does not match the date format " . $datepickerDateFormat);
}
} else {
if ($from != $datepickerDateFormat && $to == $datepickerDateFormat) {
if ($from != "") {
$value["from"] = parent::doClean($value["from"]);
$this->setMessage('invalid', 'Insert a valid "from" date');
$this->setMessage("bad_format", "From date value does not match the date format " . $datepickerDateFormat);
}
} else {
if ($from == $datepickerDateFormat && $to == $datepickerDateFormat) {
return $value;
}
}
}
}
if ($value["from"] != $datepickerDateFormat && $value["to"] != $datepickerDateFormat && $value["from"] != "" && $value["to"] != "") {
$this->setMessage('invalid', 'From date should be before to date.');
$v = new ohrmValidatorSchemaDateRange("project_date_range", sfValidatorSchemaCompare::LESS_THAN_EQUAL, "project_date_range", array('throw_global_error' => true), array('invalid' => $this->getMessage('invalid')));
$v->clean($value);
}
return $value;
}
示例5: configure
protected function configure($options = array(), $messages = array())
{
parent::configure($options, $messages);
$inputDatePattern = sfContext::getInstance()->getUser()->getDateFormat();
$this->addOption('date_format', $inputDatePattern);
$this->addOption('values', array('from', 'to'));
$this->addMessage('value1_required', __(ValidationMessages::REQUIRED));
$this->addMessage('value2_required', __(ValidationMessages::REQUIRED));
$this->addMessage('value1_value2_required', __(ValidationMessages::REQUIRED));
$this->addMessage('value1_greater_than_value2', __('Should be greater than first value'));
$this->addMessage('value1_invalid', ValidationMessages::DATE_FORMAT_INVALID);
$this->addMessage('value2_invalid', ValidationMessages::DATE_FORMAT_INVALID);
$this->addMessage('value1_and_value2_invalid', ValidationMessages::DATE_FORMAT_INVALID);
$this->messageArguments['format'] = get_datepicker_date_format($inputDatePattern);
}
示例6: doClean
/**
* @see sfValidatorBase
*/
protected function doClean($value)
{
$date = null;
$valid = false;
$trimmedValue = trim($value);
$pattern = $this->getOption('date_format');
// If not required and empty or the format pattern, return valid.
if (!$this->getOption('required') && ($trimmedValue == '' || strcasecmp(str_replace('yyyy', 'yy', $trimmedValue), get_datepicker_date_format($pattern)) == 0)) {
return null;
}
$localizationService = new LocalizationService();
$result = $localizationService->convertPHPFormatDateToISOFormatDate($pattern, $trimmedValue);
$valid = $result == "Invalid date" ? false : true;
if (!$valid) {
throw new sfValidatorError($this, 'bad_format', array('value' => $value, 'date_format' => $this->getOption('date_format_error') ? $this->getOption('date_format_error') : get_datepicker_date_format($pattern)));
}
return $result;
}
示例7: render
public function render($name, $value = null, $attributes = array(), $errors = array())
{
if (array_key_exists('class', $attributes)) {
$attributes['class'] .= ' ohrm_datepicker';
} else {
$attributes['class'] = 'ohrm_datepicker';
}
$html = parent::render($name, $value, $attributes, $errors);
$html .= $this->renderTag('input', array('type' => 'button', 'id' => "{$this->attributes['id']}_Button", 'class' => 'calendarBtn', 'style' => 'float: none; display: inline; margin-left: 6px;', 'value' => ''));
$javaScript = sprintf(<<<EOF
<script type="text/javascript">
var datepickerDateFormat = '%s';
var displayDateFormat = datepickerDateFormat.replace('yy', 'yyyy');
\$(document).ready(function(){
var rDate = trim(\$("#%s").val());
if (rDate == '') {
\$("#%s").val(displayDateFormat);
}
//Bind date picker
daymarker.bindElement("#%s",
{
onSelect: function(date){
},
dateFormat : datepickerDateFormat,
onClose: function(){
\$(this).valid();
}
});
\$('#%s_Button').click(function(){
daymarker.show("#%s");
});
});
</script>
EOF
, get_datepicker_date_format(sfContext::getInstance()->getUser()->getDateFormat()), $this->attributes['id'], $this->attributes['id'], $this->attributes['id'], $this->attributes['id'], $this->attributes['id']);
return $html . $javaScript;
}
示例8: get_datepicker_date_format
</div>
</div>
<script type="text/javascript">
var datepickerDateFormat = '<?php
echo get_datepicker_date_format($sf_user->getDateFormat());
?>
';
var displayDateFormat = '<?php
echo str_replace('yy', 'yyyy', get_datepicker_date_format($sf_user->getDateFormat()));
?>
';
var errorForInvalidFormat='<?php
echo __(ValidationMessages::DATE_FORMAT_INVALID, array('%format%' => str_replace('yy', 'yyyy', get_datepicker_date_format($sf_user->getDateFormat()))));
?>
';
var errorMsge;
var linkForGetRecords='<?php
echo url_for('attendance/getRelatedAttendanceRecords');
?>
';
var employeeId='<?php
echo $employeeId;
?>
';
var actionRecorder='<?php
echo $actionRecorder;
?>
';
示例9: __
";
var lang_majorMaxLength = "<?php
echo __(ValidationMessages::TEXT_LENGTH_EXCEEDS, array('%amount%' => 100));
?>
";
var lang_gpaMaxLength = "<?php
echo __(ValidationMessages::TEXT_LENGTH_EXCEEDS, array('%amount%' => 25));
?>
";
var lang_yearShouldBeNumber = "<?php
echo __('Should be a number');
?>
";
var datepickerDateFormat = '<?php
echo get_datepicker_date_format($sf_user->getDateFormat());
?>
';
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
var startDate = "";
$(document).ready(function() {
//hide add section
$("#changeEducation").hide();
$("#educationRequiredNote").hide();
//hiding the data table if records are not available
示例10: get_datepicker_date_format
<?php
$inputDatePattern = sfContext::getInstance()->getUser()->getDateFormat();
$datepickerDateFormat = get_datepicker_date_format($inputDatePattern);
?>
<table>
<tr><td style="width: 80px;"><?php
echo " " . __("Project Name") . "";
?>
</td><td><?php
echo $projectName;
?>
</td></tr>
<?php
if (!($projectDateRangeFrom == $datepickerDateFormat || $projectDateRangeFrom == "")) {
?>
<tr><td style="width: 80px;"><?php
echo " " . __("From") . " ";
?>
</td><td><?php
echo set_datepicker_date_format($projectDateRangeFrom);
?>
</td></tr><?php
}
if (!($projectDateRangeTo == $datepickerDateFormat || $projectDateRangeTo == "")) {
?>
<tr><td style="width: 80px;"><?php
echo " " . __("To") . " ";
?>
</td><td><?php
示例11: render
public function render($name, $value = null, $attributes = array(), $errors = array())
{
$values = array_merge(array('from' => '', 'to' => '', 'comparision' => ''), is_array($value) ? $value : array());
$html = strtr($this->translate($this->getOption('template')), array('%comparision%' => $this->getOption($this->attributes['id'] . '_' . 'comparision')->render($name . '[comparision]', $values['comparision'], array('id' => $this->attributes['id'] . '_' . 'comparision')), '%from%' => $this->getOption($this->attributes['id'] . '_' . 'from')->render($name . '[from]', $values['from'], array('id' => $this->attributes['id'] . '_' . 'from')), '%to%' => $this->getOption($this->attributes['id'] . '_' . 'to')->render($name . '[to]', $values['to'], array('id' => $this->attributes['id'] . '_' . 'to'))));
$javaScript = $javaScript = sprintf(<<<EOF
<script type="text/javascript">
\$(document).ready(function() {
var idValue = '%s';
var joinedDateFormat = '%s';
if(\$('#' + idValue + '_comparision').val() == ''){
\$('#' + idValue + '_from').hide().val('');
\$('#' + idValue + '_to').hide().val('');
\$('#' + idValue + '_from_Button').hide();
\$('#' + idValue + '_to_Button').hide();
}
\$('#' + idValue + '_comparision').change(function(){
if(\$('#' + idValue + '_comparision').val() == ''){
\$('#' + idValue + '_from').hide().val('');
\$('#' + idValue + '_from_Button').hide();
\$('#' + idValue + '_to_Button').hide();
\$('#' + idValue + '_to').hide().val('');
}else if(\$('#' + idValue + '_comparision').val() == '1'){
\$('#' + idValue + '_from').show();
\$('#' + idValue + '_to').hide().val('');
\$('#' + idValue + '_from_Button').show().css('display', 'inline');
\$('#' + idValue + '_to_Button').hide();
}else if(\$('#' + idValue + '_comparision').val() == '2'){
\$('#' + idValue + '_from').show();
\$('#' + idValue + '_to').hide().val('');
\$('#' + idValue + '_from_Button').show().css('display', 'inline');
\$('#' + idValue + '_to_Button').hide();
}else if(\$('#' + idValue + '_comparision').val() == '3'){
\$('#' + idValue + '_from').show();
\$('#' + idValue + '_to').show();
\$('#' + idValue + '_from_Button').show().css('display', 'inline');
\$('#' + idValue + '_to_Button').show().css('display', 'inline');
}
if (\$('#' + idValue + '_from').is(":visible")) {
if (\$('#' + idValue + '_from').val() == '') {
\$('#' + idValue + '_from').val(joinedDateFormat);
}
}
if (\$('#' + idValue + '_to').is(":visible")) {
if (\$('#' + idValue + '_to').val() == '') {
\$('#' + idValue + '_to').val(joinedDateFormat);
}
}
});
\$('#' + idValue + '_comparision').trigger('change');
});
</script>
EOF
, $this->attributes['id'], get_datepicker_date_format(sfContext::getInstance()->getUser()->getDateFormat()));
return $html . $javaScript;
}
示例12: getFormValidators
/**
*
* @return array
*/
protected function getFormValidators()
{
$validators = array();
$inputDatePattern = sfContext::getInstance()->getUser()->getDateFormat();
$validators['id'] = new sfValidatorString(array('required' => false));
$validators['recurring'] = new sfValidatorString(array('required' => false));
$validators['description'] = new sfValidatorString(array('required' => true, 'max_length' => 200), array('required' => 'Holiday Name is required', 'max_length' => 'Name of Holiday length exceeded'));
$validators['date'] = new ohrmDateValidator(array('date_format' => $inputDatePattern, 'required' => true), array('required' => 'Date field is required', 'bad_format' => __(ValidationMessages::DATE_FORMAT_INVALID, array('%format%' => get_datepicker_date_format(sfContext::getInstance()->getUser()->getDateFormat())))));
$validators['length'] = new sfValidatorChoice(array('choices' => array_keys($this->getDaysLengthList())));
return $validators;
}
示例13: __
?>
';
var errorForInvalidFormat="<?php
echo __('Should Be a Valid Time in %format% Format', array('%format%' => 'HH:MM'));
?>
";
var errorForInvalidTimeFormat="<?php
echo __('Should Be a Valid Time in %format% Format', array('%format%' => 'HH:MM'));
?>
";
var getCurrentTimeLink='<?php
echo url_for('attendance/getCurrentTime');
?>
';
var errorForInvalidDateFormat='<?php
echo __('Should Be a Valid Date in %format% Format', array('%format%' => get_datepicker_date_format($sf_user->getDateFormat())));
?>
';
var errorForOverLappingTime="<?php
echo __('Overlapping Records Found');
?>
";
var errorForInvalidNote='<?php
echo __(ValidationMessages::TEXT_LENGTH_EXCEEDS, array('%amount%' => 250));
?>
';
var actionPunchIn='<?php
echo $actionPunchIn;
?>
';
示例14: render
public function render($name, $value = null, $attributes = array(), $errors = array())
{
if (array_key_exists('class', $attributes)) {
$attributes['class'] .= ' calendar';
} else {
$attributes['class'] = 'calendar';
}
if (!isset($attributes['id']) && isset($this->attributes['id'])) {
$attributes['id'] = $this->attributes['id'];
}
$html = parent::render($name, $value, $attributes, $errors);
$javaScript = sprintf(<<<EOF
<script type="text/javascript">
var datepickerDateFormat = '%s';
var displayDateFormat = datepickerDateFormat.replace('yy', 'yyyy');
\$(document).ready(function(){
var dateFieldValue = \$.trim(\$("#%s").val());
if (dateFieldValue == '') {
\$("#%s").val(displayDateFormat);
}
daymarker.bindElement("#%s",
{
showOn: "both",
dateFormat: datepickerDateFormat,
buttonImage: "%s",
buttonText:"",
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
yearRange: "-100:+100",
firstDay: 1,
onClose: function() {
\$("#%s").trigger('blur');
}
});
//\$("img.ui-datepicker-trigger").addClass("editable");
\$("#%s").click(function(){
daymarker.show("#%s");
if (\$(this).val() == displayDateFormat) {
\$(this).val('');
}
});
});
</script>
EOF
, get_datepicker_date_format(sfContext::getInstance()->getUser()->getDateFormat()), $this->attributes['id'], $this->attributes['id'], $this->attributes['id'], theme_path('images/calendar.png'), $this->attributes['id'], $this->attributes['id'], $this->attributes['id']);
return $html . $javaScript;
}