本文整理汇总了PHP中XDateTime::valueOf方法的典型用法代码示例。如果您正苦于以下问题:PHP XDateTime::valueOf方法的具体用法?PHP XDateTime::valueOf怎么用?PHP XDateTime::valueOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XDateTime
的用法示例。
在下文中一共展示了XDateTime::valueOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: androidMedicineRemind
public function androidMedicineRemind($request, $response)
{
/*{{{*/
$userId = $request->userId;
$user = DAL::get()->find('user', $userId);
$remoter = new RequestDelegate();
$url = "http://" . URL_PREFIX . "mobile-api.haodf.com/followup/mobileapi/getMedicineRemindList";
//"fa28bd37cd7f397fbd088649c1d09af8"为手机客户端followup对应密钥
$cryptedUserId = $this->cryptWithKey(json_encode(array("userId" => $userId)), "fa28bd37cd7f397fbd088649c1d09af8");
$args = array('os' => 'android', 'app' => 'followup', 'version' => 'fu1.0', '_s' => $cryptedUserId);
$res = $remoter->request($url, 'get', $args);
$res = json_decode($res);
$todayRemindList = array();
$remindList = $res->content;
foreach ($remindList as &$remind) {
$remind->problemTitle = mb_convert_encoding($remind->problemTitle, 'gbk', 'utf-8');
if ($remind->remindIntervalDay == 1) {
$todayRemindList[] = $remind;
} else {
$today = XDateTime::today();
$checkTime = XDateTime::valueOf($remind->remindCheckTime);
$dayDiff = XDateTime::dayDiff($today, $checkTime);
$intervalDay = $remind->remindIntervalDay;
if (fmod($dayDiff, $intervalDay) == 0) {
$todayRemindList[] = $remind;
}
}
}
$response->todayRemindList = $todayRemindList;
$response->remindData = $remindList;
$response->userId = $userId;
$response->userName = $user->name;
}
示例2: updateBaseInfo
public function updateBaseInfo($request, $response)
{
$vars = $request->var;
if ($request->is_ajax) {
$vars = XString::toGbkDeep($vars);
}
if (!empty($vars['birthday']))
$vars['birthday'] = XDateTime::valueOf($vars['birthday']);
DoctorClient::getInstance()->modifyByDoctor($this->_newSpace->host->id, $vars);
//调用同步新浪微博接口(更新医生个人信息和修改医生资料)
//MessageQueueClient::getInstance()->regEvent(new UpdateDoctorInformationSinaWeiboEvent($this->_newSpace->user->id));
if ($request->is_ajax)
{
$results = array(
'grade' => XString::convertToUnicode($this->_newSpace->host->grade),
'educate_grade' => XString::convertToUnicode($this->_newSpace->host->educateGrade),
'specialize' => XString::convertToUnicode($this->_newSpace->host->specialize),
'intro' => XString::convertToUnicode(XString::truncate($this->_newSpace->host->intro, 100)),
'status' => 0,
);
echo json_encode($results);
exit;
}
$this->message('您的医生资料提交成功!将在1个工作日内审核后生效!', $response, array(
'buttons' => array(
array('text' => '继续修改', 'url' => $this->_newSpace->getUrl()."admindoctor/showbaseinfo"),
array('text' => '进入个人网站', 'url' => $this->_newSpace->getUrl())
),
));
}
示例3: getShowTime
public static function getShowTime($oldTime)
{/*{{{*/
$msg = '';
$time = XDateTime::valueOf($oldTime)->getTime();
$now = time();
$time = $now - $time;
if($time < 60)
{
$msg = '1分钟前';
}
else if($time < 3600 && $time >= 60)
{
$cnt = (int)floor($time / 60);
$msg = $cnt."分钟前";
}
else if($time < 86400 && $time >= 3600)
{
$cnt = (int)floor($time / 3600);
$msg = $cnt."小时前";
}
else if($time < 604800 && $time >= 86400)
{
$cnt = (int)floor($time / 86400);
$msg = $cnt."天前";
}
else
{
$time = XDateTime::valueOf($oldTime);
$msg = $time->getYear().'-'.$time->getMonth().'-'.$time->getDay().' '.$time->getHour().':'.$time->getMinute();
}
return $msg;
}/*}}}*/
示例4: sendVerificationCodeEmail
public function sendVerificationCodeEmail($request, $response)
{
/*{{{*/
if (false == RequestDelegate::isOfficeIp()) {
echo '系统错误,请联系技术人员!!!';
exit;
}
PrivilegeClient::getInstance()->sendVerificationCodeEmail($request->emailaddress, XDateTime::valueOf($request->starttime), XDateTime::valueOf($request->endtime));
$response->setRedirect($response->router->urlfor('backyardauth/applytoken?st=ok'));
}
示例5: doAddTelOrderTask
public function doAddTelOrderTask($request,$response)
{/*{{{*/
DBC::requireNotEmptyString($request->spaceId, 'spaceId 不能为空');
DBC::requireNotEmptyString($request->taskType, 'taskType 不能为空');
DBC::requireNotEmptyString($request->taskRemark, 'taskRemark 不能为空');
DBC::requireNotEmptyString($request->executeGroup, 'executeGroup 不能为空');
$orderId = $request->orderId ? $request->orderId : 0;
$taskBeginTime = XDateTime::valueOf($request->taskBeginTime);
$taskBeginTime = $taskBeginTime->before(XDateTime::now())?XDateTime::now()->toString() : $request->taskBeginTime;
$taskId = TelOrderTaskClient::getInstance()->addTelOrderTask($request->priority, $this->curUser, $request->spaceId, $request->taskType, $this->curUser, $request->executeGroup, $taskBeginTime, $orderId, 0, $request->taskRemark);
$task = DAL::get()->find('TelOrderTask', $taskId);
}/*}}}*/
示例6: ajaxPostDoctorInfo
public function ajaxPostDoctorInfo($request, $response)
{
/*{{{*/
$vars = $request->getRequest('var', array());
if (count($vars) > 0) {
$vars = XString::toGbkDeep($vars);
if ($vars['birthday']) {
$vars['birthday'] = XDateTime::valueOf($vars['birthday']);
}
DoctorClient::getInstance()->modifyByDoctor($this->space->host->id, $vars);
$results = array('res' => 'success', 'specialize' => XString::convertToUnicode($vars['specialize']), 'intro' => XString::convertToUnicode(XString::truncate($vars['intro'], 100)));
echo json_encode($results);
} else {
echo '{"res":"failure", "msg":"请填写完整您的个人信息"}';
}
return self::DIRECT_OUTPUT;
}
示例7: showTaskList
public function showTaskList($request, $response)
{
/*{{{*/
$someDayDateStr = $request->getRequest('somedaydatestr', XDateTime::today()->toShortString());
$queryType = $request->getRequest('querytype', 'num');
$lastnum = $request->getRequest('lastnum', 100);
$someDay = XDateTime::valueOf($someDayDateStr);
if ($queryType == 'time') {
$response->taskList = DAL::get()->find_all_byTaskTemplateIdAndCtimeBetween('QueueTask', $request->tasktemplateid, $someDay, $someDay->addDay(1));
} else {
$response->taskList = DAL::get()->find_all_InRecentTimes('QueueTask', $request->tasktemplateid, $lastnum);
}
$response->someDayDateStr = $someDayDateStr;
$response->taskTemplate = DAL::get()->find('TaskTemplate', $request->tasktemplateid);
$response->queryType = $queryType;
$response->lastnum = $lastnum;
}
示例8: modifyPost
public function modifyPost($request, $response)
{
/*{{{*/
$dotime = XDateTime::valueOf($request->dotime);
$projectOperatorId = $this->myProjectOperator->id;
$questionSheetId = $request->questionSheetId;
$answerData = array();
foreach ($request->qid as $qid => $q) {
if ($q['sourcetype'] == 'RadioQuestion' && isset($q['optionIdArr'])) {
$answerData[$qid]['optionIdArr'] = array($q['optionIdArr']);
$answerData[$qid]['answerContent'] = '';
} else {
if ("TextQuestion" == $q['sourcetype']) {
$answerData[$qid]['optionIdArr'] = array();
$answerData[$qid]['answerContent'] = $q['content'];
}
}
}
ProjectEventClient::getInstance()->modifyEvent($request->projectEventId, $dotime, $answerData, $projectOperatorId);
$msg = "修改事件成功!";
$response->setRedirect($response->router->urlfor('projecteventmgr/modify', array('projectEventId' => $request->projectEventId, 'preMsg' => $msg)));
}
示例9: birthday2Age
public static function birthday2Age($birthday)
{/*{{{*/
$age = '';
try
{
$diff = XDateTime::valueOf($birthday)->getDateDiff(XDateTime::now());
}
catch (Exception $ex)
{
return '';
}
$year = $diff['year'];
$month = $diff['month'];
$day = $diff['day'];
if($year>=10)
{
$age = $year."岁";
}
else
{
if ($day>1)
{
$month++;
}
if($year == 1 && $month == 0 && $day == 0)
{
$age = "12个月";
}
if ($year<10 && $year>=1)
{
if(12 == $month)
{
$year++;
$month = 0;
}
$age = $year."岁".($month>0?($month."个月"):"");
}
else if($year == 0 && $month >1)
{
$age = $month."个月";
}
else if($year == 0 && $month = 1 && $day == 1)
{
$birthday = XDateTime::valueOf($birthday);
if(XDateTime::now()->getMonth() != $birthday->getMonth())
{
$age = "1个月";
}
}
else if($year == 0 && $month = 1 && $day > 1)
{
$age = "{$day}天";
}
else
{
$age = "";
}
}
return $age;
}/*}}}*/
示例10: if
{
$addr = $article->space->host->hospitalfaculty->hospital->commonName . $article->space->host->hospitalfaculty->name;
$spaceName = $article->space->name;
}
else
{
$addr = $article->space->name;
$spaceName = "";
$addr = XString::truncate($addr, 24);
}
}
else
{
continue;
}
$articleTime = XDateTime::valueOf($articleTime)->toShortString();
?>
<li class="clearfix">
<span class="fl">
<a href="<?=$articleUrl?>" target="_blank" class="f14"><?=$articleTitle.Article::$sourceDesc[$article->source]?></a>
<span class="gray2 ml10"><?=$articleTime?></span>
</span>
<?php if(isset($addr) && isset($articleDoctorUrl)){ ?>
<span class="fr">
<a target="_blank" href="/faculty/<?=Codec::getInstance()->encodeId($article->space->host->hospitalfaculty->id)?>.htm" class="green"><?=$addr?>
</a>
<span class="green">|</span>
<a target="_blank" href="<?=$articleDoctorUrl?>" class="green"><?=$spaceName?></a>
<span class="gray2 ml10">发表</span>
</span>
示例11: pullDailyRecommendThreads
public function pullDailyRecommendThreads($spaceId)
{/*{{{*/
$space = DAL::get()->find('space', $spaceId);
if($space->isNull())
{
$this->setErrorCode(328);
return 0;
}
$firstLoginTime = '';
$spaceexp= DAL::get()->find_by_userid('spaceexp', $space->user->id);
if(false == $spaceexp->isNull())
{
$firstLoginTime = $spaceexp->firstLoginTime;
}
if(empty($firstLoginTime)
|| false == empty($firstLoginTime) && (XDateTime::hourDiff(XDateTime::valueOf($firstLoginTime),XDateTime::now()) > 24))
{
$proposalIds = ProposalClient::getInstance()->autoPullRecommends($space);
error_log("[".XDateTime::now()."] ".$space->user->name."\n", 3, "/tmp/mobile_autopull.log");
if (false == empty($proposalIds))
{
SpaceExpClient::getInstance()->createSpaceExp($space->user->id, XDateTime::now());
}
}
}/*}}}*/
示例12: getAllQuestionTitleAndAnswerContentArrByPatient
public static function getAllQuestionTitleAndAnswerContentArrByPatient($patient, $pageId=1, $pageSize=10)
{/*{{{*/
DBC::requireTrue($patient instanceof Patient, '患者不存在');
$result = PatientFileClient::getInstance()->getRecordListByPatientId($patient->id, $pageId, $pageSize);
$arr = array();
$res = array();
$arr['pageInfo'] = $result['pageInfo'];
foreach($result['list'] as $record)
{
$res[1][0] = 'time';
$res[1][1] = XDateTime::valueOf($record->ctime)->getDateTime();
$res[2][0] = 'week';
$res[2][1] = XDateTime::valueOf($record->ctime)->getWeekDesc();
$res[3][0] = 'abNormal';
$res[3][1] = $record->isAbNormal();
$res[4][0] = 'questionSheetTitle';
$res[4][1] = $record->answerSheet->questionSheet->title;
$res[$record->answerSheet->id][0] = 'answerSheetId';
$res[$record->answerSheet->id][1] = $record->answerSheet->id;
$questionIdArr = $record->answerSheet->getQuestionId_answerArr();
$i = 4;
foreach($questionIdArr as $questionId => $answer)
{/*{{{*/
$question = DAL::get()->find('question', $questionId);
$answerContent = $answer->getAnswerContent();
if ($answerContent instanceof NullEntity)
{
$answerContent = "";
}
// if ($question->isUpload())
// {
// $ids = explode(',', $answerContent);
// $patientAttachment = DAL::get()->find('PatientAttachment', $ids);
// foreach ($patientAttachments as $patientAttachment)
// {
// if (false == $patientAttachment->isNull() && false == $patientAttachment->attachment->isNull() && $patientAttachment->attachment->filePath)
// {
// $imgUrl2 = TuClient::getInstance()->getThumbnailUrl($patientAttachment->attachment->filePath, 100, 100);
// $orgImgUrl = TuClient::getInstance()->getUrl($patientAttachment->attachment->filePath);
// $i ++;
// $res[$i]['name'] = $question->content."缩略图";
// $res[$i]['value'] = $orgImgUrl;
// $i ++;
// $res[$i]['name'] = $question->content."原图";
// $res[$i]['value'] = $imgUrl2;
// }
// }
// }
// else
{
$res[$question->id][0] = $question->content;
$res[$question->id][1] = $answerContent;
}
}/*}}}*/
$arr[] = $res;
}
return $arr;
}/*}}}*/
示例13: ajaxgetshittotalhashdata
public function ajaxgetshittotalhashdata($request, $response)
{/*{{{*/
$lastTime = XDateTime::valueOf($request->lasttime);
$startTime = $lastTime->addDay(-30);
$response->shitJsonHashData = HealthRecordClient::getInstance()->getShitJsonHashData($request->userid, $startTime->toShortString(), $lastTime->toShortString());
}/*}}}*/
示例14: if
<!-- start dd-article -->
<div class="dd-article dd-box ">
<ul class="pt15 lh180">
<?php if(isset($papers)) { ?>
<?php
if (false == empty($papers))
{
$a = 0;
foreach($papers as $paper)
{
$a++;
?>
<li class="thirdList clearfix">
<span class="fl">●</span>
<a class="black f14 fl" href="<?php echo $paper->getDetailUrl();?>" target="_blank" ><?=$paper->name?></a>
<span class="fr f12 gray2 thirdList ml20"><?=XDateTime::valueOf($paper->onlineTime)->getDateTime()?></span>
</li>
<?php if (!fmod($a, 5)) { ?> <li class="mt20"></li> <?php } ?>
<?php
}
}
?>
<li class="clearfix"><?=$pageLink ? $pageLink : ''?></li>
<?php } else { ?>
<?php foreach(CmsObjCategory::getDescArray4Paper() as $key=>$value) { ?>
<li class="clearfix">
<span class="fl thirdList">
<a href="/thesis/showtaglist?searchType=<?=$searchType?>&searchParam=<?=$key?>" class="black f14"><?=$value?></a>
</span>
</li>
<?php } ?>
示例15:
<link href="http://i1.hdfimg.com/nfs/css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form method="post" action="">
<p class="mt20 ml20">
<input type="text" name="month" value="<?php
echo $month;
?>
"/>
<input type="submit" value="查看"/>
</p>
</form>
<table class="list w700 ml20 mt10">
<tr>
<td colspan=7><span class="fb f14">呼叫中心<?php
echo XDateTime::valueOf($month)->toStringByFormat('Y年m月');
?>
呼入呼出量统计</span></td>
</tr>
<tr>
<td>队列</td>
<td>总时长</td>
<td>呼出</td>
<td>人均呼出</td>
<td>呼入</td>
<td>人均呼出</td>
<td>队列人数</td>
</tr>
<?php
if (false == empty($callInfos)) {
$allout = $allin = $alloperator = 0;