Пример #1
0
 function RunnerPage(&$params)
 {
     global $locale_info, $cCharset, $page_layouts;
     // copy properties to object
     RunnerApply($this, $params);
     $this->setTableConnection();
     $this->pSet = new ProjectSettings($this->tName, $this->pageType);
     $this->pSetEdit = $this->pSet;
     $this->pSetSearch = new ProjectSettings($this->tName, PAGE_SEARCH);
     $this->searchTableName = $this->tName;
     $this->assignCipherer();
     include_once getabspath("classes/controls/EditControlsContainer.php");
     $this->controls = new EditControlsContainer($this, $this->pSetEdit, $this->pageType);
     include_once getabspath("classes/controls/ViewControlsContainer.php");
     $this->viewControls = new ViewControlsContainer($this->pSet, $this->pageType, $this);
     $this->gQuery = $this->pSet->getSQLQuery();
     //set google map configuration
     $this->googleMapCfg = array('isUseMainMaps' => false, 'isUseFieldsMaps' => false, 'isUseGoogleMap' => false, 'APIcode' => GetGlobalData("apiGoogleMapsCode", ""), 'mainMapIds' => array(), 'fieldMapsIds' => array(), 'mapsData' => array());
     $this->debugJSMode = false;
     if ($this->flyId < $this->id + 1) {
         $this->flyId = $this->id + 1;
     }
     // get permissions
     if ($this->tName) {
         $this->permis[$this->tName] = $this->getPermissions();
         $this->eventsObject =& getEventObject($this->tName);
     }
     if (!$this->sessionPrefix) {
         $this->assignSessionPrefix();
     }
     $this->isDisplayLoading = $this->pSet->displayLoading();
     //init settingMap globalSettings
     $this->settingsMap["globalSettings"] = array();
     $this->settingsMap["globalSettings"]["shortTNames"] = array();
     $this->searchPanelActivated = $this->checkIfSearchPanelActivated(isMobile());
     //global settings including "shortTNames" might be updated
     $this->setParamsForSearchPanel();
     $this->searchSavingEnabled = $this->isSearchSavingEnabled() && $this->needSearchClauseObj;
     $this->setSessionVariables();
     //	get locking object
     $this->lockingObj = GetLockingObject($this->tName);
     $this->warnLeavingPages = $this->pSet->warnLeavingPages();
     $this->is508 = isEnableSection508();
     $this->isUseVideo = $this->pSet->isUseVideo();
     $this->strCaption = GetTableCaption(GoodFieldName($this->tName));
     $this->tableType = $this->pSet->getTableType();
     $this->isAddWebRep = GetGlobalData("isAddWebRep", false);
     //	get details keys by master table
     $this->detailKeysByM = $this->getDetailKeysByMasterTable();
     $this->isDynamicPerm = GetGlobalData("isDynamicPerm", false);
     $this->shortTableName = $this->pSet->getShortTableName();
     $this->isResizeColumns = $this->pSet->isResizeColumns();
     $this->isUseAjaxSuggest = $this->pSetSearch->isUseAjaxSuggest();
     $this->useDetailsPreview = $this->pSet->isUseDetailsPreview();
     $this->isShowDetailTables = displayDetailsOn($this->tName, $this->pageType);
     //	get all details table for current table
     $this->allDetailsTablesArr = $this->pSet->getDetailTablesArr();
     //	set template file
     $this->setTemplateFile();
     //	init jsSettings
     $this->jsSettings = array();
     $this->jsSettings["tableSettings"] = array();
     $this->jsSettings["tableSettings"][$this->tName] = array();
     $this->jsSettings["tableSettings"][$this->tName]["proxy"] = array("proxy" => "");
     $this->jsSettings["tableSettings"][$this->tName]['fieldSettings'] = array();
     $this->settingsMap["globalSettings"]["webRootPath"] = GetWebRootPath();
     $this->settingsMap["globalSettings"]["ext"] = "php";
     $this->settingsMap["globalSettings"]["charSet"] = $cCharset;
     $this->settingsMap["globalSettings"]["debugMode"] = $this->debugJSMode;
     $this->settingsMap["globalSettings"]["googleMapsApiCode"] = $this->googleMapCfg['APIcode'];
     $this->settingsMap["globalSettings"]["shortTNames"][$this->tName] = $this->shortTableName;
     $globalPopupPagesLayoutNames = GetGlobalData("popupPagesLayoutNames", array());
     if (count($globalPopupPagesLayoutNames)) {
         $this->settingsMap["globalSettings"]["popupPagesLayoutNames"] = $globalPopupPagesLayoutNames;
     }
     //isMobile
     $this->settingsMap["globalSettings"]["isMobile"] = isMobile();
     $this->settingsMap["globalSettings"]["mobileDeteced"] = detectMobileDevice();
     // s508 must be in global settings
     $this->settingsMap['globalSettings']['s508'] = $this->is508;
     $this->settingsMap["globalSettings"]["locale"] = array();
     $this->settingsMap["globalSettings"]["locale"]["dateFormat"] = $locale_info["LOCALE_IDATE"];
     $this->settingsMap["globalSettings"]["locale"]["startWeekDay"] = $locale_info["LOCALE_IFIRSTDAYOFWEEK"];
     $this->settingsMap["globalSettings"]["locale"]["dateDelimiter"] = $locale_info["LOCALE_SDATE"];
     $this->settingsMap["tableSettings"] = array();
     $this->settingsMap['tableSettings']['hasEvents'] = array("default" => false, "jsName" => "hasEvents");
     $this->settingsMap["tableSettings"]["strCaption"] = array("default" => "", "jsName" => "strCaption");
     $this->settingsMap["tableSettings"]["isUseAudio"] = array("default" => false, "jsName" => "isUseAudio");
     //fix it
     $this->settingsMap["tableSettings"]["isUseVideo"] = array("default" => false, "jsName" => "isUseVideo");
     $this->settingsMap['tableSettings']['listGridLayout'] = array("default" => gltHORIZONTAL, "jsName" => "listGridLayout");
     $this->settingsMap["tableSettings"]["rowHighlite"] = array("default" => false, "jsName" => "isUseHighlite");
     $this->settingsMap["tableSettings"]["isUseToolTips"] = array("default" => false, "jsName" => "isUseToolTips");
     $this->settingsMap['tableSettings']['recsPerRowList'] = array("default" => 1, "jsName" => "recsPerRowList");
     $this->settingsMap["tableSettings"]["showAddInPopup"] = array("default" => false, "jsName" => "showAddInPopup");
     $this->settingsMap["tableSettings"]["showEditInPopup"] = array("default" => false, "jsName" => "showEditInPopup");
     $this->settingsMap["tableSettings"]["showViewInPopup"] = array("default" => false, "jsName" => "showViewInPopup");
     $this->settingsMap["tableSettings"]["isResizeColumns"] = array("default" => false, "jsName" => "isUseResize");
     $this->settingsMap["tableSettings"]["useDetailsPreview"] = array("default" => false, "jsName" => "isUseDP");
     $this->settingsMap['tableSettings']['isUsebuttonHandlers'] = array("default" => false, "jsName" => "isUseButtons");
     //if the Search panel added to the non table based page ajax suggests should be configured according to the search table's settings
     $ajaxSuggestDefault = $this->tableBasedSearchPanelAdded ? !$this->isUseAjaxSuggest : true;
     $this->settingsMap["tableSettings"]["isUseAjaxSuggest"] = array("default" => $ajaxSuggestDefault, "jsName" => "ajaxSuggest");
     if ($this->pageType == PAGE_REGISTER || $this->pageType == PAGE_CHANGEPASS) {
         $this->pageLayout = GetPageLayout('', $this->pageType);
     } else {
         $this->pageLayout = GetPageLayout($this->shortTableName, $this->pageType);
     }
     if ($this->pageLayout) {
         $this->jsSettings['tableSettings'][$this->tName]['pageSkinStyle'] = array();
         $this->jsSettings['tableSettings'][$this->tName]['pageSkinStyle'][$this->pageType] = $this->pageLayout->style . " page-" . $this->pageLayout->name;
         $this->AddCSSFile($this->pageLayout->getCSSFiles(isRTL(), isPageLayoutMobile($this->templatefile)));
     }
     $this->controlsMap["oldLayout"] = $this->isOldLayout();
     $this->controlsMap["layoutName"] = $this->getLayoutName();
     $this->settingsMap["fieldSettings"] = array();
     $this->settingsMap["fieldSettings"]["UseTimestamp"] = array("default" => false, "jsName" => "isUseTimeStamp");
     $this->settingsMap["fieldSettings"]["strName"] = array("default" => "", "jsName" => "strName");
     $this->settingsMap["fieldSettings"]["ShowTime"] = array("default" => false, "jsName" => "showTime");
     $this->settingsMap["fieldSettings"]["EditFormat"] = array("default" => "", "jsName" => "editFormat");
     $this->settingsMap["fieldSettings"]["DateEditType"] = array("default" => EDIT_DATE_SIMPLE, "jsName" => "dateEditType");
     $this->settingsMap["fieldSettings"]["RTEType"] = array("default" => "", "jsName" => "RTEType");
     $this->settingsMap["fieldSettings"]["ViewFormat"] = array("default" => "", "jsName" => "viewFormat");
     $this->settingsMap["fieldSettings"]["validateAs"] = array("default" => null, "jsName" => "validation");
     $this->settingsMap["fieldSettings"]["strEditMask"] = array("default" => null, "jsName" => "mask");
     $this->settingsMap["fieldSettings"]["LastYearFactor"] = array("default" => 10, "jsName" => "lastYear");
     $this->settingsMap["fieldSettings"]["InitialYearFactor"] = array("default" => 100, "jsName" => "initialYear");
     $this->settingsMap["fieldSettings"]["ShowListOfThumbnails"] = array("default" => false, "jsName" => "showListOfThumbnails");
     $this->settingsMap["fieldSettings"]["ImageWidth"] = array("default" => 0, "jsName" => "imageWidth");
     $this->settingsMap["fieldSettings"]["ImageHeight"] = array("default" => 0, "jsName" => "imageHeight");
     $this->jsSettings["tableSettings"][$this->tName]["strCaption"] = $this->strCaption;
     $this->jsSettings["tableSettings"][$this->tName]["pageMode"] = $this->mode;
     if ($this->listAjax) {
         $this->jsSettings['tableSettings'][$this->tName]['pageMode'] = LIST_AJAX;
     }
     if ($this->lockingObj) {
         $this->jsSettings['tableSettings'][$this->tName]['locking'] = true;
     }
     if ($this->warnLeavingPages && ($this->pageType == PAGE_REGISTER || $this->pageType == PAGE_ADD || $this->pageType == PAGE_EDIT)) {
         $this->jsSettings['tableSettings'][$this->tName]['warnOnLeaving'] = true;
     }
     //If current table has detail tables
     if (count($this->allDetailsTablesArr)) {
         if ($this->pageType == PAGE_LIST) {
             $this->jsSettings['tableSettings'][$this->tName]['detailTables'] = array();
         }
         $this->jsSettings['tableSettings'][$this->tName]['isShowDetails'] = $this->isShowDetailTables;
         for ($i = 0; $i < count($this->allDetailsTablesArr); $i++) {
             $this->settingsMap["globalSettings"]['shortTNames'][$this->allDetailsTablesArr[$i]['dDataSourceTable']] = $this->allDetailsTablesArr[$i]['dShortTable'];
             if ($this->pageType == PAGE_LIST || $this->pageType == PAGE_REPORT || $this->pageType == PAGE_CHART) {
                 unset($_SESSION[$this->allDetailsTablesArr[$i]['dDataSourceTable'] . '_advsearch']);
                 $dPermission = $this->getPermissions($this->allDetailsTablesArr[$i]['dDataSourceTable']);
                 if ($dPermission["search"]) {
                     $this->jsSettings['tableSettings'][$this->tName]['detailTables'][$this->allDetailsTablesArr[$i]['dDataSourceTable']] = array('pageType' => $this->allDetailsTablesArr[$i]['dType'], 'dispChildCount' => $this->allDetailsTablesArr[$i]['dispChildCount'], 'hideChild' => $this->allDetailsTablesArr[$i]['hideChild'], 'listShowType' => $this->allDetailsTablesArr[$i]['previewOnList'], 'addShowType' => $this->allDetailsTablesArr[$i]['previewOnAdd'], 'editShowType' => $this->allDetailsTablesArr[$i]['previewOnEdit'], 'viewShowType' => $this->allDetailsTablesArr[$i]['previewOnView']);
                 }
                 if ($this->allDetailsTablesArr[$i]['previewOnList'] == DP_POPUP) {
                     $this->jsSettings['tableSettings'][$this->tName]['isUsePopUp'] = true;
                 }
                 // field names of master keys of current table for passed details table name
                 $this->masterKeysByD[$i] = $this->allDetailsTablesArr[$i]['masterKeys'];
             }
         }
         if (($this->pageType == PAGE_ADD || $this->pageType == PAGE_EDIT) && $this->isShowDetailTables) {
             $this->controlsMap["dControlsMap"] = array();
         }
     }
     $this->controlsMap["video"] = array();
     $this->controlsMap['toolTips'] = array();
     $this->addLookupSettings();
     $this->addMultiUploadSettings();
     $this->controlsMap["searchPanelActivated"] = $this->searchPanelActivated;
     if ($this->pageType != PAGE_LIST || $this->mode != LIST_DETAILS) {
         $this->controlsMap["controls"] = array();
         if (!($this->pageType == PAGE_ADD && $this->mode == ADD_INLINE) && !($this->pageType == PAGE_EDIT && $this->mode == EDIT_INLINE)) {
             $allSearchFields = $this->pSetSearch->getAllSearchFields();
             $this->controlsMap["search"] = array();
             $this->controlsMap["search"]["searchBlocks"] = array();
             $this->controlsMap["search"]["allSearchFields"] = $allSearchFields;
             $this->controlsMap["search"]["allSearchFieldsLabels"] = $this->getSearchFieldsLabels($allSearchFields);
             $this->controlsMap["search"]["panelSearchFields"] = $this->pSetSearch->GetPanelSearchFields();
             $this->controlsMap["search"]["googleLikeFields"] = $this->pSetSearch->getGoogleLikeFields();
             $this->controlsMap["search"]["inflexSearchPanel"] = !$this->pSetSearch->isFlexibleSearch();
             $this->controlsMap["search"]["requiredSearchFields"] = $this->pSetSearch->getSearchRequiredFields();
             $this->controlsMap["search"]["isSearchRequired"] = $this->pSetSearch->noRecordsOnFirstPage();
             $this->controlsMap["search"]["searchTableName"] = $this->searchTableName;
             $this->controlsMap["search"]["shortSearchTableName"] = $this->pSetSearch->getShortTableName();
             if ($this->pageType != PAGE_SEARCH) {
                 $this->controlsMap["search"]["submitPageType"] = $this->pageType;
             } else {
                 if (postvalue("rname")) {
                     $this->controlsMap["search"]["submitPageType"] = "dreport";
                     $this->controlsMap["search"]["baseParams"]["rname"] = postvalue("rname");
                     if ($_SESSION["crossLink"]) {
                         if (substr($_SESSION["crossLink"], 0, 1) == "&") {
                             $_SESSION["crossLink"] = substr($_SESSION["crossLink"], 1);
                         }
                         $alink = explode("&", $_SESSION["crossLink"]);
                         foreach ($alink as $param) {
                             $arrtmp = explode("=", $param);
                             $this->controlsMap["search"]["baseParams"][$arrtmp[0]] = $arrtmp[1];
                         }
                     }
                 } elseif (postvalue("cname")) {
                     $this->controlsMap["search"]["submitPageType"] = "dchart";
                     $this->controlsMap["search"]["baseParams"]["cname"] = postvalue("cname");
                 } else {
                     $this->controlsMap["search"]["submitPageType"] = $this->tableType;
                 }
             }
         }
     }
     $this->isUseToolTips = $this->isUseToolTips || $this->pSet->isUseToolTips();
     $this->googleMapCfg["APIcode"] = "";
     $this->processMasterKeyValue();
     $this->assignSearchLogger();
 }
