public function render($tpl = null) { //authenticate the current user to make sure they are an admin UsersHelper::authenticateAdmin(); //display toolbar $this->toolbar = new Toolbar(); $this->toolbar->save(); //document $document = JFactory::getDocument(); $document->addScript(JURI::base() . "/src/Cobalt/media/js/cobalt-admin.js"); /* Menu Links **/ $menu = MenuHelper::getMenuModules(); $this->menu = $menu; //get model $model = new ConfigModel(); $layout = $this->getLayout(); $model->set("_layout", $layout); //get config $config = $model->getConfig(); //generate timezones $list = timezone_identifiers_list(); $timezones = array(); foreach ($list as $zone) { $timezones[$zone] = $zone; } //view references $this->imap_found = function_exists('imap_open') ? TRUE : FALSE; $this->config = $config; $this->timezones = $timezones; $this->time_formats = DateHelper::getTimeFormats(); $this->languages = ConfigHelper::getLanguages(); $this->language = ConfigHelper::getLanguage(); //display return parent::render(); }
public function render($tpl = null) { //authenticate the current user to make sure they are an admin UsersHelper::authenticateAdmin(); $app = \Cobalt\Container::fetch('app'); $document = $app->getDocument(); $document->addScript(JURI::base() . 'src/Cobalt/media/js/cobalt-admin.js'); /** Menu Links **/ $menu = MenuHelper::getMenuModules(); $this->menu = $menu; $configModel = new ConfigModel(); /** Component version **/ $installedVersion = ConfigHelper::getVersion(); $latestVersion = VersionHelper::getLatestVersion(); $updateUrl = "http://www.cobaltcrm.org/support/login"; $updatesFeed = $configModel->getUpdatesRSS(); /** Launch completion **/ $config = $configModel->getConfig(); $this->launch_default = $config->launch_default; $percentage = $menu['percentage']; $this->setup_percent = $percentage; /** php version check **/ $this->php_version = (double) phpversion(); $this->php_version_check = $this->php_version >= 5.3 ? TRUE : FALSE; /** View Ref **/ $this->installedVersion = $installedVersion; $this->latestVersion = $latestVersion; $this->updateUrl = $updateUrl; $this->updatesFeed = $updatesFeed; //display return parent::render(); }
public function execute() { $sampleIds = array(); $importModel = new ImportModel(); $sampleCsvFiles = array('sample-company' => "companies", 'sample-person' => "people", 'sample-deal' => "deals"); foreach ($sampleCsvFiles as $file => $table) { $importData = $importModel->readCSVFile(JPATH_COBALT . '/Sample/' . $file . '.csv', $table, false); switch ($table) { case "companies": $model = "company"; break; case "people": $model = "people"; break; case "deals": $model = "deal"; break; } unset($importData['headers']); $ids = $importModel->importCSVData($importData, $model, true); $sampleIds[$table] = $ids; } $data = array('import_sample' => serialize($sampleIds)); $configModel = new ConfigModel(); $configModel->store($data); $msg = TextHelper::_('COBALT_SAMPLE_DATA_INSTALLED'); $this->getApplication()->redirect('index.php?view=import', $msg); }
/** * Get the configuration value for the specified field. If the field was not found in the config, return null. * * @param string $field The name of the field * @param boolean $serializedArray True if the field is stored as an array * @return mixed The value of the field in the #__jf_configuration table */ public static function getConfigValue($field, $serializedArray = FALSE) { $configModel = new ConfigModel(); $config = $configModel->getConfig(TRUE); if (is_array($config) && array_key_exists($field, $config)) { $value = $serializedArray == TRUE && $config[$field] != 0 && $config[$field] != "0" ? unserialize($config[$field]) : $config[$field]; } else { $value = null; } return $value; }
public function removeSampleData() { $sampleIds = unserialize(ConfigHelper::getConfigValue('import_sample')); $db = $this->container->resolve('db'); $query = $db->getQuery(true); foreach ($sampleIds as $table => $ids) { $query->clear()->delete("#__" . $table)->where("id IN(" . implode(',', $ids) . ")"); $db->setQuery($query); $db->query(); } $data = array('import_sample' => "0"); $configModel = new ConfigModel(); $configModel->store($data); $msg = TextHelper::_('COBALT_SAMPLE_DATA_REMOVED'); $this->getApplication()->redirect('index.php?view=import', $msg); }