示例#1
0
     break;
 case 'save_item':
     $id = (int) $_POST['id'];
     if (!$id) {
         $sResponce = echoMenuEditMsg('Error', 'red');
     } else {
         $aItemFields = array('Name', 'Caption', 'Link', 'Target', 'Icon', 'Script');
         $aItem = array();
         foreach ($aItemFields as $field) {
             $aItem[$field] = isset($_POST[$field]) ? $_POST[$field] : null;
         }
         if (!$aItem['Icon']) {
             $aItem['Icon'] = 'member_menu_default.png';
         }
         $res = saveItem($id, $aItem, $sMenuSection);
         updateLangFile($_POST['Caption'], $_POST['LangCaption']);
         $res['message'] = MsgBox($res['message']);
         $oJson = new Services_JSON();
         echo $oJson->encode($res);
         exit;
     }
     break;
 case 'delete_item':
     $id = (int) $_POST['id'];
     if (!$id) {
         $sResponce = 'Item ID is not specified';
     } else {
         $aItem = db_arr("SELECT `Deletable` FROM `sys_menu_member` WHERE `ID` = {$id}");
         if (!$aItem) {
             $sResponce = 'Item not found';
         } else {
     }
     $aItemFields = array('Name', 'Caption', 'Link', 'Target');
     $aItem = array();
     foreach ($aItemFields as $field) {
         $aItem[$field] = $_GET[$field];
     }
     $aVis = array();
     if ((int) $_GET['Visible_non']) {
         $aVis[] = 'non';
     }
     if ((int) $_GET['Visible_memb']) {
         $aVis[] = 'memb';
     }
     $aItem['Visible'] = implode(',', $aVis);
     $res = saveItem($id, $aItem);
     updateLangFile($_GET['Caption'], $_GET['LangCaption']);
     echo $res;
     exit;
 case 'delete_item':
     $id = (int) $_GET['id'];
     if (!$id) {
         echo 'Item ID is not specified';
         exit;
     }
     $aItem = db_arr("SELECT `Deletable` FROM `TopMenu` WHERE `ID` = {$id}");
     if (!$aItem) {
         echo 'Item not found';
         exit;
     }
     if (!(int) $aItem['Deletable']) {
         echo 'Item is non-deletable';