本文整理汇总了PHP中CMbDT::dateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP CMbDT::dateTime方法的具体用法?PHP CMbDT::dateTime怎么用?PHP CMbDT::dateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMbDT
的用法示例。
在下文中一共展示了CMbDT::dateTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadPublications
/**
* Loads messages from a publication date perspective
*
* @param string $status Wanted status, null for all
* @param string $mod_name Module name restriction, null for all
* @param int $group_id Group ID
*
* @return self[] Published messages
*/
function loadPublications($status = null, $mod_name = null, $group_id = null)
{
$now = CMbDT::dateTime();
$where = array();
switch ($status) {
case "past":
$where["fin"] = "< '{$now}'";
break;
case "present":
$where["deb"] = "< '{$now}'";
$where["fin"] = "> '{$now}'";
break;
case "future":
$where["deb"] = "> '{$now}'";
break;
}
if ($group_id) {
$where[] = "group_id = '{$group_id}' OR group_id IS NULL";
}
/** @var self[] $messages */
$messages = $this->loadList($where, "deb DESC");
// Module name restriction
if ($mod_name) {
foreach ($messages as $message_id => $_message) {
if ($_message->module_id) {
if ($_message->loadRefModuleObject()->mod_name != $mod_name) {
unset($messages[$message_id]);
}
}
}
}
return $messages;
}
示例2: mine
static function mine($parent_class)
{
$classes = CApp::getChildClasses($parent_class);
$limit = CAppUI::conf("dataminer_limit");
foreach ($classes as $_class) {
$miner = new $_class();
$report = $miner->mineSome($limit, "mine");
$dt = CMbDT::dateTime();
echo "<{$dt}> Miner: {$_class}. Success mining count is '" . $report["success"] . "'\n";
if (!$report["failure"]) {
echo "<{$dt}> Miner: {$_class}. Failure mining counts is '" . $report["failure"] . "'\n";
}
$miner = new $_class();
$report = $miner->mineSome($limit, "remine");
$dt = CMbDT::dateTime();
echo "<{$dt}> Reminer: {$_class}. Success remining count is '" . $report["success"] . "'\n";
if (!$report["failure"]) {
echo "<{$dt}> Reminer: {$_class}. Failure remining counts is '" . $report["failure"] . "'\n";
}
$miner = new $_class();
$report = $miner->mineSome($limit, "postmine");
$dt = CMbDT::dateTime();
echo "<{$dt}> Postminer: {$_class}. Success postmining count is '" . $report["success"] . "'\n";
if (!$report["failure"]) {
echo "<{$dt}> Postminer: {$_class}. Failure postmining counts is '" . $report["failure"] . "'\n";
}
}
}
示例3: store
/**
* @see parent::store()
*/
function store()
{
if ($this->fieldModified("content") || !$this->last_modified) {
$this->last_modified = CMbDT::dateTime();
}
return parent::store();
}
示例4: store
/**
* @see parent::store()
*/
function store()
{
$this->completeField("handled");
if (!$this->creation_date) {
$this->creation_date = CMbDT::dateTime();
if ($this->_id) {
$this->creation_date = $this->loadFirstLog()->date;
}
}
if ($this->fieldModified("handled", "1") || $this->handled && !$this->handled_date && !$this->handled_user_id) {
$this->handled_date = CMbDT::dateTime();
$this->handled_user_id = CMediusers::get()->_id;
if ($this->handled) {
$last_log = $this->loadLastLog();
$this->handled_date = $last_log->date;
$this->handled_user_id = $last_log->user_id;
}
}
if ($this->fieldModified("handled", "0")) {
$this->handled_date = $this->handled_user_id = "";
}
if ($msg = parent::store()) {
return $msg;
}
}
示例5: build
/**
* Build EVN segement
*
* @param CHL7v2Event $event Event
*
* @return null
*/
function build(CHL7v2Event $event)
{
parent::build($event);
$version = $event->message->version;
$data = array();
// EVN-1: Event Type Code (ID) (optional)
// This field has been retained for backward compatibility only
$data[] = $version < "2.5" ? $event->code : null;
// EVN-2: Recorded Date/Time (TS)
$data[] = CMbDT::dateTime();
// EVN-3: Date/Time Planned Event (TS)(optional)
$data[] = $this->planned_datetime;
// EVN-4: Event Reason Code (IS) (optional)
// Table 062
// 01 - Patient request
// 02 - Physician/health practitioner order
// 03 - Census management
// O - Other
// U - Unknown
$data[] = null;
// EVN-5: Operator ID (XCN) (optional repeating)
//$data[] = $this->getXCN($event->last_log->loadRefUser());
$data[] = null;
// EVN-6: Event Occurred (TS) (optional)
$data[] = $this->occured_datetime;
// EVN-7: Event Facility (HD) (optional)
$data[] = null;
$this->fill($data);
}
示例6: build
/**
* @see parent::build
*/
function build(CHPREvent $event)
{
parent::build($event);
$message = $event->message;
$data = array();
// H-1 : Field Separator
$data[] = $message->fieldSeparator;
// H-2: Encoding Characters (ST)
$data[] = substr($message->getEncodingCharacters(), 1);
// H-3 : Message ID
$data[] = $event->_exchange_hpr->_id;
// H-4 : Password
$data[] = null;
// H-5 : Sender ID
$data[] = $event->_sender->nom;
// H-6 : Sender address
$data[] = null;
// H-7 : Context
$data[] = $event->event_type;
// H-8 : Sender phone
$data[] = null;
// H-9 : Transmission characteristics
$data[] = null;
// H-10 : Receiver ID
$data[] = array($event->_receiver->_id, $event->_receiver->nom);
// H-11 : Comment
$data[] = null;
// H-12 : Processing ID
$data[] = null;
// H-13 : Version and Type
$data[] = array(array($event->version, $event->_exchange_hpr->type));
// H-14 : Date/Time of Message
$data[] = CMbDT::dateTime();
$this->fill($data);
}
示例7: logForSejour
/**
* logSejourAccess
*
* @param CSejour $sejour
*
* @return bool has the access been logged
*/
static function logForSejour($sejour)
{
$group = $sejour->loadRefEtablissement();
if (!CAppUI::conf("admin CLogAccessMedicalData enable_log_access", $group) || !$sejour->_id) {
return false;
}
$user = CMediusers::get();
$conf = CAppUI::conf("admin CLogAccessMedicalData round_datetime", $group);
$datetime = CMbDT::dateTime();
switch ($conf) {
case '1m':
// minute
$datetime = CMbDT::format($datetime, "%y-%m-%d %H:%M:00");
break;
case '10m':
// 10 minutes
$minute = CMbDT::format($datetime, "%M");
$minute = str_pad(floor($minute / 10) * 10, 2, 0, STR_PAD_RIGHT);
$datetime = CMbDT::format($datetime, "%y-%m-%d %H:{$minute}:00");
break;
case '1d':
// 1 day
$datetime = CMbDT::format($datetime, "%y-%m-%d 00:00:00");
break;
default:
// 1 hour
$datetime = CMbDT::format($datetime, "%y-%m-%d %H:00:00");
break;
}
return self::logintoDb($user->_id, $sejour->_class, $sejour->_id, $datetime, $group->_id);
}
示例8: __call
/**
* Magic method (do not call directly).
* @param string $name method name
* @param array $args arguments
*
* @return mixed
*
* @throws Exception
* @throws CMbException
*/
function __call($name, $args)
{
$name = strtolower($name);
$silent = strncmp($name, 'try', 3) === 0;
$function_name = $silent ? substr($name, 3) : $name;
$function_name = '_' . (isset(self::$aliases[$function_name]) ? self::$aliases[$function_name] : $function_name);
if (!method_exists($this, $function_name)) {
throw new CMbException("CSourceFTP-call-undefined-method", $name);
}
if ($function_name == "_init") {
return call_user_func_array(array($this, $function_name), $args);
}
if (!$this->loggable) {
try {
return call_user_func_array(array($this, $function_name), $args);
} catch (CMbException $fault) {
throw $fault;
}
}
$echange_ftp = new CExchangeFTP();
$echange_ftp->date_echange = CMbDT::dateTime();
$echange_ftp->emetteur = CAppUI::conf("mb_id");
$echange_ftp->destinataire = $this->hostname;
$echange_ftp->function_name = $name;
CApp::$chrono->stop();
$chrono = new Chronometer();
$chrono->start();
$output = null;
try {
$output = call_user_func_array(array($this, $function_name), $args);
} catch (CMbException $fault) {
$echange_ftp->date_echange = CMbDT::dateTime();
$echange_ftp->output = $fault->getMessage();
$echange_ftp->ftp_fault = 1;
$echange_ftp->store();
CApp::$chrono->start();
throw $fault;
}
$chrono->stop();
CApp::$chrono->start();
// response time
$echange_ftp->response_time = $chrono->total;
// Truncate input and output before storing
$args = array_map_recursive(array("CFTP", "truncate"), $args);
$echange_ftp->input = serialize($args);
if ($echange_ftp->ftp_fault != 1) {
if ($function_name == "_getlistfiles") {
// Truncate le tableau des fichiers reçus dans le cas où c'est > 100
$array_count = count($output);
if ($array_count > 100) {
$output = array_slice($output, 0, 100);
$output["count"] = "{$array_count} files";
}
}
$echange_ftp->output = serialize(array_map_recursive(array("CFTP", "truncate"), $output));
}
$echange_ftp->store();
return $output;
}
示例9: getCreateDate
/**
* Return the create date of the document
*
* @return datetime|Null
*/
function getCreateDate()
{
$create_date = $this->queryAttributNode("/cda:ClinicalDocument/cda:effectiveTime", null, "value");
if ($create_date) {
$create_date = CMbDT::dateTime($create_date);
}
return $create_date;
}
示例10: store
/**
* @see parent::store()
*/
function store()
{
if (!$this->creation_datetime) {
$this->creation_datetime = CMbDT::dateTime();
}
if ($msg = parent::store()) {
return $msg;
}
}
示例11: doStore
/**
* @see parent::doStore()
*/
function doStore()
{
if (isset($_FILES['attachment'])) {
$mail_id = CValue::post('mail_id');
$mail = new CUserMail();
$mail->load($mail_id);
$files = array();
foreach ($_FILES['attachment']['error'] as $key => $file_error) {
if (isset($_FILES['attachment']['name'][$key])) {
$files[] = array('name' => $_FILES['attachment']['name'][$key], 'tmp_name' => $_FILES['attachment']['tmp_name'][$key], 'error' => $_FILES['attachment']['error'][$key], 'size' => $_FILES['attachment']['size'][$key]);
}
}
foreach ($files as $_key => $_file) {
if ($_file['error'] == UPLOAD_ERR_NO_FILE) {
continue;
}
if ($_file['error'] != 0) {
CAppUI::setMsg(CAppUI::tr("CFile-msg-upload-error-" . $_file["error"]), UI_MSG_ERROR);
continue;
}
$attachment = new CMailAttachments();
$attachment->name = $_file['name'];
$content_type = mime_content_type($_file['tmp_name']);
$attachment->type = $attachment->getTypeInt($content_type);
$attachment->bytes = $_file['size'];
$attachment->mail_id = $mail_id;
$content_type = explode('/', $content_type);
$attachment->subtype = strtoupper($content_type[1]);
$attachment->disposition = 'ATTACHMENT';
$attachment->extension = substr(strrchr($attachment->name, '.'), 1);
$attachment->part = $mail->countBackRefs('mail_attachments') + 1;
$attachment->store();
$file = new CFile();
$file->setObject($attachment);
$file->author_id = CAppUI::$user->_id;
$file->file_name = $attachment->name;
$file->file_date = CMbDT::dateTime();
$file->fillFields();
$file->updateFormFields();
$file->doc_size = $attachment->bytes;
$file->file_type = mime_content_type($_file['tmp_name']);
$file->moveFile($_file, true);
if ($msg = $file->store()) {
CAppUI::setMsg(CAppUI::tr('CMailAttachments-error-upload-file') . ':' . CAppUI::tr($msg), UI_MSG_ERROR);
CApp::rip();
}
$attachment->file_id = $file->_id;
if ($msg = $attachment->store()) {
CAppUI::setMsg($msg, UI_MSG_ERROR);
CApp::rip();
}
}
CAppUI::setMsg('CMailAttachments-msg-added', UI_MSG_OK);
} else {
parent::doStore();
}
}
示例12: checkOlder
/**
* check if $this is an older rule
*
* @return bool
*/
function checkOlder()
{
$now = CMbDT::dateTime();
if ($this->date_min && $now < $this->date_min) {
return $this->_inactive = true;
}
if ($this->date_max && $now > $this->date_max) {
return $this->_inactive = true;
}
return $this->_inactive = false;
}
示例13: __construct
/**
* History constructor
*
* @param string $m Module
* @param string $action Action
* @param string $actionType Action type
* @param CMbObject $object Object
* @param array $params Parameters
* @param string $type Type of view
*/
protected function __construct($m, $action, $actionType, CMbObject $object, $params, $type)
{
$this->datetime = CMbDT::dateTime();
$this->m = $m;
$this->action = $action;
$this->actionType = $actionType;
$this->params = $params;
$this->type = $type;
$this->object_guid = $object->_guid;
$this->object = $object;
}
示例14: checkProperty
/**
* @see parent::checkProperty()
*/
function checkProperty($object)
{
$propValue =& $object->{$this->fieldName};
if (!preg_match("/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}[ \\+][0-9]{1,2}:[0-9]{1,2}(:[0-9]{1,2})?\$/", $propValue)) {
if ($propValue === 'current' || $propValue === 'now') {
$propValue = CMbDT::dateTime();
return null;
}
return "format de dateTime invalide : '{$propValue}'";
}
$propValue = strtr($propValue, "+", " ");
return null;
}
示例15: store
/**
* @see parent::store()
*/
function store()
{
// Save owner and creation date
if (!$this->_id) {
if (!$this->creation_date) {
$this->creation_date = CMbDT::dateTime();
}
if (!$this->owner_id) {
$this->owner_id = CMediusers::get()->_id;
}
}
return parent::store();
}