| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | require_once( dirname(__file__) . '/../common/omconfig.php' );
|
|---|
| 4 | require_once( FS_COMMON_SKIN_DIRECTORY . '/common.php' );
|
|---|
| 5 | require_once( 'includes/config.php' );
|
|---|
| 6 | require_once( 'portlets/portlets.php' );
|
|---|
| 7 |
|
|---|
| 8 | class OmCollabExplore {
|
|---|
| 9 |
|
|---|
| 10 | protected $sAction;
|
|---|
| 11 | protected $aOmCollabAppUrls;
|
|---|
| 12 | protected $sGoogleSearchHtml;
|
|---|
| 13 | protected $sGoogleAnalyticsJs;
|
|---|
| 14 |
|
|---|
| 15 | public function __construct( $sPathInfo
|
|---|
| 16 | , $aOmCollabAppUrls ){
|
|---|
| 17 |
|
|---|
| 18 | @list( $sUrl, $sAction ) = isset( $sPathInfo ) ? explode('/', $sPathInfo ) : NULL;
|
|---|
| 19 | $this->sAction = $sAction;
|
|---|
| 20 | $this->aOmCollabAppUrls = $aOmCollabAppUrls;
|
|---|
| 21 | $this->Execute();
|
|---|
| 22 |
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | public function Execute(){
|
|---|
| 26 |
|
|---|
| 27 | switch( strtolower( $this->sAction ) ){
|
|---|
| 28 | case 'search': //display results
|
|---|
| 29 | $this->sGoogleSearchHtml = file_get_contents( 'includes/templates/GoogleSearchResults.html' );
|
|---|
| 30 | break;
|
|---|
| 31 |
|
|---|
| 32 | default: // search form
|
|---|
| 33 | $this->sGoogleSearchHtml = file_get_contents( 'includes/templates/GoogleSearchForm.html' );
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | $aGoogleSearchPlaceholders = array( 'omcollab_installation_dir' => RR_OMCOLLAB_DIRECTORY
|
|---|
| 37 | , 'omcollab_google_cse_code' => OMCOLLAB_GOOGLE_CSE_CODE
|
|---|
| 38 | , 'omcollab_google_cse_code_e' => urlencode(OMCOLLAB_GOOGLE_CSE_CODE)
|
|---|
| 39 | , 'omcollab_google_cse_forid' => OMCOLLAB_GOOGLE_CSE_FORID );
|
|---|
| 40 |
|
|---|
| 41 | foreach( $aGoogleSearchPlaceholders as $sPlaceholder => $sValue ){
|
|---|
| 42 | $this->sGoogleSearchHtml = str_replace( '{' . $sPlaceholder .'}', $sValue, $this->sGoogleSearchHtml );
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | if( OMCOLLAB_GOOGLE_ANALYTICS != '' ){
|
|---|
| 46 | $this->sGoogleAnalyticsJs = str_replace( '{omCollabGoogleAnalyticsJs}'
|
|---|
| 47 | , OMCOLLAB_GOOGLE_ANALYTICS
|
|---|
| 48 | , file_get_contents( 'includes/templates/GoogleAnalyticsCode.html' ) );
|
|---|
| 49 | }
|
|---|
| 50 |
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | public function Show(){
|
|---|
| 54 |
|
|---|
| 55 | $sTemplate = file_get_contents( 'includes/templates/ExploreMainWrapper.html' );
|
|---|
| 56 |
|
|---|
| 57 | #you can force the portlet order
|
|---|
| 58 | #specify: 1 (alpha asc), 0 (alpha desc) or
|
|---|
| 59 | #an array of portlet basenames in the order their display is required
|
|---|
| 60 | #You can also just specify the first n portlets in that array, and subsequent
|
|---|
| 61 | #portlets will be alpha asc
|
|---|
| 62 |
|
|---|
| 63 | $oSidebarPortlets = new Portlets( 'Sidebar' );
|
|---|
| 64 | $oSidebarPortlets ->SetPortletDisplayOrder( array( 'Profile') ); //display 'Profile' first; others in alpha asc order
|
|---|
| 65 | $sSidebarPortlets = $oSidebarPortlets->Show();
|
|---|
| 66 |
|
|---|
| 67 | $oFooterPortlets = new Portlets( 'Footer' );
|
|---|
| 68 | $oFooterPortlets -> SetPortletDisplayOrder( array( 'CommunityExplorer', 'SocialProfile','TagCloud' ) ); //display in specific order
|
|---|
| 69 | $sFooterPortlets = $oFooterPortlets->Show();
|
|---|
| 70 |
|
|---|
| 71 | $aPlaceholders = array( 'GoogleSearchHtml' => $this->sGoogleSearchHtml
|
|---|
| 72 | , 'GoogleAnalyticsJs' => $this->sGoogleAnalyticsJs
|
|---|
| 73 | , 'omCollabInstallationDirectory' => RR_OMCOLLAB_DIRECTORY
|
|---|
| 74 | , 'omExploreApplicationName' => OMEXPLORE_APPLICATION_NAME
|
|---|
| 75 | , 'omCollabCommonHeader' => $this->_GetOmCollabCommonHeader()
|
|---|
| 76 | , 'omCollabCommonFooter' => $this->_GetOmCollabCommonFooter()
|
|---|
| 77 | , 'CommonSkinDirectory' => RR_COMMON_SKIN_DIRECTORY
|
|---|
| 78 | , 'SidebarPortlets' => $sSidebarPortlets
|
|---|
| 79 | , 'FooterPortlets' => $sFooterPortlets
|
|---|
| 80 | , 'WikiUrl' => $this->aOmCollabAppUrls[WIKI]
|
|---|
| 81 | , 'BlogsUrl' => $this->aOmCollabAppUrls[BLOGS]
|
|---|
| 82 | , 'BookmarkUrl' => $this->aOmCollabAppUrls[BOOKMARKS]
|
|---|
| 83 | , 'SearchUrl' => $this->aOmCollabAppUrls[EXPLORE]
|
|---|
| 84 | , 'siteurl' => RR_OMCOLLAB_DIRECTORY );
|
|---|
| 85 |
|
|---|
| 86 | foreach( $aPlaceholders as $sPlaceholder => $sValue ){
|
|---|
| 87 | $sTemplate = str_replace( '{' . $sPlaceholder .'}', $sValue, $sTemplate );
|
|---|
| 88 | }
|
|---|
| 89 | echo $sTemplate;
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|
| 92 | private function _GetOmCollabCommonHeader(){
|
|---|
| 93 | ob_start();
|
|---|
| 94 | include_once FS_COMMON_SKIN_DIRECTORY . '/header.php';
|
|---|
| 95 | $sHtml = ob_get_contents();
|
|---|
| 96 | ob_end_clean();
|
|---|
| 97 | return $sHtml;
|
|---|
| 98 | }
|
|---|
| 99 |
|
|---|
| 100 | private function _GetOmCollabCommonFooter(){
|
|---|
| 101 | ob_start();
|
|---|
| 102 | include_once FS_COMMON_SKIN_DIRECTORY . '/footer.php';
|
|---|
| 103 | $sHtml = ob_get_contents();
|
|---|
| 104 | ob_end_clean();
|
|---|
| 105 | return $sHtml;
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | }
|
|---|
| 109 |
|
|---|
| 110 | $oOmCollabExplore = new OmCollabExplore( isset($_SERVER['PATH_INFO'])?$_SERVER['PATH_INFO']:NULL
|
|---|
| 111 | , $omCollabAppURLs );
|
|---|
| 112 |
|
|---|
| 113 | $oOmCollabExplore->Show();
|
|---|
| 114 |
|
|---|
| 115 | ?> |
|---|