示例#1
0
 /**
  * Render
  * 
  * Renders a cell and populates
  * it's rendered value
  * 
  * @access	public
  * @param	Spark\Grid_Column_Cell	Cell
  * @return	Spark\Grid_Column_Renderer_Options
  */
 public function render(\Grid_Column_Cell $cell)
 {
     // Get options
     $options = $cell->get_column()->get_options();
     // Value fallback
     $value = '';
     // Override the value with an option
     if (isset($options[$cell->get_original_value()])) {
         $value = $options[$cell->get_original_value()];
     }
     $cell->set_rendered_value($value);
     return $this;
 }
示例#2
0
 /**
  * Render
  * 
  * Renders a cell and populates
  * it's rendered value
  * 
  * @access	public
  * @param	Spark\Grid_Column_Cell	Cell
  * @return	Spark\Grid_Column_Renderer_Checkbox
  */
 public function render(\Grid_Column_Cell $cell)
 {
     // Get the value
     $value = $cell->get_original_value();
     // An array of checked items
     $checked = ($checked = $cell->get_column()->get_checked() and $checked->count()) ? $checked->get_data() : array();
     $cell->set_rendered_value(\Form::checkbox($this->get_checkbox_name($cell), $value, array(in_array($value, $checked) ? 'checked' : null)));
     return $this;
 }
示例#3
0
 /**
  * Render
  * 
  * Renders a cell and populates
  * it's rendered value
  * 
  * @access	public
  * @param	Spark\Grid_Column_Cell	Cell
  * @return	Spark\Grid_Column_Renderer_Options
  */
 public function render(\Grid_Column_Cell $cell)
 {
     // Get current row from database
     $results = $cell->get_driver()->get_results()->as_array();
     $current = $results[$this->counter++];
     // Get options
     $options = $cell->get_column()->get_options();
     // Value fallback
     $value = '';
     // Override the value with an option
     if (isset($options[$cell->get_original_value()])) {
         $value = $options[$cell->get_original_value()];
         // Create date tooltip
         if ($cell->get_original_value() == 2) {
             $value .= '<a href="#" class="activeDate" id="activeDate02" title="' . date('m/d/Y', $current->active_from) . ' - ' . date('m/d/Y', $current->active_to) . '">' . \Theme::instance()->asset->img('icon-calendar.png', array('width' => 16, 'height' => 16, 'alt' => '')) . '</a>';
         }
     }
     $cell->set_rendered_value($value);
     return $this;
 }
示例#4
0
 /**
  * Render
  * 
  * Renders a cell and populates
  * it's rendered value
  * 
  * @access	public
  * @param	Spark\Grid_Column_Cell	Cell
  * @return	Spark\Grid_Column_Renderer_Action
  */
 public function render(\Grid_Column_Cell $cell)
 {
     // Get value
     $value = $cell->get_original_value();
     if ($actions = $cell->get_actions()) {
         if ($actions->count() > 1) {
             // Convert uri to somethign that the browser will like
             $value = \Form::select(null, null, array(null => null) + $actions->get_data(), array('onchange' => 'window.location.href=this.value'));
         } else {
             $value = '';
             foreach ($actions->get_data() as $action => $action_value) {
                 if (is_object($action_value)) {
                     $value .= \Html::anchor($action, $action_value->get_data('title'), array('class' => $action_value->get_data('link_class', '')));
                 } else {
                     $value .= \Html::anchor($action, $action_value);
                 }
             }
         }
     }
     // Set rendered
     $cell->set_rendered_value($value);
     return $this;
 }
示例#5
0
 /**
  * Render
  * 
  * Renders a cell and populates
  * it's rendered value
  * 
  * @access	public
  * @param	Spark\Grid_Column_Cell	Cell
  * @return	Spark\Grid_Column_Renderer_Text
  */
 public function render(\Grid_Column_Cell $cell)
 {
     $cell->set_rendered_value($cell->get_original_value());
     return $this;
 }