本文整理匯總了PHP中Dict::Format方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dict::Format方法的具體用法?PHP Dict::Format怎麽用?PHP Dict::Format使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dict
的用法示例。
在下文中一共展示了Dict::Format方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: GetCurrentUserName
public static function GetCurrentUserName()
{
if (UserRights::IsImpersonated()) {
$sUserString = Dict::Format('UI:Archive_User_OnBehalfOf_User', UserRights::GetRealUserFriendlyName(), UserRights::GetUserFriendlyName());
} else {
$sUserString = UserRights::GetUserFriendlyName();
}
return $sUserString;
}
示例2: GetUserFriendlyDescription
public function GetUserFriendlyDescription()
{
$sWrongClass = $this->GetWrongWord();
$sSuggest = self::FindClosestString($sWrongClass, $this->GetSuggestions());
if ($sSuggest != '') {
return Dict::Format('UI:OQL:UnknownClassAndFix', $sWrongClass, $sSuggest);
} else {
return Dict::Format('UI:OQL:UnknownClassNoFix', $sWrongClass);
}
}
示例3: TestConfig
function TestConfig($sContents, $oP)
{
try {
ini_set('display_errors', 1);
ob_start();
eval('?' . '>' . trim($sContents));
$sNoise = trim(ob_get_contents());
ob_end_clean();
} catch (Exception $e) {
// well, never reach in case of parsing error :-(
throw new Exception('Error in configuration: ' . $e->getMessage());
}
if (strlen($sNoise) > 0) {
if (preg_match("/(Error|Parse error|Notice|Warning): (.+) in \\S+ : eval\\(\\)'d code on line (\\d+)/i", strip_tags($sNoise), $aMatches)) {
$sMessage = $aMatches[2];
$sLine = $aMatches[3];
$iLine = (int) $sLine;
// Highlight the line
$aLines = explode("\n", $sContents);
$iStart = 0;
for ($i = 0; $i < $iLine - 1; $i++) {
$iStart += strlen($aLines[$i]);
}
$iEnd = $iStart + strlen($aLines[$iLine - 1]);
$iTotalLines = count($aLines);
$oP->add_ready_script(<<<EOF
setCursorPos(\$('#new_config')[0], {$iStart}, {$iEnd});
\$('#new_config')[0].focus();
var iScroll = Math.floor(\$('#new_config')[0].scrollHeight * ({$iLine} - 20) / {$iTotalLines});
\$('#new_config').scrollTop(iScroll);
EOF
);
$sMessage = Dict::Format('config-parse-error', $sMessage, $sLine);
throw new Exception($sMessage);
} else {
// Note: sNoise is an html output, but so far it was ok for me (e.g. showing the entire call stack)
throw new Exception('Syntax error in configuration file: <tt>' . $sNoise . '</tt>');
}
}
}
示例4: DisplayNavigatorListTab
function DisplayNavigatorListTab($oP, $aResults, $sRelation, $oObj)
{
$oP->SetCurrentTab(Dict::S('UI:RelationshipList'));
$oP->add("<div id=\"impacted_objects\" style=\"width:100%;background-color:#fff;padding:10px;\">");
$iBlock = 1;
// Zero is not a valid blockid
foreach ($aResults as $sListClass => $aObjects) {
$oSet = CMDBObjectSet::FromArray($sListClass, $aObjects);
$oP->add("<h1>" . MetaModel::GetRelationDescription($sRelation) . ' ' . $oObj->GetName() . "</h1>\n");
$oP->add("<div class=\"page_header\">\n");
$oP->add("<h2>" . MetaModel::GetClassIcon($sListClass) . " <span class=\"hilite\">" . Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', count($aObjects), Metamodel::GetName($sListClass)) . "</h2>\n");
$oP->add("</div>\n");
$oBlock = DisplayBlock::FromObjectSet($oSet, 'list');
$oBlock->Display($oP, $iBlock++);
$oP->P(' ');
// Some space ?
}
$oP->add("</div>");
}
示例5: count
} else {
$oPage->add("<table>");
$aFirstLine = $aData[0];
// Use the first row to determine the number of columns
$iStartLine = 0;
$iNbColumns = count($aFirstLine);
if ($bFirstLineAsHeader) {
$iStartLine = 1;
foreach ($aFirstLine as $sField) {
$aHeader[] = $sField;
}
} else {
// Build some conventional name for the fields: field1...fieldn
$index = 1;
foreach ($aFirstLine as $sField) {
$aHeader[] = Dict::Format('UI:CSVImport:FieldName', $index);
$index++;
}
}
$oPage->add("<table>\n");
$oPage->add('<tr>');
$oPage->add('<th>' . Dict::S('UI:CSVImport:HeaderFields') . '</th><th>' . Dict::S('UI:CSVImport:HeaderMappings') . '</th><th> </th><th>' . Dict::S('UI:CSVImport:HeaderSearch') . '</th><th>' . Dict::S('UI:CSVImport:DataLine1') . '</th><th>' . Dict::S('UI:CSVImport:DataLine2') . '</th>');
$oPage->add('</tr>');
$index = 1;
foreach ($aHeader as $sField) {
$sDefaultChoice = null;
if (isset($aInitFieldMapping[$index])) {
$sDefaultChoice = $aInitFieldMapping[$index];
}
$oPage->add('<tr>');
$oPage->add("<th>{$sField}</th>");
示例6: Login
//.........這裏部分代碼省略.........
}
break;
case 'external':
// Web server supplied authentication
$bExternalAuth = false;
$sExtAuthVar = MetaModel::GetConfig()->GetExternalAuthenticationVariable();
// In which variable is the info passed ?
eval('$sAuthUser = isset(' . $sExtAuthVar . ') ? ' . $sExtAuthVar . ' : false;');
// Retrieve the value
if ($sAuthUser && strlen($sAuthUser) > 0) {
$sAuthPwd = '';
// No password in this case the web server already authentified the user...
$sLoginMode = 'external';
$sAuthentication = 'external';
}
break;
case 'url':
// Credentials passed directly in the url
$sAuthUser = utils::ReadParam('auth_user', '', false, 'raw_data');
$sAuthPwd = utils::ReadParam('auth_pwd', null, false, 'raw_data');
if ($sAuthUser != '' && $sAuthPwd !== null) {
$sLoginMode = 'url';
}
break;
}
$index++;
}
//echo "\nsLoginMode: $sLoginMode (user: $sAuthUser / pwd: $sAuthPwd\n)";
if ($sLoginMode == '') {
// First connection
$sDesiredLoginMode = utils::ReadParam('login_mode');
if (in_array($sDesiredLoginMode, $aAllowedLoginTypes)) {
$sLoginMode = $sDesiredLoginMode;
} else {
$sLoginMode = $aAllowedLoginTypes[0];
// First in the list...
}
if (array_key_exists('HTTP_X_COMBODO_AJAX', $_SERVER)) {
// X-Combodo-Ajax is a special header automatically added to all ajax requests
// Let's reply that we're currently logged-out
header('HTTP/1.0 401 Unauthorized');
exit;
}
if ($iOnExit == self::EXIT_HTTP_401 || $sLoginMode == 'basic') {
header('WWW-Authenticate: Basic realm="' . Dict::Format('UI:iTopVersion:Short', ITOP_VERSION));
header('HTTP/1.0 401 Unauthorized');
header('Content-type: text/html; charset=iso-8859-1');
exit;
} else {
if ($iOnExit == self::EXIT_RETURN) {
if ($sAuthUser !== '' && $sAuthPwd === null) {
return self::EXIT_CODE_MISSINGPASSWORD;
} else {
return self::EXIT_CODE_MISSINGLOGIN;
}
} else {
$oPage = self::NewLoginWebPage();
$oPage->DisplayLoginForm($sLoginMode, false);
$oPage->output();
exit;
}
}
} else {
if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, $sLoginMode, $sAuthentication)) {
//echo "Check Credentials returned false for user $sAuthUser!";
self::ResetSession();
if ($iOnExit == self::EXIT_HTTP_401 || $sLoginMode == 'basic') {
header('WWW-Authenticate: Basic realm="' . Dict::Format('UI:iTopVersion:Short', ITOP_VERSION));
header('HTTP/1.0 401 Unauthorized');
header('Content-type: text/html; charset=iso-8859-1');
exit;
} else {
if ($iOnExit == self::EXIT_RETURN) {
return self::EXIT_CODE_WRONGCREDENTIALS;
} else {
$oPage = self::NewLoginWebPage();
$oPage->DisplayLoginForm($sLoginMode, true);
$oPage->output();
exit;
}
}
} else {
// User is Ok, let's save it in the session and proceed with normal login
UserRights::Login($sAuthUser, $sAuthentication);
// Login & set the user's language
if (MetaModel::GetConfig()->Get('log_usage')) {
$oLog = new EventLoginUsage();
$oLog->Set('userinfo', UserRights::GetUser());
$oLog->Set('user_id', UserRights::GetUserObject()->GetKey());
$oLog->Set('message', 'Successful login');
$oLog->DBInsertNoReload();
}
$_SESSION['auth_user'] = $sAuthUser;
$_SESSION['login_mode'] = $sLoginMode;
UserRights::_InitSessionCache();
}
}
}
return self::EXIT_CODE_OK;
}
示例7: DoUpdateObjectFromPostedForm
/**
* Updates the object form POSTED arguments, and writes it into the DB (applies a stimuli if requested)
* @param DBObject $oObj The object to update
* $param array $aAttList If set, this will limit the list of updated attributes
* @return void
*/
public function DoUpdateObjectFromPostedForm(DBObject $oObj, $aAttList = null)
{
$sTransactionId = utils::ReadPostedParam('transaction_id', '');
if (!utils::IsTransactionValid($sTransactionId)) {
throw new TransactionException();
}
$sClass = get_class($oObj);
$sStimulus = trim(utils::ReadPostedParam('apply_stimulus', ''));
$sTargetState = '';
if (!empty($sStimulus)) {
// Compute the target state
$aTransitions = $oObj->EnumTransitions();
if (!isset($aTransitions[$sStimulus])) {
throw new ApplicationException(Dict::Format('UI:Error:Invalid_Stimulus_On_Object_In_State', $sStimulus, $oObj->GetName(), $oObj->GetStateLabel()));
}
$sTargetState = $aTransitions[$sStimulus]['target_state'];
}
$oObj->UpdateObjectFromPostedForm('', $aAttList, $sTargetState);
// Optional: apply a stimulus
//
if (!empty($sStimulus)) {
if (!$oObj->ApplyStimulus($sStimulus)) {
throw new Exception("Cannot apply stimulus '{$sStimulus}' to {$oObj->GetName()}");
}
}
if ($oObj->IsModified()) {
// Record the change
//
$oObj->DBUpdate();
// Trigger ?
//
$aClasses = MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL);
$sClassList = implode(", ", CMDBSource::Quote($aClasses));
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnPortalUpdate AS t WHERE t.target_class IN ({$sClassList})"));
while ($oTrigger = $oSet->Fetch()) {
$oTrigger->DoActivate($oObj->ToArgs('this'));
}
$this->p("<h1>" . Dict::Format('UI:Class_Object_Updated', MetaModel::GetName(get_class($oObj)), $oObj->GetName()) . "</h1>\n");
}
$bLockEnabled = MetaModel::GetConfig()->Get('concurrent_lock_enabled');
if ($bLockEnabled) {
// Release the concurrent lock, if any
$sOwnershipToken = utils::ReadPostedParam('ownership_token', null, false, 'raw_data');
if ($sOwnershipToken !== null) {
// We're done, let's release the lock
iTopOwnershipLock::ReleaseLock(get_class($oObj), $oObj->GetKey(), $sOwnershipToken);
}
}
}
示例8: GetDescription
/**
* Describe (as a text string) the modifications corresponding to this change
*/
public function GetDescription()
{
$sResult = '';
$oTargetObjectClass = $this->Get('objclass');
$oTargetObjectKey = $this->Get('objkey');
$oTargetSearch = new DBObjectSearch($oTargetObjectClass);
$oTargetSearch->AddCondition('id', $oTargetObjectKey, '=');
$oMonoObjectSet = new DBObjectSet($oTargetSearch);
if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) {
if (!MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) {
return '';
}
// Protects against renamed attributes...
$oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode'));
$sAttName = $oAttDef->GetLabel();
$sLinkClass = $oAttDef->GetLinkedClass();
$aLinkClasses = MetaModel::EnumChildClasses($sLinkClass, ENUM_CHILD_CLASSES_ALL);
// Search for changes on the corresponding link
//
$oSearch = new DBObjectSearch('CMDBChangeOpSetAttribute');
$oSearch->AddCondition('change', $this->Get('change'), '=');
$oSearch->AddCondition('objkey', $this->Get('link_id'), '=');
if (count($aLinkClasses) == 1) {
// Faster than the whole building of the expression below for just one value ??
$oSearch->AddCondition('objclass', $sLinkClass, '=');
} else {
$oField = new FieldExpression('objclass', $oSearch->GetClassAlias());
$sListExpr = '(' . implode(', ', CMDBSource::Quote($aLinkClasses)) . ')';
$sOQLCondition = $oField->Render() . " IN {$sListExpr}";
$oNewCondition = Expression::FromOQL($sOQLCondition);
$oSearch->AddConditionExpression($oNewCondition);
}
$oSet = new DBObjectSet($oSearch);
$aChanges = array();
while ($oChangeOp = $oSet->Fetch()) {
$aChanges[] = $oChangeOp->GetDescription();
}
if (count($aChanges) == 0) {
return '';
}
$sItemDesc = MetaModel::GetHyperLink($this->Get('item_class'), $this->Get('item_id'));
$sResult = $sAttName . ' - ';
$sResult .= Dict::Format('Change:LinkSet:Modified', $sItemDesc);
$sResult .= ' : ' . implode(', ', $aChanges);
}
return $sResult;
}
示例9: GetDescription
/**
* Describe (as a text string) the modifications corresponding to this change
*/
public function GetDescription()
{
// Temporary, until we change the options of GetDescription() -needs a more global revision
$bIsHtml = true;
$sResult = Dict::Format('Attachments:History_File_Removed', '<span class="attachment-history-deleted">' . htmlentities($this->Get('filename'), ENT_QUOTES, 'UTF-8') . '</span>');
return $sResult;
}
示例10: catch
$oLog->Set('userinfo', '');
$oLog->Set('issue', $e->GetIssue());
$oLog->Set('impact', 'Page could not be displayed');
$oLog->Set('callstack', $e->getTrace());
$oLog->Set('data', $e->getContextData());
$oLog->DBInsertNoReload();
}
IssueLog::Error($e->getMessage());
}
// For debugging only
//throw $e;
} catch (Exception $e) {
require_once APPROOT . '/setup/setuppage.class.inc.php';
$oP = new SetupPage(Dict::S('UI:PageTitle:FatalError'));
$oP->add("<h1>" . Dict::S('UI:FatalErrorMessage') . "</h1>\n");
$oP->error(Dict::Format('UI:Error_Details', $e->getMessage()));
$oP->output();
if (MetaModel::IsLogEnabledIssue()) {
if (MetaModel::IsValidClass('EventIssue')) {
$oLog = new EventIssue();
$oLog->Set('message', $e->getMessage());
$oLog->Set('userinfo', '');
$oLog->Set('issue', 'PHP Exception');
$oLog->Set('impact', 'Page could not be displayed');
$oLog->Set('callstack', $e->getTrace());
$oLog->Set('data', array());
$oLog->DBInsertNoReload();
}
IssueLog::Error($e->getMessage());
}
}
示例11: output
/**
* Outputs (via some echo) the complete HTML page by assembling all its elements
*/
public function output()
{
$sAbsURLAppRoot = addslashes($this->m_sRootUrl);
//$this->set_base($this->m_sRootUrl.'pages/');
$sForm = $this->GetSiloSelectionForm();
$this->DisplayMenu();
// Compute the menu
// Call the extensions to add content to the page, so that they can also add styles or scripts
$sBannerExtraHtml = '';
foreach (MetaModel::EnumPlugins('iPageUIExtension') as $oExtensionInstance) {
$sBannerExtraHtml .= $oExtensionInstance->GetBannerHtml($this);
}
$sNorthPane = '';
foreach (MetaModel::EnumPlugins('iPageUIExtension') as $oExtensionInstance) {
$sNorthPane .= $oExtensionInstance->GetNorthPaneHtml($this);
}
if (UserRights::IsAdministrator() && ExecutionKPI::IsEnabled()) {
$sNorthPane .= '<div id="admin-banner"><span style="padding:5px;">' . ExecutionKPI::GetDescription() . '<span></div>';
}
//$sSouthPane = '<p>Peak memory Usage: '.sprintf('%.3f MB', memory_get_peak_usage(true) / (1024*1024)).'</p>';
$sSouthPane = '';
foreach (MetaModel::EnumPlugins('iPageUIExtension') as $oExtensionInstance) {
$sSouthPane .= $oExtensionInstance->GetSouthPaneHtml($this);
}
// Put here the 'ready scripts' that must be executed after all others
$aMultiselectOptions = array('header' => true, 'checkAllText' => Dict::S('UI:SearchValue:CheckAll'), 'uncheckAllText' => Dict::S('UI:SearchValue:UncheckAll'), 'noneSelectedText' => Dict::S('UI:SearchValue:Any'), 'selectedText' => Dict::S('UI:SearchValue:NbSelected'), 'selectedList' => 1);
$sJSMultiselectOptions = json_encode($aMultiselectOptions);
$this->add_ready_script(<<<EOF
\t\t// Since the event is only triggered when the hash changes, we need to trigger
\t\t// the event now, to handle the hash the page may have loaded with.
\t\t\$(window).trigger( 'hashchange' );
\t\t
\t\t// Some table are sort-able, some are not, let's fix this
\t\t\$('table.listResults').each( function() { FixTableSorter(\$(this)); } );
\t\t
\t\t\$('.multiselect').multiselect({$sJSMultiselectOptions});
\t\tFixSearchFormsDisposition();
EOF
);
if ($this->GetOutputFormat() == 'html') {
foreach ($this->a_headers as $s_header) {
header($s_header);
}
}
$s_captured_output = $this->ob_get_clean_safe();
$sHtml = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
$sHtml .= "<html>\n";
$sHtml .= "<head>\n";
// Make sure that Internet Explorer renders the page using its latest/highest/greatest standards !
$sHtml .= "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n";
$sHtml .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
$sHtml .= "<title>" . htmlentities($this->s_title, ENT_QUOTES, 'UTF-8') . "</title>\n";
$sHtml .= $this->get_base_tag();
// Stylesheets MUST be loaded before any scripts otherwise
// jQuery scripts may face some spurious problems (like failing on a 'reload')
foreach ($this->a_linked_stylesheets as $a_stylesheet) {
if ($a_stylesheet['condition'] != "") {
$sHtml .= "<!--[if {$a_stylesheet['condition']}]>\n";
}
$sHtml .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$a_stylesheet['link']}\" />\n";
if ($a_stylesheet['condition'] != "") {
$sHtml .= "<![endif]-->\n";
}
}
// special stylesheet for printing, hides the navigation gadgets
$sHtml .= "<link rel=\"stylesheet\" media=\"print\" type=\"text/css\" href=\"../css/print.css\" />\n";
if ($this->GetOutputFormat() == 'html') {
$sHtml .= $this->output_dict_entries(true);
// before any script so that they can benefit from the translations
foreach ($this->a_linked_scripts as $s_script) {
// Make sure that the URL to the script contains the application's version number
// so that the new script do NOT get reloaded from the cache when the application is upgraded
if (strpos($s_script, '?') === false) {
$s_script .= "?itopversion=" . ITOP_VERSION;
} else {
$s_script .= "&itopversion=" . ITOP_VERSION;
}
$sHtml .= "<script type=\"text/javascript\" src=\"{$s_script}\"></script>\n";
}
$this->add_script("var iPaneVisWatchDog = window.setTimeout('FixPaneVis()',5000);\n\$(document).ready(function() {\n{$this->m_sInitScript};\nwindow.setTimeout('onDelayedReady()',10)\n});");
if (count($this->m_aReadyScripts) > 0) {
$this->add_script("\nonDelayedReady = function() {\n" . implode("\n", $this->m_aReadyScripts) . "\n}\n");
}
if (count($this->a_scripts) > 0) {
$sHtml .= "<script type=\"text/javascript\">\n";
foreach ($this->a_scripts as $s_script) {
$sHtml .= "{$s_script}\n";
}
$sHtml .= "</script>\n";
}
}
if (count($this->a_styles) > 0) {
$sHtml .= "<style>\n";
foreach ($this->a_styles as $s_style) {
$sHtml .= "{$s_style}\n";
//.........這裏部分代碼省略.........
示例12: ToArgs
public function ToArgs($sArgName = 'this')
{
if (is_null($this->m_aAsArgs)) {
$oKPI = new ExecutionKPI();
$aScalarArgs = $this->ToArgsForQuery($sArgName);
$aScalarArgs[$sArgName] = $this->GetKey();
$aScalarArgs[$sArgName . '->id'] = $this->GetKey();
$aScalarArgs[$sArgName . '->hyperlink()'] = $this->GetHyperlink('iTopStandardURLMaker', false);
$aScalarArgs[$sArgName . '->hyperlink(portal)'] = $this->GetHyperlink('PortalURLMaker', false);
$aScalarArgs[$sArgName . '->name()'] = $this->GetName();
$sClass = get_class($this);
foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) {
if ($oAttDef instanceof AttributeCaseLog) {
$oCaseLog = $this->Get($sAttCode);
$aScalarArgs[$sArgName . '->' . $sAttCode] = $oCaseLog->GetText();
$sHead = $oCaseLog->GetLatestEntry();
$aScalarArgs[$sArgName . '->head(' . $sAttCode . ')'] = $sHead;
$aScalarArgs[$sArgName . '->head_html(' . $sAttCode . ')'] = '<div class="caselog_entry">' . str_replace(array("\r\n", "\n", "\r"), "<br/>", htmlentities($sHead, ENT_QUOTES, 'UTF-8')) . '</div>';
$aScalarArgs[$sArgName . '->html(' . $sAttCode . ')'] = $oCaseLog->GetAsEmailHtml();
} elseif ($oAttDef->IsScalar()) {
$aScalarArgs[$sArgName . '->' . $sAttCode] = $this->Get($sAttCode);
// #@# Note: This has been proven to be quite slow, this can slow down bulk load
$sAsHtml = $this->GetAsHtml($sAttCode);
$aScalarArgs[$sArgName . '->html(' . $sAttCode . ')'] = $sAsHtml;
$aScalarArgs[$sArgName . '->label(' . $sAttCode . ')'] = $this->GetEditValue($sAttCode);
// "Nice" display value, but without HTML tags and entities
} elseif ($oAttDef->IsLinkSet()) {
$sRemoteName = $oAttDef->IsIndirect() ? $oAttDef->GetExtKeyToRemote() . '_friendlyname' : 'friendlyname';
$oLinkSet = clone $this->Get($sAttCode);
// Workaround/Safety net for Trac #887
$iLimit = MetaModel::GetConfig()->Get('max_linkset_output');
if ($iLimit > 0) {
$oLinkSet->SetLimit($iLimit);
}
$aNames = $oLinkSet->GetColumnAsArray($sRemoteName);
if ($iLimit > 0) {
$iTotal = $oLinkSet->Count();
if ($iTotal > count($aNames)) {
$aNames[] = '... ' . Dict::Format('UI:TruncatedResults', count($aNames), $iTotal);
}
}
$sNames = implode("\n", $aNames);
$aScalarArgs[$sArgName . '->' . $sAttCode] = $sNames;
$aScalarArgs[$sArgName . '->html(' . $sAttCode . ')'] = '<ul><li>' . implode("</li><li>", $aNames) . '</li></ul>';
}
}
$this->m_aAsArgs = $aScalarArgs;
$oKPI->ComputeStats('ToArgs', get_class($this));
}
return $this->m_aAsArgs;
}
示例13: GetName
public function GetName()
{
return Dict::Format('UI:UserManagement:LinkBetween_User_And_Org', $this->Get('userlogin'), $this->Get('allowed_org_name'));
}
示例14: Display
/**
* Display the graph inside the given page, with the "filter" drawer above it
* @param WebPage $oP
* @param hash $aResults
* @param string $sRelation
* @param ApplicationContext $oAppContext
* @param array $aExcludedObjects
*/
function Display(WebPage $oP, $aResults, $sRelation, ApplicationContext $oAppContext, $aExcludedObjects = array(), $sObjClass = null, $iObjKey = null, $sContextKey, $aContextParams = array())
{
$aContextDefs = static::GetContextDefinitions($sContextKey, true, $aContextParams);
$aExcludedByClass = array();
foreach ($aExcludedObjects as $oObj) {
if (!array_key_exists(get_class($oObj), $aExcludedByClass)) {
$aExcludedByClass[get_class($oObj)] = array();
}
$aExcludedByClass[get_class($oObj)][] = $oObj->GetKey();
}
$oP->add("<div class=\"not-printable\">\n");
$oP->add("<div id=\"ds_flash\" class=\"SearchDrawer\" style=\"display:none;\">\n");
if (!$oP->IsPrintableVersion()) {
$oP->add_ready_script(<<<EOF
\t\$( "#tabbedContent_0" ).tabs({ heightStyle: "fill" });
EOF
);
}
$oP->add_ready_script(<<<EOF
\t\$("#dh_flash").click( function() {
\t\t\$("#ds_flash").slideToggle('normal', function() { \$("#ds_flash").parent().resize(); \$("#dh_flash").trigger('toggle_complete'); } );
\t\t\$("#dh_flash").toggleClass('open');
\t});
\$('#ReloadMovieBtn').button().button('disable');
EOF
);
$aSortedElements = array();
foreach ($aResults as $sClassIdx => $aObjects) {
foreach ($aObjects as $oCurrObj) {
$sSubClass = get_class($oCurrObj);
$aSortedElements[$sSubClass] = MetaModel::GetName($sSubClass);
}
}
asort($aSortedElements);
$idx = 0;
foreach ($aSortedElements as $sSubClass => $sClassName) {
$oP->add("<span style=\"padding-right:2em; white-space:nowrap;\"><input type=\"checkbox\" id=\"exclude_{$idx}\" name=\"excluded[]\" value=\"{$sSubClass}\" checked onChange=\"\$('#ReloadMovieBtn').button('enable')\"><label for=\"exclude_{$idx}\"> " . MetaModel::GetClassIcon($sSubClass) . " {$sClassName}</label></span> ");
$idx++;
}
$oP->add("<p style=\"text-align:right\"><button type=\"button\" id=\"ReloadMovieBtn\" onClick=\"DoReload()\">" . Dict::S('UI:Button:Refresh') . "</button></p>");
$oP->add("</div>\n");
$oP->add("<div class=\"HRDrawer\"></div>\n");
$oP->add("<div id=\"dh_flash\" class=\"DrawerHandle\">" . Dict::S('UI:ElementsDisplayed') . "</div>\n");
$oP->add("</div>\n");
// class="not-printable"
$aAdditionalContexts = array();
foreach ($aContextDefs as $sKey => $aDefinition) {
$aAdditionalContexts[] = array('key' => $sKey, 'label' => Dict::S($aDefinition['dict']), 'oql' => $aDefinition['oql'], 'default' => array_key_exists('default', $aDefinition) && $aDefinition['default'] == 'yes');
}
$sDirection = utils::ReadParam('d', 'horizontal');
$iGroupingThreshold = utils::ReadParam('g', 5);
$oP->add_linked_script(utils::GetAbsoluteUrlAppRoot() . 'js/fraphael.js');
$oP->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot() . 'css/jquery.contextMenu.css');
$oP->add_linked_script(utils::GetAbsoluteUrlAppRoot() . 'js/jquery.contextMenu.js');
$oP->add_linked_script(utils::GetAbsoluteUrlAppRoot() . 'js/simple_graph.js');
try {
$this->InitFromGraphviz();
$sExportAsPdfURL = '';
$sExportAsPdfURL = utils::GetAbsoluteUrlAppRoot() . 'pages/ajax.render.php?operation=relation_pdf&relation=' . $sRelation . '&direction=' . ($this->bDirectionDown ? 'down' : 'up');
$oAppcontext = new ApplicationContext();
$sContext = $oAppContext->GetForLink();
$sDrillDownURL = utils::GetAbsoluteUrlAppRoot() . 'pages/UI.php?operation=details&class=%1$s&id=%2$s&' . $sContext;
$sExportAsDocumentURL = utils::GetAbsoluteUrlAppRoot() . 'pages/ajax.render.php?operation=relation_attachment&relation=' . $sRelation . '&direction=' . ($this->bDirectionDown ? 'down' : 'up');
$sLoadFromURL = utils::GetAbsoluteUrlAppRoot() . 'pages/ajax.render.php?operation=relation_json&relation=' . $sRelation . '&direction=' . ($this->bDirectionDown ? 'down' : 'up');
$sAttachmentExportTitle = '';
if ($sObjClass != null && $iObjKey != null) {
$oTargetObj = MetaModel::GetObject($sObjClass, $iObjKey, false);
if ($oTargetObj) {
$sAttachmentExportTitle = Dict::Format('UI:Relation:AttachmentExportOptions_Name', $oTargetObj->GetName());
}
}
$sId = 'graph';
$sStyle = '';
if ($oP->IsPrintableVersion()) {
// Optimize for printing on A4/Letter vertically
$sStyle = 'margin-left:auto; margin-right:auto;';
$oP->add_ready_script("\$('.simple-graph').width(18/2.54*96).resizable({ stop: function() { \$(window).trigger('resized'); }});");
// Default width about 18 cm, since most browsers assume 96 dpi
}
$oP->add('<div id="' . $sId . '" class="simple-graph" style="' . $sStyle . '"></div>');
$aParams = array('source_url' => $sLoadFromURL, 'sources' => $this->bDirectionDown ? $this->aSourceObjects : $this->aSinkObjects, 'excluded' => $aExcludedByClass, 'grouping_threshold' => $iGroupingThreshold, 'export_as_pdf' => array('url' => $sExportAsPdfURL, 'label' => Dict::S('UI:Relation:ExportAsPDF')), 'export_as_attachment' => array('url' => $sExportAsDocumentURL, 'label' => Dict::S('UI:Relation:ExportAsAttachment'), 'obj_class' => $sObjClass, 'obj_key' => $iObjKey), 'drill_down' => array('url' => $sDrillDownURL, 'label' => Dict::S('UI:Relation:DrillDown')), 'labels' => array('export_pdf_title' => Dict::S('UI:Relation:PDFExportOptions'), 'export_as_attachment_title' => $sAttachmentExportTitle, 'export' => Dict::S('UI:Button:Export'), 'cancel' => Dict::S('UI:Button:Cancel'), 'title' => Dict::S('UI:RelationOption:Title'), 'untitled' => Dict::S('UI:RelationOption:Untitled'), 'include_list' => Dict::S('UI:RelationOption:IncludeList'), 'comments' => Dict::S('UI:RelationOption:Comments'), 'grouping_threshold' => Dict::S('UI:RelationOption:GroupingThreshold'), 'refresh' => Dict::S('UI:Button:Refresh'), 'check_all' => Dict::S('UI:SearchValue:CheckAll'), 'uncheck_all' => Dict::S('UI:SearchValue:UncheckAll'), 'none_selected' => Dict::S('UI:Relation:NoneSelected'), 'nb_selected' => Dict::S('UI:SearchValue:NbSelected'), 'additional_context_info' => Dict::S('UI:Relation:AdditionalContextInfo'), 'zoom' => Dict::S('UI:Relation:Zoom'), 'loading' => Dict::S('UI:Loading')), 'page_format' => array('label' => Dict::S('UI:Relation:PDFExportPageFormat'), 'values' => array('A3' => Dict::S('UI:PageFormat_A3'), 'A4' => Dict::S('UI:PageFormat_A4'), 'Letter' => Dict::S('UI:PageFormat_Letter'))), 'page_orientation' => array('label' => Dict::S('UI:Relation:PDFExportPageOrientation'), 'values' => array('P' => Dict::S('UI:PageOrientation_Portrait'), 'L' => Dict::S('UI:PageOrientation_Landscape'))), 'additional_contexts' => $aAdditionalContexts, 'context_key' => $sContextKey);
if (!extension_loaded('gd')) {
// PDF export requires GD
unset($aParams['export_as_pdf']);
}
if (!extension_loaded('gd') || is_null($sObjClass) || is_null($iObjKey)) {
// Export as Attachment requires GD (for building the PDF) AND a valid objclass/objkey couple
unset($aParams['export_as_attachment']);
}
$oP->add_ready_script("\$('#{$sId}').simple_graph(" . json_encode($aParams) . ");");
} catch (Exception $e) {
$oP->add('<div>' . $e->getMessage() . '</div>');
//.........這裏部分代碼省略.........
示例15: ReadParameters
public function ReadParameters()
{
parent::ReadParameters();
$sQueryId = utils::ReadParam('query', null, true);
$sFields = utils::ReadParam('fields', null, true, 'raw_data');
if (($sFields === null || $sFields === '') && $sQueryId === null) {
throw new BulkExportMissingParameterException('fields');
} else {
if ($sQueryId !== null && $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();
if ($sFields === null || $sFields === '') {
// No 'fields' parameter supplied, take the fields from the query phrasebook definition
$sFields = trim($oQuery->Get('fields'));
if ($sFields === '') {
throw new BulkExportMissingParameterException('fields');
}
}
} else {
throw BulkExportException('Invalid value for the parameter: query. There is no Query Phrasebook with id = ' . $sQueryId, Dict::Format('Core:BulkExport:InvalidParameter_Query', $sQueryId));
}
}
}
$aFields = explode(',', $sFields);
$this->aStatusInfo['fields'] = array();
foreach ($aFields as $sField) {
// Trim the values since it's too temping to write: fields=name, first_name, org_name instead of fields=name,first_name,org_name
$this->aStatusInfo['fields'][] = trim($sField);
}
}