コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function getData(RequestInterface $request)
 {
     $data = new \SplDoublyLinkedList();
     $source = array_slice($this->source, $request->getLimit() * ($request->getPage() - 1), $request->getLimit());
     foreach ($source as $rowData) {
         $row = new Row();
         foreach ($rowData as $cellData) {
             $row->appendCell(new Cell($cellData));
         }
         $data[] = $row;
     }
     return $data;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function process($source)
 {
     $fields = $this->getFields();
     $row = new Row();
     foreach ($this->schemaProvider->getSchema()->getMetadataProperties() as $name) {
         $metaValue = $this->accessor->getValue($source, $name);
         $row->setMetadataProperty($name, $metaValue);
     }
     foreach ($fields as $property => $field) {
         $value = $this->accessor->getValue($source, $property);
         $row->appendCell(new Cell($value, $field));
     }
     return $row;
 }
コード例 #3
0
ファイル: Cell.php プロジェクト: mikemirten/zgrid
 /**
  * Get url if the cell is a link
  * 
  * @return string
  */
 public function getLink()
 {
     $link = $this->field->getCellLink();
     if ($link === null) {
         return;
     }
     return preg_replace_callback('~\\{([^}]+)\\}~', function ($matches) {
         if ($this->row === null) {
             throw new \LogicException('Cell doesn\'t belongs to a row');
         }
         return $this->row->getMetadataProperty($matches[1]);
     }, $link);
 }