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


PHP Record::getField方法代码示例

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


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

示例1: testGetFieldNewRecord

 function testGetFieldNewRecord()
 {
     $record = new Record($this->getPdo(), 'whatilearned_knowledgebit');
     $this->assertNull($record->getField('key'));
 }
开发者ID:nkammah,项目名称:what-i-learned,代码行数:5,代码来源:RecordTest.php

示例2: foreach

         echo $output;
         exit;
     }
     break;
 case 'ukcrn':
     $output = "Study Identifier,Study Acronym,Site Identifier,Site Name,Activity Date,Participant Type,Unique Participant ID,Activity Type\r\n";
     $sql = "SELECT link.id FROM link\n  LEFT JOIN core ON link.core_id = core.id\n  LEFT JOIN centre ON core.centre_id = centre.id\n  WHERE centre.country_id = 30 AND discontinue_id IS NULL\n  ORDER BY link.id";
     $query = DB::query($sql);
     $count = 1;
     foreach ($query->rows as $row) {
         $record = new Record($row->id);
         $record->getAllData();
         $centre = new Centre($record->getCentre());
         $output .= "20252,PRISM,,";
         $output .= "{$centre->name},";
         $output .= $record->getField('core', 'randdate') . ',';
         $output .= "Participant with the relevant condition,";
         $output .= $record->getField('core', 'trialid') . ',';
         $output .= "Recruitment";
         $output .= "\r\n";
     }
     $date = date('Y-m-d');
     $filename = "CPMS.{$date}.csv";
     header('Pragma: public');
     header('Expires: -1');
     header('Content-Transfer-Encoding: binary');
     header('Content-Type: application/vnd.ms-excel');
     header("Content-Disposition: attachment;filename=\"{$filename}\"");
     header('Cache-Control: max-age=0');
     echo $output;
     exit;
开发者ID:uhtoff,项目名称:eCRF,代码行数:31,代码来源:process.php

