Example #1
0
 /**
  * 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);
 }
Example #2
0
 /**
  * Is serchable ?
  * 
  * @return bool
  */
 public function isSearchable()
 {
     return $this->field->isSearchable();
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function getSchema()
 {
     $colsNumber = 0;
     foreach ($this->source as $row) {
         $count = count($row);
         if ($count > $colsNumber) {
             $colsNumber = $count;
         }
     }
     $schema = new Schema();
     if ($colsNumber === 0) {
         return $schema;
     }
     $colSize = (int) round(100 / $colsNumber);
     for ($i = 0; $i < $colsNumber; ++$i) {
         $field = new Field($i);
         $field->setWidth($colSize);
         $schema->addField($field);
     }
     return $schema;
 }
 /**
  * Resolve type of field
  * 
  * @param  Field $field
  */
 protected function resolveType(Field $field)
 {
     if ($field->getType() !== null) {
         return;
     }
     $type = $this->getMetadata()->getTypeOfField($field->getName());
     $field->setType($type);
 }