예제 #1
0
    public function getActivityHTML($row, $userID)
    {
        ob_start();
        $user = BuckysUser::getUserBasicInfo($row['userID']);
        $owner = BuckysUser::getUserBasicInfo($row['poster']);
        if ($row['activityType'] == 'like') {
            ?>
            <div class="activityComment">
                <?php 
            render_profile_link($user, 'replyToPostIcons');
            ?>
                <span>
                    <a href="/profile.php?user=<?php 
            echo $row['userID'];
            ?>
"><b><?php 
            echo $user['firstName'] . " " . $user['lastName'];
            ?>
</b></a>
                    liked <?php 
            echo $row['poster'] == $userID ? 'your' : "<a href='/profile.php?user="******"'><b>" . $owner['firstName'] . " " . $owner['lastName'] . "'s</b></a>";
            ?>
                    <?php 
            switch ($row['type']) {
                case "image":
                    echo "<a href='/posts.php?user="******"&post=" . $row['objectID'] . "'>photo</a>";
                    break;
                case "video":
                    echo "<a href='/posts.php?user="******"&post=" . $row['objectID'] . "'>video</a>";
                    break;
                case "text":
                default:
                    echo "<a href='/posts.php?user="******"&post=" . $row['objectID'] . "'>post</a> ";
                    if (strlen(buckys_trunc_content($row['content'], 60)) > 0) {
                        echo '&#8220;' . buckys_trunc_content($row['content'], 60) . '&#8221;';
                    }
                    break;
            }
            ?>
                </span>
            </div>
            
            <?php 
        } else {
            if ($row['activityType'] == 'comment') {
                ?>
            <div class="activityComment">                
                <?php 
                render_profile_link($user, 'replyToPostIcons');
                ?>
                <span>
                    <a href="/profile.php?user=<?php 
                echo $row['userID'];
                ?>
"><b><?php 
                echo $user['firstName'] . " " . $user['lastName'];
                ?>
</b></a>
                    left a comment on 
                    <?php 
                if ($row['poster'] == $userID) {
                    echo 'your';
                } else {
                    if ($row['poster'] == $row['userID']) {
                        //Getting User Data
                        $tUinfo = BuckysUser::getUserBasicInfo($row['userID']);
                        switch (strtolower($tUinfo['gender'])) {
                            case 'male':
                                echo 'his';
                                break;
                            case 'female':
                                echo 'her';
                                break;
                                break;
                                echo 'their';
                                break;
                        }
                    } else {
                        echo "<a href='/profile.php?user="******"'><b>" . $owner['firstName'] . " " . $owner['lastName'] . "'s</b></a>";
                    }
                }
                ?>
 
                    <?php 
                switch ($row['type']) {
                    case "image":
                        echo "<a href='/posts.php?user="******"&post=" . $row['objectID'] . "'>photo</a>";
                        break;
                    case "video":
                        echo "<a href='/posts.php?user="******"&post=" . $row['objectID'] . "'>video</a>";
                        break;
                    case "text":
                    default:
                        echo "<a href='/posts.php?user="******"&post=" . $row['objectID'] . "'>post</a> ";
                        break;
                }
                if (strlen(buckys_trunc_content($row['comment_content'], 25)) > 0) {
                    echo ': &#8220;' . buckys_trunc_content($row['comment_content'], 25) . '&#8221;';
                }
                ?>
                    
                </span>
            </div>
            <?php 
            }
        }
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
    /**
     * @param $row
     * @param $userID
     * @return string
     */
    public static function getActivityHTML($row, $userID)
    {
        ob_start();
        $user = BuckysUser::getUserBasicInfo($row['userID']);
        $owner = BuckysUser::getUserBasicInfo($row['poster']);
        $pagePostFlag = false;
        if ($row['pageID'] != BuckysPost::INDEPENDENT_POST_PAGE_ID) {
            $pageIns = new BuckysPage();
            $pageData = $pageIns->getPageByID($row['pageID']);
        }
        if (isset($pageData)) {
            $pagePostFlag = true;
        }
        if ($pagePostFlag) {
            $objectLink = "/page.php?pid=" . $row['pageID'] . "&post=" . $row['objectID'];
            $authorLink = '/page.php?pid=' . $row['pageID'];
        } else {
            $objectLink = "/posts.php?user="******"&post=" . $row['objectID'];
            $authorLink = '/profile.php?user='******'poster'];
        }
        if ($row['activityType'] == 'like') {
            ?>
            <div class="activityComment">
                <?php 
            render_profile_link($user, 'replyToPostIcons');
            ?>
                <span>
                    <a href="/profile.php?user=<?php 
            echo $row['userID'];
            ?>
"
                        class="userName"><?php 
            echo $user['firstName'] . " " . $user['lastName'];
            ?>
</a>
                    liked <?php 
            echo $row['poster'] == $userID ? 'your' : "<a href='/profile.php?user="******"' class=\"userName\">" . $owner['firstName'] . " " . $owner['lastName'] . "'s</a>";
            ?>
                    <?php 
            switch ($row['type']) {
                case "image":
                    echo "<a href='" . $objectLink . "'>photo</a>";
                    break;
                case "video":
                    echo "<a href='" . $objectLink . "'>video</a>";
                    break;
                case "text":
                default:
                    echo "<a href='" . $objectLink . "'>post</a> ";
                    if (strlen(buckys_trunc_content($row['content'], 60)) > 0) {
                        echo '&#8220;' . buckys_trunc_content($row['content'], 60) . '&#8221;';
                    }
                    break;
            }
            ?>
                </span>
            </div>
            
            <?php 
        } else {
            if ($row['activityType'] == 'comment') {
                ?>
            <div class="activityComment">                
                <?php 
                render_profile_link($user, 'replyToPostIcons');
                ?>
                <span>
                    <a href="/profile.php?user=<?php 
                echo $row['userID'];
                ?>
"
                        class="userName"><?php 
                echo $user['firstName'] . " " . $user['lastName'];
                ?>
</a>
                    left a comment on 
                    <?php 
                if ($row['poster'] == $userID) {
                    echo 'your';
                } else {
                    if ($row['poster'] == $row['userID']) {
                        //Getting User Data
                        $tUinfo = BuckysUser::getUserBasicInfo($row['userID']);
                        switch (strtolower($tUinfo['gender'])) {
                            case 'male':
                                echo 'his';
                                break;
                            case 'female':
                                echo 'her';
                                break;
                                break;
                                echo 'their';
                                break;
                        }
                    } else {
                        echo "<a href='/profile.php?user="******"' class=\"userName\">" . $owner['firstName'] . " " . $owner['lastName'] . "'s</a>";
                    }
                }
                ?>
 
                    <?php 
                switch ($row['type']) {
                    case "image":
                        echo "<a href='" . $objectLink . "'>photo</a>";
                        break;
                    case "video":
                        echo "<a href='" . $objectLink . "'>video</a>";
                        break;
                    case "text":
                    default:
                        echo "<a href='" . $objectLink . "'>post</a> ";
                        break;
                }
                if (strlen(buckys_trunc_content($row['comment_content'], 25)) > 0) {
                    echo ': &#8220;' . buckys_trunc_content($row['comment_content'], 25) . '&#8221;';
                }
                ?>
                    
                </span>
            </div>
            <?php 
            }
        }
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }