mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
🎨 clean warnings and add KPI in ajax.render.php
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
*/
|
||||
|
||||
use Combodo\iTop\Renderer\Console\ConsoleFormRenderer;
|
||||
|
||||
require_once('../approot.inc.php');
|
||||
require_once(APPROOT.'application/application.inc.php');
|
||||
require_once(APPROOT.'application/webpage.class.inc.php');
|
||||
@@ -202,13 +204,13 @@ try
|
||||
$bShowObsoleteData = utils::ShowObsoleteData();
|
||||
}
|
||||
$oSet->SetShowObsoleteData($bShowObsoleteData);
|
||||
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oDataTable = new DataTable($iListId, $oSet, $oSet->GetSelectedClasses());
|
||||
if ($operation == 'datatable')
|
||||
{
|
||||
// Redraw the whole table
|
||||
$sHtml = $oDataTable->UpdatePager($oPage, $iEnd - $iStart, $iStart); // Set the default page size
|
||||
$sHtml .= $oDataTable->GetHTMLTable($oPage, $aColumns, $sSelectMode, $iEnd - $iStart, $bDisplayKey, $aExtraParams);
|
||||
$oDataTable->UpdatePager($oPage, $iEnd - $iStart, $iStart); // Set the default page size
|
||||
$sHtml = $oDataTable->GetHTMLTable($oPage, $aColumns, $sSelectMode, $iEnd - $iStart, $bDisplayKey, $aExtraParams);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -216,6 +218,7 @@ try
|
||||
$sHtml = $oDataTable->GetAsHTMLTableRows($oPage, $iEnd - $iStart, $aColumns, $sSelectMode, $bDisplayKey, $aExtraParams);
|
||||
}
|
||||
$oPage->add($sHtml);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
case 'datatable_save_settings':
|
||||
@@ -276,16 +279,20 @@ try
|
||||
$iInputId = utils::ReadParam('iInputId', '');
|
||||
$sTitle = utils::ReadParam('sTitle', '', false, 'raw_data');
|
||||
$sTargetClass = utils::ReadParam('sTargetClass', '', false, 'class');
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oWidget = new UISearchFormForeignKeys($sTargetClass, $iInputId);
|
||||
$oWidget->ShowModalSearchForeignKeys($oPage, $sTitle);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
// ui.searchformforeignkeys
|
||||
case 'GetFullListForeignKeysFromSelection':
|
||||
$oPage->SetContentType('application/json');
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oWidget = new UISearchFormForeignKeys($sClass);
|
||||
$oFullSetFilter = new DBObjectSearch($sClass);
|
||||
$oWidget->GetFullListForeignKeysFromSelection($oPage, $oFullSetFilter);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
// ui.searchformforeignkeys
|
||||
@@ -294,8 +301,10 @@ try
|
||||
$sTargetClass = utils::ReadParam('sTargetClass', '', false, 'class');
|
||||
$iInputId = utils::ReadParam('iInputId', '');
|
||||
$sRemoteClass = utils::ReadParam('sRemoteClass', '', false, 'class');
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oWidget = new UISearchFormForeignKeys($sTargetClass, $iInputId);
|
||||
$oWidget->ListResultsSearchForeignKeys($oPage, $sRemoteClass);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
|
||||
@@ -326,6 +335,7 @@ try
|
||||
'source_obj' => $oObj
|
||||
);
|
||||
$aAlreadyLinked = utils::ReadParam('aAlreadyLinked', array());
|
||||
/** @var \DBObject $oObj */
|
||||
$oWidget->GetObjectPickerDialog($oPage, $oObj, $sJson, $aAlreadyLinked, $aPrefillFormParam);
|
||||
break;
|
||||
|
||||
@@ -338,8 +348,10 @@ try
|
||||
$sSuffix = utils::ReadParam('sSuffix', '');
|
||||
$bDuplicates = (utils::ReadParam('bDuplicates', 'false') == 'false') ? false : true;
|
||||
$aAlreadyLinked = utils::ReadParam('aAlreadyLinked', array());
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oWidget = new UILinksWidget($sClass, $sAttCode, $iInputId, $sSuffix, $bDuplicates);
|
||||
$oWidget->SearchObjectsToAdd($oPage, $sRemoteClass, $aAlreadyLinked);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
//ui.linksdirectwidget
|
||||
@@ -371,8 +383,10 @@ try
|
||||
$iTempId = utils::ReadParam('tempId', '');
|
||||
$aValues = utils::ReadParam('values', array(), false, 'raw_data');
|
||||
$oPage->SetContentType('text/html');
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oWidget = new UILinksWidgetDirect($sClass, $sAttCode, $iInputId);
|
||||
$oPage->add($oWidget->GetRow($oPage, $sRealClass, $aValues, -$iTempId));
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
// ui.linksdirectwidget
|
||||
@@ -381,6 +395,7 @@ try
|
||||
$sClass = utils::ReadParam('class', '', false, 'class');
|
||||
$aAlreadyLinked = utils::ReadParam('aAlreadyLinked', array());
|
||||
$sJson = utils::ReadParam('json', '', false, 'raw_data');
|
||||
/** @var \DBObject $oObj */
|
||||
$oObj = null;
|
||||
if ($sJson != '')
|
||||
{
|
||||
@@ -400,8 +415,10 @@ try
|
||||
'source_obj' => $oObj,
|
||||
);
|
||||
$aPrefillFormParam['dest_class'] = ($oObj === null ? '' : $oObj->Get($sAttCode)->GetClass());
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oWidget = new UILinksWidgetDirect($sClass, $sAttCode, $iInputId);
|
||||
$oWidget->GetObjectsSelectionDlg($oPage, $oObj, $aAlreadyLinked, $aPrefillFormParam);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
// ui.linksdirectwidget
|
||||
@@ -427,8 +444,10 @@ try
|
||||
'source_obj' => $oObj,
|
||||
);
|
||||
$aPrefillFormParam['dest_class'] = ($oObj === null ? '' : $oObj->Get($sAttCode)->GetClass());
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oWidget = new UILinksWidgetDirect($sClass, $sAttCode, $iInputId);
|
||||
$oWidget->SearchObjectsToAdd($oPage, $sRealClass, $aAlreadyLinked, $oObj, $aPrefillFormParam);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
// ui.linksdirectwidget
|
||||
@@ -462,8 +481,10 @@ try
|
||||
$oFullSetFilter = DBObjectSearch::FromOQL($valuesDef->GetFilterExpression());
|
||||
}
|
||||
}
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oWidget = new UILinksWidgetDirect($sClass, $sAttCode, $iInputId);
|
||||
$oWidget->DoAddObjects($oPage, $oFullSetFilter);
|
||||
$oKPI->ComputeAndReport('Data write');
|
||||
break;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -488,8 +509,10 @@ try
|
||||
// Search form: no current object
|
||||
$oObj = null;
|
||||
}
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oWidget = new UIExtKeyWidget($sTargetClass, $iInputId, $sAttCode, $bSearchMode);
|
||||
$oWidget->SearchObjectsToSelect($oPage, $sFilter, $sRemoteClass, $oObj);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
// ui.extkeywidget: autocomplete
|
||||
@@ -515,8 +538,10 @@ try
|
||||
// Search form: no current object
|
||||
$oObj = null;
|
||||
}
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oWidget = new UIExtKeyWidget($sTargetClass, $iInputId, '', $bSearchMode);
|
||||
$oWidget->AutoComplete($oPage, $sFilter, $oObj, $sContains, $sOutputFormat, $sAutocompleteOperation);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -588,9 +613,11 @@ try
|
||||
$iInputId = utils::ReadParam('iInputId', '');
|
||||
$sFormPrefix = utils::ReadParam('sFormPrefix', '');
|
||||
$sAttCode = utils::ReadParam('sAttCode', '');
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oWidget = new UIExtKeyWidget($sTargetClass, $iInputId, $sAttCode, false);
|
||||
$aResult = $oWidget->DoCreateObject($oPage);
|
||||
echo json_encode($aResult);
|
||||
$oKPI->ComputeAndReport('Data write');
|
||||
break;
|
||||
|
||||
// ui.extkeywidget
|
||||
@@ -600,9 +627,11 @@ try
|
||||
$iInputId = utils::ReadParam('iInputId', '');
|
||||
$iObjectId = utils::ReadParam('iObjectId', '');
|
||||
$bSearchMode = (utils::ReadParam('bSearchMode', 'false') == 'true');
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oWidget = new UIExtKeyWidget($sTargetClass, $iInputId, '', $bSearchMode);
|
||||
$sName = $oWidget->GetObjectName($iObjectId);
|
||||
echo json_encode(array('name' => $sName));
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
// ui.extkeywidget
|
||||
@@ -624,8 +653,10 @@ try
|
||||
// Search form: no current object
|
||||
$oObj = null;
|
||||
}
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oWidget = new UIExtKeyWidget($sTargetClass, $sInputId, '', $bSearchMode);
|
||||
$oWidget->DisplayHierarchy($oPage, $sFilter, $currValue, $oObj);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@@ -641,7 +672,9 @@ try
|
||||
$sJson = utils::ReadParam('json', '', false, 'raw_data');
|
||||
$iMaxAddedId = utils::ReadParam('max_added_id');
|
||||
$oWizardHelper = WizardHelper::FromJSON($sJson);
|
||||
/** @var \DBObject $oObj */
|
||||
$oObj = $oWizardHelper->GetTargetObject();
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oWidget = new UILinksWidget($sClass, $sAttCode, $iInputId, $sSuffix, $bDuplicates);
|
||||
if ($sFilter != '')
|
||||
{
|
||||
@@ -652,6 +685,7 @@ try
|
||||
$oFullSetFilter = new DBObjectSearch($sRemoteClass);
|
||||
}
|
||||
$oWidget->DoAddObjects($oPage, $iMaxAddedId, $oFullSetFilter, $oObj);
|
||||
$oKPI->ComputeAndReport('Data write');
|
||||
break;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -668,6 +702,7 @@ try
|
||||
$oPage->SetContentType('text/html');
|
||||
$sJson = utils::ReadParam('json_obj', '', false, 'raw_data');
|
||||
$oWizardHelper = WizardHelper::FromJSON($sJson);
|
||||
/** @var \DBObject $oObj */
|
||||
$oObj = $oWizardHelper->GetTargetObject();
|
||||
$sClass = $oWizardHelper->GetTargetClass();
|
||||
foreach($oWizardHelper->GetFieldsForDefaultValue() as $sAttCode)
|
||||
@@ -781,10 +816,12 @@ try
|
||||
break;
|
||||
}
|
||||
}
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oDisplayBlock = new DisplayBlock($oFilter, $sStyle, false);
|
||||
$aExtraParams['display_limit'] = true;
|
||||
$aExtraParams['truncated'] = true;
|
||||
$oDisplayBlock->RenderContent($oPage, $aExtraParams);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -795,7 +832,9 @@ try
|
||||
case 'displayCSVHistory':
|
||||
$oPage->SetContentType('text/html');
|
||||
$bShowAll = (utils::ReadParam('showall', 'false') == 'true');
|
||||
$oKPI = new ExecutionKPI();
|
||||
BulkChange::DisplayImportHistory($oPage, true, $bShowAll);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
case 'details':
|
||||
@@ -803,8 +842,10 @@ try
|
||||
$key = utils::ReadParam('id', 0);
|
||||
$oFilter = new DBObjectSearch($sClass);
|
||||
$oFilter->AddCondition('id', $key, '=');
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oDisplayBlock = new DisplayBlock($oFilter, 'details', false);
|
||||
$oDisplayBlock->RenderContent($oPage);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
case 'pie_chart':
|
||||
@@ -820,8 +861,10 @@ try
|
||||
{
|
||||
$oFilter = DBSearch::unserialize($sFilter);
|
||||
}
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oDisplayBlock = new DisplayBlock($oFilter, 'pie_chart_ajax', false);
|
||||
$oDisplayBlock->RenderContent($oPage, array('group_by' => $sGroupBy));
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -841,8 +884,10 @@ try
|
||||
if ($sFilter != '')
|
||||
{
|
||||
$oFilter = DBSearch::unserialize($sFilter);
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oDisplayBlock = new DisplayBlock($oFilter, 'chart_ajax', false);
|
||||
$oDisplayBlock->RenderContent($oPage, $aParams);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -857,8 +902,10 @@ try
|
||||
$oFilter = new DBObjectSearch($sClass);
|
||||
$oFilter->AddCondition('id', $key, '=');
|
||||
$oPage->Add("<p style=\"width:100%; margin-top:-5px;padding:3px; background-color:#33f; color:#fff;\">Object Details</p>\n");
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oDisplayBlock = new DisplayBlock($oFilter, 'details', false);
|
||||
$oDisplayBlock->RenderContent($oPage);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
$oPage->Add("<input type=\"button\" class=\"jqmClose\" value=\" Close \" />\n");
|
||||
break;
|
||||
|
||||
@@ -873,22 +920,26 @@ try
|
||||
$oFilter = new DBObjectSearch($sClass);
|
||||
$oFilter->AddCondition($sAttCode, $sName, 'Begins with');
|
||||
//$oFilter->AddCondition('org_id', $sOrg, '=');
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oSet = new CMDBObjectSet($oFilter, array($sAttCode => true));
|
||||
while (($iCount < $iMaxCount) && ($oObj = $oSet->fetch()))
|
||||
{
|
||||
$oPage->add($oObj->GetAsHTML($sAttCode)."|".$oObj->GetKey()."\n");
|
||||
$iCount++;
|
||||
}
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
case 'combo_options':
|
||||
$oPage->SetContentType('text/html');
|
||||
$oFilter = DBSearch::FromOQL($sFilter);
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oSet = new CMDBObjectSet($oFilter);
|
||||
while ($oObj = $oSet->fetch())
|
||||
{
|
||||
$oPage->add('<option title="Here is more information..." value="'.$oObj->GetKey().'">'.$oObj->GetName().'</option>');
|
||||
}
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
case 'display_document':
|
||||
@@ -896,7 +947,9 @@ try
|
||||
$sField = utils::ReadParam('field', '');
|
||||
if (!empty($sClass) && ($sClass != 'InlineImage') && !empty($id) && !empty($sField))
|
||||
{
|
||||
$oKPI = new ExecutionKPI();
|
||||
ormDocument::DownloadDocument($oPage, $sClass, $id, $sField, 'inline');
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -914,6 +967,7 @@ try
|
||||
|
||||
$oFilter = new DBObjectSearch($sClass);
|
||||
$oSet = new CMDBObjectSet($oFilter);
|
||||
$oKPI = new ExecutionKPI();
|
||||
$sHtml = cmdbAbstractObject::GetSearchForm($oPage, $oSet, array('currentId' => $currentId,
|
||||
'baseClass' => $sRootClass,
|
||||
'action' => $sAction,
|
||||
@@ -923,6 +977,7 @@ try
|
||||
'cssCount' => $scssCount,
|
||||
'table_inner_id' => $sTableInnerId));
|
||||
$oPage->add($sHtml);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
case 'set_pref':
|
||||
@@ -960,14 +1015,17 @@ try
|
||||
$oPage->SetContentType('text/html');
|
||||
$id = (int)utils::ReadParam('id', 0);
|
||||
$sAttCode = utils::ReadParam('attcode', '');
|
||||
$oKPI = new ExecutionKPI();
|
||||
/** @var \cmdbAbstractObject $oObj */
|
||||
$oObj = MetaModel::GetObject($sClass, $id);
|
||||
$oObj->DisplayDashboard($oPage, $sAttCode);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
case 'export_dashboard':
|
||||
$sDashboardId = utils::ReadParam('id', '', false, 'raw_data');
|
||||
$sDashboardFile = utils::ReadParam('file', '', false, 'raw_data');
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oDashboard = RuntimeDashboard::GetDashboard($sDashboardFile, $sDashboardId);
|
||||
if (!is_null($oDashboard))
|
||||
{
|
||||
@@ -976,6 +1034,7 @@ try
|
||||
$oPage->SetContentDisposition('attachment', 'dashboard_'.$oDashboard->GetTitle().'.xml');
|
||||
$oPage->add($oDashboard->ToXml());
|
||||
}
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
case 'import_dashboard':
|
||||
@@ -1117,10 +1176,12 @@ EOF
|
||||
$aParams['auto_reload'] = utils::ReadParam('auto_reload', false);
|
||||
$aParams['auto_reload_sec'] = utils::ReadParam('auto_reload_sec', 300);
|
||||
$sReloadURL = utils::ReadParam('reload_url', '', false, 'raw_data');
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oDashboard = new RuntimeDashboard($sDashboardId);
|
||||
$oDashboard->FromParams($aParams);
|
||||
$oDashboard->SetReloadURL($sReloadURL);
|
||||
$oDashboard->Render($oPage, true /* bEditMode */, $aExtraParams);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
case 'dashboard_editor':
|
||||
@@ -1128,6 +1189,7 @@ EOF
|
||||
$aExtraParams = utils::ReadParam('extra_params', array(), false, 'raw_data');
|
||||
$sDashboardFile = utils::ReadParam('file', '', false, 'raw_data');
|
||||
$sReloadURL = utils::ReadParam('reload_url', '', false, 'raw_data');
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oDashboard = RuntimeDashboard::GetDashboard($sDashboardFile, $sId);
|
||||
if (!is_null($oDashboard))
|
||||
{
|
||||
@@ -1137,6 +1199,7 @@ EOF
|
||||
}
|
||||
$oDashboard->RenderEditor($oPage, $aExtraParams);
|
||||
}
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
case 'new_dashlet':
|
||||
@@ -1265,6 +1328,7 @@ EOF
|
||||
$aContext = $oAppContext->GetAsHash();
|
||||
$sContext = serialize($aContext);
|
||||
|
||||
/** @var ShortcutOQL $oShortcut */
|
||||
$oShortcut = MetaModel::NewObject("ShortcutOQL");
|
||||
$oShortcut->Set('user_id', UserRights::GetUserId());
|
||||
$oShortcut->Set("context", $sContext);
|
||||
@@ -1541,8 +1605,10 @@ EOF
|
||||
$id = (int)utils::ReadParam('id', 0);
|
||||
$iStart = (int)utils::ReadParam('start', 0);
|
||||
$iCount = (int)utils::ReadParam('count', MetaModel::GetConfig()->Get('max_history_length'));
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oObj = MetaModel::GetObject($sClass, $id);
|
||||
$oObj->DisplayBareHistory($oPage, false, $iCount, $iStart);
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
$oPage->add_ready_script("$('#history table.listResults').tableHover(); $('#history table.listResults').tablesorter( { widgets: ['myZebra', 'truncatedList']} );");
|
||||
break;
|
||||
|
||||
@@ -1551,9 +1617,11 @@ EOF
|
||||
$oHistoryFilter = DBSearch::unserialize($sFilter);
|
||||
$iStart = (int)utils::ReadParam('start', 0);
|
||||
$iCount = (int)utils::ReadParam('count', MetaModel::GetConfig()->Get('max_history_length'));
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oBlock = new HistoryBlock($oHistoryFilter, 'table', false);
|
||||
$oBlock->SetLimit($iCount, $iStart);
|
||||
$oBlock->Display($oPage, 'history');
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
$oPage->add_ready_script("$('#history table.listResults').tableHover(); $('#history table.listResults').tablesorter( { widgets: ['myZebra', 'truncatedList']} );");
|
||||
break;
|
||||
|
||||
@@ -1938,7 +2006,6 @@ EOF
|
||||
$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
|
||||
@@ -1953,6 +2020,7 @@ EOF
|
||||
ini_set('max_execution_time', max(300, ini_get('max_execution_time'))); // At least 5 minutes
|
||||
|
||||
$sToken = utils::ReadParam('token', '', false, 'raw_data');
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oExcelExporter = new ExcelExporter($sToken);
|
||||
$aStatus = $oExcelExporter->Run();
|
||||
$aResults = array('status' => $aStatus['code'], 'percentage' => $aStatus['percentage'], 'message' => $aStatus['message']);
|
||||
@@ -1961,6 +2029,7 @@ EOF
|
||||
$aResults['statistics'] = $oExcelExporter->GetStatistics('html');
|
||||
}
|
||||
$oPage->add(json_encode($aResults));
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
case 'xlsx_download':
|
||||
@@ -2145,7 +2214,7 @@ EOF
|
||||
// Save the generated PDF as an attachment
|
||||
$sPDF = $oPage->get_pdf();
|
||||
$oPage = new ajax_page('');
|
||||
$oAttachment = new Attachment();
|
||||
$oAttachment = MetaModel::NewObject('Attachment');
|
||||
$oAttachment->Set('item_class', $sObjClass);
|
||||
$oAttachment->Set('item_id', $iObjKey);
|
||||
$oDoc = new ormDocument($sPDF, 'application/pdf', $sTitle.'.pdf');
|
||||
@@ -2242,6 +2311,7 @@ EOF
|
||||
case 'relation_groups':
|
||||
$aGroups = utils::ReadParam('groups');
|
||||
$iBlock = 1; // Zero is not a valid blockid
|
||||
$oKPI = new ExecutionKPI();
|
||||
foreach($aGroups as $idx => $aDefinition)
|
||||
{
|
||||
$sListClass = $aDefinition['class'];
|
||||
@@ -2256,11 +2326,13 @@ EOF
|
||||
$oBlock->Display($oPage, 'group_'.$iBlock++);
|
||||
$oPage->p(' '); // Some space ?
|
||||
}
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
case 'relation_lists':
|
||||
$aLists = utils::ReadParam('lists');
|
||||
$iBlock = 1; // Zero is not a valid blockid
|
||||
$oKPI = new ExecutionKPI();
|
||||
foreach($aLists as $sListClass => $aKeys)
|
||||
{
|
||||
$oSearch = new DBObjectSearch($sListClass);
|
||||
@@ -2273,6 +2345,7 @@ EOF
|
||||
$oBlock->Display($oPage, 'list_'.$iBlock++, array('table_id' => 'ImpactAnalysis_'.$sListClass));
|
||||
$oPage->p(' '); // Some space ?
|
||||
}
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
case 'ticket_impact':
|
||||
@@ -2289,6 +2362,7 @@ EOF
|
||||
$iId = (int)utils::ReadParam('id', 0, false, 'integer');
|
||||
|
||||
// Get the list of source objects
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oTicket = MetaModel::GetObject($sClass, $iId);
|
||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
||||
$sExtKeyToRemote = $oAttDef->GetExtKeyToRemote();
|
||||
@@ -2326,6 +2400,7 @@ EOF
|
||||
$sContextKey = 'itop-tickets/relation_context/'.$sClass.'/'.$sRelation.'/'.$sDirection;
|
||||
$oAppContext = new ApplicationContext();
|
||||
$oGraph->Display($oPage, $aResults, $sRelation, $oAppContext, $aExcludedObjects, $sClass, $iId, $sContextKey, array('this' => $oTicket));
|
||||
$oKPI->ComputeAndReport('Data fetch and format');
|
||||
break;
|
||||
|
||||
case 'export_build':
|
||||
@@ -2526,7 +2601,7 @@ EOF
|
||||
{
|
||||
$aDimensions = null;
|
||||
$oDoc = InlineImage::ResizeImageToFit($oDoc, $aDimensions);
|
||||
/** @var Attachment $oAttachment */
|
||||
/** @var InlineImage $oAttachment */
|
||||
$oAttachment = MetaModel::NewObject('InlineImage');
|
||||
$oAttachment->Set('expire', time() + MetaModel::GetConfig()->Get('draft_attachments_lifetime'));
|
||||
$oAttachment->Set('temp_id', $sTempId);
|
||||
@@ -2576,7 +2651,7 @@ EOF
|
||||
} else {
|
||||
$aDimensions = null;
|
||||
$oDoc = InlineImage::ResizeImageToFit($oDoc, $aDimensions);
|
||||
/** @var Attachment $oAttachment */
|
||||
/** @var InlineImage $oAttachment */
|
||||
$oAttachment = MetaModel::NewObject('InlineImage');
|
||||
$oAttachment->Set('expire', time() + MetaModel::GetConfig()->Get('draft_attachments_lifetime'));
|
||||
$oAttachment->Set('temp_id', $sTempId);
|
||||
@@ -2726,7 +2801,7 @@ EOF
|
||||
$oOrmCustomFieldValue = $oObj->Get($sAttCode);
|
||||
$oForm = $oOrmCustomFieldValue->GetForm();
|
||||
$oSubForm = $oForm->FindSubForm($sRequestedFieldsFormPath);
|
||||
$oRenderer = new \Combodo\iTop\Renderer\Console\ConsoleFormRenderer($oSubForm);
|
||||
$oRenderer = new ConsoleFormRenderer($oSubForm);
|
||||
$aRenderRes = $oRenderer->Render($aRequestedFields);
|
||||
|
||||
$aResult['form']['updated_fields'] = $aRenderRes;
|
||||
|
||||
Reference in New Issue
Block a user