/** * function to get data history display text * @param object $obj * @param boolean $link * @param boolean $user_history * @return array $ret_array */ public function get_data_history_display_text($obj, $link = false, $user_history = false) { $row1 = '<strong>' . $obj->firstname . ' ' . $obj->lastname . '</strong> ' . _('on ') . '<i>' . i18nDate::i18n_long_time(TimeZoneUtil::convert_to_user_timezone($obj->date_modified, true)) . '</i>'; switch ($obj->action) { case 'add': if ($user_history === true) { $row2 = _('Added') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule); } else { $row2 = _('Added the record'); } break; case 'delete': if ($user_history === true) { $row2 = _('Deleted') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule); } else { $row2 = _('Deleted the record'); } break; case 'edit': if ($user_history === true) { $row2 = _('Updated') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule); } else { $row2 = _('Updated the record'); } break; case 'value_changes': $do_crm_fields = new CRMFields(); $do_crm_fields->getId($obj->idfields); if ($do_crm_fields->getNumRows() > 0) { $field_label = $do_crm_fields->field_label; $old_value = $obj->old_value; $new_value = $obj->new_value; if ($do_crm_fields->field_type == 9) { $old_value = FieldType9::display_value($old_value); $new_value = FieldType9::display_value($new_value); } if ($user_history === true) { $row2 = _('Changed value in') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule) . ' , ' . $field_label . ' :: ' . $old_value . ' >>> ' . $new_value; } else { $row2 = _('Changed') . ' ' . $field_label . ' :: ' . $old_value . ' >>> ' . $new_value; } } $do_crm_fields->free(); break; } if ($obj->user_avatar != '') { $avatar_path = $GLOBALS['AVATAR_DISPLAY_PATH']; $thumb = $avatar_path . '/ths_' . $obj->user_avatar . '.' . $obj->file_extension; } if ($link === true) { $detail_url = NavigationControl::getNavigationLink($_SESSION["do_module"]->modules_full_details[$obj->idmodule]["name"], "detail", $obj->id_referrer); $row2 .= ' <a href="' . $GLOBALS['SITE_URL'] . $detail_url . '">' . $GLOBALS['SITE_URL'] . $detail_url . '</a>'; } $ret_array = array("avatar" => $thumb, "row1" => $row1, "row2" => $row2); return $ret_array; }