$item_id = WPRMM_Item::create($_POST['wprmm']);
            #$category_id = (int) $_POST['wprmm_crud']['category_id'];
            #$menu_id = (int) $_POST['wprmm_crud']['menu_id'];
            wp_redirect(wprmm_admin_url('item', 'edit-item', $item_id));
            exit;
        }
        /* Delete Item */
        if ($_POST['wprmm_crud']['item'] == 'Delete') {
            $item_id = (int) $_POST['wprmm_crud']['item_id'];
            $menu_id = (int) $_POST['wprmm_crud']['menu_id'];
            WPRMM_Item::destroy($item_id);
            wp_redirect(wprmm_admin_url('menu', 'index-item', $menu_id));
            exit;
        }
    }
    /* Save New Icon */
    if (!empty($_POST['wprmm_crud']['icon'])) {
        if ($_POST['wprmm_crud']['icon'] == 'new') {
            $icon_id = WPRMM_ICON::create($_POST['wprmm']);
            wp_redirect(wprmm_admin_icon_url('icon', 'edit-icon', $icon_id));
            exit;
        }
        /* Delete Icon */
        if ($_POST['wprmm_crud']['icon'] == 'Delete') {
            $icon_id = (int) $_POST['wprmm_crud']['icon_id'];
            WPRMM_ICON::destroy($icon_id);
            wp_redirect(admin_url('admin.php?page=' . WPRMM_ADMIN_ICON_URL));
            exit;
        }
    }
}
示例#2
0
    <input type="hidden" name="wprmm[id]" value="<?php 
echo $icon->id;
?>
" />

    <div class="wprmm-admin-nav">
      <p>
        <input class="button-primary" class="left" type="submit" name="save_item" value="Save Icon" />
        <a class="button" href="<?php 
echo admin_url('admin.php?page=' . WPRMM_ADMIN_ICON_URL);
?>
">&laquo;back to Icons</a>&nbsp;
        <span>
          <a class="button" href="<?php 
echo wprmm_admin_icon_url('icon', 'new-icon', 'new');
?>
">+ Add New Icon</a>&nbsp;
          <a class="button" href="<?php 
echo wprmm_help_link();
?>
">help?</a>
        </span>&nbsp;
      </p>
    </div>


  </form>

</div>