forked from science-ation/science-ation
Updates to work with new user system. Also updated the committees_link table fieldname to use "accounts_id" instead of "users_uid" and updated code accordingly.
This commit is contained in:
parent
004c9b64d2
commit
a403202786
@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
user_auth_required('admin');
|
user_auth_required('admin');
|
||||||
|
|
||||||
if($_POST['users_uid'])
|
if($_POST['accounts_id'])
|
||||||
$uid = intval($_POST['users_uid']);
|
$accounts_id = intval($_POST['accounts_id']);
|
||||||
|
|
||||||
|
|
||||||
/* Now, start the output for this page */
|
/* Now, start the output for this page */
|
||||||
@ -101,7 +101,7 @@ function actionSubmit()
|
|||||||
alert('You must choose an action');
|
alert('You must choose an action');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(document.forms.memberaction.users_uid.selectedIndex==0)
|
if(document.forms.memberaction.accounts_id.selectedIndex==0)
|
||||||
{
|
{
|
||||||
alert('You must choose a member');
|
alert('You must choose a member');
|
||||||
return false;
|
return false;
|
||||||
@ -109,7 +109,7 @@ function actionSubmit()
|
|||||||
|
|
||||||
if(document.forms.memberaction.action.selectedIndex == 2) {
|
if(document.forms.memberaction.action.selectedIndex == 2) {
|
||||||
// Edit
|
// Edit
|
||||||
var id = document.forms.memberaction.users_uid.options[document.forms.memberaction.users_uid.selectedIndex];
|
var id = document.forms.memberaction.accounts_id.options[document.forms.memberaction.accounts_id.selectedIndex];
|
||||||
openeditor(id.value);
|
openeditor(id.value);
|
||||||
// alert("id="+id.value);
|
// alert("id="+id.value);
|
||||||
return false;
|
return false;
|
||||||
@ -153,12 +153,12 @@ if($_POST['committees_id'] && $_POST['committees_ord']) {
|
|||||||
if(!is_array($ctitle)) continue;
|
if(!is_array($ctitle)) continue;
|
||||||
// print_r($ctitle);
|
// print_r($ctitle);
|
||||||
|
|
||||||
foreach($ctitle as $uid=>$title) {
|
foreach($ctitle as $accounts_id=>$title) {
|
||||||
$o = intval($cord[$uid]);
|
$o = intval($cord[$accounts_id]);
|
||||||
$t = mysql_escape_string(stripslashes($title));
|
$t = mysql_escape_string(stripslashes($title));
|
||||||
$u = intval($uid);
|
$u = intval($accounts_id);
|
||||||
$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 accounts_id='$u'";
|
||||||
// echo $q;
|
// echo $q;
|
||||||
mysql_query($q);
|
mysql_query($q);
|
||||||
}
|
}
|
||||||
@ -170,12 +170,12 @@ 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['accounts_id']) {
|
||||||
$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 accounts_id='$accounts_id'");
|
||||||
|
|
||||||
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,accounts_id) VALUES ('$cid','$accounts_id')");
|
||||||
echo happy(i18n("Successfully added member to committee"));
|
echo happy(i18n("Successfully added member to committee"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -193,7 +193,7 @@ if($_GET['deletecommittee']) {
|
|||||||
|
|
||||||
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($accounts_id, 'committee');
|
||||||
echo happy(i18n("Committee member deleted"));
|
echo happy(i18n("Committee member deleted"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ if($_GET['unlinkmember'] && $_GET['unlinkcommittee']) {
|
|||||||
$mem = intval($_GET['unlinkmember']);
|
$mem = intval($_GET['unlinkmember']);
|
||||||
$com = intval($_GET['unlinkcommittee']);
|
$com = intval($_GET['unlinkcommittee']);
|
||||||
//unlink the member from the committee
|
//unlink the member from the committee
|
||||||
mysql_query("DELETE FROM committees_link WHERE users_uid='$mem' AND committees_id='$com'");
|
mysql_query("DELETE FROM committees_link WHERE accounts_id='$mem' AND committees_id='$com'");
|
||||||
echo happy(i18n("Committee member unlinked from committee"));
|
echo happy(i18n("Committee member unlinked from committee"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,14 +247,14 @@ if($_GET['unlinkmember'] && $_GET['unlinkcommittee']) {
|
|||||||
echo "</select>";
|
echo "</select>";
|
||||||
|
|
||||||
echo "</td><td>";
|
echo "</td><td>";
|
||||||
$q=mysql_query("SELECT uid,MAX(year),firstname,lastname,email,deleted FROM users WHERE types LIKE '%committee%' GROUP BY uid ORDER BY firstname");
|
$q=mysql_query("SELECT accounts_id,MAX(year),firstname,lastname,email,deleted FROM users WHERE types LIKE '%committee%' GROUP BY accounts_id ORDER BY firstname");
|
||||||
echo "<select name=\"users_uid\">";
|
echo "<select name=\"accounts_id\">";
|
||||||
echo "<option value=\"\">".i18n("Select a Member")."</option>\n";
|
echo "<option value=\"\">".i18n("Select a Member")."</option>\n";
|
||||||
while($r=mysql_fetch_object($q))
|
while($r=mysql_fetch_object($q))
|
||||||
{
|
{
|
||||||
if($r->deleted != 'no') continue;
|
if($r->deleted != 'no') continue;
|
||||||
$displayname = $r->firstname.' '.$r->lastname;
|
$displayname = $r->firstname.' '.$r->lastname;
|
||||||
echo "<option value=\"$r->uid\">$displayname ($r->email)</option>\n";
|
echo "<option value=\"$r->accounts_id\">$displayname ($r->email)</option>\n";
|
||||||
}
|
}
|
||||||
echo "</select>";
|
echo "</select>";
|
||||||
|
|
||||||
@ -308,13 +308,13 @@ if($_GET['unlinkmember'] && $_GET['unlinkcommittee']) {
|
|||||||
$q2=mysql_query("SELECT
|
$q2=mysql_query("SELECT
|
||||||
committees_link.title,
|
committees_link.title,
|
||||||
committees_link.ord,
|
committees_link.ord,
|
||||||
users.uid,
|
users.accounts_id,
|
||||||
MAX(users.year) AS my,
|
MAX(users.year) AS my,
|
||||||
users.lastname
|
users.lastname
|
||||||
FROM committees_link
|
FROM committees_link
|
||||||
JOIN users ON users.uid = committees_link.users_uid
|
JOIN users ON users.accounts_id = committees_link.accounts_id
|
||||||
WHERE committees_id='{$r->id}'
|
WHERE committees_id='{$r->id}'
|
||||||
GROUP BY users.uid
|
GROUP BY users.accounts_id
|
||||||
ORDER BY ord,
|
ORDER BY ord,
|
||||||
users.lastname ");
|
users.lastname ");
|
||||||
|
|
||||||
@ -326,18 +326,18 @@ if($_GET['unlinkmember'] && $_GET['unlinkcommittee']) {
|
|||||||
echo "</td></tr>\n";
|
echo "</td></tr>\n";
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
while($r2=mysql_fetch_object($q2)) {
|
while($r2=mysql_fetch_object($q2)) {
|
||||||
$u = user_load_by_uid($r2->uid);
|
$u = user_load_by_accounts_id($r2->accounts_id);
|
||||||
echo "<tr><td align=\"right\"> ";
|
echo "<tr><td align=\"right\"> ";
|
||||||
echo "<a title=\"Edit Member\" href=\"#\" onclick=\"openeditor({$u['id']})\"><img src=\"{$config['SFIABDIRECTORY']}/images/16/edit.{$config['icon_extension']}\" border=\"0\" alt=\"Edit\" /></a>";
|
echo "<a title=\"Edit Member\" href=\"#\" onclick=\"openeditor({$u['id']})\"><img src=\"{$config['SFIABDIRECTORY']}/images/16/edit.{$config['icon_extension']}\" border=\"0\" alt=\"Edit\" /></a>";
|
||||||
echo " ";
|
echo " ";
|
||||||
echo "<a title=\"Unlink Member from Committee\" onclick=\"return confirmClick('Are you sure you want to unlink this member from this committee?');\" href=\"committees.php?unlinkmember={$u['uid']}&unlinkcommittee={$r->id}\"><img src=\"{$config['SFIABDIRECTORY']}/images/16/undo.{$config['icon_extension']}\" border=\"0\" alt=\"Unlink\" /></a>";
|
echo "<a title=\"Unlink Member from Committee\" onclick=\"return confirmClick('Are you sure you want to unlink this member from this committee?');\" href=\"committees.php?unlinkmember={$u['accounts_id']}&unlinkcommittee={$r->id}\"><img src=\"{$config['SFIABDIRECTORY']}/images/16/undo.{$config['icon_extension']}\" border=\"0\" alt=\"Unlink\" /></a>";
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
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['uid']}]\" size=\"15\">";
|
echo "<input type=\"text\" value=\"{$r2->title}\" name=\"title[{$r->id}][{$u['accounts_id']}]\" size=\"15\">";
|
||||||
echo "</td><td>";
|
echo "</td><td>";
|
||||||
echo "<input type=\"text\" value=\"{$r2->ord}\" name=\"order[{$r->id}][{$u['uid']}]\" size=\"2\">";
|
echo "<input type=\"text\" value=\"{$r2->ord}\" name=\"order[{$r->id}][{$u['accounts_id']}]\" size=\"2\">";
|
||||||
|
|
||||||
echo "</td><td>";
|
echo "</td><td>";
|
||||||
|
|
||||||
|
@ -30,10 +30,10 @@
|
|||||||
$q=mysql_query("SELECT * FROM committees ORDER BY ord,name");
|
$q=mysql_query("SELECT * FROM committees ORDER BY ord,name");
|
||||||
while($r=mysql_fetch_object($q)) {
|
while($r=mysql_fetch_object($q)) {
|
||||||
/* Select all the users in the committee, using MAX(year) for the most recent year */
|
/* Select all the users in the committee, using MAX(year) for the most recent year */
|
||||||
$q2=mysql_query("SELECT committees_link.*,users.uid,MAX(users.year),users.lastname
|
$q2=mysql_query("SELECT committees_link.*,users.accounts_id,MAX(users.year),users.lastname
|
||||||
FROM committees_link LEFT JOIN users ON users.uid = committees_link.users_uid
|
FROM committees_link LEFT JOIN users ON users.accounts_id = committees_link.accounts_id
|
||||||
WHERE committees_id='{$r->id}'
|
WHERE committees_id='{$r->id}'
|
||||||
GROUP BY users.uid ORDER BY ord,users.lastname ");
|
GROUP BY users.accounts_id ORDER BY ord,users.lastname ");
|
||||||
|
|
||||||
//if there's nobody in this committee, then just skip it and go on to the next one.
|
//if there's nobody in this committee, then just skip it and go on to the next one.
|
||||||
if(mysql_num_rows($q2)==0)
|
if(mysql_num_rows($q2)==0)
|
||||||
@ -46,8 +46,8 @@
|
|||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
while($r2=mysql_fetch_object($q2)) {
|
while($r2=mysql_fetch_object($q2)) {
|
||||||
|
|
||||||
$uid = $r2->users_uid;
|
$accid = $r2->accounts_id;
|
||||||
$u = user_load_by_uid($uid);
|
$u = user_load_by_accounts_id($accid);
|
||||||
|
|
||||||
$output=$config['committee_publiclayout'];
|
$output=$config['committee_publiclayout'];
|
||||||
|
|
||||||
|
@ -85,10 +85,10 @@ function tochange() {
|
|||||||
|
|
||||||
/* Select everyone in this committee, attach the user data using MAX(year) so we only get the most recent
|
/* Select everyone in this committee, attach the user data using MAX(year) so we only get the most recent
|
||||||
* user data */
|
* user data */
|
||||||
$q2=mysql_query("SELECT committees_link.*,users.uid,MAX(users.year),users.firstname,users.lastname,users.email,users.deleted
|
$q2=mysql_query("SELECT committees_link.*,users.accounts_id,MAX(users.year),users.firstname,users.lastname,users.email,users.deleted
|
||||||
FROM committees_link LEFT JOIN users ON users.uid = committees_link.users_uid
|
FROM committees_link LEFT JOIN users ON users.accounts_id = committees_link.accounts_id
|
||||||
WHERE committees_id='{$r->id}'
|
WHERE committees_id='{$r->id}'
|
||||||
GROUP BY users.uid ORDER BY ord,users.lastname ");
|
GROUP BY users.accounts_id ORDER BY ord,users.lastname ");
|
||||||
|
|
||||||
//if there's nobody in this committee, then just skip it and go on to the next one.
|
//if there's nobody in this committee, then just skip it and go on to the next one.
|
||||||
if(mysql_num_rows($q2)==0)
|
if(mysql_num_rows($q2)==0)
|
||||||
|
@ -1 +1 @@
|
|||||||
202
|
203
|
||||||
|
2
db/db.update.203.sql
Normal file
2
db/db.update.203.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE `committees_link` CHANGE `users_uid` `accounts_id` INT( 11 ) NOT NULL DEFAULT '0';
|
||||||
|
|
@ -297,7 +297,7 @@ function user_remove_role(&$u, $role)
|
|||||||
/* Do role-specific remove actions */
|
/* Do role-specific remove actions */
|
||||||
switch($role) {
|
switch($role) {
|
||||||
case 'committee':
|
case 'committee':
|
||||||
mysql_query("DELETE FROM committees_link WHERE users_uid='{$u['accounts_id']}'");
|
mysql_query("DELETE FROM committees_link WHERE accounts_id='{$u['accounts_id']}'");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'judge':
|
case 'judge':
|
||||||
|
Loading…
Reference in New Issue
Block a user