Exemplo n.º 1
0
 /**
  * Renders the value using the specified settings
  *
  * @param string The cell value
  */
 public function renderValue($value)
 {
     $image = $this->uriDir . $value;
     if ($this->checkImageLoc == true) {
         $path = $this->fsDir . $value;
         if (!file_exists($path)) {
             $image = $this->notFoundImage;
         }
     }
     return Gecko_HTML::drawImg($image, $value);
 }
Exemplo n.º 2
0
 /**
  * Called when row ends
  */
 public function endRow()
 {
     if ($this->rowNum === 'header') {
         $span = 0;
         if ($this->_settings['viewLink'] == true) {
             $span++;
         }
         if ($this->_settings['editLink'] == true) {
             $span++;
         }
         if ($this->_settings['deleteLink'] == true) {
             $span++;
         }
         if ($span > 0) {
             $this->table->addHeader($this->_settings['header'], array("colspan" => $span));
         }
     } else {
         if (!$this->isValidRow()) {
             return;
         }
         $data = $this->grid->getDataSource()->getRowAt($this->rowNum);
         $key = $data[$this->_idColumn];
         if (!$key) {
             throw new Gecko_DataGrid_Exception("{$this->_idColumn} not found in data source");
         }
         if ($this->_settings['viewLink'] == true) {
             $viewLabel = $this->_settings['viewLabel'];
             $view = Gecko_HTML::LinkTag(Gecko_HTML::drawImg($this->_settings['viewImage'], $viewLabel) . ' ' . $viewLabel, $this->_createRoute('view', $key));
             $this->table->addCell($view);
         }
         if ($this->_settings['editLink'] == true) {
             $editLabel = $this->_settings['editLabel'];
             $edit = Gecko_HTML::LinkTag(Gecko_HTML::drawImg($this->_settings['editImage'], $editLabel) . ' ' . $editLabel, $this->_createRoute('edit', $key));
             $this->table->addCell($edit);
         }
         if ($this->_settings['deleteLink'] == true) {
             $deleteLabel = $this->_settings['deleteLabel'];
             $delete = Gecko_HTML::LinkTag(Gecko_HTML::drawImg($this->_settings['deleteImage'], $deleteLabel) . ' ' . $deleteLabel, $this->_createRoute('delete', $key), '_self', array('class' => 'deleteLink'));
             $this->table->addCell($delete);
         }
     }
 }