示例#1
2
 /**
  * Static function for create list page
  * Read params from setting 
  * Create object of class in accordance with mode displaying page
  * @param String strTableName
  * @param Array options
  */
 static function &createListPage($strTableName, $options)
 {
     global $isGroupSecurity;
     $gSettings = new ProjectSettings($strTableName, $options['pageType']);
     $gQuery = $gSettings->getSQLQuery();
     $params = $options;
     $params['tName'] = $strTableName;
     $params['origTName'] = $gSettings->getOriginalTableName();
     $params['gPageSize'] = $gSettings->getInitialPageSize();
     $params['gOrderIndexes'] = $gSettings->getOrderIndexes();
     $params['gstrOrderBy'] = $gQuery->OrderByToSql();
     $params['gsqlHead'] = $gQuery->HeadToSql();
     $params['gsqlFrom'] = $gQuery->FromToSql();
     $params['gsqlWhereExpr'] = $gQuery->WhereToSql();
     $params['gsqlGroupBy'] = $gQuery->GroupByToSql();
     $params['gsqlHaving'] = $gQuery->Having()->toSql($gQuery);
     $params['nSecOptions'] = $gSettings->getAdvancedSecurityType();
     $params['nLoginMethod'] = GetGlobalData("nLoginMethod", 0);
     $params['recsPerRowList'] = isMobile() ? 1 : $gSettings->getRecordsPerRowList();
     $params['mainTableOwnerID'] = $gSettings->getTableOwnerIdField();
     $params['exportTo'] = $gSettings->hasExportPage();
     $params['printFriendly'] = $gSettings->hasPrintPage();
     $params['deleteRecs'] = $gSettings->hasDelete();
     $params["isGroupSecurity"] = $isGroupSecurity;
     $params['arrKeyFields'] = $gSettings->getTableKeys();
     $params["isUseInlineAdd"] = $gSettings->hasInlineAdd();
     $params["isUseInlineEdit"] = $gSettings->hasInlineEdit();
     $params["panelSearchFields"] = $gSettings->getPanelSearchFields();
     $params['listGridLayout'] = $gSettings->getListGridLayout();
     $params['createLoginPage'] = GetGlobalData("createLoginPage", false);
     $params['noRecordsFirstPage'] = $gSettings->noRecordsOnFirstPage();
     $params['totalsFields'] = $gSettings->getTotalsFields();
     $params['listAjax'] = $gSettings->ajaxBasedListPage();
     $params['arrRecsPerPage'] = $gSettings->getRecordsPerPageArray();
     $params['isScrollGridBody'] = $gSettings->getScrollGridBody();
     $params['viewPDF'] = $gSettings->isViewPagePDF() || $gSettings->isPrinterPagePDF();
     $params['audit'] = GetAuditObject($table);
     $params['listFields'] = array();
     $allfields = $gSettings->getListFields();
     foreach ($allfields as $f) {
         if (!$gSettings->appearOnListPage($f)) {
             continue;
         }
         $params['listFields'][] = array("fName" => $f, "goodFieldName" => GoodFieldName($f), "valueFieldName" => GoodFieldName($f) . "_value", "viewFormat" => $gSettings->getViewFormat($f), "editFormat" => $gSettings->getEditFormat($f));
     }
     // choose class by mode
     if ($params["mode"] == LIST_SIMPLE) {
         $pageObject = new ListPage_Simple($params);
     } else {
         if ($params["mode"] == LIST_AJAX) {
             $pageObject = new ListPage_Ajax($params);
         } else {
             if ($params["mode"] == LIST_LOOKUP) {
                 $pageObject = new ListPage_Lookup($params);
             } else {
                 if ($params["mode"] == LIST_DETAILS || $params["mode"] == LIST_DASHDETAILS) {
                     $pageObject = new ListPage_DPInline($params);
                 } else {
                     if ($params["mode"] == RIGHTS_PAGE) {
                         $pageObject = new RightsPage($params);
                     } else {
                         if ($params["mode"] == MEMBERS_PAGE) {
                             $pageObject = new MembersPage($params);
                         } else {
                             if ($params["mode"] == LIST_DASHBOARD) {
                                 $pageObject = new ListPage_Dashboard($params);
                             }
                         }
                     }
                 }
             }
         }
     }
     $pageObject->init();
     return $pageObject;
 }
