Fix edit site list
This commit is contained in:
parent
c71ecadd9d
commit
ca66049813
@ -65,6 +65,25 @@ class SiteInfo {
|
||||
return $rows;
|
||||
}
|
||||
|
||||
// Return Site Information array. 0 eliminates argument
|
||||
public function listSite ($rowsperpage, $offset) {
|
||||
if ($rowsperpage == "0") { $c_rowsperpage = NULL; }
|
||||
else { $c_rowsperpage = " LIMIT " . Registry::ROWSPERPAGE; }
|
||||
if ($offset == "0") { $c_offset = NULL; }
|
||||
else { $c_offset = " OFFSET " . $offset; }
|
||||
$query = "
|
||||
SELECT DISTINCT
|
||||
" . Registry::DB_PRFX . "sites.id as sites_id,
|
||||
" . Registry::DB_PRFX . "sites.name as sites_name,
|
||||
" . Registry::DB_PRFX . "sites.region as sites_region,
|
||||
" . Registry::DB_PRFX . "sites.timezone as sites_timezone
|
||||
FROM " . Registry::DB_PRFX . "sites
|
||||
ORDER BY " . Registry::DB_PRFX . "sites.name ASC" . $c_rowsperpage . $c_offset;
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$rows = $database->getQuery($query);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function deleteSite ($siteid) {
|
||||
$query = "
|
||||
DELETE FROM " . Registry::DB_PRFX . "sites WHERE " . Registry::DB_PRFX . "sites.id=\"$siteid\"
|
||||
|
@ -91,7 +91,8 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<?php print_r($SiteInfo->getSite("0", "0", "0", "0"));
|
||||
<?php
|
||||
// var_dump($SiteInfo->getSite("0", "0", "0", "0"));
|
||||
// foreach($SiteInfo->getSite("0", $uid, "0", "0") as $arr) {
|
||||
// $lookup_array[$arr['sites_id']]=1; }
|
||||
// if(isset($lookup_array[$siteidcookie])) {
|
||||
@ -99,7 +100,7 @@
|
||||
// if(!isset($siteid)) { $siteid="1"; }
|
||||
?>
|
||||
<select id="sitepermissions" name="sitepermissions" class="custom-select" multiple size="5">
|
||||
<?php foreach($SiteInfo->getSite("0", "0", "0", "0") as $row): ?>
|
||||
<?php foreach($SiteInfo->getSite("0", $edituser["0"]["users_id"], "0", "0") as $row): ?>
|
||||
<option value="<?php echo $row['sites_id']; ?>"<?php if ($row['users_sites_users_id']==$edituser["0"]["users_id"]) { echo " selected"; } ?>><?php echo $row['sites_name']; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
@ -296,7 +297,7 @@ if(!empty($_GET['pnum1'])):
|
||||
endif;
|
||||
endif;
|
||||
$offset1 = ($page_num1 - 1) * $StaticFunctions->getPageRows();
|
||||
$row_count1 = count($SiteInfo->getSite("0", "0", "0", "0"));
|
||||
$row_count1 = count($SiteInfo->listSite("0", "0"));
|
||||
$page_count1 = 0;
|
||||
if (0 === $row_count1): else: $page_count1 = (int)ceil($row_count1 / $StaticFunctions->getPageRows()); if($page_num1 > $page_count1): $page_num1 = 1; endif; endif;
|
||||
?>
|
||||
@ -319,7 +320,7 @@ if (0 === $row_count1): else: $page_count1 = (int)ceil($row_count1 / $StaticFunc
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($SiteInfo->getSite("0", "0", $StaticFunctions->getPageRows(), $offset1) as $row1): ?>
|
||||
<?php foreach($SiteInfo->listSite($StaticFunctions->getPageRows(), $offset1) as $row1): ?>
|
||||
<tr>
|
||||
<td><?php echo $row1['sites_name']; ?></td><td><?php echo $row1['sites_timezone']; ?></td><td><?php echo $row1['sites_region']; ?></td><td><form method="post" onsubmit="return confirm('<?php echo $transLang['DELETE_WARNING']; ?>')"><input type="hidden" id="_METHOD" name="_METHOD" value="DELETE" /><input type="hidden" id="deleteid" name="deleteid" value="<?php echo $row1['sites_id']; ?>" /><button class="btn btn-danger btn-sm" id="deluser" name="delsite" value="delsite" type="submit"><i class="fa fa-trash"></i> </button></form></td>
|
||||
</tr>
|
||||
|
Loading…
Reference in New Issue
Block a user