Ejemplo n.º 1
0
 /**
  * The list of members; just names if pregame, otherwise a full detailed table, ordered by
  * status then relative success in-game.
  *
  * @return string
  */
 function membersList()
 {
     if ($this->Game->phase == 'Pre-game') {
         $membersNames = array();
         foreach ($this->ByUserID as $Member) {
             $membersNames[] = '<span class="memberName">' . $Member->memberName() . '</span>';
         }
         return '<table><tr class="member memberAlternate1 memberPreGameList"><td>' . implode(', ', $membersNames) . '</td></tr></table>';
     }
     libHTML::$alternate = 2;
     $membersList = array();
     foreach (self::$statusOrder as $status) {
         foreach ($this->ByStatus[$status] as $Member) {
             $membersList[] = '<tr class="member memberAlternate' . libHTML::alternate() . '">' . $Member->memberBar() . '</tr>';
         }
     }
     $extras = '';
     if ($this->Game->hasModeratorPowers() && count($this->Game->civilDisorderInfo) != 0) {
         $extras = '<div class="bar titleBar modEyes">Civil Disorders</div><table><tbody>';
         foreach ($this->Game->civilDisorderInfo as $userID => $CD) {
             $cdUser = new User($userID);
             $extras .= '<tr class="member memberAlternate1"><td class="memberLeftSide" style="white-space: nowrap;"><span><a href="profile.php?userID=' . $userID . '">' . $cdUser->username . '</a>' . ' <span class="points">(' . $cdUser->points . libHTML::points() . User::typeIcon($cdUser->type) . ')' . (defined('AdminUserSwitch') ? ' (<a href="board.php?gameID=' . $this->Game->id . '&auid=' . $cdUser->id . '" class="light">+</a>)' : '') . '</span></span></td><td class="memberRightSide">';
             $extras .= '<span class="country' . $CD['countryID'] . '">';
             if ($CD['countryID'] == 0) {
                 $extras .= 'Unassigned';
             } else {
                 $extras .= $this->Game->Variant->countries[$CD['countryID'] - 1];
             }
             $extras .= '</span> (' . $this->Game->datetxt($CD['turn']) . ') with ' . $CD['SCCount'] . ' centres.';
             $extras .= '</td></tr>';
         }
         $extras .= "</tbody></table>";
     }
     return '<table>' . implode('', $membersList) . '</table>' . $extras;
 }
Ejemplo n.º 2
0
    /**
     * The member bar shown at the top of a board page for members of the game.
     * @return string
     */
    function memberHeaderBar()
    {
        $buf = '';
        libHTML::alternate();
        if ($this->Game->phase != 'Pre-game') {
            $buf .= '<div class="panelBarGraph memberProgressBar barAlt' . libHTML::$alternate . '">' . $this->memberProgressBar() . '</div>';
        } else {
            $buf .= '<div class="panelBarGraph memberProgressBarBlank"> </div>';
        }
        $buf .= '<div class="memberBoardHeader barAlt' . libHTML::$alternate . ' barDivBorderTop ">
			<table><tr class="member">';
        $buf .= '
			<td class="memberLeftSide">
				<span class="memberCountryName">' . $this->memberCountryName() . '</span>';
        $buf .= '
			</td>
			<td class="memberRightSide ' . ($this->status == 'Left' || $this->status == 'Resigned' || $this->status == 'Defeated' ? 'memberStatusFade' : '') . '">
				<div>
				<div class="memberUserDetail">
					' . $this->memberFinalizedFull() . '<br />
					' . $this->memberMessagesFull() . '
				</div>
				<div class="memberGameDetail">
					' . $this->memberGameDetail() . '
				</div>
				<div style="clear:both"></div>
				</div>
			</td>
			</tr>
			</table></div>';
        return $buf;
    }
Ejemplo n.º 3
0
 /**
  * Alternates $alternate, and returns it
  * @return int
  */
 static function alternate()
 {
     self::$alternate = 3 - self::$alternate;
     return self::$alternate;
 }