示例#2
0
    $field = GoodFieldName($dashFields[$field][0]["field"]);
    if (!checkTableName($table)) {
        exit(0);
    }
    require_once "include/" . $table . "_variables.php";
    $cipherer = new RunnerCipherer($strTableName);
    $gSettings = new ProjectSettings($strTableName, $pageType);
}
$hasWhere = false;
$fieldsArr = $gSettings->getFieldsList();
$lwLinkField = '';
$lookupField = '';
$lwDisplayField = '';
$lookupConnection = $cman->getDefault();
foreach ($fieldsArr as $f) {
    $fEditFormat = $gSettings->getEditFormat($f);
    if ($fEditFormat != EDIT_FORMAT_LOOKUP_WIZARD || GoodFieldName($f) != $field) {
        continue;
    }
    $lookupField = $f;
    $LookupType = $gSettings->getLookupType($f);
    if ($LookupType == LT_LOOKUPTABLE || $LookupType == LT_QUERY) {
        $lookupTable = $gSettings->getLookupTable($f);
        if ($LookupType == LT_QUERY) {
            $lookupConnection = $cman->byTable($lookupTable);
        } else {
            $connId = $gSettings->getNotProjectLookupTableConnId($f);
            $lookupConnection = strlen($connId) ? $cman->byId($connId) : $cman->getDefault();
        }
        $linkFieldName = $gSettings->getLinkField($f);
        $displayFieldName = $gSettings->getDisplayField($f);
示例#3
0
 /**
  * Static function for create list page
  * Read params from setting 
  * Create object of class in accordance with mode displaying page 
  */
 function &createListPage($table, $options)
 {
     global $bSubqueriesSupported, $strTableName, $conn, $locale_info, $isGroupSecurity;
     $gSettings = new ProjectSettings($strTableName, $options['pageType']);
     $gQuery = $gSettings->getSQLQuery();
     $params = array();
     $params = $options;
     $params['origTName'] = $gSettings->getOriginalTableName();
     $params['sessionPrefix'] = $strTableName;
     $params['tName'] = $table;
     $params['conn'] =& $conn;
     $params['gPageSize'] = $gSettings->getInitialPageSize();
     $params['gOrderIndexes'] = $gSettings->getOrderIndexes();
     $params['gstrOrderBy'] = $gQuery->OrderByToSql();
     $params['gsqlHead'] = $gQuery->HeadToSql();
     $params['gsqlFrom'] = $gQuery->FromToSql();
     $params['gsqlWhereExpr'] = $gQuery->WhereToSql();
     $params['gsqlGroupBy'] = $gQuery->GroupByToSql();
     $params['gsqlHaving'] = $gQuery->Having()->toSql($gQuery);
     $params['locale_info'] =& $locale_info;
     $params["subQueriesSupp"] = $bSubqueriesSupported;
     $params['nSecOptions'] = $gSettings->getAdvancedSecurityType();
     $params['nLoginMethod'] = GetGlobalData("nLoginMethod", 0);
     $params['recsPerRowList'] = $gSettings->getRecordsPerRowList();
     $params['dbType'] = GetGlobalData("dbType", 0);
     $params['mainTableOwnerID'] = $gSettings->getTableOwnerIdField();
     $params['moveNext'] = $gSettings->useMoveNext();
     $params['exportTo'] = $gSettings->hasExportPage();
     $params['printFriendly'] = $gSettings->hasPrintPage();
     $params['deleteRecs'] = $gSettings->hasDelete();
     $params['rowHighlite'] = $gSettings->highlightRows();
     $params["isGroupSecurity"] = $isGroupSecurity;
     $params['arrKeyFields'] = $gSettings->getTableKeys();
     $params["isUseInlineAdd"] = $gSettings->hasInlineAdd();
     $params["isUseInlineEdit"] = $gSettings->hasInlineEdit();
     $params["isUseInlineJs"] = $params["isUseInlineAdd"] || $params["isUseInlineEdit"];
     $params["panelSearchFields"] = $gSettings->getPanelSearchFields();
     $params['isVerLayout'] = $gSettings->isVerticalLayoutList();
     $params['isDisplayLoading'] = $gSettings->displayLoading();
     $params['createLoginPage'] = GetGlobalData("createLoginPage", false);
     $params['subQueriesSupAccess'] = $gSettings->tableSupportsSubqueries();
     $params['noRecordsFirstPage'] = $gSettings->noRecordsOnFirstPage();
     $params['totalsFields'] = $gSettings->getTotalsFields();
     $params['listIcons'] = $gSettings->iconsOnList();
     $params['edit'] = $gSettings->hasEditPage();
     $params['inlineEdit'] = $gSettings->hasInlineEdit();
     $params['iCopy'] = $gSettings->hasCopyPage();
     $params['iView'] = $gSettings->hasViewPage();
     $params['listAjax'] = $gSettings->ajaxBasedListPage();
     $params['arrRecsPerPage'] = $gSettings->getRecordsPerPageArray();
     $params['isScrollGridBody'] = $gSettings->getScrollGridBody();
     $params['audit'] = GetAuditObject($table);
     $params['listFields'] = array();
     $allfields = $gSettings->getListFields();
     foreach ($allfields as $f) {
         if (!$gSettings->appearOnListPage($f)) {
             continue;
         }
         $params['listFields'][] = array("fName" => $f, "goodFieldName" => GoodFieldName($f), "valueFieldName" => GoodFieldName($f) . "_value", "viewFormat" => $gSettings->getViewFormat($f), "editFormat" => $gSettings->getEditFormat($f));
     }
     // choose class by mode
     if ($params["mode"] == LIST_SIMPLE) {
         $pageObject = new ListPage_Simple($params);
     } else {
         if ($params["mode"] == LIST_AJAX) {
             $pageObject = new ListPage_Ajax($params);
         } else {
             if ($params["mode"] == LIST_LOOKUP) {
                 $pageObject = new ListPage_Lookup($params);
             } else {
                 if ($params["mode"] == LIST_DETAILS) {
                     $pageObject = new ListPage_DPInline($params);
                 } else {
                     if ($params["mode"] == RIGHTS_PAGE) {
                         $pageObject = new RightsPage($params);
                     } else {
                         if ($params["mode"] == MEMBERS_PAGE) {
                             $pageObject = new MembersPage($params);
                         }
                     }
                 }
             }
         }
     }
     return $pageObject;
 }
示例#4
0
function GetInputElementId($field, $id, $ptype)
{
    global $strTableName;
    $pSet = new ProjectSettings($strTableName, $ptype);
    $format = $pSet->getEditFormat($field);
    if ($format == EDIT_FORMAT_DATE) {
        $type = $pSet->getDateEditType($field);
        if ($type == EDIT_DATE_DD || $type == EDIT_DATE_DD_DP) {
            return "dayvalue_" . GoodFieldName($field) . "_" . $id;
        } else {
            return "value_" . GoodFieldName($field) . "_" . $id;
        }
    } else {
        if ($format == EDIT_FORMAT_RADIO) {
            return "radio_" . GoodFieldName($field) . "_" . $id . "_0";
        } else {
            if ($format == EDIT_FORMAT_LOOKUP_WIZARD) {
                $lookuptype = $pSet->LookupControlType($field);
                if ($lookuptype == LCT_AJAX || $lookuptype == LCT_LIST) {
                    return "display_value_" . GoodFieldName($field) . "_" . $id;
                } else {
                    return "value_" . GoodFieldName($field) . "_" . $id;
                }
            } else {
                return "value_" . GoodFieldName($field) . "_" . $id;
            }
        }
    }
}
 function addFieldsSettings($arrFields, $pageBased, $pageType)
 {
     $dashSearchFields = $this->pSet->getDashboardSearchFields();
     foreach ($arrFields as $fieldName) {
         $pSet = new ProjectSettings($dashSearchFields[$fieldName][0]["table"]);
         $tableFieldName = $dashSearchFields[$fieldName][0]["field"];
         if (!array_key_exists($fieldName, $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'])) {
             $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fieldName] = array();
         }
         if (!array_key_exists($pageType, $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fieldName])) {
             $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fieldName][$pageType] = array();
         }
         foreach ($this->settingsMap["fieldSettings"] as $key => $val) {
             $fData = $pSet->getFieldData($tableFieldName, $key);
             if ($key == "validateAs") {
                 if ($pageType == PAGE_ADD || $pageType == PAGE_EDIT || $pageType == PAGE_REGISTER) {
                     $this->fillValidation($fData, $val, $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fieldName][$pageType]);
                 }
                 continue;
             }
             if ($key == "RTEType") {
                 $fData = $pSet->getRTEType($tableFieldName);
                 if ($fData == "RTECK") {
                     $this->isUseCK = true;
                     $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fieldName][$pageType]['nWidth'] = $pSet->getNCols($tableFieldName);
                     $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fieldName][$pageType]['nHeight'] = $pSet->getNRows($tableFieldName);
                 }
             } elseif ($key == "autoCompleteFields") {
                 $fData = $pSet->getAutoCompleteFields($tableFieldName);
             }
             $isDefault = false;
             if (is_array($fData)) {
                 $isDefault = !count($fData);
             } else {
                 if (!is_array($val['default'])) {
                     $isDefault = $fData === $val['default'];
                 }
             }
             if (!$isDefault) {
                 $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fieldName][$pageType][$val['jsName']] = $fData;
             }
         }
         $this->jsSettings['tableSettings'][$this->tName]['isUseCK'] = $this->isUseCK;
         if (count($this->googleMapCfg) != 0 && $this->googleMapCfg['isUseGoogleMap']) {
             $this->jsSettings['tableSettings'][$this->tName]['isUseGoogleMap'] = true;
             $this->jsSettings['tableSettings'][$this->tName]['googleMapCfg'] = $this->googleMapCfg;
         }
         $lookupTableName = $pSet->getLookupTable($tableFieldName);
         if ($lookupTableName) {
             $this->jsSettings['global']['shortTNames'][$lookupTableName] = GetTableURL($lookupTableName);
         }
         if ($pSet->getEditFormat($tableFieldName) == 'Time') {
             $this->fillTimePickSettings($tableFieldName, "", $pSet, $pageType);
         }
     }
 }