- /**
- * @return array
- */
- private function _getComponentSelectValues() {
- $ret = array();
- $this->_components = CRM_Core_Component::getComponents();
- foreach ($this->_components as $name => $object) {
- $ret[$name] = $object->info['translatedName'];
- }
-
- return $ret;
- }
-
- public function postProcess() {
- $params = $this->controller->exportValues($this->_name);
-
- parent::commonProcess($params);
-
- // reset navigation when components are enabled / disabled
- CRM_Core_BAO_Navigation::resetNavigation();
- }
-
- /**
- * Load case sample data.
- *
- * @param string $fileName
- * @param bool $lineMode
- */
- public static function loadCaseSampleData($fileName, $lineMode = FALSE) {
- $dao = new CRM_Core_DAO();
- $db = $dao->getDatabaseConnection();
-
- $domain = new CRM_Core_DAO_Domain();
- $domain->find(TRUE);
- $multiLingual = (bool) $domain->locales;
- $smarty = CRM_Core_Smarty::singleton();
- $smarty->assign('multilingual', $multiLingual);
- $smarty->assign('locales', explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales));
-
- if (!$lineMode) {
-
- $string = $smarty->fetch($fileName);
- // change \r\n to fix windows issues
- $string = str_replace("\r\n", "\n", $string);
-
- //get rid of comments starting with # and --
-
- $string = preg_replace("/^#[^\n]*$/m", "\n", $string);
- $string = preg_replace("/^(--[^-]).*/m", "\n", $string);
-
- $queries = preg_split('/;$/m', $string);
- foreach ($queries as $query) {
- $query = trim($query);
- if (!empty($query)) {
- $res = &$db->query($query);
- if (PEAR::isError($res)) {
- die("Cannot execute $query: " . $res->getMessage());
- }
- }
- }
- }
- else {
- $fd = fopen($fileName, "r");
- while ($string = fgets($fd)) {
- $string = preg_replace("/^#[^\n]*$/m", "\n", $string);
- $string = preg_replace("/^(--[^-]).*/m", "\n", $string);
-
- $string = trim($string);
- if (!empty($string)) {
- $res = &$db->query($string);
- if (PEAR::isError($res)) {
- die("Cannot execute $string: " . $res->getMessage());
- }
- }
- }
- }
- }
-