本文整理汇总了PHP中Framework::exception方法的典型用法代码示例。如果您正苦于以下问题:PHP Framework::exception方法的具体用法?PHP Framework::exception怎么用?PHP Framework::exception使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framework
的用法示例。
在下文中一共展示了Framework::exception方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItems
/**
* @return array<list_Item>
*/
public final function getItems()
{
$request = Controller::getInstance()->getContext()->getRequest();
$form = null;
$conditionOn = null;
try {
$conditionOnId = intval($request->getParameter('documentId', 0));
if ($conditionOnId > 0) {
$conditionOn = DocumentHelper::getDocumentInstance($conditionOnId);
$form = $conditionOn->getForm();
} else {
$parent = DocumentHelper::getDocumentInstance(intval($request->getParameter('parentId', 0)));
if ($parent instanceof form_persistentdocument_baseform) {
$form = $parent;
} else {
if ($parent instanceof form_persistentdocument_group) {
$form = $parent->getForm();
}
}
}
} catch (Exception $e) {
Framework::exception($e);
}
if (!$form instanceof form_persistentdocument_baseform) {
return array();
}
$results = array();
$excludeIds = $this->getExcludeIds($conditionOn);
foreach ($form->getDocumentService()->getValidActivationFields($form, $excludeIds) as $field) {
$results[] = new list_Item($field->getLabel(), $field->getId());
}
return $results;
}
示例2: install
public function install()
{
try {
$scriptReader = import_ScriptReader::getInstance();
$scriptReader->executeModuleScript('form', 'init.xml');
} catch (Exception $e) {
echo "ERROR: " . $e->getMessage() . "\n";
Framework::exception($e);
}
}
示例3: buildXmlElementResponse
/**
* @param form_persistentdocument_file $field
* @param DOMElement $fieldElm
* @param mixed $rawValue
* @return string
*/
public function buildXmlElementResponse($field, $fieldElm, $rawValue)
{
if (is_numeric($rawValue)) {
try {
$document = DocumentHelper::getDocumentInstance($rawValue);
$fieldElm->setAttribute('mailValue', $document->getLabel());
} catch (Exception $e) {
Framework::exception($e);
}
}
return $rawValue;
}
示例4: execute
/**
* @see website_BlockAction::execute()
* @param f_mvc_Request $request
* @param f_mvc_Response $response
* @return String
*/
public function execute($request, $response)
{
if ($this->isInBackoffice()) {
return website_BlockView::NONE;
}
$form = $this->getDocumentParameter();
if ($form === null || !$form->isPublished()) {
return website_BlockView::NONE;
}
$request->setAttribute('form', $form);
$request->setAttribute('moduleName', $this->getModuleName());
if ($request->hasParameter('receiverIds')) {
$receiverIds = explode(',', $request->getParameter('receiverIds'));
$receiverLabels = array();
foreach ($receiverIds as $receiverId) {
if (is_numeric($receiverId)) {
try {
$receiver = DocumentHelper::getDocumentInstance($receiverId);
$receiverLabels[] = $receiver->getLabel();
} catch (Exception $e) {
Framework::exception($e);
$receiverLabels[] = $receiverId;
}
} else {
if (f_util_StringUtils::isNotEmpty($receiverId)) {
$receiverLabels[] = $receiverId;
}
}
}
$request->setAttributes('receiverLabels', $receiverLabels);
}
$agaviUser = $this->getContext()->getGlobalContext()->getUser();
if ($agaviUser->hasAttribute('form_success_parameters_' . $form->getId())) {
$view = $this->getSuccessView($form, $request);
} else {
if ($request->hasParameter('submit_' . $form->getId())) {
try {
$form->getDocumentService()->saveFormData($form, $request);
$agaviUser->setAttribute('form_success_parameters_' . $form->getId(), $request->getParameters());
$view = $this->getSuccessView($form, $request);
} catch (form_FormValidationException $e) {
$request->setAttribute('errors', $e->getErrorCollection());
$view = $this->getInputView($form, $request);
}
} else {
$view = $this->getInputView($form, $request);
}
}
return $view;
}
示例5: buildXmlElementResponse
/**
* @param form_persistentdocument_hidden $field
* @param DOMElement $fieldElm
* @param mixed $rawValue
* @return string
*/
public function buildXmlElementResponse($field, $fieldElm, $rawValue)
{
switch ($field->getIsRecommand()) {
case 'site':
return website_WebsiteModuleService::getInstance()->getCurrentWebsite()->getUrl();
break;
case 'page':
try {
return LinkHelper::getUrl(DocumentHelper::getDocumentInstance($rawValue));
} catch (Exception $e) {
Framework::exception($e);
}
return website_WebsiteModuleService::getInstance()->getCurrentWebsite()->getUrl();
}
return parent::buildXmlElementResponse($field, $fieldElm, $rawValue);
}
示例6: 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;
}
示例7: execute
/**
* @param block_BlockContext $context
* @param block_BlockRequest $request
* @return String the view name
*/
public function execute($context, $request)
{
$id = $this->getFormId();
if (empty($id)) {
return block_BlockView::NONE;
}
$form = DocumentHelper::getDocumentInstance($id);
if (!$form->isPublished()) {
return block_BlockView::NONE;
}
$form->getDocumentNode()->getDescendents();
$this->setParameter('form', $form);
if ($context->inBackofficeMode()) {
return block_BlockView::DUMMY;
}
if ($request->hasParameter("receiverIds")) {
$receiverIds = explode(",", $request->getParameter("receiverIds"));
$receiverLabels = array();
foreach ($receiverIds as $receiverId) {
if (is_numeric($receiverId)) {
try {
$receiver = DocumentHelper::getDocumentInstance($receiverId);
$receiverLabels[] = $receiver->getLabel();
} catch (Exception $e) {
Framework::exception($e);
$receiverLabels[] = $receiverId;
}
} elseif (f_util_StringUtils::isNotEmpty($receiverId)) {
$receiverLabels[] = $receiverId;
}
}
$this->setParameter("receiverLabels", $receiverLabels);
}
if ($this->isSuccess($context, $request)) {
$view = block_BlockView::SUCCESS;
} else {
if ($this->isFormPosted($request)) {
$fs = form_FormService::getInstance();
try {
$fs->saveFormData($form, $request);
$user = $context->getGlobalContext()->getUser();
$user->setAttribute('form_success_parameters_' . $form->getId(), $request->getParameters());
$view = block_BlockView::SUCCESS;
} catch (form_FormValidationException $e) {
$this->setParameter('errors', $e->getErrorCollection());
$view = block_BlockView::INPUT;
}
} else {
$view = block_BlockView::INPUT;
}
}
// Calls the BlockFormDecorator if present.
$formId = $form->getFormid();
$matches = null;
if (preg_match('#^modules_([a-z]+)/([a-z]+)$#', $formId, $matches)) {
$extendClassName = $matches[1] . '_BlockForm' . ucfirst($matches[2]) . 'Decorator';
if (f_util_ClassUtils::classExists($extendClassName)) {
$instance = new $extendClassName($this);
if ($instance instanceof form_BlockFormDecorator) {
$instance->execute($context, $request);
} else {
Framework::warn("\"{$extendClassName}\" is not an instance of \"block_BlockDecorator\": form \"{$formId}\" won't be decorated.");
}
}
}
return $view;
}