示例#1
0
 /**
  *
  *
  *
  *
  */
 function action()
 {
     switch ($_REQUEST['PHAT_REPORT_OP']) {
         case 'list':
             if (Current_User::allow('phatform', 'report_view')) {
                 $content = $this->report();
             } else {
                 $this->accessDenied();
             }
             break;
         case 'edit':
             if (Current_User::allow('phatform', 'report_edit')) {
                 $content = $_SESSION['PHAT_FormManager']->menu() . $this->edit();
             } else {
                 $this->accessDenied();
             }
             break;
         case 'view':
             if (Current_User::allow('phatform', 'report_view')) {
                 $content = $_SESSION['PHAT_FormManager']->menu() . $this->view();
             } else {
                 $this->accessDenied();
             }
             break;
         case 'confirmDelete':
             if (Current_User::allow('phatform', 'report_delete')) {
                 $content = $this->confirmDelete();
             } else {
                 $this->accessDenied();
             }
             break;
         case 'delete':
             if (Current_User::allow('phatform', 'report_delete')) {
                 $content = $this->delete();
             } else {
                 $this->accessDenied();
             }
             break;
         case 'export':
             if (Current_User::allow('phatform', 'report_export')) {
                 include PHPWS_SOURCE_DIR . 'mod/phatform/inc/Export.php';
                 $error = export($this->_formId);
                 if (PHPWS_Error::isError($error)) {
                     javascript('alert', array('content' => PHPWS_Error::printError($error)));
                     $content = $this->report();
                 }
             } else {
                 $this->accessDenied();
             }
             break;
     }
     if ($content) {
         if (isset($_REQUEST['lay_quiet'])) {
             Layout::nakedDisplay($content);
         } else {
             $GLOBALS['CNT_phatform']['content'] = $content;
         }
     }
 }
示例#2
0
 /**
  * The action function for this PHAT_Form.
  *
  *
  * @return mixed  $content Returns the contents handed to it from functions called within.
  * @access public
  */
 function action()
 {
     if (isset($_SESSION['PHAT_Message'])) {
         $content = $_SESSION['PHAT_Message'];
         $GLOBALS['CNT_phatform']['content'] .= $content;
         $_SESSION['PHAT_Message'] = NULL;
     }
     switch ($_REQUEST['PHAT_FORM_OP']) {
         case 'SaveFormSettings':
             if (Current_User::allow('phatform', 'edit_forms')) {
                 if (isset($_REQUEST['PHAT_SaveSettings'])) {
                     $content = $this->_saveSettings();
                     $content = $_SESSION['PHAT_FormManager']->menu() . $content;
                 } else {
                     if ($_REQUEST['PHAT_EditElements']) {
                         if ($this->isSaved()) {
                             $content = $this->_confirmArchive();
                         } else {
                             $content = $_SESSION['PHAT_FormManager']->menu();
                             $content .= $this->view(TRUE);
                         }
                     }
                 }
             } else {
                 $this->_accessDenied();
             }
             break;
         case 'editSettings':
             if (Current_User::allow('phatform', 'edit_forms')) {
                 $content = $_SESSION['PHAT_FormManager']->menu();
                 $content .= $this->editSettings();
             } else {
                 $this->_accessDenied();
             }
             break;
         case 'editElements':
             if (Current_User::allow('phatform', 'edit_forms')) {
                 $content = $_SESSION['PHAT_FormManager']->menu();
                 $content .= $this->view(TRUE);
             } else {
                 $this->_accessDenied();
             }
             break;
         case 'report':
             if (Current_User::allow('phatform', 'report_view')) {
                 $this->report = new PHAT_Report();
                 $content = $this->report->report();
             } else {
                 $this->_accessDenied();
             }
             break;
         case 'archive':
             if (!Current_User::allow('phatform', 'archive_form')) {
                 $this->_accessDenied();
             } else {
                 include PHPWS_SOURCE_DIR . 'mod/phatform/inc/Archive.php';
                 $error = NULL;
                 $error = archive($this->getId());
                 if (PHPWS_Error::isError($error)) {
                     javascript('alert', array('content' => PHPWS_Error::printError($error)));
                 } else {
                     $_SESSION['PHAT_Message'] = sprintf(dgettext('phatform', 'The form %s was successfully archived.'), '<b><i>' . $this->getLabel() . '</i></b>');
                 }
                 $_REQUEST['PHAT_FORM_OP'] = 'report';
                 $this->action();
             }
             break;
         case 'ToolbarAction':
             if (Current_User::allow('phatform', 'edit_forms')) {
                 $content = $this->_toolbarAction();
             } else {
                 $this->_accessDenied();
             }
             break;
         case 'EditAction':
             if (Current_User::allow('phatform', 'edit_forms')) {
                 if (isset($_REQUEST['PHAT_Submit']) || isset($_REQUEST['PHAT_Next']) || isset($_REQUEST['PHAT_Back'])) {
                     $content = $_SESSION['PHAT_FormManager']->menu();
                     $content .= $this->view(TRUE);
                 } else {
                     $content = $this->_editAction();
                 }
             } else {
                 $this->_accessDenied();
             }
             break;
         case 'Action':
             $content = $this->_formAction();
             break;
         case 'ArchiveConfirm':
             $this->_confirmArchive();
             break;
     }
     // END PHAT_FORM_OP SWITCH
     if (isset($content)) {
         $GLOBALS['CNT_phatform']['content'] .= $content;
     }
 }
示例#3
0
 public static function log($value, $module = NULL, $funcName = NULL, $extraInfo = NULL)
 {
     if ((bool) PHPWS_LOG_ERRORS == FALSE) {
         return;
     }
     if (!PHPWS_Error::isError($value)) {
         $error = PHPWS_Error::get($value, $module, $funcName, $extraInfo);
     } else {
         $error = $value;
     }
     $final = PHPWS_Error::printError($error);
     Error::logError($final);
 }