当前位置: 首页>>代码示例>>PHP>>正文


PHP DBObjectSearch::unserialize方法代码示例

本文整理汇总了PHP中DBObjectSearch::unserialize方法的典型用法代码示例。如果您正苦于以下问题:PHP DBObjectSearch::unserialize方法的具体用法?PHP DBObjectSearch::unserialize怎么用?PHP DBObjectSearch::unserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBObjectSearch的用法示例。


在下文中一共展示了DBObjectSearch::unserialize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ReloadState

 public function ReloadState()
 {
     if ($this->sToken == null) {
         throw new Exception('ExcelExporter not initialized with a token, cannot reload state');
     }
     if (!file_exists($this->GetStateFile())) {
         throw new Exception("ExcelExporter: missing status file '" . $this->GetStateFile() . "', cannot reload state.");
     }
     $sJson = file_get_contents($this->GetStateFile());
     $aState = json_decode($sJson, true);
     if ($aState === null) {
         throw new Exception("ExcelExporter:corrupted status file '" . $this->GetStateFile() . "', not a JSON, cannot reload state.");
     }
     $this->sState = $aState['state'];
     $this->aStatistics = $aState['statistics'];
     $this->oSearch = DBObjectSearch::unserialize($aState['filter']);
     $this->iPosition = $aState['position'];
     $this->iChunkSize = $aState['chunk_size'];
     $this->aObjectsIDs = $aState['object_ids'];
     $this->sOutputFilePath = $aState['output_file_path'];
     $this->bAdvancedMode = $aState['advanced_mode'];
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:22,代码来源:excelexporter.class.inc.php

示例2: UILinksWidget

     // ui.linkswidget
 ////////////////////////////////////////////////////
 // ui.linkswidget
 case 'doAddObjects':
     $oPage->SetContentType('text/html');
     $sAttCode = utils::ReadParam('sAttCode', '');
     $iInputId = utils::ReadParam('iInputId', '');
     $sSuffix = utils::ReadParam('sSuffix', '');
     $sRemoteClass = utils::ReadParam('sRemoteClass', $sClass, false, 'class');
     $bDuplicates = utils::ReadParam('bDuplicates', 'false') == 'false' ? false : true;
     $sJson = utils::ReadParam('json', '', false, 'raw_data');
     $oWizardHelper = WizardHelper::FromJSON($sJson);
     $oObj = $oWizardHelper->GetTargetObject();
     $oWidget = new UILinksWidget($sClass, $sAttCode, $iInputId, $sSuffix, $bDuplicates);
     if ($sFilter != '') {
         $oFullSetFilter = DBObjectSearch::unserialize($sFilter);
     } else {
         $oFullSetFilter = new DBObjectSearch($sRemoteClass);
     }
     $oWidget->DoAddObjects($oPage, $oFullSetFilter, $oObj);
     break;
     ////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////
 case 'wizard_helper_preview':
     $oPage->SetContentType('text/html');
     $sJson = utils::ReadParam('json_obj', '', false, 'raw_data');
     $oWizardHelper = WizardHelper::FromJSON($sJson);
     $oObj = $oWizardHelper->GetTargetObject();
     $oObj->DisplayBareProperties($oPage);
     break;
 case 'wizard_helper':
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:31,代码来源:ajax.render.php

示例3: ApplicationContext

        $oP->EndCollapsibleSection();
    }
}
$sOperation = utils::ReadParam('operation', 'menu');
$oAppContext = new ApplicationContext();
$oP = new iTopWebPage(Dict::S('UI:RunQuery:Title'));
// Main program
$sExpression = utils::ReadParam('expression', '', false, 'raw_data');
$sEncoding = utils::ReadParam('encoding', 'oql');
ShowExamples($oP, $sExpression);
try {
    if ($sEncoding == 'crypted') {
        // Translate $sExpression into a oql expression
        $sClearText = base64_decode($sExpression);
        echo "<strong>FYI: '{$sClearText}'</strong><br/>\n";
        $oFilter = DBObjectSearch::unserialize($sExpression);
        $sExpression = $oFilter->ToOQL();
    } else {
        // leave $sExpression as is
    }
    $oFilter = null;
    $aArgs = array();
    $sSyntaxError = null;
    if (!empty($sExpression)) {
        try {
            $oFilter = DBObjectSearch::FromOQL($sExpression);
        } catch (Exception $e) {
            if ($e instanceof OqlException) {
                $sSyntaxError = $e->getHtmlDesc();
            } else {
                $sSyntaxError = $e->getMessage();
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:31,代码来源:run_query.php

示例4: CheckQuery

 protected function CheckQuery($sQuery, $bIsCorrectQuery)
 {
     if ($bIsCorrectQuery) {
         echo "<h4 style=\"color:green;\">{$sQuery}</h4>\n";
     } else {
         echo "<h4 style=\"color:red;\">{$sQuery}</h3>\n";
     }
     try {
         //$oOql = new OqlInterpreter($sQuery);
         //$oTrash = $oOql->ParseQuery();
         //self::DumpVariable($oTrash, true);
         $oMyFilter = DBObjectSearch::FromOQL($sQuery);
     } catch (OQLException $oOqlException) {
         if ($bIsCorrectQuery) {
             echo "<p>More info on this unexpected failure:<br/>" . $oOqlException->getHtmlDesc() . "</p>\n";
             throw $oOqlException;
             return false;
         } else {
             // Everything is fine :-)
             echo "<p>More info on this expected failure:\n";
             echo "<ul>\n";
             echo "<li>" . get_class($oOqlException) . "</li>\n";
             echo "<li>" . $oOqlException->getMessage() . "</li>\n";
             echo "<li>" . $oOqlException->getHtmlDesc() . "</li>\n";
             echo "</ul>\n";
             echo "</p>\n";
             return true;
         }
     }
     // The query was correctly parsed, was it expected to be correct ?
     if (!$bIsCorrectQuery) {
         throw new UnitTestException("The query '{$sQuery}' was parsed with success, while it shouldn't (?)");
         return false;
     }
     echo "<p>To OQL: " . $oMyFilter->ToOQL() . "</p>";
     $this->search_and_show_list($oMyFilter);
     //echo "<p>first pass<p>\n";
     //self::DumpVariable($oMyFilter, true);
     $sQuery1 = $oMyFilter->MakeSelectQuery();
     //echo "<p>second pass<p>\n";
     //self::DumpVariable($oMyFilter, true);
     //$sQuery1 = $oMyFilter->MakeSelectQuery();
     $sSerialize = $oMyFilter->serialize();
     echo "<p>Serialized:{$sSerialize}</p>\n";
     $oFilter2 = DBObjectSearch::unserialize($sSerialize);
     try {
         $sQuery2 = $oMyFilter2->MakeSelectQuery();
     } catch (Exception $e) {
         echo "<p>Could not compute the query after unserialize</p>\n";
         echo "<p>Query 1: {$sQuery1}</p>\n";
         MyHelpers::var_cmp_html($oMyFilter, $oFilter2);
         throw $e;
     }
     //if ($oFilter2 != $oMyFilter) no, they may differ while the resulting query is the same!
     if ($sQuery1 != $sQuery2) {
         echo "<p>serialize/unserialize mismatch :-(</p>\n";
         MyHelpers::var_cmp_html($sQuery1, $sQuery2);
         MyHelpers::var_cmp_html($oMyFilter, $oFilter2);
         return false;
     }
     return true;
 }
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:62,代码来源:testlist.inc.php

示例5: array

     $oPage->add('<p style="font-size:10pt;margin-left:2em;margin-top:-0.5em;padding-bottom:1em;">' . Dict::S('UI:CSVImport:AdvancedMode+') . '</p>');
     $oPage->add('<p><input type="checkbox" id="export-auto-download" checked="checked"/>&nbsp;<label for="export-auto-download">' . Dict::S('ExcelExport:AutoDownload') . '</label></p>');
     $oPage->add('</div>');
     $oPage->add('<div class="progress"><p class="status-message">' . Dict::S('ExcelExport:PreparingExport') . '</p><div class="progress-bar"><div class="progress-label"></div></div></div>');
     $oPage->add('<div class="statistics"><div class="stats-toggle closed">' . Dict::S('ExcelExport:Statistics') . '<div class="stats-data"></div></div></div>');
     $oPage->add('</div>');
     $aLabels = array('dialog_title' => Dict::S('ExcelExporter:ExportDialogTitle'), 'cancel_button' => Dict::S('UI:Button:Cancel'), 'export_button' => Dict::S('ExcelExporter:ExportButton'), 'download_button' => Dict::Format('ExcelExporter:DownloadButton', 'export.xlsx'));
     $sJSLabels = json_encode($aLabels);
     $sFilter = addslashes($sFilter);
     $sJSPageUrl = addslashes(utils::GetAbsoluteUrlAppRoot() . 'pages/ajax.render.php');
     $oPage->add_ready_script("\$('#XlsxExportDlg').xlsxexporter({filter: '{$sFilter}', labels: {$sJSLabels}, ajax_page_url: '{$sJSPageUrl}'});");
     break;
 case 'xlsx_start':
     $sFilter = utils::ReadParam('filter', '', false, 'raw_data');
     $bAdvanced = utils::ReadParam('advanced', 'false') == 'true';
     $oSearch = DBObjectSearch::unserialize($sFilter);
     $oExcelExporter = new ExcelExporter();
     $oExcelExporter->SetObjectList($oSearch);
     //$oExcelExporter->SetChunkSize(10); //Only for testing
     $oExcelExporter->SetAdvancedMode($bAdvanced);
     $sToken = $oExcelExporter->SaveState();
     $oPage->add(json_encode(array('status' => 'ok', 'token' => $sToken)));
     break;
 case 'xlsx_run':
     $sMemoryLimit = MetaModel::GetConfig()->Get('xlsx_exporter_memory_limit');
     ini_set('memory_limit', $sMemoryLimit);
     ini_set('max_execution_time', max(300, ini_get('max_execution_time')));
     // At least 5 minutes
     $sToken = utils::ReadParam('token', '', false, 'raw_data');
     $oExcelExporter = new ExcelExporter($sToken);
     $aStatus = $oExcelExporter->Run();
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:31,代码来源:ajax.render.php

示例6: FindExporterFromToken

 /**
  * Find the exporter corresponding to the given persistent token
  * @param int $iPersistentToken The identifier of the BulkExportResult object storing the information
  * @return iBulkExport|NULL
  */
 public static function FindExporterFromToken($iPersistentToken = null)
 {
     $oBulkExporter = null;
     $oInfo = MetaModel::GetObject('BulkExportResult', $iPersistentToken, false);
     if ($oInfo && $oInfo->Get('user_id') == UserRights::GetUserId()) {
         $sFormatCode = $oInfo->Get('format');
         $oSearch = DBObjectSearch::unserialize($oInfo->Get('search'));
         $oBulkExporter = self::FindExporter($sFormatCode, $oSearch);
         if ($oBulkExporter) {
             $oBulkExporter->SetFormat($sFormatCode);
             $oBulkExporter->SetObjectList($oSearch);
             $oBulkExporter->SetChunkSize($oInfo->Get('chunk_size'));
             $oBulkExporter->SetStatusInfo(json_decode($oInfo->Get('status_info'), true));
             $oBulkExporter->sTmpFile = $oInfo->Get('temp_file_path');
             $oBulkExporter->oBulkExportResult = $oInfo;
         }
     }
     return $oBulkExporter;
 }
开发者ID:henryavila,项目名称:itop,代码行数:24,代码来源:bulkexport.class.inc.php


注:本文中的DBObjectSearch::unserialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。