Пример #1
0
    function __PrintForumGroupsAndForums($arRes, $arResult, $arParams, $depth = -1)
    {
        static $bInsertSeparator = false;
        $arGroup = $arRes;
        if (!is_array($arRes)) {
            return false;
        }
        if (intVal($arGroup["ID"]) > 0 && $arGroup["ID"] != $arResult["GROUP"]["ID"]) {
            if ($bInsertSeparator) {
                ?>
		<tbody class="forum-category-separator">
			<tr>
				<td class="forum-category-separator" colspan="5"></td>
			</tr>
		</tbody>
<?php 
            }
            ?>
		<thead>
			<tr>
				<th class="forum-column-title" colspan="2" scope="col"><div class="forum-head-title"><span><?php 
            ?>
<noindex><a rel="nofollow" href="<?php 
            echo $arResult["URL"]["GROUP_" . $arGroup["ID"]];
            ?>
"><?php 
            echo $arGroup["NAME"];
            ?>
</a></noindex></span></div></th>
				<th class="forum-column-topics" scope="col"><span><?php 
            echo GetMessage("F_TOPICS");
            ?>
</span></th>
				<th class="forum-column-replies" scope="col"><span><?php 
            echo GetMessage("F_POSTS");
            ?>
</span></th>
				<th class="forum-column-lastpost" scope="col"><span><?php 
            echo GetMessage("F_LAST_POST");
            ?>
</span></th>
			</tr>
		</thead>
<?php 
            $bInsertSeparator = true;
        }
        $iCountRows = 1;
        if (array_key_exists("FORUMS", $arRes)) {
            ?>
			<tbody>
<?php 
            foreach ($arGroup["FORUMS"] as $res) {
                if ($arParams["WORD_WRAP_CUT"] > 0) {
                    $res["TITLE"] = strLen($res["~TITLE"]) > $arParams["WORD_WRAP_CUT"] ? htmlspecialcharsEx(substr($res["~TITLE"], 0, $arParams["WORD_WRAP_CUT"])) . "..." : $res["TITLE"];
                    $res["LAST_POSTER_NAME"] = strLen($res["~LAST_POSTER_NAME"]) > $arParams["WORD_WRAP_CUT"] ? htmlspecialcharsEx(substr($res["~LAST_POSTER_NAME"], 0, $arParams["WORD_WRAP_CUT"])) . "..." : $res["LAST_POSTER_NAME"];
                }
                ?>
			<tr class="<?php 
                echo $iCountRows == 1 ? "forum-row-first " : "";
                echo $iCountRows == count($arGroup["FORUMS"]) ? "forum-row-last " : "";
                echo $iCountRows % 2 == 1 ? "forum-row-odd " : "forum-row-even ";
                echo $res["ACTIVE"] != "Y" ? " forum-row-inactive" : "";
                ?>
" <?php 
                if ($res["ACTIVE"] != "Y") {
                    ?>
 title="<?php 
                    echo GetMessage("F_NOT_ACTIVE_FORUM");
                    ?>
" <?php 
                }
                ?>
>
					<td class="forum-column-icon">
						<div class="forum-icon-container">
<?php 
                if ($res["NewMessage"] == "Y") {
                    ?>
							<div class="forum-icon forum-icon-newposts" title="<?php 
                    echo GetMessage("F_HAVE_NEW_MESS");
                    ?>
"><!-- ie --></div>
<?php 
                } else {
                    ?>
							<div class="forum-icon forum-icon-default" title="<?php 
                    echo GetMessage("F_NO_NEW_MESS");
                    ?>
"><!-- ie --></div>
<?php 
                }
                ?>
						</div>
					</td>
					<td class="forum-column-title">
						<div class="forum-item-info">
							<div class="forum-item-name"><span class="forum-item-title"><a href="<?php 
                echo $res["URL"]["TOPICS"];
                ?>
"><?php 
                echo $res["~NAME"];
                ?>
</a><?php 
                if ($res["NewMessage"] == "Y" && strLen($arParams["TMPLT_SHOW_ADDITIONAL_MARKER"]) > 0) {
                    ?>
<noindex><a rel="nofollow" href="<?php 
                    echo $res["URL"]["TOPICS"];
                    ?>
" class="forum-new-message-marker"><?php 
                    echo $arParams["TMPLT_SHOW_ADDITIONAL_MARKER"];
                    ?>
</a></noindex><?php 
                }
                ?>
</span></div>
							<span class="forum-item-desc"><?php 
                echo $res["~DESCRIPTION"];
                ?>
</span>
<?php 
                if ($res["PERMISSION"] >= "Q" && ($res["MODERATE"]["TOPICS"] > 0 || $res["MODERATE"]["POSTS"] > 0)) {
                    ?>
							<div class="forum-moderator-stat"><?php 
                    echo GetMessage("F_NOT_APPROVED");
                    ?>
&nbsp;<?php 
                    if ($res["MODERATE"]["TOPICS"] > 0) {
                        echo GetMessage("F_NOT_APPROVED_TOPICS");
                        ?>
:&nbsp;<span><?php 
                        echo $res["MODERATE"]["TOPICS"];
                        ?>
</span><?php 
                        echo $res["MODERATE"]["POSTS"] > 0 ? ", " : "";
                    }
                    if ($res["MODERATE"]["POSTS"] > 0) {
                        echo GetMessage("F_NOT_APPROVED_POSTS");
                        ?>
:&nbsp;<span><?php 
                        ?>
<noindex><a rel="nofollow" href="<?php 
                        echo $res["URL"]["MODERATE_MESSAGE"];
                        ?>
"><?php 
                        echo $res["MODERATE"]["POSTS"];
                        ?>
</a></noindex></span><?php 
                    }
                }
                ?>
						</div>
					</td>
					<td class="forum-column-topics"><span><?php 
                echo $res["TOPICS"];
                ?>
</span></td>
					<td class="forum-column-replies"><span><?php 
                echo $res["POSTS"];
                ?>
</span></td>
					<td class="forum-column-lastpost">
<?php 
                if (intVal($res["LAST_MESSAGE_ID"]) > 0) {
                    ?>
						<div class="forum-lastpost-box">
							<span class="forum-lastpost-title"><?php 
                    ?>
<noindex><a rel="nofollow" href="<?php 
                    echo $res["URL"]["MESSAGE"];
                    ?>
" title="<?php 
                    echo htmlspecialcharsEx($res["~TITLE"] . " (" . $res["~LAST_POSTER_NAME"] . ")");
                    ?>
"><?php 
                    echo $res["TITLE"];
                    ?>
 <span class="forum-lastpost-author">(<?php 
                    echo $res["LAST_POSTER_NAME"];
                    ?>
)</span></a></noindex></span>
							<span class="forum-lastpost-date"><?php 
                    echo $res["LAST_POST_DATE"];
                    ?>
</span>
						</div>
<?php 
                } else {
                    ?>
						&nbsp;
<?php 
                }
                ?>
					</td>
				</tr>
<?php 
                $iCountRows++;
            }
            ?>
			</tbody>
<?php 
        }
        $iCountRows = 0;
        if (array_key_exists("GROUPS", $arRes)) {
            if ($depth >= 1) {
                ?>
			<tbody>
<?php 
                foreach ($arRes["GROUPS"] as $key => $res) {
                    $iCountRows++;
                    ?>
				<tr class="<?php 
                    echo $iCountRows == 1 ? "forum-row-first " : "";
                    echo $iCountRows == $iCountRows ? "forum-row-last " : "";
                    echo $iCountRows % 2 == 1 ? "forum-row-odd " : "forum-row-even ";
                    ?>
" >
						<td class="forum-column-icon">
						<div class="forum-icon-container">
<?php 
                    if ($res["NewMessage"] == "Y") {
                        ?>
							<div class="forum-icon forum-icon-newposts" title="<?php 
                        echo GetMessage("F_HAVE_NEW_MESS");
                        ?>
"><!-- ie --></div>
<?php 
                    } else {
                        ?>
							<div class="forum-icon forum-icon-default" title="<?php 
                        echo GetMessage("F_NO_NEW_MESS");
                        ?>
"><!-- ie --></div>
<?php 
                    }
                    ?>
						</div>
					
					</td>
					<td class="forum-column-title">
						<div class="forum-item-info">
							<div class="forum-item-name"><span class="forum-item-title"><?php 
                    ?>
<noindex><a rel="nofollow" href="<?php 
                    echo $arResult["URL"]["GROUP_" . $res["ID"]];
                    ?>
"><?php 
                    echo $res["~NAME"];
                    ?>
</a></noindex></span></div>
							<span class="forum-item-desc"><?php 
                    if (array_key_exists("FORUMS", $res)) {
                        echo GetMessage("F_SUBFORUMS");
                        ?>
 <?php 
                        $bFirst = true;
                        foreach ($res["FORUMS"] as $val) {
                            if (!$bFirst) {
                                ?>
, <?php 
                            }
                            ?>
<a href="<?php 
                            echo $val["URL"]["TOPICS"];
                            ?>
"><?php 
                            echo $val["~NAME"];
                            ?>
</a><?php 
                            $bFirst = false;
                        }
                    } else {
                        echo GetMessage("F_SUBGROUPS");
                        ?>
 <?php 
                        $bFirst = true;
                        foreach ($res["GROUPS"] as $val) {
                            if (!$bFirst) {
                                ?>
, <?php 
                            }
                            ?>
<noindex><a rel="nofollow" href="<?php 
                            echo $arResult["URL"]["GROUP_" . $val["ID"]];
                            ?>
"><?php 
                            echo $val["~NAME"];
                            ?>
</a></noindex><?php 
                            $bFirst = false;
                        }
                    }
                    ?>
</span>
							
<?php 
                    if ($res["MODERATE"]["TOPICS"] > 0 || $res["MODERATE"]["POSTS"] > 0) {
                        ?>
							<div class="forum-moderator-stat"><?php 
                        echo GetMessage("F_NOT_APPROVED");
                        ?>
&nbsp;<?php 
                        if ($res["MODERATE"]["TOPICS"] > 0) {
                            echo GetMessage("F_NOT_APPROVED_TOPICS");
                            ?>
:&nbsp;<span><?php 
                            echo $res["MODERATE"]["TOPICS"];
                            ?>
</span><?php 
                            echo $res["MODERATE"]["POSTS"] > 0 ? ", " : "";
                        }
                        if ($res["MODERATE"]["POSTS"] > 0) {
                            echo GetMessage("F_NOT_APPROVED_POSTS");
                            ?>
:&nbsp;<span><?php 
                            ?>
<noindex><a rel="nofollow" href="<?php 
                            echo $arResult["URL"]["GROUP_" . $res["ID"]];
                            ?>
"><?php 
                            echo $res["MODERATE"]["POSTS"];
                            ?>
</a></noindex></span><?php 
                        }
                    }
                    ?>
						</div>
					</td>
					<td class="forum-column-topics"><span><?php 
                    echo $res["TOPICS"];
                    ?>
</span></td>
					<td class="forum-column-replies"><span><?php 
                    echo $res["POSTS"];
                    ?>
</span></td>
					<td class="forum-column-lastpost">
<?php 
                    if (intVal($res["LAST_MESSAGE_ID"]) > 0) {
                        ?>
						<div class="forum-lastpost-box">
							<span class="forum-lastpost-title"><?php 
                        ?>
<noindex><a rel="nofollow" href="<?php 
                        echo $res["URL"]["MESSAGE"];
                        ?>
" title="<?php 
                        echo htmlspecialcharsEx($res["~TITLE"] . " (" . $res["~LAST_POSTER_NAME"] . ")");
                        ?>
"><?php 
                        echo $res["TITLE"];
                        ?>
 <span class="forum-lastpost-author">(<?php 
                        echo $res["LAST_POSTER_NAME"];
                        ?>
)</span></a></noindex></span>
							<span class="forum-lastpost-date"><?php 
                        echo $res["LAST_POST_DATE"];
                        ?>
</span>
						</div>
<?php 
                    } else {
                        ?>
						&nbsp;
<?php 
                    }
                    ?>
					</td>
				</tr>
<?php 
                }
                ?>
			</tbody>
<?php 
            } else {
                $depth++;
                foreach ($arRes["GROUPS"] as $key => $val) {
                    __PrintForumGroupsAndForums($arRes["GROUPS"][$key], $arResult, $arParams, $depth);
                }
            }
        }
    }
