Вход Регистрация
Файл: html/admin/location/edit.php
Строк: 535
<?php
require_once '../../system/func.php';
require_once 
'../../system/header.php';
if (!
$user OR $user['access'] < 3) {
    
?><script>showContent("/");</script><?php
    
exit;
}
?>

<center>
    <h2>
        <strong>
            -Редактор локации-
        </strong>
    </h2>
</center>

<?php
$allloc 
$mc->query("SELECT * FROM `location` ORDER BY `location`.`id` ASC")->fetch_all(MYSQLI_ASSOC);
///////////////////////////////Все локации
if (isset($_GET['func']) && $_GET['func'] == "allloc") {

    for (
$i 0$i count($allloc); $i++) {
        
$icon "";
        if (
$allloc[$i]['access'] == 1) {
            
$icon "<img height='19' src='/img/icon/icogood.png' width='19' alt=''>";
        } elseif (
$allloc[$i]['access'] == 2) {
            
$icon "<img height='19' src='/img/icon/icoevil.png' width='19' alt=''>";
        }
        
?>
        <div class="clanturblock" style="padding: 6px;" onclick="showContent('/admin/location/edit.php?func=infloc&locid=<?= $allloc[$i]['id']; ?>')">
            <table style="width: 100%;margin: auto;">
                <tr>
                    <td style="width: 50px;text-align: center"><?= $allloc[$i]['id'] . " . "?></td>
                    <td style="max-width: 100%;text-align: left">
                        <table style="width: 100%">
                            <tr>
                                <td style="width: 40%;text-align: left;">
                                    <?= $icon $allloc[$i]['Name'] . "[" $allloc[$i]['accesslevel'] . "]"?>
                                </td>
                                <td style="width: 60%;text-align: center;">
                                    ДК [<img width="10px" src="/images/icons/zoloto.png"><?= money($allloc[$i]['dhdClan'], 'zoloto'); ?><img width="10px" src="/images/icons/serebro.png"><?= money($allloc[$i]['dhdClan'], 'serebro'); ?><img width="10px" src="/images/icons/med.png"><?= money($allloc[$i]['dhdClan'], 'med'); ?>]
                                    <br>
                                    ДЛ [<img width="10px" src="/images/icons/zoloto.png"><?= money($allloc[$i]['dhdUser'], 'zoloto'); ?><img width="10px" src="/images/icons/serebro.png"><?= money($allloc[$i]['dhdUser'], 'serebro'); ?><img width="10px" src="/images/icons/med.png"><?= money($allloc[$i]['dhdUser'], 'med'); ?>]
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div> 
        <?php
    
}
} else {
    
?>
    <style>
        td{
            background-color: #faffbd;
        }
        textarea{
            min-height: 60px;
        }
    </style>
    <?php
    
if (isset($_GET['func']) && $_GET['func'] == "add") {
        
?>
        <center>-Новая-</center>
        <hr style="background-color: red;">
        <form id="form" >
            <table style="width: 90%;margin: auto;">
                <tr>
                    <td style='width:50%;text-align:center'>
                        айди локации
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input id="id" name='locid' type='number' style='width:98%' value='' >
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        Имя локации
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input name='locname' type='text' style='width:98%' value='Новая' >
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        КОЭФ покупки шм
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input name='coef_buy' type='number' style='width:98%' value='0' >
                    </td>    
                </tr>  
                <tr>
                    <td style='width:50%;text-align:center'>
                        КОЭФ продаж шм
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input name='coef_sell' type='number' style='width:98%' value='0' >
                    </td>    
                </tr>   
                <tr>
                    <td style='width:50%;text-align:center'>
                        КОЭФ ремонта шм
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input name='coef_repair' type='number' style='width:98%' value='0' >
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        айди фото
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input id="fotoid" name='locimgid'  type='number' style='width:98%'  value='0'>
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        Доступно с уровня
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input name='loclvl' type='number' style='width:98%' value='0' >
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        Раса Доступно
                    </td>
                    <td style='width:50%;text-align:center'>
                        <select name='locaccess' style='width:98%'>
                            <option value='3'>Всем</option>
                            <option value='2'>Только Шейванам</option>
                            <option value='1'>только Нормасцам</option> 
                        </select>
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        Снег
                    </td>
                    <td style='width:50%;text-align:center'>
                        <select name='snow' style='width:98%'>
                            <option value='0'>Выключен</option>
                            <option value='1'>Включен</option>
                        </select>
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        По Квесту
                    </td>
                    <td style='width:50%;text-align:center'>
                        <select name='quests' style='width:98%'>
                            <option value='0'>НЕТ</option>
                            <option value='1'>ДА</option>
                        </select>
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        Доступно по вещи id
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input name='thingid' type='number' style='width:98%' value='0' >
                    </td>    
                </tr> 
                <tr>
                    <td style='width:50%;text-align:center'>
                        Доступно по id локации у клана
                    </td>
                    <td style='width:50%;text-align:center'>
                        <select name='id_loc_dostup_sk'>
                            <?php for ($i1 0$i1 count($allloc); $i1++) { ?>
                                <option value='<?= $allloc[$i1]['id']; ?>'><?= htmlspecialchars(urldecode($allloc[$i1]['Name'])); ?></option>
                            <?php ?>
                        </select>      
                    </td>    
                </tr> 
                <tr>
                    <td style='width:50%;text-align:center'>
                        фото
                    </td>
                    <td style='width:50%;text-align:center'>
                        <div>
                            <select  id="ico" style='width:98%'>
                            </select>
                        </div>
                    </td>    
                </tr>    
            </table>
            <center>-ЛОКАЦИИ-</center>
            <hr style="background-color: green;">
            <table style="width: 90%;margin: auto;">
                <?php for ($i 1$i 11$i++) { ?>
                    <tr>
                        <td style='width:30%;text-align:center'>
                            <?= $i?>
                        </td>
                        <td style='width:70%;text-align:center'>
                            <select name='IdLoc<?= $i?>'>
                                <?php for ($i1 0$i1 count($allloc); $i1++) { ?>
                                    <option value='<?= $allloc[$i1]['id']; ?>' ><?= htmlspecialchars(urldecode($allloc[$i1]['Name'])); ?></option>
                                <?php ?>
                            </select>
                        </td>    
                    </tr>
                <?php ?>
            </table>
            <center>-Земля-</center>
            <hr style="background-color: green;">
            <table style="width: 90%;margin: auto;">
                <tr>
                    <td style='width:30%;text-align:center'>
                        Уровень
                    </td>
                    <td style='width:70%;text-align:center'>
                        <input name='dhdLevel' type='number' style='width:98%' value='1' >
                    </td>    
                </tr>
                <tr>
                    <td style='width:30%;text-align:center'>
                        Доход казны:
                    </td>
                    <td style='width:70%;text-align:center'>
                        <img width="10px" src="/images/icons/zoloto.png">
                        <input name='dhdClanzolo' type='number' style='width:20%' value='0' >
                        <img width="10px" src="/images/icons/serebro.png">
                        <input name='dhdClanserebro' type='number' style='width:20%' value='0' >
                        <img width="10px" src="/images/icons/med.png">
                        <input name='dhdClanmed' type='number' style='width:20%' value='0' >
                    </td>    
                </tr>
                <tr>
                    <td style='width:30%;text-align:center'>
                        Личный доход:
                    </td>
                    <td style='width:70%;text-align:center'>
                        <img width="10px" src="/images/icons/zoloto.png">
                        <input name='dhdUserzolo' type='number' style='width:20%' value='0' >
                        <img width="10px" src="/images/icons/serebro.png">
                        <input name='dhdUserserebro' type='number' style='width:20%' value='0' >
                        <img width="10px" src="/images/icons/med.png">
                        <input name='dhdUsermed' type='number' style='width:20%' value='0' >
                    </td>     
                </tr>
            </table>
        </form>
        <?php
    
} else if (isset($_GET['func']) && $_GET['func'] == "infloc") {
        
$infloc $mc->query("SELECT * FROM `location` WHERE `id`='" $_GET['locid'] . "'")->fetch_array(MYSQLI_ASSOC);
        
?>
        <center>-<?= $infloc['Name']; ?>-</center>
        <hr style="background-color: red;">
        <form id="form" >
            <table style="width: 90%;margin: auto;">
                <tr>
                    <td style='width:50%;text-align:center'>
                        айди локации
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input id="id" name='locid' type='number' style='width:98%' value='<?= $infloc['id']; ?>' >
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        Имя локации
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input name='locname' type='text' style='width:98%' value='<?= $infloc['Name']; ?>' >
                    </td>    
                </tr> 
                <tr>
                    <td style='width:50%;text-align:center'>
                        КОЭФ покупки шм
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input name='coef_buy' type='number' style='width:98%' value='<?= $infloc['coef_buy']; ?>' >
                    </td>    
                </tr>  
                <tr>
                    <td style='width:50%;text-align:center'>
                        КОЭФ продаж шм
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input name='coef_sell' type='number' style='width:98%' value='<?= $infloc['coef_sell']; ?>' >
                    </td>    
                </tr>   
                <tr>
                    <td style='width:50%;text-align:center'>
                        КОЭФ ремонта шм
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input name='coef_repair' type='number' style='width:98%' value='<?= $infloc['coef_repair']; ?>' >
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        айди фото
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input id="fotoid" name='locimgid'  type='number' style='width:98%'  value='<?= $infloc['IdImage']; ?>'>
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        Доступно с уровня
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input name='loclvl' type='number' style='width:98%' value='<?= $infloc['accesslevel']; ?>' >
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        Раса Доступно
                    </td>
                    <td style='width:50%;text-align:center'>
                        <select name='locaccess' style='width:98%'>
                            <option <?= $infloc['access'] == "selected" ""?> value='3'>Всем</option>
                            <option <?= $infloc['access'] == "selected" ""?> value='2'>Только Шейванам</option>
                            <option <?= $infloc['access'] == "selected" ""?> value='1'>только Нормасцам</option> 
                        </select>
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        Снег
                    </td>
                    <td style='width:50%;text-align:center'>
                        <select name='snow' style='width:98%'>
                            <option <?= $infloc['snow'] == "selected" ""?> value='0'>Выключен</option>
                            <option <?= $infloc['snow'] == "selected" ""?> value='1'>Включен</option>
                        </select>
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        По Квесту
                    </td>
                    <td style='width:50%;text-align:center'>
                        <select name='quests' style='width:98%'>
                            <option <?= $infloc['quests'] == "selected" ""?> value='0'>НЕТ</option>
                            <option <?= $infloc['quests'] == "selected" ""?> value='1'>ДА</option>
                        </select>
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        Доступно по вещи id
                    </td>
                    <td style='width:50%;text-align:center'>
                        <input name='thingid' type='number' style='width:98%' value='<?= $infloc['thingid']; ?>' >
                    </td>    
                </tr>
                <tr>
                    <td style='width:50%;text-align:center'>
                        Доступно по id локации у клана
                    </td>
                    <td style='width:50%;text-align:center'>
                        <select name='id_loc_dostup_sk'>
                            <?php for ($i1 0$i1 count($allloc); $i1++) { ?>
                                <option value='<?= $allloc[$i1]['id']; ?><?= $infloc['id_loc_dostup_sk'] == $allloc[$i1]['id'] ? 'selected' ''?>><?= htmlspecialchars(urldecode($allloc[$i1]['Name'])); ?></option>
                            <?php ?>
                        </select>      
                    </td>    
                </tr> 
                <tr>
                    <td style='width:50%;text-align:center'>
                        фото
                    </td>
                    <td style='width:50%;text-align:center'>
                        <div>
                            <select  id="ico" style='width:98%'>
                            </select>
                        </div>
                    </td>    
                </tr>    
            </table>
            <center>-ЛОКАЦИИ-</center>
            <hr style="background-color: green;">
            <table style="width: 90%;margin: auto;">
                <?php for ($i 1$i 11$i++) { ?>
                    <tr>
                        <td style='width:30%;text-align:center'>
                            <?= $i?>
                        </td>
                        <td style='width:70%;text-align:center'>
                            <select name='IdLoc<?= $i?>'>
                                <?php for ($i1 0$i1 count($allloc); $i1++) { ?>
                                    <option value='<?= $allloc[$i1]['id']; ?><?= $infloc["IdLoc" $i] == $allloc[$i1]['id'] ? 'selected' ''?>><?= htmlspecialchars(urldecode($allloc[$i1]['Name'])); ?></option>
                                <?php ?>
                            </select>
                        </td>    
                    </tr>
                <?php ?>
            </table>
            <center>-Земля-</center>
            <hr style="background-color: green;">
            <table style="width: 90%;margin: auto;">
                <tr>
                    <td style='width:30%;text-align:center'>
                        Уровень
                    </td>
                    <td style='width:70%;text-align:center'>
                        <input name='dhdLevel' type='number' style='width:98%' value='1' >
                    </td>    
                </tr>
                <tr>
                    <td style='width:30%;text-align:center'>
                        Доход казны:
                    </td>
                    <td style='width:70%;text-align:center'>
                        <img width="10px" src="/images/icons/zoloto.png">
                        <input name='dhdClanzolo' type='number' style='width:20%' value='<?= money($infloc['dhdClan'], 'zoloto'); ?>' >
                        <img width="10px" src="/images/icons/serebro.png">
                        <input name='dhdClanserebro' type='number' style='width:20%' value='<?= money($infloc['dhdClan'], 'serebro'); ?>' >
                        <img width="10px" src="/images/icons/med.png">
                        <input name='dhdClanmed' type='number' style='width:20%' value='<?= money($infloc['dhdClan'], 'med'); ?>' >
                    </td>    
                </tr>
                <tr>
                    <td style='width:30%;text-align:center'>
                        Личный доход:
                    </td>
                    <td style='width:70%;text-align:center'>
                        <img width="10px" src="/images/icons/zoloto.png">
                        <input name='dhdUserzolo' type='number' style='width:20%' value='<?= money($infloc['dhdUser'], 'zoloto'); ?>' >
                        <img width="10px" src="/images/icons/serebro.png">
                        <input name='dhdUserserebro' type='number' style='width:20%' value='<?= money($infloc['dhdUser'], 'serebro'); ?>' >
                        <img width="10px" src="/images/icons/med.png">
                        <input name='dhdUsermed' type='number' style='width:20%' value='<?= money($infloc['dhdUser'], 'med'); ?>' >
                    </td>     
                </tr>
            </table>
        </form>
    <?php ?>
    <br>
    <div style='width: 100%;text-align: center'>
        <input class='button_alt_01' style='width:200px' type='button' onclick="savePredmet();" value='Сохранить!'>
    </div>
    <br>
    <div style='width: 100%;text-align: center'>
        <input class='button_alt_01' style='width:200px' type='button' onclick="$('#id').val('');savePredmet();" value='Копирнуть !'>
    </div>
    <br>
    <div class="msg" style="z-index: 9999;background-color: rgba(0,0,0,0.5);width: 100%;height: 100%;position: fixed;top: 0;left: 0;display: none">
        <table style="margin: auto;width: 240px;height: 100%">
            <tr>
                <td style="vertical-align: middle;text-align: center;background-color: rgba(0,0,0,0);">
                    <div style="width:100%;background-color: #FFFFCC;border-color: black;border-style: solid;border-width: 2px;border-radius: 4px;">
                        <br>
                        <div class="text_msg">sssssssssss</div>
                        <br>
                        <div class="button_alt_01" style="margin: auto;" onclick="$('.msg').css({display: 'none'})">Ок</div>
                        <br>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <script>
        var canvas = document.createElement("canvas");
        var ctx = canvas.getContext("2d");
        canvas.width = 100;
        canvas.height = 75;
        var img = [];
        $.ajax({
            url: "./json/battle/battle1.json?136.12311",
            dataType: "json",
            success: function (data) {
                for (var i = 0; i < data.img.length; i++) {
                    img[i] = new Image();
                    img[i].src = data.img[i];
                }
                MyLib.setTimeid[100] = setTimeout(function () {
                    for (var i1 = 1; i1 < data.img.length; i1++) {
                        ctx.drawImage(img[i1],
                                0,
                                0,
                                img[i1].width,
                                img[i1].height,
                                0, 0, canvas.width, canvas.height
                                );
                        $("#ico").append($("<option></option>")
                                .attr("title", canvas.toDataURL())
                                .attr("value", i1)
                                );
                    }
                    $("#ico").msDropDown();
                    $('#ico').msDropDown().data("dd").set("selectedIndex", <?= isset($infloc['IdImage']) ? $infloc['IdImage'] : 0?> - 1);
                }, 2000);
            }});
        $("#ico").change(function () {
            $("#fotoid").val($('#ico option:selected').val());
        });
        function savePredmet() {
            $.fn.serializeObject = FormSerializer.serializeObject;
            var arr = $("#form").serializeObject();
            senddatas(encodeURIComponent(JSON.stringify(arr)));
        }
        function senddatas(e) {
            $("body").prepend("<img class='loading' src='" + imgLoading.src + "' alt='loading'>" +
                    "<div class='linefooter sizeFooterH'></div>");
            $.ajax({
                type: "POST",
                url: "/admin/location/location_l.php",
                data: {
                    strdata: e
                },
                dataType: "json",
                success: function (el) {
                    $(".loading").remove();
                    var data = el;
                    if (data.otvet == 1) {
                        $('#id').val(data.new_id);
                        msg("локация создана");
                    } else if (data.otvet == 2) {
                        msg("локация обновлена");
                    } else {
                        msg("ошибка внесения изменений в бд");
                    }
                },
                error: function () {
                    $(".loading").remove();
                    msg("ошибка соединения данные не сохранены");
                }
            });
        }
        function msg(e) {
            $('.text_msg').html(e);
            $('.msg').css({display: 'block'});
        }
    </script>
    <?php
}

$footval 'adminlocedit';
include 
'../../system/foot/foot.php';
?>
Онлайн: 3
Реклама