Beispiel #1
0
 private static function _message($id, $data, $fields, $table)
 {
     $sgsml = new sgsml($data["folder"], "display", array($id), false);
     $message = $sgsml->att["MODULENAME"] . "\n";
     $message .= str_repeat("-", strlen($message) - 1) . "\n\n";
     foreach ($data as $key => $value) {
         if (strlen($value) == 0 or !in_array($key, $fields)) {
             continue;
         }
         $value = trim(asset::build_history($sgsml->fields[$key]["SIMPLE_TYPE"], $value, ""));
         if ($value != "") {
             $message .= $sgsml->fields[$key]["DISPLAYNAME"] . ": " . $value . "\n";
         }
     }
     $url = "http" . (sys_https() ? "s" : "") . "://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER["SCRIPT_NAME"]) . "/index.php?view=details&find=" . $table . "|" . $id;
     return $message . "\n{t}Details{/t}: " . $url;
 }
Beispiel #2
0
 function build_history($new_data, $old_data)
 {
     $cdata = "";
     $cfields = array();
     $no_history = array("created", "createdby", "lastmodified", "lastmodifiedby", "history", "notification_summary", "dsize", "id");
     foreach ($new_data as $data_key => $data_value) {
         $field = $this->fields[$data_key];
         if (isset($old_data[$data_key]) and strcmp(trim($old_data[$data_key], "|"), trim($data_value, "|")) == 0) {
             unset($new_data[$data_key]);
             continue;
         }
         if (in_array($data_key, $no_history)) {
             continue;
         }
         if (isset($field["SIMPLE_TYPE"]) and (strlen($data_value) > 0 or !empty($old_data[$data_key]))) {
             $data_value = asset::build_history($field["SIMPLE_TYPE"], $data_value, @$old_data[$data_key]);
         }
         if (!empty($field["NO_SEARCH_INDEX"])) {
             $data_value = "";
         }
         if (!empty($field["DISPLAYNAME"])) {
             $key = $field["DISPLAYNAME"];
         } else {
             $key = $data_key;
         }
         if (trim($data_value) != "") {
             $cdata .= $key . ": " . $data_value . "\n";
         }
         $cfields[] = $key;
     }
     $new_data["history"] = str_replace("@fields@", implode(", ", $cfields), $new_data["history"]) . $cdata . "\n";
     return $new_data;
 }