本文整理汇总了PHP中JTable::reorder方法的典型用法代码示例。如果您正苦于以下问题:PHP JTable::reorder方法的具体用法?PHP JTable::reorder怎么用?PHP JTable::reorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JTable
的用法示例。
在下文中一共展示了JTable::reorder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testReorder
/**
* Test the reorder method.
*
* @return void
*
* @since 12.3
*/
public function testReorder()
{
$this->object->load(array('id1' => 25, 'id2' => 51));
$this->object->ordering = 25;
$this->object->store();
$object2 = new TableDbTestComposite(TestCaseDatabase::$driver);
$object2->load(array('id1' => 25, 'id2' => 51));
$this->assertEquals(25, $object2->ordering, 'Preconditions');
$this->object->reorder();
$object2->load(array('id1' => 25, 'id2' => 51));
$this->assertEquals(2, $object2->ordering, 'Elements did not get reordered');
}
示例2: reorder
function reorder($where = '')
{
parent::reorder('option_id = ' . $this->_db->Quote($this->option_id));
}
示例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->reorder('catid = ' . (int) $table->catid . ' AND state >= 0');
}
}
示例4: setOrderPosition
/**
* Method to set new item ordering as first or last.
*
* @param JTable $table Item table to save.
* @param string $position 'first' or other are last.
*
* @return type
*/
public function setOrderPosition($table, $position = null)
{
if ($position == 'first') {
if (!$table->ordering) {
$table->reorder('catid = ' . (int) $table->catid . ' AND published >= 0');
}
} else {
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = JFactory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__' . $this->component . '_' . $this->list_name);
$max = $db->loadResult();
$table->ordering = $max + 1;
}
}
}
示例5: reorder
function reorder()
{
parent::reorder('product_id = ' . $this->_db->Quote($this->product_id));
}
示例6: 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)
{
// Reorder the articles within the category so the new article is first
if (empty($table->id)) {
$table->reorder('enabled >= 1');
}
}