X-Git-Url: http://git.roojs.org/?p=Pman.Admin;a=blobdiff_plain;f=EventView.php;h=bf0d1a4305043147216ab614df11b490634d89c0;hp=87a0ace90edd720c94c7027d884756650545d829;hb=HEAD;hpb=56cc0d52ce6905a5a1635294d4c48514a7cb73a6 diff --git a/EventView.php b/EventView.php index 87a0ace..bf0d1a4 100644 --- a/EventView.php +++ b/EventView.php @@ -14,19 +14,18 @@ class Pman_Admin_EventView extends Pman $this->jerrAuth(); } return true; - - + } - function get($id) - { + function get($id, $opts = Array()) + { $ev = DB_DataObject::Factory('Events'); if (!$ev->get((int)$id)) { $this->jerr("invalid id"); } // verify if not admin, then they should - $g = DB_DataObject::Factory('group_members'); + $g = DB_DataObject::Factory('core_group_member'); if (is_a($g, 'DB_DataObject')) { $grps = $g->listGroupMembership($this->authUser); //var_dump($grps); @@ -36,59 +35,69 @@ class Pman_Admin_EventView extends Pman $this->jerrAuth(); } } + + + echo '
'.htmlspecialchars(print_r($ev->toArray(),true))."
"; // we have 2 bits of data available at present: // core_event_audit // the event file.. $d= DB_DataObject::factory('core_event_audit'); - if (is_a($d,'DB_DataObject')) { + $d->event_id = $ev->id; // we can set that as the above returns error or dataobject.. + if (is_a($d,'DB_DataObject') && $d->count()) { echo "

Changed Data:

"; - $d->event_id = $ev->id; + foreach($d->fetchAll() as $d) { echo "{$d->name} SET TO: " . htmlspecialchars($d->newvalue) . "
\n"; } } echo "

Posted Data:

"; - + $logdir = DB_DAtaObject::Factory('Events')->logDir(); - $ff = HTML_FlexyFramework::get(); - if (empty($ff->Pman['event_log_dir'])) { - echo "not available (not configured)"; + if (!$logdir) { + echo "not available (Pman[storedir] not configured)"; exit; } - if (function_exists('posix_getpwuid')) { - $uinfo = posix_getpwuid( posix_getuid () ); - - $user = $uinfo['name']; - } else { - $user = getenv('USERNAME'); // windows. - } - $file = $ff->Pman['event_log_dir']. "/{$user}" . date('/Y/m/d/',strtotime($ev->event_when)). $ev->id . ".php"; + $file = $logdir. date('/Y/m/d/',strtotime($ev->event_when)). $ev->id . ".php"; if (file_exists($file)) { echo '
' . htmlspecialchars(file_get_contents($file)). '
'; } - - - $file = $ff->Pman['event_log_dir']. "/{$user}" . date('/Y/m/d/',strtotime($ev->event_when)). $ev->id . ".json"; + + $file = $logdir. date('/Y/m/d/',strtotime($ev->event_when)). $ev->id . ".json"; if (!file_exists($file)) { echo "not available (missing file) $file"; exit; } + echo '
' . htmlspecialchars(print_r(json_decode(file_get_contents($file)), true)) . '
'; - echo '
'. htmlspecialchars($ev->remarks) . '
'; + if (!empty($ev->remarks)) { + echo "

Remarks:

"; + echo '
'. htmlspecialchars($ev->remarks) . '
'; + } - $filesJ = json_decode(file_get_contents($file)); - echo '
Images Preview
'; + $json = json_decode($ev->remarks, JSON_PRETTY_PRINT); - foreach($filesJ->FILES as $k=>$f){ - $ip = $ff->baseURL."/Images/events/". $ev->id . '/'. $f->tmp_name; - echo '' . htmlspecialchars( $k . ' ' . $f->name ) . '
'; + if(json_last_error() == JSON_ERROR_NONE){ + echo "

JSON DECODE Data:

"; + echo '
' . print_r($json, true) . '
'; + } + $filesJ = json_decode(file_get_contents($file)); + if (!empty($filesJ->FILES )) { + echo "

Download files:

"; + } - exit;