Ejemplo n.º 1
0
 /**
  * Constructor
  * In general you should not call this constructor directly. Any table in your database
  * should be represented by an extension of this class.
  *
  * @param int $pn_id primary key identifier of the table row represented by this object
  * if omitted, an empty object is created which can be used to create a new row in the database.
  * @return BaseModel
  */
 public function __construct($pn_id = null, $pb_use_cache = true)
 {
     $vs_table_name = $this->tableName();
     if (!($this->FIELDS =& BaseModel::$s_ca_models_definitions[$vs_table_name]['FIELDS'])) {
         die("Field definitions not found for {$vs_table_name}");
     }
     $this->NAME_SINGULAR =& BaseModel::$s_ca_models_definitions[$vs_table_name]['NAME_SINGULAR'];
     $this->NAME_PLURAL =& BaseModel::$s_ca_models_definitions[$vs_table_name]['NAME_PLURAL'];
     $this->errors = array();
     $this->error_output = 0;
     # don't halt on error
     $this->field_conflicts = array();
     $this->_CONFIG = Configuration::load();
     $this->_DATAMODEL = Datamodel::load();
     $this->_FILES_CLEAR = array();
     $this->_SET_FILES = array();
     $this->_MEDIA_VOLUMES = MediaVolumes::load();
     $this->_FILE_VOLUMES = FileVolumes::load();
     $this->_FIELD_VALUE_CHANGED = array();
     if ($vs_locale = $this->_CONFIG->get("locale")) {
         $this->ops_locale = $vs_locale;
     }
     $this->opb_purify_input = strlen($this->_CONFIG->get("purify_all_text_input")) ? (bool) $this->_CONFIG->get("purify_all_text_input") : true;
     $this->opo_app_plugin_manager = new ApplicationPluginManager();
     $this->setMode(ACCESS_READ);
     if ($pn_id) {
         $this->load($pn_id, $pb_use_cache);
     }
 }