本文整理汇总了PHP中JTableNested::store方法的典型用法代码示例。如果您正苦于以下问题:PHP JTableNested::store方法的具体用法?PHP JTableNested::store怎么用?PHP JTableNested::store使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JTableNested
的用法示例。
在下文中一共展示了JTableNested::store方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store($updateNulls = false)
{
// Verify that the alias is unique
$table = JTable::getInstance('Category', 'Table', array('dbo' => $this->getDbo()));
if ($table->load(array('alias' => $this->alias, 'parent_id' => $this->parent_id)) && ($table->id != $this->id || $this->id == 0)) {
$this->setError(JText::_('JLIB_DATABASE_ERROR_CATEGORY_UNIQUE_ALIAS'));
return false;
}
return parent::store($updateNulls);
}
示例2: store
/**
* Overriden JTable::store to set created/modified and user id.
*
* @param boolean True to update fields even if they are null.
* @return boolean True on success.
*/
public function store($updateNulls = false)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
if ($this->id) {
// Existing category
$this->modified_time = $date->toMySQL();
$this->modified_user_id = $user->get('id');
} else {
// New category
$this->created_time = $date->toMySQL();
$this->created_user_id = $user->get('id');
}
return parent::store($updateNulls);
}
示例3: store
/**
* Method to store a row in the database from the JTable instance properties.
* If a primary key value is set the row with that primary key value will be
* updated with the instance property values. If no primary key value is set
* a new row will be inserted into the database with the properties from the
* JTable instance.
*
* @param boolean $updateNulls True to update fields even if they are null.
*
* @return boolean True on success.
*
* @link http://docs.joomla.org/JTable/store
* @since 11.1
*/
public function store($updateNulls = false)
{
$user = JFactory::getUser();
$date = JFactory::getDate();
if (!$this->id && property_exists($this, 'created')) {
$this->created = $date->toSql();
}
if (!$this->id && property_exists($this, 'created_by')) {
$this->created_by = $user->get('id');
}
if ($this->id && property_exists($this, 'modified')) {
$this->modified = $date->toSql();
}
if ($this->id && property_exists($this, 'modified_by')) {
$this->modified_by = $user->get('id');
}
if (property_exists($this, 'language') && !$this->language) {
$this->language = '*';
}
return parent::store($updateNulls);
}
示例4: store
/**
* Overloaded store function
*
* @param boolean $updateNulls True to update fields even if they are null.
*
* @return mixed False on failure, positive integer on success.
*
* @see JTable::store
* @since 11.1
*/
public function store($updateNulls = false)
{
$updated = parent::store($updateNulls);
// Verify that the alias is unique
$table = JTable::getInstance('Addon', 'oseMscTable');
$table->load($this->getRootId());
$table->rebuild($this->getRootId(), $table->lft, $table->level);
return $updated;
/*if($this->id != $this->getRootId())
{
$table->load($this->parent_id);
// Rebuild the paths of the category's children:
//oseExit($table);
if (!$table->rebuild($table->id, $table->lft, $table->level) && $updated) {
return false;
}
}
return $updated;*/
//$table->load($table->getRootId());
// Use new path for partial rebuild of table
// Rebuild will return positive integer on success, false on failure
//return ($table->rebuild());
//return ($this->rebuild($this->{$this->_tbl_key}, $this->lft, $this->level) > 0);
}
示例5: store
/**
* Method to store a node in the database table.
*
* @param boolean $updateNulls True to update null values as well.
*
* @return boolean True on success.
*/
public function store($updateNulls = false)
{
$dispatcher = RFactory::getDispatcher();
// Import plugin types
if ($this->_eventBeforeStore || $this->_eventAfterStore) {
foreach ($this->_pluginTypesToImport as $type) {
JPluginHelper::importPlugin($type);
}
}
// Trigger before store
if ($this->_eventBeforeStore) {
$results = $dispatcher->trigger($this->_eventBeforeStore, array($this, $updateNulls));
if (count($results) && in_array(false, $results, true)) {
return false;
}
}
// Store
if (!parent::store($updateNulls)) {
return false;
}
// Trigger after store
if ($this->_eventAfterStore) {
$results = $dispatcher->trigger($this->_eventAfterStore, array($this, $updateNulls));
if (count($results) && in_array(false, $results, true)) {
return false;
}
}
return true;
}
示例6: store
/**
* Overriden JTable::store to set modified data and user id.
*
* @param boolean $updateNulls True to update fields even if they are null.
*
* @return boolean True on success.
*
* @since 3.1
*/
public function store($updateNulls = false)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
$this->modified_time = $date->toSql();
if ($this->id) {
// Existing item
$this->modified_user_id = $user->get('id');
} else {
// New tag. A tag 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_time) {
$this->created_time = $date->toSql();
}
if (empty($this->created_user_id)) {
$this->created_user_id = $user->get('id');
}
}
// Verify that the alias is unique
$table = JTable::getInstance('Tag', 'TagsTable', array('dbo' => $this->_db));
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) {
$this->setError(JText::_('COM_TAGS_ERROR_UNIQUE_ALIAS'));
return false;
}
return parent::store($updateNulls);
}
示例7: store
/**
* Overridden JTable::store to set created/modified and user id.
*
* @param boolean $updateNulls True to update fields even if they are null.
*
* @return boolean True on success.
*
* @since 11.1
*/
public function store($updateNulls = false)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
$this->modified_time = $date->toSql();
if ($this->id) {
// Existing category
$this->modified_user_id = $user->get('id');
} else {
// New category. A category created_time and created_user_id field can be set by the user,
// so we don't touch either of these if they are set.
if (!(int) $this->created_time) {
$this->created_time = $date->toSql();
}
if (empty($this->created_user_id)) {
$this->created_user_id = $user->get('id');
}
}
// Verify that the alias is unique
$table = JTable::getInstance('Category', 'JTable', array('dbo' => $this->getDbo()));
if ($table->load(array('alias' => $this->alias, 'parent_id' => (int) $this->parent_id, 'extension' => $this->extension)) && ($table->id != $this->id || $this->id == 0)) {
$this->setError(JText::_('JLIB_DATABASE_ERROR_CATEGORY_UNIQUE_ALIAS'));
return false;
}
return parent::store($updateNulls);
}
示例8: store
/**
* Overridden JTable::store to set created/modified and user id.
*
* @param boolean $updateNulls True to update fields even if they are null.
*
* @return boolean True on success.
*
* @since 11.1
*/
public function store($updateNulls = false)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
if ($this->id) {
// Existing category
$this->modified_time = $date->toSql();
$this->modified_user_id = $user->get('id');
} else {
// New category
$this->created_time = $date->toSql();
$this->created_user_id = $user->get('id');
}
// Verify that the alias is unique
$table = JTable::getInstance('Category', 'JTable', array('dbo' => $this->getDbo()));
if ($table->load(array('alias' => $this->alias, 'parent_id' => $this->parent_id, 'extension' => $this->extension)) && ($table->id != $this->id || $this->id == 0)) {
$this->setError(JText::_('JLIB_DATABASE_ERROR_CATEGORY_UNIQUE_ALIAS'));
return false;
}
$this->tagsHelper->typeAlias = $this->extension . '.category';
$this->tagsHelper->preStoreProcess($this);
$result = parent::store($updateNulls);
return $result && $this->tagsHelper->postStoreProcess($this);
}
示例9: store
public function store($updateNulls = false)
{
$app = JFactory::getApplication();
if ($app->isSite()) {
if ($this->_comment_latest) {
$timeNow = strtotime($this->created);
$waiting = $this->_comment_latest + $this->_comment_interval - $timeNow;
if ($waiting > 0) {
$this->setError($this->getErrorForIntervalComment($waiting));
return false;
}
}
if ($this->_comment_latest_same_listing > 0) {
$timeNow = strtotime($this->created);
$waiting = $this->_comment_latest_same_listing + $this->_comment_interval_same_listing - $timeNow;
if ($waiting > 0) {
$this->setError($this->getErrorForIntervalComment($waiting));
return false;
}
}
}
if (!parent::store($updateNulls)) {
$this->setError(JText::_('COM_JUDIRECTORY_COMMENT_FAILED'));
return false;
}
return true;
}
示例10: store
/**
* Overloaded store function
*
* @param boolean $updateNulls True to update fields even if they are null.
*
* @return mixed False on failure, positive integer on success.
*
* @see JTable::store()
* @since 11.1
*/
public function store($updateNulls = false)
{
$db = JFactory::getDbo();
// Verify that the alias is unique
$table = JTable::getInstance('Menu', 'JTable', array('dbo' => $this->getDbo()));
if ($table->load(array('alias' => $this->alias, 'parent_id' => $this->parent_id, 'client_id' => (int) $this->client_id, 'language' => $this->language)) && ($table->id != $this->id || $this->id == 0)) {
if ($this->menutype == $table->menutype) {
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS'));
} else {
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS_ROOT'));
}
return false;
}
// Verify that the home page for this language is unique
if ($this->home == '1') {
$table = JTable::getInstance('Menu', 'JTable', array('dbo' => $this->getDbo()));
if ($table->load(array('home' => '1', 'language' => $this->language))) {
if ($table->checked_out && $table->checked_out != $this->checked_out) {
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_DEFAULT_CHECKIN_USER_MISMATCH'));
return false;
}
$table->home = 0;
$table->checked_out = 0;
$table->checked_out_time = $db->getNullDate();
$table->store();
}
// Verify that the home page for this menu is unique.
if ($table->load(array('home' => '1', 'menutype' => $this->menutype)) && ($table->id != $this->id || $this->id == 0)) {
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_HOME_NOT_UNIQUE_IN_MENU'));
return false;
}
}
if (!parent::store($updateNulls)) {
return false;
}
// Get the new path in case the node was moved
$pathNodes = $this->getPath();
$segments = array();
foreach ($pathNodes as $node) {
// Don't include root in path
if ($node->alias != 'root') {
$segments[] = $node->alias;
}
}
$newPath = trim(implode('/', $segments), ' /\\');
// Use new path for partial rebuild of table
// Rebuild will return positive integer on success, false on failure
return $this->rebuild($this->{$this->_tbl_key}, $this->lft, $this->level, $newPath) > 0;
}
示例11: store
/**
* Overloaded store function
*
* @param boolean $updateNulls True to update null values as well.
* @return boolean True on success, false otherwise
* @since 1.5.7
*/
public function store($updateNulls = false)
{
if (!parent::store($updateNulls)) {
return false;
}
// If there aren't any sub categories there isn't anything to do anymore
$cats = JoomHelper::getAllSubCategories($this->cid, false, true, true, false);
if (!count($cats)) {
return true;
}
// Set state of all sub-categories
// according to the settings of this category
$query = $this->_db->getQuery(true)->update(_JOOM_TABLE_CATEGORIES)->set('published = ' . (int) $this->published)->where('cid IN (' . implode(',', $cats) . ')');
$this->_db->setQuery($query);
if (!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Set 'in_hidden' of all sub-categories
// according to hidden state of this category
// (but only if there was a change of this state)
if ($this->_hidden != $this->hidden && !$this->in_hidden || $this->_in_hidden != $this->in_hidden) {
if ($this->hidden == 0 && $this->in_hidden == 0) {
// If 'hidden' is 0 only the categories
// which aren't set to hidden must be changed
// because they form a hidden group themselves
// anyway and have to stay hidden
$cats = JoomHelper::getAllSubCategories($this->cid, false, true, true, true);
}
$query = $this->_db->getQuery(true)->update(_JOOM_TABLE_CATEGORIES)->set('in_hidden = ' . (int) ($this->hidden || $this->in_hidden))->where('cid IN (' . implode(',', $cats) . ')');
$this->_db->setQuery($query);
if (!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
}
return true;
}
示例12: store
/**
* Method to store a node in the database table.
*
* @param boolean $updateNulls True to update null values as well.
*
* @return boolean True on success.
*/
public function store($updateNulls = false)
{
// Before store
if (!$this->beforeStore($updateNulls)) {
return false;
}
// Store
if (!parent::store($updateNulls)) {
return false;
}
// After store
if (!$this->afterStore($updateNulls)) {
return false;
}
return true;
}
示例13: store
/**
* Overriden JTable::store to set created/modified and user id.
*
* @param boolean True to update fields even if they are null.
*
* @return boolean True on success.
*
* @since 11.1
*/
public function store($updateNulls = false)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
if ($this->id) {
// Existing category
$this->modified_time = $date->toMySQL();
$this->modified_user_id = $user->get('id');
} else {
// New category
$this->created_time = $date->toMySQL();
$this->created_user_id = $user->get('id');
}
// Verify that the alias is unique
$table = JTable::getInstance('Category', 'JTable');
if ($table->load(array('alias' => $this->alias, 'parent_id' => $this->parent_id, 'extension' => $this->extension)) && ($table->id != $this->id || $this->id == 0)) {
$this->setError(JText::_('JLIB_DATABASE_ERROR_CATEGORY_UNIQUE_ALIAS'));
return false;
}
return parent::store($updateNulls);
}
示例14: store
/**
* Overloaded store function
*
* @param boolean $updateNulls True to update fields even if they are null.
*
* @return mixed False on failure, positive integer on success.
*
* @see JTable::store()
* @since 11.1
*/
public function store($updateNulls = false)
{
$db = JFactory::getDbo();
// Verify that the alias is unique
$table = JTable::getInstance('Menu', 'JTable', array('dbo' => $this->getDbo()));
$originalAlias = trim($this->alias);
$this->alias = !$originalAlias ? $this->title : $originalAlias;
$this->alias = JApplicationHelper::stringURLSafe(trim($this->alias), $this->language);
// If alias still empty (for instance, new menu item with chinese characters with no unicode alias setting).
if (empty($this->alias)) {
$this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
} else {
$itemSearch = array('alias' => $this->alias, 'parent_id' => $this->parent_id, 'client_id' => (int) $this->client_id);
$errorType = '';
// Check if the alias already exists. For multilingual site.
if (JLanguageMultilang::isEnabled()) {
// If not exists a menu item at the same level with the same alias (in the All or the same language).
if ($table->load(array_replace($itemSearch, array('language' => '*'))) && ($table->id != $this->id || $this->id == 0) || $table->load(array_replace($itemSearch, array('language' => $this->language))) && ($table->id != $this->id || $this->id == 0) || $this->language == '*' && $table->load($itemSearch) && ($table->id != $this->id || $this->id == 0)) {
$errorType = 'MULTILINGUAL';
}
} else {
// If not exists a menu item at the same level with the same alias (in any language).
if ($table->load($itemSearch) && ($table->id != $this->id || $this->id == 0)) {
$errorType = 'MONOLINGUAL';
}
}
// The alias already exists. Send an error message.
if ($errorType) {
$message = JText::_('JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS' . ($this->menutype != $table->menutype ? '_ROOT' : ''));
$this->setError($message);
return false;
}
}
if ($this->home == '1') {
// Verify that the home page for this menu is unique.
if ($table->load(array('menutype' => $this->menutype, 'client_id' => (int) $this->client_id, 'home' => '1')) && $table->language != $this->language) {
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_HOME_NOT_UNIQUE_IN_MENU'));
return false;
}
// Verify that the home page for this language is unique
if ($table->load(array('home' => '1', 'language' => $this->language))) {
if ($table->checked_out && $table->checked_out != $this->checked_out) {
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_DEFAULT_CHECKIN_USER_MISMATCH'));
return false;
}
$table->home = 0;
$table->checked_out = 0;
$table->checked_out_time = $db->getNullDate();
$table->store();
}
}
if (!parent::store($updateNulls)) {
return false;
}
// Get the new path in case the node was moved
$pathNodes = $this->getPath();
$segments = array();
foreach ($pathNodes as $node) {
// Don't include root in path
if ($node->alias != 'root') {
$segments[] = $node->alias;
}
}
$newPath = trim(implode('/', $segments), ' /\\');
// Use new path for partial rebuild of table
// Rebuild will return positive integer on success, false on failure
return $this->rebuild($this->{$this->_tbl_key}, $this->lft, $this->level, $newPath) > 0;
}
示例15: store
public function store($updateNulls = false)
{
$categoryTable = JTable::getInstance('Category', 'JUDownloadTable');
if ($categoryTable->load(array('alias' => $this->alias, 'parent_id' => $this->parent_id)) && ($categoryTable->id != $this->id || $this->id == 0)) {
$this->setError(JText::sprintf('COM_JUDOWNLOAD_AN_OTHER_CATEGORY_IN_THE_SAME_PARENT_CATEGORY_HAS_THE_SAME_ALIAS_X', $this->alias));
return false;
}
return parent::store($updateNulls);
}