|
@@ 599-614 (lines=16) @@
|
| 596 |
|
* @param integer $currentOrder L'ordre de l'élément courant à remonter |
| 597 |
|
* @return void |
| 598 |
|
*/ |
| 599 |
|
public function moveUp($currentId, $currentOrder) |
| 600 |
|
{ |
| 601 |
|
$sql_plus = 'SELECT article_id FROM ' . $this->table . ' WHERE article_weight = ' . ((int)$currentOrder - 1); |
| 602 |
|
$res_plus = $this->db->query($sql_plus); |
| 603 |
|
if ($this->db->getRowsNum($res_plus) == 0) { |
| 604 |
|
return; |
| 605 |
|
} |
| 606 |
|
$row_plus = $this->db->fetchArray($res_plus); |
| 607 |
|
|
| 608 |
|
$upd1 = 'UPDATE ' . $this->table . ' SET article_weight = (article_weight + 1) WHERE article_id = ' . $row_plus['article_id']; |
| 609 |
|
$this->db->queryF($upd1); |
| 610 |
|
|
| 611 |
|
$upd2 = 'UPDATE ' . $this->table . ' SET article_weight = (article_weight - 1) WHERE article_id = ' . (int)$currentId; |
| 612 |
|
$this->db->queryF($upd2); |
| 613 |
|
$this->forceCacheClean(); |
| 614 |
|
} |
| 615 |
|
|
| 616 |
|
/** |
| 617 |
|
* Descend un article d'un cran dans l'ordre global des articles |
|
@@ 623-638 (lines=16) @@
|
| 620 |
|
* @param integer $currentOrder L'orde de l'élément courant à remonter |
| 621 |
|
* @return void |
| 622 |
|
*/ |
| 623 |
|
public function moveDown($currentId, $currentOrder) |
| 624 |
|
{ |
| 625 |
|
$sql_moins = 'SELECT article_id FROM ' . $this->table . ' WHERE article_weight = ' . ((int)$currentOrder + 1); |
| 626 |
|
$res_moins = $this->db->query($sql_moins); |
| 627 |
|
if ($this->db->getRowsNum($res_moins) == 0) { |
| 628 |
|
return; |
| 629 |
|
} |
| 630 |
|
|
| 631 |
|
$row_moins = $this->db->fetchArray($res_moins); |
| 632 |
|
$upd1 = 'UPDATE ' . $this->table . ' SET article_weight = (article_weight - 1) WHERE article_id = ' . $row_moins['article_id']; |
| 633 |
|
$this->db->queryF($upd1); |
| 634 |
|
|
| 635 |
|
$upd2 = 'UPDATE ' . $this->table . ' SET article_weight =( article_weight + 1) WHERE article_id = ' . (int)$currentId; |
| 636 |
|
$this->db->queryF($upd2); |
| 637 |
|
$this->forceCacheClean(); |
| 638 |
|
} |
| 639 |
|
} |
| 640 |
|
|