本文整理汇总了PHP中RequestContext::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestContext::getInstance方法的具体用法?PHP RequestContext::getInstance怎么用?PHP RequestContext::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestContext
的用法示例。
在下文中一共展示了RequestContext::getInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preDuplicate
/**
* @param form_persistentdocument_group $newDocument
* @param form_persistentdocument_group $originalDocument
* @param Integer $parentNodeId
*/
protected function preDuplicate($newDocument, $originalDocument, $parentNodeId)
{
$requestContext = RequestContext::getInstance();
foreach ($requestContext->getSupportedLanguages() as $lang) {
try {
$requestContext->beginI18nWork($lang);
if ($newDocument->isContextLangAvailable()) {
$newDocument->setLabel($originalDocument->getLabel());
}
$requestContext->endI18nWork();
} catch (Exception $e) {
$requestContext->endI18nWork($e);
}
}
}
示例2: duplicateNotificationInfo
/**
* @param notification_persistentdocument_notification $oldNotification
* @param notification_persistentdocument_notification $newNotification
*/
protected function duplicateNotificationInfo($oldNotification, $newNotification)
{
$requestContext = RequestContext::getInstance();
foreach ($requestContext->getSupportedLanguages() as $lang) {
try {
$requestContext->beginI18nWork($lang);
if ($newNotification->isContextLangAvailable()) {
if ($oldNotification->getLabel() != $oldNotification->getSubject()) {
$newNotification->setSubject(f_Locale::translate('&modules.generic.backoffice.Duplicate-prefix;') . ' ' . $oldNotification->getSubject());
}
$newNotification->setBody($oldNotification->getBody());
$newNotification->setHeader($oldNotification->getHeader());
$newNotification->setFooter($oldNotification->getFooter());
$newNotification->setFooter($oldNotification->getFooter());
$newNotification->setTemplate($oldNotification->getTemplate());
$newNotification->setSenderEmail($oldNotification->getSenderEmail());
}
$requestContext->endI18nWork();
} catch (Exception $e) {
$requestContext->endI18nWork($e);
}
}
}
示例3: renderForm
/**
* @param form_persistentdocument_baseform $form
* @param block_BlockRequest $formRequest
* @param validation_Errors $errors
* @param array<String> $scriptArray
* @return String
* @deprecated
*/
public function renderForm($form, $formRequest, $errors, &$scriptArray)
{
$scriptArray[] = 'modules.form.lib.js.date-picker.date';
$scriptArray[] = 'modules.form.lib.js.date-picker.date_' . RequestContext::getInstance()->getLang();
$scriptArray[] = 'modules.form.lib.js.date-picker.jquery-bgiframe';
$scriptArray[] = 'modules.form.lib.js.date-picker.jquery-dimensions';
$scriptArray[] = 'modules.form.lib.js.date-picker.jquery-datePicker';
$scriptArray[] = 'modules.form.lib.js.form';
$markup = $form->getMarkup();
if (!$markup) {
$markup = 'default';
}
try {
$template = TemplateLoader::getInstance()->setMimeContentType(K::HTML)->setPackageName('modules_form')->setDirectory('templates/markup/' . $markup)->load('Form');
$template->setAttribute('form', $form);
$template->setAttribute('selfUrl', $_SERVER['REQUEST_URI']);
if ($formRequest->hasParameter(form_FormConstants::BACK_URL_PARAMETER)) {
$template->setAttribute('backUrl', $formRequest->getParameter(form_FormConstants::BACK_URL_PARAMETER));
} else {
$template->setAttribute('backUrl', $_SERVER['HTTP_REFERER']);
}
if (!is_null($errors)) {
$template->setAttribute('errors', $errors);
}
$fieldContents = array();
$this->buildContentsFromRequest($form->getDocumentNode()->getChildren(), $fieldContents, $formRequest, $form);
$template->setAttribute('requestParameters', $formRequest->getParameters());
$template->setAttribute('elements', $fieldContents);
return $template->execute(true);
} catch (Exception $e) {
Framework::exception($e);
}
return null;
}
示例4: preDuplicate
/**
* @param form_persistentdocument_field $newDocument
* @param form_persistentdocument_field $originalDocument
* @param Integer $parentNodeId
*/
protected function preDuplicate($newDocument, $originalDocument, $parentNodeId)
{
$requestContext = RequestContext::getInstance();
foreach ($newDocument->getI18nInfo()->getLangs() as $lang) {
try {
$requestContext->beginI18nWork($lang);
$newDocument->setLabel($originalDocument->getLabel());
$requestContext->endI18nWork();
} catch (Exception $e) {
$requestContext->endI18nWork($e);
}
}
}
示例5: addScriptsAndStyles
/**
* @param website_Page $page
* @param form_persistentdocument_baseform $form
*/
public static function addScriptsAndStyles($page)
{
$page->addStyle('modules.form.frontoffice');
$page->addScript('modules.form.lib.js.date-picker.date');
$page->addScript('modules.form.lib.js.date-picker.date_' . RequestContext::getInstance()->getLang());
$page->addScript('modules.form.lib.js.date-picker.jquery-bgiframe');
$page->addScript('modules.form.lib.js.date-picker.jquery-dimensions');
$page->addScript('modules.form.lib.js.date-picker.jquery-datePicker');
$page->addScript('modules.form.lib.js.form');
}