status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") { $history_list[] = Array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $timedate->to_display_date($task->date_modified, true), ); } else { if ($task->date_due == '0000-00-00') $date_due = ''; else { $date_due = $task->date_due; } $open_activity_list[] = Array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due ); } } foreach ($focus_meetings_list as $meeting) { if ($meeting->status != "Planned") { $history_list[] = Array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_modified ); } else { $open_activity_list[] = Array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start ); } } foreach ($focus_calls_list as $call) { if ($call->status != "Planned") { $history_list[] = Array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_modified ); } else { $open_activity_list[] = Array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start ); } } foreach ($focus_emails_list as $email) { $history_list[] = Array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start." ".$email->time_start ); } foreach ($focus_notes_list as $note) { $history_list[] = Array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified ); if (!empty($note->filename)) { $count = count($history_list); $count--; $history_list[$count]['filename'] = $note->filename; $history_list[$count]['fileurl'] = UploadFile::get_upload_url($note); } } if ($currentModule == 'Contacts') { $xtpl=new XTemplate ('modules/Activities/SubPanelViewContacts.html'); $xtpl->assign("CONTACT_ID", $focus->id); } else { $xtpl=new XTemplate ('modules/Activities/SubPanelView.html'); } $xtpl->assign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline','align="absmiddle" border="0"', null,null,'.gif',$app_strings['LNK_DELETE'])); $xtpl->assign("EDIT_INLINE_PNG", SugarThemeRegistry::current()->getImage('edit_inline','align="absmiddle" border="0"', null,null,'.gif',$app_strings['LNK_EDIT'])); $xtpl->assign("MOD", $current_module_strings); $xtpl->assign("APP", $app_strings); $button = "
\n"; $button .= "\n"; $button .= "\n"; if ($currentModule == 'Accounts') { $button .= "\n\n\n"; } elseif ($currentModule == 'Opportunities') { $button .= "\n\n\n"; } elseif ($currentModule == 'Cases') { $button .= "\n\n\n"; } elseif ($currentModule == 'Contacts') { $button .= "\n\n"; $button .= "\n\n\n"; $button .= "\n"; } else { $button .= "\n\n\n"; } $button .= "\n"; $button .= "\n"; $button .= "\n"; $button .= "\n"; $button .= "\n"; if($currentModule != 'Project' && $currentModule != 'ProjectTask') { $button .= "\n"; } $button .= "\n"; $button .= "\n"; $button .= "\n"; $button .= "
\n"; // Stick the form header out there. echo get_form_header($current_module_strings['LBL_OPEN_ACTIVITIES'], $button, false); $xtpl->assign("RETURN_URL", "&return_module=$currentModule&return_action=DetailView&return_id=$focus->id"); $oddRow = true; if (count($open_activity_list) > 0) $open_activity_list = array_csort($open_activity_list, 'date_due', SORT_DESC); foreach($open_activity_list as $activity) { $activity_fields = array( 'ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_due'] ); if (empty($activity['direction'])) { $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']]; } else { $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']].' '.$app_list_strings['activity_dom'][$activity['type']]; } if (isset($activity['parent_type'])) $activity_fields['PARENT_MODULE'] = $activity['parent_type']; switch ($activity['type']) { case 'Call': $activity_fields['SET_COMPLETE'] = "".SugarThemeRegistry::current()->getImage("close_inline","title=".translate('LBL_LIST_CLOSE','Activities')." border='0'",null,null,'.gif',$mod_strings['LBL_LIST_CLOSE']).""; $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']]; break; case 'Meeting': $activity_fields['SET_COMPLETE'] = "".SugarThemeRegistry::current()->getImage("close_inline","title=".translate('LBL_LIST_CLOSE','Activities')." border='0'", null,null,'.gif',$mod_strings['LBL_LIST_CLOSE']).""; $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']]; break; case 'Task': $activity_fields['SET_COMPLETE'] = "".SugarThemeRegistry::current()->getImage("close_inline","title=".translate('LBL_LIST_CLOSE','Activities')." border='0'", null,null,'.gif',$mod_strings['LBL_LIST_CLOSE']).""; $activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']]; break; } global $odd_bg; global $even_bg; global $hilite_bg; global $click_bg; $xtpl->assign("BG_HILITE", $hilite_bg); $xtpl->assign("BG_CLICK", $click_bg); $xtpl->assign("ACTIVITY_MODULE_PNG", SugarThemeRegistry::current()->getImage($activity_fields['MODULE'].'','border="0"', null,null,'.gif',$activity_fields['NAME'])); $xtpl->assign("ACTIVITY", $activity_fields); if($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); $xtpl->assign("BG_COLOR", $odd_bg); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); $xtpl->assign("BG_COLOR", $even_bg); } $oddRow = !$oddRow; $xtpl->parse("open_activity.row"); // Put the rows in. } $xtpl->parse("open_activity"); $xtpl->out("open_activity"); echo "
"; //requestdata $popup_request_data = array( 'call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array(), ); $json = getJSONobj(); $encoded_popup_request_data = $json->encode($popup_request_data); $button = "
\n"; $button .= "\n"; $button .= "\n"; if ($currentModule == 'Accounts') $button .= "\n\n\n"; if ($currentModule == 'Opportunities') $button .= "\n\n\n"; elseif ($currentModule == 'Cases') $button .= "\n\n\n"; elseif ($currentModule == 'Contacts') { $button .= "\n\n"; $button .= "\n"; $button .= "\n\n\n"; }else{ $button .= "\n\n\n"; } $button .= "\n"; $button .= "\n"; $button .= "\n"; $button .= "\n"; $button .= "\n"; $button .= "\n"; $button .= "\n"; $button .= "
\n"; // Stick the form header out there. echo get_form_header($current_module_strings['LBL_HISTORY'], $button, false); $xtpl->assign("RETURN_URL", "&return_module=$currentModule&return_action=DetailView&return_id=$focus->id"); $oddRow = true; if (count($history_list) > 0) $history_list = array_csort($history_list, 'date_modified', SORT_DESC); foreach($history_list as $activity) { $activity_fields = array( 'ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], ); if (empty($activity['direction'])) { $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']]; } else { $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']].' '.$app_list_strings['activity_dom'][$activity['type']]; } switch ($activity['type']) { case 'Call': $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']]; break; case 'Meeting': $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']]; break; case 'Task': $activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']]; break; } if (isset($activity['location'])) $activity_fields['LOCATION'] = $activity['location']; if (isset($activity['filename'])) { $activity_fields['ATTACHMENT'] = "".SugarThemeRegistry::current()->getImage("attachment","border='0' align='absmiddle'",null,null,'.gif',$activity['filename']).""; } if (isset($activity['parent_type'])) $activity_fields['PARENT_MODULE'] = $activity['parent_type']; $xtpl->assign("ACTIVITY", $activity_fields); $xtpl->assign("ACTIVITY_MODULE_PNG", SugarThemeRegistry::current()->getImage($activity_fields['MODULE'].'','border="0"', null,null,'.gif',$activity_fields['NAME'])); if($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); $xtpl->assign("BG_COLOR", $odd_bg); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); $xtpl->assign("BG_COLOR", $even_bg); } $oddRow = !$oddRow; $xtpl->parse("history.row"); // Put the rows in. } $xtpl->parse("history"); $xtpl->out("history"); ?>