- md5
- f886c8c62301ab9b503218dffc0f9170
- sha1
- 064be8d1de8d40494802309bbf2f1b4887139c3a
- sha256
- 0331a7d067328c9c986fde4bdb6456d96d05f30c6b11b8ad8b2f132a090b1fdf
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
<?php
/**
* @package Joomla.Administrator
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Users\Administrator\Table;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Table\Table;
use Joomla\Database\DatabaseDriver;
use Joomla\Utilities\ArrayHelper;
/**
* User notes table class
*
* @since 2.5
*/
class NoteTable extends Table
{
/**
* Constructor
*
* @param DatabaseDriver $db Database object
*
* @since 2.5
*/
public function __construct(DatabaseDriver $db)
{
$this->typeAlias = 'com_users.note';
parent::__construct('#__user_notes', 'id', $db);
$this->setColumnAlias('published', 'state');
}
/**
* Overloaded store method for the notes table.
*
* @param boolean $updateNulls Toggle whether null values should be updated.
*
* @return boolean True on success, false on failure.
*
* @since 2.5
*/
public function store($updateNulls = false)
{
$date = Factory::getDate()->toSql();
$userId = Factory::getUser()->get('id');
if (!((int) $this->review_time))
{
// Null date.
$this->review_time = $this->getDbo()->getNullDate();
}
if ($this->id)
{
// Existing item
$this->modified_time = $date;
$this->modified_user_id = $userId;
}
else
{
// New record.
$this->created_time = $date;
$this->created_user_id = $userId;
}
// Attempt to store the data.
return parent::store($updateNulls);
}
/**
* Method to perform sanity checks on the Table instance properties to ensure they are safe to store in the database.
*
* @return boolean True if the instance is sane and able to be stored in the database.
*
* @since 4.0.0
*/
public function check()
{
try
{
parent::check();
}
catch (\Exception $e)
{
$this->setError($e->getMessage());
return false;
}
if (empty($this->modified_time))
{
$this->modified_time = $this->getDbo()->getNullDate();
}
return true;
}
}
The same content is in 3 releases, Joomla 4.0.0-alpha7 to 4.0.0-alpha9. See them all, or every version of this file.