本文整理汇总了PHP中R::isoDateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP R::isoDateTime方法的具体用法?PHP R::isoDateTime怎么用?PHP R::isoDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类R
的用法示例。
在下文中一共展示了R::isoDateTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addToList
public function addToList($type, $value)
{
$ban = R::dispense('banlist');
$ban->type = $type;
$ban->value = $value;
$ban->created = R::isoDateTime();
$id = R::store($ban);
return $id;
}
示例2: add
public static function add($f3, $path)
{
$cache_file = R::findOne("cache", "path = ?", [$path]);
if (is_null($cache_file)) {
$cache_file = R::dispense("cache");
$cache_file->path = $path;
$cache_file->filesize = filesize($path);
}
$cache_file->datetime = R::isoDateTime();
R::store($cache_file);
}
示例3: add
public function add($postId, $text, $username, $userId = null)
{
$comment = R::dispense('comments');
$comment['post_id'] = $postId;
$comment['text'] = $text;
$comment['date'] = R::isoDateTime();
$comment['username'] = $username;
$comment['user_id'] = $userId;
$commentId = R::store($comment);
return $commentId;
}
示例4: create
public function create($title, $text, $tags)
{
$post = R::dispense('posts');
$post['title'] = $title;
$post['text'] = $text;
$post['date'] = R::isoDateTime();
$post['visits'] = 0;
$post['username'] = $_SESSION['username'];
$post['user_id'] = $_SESSION['userId'];
$post->sharedTagsList = $this->processTags($tags);
$postId = R::store($post);
return $postId;
}
示例5: create_photo_model
function create_photo_model($options = array())
{
$photo = \R::dispense('photo');
foreach ($options as $key => $value) {
if ($key != 'tags') {
$photo->{$key} = $value;
}
}
# Add metadata we want to keep:
$photo->moderated = false;
$photo->created_at = array_key_exists('created_at', $photo) ? \DateTime::createFromFormat(\DateTime::ISO8601, $photo->created_at) : \R::isoDateTime();
$id = \R::store($photo);
}
示例6: completar
public static function completar()
{
//global $logged;
if (isset($_POST['id'])) {
$request = R::load('request', $_POST['id']);
$completed = R::dispense('completed');
$completed->import($request->export(), 'name, user_id');
$completed->date = R::isoDateTime();
$completed->agregado = $request->date;
$id = R::store($completed);
R::trash($request);
echo json_encode(["exito" => 1]);
}
}
示例7: createSubscription
public function createSubscription($subscription_for)
{
if (!$this->isUserSubscribed()) {
$user = R::dispense('subscriptions');
$user->email = $this->_email;
$user->category_id = $this->_category_id;
$user->city_id = $this->_city_id;
$user->token = token();
$user->is_confirmed = 0;
$user->created = R::isoDateTime();
$id = R::store($user);
$notif = new Notifications();
$notif->createSubscriptionMail($id, $user->token, $user->email, $subscription_for);
return $id;
}
return false;
}
示例8: create_log
/**
* 記錄下載對象
* @param Object $f3
* @param RedBean $file
* @param String $action 動作
* @return RedBean $file
*/
static function create_log($f3, $file, $action)
{
$log = R::dispense("log");
$log->file_id = $file->id;
$log->action = $action;
$log->datetime = R::isoDateTime();
// 上傳IP
$client_ip = PFH_Client_helper::get_client_ip($f3);
//$data["client_ip"] = $client_ip;
$log->client_ip = $client_ip;
// 來源網頁
$http_referer = getenv("HTTP_REFERER");
//$data["http_referer"] = $http_referer;
$log->http_referer = $http_referer;
$log->agent = $f3->get("AGENT");
R::store($log);
return $file;
}
示例9: addEdit
function addEdit()
{
global $db_name;
$edit = isset($_POST['edit']);
$type = $_REQUEST['type'];
$errors = array();
$db = $edit ? R::load($db_name, (int) $_POST['edit']) : R::dispense($db_name);
foreach ($_POST as $key => $val) {
if (substr($key, 0, 3) != 'db_') {
continue;
}
$db->{substr($key, 3)} = $val;
}
$filename = pickFilename(array($_POST['db_sponsor_name'], $_POST['db_title']));
$max_width = 0;
if ($type == 'videos') {
$max_width = 150;
} else {
if ($type == 'channels') {
$max_width = 230;
}
}
$image_url = imageUpload($filename, $max_width);
if ($image_url) {
$db->image_url = $image_url;
} else {
$errors[] = 'Image upload failed.';
}
if ($type == 'channels') {
$db->video_list = json_encode($_REQUEST['video_urls']);
}
if (!$edit) {
$db->created_on = R::isoDateTime();
} else {
$db->updated_on = R::isoDateTime();
}
$id = R::store($db);
$returnArr = $db->export();
if (!empty($errors)) {
$returnArr['errors'] = $errors;
}
jsonForAjax($returnArr);
}
示例10: applyForJob
public function applyForJob($data)
{
$apply = R::dispense('applications');
$apply->job_id = $this->_job_id;
$apply->cover_letter = $data['cover_letter'];
$apply->full_name = $data['full_name'];
$apply->email = $data['email'];
$apply->location = $data['location'];
$apply->websites = $data['websites'];
$apply->attachment = $data['attachment'];
$apply->token = $data['token'];
$apply->created = R::isoDateTime();
$id = R::store($apply);
$job = R::load('jobs', $this->_job_id);
$data['title'] = $job->title;
$data['recipient'] = $job->email;
$notif = new Notifications();
if ($notif->applyForJobMail($data)) {
return $id;
}
return false;
}
示例11: propareVO
public function propareVO()
{
// Get data from post
$username = stripslashes(trim($_POST['userid']));
// user id
$pwd = md5(trim($_POST['pwd']));
$email = trim($_POST['email']);
$regtime = R::isoDateTime();
$token = md5($username . $pwd . $regtime);
//create activation token
$token_exptime = time() + 60 * 60 * 24;
//expire time 24 hours
// create a vo for convey object info
$user = new User();
$user->setUserName($username);
$user->setPassword($pwd);
$user->setEmail($email);
$user->setToken($token);
$user->setTokenExptime($token_exptime);
$user->setRegTime($regtime);
return $user;
}
示例12: crear
public static function crear()
{
if (isset($_POST['user']['name']) && isset($_POST['user']['password'])) {
$usuario = $_POST['user']['name'];
$password = hash("sha256", $_POST['user']['password']);
$user = R::findOne('user', ' name = :name AND password = :password ', array(':name' => $usuario, ':password' => $password));
if ($user == null) {
$_SESSION['flash'] = 'Error al autenticar. Usuario/Contraseña incorrectos.';
header('Location:/entrar');
} else {
$_SESSION['flash'] = 'Autenticado correctamente';
$session = R::dispense('session');
$session->name = $user->name;
$session->hora = R::isoDateTime();
$session->ip = $_SERVER['REMOTE_ADDR'];
$id = R::store($session);
$session->id = $id;
setcookie('logged', json_encode($session->export()), time() * 2);
header('Location:/');
}
}
}
示例13: jobCreateUpdate
public function jobCreateUpdate($data, $status = INACTIVE)
{
if (isset($data['id']) && $data['id'] != '' && $this->getJobFromToken($data['token'])) {
$job = R::load('jobs', $data['id']);
$data['email'] = $job->email;
} else {
$job = R::dispense('jobs');
$job->created = R::isoDateTime();
$job->email = $data['email'];
$job->token = $data['token'];
$job->status = $status;
}
$job->title = $data['title'];
$job->category = $data['category'];
$job->city = $data['city'];
$job->description = $data['description'];
$job->perks = $data['perks'];
$job->how_to_apply = $data['how_to_apply'];
$job->company_name = $data['company_name'];
$job->logo = $data['logo'];
$job->url = $data['url'];
$job->is_featured = $data['is_featured'];
$id = R::store($job);
$data['access'] = accessToken($id);
// send user an email if job is inactive
if (!$job->status && $data['step'] == 3) {
$notif = new Notifications();
if ($notif->jobCreateUpdateMail($data)) {
return true;
}
}
if ($id > 0) {
return $id;
}
return false;
}
示例14: sendEmailsToSubscribersMail
public function sendEmailsToSubscribersMail($job_id)
{
global $categories, $cities;
$message = '';
$content = '';
// get job information
$j = new Jobs($job_id);
$job = $j->showJobDetails();
$title = $j->getSlugTitle();
$category_name = $categories[$job->category]['name'];
$city_name = $cities[$job->city]['name'];
$job_link = BASE_URL . "jobs/{$job->id}/{$title}";
$description = Parsedown::instance()->parse($job->description);
$content .= "<p>Job Details</p>";
$content .= "<p>-----------</p>";
$content .= "<p><a href={$job_link}>{$job_link}</a></p>";
$content .= "<p>Title: <strong>{$job->title}</strong></p>";
$content .= "<p>Description: {$description}</p>";
if ($job->perks != '') {
$content .= "<p>Perks: {$job->perks}</p>";
}
$content .= "<p>How to apply: {$job->how_to_apply}</p>";
$content .= "<p>-----------</p>";
// get all users subscribed to the job
$users = R::findAll('subscriptions', " is_confirmed=1 AND (category_id=:category_id OR city_id=:city_id) ", array(':category_id' => $job->category, ':city_id' => $job->city));
foreach ($users as $user) {
$link = BASE_URL . "subscribe/{$user->id}/delete/{$user->token}";
$name = $user->category_id > 0 ? $category_name : $city_name;
$subject = "A new {$name} job was posted at {$this->app_name}";
$message .= "<p>You subcribed to receive {$name} jobs on {$this->app_name}.</p>";
$message .= $content;
$message .= "<p>To unsubscribe, click this link to stop receiving alerts.</p>";
$message .= "<p><a href={$link}>{$link}</a></p>";
if ($this->sendNotification($subject, $message, $user->email)) {
$update = R::load('subscriptions', $user->id);
$update->last_sent = R::isoDateTime();
R::store($update);
}
}
}
示例15: testBeautifulColumnNames
/**
* Test beautification of column names.
*
* @return void
*/
public function testBeautifulColumnNames()
{
testpack('Beautiful column names');
$town = R::dispense('town');
$town->isCapital = FALSE;
$town->hasTrainStation = TRUE;
$town->name = 'BeautyVille';
$houses = R::dispense('house', 2);
$houses[0]->isForSale = TRUE;
$town->ownHouse = $houses;
R::store($town);
$town = R::load('town', $town->id);
asrt($town->isCapital == FALSE, TRUE);
asrt($town->hasTrainStation == TRUE, TRUE);
asrt($town->name == 'BeautyVille', TRUE);
testpack('Accept datetime objects.');
$cal = R::dispense('calendar');
$cal->when = new DateTime('2000-01-01', new DateTimeZone('Pacific/Nauru'));
asrt($cal->when, '2000-01-01 00:00:00');
testpack('Affected rows test');
$currentDriver = $this->currentlyActiveDriverID;
$toolbox = R::$toolbox;
$adapter = $toolbox->getDatabaseAdapter();
$writer = $toolbox->getWriter();
$redbean = $toolbox->getRedBean();
$pdo = $adapter->getDatabase();
$bean = $redbean->dispense('bean');
$bean->prop = 3;
//make test run with strict mode as well
$redbean->store($bean);
$adapter->exec('UPDATE bean SET prop = 2');
asrt($adapter->getAffectedRows(), 1);
testpack('Testing Logger');
R::$adapter->getDatabase()->setLogger(new RedBean_Logger_Default());
asrt(R::$adapter->getDatabase()->getLogger() instanceof RedBean_Logger, TRUE);
asrt(R::$adapter->getDatabase()->getLogger() instanceof RedBean_Logger_Default, TRUE);
$bean = R::dispense('bean');
$bean->property = 1;
$bean->unsetAll(array('property'));
asrt($bean->property, NULL);
asrt($bean->setAttr('property', 2) instanceof RedBean_OODBBean, TRUE);
asrt($bean->property, 2);
asrt(preg_match('/\\d\\d\\d\\d\\-\\d\\d\\-\\d\\d/', R::isoDate()), 1);
asrt(preg_match('/\\d\\d\\d\\d\\-\\d\\d\\-\\d\\d\\s\\d\\d:\\d\\d:\\d\\d/', R::isoDateTime()), 1);
$redbean = R::getRedBean();
$adapter = R::getDatabaseAdapter();
$writer = R::getWriter();
asrt($redbean instanceof RedBean_OODB, TRUE);
asrt($adapter instanceof RedBean_Adapter, TRUE);
asrt($writer instanceof RedBean_QueryWriter, TRUE);
R::setRedBean($redbean);
pass();
//cant really test this
R::setDatabaseAdapter($adapter);
pass();
//cant really test this
R::setWriter($writer);
pass();
//cant really test this
$u1 = R::dispense('user');
$u1->name = 'Gabor';
$u1->login = 'g';
$u2 = R::dispense('user');
$u2->name = 'Eric';
$u2->login = 'e';
R::store($u1);
R::store($u2);
$list = R::getAssoc('select login,' . R::$writer->esc('name') . ' from ' . R::$writer->esc('user') . ' ');
asrt($list['e'], 'Eric');
asrt($list['g'], 'Gabor');
$painting = R::dispense('painting');
$painting->name = 'Nighthawks';
$id = R::store($painting);
testpack('Testing Plugin Cooker');
$cooker = new RedBean_Plugin_Cooker();
$cooker->setToolbox($toolbox);
try {
asrt($cooker->graph('abc'), 'abc');
fail();
} catch (RedBean_Exception_Security $e) {
pass();
}
testpack('Testing SQL Error Types');
foreach ($writer->typeno_sqltype as $code => $text) {
asrt(is_integer($code), TRUE);
asrt(is_string($text), TRUE);
}
foreach ($writer->sqltype_typeno as $text => $code) {
asrt(is_integer($code), TRUE);
asrt(is_string($text), TRUE);
}
testpack('Testing Nowhere Pt. 1 (unfrozen)');
foreach (array('exec', 'getAll', 'getCell', 'getAssoc', 'getRow', 'getCol') as $method) {
R::$method('select * from nowhere');
pass();
//.........这里部分代码省略.........