本文整理汇总了PHP中JModelAdmin::checkregionId方法的典型用法代码示例。如果您正苦于以下问题:PHP JModelAdmin::checkregionId方法的具体用法?PHP JModelAdmin::checkregionId怎么用?PHP JModelAdmin::checkregionId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JModelAdmin
的用法示例。
在下文中一共展示了JModelAdmin::checkregionId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: batchCopy
/**
* Batch copy items to a new category or current.
*
* @param integer $value The new category.
* @param array $pks An array of row IDs.
* @param array $contexts An array of item contexts.
*
* @return mixed An array of new IDs on success, boolean false on failure.
*
* @since 11.1
*/
protected function batchCopy($value, $pks, $contexts)
{
$regionId = (int) $value;
$newIds = array();
if (!parent::checkregionId($regionId)) {
return false;
}
// Parent exists so we let's proceed
while (!empty($pks)) {
// Pop the first ID off the stack
$pk = array_shift($pks);
$this->table->reset();
// Check that the row actually exists
if (!$this->table->load($pk)) {
if ($error = $this->table->getError()) {
// Fatal error
$this->setError($error);
return false;
} else {
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
// Alter the title & alias
$data = $this->generateNewTitle($regionId, $this->table->alias, $this->table->title);
$this->table->title = $data['0'];
$this->table->alias = $data['1'];
// Reset the ID because we are making a copy
$this->table->id = 0;
// Reset hits because we are making a copy
$this->table->hits = 0;
// Unpublish because we are making a copy
$this->table->state = 0;
// New region ID
$this->table->regionid = $regionId;
// TODO: Deal with ordering?
// $table->ordering = 1;
// Get the featured state
//$featured = $this->table->featured;
// Check the row.
if (!$this->table->check()) {
$this->setError($this->table->getError());
return false;
}
parent::createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
// Store the row.
if (!$this->table->store()) {
$this->setError($this->table->getError());
return false;
}
// Get the new item ID
$newId = $this->table->get('id');
// Add the new ID to the array
$newIds[$pk] = $newId;
// // Check if the town was featured and update the #__content_frontpage table
// if ($featured == 1)
// {
// $db = $this->getDbo();
// $query = $db->getQuery(true)
// ->insert($db->quoteName('#__content_frontpage'))
// ->values($newId . ', 0');
// $db->setQuery($query);
// $db->execute();
// }
}
// Clean the cache
$this->cleanCache();
return $newIds;
}