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


PHP utils::ReadParam方法代码示例

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


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

示例1: ReadMandatoryParam

function ReadMandatoryParam($sName)
{
    $value = utils::ReadParam($sName, null);
    if (is_null($value)) {
        echo "<p>Missing mandatory argument <b>{$sName}</b></p>";
        exit;
    }
    return $value;
}
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:9,代码来源:test.php

示例2: ReadMandatoryParam

function ReadMandatoryParam($oP, $sParam, $sSanitizationFilter = 'parameter')
{
    $sValue = utils::ReadParam($sParam, null, true, $sSanitizationFilter);
    if (is_null($sValue)) {
        $oP->p("ERROR: Missing argument '{$sParam}'\n");
        exit(29);
    }
    return trim($sValue);
}
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:9,代码来源:priv_sync_chunk.php

示例3: ReadMandatoryParam

function ReadMandatoryParam($oP, $sParam, $sSanitizationFilter)
{
    global $aPageParams;
    assert(isset($aPageParams[$sParam]));
    assert($aPageParams[$sParam]['mandatory']);
    $sValue = utils::ReadParam($sParam, null, true, $sSanitizationFilter);
    if (is_null($sValue)) {
        $oP->p("ERROR: Missing argument '{$sParam}'\n");
        UsageAndExit($oP);
    }
    return trim($sValue);
}
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:12,代码来源:synchro_import.php

