Ejemplo n.º 1
0
 function SugarFeedDashlet($id, $def = null)
 {
     global $current_user, $app_strings, $app_list_strings;
     require 'modules/SugarFeed/metadata/dashletviewdefs.php';
     $this->myItemsOnly = false;
     parent::DashletGeneric($id, $def);
     $this->myItemsOnly = false;
     $this->isConfigurable = true;
     $this->hasScript = true;
     // Add in some default categories.
     $this->categories['ALL'] = translate('LBL_ALL', 'SugarFeed');
     // Need to get the rest of the active SugarFeed modules
     $module_list = SugarFeed::getActiveFeedModules();
     // Translate the category names
     if (!is_array($module_list)) {
         $module_list = array();
     }
     foreach ($module_list as $module) {
         if ($module == 'UserFeed') {
             // Fake module, need to translate specially
             $this->categories[$module] = translate('LBL_USER_FEED', 'SugarFeed');
         } else {
             $this->categories[$module] = $app_list_strings['moduleList'][$module];
         }
     }
     if (empty($def['title'])) {
         $this->title = translate('LBL_HOMEPAGE_TITLE', 'SugarFeed');
     }
     if (!empty($def['rows'])) {
         $this->displayRows = $def['rows'];
     }
     if (!empty($def['categories'])) {
         $this->selectedCategories = $def['categories'];
     }
     $this->searchFields = $dashletData['SugarFeedDashlet']['searchFields'];
     $this->columns = $dashletData['SugarFeedDashlet']['columns'];
     $catCount = count($this->categories);
     ACLController::filterModuleList($this->categories, false);
     if (count($this->categories) < $catCount) {
         if (!empty($this->selectedCategories)) {
             ACLController::filterModuleList($this->selectedCategories, true);
         } else {
             $this->selectedCategories = array_keys($this->categories);
             unset($this->selectedCategories[0]);
         }
     }
     $this->seedBean = new SugarFeed();
 }
Ejemplo n.º 2
0
 function __construct($id, $def = null)
 {
     global $current_user, $app_strings, $app_list_strings;
     require_once 'modules/SugarFeed/metadata/dashletviewdefs.php';
     $this->myItemsOnly = false;
     parent::__construct($id, $def);
     $this->myItemsOnly = false;
     $this->isConfigurable = true;
     $this->hasScript = true;
     $pattern = array();
     $pattern[] = "/-/";
     $pattern[] = "/[0-9]/";
     $replacements = array();
     $replacements[] = '';
     $replacements[] = '';
     $this->idjs = preg_replace($pattern, $replacements, $this->id);
     // Add in some default categories.
     $this->categories['ALL'] = translate('LBL_ALL', 'SugarFeed');
     // Need to get the rest of the active SugarFeed modules
     $module_list = SugarFeed::getActiveFeedModules();
     // Translate the category names
     if (!is_array($module_list)) {
         $module_list = array();
     }
     foreach ($module_list as $module) {
         if ($module == 'UserFeed') {
             // Fake module, need to translate specially
             $this->categories[$module] = translate('LBL_USER_FEED', 'SugarFeed');
         } else {
             $this->categories[$module] = $app_list_strings['moduleList'][$module];
         }
     }
     // Need to add the external api's here
     $this->externalAPIList = ExternalAPIFactory::getModuleDropDown('SugarFeed', true);
     if (!is_array($this->externalAPIList)) {
         $this->externalAPIList = array();
     }
     foreach ($this->externalAPIList as $apiObj => $apiName) {
         $this->categories[$apiObj] = $apiName;
     }
     if (empty($def['title'])) {
         $this->title = translate('LBL_HOMEPAGE_TITLE', 'SugarFeed');
     }
     if (!empty($def['rows'])) {
         $this->displayRows = $def['rows'];
     }
     if (!empty($def['categories'])) {
         $this->selectedCategories = $def['categories'];
     }
     if (!empty($def['userfeed_created'])) {
         $this->userfeed_created = $def['userfeed_created'];
     }
     $this->searchFields = $dashletData['SugarFeedDashlet']['searchFields'];
     $this->columns = $dashletData['SugarFeedDashlet']['columns'];
     $twitter_enabled = $this->check_enabled('twitter');
     $facebook_enabled = $this->check_enabled('facebook');
     if ($facebook_enabled) {
         $this->categories["Facebook"] = "Facebook";
     }
     if ($twitter_enabled) {
         $this->categories["Twitter"] = "Twitter";
     }
     $catCount = count($this->categories);
     ACLController::filterModuleList($this->categories, false);
     if (count($this->categories) < $catCount) {
         if (!empty($this->selectedCategories)) {
             ACLController::filterModuleList($this->selectedCategories, true);
         } else {
             $this->selectedCategories = array_keys($this->categories);
             unset($this->selectedCategories[0]);
         }
     }
     $this->seedBean = new SugarFeed();
 }
Ejemplo n.º 3
0
 public function testgetActiveFeedModules()
 {
     $result = SugarFeed::getActiveFeedModules();
     $expected = array('UserFeed' => 'UserFeed', 'Cases' => 'Cases', 'Contacts' => 'Contacts', 'Leads' => 'Leads', 'Opportunities' => 'Opportunities');
     $this->assertEquals($expected, $result);
 }