$success = lock_task_workunit ($id_workunit);
	if (! $success) {
		audit_db ($config['id_user'], $config["REMOTE_ADDR"], "ACL Violation",
			"Trying to lock WU $id_workunit without rigths");
		if (!defined ('AJAX'))
			include ("general/noaccess.php");
		return;
	}
	
	$result_output = ui_print_success_message (__('Locked successfully'), '', true, 'h3', true);
	audit_db ($config['id_user'], $config["REMOTE_ADDR"], "Work unit locked",
		"Workunit for ".$config['id_user']);
	
	if (defined ('AJAX')) {
		echo '<img src="images/rosette.png" title="'.__('Locked by').' '.$config['id_user'].'" />';
		print_user_avatar ($config['id_user'], true);
		return;
	}
}

if ($id_workunit) {
	$sql = sprintf ('SELECT *
		FROM tworkunit
		WHERE tworkunit.id = %d', $id_workunit);
	$workunit = get_db_row_sql ($sql);
	
	$belong_to_ticket = get_db_value_sql("SELECT * FROM tworkunit_incident WHERE id_workunit = ".$id_workunit);

	if (($workunit === false) OR $belong_to_ticket) {
		require ("general/noaccess.php");
		return;
示例#2
0
 function render_sidebox_user_info($user, $label)
 {
     $output = "";
     $output .= '<div style="text-align:center;"><b>' . __($label) . ' </b></div>';
     $output .= '<div class="user_info_sidebox">';
     $output .= print_user_avatar($user, true, true);
     $output .= '<a href="index.php?sec=users&sec2=operation/users/user_edit&id=' . $user . '">';
     $output .= ' <strong>' . $user . '</strong></a><br>';
     $user_data = get_db_row("tusuario", "id_usuario", $user);
     if ($user_data["nombre_real"] != "") {
         $output .= $user_data["nombre_real"] . "<br>";
     }
     if ($user_data["telefono"] != "") {
         $output .= $user_data["telefono"] . "<br>";
     }
     if ($user_data["direccion"] != "") {
         $output .= $user_data["direccion"];
     }
     if ($user_data["id_company"] != 0) {
         $company_name = (string) get_db_value('name', 'tcompany', 'id', $user_data['id_company']);
         $output .= "<br>(<em>{$company_name}</em>)";
     }
     $output .= '</div>';
     return $output;
 }
示例#3
0
function user_search_result($filter, $ajax, $size_page, $offset, $clickin, $search_text, $disabled_user, $level, $group, $from_tickets = false)
{
    global $config;
    if ($filter != 0) {
        $offset = $filter['offset'];
        $search_text = $filter['search_text'];
        $disabled_user = $filter['disabled_user'];
        $level = $filter['level'];
        $group = $filter['group'];
    }
    $search = "WHERE 1=1 ";
    if ($search_text != "") {
        $search .= " AND (id_usuario LIKE '%{$search_text}%' OR comentarios LIKE '%{$search_text}%' OR nombre_real LIKE '%{$search_text}%' OR direccion LIKE '%{$search_text}%')";
    }
    if ($disabled_user > -1) {
        $search .= " AND disabled = {$disabled_user}";
    }
    if ($level > -10) {
        $search .= " AND nivel = {$level}";
    }
    if ($group == -1) {
        $search .= " AND tusuario.id_usuario NOT IN (select id_usuario from tusuario_perfil)";
    } else {
        if ($group > 0) {
            $search .= " AND tusuario.id_usuario = ANY (SELECT id_usuario FROM tusuario_perfil WHERE id_grupo = {$group})";
        }
    }
    $query1 = "SELECT * FROM tusuario {$search} ORDER BY id_usuario";
    if ($from_tickets) {
        $query1 = users_get_allowed_users_query($config['id_user'], $filter);
    }
    $count = get_db_sql("SELECT COUNT(id_usuario) FROM tusuario {$search} ");
    $sql1 = "{$query1} LIMIT {$offset}, " . $size_page;
    echo "<div class='divresult'>";
    pagination($count, "index.php?sec=users&sec2=godmode/usuarios/lista_usuarios&search_text=" . $search_text . "&disabled_user="******"&level=" . $level . "&group=" . $group, $offset, true);
    $resq1 = process_sql($sql1);
    if (!$resq1) {
        echo ui_print_error_message(__("No users"), '', true, 'h3', true);
    } else {
        echo '<table width="100%" class="listing">';
        if ($filter == 0) {
            echo '<th>' . print_checkbox('all_user_checkbox', 1, false, true);
            echo '<th title="' . __('Enabled/Disabled') . '">' . __('E/D');
            echo '<th title="' . __('Enabled login') . '">' . __('Enabled login');
        }
        echo '<th>' . __('User ID');
        echo '<th>' . __('Name');
        echo '<th>' . __('Company');
        echo '<th>' . __('Last contact');
        echo '<th>' . __('Profile');
        if ($filter == 0) {
            echo '<th>' . __('Delete');
        }
        // Init vars
        $nombre = "";
        $nivel = "";
        $comentarios = "";
        $fecha_registro = "";
        if ($resq1) {
            foreach ($resq1 as $rowdup) {
                $nombre = $rowdup["id_usuario"];
                $nivel = $rowdup["nivel"];
                $realname = $rowdup["nombre_real"];
                $fecha_registro = $rowdup["fecha_registro"];
                $avatar = $rowdup["avatar"];
                if ($rowdup["nivel"] == 0) {
                    $nivel = "<img src='images/group.png' title='" . __("Grouped user") . "'>";
                } elseif ($rowdup["nivel"] == 1) {
                    $nivel = "<img src='images/integria_mini_logo.png' title='" . __("Administrator") . "'>";
                } else {
                    $nivel = "<img src='images/user_gray.png' title='" . __("Standalone user") . "'>";
                }
                $disabled = $rowdup["disabled"];
                $id_company = $rowdup["id_company"];
                $enabled_login = $rowdup["enable_login"];
                echo "<tr>";
                if ($filter == 0) {
                    echo "<td>";
                    echo print_checkbox_extended("user-" . $rowdup["id_usuario"], $rowdup["id_usuario"], false, false, "", "class='user_checkbox'", true);
                    echo "<td>";
                    if ($disabled == 1) {
                        echo "<img src='images/lightbulb_off.png' title='" . __("Disabled") . "'> ";
                    }
                    echo "<td>";
                    if ($enabled_login == 1) {
                        echo "<img src='images/accept.png' title='" . __("Enabled login") . "'> ";
                    } else {
                        echo "<img src='images/fail.png' title='" . __("Disabled login") . "'> ";
                    }
                }
                echo "<td>";
                if ($filter == 0) {
                    echo "<a href='index.php?sec=users&sec2=godmode/usuarios/configurar_usuarios&update_user="******"'>" . ucfirst($nombre) . "</a>";
                } else {
                    $url = "javascript:loadContactUser(\"" . $nombre . "\",\"" . $clickin . "\");";
                    echo "<a href='" . $url . "'>" . ucfirst($nombre) . "</a>";
                }
                echo "<td style=''>" . $realname;
                $company_name = (string) get_db_value('name', 'tcompany', 'id', $id_company);
                echo "<td>" . $company_name . "</td>";
                echo "<td style=''>" . human_time_comparation($fecha_registro);
                echo "<td>";
                print_user_avatar($nombre, true);
                echo "&nbsp;";
                if ($config["enteprise"] == 1) {
                    $sql1 = 'SELECT * FROM tusuario_perfil WHERE id_usuario = "' . $nombre . '"';
                    $result = mysql_query($sql1);
                    echo "<a href='#' class='tip'>&nbsp;<span>";
                    if (mysql_num_rows($result)) {
                        while ($row = mysql_fetch_array($result)) {
                            echo dame_perfil($row["id_perfil"]) . "/ ";
                            echo dame_grupo($row["id_grupo"]) . "<br>";
                        }
                    } else {
                        echo __('This user doesn\'t have any assigned profile/group');
                    }
                    echo "</span></a>";
                }
                echo $nivel;
                if ($filter == 0) {
                    echo '<td align="center">';
                    echo '<a href="index.php?sec=users&sec2=godmode/usuarios/lista_usuarios&borrar_usuario=' . $nombre . '" onClick="if (!confirm(\'' . __('Are you sure?') . '\')) return false;"><img src="images/cross.png"></a>';
                    echo '</td>';
                }
            }
        }
        echo "</table>";
    }
    echo "</div>";
}
    // FInish this task
    if ($op == "fin") {
        $sql = "UPDATE ttask SET completion = 100 WHERE id = {$task}";
        process_sql($sql);
    }
    // Remove this user from that task
    if ($op == "deas") {
        $sql = "DELETE FROM trole_people_task WHERE id_user = '******' AND id_task = {$task}";
        process_sql($sql);
    }
}
if ($id_user != $config["id_user"] and give_acl($config["id_user"], 0, "PM") != 1) {
    $id_user = $config["id_user"];
}
$sql = "SELECT ttask.id, ttask.name, tproject.name, ttask.completion, tproject.id, ttask.id, ttask.priority FROM trole_people_task, ttask, tproject WHERE trole_people_task.id_user = '******' AND trole_people_task.id_task = ttask.id AND ttask.id_project = tproject.id AND tproject.disabled = 0 AND ttask.completion < 100 ORDER BY tproject.name DESC";
echo "<h1>" . __('Global task assignment') . " " . __('For user') . " '" . $id_user . "' " . print_user_avatar($id_user, true, true) . "</h1>";
if (give_acl($config["id_user"], 0, "PM")) {
    echo "<form id='form-user_task_assignment' name='xx' method=post action='index.php?sec=users&sec2=operation/users/user_task_assigment'>";
    echo "<table style='width: 99%;' class=search-table>";
    echo "<tr><td style='width: 150px;'>";
    // Show user
    //combo_user_visible_for_me ($config["id_user"], "id_user", 0, "PR");
    $src_code = print_image('images/group.png', true, false, true);
    echo print_input_text_extended('id_user', '', 'text-id_user', '', 15, 30, false, '', array('style' => 'background: url(' . $src_code . ') no-repeat right;'), true, '', '');
    //. print_help_tip (__("Type at least two characters to search"), true);
    echo "<td>";
    print_submit_button(__('Go'), 'sub_btn', false, 'class="upd sub"');
    echo "<td>";
    echo "</form></table>";
}
echo "<table  class='listing' width=99%>";
/**
 * Print a given user row detailed
 *
 * @param $data_row
 * @param $stat_issue_count
 * @param $group_index
 * @return mixed
 */
function print_user_row($data_row, $stat_issue_count, $group_index)
{
    global $print;
    /** group 1 */
    if ($group_index == 1) {
        /** assigned_project_id is always null, so check current selected project and subprojects,
         * if the user has permission to see info
         */
        $user_permission = userprojectapi::check_user_permission();
    } else {
        $assigned_project_id = $data_row['assigned_project_id'];
        $user_permission = userprojectapi::check_user_has_level($assigned_project_id);
    }
    if ($user_permission) {
        echo '<tr class="info" data-level="2" data-status="1">' . PHP_EOL;
        echo '<td></td>' . PHP_EOL;
        if ($print) {
            echo '<td></td>' . PHP_EOL;
            userprojectapi::get_cell_highlighting($data_row, 1, 'nowrap');
            echo '</td>' . PHP_EOL;
        } else {
            if ($group_index == 1) {
                print_chackbox($data_row);
            } else {
                echo '<td></td>' . PHP_EOL;
            }
            print_user_avatar($data_row, $group_index);
        }
        if ($group_index == 1) {
            print_user_name($data_row);
            print_real_name($data_row);
        }
        print_layer_one_project($data_row, $print, $group_index);
        $project_hierarchy_depth = userprojectapi::get_project_hierarchy_depth(helper_get_current_project());
        if ($group_index != 1) {
            if ($project_hierarchy_depth > 1) {
                print_bug_layer_project($data_row, $print);
            }
            if ($project_hierarchy_depth > 2) {
                print_version_layer_project($data_row, $print);
            }
            print_target_version($data_row, $print);
        }
        $stat_issue_count = print_amount_of_issues($data_row, $group_index, $stat_issue_count, $print);
        print_remark($data_row, $group_index, $print);
        echo '</tr>' . PHP_EOL;
    }
    return $stat_issue_count;
}
print_inventory_tabs('incidents', $id, $inventory_name);
$table->width = '99%';
$table->class = 'listing';
$table->data = array();
$table->head = array();
$table->head[0] = __('Title');
$table->head[1] = __('Date');
$table->head[2] = __('Priority');
$table->head[3] = __('Status');
$table->head[4] = __('Assigned user');
$table->head[5] = __('View');
$incidents = get_incidents_on_inventory($id, false);
foreach ($incidents as $incident) {
    $data = array();
    if (!give_acl($config['id_user'], $incident['id_grupo'], 'IR')) {
        continue;
    }
    $data[0] = $incident['titulo'];
    $data[1] = $incident['inicio'];
    $data[2] = print_priority_flag_image($incident['prioridad'], true);
    $data[3] = get_db_value('name', 'tincident_status', 'id', $incident['estado']);
    $user_avatar = get_db_value('avatar', 'tusuario', 'id_usuario', $incident['id_usuario']);
    $data[4] = print_user_avatar($incident['id_usuario'], true, true);
    $data[4] .= " " . $incident['id_usuario'];
    $data[5] = '<a href="index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id=' . $incident['id_incidencia'] . '"><img src="images/zoom.png" /></a>';
    array_push($table->data, $data);
}
print_table($table);
echo '<div id="inventories-stats">';
echo print_html_report_button("index.php?sec=inventory&sec2=operation/reporting/incidents_html&search_id_inventory={$id}", __('HTML report'), "submit-incident_report", "target='_blank'");
echo '</div>';
示例#7
0
 $disabled = $rowdup["disabled"];
 $id_company = $rowdup["id_company"];
 echo "<tr><td>";
 echo print_checkbox_extended("user-" . $rowdup["id_usuario"], $rowdup["id_usuario"], false, false, "", "class='user_checkbox'", true);
 echo "<td>";
 if ($disabled == 1) {
     echo "<img src='images/lightbulb_off.png' title='" . __("Disabled") . "'> ";
 }
 echo "<td>";
 echo "<a href='index.php?sec=users&sec2=godmode/usuarios/configurar_usuarios&update_user="******"'>" . ucfirst($nombre) . "</a>";
 echo "<td style='font-size:9px'>" . $realname;
 $company_name = (string) get_db_value('name', 'tcompany', 'id', $id_company);
 echo "<td>" . $company_name . "</td>";
 echo "<td style='font-size:9px'>" . human_time_comparation($fecha_registro);
 echo "<td>";
 print_user_avatar($nombre, true);
 echo "&nbsp;";
 if ($config["enteprise"] == 1) {
     $sql1 = 'SELECT * FROM tusuario_perfil WHERE id_usuario = "' . $nombre . '"';
     $result = mysql_query($sql1);
     echo "<a href='#' class='tip'>&nbsp;<span>";
     if (mysql_num_rows($result)) {
         while ($row = mysql_fetch_array($result)) {
             echo dame_perfil($row["id_perfil"]) . "/ ";
             echo dame_grupo($row["id_grupo"]) . "<br>";
         }
     } else {
         echo __('This user doesn\'t have any assigned profile/group');
     }
     echo "</span></a>";
 }