Пример #2
0
function showButtons($filenameWithoutExtension, $podcast_filetype, $url, $upload_dir, $recent_count, $absolutePathEpisode, $enablestreaming)
{
    $buttonsOutput = '<p>';
    //// Button "More" - in the permalink it is not show (no numeric var passed)
    if (is_numeric($recent_count)) {
        $buttonsOutput .= '<a class="btn btn-default" href="?name=' . urlencode($filenameWithoutExtension) . '.' . $podcast_filetype . '"><i class="fa fa-search"></i> ' . _("More") . '</a>&nbsp;&nbsp;';
    }
    //// Button Watch (takes into account $enablestreaming from config.php)
    $browserAudioVideoSupport = detectModernBrowser();
    if ($enablestreaming == "yes" and isItAvideo($podcast_filetype) == TRUE and $browserAudioVideoSupport[1] == TRUE and !detectMobileDevice()) {
        //javascript:; is added as an empty link for href
        $buttonsOutput .= '<a href="javascript:;" class="btn btn-default"  onclick="$(\'#videoPlayer' . $recent_count . '\').fadeToggle();$(this).css(\'font-weight\',\'bold\');"><i class="fa fa-youtube-play"></i> ' . _("Watch") . '</a>&nbsp;&nbsp;';
    }
    //// Button download
    //Download button doesn't appear for episodes with future publication date (security reasons)
    if (!publishInFuture($absolutePathEpisode)) {
        //iOS device has been reported having some trouble downloading episode using the "download.php" forced download...
        if (!detectMobileDevice()) {
            //show button (FORCED) download using download.php
            $buttonsOutput .= '<a class="btn btn-default" href="' . $url . 'download.php?filename=' . urlencode($filenameWithoutExtension) . '.' . $podcast_filetype . '"><i class="fa fa-download"></i> ' . _("Download") . '</a>';
        } else {
            // SHOW BUTTON DOWNLOAD THAT links directly to the file (so no problems with PHP forcing headers)
            //Write "watch" or "listen" in mobile devices.
            if (isItAvideo($podcast_filetype) == TRUE) {
                $buttonsOutput .= '<a class="btn btn-default" 			href="' . $url . $upload_dir . urlencode($filenameWithoutExtension) . '.' . $podcast_filetype . '"><i class="fa fa-youtube-play"></i> 	' . _("Watch") . '</a>';
            } else {
                if ($podcast_filetype == "mp3" or $podcast_filetype == "m4a") {
                    $buttonsOutput .= '<a class="btn btn-default" 			href="' . $url . $upload_dir . urlencode($filenameWithoutExtension) . '.' . $podcast_filetype . '"><i class="fa fa-play"></i> 	' . _("Listen") . '</a>';
                } else {
                    $buttonsOutput .= '<a class="btn btn-default" href="' . $url . $upload_dir . urlencode($filenameWithoutExtension) . '.' . $podcast_filetype . '"><i class="fa fa-download"></i> 	' . _("Download") . '</a>';
                }
            }
        }
    }
    $buttonsOutput .= '</p>';
    return $buttonsOutput;
}