示例3: getFormFields

 public function getFormFields($page = NULL, $multiple = false, $multiSuffix = NULL, $record = NULL)
 {
     if (!$page) {
         $page = $this->getPage();
     }
     Timer::start();
     $fields = array();
     if ($multiple) {
         if (!isset($this->multipleFormFields[$page])) {
             $sql = "SELECT id, labelText, fieldName, defaultVal,\n\t\t\t\t  \ttype, toggle, mandatory, multiple, size, class \t\t \n\t\t\t\t  FROM formFields  \n\t\t\t\t  WHERE pages_name=?  \n                  AND multiple = ?\n\t\t\t\t  ORDER BY entryorder";
             $pA = array('ss', $page, $multiple);
             $result = $this->multipleFormFields[$page] = DB::query($sql, $pA);
         } else {
             $result = $this->multipleFormFields[$page];
         }
     } else {
         if (!isset($this->formFields[$page])) {
             $sql = "SELECT formFields.id, IFNULL( label_text, formFields.labelText ) as label_text, fieldName, defaultVal,\n\t\t\t\t\ttype, toggle, mandatory, size, class, readonly\t\t \n\t\t\t\tFROM formFields\n\t\t\t\tLEFT JOIN formFields_labels\n\t\t\t\tON formFields.id = formFields_id AND language_code = '{$this->getFormLanguage()}' \n\t\t\t\tWHERE pages_name=? \n                AND multiple IS NULL\t\t\t\n\t\t\t\tORDER BY entryorder";
             $pA = array('s', $page);
             $result = $this->formFields[$page] = DB::query($sql, $pA);
         } else {
             $result = $this->formFields[$page];
         }
     }
     $excluded = $this->getExcludedFormFields($record);
     $counter = 1;
     foreach ($result->rows as $row) {
         if (in_array($row->id, $excluded)) {
             continue;
         }
         if (!$row->fieldName) {
             $row->fieldName = $counter++;
         }
         if ($row->type != 'data') {
             $name = "{$page}-{$row->fieldName}";
             // Prepends the name with the current page
         } else {
             $name = $row->fieldName;
         }
         if ($multiSuffix) {
             $name .= "_{$multiSuffix}";
         }
         $fields[$name]['type'] = $row->type;
         $fields[$name]['label'] = $row->label_text;
         $fields[$name]['toggle'] = $row->toggle;
         $fields[$name]['mandatory'] = $row->mandatory;
         $fields[$name]['default'] = $row->defaultVal;
         $fields[$name]['size'] = $row->size;
         $fields[$name]['readonly'] = $row->readonly;
         $fields[$name]['class'] = $row->class;
         if ($row->type == 'checkbox' || $row->type == 'radio') {
             // Add checkbox options from validation table
             if (!isset($this->checkboxRadioOptions[$row->id])) {
                 $options = array();
                 $sql = "SELECT value, special FROM formVal \n                    WHERE formFields_id = ?\n                    AND operator = 'IN LIST'\n                    ORDER BY groupNum";
                 $pA = array('i', $row->id);
                 $getTable = DB::cleanQuery($sql, $pA);
                 if ($getTable->getRows() > 1) {
                     $sql = "SELECT a.option_value, IFNULL( b.option_text, a.option_text ) as option_text \n\t\t\t\t\tFROM {$getTable->value} a \n\t\t\t\t\tLEFT JOIN {$getTable->value} b \n\t\t\t\t\tON a.option_value = b.option_value AND b.language_code = '{$this->language}' ";
                     if ($getTable->value != 'centre') {
                         $sql .= "WHERE a.language_code = 'en' ";
                     }
                     $sql .= "ORDER BY a.option_order";
                     $result = DB::query($sql);
                     foreach ($result->rows as $row) {
                         $this->addOption($row->option_text, $row->option_value);
                     }
                 } else {
                     $sql = "SELECT a.option_value, IFNULL( b.option_text, a.option_text ) as option_text \n\t\t\t\t\t\tFROM {$getTable->value} a \n\t\t\t\t\t\tLEFT JOIN {$getTable->value} b \n\t\t\t\t\t\tON a.option_value = b.option_value AND b.language_code = '{$this->language}' \n\t\t\t\t\t\tWHERE a.language_code = 'en' ORDER BY a.option_order";
                     $ref = DB::query($sql);
                 }
                 foreach ($ref->rows as $rRow) {
                     $options[$rRow->option_value] = $rRow->option_text;
                 }
                 $fields[$name]['options'] = $this->checkboxRadioOptions[$row->id] = $options;
             } else {
                 $fields[$name]['options'] = $this->checkboxRadioOptions[$row->id];
             }
         }
         if ($row->type == 'select') {
             // Adds select options from table
             if (!isset($this->selectOptions[$row->id])) {
                 $options = array();
                 $sql = "SELECT value, special, operator FROM formVal \n                    WHERE formFields_id = ? ORDER BY groupNum";
                 $pA = array('i', $row->id);
                 $getTable = DB::query($sql, $pA);
                 foreach ($getTable->rows as $vRow) {
                     $filterNum = NULL;
                     switch ($vRow->operator) {
                         case 'IN LIST':
                             if ($vRow->special == 'FILTER') {
                                 $filter = explode('-', $vRow->value);
                                 $filterNum = $this->record->getField($filter[0], $filter[1]);
                             } else {
                                 $refTable = DB::clean($vRow->value);
                                 $order = $vRow->special == 'ALPHA' ? 'name' : 'option_order';
                                 if (strpos($refTable, '-')) {
                                     $filterBy = explode('-', $refTable);
                                     $refTable = $filterBy[0];
                                     $filterTable = $filterBy[1];
//.........这里部分代码省略.........
开发者ID:uhtoff,项目名称:eCRF,代码行数:101,代码来源:ecrflib.php


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