Gazelle/sections/collages/manage_artists.php

113 lines
4.0 KiB
PHP
Raw Normal View History

2013-05-25 08:01:03 +00:00
<?
$CollageID = $_GET['collageid'];
if (!is_number($CollageID)) {
error(0);
}
2013-07-13 08:00:46 +00:00
$DB->query("
SELECT Name, UserID, CategoryID
FROM collages
WHERE ID = '$CollageID'");
2013-05-25 08:01:03 +00:00
list($Name, $UserID, $CategoryID) = $DB->next_record();
2013-07-13 08:00:46 +00:00
if ($CategoryID === '0' && $UserID !== $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
2013-05-25 08:01:03 +00:00
error(403);
}
2013-07-30 08:00:51 +00:00
if ($CategoryID != array_search(ARTIST_COLLAGE, $CollageCats)) {
error(404);
2013-05-25 08:01:03 +00:00
}
2013-05-26 08:00:59 +00:00
$DB->query("
SELECT
ca.ArtistID,
ag.Name,
um.ID AS UserID,
um.Username,
ca.Sort
FROM collages_artists AS ca
2013-07-13 08:00:46 +00:00
JOIN artists_group AS ag ON ag.ArtistID = ca.ArtistID
LEFT JOIN users_main AS um ON um.ID = ca.UserID
WHERE ca.CollageID = '$CollageID'
2013-05-26 08:00:59 +00:00
ORDER BY ca.Sort");
2013-05-25 08:01:03 +00:00
$Artists = $DB->to_array('ArtistID', MYSQLI_ASSOC);
2014-03-16 08:00:50 +00:00
View::show_header("Manage collage $Name", 'jquery-ui,jquery.tablesorter,sort');
2013-05-25 08:01:03 +00:00
?>
<div class="thin">
<div class="header">
<h2>Manage collage <a href="collages.php?id=<?=$CollageID?>"><?=$Name?></a></h2>
</div>
<table width="100%" class="layout">
<tr class="colhead"><td id="sorting_head">Sorting</td></tr>
<tr>
<td id="drag_drop_textnote">
<ul>
<li>Click on the headings to organize columns automatically.</li>
<li>Sort multiple columns simultaneously by holding down the shift key and clicking other column headers.</li>
<li>Click and drag any row to change its order.</li>
<li>Press "Save All Changes" when you are finished sorting.</li>
<li>Press "Edit" or "Remove" to simply modify one entry.</li>
</ul>
</td>
</tr>
</table>
<div class="drag_drop_save hidden">
2013-08-28 23:08:41 +00:00
<input type="button" name="submit" value="Save All Changes" class="save_sortable_collage" />
2013-05-25 08:01:03 +00:00
</div>
<table id="manage_collage_table">
<thead>
<tr class="colhead">
2014-03-16 08:00:50 +00:00
<th style="width: 7%;" data-sorter="false">Order</th>
2013-11-05 08:01:12 +00:00
<th style="width: 1%;"><span><abbr class="tooltip" title="Current rank">#</abbr></span></th>
2014-03-16 08:00:50 +00:00
<th style="text-align: left;" data-sorter="ignoreArticles"><span>Artist</span></th>
<th style="width: 7%;" data-sorter="ignoreArticles"><span>User</span></th>
<th style="width: 7%; text-align: right;" class="nobr" data-sorter="false"><span><abbr class="tooltip" title="Modify an individual row.">Tweak</abbr></span></th>
2013-05-25 08:01:03 +00:00
</tr>
</thead>
<tbody>
<?
$Number = 0;
foreach ($Artists as $Artist) {
$Number++;
2013-05-27 08:00:58 +00:00
$AltCSS = ($Number % 2 === 0 ? 'rowa' : 'rowb');
2013-05-25 08:01:03 +00:00
?>
<tr class="drag <?=$AltCSS?>" id="li_<?=$Artist['ArtistID']?>">
<form class="manage_form" name="collage" action="collages.php" method="post">
<td>
<input class="sort_numbers" type="text" name="sort" value="<?=$Artist['Sort']?>" id="sort_<?=$Artist['ArtistID']?>" size="4" />
</td>
<td><?=$Number?></td>
2013-05-27 08:00:58 +00:00
<td><?=(trim($Artist['Name']) ?: '&nbsp;')?></td>
2013-05-25 08:01:03 +00:00
<td class="nobr"><?=Users::format_username($Artist['UserID'], $$Artist['Username'], false, false, false)?></td>
<td class="nobr">
<input type="hidden" name="action" value="manage_artists_handle" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<input type="hidden" name="artistid" value="<?=$Artist['ArtistID']?>" />
<input type="submit" name="submit" value="Edit" />
<input type="submit" name="submit" value="Remove" />
</td>
</form>
</tr>
2013-05-27 08:00:58 +00:00
<? } ?>
2013-05-25 08:01:03 +00:00
</tbody>
</table>
<div class="drag_drop_save hidden">
2013-08-28 23:08:41 +00:00
<input type="button" name="submit" value="Save All Changes" class="save_sortable_collage" />
2013-05-25 08:01:03 +00:00
</div>
<form class="dragdrop_form hidden" name="collage" action="collages.php" method="post" id="drag_drop_collage_form">
<div>
<input type="hidden" name="action" value="manage_artists_handle" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<input type="hidden" name="artistid" value="1" />
<input type="hidden" name="drag_drop_collage_sort_order" id="drag_drop_collage_sort_order" readonly="readonly" value="" />
</div>
</form>
</div>
<? View::show_footer(); ?>