示例4: __construct

 /**
  * constructor for the web page
  * @param string $s_title Not used
  */
 function __construct($s_title)
 {
     $sPrintable = utils::ReadParam('printable', '0');
     $bPrintable = $sPrintable == '1';
     parent::__construct($s_title, $bPrintable);
     $this->m_sReadyScript = "";
     //$this->add_header("Content-type: text/html; charset=utf-8");
     $this->add_header("Cache-control: no-cache");
     $this->m_oTabs = new TabManager();
     $this->sContentType = 'text/html';
     $this->sContentDisposition = 'inline';
     $this->m_sMenu = "";
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:17,代码来源:ajaxwebpage.class.inc.php

示例5: MakeArchiveFileName

function MakeArchiveFileName($iRefTime = null)
{
    $sDefaultBackupFileName = sys_get_temp_dir() . '/' . "__DB__-%Y-%m-%d";
    $sBackupFile = utils::ReadParam('backup_file', $sDefaultBackupFileName, true, 'raw_data');
    $oConfig = new Config(APPCONF . 'production/config-itop.php');
    $sBackupFile = str_replace('__HOST__', $oConfig->GetDBHost(), $sBackupFile);
    $sBackupFile = str_replace('__DB__', $oConfig->GetDBName(), $sBackupFile);
    $sBackupFile = str_replace('__SUBNAME__', $oConfig->GetDBSubName(), $sBackupFile);
    if (is_null($iRefTime)) {
        $sBackupFile = strftime($sBackupFile);
    } else {
        $sBackupFile = strftime($sBackupFile, $iRefTime);
    }
    return $sBackupFile . '.zip';
}
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:15,代码来源:check-backup.php

示例6: DisplayFormPart

 public function DisplayFormPart(WebPage $oP, $sPartId)
 {
     switch ($sPartId) {
         case 'interactive_fields_spreadsheet':
             $this->GetInteractiveFieldsWidget($oP, 'interactive_fields_spreadsheet');
             break;
         case 'spreadsheet_options':
             $sChecked = utils::ReadParam('no_localize', 0) == 1 ? ' checked ' : '';
             $oP->add('<fieldset><legend>' . Dict::S('Core:BulkExport:SpreadsheetOptions') . '</legend>');
             $oP->add('<table>');
             $oP->add('<tr>');
             $oP->add('<td><input type="checkbox" id="spreadsheet_no_localize" name="no_localize" value="1"' . $sChecked . '><label for="spreadsheet_no_localize"> ' . Dict::S('Core:BulkExport:OptionNoLocalize') . '</label></td>');
             $oP->add('</tr>');
             $oP->add('</table>');
             $oP->add('</fieldset>');
             break;
         default:
             return parent::DisplayFormPart($oP, $sPartId);
     }
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:20,代码来源:spreadsheetbulkexport.class.inc.php

示例7: __construct

 public function __construct($s_title)
 {
     $this->s_title = $s_title;
     $this->s_content = "";
     $this->s_deferred_content = '';
     $this->a_scripts = array();
     $this->a_dict_entries = array();
     $this->a_styles = array();
     $this->a_linked_scripts = array();
     $this->a_linked_stylesheets = array();
     $this->a_headers = array();
     $this->a_base = array('href' => '', 'target' => '');
     $this->iNextId = 0;
     $this->iTransactionId = 0;
     $this->sContentType = '';
     $this->sContentDisposition = '';
     $this->sContentFileName = '';
     $this->s_OutputFormat = utils::ReadParam('output_format', 'html');
     $this->a_OutputOptions = array();
     ob_start();
     // Start capturing the output
 }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:22,代码来源:webpage.class.inc.php

示例8: CheckParameters

/**
 * Checks the parameters and returns the appropriate exporter (if any)
 * @param string $sExpression The OQL query to export or null
 * @param string $sQueryId The entry in the query phrasebook if $sExpression is null
 * @param string $sFormat The code of export format: csv, pdf, html, xlsx
 * @throws MissingQueryArgument
 * @return Ambigous <iBulkExport, NULL>
 */
function CheckParameters($sExpression, $sQueryId, $sFormat)
{
    $oExporter = null;
    if ($sExpression === null && $sQueryId === null) {
        ReportErrorAndUsage("Missing parameter. The parameter 'expression' or 'query' must be specified.");
    }
    // Either $sExpression or $sQueryId must be specified
    if ($sExpression === null) {
        $oSearch = DBObjectSearch::FromOQL('SELECT QueryOQL WHERE id = :query_id', array('query_id' => $sQueryId));
        $oQueries = new DBObjectSet($oSearch);
        if ($oQueries->Count() > 0) {
            $oQuery = $oQueries->Fetch();
            $sExpression = $oQuery->Get('oql');
            $sFields = $oQuery->Get('fields');
            if (strlen($sFields) == 0) {
                $sFields = trim($oQuery->Get('fields'));
            }
        } else {
            ReportErrorAndExit("Invalid query phrasebook identifier: '{$sQueryId}'");
        }
    }
    if ($sFormat === null) {
        ReportErrorAndUsage("Missing parameter 'format'.");
    }
    // Check if the supplied query is valid (and all the parameters are supplied
    try {
        $oSearch = DBObjectSearch::FromOQL($sExpression);
        $aArgs = array();
        foreach ($oSearch->GetQueryParams() as $sParam => $foo) {
            $value = utils::ReadParam('arg_' . $sParam, null, true, 'raw_data');
            if (!is_null($value)) {
                $aArgs[$sParam] = $value;
            } else {
                throw new MissingQueryArgument("Missing parameter '--arg_{$sParam}'");
            }
        }
        $oSearch->SetInternalParams($aArgs);
        $sFormat = utils::ReadParam('format', 'html', true, 'raw_data');
        $oExporter = BulkExport::FindExporter($sFormat, $oSearch);
        if ($oExporter == null) {
            $aSupportedFormats = BulkExport::FindSupportedFormats();
            ReportErrorAndExit("Invalid output format: '{$sFormat}'. The supported formats are: " . implode(', ', array_keys($aSupportedFormats)));
        }
    } catch (MissingQueryArgument $e) {
        ReportErrorAndUsage("Invalid OQL query: '{$sExpression}'.\n" . $e->getMessage());
    } catch (OQLException $e) {
        ReportErrorAndExit("Invalid OQL query: '{$sExpression}'.\n" . $e->getMessage());
    } catch (Exception $e) {
        ReportErrorAndExit($e->getMessage());
    }
    $oExporter->SetFormat($sFormat);
    $oExporter->SetChunkSize(EXPORTER_DEFAULT_CHUNK_SIZE);
    $oExporter->SetObjectList($oSearch);
    $oExporter->ReadParameters();
    return $oExporter;
}
开发者ID:henryavila,项目名称:itop,代码行数:64,代码来源:export-v2.php

示例9: RenderContent

    public function RenderContent(WebPage $oPage, $aExtraParams = array())
    {
        $oDashboard = $this->GetDashboard();
        if ($oDashboard != null) {
            $sDivId = preg_replace('/[^a-zA-Z0-9_]/', '', $this->sMenuId);
            $oPage->add('<div class="dashboard_contents" id="' . $sDivId . '">');
            $oDashboard->Render($oPage, false, $aExtraParams);
            $oPage->add('</div>');
            $oDashboard->RenderEditionTools($oPage);
            if ($oDashboard->GetAutoReload()) {
                $sId = $this->sMenuId;
                $sExtraParams = json_encode($aExtraParams);
                $iReloadInterval = 1000 * $oDashboard->GetAutoReloadInterval();
                $oPage->add_script(<<<EOF
\t\t\t\t\tsetInterval("ReloadDashboard('{$sDivId}');", {$iReloadInterval});

\t\t\t\t\tfunction ReloadDashboard(sDivId)
\t\t\t\t\t{
\t\t\t\t\t\tvar oExtraParams = {$sExtraParams};
\t\t\t\t\t\t// Do not reload when a dialog box is active
\t\t\t\t\t\tif (!(\$('.ui-dialog:visible').length > 0))
\t\t\t\t\t\t{
\t\t\t\t\t\t\t\$('.dashboard_contents#'+sDivId).block();
\t\t\t\t\t\t\t\$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php',
\t\t\t\t\t\t\t   { operation: 'reload_dashboard', dashboard_id: '{$sId}', extra_params: oExtraParams},
\t\t\t\t\t\t\t   function(data){
\t\t\t\t\t\t\t\t \$('.dashboard_contents#'+sDivId).html(data);
\t\t\t\t\t\t\t\t \$('.dashboard_contents#'+sDivId).unblock();
\t\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t );
\t\t\t\t\t\t}
\t\t\t\t\t}
EOF
);
            }
            $bEdit = utils::ReadParam('edit', false);
            if ($bEdit) {
                $sId = addslashes($this->sMenuId);
                $oPage->add_ready_script("EditDashboard('{$sId}');");
            }
        } else {
            $oPage->p("Error: failed to load dashboard file: '{$this->sDashboardFile}'");
        }
    }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:44,代码来源:menunode.class.inc.php

示例10: addslashes

\t\t\t\tsRes += '</tbody>';
\t\t\t\tsRes += '</table>';
\t\t\t\t\$('#full_text_results').append(sRes);
EOF
);
                }
                if ($iCount == 0) {
                    $sFullTextSummary = addslashes(Dict::S('UI:Search:NoObjectFound'));
                    $oPage->add_ready_script("\$('#full_text_results').append('<div id=\"no_object_found\">{$sFullTextSummary}</div>');");
                }
            }
            break;
        case 'full_text_search_enlarge':
            $sFullText = trim(utils::ReadParam('text', '', false, 'raw_data'));
            $sClass = trim(utils::ReadParam('class', ''));
            $iTune = utils::ReadParam('tune', 0);
            if (preg_match('/^"(.*)"$/', $sFullText, $aMatches)) {
                // The text is surrounded by double-quotes, remove the quotes and treat it as one single expression
                $aFullTextNeedles = array($aMatches[1]);
            } else {
                // Split the text on the blanks and treat this as a search for <word1> AND <word2> AND <word3>
                $aFullTextNeedles = explode(' ', $sFullText);
            }
            $oFilter = new DBObjectSearch($sClass);
            foreach ($aFullTextNeedles as $sSearchText) {
                $oFilter->AddCondition_FullText($sSearchText);
            }
            $oSet = new DBObjectSet($oFilter);
            $oPage->add("<div class=\"page_header\">\n");
            $oPage->add("<h2>" . MetaModel::GetClassIcon($sClass) . "&nbsp;<span class=\"hilite\">" . Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', $oSet->Count(), Metamodel::GetName($sClass)) . "</h2>\n");
            $oPage->add("</div>\n");
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:31,代码来源:ajax.render.php

示例11: GetRenderContent

    public function GetRenderContent(WebPage $oPage, $aExtraParams = array(), $sId)
    {
        $sHtml = '';
        // Add the extra params into the filter if they make sense for such a filter
        $bDoSearch = utils::ReadParam('dosearch', false);
        if ($this->m_oSet == null) {
            $aQueryParams = array();
            if (isset($aExtraParams['query_params'])) {
                $aQueryParams = $aExtraParams['query_params'];
            }
            if ($this->m_sStyle != 'links') {
                $oAppContext = new ApplicationContext();
                $sClass = $this->m_oFilter->GetClass();
                $aFilterCodes = array_keys(MetaModel::GetClassFilterDefs($sClass));
                $aCallSpec = array($sClass, 'MapContextParam');
                if (is_callable($aCallSpec)) {
                    foreach ($oAppContext->GetNames() as $sContextParam) {
                        $sParamCode = call_user_func($aCallSpec, $sContextParam);
                        //Map context parameter to the value/filter code depending on the class
                        if (!is_null($sParamCode)) {
                            $sParamValue = $oAppContext->GetCurrentValue($sContextParam, null);
                            if (!is_null($sParamValue)) {
                                $aExtraParams[$sParamCode] = $sParamValue;
                            }
                        }
                    }
                }
                foreach ($aFilterCodes as $sFilterCode) {
                    $externalFilterValue = utils::ReadParam($sFilterCode, '', false, 'raw_data');
                    $condition = null;
                    if (isset($aExtraParams[$sFilterCode])) {
                        $condition = $aExtraParams[$sFilterCode];
                    }
                    if ($bDoSearch && $externalFilterValue != "") {
                        // Search takes precedence over context params...
                        unset($aExtraParams[$sFilterCode]);
                        if (!is_array($externalFilterValue)) {
                            $condition = trim($externalFilterValue);
                        } else {
                            if (count($externalFilterValue) == 1) {
                                $condition = trim($externalFilterValue[0]);
                            } else {
                                $condition = $externalFilterValue;
                            }
                        }
                    }
                    if (!is_null($condition)) {
                        $sOpCode = null;
                        // default operator
                        if (is_array($condition)) {
                            // Multiple values, add them as AND X IN (v1, v2, v3...)
                            $sOpCode = 'IN';
                        }
                        $this->AddCondition($sFilterCode, $condition, $sOpCode);
                    }
                }
                if ($bDoSearch) {
                    // Keep the table_id identifying this table if we're performing a search
                    $sTableId = utils::ReadParam('_table_id_', null, false, 'raw_data');
                    if ($sTableId != null) {
                        $aExtraParams['table_id'] = $sTableId;
                    }
                }
            }
            $aOrderBy = array();
            if (isset($aExtraParams['order_by'])) {
                // Convert the string describing the order_by parameter into an array
                // The syntax is +attCode1,-attCode2
                // attCode1 => ascending, attCode2 => descending
                $aTemp = explode(',', $aExtraParams['order_by']);
                foreach ($aTemp as $sTemp) {
                    $aMatches = array();
                    if (preg_match('/^([+-])?(.+)$/', $sTemp, $aMatches)) {
                        $bAscending = true;
                        if ($aMatches[1] == '-') {
                            $bAscending = false;
                        }
                        $aOrderBy[$aMatches[2]] = $bAscending;
                    }
                }
            }
            $this->m_oSet = new CMDBObjectSet($this->m_oFilter, $aOrderBy, $aQueryParams);
        }
        switch ($this->m_sStyle) {
            case 'count':
                if (isset($aExtraParams['group_by'])) {
                    if (isset($aExtraParams['group_by_label'])) {
                        $oGroupByExp = Expression::FromOQL($aExtraParams['group_by']);
                        $sGroupByLabel = $aExtraParams['group_by_label'];
                    } else {
                        // Backward compatibility: group_by is simply a field id
                        $sAlias = $this->m_oFilter->GetClassAlias();
                        $oGroupByExp = new FieldExpression($aExtraParams['group_by'], $sAlias);
                        $sGroupByLabel = MetaModel::GetLabel($this->m_oFilter->GetClass(), $aExtraParams['group_by']);
                    }
                    $aGroupBy = array();
                    $aGroupBy['grouped_by_1'] = $oGroupByExp;
                    $sSql = $this->m_oFilter->MakeGroupByQuery($aQueryParams, $aGroupBy, true);
                    $aRes = CMDBSource::QueryToArray($sSql);
                    $aGroupBy = array();
//.........这里部分代码省略.........
开发者ID:henryavila,项目名称:itop,代码行数:101,代码来源:displayblock.class.inc.php

示例12: DeleteObjects

 /**
  * Perform all the needed checks to delete one (or more) objects
  */
 public static function DeleteObjects(WebPage $oP, $sClass, $aObjects, $bPreview, $sCustomOperation, $aContextData = array())
 {
     $oDeletionPlan = new DeletionPlan();
     foreach ($aObjects as $oObj) {
         if ($bPreview) {
             $oObj->CheckToDelete($oDeletionPlan);
         } else {
             $oObj->DBDeleteTracked(CMDBObject::GetCurrentChange(), null, $oDeletionPlan);
         }
     }
     if ($bPreview) {
         if (count($aObjects) == 1) {
             $oObj = $aObjects[0];
             $oP->add("<h1>" . Dict::Format('UI:Delete:ConfirmDeletionOf_Name', $oObj->GetName()) . "</h1>\n");
         } else {
             $oP->add("<h1>" . Dict::Format('UI:Delete:ConfirmDeletionOf_Count_ObjectsOf_Class', count($aObjects), MetaModel::GetName($sClass)) . "</h1>\n");
         }
         // Explain what should be done
         //
         $aDisplayData = array();
         foreach ($oDeletionPlan->ListDeletes() as $sTargetClass => $aDeletes) {
             foreach ($aDeletes as $iId => $aData) {
                 $oToDelete = $aData['to_delete'];
                 $bAutoDel = $aData['mode'] == DEL_SILENT || $aData['mode'] == DEL_AUTO;
                 if (array_key_exists('issue', $aData)) {
                     if ($bAutoDel) {
                         if (isset($aData['requested_explicitely'])) {
                             $sConsequence = Dict::Format('UI:Delete:CannotDeleteBecause', $aData['issue']);
                         } else {
                             $sConsequence = Dict::Format('UI:Delete:ShouldBeDeletedAtomaticallyButNotPossible', $aData['issue']);
                         }
                     } else {
                         $sConsequence = Dict::Format('UI:Delete:MustBeDeletedManuallyButNotPossible', $aData['issue']);
                     }
                 } else {
                     if ($bAutoDel) {
                         if (isset($aData['requested_explicitely'])) {
                             $sConsequence = '';
                             // not applicable
                         } else {
                             $sConsequence = Dict::S('UI:Delete:WillBeDeletedAutomatically');
                         }
                     } else {
                         $sConsequence = Dict::S('UI:Delete:MustBeDeletedManually');
                     }
                 }
                 $aDisplayData[] = array('class' => MetaModel::GetName(get_class($oToDelete)), 'object' => $oToDelete->GetHyperLink(), 'consequence' => $sConsequence);
             }
         }
         foreach ($oDeletionPlan->ListUpdates() as $sRemoteClass => $aToUpdate) {
             foreach ($aToUpdate as $iId => $aData) {
                 $oToUpdate = $aData['to_reset'];
                 if (array_key_exists('issue', $aData)) {
                     $sConsequence = Dict::Format('UI:Delete:CannotUpdateBecause_Issue', $aData['issue']);
                 } else {
                     $sConsequence = Dict::Format('UI:Delete:WillAutomaticallyUpdate_Fields', $aData['attributes_list']);
                 }
                 $aDisplayData[] = array('class' => MetaModel::GetName(get_class($oToUpdate)), 'object' => $oToUpdate->GetHyperLink(), 'consequence' => $sConsequence);
             }
         }
         $iImpactedIndirectly = $oDeletionPlan->GetTargetCount() - count($aObjects);
         if ($iImpactedIndirectly > 0) {
             if (count($aObjects) == 1) {
                 $oObj = $aObjects[0];
                 $oP->p(Dict::Format('UI:Delete:Count_Objects/LinksReferencing_Object', $iImpactedIndirectly, $oObj->GetName()));
             } else {
                 $oP->p(Dict::Format('UI:Delete:Count_Objects/LinksReferencingTheObjects', $iImpactedIndirectly));
             }
             $oP->p(Dict::S('UI:Delete:ReferencesMustBeDeletedToEnsureIntegrity'));
         }
         if ($iImpactedIndirectly > 0 || $oDeletionPlan->FoundStopper()) {
             $aDisplayConfig = array();
             $aDisplayConfig['class'] = array('label' => 'Class', 'description' => '');
             $aDisplayConfig['object'] = array('label' => 'Object', 'description' => '');
             $aDisplayConfig['consequence'] = array('label' => 'Consequence', 'description' => Dict::S('UI:Delete:Consequence+'));
             $oP->table($aDisplayConfig, $aDisplayData);
         }
         if ($oDeletionPlan->FoundStopper()) {
             if ($oDeletionPlan->FoundSecurityIssue()) {
                 $oP->p(Dict::S('UI:Delete:SorryDeletionNotAllowed'));
             } elseif ($oDeletionPlan->FoundManualOperation()) {
                 $oP->p(Dict::S('UI:Delete:PleaseDoTheManualOperations'));
             } else {
                 $oP->p(Dict::S('UI:Delete:PleaseDoTheManualOperations'));
             }
             $oAppContext = new ApplicationContext();
             $oP->add("<form method=\"post\">\n");
             $oP->add("<input type=\"hidden\" name=\"transaction_id\" value=\"" . utils::ReadParam('transaction_id') . "\">\n");
             $oP->add("<input type=\"button\" onclick=\"window.history.back();\" value=\"" . Dict::S('UI:Button:Back') . "\">\n");
             $oP->add("<input DISABLED type=\"submit\" name=\"\" value=\"" . Dict::S('UI:Button:Delete') . "\">\n");
             $oP->add($oAppContext->GetForForm());
             $oP->add("</form>\n");
         } else {
             if (count($aObjects) == 1) {
                 $oObj = $aObjects[0];
                 $id = $oObj->GetKey();
                 $oP->p('<h1>' . Dict::Format('UI:Delect:Confirm_Object', $oObj->GetHyperLink()) . '</h1>');
//.........这里部分代码省略.........
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:101,代码来源:cmdbabstract.class.inc.php

示例13: DoLoginEx

 /**
  * Check if the user is already authentified, if yes, then performs some additional validations to redirect towards the desired "portal"
  * @param string|null $sRequestedPortalId The requested "portal" interface, null for any
  * @param bool $bMustBeAdmin Whether or not the user must be an admin to access the current page
  * @param int iOnExit What action to take if the user is not logged on (one of the class constants EXIT_...)
  */
 static function DoLoginEx($sRequestedPortalId = null, $bMustBeAdmin = false, $iOnExit = self::EXIT_PROMPT)
 {
     $operation = utils::ReadParam('loginop', '');
     $sMessage = self::HandleOperations($operation);
     // May exit directly
     $iRet = self::Login($iOnExit);
     if ($iRet == self::EXIT_CODE_OK) {
         if ($bMustBeAdmin && !UserRights::IsAdministrator()) {
             if ($iOnExit == self::EXIT_RETURN) {
                 return self::EXIT_CODE_MUSTBEADMIN;
             } else {
                 require_once APPROOT . '/setup/setuppage.class.inc.php';
                 $oP = new SetupPage(Dict::S('UI:PageTitle:FatalError'));
                 $oP->add("<h1>" . Dict::S('UI:Login:Error:AccessAdmin') . "</h1>\n");
                 $oP->p("<a href=\"" . utils::GetAbsoluteUrlAppRoot() . "pages/logoff.php\">" . Dict::S('UI:LogOffMenu') . "</a>");
                 $oP->output();
                 exit;
             }
         }
         $iRet = call_user_func(array(self::$sHandlerClass, 'ChangeLocation'), $sRequestedPortalId, $iOnExit);
     }
     if ($iOnExit == self::EXIT_RETURN) {
         return $iRet;
     } else {
         return $sMessage;
     }
 }
开发者ID:besmirzanaj,项目名称:itop-code,代码行数:33,代码来源:loginwebpage.class.inc.php

示例14: DBObjectSearch

\t\tDoCheckMapping();
EOF
);
            }
            break;
        case 'get_csv_template':
            $sClassName = utils::ReadParam('class_name');
            $sFormat = utils::ReadParam('format', 'csv');
            if (MetaModel::IsValidClass($sClassName)) {
                $oSearch = new DBObjectSearch($sClassName);
                $oSearch->AddCondition('id', 0, '=');
                // Make sure we create an empty set
                $oSet = new CMDBObjectSet($oSearch);
                $sResult = cmdbAbstractObject::GetSetAsCSV($oSet, array('showMandatoryFields' => true));
                $sClassDisplayName = MetaModel::GetName($sClassName);
                $sDisposition = utils::ReadParam('disposition', 'inline');
                if ($sDisposition == 'attachment') {
                    switch ($sFormat) {
                        case 'xlsx':
                            $oPage = new ajax_page("");
                            $oPage->SetContentType('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
                            $oPage->SetContentDisposition('attachment', $sClassDisplayName . '.xlsx');
                            require_once APPROOT . '/application/excelexporter.class.inc.php';
                            $writer = new XLSXWriter();
                            $writer->setAuthor(UserRights::GetUserFriendlyName());
                            $aHeaders = array(0 => explode(',', $sResult));
                            // comma is the default separator
                            $writer->writeSheet($aHeaders, $sClassDisplayName, array());
                            $oPage->add($writer->writeToString());
                            break;
                        case 'csv':
开发者ID:henryavila,项目名称:itop,代码行数:31,代码来源:ajax.csvimport.php

示例15: DoSynchronize

 /**
  * Do the entire synchronization job
  */
 protected function DoSynchronize()
 {
     $this->m_oStatLog->Set('status_curr_job', 1);
     $this->m_oStatLog->Set('status_curr_pos', -1);
     $iMaxChunkSize = utils::ReadParam('max_chunk_size', 0, true);
     if ($iMaxChunkSize > 0) {
         // Split the execution into several processes
         // Each process will call DoSynchronizeChunk()
         // The loop will end when a process does not reply "continue" on the last line of its output
         if (!utils::IsModeCLI()) {
             throw new SynchroExceptionNotStarted(Dict::S('Core:SyncSplitModeCLIOnly'));
         }
         $aArguments = array();
         $aArguments['source'] = $this->m_oDataSource->GetKey();
         $aArguments['log'] = $this->m_oStatLog->GetKey();
         $aArguments['change'] = $this->m_oChange->GetKey();
         $aArguments['chunk'] = $iMaxChunkSize;
         if ($this->m_oLastFullLoadStartDate) {
             $aArguments['last_full_load'] = $this->m_oLastFullLoadStartDate->Format('Y-m-d H:i:s');
         } else {
             $aArguments['last_full_load'] = '';
         }
         $this->m_oStatLog->DBUpdate($this->m_oChange);
         $iStepCount = 0;
         do {
             $aArguments['step_count'] = $iStepCount;
             $iStepCount++;
             list($iRes, $aOut) = utils::ExecITopScript('synchro/priv_sync_chunk.php', $aArguments);
             // Reload the log that has been modified by the processes
             $this->m_oStatLog->Reload();
             $sLastRes = strtolower(trim(end($aOut)));
             switch ($sLastRes) {
                 case 'continue':
                     $bContinue = true;
                     break;
                 case 'finished':
                     $bContinue = false;
                     break;
                 default:
                     $this->m_oStatLog->AddTrace("The script did not reply with the expected keywords:");
                     $aIndentedOut = array();
                     foreach ($aOut as $sOut) {
                         $aIndentedOut[] = "-> {$sOut}";
                         $this->m_oStatLog->AddTrace(">>> {$sOut}");
                     }
                     throw new Exception("Encountered an error in an underspinned process:\n" . implode("\n", $aIndentedOut));
             }
         } while ($bContinue);
     } else {
         $this->PrepareProcessing();
         $this->DoJob1();
         $this->DoJob2();
         $this->DoJob3();
     }
 }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:58,代码来源:synchrodatasource.class.inc.php


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