コード例 #1
0
ファイル: WatchdogCommon_0.php プロジェクト: cretzu89/EPESI
 public static function get_change_subscription_icon_tags($category_name, $id)
 {
     $category_id = self::get_category_id($category_name);
     if (!$category_id) {
         return;
     }
     $last_seen = self::check_if_notified($category_name, $id);
     load_js('modules/Utils/Watchdog/subscribe.js');
     $tag_id = 'watchdog_sub_button_' . $category_name . '_' . $id;
     $href = ' onclick="utils_watchdog_set_subscribe(' . ($last_seen === null ? 1 : 0) . ',\'' . $category_name . '\',' . $id . ',\'' . $tag_id . '\')" href="javascript:void(0);"';
     if ($last_seen === null) {
         $icon = Base_ThemeCommon::get_template_file('Utils_Watchdog', 'not_watching_small.png');
         $tooltip = __('Click to watch this record for changes.');
     } else {
         if ($last_seen === true) {
             $icon = Base_ThemeCommon::get_template_file('Utils_Watchdog', 'watching_small.png');
             $tooltip = __('You are watching this record, click to stop watching this record for changes.');
         } else {
             $icon = Base_ThemeCommon::get_template_file('Utils_Watchdog', 'watching_small_new_events.png');
             $ev = self::display_events($category_id, $last_seen, $id);
             $tooltip = __('You are watching this record, click to stop watching this record for changes.') . ($ev ? '<br>' . __('The following changes were made since the last time you were viewing this record:') . '<br><br>' . $ev['events'] : '');
         }
     }
     $subscribers = self::get_subscribers($category_name, $id);
     $my_user = Base_AclCommon::get_user();
     if ($subscribers) {
         $icon_on = ' src="' . Base_ThemeCommon::get_template_file('Utils_Watchdog', 'watching_small.png') . '"';
         $icon_off = ' src="' . Base_ThemeCommon::get_template_file('Utils_Watchdog', 'watching_small_new_events.png') . '"';
         $other_subscribers = array();
         foreach ($subscribers as $subscriber) {
             if ($subscriber == $my_user) {
                 continue;
             }
             if (class_exists('CRM_ContactsCommon')) {
                 $contact = CRM_ContactsCommon::get_user_label($subscriber, true);
             } else {
                 $contact = Base_UserCommon::get_user_login($subscriber);
             }
             $notified = self::user_check_if_notified($subscriber, $category_name, $id);
             $icon2 = $notified === true ? $icon_on : $icon_off;
             $other_subscribers[] = '<img style="margin-right:4px;" ' . $icon2 . ' /><a>' . Utils_RecordBrowserCommon::no_wrap($contact) . '</a>';
         }
         if ($other_subscribers) {
             $tooltip .= '<hr />' . implode('<br>', $other_subscribers);
         }
     }
     $tooltip = Utils_TooltipCommon::open_tag_attrs($tooltip);
     return '<a ' . $href . ' ' . $tooltip . '><img border="0" src="' . $icon . '"></a>';
 }
コード例 #2
0
ファイル: UserCommon_0.php プロジェクト: 62BRAINS/EPESI
 }
 public static function get_user_label($uid, $nolink = false)
 {
     if (!$uid) {
         return __('front-end user');
     }
     if (ModuleManager::is_installed('CRM_Contacts') >= 0) {
         return CRM_ContactsCommon::get_user_label($uid, $nolink);
     } else {
         return self::get_user_login($uid);
     }