예제 #1
0
 /**
  * Generates a list of user names that has access to the workspace.
  *
  * @param	array		A list of user IDs separated by comma
  * @param	string		Access string
  * @return	string		Generated content
  */
 function workspaceList_getUserListWithAccess(&$list, $access)
 {
     $content_array = array();
     if ($list != '') {
         $userIDs = explode(',', $list);
         // get user names and sort
         $regExp = '/^(be_[^_]+)_(\\d+)$/';
         $groups = false;
         foreach ($userIDs as $userUID) {
             $id = $userUID;
             if (preg_match($regExp, $userUID)) {
                 $table = preg_replace($regExp, '\\1', $userUID);
                 $id = intval(preg_replace($regExp, '\\2', $userUID));
                 if ($table == 'be_users') {
                     // user
                     $icon = $GLOBALS['TCA']['be_users']['typeicons'][$this->be_user_Array[$id]['admin']];
                     if ($id == $GLOBALS['BE_USER']->user['uid']) {
                         // highlight current user
                         $tag0 = '<span class="ver-wl-current-user">';
                         $tag1 = '</span>';
                     } else {
                         $tag0 = $tag1 = '';
                     }
                     $content_array[] = $this->doc->wrapClickMenuOnIcon(t3lib_iconWorks::getIconImage($table, $this->be_user_Array[$id], $GLOBALS['BACK_PATH'], ' align="middle" alt="UID: ' . $id . '"'), $table, $id, 2) . $tag0 . htmlspecialchars($this->be_user_Array_full[$id]['username']) . $tag1;
                 } else {
                     // group
                     if (false === $groups) {
                         $groups = t3lib_BEfunc::getGroupNames();
                     }
                     $content_array[] = $this->doc->wrapClickMenuOnIcon(t3lib_iconWorks::getIconImage($table, $groups[$id], $GLOBALS['BACK_PATH'], ' align="middle" alt="UID: ' . $id . '"'), $table, $id, 2) . $groups[$id]['title'];
                 }
             } else {
                 // user id
                 if ($userUID == $GLOBALS['BE_USER']->user['uid']) {
                     // highlight current user
                     $tag0 = '<span class="ver-wl-current-user">';
                     $tag1 = '</span>';
                 } else {
                     $tag0 = $tag1 = '';
                 }
                 $content_array[] = t3lib_iconWorks::getIconImage('be_users', $this->be_user_Array[$id], $GLOBALS['BACK_PATH'], ' align="middle" alt="UID: ' . $id . '"') . $tag0 . htmlspecialchars($this->be_user_Array_full[$userUID]['username']) . $tag1;
             }
         }
         sort($content_array);
     } else {
         $content_array[] = '&nbsp;&ndash;';
     }
     $content = '<tr><td class="ver-wl-details-label ver-wl-details-user-list-label">';
     // TODO CSH lable explaining access here?
     $content .= '<strong>' . $access . '</strong></td>';
     $content .= '<td class="ver-wl-details">' . implode('<br />', $content_array) . '</td></tr>';
     return $content;
 }