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


PHP Field::setValue方法代码示例

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


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

示例1: setValue

 function setValue($path)
 {
     if (!file_exists($this->imgDir . $path)) {
         $path = $this->default;
     }
     parent::setValue($path);
 }
开发者ID:rodrigoprimo,项目名称:estudiolivre,代码行数:7,代码来源:ThumbField.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: 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

示例4: 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

示例5: setValue

 public function setValue($value)
 {
     if ($value === false) {
         return parent::setValue('0');
     } else {
         if ($value === true) {
             return parent::setValue('1');
         } else {
             return parent::setValue($value);
         }
     }
 }
开发者ID:ekowabaka,项目名称:cfx,代码行数:12,代码来源:HiddenField.php

示例6: setValue

 public function setValue($value)
 {
     parent::setValue($value);
     if ($value == "") {
         return;
     }
     $mainValue = $this->subModel->get(array("fields" => array($this->mainModel->getKeyField()), "conditions" => "{$this->subModel->getKeyField()}={$value}"), Model::MODE_ARRAY, false, false);
     $this->mainSelectionList->setValue($mainValue[0][0]);
     $subValues = $this->subModel->get(array("fields" => array($this->subModel->getKeyField(), $this->subModelPathInfo["field"]), "conditions" => "{$this->subModel->getKeyField()}={$value}"), Model::MODE_ARRAY, false, false);
     foreach ($subValues as $subValue) {
         $this->subSelectionList->addOption($subValue[1], $subValue[0]);
     }
     $this->subSelectionList->setValue($value);
 }
开发者ID:rocksyne,项目名称:wyf,代码行数:14,代码来源:RelationshipField.php

示例7: setValue

 public function setValue($value, $default = false)
 {
     if ($this->multiple) {
         if (is_array($value)) {
             foreach ($value as &$v) {
                 $v = (string) $v;
             }
             $this->value = $value;
         } else {
             $this->value = null;
         }
     } else {
         parent::setValue($value, $default);
     }
 }
开发者ID:gregwar,项目名称:formidable,代码行数:15,代码来源:Select.php

示例8: setWithDisplayValue

 public function setWithDisplayValue($value)
 {
     $parts = explode("//", $value);
     $mainId = $this->mainModel->getKeyField();
     $mainField = Model::resolvePath($this->mainModelField);
     $mainField = $mainField['field'];
     $subField = Model::resolvePath($this->subModelField);
     $subField = $subField['field'];
     $possibleMainItem = reset($this->mainModel->getWithField2("trim({$mainField})", trim($parts[0])));
     if ($possibleMainItem === false) {
         parent::setValue(null);
         return;
     }
     $possibleSubItem = reset($this->subModel->get(array('conditions' => "{$mainId} = {$possibleMainItem[$mainId]} and trim({$subField}) = '" . trim($this->mainModel->escape($parts[1])) . "'"), Model::MODE_ASSOC, false, false));
     parent::setValue($possibleSubItem[$this->getName()]);
 }
开发者ID:9naQuame,项目名称:wyf,代码行数:16,代码来源:RelationsField.php

示例9: setValue

 public function setValue($value, $default = false)
 {
     $set = false;
     if (!is_string($value) && !is_float($value) && !is_int($value)) {
         return;
     }
     foreach ($this->radios as $radio) {
         if ($radio->getValue() == $value) {
             $radio->setChecked(true);
             $set = true;
         } else {
             $radio->setChecked(false);
         }
     }
     parent::setValue($set ? $value : null);
 }
开发者ID:rgv151,项目名称:Formidable,代码行数:16,代码来源:MultiradioField.php