Ejemplo n.º 4
0
 /**
  * Display a table with the vital members info; who is finalized, who has sent messages etc, each member
  * takes up a short, thin column.
  * @return string
  */
 function membersList()
 {
     global $User;
     // $membersList[$i]=array($nameOrCountryID,$iconOne,$iconTwo,...);
     $membersList = array();
     if ($this->Game->phase == 'Pre-game') {
         $count = count($this->ByID);
         for ($i = 0; $i < $count; $i++) {
             $membersList[] = array($i + 1, '<img src="' . l_s('images/icons/tick.png') . '" alt=" " title="' . l_t('Player joined, spot filled') . '" />');
         }
         for ($i = $count; $i <= count($this->Game->Variant->countries); $i++) {
             $membersList[] = array($i + 1, '');
         }
     } else {
         for ($countryID = 1; $countryID <= count($this->Game->Variant->countries); $countryID++) {
             $Member = $this->ByCountryID[$countryID];
             //if ( $User->id == $this->ByCountryID[$countryID]->userID )
             //	continue;
             //elseif( $Member->status != 'Playing' && $Member->status != 'Left' )
             //	continue;
             $membersList[] = $Member->memberColumn();
         }
     }
     $buf = '<table class="homeMembersTable">';
     $rowsCount = count($membersList[0]);
     $alternate = libHTML::$alternate;
     for ($i = 0; $i < $rowsCount; $i++) {
         $rowBuf = '';
         $dataPresent = false;
         $remainingPlayers = count($this->ByID);
         $remainingWidth = 100;
         foreach ($membersList as $data) {
             if ($data[$i]) {
                 $dataPresent = true;
             }
             if ($remainingPlayers > 1) {
                 $width = floor($remainingWidth / $remainingPlayers);
             } else {
                 $width = $remainingWidth;
             }
             $remainingPlayers--;
             $remainingWidth -= $width;
             $rowBuf .= '<td style="width:' . $width . '%" class="barAlt' . libHTML::alternate() . '">' . $data[$i] . '</td>';
         }
         libHTML::alternate();
         if ($dataPresent) {
             $buf .= '<tr>' . $rowBuf . '</tr>';
         }
         libHTML::$alternate = $alternate;
     }
     libHTML::alternate();
     $buf .= '</table>';
     return $buf;
 }
Ejemplo n.º 5
0
    /**
     * Links to the game and game archives
     * @return string
     */
    function links()
    {
        $watchString = '';
        if ($this->watched()) {
            $watchString = '- <a href="board.php?gameID=' . $this->id . '&unwatch">' . l_t('Stop spectating') . '</a>';
        }
        if ($this->phase == 'Pre-game') {
            return '<div class="bar homeGameLinks barAlt' . libHTML::alternate() . '">
				<a href="board.php?gameID=' . $this->id . '">' . l_t('Open') . '</a>
				' . $watchString . '</div>';
        } else {
            return '<div class="bar homeGameLinks barAlt' . libHTML::alternate() . '">
				<a href="board.php?gameID=' . $this->id . '#gamePanel">' . l_t('Open') . '</a> 
				' . $watchString . '</div>';
        }
    }
Ejemplo n.º 6
0
    /**
     * A modified header, which will also print the info about the member which has joined if applicable,
     * for use at the top of a game board.
     * @return string
     */
    function header()
    {
        global $User;
        libHTML::$alternate = 2;
        $buf = '<div class="titleBar barAlt' . libHTML::alternate() . '">
				' . $this->titleBar() . '
			</div>';
        $noticeBar = $this->gameNoticeBar();
        if ($noticeBar) {
            $buf .= '
				<div class="bar gameNoticeBar barAlt' . libHTML::alternate() . '">
					' . $noticeBar . '
				</div>';
        }
        if ($this->Members->isJoined() && $this->phase != 'Pre-game') {
            $buf .= '<div class="membersList">' . $this->Members->ByUserID[$User->id]->memberHeaderBar() . '</div>';
        }
        return $buf;
    }
Ejemplo n.º 7
0
    /**
     * The header; the vital game info and the vital notice bar
     * @return string
     */
    function header()
    {
        $buf = '<div class="bar titleBar"><a name="gamePanel"></a>
				' . $this->titleBar() . '
			</div>';
        $noticeBar = $this->gameNoticeBar();
        if ($noticeBar) {
            return $buf . '
				<div class="bar gameNoticeBar barAlt' . libHTML::alternate() . '">
					' . $noticeBar . '
				</div>';
        } else {
            return $buf;
        }
    }
Ejemplo n.º 8
0
    public function html()
    {
        global $User;
        $buf = '<div class="homeNotice ' . ($this->type == 'Game' ? '" gameID="' . $this->fromID . '"' : 'userID' . $this->fromID . '"') . '>
			<div class="homeForumGroup homeForumAlt' . libHTML::alternate() . '">
				<div class="homeForumSubject homeForumTopBorder">' . $this->fromLink() . '</div>
				<div class="homeForumPostAlt' . libHTML::alternate() . ' homeForumPost">
					<div class="homeForumPostTime">' . libTime::text($this->timeSent) . ' ';
        if (self::$recent) {
            $buf .= libHTML::unreadMessages();
        } elseif (self::$new) {
            $buf .= libHTML::maybeReadMessages();
        }
        $buf .= '</div>
					<div class="homeForumMessage">' . $this->text . '</div>
					<div style="clear:both"></div>
					</div>';
        if ($this->isRespondable()) {
            $buf .= '<div class="homeForumPostAlt' . libHTML::alternate() . ' homeForumPost">' . $this->replyBox() . '</div>';
        }
        $buf .= '	</div>';
        //<div class="homeForumMessage">'.$post['message'].'</div>
        /*
        			$buf .= '<div class="homeForumLink">
        					<div class="homeForumPostTime"><strong>'.$data['replies'].'</strong> replies</div>
        					<a href="forum.php?threadID='.$threadID.'#'.$threadID.'">Open</a>
        					</div>
        					</div>';*/
        $buf .= '<div class="hr"></div></div>';
        return $buf;
    }
