if(!empty($_GET['sid'])) $sid = intval($_GET['sid']); $bg = ''; /* operation selected ... */ if(!empty($_GET['op'])) { $sql = "SELECT status,owner,realm FROM ".$GLOBALS['ESPCONFIG']['survey_table']." WHERE id=${sid}"; $result = execute_sql($sql); if((list($old_status, $owner, $realm) = fetch_row($result))) { $result->MoveNext(); $access = false; $err = false; $status = $old_status; // trying to perform some operation switch(strtolower($_GET['op'])) { case 'c': // Clear /* only _superuser_s can do this */ if($_SESSION['acl']['superuser'] == 'Y') { $access = true; } else { $access = false; } $status = 0; break; case 't': // test /* only the owner or a group editor+design */ if($owner == $_SESSION['acl']['username'] || in_array($realm, array_intersect( $_SESSION['acl']['pall'], $_SESSION['acl']['pdesign']))) { $access = true; } $status = STATUS_TEST; if($old_status & ( STATUS_DELETED | STATUS_DONE | STATUS_ACTIVE ) ) $err = true; break; case 'm': // Edit /* only the owner or a group editor+design */ if($owner == $_SESSION['acl']['username'] || in_array($realm, array_intersect( $_SESSION['acl']['pall'], $_SESSION['acl']['pdesign']))) { $access = true; } $status = STATUS_EDIT; if($old_status & ( STATUS_DELETED | STATUS_DONE | STATUS_ACTIVE ) ) $err = true; else response_delete_all($sid); break; case 'a': // activate /* only the owner+stauts or a group editor+status */ if(in_array($realm, $_SESSION['acl']['pstatus']) && ($owner == $_SESSION['acl']['username'] || in_array($realm, $_SESSION['acl']['pall']))) { $access = true; } $status = STATUS_ACTIVE; // here we also check that we don't activate twice, because // it would delete all current responses ... if($old_status & ( STATUS_ACTIVE | STATUS_DELETED | STATUS_DONE ) ) $err = true; else response_delete_all($sid); break; case 'e': // End /* only the owner+stauts or a group editor+status */ if(in_array($realm, $_SESSION['acl']['pstatus']) && ($owner == $_SESSION['acl']['username'] || in_array($realm, $_SESSION['acl']['pall']))) { $access = true; } $status = STATUS_DONE; if($old_status & (STATUS_DONE | STATUS_DELETED) ) $err = true; break; case 'd': // Delete /* only the owner+stauts or a group editor+status */ if(in_array($realm, $_SESSION['acl']['pstatus']) && ($owner == $_SESSION['acl']['username'] || in_array($realm, $_SESSION['acl']['pall']))) { $access = true; } $status = STATUS_DELETED; if($old_status & STATUS_DELETED) $err = true; break; } /* superuser overrides all */ if($_SESSION['acl']['superuser'] == 'Y') $access = true; if($access || auth_no_access(_('to access this survey'))) { if(!$err) { $sql = "UPDATE ".$GLOBALS['ESPCONFIG']['survey_table']." SET status=$status WHERE id=${sid}"; execute_sql($sql); } else { print mkwarn(_('Can not set survey status.')); print mkerror(_('Status') .': '. $old_status); } } } } ?>

" . _('Go back to Management Interface') . "\n"); ?> MoveNext(); $stat = _('Editing'); $test = "". _('Test') .""; $act = "". _('Activate') .""; $done = "". _('End') .""; $del = "". _('Archive') .""; if($status & STATUS_DELETED) { $stat = _('Archived'); $test = $act = $done = $del = ' '; continue; } elseif($status & STATUS_DONE) { $stat = _('Ended'); $test = $act = $done = ' '; } elseif($status & STATUS_ACTIVE) { $stat = _('Active'); $test = $act = ' '; } elseif($status & STATUS_TEST) { $stat = _('Testing'); $done = ' '; $test = "". _('Edit') .""; } else { $done = ' '; } /* whack things back to permissions set by ACL * for everyone _not_ superuser */ if($_SESSION['acl']['superuser'] != 'Y' && !in_array($realm, $realms)) { $act = ' '; $done = ' '; $del = ' '; } if($bg != $ESPCONFIG['bgalt_color1']) $bg = $ESPCONFIG['bgalt_color1']; else $bg = $ESPCONFIG['bgalt_color2']; ?>
       
"> ">
" . _('Go back to Management Interface') . "\n"); ?>