/** * Makes a pretty readonly field with some stars in it */ function performReadonlyTransformation() { $stars = '*****'; $field = new ReadonlyField($this->name, $this->title ? $this->title : '', $stars); $field->setForm($this->form); return $field; }
public function Field($properties = array()) { $titleArray = $itemIDs = array(); $titleList = $itemIDsList = ""; if ($items = $this->getItems()) { foreach ($items as $item) { $titleArray[] = $item->Title; } foreach ($items as $item) { $itemIDs[] = $item->ID; } if ($titleArray) { $titleList = implode(", ", $titleArray); } if ($itemIDs) { $itemIDsList = implode(",", $itemIDs); } } $field = new ReadonlyField($this->name . '_ReadonlyValue', $this->title); $field->setValue($titleList); $field->setForm($this->form); $valueField = new HiddenField($this->name); $valueField->setValue($itemIDsList); $valueField->setForm($this->form); return $field->Field() . $valueField->Field(); }
/** * Returns a readonly version of this field */ function performReadonlyTransformation() { $field = new ReadonlyField($this->name, $this->title, $this->value); $field->addExtraClass($this->extraClass()); $field->setForm($this->form); return $field; }
/** * Transforms the source data for this CheckboxSetField * into a comma separated list of values. * * @return ReadonlyField */ public function performReadonlyTransformation() { $values = ''; $data = array(); $items = $this->value; if ($this->source) { foreach ($this->source as $source) { if (is_object($source)) { $sourceTitles[$source->ID] = $source->Title; } } } if ($items) { // Items is a DO Set if (is_a($items, 'DataObjectSet')) { foreach ($items as $item) { $data[] = $item->Title; } if ($data) { $values = implode(', ', $data); } // Items is an array or single piece of string (including comma seperated string) } else { if (!is_array($items)) { $items = preg_split('/ *, */', trim($items)); } foreach ($items as $item) { if (is_array($item)) { $data[] = $item['Title']; } elseif (is_array($this->source) && !empty($this->source[$item])) { $data[] = $this->source[$item]; } elseif (is_a($this->source, 'DataObjectSet')) { $data[] = $sourceTitles[$item]; } else { $data[] = $item; } } $values = implode(', ', $data); } } $title = $this->title ? $this->title : ''; $field = new ReadonlyField($this->name, $title, $values); $field->setForm($this->form); return $field; }
/** * Makes a pretty readonly field with some stars in it */ public function performReadonlyTransformation() { $stars = '*****'; $field = new ReadonlyField($this->name, $this->title ? $this->title : _t('Member.PASSWORD'), $stars); $field->setForm($this->form); return $field; }
/** * Makes a pretty readonly field */ function performReadonlyTransformation() { $values = ''; $items = $this->value; foreach ($this->source as $source) { if (is_object($source)) { $sourceTitles[$source->ID] = $source->Title; } } if ($items) { // Items is a DO Set if (is_a($items, 'DataObjectSet')) { foreach ($items as $item) { $data[] = $item->Title; } if ($data) { $values = implode(", ", $data); } // Items is an array or single piece of string (including comma seperated string) } else { if (!is_array($items)) { $items = split(" *, *", trim($items)); } foreach ($items as $item) { if (is_array($item)) { $data[] = $item['Title']; } else { if (is_array($this->source) && $this->source[$item]) { $data[] = $this->source[$item]; } else { if (is_a($this->source, "ComponentSet")) { //added for editable checkboxset. $data[] = $sourceTitles[$item]; } else { $data[] = $item; } } } } $values = implode(", ", $data); } } $field = new ReadonlyField($this->name, $this->title ? $this->title : "", $values); $field->setForm($this->form); return $field; }
function Field() { $titleArray = array(); $titleList = array(); if ($items = $this->getItems()) { foreach ($items as $item) { $titleArray[] = $item->Title; } if ($titleArray) { $titleList = implode(", ", $titleArray); } } $field = new ReadonlyField($this->name, $this->title); $field->setValue($titleList); $field->setForm($this->form); return $field->Field(); }
/** * Return list of IDs for read only * * @return ReadonlyField */ public function performReadonlyTransformation() { $values = implode(',', $this->getSelected()); $field = new ReadonlyField($this->name, $this->title, $values); $field->setForm($this->form); return $field; }