定制 webtorque/silverstripe-nhi-field 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

webtorque/silverstripe-nhi-field

Composer 安装命令:

composer require webtorque/silverstripe-nhi-field

包简介

Provide a NHI db field and NHI Form field to track NZ's "National Health Index" number.

README 文档

README

A Silverstipe module to provide a NHI db field and NHI Form field to track NZ's "National Health Index" number.

Build Status

Features

  • Custom DB field type
  • Custom form field type with basic pattern validation and checksum validation.
  • Consistently save NHI in all caps.

Requirements

  • PHP 5.4 or greater (tested with up to PHP 7.1)
  • silverstripe/framework:^3.0
  • silverstripe/cms:^3.0

Installation

composer require webtorque/silverstripe-nhi-field:^0.0

Usage

To specify a NHI db field on a DataObject:

class Patient extends DataObject {
    private static $db = [
        'NationalHealthIndex' => 'NHI',
    ];
}

The NHI field type is equivalent to Varchar(7). When scaffolding a form, any NHI db field will autmatically use the NHIField form field instead of TextField.

Validating an NHI

Just use the NHIField in your form and validate your Form normally.

$nhiField = NHIField::create(
    $name = 'nhi',                      // required
    $title = 'National Health Index',   // optional
    $value = 'CGC2720',                 // optional
    $form = null,                       // optional
    $html5pattern = false               // optional, output an `html5` pattern attribute
);

NHIField is a simple extension of TextField with the following alteration:

  • The maxlength is automatically set to 7.
  • When setting the value of the field, it will automatically be converted to uppercase.
  • The value is validated with a basic regex and with a checksum as specified by the NHI standard.
  • You can ouput an html5 pattern attribute with $nhiField->setHtml5Pattern(true);.

For testing purposes, checksum validation can be disabled by setting the disable_checksum_validation flag on the NHIField config.

if (Director::isDev()) {
    NHIField::config()->disable_checksum_validation = true;
}

统计信息

  • 总下载量: 307
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固