本文整理汇总了PHP中JTable::getNextOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP JTable::getNextOrder方法的具体用法?PHP JTable::getNextOrder怎么用?PHP JTable::getNextOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JTable
的用法示例。
在下文中一共展示了JTable::getNextOrder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Override paren't store method so we can do some checking with the watermarks.
*
* @return bool True on success.
**/
public function store($updateNulls = false)
{
if (!$this->id) {
$this->ordering = parent::getNextOrder();
}
parent::store();
}
示例2: store
/**
* Override paren't store method so we can do some checking with the watermarks.
*
* @return bool True on success.
**/
public function store()
{
if (!$this->id) {
$this->ordering = parent::getNextOrder();
}
parent::store();
}
示例3: prepareTable
/**
* Prepare and sanitise the table data prior to saving.
*
* @param JTable $table A JTable object.
*
* @return void
*
* @since 1.6
*/
protected function prepareTable($table)
{
// Set the publish date to now
$db = $this->getDbo();
if ($table->state == 1 && (int) $table->publish_up == 0) {
$table->publish_up = JFactory::getDate()->toSql();
}
if ($table->state == 1 && intval($table->publish_down) == 0) {
$table->publish_down = $db->getNullDate();
}
// Increment the content version number.
$table->version++;
// Reorder the articles within the category so the new article is first
if (empty($table->id)) {
$table->ordering = $table->getNextOrder('catid = ' . (int) $table->catid . ' AND state >= 0');
}
}
示例4: testGetNextOrder
/**
* Test the getNextOrder method.
*
* @return void
*
* @since 12.3
*/
public function testGetNextOrder()
{
$this->assertEquals(3, $this->object->getNextOrder());
}
示例5: onBeforeSave
/**
* onBeforeSave method. Hook for chidlren model to prepare the data.
*
* @param array $data The data to be saved.
* @param JTable $table The table object.
*
* @return boolean
*/
protected function onBeforeSave(&$data, $table)
{
// Get database
$db = $this->getDBO();
// User
$user = JFactory::getUser();
// Permissions check
if (!$user->authorise('k2.extrafields.manage')) {
$this->setError(JText::_('K2_YOU_ARE_NOT_AUTHORIZED_TO_PERFORM_THIS_OPERATION'));
return false;
}
// Ordering
if (!$table->id) {
$data['ordering'] = $table->getNextOrder($db->quoteName('group') . ' = ' . (int) $data['group']);
}
return true;
}
示例6: getNextOrder
/**
* Overwrites JTable's getNextOrder function by expecting an array of columns and values or SocialSql object
*
* @since 1.0
* @access public
* @param string/array/SocialSql The filter clause to pass to JTable getNextOrder function
* @return int
**/
public function getNextOrder($where = '')
{
$string = '';
if (is_string($where)) {
$string = $where;
}
if (is_array($where)) {
$db = FD::db();
$string = array();
foreach ($where as $k => $v) {
$string[] = $db->nameQuote($k) . ' = ' . $db->quote($v);
}
$string = implode(' AND ', $string);
}
if (is_object($where) && get_class($where) === 'SocialSql') {
$string = $where->getConditionSql();
}
return parent::getNextOrder($string);
}