<tr> <th>Priority</th><td><?php echo $assignment->priority; ?> </td> </tr> --> <tr> <th>Estimated start</th><td><?php echo unix_to_human($assignment->appointment_date, '%h:%i%a'); ?> </td> </tr> <tr> <th>Estimated time</th><td><?php echo get_duration($assignment->estimated_duration); ?> </td> </tr> <tr> <th>Estimated finish</th><td><?php echo unix_to_human($assignment->appointment_date + $assignment->estimated_duration * 60, '%h:%i%a'); ?> </td> </tr> <?php // TODO Display a summary of time spent on job ?> </table> </div> <div class="modal-footer">
function report_row(&$rows, &$data) { global $output_format, $ajax, $ajax_capable; global $csv_row_sep, $csv_col_sep; global $custom_fields, $field_natures, $field_lengths, $tbl_entry; global $approval_somewhere, $confirmation_somewhere; global $strftime_format; global $select_options; global $field_order_list; // If we're capable of delivering an Ajax request and this is not Ajax request, // then don't do anything. We're going to save sending the data until we actually // get the Ajax request; we just send the rest of the page at this stage. if ($output_format == OUTPUT_HTML && $ajax_capable && !$ajax) { return; } $values = array(); foreach ($field_order_list as $field) { $value = $data[$field]; // Some fields need some special processing to turn the raw value into something // more meaningful switch ($field) { case 'end_time': // Calculate the duration and then fall through to calculating the end date // Need the duration in seconds for sorting. Have to correct it for DST // changes so that the user sees what he expects to see $duration_seconds = $data['end_time'] - $data['start_time']; $duration_seconds -= cross_dst($data['start_time'], $data['end_time']); $d = get_duration($data['start_time'], $data['end_time'], $data['enable_periods']); $d_string = $d['duration'] . ' ' . $d['dur_units']; $d_string = escape($d_string); case 'start_time': $mod_time = $field == 'start_time' ? 0 : -1; if ($data['enable_periods']) { list(, $date) = period_date_string($value, $mod_time); } else { $date = time_date_string($value); } $value = $date; break; case 'type': $value = get_type_vocab($value); break; case 'confirmation_enabled': // Translate the status field bit into meaningful text if ($data['confirmation_enabled']) { $value = $data['status'] & STATUS_TENTATIVE ? get_vocab("tentative") : get_vocab("confirmed"); } else { $value = ''; } break; case 'approval_enabled': // Translate the status field bit into meaningful text if ($data['approval_enabled']) { $value = $data['status'] & STATUS_AWAITING_APPROVAL ? get_vocab("awaiting_approval") : get_vocab("approved"); } else { $value = ''; } break; case 'last_updated': $value = time_date_string($value); break; default: // Custom fields if (array_key_exists($field, $custom_fields)) { // Output a yes/no if it's a boolean or integer <= 2 bytes (which we will // assume are intended to be booleans) if ($field_natures[$field] == 'boolean' || $field_natures[$field] == 'integer' && isset($field_lengths[$field]) && $field_lengths[$field] <= 2) { $value = empty($value) ? get_vocab("no") : get_vocab("yes"); } elseif (isset($value)) { // If the custom field is an associative array then we want // the value rather than the array key (provided the key is not // an empty string) if (isset($select_options["entry.{$field}"]) && is_assoc($select_options["entry.{$field}"]) && array_key_exists($value, $select_options["entry.{$field}"]) && $value !== '') { $value = $select_options["entry.{$field}"][$value]; } } else { $value = ''; } } break; } $value = escape($value); // For HTML output we take special action for some fields if ($output_format == OUTPUT_HTML) { switch ($field) { case 'name': // Add a link to the entry and also a data-id value for the Bulk Delete JavaScript $value = "<a href=\"view_entry.php?id=" . $data['id'] . "\"" . " data-id=\"" . $data['id'] . "\"" . " title=\"{$value}\">{$value}</a>"; break; case 'end_time': // Process the duration and then fall through to the end_time // Include the duration in a seconds as a title in an empty span so // that the column can be sorted and filtered properly $d_string = "<span title=\"{$duration_seconds}\"></span>{$d_string}"; case 'start_time': case 'last_updated': // Include the numeric time as a title in an empty span so // that the column can be sorted and filtered properly $value = "<span title=\"{$data[$field]}\"></span>{$value}"; break; default: break; } } // Add the value to the array. We don't bother with some fields if // they are going to be irrelevant if (($confirmation_somewhere || $field != 'confirmation_enabled') && ($approval_somewhere || $field != 'approval_enabled')) { $values[] = $value; } // Special action for the duration if ($field == 'end_time') { $values[] = $d_string; } } // foreach $rows[] = $values; }
function display_id($id) { global $db, $year, $month, $day, $config; $row = get_event_by_id($id); $year = $row['year']; $month = $row['month']; $day = $row['day']; $time_str = formatted_time_string($row['starttime'], $row['eventtype']); $date_str = formatted_date_string($row['year'], $row['month'], $row['day'], $row['end_year'], $row['end_month'], $row['end_day']); $dur_str = get_duration($row['duration'], $row['eventtype']); $subject = htmlspecialchars(strip_tags(stripslashes($row['subject']))); if (empty($subject)) { $subject = _('(No subject)'); } $name = stripslashes($row['username']); $desc = parse_desc($row['description']); if (check_user($row['uid']) || $config['anon_permission'] >= 2) { return tag('div', attributes('class="phpc-main"'), tag('h2', $subject), tag('div', 'by ', tag('cite', $name)), tag('div', create_id_link(_('Modify'), 'event_form', $id), "\n", create_id_link(_('Delete'), 'event_delete', $id)), tag('div', tag('div', _('Date') . ": {$date_str}"), tag('div', _('Time') . ": {$time_str}"), tag('div', _('Duration') . ": {$dur_str}")), tag('p', $desc)); } else { return tag('div', attributes('class="phpc-main"'), tag('h2', $subject), tag('div', 'by ', tag('cite', $name)), tag('div', tag('div', _('Date') . ": {$date_str}"), tag('div', _('Time') . ": {$time_str}"), tag('div', _('Duration') . ": {$dur_str}")), tag('p', $desc)); } }
//$subject_code = $_POST['subject_menu']; //$room_no = $_POST['room_menu']; //$emp_id = $_POST['teacher_menu']; if (isset($_POST['e_day_menu'])) { //$days = array($_POST['day_menu']); $s_time_index = $_POST['e_s_time_menu']; $e_time_index = $_POST['e_e_time_menu']; $start_time = $times[$s_time_index]; $end_time = $times[$e_time_index]; if (strtotime($start_time) < strtotime($end_time)) { //$start_time<$end_time if (!($msg = is_faculty_loaded_e($class_id, $start_time, $end_time, $_POST['e_day_menu'], $schedule_id))) { //!$msg = is_loaded() if (!($msg = is_section_loaded_e($_GET['section_id'], $start_time, $end_time, $_POST['e_day_menu'], $schedule_id))) { //!$msg = is_teacher_max($emp_id, $subject_code) $total_hours = get_duration($start_time, $end_time) * count($_POST['e_day_menu']); if (!($msg = is_subj_max_e($class_id, $total_hours, $schedule_id))) { //!$msg = is_subj_max($section_id, $subject_code) foreach ($_POST['e_day_menu'] as $day) { $sy_id = get_active_sy(); mysql_query("START TRANSACTION;"); mysql_query("UPDATE class_schedule_temp_t \n\t\t\t\t\t\t\t\t\t\t\t SET class_id='{$class_id}', \n\t\t\t\t\t\t\t\t\t\t\t\t\t day='{$day}', \n\t\t\t\t\t\t\t\t\t\t\t\t\t time_start='{$start_time}', \n\t\t\t\t\t\t\t\t\t\t\t\t\t time_end='{$end_time}', \n\t\t\t\t\t\t\t\t\t\t\t\t\t room='102'\n\t\t\t\t\t\t\t\t\t\t\t WHERE schedule_id='{$schedule_id}'\n\t\t\t\t\t\t\t\t\t\t\t ") or die(mysql_error()); mysql_query("COMMIT;"); } $msg = "Successfuly Edited Load {$start_time};"; } //else // $msg = "hello"; } //else // $msg = "Teacher has reached maximum loads available";
/** * Function to status availability of user * @param string $owner - ownername * @param integer $userid - userid * @param integer $activity_id - activityid * @param string $avail_date - date in string format * @param string $activity_start_time - time string * @param string $activity_end_time - time string * return string $availability - html img tag in string */ function status_availability($owner, $userid, $activity_id, $avail_date, $activity_start_time, $activity_end_time) { global $adb, $image_path, $log, $theme; $log->debug("Entering status_availability(" . $owner, $userid . "," . $activity_id . "," . $avail_date . "," . $activity_start_time . "," . $activity_end_time . ") method ..."); $avail_flag = "false"; $avail_date = getDBInsertDateValue($avail_date); if ($owner != $userid) { $usr_query = "select activityid,vtiger_activity.date_start,vtiger_activity.due_date, vtiger_activity.time_start,vtiger_activity.duration_hours,vtiger_activity.duration_minutes,vtiger_crmentity.smownerid from vtiger_activity,vtiger_crmentity where vtiger_crmentity.crmid=vtiger_activity.activityid and ('" . $avail_date . "' like date_start) and vtiger_crmentity.smownerid=? and vtiger_activity.activityid !=? and vtiger_crmentity.deleted=0"; } else { $usr_query = "select activityid,vtiger_activity.date_start,vtiger_activity.due_date, vtiger_activity.time_start,vtiger_activity.duration_hours,vtiger_activity.duration_minutes,vtiger_crmentity.smownerid from vtiger_activity,vtiger_crmentity where vtiger_crmentity.crmid=vtiger_activity.activityid and ('" . $avail_date . "' like date_start) and vtiger_crmentity.smownerid=? and vtiger_activity.activityid !=? and vtiger_crmentity.deleted=0"; } $result_cal = $adb->pquery($usr_query, array($userid, $activity_id)); $noofrows_cal = $adb->num_rows($result_cal); $avail_flag = "false"; if ($noofrows_cal != 0) { while ($row_cal = $adb->fetch_array($result_cal)) { $usr_date_start = $row_cal['date_start']; $usr_due_date = $row_cal['due_date']; $usr_time_start = $row_cal['time_start']; $usr_hour_dur = $row_cal['duration_hours']; $usr_mins_dur = $row_cal['duration_minutes']; $user_start_time = time_to_number($usr_time_start); $user_end_time = get_duration($usr_time_start, $usr_hour_dur, $usr_mins_dur); if ($user_start_time > $activity_start_time && $user_start_time < $activity_end_time || $user_end_time > $activity_start_time && $user_end_time < $activity_end_time || ($activity_start_time == $user_start_time || $activity_end_time == $user_end_time)) { $availability = 'busy'; $avail_flag = "true"; $log->info("user start time-- " . $user_start_time . "user end time" . $user_end_time); $log->info("Availability " . $availability); } } } if ($avail_flag != "true") { $recur_query = "SELECT vtiger_activity.activityid, vtiger_activity.time_start, vtiger_activity.duration_hours, vtiger_activity.duration_minutes , vtiger_crmentity.smownerid, vtiger_recurringevents.recurringid, vtiger_recurringevents.recurringdate as date_start from vtiger_activity inner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid inner join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid where ('" . $avail_date . "' like vtiger_recurringevents.recurringdate) and vtiger_crmentity.smownerid=? and vtiger_activity.activityid !=? and vtiger_crmentity.deleted=0"; $result_cal = $adb->pquery($recur_query, array($userid, $activity_id)); $noofrows_cal = $adb->num_rows($result_cal); $avail_flag = "false"; if ($noofrows_cal != 0) { while ($row_cal = $adb->fetch_array($result_cal)) { $usr_date_start = $row_cal['date_start']; $usr_time_start = $row_cal['time_start']; $usr_hour_dur = $row_cal['duration_hours']; $usr_mins_dur = $row_cal['duration_minutes']; $user_start_time = time_to_number($usr_time_start); $user_end_time = get_duration($usr_time_start, $usr_hour_dur, $usr_mins_dur); if ($user_start_time > $activity_start_time && $user_start_time < $activity_end_time || $user_end_time > $activity_start_time && $user_end_time < $activity_end_time || ($activity_start_time == $user_start_time || $activity_end_time == $user_end_time)) { $availability = 'busy'; $avail_flag = "true"; $log->info("Recurring Events:: user start time-- " . $user_start_time . "user end time" . $user_end_time); $log->info("Recurring Events:: Availability " . $availability); } } } } if ($avail_flag == "true") { $availability = ' <IMG SRC="' . vtiger_imageurl('busy.gif', $theme) . '">'; } else { $availability = ' <IMG SRC="' . vtiger_imageurl('free.gif', $theme) . '">'; } $log->debug("Exiting status_availability method ..."); return $availability; }
function is_subj_max_e($class_id, $add_hours, $schedule_id) { $query = mysql_query("SELECT subject_t.credit_unit AS credit_unit FROM subject_t, class_t WHERE subject_t.subject_code=class_t.subject_code\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t AND class_t.class_id={$class_id}") or die("error selecting subject"); $row = mysql_fetch_assoc($query); $credit_unit = $row['credit_unit']; $total_hours = unit_to_time($credit_unit); //insert codes for getting the current school year $query_sched = mysql_query("SELECT * FROM class_schedule_temp_t WHERE schedule_id='{$schedule_id}'") or die("subj_func " . mysql_error()); $row_sched = mysql_fetch_assoc($query_sched); $start = $row_sched['time_start']; $end = $row_sched['time_end']; $deduction = get_duration($start, $end); $curr_hours = total_hours($class_id) - $deduction; $curr_hours += $add_hours; if ($total_hours < $curr_hours) { return "Section has exceeded the maximum no. of load for the subject ({$curr_hours}/{$total_hours})"; } else { return NULL; } }
function show_galeria($id, $titulo, $copete, $texto, $file, $tabla, $mode = '') { $path = '_uploads/' . $tabla . '/' . $file; $foto = substr(trim($path), 0, strlen(trim($path)) - 4) . '-converted.flv1.jpg'; $video = substr(trim($path), 0, strlen(trim($path)) - 4) . '-converted.flv'; $audio = substr(trim($path), 0, strlen(trim($path)) - 4) . '-converted.mp3'; /* echo '<p>id: '.$id; echo '<br />titulo: '.$titulo; echo '<br />file: '.$file; echo '<br />tabla: '.$tabla; echo '<br />mode: '.$mode; echo '<br />path: '.$path; echo '<br />foto: '.$foto; echo '<br />video: '.$video.'</p>'; echo '<br />audio: '.$audio.'</p>'; */ echo '<div class="show_video_galeria" id="item_' . $id . '">'; if ($mode == 'video') { // ----------------------------------------------- MODO VIDEO ----------------------------------------------------------- // // ----------------------------------------------- MODO VIDEO ----------------------------------------------------------- // // ---------------------- si existe video convertido y existe el preview poner el player -------------------------------- // if (file_exists($video) && file_exists($foto)) { //echo 'Existe video convertido y foto preview. '; $prefijo = substr(md5(uniqid(rand())), 0, 2); ?> <div class="player"> <div id="s<?php echo $prefijo; ?> "></div> <script type="text/javascript"> var s<?php echo $prefijo; ?> = new SWFObject("player.swf", "ply", "220", "185", "9", "#FFFFFF"); s<?php echo $prefijo; ?> .addParam("allowfullscreen", "true"); s<?php echo $prefijo; ?> .addParam("allowscriptaccess", "always"); s<?php echo $prefijo; ?> .addParam("wmode", "opaque"); s<?php echo $prefijo; ?> .addVariable("file", "<?php echo $video; ?> "); s<?php echo $prefijo; ?> .addVariable("image", "<?php echo $foto; ?> "); s<?php echo $prefijo; ?> .addVariable("duration", "<?php echo get_duration($video); ?> "); s<?php echo $prefijo; ?> .write("s<?php echo $prefijo; ?> "); </script> <?php $campo = 'video'; echo '<div class="buttons">'; echo '<a href="javascript:borrar(\'' . $id . '\',\'' . $tabla . '\',\'delete_item\')" onclick="return boton_borrar();"><img class="buttons" src="img/admin/film_delete.png" alt="borrar" title="borrar"/></a>'; echo '<a href="#edit" class="edit"><img class="buttons" src="img/admin/eye.png" alt="info" title="info"/></a>'; echo '<a href="#move" class="mover"><img class="buttons" src="img/admin/move.png" alt="mover" title="mover"/></a>'; echo '<div class="edit_box">'; echo '<p>Original: ' . substr($file, 3, strlen($file)) . '</p>'; echo '<p>Convertido: ' . $video . '</p>'; echo '<p>Preview: ' . $foto . '</p>'; echo get_data_video($video); echo '</div>'; echo '</div>'; echo '</div>'; } // --------------------------------- si se necesita convertir el video ------------------------------------------- // if (file_exists($path) && $file != '' && !file_exists($foto) && !file_exists($video)) { //echo 'Existe video pero sin convertir, sin preview. '; $campo = 'video'; echo '<p><a href="javascript:convertVideo(\'' . $campo . '\',\'' . $id . '\',\'' . $tabla . '\')">Debe convertir este video para que obtener una imagen de previsualización y un formato apropiado para el sitio. Haga click en este enlace para comenzar la conversión (Esto puede tardar unos minutos).</a></p>'; echo '<div class="buttons">'; echo '<a href="javascript:borrar(\'' . $id . '\',\'' . $tabla . '\',\'delete_video\')" onclick="return boton_borrar();"><img class="buttons" src="img/admin/film_delete.png" alt="borrar" title="borrar"/></a>'; echo '<a href="javascript:convertVideo(\'' . $campo . '\',\'' . $id . '\',\'' . $tabla . '\')"><img class="buttons" src="img/admin/film_go.png" alt="Convertir" title="Convertir"/></a>'; echo '<a href="#move" class="mover"><img class="buttons" src="img/admin/move.png" alt="mover" title="mover"/></a>'; echo '</div>'; } // --------------------------------- si no existe video subido ------------------------------------------- // if (!file_exists($video) && !file_exists($foto) && !file_exists($path)) { //echo 'No se encuentra el file. '; echo '<div class="player"><p><img src="_plugins/phpt/phpThumb.php?src=../../_uploads/no_disp.jpg&w=50&h=50&zc=1" border="0" alt="' . $titulo . '" title="' . $titulo . '" /></p></div>'; } } if ($mode == 'imagen') { // ----------------------------------------------- MODO IMAGEN ----------------------------------------------------------- // // ----------------------------------------------- MODO IMAGEN ----------------------------------------------------------- // // ---------------------------------------------- si existe foto --------------------------------------------------------- // if (file_exists($path)) { echo '<p><img src="_plugins/phpt/phpThumb.php?src=../../' . $path . '&w=220&h=165&zc=1" alt="' . $titulo . '" title="' . $titulo . '" /></p>'; echo '<div class="buttons">'; echo '<a href="javascript:borrar(\'' . $id . '\',\'' . $tabla . '\',\'delete_imagen_g\')" onclick="return boton_borrar();"><img class="buttons" src="img/admin/delete.png" alt="borrar" title="borrar"/></a>'; echo '<a href="#move" class="mover"><img class="buttons" src="img/admin/move.png" alt="mover" title="mover"/></a>'; echo '<a href="" class="edit"><img class="buttons" src="img/admin/editar_datos.png" alt="info" title="info"/></a>'; echo '<div class="edit_box">'; echo '<form method="post" action="" name="fotog">'; echo '<p><input type="hidden" name="valores_' . $id . '" id="valores_' . $id . '" value="title_' . $id . ',text_' . $id . '" class="galeria_desc" /></p>'; echo '<p>' . $file . '</p>'; echo '<p>Titulo</p>'; echo '<p><input type="text" name="title" id="title_' . $id . '" value="' . $titulo . '" class="galeria_desc" /></p>'; echo '<p>Copete</p>'; echo '<p><input type="text" name="copete" id="copete_' . $id . '" value="' . $copete . '" class="galeria_desc" /></p>'; echo '<p>Descripción</p>'; echo '<p><input type="text" name="text" id="text_' . $id . '" value="' . $texto . '" class="galeria_desc" /></p>'; echo '<p><a href="javascript:guardar_desc_g(\'valores_' . $id . '\',\'' . $id . '\',\'' . $tabla . '\');"><img class="buttons" src="img/admin/aprobar.png" alt="guardar" title="guardar"/></a></p>'; echo '</form>'; echo '</div>'; echo '</div>'; } } if ($mode == 'audio') { // ----------------------------------------------- MODO AUDIO ----------------------------------------------------------- // // ----------------------------------------------- MODO AUDIO ----------------------------------------------------------- // // ---------------------- si existe audio convertido poner el player -------------------------------- // if (file_exists($audio)) { //echo 'Existe audio convertido. '; $prefijo = substr(md5(uniqid(rand())), 0, 2); ?> <div class="player"> <div id="s<?php echo $prefijo; ?> "></div> <script type="text/javascript"> var s<?php echo $prefijo; ?> = new SWFObject("player.swf", "mpl", "220", "20", "9", "#FFFFFF"); s<?php echo $prefijo; ?> .addParam("allowfullscreen", "true"); s<?php echo $prefijo; ?> .addParam("allowscriptaccess", "always"); s<?php echo $prefijo; ?> .addParam("wmode", "opaque"); s<?php echo $prefijo; ?> .addVariable("file", "<?php echo $audio; ?> "); s<?php echo $prefijo; ?> .addVariable("duration", "<?php echo get_duration($audio); ?> "); s<?php echo $prefijo; ?> .write("s<?php echo $prefijo; ?> "); </script> <?php $campo = 'audio'; echo '<div class="buttons">'; echo '<a href="javascript:borrar(\'' . $id . '\',\'' . $tabla . '\',\'delete_audio\')" onclick="return boton_borrar();"><img class="buttons" src="img/admin/audio/sound_delete.png" alt="borrar" title="borrar"/></a>'; echo '<a href="#edit" class="edit"><img class="buttons" src="img/admin/eye.png" alt="info" title="info"/></a>'; echo '<a href="#move" class="mover"><img class="buttons" src="img/admin/move.png" alt="mover" title="mover"/></a>'; echo '<div class="edit_box">'; echo '<p>Original: ' . substr($file, 3, strlen($file)) . '</p>'; echo '<p>Convertido: ' . $audio . '</p>'; echo get_data_audio($audio); echo '</div>'; echo '</div>'; echo '</div>'; } // --------------------------------- si se necesita convertir el audio ------------------------------------------- // if (file_exists($path) && $file != '' && !file_exists($audio)) { //echo 'Existe audio pero sin convertir. '; $campo = 'audio'; echo '<p><a href="javascript:convertAudio(\'' . $campo . '\',\'' . $id . '\',\'' . $tabla . '\')">Debe convertir este audio para obtener un formato apropiado para el sitio. Haga click en este enlace para comenzar la conversión (Esto puede tardar unos minutos).</a></p>'; echo '<div class="buttons">'; echo '<a href="javascript:borrar(\'' . $id . '\',\'' . $tabla . '\',\'delete_audio\')" onclick="return boton_borrar();"><img class="buttons" src="img/admin/audio/sound_delete.png" alt="borrar" title="borrar"/></a>'; echo '<a href="javascript:convertAudio(\'' . $campo . '\',\'' . $id . '\',\'' . $tabla . '\')"><img class="buttons" src="img/admin/audio/audio_go.png" alt="Convertir" title="Convertir"/></a>'; echo '<a href="#move" class="mover"><img class="buttons" src="img/admin/move.png" alt="mover" title="mover"/></a>'; echo '</div>'; } // --------------------------------- si no existe video subido ------------------------------------------- // if (!file_exists($audio) && !file_exists($path)) { //echo 'No se encuentra el file. '; echo '<div class="player"><p><img src="_plugins/phpt/phpThumb.php?src=../../_uploads/no_disp.jpg&w=50&h=50&zc=1" border="0" alt="' . $titulo . '" title="' . $titulo . '" /></p></div>'; } } echo '</div>'; }
</script> </tr> </table> <input id="text" type="text"> <button id="button" type="button" onClick="design()">hello</button> <div id="some" > sdlfkjsldkjflksdfsdf </div> <?php include "actions/subject_functions.php"; ?> <?php $start = "04:00"; $end = "06:00"; echo get_duration($start, $end); ?> </div> <a class="btn" data-toggle="modal" href="#add_subject"><i class="icon-plus-sign-alt" > </i> Add Subject via Modal</a> <div class="modal fade hide" id="add_subject"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h3>Modal header</h3> </div> <div class="modal-body"> heyoulk
/** * Build the item list * * @param array $result_set Array of calls from database * @param object $current_user SugarCRM current_user object allows DB access * @param array $mod_strings SugarCRM module strings * @return array */ function build_getCalls_item_list($result_set, $current_user, $mod_strings) { global $sugar_config; $response = array(); $index = 0; $numCalls = $current_user->db->getRowCount($result_set); $maxCalls = $sugar_config['asterisk_max_popups']; while ($row = $current_user->db->fetchByAssoc($result_set)) { // If we have too many calls, we nuke the extra from beginning of result_set since they're the oldest. if ($numCalls > $maxCalls && $index++ < $numCalls - $maxCalls) { updateUIState("Closed", $row['call_record_id'], $row['asterisk_id']); //logLine("Too many active popups, closing {$row['asterisk_id']}"); } else { $state = get_call_state($row, $mod_strings); $phone_number = get_callerid($row); $call_direction = get_call_direction($row, $mod_strings); $contacts = array(); // Dont fetch contacts if it's already known this is already been related to another module. if (!empty($row['bean_module']) && !empty($row['bean_id'])) { $beans = make_bean_array_from_call_row($row); } else { // @@@@ BEGIN CALLINIZE COMMUNITY ONLY @@@@ $module_list = "accounts,contacts"; // @@@@ END CALLINIZE COMMUNITY ONLY @@@@ $beans = find_beans($phone_number, $module_list, false, $current_user); } // When only one matching number, save the result in call record. if (count($beans) == 1) { setBeanID($row['call_record_id'], $beans[0]['bean_module'], $beans[0]['bean_id']); } $call = array('id' => $row['id'], 'asterisk_id' => $row['asterisk_id'], 'state' => $state, 'is_hangup' => $state == $mod_strings['YAAI']['HANGUP'], 'call_record_id' => $row['call_record_id'], 'phone_number' => $phone_number, 'timestamp_call' => $row['timestamp_call'], 'title' => get_title($beans, $phone_number, $state, $mod_strings), 'beans' => $beans, 'call_type' => $call_direction['call_type'], 'direction' => $call_direction['direction'], 'duration' => get_duration($row), 'mod_strings' => $mod_strings['YAAI']); $response[] = $call; } } return $response; }