stat('tree_class'), $id); } if(!$record) return false; $fields = $record->getCMSFields(); $actions = new FieldSet( new FormAction('addmember',_t('SecurityAdmin.ADDMEMBER','Add Member')), new FormAction('save',_t('SecurityAdmin.SAVE','Save')) ); $form = new Form($this, "EditForm", $fields, $actions); $form->loadDataFrom($record); return $form; } public function AddRecordForm() { $m = Object::create('MemberTableField', $this, "Members", $this->currentPageID() ); return $m->AddRecordForm(); } /** * Ajax autocompletion */ public function autocomplete() { $fieldName = $this->urlParams['ID']; $fieldVal = $_REQUEST[$fieldName]; $result = ''; // Make sure we only autocomplete on keys that actually exist, and that we don't autocomplete on password if(!array_key_exists($fieldName, singleton($this->stat('subitem_class'))->stat('db')) || $fieldName == 'Password') return; $matches = DataObject::get($this->stat('subitem_class'),"$fieldName LIKE '" . Convert::raw2sql($fieldVal) . "%'"); if($matches) { $result .= ""; return $result; } } function addmember($className=null) { $data = $_REQUEST; unset($data['ID']); if($className == null) $className = $this->stat('subitem_class'); $record = new $className(); $record->update($data); $record->write(); if($data['GroupID']) $record->Groups()->add((int)$data['GroupID']); FormResponse::add("reloadMemberTableField();"); return FormResponse::respond(); } /** * Return the entire site tree as a nested set of ULs. * @return string Unordered list