예제 #1
0
 public function index($option)
 {
     $rows = $this->getRows();
     $events = array();
     foreach ($rows as $id) {
         $row = new EventLog();
         $row->load($id);
         $events[$id] = new stdClass();
         $events[$id]->id = $row->id;
         $events[$id]->datetime = $row->datetime;
         $events[$id]->short = $row->short;
         $events[$id]->tags = implode(', ', explode(',', $row->tags));
         $events[$id]->event = $row->event;
         $events[$id]->level = $row->level;
         $events[$id]->notify = $row->notify;
         $params = array();
         if (!empty($row->params) && is_array($row->params)) {
             foreach ($row->params as $key => $value) {
                 switch ($key) {
                     case 'userid':
                         $content = '<a href="index.php?option=com_acctexp&amp;task=edit&amp;entity=Membership&userid=' . $value . '">' . $value . '</a>';
                         break;
                     case 'invoice_number':
                         $content = '<a class="quicksearch" href="#">' . $value . '</a>';
                         break;
                     default:
                         $content = $value;
                         break;
                 }
                 $params[] = $key . '(' . $content . ')';
             }
         }
         $events[$id]->params = implode(', ', $params);
         if (strpos($row->event, '<?xml') !== false) {
             $events[$id]->event = '<p><strong>XML cell - decoded as:</strong></p><pre class="prettyprint">' . htmlentities($row->event) . '</pre>';
         } else {
             $format = @json_decode($row->event);
             if (is_array($format) || is_object($format)) {
                 $events[$id]->event = '<p><strong>JSON cell - decoded as:</strong></p><pre class="prettyprint">' . print_r($format, true) . '</pre>';
             } else {
                 $events[$id]->event = htmlentities(stripslashes($events[$id]->event));
             }
         }
     }
     HTML_AcctExp::eventlog($events, $this->getPagination(), $this->getState());
 }