$events = calendar_get_events_agenda($start_date, $end_date, $pn, $config['id_user'], $show_projects, $show_tasks, $show_events, $show_wo, $show_clients); $events_result = array(); //Clean name output foreach ($events as $ev) { $ev["name"] = safe_output($ev["name"]); array_push($events_result, $ev); } echo json_encode($events_result); return; } if ($get_holidays) { $start_date = get_parameter("start_date"); $end_date = get_parameter("end_date"); $id_user = get_parameter("id_user", ""); if (!$id_user) { $users = get_user_visible_users($config["id_user"]); $users_ids = array_keys($users); } else { $users_ids = $id_user; } $holidays = calendar_get_users_holidays_date_range($start_date, $end_date, $users_ids); echo json_encode($holidays); return; } if ($get_non_working_days) { $year = safe_output(get_parameter("year")); $result = calendar_get_non_working_days($year); echo json_encode($result); return; } ?>
if ($query_result) { // Exists. Validation error echo json_encode(false); return; } // Does not exist echo json_encode(true); return; } elseif ($search_non_existing_user_id) { require_once 'include/functions_db.php'; $user_id = get_parameter('user_id', ''); if ($user_id == '') { echo json_encode(true); return; } $users = get_user_visible_users($config['id_user'], "IR", false); foreach ($users as $user) { if (preg_match('/^' . $user_id . '$/i', $user['id_usuario']) || preg_match('/^' . $user_id . '$/i', $user['nombre_real']) || preg_match('/^' . $user_id . '$/i', $user['num_employee'])) { echo json_encode(true); return; } } // Does not exist echo json_encode(false); return; } elseif ($search_existing_user_name) { require_once 'include/functions_db.php'; $user_name = get_parameter('user_name'); $user_id = get_parameter('user_id', 0); $old_user_name = ""; if ($user_id) {
$next_year = $year +1 ; $id_user_show = get_parameter ("id_user", $config["id_user"]); if (($id_user_show != $config["id_user"]) AND (!give_acl($config["id_user"], 0, "PM"))){ // Doesn't have access to this page audit_db($id_user, $config["REMOTE_ADDR"], "ACL Violation","Trying to access to another user yearly report without proper rights"); include ("general/noaccess.php"); exit; } // Extended ACL check for project manager // TODO - Move to enteprrise, encapsulate in a general function $users = get_user_visible_users(); if (($id_user_show == "") || (($id_user_show != $config["id_user"]) && !in_array($id_user_show, array_keys($users)))) { audit_db("Noauth", $config["REMOTE_ADDR"], "No permission access", "Trying to access user workunit report"); require ("general/noaccess.php"); exit; } echo "<h2>".__('Annual report')."</h2>"; echo "<h4>".__('For user').": ". $id_user_show; echo "<div id='button-bar-title'><ul>"; if ($clean_output == 0) { // link full screen if ($pure) {
function api_get_users($return_type, $user) { $users = get_user_visible_users($user, "IR", false); $ret = ''; if ($return_type == 'xml') { $ret = "<xml>\n"; } foreach ($users as $index => $item) { switch ($return_type) { case "xml": $ret .= "<id_user>" . $index . "</id_user>\n"; break; case "csv": $ret .= $item['id_usuario'] . "\n"; break; } } if ($return_type == 'xml') { $ret .= "</xml>\n"; } return $ret; }
function combo_users_task($id_task, $icon_list = false, $return = false) { global $config; // Show only users assigned to this project $task_users = get_db_all_rows_field_filter('trole_people_task', 'id_task', $id_task); $visible_users = get_user_visible_users($config["id_user"], 'PR', true); $users = array(); if ($task_users) { foreach ($task_users as $user) { if (isset($visible_users[$user['id_user']])) { if ($icon_list) { array_push($users, $user); } else { $users[$user['id_user']] = $user['id_user']; } } } } $output = ''; if (!$icon_list) { $output .= print_select($users, 'user', '', '', '', '', true, 0, true, false, false, "width:100px"); } else { $text = __('Users') . ':<br />'; $users_size = count($users); $count = 0; foreach ($users as $user) { $count++; $text .= $user["id_user"]; if ($count < $users_size) { $text .= ", "; } } $output .= print_help_tip($text, true, 'tip_people'); } if ($return) { return $output; } echo $output; }
echo "<a href='index.php?sec=users&sec2=operation/user_report/report_monthly&working_month={$next_month}&working_year={$next_year}'><img src='images/control_fastforward_blue.png' title='" . __('Next') . "'></a> "; echo "</table>"; echo "</td><td>"; echo "<table>"; echo "<tr><td>"; echo __('Filter'); echo "</td><td>"; $search = get_parameter("search", ''); print_input_text('search', $search, '', 25); echo "</table>"; echo "</td><td style='text-align: right;'>"; echo "<input type=submit class='sub search' value='" . __('Search') . "'>"; echo "</td></tr></table>"; echo "</form>"; //$values = get_user_visible_users ($config['id_user'], "UM", true, true, false, $search); $values = get_user_visible_users($config['id_user'], 'UM', true, true, false, $search, false); if (empty($values) && $search == '') { $values[$config['id_user']] = $config['id_user']; } $offset = get_parameter('offset', 0); echo "<table class='blank'><tr><td>"; pagination(count($values), "index.php?sec=users&sec2=operation/user_report/report_monthly", $offset); echo "</td></tr></table>"; echo '<table width="99%" class="listing">'; echo "<th>" . __('Profile'); echo "<th>" . __('User ID'); echo "<th>" . __('Fullname'); echo "<th>" . __('Company'); echo "<th>" . __('Reports'); echo "<th>" . __('Total hours for this month'); echo "<th>" . __('Avg. Scoring');
$ical_text = create_ical($date . ' ' . $time, $duration, $config['id_user'], $description, "Integria imported event: {$title}"); $full_filename = $full_path . $config['id_user'] . '-' . microtime(true) . '.ics'; $full_filename_h = fopen($full_filename, 'a'); fwrite($full_filename_h, $ical_text); fclose($full_filename_h); $nombre = get_db_value('nombre_real', 'tusuario', 'id_usuario', $config['id_user']); $email = get_db_value('direccion', 'tusuario', 'id_usuario', $config['id_user']); if (empty($id)) { $mail_description = $config["HEADER_EMAIL"] . "A new entry in calendar has been created by user " . $config['id_user'] . " ({$nombre})\n\n\n\t\t\t\tDate and time: {$date} {$time}\n\n\t\t\t\tTitle : {$title}\n\n\t\t\t\tDescription : {$description}\n\n" . $config["FOOTER_EMAIL"]; } else { $mail_description = $config["HEADER_EMAIL"] . "A calendar entry has been updated by user " . $config['id_user'] . " ({$nombre})\n\n\n\t\t\t\tOld date and time: " . $old_entry['timestamp'] . "\n\n\t\t\t\tOld title : " . $old_entry['title'] . "\n\n\t\t\t\tOld description : " . $old_entry['description'] . "\n\n\n\t\t\t\tNew date and time: {$date} {$time}\n\n\t\t\t\tNew title : {$title}\n\n\t\t\t\tNew description : {$description}\n\n" . $config["FOOTER_EMAIL"]; } $emails = array(); $users = false; if ($public) { $users = get_user_visible_users($config['id_user'], 'AR', false, true, true); } else { if (!empty($groups)) { $users = get_users_in_group($config['id_user'], $groups, 'AR'); } } if (is_array($users)) { $emails = array_reduce($users, function ($carry, $user) { $disabled = (bool) $user['disabled']; $email = trim($user['direccion']); if (!$disabled && !empty($email)) { if (!in_array($email, $carry)) { $carry[] = $email; } } return $carry;
$id_grupo = get_parameter ("id_grupo",0); $id = get_parameter ('id', $config["id_user"]); $real_user_id = $config["id_user"]; if ((give_acl($real_user_id, $id_grupo, "PR") != 1) AND (give_acl($$real_user_id, $id_grupo, "IR") != 1)){ // Doesn't have access to this page audit_db($real_user_id,$config["REMOTE_ADDR"], "ACL Violation","Trying to access to user monthly report without projects rights"); include ("general/noaccess.php"); exit; } //$users = get_user_visible_users(); $users = get_user_visible_users(0,'IR',true,true,false,'',false); if (($id == "") || (($id != $real_user_id) && !in_array($id, array_keys($users)))) { audit_db("Noauth", $config["REMOTE_ADDR"], "No permission access", "Trying to access user workunit report"); require ("general/noaccess.php"); exit; } // Get parameters for actual Calendar show $time = time(); $month = get_parameter ( "month", date('n', $time)); $year = get_parameter ( "year", date('y', $time)); $lock_month = get_parameter ("lock_month", ""); $today = date('j',$time); $days_f = array();
echo '<div class="div_ui div_right_ui">'; echo print_select($companies_selected, "destiny", '', '', '', 0, true, true, false, false, false, '', true); echo '</div>'; echo '<p class="button_send_groups"><input type="button" value=' . __('Submit') . ' onclick="load_company_groups()" /></p>'; echo '</form>'; return; } if ($get_user_associated) { $filter = get_parameter("filter"); if ($filter != 'none,') { $name_prepare = get_user_visible_users($config['id_user']); $name_selected_prepare = explode(",", $filter); $name = array_diff($name_prepare, $name_selected_prepare); $name_selected = array_intersect($name_prepare, $name_selected_prepare); } else { $name = get_user_visible_users($config['id_user']); } echo '<div class="div_ui div_left_ui">'; echo print_select($name, "origin_users", '', '', '', 0, true, true, false); echo '</div>'; echo '<div class="div_middle_ui">'; echo '<a class="pass left"><img src="images/flecha_dcha.png"/></a><br/>'; echo '<a class="passall left"><img src="images/go_finish.png"/></a><br/>'; echo '<a class="remove right"><img src="images/flecha_izqda.png"/></a><br/>'; echo '<a class="removeall right"><img src="images/go_begin.png"/></a>'; echo '</div>'; echo '<div class="div_ui div_right_ui">'; echo print_select($name_selected, "destiny", '', '', '', 0, true, true, false, false, false, '', true, "destiny_users"); echo '</div>'; echo '<p class="button_send_groups"><input type="button" value=' . __('Submit') . ' onclick="load_users_groups()" /></p>'; echo '</form>';
public function ajax ($method = false) { if (! $this->isLogged()) { return; } switch ($method) { case 'search_users': $string = (string) get_parameter ('term'); /* term is what autocomplete plugin gives */ $users = get_user_visible_users ($this->getIdUser(),"IR", false); if ($users === false) return; $res = array(); foreach ($users as $user) { if(preg_match('/'.$string.'/i', $user['id_usuario']) || preg_match('/'.$string.'/i', $user['nombre_real'])|| preg_match('/'.$string.'/i', $user['num_employee'])) { array_push($res, array("label" => safe_output($user['nombre_real'])." (".$user['id_usuario'].")", "value" => $user['id_usuario'])); } } echo json_encode($res); break; case 'search_users_role': $id_project = (int) get_parameter ('id_project'); $string = (string) get_parameter ('term'); /* term is what autocomplete plugin gives */ $users = get_users_project ($id_project); if ($users === false) return; $res = array(); foreach ($users as $user) { if(preg_match('/'.$string.'/i', $user['id_usuario']) || preg_match('/'.$string.'/i', $user['nombre_real'])|| preg_match('/'.$string.'/i', $user['num_employee'])) { array_push($res, array("label" => safe_output($user['nombre_real'])." (".$user['id_usuario'].")", "value" => $user['id_usuario'])); } } echo json_encode($res); break; } }