function getControl($field, $id = "") { // if conrol does not created previously if(!array_key_exists($field, $this->controls)) { include_once(getabspath("classes/controls/Control.php")); $userControl = false; $cTypes = new ControlTypes(); $editFormat = $this->pSetEdit->getEditFormat($field); if($editFormat == EDIT_FORMAT_TEXT_FIELD && IsDateFieldType($this->pSetEdit->getFieldType($field))) $editFormat = EDIT_FORMAT_DATE; if($this->pageType == PAGE_SEARCH || $this->pageType == PAGE_LIST) { // Text field may be Lookup field on some page if($editFormat == EDIT_FORMAT_TEXT_FIELD && $this->pSetEdit->getPageTypeByFieldEditFormat($field, EDIT_FORMAT_LOOKUP_WIZARD) != "") { $localPSet = new ProjectSettings($this->pSetEdit->_table, $this->pSetEdit->getPageTypeByFieldEditFormat($field, EDIT_FORMAT_LOOKUP_WIZARD)); if($localPSet->getLWLinkField($field) != $localPSet->getLWDisplayField($field)) $className = "LookupTextField"; else $className = $cTypes->forSearch[$editFormat]; } else $className = $cTypes->forSearch[$editFormat]; } else $className = $cTypes->forEdit[$editFormat]; if(!$className) { if($editFormat != "") { $className = "Edit".$editFormat; $userControl = true; include_once(getabspath("classes/controls/UserControl.php")); if(!is_null($this->pageObject)) $this->pageObject->AddJSFile("include/runnerJS/controls/".$className.".js", "include/runnerJS/Control.js"); } else $className = $cTypes->forEdit[EDIT_FORMAT_TEXT_FIELD]; } else if($className == $cTypes->forEdit[EDIT_FORMAT_FILE] && $this->pSetEdit->isCompatibilityMode($field)) $className = "FileFieldSingle"; $this->controls[$field] = createControlClass($className, $field, $this->pageObject != null ? $this->pageObject : $this, $id); $this->controls[$field]->container = $this; if($userControl) { $this->controls[$field]->format = $className; $this->controls[$field]->initUserControl(); } } if($id !== "") $this->controls[$field]->setID($id); return $this->controls[$field]; }
/** * @param String field * @param String id (optional) * @param Array extraParmas (optional) * @return Control */ function getControl($field, $id = "", $extraParmas = array()) { if (count($extraParmas) && $extraParmas["getDetKeyReadOnlyCtrl"]) { include_once getabspath("classes/controls/Control.php"); $cTypes = new ControlTypes(); $className = $cTypes->forEdit[EDIT_FORMAT_READONLY]; $ctrl = createControlClass($className, $field, $this->pageObject != null ? $this->pageObject : $this, $id, $this->connection); $ctrl->container = $this; return $ctrl; } if (count($extraParmas) && $extraParmas["getConrirmFieldCtrl"]) { include_once getabspath("classes/controls/Control.php"); $cTypes = new ControlTypes(); $className = $cTypes->forEdit[EDIT_FORMAT_PASSWORD]; $ctrl = createControlClass($className, $field, $this->pageObject != null ? $this->pageObject : $this, $id, $this->connection); if ($extraParmas['isConfirm']) { $ctrl->field = GetPasswordField(); } $ctrl->container = $this; return $ctrl; } // if conrol does not created previously if (!array_key_exists($field, $this->controls)) { include_once getabspath("classes/controls/Control.php"); $userControl = false; $cTypes = new ControlTypes(); $editFormat = $this->pSetEdit->getEditFormat($field); if ($editFormat == EDIT_FORMAT_TEXT_FIELD && IsDateFieldType($this->pSetEdit->getFieldType($field))) { $editFormat = EDIT_FORMAT_DATE; } if ($this->pageType == PAGE_SEARCH || $this->pageType == PAGE_LIST) { // Text field may be Lookup field on some page $pageTypebyLookupFormat = $this->pSetEdit->getPageTypeByFieldEditFormat($field, EDIT_FORMAT_LOOKUP_WIZARD); if ($editFormat == EDIT_FORMAT_TEXT_FIELD && $pageTypebyLookupFormat != "") { $localPSet = new ProjectSettings($this->pSetEdit->_table, $pageTypebyLookupFormat); if ($localPSet->getLinkField($field) != $localPSet->getDisplayField($field)) { $className = "LookupTextField"; } else { $className = $cTypes->forSearch[$editFormat]; } } else { $className = $cTypes->forSearch[$editFormat]; } } else { $className = $cTypes->forEdit[$editFormat]; } if ($className == $cTypes->forEdit[EDIT_FORMAT_FILE] && $this->pSetEdit->isBasicUploadUsed($field)) { $className = "FileFieldSingle"; } if (!$className) { if ($editFormat != "") { $className = "Edit" . $editFormat; $userControl = true; include_once getabspath("classes/controls/UserControl.php"); if (!is_null($this->pageObject)) { $this->pageObject->AddJSFile("include/runnerJS/controls/" . $className . ".js", "include/runnerJS/Control.js"); } } else { $className = $cTypes->forEdit[EDIT_FORMAT_TEXT_FIELD]; } } $this->controls[$field] = createControlClass($className, $field, $this->pageObject != null ? $this->pageObject : $this, $id, $this->connection); $this->controls[$field]->container = $this; if ($userControl) { $this->controls[$field]->format = $className; $this->controls[$field]->initUserControl(); } } if ($id !== "") { $this->controls[$field]->setID($id); } return $this->controls[$field]; }