Пример #2
0
    function __PrintForumGroupsAndForums($arRes, $arResult, $arParams, $depth = -1)
    {
        $arGroup = $arRes;
        if ($depth <= 0) {
            ?>
	<tbody>
<?php 
        }
        if (intVal($arGroup["ID"]) > 0) {
            ?>
		<tr>
			<td class="forum-group" colspan="<?php 
            echo $arResult["DrawAddColumn"] == "Y" ? "6" : "5";
            ?>
">
<?php 
            if ($arResult["GROUPS_SHOW"] == "Y" && $depth <= 0) {
                ?>
<span class="icon-switcher<?php 
                echo in_array($arGroup["ID"], $arResult["USER"]["HIDDEN_GROUPS"]) ? "-hidden" : "";
                ?>
" onclick="return SectionSH('<?php 
                echo $arGroup["ID"];
                ?>
');" id="forum_switch_<?php 
                echo $arGroup["ID"];
                ?>
" title="<?php 
                echo GetMessage("F_SHOW_HIDE_GROUP");
                ?>
"></span>
<?php 
            }
            ?>
<div class="forum-block forum-group">
				<a href="<?php 
            echo $arResult["URL"]["GROUP_" . $arGroup["ID"]];
            ?>
" class="forum-group">
					<?php 
            echo str_pad("", $depth - 1, ".");
            echo $arGroup["~NAME"];
            ?>
</a><?php 
            if (strLen($arGroup["~DESCRIPTION"]) > 0) {
                ?>
				<div class="forum-group-description"><?php 
                echo $arGroup["~DESCRIPTION"];
                ?>
</div><?php 
            }
            ?>
				</div>
			</td>
		</tr>
<?php 
            if ($depth <= 0) {
                ?>
	</tbody>
	<tbody id="forum_group_<?php 
                echo $arGroup["ID"];
                ?>
" <?php 
                echo in_array($arGroup["ID"], $arResult["USER"]["HIDDEN_GROUPS"]) ? " style=\"display:none;\"" : "";
                ?>
>
<?php 
            }
        }
        if (array_key_exists("FORUMS", $arRes)) {
            foreach ($arGroup["FORUMS"] as $res) {
                ?>
	<tr>
<?php 
                if ($arResult["DrawAddColumn"] == "Y") {
                    ?>
<td class="td-moderate"><?php 
                    if (intVal($res["mCnt"]) > 0) {
                        ?>
<a href="<?php 
                        echo $res["message_appr"];
                        ?>
" title="<?php 
                        echo GetMessage("F_MESSAGE_NOT_APPROVED");
                        ?>
 (<?php 
                        echo $res["mCnt"];
                        ?>
)"><div class="icon-attention"></div></a><?php 
                    }
                    ?>
</td><?php 
                }
                ?>
<td class="td-status"><?php 
                if ($res["ACTIVE"] != "Y") {
                    ?>
<div class="icon-na" title="N/A"></div><?php 
                } elseif ($res["NewMessage"] == "Y") {
                    ?>
<div class="icon-new-message" title="<?php 
                    echo GetMessage("F_HAVE_NEW_MESS");
                    ?>
" onclick="location.href='<?php 
                    echo $res["topic_list"];
                    ?>
'; return false"></div><?php 
                } else {
                    ?>
<div class="icon-no-message" title="<?php 
                    echo GetMessage("F_NO_NEW_MESS");
                    ?>
"></div><?php 
                }
                ?>
</td>
				<td class="td-name">
					<a href="<?php 
                echo $res["topic_list"];
                ?>
" class="forum"><?php 
                echo $res["~NAME"];
                ?>
</a>
					<?php 
                if ($res["NewMessage"] == "Y" && strLen(trim($arParams["TMPLT_SHOW_ADDITIONAL_MARKER"])) > 0) {
                    ?>
						<a href="<?php 
                    echo $res["topic_list"];
                    ?>
" class="forum forum-attention"><?php 
                    echo $arParams["TMPLT_SHOW_ADDITIONAL_MARKER"];
                    ?>
</a>
					<?php 
                }
                ?>
					<br />
					<?php 
                echo $res["~DESCRIPTION"];
                ?>
				</td>
				<td class="td-topics"><?php 
                echo $res["TOPICS"];
                ?>
</td>
				<td class="td-posts"><?php 
                echo $res["POSTS"];
                ?>
</td>
				<td class="td-lm">
					<?php 
                if (strLen($res["LAST_POST_DATE"]) > 0) {
                    ?>
						<a href="<?php 
                    echo $res["message_list"];
                    ?>
" class="forum-topic"><?php 
                    echo $res["LAST_POST_DATE"];
                    ?>
</a>
						<?php 
                    if (strLen($res["TITLE"]) > 0) {
                        if ($arParams["WORD_WRAP_CUT"] > 0) {
                            $res["TITLE"] = strLen($res["~TITLE"]) > $arParams["WORD_WRAP_CUT"] ? htmlspecialcharsEx(substr($res["~TITLE"], 0, $arParams["WORD_WRAP_CUT"])) . "..." : $res["TITLE"];
                        }
                        ?>
						<div class="forum-block forum-topic">
							<?php 
                        echo GetMessage("F_TOPIC");
                        ?>
&nbsp;<a href="<?php 
                        echo $res["message_list"];
                        ?>
" class="forum-topic"><?php 
                        echo $res["TITLE"];
                        ?>
</a>
						</div>
						<?php 
                    }
                    ?>
						<?php 
                    if (strLen($res["LAST_POSTER_NAME"]) > 0) {
                        if ($arParams["WORD_WRAP_CUT"] > 0) {
                            $res["LAST_POSTER_NAME"] = strLen($res["~LAST_POSTER_NAME"]) > $arParams["WORD_WRAP_CUT"] ? htmlspecialcharsEx(substr($res["~LAST_POSTER_NAME"], 0, $arParams["WORD_WRAP_CUT"])) . "..." : $res["LAST_POSTER_NAME"];
                        }
                        ?>
						<div class="forum-block forum-user">
						<?php 
                        echo GetMessage("F_AUTHOR");
                        ?>
							<?php 
                        if (intVal($res["LAST_POSTER_ID"]) > 0) {
                            ?>
								<a href="<?php 
                            echo $res["profile_view"];
                            ?>
" class="forum-user"><?php 
                            echo $res["LAST_POSTER_NAME"];
                            ?>
</a>
							<?php 
                        } else {
                            ?>
								<span class="forum-user"><?php 
                            echo $res["LAST_POSTER_NAME"];
                            ?>
</span>
							<?php 
                        }
                        ?>
						<?php 
                    }
                    ?>
						</div>
					<?php 
                }
                ?>
				</td>
			</tr><?php 
            }
        }
        if (array_key_exists("GROUPS", $arRes)) {
            $depth++;
            foreach ($arRes["GROUPS"] as $key => $val) {
                __PrintForumGroupsAndForums($arRes["GROUPS"][$key], $arResult, $arParams, $depth);
            }
        }
        if ($depth <= 0) {
            ?>
		</tbody>
<?php 
        }
    }