当前位置: 首页>>代码示例>>PHP>>正文


PHP CoreUtils::getDateTime方法代码示例

本文整理汇总了PHP中CoreUtils::getDateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP CoreUtils::getDateTime方法的具体用法?PHP CoreUtils::getDateTime怎么用?PHP CoreUtils::getDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CoreUtils的用法示例。


在下文中一共展示了CoreUtils::getDateTime方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTimeRemaining

 /**
  * Ta funkcja zwraca na razie liczbę dni, godzin, minut, sekund
  * pozostających do momentu podanego w parametrze. Podanie ilości
  * miesięcy i lat to trochę gorsza sprawa (szczególnie z miesiącami
  * jest problem koncepcyjny).
  * @param string
  * @return array
  */
 public function getTimeRemaining($time)
 {
     $timeSeconds = strtotime($time) - strtotime(CoreUtils::getDateTime());
     if ($timeSeconds <= 0) {
         return null;
     }
     return array('timeSeconds' => $timeSeconds, 's' => $timeSeconds % 60, 'm' => floor($timeSeconds / 60) % 60, 'h' => floor($timeSeconds / (60 * 60)) % 24, 'D' => floor($timeSeconds / (60 * 60 * 24)));
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:16,代码来源:CoreTime.class.php

示例2: logAction

 protected function logAction($action)
 {
     $logRecord = $this->logDAO->getRecordTemplate();
     $logRecord['adminId'] = CoreServices2::getAccess()->getCurrentUserId();
     $logRecord['recordType'] = $this->recordType;
     $logRecord['recordId'] = CoreServices2::getAccess()->getCurrentUserId();
     $logRecord['logTime'] = CoreUtils::getDateTime();
     $logRecord['logIP'] = CoreServices2::getRequest()->getRealIP();
     $logRecord['logOperation'] = $action;
     $this->logDAO->save($logRecord);
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:11,代码来源:AdminLoginController.class.php

示例3: handleRequest

 protected function handleRequest()
 {
     $this->errorMessageContainer = $this->form->getValidationResults();
     if (!$this->errorMessageContainer->isAnyErrorMessage()) {
         $this->setRecordValuesFromForm();
         $this->record['userEraseRequestTime'] = CoreUtils::getDateTime();
         $this->record['userState'] = 'forDeletion';
         $this->dao->save($this->record);
         CoreServices2::getAccess()->logout();
         $this->redirectToStep2();
     }
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:12,代码来源:UserWebsiteDeleteController.class.php

示例4: updateLoginHistory

 protected function updateLoginHistory($loginHistoryDAO, $type, $userId, $loginSuccessful)
 {
     $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null;
     $host = isset($_SERVER['REMOTE_HOST']) ? gethostbyaddr($_SERVER['REMOTE_HOST']) : ($ip ? gethostbyaddr($ip) : null);
     $record = $loginHistoryDAO->getRecordTemplate();
     $record['loginHistorySuccess'] = $loginSuccessful ? 1 : null;
     $record['loginHistoryTime'] = CoreUtils::getDateTime();
     $record['loginHistoryMicrotime'] = CoreUtils::getTimeMicroseconds();
     $record['loginHistoryIP'] = $ip;
     if ($host != $ip) {
         $record['loginHistoryHost'] = $host;
     }
     $record['loginHistoryPHPSessionId'] = CoreServices::get('request')->getSessionId();
     $record[$type . 'Id'] = $userId;
     $loginHistoryDAO->save($record);
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:16,代码来源:CoreAccessVariant1.class.php

示例5: initTmpRecord

 protected function initTmpRecord()
 {
     $tmpId = CoreServices::get('request')->getFromRequest('_tmpId');
     if (!empty($tmpId)) {
         $this->tmpRecord = $this->tmpRecordDAO->getRecordById($tmpId);
         if (empty($this->tmpRecord['id'])) {
             CoreServices2::getDB()->transactionCommit();
             CoreUtils::redirect($this->getListPageAddress());
         }
     } else {
         $this->tmpRecord = $this->tmpRecordDAO->getRecordTemplate();
         $this->tmpRecord['recordType'] = $this->getRecordType();
         $this->tmpRecord['_tmpRecordCreateTime'] = CoreUtils::getDateTime();
         $this->tmpRecord['_tmpRecordSessionId'] = CoreServices2::getRequest()->getSessionId();
         $this->tmpRecordDAO->save($this->tmpRecord);
     }
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:17,代码来源:CMSAbstractControllerEditWithFileUpload.class.php

示例6: clean

 /**
  * Usuwa te rekordy z tabeli _tmpRecord, dla których sesja już na pewno wygasła.
  * Usuwa też przypisane do tych rekordów pliki.
  */
 public function clean()
 {
     $calendar = new Calendar();
     $time = $calendar->addSeconds(CoreUtils::getDateTime(), -CoreConfig::get('Cron', 'tmpRecordOldAgeSeconds'));
     $tmpRecordDAO = new TmpRecordDAO();
     $oldRecords = $tmpRecordDAO->getOldRecords($time, CoreConfig::get('Cron', 'tmpRecordsToDeletePerExecution'));
     $fileDAO = new FileDAO();
     foreach ($oldRecords as $record) {
         if ($this->isForDeletion($record)) {
             $files = $fileDAO->getListByRecord('_tmpRecord', $record['id']);
             foreach ($files as $file) {
                 $fileDAO->delete($file);
             }
             $tmpRecordDAO->delete($record);
         }
     }
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:21,代码来源:TmpRecordGarbageCollector.class.php

示例7: handleRequest

 protected function handleRequest()
 {
     $this->errorMessageContainer = $this->form->getValidationResults();
     if (!$this->errorMessageContainer->isAnyErrorMessage()) {
         $this->setRecordValuesFromForm();
         $this->record['userRegisterTime'] = CoreUtils::getDateTime();
         $this->record['userState'] = 'active';
         $this->record['userCredits'] = 0;
         $this->dao->save($this->record);
         CoreServices2::getAccess()->login($this->record['userEmail'], $this->record['userPassword']);
         if ($this->form->getField('subscribeNewsletter')->getValue()) {
             $this->subscribeNewsletter();
         }
         $this->sendConfirmationEmail();
     }
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:16,代码来源:UserWebsiteRegisterController.class.php

示例8: saveDiskFile

 protected function saveDiskFile(&$record, &$uploadStruct)
 {
     $uploadManager = CoreServices2::getFiles();
     if ($record['fileBaseName']) {
         $uploadManager->removeFile($record['fileBaseName'], $record['fileExtension'], $record['fileCategory'] == 'image');
     }
     $fileNameStruct = $uploadManager->saveUploadedFile($uploadStruct, $record['fileCategory']);
     $record['fileBaseName'] = $fileNameStruct['baseName'];
     $record['fileExtension'] = $fileNameStruct['extension'];
     $record['fileMimeType'] = $uploadStruct['type'];
     $record['fileUpdateTime'] = CoreUtils::getDateTime();
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:12,代码来源:FileDAO.class.php

示例9: delete

 public function delete(&$record)
 {
     // Rekord przekazany w parametrze może nie zawierać wszystkich potrzebnych informacji!
     $recordFull = $this->getRecordById($record['id']);
     if (empty($recordFull['id'])) {
         return;
     }
     // Wszystkie pola poza wymienionymi mają byc wyczyszczone
     $recordCopy = $this->getRecordTemplate();
     $recordCopy['id'] = $recordFull['id'];
     $recordCopy['userEmail'] = $recordFull['userEmail'];
     $recordCopy['userPassword'] = 'n/a';
     $recordCopy['userRegisterTime'] = $recordFull['userRegisterTime'];
     $recordCopy['userEraseRequestTime'] = $recordFull['userEraseRequestTime'];
     $recordCopy['userEraseTime'] = CoreUtils::getDateTime();
     $recordCopy['userState'] = 'deleted';
     parent::save($recordCopy);
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:18,代码来源:UserDAO.class.php

示例10: logAction

 protected function logAction($action)
 {
     $recordType = $this->getRecordType();
     if (!empty($recordType) && !empty($this->record['id'])) {
         $logRecord = $this->logDAO->getRecordTemplate();
         $logRecord['adminId'] = CoreServices2::getAccess()->getCurrentUserId();
         $logRecord['recordType'] = $recordType;
         // $this->recordOldValues['id'] może być puste, $this->record['id'] nie może.
         $logRecord['recordId'] = $this->record['id'];
         $logRecord['logTime'] = CoreUtils::getDateTime();
         $logRecord['logIP'] = CoreServices2::getRequest()->getRealIP();
         switch ($action) {
             case 'Save':
             case 'ChangeWithdrawDate':
                 if (empty($this->recordOldValues['id'])) {
                     $logRecord['logOperation'] = 'create';
                 } else {
                     $logRecord['logOperation'] = 'modify';
                 }
                 $logRecord['recordId'] = $this->record['id'];
                 break;
             case 'DeleteAll':
                 $logRecord['logOperation'] = 'delete';
                 break;
             default:
                 $logRecord['logOperation'] = strtolower($action);
                 break;
         }
         $this->logDAO->save($logRecord);
     }
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:31,代码来源:CMSAbstractControllerEdit.class.php

示例11: getDateTime

 public function getDateTime()
 {
     return CoreUtils::getDateTime();
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:4,代码来源:CoreDisplaySmartyUtils.class.php

示例12: isCurrentUserAllowed

 public function isCurrentUserAllowed(&$record, $updateDownloadObject)
 {
     CoreUtils::checkConstraint($record['id']);
     CoreUtils::checkConstraint($record['recordId']);
     $recordId = $record['id'];
     if (!$this->isProtectedFile($record)) {
         return true;
     }
     $this->freeModelsOfTheMonth[$record['recordId']] = false;
     $this->setMessage($recordId, false);
     $this->setErrorMessage($recordId, false);
     $sessionName = CoreServices2::getRequest()->getSessionName();
     if (empty($sessionName)) {
         $this->setErrorMessage($recordId, 'emptySessionDownloadError');
         return false;
     }
     $currentUser = CoreServices2::getAccess()->getCurrentUserData();
     if (empty($currentUser['id'])) {
         $this->setErrorMessage($recordId, 'noUserDownloadError');
         return false;
     }
     if ($sessionName == 'CMSSession') {
         return $this->isAdminAllowed($record);
     }
     $year = date("Y");
     $month = date("n");
     $modelOfTheMonthDAO = new ModelOfTheMonthDAO();
     $modelOfTheMonthInfoRecord = $modelOfTheMonthDAO->getFreeModelOfTheMonth($year, $month);
     if (!empty($modelOfTheMonthInfoRecord['modelId']) && $modelOfTheMonthInfoRecord['modelId'] == $record['recordId']) {
         $this->freeModelsOfTheMonth[$record['recordId']] = true;
         if (!empty($updateDownloadObject)) {
             $downloadDAO = new DownloadDAO();
             $downloadRecord = $downloadDAO->getRecordTemplate();
             $modelDAO = new ModelDAO();
             $modelRecord = $modelDAO->getRecordById($modelOfTheMonthInfoRecord['modelId']);
             CoreUtils::checkConstraint(!empty($modelRecord['id']));
             $downloadRecord['userId'] = $currentUser['id'];
             $downloadRecord['modelId'] = $modelRecord['id'];
             $downloadRecord['fileId'] = $record['id'];
             $downloadRecord['downloadStartTime'] = CoreUtils::getDateTime();
             $downloadRecord['downloadAttempts'] = 0;
             $downloadRecord['downloadCreditsCost'] = 0;
             $downloadRecord['downloadModelName'] = $modelRecord['modelName'];
             $downloadRecord['downloadFileTypeName'] = $record['modelFileTypeName'];
             $downloadRecord['downloadPaid'] = 0;
             $downloadRecord['downloadFree'] = 1;
             $downloadDAO->save($downloadRecord);
         }
         return true;
     }
     $downloadLogic = new DownloadLogic();
     if (!empty($updateDownloadObject)) {
         $result = $downloadLogic->checkAndUpdateDownloadObject($currentUser['id'], $record);
     } else {
         $result = $downloadLogic->checkDownloadObject($currentUser['id'], $record);
     }
     if (!$result) {
         $this->setErrorMessage($recordId, $downloadLogic->getErrorMessage());
     } else {
         $this->setMessage($recordId, $downloadLogic->getMessage());
     }
     return $result;
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:63,代码来源:FileHushvizLogic.class.php

示例13: saveFileRecord

 protected function saveFileRecord()
 {
     $this->fileRecord = $this->fileDAO->getRecordTemplate();
     $this->form->setRecordValuesFromFields($this->fileRecord);
     $this->fileRecord['id'] = null;
     $recordId = $this->form->getField('id')->getValue();
     $this->fileRecord['recordId'] = !empty($recordId) ? $recordId : $this->form->getField('_tmpId')->getValue();
     $this->fileRecord['recordType'] = !empty($recordId) ? $this->form->getField('recordType')->getValue() : '_tmpRecord';
     $this->fileRecord['fileUpdateTime'] = CoreUtils::getDateTime();
     $maxOrder = $this->fileDAO->getMaxOrderByRecord($this->fileRecord['recordType'], $this->fileRecord['recordId'], $this->fileRecord['fileCategory'], $this->fileRecord['filePosition']);
     // numerowanie od 0!
     $this->fileRecord['fileOrder'] = $maxOrder + 1;
     $uploadStruct = $this->form->getField('_fileUpload')->getValue();
     $this->fileDAO->save($this->fileRecord, $uploadStruct);
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:15,代码来源:FileAjaxUploadController.class.php


注:本文中的CoreUtils::getDateTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。