• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Field类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: make

 public static function make()
 {
     $itemFactory = new itemFactory();
     $collectionFactory = new ItemCollectionFactory();
     $fields = new Field();
     return $fields->setItemFactory($itemFactory)->setFactory($collectionFactory)->setFormatter(new FieldFormatter());
 }
开发者ID:RichardAnthonyLee,项目名称:cms-gen,代码行数:7,代码来源:FieldFactory.php


示例2: add

 public function add(Field $field)
 {
     $attr = $field->name();
     $field->setValue($this->entity->{$attr}());
     $this->fields[] = $field;
     return $this;
 }
开发者ID:Cybercraft,项目名称:Framework,代码行数:7,代码来源:Form.class.php


示例3: __construct

 /**
  * Конструктор, нужен для реализации паттерна Observer
  * 
  * @param \REXFramework\forms\Field $field
  * @param mixed $criterion Критерий для валидатора, например, регулярное выражение
  * @param string $message Сообщение об ошибке
  */
 public function __construct(Field $field, $criterion = null, $message = '')
 {
     $this->field = $field;
     $this->criterion = $criterion;
     $this->message = $message;
     $field->attach($this);
 }
开发者ID:BoesesGenie,项目名称:rex-framework,代码行数:14,代码来源:Validator.php


示例4: getKeyKey

 /**
  * @return mixed
  */
 protected function getKeyKey()
 {
     $n = get_called_class();
     if (!isset(self::$k_cache[$n])) {
         $key = null;
         $r = $this->getReflection();
         //Parse the annotations in a class
         $reader = new \Phalcon\Annotations\Reader();
         $parsing = $reader->parse($r->getName());
         //Create the reflection
         $annotations = new \Phalcon\Annotations\Reflection($parsing);
         if ($annotations->getClassAnnotations()->has('key')) {
             $key = $annotations->getClassAnnotations()->get('key');
         } else {
             foreach ($r->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
                 if (!$property->isPublic() || $property->isStatic()) {
                     continue;
                 }
                 $f = new Field($r, $property);
                 if ($f->isKey()) {
                     $key = $property->getName();
                     break;
                 }
             }
         }
         self::$k_cache[$n] = $key;
     }
     return self::$k_cache[$n];
 }
开发者ID:kathynka,项目名称:Foundation,代码行数:32,代码来源:DataObject.php


示例5: removeField

 public function removeField(Field $field)
 {
     if (isset($this->fields[$field->getName()])) {
         unset($this->fields[$field->getName()]);
     }
     return $this;
 }
开发者ID:pavelkolomitkin,项目名称:nigma-blog,代码行数:7,代码来源:Form.php


示例6: addField

 /**
  * @param Field $field
  * @throws DuplicateFieldException
  */
 public function addField(Field $field)
 {
     if (isset($this->fields[$field->getName()])) {
         throw new DuplicateFieldException('Field `' . $field->getName() . '` already exists');
     }
     $this->fields[$field->getName()] = $field;
 }
开发者ID:mammothmkiv,项目名称:php-validator,代码行数:11,代码来源:FieldList.php


示例7: resolve

 /**
  * @param Field $field
  *
  * @return array
  */
 public function resolve(Field $field)
 {
     $defaults = ['required' => false, 'label' => $field->getLabel()];
     $definition = $this->registry->findDefinitionFor($field->getDocument());
     $attributes = $definition->getAttributes($field);
     return array_merge($defaults, $this->trim($attributes));
 }
开发者ID:tomaszhanc,项目名称:form-field-bundle,代码行数:12,代码来源:AttributeResolver.php


