本文整理汇总了PHP中mysql::formatDateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::formatDateTime方法的具体用法?PHP mysql::formatDateTime怎么用?PHP mysql::formatDateTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql
的用法示例。
在下文中一共展示了mysql::formatDateTime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updPartner
/**
* Mise à jour d'un partenaire
*
* @param array $params
* 'id' => integer
* 'name' => string
* 'logo' => string
* 'descriptions' => array
* 'active' => boolean
* 'date' => string
* 'url' => array
* 'url_title' => array
* @return boolean
*/
public function updPartner($params = array())
{
$this->params = $params;
if (!$this->partnerExists($this->params['id'])) {
$this->error->set('Le partenaire #' . $this->params['id'] . ' n’existe pas.');
return false;
}
# vérification des paramètres
$this->checkParams();
if (!$this->error->isEmpty()) {
return false;
}
$query = 'UPDATE ' . $this->t_partners . ' SET ' . 'active=' . (int) $this->params['active'] . ', ' . 'category_id=' . (is_null($this->params['category_id']) ? 'NULL,' : (int) $this->params['category_id'] . ', ') . 'name=' . '\'' . $this->db->escapeStr($this->params['name']) . '\', ' . (!empty($this->params['date']) ? 'created_at=\'' . mysql::formatDateTime($this->params['date']) . '\', ' : '') . 'updated_at=NOW() ' . 'WHERE id=' . (int) $this->params['id'];
if (!$this->db->execute($query)) {
return false;
}
# modification des textes internationalisés
if (!$this->setPartnerInter()) {
return false;
}
# modification du logo
if ($this->updLogo($this->params['id']) === false) {
return false;
}
return true;
}
示例2: adminPopulateData
/**
* Peuplement des données de la page avec données de $_POST.
*
* @param oktCore $okt
* @param arrayObject $aPageData
* @return void
*/
public static function adminPopulateData($okt, $aPageData)
{
# récupération du champ "checkbox"
$aPageData['post']['checkbox'] = !empty($_POST['p_checkbox']) ? 1 : 0;
# récupération du champ "date"
$aPageData['post']['date'] = !empty($_POST['p_date']) ? mysql::formatDateTime($_POST['p_date']) : null;
# récupération du champ "required"
$aPageData['post']['required'] = !empty($_POST['p_required']) ? $_POST['p_required'] : null;
# récupération des champs "multilangue" et "editor"
foreach ($okt->languages->list as $aLanguage) {
$aPageData['locales'][$aLanguage['code']]['multilangue'] = !empty($_POST['p_multilangue'][$aLanguage['code']]) ? $_POST['p_multilangue'][$aLanguage['code']] : '';
$aPageData['locales'][$aLanguage['code']]['editor'] = !empty($_POST['p_editor'][$aLanguage['code']]) ? $_POST['p_editor'][$aLanguage['code']] : '';
}
}
示例3: array
$okt->catalog->switchProdStatus($product_id);
$okt->redirect('module.php?m=catalog&action=edit&product_id=' . $product_id . '&switched=1');
}
# suppression d'une image
if (!empty($_GET['delete_image']) && !empty($product_id) && $can_edit_product) {
$okt->catalog->deleteImage($product_id, $_GET['delete_image']);
$okt->redirect('module.php?m=catalog&action=edit&product_id=' . $product_id . '&edited=1');
}
# suppression d'un fichier
if (!empty($_GET['delete_file']) && !empty($product_id) && $can_edit_product) {
$okt->catalog->deleteFile($product_id, $_GET['delete_file']);
$okt->redirect('module.php?m=catalog&action=edit&product_id=' . $product_id . '&edited=1');
}
# add/update product
if (!empty($_POST['sended'])) {
$product_data = array('id' => $product_id, 'category_id' => !empty($_POST['p_category_id']) ? intval($_POST['p_category_id']) : 0, 'visibility' => !empty($_POST['p_visibility']) ? intval($_POST['p_visibility']) : $product_data['visibility'], 'title' => !empty($_POST['p_title']) ? $_POST['p_title'] : '', 'subtitle' => !empty($_POST['p_subtitle']) ? $_POST['p_subtitle'] : '', 'content' => !empty($_POST['p_content']) ? $_POST['p_content'] : '', 'content_short' => !empty($_POST['p_content_short']) ? $_POST['p_content_short'] : '', 'price' => !empty($_POST['p_price']) ? util::sysNumber($_POST['p_price']) : null, 'price_promo' => !empty($_POST['p_price_promo']) ? util::sysNumber($_POST['p_price_promo']) : null, 'promo' => !empty($_POST['p_promo']) ? intval($_POST['p_promo']) : null, 'promo_start' => !empty($_POST['p_promo_start']) ? mysql::formatDateTime($_POST['p_promo_start']) : null, 'promo_end' => !empty($_POST['p_promo_end']) ? mysql::formatDateTime($_POST['p_promo_end']) : null, 'nouvo' => !empty($_POST['p_nouvo']) ? intval($_POST['p_nouvo']) : null, 'nouvo_start' => !empty($_POST['p_nouvo_start']) ? mysql::formatDateTime($_POST['p_nouvo_start']) : null, 'nouvo_end' => !empty($_POST['p_nouvo_end']) ? mysql::formatDateTime($_POST['p_nouvo_end']) : null, 'favo' => !empty($_POST['p_favo']) ? intval($_POST['p_favo']) : null, 'favo_start' => !empty($_POST['p_favo_start']) ? mysql::formatDateTime($_POST['p_favo_start']) : null, 'favo_end' => !empty($_POST['p_favo_end']) ? mysql::formatDateTime($_POST['p_favo_end']) : null);
if ($okt->catalog->config->seo_enable) {
$product_data['title_tag'] = !empty($_POST['p_title_tag']) ? $_POST['p_title_tag'] : '';
$product_data['slug'] = !empty($_POST['p_slug']) ? $_POST['p_slug'] : '';
$product_data['meta_description'] = !empty($_POST['p_meta_description']) ? $_POST['p_meta_description'] : '';
$product_data['meta_keywords'] = !empty($_POST['p_meta_keywords']) ? $_POST['p_meta_keywords'] : '';
}
# add or update post
if ($okt->catalog->checkProdData($product_data)) {
$cursor = $okt->catalog->openCursor($product_data);
# update product
if (!empty($product_id)) {
# -- CORE TRIGGER : moduleNewsBeforeProdUpdate
$okt->triggers->callTrigger('moduleNewsBeforeProdUpdate', $cursor, $product_id);
if ($okt->catalog->updProd($product_id, $cursor) !== false) {
# -- CORE TRIGGER : moduleNewsAfterProdUpdate
示例4: preparePostCursor
/**
* Réalise les opérations communes sur le cursor pour l'insertion et la modification.
*
* @param cursor $oCursor
*/
protected function preparePostCursor($oCursor)
{
$sDate = date('Y-m-d H:i:s');
if (empty($oCursor->created_at)) {
$oCursor->created_at = $sDate;
}
$oCursor->created_at = mysql::formatDateTime($oCursor->created_at);
$oCursor->updated_at = $sDate;
if (strtotime($oCursor->created_at) > time()) {
$oCursor->active = 3;
}
}
示例5: addSig
/**
* Ajout d'une signature
*
* @param array $data
*
* @return integer ID de la signature nouvellement ajoutée
*/
public function addSig($data)
{
$data['is_spam'] = null;
if ($this->okt->modules->moduleExists('antispam')) {
$data['is_spam'] = oktAntispam::isSpam('guestbook', $data['nom'], $data['email'], $data['url'], $data['ip'], $data['message']);
}
if (!is_array($data['is_spam'])) {
$data['is_spam'] = array('spam_status' => null, 'spam_filter' => null);
}
$query = 'INSERT INTO ' . $this->t_guestbook . ' ( ' . 'language, message, nom, email, url, note, ip, date_sign, visible, spam_status, spam_filter ' . ') VALUES ( ' . (is_null($data['language']) ? 'NULL' : '\'' . $this->db->escapeStr($data['language']) . '\'') . ', ' . '\'' . $this->db->escapeStr($data['message']) . '\', ' . (is_null($data['nom']) ? 'NULL' : '\'' . $this->db->escapeStr($data['nom']) . '\'') . ', ' . (is_null($data['email']) ? 'NULL' : '\'' . $this->db->escapeStr($data['email']) . '\'') . ', ' . (is_null($data['url']) ? 'NULL' : '\'' . $this->db->escapeStr($data['url']) . '\'') . ', ' . (is_null($data['note']) ? 'NULL' : (int) $data['note']) . ', ' . (is_null($data['ip']) ? 'NULL' : '\'' . $this->db->escapeStr($data['ip']) . '\'') . ', ' . (empty($data['date']) ? 'NOW()' : '\'' . $this->db->escapeStr(mysql::formatDateTime($data['date'])) . '\'') . ', ' . (int) $data['visible'] . ', ' . (is_null($data['is_spam']['spam_status']) ? 'NULL' : '\'' . $this->db->escapeStr($data['is_spam']['spam_status']) . '\'') . ', ' . (is_null($data['is_spam']['spam_filter']) ? 'NULL' : '\'' . $this->db->escapeStr($data['is_spam']['spam_filter']) . '\'') . ' ' . '); ';
if (!$this->db->execute($query)) {
return false;
}
return $this->db->getLastID();
}
示例6: updEvent
/**
* Mise à jour d'un évènement.
*
* @param integer $iEventId
* @param cursor $oCursor
* @return boolean
*/
public function updEvent($iEventId, $oCursor)
{
if (!$this->eventExists($iEventId)) {
$this->error->set(sprintf(__('m_diary_event_%s_not_exists'), $iEventId));
return false;
}
$oCursor->updated_at = date('Y-m-d H:i:s');
$oCursor->date = mysql::formatDateTime($oCursor->date);
if ($oCursor->date_end != '') {
$oCursor->date_end = mysql::formatDateTime($oCursor->date_end);
} else {
$oCursor->date_end = null;
}
$oCursor->description = $this->okt->HTMLfilter($oCursor->description);
$oCursor->disponibility = $oCursor->disponibility;
$oCursor->meta_description = html::clean($oCursor->meta_description);
$oCursor->meta_keywords = html::clean($oCursor->meta_keywords);
if (!$oCursor->update('WHERE id=' . (int) $iEventId . ' ')) {
return false;
}
# modification des images
if ($this->config->images['enable'] && $this->updImages($iEventId) === false) {
return false;
}
# modification des fichiers
if ($this->config->files['enable'] && $this->updFiles($iEventId) === false) {
return false;
}
# modification du slug
if ($this->setEventSlug($iEventId) === false) {
return false;
}
return true;
}