protected function createBooleanControl($container, $column, $record)
 {
     $value = $this->getRecordPropertyValue($column, $record);
     $control = new TCheckBox();
     $control->setChecked(TPropertyValue::ensureBoolean($value));
     $control->setCssClass('boolean-checkbox');
     $this->setDefaultProperty($container, $control, $column, $record);
     return $control;
 }
Esempio n. 2
0
 /**
  * Initializes the specified cell to its initial values.
  * This method overrides the parent implementation.
  * It creates a checkbox inside the cell.
  * If the column is read-only or if the item is not in edit mode,
  * the checkbox will be set disabled.
  * @param TTableCell the cell to be initialized.
  * @param integer the index to the Columns property that the cell resides in.
  * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem)
  */
 public function initializeCell($cell, $columnIndex, $itemType)
 {
     if ($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) {
         $checkBox = new TCheckBox();
         if ($this->getReadOnly() || $itemType !== TListItemType::EditItem) {
             $checkBox->setEnabled(false);
         }
         $cell->setHorizontalAlign('Center');
         $cell->getControls()->add($checkBox);
         $cell->registerObject('CheckBox', $checkBox);
         if ($this->getDataField() !== '') {
             $checkBox->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn'));
         }
     } else {
         parent::initializeCell($cell, $columnIndex, $itemType);
     }
 }
Esempio n. 3
0
 /**
  * @return string the value attribute to be rendered
  */
 protected function getValueAttribute()
 {
     if (($value = parent::getValueAttribute()) === '') {
         return $this->getUniqueID();
     } else {
         return $value;
     }
 }
 /**
  * @return string checkbox label ID;
  */
 protected function getDefaultLabelID()
 {
     if ($attributes = $this->getViewState('LabelAttributes', null)) {
         return TCheckBox::getLabelAttributes()->itemAt('id');
     } else {
         return $this->getClientID() . '_label';
     }
 }
Esempio n. 5
0
 /**
  * Override client implementation to avoid emitting the javascript
  *
  * @param THtmlWriter the writer for the rendering purpose
  * @param string checkbox id
  * @param string onclick js
  */
 protected function renderInputTag($writer, $clientID, $onclick)
 {
     TCheckBox::renderInputTag($writer, $clientID, $onclick);
 }
 /**
  * Returns the attributes to be rendered.
  * This method overrides the parent's implementation.
  * @return ArrayObject attributes to be rendered
  */
 protected function getAttributesToRender()
 {
     $attributes = parent::getAttributesToRender();
     $attributes["type"] = "radio";
     $groupName = $this->getGroupName();
     if (strlen($groupName)) {
         $attributes["name"] = $groupName;
     }
     $attributes["value"] = $this->getUniqueID();
     return $attributes;
 }