當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TimeDate::toDatabaseDate方法代碼示例

本文整理匯總了PHP中TimeDate::toDatabaseDate方法的典型用法代碼示例。如果您正苦於以下問題:PHP TimeDate::toDatabaseDate方法的具體用法?PHP TimeDate::toDatabaseDate怎麽用?PHP TimeDate::toDatabaseDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TimeDate的用法示例。


在下文中一共展示了TimeDate::toDatabaseDate方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: save

 function save()
 {
     $bind = array();
     $this->updated = gmdate('Y-m-d H:i:s');
     foreach ($this as $prop => $val) {
         $bind[$prop] = $val;
     }
     if (!$this->bind($bind)) {
         return false;
     }
     if (!$this->check()) {
         return false;
     }
     //set the dates back to db format
     if (!empty($this->start_time)) {
         $this->start_time = TimeDate::toDatabaseDate($this->start_time);
     }
     if (!empty($this->end_time)) {
         $this->end_time = TimeDate::toDatabaseDate($this->end_time);
     }
     //Bug 36: pass in true to allow nulls to be updated
     if (!$this->store(true)) {
         jTipsLogger::_log($this->_db->getErrorMsg(), 'ERROR');
         return false;
     }
     //reformat the dates
     //set the dates back to display format
     if (!empty($this->start_time)) {
         $this->start_time = TimeDate::toDisplayDate($this->start_time);
     }
     if (!empty($this->end_time)) {
         $this->end_time = TimeDate::toDisplayDate($this->end_time);
     }
     return true;
 }
開發者ID:joomux,項目名稱:jTips,代碼行數:35,代碼來源:jseason.class.php

示例2: save

 function save()
 {
     global $database, $jTips;
     $bind = array();
     $this->set('updated', gmdate('Y-m-d H:i:s'));
     foreach ($this as $prop => $val) {
         $bind[$prop] = $val;
     }
     if (!$this->bind($bind)) {
         return false;
     }
     //jTipsDebug("IDA: " .$this->id);
     if (!$this->check()) {
         return false;
     }
     if (!$this->user_id) {
         jTipsLogger::_log('attempt to save jtipsuser with no related josuser. aborted', 'ERROR');
         return false;
     }
     //jTipsDebug("IDB: " .$this->id);
     if (empty($this->id) and !empty($this->season_id)) {
         $newUser = true;
     } else {
         $newUser = false;
     }
     //Bug 36: Set the image property to empty string instead of null
     if (!$this->store(true)) {
         jTipsLogger::_log($this->_db->getErrorMsg(), 'ERROR');
         return false;
     }
     //jTipsDebug("IDC " .$this->id);
     //late entry points here
     jTipsLogger::_log('saving user with id ' . $this->id . ' and season ' . $this->season_id);
     if ($newUser) {
         // BUG 406 - optionally set reminders as on by default
         if ($jTips['DefaultReminders']) {
             jTipsLogger::_log('setting email reminder option as on by default');
             $this->setPreference('email_reminder', 1);
         }
         jTipsLogger::_log('setting default points for new user for season ' . $this->season_id);
         $jSeason = new jSeason($database);
         $jSeason->load($this->season_id);
         jTipsLogger::_log('comparing dates ' . date('Y-m-d') . ' >? ' . TimeDate::toDatabaseDate($jSeason->start_time));
         if (date('Y-m-d') > TimeDate::toDatabaseDate($jSeason->start_time)) {
             $jSeason->getDefaultPoints($this->id);
         }
         if ($jTips['JomSocialActivities'] and $jTips['JomSocialOnUserJoin']) {
             // BUG 334 - typo in user_id variable.
             jTipsJomSocial::writeJoinMessage($this->user_id, $jSeason);
         }
     }
     return true;
 }
開發者ID:joomux,項目名稱:jTips,代碼行數:53,代碼來源:juser.class.php

示例3: gmdate

    $step = 5;
}
$tpl->date_start_time_minute = jTipsHTML::integerSelectList('00', $end, $step, 'date_start_time_minute', "class='inputbox'", $date_start_time_minute);
if (intval($jTips['Is24Hour']) == 1) {
    $tpl->date_start_time_meridiem = '';
} else {
    $tpl->date_start_time_meridiem = jTipsHTML::selectList($meridiemOptions, 'date_start_time_meridiem', "class='inputbox'", 'value', 'text', $date_start_time_meridiem);
}
//now prepare the end_time
if (!$focus->end_time) {
    $focus->end_time = gmdate('Y-m-d H:i:s');
}
//BUG 263
if (!isJoomla15()) {
    $tpl->date_end_date = TimeDate::toDisplayDate($focus->end_time, true);
    $tpl->date_end_date = TimeDate::toDatabaseDate($tpl->date_end_date);
} else {
    $tpl->date_end_date = TimeDate::toDisplayDate($focus->end_time, true);
}
$date_end_time_hour = TimeDate::format($focus->end_time, '%I', true);
$date_end_time_minute = TimeDate::format($focus->end_time, '%M', true);
$date_end_time_meridiem = strtolower(TimeDate::format($focus->end_time, '%p', true));
// BUG 326 - Optionally allo 24-hour format
if (intval($jTips['Is24Hour']) == 1) {
    $hour_end = 23;
    if ($date_end_time_meridiem == 'pm') {
        $date_end_time_hour += 12;
    }
} else {
    $hour_end = 12;
}
開發者ID:joomux,項目名稱:jTips,代碼行數:31,代碼來源:edit.php

