Example #1
0
 public function getFormattedValue(AbstractColumn $column)
 {
     $row = $this->getRowData();
     $rowValue = $row[$column->getUniqueId()];
     if ($rowValue != '') {
         //estract
         $value = explode(self::paramsSeparator, $rowValue);
     }
     if ($this->getAttribute('href') !== null) {
         $href = $this->getAttribute('href');
     } else {
         $href = $value;
     }
     if ($this->getAttribute('path') !== null) {
         $path = $this->getAttribute('path') . "/";
     } else {
         $path = '?op=f&file=';
     }
     if ($this->getAttribute('title') !== null) {
         $title = "title={$this->getAttribute('title')}";
     } else {
         $title = '';
     }
     if ($this->getAttribute('target') !== null) {
         $target = "target={$this->getAttribute('target')}";
     } else {
         $target = '';
     }
     $linkFile = "<a href=\"{$path}{$rowValue}\"  {$title}  {$target} > {$value[1]} </a>";
     return $linkFile;
 }
Example #2
0
 public function getFormattedValue(AbstractColumn $column)
 {
     $row = $this->getRowData();
     $value = $row[$column->getUniqueId()];
     $prefix = $this->getPrefix();
     if (is_array($value)) {
         $thumb = $value[0];
         if (isset($value[1])) {
             $original = $value[1];
         } else {
             $original = $thumb;
         }
     } else {
         $thumb = $value;
         $original = $value;
     }
     $linkAttributes = array();
     foreach ($this->getLinkAttributes() as $key => $value) {
         $linkAttributes[] = $key . '="' . $value . '"';
     }
     $attributes = array();
     foreach ($this->getAttributes() as $key => $value) {
         $attributes[] = $key . '="' . $value . '"';
     }
     return '<a href="' . $prefix . $original . '" ' . implode(' ', $linkAttributes) . '><img src="' . $prefix . $thumb . '" ' . implode(' ', $attributes) . ' /></a>';
 }
 /**
  * The value should be in bytes
  *
  * @see \Zf2datatable\Column\Formatter\AbstractFormatter::getFormattedValue()
  */
 public function getFormattedValue(AbstractColumn $column)
 {
     $row = $this->getRowData();
     $value = $row[$column->getUniqueId()];
     if ($value == '') {
         return $value;
     }
     $index = 0;
     while ($value >= 1024 && $index < count(self::$prefixes)) {
         $value = $value / 1024;
         $index++;
     }
     return sprintf('%1.2f %sB', $value, self::$prefixes[$index]);
 }
 public function setUp()
 {
     $this->colId = $this->getMockForAbstractClass('Zf2datatable\\Column\\AbstractColumn');
     $this->colId->setUniqueId('id');
     $this->colId->setIdentity(true);
     $this->col1 = $this->getMockForAbstractClass('Zf2datatable\\Column\\AbstractColumn');
     $this->col1->setUniqueId('col1');
     $this->col2 = $this->getMockForAbstractClass('Zf2datatable\\Column\\AbstractColumn');
     $this->col2->setUniqueId('col2');
     $this->col3 = $this->getMockForAbstractClass('Zf2datatable\\Column\\AbstractColumn');
     $this->col3->setUniqueId('col3');
     $this->col3->setType(new Type\PhpArray());
     $data = array();
     $data[] = array('id' => '1', 'col1' => 'test', 'col2' => 'n', 'col3' => array('tag1', 'tag2'));
     $data[] = array('id' => '2', 'col1' => 'test', 'col3' => array('tag3', 'tag1'));
     $data[] = array('id' => '3', 'col1' => 'test', 'col2' => 'y', 'col3' => array('tag2', 'tag5'));
     $this->data = $data;
 }
Example #5
0
 public function getFormattedValue(AbstractColumn $column)
 {
     $row = $this->getRowData();
     $value = $row[$column->getUniqueId()];
     //\Zend\Debug\Debug::dump($row);
     if ($this->getAttribute('href') !== null) {
         $href = $this->getAttribute('href');
     } else {
         $href = $value;
     }
     foreach ($this->getParamFromGet() as $key => $val) {
         if (array_key_exists($key, $row)) {
             if ($val['overwriteKey'] != '') {
                 $param = $val['overwriteKey'];
             } else {
                 $param = $key;
             }
             if (preg_match('/\\?/', $href)) {
                 $href .= "&{$param}={$row[$key]}";
             } else {
                 $href .= "?{$param}={$row[$key]}";
             }
         } else {
             if (preg_match('/\\?/', $href)) {
                 $href .= "&{$param}={$val}";
             } else {
                 $href .= "?{$param}={$val}";
             }
         }
     }
     if ($this->getAttribute('title') !== null) {
         $title = "title={$this->getAttribute('title')}";
     } else {
         $title = '';
     }
     if ($this->getAttribute('target') !== null) {
         $target = "target={$this->getAttribute('target')}";
     } else {
         $target = '';
     }
     return '<a href="' . $href . '"  ' . $title . '  ' . $target . ' >' . $value . '</a>';
 }
Example #6
0
 /**
  * Apply a filter based on a column
  *
  * @param Column\AbstractColumn $column
  * @param string  $inputFilterValue
  */
 public function setFromColumn(Column\AbstractColumn $column, $inputFilterValue)
 {
     $this->column = $column;
     $this->setColumnOperator($inputFilterValue, $column->getFilterDefaultOperation());
 }
 /**
  * Get the column row value placeholder
  * $action->setLink('/myLink/something/id/'.$action->getRowIdPlaceholder().'/something/'.$action->getColumnRowPlaceholder($myCol));
  *
  * @param  AbstractColumn $col
  * @return string
  */
 public function getColumnValuePlaceholder(AbstractColumn $col)
 {
     $this->linkColumnPlaceholders[] = $col;
     return ':' . $col->getUniqueId() . ':';
 }
Example #8
0
 public function getFormattedValue(AbstractColumn $column)
 {
     $row = $this->getRowData();
     return '<a href="mailto:' . $row[$column->getUniqueId()] . '">' . $row[$column->getUniqueId()] . '</a>';
 }
 public function setUp()
 {
     $this->column = $this->getMockForAbstractClass('Zf2datatable\\Column\\AbstractColumn');
     $this->column->setUniqueId('colName');
 }
Example #10
0
 public function getFormattedValue(AbstractColumn $column)
 {
     $row = $this->getRowData();
     return call_user_func_array($this->getCallBack(), array($row, $column->getUniqueId()));
     //return '<a href="mailto:' . $row[$column->getUniqueId()] . '">' . $row[$column->getUniqueId()] . '</a>';
 }