本文整理汇总了PHP中RedBeanPHP\R::isoDateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP R::isoDateTime方法的具体用法?PHP R::isoDateTime怎么用?PHP R::isoDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedBeanPHP\R
的用法示例。
在下文中一共展示了R::isoDateTime方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newBean
public function newBean()
{
if ($this->bean !== null) {
return $this->bean;
}
$bean = R::dispense('skemafield');
$bean->name = $this->name;
$bean->cleanName = $this->cleanName;
$bean->created = R::isoDateTime();
$bean->type = get_class($this);
$bean->prerequisite = $this->prerequisite;
return $this->bean = $bean;
}
示例2: replace
public function replace($content = '')
{
if (empty($this->name)) {
throw new Exception('Page needs name before it can be saved');
}
$userBean = Enpowi\App::user()->bean();
R::exec('UPDATE page SET is_revision = 1 WHERE name = ? and is_revision = 0', [$this->name]);
$oldBean = $this->_bean;
$originalUserBean = $userBean;
//TODO: ensure createdBy is set once and contributors is an incremental list
$bean = R::dispense('page');
$bean->name = $this->name;
$bean->content = $content;
$bean->created = R::isoDateTime();
$bean->user = $originalUserBean;
$bean->isRevision = false;
if ($oldBean !== null) {
$bean->sharedUser = $oldBean->sharedUser;
}
$bean->sharedUser[] = $userBean;
R::store($bean);
return new Page($this->name, $bean);
}
示例3: create
public static function create($name, $description)
{
$bean = R::dispense('gallery');
$bean->userId = App::user()->id;
$bean->created = R::isoDateTime();
$gallery = new Gallery(null, $bean);
return $gallery->setName($name)->setDescription($description)->save();
}
示例4: replace
public function replace($content = '', $updateCache = true)
{
if (empty($this->name)) {
throw new Exception('Blog post needs name before it can be saved');
}
$bean = $this->_bean;
if ($bean === null) {
$this->_bean = $bean = R::dispense('blog');
}
$bean->name = $this->name;
$this->content = $bean->content = $content;
$bean->edited = R::isoDateTime();
$bean->created = $this->created ?: R::isoDateTime();
$otherUserBean = App::user()->bean();
$bean->user = $this->_user !== null ? $this->_user->bean() : $otherUserBean;
$this->contributorIds[] = $otherUserBean->getID();
$this->contributorIds = array_unique($this->contributorIds);
$bean->contributorIds = implode(',', $this->contributorIds);
if (!empty($this->publishedOn)) {
$bean->publishedOn = R::isoDateTime($this->publishedOn);
} else {
$bean->publishedOn = null;
}
if ($updateCache) {
if (Event\Blog\Cache::length() > 0) {
Event\Blog\Cache::pub($this);
} else {
$this->cache = $rendered = $this->render();
$allowedTags = join('><', self::$cacheShortAllowedTagNames);
if (strlen($allowedTags) > 0) {
$allowedTags = '<' . $allowedTags . '>';
} else {
$allowedTags = null;
}
$noTagsDirty = strip_tags($rendered, $allowedTags);
$noTags = preg_replace('!\\s+!', ' ', $noTagsDirty);
if (strlen($noTags) > self::$cacheShortLimit) {
$noTags = substr($noTags, 0, self::$cacheShortLimit) . '...';
}
$this->cacheShort = $noTags;
}
$bean->cache = $this->cache;
$bean->cacheShort = $this->cacheShort;
}
$id = R::store($bean);
Event\Blog\Replace::pub($this);
return $id;
}
示例5: canValidate
public function canValidate()
{
return R::isoDateTime() - 60 * 60 * 24 < $this->_bean->validationDate;
}
示例6: save
public function save()
{
$bean = $this->_bean;
if ($bean === null) {
$bean = $this->_bean = R::dispense('file');
$bean->userId = App::get()->user()->id;
}
$bean->classType = $this->classType;
$bean->date = R::isoDateTime();
$bean->description = $this->description;
$bean->name = $this->name;
$bean->tags = $this->tags;
$bean->hash = $this->hash;
return $this->id = R::store($bean);
}
示例7: logError
public static function logError($detail = '')
{
$bean = R::dispense('error');
$bean->email = self::user()->email;
$bean->ip = self::getApi()->request->getIp();
$bean->time = R::isoDateTime();
$bean->detail = $detail;
R::store($bean);
}
示例8: softTrash
public function softTrash($bean)
{
$bean = $this->getBean($bean);
$bean->deleted_at = R::isoDateTime();
return R::store($bean);
}
示例9: Json
return new Json($post->export());
}, 'POST')->route('edit-post', '/posts/:id', function ($id) use($auth) {
$auth->authenticate();
$post = R::load('post', $id);
if ($post->id != $id) {
return new HttpStatus(HttpStatus::STATUS_204_NO_CONTENT);
}
$request = HttpContext::get()->getRequest();
if ($request->hasPost('post')) {
$post->title = $request->getPost('post', 'title');
$post->summary = $request->getPost('post', 'summary');
$post->isactive = $request->getPost('post', 'isactive');
$post->content = $request->getPost('post', 'content');
$post->controller = $request->getPost('post', 'controller');
$post->slug = $request->getPost('post', 'slug');
$post->changed = R::isoDateTime(time());
// store tags
$tags = $request->getPost('post', 'tags');
foreach ($tags as $tag) {
$rbTag = R::findOne('tag', ' tag = ?', [$tag]);
if (!$rbTag) {
$rbTag = R::dispense('tag');
$rbTag->tag = $tag;
R::store($rbTag);
}
$post->sharedTagList[] = $rbTag;
}
R::store($post);
}
return new Json($post->export());
}, 'PUT')->route('sitemap.xml', '/generate-sitemap', function () use($auth) {
示例10: replace
public function replace($content = '')
{
if (empty($this->name)) {
throw new Exception('Blog post needs name before it can be saved');
}
$bean = $this->_bean;
if ($bean === null) {
$this->_bean = $bean = R::dispense('blog');
}
$bean->name = $this->name;
$this->content = $bean->content = $content;
$bean->edited = R::isoDateTime();
$bean->created = $this->created ?: R::isoDateTime();
$otherUserBean = App::user()->bean();
$bean->user = $this->_user !== null ? $this->_user->bean() : $otherUserBean;
$this->contributorIds[] = $otherUserBean->getID();
$this->contributorIds = array_unique($this->contributorIds);
$bean->contributorIds = implode(',', $this->contributorIds);
if (!empty($this->publishedOn)) {
$bean->publishedOn = R::isoDateTime($this->publishedOn);
} else {
$bean->publishedOn = null;
}
R::store($bean);
}
示例11: beforeStoreValue
public function beforeStoreValue($valueFromUser)
{
return R::isoDateTime(strtotime($valueFromUser));
}
示例12: getBean
public function getBean()
{
if ($this->bean !== null) {
return $this->bean;
}
$bean = R::findOne('skemaset', ' name = ? ', [$this->name]);
if (empty($bean)) {
$bean = R::dispense('skemaset');
$bean->name = $this->name;
$bean->cleanName = Utility::cleanTableName($this->name);
$bean->created = R::isoDateTime();
$bean->description = '';
$bean->ownFieldList;
$bean->{'ownSkemarecord' . $this->cleanBaseName . 'List'};
}
return $this->bean = $bean;
}