/**
  * @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];
 }
Exemple #2
0
 $strCategoryControl = $pageObject->getMainLookupFieldNameForDependant($fName);
 if ($strCategoryControl !== "" && in_array($strCategoryControl, $regFields)) {
     $vals = array($fName => @$values[$fName], $strCategoryControl => @$values[$strCategoryControl]);
 } else {
     $vals = array($fName => @$values[$fName]);
 }
 $preload = $pageObject->fillPreload($fName, $vals);
 if ($preload !== false) {
     $controls["controls"]['preloadData'] = $preload;
 }
 $pageObject->fillControlsMap($controls);
 if ($pageObject->pSet->getEditFormat($fName) == 'Time') {
     $pageObject->fillTimePickSettings($fName, @$values[$fName]);
 }
 // Confirm field for re-enter password
 if ($fName == GetPasswordField() && GetPasswordField() != GetUserNameField()) {
     $parameters = array();
     $parameters["id"] = $id;
     $parameters["mode"] = "add";
     $parameters["field"] = "confirm";
     $parameters["format"] = "Password";
     $parameters["suggest"] = true;
     $parameters["pageObj"] = $pageObject;
     $parameters["validate"]['basicValidate'] = array('IsRequired');
     $parameters["extraParams"] = array();
     $parameters["extraParams"]["isConfirm"] = true;
     $parameters["extraParams"]["getConrirmFieldCtrl"] = true;
     $control1['confirm'] = array();
     AssignFunction($control1['confirm'], "xt_buildeditcontrol", $parameters);
     $controls = array('controls' => array());
     $controls["controls"]['id'] = $id;
Exemple #3
0
 /**
  * Create pasword or confirm field control (if needed)
  * @param {string} field name
  * @intellisense
  */
 function addConfirmFieldControl($field, $id, $isConfirm = false)
 {
     if (!array_key_exists($field, $this->controls)) {
         include_once getabspath("classes/controls/Control.php");
         include_once getabspath("classes/controls/PasswordField.php");
         $this->controls->controls[$field] = new PasswordField($field, $this, $id);
         if ($isConfirm) {
             $this->controls->controls[$field]->field = GetPasswordField();
         }
     }
 }