Example #1
0
 /**
  * @param mixed $index
  * @return string
  */
 public function getValue($index)
 {
     $value = parent::getValue($index);
     $total = $this->table->getFooterValue($this->name);
     $this->table->setFooterValue($this->name, $total + $value);
     return $value;
 }
Example #2
0
 public function getValue($index)
 {
     $value = parent::getValue($index);
     if (empty($value)) {
         return null;
     }
     try {
         $date = new \DateTime($value);
         return $date->format($this->format);
     } catch (\Exception $e) {
         return $e->getMessage();
     }
 }
Example #3
0
 public function getValue($index)
 {
     $value = parent::getValue($index);
     // check and see if value is one of these:
     // 1, true, yes
     $labelHtml = '<span class="label %s">%s</span>';
     $labelCss = 'label-default';
     if (in_array(strtolower((string) $value), $this->trueValues, true)) {
         $value = $this->trueLabel;
         $labelCss = 'label-success';
     }
     if (in_array(strtolower((string) $value), $this->falseValues, true)) {
         $value = $this->falseLabel;
         $labelCss = 'label-danger';
     }
     return sprintf($labelHtml, $labelCss, $value);
 }
Example #4
0
    /**
     * @param mixed $index
     * @return string
     */
    public function getValue($index)
    {
        $value = parent::getValue($index);
        if (!$this->enableEditing) {
            return $value;
        }
        //assume server response: 200 Ok {status: 'error', msg: 'field cannot be empty!'}
        $this->javascript = <<<__JS__
<script type="text/javascript">
    jQuery(function(){jQuery({$this->editableId}).editable({
            success: function(response, newValue){
                if(response.status == 'error') return response.msg;
            }
        });
    });
</script>
__JS__;
        if (strlen($value) > 50) {
            $this->fieldType = 'textarea';
        }
        return sprintf('<a href="#" class="editable" data-type="%s" data-pk=\'%s\' data-url="%s" data-title="%s" %s>%s</a>', $this->fieldType, $this->getPrimaryKeyValue(), $this->editUrl, $this->prompt, $this->getFieldOptions(), $value);
    }
Example #5
0
 /**
  * Returns cell prototype (<td> html tag).
  * @param mixed $row
  * @return \Nette\Utils\Html
  */
 public function getCellPrototype($row = NULL)
 {
     $td = parent::getCellPrototype($row);
     if ($this->isEditable() && $row !== NULL) {
         $td->data['grido-editable-value'] = $this->editableValueCallback === NULL ? parent::getValue($row) : callback($this->editableValueCallback)->invokeArgs(array($row, $this));
     }
     return $td;
 }
Example #6
0
 public function getValue()
 {
     return (bool) parent::getValue();
 }
Example #7
0
 public function getValue()
 {
     return $this->toCarbon(parent::getValue())->format($this->getFormat(config('administr.listview.date_format')));
 }
Example #8
0
 /**
  * Render a checkbox while checking if the checkbox should be checked by default
  *
  * @param type $index
  * @return string
  */
 public function getValue($index)
 {
     $value = parent::getValue($index);
     $checked = $this->isChecked($this->data) ? 'checked="checked"' : null;
     return sprintf('<label><input type="checkbox" name="%s[]" class="grid-view-checkbox" value="%s" %s> %s</label>', $this->name, $value, $checked, $value);
 }