/**
  * Get data from model based on filter
  *
  */
 protected function buildData()
 {
     $filters = $this->filter_names;
     // Always display latest version of certificates aka "active" if the table was initialized with this option
     // Otherwise, check if the checkbox of the filter was checked
     if ($this->getOption('newest_version_only')) {
         $filters['active'] = 1;
     }
     if ($this->getOption('definition_id')) {
         $filters['definition_id'] = $this->getOption('definition_id');
     }
     if ($this->getOption('user_id')) {
         $filters['user_id'] = $this->getOption('user_id');
     }
     $this->setExternalSorting(true);
     $this->setExternalSegmentation(true);
     $this->setDefaultOrderField($this->columns[0]);
     $this->determineLimit();
     $this->determineOffsetAndOrder();
     $options = array('filters' => $filters, 'count' => true, 'limit' => array($this->getOffset(), $this->getLimit()), 'sort' => array($this->getOrderField() => $this->getOrderDirection()));
     $count = srCertificate::getCertificateData($options);
     $data = srCertificate::getCertificateData(array_merge($options, array('count' => false)));
     foreach ($data as $cert) {
         if ($cert["status"] == srCertificate::STATUS_PROCESSED) {
             $this->has_any_certs = true;
         }
     }
     $this->setMaxCount($count);
     $this->setData($data);
 }