_("MTinfo") . " " . strtolower(_("Project")) . " " . strtolower(_("logbook")), header => _("MTinfo") . " " . strtolower(_("Project")) . " " . strtolower(_("logbook") . " - " . $project['naam']), data => array(array("Date", $datetime), array("Timezone", ucfirst($customer['tz'])), array("MTinfo", VERSION . (is_ReleaseCandidate() ? " - " . $_SESSION[$_PAGE_INFO['id']]['release_dir'] : "")), array("User", getUser($user['id']))))); // Default table layout $single_report_data = array(border => array("LBT", "RBT"), bold => array(0, 0), align => array("L", "L"), font_size => array(8, 8), cell_width => array(1, 179), check_page_end => 1); $double_report_data = array(border => array("LRBT", "LRBT"), bold => array(1, 0), align => array("L", "L"), font_size => array(8, 8), cell_width => array(70, 110), check_page_end => 1); // Initial values $log_found = FALSE; $weco_found = FALSE; $sub_found = FALSE; $scripts = array(ENQ_FRONT_COVER_LWB, ENQ_FRONT_COVER_LLV, ENQ_KEY_LIST, ENQ_LMRA, ENQ_SWITCH_LIST, ENQ_TRANSFER_TECH_MEAS, ENQ_WECO, ENQ_WECO_TRDL, ENQ_WECO_WORKPLACE, ENQ_WECO_WORKTIME, ENQ_WECO_NOVOLTAGE, ENQ_WECO_SAFETY); // Determine level current user $current_user = db_fetch_project_users($id, $_PAGE_INFO['login']['user']['id']); // Not a project user $current_level = 100; if (is_array($current_user)) { foreach ($current_user as $user) { // #14 Project leaders of a project are supposed to be able to see the log regardless of their assigned access level if ($user['rol'] === 'projectleider-rc' || $user['rol'] === 'projectleider') { $current_level = 1; } elseif ($user['level'] < $current_level) { $current_level = $user['level']; } } } if (is_array($logs)) { $llv_overview = FALSE; $lwb_overview = FALSE; foreach ($scripts as $script) { $script_first = TRUE; foreach ($logs as $log) { $found = FALSE; $valid = FALSE; $userTable = $log['gebruiker_tabel']; if ($log['enquete'] == $script) { // Current user log? // Exception are keylists if (($log['gebruiker'] == $_PAGE_INFO['login']['user']['id'] && $userTable == 'gebruiker') || ($script == ENQ_KEY_LIST) || ($script == ENQ_SWITCH_LIST) || ($script == ENQ_WECO) || ($script == ENQ_WECO_TRDL) || ($script == ENQ_WECO_WORKPLACE) || ($script == ENQ_WECO_WORKTIME) || ($script == ENQ_WECO_NOVOLTAGE) || ($script == ENQ_WECO_SAFETY) ) { $found = TRUE; $log_id = $log['id']; // Not a project user $project_user_level = 100; if ($userTable == 'gebruiker_profiel') { // Get access level of when the profile was last signed in $checkInOutAccessLevel = getCheckInOutAccessLevel($log['gebruiker'], $id, 'incheck'); if ($checkInOutAccessLevel) { $project_user_level = $checkInOutAccessLevel; } } else { // Determine level user $project_user = db_fetch_project_users($id, $log['gebruiker']); if (is_array($project_user)) { foreach ($project_user as $user) { if ($user['level'] < $project_user_level) { $project_user_level = $user['level']; } } } } // Check level if (($current_level <= $project_user_level) && ($current_level != 100)) { $valid = TRUE; } } } // Valid // Exception is LWB icw LLV overview if ((($found) && ($valid)) || (($current_level == 8) && ($script == ENQ_FRONT_COVER_LLV) && (!llv_overview))) { // This is a valid script $valid_script = TRUE; if (($found) && ($valid)) { // Get the answers $answers = db_fetch_questionaire_answers($log_id, QUESTIONAIRE_SINGLE); // Only saved items if ((is_array($answers)) && (!empty($answers))) { $tmp = $answers; $answers = array(); foreach ($tmp as $tmp_item) { if ($tmp_item['antwoorden'][0]['opgeslagen'] == "yes") { array_push($answers, $tmp_item); } } } if ((is_array($answers)) && (!empty($answers))) { // Display chapter title when saved questions switch ($script) { case ENQ_FRONT_COVER_LWB: case ENQ_FRONT_COVER_LLV: case ENQ_KEY_LIST: case ENQ_SWITCH_LIST: case ENQ_LMRA: case ENQ_TRANSFER_TECH_MEAS: if (!$log_found) { $log_found = TRUE; // Chapter title report_data(array_merge($double_report_data, array(value => array(ucfirst(_("logbook"))), cell_width => array(180, 0), font_size => array(12, 12), border => array("", ""), ishtml => array(array(type => "bookmark", data => ucfirst(_("logbook")), parent => 0, bold => 1))))); } break; case ENQ_WECO: case ENQ_WECO_TRDL: case ENQ_WECO_WORKPLACE: case ENQ_WECO_WORKTIME: case ENQ_WECO_NOVOLTAGE: case ENQ_WECO_SAFETY: if (!$weco_found) { // Add extra empty line if ($log_found) { empty_line(); } $weco_found = TRUE; // Chapter title report_data(array_merge($double_report_data, array(value => array(ucfirst(_("Weco"))), cell_width => array(180, 0), font_size => array(12, 12), border => array("", ""), ishtml => array(array(type => "bookmark", data => ucfirst(_("Weco")), parent => 0, bold => 1))))); } break; } // Default value $enquete_id = 0; $i18n = getI18n($answers[0]['gebruiker'], $answers[0]['gebruiker_tabel']); // Get the questions $questions = db_fetch_questionaires($i18n, $id); // Determine set of questions used if (is_array($questions)) { for ($i = 0; $i < sizeof($questions); $i++) { if ($questions[$i]['id'] == $answers[0]['enquete']) { $enquete_id = $i; } } } $bookmark = ""; if ($script_first) { // Add empty line empty_line(); // Add bookmark $bookmark = array(type => "bookmark", data => $questions[$enquete_id]['titel'], parent => $_PAGE_INFO['bookmark_handle'], bold => 0); // Clear flag $script_first = FALSE; // Enquete title report_data(array_merge($double_report_data, array(value => array($questions[$enquete_id]['titel']), cell_width => array(180, 0), font_size => array(10, 10), border => array("", ""), ishtml => array($bookmark)))); } // Initial value $count = 0; $max_chars = 100; $number = 0; do { // Initial value $finished = TRUE; $first = TRUE; foreach ($answers[0]['antwoorden'] as $answer) { if ($answer['volgnummer'] == $number) { // Initial values $valid = TRUE; // Get the dependency questions $dependency = db_fetch_dependency_questionaire($answer['vraag'], 0); if ((!is_array($dependency)) || (empty($dependency))) { // Increment counter $count++; // Clear sub counter $count_sub = 0; // No sub item? $sub_item = FALSE; } else { // Increment sub counter $count_sub++; // Default level $sub_item = 1; do { $found = FALSE; for ($i = 0; (($i < sizeof($dependency)) && ($found !== TRUE)); $i++) { // Get the dependency questions $new_dependency = db_fetch_dependency_questionaire($dependency[$i]['dependency'], 0); if ((is_array($new_dependency)) && (!empty($new_dependency))) { $found = TRUE; } } // New dependency? if ($found) { $dependency = $new_dependency; $sub_item++; } } while ($found); } if ($valid) { // Add sub-title if ($first) { switch ($script) { case ENQ_KEY_LIST: case ENQ_SWITCH_LIST: case ENQ_LMRA: case ENQ_WECO_TRDL: case ENQ_WECO_WORKPLACE: case ENQ_WECO_WORKTIME: case ENQ_WECO_NOVOLTAGE: switch ($script) { case ENQ_KEY_LIST: $data = 126; break; case ENQ_SWITCH_LIST: $data = 215; break; case ENQ_WECO_TRDL: $data = 123; break; case ENQ_WECO_WORKPLACE: $data = 107; break; case ENQ_WECO_WORKTIME: $data = 111; break; case ENQ_WECO_NOVOLTAGE: $data = 115; break; } // Get key name $subtitle = db_fetch_questionaire_answer($answer['enquete_entry'], $data, $answer['volgnummer']); // Get user $entry = db_get_enquete_entry_id($answer['enquete_entry'], "", "", 3); // Define subtitle if ((is_array($subtitle)) && (!empty($subtitle))) { $sub = $subtitle[0]['antwoord']; if (($subtitle[0]['opgeslagen'] == "no") || (!strlen($subtitle[0]['antwoord']))) { // Display "-" when empty/not saved $sub = "-"; } } else { $sub = "-"; } $userOrProfileName = getUserOrProfileName($entry[0]['gebruiker'], $entry[0]['gebruiker_tabel']); multiple_lines($sub . " ($userOrProfileName)", $max_chars, 1, $single_report_data, NULL, FALSE, array('cell' => "fillcolor={rgb 0.78 0.80 0.78}")); break; default: break; } // Clear flag $first = FALSE; } if (!empty($questions[$enquete_id]['vragen'][$answer['vraag']]['vraag'])) { // Add question (italic and red when not saved) multiple_lines($questions[$enquete_id]['vragen'][$answer['vraag']]['vraag'], $max_chars, 1, $single_report_data, NULL, $sub_item, array('cell' => "fillcolor={rgb 0.78 0.80 0.78}")); // Get type of question switch ($questions[$enquete_id]['vragen'][$answer['vraag']]['type']) { // Type=input case "text": // Type=datetime case "datetime": // Type=textarea case "listbox": // Type=listbox case "simpletext": // Pre-action required? switch ($script) { case ENQ_FRONT_COVER_LWB: case ENQ_FRONT_COVER_LLV: // Initial value $user = ""; switch ($questions[$enquete_id]['vragen'][$answer['vraag']]['actie']) { case "php:wbu"; $user = db_fetch_project_users($id, "", "wbu"); break; case "php:wbv"; $user = db_fetch_project_users($id, "", "wbv"); break; case "php:lwb"; $user[0]['id'] = $_PAGE_INFO['login']['user']['id']; break; } if (isset($user[0]['id'])) { $transfer = db_fetch_project_transfer($id, $user[0]['id']); if ((is_array($transfer)) && (!empty($transfer))) { switch ($transfer[0]['status']) { case "goedgekeurd": $answer['antwoord'] .= " (" . ucfirst(_("accepted")) . ": " . convert_datetime($transfer[0]['t'], TRUE) . ")"; break; case "afgekeurd": $answer['antwoord'] .= " (" . ucfirst(_("rejected")) . ": " . convert_datetime($transfer[0]['t'], TRUE) . ")"; break; case "gewijzigd": $answer['antwoord'] .= " (" . ucfirst(_("changed")) . ": " . convert_datetime($transfer[0]['t'], TRUE) . ")"; break; } } } break; case ENQ_WECO_WORKPLACE: switch ($questions[$enquete_id]['vragen'][$answer['vraag']]['id']) { case 109: // Set wbi number as value of the simpletext $answer['antwoord'] .= $project['wbi_nummer']; break; } break; default: // Do nothing break; } // Add result (when saved) multiple_lines(html_entity_decode($answer['antwoord'], ENT_QUOTES), $max_chars, 0, $single_report_data, NULL, $sub_item); break; // Type=checkbox case "set": // Type=enum case "enum": if (is_array($questions[$enquete_id]['vragen'][$answer['vraag']]['antwoorden'])) { $answer_array = explode(",", html_entity_decode($answer['antwoord'], ENT_QUOTES)); foreach ($questions[$enquete_id]['vragen'][$answer['vraag']]['antwoorden'] as $item) { // Determine image $image = ($questions[$enquete_id]['vragen'][$answer['vraag']]['type'] == "enum") ? "radiobutton" : "checkbox"; // Define image $found = FALSE; foreach ($answer_array as $answer_item) { if (!$found) { // Only display when saved if (($answer['antwoord'] == "yes") || ($answer['antwoord'] == $item['key'])) { if (strtolower($answer_item) == strtolower($item['key'])) { $image .= "_checked"; // Set flag $found = TRUE; // Store answer $answer_data = $answer_item; } } } } // Add extension $image .= ".png"; // Extra input textfield available? $extra_input_data = ""; $extra_input = explode(':', $item['antwoord']); if (is_array($extra_input)) { $item['antwoord'] = $extra_input[0]; if ($found) { // "Title" added to input textfield? if (($item['key'] != "*") && (isset($extra_input[1]))) { if (!empty($extra_input[1])) { $extra_input_data = $extra_input[1] . ":"; } // Get input textfield data $data = explode(":\"", $answer_data); if ((is_array($data)) && (isset($data[1]))) { // Remove trailing quote/other $pos = strrpos($data[1], '"'); if ($pos !== FALSE) { $extra_input_data .= " " . substr($data[1], 0, $pos); } } } } } // Others filled in? if ($item['key'] == "*") { $other_answer = ""; $pos = array_search($item['key'], $answer_array); if ($pos !== FALSE) { if (isset($answer_array[$pos + 1])) { // Find next result $other_answer = $answer_array[$pos + 1]; } } $item['antwoord'] .= ": " . $other_answer; } // Add extra input textfield data $item['antwoord'] .= "\r\n" . $extra_input_data; // Add result (when saved) multiple_lines(" " . $item['antwoord'], $max_chars, 0, $single_report_data, array(array(type => "image", left => 2 + ($sub_item * SUB_STEP), width => 7, filename => $image)), $sub_item); } } break; case "image:inline": if (!empty($answer['antwoord'])) { // Does it fit on this page? $nr_lines = 7; $cell_height = 16; if ((($_PAGE_INFO['height'] - ($nr_lines * $cell_height)) < PDF_MARGIN_BOTTOM) || (($nr_lines * $cell_height) > $_PAGE_INFO['height'])) { pdf_page_new(); } // Store current position $old_pdf_height = $_PAGE_INFO['height']; empty_line(); // Clear/delete array $_PAGE_INFO['delete'] = array(); // Strip header info $pos = strpos($answer['antwoord'], ','); $image = base64_decode(substr($answer['antwoord'], $pos + 1)); // Download file download_document_header("image/png", "report_log_attachment_" . $answer['enquete_entry'] . ".png", "write_file", "report_log_attachment_" . $answer['enquete_entry']); download_document_data($image, "write_file", "report_log_attachment_" . $answer['enquete_entry']); // Get image info if ((file_exists($_PAGE_INFO["report_log_attachment_" . $answer['enquete_entry']])) && (filesize($_PAGE_INFO["report_log_attachment_" . $answer['enquete_entry']]) > 0)) { $imagesize = getimagesize($_PAGE_INFO["report_log_attachment_" . $answer['enquete_entry']]); // Get width/height $width = $imagesize[0]; $height = $imagesize[1]; // Determine max width $max_width = 400; $width = ($width > $max_width) ? $max_width : $width; if ($width != $imagesize[0]) { // Determine height (keep aspect ratio) $height = $height * floatval($width / $imagesize[0]); } // empty line empty_line(); pdf_print_image("Test", $_PAGE_INFO["report_log_attachment_" . $answer['enquete_entry']], $height, $width, (($_PAGE_INFO['PDF_WIDTH'] / 2) - ($width / 2) + PDF_MARGIN_LEFT)); } // Restore old position $_PAGE_INFO['height'] = $old_pdf_height; // Add result (when saved) for ($i = 0; $i < $nr_lines; $i++) { if (!$i) { report_data(array_merge($single_report_data, array(value => array("", ""), border => array("LT", "RT")))); } else if ($i == ($nr_lines - 1)) { report_data(array_merge($single_report_data, array(value => array("", ""), border => array("LB", "RB")))); } else { report_data(array_merge($single_report_data, array(value => array("", ""), border => array("L", "R")))); } } } else { report_data(array_merge($single_report_data, array(value => array("", ""), border => array("LBT", "RBT")))); } break; default: // Do nothing break; // Empty line empty_line(); } } } } else { if ($answer['volgnummer'] > $number) { // Not yet finished $finished = FALSE; } } } // Increment number $number++; } while (!$finished); } } // Display titles when overview displayed if ((($script == ENQ_FRONT_COVER_LWB) && (!$lwb_overview) && ($current_level == 8)) || (($script == ENQ_FRONT_COVER_LLV) && (!$llv_overview) && ($current_level == 8)) ) { if (!$log_found) { $log_found = TRUE; // Chapter title report_data(array_merge($double_report_data, array(value => array(ucfirst(_("logbook"))), cell_width => array(180, 0), font_size => array(12, 12), border => array("", ""), ishtml => array(array(type => "bookmark", data => ucfirst(_("logbook")), parent => 0, bold => 1))))); // Empty line empty_line(); } $i18n = getI18n($log['gebruiker'], $userTable); // Get the questions $questions = db_fetch_questionaires($i18n, $id); // Determine set of questions used if (is_array($questions)) { for ($i = 0; $i < sizeof($questions); $i++) { if ($questions[$i]['id'] == $answers[0]['enquete']) { $enquete_id = $i; } } } if (!$count) { // Get enquete $enq = db_fetch_enquete_translations(NULL, 'nl', $log['enquete']); // Enquete title report_data(array_merge($double_report_data, array(value => array($enq[0]['data']), cell_width => array(180, 0), font_size => array(10, 10), border => array("", ""), ishtml => array($bookmark)))); } } // Post-action required? switch ($script) { case ENQ_FRONT_COVER_LWB: case ENQ_FRONT_COVER_LLV: $user_handled = array(); $profilesHandled = array(); switch ($script) { case ENQ_FRONT_COVER_LWB: // LWB level/title $level = 8; $title = "Acceptance lwb overview"; // Overview? if (($current_level == 8) && (!$lwb_overview)) { $lwb_overview = TRUE; $overview = TRUE; } break; case ENQ_FRONT_COVER_LLV: // LLV level/title $level = 9; $title = "Acceptance llv overview"; // Overview? if (($current_level == 8) && (!$llv_overview)) { $llv_overview = TRUE; $overview = TRUE; } break; } // Overview valid? if ($overview) { if ($count) { // Empty line empty_line(); } // Add LWB overview multiple_lines($title, $max_chars, 1, $single_report_data, NULL, $sub_item, array('cell' => "fillcolor={rgb 0.78 0.80 0.78}")); // Get LWB transfers $users = db_fetch_project_users($id, "", "", $level); // Get signed users $signedUsers = user_check_inout_info($id, null, 13, null, null, $level); $status = array("goedgekeurd", "afgekeurd", "gewijzigd"); foreach ($status as $item) { switch ($item) { case "goedgekeurd": multiple_lines(_("accepted") . ":", $max_chars, 1, $single_report_data, NULL, $sub_item); break; case "afgekeurd": multiple_lines(_("rejected") . ":", $max_chars, 1, $single_report_data, NULL, $sub_item); break; case "gewijzigd": multiple_lines(_("changed") . ":", $max_chars, 1, $single_report_data, NULL, $sub_item); break; } // Initial value $found = FALSE; if (renderTransfers($id, $item, $max_chars, $single_report_data, $sub_item, $user_handled, 'id', 'gebruiker', $users)) { $found = true; } if (renderTransfers($id, $item, $max_chars, $single_report_data, $sub_item, $profilesHandled, 'gebruiker', 'gebruiker_profiel', $signedUsers)) { $found = true; } if (!$found) { multiple_lines("-", $max_chars, 1, $single_report_data, NULL, $sub_item, array(border => array("LRT", "LRT"))); } } } break; } } } } } // Add subscription list // Subscription table layout $sub_report_data = array(border => array("LRBT", "LRBT", "LRBT", "LRBT", "LRBT", "LRBT", "LRBT", "LRBT", "LRBT"), bold => array(0, 0, 0, 0, 0, 0, 0, 0, 0), align => array("L", "C", "L", "L", "L", "L", "L", "L", "L"), font_size => array(8, 8, 8, 8, 8, 8, 8, 8, 8), cell_width => array(27, 10, 27, 14, 27, 20, 20, 26, 12), check_page_end => 1); // Get for eacht user the in/out data $inout_items = user_check_inout_info($id, "", 11); // Level check_page if (is_array($inout_items)) { $tmp = $inout_items; $inout_items = array(); foreach ($tmp as $tmp_item) { $rightsHoldingUserId = getRightsHoldingUserId($id, $tmp_item['lwb'], $tmp_item['lwb_tabel']); // Get check in by user level $users = db_fetch_project_users($id, $rightsHoldingUserId); // Initial value $level = 100; if (is_array($users)) { foreach ($users as $user) { if ($user['level'] < $level) { $level = $user['level']; } } if ($current_level <= $level) { array_push($inout_items, $tmp_item); } } } } if ((is_array($inout_items)) && (!empty($inout_items))) { if (!$sub_found) { // Add extra empty line if (($log_found) || ($weco_found)) { empty_line(); } $sub_found = TRUE; // Chapter title report_data(array_merge($double_report_data, array(value => array(ucfirst(_("Subscriptionlist"))), cell_width => array(180, 0), font_size => array(12, 12), border => array("", ""), ishtml => array(array(type => "bookmark", data => ucfirst(_("Subscriptionlist")), parent => 0, bold => 1))))); } // Initial values $gps_info = "-"; $gps_info_link = ""; // Add title $value = array(ucfirst(_("User")), ucfirst(_("Action")), ucfirst(_("Mobile number")), ucfirst(_("Dvp number")), ucfirst(_("by")), ucfirst(_("Date")), ucfirst(_("location")), ucfirst(_("signInListAccessLevel")), ucfirst(_("Work location"))); $styling_options = array(); $bold = array(); $last_dvp = ""; foreach ($value as $item) { array_push($bold, 1); array_push($styling_options, array('cell' => "fillcolor={rgb 0.78 0.80 0.78}")); } report_data(array_merge($sub_report_data, array(value => $value, bold => $bold, styling_options => $styling_options))); foreach ($inout_items as $inout) { if ((strlen($inout['longitude'])) && (strlen($inout['latitude']))) { $gps_info_link = GOOGLE_MAPS . "maps?q=" . $inout['latitude'] . ", " . $inout['longitude']; $gps_info = $inout['latitude'] . ", " . $inout['longitude']; } switch ($inout['level']) { case 9: $accessLevel = _("signInListOptionSafetyFunction"); break; case 10: $accessLevel = _("signInListOptionTeamMember"); break; default: $accessLevel = _("signInListOptionNone"); break; } $value = array($inout['naam'], ($inout['actie'] == "incheck") ? ucfirst(_("in")) : ucfirst(_("out")), $inout['mobielnr'], $inout['dvp'], getUserOrProfileName($inout['lwb'], $inout['lwb_tabel']), convert_datetime($inout['t'], TRUE), $gps_info, $accessLevel, $inout['work_location']); $styling_options = array(); $bookmark = ""; if ($last_dvp != $inout['dvp']) { $last_dvp = $inout['dvp']; // Add bookmark $bookmark = array(type => "bookmark", data => $inout['naam'] . " (" . $inout['dvp'] . ")", parent => $_PAGE_INFO['bookmark_handle'], bold => 0); // Add colors foreach ($value as $item) { $color = ($inout['actie'] == "incheck") ? "fillcolor={rgb 1 0 0}" : "fillcolor={rgb 0 1 0}"; $textcolor = ($inout['actie'] == "incheck") ? "fillcolor={rgb 1 1 1}" : "fillcolor={rgb 0 0 0}"; array_push($styling_options, array('cell' => $color, 'font' => $textcolor)); } } report_data(array_merge($sub_report_data, array(value => $value, ishtml => array($bookmark, "", "", "", "", "", array(type => link, data => $gps_info_link)), styling_options => $styling_options))); } } if (($valid_script) || ($destination == "D")) { // Generate document return report_generate(); } else { // Return nothing return ""; } } function getI18n($userId, $userTable) { $i18n = 'nl'; if ($userTable == 'gebruiker') { // Get user i18n $user_info = db_fetch_user($userId, "", 1); $i18n = $user_info['i18n']; } return $i18n; } /** * Returns the id of the user holding the app rights * * @param int $projectId The id of the project to check the rights for * @param int $lwbId The id of the LWB user * @param string $lwbTable The name of the LWB table * @return int The id of the user holding the rights */ function getRightsHoldingUserId($projectId, $lwbId, $lwbTable) { if ($lwbTable == 'gebruiker') { return $lwbId; } else { $checkInOutInfo = user_check_inout_info($projectId, $lwbId, 8, $lwbTable); if (is_array($checkInOutInfo)) { $projectId = $checkInOutInfo['project']; $lwbId = $checkInOutInfo['lwb']; $lwbTable = $checkInOutInfo['lwb_tabel']; // Get rights holding user id return getRightsHoldingUserId($projectId, $lwbId, $lwbTable); } else { return null; } } } function renderTransfers($projectId, $status, $max_chars, $single_report_data, $sub_item, &$handled, $userIdColumn, $userTable, $users) { $found = false; if (is_array($users)) { foreach ($users as $user) { $transfer = db_fetch_project_transfer($projectId, $user[$userIdColumn]); if ((is_array($transfer)) && (!empty($transfer))) { if ($transfer[0]['status'] == $status) { if (!in_array($user[$userIdColumn], $handled)) { multiple_lines(getUserOrProfileName($user[$userIdColumn], $userTable) . ": " . convert_datetime($transfer[0]['t'], TRUE), $max_chars, 0, $single_report_data, NULL, $sub_item); // Add to array array_push($handled, $user[$userIdColumn]); // Set Flag $found = true; } } } } } return $found; }