本文整理汇总了PHP中utils::GetNewTransactionId方法的典型用法代码示例。如果您正苦于以下问题:PHP utils::GetNewTransactionId方法的具体用法?PHP utils::GetNewTransactionId怎么用?PHP utils::GetNewTransactionId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils
的用法示例。
在下文中一共展示了utils::GetNewTransactionId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: WizardFormStart
public function WizardFormStart($sId = '', $sNextStep = null, $bAttachment = false, $sMethod = 'post')
{
$this->m_sWizardId = $sId;
// multipart... needed for file upload
$this->add("<form id=\"{$this->m_sWizardId}\" method=\"{$sMethod}\" enctype=\"multipart/form-data\" onsubmit=\"window.bInSubmit = true;\">\n");
$aPreviousSteps = $this->GetWizardStepHistory();
if (utils::ReadParam('step_back', 0) == 1) {
// Back into the past history
array_pop($aPreviousSteps);
} else {
// Moving forward
array_push($aPreviousSteps, utils::ReadParam('next_step'));
}
$sStepHistory = implode(',', $aPreviousSteps);
$this->add("<input type=\"hidden\" id=\"step_history\" name=\"step_history\" value=\"" . htmlentities($sStepHistory, ENT_QUOTES, 'UTF-8') . "\">");
if (!is_null($sNextStep)) {
$this->add("<input type=\"hidden\" id=\"next_step\" name=\"next_step\" value=\"{$sNextStep}\">");
}
$this->add("<input type=\"hidden\" id=\"step_back\" name=\"step_back\" value=\"0\">");
$sTransactionId = utils::GetNewTransactionId();
$this->SetTransactionId($sTransactionId);
$this->add("<input type=\"hidden\" id=\"transaction_id\" name=\"transaction_id\" value=\"{$sTransactionId}\">\n");
$this->add_ready_script("\$(window).unload(function() { OnUnload('{$sTransactionId}') } );\n");
}
示例2: DeleteObjects
//.........这里部分代码省略.........
} 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>');
} else {
$oP->p('<h1>' . Dict::Format('UI:Delect:Confirm_Count_ObjectsOf_Class', count($aObjects), MetaModel::GetName($sClass)) . '</h1>');
}
foreach ($aObjects as $oObj) {
$aKeys[] = $oObj->GetKey();
}
$oFilter = new DBObjectSearch($sClass);
$oFilter->AddCondition('id', $aKeys, 'IN');
$oSet = new CMDBobjectSet($oFilter);
$oP->add('<div id="0">');
CMDBAbstractObject::DisplaySet($oP, $oSet, array('display_limit' => false, 'menu' => false));
$oP->add("</div>\n");
$oP->add("<form method=\"post\">\n");
foreach ($aContextData as $sKey => $value) {
$oP->add("<input type=\"hidden\" name=\"{$sKey}\" value=\"{$value}\">\n");
}
$oP->add("<input type=\"hidden\" name=\"transaction_id\" value=\"" . utils::GetNewTransactionId() . "\">\n");
$oP->add("<input type=\"hidden\" name=\"operation\" value=\"{$sCustomOperation}\">\n");
$oP->add("<input type=\"hidden\" name=\"filter\" value=\"" . $oFilter->Serialize() . "\">\n");
$oP->add("<input type=\"hidden\" name=\"class\" value=\"{$sClass}\">\n");
foreach ($aObjects as $oObj) {
$oP->add("<input type=\"hidden\" name=\"selectObject[]\" value=\"" . $oObj->GetKey() . "\">\n");
}
$oP->add("<input type=\"button\" onclick=\"window.history.back();\" value=\"" . Dict::S('UI:Button:Back') . "\">\n");
$oP->add("<input type=\"submit\" name=\"\" value=\"" . Dict::S('UI:Button:Delete') . "\">\n");
$oAppContext = new ApplicationContext();
$oP->add($oAppContext->GetForForm());
$oP->add("</form>\n");
}
} else {
// Execute the deletion
//
if (count($aObjects) == 1) {
$oObj = $aObjects[0];
$oP->add("<h1>" . Dict::Format('UI:Title:DeletionOf_Object', $oObj->GetName()) . "</h1>\n");
} else {
$oP->add("<h1>" . Dict::Format('UI:Title:BulkDeletionOf_Count_ObjectsOf_Class', count($aObjects), MetaModel::GetName($sClass)) . "</h1>\n");
}
// Security - do not allow the user to force a forbidden delete by the mean of page arguments...
if ($oDeletionPlan->FoundSecurityIssue()) {
throw new CoreException(Dict::S('UI:Error:NotEnoughRightsToDelete'));
}
if ($oDeletionPlan->FoundManualOperation()) {
throw new CoreException(Dict::S('UI:Error:CannotDeleteBecauseManualOpNeeded'));
}
if ($oDeletionPlan->FoundManualDelete()) {
throw new CoreException(Dict::S('UI:Error:CannotDeleteBecauseOfDepencies'));
}
// Report deletions
示例3: MakeStimulusForm
/**
* Create form to apply a stimulus
* @param WebPage $oP The current web page
* @param Object $oObj The target object
* @param String $sStimulusCode Stimulus that will be applied
* @param Array $aEditAtt List of attributes to edit
* @return void
*/
function MakeStimulusForm(WebPage $oP, $oObj, $sStimulusCode, $aEditAtt)
{
static $bHasStimulusForm = false;
$sDialogId = $sStimulusCode . "_dialog";
$sFormId = $sStimulusCode . "_form";
$sCancelButtonLabel = Dict::S('UI:Button:Cancel');
$oP->add('<div id="' . $sDialogId . '" style="display: none;">');
$sClass = get_class($oObj);
$oP->add('<form id="' . $sFormId . '" method="post">');
$sTransactionId = utils::GetNewTransactionId();
$oP->add("<input type=\"hidden\" id=\"transaction_id\" name=\"transaction_id\" value=\"{$sTransactionId}\">\n");
$oP->add("<input type=\"hidden\" name=\"class\" value=\"{$sClass}\">");
$oP->add("<input type=\"hidden\" name=\"id\" value=\"" . $oObj->GetKey() . "\">");
$oP->add("<input type=\"hidden\" name=\"operation\" value=\"update_request\">");
$oP->add("<input type=\"hidden\" id=\"stimulus_to_apply\" name=\"apply_stimulus\" value=\"{$sStimulusCode}\">\n");
foreach ($aEditAtt as $sAttCode) {
$sValue = $oObj->Get($sAttCode);
$sDisplayValue = $oObj->GetEditValue($sAttCode);
$aArgs = array('this' => $oObj, 'formPrefix' => '');
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
$sInputId = 'input_' . $sAttCode;
$sHTMLValue = "<span id=\"field_{$sStimulusCode}_{$sInputId}\">" . cmdbAbstractObject::GetFormElementForField($oP, $sClass, $sAttCode, $oAttDef, $sValue, $sDisplayValue, $sInputId, '', 0, $aArgs) . '</span>';
$oP->add('<h1>' . MetaModel::GetLabel($sClass, $sAttCode) . '</h1>');
$oP->add($sHTMLValue);
}
$oP->add('</form>');
$oP->add('</div>');
if (!$bHasStimulusForm) {
$bHasStimulusForm = true;
$oP->add_script(<<<EOF
function RunStimulusDialog(sStimulusCode, sTitle, sOkButtonLabel)
{
\tvar sWidth = 'auto';
\tif (sStimulusCode == 'ev_reopen')
\t{
\t\t// Avoid having a dialog spanning the complete width of the window
\t\t// just because it contains a CaseLog entry
\t\tsWidth = '80%';
\t}
\t\t\t\t
\t\$('#'+sStimulusCode+'_dialog').dialog({
\t\theight: 'auto',
\t\twidth: sWidth,
\t\tmodal: true,
\t\ttitle: sTitle,
\t\tbuttons: [
\t\t{ text: sOkButtonLabel, click: function() {
\t\t\t\$(this).find('#'+sStimulusCode+'_form').submit();
\t\t} },
\t\t{ text: "{$sCancelButtonLabel}", click: function() {
\t\t\t\$(this).dialog( "close" );
\t\t} }
\t\t]
\t});
\t// Start the validation
\tCheckFields(sStimulusCode+'_form', false);
\t\$('#'+sStimulusCode+'_form').submit( function() {
\t\treturn OnSubmit(sStimulusCode+'_form');
\t});
}
EOF
);
}
}
示例4: DisplayFinalStep
/**
* Display the final step of the wizard: a confirmation screen
*/
public function DisplayFinalStep($iStepIndex, $aFieldsMap)
{
$oAppContext = new ApplicationContext();
$this->m_oPage->add("<div class=\"wizContainer\" id=\"wizStep{$iStepIndex}\" style=\"display:none;\">\n");
$this->m_oPage->add("<a name=\"step{$iStepIndex}\" />\n");
$this->m_oPage->P(Dict::S('UI:Wizard:FinalStepTitle'));
$this->m_oPage->add("<input type=\"hidden\" name=\"operation\" value=\"wizard_apply_new\" />\n");
$this->m_oPage->add("<input type=\"hidden\" name=\"transaction_id\" value=\"" . utils::GetNewTransactionId() . "\" />\n");
$this->m_oPage->add("<input type=\"hidden\" id=\"wizard_json_obj\" name=\"json_obj\" value=\"\" />\n");
$sScript = "function OnEnterStep{$iStepIndex}() {\n";
foreach ($aFieldsMap as $iInputId => $sAttCode) {
$sScript .= "\toWizardHelper.UpdateCurrentValue('{$sAttCode}');\n";
}
$sScript .= "\toWizardHelper.Preview('object_preview');\n";
$sScript .= "\t\$('#wizard_json_obj').val(oWizardHelper.ToJSON());\n";
$sScript .= "}\n";
$this->m_oPage->add_script($sScript);
$this->m_oPage->add("<div id=\"object_preview\">\n");
$this->m_oPage->add("</div>\n");
$this->m_oPage->add($oAppContext->GetForForm());
$this->m_oPage->add("<input type=\"button\" value=\"" . Dict::S('UI:Button:Back') . "\" onClick=\"GoToStep({$iStepIndex}, {$iStepIndex} - 1)\" />");
$this->m_oPage->add("<input type=\"submit\" value=\"Create " . MetaModel::GetName($this->m_sClass) . "\" />\n");
$this->m_oPage->add("</div>\n");
$this->m_oPage->add("</form>\n");
}
示例5: DisplayMultipleSelectionForm
/**
* Displays a form (checkboxes) to select the objects for which to apply a given action
* Only the objects for which the action is valid can be checked. By default all valid objects are checked
* @param $oP WebPage The page for output
* @param $oFilter DBObjectSearch The filter that defines the list of objects
* @param $sNextOperation string The next operation (code) to be executed when the form is submitted
* @param $oChecker ActionChecker The helper class/instance used to check for which object the action is valid
* @return none
*/
function DisplayMultipleSelectionForm($oP, $oFilter, $sNextOperation, $oChecker, $aExtraFormParams = array())
{
$oAppContext = new ApplicationContext();
$iBulkActionAllowed = $oChecker->IsAllowed();
$sClass = $oFilter->GetClass();
$aExtraParams = array('selection_type' => 'multiple', 'selection_mode' => true, 'display_limit' => false, 'menu' => false);
if ($iBulkActionAllowed == UR_ALLOWED_DEPENDS) {
$aAllowed = array();
$aExtraParams['selection_enabled'] = $oChecker->GetAllowedIDs();
} else {
if (UR_ALLOWED_NO) {
throw new ApplicationException(Dict::Format('UI:ActionNotAllowed'));
}
}
$oBlock = new DisplayBlock($oFilter, 'list', false);
$oP->add("<form method=\"post\" action=\"./UI.php\">\n");
$oP->add("<input type=\"hidden\" name=\"operation\" value=\"{$sNextOperation}\">\n");
$oP->add("<input type=\"hidden\" name=\"class\" value=\"" . $oFilter->GetClass() . "\">\n");
$oP->add("<input type=\"hidden\" name=\"filter\" value=\"" . $oFilter->Serialize() . "\">\n");
$oP->add("<input type=\"hidden\" name=\"transaction_id\" value=\"" . utils::GetNewTransactionId() . "\">\n");
foreach ($aExtraFormParams as $sName => $sValue) {
$oP->add("<input type=\"hidden\" name=\"{$sName}\" value=\"{$sValue}\">\n");
}
$oP->add($oAppContext->GetForForm());
$oBlock->Display($oP, 1, $aExtraParams);
$oP->add("<input type=\"button\" value=\"" . Dict::S('UI:Button:Cancel') . "\" onClick=\"window.history.back()\"> <input type=\"submit\" value=\"" . Dict::S('UI:Button:Next') . "\">\n");
$oP->add("</form>\n");
$oP->add_ready_script("\$('#1 table.listResults').trigger('check_all');");
}