Exemplo n.º 1
0
 /**
  * displayPluginsFormSubmit
  * 
  * @return void
  */
 function displayPluginsFormSubmit()
 {
     $on = array();
     $off = array();
     // Get Plugin Data
     $sql = "SELECT `id`, `link`, `col`, `order`, `req`\n                FROM `fcms_navigation` \n                WHERE (\n                    `col` = 3 \n                    OR `col` = 4\n                )\n                AND `req` = 0\n                ORDER BY `order`";
     $rows = $this->fcmsDatabase->getRows($sql);
     if ($rows === false) {
         $this->fcmsError->displayError();
         $this->displayFooter();
         return;
     }
     foreach ($rows as $r) {
         // Turn on
         if (isset($_POST[$r['link']])) {
             if ($r['order'] == 0) {
                 $on[] = $r;
             }
         } else {
             $off[] = $r['id'];
         }
     }
     // Turn off all that need turned off
     if (count($off) > 0) {
         $offIds = implode(',', $off);
         $sql = "UPDATE `fcms_navigation` \n                    SET `order` = 0 \n                    WHERE `id` IN ({$offIds})";
         if (!$this->fcmsDatabase->update($sql)) {
             $this->displayHeader();
             $this->fcmsError->displayError();
             $this->displayFooter();
             return;
         }
     }
     // Turn on all that need turned on
     $communicateOrder = getNextNavigationOrder(3);
     $shareOrder = getNextNavigationOrder(4);
     foreach ($on as $plugin) {
         if ($plugin['col'] == 3) {
             $order = $communicateOrder;
             $communicateOrder++;
         } elseif ($plugin['col'] == 4) {
             $order = $shareOrder;
             $shareOrder++;
         }
         $id = (int) $plugin['id'];
         $sql = "UPDATE `fcms_navigation` \n                    SET `order` = ?\n                    WHERE `id` = ?";
         if (!$this->fcmsDatabase->update($sql, array($order, $id))) {
             $this->displayHeader();
             $this->fcmsError->displayError();
             $this->displayFooter();
             return;
         }
     }
     $_SESSION['success'] = 1;
     header("Location: config.php?view=plugins");
 }
Exemplo n.º 2
0
Arquivo: utils.php Projeto: lmcro/fcms
/**
 * getNextAdminNavigationOrder 
 * 
 * Wrapper for getNextNavigationOrder.
 * Returns the next order number for the Admininstration navigation.
 * 
 * @return void
 */
function getNextAdminNavigationOrder()
{
    return getNextNavigationOrder(6);
}