示例10: parse

 public static function parse($conf, $inputs)
 {
     $confPath = \Path::instance()->currentProject('etc.conf.@' . $conf . '.conf.xml');
     if (!file_exists($confPath)) {
         return false;
     }
     $dom = new \DOMDocument("1.0", "utf-8");
     $dom->load($confPath);
     $xpath = new \DOMXPath($dom);
     $xpath->registerNamespace('bong', 'http://lab.zigmoyd.net/xmlns/bong');
     $fieldNodes = $xpath->query("//bong:form/bong:field");
     $form = new Form();
     foreach ($fieldNodes as $fieldNode) {
         $field = null;
         $name = self::__attrValue($fieldNode, "name");
         $default = self::__attrValue($fieldNode, "default");
         if ($name) {
             $field = new Field($name);
             $required = self::__attrValue($fieldNode, "required", 'false');
             if ($required == 'true') {
                 $field->setRequiredFlag(true);
             }
             if (isset($inputs[$name])) {
                 $field->setValue(strlen($inputs[$name]) > 0 ? $inputs[$name] : ($default ? $default : ''));
             }
             $ruleNodes = $xpath->query("bong:criteria", $fieldNode);
             foreach ($ruleNodes as $ruleNode) {
                 $ruleName = self::__attrValue($ruleNode, 'name');
                 if ($ruleName) {
                     $arg = self::__attrValue($ruleNode, 'value');
                     $error = self::__attrValue($ruleNode, 'msg');
                     $rule = new RuleSet($ruleName, $error, $arg);
                     $field->addRuleSet($rule);
                 }
             }
         }
         $form->addField($field);
     }
     return $form;
 }
开发者ID:neel,项目名称:bong,代码行数:40,代码来源:validation.php

示例11: setupFields

 /**
  * This function gets the description of a table from the RDBMS and then constructs
  * an array of Fields and returns them as required
  */
 public function setupFields()
 {
     /*if(!$fields = Session::getRegistered($this->table_name.'_field_array'))
       {*/
     try {
         $fields = FieldDefinitions::current()->definitionsForTable($this->table_name);
     } catch (Exception $exc) {
         if (!file_exists($this->fieldCachePath())) {
             $query = SimpleQuery::create('describe ' . $this->table_name);
             $fields = array();
             while ($row = $query->next()) {
                 $type_array = preg_split('/\\(/', $row['Type']);
                 if ($row['Extra'] == 'auto_increment') {
                     $type = 'Field::T_AUTO';
                 } else {
                     if ($row['Key'] == 'PRI') {
                         $type = 'Field::T_PRIMARY_KEY_' . strtoupper($type_array[0]) . '';
                     } else {
                         $type = 'Field::T_' . strtoupper($type_array[0]) . '';
                     }
                 }
                 eval('$field_type = ' . $type . ';');
                 $field = new Field($this->table_name, $row['Field'], $field_type);
                 $fields[$row['Field']] = $field;
                 if ($row['Default'] || !$row['Default'] && is_numeric($row['Default'])) {
                     $field->setValue($row['Default']);
                 }
             }
             @unlink($this->fieldCachePath());
             file_put_contents($this->fieldCachePath(), serialize($fields));
             @chmod($this->fieldCachePath(), 0664);
         } else {
             if (file_exists($this->fieldCachePath())) {
                 $fields = unserialize(file_get_contents($this->fieldCachePath()));
             }
         }
         //Session::register($this->table_name.'_field_array',$fields);
         FieldDefinitions::current()->addDefinitionsForTable($this->table_name, $fields);
     }
     return $fields;
 }
开发者ID:k7n4n5t3w4rt,项目名称:SeeingSystem,代码行数:45,代码来源:table.class.php

示例12: set

 public function set($instance, Field $f, $value)
 {
     $f->setValue($instance, $value);
 }
开发者ID:google-code-backups,项目名称:gwtphp-derpc,代码行数:4,代码来源:CommandSerializationUtil.php

示例13: setValue

 public function setValue($value)
 {
     if ($value == 't') {
         $value = '1';
     }
     parent::setValue($value);
     return $this;
 }
开发者ID:rocksyne,项目名称:wyf,代码行数:8,代码来源:Checkbox.php

示例14: setValue

 /**
  * Must be a ISO 8601 date string or a \DateTime object
  * @param string|\DateTime $value
  * @return $this
  */
 public function setValue($value)
 {
     if ($value instanceof \DateTime) {
         $value = $value->format('c');
     }
     return parent::setValue($value);
 }
开发者ID:yanahiro,项目名称:php-passbook,代码行数:12,代码来源:DateField.php

示例15: setValue

    function setValue($v) {
	parent::setValue((boolean)$v);
    }
开发者ID:rodrigoprimo,项目名称:estudiolivre,代码行数:3,代码来源:BooleanField.php


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