本文整理汇总了PHP中Pw::str2time方法的典型用法代码示例。如果您正苦于以下问题:PHP Pw::str2time方法的具体用法?PHP Pw::str2time怎么用?PHP Pw::str2time使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pw
的用法示例。
在下文中一共展示了Pw::str2time方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setOvertime
public function setOvertime($overtime)
{
if ($overtime) {
$this->overtime = is_numeric($overtime) ? $overtime : Pw::str2time($overtime) + 86399;
}
return $this;
}
示例2: run
public function run()
{
list($page, $perpage, $username, $starttime, $endtime, $keyword) = $this->getInput(array('page', 'perpage', 'username', 'starttime', 'endtime', 'keyword'));
$starttime && ($pwStartTime = Pw::str2time($starttime));
$endtime && ($pwEndTime = Pw::str2time($endtime));
$page = $page ? $page : 1;
$perpage = $perpage ? $perpage : $this->perpage;
list($start, $limit) = Pw::page2limit($page, $perpage);
if ($username) {
$userinfo = $this->_getUserDs()->getUserByName($username);
$fromUid = $userinfo['uid'] ? $userinfo['uid'] : 0;
}
Wind::import('WINDID:service.message.srv.vo.WindidMessageSo');
$vo = new WindidMessageSo();
$endtime && $vo->setEndTime($endtime);
$fromUid && $vo->setFromUid($fromUid);
$keyword && $vo->setKeyword($keyword);
$starttime && $vo->setStarttime($starttime);
$messages = $this->_getMessageDs()->searchMessage($vo, $start, $limit);
$count = $this->_getMessageDs()->countMessage($vo);
foreach ($messages as $k => $v) {
$uids[] = $v['from_uid'];
}
$users = $this->_getUserDs()->fetchUserByUid($uids);
foreach ($messages as $k => $v) {
$messages[$k]['username'] = $users[$v['from_uid']]['username'];
}
$this->setOutput($count, 'count');
$this->setOutput($page, 'page');
$this->setOutput($perpage, 'perpage');
$this->setOutput(array('keyword' => $keyword, 'username' => $username, 'starttime' => $starttime, 'endtime' => $endtime), 'args');
$this->setOutput($messages, 'messages');
}
示例3: getMyAnnounceBySchoolIdAction
public function getMyAnnounceBySchoolIdAction()
{
$schoolid = $this->getInput('schoolid', 'get');
if (empty($schoolid)) {
$this->output(-1);
return;
}
$result = $this->_getPwAnnounceDs()->getAnnounceBySchoolId($schoolid, Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')), 9, 0);
$this->output($result);
}
示例4: doeditAction
public function doeditAction()
{
$dataid = (int) $this->getInput('dataid', 'post');
$info = $this->_getDataDs()->getData($dataid);
if (!$info) {
$this->showError("operate.fail");
}
$orderid = $info['vieworder'];
$start = $this->getInput('start_time', 'post');
$end = $this->getInput('end_time', 'post');
$data = $this->getInput('data', 'post');
$images = $this->getInput('images', 'post');
$bold = $this->getInput('bold', 'post');
$italic = $this->getInput('italic', 'post');
$underline = $this->getInput('underline', 'post');
$color = $this->getInput('color', 'post');
$standard = $this->_getDesignService()->getStandardSignkey($this->bo->getModel());
if (!$data[$standard['sTitle']]) {
$this->showError("operate.fail");
}
foreach ($images as $k => $v) {
if ($_FILES[$k]['name'] && ($image = $this->_uploadFile($k, $this->bo->moduleid))) {
$data[$k] = $image;
} else {
$data[$k] = $v;
}
}
$time = Pw::getTime();
$startTime = $start ? Pw::str2time($start) : $time;
$endTime = $end ? Pw::str2time($end) : $end;
if ($end && $endTime < $time) {
$this->showError("DESIGN:endtimd.error");
}
Wind::import('SRV:design.dm.PwDesignDataDm');
$dm = new PwDesignDataDm($dataid);
$dm->setStyle($bold, $underline, $italic, $color)->setExtend($data)->setStarttime($startTime)->setEndtime($endTime);
//推送的数据,不打修改标识
if ($info['from_type'] == PwDesignData::FROM_AUTO) {
$dm->setEdited(1);
}
if ($startTime > $time) {
$dm->setReservation(1);
}
$this->_getDataDs()->updateData($dm);
if ($info['from_type'] == PwDesignData::FROM_PUSH) {
Wind::import('SRV:design.dm.PwDesignPushDm');
$pushDm = new PwDesignPushDm($info['from_id']);
$pushDm->setStyle($bold, $underline, $italic, $color)->setExtend($data)->setStartTime($startTime)->setEndTime($endTime)->setModuleId($info['module_id']);
$this->_getPushDs()->updatePush($pushDm);
}
$this->showMessage("operate.success", 'design/data/run?moduleid=' . $this->bo->moduleid, true);
}
示例5: getAnnounceForBbsScroll
/**
* 通过公告记录组装前台显示效果
* 帖子列表滚动展示标题用
*
* @return array
*/
public function getAnnounceForBbsScroll()
{
$announces = array();
$announceInfos = $this->_getPwAnnounceDs()->getAnnounceByTimeOrderByVieworder(Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')), 9, 0);
foreach ($announceInfos as $value) {
$announces[$value['aid']] = $value;
$announces[$value['aid']]['start_date'] = Pw::time2str($value['start_date'], 'Y-m-d');
if (Pw::strlen($value['subject']) > 18) {
$announces[$value['aid']]['subject'] = Pw::substrs($value['subject'], 18);
}
}
return $announces;
}
示例6: run
public function run()
{
$aid = $this->getInput('aid', 'get');
$page = $this->getInput('page');
$this->page = $page < 1 ? 1 : intval($page);
list($start, $limit) = Pw::page2limit($this->page, $this->perpage);
$total = $this->_getPwAnnounceDs()->countAnnounceByTime(Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')));
$list = $total ? $this->_getPwAnnounceService()->formatAnnouncesUsername($this->_getPwAnnounceDs()->getAnnounceByTimeOrderByVieworder(Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')), $limit, $start)) : array();
$this->setOutput($total, 'total');
$this->setOutput($list, 'list');
$this->setOutput($aid, 'aid');
$this->setOutput($this->page, 'page');
$this->setOutput($this->perpage, 'perpage');
}
示例7: dorunAction
/**
* 禁止用户
*/
public function dorunAction()
{
$this->getRequest()->isPost() || $this->showError('operate.fail');
$key = $this->getInput('key', 'post');
if (!in_array($key, array('1', '2'))) {
$this->showError('USER:ban.error.data.format');
}
$array = array();
list($end_time, $reason, $types) = $this->getInput(array('end_time', 'reason', 'type'), 'post');
$userInfos = $this->_getUids(explode(',', $this->getInput('value', 'post')), intval($key));
if (!$userInfos) {
$this->showError('USER:ban.user.illegal');
}
//如果是创始人 则自动设置为system
$_uid = $this->loginUser->uid;
$_operator = $this->loginUser->username;
if ($this->isFounder($_operator)) {
$_operator = 'system';
$_uid = 0;
}
if ($end_time > 0) {
$end_time = Pw::str2time($end_time);
}
Wind::import('SRV:user.dm.PwUserBanInfoDm');
$_notice = array();
$rightTypes = array_keys($this->_getService()->getBanType());
foreach ($types as $type) {
if (!in_array($type, $rightTypes)) {
continue;
}
foreach ($userInfos as $uid => $info) {
$dm = new PwUserBanInfoDm();
$dm->setUid($uid)->setEndTime(intval($end_time))->setTypeid($type)->setReason($reason)->setOperator($_operator)->setCreatedUid($_uid);
$array[] = $dm;
isset($_notice[$uid]) || ($_notice[$uid] = array());
$_notice[$uid]['end_time'] = $end_time;
$_notice[$uid]['reason'] = $reason;
$_notice[$uid]['type'][] = $type;
$_notice[$uid]['operator'] = $_operator;
}
}
$r = $this->_getService()->banUser($array);
if ($r instanceof PwError) {
$this->showError($r->getError(), 'u/forbidden/run');
}
$this->_getService()->sendNotice($_notice, 1);
$this->showMessage('USER:ban.success', 'u/forbidden/run');
}
示例8: doaddAction
public function doaddAction() {
$pageid = (int)$this->getInput('pageid', 'post');
$moduleid = (int)$this->getInput('moduleid', 'post');
$isnotice = (int)$this->getInput('isnotice', 'post');
$fromid = (int)$this->getInput('fromid', 'post');
$fromtype = $this->getInput('fromtype', 'post');
$start = $this->getInput('start_time', 'post');
$end = $this->getInput('end_time', 'post');
if ($moduleid < 1) $this->showError("operate.fail");
$permiss = $this->_getPermissionsService()->getPermissionsForModule($this->loginUser->uid, $moduleid, $pageid);
$pushService = $this->_getPushService();
$data = $pushService->getDataByFromid($fromtype, $fromid);
Wind::import('SRV:design.bo.PwDesignModuleBo');
$bo = new PwDesignModuleBo($moduleid);
$time = Pw::getTime();
$startTime = $start ? Pw::str2time($start) : $time;
$endTime = $end ? Pw::str2time($end) : $end;
if ($end && $endTime < $time) $this->showError("DESIGN:endtimd.error");
$pushDs = $this->_getPushDs();
Wind::import('SRV:design.dm.PwDesignPushDm');
$dm = new PwDesignPushDm();
$dm->setFromid($fromid)
->setModuleId($moduleid)
->setCreatedUserid($this->loginUser->uid)
->setCreatedTime($time)
->setStartTime($startTime)
->setEndTime($endTime)
->setAuthorUid($data['uid']);
if ($isnotice) $dm->setNeedNotice(1);
if ($permiss <= PwDesignPermissions::NEED_CHECK) {
$dm->setStatus(PwDesignPush::NEEDCHECK);
$isdata = false;
} else {
$isdata = true;
}
$resource = $pushService->addPushData($dm);
if ($resource instanceof PwError) $this->showError($resource->getError());
if ($isdata) {
$pushService->pushToData((int)$resource);
$pushService->afterPush((int)$resource);
}
$this->showMessage("operate.success");
}
示例9: run
public function run()
{
if ($this->regist['type'] != 2) {
$this->forwardRedirect(WindUrlHelper::createUrl('my/invite/inviteFriend'));
// $this->showError('USER:invite.close');
}
Wind::import('SRV:credit.bo.PwCreditBo');
/* @var $pwCreditBo PwCreditBo */
$pwCreditBo = PwCreditBo::getInstance();
$startTime = Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d'));
$readyBuy = $this->_getDs()->countByUidAndTime($this->loginUser->uid, $startTime);
$gidLimit = abs(ceil($this->loginUser->getPermission('invite_limit_24h')));
$price = abs(ceil($this->loginUser->getPermission('invite_buy_credit_num')));
$_tmpId = $this->regist['invite.credit.type'];
$_credit = array('id' => $_tmpId, 'name' => $pwCreditBo->cType[$_tmpId], 'unit' => $pwCreditBo->cUnit[$_tmpId]);
$this->setOutput($_credit, 'creditWithBuy');
//用于购买的积分信息
$_tmpId = $this->regist['invite.reward.credit.type'];
$_credit = array('id' => $_tmpId, 'name' => $pwCreditBo->cType[$_tmpId], 'unit' => $pwCreditBo->cUnit[$_tmpId]);
$this->setOutput($_credit, 'rewardCredit');
//奖励的积分信息
$this->setOutput($readyBuy > $gidLimit ? 0 : $gidLimit - $readyBuy, 'canBuyNum');
//还能购买的邀请数
$this->setOutput($price, 'pricePerCode');
//每个邀请码需要积分的单价
$this->setOutput($this->loginUser->info['credit' . $this->regist['invite.credit.type']], 'myCredit');
//我拥有的积分
$this->setOutput($this->regist['invite.reward.credit.num'], 'rewardNum');
//奖励积分数
$this->setOutput($this->regist['invite.expired'], 'codeExpired');
//邀请码有效期
$this->setOutput($this->loginUser->getPermission('invite_allow_buy'), 'canInvite');
//该用户组是否可以购买邀请码
$this->setOutput($this->regist['invite.pay.money'], 'money');
$this->setOutput(false, 'canBuyWithMoney');
$this->listCode();
// seo设置
Wind::import('SRV:seo.bo.PwSeoBo');
$seoBo = PwSeoBo::getInstance();
$lang = Wind::getComponent('i18n');
$seoBo->setCustomSeo($lang->getMessage('SEO:bbs.invite.run.title'), '', '');
Wekit::setV('seo', $seoBo);
}
示例10: run
public function run()
{
list($page, $perpage, $username, $starttime, $endtime, $keyword) = $this->getInput(array('page', 'perpage', 'username', 'starttime', 'endtime', 'keyword'));
$starttime && ($pwStartTime = Pw::str2time($starttime));
$endtime && ($pwEndTime = Pw::str2time($endtime));
$page = $page ? $page : 1;
$perpage = $perpage ? $perpage : $this->perpage;
list($start, $limit) = Pw::page2limit($page, $perpage);
if ($username) {
$userinfo = $this->_getUserDs()->getUserByName($username);
$fromUid = $userinfo['uid'] ? $userinfo['uid'] : 0;
}
list($count, $messages) = $this->_getMessageService()->getMessagesByUid($start, $limit, $fromUid, $pwStartTime, $pwEndTime, $keyword);
$this->setOutput($count, 'count');
$this->setOutput($page, 'page');
$this->setOutput($perpage, 'perpage');
$this->setOutput(array('keyword' => $keyword, 'username' => $username, 'starttime' => $starttime, 'endtime' => $endtime), 'args');
$this->setOutput($messages, 'messages');
}
示例11: clearAction
/**
* 清除三个月前操作
*/
public function clearAction()
{
if (!$this->isFounder($this->adminUser->getUsername())) {
$this->showError('fail');
}
$step = $this->getInput('step', 'post');
if ($step != 2) {
$this->showError('fail');
}
list($year, $month) = explode('-', Pw::time2str(Pw::getTime(), 'Y-n'));
if ($month > 3) {
$month = $month - 3;
} else {
$month = 9 - $month;
$year = $year - 1;
}
Wekit::load('log.PwLoginLog')->clearLogBeforeDatetime(Pw::str2time($year . '-' . $month . '-1'));
$this->showMessage('success');
}
示例12: _buildBanDm
/**
* 构建禁止的对象
*
* @return array
*/
private function _buildBanDm()
{
Wind::import('SRV:user.dm.PwUserBanInfoDm');
Wind::import('SRV:user.PwUserBan');
$rightTypes = array(PwUserBan::BAN_AVATAR, PwUserBan::BAN_SIGN, PwUserBan::BAN_SPEAK);
if ($this->banInfo->end_time > 0) {
$this->banInfo->end_time = Pw::str2time($this->banInfo->end_time);
}
$data = $_notice = array();
foreach ($this->banInfo->types as $type) {
if (!in_array($type, $rightTypes)) {
continue;
}
foreach ($this->selectBanUsers as $uid => $_item) {
$dm = new PwUserBanInfoDm();
$dm->setUid($uid)->setBanAllAccount($this->banInfo->ban_others)->setCreateTime(Pw::getTime())->setCreatedUid($this->loginUser->uid)->setOperator($this->loginUser->username)->setEndTime(intval($this->banInfo->end_time))->setTypeid($type)->setReason($this->banInfo->reason)->setFid(0);
$data[] = $dm;
isset($_notice[$uid]) || ($_notice[$uid] = array());
$_notice[$uid]['end_time'] = $this->banInfo->end_time;
$_notice[$uid]['reason'] = $this->banInfo->reason;
$_notice[$uid]['type'][] = $type;
$_notice[$uid]['operator'] = $this->loginUser->username;
}
}
return array($data, $_notice);
}
示例13: refreshTime
/**
* 允许数据更新的时间
*
* @return 允许更新的开始时间,允许更新的结束时间,更新的时间
*
*/
public function refreshTime($time)
{
$expired = $this->getCache();
if ($expired['expired'] < 1) {
return array($time, 0, 0);
}
list($y, $m, $d) = explode('-', Pw::time2str($time, 'Y-m-d'));
$start = Pw::str2time($y . '-' . $m . '-' . $d . ' ' . $expired['start_hour'] . ':' . $expired['start_minute'] . ':0');
if ($expired['end_hour'] < $expired['start_hour']) {
$d++;
}
$end = Pw::str2time($y . '-' . $m . '-' . $d . ' ' . $expired['end_hour'] . ':' . $expired['end_minute'] . ':0');
if ($start == $end) {
$end += 86400;
}
if ($time < $start) {
$refreshTime = $start;
} elseif ($time > $start && $time < $end) {
$refreshTime = $time + (int) $expired['expired'] * 60;
} else {
$refreshTime = $start + 86400;
}
return array($start, $end, $refreshTime);
}
示例14: replyAction
public function replyAction()
{
$page = intval($this->getInput('page'));
list($author, $fid, $createdTimeStart, $createdTimeEnd) = $this->getInput(array('author', 'fid', 'created_time_start', 'created_time_end'));
$page < 1 && ($page = 1);
$perpage = 20;
list($start, $limit) = Pw::page2limit($page, $perpage);
Wind::import('SRV:forum.vo.PwPostSo');
$so = new PwPostSo();
$so->setDisabled(1)->orderbyCreatedTime(0);
$args = array();
if ($author) {
$so->setAuthor($author);
$args['author'] = $author;
}
if ($fid) {
$forum = Wekit::load('forum.PwForum')->getForum($fid);
if ($forum['type'] != 'category') {
$so->setFid($fid);
} else {
$srv = Wekit::load('forum.srv.PwForumService');
$fids = array(0);
$forums = $srv->getForumsByLevel($fid, $srv->getForumMap());
foreach ($forums as $value) {
$fids[] = $value['fid'];
}
$so->setFid($fids);
}
}
if ($createdTimeStart) {
$so->setCreateTimeStart(Pw::str2time($createdTimeStart));
$args['created_time_start'] = $createdTimeStart;
}
if ($createdTimeEnd) {
$so->setCreateTimeEnd(Pw::str2time($createdTimeEnd));
$args['created_time_end'] = $createdTimeEnd;
}
$count = Wekit::load('forum.PwThread')->countSearchPost($so);
$postdb = Wekit::load('forum.PwThread')->searchPost($so, $limit, $start);
$this->setOutput($postdb, 'postdb');
$this->setOutput(Wekit::load('forum.srv.PwForumService')->getForumList($fid), 'forumlist');
$this->setOutput(Wekit::load('forum.srv.PwForumService')->getForumOption($fid), 'option_html');
$this->setOutput($page, 'page');
$this->setOutput($perpage, 'perpage');
$this->setOutput($count, 'count');
$this->setOutput($args, 'args');
}
示例15: setDm
/**
* 设置dm
*
* @return PwTaskDm
*/
private function setDm($id)
{
$condition = $this->getInput('condition');
$dm = PwTaskDmFactory::getInstance($condition['type'], $condition['child']);
PwTaskDmFactory::addRewardDecoration($dm, $this->getInput('reward'));
$icon = $this->saveIcon();
$user_groups = $this->getInput('user_groups');
$is_display_all = $this->getInput('is_display_all');
/*如果全选用户组,则设置该用户组为-1*/
/* @var $userGroup PwUserGroups */
$userGroup = Wekit::load('usergroup.PwUserGroups');
$groups = $userGroup->getAllGroups();
if (!$user_groups || !array_diff(array_keys($groups), $user_groups)) {
$user_groups = array(-1);
}
$startTime = $this->getInput('start_time');
$endTime = $this->getInput('end_time');
$dm->setTaskId($id)->setTitle($this->getInput('title'))->setDescription($this->getInput('description'))->setIcon($icon)->setStartTime($startTime ? Pw::str2time($startTime) : 0)->setEndTime($endTime ? Pw::str2time($endTime . ' 23:59:59') : PwTaskDm::MAXENDTIME)->setPeriod($this->getInput('period'))->setPreTask($this->getInput('pre_task'))->setUserGroups($user_groups)->setIsAuto($this->getInput('is_auto'))->setIsDisplayAll($is_display_all)->setConditions($condition);
return $dm;
}