$assigned_str3 = 'project_task.project_task_id=project_assigned_to.project_task_id AND'; } else { //no assigned to was chosen, so don't add it to where clause $assigned_str = ''; } //build page title to make bookmarking easier //if a user was selected, add the user_name to the title //same for status pm_header(array('title' => 'Browse Tasks' . ($_assigned_to ? ' For: ' . user_getname($_assigned_to) : '') . ($_status && $_status != 100 ? ' By Status: ' . pm_data_get_status_name($_status) : ''))); $sql = "SELECT project_task.priority,project_task.group_project_id,project_task.project_task_id," . "project_task.start_date,project_task.end_date,project_task.percent_complete,project_task.summary " . "FROM project_task {$assigned_str2} " . "WHERE {$assigned_str3} project_task.group_project_id='{$group_project_id}' " . " {$assigned_str} {$status_str} " . $order_by; $message = "Browsing Custom Task List"; $result = db_query($sql, 51, $offset); /* creating a custom technician box which includes "any" and "unassigned" */ $res_tech = pm_data_get_technicians($group_id); $tech_id_arr = util_result_column_to_array($res_tech, 0); $tech_id_arr[] = '0'; //this will be the 'any' row $tech_name_arr = util_result_column_to_array($res_tech, 1); $tech_name_arr[] = 'Any'; $tech_box = html_build_select_box_from_arrays($tech_id_arr, $tech_name_arr, '_assigned_to', $_assigned_to, true, 'Unassigned'); /* Show the new pop-up boxes to select assigned to and/or status */ echo '<H2>Browse Tasks by</H2> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="6"><FORM ACTION="' . $PHP_SELF . '" METHOD="GET"> <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . $group_id . '"> <INPUT TYPE="HIDDEN" NAME="set" VALUE="custom"> <TR><TD><b>Subproject:</b></TD><TD><b>Assigned User:</b></TD><TD><b>Status:</b></TD></TR> <TR><TD>' . pm_show_subprojects_box('group_project_id', $group_id, $group_project_id) . '</TD>' . '<TD><FONT SIZE="-1">' . $tech_box . '</TD><TD><FONT SIZE="-1">' . pm_status_box('_status', $_status, 'Any') . '</TD>' . '<TD><FONT SIZE="-1"><INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Browse"></TD></TR></FORM></TABLE>';
function pm_multiple_assigned_box($name = 'assigned_to[]', $group_id = false, $project_task_id = false) { if (!$group_id) { return 'ERROR - no group_id'; } else { $result = pm_data_get_technicians($group_id); if ($project_task_id) { //get the data so we can mark items as SELECTED $result2 = pm_data_get_assigned_to($project_task_id); return html_build_multiple_select_box($result, $name, util_result_column_to_array($result2)); } else { return html_build_multiple_select_box($result, $name, array()); } } }