/**
  * This object is a Singleton.
  * This method gets the instance of it.
  * @return DebugUtils the single instance of the class
  */
 public static function get_instance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
예제 #2
0
 public function Post()
 {
     $this->DoBeforePost();
     if ($this->editMode) {
         if (count($this->editFieldValues) > 0 || count($this->editFieldSetToDefault) > 0) {
             $updateCommand = $this->CreateUpdateCommand();
             $primaryKeyValues = $this->GetOldPrimaryKeyValuesMap();
             foreach ($primaryKeyValues as $keyFieldName => $value) {
                 $updateCommand->SetKeyFieldValue($keyFieldName, $value);
             }
             foreach ($this->editFieldValues as $fieldName => $value) {
                 if (in_array($fieldName, $this->editFieldSetToDefault)) {
                     $updateCommand->SetParameterValue($fieldName, null, true);
                 } else {
                     $updateCommand->SetParameterValue($fieldName, $value);
                 }
             }
             foreach ($this->GetFields() as $field) {
                 if ($field->GetReadOnly()) {
                     $updateCommand->SetParameterValue($field->GetNameInDataset(), $field->GetDefaultValue());
                 }
             }
             if (DebugUtils::GetDebugLevel() >= 1) {
                 echo $updateCommand->GetSQL() . '<br>';
             }
             $updateCommand->Execute($this->GetConnection());
         }
         $this->editMode = false;
     } elseif ($this->insertMode) {
         $hasValuesForAutoIncrement = false;
         $insertCommand = $this->CreateInsertCommand() or RaiseError('Could not create InsertCommand');
         $this->Connect();
         foreach ($this->masterFieldValue as $fieldName => $value) {
             $insertCommand->SetParameterValue($fieldName, $value);
         }
         foreach ($this->insertFieldValues as $fieldName => $value) {
             if (in_array($fieldName, $this->insertFieldSetToDefault)) {
                 if (!$this->GetFieldByName($fieldName)->GetIsAutoincrement()) {
                     $insertCommand->SetParameterValue($fieldName, null, true);
                 }
             } else {
                 if ($this->GetFieldByName($fieldName)->GetIsAutoincrement()) {
                     $hasValuesForAutoIncrement = true;
                 }
                 $insertCommand->SetParameterValue($fieldName, $value);
             }
         }
         foreach ($this->GetFields() as $field) {
             if ($field->GetReadOnly()) {
                 $insertCommand->SetParameterValue($field->GetNameInDataset(), $field->GetDefaultValue());
             }
         }
         foreach ($this->defaultFieldValues as $fieldName => $value) {
             $insertCommand->SetParameterValue($fieldName, $value);
         }
         $insertCommand->SetAutoincrementInsertion($hasValuesForAutoIncrement);
         if (DebugUtils::GetDebugLevel() == 1) {
             echo $insertCommand->GetSQL() . '<br>';
         }
         $insertCommand->Execute($this->GetConnection());
         $this->UpdatePrimaryKeyAfterInserting();
         $this->insertMode = false;
         $this->insertedMode = true;
     }
 }
예제 #3
0
 function RenderPage(Page $Page)
 {
     $this->SetHTTPContentTypeByPage($Page);
     $PageList = $Page->GetPageList();
     $PageList = isset($PageList) ? $this->Render($PageList) : '';
     $displayDebugInfo = DebugUtils::GetDebugLevel();
     $inputValues = array('PageList' => $PageList, 'ErrorMessage' => $this->exception->getMessage(), 'DisplayDebugInfo' => $displayDebugInfo);
     if ($displayDebugInfo == 1) {
         $inputValues['File'] = $this->exception->getFile();
         $inputValues['Line'] = $this->exception->getLine();
         $inputValues['Trace'] = $this->exception->getTraceAsString();
     }
     $this->DisplayTemplate('list/error_page.tpl', array('Page' => $Page), $inputValues);
 }
 /**
  * Disable vd()\vc()\v() functions output,
  * This is default status, generically good for production environments.
  */
 public static function disable_debug()
 {
     $debug = DebugUtils::get_instance();
     $debug->status = false;
 }
 public static function setMemoryCounter()
 {
     self::$currentMemory = memory_get_usage();
 }
예제 #6
0
 /**
  * @WebAction
  */
 public function overview()
 {
     $message = new Message();
     $message->put("naam", "pieter");
     DebugUtils::debug($message);
 }