$table->head[0] = __('Name'); $table->head[1] = __('Manager'); $table->head[2] = __('Completion'); $table->head[3] = __('Updated'); $table->head[4] = ''; $table->data = array (); $where_clause = ""; if ($search_text != "") { $where_clause .= sprintf (" AND (tproject.name LIKE '%%%s%%' OR tproject.description LIKE '%%%s%%')", $search_text, $search_text); } if ($search_id_project_group != 0) { $where_clause .= sprintf (" AND tproject.id_project_group=$search_id_project_group "); } $sql = get_projects_query ($config['id_user'], $where_clause, $view_disabled); $new = true; while ($project = get_db_all_row_by_steps_sql ($new, $result, $sql)) { $new = false; $project_permission = get_project_access ($config['id_user'], $project['id']); if (!$project_permission['read']) { continue; } $data = array (); // Project name $data[0] = '<a href="index.php?sec=projects&sec2=operation/projects/project_detail&id_project='.$project['id'].'">'.$project['name'].'</a>'; $data[1] = $project["id_owner"];
} print_table ($table); $table->data = array (); echo '<a href="javascript:;" onclick="$(\'#advanced_div\').slideToggle (); return false">'; echo __('Advanced search >>'); echo '</a>'; echo '<div id="advanced_div" style="padding: 0px; margin: 0px; display: none;">'; $table->data[0][0] = print_select_from_sql ('SELECT id, name FROM two_category ORDER BY name', 'id_category', $id_category, '', __("Any"), 0, true, false, false, __('Category')); $table->data[0][1] = print_select_from_sql (get_projects_query($config['id_user']), 'id_project', $id_project, '', __("Any"), 0, true, false, false, __('Project')); $table->data[0][2] = print_checkbox ("need_validation", 1, $need_validation, true, __("Require validation")); print_table ($table); echo "</div>"; echo '</form>'; if ($owner == $config['id_user'] && $creator == "") { $order_by = "ORDER BY created_by_user, priority, last_update DESC"; } elseif ($creator == $config['id_user'] && $owner == "") { $order_by = "ORDER BY assigned_user, priority, last_update DESC"; } else { $order_by = "ORDER BY priority, last_update DESC";
$table->data[0][1] = combo_roles(false, "roles", __('Role'), true); } else { $table->data[0][1] = combo_roles(false, "roles", __('Role'), true, false); } $table->data[0][1] .= integria_help("project_roles", true); $table->data[0][2] = print_submit_button(__('Add'), 'sub_btn', false, 'class="create sub"; style="margin-top:25px"', true); print_table($table); echo "</form>"; echo "<table class='listing' width='99%'>"; echo "<th>" . __("Project"); echo "<th>" . __("Task"); echo "<th>" . __("Role"); echo "<th>" . __("WU"); echo "<th>" . __("WU/Tsk"); echo "<th align='center'>" . __("Delete") . "</th>"; $sql = get_projects_query($id_user, "", 0, true); $new = true; $color = 1; while ($project = get_db_all_row_by_steps_sql($new, $result_project, $sql)) { $sql = get_tasks_query($id_user, $project['id'], "", 0, true); $new = true; $project_access = get_project_access($config['id_user'], $project['id']); // ACL - To see the project, you should have read access if (!$project_access['read']) { $new = false; continue; // Does not show this project tasks } while ($task = get_db_all_row_by_steps_sql($new, $result_task, $sql)) { $new = false; $belong_task = user_belong_task($id_user, $task['id'], true);
$table->rowspan[0][3] = 3; if ($owner != "") { $table->data[0][3] = '<b>' . __('Submitters') . '</b>'; $table->data[0][3] .= '<br>' . graph_workorder_num('200', '100', 'submitter', $where_clause, 5); } else { $table->data[0][3] = '<b>' . __('Owners') . '</b>'; $table->data[0][3] .= '<br><div class="pie_frame">' . graph_workorder_num('200', '100', 'owner', $where_clause, 5) . '</div>'; } print_table($table); $table->data = array(); echo '<a href="javascript:;" onclick="$(\'#advanced_div\').slideToggle (); return false">'; echo __('Advanced search >>'); echo '</a>'; echo '<div id="advanced_div" style="padding: 0px; margin: 0px; display: none;">'; $table->data[0][0] = print_select_from_sql('SELECT id, name FROM two_category ORDER BY name', 'id_category', $id_category, '', __("Any"), 0, true, false, false, __('Category')); $table->data[0][1] = print_select_from_sql(get_projects_query($config['id_user']), 'id_project', $id_project, '', __("Any"), 0, true, false, false, __('Project')); $table->data[0][2] = print_checkbox("need_validation", 1, $need_validation, true, __("Require validation")); print_table($table); echo "</div>"; echo '</form>'; if ($owner == $config['id_user'] && $creator == "") { $order_by = "ORDER BY created_by_user, priority, last_update DESC"; } elseif ($creator == $config['id_user'] && $owner == "") { $order_by = "ORDER BY assigned_user, priority, last_update DESC"; } else { $order_by = "ORDER BY priority, last_update DESC"; } $wos = get_workorders($where_clause, $order_by); $wos = print_array_pagination($wos, "index.php?sec=projects&sec2=operation/workorders/wo{$params}"); if ($wos !== false) { unset($table);
function combo_task_user_manager($id_user, $actual = 0, $return = false, $label = false, $name = false, $nothing = true, $multiple = false, $id_project = false, $id_task_out = false) { $output = ''; $values = array(); if ($id_project) { $where = "AND id={$id_project}"; } else { $where = ""; } if ($id_task_out) { $task_out = "AND id<>{$id_task_out}"; } else { $task_out = ""; } $sql = get_projects_query($id_user, $where); $new = true; while ($project = get_db_all_row_by_steps_sql($new, $result_project, $sql)) { $sql = "SELECT *\n\t\t\t\tFROM ttask\n\t\t\t\tWHERE id_project=" . $project['id'] . "\n\t\t\t\t\tAND id_project IN(SELECT id\n\t\t\t\t\t\t\t\t\t FROM tproject\n\t\t\t\t\t\t\t\t\t WHERE disabled=0)\n\t\t\t\t\t{$task_out}\n\t\t\t\tORDER BY name"; $new = true; $project_access = get_project_access($id_user, $project['id']); // ACL - To continue, the user should have read access if ($project_access['read']) { while ($task = get_db_all_row_by_steps_sql($new, $result_task, $sql)) { $new = false; $task_access = get_project_access($id_user, $project['id'], $task['id'], false, true); // ACL - To show the task, the user should have manage access if ($task_access['manage']) { $values[$task['id']] = array('optgroup' => $project['name'], 'name' => ' ' . $task['name']); } } } else { $new = false; } } if (!$name) { $name = 'id_task'; } if ($nothing && $nothing !== true) { $nothing = $nothing; } elseif ($nothing) { $nothing = __('N/A'); } else { $nothing = ''; } $output .= print_select($values, $name, $actual, '', $nothing, '0', true, $multiple, false, $label); if ($return) { return $output; } echo $output; }