Exemplo n.º 1
0
require_once ('include/functions_user.php');

if (defined ('AJAX')) {

	global $config;

	$get_task_roles = (bool) get_parameter ('get_task_roles');
	$get_user_task_roles = (bool) get_parameter ('get_user_task_roles');
	
	//Get only user roles
	if ($get_user_task_roles) {

		$id_user = get_parameter ('id_user');
		$id_task = get_parameter ('id_task');
		
		$roles = user_get_task_roles ($id_user, $id_task);
		
		echo json_encode($roles);

		return;
	}

 	// Get the roles assigned to user in the project of a given task
	if ($get_task_roles) {
		$id_user = get_parameter ('id_user');
		$id_task = get_parameter ('id_task');

		$id_project = get_db_value('id_project','ttask','id',$id_task);
		
		// If the user is Project Manager, all the roles are retrieved. 
		// If not, only the assigned roles
Exemplo n.º 2
0
function workunits_get_user_role($id_user, $id_wo)
{
    $roles = false;
    $id_task = get_db_value('id_task', 'ttodo', 'id', $id_wo);
    if ($id_task) {
        $roles = user_get_task_roles($id_user, $id_task);
    }
    if (!$roles) {
        $roles[0] = __('N/A');
    }
    return $roles;
}