Exemplo n.º 1
0
/**
* Gives all available survey permissions for a certain survey to a user 
* 
* @param mixed $iUserID  The User ID
* @param mixed $iSurveyID The Survey ID
*/
function GiveAllSurveyPermissions($iUserID, $iSurveyID)
{
    $aPermissions = aGetBaseSurveyPermissions();
    $aPermissionsToSet = array();
    foreach ($aPermissions as $sPermissionName => $aPermissionDetails) {
        foreach ($aPermissionDetails as $sPermissionDetailKey => $sPermissionDetailValue) {
            if (in_array($sPermissionDetailKey, array('create', 'read', 'update', 'delete', 'import', 'export')) && $sPermissionDetailValue == true) {
                $aPermissionsToSet[$sPermissionName][$sPermissionDetailKey] = 1;
            }
        }
    }
    SetSurveyPermissions($iUserID, $iSurveyID, $aPermissionsToSet);
}
Exemplo n.º 2
0
                }
            }
        }
    }
    if (isset($postusergroupid) && $postusergroupid > 0) {
        $sQuery = "SELECT uid from " . db_table_name('user_in_groups') . " where ugid = {$postusergroupid} and uid<>{$_SESSION['loginID']} AND uid<>{$iOwnerID}";
        $oResult = db_execute_assoc($sQuery);
        //Checked
        if ($oResult->RecordCount() > 0) {
            while ($aRow = $oResult->FetchRow()) {
                SetSurveyPermissions($aRow['uid'], $surveyid, $aPermissions);
            }
            $addsummary .= "<div class=\"successheader\">" . $clang->gT("Survey permissions for all users in this group were successfully updated.") . "</div>\n";
        }
    } else {
        if (SetSurveyPermissions($postuserid, $surveyid, $aPermissions)) {
            $addsummary .= "<div class=\"successheader\">" . $clang->gT("Survey permissions were successfully updated.") . "</div>\n";
        } else {
            $addsummary .= "<div class=\"warningheader\">" . $clang->gT("Failed to update survey permissions!") . "</div>\n";
        }
    }
    $addsummary .= "<br/><input type=\"submit\" onclick=\"window.open('{$scriptname}?sid={$surveyid}&amp;action=surveysecurity', '_top')\" value=\"" . $clang->gT("Continue") . "\"/>\n";
    $addsummary .= "</div>\n";
}
// *************************************************
// Survey Rights End	****************************
// *************************************************
// Edit survey general settings
if ($action == "editsurveysettings" || $action == "newsurvey") {
    include "editsurveysettings.php";
}