/**
  * {@inheritdoc}
  */
 public function listView($fields = array())
 {
     self::$logger->debug('>>listView(fields=[' . var_export($fields, true) . '])');
     $config = ConfigProvider::getInstance();
     $sessionProvider = $config->get('session.provider.name');
     $session = SessionProviderFactory::getInstance($sessionProvider);
     // work out how many columns will be in the table
     $reflection = new ReflectionClass(get_class($this->BO));
     $properties = array_keys($reflection->getDefaultProperties());
     $fields['colCount'] = 1 + count(array_diff($properties, $this->BO->getDefaultAttributes(), $this->BO->getTransientAttributes()));
     // get the class attributes
     $properties = $reflection->getProperties();
     $html = '';
     $html .= '<tr>';
     foreach ($properties as $propObj) {
         $propName = $propObj->name;
         // skip over password fields
         $property = $this->BO->getPropObject($propName);
         if (!($property instanceof String && $property->checkIsPassword())) {
             if (!in_array($propName, $this->BO->getDefaultAttributes()) && !in_array($propName, $this->BO->getTransientAttributes())) {
                 $html .= '  <th>' . $this->BO->getDataLabel($propName) . '</th>';
             }
             if ($propName == 'OID') {
                 $html .= '  <th>' . $this->BO->getDataLabel($propName) . '</th>';
             }
         } else {
             $fields['colCount'] = $fields['colCount'] - 1;
         }
     }
     $html .= '</tr><tr>';
     $fields['formHeadings'] = $html;
     $html = '';
     // and now the values
     foreach ($properties as $propObj) {
         $propName = $propObj->name;
         $property = $this->BO->getPropObject($propName);
         if (!($property instanceof String && $property->checkIsPassword())) {
             if (!in_array($propName, $this->BO->getDefaultAttributes()) && !in_array($propName, $this->BO->getTransientAttributes())) {
                 $propClass = get_class($this->BO->getPropObject($propName));
                 if ($propClass == 'Text') {
                     $text = htmlentities($this->BO->get($propName), ENT_COMPAT, 'utf-8');
                     if (mb_strlen($text) > 70) {
                         $html .= '  <td>&nbsp;' . mb_substr($text, 0, 70) . '...</td>';
                     } else {
                         $html .= '  <td>&nbsp;' . $text . '</td>';
                     }
                 } elseif ($propClass == 'DEnum') {
                     $html .= '  <td>&nbsp;' . $this->BO->getPropObject($propName)->getDisplayValue() . '</td>';
                 } else {
                     $html .= '  <td>&nbsp;' . $this->BO->get($propName) . '</td>';
                 }
             }
             if ($propName == 'OID') {
                 $html .= '  <td>&nbsp;' . $this->BO->getOID() . '</td>';
             }
         }
     }
     $html .= '</tr>';
     $fields['formFields'] = $html;
     $request = new Request(array('method' => 'GET'));
     // View button
     if (mb_strpos($request->getURI(), '/tk/') !== false) {
         if (isset($fields['viewButtonURL'])) {
             $button = new Button("document.location = '" . $fields['viewButtonURL'] . "';", 'View', 'view' . $this->BO->getOID() . 'But');
         } else {
             $button = new Button("document.location = '" . FrontController::generateSecureURL('act=Alpha\\Controller\\ActiveRecordController&ActiveRecordType=' . get_class($this->BO) . '&ActiveRecordOID=' . $this->BO->getOID()) . "';", 'View', 'view' . $this->BO->getOID() . 'But');
         }
         $fields['viewButton'] = $button->render();
     } else {
         if ($this->BO->hasAttribute('URL')) {
             $button = new Button("document.location = '" . $this->BO->get('URL') . "';", 'View', 'view' . $this->BO->getOID() . 'But');
         } else {
             $button = new Button("document.location = '" . $config->get('app.url') . '/record/' . urlencode(get_class($this->BO)) . '/' . $this->BO->getOID() . "';", 'View', 'view' . $this->BO->getOID() . 'But');
         }
         $fields['viewButton'] = $button->render();
     }
     $html = '';
     // render edit and delete buttons for admins only
     if ($session->get('currentUser') && $session->get('currentUser')->inGroup('Admin')) {
         $html .= '&nbsp;&nbsp;';
         if (isset($fields['editButtonURL'])) {
             $button = new Button("document.location = '" . $fields['editButtonURL'] . "'", 'Edit', 'edit' . $this->BO->getOID() . 'But');
         } else {
             $button = new Button("document.location = '" . FrontController::generateSecureURL('act=Alpha\\Controller\\ActiveRecordController&ActiveRecordType=' . get_class($this->BO) . '&ActiveRecordOID=' . $this->BO->getOID() . '&view=edit') . "'", 'Edit', 'edit' . $this->BO->getOID() . 'But');
         }
         $html .= $button->render();
         $html .= '&nbsp;&nbsp;';
         $js = "if(window.jQuery) {\n                    BootstrapDialog.show({\n                        title: 'Confirmation',\n                        message: 'Are you sure you wish to delete this item?',\n                        buttons: [\n                            {\n                                icon: 'glyphicon glyphicon-remove',\n                                label: 'Cancel',\n                                cssClass: 'btn btn-default btn-xs',\n                                action: function(dialogItself){\n                                    dialogItself.close();\n                                }\n                            },\n                            {\n                                icon: 'glyphicon glyphicon-ok',\n                                label: 'Okay',\n                                cssClass: 'btn btn-default btn-xs',\n                                action: function(dialogItself) {\n                                    \$('[id=\"" . ($config->get('security.encrypt.http.fieldnames') ? base64_encode(SecurityUtils::encrypt('ActiveRecordOID')) : 'ActiveRecordOID') . "\"]').attr('value', '" . $this->BO->getOID() . "');\n                                    \$('#deleteForm').submit();\n                                    dialogItself.close();\n                                }\n                            }\n                        ]\n                    });\n                }";
         $button = new Button($js, 'Delete', 'delete' . $this->BO->getOID() . 'But');
         $html .= $button->render();
     }
     $fields['adminButtons'] = $html;
     // buffer security fields to $formSecurityFields variable
     $fields['formSecurityFields'] = self::renderSecurityFields();
     self::$logger->debug('<<listView [HTML]');
     return View::loadTemplate($this->BO, 'list', $fields);
 }