本文整理汇总了PHP中JTable::store方法的典型用法代码示例。如果您正苦于以下问题:PHP JTable::store方法的具体用法?PHP JTable::store怎么用?PHP JTable::store使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JTable
的用法示例。
在下文中一共展示了JTable::store方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store($updateNulls = false)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
// Attempt to store the user data.
return parent::store($updateNulls);
}
示例2: store
public function store($updateNulls = true)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
if ($this->id) {
$this->modified_time = $date->toSql();
$this->modified_user_id = $user->get('id');
} else {
if (!(int) $this->created_time) {
$this->created_time = $date->toSql();
}
if (empty($this->created_user_id)) {
$this->created_user_id = $user->get('id');
}
}
$table = JTable::getInstance('Page', 'SppagebuilderTable');
$alias = JFilterOutput::stringURLSafe($this->alias);
if ($alias == '') {
$alias = JFilterOutput::stringURLSafe($this->title);
}
$this->alias = $alias;
if ($table->load(array('alias' => $alias)) && ($table->id != $this->id || $this->id == 0)) {
$this->setError(JText::_('COM_SPPAGEBUILDER_ERROR_UNIQUE_ALIAS'));
return false;
}
return parent::store($updateNulls);
}
示例3: store
/**
* Overload the store method for the Weblinks table.
*
* @param boolean Toggle whether null values should be updated.
* @return boolean True on success, false on failure.
* @since 1.6
*/
public function store($updateNulls = false)
{
$date = JFactory::getDate();
/*
if ($this->id)
{
// Existing item
$this->hits = $this->hits+1;
}
*/
// New item. A item created and created_by field can be set by the user,
// so we don't touch either of these if they are set.
if (!(int) $this->creation_date) {
$this->creation_date = $date->toSql();
}
// Verify that the file is
$table = JTable::getInstance('Files', 'Table');
if ($table->load(array('product_id' => $this->product_id, 'url' => $this->url)) && ($table->id != $this->id || $this->id == 0)) {
if (!($table->name == $this->name)) {
$table->name = $this->name;
$table->store();
}
return true;
}
return parent::store($updateNulls);
}
示例4: store
public function store($updateNulls = false)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
$app = JFactory::getApplication();
$db = JFactory::getDbo();
if (!$this->id) {
if (!intval($this->created)) {
$this->created = $date->toSql();
}
if (empty($this->created_by)) {
$this->created_by = $user->get('id');
}
}
$table = JTable::getInstance('Producers', 'Djcatalog2Table');
if ($app->isSite() || $app->input->get('task') == 'import') {
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) {
$db->setQuery('select alias from #__djc2_producers where id != ' . $this->id . ' and alias like ' . $db->quote($db->escape($this->alias) . '%') . ' order by alias asc');
$aliases = $db->loadColumn();
$suffix = 2;
while (in_array($this->alias . '-' . $suffix, $aliases)) {
$suffix++;
}
$this->alias = $this->alias . '-' . $suffix;
}
} else {
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) {
$this->setError(JText::_('COM_DJCATALOG2_ERROR_UNIQUE_ALIAS'));
return false;
}
}
return parent::store($updateNulls);
}
示例5: store
function store($updateNulls = false)
{
if (empty($this->name)) {
$this->name = $this->code;
}
return parent::store($updateNulls);
}
示例6: store
function store($updateNulls = false)
{
if ($this->userid != 0 && empty($this->email)) {
$user = JFactory::getUser($this->userid);
$this->email = $user->email;
}
if ($this->userid == 0 && !empty($this->email)) {
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__users'));
$query->where($db->quoteName('email') . ' = ' . $db->Quote($db->escape($this->email, true)));
$db->setQuery($query);
$users = $db->loadObjectList();
if (count($users)) {
$this->userid = $users[0]->id;
$this->name = $users[0]->name;
}
}
if (empty($this->lang)) {
$this->lang = JCommentsMultilingual::getLanguage();
}
$this->hash = $this->getHash();
return parent::store($updateNulls);
}
示例7: store
/**
* method to store a row
*
* @param boolean $updateNulls True to update fields even if they are null.
*/
function store($updateNulls = false)
{
//echo "<br>TABLE STORE:: ".$this->id;
// echo "<br>TABLE STORE:: ".$this->_getAssetName();
// Attempt to store the user data.
return parent::store($updateNulls);
}
示例8: store
/**
* Store Table override
* @override
*
* @see JTable::store()
*/
public function store($updateNulls = false)
{
$result = parent::store($updateNulls);
// If store sucessful go on to popuplate relations table for sources/datasets
if ($result) {
// Clear table from previous records
$queryDelete = "DELETE" . "\n FROM " . $this->_db->quoteName('#__jmap_dss_relations') . "\n WHERE" . "\n " . $this->_db->quoteName('datasetid') . " = " . "\n " . (int) $this->id;
if (!$this->_db->setQuery($queryDelete)->execute()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Manage multiple tuples to be inserted using single query
$selectedSources = json_decode($this->sources);
if (count($selectedSources)) {
$insertTuples = array();
foreach ($selectedSources as $source) {
$insertTuples[] = '(' . (int) $this->id . ',' . $source . ')';
}
$insertTuples = implode(',', $insertTuples);
$queryMultipleInsert = "INSERT" . "\n INTO " . $this->_db->quoteName('#__jmap_dss_relations') . "\n (" . $this->_db->quoteName('datasetid') . "," . $this->_db->quoteName('datasourceid') . ")" . "\n VALUES " . $insertTuples;
if (!$this->_db->setQuery($queryMultipleInsert)->execute()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
}
}
return $result;
}
示例9: store
public function store($updateNulls = false)
{
if (empty($this->created) || $this->created == '0000-00-00 00:00:00') {
$this->created = DiscussHelper::getDate()->toMySQL();
}
return parent::store();
}
示例10: store
/**
* Overriden JTable::store to set modified data.
*
* @param boolean $updateNulls True to update fields even if they are null.
*
* @return boolean True on success.
*
* @since 1.6
*/
public function store($updateNulls = false)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
if ($this->id) {
// Existing item
$this->modified = $date->toSql();
$this->modified_by = $user->get('id');
} else {
// New edashboard. A feed created and created_by field can be set by the user,
// so we don't touch either of these if they are set.
if (!(int) $this->created) {
$this->created = $date->toSql();
}
if (empty($this->created_by)) {
$this->created_by = $user->get('id');
}
}
// Verify that the alias is unique
$table = JTable::getInstance('Edashboard', 'EdashboardTable');
if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) {
$this->setError(JText::_('COM_EDASHBOARD_ERROR_UNIQUE_ALIAS') . ' ' . $this->alias);
return false;
}
return parent::store($updateNulls);
}
示例11: store
/**
* Overrides JTable::store to check unique fields.
*
* @param boolean $updateNulls True to update fields even if they are null.
*
* @return boolean True on success.
*
* @since 11.4
*/
public function store($updateNulls = false)
{
// Verify that the sef field is unique
$table = JTable::getInstance('Language', 'JTable');
if ($table->load(array('sef' => $this->sef)) && ($table->lang_id != $this->lang_id || $this->lang_id == 0))
{
$this->setError(JText::_('JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_SEF'));
return false;
}
// Verify that the image field is unique
if ($table->load(array('image' => $this->image)) && ($table->lang_id != $this->lang_id || $this->lang_id == 0))
{
$this->setError(JText::_('JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_IMAGE'));
return false;
}
// Verify that the language code is unique
if ($table->load(array('lang_code' => $this->lang_code)) && ($table->lang_id != $this->lang_id || $this->lang_id == 0))
{
$this->setError(JText::_('JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_LANG_CODE'));
return false;
}
return parent::store($updateNulls);
}
示例12: store
public function store()
{
$now = new JDate();
// Always update the stream last updated time
$this->updated = $now->toMySQL();
return parent::store();
}
示例13: store
function store($updateNulls = false)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
if ($this->id) {
// Existing item
$this->modified = $date->toSql();
$this->modified_by = $user->get('id');
}
// New product. A product created and created_by field can be set by the user,
// so we don't touch either of these if they are set.
if (!(int) $this->created) {
$this->created = $date->toSql();
}
if (empty($this->created_by)) {
$this->created_by = $user->get('id');
}
// Set publish_up to null date if not set
if (!$this->publish_up) {
$this->publish_up = $this->_db->getNullDate();
}
// Set publish_down to null date if not set
if (!$this->publish_down) {
$this->publish_down = $this->_db->getNullDate();
}
// Verify that the alias is unique
$table = JTable::getInstance('Product', 'Table');
if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) {
$this->setError(JText::_('COM_DIGICOM_ERROR_UNIQUE_ALIAS'));
return false;
}
return parent::store($updateNulls);
}
示例14: store
public function store($updateNulls = false)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
$app = JFactory::getApplication();
$db = JFactory::getDbo();
$id = (int) $this->id;
$country_id = (int) $this->country_id;
$tax_rate = (int) $this->tax_rate_id;
$client = substr(strtoupper($this->client_type), 0, 1);
$this->client_type = $client;
$query = $db->getQuery(true);
$where = array();
$query->select('count(*)');
$query->from('#__djc2_tax_rules');
if ($id) {
$where[] = 'id != ' . $id;
}
if ($country_id > 0) {
$where[] = 'country_id=' . $country_id;
}
$where[] = 'tax_rate_id=' . $tax_rate;
$query->where($where);
$db->setQuery($query);
$count = $db->loadResult();
if ($count > 0) {
$this->setError(JText::_('COM_DJCATALOG2_ERROR_UNIQUE_TAX_RULE'));
return false;
}
return parent::store($updateNulls);
}
示例15: store
/**
* method to store a row
*
* @param boolean $updateNulls True to update fields even if they are null.
*/
function store($updateNulls = false)
{
if (empty($this->id)) {
// Store the row
parent::store($updateNulls);
} else {
// Get the old row
$oldrow = JTable::getInstance('Comment', 'Jnt_HanhphucTable');
if (!$oldrow->load($this->id) && $oldrow->getError()) {
$this->setError($oldrow->getError());
}
// Verify that the alias is unique
$table = JTable::getInstance('Comment', 'Jnt_HanhphucTable');
if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) {
$this->setError(JText::_('COM_BANNERS_ERROR_UNIQUE_ALIAS'));
return false;
}
// Store the new row
parent::store($updateNulls);
// Need to reorder ?
if ($oldrow->state >= 0 && ($this->state < 0 || $oldrow->catid != $this->catid)) {
// Reorder the oldrow
$this->reorder($this->_db->quoteName('catid') . '=' . $this->_db->Quote($oldrow->catid) . ' AND state>=0');
}
}
return count($this->getErrors()) == 0;
}