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


PHP Field::setType方法代码示例

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


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

示例1: _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

示例2: _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

示例3: testSetTypeException

 /**
  * Test setType exception
  *
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage Invalid type
  */
 public function testSetTypeException()
 {
     $object = new Field();
     $object->setType('foo');
 }
开发者ID:doit05,项目名称:relProject,代码行数:11,代码来源:FieldTest.php

示例4: executeSaveField

    /**
     * Create a new field and save it to database
     * @param sfWebRequest $request
     * @return <type>
     */
    public function executeSaveField(sfWebRequest $request) {
        $data = $request->getPostParameters();
        $fieldClass = new FieldClass();
        $data = $fieldClass->prepareSaveData($data); // prepare the data to save, set color and writeprotected flag

        // create parent element for the fields
        $fieldObj = new Field();
        $fieldObj->setTitle($data['createFileWindow_fieldname']);
        $fieldObj->setType($data['createFileWindow_fieldtype']);
        $fieldObj->setwriteprotected($data['createFileWindow_writeprotected']);
        $fieldObj->setColor($data['createFileWindow_color']);
        $fieldObj->save();
        $id = $fieldObj->getId();

        // add the child elements to the field, with the selected field type
        switch ($data['createFileWindow_fieldtype']) {
            case 'TEXTFIELD':
                $textfield = new FieldTextfield();
                $textfield->setFieldId($id);
                $textfield->setRegex($data['fieldTextfield_regularexpression']);
                $textfield->setDefaultvalue($data['fieldTextfield_standard']);
                $textfield->save();
                break;
            case 'CHECKBOX':
                // do nothing
                break;
            case 'NUMBER':
                $numberfield = new FieldNumber();
                $numberfield->setRegex($data['fieldNumber_regularexpression']);
                $numberfield->setDefaultvalue($data['fieldNumber_standard']);
                $numberfield->setComboboxvalue($data['fieldNumber_regularexpressioncombo']);
                $numberfield->setFieldId($id);
                $numberfield->save();
                break;
            case 'DATE':
                $datefield = new FieldDate();
                $datefield->setRegex($data['fieldDate_regularexpression']);
                $datefield->setDateformat($data['fieldDate_format']);
                $datefield->setDefaultvalue($data['fieldDate_date']);
                $datefield->setFieldId($id);
                $datefield->save();
                break;
            case 'TEXTAREA':
                $data['fieldTextarea_content'] = $data['fieldTextarea_contenttype'] == 'plain' ? $data['fieldTextarea_textarea']: $data['fieldTextarea_htmlarea'];
                $textarea = new FieldTextarea();
                $textarea->setContent($data['fieldTextarea_content']);
                $textarea->setContenttype($data['fieldTextarea_contenttype']);
                $textarea->setFieldId($id);
                $textarea->save();
                break;
            case 'RADIOGROUP':
                $fieldClass->saveRadiogroup($id, $data); // save radiogroup
                break;
            case 'CHECKBOXGROUP':
                $fieldClass->saveCheckboxgroup($id, $data); // save checkboxgroup
                break;
            case 'COMBOBOX':
                $fieldClass->saveCombobox($id, $data); // save combobox
                break;
            case 'FILE':
                $file = new FieldFile();
                $file->setRegex($data['fieldFile_regularexpression']);
                $file->setFieldId($id);
                $file->save();
                break;
        }
        $this->renderText('{success:true}');
        return sfView::NONE;
    }
开发者ID:rlauenroth,项目名称:cuteflow_v3,代码行数:74,代码来源:actions.class.php

示例5: testAdminCheckbox

 /**
  * Unit Test case-9 to test Check Boxes
  */
 public function testAdminCheckbox()
 {
     $test = new Field(6);
     $test->setType("checkbox");
     $test->setIsRequired(true);
     $test->setTextBefore("CHECK BOX!");
     $test->setOptions("option1|-etm-|option2|-etm-|option3");
     $html = $test->getAdminHtml();
     /**
      * test to see the textbeforechanges
      */
     preg_match_all('/CHECK BOX!/', $html, $matches);
     $this->assertEquals(2, count($matches[0]));
     /**
      * test to see we see the id 6
      */
     preg_match_all('/etm_element_(\\d+)/', $html, $matches);
     $this->assertEquals(6, $matches[1][0]);
     /**
      * test to see we see  input types of type select
      */
     preg_match_all('/<input type=\'checkbox\'/', $html, $matches);
     $this->assertEquals(3, count($matches[0]));
 }
开发者ID:elliottpost,项目名称:fabulous-form-maker,代码行数:27,代码来源:FieldTest.php


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