Example #1
0
 function DisplayBareProperties(WebPage $oPage, $bEditMode = false, $sPrefix = '', $aExtraParams = array())
 {
     $aFieldsMap = parent::DisplayBareProperties($oPage, $bEditMode, $sPrefix, $aExtraParams);
     if (!$bEditMode) {
         $sUrl = utils::GetAbsoluteUrlAppRoot() . 'webservices/export-v2.php?format=spreadsheet&login_mode=basic&query=' . $this->GetKey();
         $sOql = $this->Get('oql');
         $sMessage = null;
         try {
             $oSearch = DBObjectSearch::FromOQL($sOql);
             $aParameters = $oSearch->GetQueryParams();
             foreach ($aParameters as $sParam => $val) {
                 $sUrl .= '&arg_' . $sParam . '=["' . $sParam . '"]';
             }
             $oPage->p(Dict::S('UI:Query:UrlForExcel') . ':<br/><textarea cols="80" rows="3" READONLY>' . $sUrl . '</textarea>');
             if (count($aParameters) == 0) {
                 $oBlock = new DisplayBlock($oSearch, 'list');
                 $aExtraParams = array('table_id' => 'query_preview_' . $this->getKey());
                 $sBlockId = 'block_query_preview_' . $this->GetKey();
                 // make a unique id (edition occuring in the same DOM)
                 $oBlock->Display($oPage, $sBlockId, $aExtraParams);
             }
         } catch (OQLException $e) {
             $sMessage = '<div class="message message_error" style="padding-left: 30px;"><div style="padding: 10px;">' . Dict::Format('UI:RunQuery:Error', $e->getHtmlDesc()) . '</div></div>';
             $oPage->p($sMessage);
         }
     }
     return $aFieldsMap;
 }