示例8: process

    public function process($input)
    {
        $id = 0;
        $minesAll  = array();
        while(count($input)>0)
        {           
            $line = array_shift($input);    
            
            if($this->isNewField($line))
            {
                $dim = $this->getFieldDimensions($line);
                $m = $dim[0]; 
                $n = $dim[1]; 
                if(!$this->IsTheEnd($m, $n))
                {
                    if(!$this->isValidDim($m, $n)){
                        throw new Exception ("Error: Invalid field dimensions! $m, $n");
                    }
                    ++$id;
                    $lineNum = 0;
                    $field = new Field($id, $m, $n);
                    $field->setDebug($this->debug);
                    $this->fields[$id] = $field;  
                }             
            }
            else
            {                                
                if( count($this->fields)<=0 ){
                    throw new Exception ("Error something wrong\n");
                }
                $field = $this->getField($id);
                $id = $field->getFieldId();

                /* line data process */
                foreach(str_split($line) as $x=>$cellvalue)
                {
                    $field->addCell($x, $lineNum);
                    /* detecting mines */
                    if($this->isMinedCell($cellvalue)){
                       $minesAll[$id][] = array($x, $lineNum);
                    }
                }
                $this->fields[$id] = $field;
                $lineNum++;
            }
        } 
        
        if(count($minesAll)>0)
        {
            foreach($minesAll as $id=>$mines)
            {
                $field = $this->getField($id); 
                $field = $this->MineField($field, $mines);
            }
            
        }
        
        return $this->getOutput();
    }
开发者ID:rmhdev,项目名称:Agosto-Minesweeper,代码行数:59,代码来源:Exercise.php


示例9: alterField

 function alterField(\Field $field, $add = false)
 {
     $q = $this->db->dsql()->expr('alter table [al_table] add [field_name] [type_expr]');
     $q->setCustom('al_table', $this->table);
     $q->setCustom('field_name', $x = $field->actual_field ?: $field->short_name);
     $q->setCustom('type_expr', $this->db->dsql()->expr($this->resolveFieldType($field->type())));
     $q->execute();
 }
开发者ID:xavocvijay,项目名称:atkschool,代码行数:8,代码来源:AutoCreator.php


示例10: testCanOverrideInvalidRelation

 public function testCanOverrideInvalidRelation()
 {
     $args = array('type' => 'taxonomy', 'taxonomy' => 'category', 'relation' => 'IN');
     $f = new Field($args);
     $defaults = $f->getDefaults();
     $default_relation = $defaults['relation'];
     $this->assertTrue($f->getRelation() == $default_relation);
 }
开发者ID:dsopiarz,项目名称:wp-advanced-search,代码行数:8,代码来源:TestField.php


示例11: DoAddField

 /**
  * @param Field $field
  * @return void
  */
 protected function DoAddField($field)
 {
     $sourceTable = $field->GetSourceTable();
     if (!isset($sourceTable) || $sourceTable == '') {
         $sourceTable = $this->tableName;
     }
     $this->GetSelectCommand()->AddField($sourceTable, $field->GetName(), $field->GetEngFieldType(), $field->GetAlias());
 }
开发者ID:howareyoucolin,项目名称:demo,代码行数:12,代码来源:table_dataset.php


示例12: addField

 /**
  * Add field
  * 
  * @param  Field $field
  * @throws \LogicException
  */
 public function addField(Field $field)
 {
     $name = $field->getName();
     if (isset($this->fields[$name])) {
         throw new \LogicException(sprintf('Field "%s" already exists', $name));
     }
     $this->fields[$name] = $field;
 }
开发者ID:mikemirten,项目名称:ConstructorCMS,代码行数:14,代码来源:Schema.php


示例13: add

 /**
  * Méthode permettant d'ajouter un champ à la liste
  * 
  * @param \OCFram\Field $field
  * @return \OCFram\Form
  */
 public function add(Field $field)
 {
     $attr = $field->name();
     // Récupérer le nom du champ
     $field->setValue($this->entity->{$attr}());
     // Assigner la valeur correspondante au champ
     $this->fields[] = $field;
     // Ajouter le champ passé en argument à la liste des champs
     return $this;
 }
