public function FillModal($d) { switch ($d->type) { case 'Field': $d->formStudy = intval($d->formStudy); $rows = RecordBookQuery::ModalFieldList($this->db, $d->formStudy); break; case 'GroupModal': $d->fieldid = intval($d->fieldid); $d->curGroup = intval($d->curGroup); $rows = RecordBookQuery::ModalGroupList($this->db, $d->fieldid, $d->curGroup); break; } $listClass = $d->type . "List"; $itemClass = $d->type . "Item"; $list = $this->models->InstanceClass($listClass); while ($dd = $this->db->fetch_array($rows)) { $list->Add($this->models->InstanceClass($itemClass, $dd)); } return $list; }