Ejemplo n.º 9
0
    static function forumNew()
    {
        // Select by id, prints replies and new threads
        global $DB, $Misc;
        $tabl = $DB->sql_tabl("\r\n\t\t\tSELECT m.id as postID, t.id as threadID, m.type, m.timeSent, IF(t.replies IS NULL,m.replies,t.replies) as replies,\r\n\t\t\t\tIF(t.subject IS NULL,m.subject,t.subject) as subject,\r\n\t\t\t\tu.id as userID, u.username, u.points, IF(s.userID IS NULL,0,1) as online, u.type as userType,\r\n\t\t\t\tSUBSTRING(m.message,1,100) as message, m.latestReplySent, t.fromUserID as threadStarterUserID\r\n\t\t\tFROM wD_ForumMessages m\r\n\t\t\tINNER JOIN wD_Users u ON ( m.fromUserID = u.id )\r\n\t\t\tLEFT JOIN wD_Sessions s ON ( m.fromUserID = s.userID )\r\n\t\t\tLEFT JOIN wD_ForumMessages t ON ( m.toID = t.id AND t.type = 'ThreadStart' AND m.type = 'ThreadReply' )\r\n\t\t\tORDER BY m.timeSent DESC\r\n\t\t\tLIMIT 50");
        $oldThreads = 0;
        $threadCount = 0;
        $threadIDs = array();
        $threads = array();
        while (list($postID, $threadID, $type, $timeSent, $replies, $subject, $userID, $username, $points, $online, $userType, $message, $latestReplySent, $threadStarterUserID) = $DB->tabl_row($tabl)) {
            $threadCount++;
            if ($threadID) {
                $iconMessage = libHTML::forumMessage($threadID, $postID);
            } else {
                $iconMessage = libHTML::forumMessage($postID, $postID);
            }
            if ($type == 'ThreadStart') {
                $threadID = $postID;
            }
            if (!isset($threads[$threadID])) {
                if (strlen($subject) > 30) {
                    $subject = substr($subject, 0, 40) . '...';
                }
                $threadIDs[] = $threadID;
                $threads[$threadID] = array('subject' => $subject, 'replies' => $replies, 'posts' => array(), 'threadStarterUserID' => $threadStarterUserID);
            }
            $message = Message::refilterHTML($message);
            if (strlen($message) >= 50) {
                $message = substr($message, 0, 50) . '...';
            }
            $message = '<div class="message-contents threadID' . $threadID . '" fromUserID="' . $userID . '">' . $message . '</div>';
            $threads[$threadID]['posts'][] = array('iconMessage' => $iconMessage, 'userID' => $userID, 'username' => $username, 'message' => $message, 'points' => $points, 'online' => $online, 'userType' => $userType, 'timeSent' => $timeSent);
        }
        $buf = '';
        $threadCount = 0;
        foreach ($threadIDs as $threadID) {
            $data = $threads[$threadID];
            $buf .= '<div class="hr userID' . $threads[$threadID]['threadStarterUserID'] . ' threadID' . $threadID . '"></div>';
            $buf .= '<div class="homeForumGroup homeForumAlt' . ($threadCount % 2 + 1) . ' userID' . $threads[$threadID]['threadStarterUserID'] . ' threadID' . $threadID . '">
				<div class="homeForumSubject homeForumTopBorder">' . libHTML::forumParticipated($threadID) . ' ' . $data['subject'] . '</div> ';
            if (count($data['posts']) < $data['replies']) {
                $buf .= '<div class="homeForumPost homeForumMessage homeForumPostAlt' . libHTML::alternate() . ' ">

				...</div>';
            }
            $data['posts'] = array_reverse($data['posts']);
            foreach ($data['posts'] as $post) {
                $buf .= '<div class="homeForumPost homeForumPostAlt' . libHTML::alternate() . ' userID' . $post['userID'] . '">


					<div class="homeForumPostTime">' . libTime::text($post['timeSent']) . ' ' . $post['iconMessage'] . '</div>
					<a href="profile.php?userID=' . $post['userID'] . '" class="light">' . $post['username'] . '</a>
						' . libHTML::loggedOn($post['userID']) . ' (' . $post['points'] . libHTML::points() . User::typeIcon($post['userType']) . ')

					<div style="clear:both"></div>
					<div class="homeForumMessage">' . $post['message'] . '</div>
					</div>';
            }
            $buf .= '<div class="homeForumLink">
					<div class="homeForumReplies">' . l_t('%s replies', '<strong>' . $data['replies'] . '</strong>') . '</div>
					<a href="forum.php?threadID=' . $threadID . '#' . $threadID . '">' . l_t('Open') . '</a>
					</div>
					</div>';
        }
        if ($buf) {
            return $buf;
        } else {
            return '<div class="homeNoActivity">' . l_t('No forum posts found, why not ' . '<a href="forum.php?postboxopen=1#postbox" class="light">start one</a>?');
        }
    }