/** * Constructor */ public function __construct() { parent::__construct(); $this->schemaPath = ProfileHelper::getPath(); $this->backupPath = ProfileHelper::getTmpPath() . '/backups'; $this->createDatabase(); }
/** * MonitorModelAbstract constructor. * * @param JApplicationCms $application The Application object to use in this model. * @param boolean $loadFilters If set to true, filters and list options will be loaded from the page request. * * @throws Exception */ public function __construct($application = null, $loadFilters = true) { parent::__construct(); if ($application) { $this->app = $application; } else { $this->app = JFactory::getApplication(); } if ($loadFilters) { // Receive & set filters if ($this->filters = $this->app->getUserStateFromRequest('filter.' . $this->prefix, 'filter', array(), 'array')) { foreach ($this->filters as $filter => $value) { $this->getState()->set('filter.' . $this->prefix . '.' . $filter, $value); } } // Receive & set list options if ($this->list = $this->app->getUserStateFromRequest('list.' . $this->prefix, 'list', array(), 'array')) { if (isset($this->list['fullordering']) && $this->list['fullordering']) { $fullOrdering = explode(' ', $this->list['fullordering']); $this->list['ordering'] = $fullOrdering[0]; $this->list['direction'] = $fullOrdering[1]; } foreach ($this->list as $key => $value) { $this->getState()->set('list.' . $this->prefix . '.' . $key, $value); } } if (!isset($this->list['limit']) && ($limit = $this->app->getUserStateFromRequest('list.' . $this->prefix . '.limit', 'limit', null)) !== null) { $this->list['limit'] = $limit; $this->getState()->set('list.' . $this->prefix . '.limit', $limit); } } }
/** * MonitorModelNotifications constructor. * * @param JApplicationCms $application The Application object to use in this model. * * @throws Exception */ public function __construct($application = null) { parent::__construct(); if ($application) { $this->app = $application; } else { $this->app = JFactory::getApplication(); } }
/** * Constructor * * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). * * @since 3.2 * @throws Exception */ public function __construct($config = array()) { // Guess the option from the class name (Option)Model(View). if (empty($this->option)) { $r = null; if (!preg_match('/(.*)Model/i', get_class($this), $r)) { throw new Exception(JText::_('JLIB_APPLICATION_ERROR_MODEL_GET_NAME')); } $this->option = 'com_' . strtolower($r[1]); } // Set the view name if (empty($this->name)) { if (array_key_exists('name', $config)) { $this->name = $config['name']; } else { $this->name = $this->getName(); } } // Set the model state if (array_key_exists('state', $config)) { $this->state = $config['state']; } else { $this->state = new Registry(); } // Set the model dbo if (array_key_exists('dbo', $config)) { $this->db = $config['dbo']; } // Register the paths for the form $paths = $this->registerTablePaths($config); // Set the internal state marker - used to ignore setting state from the request if (!empty($config['ignore_request'])) { $this->__state_set = true; } // Set the clean cache event if (isset($config['event_clean_cache'])) { $this->event_clean_cache = $config['event_clean_cache']; } elseif (empty($this->event_clean_cache)) { $this->event_clean_cache = 'onContentCleanCache'; } $state = new Registry($config); parent::__construct($state); }
/** * Constructor * * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). * @param JoomlaContainer $container Service container. * @param \JRegistry $state The model state. * @param \JDatabaseDriver $db The database adapter. * * @throws \Exception */ public function __construct($config = array(), JoomlaContainer $container = null, \JRegistry $state = null, \JDatabaseDriver $db = null) { // Guess the option from the class name (Option)Model(View). if (empty($this->prefix)) { $r = null; if (!preg_match('/(.*)Model/i', get_class($this), $r)) { throw new \Exception(\JText::_('JLIB_APPLICATION_ERROR_MODEL_GET_NAME'), 500); } $this->prefix = strtolower($r[1]); } $this->option = 'com_' . $this->prefix; // Guess name $this->name = $this->name ?: \JArrayHelper::getValue($config, 'name', $this->getName()); // Register the paths for the form $this->registerTablePaths($config); // Set the clean cache event $this->eventCleanCache = $this->eventCleanCache ?: \JArrayHelper::getValue($config, 'event_clean_cache', 'onContentCleanCache'); $this->container = $container ?: $this->getContainer(); $state = new \JRegistry($config); parent::__construct($state, $db); // Guess the context as Option.ModelName. $this->context = $this->context ?: strtolower($this->option . '.' . $this->getName()); // Set the internal state marker - used to ignore setting state from the request if (empty($config['ignore_request'])) { // Protected method to auto-populate the model state. $this->populateState(); } }
/** * Constructor */ public function __construct() { parent::__construct(); $this->queryHelper = AbstractQueryHelper::getInstance($this->db->name); }
/** * Instantiate the model. * * @param string $context The model context. * @param Registry $state The model state. * @param \JDatabaseDriver $db The database adpater. * * @since 2.0 */ public function __construct($context, Registry $state = null, \JDatabaseDriver $db = null) { parent::__construct($state, $db); $this->context = $context; $this->sortFields = array('a.pull_id', 'a.title', 'applied'); }
/** * Constructor */ public function __construct() { $this->global = SQLSYNC_LIB . '/Resource/track.yml'; $this->file = ProfileHelper::getPath() . '/track.yml'; parent::__construct(); }
/** * Constructor * * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). * @param JoomlaContainer $container Service container. * @param Registry $state The model state. * @param \JDatabaseDriver $db The database adapter. * * @throws \Exception */ public function __construct($config = array(), JoomlaContainer $container = null, Registry $state = null, \JDatabaseDriver $db = null) { $this->prefix = $this->getPrefix($config); $this->option = 'com_' . $this->prefix; // Guess name $this->name = $this->name ?: ArrayHelper::getValue($config, 'name', $this->getName()); // Register the paths for the form $this->registerTablePaths($config); // Set the clean cache event $this->eventCleanCache = $this->eventCleanCache ?: ArrayHelper::getValue($config, 'event_clean_cache', 'onContentCleanCache'); $this->container = $container ?: $this->getContainer(); $this->resetCache(); parent::__construct($state, $db); $this->state->loadArray($config); // Guess the context as Option.ModelName. $this->context = $this->context ?: ContextHelper::fromModel($this); // Set the internal state marker - used to ignore setting state from the request if (empty($config['ignore_request'])) { // Protected method to auto-populate the model state. $this->populateState(); } }
/** * Constructor. */ public function __construct() { parent::__construct(); $this->prefix = $this->db->getPrefix(); }
/** * Instantiate the model. * * @param string $context The model context. * @param Registry $state The model state. * @param \JDatabaseDriver $db The database adpater. * * @since 2.0 */ public function __construct($context, Registry $state = null, \JDatabaseDriver $db = null) { parent::__construct($state, $db); $this->context = $context; }