本文整理汇总了PHP中XMLDBField::setEnumValues方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLDBField::setEnumValues方法的具体用法?PHP XMLDBField::setEnumValues怎么用?PHP XMLDBField::setEnumValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLDBField
的用法示例。
在下文中一共展示了XMLDBField::setEnumValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invoke
//.........这里部分代码省略.........
$enumarr[$key] = trim($enumelement);
$enumelement = trim($enumelement);
/// Calculate needed length
$le = strlen(str_replace("'", '', $enumelement));
if ($le > $maxlength) {
$maxlength = $le;
}
/// Skip if under error
if ($enumerr) {
continue;
}
/// Look for quoted strings
if (substr($enumelement, 0, 1) != "'" || substr($enumelement, -1, 1) != "'") {
$enumerr = true;
}
}
} else {
$enumerr = true;
}
if ($enumerr) {
$errors[] = $this->str['enumvaluesincorrect'];
} else {
$enumvalues = $enumarr;
}
if ($length < $maxlength) {
$errors[] = $this->str['wronglengthforenum'];
}
}
if (!empty($errors)) {
$tempfield = new XMLDBField($name);
$tempfield->setType($type);
$tempfield->setLength($length);
$tempfield->setDecimals($decimals);
$tempfield->setUnsigned($unsigned);
$tempfield->setNotNull($notnull);
$tempfield->setSequence($sequence);
$tempfield->setEnum($enum);
$tempfield->setEnumValues($enumvalues);
$tempfield->setDefault($default);
/// Prepare the output
$site = get_site();
$navlinks = array();
$navlinks[] = array('name' => $this->str['administration'], 'link' => '../index.php', 'type' => 'misc');
$navlinks[] = array('name' => 'XMLDB', 'link' => 'index.php', 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("{$site->shortname}: XMLDB", "{$site->fullname}", $navigation);
notice('<p>' . implode(', ', $errors) . '</p>
<p>' . $tempfield->readableInfo(), 'index.php?action=edit_field&field=' . $field->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)));
die;
/// re-die :-P
}
/// Continue if we aren't under errors
if (empty($errors)) {
/// If there is one name change, do it, changing the prev and next
/// atributes of the adjacent fields
if ($fieldparam != $name) {
$field->setName($name);
if ($field->getPrevious()) {
$prev =& $table->getField($field->getPrevious());
$prev->setNext($name);
$prev->setChanged(true);
}
if ($field->getNext()) {
$next =& $table->getField($field->getNext());
$next->setPrevious($name);
$next->setChanged(true);
}
}
/// Set comment
$field->setComment($comment);
/// Set the rest of fields
$field->setType($type);
$field->setLength($length);
$field->setDecimals($decimals);
$field->setUnsigned($unsigned);
$field->setNotNull($notnull);
$field->setSequence($sequence);
$field->setEnum($enum);
$field->setEnumValues($enumvalues);
$field->setDefault($default);
/// If the hash has changed from the old one, change the version
/// and mark the structure as changed
$field->calculateHash(true);
if ($oldhash != $field->getHash()) {
$field->setChanged(true);
$table->setChanged(true);
/// Recalculate the structure hash
$structure->calculateHash(true);
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
/// Mark as changed
$structure->setChanged(true);
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
}
/// Return ok if arrived here
return $result;
}