public function actionUserInterface($type = null)
 {
     if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
         throw new NotSupportedException();
     }
     if ($type == null) {
         $demoView = new MenuUserInterfaceDemoView();
         $view = new ZurmoConfigurationPageView(ZurmoDefaultAdminViewUtil::makeStandardViewForCurrentUser($this, $demoView));
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::STANDARD_VIEW) {
         $demoView = new StandardUserInterfaceDemoView();
         $demoView->message = 'Standard View';
         $view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $demoView));
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::STANDARD_BREADCRUMBS_VIEW) {
         $breadCrumbLinks = array('Breadcrumb 1' => array('/zurmo/demo/userInterface'), 'Breadcrumb 2');
         $demoView = new StandardUserInterfaceDemoView();
         $demoView->message = 'Standard View with BreadCrumbs';
         $view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $demoView, $breadCrumbLinks, 'SettingsBreadCrumbView'));
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::GRACEFUL_ERROR_VIEW) {
         $demoView = new StandardUserInterfaceDemoView();
         $demoView->message = 'Graceful Error View';
         $view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeErrorViewForCurrentUser($this, $demoView));
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::UNEXPECTED_ERROR_VIEW) {
         $view = new ErrorPageView('Unexpected error view');
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::AUTHORIZATION_VIEW) {
         $demoView = new StandardUserInterfaceDemoView();
         $demoView->message = 'Authorization View';
         $view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeAuthorizationViewForCurrentUser($this, $demoView));
         $view->setCssClasses(array_merge($view->getCssClasses(), array('ZurmoAuthorizationPageView')));
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::CONTACT_FORM_EXTERNAL_VIEW) {
         $containedView = new ContactExternalEditAndDetailsView('Edit', $this->getId(), $this->getModule()->getId(), new ContactWebFormsModelForm(new Contact()), ContactExternalEditAndDetailsView::getMetadata());
         $view = new ContactWebFormsExternalPageView(ZurmoExternalViewUtil::makeExternalViewForCurrentUser($containedView));
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::MARKETING_LISTS_EXTERNAL_PREVIEW_VIEW) {
         $splashView = new MarketingListsExternalActionsPreviewView();
         $view = new MarketingListsExternalActionsPageView($this, $splashView);
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::MARKETING_LISTS_MANAGE_SUBSCRIPTIONS_VIEW) {
         $marketingListMember = MarketingListMember::getSubset(null, 0, 1);
         $marketingLists = MarketingList::getByUnsubscribedAndAnyoneCanSubscribe($marketingListMember[0]->contact->id);
         $listView = new MarketingListsManageSubscriptionsListView($this->getId(), $this->getModule()->getId(), $marketingLists, -100, -100, -100, 'notUsed');
         $view = new MarketingListsManageSubscriptionsPageView($this, $listView);
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::MOBILE_HEADER_VIEW) {
         Yii::app()->userInterface->setSelectedUserInterfaceType(UserInterface::MOBILE);
         $demoView = new StandardUserInterfaceDemoView();
         $demoView->message = 'Standard View';
         $view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $demoView));
         echo $view->render();
     } else {
         throw new NotSupportedException();
     }
 }
Example #2
0
 public function actionError()
 {
     if ($error = Yii::app()->errorHandler->error) {
         if (Yii::app()->request->isAjaxRequest) {
             echo $error['message'];
         } else {
             $view = new ErrorPageView($error['message']);
             echo $view->render();
         }
     }
 }
 public function actionError()
 {
     if ($error = Yii::app()->errorHandler->error) {
         if ($error['type'] == 'RedBean_Exception_SQL') {
             $error['message'] = null;
             $content = 'Exception class: ' . $error['type'];
             if ($error['message'] != null) {
                 $content .= ' Thrown with message: ' . $error['message'];
             }
             $content .= "\n" . $error['trace'];
             Yii::log($content, CLogger::LEVEL_WARNING);
         }
         if (Yii::app()->request->isAjaxRequest) {
             echo $error['message'];
         } else {
             $view = new ErrorPageView($error['message']);
             echo $view->render();
         }
     }
 }
 /**
  * Generic method that is used by all steps to validate and saved the ImportWizardForm and Import model.
  * @param object $importWizardForm
  * @param object $import
  * @param string $redirectAction
  */
 protected function attemptToValidateImportWizardFormAndSave($importWizardForm, $import, $redirectAction)
 {
     assert('$importWizardForm instanceof ImportWizardForm');
     assert('$import instanceof Import');
     assert('is_string($redirectAction)');
     if ($importWizardForm->validate()) {
         ImportWizardUtil::setImportSerializedDataFromForm($importWizardForm, $import);
         if ($import->save()) {
             $this->redirect(array($this->getId() . '/' . $redirectAction, 'id' => $import->id));
             Yii::app()->end(0, false);
         } else {
             $view = new ErrorPageView(Zurmo::t('ImportModule', 'There was an error processing this import.'));
             echo $view->render();
             Yii::app()->end(0, false);
         }
     }
 }
Example #5
0
/**
 * Handle an error condition that happened somewhere in our main request processing code.  If the
 * error cannot be handled, then add an error in the event log.
 * @param GalleryStatus a status code
 * @param array $g2Data the results from _GalleryMain
 */
function _GalleryMain_errorHandler($error, $g2Data = null)
{
    global $gallery;
    GalleryCoreApi::requireOnce('modules/core/ErrorPage.inc');
    $handledError = ErrorPageView::errorHandler($error, $g2Data);
    if (!$handledError) {
        $summary = $error->getErrorMessage();
        if (empty($summary)) {
            $summary = join(', ', $error->getErrorCodeConstants($error->getErrorCode()));
        }
        GalleryCoreApi::addEventLogEntry('Gallery Error', $summary, $error->getAsText());
    }
}