示例4: parseDataType

function parseDataType(&$data, $column, $field)
{
    global $database;
    $dataval = $data[$column];
    switch ($field['type']) {
        case 'int':
            if (is_numeric($dataval)) {
                return $dataval;
            } else {
                return 0;
            }
            break;
        case 'double':
        case 'float':
            if (is_float($dataval)) {
                return $dataval;
            } else {
                return 0;
            }
            break;
        case 'bool':
            if ($dataval == 1 or preg_match('/yes/i', $dataval)) {
                return 1;
            } else {
                return 0;
            }
            break;
        case 'date':
            //return toDbDate($dataval);
            return TimeDate::toDatabaseDate($dataval);
            break;
        case 'datetime':
            //return toDbDateTime($dataval);
            return TimeDate::toDatabaseDateTime($dataval);
            break;
        case 'time':
            //return toDbTime($dataval);
            return TimeDate::toDatabaseTime($dataval);
            break;
        case 'relate':
            //Locate an existing record matching the given data value
            //If nothing found create a skeleton record with the supplied data
            //Return key of supplied data in related table.
            $class = $field['related'];
            $obj = new $class($database);
            $related_fields = $field['related_fields'];
            if (count($related_fields) > 1) {
                $values = preg_split('/[\\s]+/', $dataval);
            } else {
                $values = array($dataval);
            }
            $max = min(count($values), count($related_fields));
            $params = array();
            for ($i = 0; $i < $max; $i++) {
                $params[$related_fields[$i]] = $values[$i];
            }
            if (isset($field['dependency']) and !empty($field['dependency'])) {
                $params[$field['dependency']['key']] = getDependentField($field, $data, $_POST['importFields']);
            }
            //jTipsDebug($_POST);
            //jTipsDebug($dataval);
            //jTipsDebug($field);
            //jTipsDebug($params);
            //die();
            $obj->loadByParams($params);
            $rel_key = $field['related_key'];
            if (isset($obj->{$rel_key}) and !empty($rel_key)) {
                return $obj->{$rel_key};
            } else {
                if ($field['required']) {
                    $obj->bind($params);
                    $obj->save();
                    return $obj->{$rel_key};
                } else {
                    return $field['default'];
                }
            }
            break;
        case 'virtual':
            continue;
            break;
        case 'text':
        default:
            return mysql_real_escape_string($dataval);
            break;
    }
}
開發者ID:joomux,項目名稱:jTips,代碼行數:87,代碼來源:functions.inc.php

示例5: display


//.........這裏部分代碼省略.........
        ?>
><?php 
        echo $jLang['_COM_DASH_CURR_ROUND'];
        ?>
</th>
		<th <?php 
        echo $center;
        ?>
><?php 
        echo $jLang['_ADMIN_DASH_TOTAL_USERS'];
        ?>
</th>
		<th <?php 
        echo $center;
        ?>
><?php 
        echo $jLang['_ADMIN_DASH_PENDING_TIPS'];
        ?>
</th>
		<th <?php 
        echo $center;
        ?>
><?php 
        echo $jLang['_ADMIN_DASH_PENDING_PAYMENT'];
        ?>
</th>
	</tr>
	</thead>
	<tbody>
	<?php 
        jTipsLogger::_log('Loading season data', 'INFO');
        $total_user_count = 0;
        foreach ($this->jSeasons as $jSeason) {
            if (TimeDate::toDatabaseDate($jSeason->end_time) > gmdate('Y-m-d')) {
                $round_id = $jSeason->getCurrentRound();
                $jRound = new jRound($database);
                if ($round_id) {
                    $jRound->load($round_id);
                }
                $jTipsUsers = $jSeason->getUsers();
                $total_users = 0;
                $no_tips = 0;
                $has_paid = 0;
                $no_tips_overlib = "";
                foreach ($jTipsUsers as $jTipsUser) {
                    $total_users++;
                    if (!$jTipsUser->hasTipped($jRound->id)) {
                        $no_tips++;
                        if ($no_tips < 10) {
                            $no_tips_overlib .= "<br />" . htmlentities($jTipsUser->getName());
                        } else {
                            if ($no_tips == 10) {
                                $no_tips_overlib .= "<br />...more";
                            }
                        }
                    }
                    if ($jTipsUser->paid == 1) {
                        $has_paid++;
                    }
                }
                if ($jTips['Payments'] != 0) {
                    $pending_payment = $total_users - $has_paid;
                } else {
                    $pending_payment = "N/A";
                }
                $no_tips_overlib = substr($no_tips_overlib, 6);
開發者ID:joomux,項目名稱:jTips,代碼行數:67,代碼來源:list.tmpl.php


注:本文中的TimeDate::toDatabaseDate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。