开发者ID:ChristopheMalo,项目名称:SiteWeb-POO-PHP,代码行数:16,代码来源:Form.php


示例14: update

 public function update()
 {
     $f = new Field();
     $f->name = $this->getFieldName();
     $f->type = $this->getFieldType();
     $f->save();
     $this->fieldSetup($f);
     $f->save();
     return $f;
 }
开发者ID:lostkobrakai,项目名称:migrations,代码行数:10,代码来源:FieldMigration.php


示例15: validate

 /**
  * Validates the given data against this constraint. If the constraint was
  * already triggered before, then it will return the last result.
  *
  * @param mixed $data The data
  *
  * @return boolean
  */
 public function validate(Field $field, $data)
 {
     if (true === $this->checked) {
         return;
     }
     $this->checked = true;
     if (true === $this->check($data)) {
         return;
     }
     $field->addError(new Error($field->getInternalName(), $this->getMessage()));
 }
开发者ID:dennis84,项目名称:formz,代码行数:19,代码来源:Constraint.php


示例16: testSettersAndGettersDoWhatTheyShould

 public function testSettersAndGettersDoWhatTheyShould()
 {
     $field = new Field('type', 'element', 'label', 'description');
     $field->setOptions(['options' => 'options']);
     $field->setValidationRules('rules');
     $field->setValue('foo');
     $expectations = ['getOptions' => ['options' => 'options'], 'getValidationRules' => 'rules', 'getValue' => 'foo'];
     foreach ($expectations as $method => $value) {
         static::assertEquals($field->{$method}(), $value);
     }
 }
开发者ID:Adamzynoni,项目名称:mybb2,代码行数:11,代码来源:FieldTest.php


示例17: _parseFields

 private function _parseFields($results)
 {
     $response = array();
     foreach ($results as $result) {
         $field = new Field();
         $field->setName($result["Field"]);
         $field->setType($result["Type"]);
         $field->setPk($result["Key"] == 'PRI');
         $response[] = $field;
     }
     return $response;
 }
开发者ID:jeanlopes,项目名称:mostra-ifrs-poa,代码行数:12,代码来源:mysql.php


示例18: _parseFields

 private function _parseFields($results, $pk)
 {
     $response = array();
     foreach ($results as $result) {
         $field = new Field();
         $field->setName($result["field"]);
         $field->setType($result["type"]);
         $field->setPk($result["field"] == $pk["col"]);
         $response[] = $field;
     }
     return $response;
 }
开发者ID:jeanlopes,项目名称:mostra-ifrs-poa,代码行数:12,代码来源:postgre.php


示例19: testPrintField

 /**
  * @dataProvider outputProvider
  */  
 public function testPrintField($id, $m, $n, $mines, $r, $msg)
 {
     $field = new Field($id,$m,$n);
     $field->fillClean();
     foreach($mines as $mine)
     {
         $x = $mine[0];
         $y = $mine[1];
         $field->mineCell($x,$y);
     }
     $this->assertEquals($r, $field->printField(),$msg);  
 }
开发者ID:rmhdev,项目名称:Agosto-Minesweeper,代码行数:15,代码来源:FieldTest.php


示例20: renderAjax

 /**
  * Render the ajax request output directly and halt execution
  * 
  * @param Page $page
  * @param Field $field
  * 
  */
 protected function renderAjax(Page $page, Field $field)
 {
     $inputfield = $field->getInputfield($page);
     if (!$inputfield) {
         return;
     }
     echo $inputfield->render();
     if ($this->notes) {
         echo "<p class='notes'>" . $this->wire('sanitizer')->entities($this->notes) . "</p>";
         $this->notes = '';
     }
     exit;
 }
开发者ID:GTuritto,项目名称:ProcessWire,代码行数:20,代码来源:InputfieldPageTableAjax.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP FieldGroup类代码示例发布时间:2022-05-23
下一篇:
PHP Feedback类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap