當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Dict::S方法代碼示例

本文整理匯總了PHP中Dict::S方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dict::S方法的具體用法?PHP Dict::S怎麽用?PHP Dict::S使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Dict的用法示例。


在下文中一共展示了Dict::S方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ShowExamples

function ShowExamples($oP, $sExpression)
{
    $bUsingExample = false;
    $aExamples = array('Pedagogic examples' => array("Web applications" => "SELECT WebApplication", "Person having an 'A' in their name" => "SELECT Person AS B WHERE B.name LIKE '%A%'", "Servers having a name like dbserver1.demo.com or dbserver023.foo.fr" => "SELECT Server WHERE name REGEXP '^dbserver[0-9]+\\\\..+\\\\.[a-z]{2,3}\$'", "Changes planned on new year's day" => "SELECT Change AS ch WHERE ch.start_date >= '2009-12-31' AND ch.end_date <= '2010-01-01'", "IPs in a range" => "SELECT DatacenterDevice AS dev WHERE INET_ATON(dev.managementip) > INET_ATON('10.22.32.224') AND INET_ATON(dev.managementip) < INET_ATON('10.22.32.255')", "Persons below a given root organization" => "SELECT Person AS P JOIN Organization AS Node ON P.org_id = Node.id JOIN Organization AS Root ON Node.parent_id BELOW Root.id WHERE Root.id=1"), 'Usefull examples' => array("NW interfaces of equipment in production for customer 'Demo'" => "SELECT PhysicalInterface AS if JOIN DatacenterDevice AS dev ON if.connectableci_id = dev.id WHERE dev.status = 'production' AND dev.organization_name = 'Demo'", "My tickets" => "SELECT Ticket AS t WHERE t.agent_id = :current_contact_id", "People being owner of an active ticket" => "SELECT Person AS p JOIN UserRequest AS u ON u.agent_id = p.id WHERE u.status != 'closed'", "Contracts terminating in the next thirty days" => "SELECT Contract AS c WHERE c.end_date > NOW() AND c.end_date < DATE_ADD(NOW(), INTERVAL 30 DAY)", "Orphan tickets (opened one hour ago, still not assigned)" => "SELECT UserRequest AS u WHERE u.start_date < DATE_SUB(NOW(), INTERVAL 60 MINUTE) AND u.status = 'new'", "Long lasting incidents (duration > 8 hours)" => "SELECT UserRequest AS u WHERE u.close_date > DATE_ADD(u.start_date, INTERVAL 8 HOUR)"));
    $aDisplayData = array();
    $oAppContext = new ApplicationContext();
    $sContext = $oAppContext->GetForForm();
    foreach ($aExamples as $sTopic => $aQueries) {
        foreach ($aQueries as $sDescription => $sOql) {
            $sHighlight = '';
            $sDisable = '';
            if ($sOql == $sExpression) {
                // this one is currently being tested, highlight it
                $sHighlight = "background-color:yellow;";
                $sDisable = 'disabled';
                // and remember we are testing a query of the list
                $bUsingExample = true;
            }
            //$aDisplayData[$sTopic][] = array(
            $aDisplayData[Dict::S('UI:RunQuery:QueryExamples')][] = array('desc' => "<div style=\"{$sHighlight}\">" . htmlentities($sDescription, ENT_QUOTES, 'UTF-8') . "</div>", 'oql' => "<div style=\"{$sHighlight}\">" . htmlentities($sOql, ENT_QUOTES, 'UTF-8') . "</div>", 'go' => "<form method=\"get\"><input type=\"hidden\" name=\"expression\" value=\"{$sOql}\"><input type=\"submit\" value=\"" . Dict::S('UI:Button:Test') . "\" {$sDisable}>{$sContext}</form>\n");
        }
    }
    $aDisplayConfig = array();
    $aDisplayConfig['desc'] = array('label' => Dict::S('UI:RunQuery:HeaderPurpose'), 'description' => Dict::S('UI:RunQuery:HeaderPurpose+'));
    $aDisplayConfig['oql'] = array('label' => Dict::S('UI:RunQuery:HeaderOQLExpression'), 'description' => Dict::S('UI:RunQuery:HeaderOQLExpression+'));
    $aDisplayConfig['go'] = array('label' => '', 'description' => '');
    foreach ($aDisplayData as $sTopic => $aQueriesDisplayData) {
        $bShowOpened = $bUsingExample;
        $oP->StartCollapsibleSection($sTopic, $bShowOpened);
        $oP->table($aDisplayConfig, $aQueriesDisplayData);
        $oP->EndCollapsibleSection();
    }
}
開發者ID:leandroborgeseng,項目名稱:bhtm,代碼行數:33,代碼來源:run_query.php

示例2: DisplayBareProperties

 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;
 }
開發者ID:henryavila,項目名稱:itop,代碼行數:28,代碼來源:query.class.inc.php

示例3: DisplayDetails

 function DisplayDetails(WebPage $oPage, $bEditMode = false)
 {
     // Object's details
     //$this->DisplayBareHeader($oPage, $bEditMode);
     $oPage->AddTabContainer(OBJECT_PROPERTIES_TAB);
     $oPage->SetCurrentTabContainer(OBJECT_PROPERTIES_TAB);
     $oPage->SetCurrentTab(Dict::S('UI:PropertiesTab'));
     $this->DisplayBareProperties($oPage, $bEditMode);
 }
開發者ID:kira8565,項目名稱:ITOP203-ZHCN,代碼行數:9,代碼來源:event.class.inc.php

示例4: MakeDictEntry

function MakeDictEntry($sKey, $sValueFromOldSystem, $sDefaultValue, &$bNotInDico)
{
    $sValue = Dict::S($sKey, 'x-no-nothing');
    if ($sValue == 'x-no-nothing') {
        $bNotInDico = true;
        $sValue = $sValueFromOldSystem;
        if (strlen($sValue) == 0) {
            $sValue = $sDefaultValue;
        }
    }
    return "\t'{$sKey}' => '" . str_replace("'", "\\'", $sValue) . "',\n";
}
開發者ID:leandroborgeseng,項目名稱:bhtm,代碼行數:12,代碼來源:ajax.toolkit.php

示例5: ComputeResults

 public function ComputeResults()
 {
     $this->m_iToDelete = 0;
     $this->m_iToUpdate = 0;
     foreach ($this->m_aToDelete as $sClass => $aToDelete) {
         foreach ($aToDelete as $iId => $aData) {
             $this->m_iToDelete++;
             if (isset($aData['issue'])) {
                 $this->m_bFoundStopper = true;
                 $this->m_bFoundManualOperation = true;
                 if (isset($aData['issue_security'])) {
                     $this->m_bFoundSecurityIssue = true;
                 }
             }
             if ($aData['mode'] == DEL_MANUAL) {
                 $this->m_aToDelete[$sClass][$iId]['issue'] = $sClass . '::' . $iId . ' ' . Dict::S('UI:Delete:MustBeDeletedManually');
                 $this->m_bFoundStopper = true;
                 $this->m_bFoundManualDelete = true;
             }
         }
     }
     // Getting and setting time limit are not symetric:
     // www.php.net/manual/fr/function.set-time-limit.php#72305
     $iPreviousTimeLimit = ini_get('max_execution_time');
     $iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop');
     foreach ($this->m_aToUpdate as $sClass => $aToUpdate) {
         foreach ($aToUpdate as $iId => $aData) {
             set_time_limit($iLoopTimeLimit);
             $this->m_iToUpdate++;
             $oObject = $aData['to_reset'];
             $aExtKeyLabels = array();
             foreach ($aData['attributes'] as $sRemoteExtKey => $aRemoteAttDef) {
                 $oObject->Set($sRemoteExtKey, $aData['values'][$sRemoteExtKey]);
                 $aExtKeyLabels[] = $aRemoteAttDef->GetLabel();
             }
             $this->m_aToUpdate[$sClass][$iId]['attributes_list'] = implode(', ', $aExtKeyLabels);
             list($bRes, $aIssues, $bSecurityIssues) = $oObject->CheckToWrite();
             if (!$bRes) {
                 $this->m_aToUpdate[$sClass][$iId]['issue'] = implode(', ', $aIssues);
                 $this->m_bFoundStopper = true;
                 if ($bSecurityIssues) {
                     $this->m_aToUpdate[$sClass][$iId]['issue_security'] = true;
                     $this->m_bFoundSecurityIssue = true;
                 }
             }
         }
     }
     set_time_limit($iPreviousTimeLimit);
 }
開發者ID:leandroborgeseng,項目名稱:bhtm,代碼行數:49,代碼來源:deletionplan.class.inc.php

示例6: Display

 /**
  * Get the HTML fragment corresponding to the linkset editing widget
  * @param WebPage $oP The web page used for all the output
  * @param Hash $aArgs Extra context arguments
  * @return string The HTML fragment to be inserted into the page
  */
 public function Display(WebPage $oPage, $aArgs = array())
 {
     $sCode = $this->sAttCode . $this->sNameSuffix;
     $iWidgetIndex = self::$iWidgetIndex;
     $aPasswordValues = utils::ReadPostedParam("attr_{$sCode}", null, 'raw_data');
     $sPasswordValue = $aPasswordValues ? $aPasswordValues['value'] : '*****';
     $sConfirmPasswordValue = $aPasswordValues ? $aPasswordValues['confirm'] : '*****';
     $sChangedValue = $sPasswordValue != '*****' || $sConfirmPasswordValue != '*****' ? 1 : 0;
     $sHtmlValue = '';
     $sHtmlValue = '<input type="password" maxlength="255" name="attr_' . $sCode . '[value]" id="' . $this->iId . '" value="' . htmlentities($sPasswordValue, ENT_QUOTES, 'UTF-8') . '"/>&nbsp;<span class="form_validation" id="v_' . $this->iId . '"></span><br/>';
     $sHtmlValue .= '<input type="password" maxlength="255" id="' . $this->iId . '_confirm" value="' . htmlentities($sConfirmPasswordValue, ENT_QUOTES, 'UTF-8') . '" name="attr_' . $sCode . '[confirm]"/> ' . Dict::S('UI:PasswordConfirm') . ' <input id="' . $this->iId . '_reset" type="button" value="' . Dict::S('UI:Button:ResetPassword') . '" onClick="ResetPwd(\'' . $this->iId . '\');">';
     $sHtmlValue .= '<input type="hidden" id="' . $this->iId . '_changed" name="attr_' . $sCode . '[changed]" value="' . $sChangedValue . '"/>';
     $oPage->add_ready_script("\$('#{$this->iId}').bind('keyup change', function(evt) { return PasswordFieldChanged('{$this->iId}') } );");
     // Bind to a custom event: validate
     $oPage->add_ready_script("\$('#{$this->iId}').bind('keyup change validate', function(evt, sFormId) { return ValidatePasswordField('{$this->iId}', sFormId) } );");
     // Bind to a custom event: validate
     $oPage->add_ready_script("\$('#{$this->iId}_confirm').bind('keyup change', function(evt, sFormId) { return ValidatePasswordField('{$this->iId}', sFormId) } );");
     // Bind to a custom event: validate
     $oPage->add_ready_script("\$('#{$this->iId}').bind('update', function(evt, sFormId)\n\t\t\t{\n\t\t\t\tif (\$(this).attr('disabled'))\n\t\t\t\t{\n\t\t\t\t\t\$('#{$this->iId}_confirm').attr('disabled', 'disabled');\n\t\t\t\t\t\$('#{$this->iId}_changed').attr('disabled', 'disabled');\n\t\t\t\t\t\$('#{$this->iId}_reset').attr('disabled', 'disabled');\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t\$('#{$this->iId}_confirm').removeAttr('disabled');\n\t\t\t\t\t\$('#{$this->iId}_changed').removeAttr('disabled');\n\t\t\t\t\t\$('#{$this->iId}_reset').removeAttr('disabled');\n\t\t\t\t}\n\t\t\t}\n\t\t);");
     // Bind to a custom event: update to handle enabling/disabling
     return $sHtmlValue;
 }
開發者ID:leandroborgeseng,項目名稱:bhtm,代碼行數:28,代碼來源:ui.passwordwidget.class.inc.php

示例7: str_replace

            $sConfig = str_replace("\r\n", "\n", file_get_contents($sConfigFile));
            $sOrginalConfig = $sConfig;
        }
        $sConfigEscaped = htmlentities($sConfig, ENT_QUOTES, 'UTF-8');
        $sOriginalConfigEscaped = htmlentities($sOrginalConfig, ENT_QUOTES, 'UTF-8');
        $oP->p(Dict::S('config-edit-intro'));
        $oP->add("<form method=\"POST\">");
        $oP->add("<input type=\"hidden\" name=\"operation\" value=\"save\">");
        $oP->add("<input type=\"submit\" value=\"" . Dict::S('config-apply') . "\"><button onclick=\"ResetConfig(); return false;\">" . Dict::S('config-cancel') . "</button>");
        $oP->add("<span class=\"current_line\">" . Dict::Format('config-current-line', "<span class=\"line_number\"></span>") . "</span>");
        $oP->add("<input type=\"hidden\" id=\"prev_config\" name=\"prev_config\" value=\"{$sOriginalConfigEscaped}\">");
        $oP->add("<textarea id =\"new_config\" name=\"new_config\" onkeyup=\"UpdateLineNumber();\" onmouseup=\"UpdateLineNumber();\">{$sConfigEscaped}</textarea>");
        $oP->add("<input type=\"submit\" value=\"" . Dict::S('config-apply') . "\"><button onclick=\"ResetConfig(); return false;\">" . Dict::S('config-cancel') . "</button>");
        $oP->add("<span class=\"current_line\">" . Dict::Format('config-current-line', "<span class=\"line_number\"></span>") . "</span>");
        $oP->add("</form>");
        $sConfirmCancel = addslashes(Dict::S('config-confirm-cancel'));
        $oP->add_script(<<<EOF
function UpdateLineNumber()
{
\tvar oTextArea = \$('#new_config')[0];
\t\$('.line_number').html(oTextArea.value.substr(0, oTextArea.selectionStart).split("\\n").length);
\t\$('.current_line').show();
}
function ResetConfig()
{
\tif (\$('#new_config').val() != \$('#prev_config').val())
\t{
\t\tif (confirm('{$sConfirmCancel}'))
\t\t{
\t\t\t\$('#new_config').val(\$('#prev_config').val());
\t\t}
開發者ID:leandroborgeseng,項目名稱:bhtm,代碼行數:31,代碼來源:config.php

示例8: WizardFormButtons

 public function WizardFormButtons($iButtonFlags)
 {
     $aButtons = array();
     if ($iButtonFlags & BUTTON_CANCEL) {
         $aButtons[] = "<input id=\"btn_cancel\" type=\"button\" value=\"" . Dict::S('UI:Button:Cancel') . "\" onClick=\"GoHome();\">";
     }
     if ($iButtonFlags & BUTTON_BACK) {
         if (utils::ReadParam('step_back', 1) != 1) {
             $aButtons[] = "<input id=\"btn_back\" type=\"submit\" value=\"" . Dict::S('UI:Button:Back') . "\"  onClick=\"GoBack('{$this->m_sWizardId}');\">";
         }
     }
     if ($iButtonFlags & BUTTON_NEXT) {
         $aButtons[] = "<input id=\"btn_next\" type=\"submit\" value=\"" . Dict::S('UI:Button:Next') . "\">";
     }
     if ($iButtonFlags & BUTTON_FINISH) {
         $aButtons[] = "<input id=\"btn_finish\" type=\"submit\" value=\"" . Dict::S('UI:Button:Finish') . "\">";
     }
     $this->add('<div id="buttons">');
     $this->add(implode('', $aButtons));
     $this->add('</div>');
 }
開發者ID:leandroborgeseng,項目名稱:bhtm,代碼行數:21,代碼來源:portalwebpage.class.inc.php

示例9: GetOwnershipJSHandler

    /**
     * Generates the javascript code handle the "watchdog" associated with the concurrent access locking mechanism
     * @param Webpage $oPage
     * @param string $sOwnershipToken
     */
    protected function GetOwnershipJSHandler($oPage, $sOwnershipToken)
    {
        $iInterval = max(MIN_WATCHDOG_INTERVAL, MetaModel::GetConfig()->Get('concurrent_lock_expiration_delay')) * 1000 / 2;
        // Minimum interval for the watchdog is MIN_WATCHDOG_INTERVAL
        $sJSClass = json_encode(get_class($this));
        $iKey = (int) $this->GetKey();
        $sJSToken = json_encode($sOwnershipToken);
        $sJSTitle = json_encode(Dict::S('UI:DisconnectedDlgTitle'));
        $sJSOk = json_encode(Dict::S('UI:Button:Ok'));
        $oPage->add_ready_script(<<<EOF
\t\twindow.setInterval(function() {
\t\t\tif (window.bInSubmit || window.bInCancel) return;
\t\t\t
\t\t\t\$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', {operation: 'extend_lock', obj_class: {$sJSClass}, obj_key: {$iKey}, token: {$sJSToken} }, function(data) {
\t\t\t\tif (!data.status)
\t\t\t\t{
\t\t\t\t\tif (\$('.lock_owned').length == 0)
\t\t\t\t\t{
\t\t\t\t\t\t\$('.ui-layout-content').prepend('<div class="header_message message_error lock_owned">'+data.message+'</div>');
\t\t\t\t\t\t\$('<div>'+data.popup_message+'</div>').dialog({title: {$sJSTitle}, modal: true, autoOpen: true, buttons:[ {text: {$sJSOk}, click: function() { \$(this).dialog('close'); } }], close: function() { \$(this).remove(); }});
\t\t\t\t\t}
\t\t\t\t\t\$('.wizContainer form button.action:not(.cancel)').attr('disabled', 'disabled');
\t\t\t\t}
\t\t\t\telse if ((data.operation == 'lost') || (data.operation == 'expired'))
\t\t\t\t{
\t\t\t\t\tif (\$('.lock_owned').length == 0)
\t\t\t\t\t{
\t\t\t\t\t\t\$('.ui-layout-content').prepend('<div class="header_message message_error lock_owned">'+data.message+'</div>');
\t\t\t\t\t\t\$('<div>'+data.popup_message+'</div>').dialog({title: {$sJSTitle}, modal: true, autoOpen: true, buttons:[ {text: {$sJSOk}, click: function() { \$(this).dialog('close'); } }], close: function() { \$(this).remove(); }});
\t\t\t\t\t}
\t\t\t\t\t\$('.wizContainer form button.action:not(.cancel)').attr('disabled', 'disabled');
\t\t\t\t}
\t\t\t}, 'json');
\t\t}, {$iInterval});
EOF
);
    }
開發者ID:besmirzanaj,項目名稱:itop-code,代碼行數:42,代碼來源:cmdbabstract.class.inc.php

示例10: HandleOperations

 protected static function HandleOperations($operation)
 {
     $sMessage = '';
     // most of the operations never return, but some can return a message to be displayed
     if ($operation == 'logoff') {
         if (isset($_SESSION['login_mode'])) {
             $sLoginMode = $_SESSION['login_mode'];
         } else {
             $aAllowedLoginTypes = MetaModel::GetConfig()->GetAllowedLoginTypes();
             if (count($aAllowedLoginTypes) > 0) {
                 $sLoginMode = $aAllowedLoginTypes[0];
             } else {
                 $sLoginMode = 'form';
             }
         }
         self::ResetSession();
         $oPage = self::NewLoginWebPage();
         $oPage->DisplayLoginForm($sLoginMode, false);
         $oPage->output();
         exit;
     } else {
         if ($operation == 'forgot_pwd') {
             $oPage = self::NewLoginWebPage();
             $oPage->DisplayForgotPwdForm();
             $oPage->output();
             exit;
         } else {
             if ($operation == 'forgot_pwd_go') {
                 $oPage = self::NewLoginWebPage();
                 $oPage->ForgotPwdGo();
                 $oPage->output();
                 exit;
             } else {
                 if ($operation == 'reset_pwd') {
                     $oPage = self::NewLoginWebPage();
                     $oPage->DisplayResetPwdForm();
                     $oPage->output();
                     exit;
                 } else {
                     if ($operation == 'do_reset_pwd') {
                         $oPage = self::NewLoginWebPage();
                         $oPage->DoResetPassword();
                         $oPage->output();
                         exit;
                     } else {
                         if ($operation == 'change_pwd') {
                             $sAuthUser = $_SESSION['auth_user'];
                             UserRights::Login($sAuthUser);
                             // Set the user's language
                             $oPage = self::NewLoginWebPage();
                             $oPage->DisplayChangePwdForm();
                             $oPage->output();
                             exit;
                         }
                     }
                 }
             }
         }
     }
     if ($operation == 'do_change_pwd') {
         $sAuthUser = $_SESSION['auth_user'];
         UserRights::Login($sAuthUser);
         // Set the user's language
         $sOldPwd = utils::ReadPostedParam('old_pwd', '', false, 'raw_data');
         $sNewPwd = utils::ReadPostedParam('new_pwd', '', false, 'raw_data');
         if (UserRights::CanChangePassword() && (!UserRights::CheckCredentials($sAuthUser, $sOldPwd) || !UserRights::ChangePassword($sOldPwd, $sNewPwd))) {
             $oPage = self::NewLoginWebPage();
             $oPage->DisplayChangePwdForm(true);
             // old pwd was wrong
             $oPage->output();
             exit;
         }
         $sMessage = Dict::S('UI:Login:PasswordChanged');
     }
     return $sMessage;
 }
開發者ID:besmirzanaj,項目名稱:itop-code,代碼行數:76,代碼來源:loginwebpage.class.inc.php

示例11: InteractiveShell

function InteractiveShell($sExpression, $sQueryId, $sFormat, $sFileName, $sMode)
{
    if ($sMode == 'dialog') {
        $oP = new ajax_page('');
        $oP->add('<div id="interactive_export_dlg">');
        $sExportBtnLabel = json_encode(Dict::S('UI:Button:Export'));
        $sJSTitle = json_encode(htmlentities(utils::ReadParam('dialog_title', '', false, 'raw_data'), ENT_QUOTES, 'UTF-8'));
        $oP->add_ready_script(<<<EOF
\t\t\$('#interactive_export_dlg').dialog({
\t\t\tautoOpen: true,
\t\t\tmodal: true,
\t\t\twidth: '80%',
\t\t\ttitle: {$sJSTitle},
\t\t\tclose: function() { \$('#export-form').attr('data-state', 'cancelled'); \$(this).remove(); },
\t\t\tbuttons: [
\t\t\t\t{text: {$sExportBtnLabel}, id: 'export-dlg-submit', click: function() {} }
\t\t\t]
\t\t});
\t\t\t
\t\tsetTimeout(function() { \$('#interactive_export_dlg').dialog('option', { position: { my: "center", at: "center", of: window }}); \$('#export-btn').hide(); ExportInitButton('#export-dlg-submit'); }, 100);
EOF
);
    } else {
        $oP = new iTopWebPage('iTop Export');
    }
    if ($sExpression === null) {
        // No expression supplied, let's check if phrasebook entry is given
        if ($sQueryId !== 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 = trim($oQuery->Get('fields'));
            } else {
                ReportErrorAndExit("Invalid query phrasebook identifier: '{$sQueryId}'");
            }
        } else {
            if (utils::IsModeCLI()) {
                Usage();
                ReportErrorAndExit("No expression or query phrasebook identifier supplied.");
            } else {
                // form to enter an OQL query or pick a query phrasebook identifier
                DisplayForm($oP, utils::GetAbsoluteUrlAppRoot() . 'webservices/export-v2.php', $sExpression, $sQueryId, $sFormat);
                $oP->output();
                exit;
            }
        }
    }
    if ($sFormat !== null) {
        $oExporter = BulkExport::FindExporter($sFormat);
        if ($oExporter === null) {
            $aSupportedFormats = BulkExport::FindSupportedFormats();
            ReportErrorAndExit("Invalid output format: '{$sFormat}'. The supported formats are: " . implode(', ', array_keys($aSupportedFormats)));
        } else {
            DisplayForm($oP, utils::GetAbsoluteUrlAppRoot() . 'webservices/export-v2.php', $sExpression, $sQueryId, $sFormat);
        }
    } else {
        DisplayForm($oP, utils::GetAbsoluteUrlAppRoot() . 'webservices/export-v2.php', $sExpression, $sQueryId, $sFormat);
    }
    if ($sMode == 'dialog') {
        $oP->add('</div>');
    }
    $oP->output();
}
開發者ID:henryavila,項目名稱:itop,代碼行數:65,代碼來源:export-v2.php

示例12: DisplayAttachments

    public function DisplayAttachments($oObject, WebPage $oPage, $bEditMode = false)
    {
        // Exit here if the class is not allowed
        if (!$this->IsTargetObject($oObject)) {
            return;
        }
        $oSearch = DBObjectSearch::FromOQL("SELECT Attachment WHERE item_class = :class AND item_id = :item_id");
        $oSet = new DBObjectSet($oSearch, array(), array('class' => get_class($oObject), 'item_id' => $oObject->GetKey()));
        if ($this->GetAttachmentsPosition() == 'relations') {
            $sTitle = $oSet->Count() > 0 ? Dict::Format('Attachments:TabTitle_Count', $oSet->Count()) : Dict::S('Attachments:EmptyTabTitle');
            $oPage->SetCurrentTab($sTitle);
        }
        $oPage->add_style(<<<EOF
.attachment {
\tdisplay: inline-block;
\ttext-align:center;
\tfloat:left;
\tpadding:5px;\t
}
.attachment:hover {
\tbackground-color: #e0e0e0;
}
.attachment img {
\tborder: 0;
}
.attachment a {
\ttext-decoration: none;
\tcolor: #1C94C4;
}
.btn_hidden {
\tdisplay: none;
}
.drag_in {
\t-webkit-box-shadow:inset 0 0 10px 2px #1C94C4;
\tbox-shadow:inset 0 0 10px 2px #1C94C4;
}
#history .attachment-history-added {
\tpadding: 0;
\tfloat: none;
}
EOF
);
        $oPage->add('<fieldset>');
        $oPage->add('<legend>' . Dict::S('Attachments:FieldsetTitle') . '</legend>');
        if ($bEditMode) {
            $sIsDeleteEnabled = $this->m_bDeleteEnabled ? 'true' : 'false';
            $iTransactionId = $oPage->GetTransactionId();
            $sClass = get_class($oObject);
            $sTempId = session_id() . '_' . $iTransactionId;
            $sDeleteBtn = Dict::S('Attachments:DeleteBtn');
            $oPage->add_script(<<<EOF
\tfunction RemoveAttachment(att_id)
\t{
\t\t\$('#attachment_'+att_id).attr('name', 'removed_attachments[]');
\t\t\$('#display_attachment_'+att_id).hide();
\t\t\$('#attachment_plugin').trigger('remove_attachment', [att_id]);
\t\treturn false; // Do not submit the form !
\t}
EOF
);
            $oPage->add('<span id="attachments">');
            while ($oAttachment = $oSet->Fetch()) {
                $iAttId = $oAttachment->GetKey();
                $oDoc = $oAttachment->Get('contents');
                $sFileName = $oDoc->GetFileName();
                $sIcon = utils::GetAbsoluteUrlAppRoot() . AttachmentPlugIn::GetFileIcon($sFileName);
                $sPreview = $oDoc->IsPreviewAvailable() ? 'true' : 'false';
                $sDownloadLink = utils::GetAbsoluteUrlAppRoot() . 'pages/ajax.render.php?operation=download_document&class=Attachment&id=' . $iAttId . '&field=contents';
                $oPage->add('<div class="attachment" id="display_attachment_' . $iAttId . '"><a data-preview="' . $sPreview . '" href="' . $sDownloadLink . '"><img src="' . $sIcon . '"><br/>' . $sFileName . '<input id="attachment_' . $iAttId . '" type="hidden" name="attachments[]" value="' . $iAttId . '"/></a><br/>&nbsp;<input id="btn_remove_' . $iAttId . '" type="button" class="btn_hidden" value="Delete" onClick="RemoveAttachment(' . $iAttId . ');"/>&nbsp;</div>');
            }
            // Suggested attachments are listed here but treated as temporary
            $aDefault = utils::ReadParam('default', array(), false, 'raw_data');
            if (array_key_exists('suggested_attachments', $aDefault)) {
                $sSuggestedAttachements = $aDefault['suggested_attachments'];
                if (is_array($sSuggestedAttachements)) {
                    $sSuggestedAttachements = implode(',', $sSuggestedAttachements);
                }
                $oSearch = DBObjectSearch::FromOQL("SELECT Attachment WHERE id IN({$sSuggestedAttachements})");
                $oSet = new DBObjectSet($oSearch, array());
                if ($oSet->Count() > 0) {
                    while ($oAttachment = $oSet->Fetch()) {
                        // Mark the attachments as temporary attachments for the current object/form
                        $oAttachment->Set('temp_id', $sTempId);
                        $oAttachment->DBUpdate();
                        // Display them
                        $iAttId = $oAttachment->GetKey();
                        $oDoc = $oAttachment->Get('contents');
                        $sFileName = $oDoc->GetFileName();
                        $sIcon = utils::GetAbsoluteUrlAppRoot() . AttachmentPlugIn::GetFileIcon($sFileName);
                        $sDownloadLink = utils::GetAbsoluteUrlAppRoot() . 'pages/ajax.render.php?operation=download_document&class=Attachment&id=' . $iAttId . '&field=contents';
                        $sPreview = $oDoc->IsPreviewAvailable() ? 'true' : 'false';
                        $oPage->add('<div class="attachment" id="display_attachment_' . $iAttId . '"><a data-preview="' . $sPreview . '" href="' . $sDownloadLink . '"><img src="' . $sIcon . '"><br/>' . $sFileName . '<input id="attachment_' . $iAttId . '" type="hidden" name="attachments[]" value="' . $iAttId . '"/></a><br/>&nbsp;<input id="btn_remove_' . $iAttId . '" type="button" class="btn_hidden" value="Delete" onClick="RemoveAttachment(' . $iAttId . ');"/>&nbsp;</div>');
                        $oPage->add_ready_script("\$('#attachment_plugin').trigger('add_attachment', [{$iAttId}, '" . addslashes($sFileName) . "']);");
                    }
                }
            }
            $oPage->add('</span>');
            $oPage->add('<div style="clear:both"></div>');
            $sMaxUpload = $this->GetMaxUpload();
            $oPage->p(Dict::S('Attachments:AddAttachment') . '<input type="file" name="file" id="file"><span style="display:none;" id="attachment_loading">&nbsp;<img src="../images/indicator.gif"></span> ' . $sMaxUpload);
//.........這裏部分代碼省略.........
開發者ID:leandroborgeseng,項目名稱:bhtm,代碼行數:101,代碼來源:main.attachments.php

示例13: DoJob1

 /**
  * Do the synchronization job #1: Obsolete replica "untouched" for some time
  * @param integer $iMaxReplica Limit the number of replicas to process 
  * @param integer $iCurrPos Current position where to resume the processing 
  * @return true if the process must be continued
  */
 protected function DoJob1($iMaxReplica = null, $iCurrPos = -1)
 {
     $sLimitDate = $this->m_oLastFullLoadStartDate->Format('Y-m-d H:i:s');
     // Get all the replicas that were not seen in the last import and mark them as obsolete
     $sDeletePolicy = $this->m_oDataSource->Get('delete_policy');
     if ($sDeletePolicy != 'ignore') {
         $sSelectToObsolete = "SELECT SynchroReplica WHERE id > :curr_pos AND sync_source_id = :source_id AND status IN ('new', 'synchronized', 'modified', 'orphan') AND status_last_seen < :last_import";
         $oSetScope = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToObsolete), array(), array('source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sLimitDate, 'curr_pos' => $iCurrPos));
         $iCountScope = $oSetScope->Count();
         if ($this->m_iCountAllReplicas > 10 && $this->m_iCountAllReplicas == $iCountScope && MetaModel::GetConfig()->Get('synchro_prevent_delete_all')) {
             throw new SynchroExceptionNotStarted(Dict::S('Core:SyncTooManyMissingReplicas'));
         }
         if ($iMaxReplica) {
             // Consider a given subset, starting from replica iCurrPos, limited to the count of iMaxReplica
             // The replica have to be ordered by id
             $oSetToProcess = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToObsolete), array('id' => true), array('source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sLimitDate, 'curr_pos' => $iCurrPos));
             $oSetToProcess->SetLimit($iMaxReplica);
         } else {
             $oSetToProcess = $oSetScope;
         }
         $iLastReplicaProcessed = -1;
         while ($oReplica = $oSetToProcess->Fetch()) {
             $iLastReplicaProcessed = $oReplica->GetKey();
             switch ($sDeletePolicy) {
                 case 'update':
                 case 'update_then_delete':
                     $this->m_oStatLog->AddTrace("Destination object to be updated", $oReplica);
                     $aToUpdate = array();
                     $aToUpdateSpec = explode(';', $this->m_oDataSource->Get('delete_policy_update'));
                     //ex: 'status:obsolete;description:stopped',
                     foreach ($aToUpdateSpec as $sUpdateSpec) {
                         $aUpdateSpec = explode(':', $sUpdateSpec);
                         if (count($aUpdateSpec) == 2) {
                             $sAttCode = $aUpdateSpec[0];
                             $sValue = $aUpdateSpec[1];
                             $aToUpdate[$sAttCode] = $sValue;
                         }
                     }
                     $oReplica->Set('status_last_error', '');
                     if ($oReplica->Get('dest_id') == '') {
                         $oReplica->Set('status', 'obsolete');
                         $this->m_oStatLog->Inc('stats_nb_replica_disappeared_no_action');
                     } else {
                         $oReplica->UpdateDestObject($aToUpdate, $this->m_oChange, $this->m_oStatLog);
                         if ($oReplica->Get('status_last_error') == '') {
                             // Change the status of the replica IIF
                             $oReplica->Set('status', 'obsolete');
                         }
                     }
                     $oReplica->DBUpdateTracked($this->m_oChange);
                     break;
                 case 'delete':
                 default:
                     $this->m_oStatLog->AddTrace("Destination object to be DELETED", $oReplica);
                     $oReplica->DeleteDestObject($this->m_oChange, $this->m_oStatLog);
             }
         }
         if ($iMaxReplica) {
             if ($iMaxReplica < $iCountScope) {
                 // Continue with this job!
                 $this->m_oStatLog->Set('status_curr_pos', $iLastReplicaProcessed);
                 return true;
             }
         }
     }
     // if ($sDeletePolicy != 'ignore'
     //Count "seen" objects
     $sSelectSeen = "SELECT SynchroReplica WHERE sync_source_id = :source_id AND status IN ('new', 'synchronized', 'modified', 'orphan') AND status_last_seen >= :last_import";
     $oSetSeen = new DBObjectSet(DBObjectSearch::FromOQL($sSelectSeen), array(), array('source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sLimitDate));
     $this->m_oStatLog->Set('stats_nb_replica_seen', $oSetSeen->Count());
     // Job complete!
     $this->m_oStatLog->Set('status_curr_job', 2);
     $this->m_oStatLog->Set('status_curr_pos', -1);
     return false;
 }
開發者ID:kira8565,項目名稱:ITOP203-ZHCN,代碼行數:81,代碼來源:synchrodatasource.class.inc.php

示例14: DisplayBareRelations

 function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
 {
     parent::DisplayBareRelations($oPage, $bEditMode);
     if (!$bEditMode) {
         $oPage->SetCurrentTab(Dict::S('Class:Subnet/Tab:IPUsage'));
         $bit_ip = ip2long($this->Get('ip'));
         $bit_mask = ip2long($this->Get('ip_mask'));
         $iIPMin = sprintf('%u', $bit_ip & $bit_mask | 1);
         // exclude the first one: identifies the subnet itself
         $iIPMax = sprintf('%u', ($bit_ip | ~$bit_mask) & 0xfffffffe);
         // exclude the last one : broadcast address
         $sIPMin = long2ip($iIPMin);
         $sIPMax = long2ip($iIPMax);
         $oPage->p(Dict::Format('Class:Subnet/Tab:IPUsage-explain', $sIPMin, $sIPMax));
         $oIfFilter = DBObjectSearch::FromOQL("SELECT IPInterface AS if WHERE INET_ATON(if.ipaddress) >= INET_ATON('{$sIPMin}') AND INET_ATON(if.ipaddress) <= INET_ATON('{$sIPMax}')");
         $oIfSet = new CMDBObjectSet($oIfFilter);
         $oBlock = new DisplayBlock($oIfFilter, 'list', false);
         $oBlock->Display($oPage, 'nwif', array('menu' => false));
         $iCountUsed = $oIfSet->Count();
         $iCountRange = $iIPMax - $iIPMin;
         // On 32-bit systems the substraction will be computed using floats for values greater than PHP_MAX_INT;
         $iFreeCount = $iCountRange - $iCountUsed;
         $oPage->SetCurrentTab(Dict::S('Class:Subnet/Tab:FreeIPs'));
         $oPage->p(Dict::Format('Class:Subnet/Tab:FreeIPs-count', $iFreeCount));
         $oPage->p(Dict::S('Class:Subnet/Tab:FreeIPs-explain'));
         $aUsedIPs = $oIfSet->GetColumnAsArray('ipaddress', false);
         $iAnIP = $iIPMin;
         $iFound = 0;
         while ($iFound < min($iFreeCount, 10) && $iAnIP <= $iIPMax) {
             $sAnIP = long2ip($iAnIP);
             if (!in_array($sAnIP, $aUsedIPs)) {
                 $iFound++;
                 $oPage->p($sAnIP);
             } else {
             }
             $iAnIP++;
         }
     }
 }
開發者ID:leandroborgeseng,項目名稱:bhtm,代碼行數:39,代碼來源:model.itop-config-mgmt.php

示例15: GetDescription

 public function GetDescription($sDefault = null)
 {
     $sLabel = parent::GetDescription('');
     if (strlen($sLabel) == 0) {
         $sKeyAttCode = $this->Get("extkey_attcode");
         if ($sKeyAttCode == 'id') {
             return Dict::S('Core:FriendlyName-Description');
         } else {
             $oExtKeyAttDef = MetaModel::GetAttributeDef($this->GetHostClass(), $sKeyAttCode);
             $sLabel = $oExtKeyAttDef->GetDescription('');
         }
     }
     return $sLabel;
 }
開發者ID:leandroborgeseng,項目名稱:bhtm,代碼行數:14,代碼來源:attributedef.class.inc.php


注:本文中的Dict::S方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。