本文整理汇总了PHP中TextField::setReadOnly方法的典型用法代码示例。如果您正苦于以下问题:PHP TextField::setReadOnly方法的具体用法?PHP TextField::setReadOnly怎么用?PHP TextField::setReadOnly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextField
的用法示例。
在下文中一共展示了TextField::setReadOnly方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUpdateAllMask
//.........这里部分代码省略.........
for ($ia = 0; $ia < count($this->COLNAMES); $ia++) {
$row = $this->ROWS[$ir];
$t = "";
$fieldName = mysql_field_name($result, $ia);
$fieldLen = 30;
if (!$this->isNoUpdateCol($fieldName)) {
$maxLen = mysql_field_len($result, $ia);
if ($maxLen < $fieldLen) {
$fieldLen = $maxLen;
}
$lookups = getLookupWerte($_SESSION['config']->DBCONNECT, $this->TABLENAME, $fieldName);
if (mysql_num_rows($lookups) > 0) {
$t = new LookupCombo($_SESSION['config']->DBCONNECT, $fieldName . $rowId, $this->TABLENAME, $fieldName, $row->getNamedAttribute($fieldName));
} else {
if ($this->isDbComboSet($this->TABLENAME, $fieldName)) {
// Wenn DbCombo definiert wurde wird die Combobox zur Spalte angezeigt
//Wenn die Combobox noch nicht erzeugt wurde, erzeugen.
if (!isset($dbComboArrays[$this->TABLENAME . $colNames[$ia]])) {
$dbComboArrays[$this->TABLENAME . $colNames[$ia]] = getDbComboArray($this->TABLENAME, $colNames[$ia], $this->ROWS[$ir]);
}
$dbCombo = $dbComboArrays[$this->TABLENAME . $colNames[$ia]];
if (count($dbCombo) > 0) {
$default = $row->getAttribute($ia);
if (!existsKeyInArray($default, $dbCombo)) {
$default = null;
}
$t = new ComboBox($fieldName . $rowId, $dbCombo, $default);
}
} else {
if (mysql_field_type($result, $ia) == "blob") {
$t = new TextArea($fieldName . $rowId, $row->getNamedAttribute($colNames[$ia]), round(70 / count($this->COLNAMES), 0), 4);
} else {
if (strpos(mysql_field_flags($result, $ia), "enum") > 0) {
$ev = $this->getEnumValues($fieldName);
if (count($ev) == 2 && (in_array('J', $ev) && in_array('N', $ev))) {
$t = new Checkbox($fieldName . $rowId);
if ($row->getNamedAttribute($colNames[$ia]) == "J") {
$t->setSelected(true);
}
} else {
$t = new ComboBox($fieldName . $rowId, $this->getComboboxEnumArray($fieldName));
}
} else {
if (mysql_field_type($result, $ia) == "int") {
$t = new TextField($fieldName . $rowId, $row->getNamedAttribute($colNames[$ia]), $fieldLen, $maxLen);
} else {
if (mysql_field_type($result, $ia) == "date") {
//$t = new TextField($fieldName.$rowId,$row->getNamedAttribute($colNames[$ia]), $tfWidth, mysql_field_len ( $result, $ia ) );
$val = $row->getNamedAttribute($colNames[$ia]);
$t = new DateTextfield($fieldName . $rowId, $val);
} else {
if (mysql_field_type($result, $ia) == "timestamp") {
$t = new TextField($fieldName . $rowId, $row->getNamedAttribute($colNames[$ia]), $fieldLen, $maxLen);
} else {
$t = new TextField($fieldName . $rowId, $row->getNamedAttribute($colNames[$ia]), $fieldLen, $maxLen);
}
}
}
}
}
$arrChk = array_search($fieldName, $this->READONLYCOLS);
if (strlen($arrChk) != 0) {
$t->setReadOnly(true);
}
}
}
// Eingabe-Objekt in Zeile einfügen
$r->setAttribute($ia, $t);
} else {
$r->setAttribute($ia, "");
}
}
// entfernen Button einfügen
if ($this->isDeleteInUpdate()) {
$btnDel = new Button("delete" . $rowId . $this->TABLENAME, "entfernen");
$r->setAttribute(count($tNames) - 1, $btnDel);
}
$table->addRow($r);
}
// Speichern/Abbrechen Button einfügen
$btnOk = new Button("DbTableUpdate" . $this->TABLENAME, "Speichern");
$btnOkFake = new Button("DbTableUpdate" . $this->TABLENAME, "Speichern");
$btnOkFake->setStyle("display", "none");
$btnOkFake->setWidth(0);
$btnOkFake->setHeight(0);
$btnCancel = new Button("", "Abbrechen");
$hidden = new Hiddenfield("UpdateAllMaskIsActive", "true");
$form = new Form($_SERVER['SCRIPT_NAME']);
$form->add($this->DEFAULT_HIDDEN_FIELDS);
if ($deleteMask != null) {
$form->add($deleteMask);
}
$form->add($btnOkFake);
$form->add($this->getPageNavigation());
$form->add($table);
$form->add($btnOk);
$form->add($btnCancel);
$form->add($hidden);
return $form;
}
示例2: getCMSFields
/**
* Return the FieldSet used to edit a dynamic template in the CMS.
*/
function getCMSFields()
{
// // delete files button
// if( $this->canEdit() ) {
// $deleteButton = new InlineFormAction('deletemarked',_t('Folder.DELSELECTED','Delete selected files'), 'delete');
// $deleteButton->includeDefaultJS(false);
// } else {
// $deleteButton = new HiddenField('deletemarked');
// }
// link file button
if ($this->canEdit()) {
$fileButtons = new CompositeField($linkFileButton = new InlineFormAction('linkfile', _t('DynamicTemplate.LINKFILE', 'Link file(s) from theme'), 'link'), $copyFileButton = new InlineFormAction('copyfile', _t('DynamicTemplate.COPYFILE', 'Copy file(s) from theme'), 'copy'), $newFileButton = new InlineFormAction('newfile', _t('DynamicTemplate.NEWFILE', 'New file'), 'newfile'));
$linkFileButton->includeDefaultJS(false);
$copyFileButton->includeDefaultJS(false);
$newFileButton->includeDefaultJS(false);
} else {
$fileButtons = new HiddenField('linkfile');
}
$propButtons = new CompositeField();
// $propButtons->push($exportButton = new InlineFormAction('exporttemplate', _t('DynamicTemplate.EXPORTTEMPLATE', 'Export'), 'export'));
// $exportButton->includeDefaultJS(false);
// if ($this->canEdit()) {
// $propButtons->push($saveButton = new InlineFormAction('savetemplate', _t('DynamicTemplate.SAVETEMPLATE', 'Save'), 'save'));
// $saveButton->includeDefaultJS(false);
// }
if (DynamicTemplateAdmin::tarball_available()) {
$exportTarballButton = new InlineFormAction('exportastarball', _t('DynamicTemplate.EXPORT', 'Export as tarball'), 'exportastarball');
$exportTarballButton->includeDefaultJS(false);
$propButtons->push($exportTarballButton);
}
if (DynamicTemplateAdmin::zip_available()) {
$exportZipButton = new InlineFormAction('exportaszip', _t('DynamicTemplate.EXPORT', 'Export as zip'), 'exportaszip');
$exportZipButton->includeDefaultJS(false);
$propButtons->push($exportZipButton);
}
// $titleField = ($this->ID && $this->ID != "root") ? new TextField("Title", _t('Folder.TITLE', 'Title')) : new HiddenField("Title");
$titleField = new TextField("Title", _t('Folder.TITLE', 'Title'));
if (!$this->canEdit()) {
$titleField->setReadOnly(true);
}
$nameField = new TextField("Name");
if (!$this->canEdit()) {
$titleField->setReadOnly(true);
}
$fields = new FieldList($rootTabSet = new TabSet("Root", new Tab("Properties", _t('DynamicTemplate.PROPERTIESTAB', 'Properties'), $titleField, new ReadonlyField("URL", _t('Folder.URL', 'URL')), new ReadonlyField("Created", _t('Folder.CREATED', 'First Uploaded')), new ReadonlyField("LastEdited", _t('Folder.LASTEDITED', 'Last Updated')), new HiddenField("ID"), new HiddenField("ClassName", null, "DynamicTemplate"), $propButtons), new Tab("Upload", _t('Folder.UPLOADTAB', "Upload"), new LabelField('UploadPrompt', _t('DynamicTemplate.UPLOADPROMPT', 'Upload files to your template. Uploads will automatically be added to the right place.')), $this->getUploadField())));
// A DT can only have files if it has been saved at least once. This is also to avoid time out issue where DynamicTemplatesFileField::calc_tree
// tries to find files from a DT with ID=0
if ($this->ID) {
$fileList = new DynamicTemplateFilesField("Files", "Files", $this);
$rootTabSet->push(new Tab("Files", _t('Folder.FILESTAB', "Files"), $fileList, $fileButtons, new HiddenField("FileIDs"), new HiddenField("DestFolderID")));
}
if (!$this->canEdit()) {
$fields->removeFieldFromTab("Root", "Upload");
}
$this->extend('updateCMSFields', $fields);
Session::set("dynamictemplates_currentID", $this->ID);
return $fields;
}