当前位置: 首页>>代码示例>>PHP>>正文


PHP xmldb_field::readableInfo方法代码示例

本文整理汇总了PHP中xmldb_field::readableInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP xmldb_field::readableInfo方法的具体用法?PHP xmldb_field::readableInfo怎么用?PHP xmldb_field::readableInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xmldb_field的用法示例。


在下文中一共展示了xmldb_field::readableInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: invoke


//.........这里部分代码省略.........
         if (!(empty($default) || is_numeric($default) && !empty($default))) {
             $errors[] = $this->str['defaultincorrect'];
         }
     }
     /// Char checks
     if ($type == XMLDB_TYPE_CHAR) {
         if (!(is_numeric($length) && !empty($length) && intval($length) == floatval($length) && $length > 0 && $length <= 255)) {
             $errors[] = $this->str['charincorrectlength'];
         }
         if ($default !== NULL && $default !== '') {
             if (substr($default, 0, 1) == "'" || substr($default, -1, 1) == "'") {
                 $errors[] = $this->str['defaultincorrect'];
             }
         }
     }
     /// Text checks
     if ($type == XMLDB_TYPE_TEXT) {
         if ($length != 'small' && $length != 'medium' && $length != 'big') {
             $errors[] = $this->str['textincorrectlength'];
         }
         if ($default !== NULL && $default !== '') {
             if (substr($default, 0, 1) == "'" || substr($default, -1, 1) == "'") {
                 $errors[] = $this->str['defaultincorrect'];
             }
         }
     }
     /// Binary checks
     if ($type == XMLDB_TYPE_BINARY) {
         if ($length != 'small' && $length != 'medium' && $length != 'big') {
             $errors[] = $this->str['binaryincorrectlength'];
         }
     }
     if (!empty($errors)) {
         $tempfield = new xmldb_field($name);
         $tempfield->setType($type);
         $tempfield->setLength($length);
         $tempfield->setDecimals($decimals);
         $tempfield->setUnsigned($unsigned);
         $tempfield->setNotNull($notnull);
         $tempfield->setSequence($sequence);
         $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() . '</p>', 'index.php?action=edit_field&amp;field=' . $field->getName() . '&amp;table=' . $table->getName() . '&amp;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->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;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:101,代码来源:edit_field_save.class.php


注:本文中的xmldb_field::readableInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。