public function get_field_renderer_class($table_name, $field_name) { if (isset($_SESSION['database-class-names'][$table_name]['fields'][$field_name]['renderer']['class_file'])) { require_once PROJECT_ROOT . $_SESSION['database-class-names'][$table_name]['fields'][$field_name]['renderer']['class_file']; return new ReflectionClass($_SESSION['database-class-names'][$table_name]['fields'][$field_name]['renderer']['class_name']); } if (DEBUG) { echo DEBUG_DELIM_OPEN; echo "Just entered: Database_DatabaseClassFactory::get_field_renderer_class(...)\n"; echo "\$table_name: {$table_name}\n"; echo "\$field_name: {$field_name}\n"; $execution_timer = CLWDProjects_ExecutionTimer::get_instance(); $execution_timer->mark(); echo DEBUG_DELIM_CLOSE; } if (isset($this->field_renderer_classes[$table_name][$field_name])) { if (DEBUG) { echo DEBUG_DELIM_OPEN; echo "\$this->field_renderer_classes[{$table_name}][{$field_name}] is already set.\n"; $execution_timer->mark(); echo DEBUG_DELIM_CLOSE; } } else { $this->field_renderer_classes[$table_name][$field_name] = null; $project_directory_finder = HaddockProjectOrganisation_ProjectDirectoryFinder::get_instance(); $project_directory = $project_directory_finder->get_project_directory_for_this_project(); $project_specific_directory = $project_directory->get_project_specific_directory(); $field_renderer_class_file = null; if ($project_specific_directory->has_database_class_name_file()) { $database_class_name_file = $project_specific_directory->get_database_class_name_file(); if ($database_class_name_file->has_field_renderer_class_file($table_name, $field_name)) { $field_renderer_class_file = $database_class_name_file->get_field_renderer_class_file($table_name, $field_name); } } # Fallback. if (!isset($field_renderer_class_file)) { $field_renderer_class_file = new FileSystem_PHPClassFile(PROJECT_ROOT . '/haddock/database/classes/renderers/Database_FieldRenderer.inc.php'); } $field_renderer_class_file->declare_class(); $this->field_renderer_classes[$table_name][$field_name] = new ReflectionClass($field_renderer_class_file->get_php_class_name()); } if (DEBUG) { echo DEBUG_DELIM_OPEN; echo "About to return from: Database_DatabaseClassFactory::get_field_renderer_class(...)\n"; $execution_timer->mark(); echo "\$this->field_renderer_classes[{$table_name}][{$field_name}]:\n"; print_r($this->field_renderer_classes[$table_name][$field_name]); echo DEBUG_DELIM_CLOSE; } return $this->field_renderer_classes[$table_name][$field_name]; }
<?php /** * Database_DatabaseClassNameOverrideFile * * RFI & SANH 2006-11-13 */ if (DEBUG) { echo DEBUG_DELIM_OPEN; require_once CLWD_CORE_ROOT . '/formatting/classes/Formatting_FileName.inc.php'; require_once CLWD_CORE_ROOT . '/clwd-projects/classes/CLWDProjects_ExecutionTimer.inc.php'; $file = new Formatting_FileName(__FILE__); echo "Entering \n"; echo $file->get_pretty_name(); echo "\n"; $execution_timer = CLWDProjects_ExecutionTimer::get_instance(); $execution_timer->mark(); echo DEBUG_DELIM_CLOSE; } /** * Define the necessary classes. */ require_once PROJECT_ROOT . '/haddock/file-system/classes/FileSystem_DataFile.inc.php'; require_once PROJECT_ROOT . '/haddock/database/classes/Database_DatabaseClassNameOverride.inc.php'; if (DEBUG) { echo DEBUG_DELIM_OPEN; echo "Defining: Database_DatabaseClassNameOverrideFile\n"; $execution_timer->mark(); echo DEBUG_DELIM_CLOSE; } /**
public function get_table_subclass_php_class_file($table_name) { if (DEBUG) { echo DEBUG_DELIM_OPEN; echo "Just entered: CLWDProjects_CLWDSVNWorkingDirectory::get_table_subclass_php_class_file(...)\n"; echo "\$table_name: {$table_name}\n"; echo '$this->get_name(): ' . $this->get_name() . "\n"; echo '$this->get_module_name(): ' . $this->get_module_name() . "\n"; $exection_timer = CLWDProjects_ExecutionTimer::get_instance(); $exection_timer->mark(); echo DEBUG_DELIM_CLOSE; } $table_subclass_php_class_file = null; if ($this->has_table_subclass_php_class_file($table_name)) { $table_subclass_php_class_file = new FileSystem_PHPClassFile($this->get_table_subclass_php_class_filename($table_name)); } if (DEBUG) { echo DEBUG_DELIM_OPEN; echo "About to return from: CLWDProjects_CLWDSVNWorkingDirectory::get_table_subclass_php_class_file(...)\n"; $exection_timer->mark(); echo "\$table_subclass_php_class_file:\n"; echo $table_subclass_php_class_file; echo "\n"; echo DEBUG_DELIM_CLOSE; } return $table_subclass_php_class_file; }
public function get_table_name_translator($table_name) { if (DEBUG) { echo DEBUG_DELIM_OPEN; echo "Just entered: Database_TableNameTranslatorFactory::get_table_name_translator(...)\n"; echo "\$table_name: {$table_name}\n"; $execution_timer = CLWDProjects_ExecutionTimer::get_instance(); $execution_timer->mark(); echo DEBUG_DELIM_CLOSE; } $table_name_translator = null; $database_class_name_overrides = $this->get_database_class_name_overrides(); if (isset($database_class_name_overrides[$table_name])) { if (DEBUG) { echo DEBUG_DELIM_OPEN; echo "In: Database_TableNameTranslatorFactory::get_table_name_translator(...)\n"; $execution_timer->mark(); echo "Found a database class name override in this module for \"{$table_name}\".\n"; echo DEBUG_DELIM_CLOSE; } $table_name_translator = $database_class_name_overrides[$table_name]; } else { # An override hasn't been found, so we'll use the algorithm. if (DEBUG) { echo DEBUG_DELIM_OPEN; echo "In: Database_TableNameTranslatorFactory::get_table_name_translator(...)\n"; $execution_timer->mark(); echo "No database class name override found in this module for \"{$table_name}\".\n"; echo "Creating a new Database_TableNameTranslator object.\n"; echo DEBUG_DELIM_CLOSE; } $clwd_svn_working_directory = $this->get_clwd_svn_working_directory(); $table_name_translator = new Database_TableNameTranslator($clwd_svn_working_directory, $table_name); } if (DEBUG) { echo DEBUG_DELIM_OPEN; echo "About to return from: Database_TableNameTranslatorFactory::get_table_name_translator(...)\n"; $execution_timer->mark(); echo "\$table_name_translator:\n"; #print_r($table_name_translator); echo $table_name_translator; echo "\n"; echo DEBUG_DELIM_CLOSE; } return $table_name_translator; }
public function get_table_class_name() { if (DEBUG) { echo DEBUG_DELIM_OPEN; echo "Just entered: Database_TableNameTranslator::get_table_class_name()\n"; echo '$this->get_table_name(): ' . $this->get_table_name() . "\n"; $exection_timer = CLWDProjects_ExecutionTimer::get_instance(); $exection_timer->mark(); echo DEBUG_DELIM_CLOSE; } if (!isset($this->table_class_name)) { $this->table_class_name = $this->get_table_name_as_class_root(); $this->table_class_name .= 'Table'; } else { if (DEBUG) { echo DEBUG_DELIM_OPEN; echo "\$this->table_class_name is already set!\n"; $exection_timer->mark(); echo DEBUG_DELIM_CLOSE; } } if (DEBUG) { echo DEBUG_DELIM_OPEN; echo "About to return from: Database_TableNameTranslator::get_table_class_name()\n"; echo '$this->table_class_name: '; echo $this->table_class_name; echo "\n"; $exection_timer->mark(); echo DEBUG_DELIM_CLOSE; } return $this->table_class_name; }