Пример #1
0
                case "show":
                    $group = $groups->getGroup($data["parameters"][2]);
                    $smarty->assign("GROUP", $group);
                    $smarty->assign("FRIENDS", $friends->getAllFriends());
                    $smarty->assign("GROUP_FRIENDS", $group->getFriends());
                    $output["text"] = $smarty->fetch("friends.groups.show.tpl");
                    break;
                case "addfriend":
                    $group = $groups->getGroup($data["parameters"][2]);
                    $group->addFriend($_POST["friend_ID"]);
                    header("Location: /friends/groups/show/{$group->id}/");
                    break;
                case "deletefriend":
                    $group = $groups->getGroup($data["parameters"][2]);
                    $group->delFriend($data["parameters"][3]);
                    header("Location: /friends/groups/show/{$group->id}/");
                    break;
            }
        } else {
            $smarty->assign("GROUPS", $groups->getAllGroups());
            $output["text"] = $smarty->fetch("friends.groups.tpl");
        }
        break;
    default:
        $arrayFriends = $friends->getAllFriends();
        $randomFriends = $friends->getRandomFriends(3);
        $smarty->assign("FRIENDS", $arrayFriends);
        $smarty->assign("randomFRIENDS", $randomFriends);
        $output["text"] = $smarty->fetch("friends.all.tpl");
        break;
}