forked from science-ation/science-ation
use UID not ID when posting title and sort orders, now saving acgtually works
This commit is contained in:
parent
a4fbff953c
commit
1e0f079c01
@ -132,8 +132,7 @@ if($_POST['addcommittee'])
|
|||||||
echo happy(i18n("Committee successfully added"));
|
echo happy(i18n("Committee successfully added"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_POST['committees_id'] && $_POST['committees_ord'])
|
if($_POST['committees_id'] && $_POST['committees_ord']) {
|
||||||
{
|
|
||||||
//re-order the committees
|
//re-order the committees
|
||||||
$x=0;
|
$x=0;
|
||||||
$ids=$_POST['committees_id'];
|
$ids=$_POST['committees_id'];
|
||||||
@ -141,8 +140,7 @@ if($_POST['committees_id'] && $_POST['committees_ord'])
|
|||||||
|
|
||||||
$titles=$_POST['title'];
|
$titles=$_POST['title'];
|
||||||
$pords = $_POST['order'];
|
$pords = $_POST['order'];
|
||||||
while($ids[$x])
|
while($ids[$x]) {
|
||||||
{
|
|
||||||
$cid = intval($ids[$x]);
|
$cid = intval($ids[$x]);
|
||||||
mysql_query("UPDATE committees SET ord='".intval($ords[$x])."' WHERE id='$cid'");
|
mysql_query("UPDATE committees SET ord='".intval($ords[$x])."' WHERE id='$cid'");
|
||||||
$x++;
|
$x++;
|
||||||
@ -153,6 +151,7 @@ if($_POST['committees_id'] && $_POST['committees_ord'])
|
|||||||
/* If the committee has no members, don't bother trying to do
|
/* If the committee has no members, don't bother trying to do
|
||||||
* anything */
|
* anything */
|
||||||
if(!is_array($ctitle)) continue;
|
if(!is_array($ctitle)) continue;
|
||||||
|
print_r($ctitle);
|
||||||
|
|
||||||
foreach($ctitle as $uid=>$title) {
|
foreach($ctitle as $uid=>$title) {
|
||||||
$o = intval($cord[$uid]);
|
$o = intval($cord[$uid]);
|
||||||
@ -160,6 +159,7 @@ if($_POST['committees_id'] && $_POST['committees_ord'])
|
|||||||
$u = intval($uid);
|
$u = intval($uid);
|
||||||
$q = "UPDATE committees_link SET title='$t', ord='$o'
|
$q = "UPDATE committees_link SET title='$t', ord='$o'
|
||||||
WHERE committees_id='$cid' AND users_uid='$u'";
|
WHERE committees_id='$cid' AND users_uid='$u'";
|
||||||
|
echo $q;
|
||||||
mysql_query($q);
|
mysql_query($q);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,13 +170,11 @@ if($_POST['committees_id'] && $_POST['committees_ord'])
|
|||||||
|
|
||||||
if($_POST['action']=="assign")
|
if($_POST['action']=="assign")
|
||||||
{
|
{
|
||||||
if($_POST['committees_id'] && $_POST['users_uid'])
|
if($_POST['committees_id'] && $_POST['users_uid']) {
|
||||||
{
|
|
||||||
$cid = intval($_POST['committees_id']);
|
$cid = intval($_POST['committees_id']);
|
||||||
$q=mysql_query("SELECT * FROM committees_link WHERE committees_id='$cid' AND users_uid='$uid'");
|
$q=mysql_query("SELECT * FROM committees_link WHERE committees_id='$cid' AND users_uid='$uid'");
|
||||||
|
|
||||||
if(!mysql_num_rows($q))
|
if(!mysql_num_rows($q)) {
|
||||||
{
|
|
||||||
mysql_query("INSERT INTO committees_link (committees_id,users_uid) VALUES ('$cid','$uid')");
|
mysql_query("INSERT INTO committees_link (committees_id,users_uid) VALUES ('$cid','$uid')");
|
||||||
echo happy(i18n("Successfully added member to committee"));
|
echo happy(i18n("Successfully added member to committee"));
|
||||||
}
|
}
|
||||||
@ -185,19 +183,15 @@ if($_POST['action']=="assign")
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
echo error(("You must choose both a member and a committee"));
|
echo error(("You must choose both a member and a committee"));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_GET['deletecommittee'])
|
if($_GET['deletecommittee']) {
|
||||||
{
|
|
||||||
$del = intval($_GET['deletecommittee']);
|
$del = intval($_GET['deletecommittee']);
|
||||||
mysql_query("DELETE FROM committees WHERE id='$del'");
|
mysql_query("DELETE FROM committees WHERE id='$del'");
|
||||||
echo happy(i18n("Committee removed"));
|
echo happy(i18n("Committee removed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_POST['action']=="remove")
|
if($_POST['action']=="remove") {
|
||||||
{
|
|
||||||
/* user_delete takes care of unlinking the user in other tables */
|
/* user_delete takes care of unlinking the user in other tables */
|
||||||
user_delete($uid, 'committee');
|
user_delete($uid, 'committee');
|
||||||
echo happy(i18n("Committee member deleted"));
|
echo happy(i18n("Committee member deleted"));
|
||||||
@ -334,9 +328,9 @@ if($_GET['unlinkmember'] && $_GET['unlinkcommittee'])
|
|||||||
echo "<td valign=\"top\">";
|
echo "<td valign=\"top\">";
|
||||||
echo "<b>{$u['name']}</b>";
|
echo "<b>{$u['name']}</b>";
|
||||||
echo "</td><td>";
|
echo "</td><td>";
|
||||||
echo "<input type=\"text\" value=\"{$r2->title}\" name=\"title[{$r->id}][{$u['id']}]\" size=\"15\">";
|
echo "<input type=\"text\" value=\"{$r2->title}\" name=\"title[{$r->id}][{$u['uid']}]\" size=\"15\">";
|
||||||
echo "</td><td>";
|
echo "</td><td>";
|
||||||
echo "<input type=\"text\" value=\"{$r2->ord}\" name=\"order[{$r->id}][{$u['id']}]\" size=\"2\">";
|
echo "<input type=\"text\" value=\"{$r2->ord}\" name=\"order[{$r->id}][{$u['uid']}]\" size=\"2\">";
|
||||||
|
|
||||||
echo "</td><td>";
|
echo "</td><td>";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user