Esempio n. 1
0
 /**
  * Save connectors array to file
  * @param array $connectors Source data to write
  * @param string $toFile filename to use
  * @return bool success
  */
 public static function saveConnectors($connectors, $toFile = '')
 {
     if (empty($toFile)) {
         $toFile = 'custom/modules/Connectors/metadata/connectors.php';
         if (defined('TEMPLATE_URL')) {
             $toFile = SugarTemplateUtilities::getFilePath($toFile);
         }
     }
     if (!is_array($connectors)) {
         $connectors = array();
     }
     if (!write_array_to_file('connectors', $connectors, $toFile)) {
         //Log error and return empty array
         $GLOBALS['log']->fatal("Cannot write sources to file");
         return false;
     }
     self::$connectors_cache = $connectors;
     return true;
 }
 /**
  * create_tables
  * Override this method to insert ACLActions for the tracker beans
  *
  */
 function create_tables()
 {
     $path = 'modules/Trackers/config.php';
     if (defined('TEMPLATE_URL')) {
         $path = SugarTemplateUtilities::getFilePath($path);
     }
     require $path;
     foreach ($tracker_config as $key => $configEntry) {
         if (isset($configEntry['bean']) && $configEntry['bean'] != 'Tracker') {
             $bean = new $configEntry['bean']();
             if ($bean->bean_implements('ACL')) {
                 ACLAction::addActions($bean->module_dir, $configEntry['bean']);
             }
         }
     }
     parent::create_tables();
 }
Esempio n. 3
0
 function makeInvisibleForAll($item_id)
 {
     $query = "UPDATE {$this->table_name} SET visible = 0 WHERE item_id = '{$item_id}' AND visible = 1";
     $this->db->query($query, true);
     $path = 'modules/Trackers/BreadCrumbStack.php';
     if (defined('TEMPLATE_URL')) {
         $path = SugarTemplateUtilities::getFilePath($path);
     }
     require_once $path;
     if (!empty($_SESSION['breadCrumbs'])) {
         $breadCrumbs = $_SESSION['breadCrumbs'];
         $breadCrumbs->popItem($item_id);
     }
 }
Esempio n. 4
0
 /**
  * getConnectors
  * Returns an Array of the connectors that have been loaded into the system
  * along with attributes pertaining to each connector.
  * 
  * @param boolean $refresh boolean flag indicating whether or not to force rewriting the file; defaults to false
  * @returns mixed $connectors Array of the connector entries found
  */
 public static function getConnectors($refresh = false)
 {
     //define paths
     $src1 = 'modules/Connectors/connectors/sources';
     $src2 = 'custom/modules/Connectors/connectors/sources';
     $src3 = 'custom/modules/Connectors/metadata';
     $src4 = 'custom/modules/Connectors/metadata/connectors.php';
     //if this is a templated environment, then use utilities to get the proper paths
     if (defined('TEMPLATE_URL')) {
         $src1 = SugarTemplateUtilities::getFilePath($src1);
         $src2 = SugarTemplateUtilities::getFilePath($src2);
         $src3 = SugarTemplateUtilities::getFilePath($src3);
         $src4 = SugarTemplateUtilities::getFilePath($src4);
     }
     if ($refresh || !file_exists($src4)) {
         $sources = array_merge(self::getSources($src1), self::getSources($src2));
         if (!file_exists($src3)) {
             mkdir_recursive($src3);
         }
         if (!write_array_to_file('connectors', $sources, $src4)) {
             //Log error and return empty array
             $GLOBALS['log']->fatal("Cannot write sources to file");
             return array();
         }
     }
     //if
     require $src4;
     return $connectors;
 }