本文整理汇总了PHP中DataManager::getChannelById方法的典型用法代码示例。如果您正苦于以下问题:PHP DataManager::getChannelById方法的具体用法?PHP DataManager::getChannelById怎么用?PHP DataManager::getChannelById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataManager
的用法示例。
在下文中一共展示了DataManager::getChannelById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
<?php
$channelId = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
$channel = DataManager::getChannelById($channelId);
if ($channel === null || !AuthenticationManager::isAuthenticated()) {
Util::redirect('/');
}
?>
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
<?php
echo $channel->getName();
?>
</h1>
</div>
</div>
<!-- /.row -->
<div id="messages" class="row"></div>
<div class="row">
<div class="col-lg-8">
<form class="form-horizontal" id="addNewPost">
<div>
<input type="text" class="form-control" name="title" placeholder="Title" id="postTitle" required>
<textarea class="form-control" rows="3" placeholder="Text" name="text" id="postText"
required></textarea>
<button type="submit" class="btn btn-default">Submit</button>
示例2: isset
<?php
$postId = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
$post = DataManager::getPostById($postId);
$user = AuthenticationManager::getAuthenticatedUser();
if (!DataManager::isPostLastInChannel($post) || $user == null || $user->getId() != $post->getUserId()) {
$error = "You can only edit or delete a post if it has been created by you and is the last one in it's channel.";
}
$channel = DataManager::getChannelById($post->getChannelId());
if ($post == null || $channel == null) {
Util::redirect('/');
}
?>
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Edit post
<small>in channel <i><?php
echo $channel->getName();
?>
</i></small>
</h1>
</div>
</div>
<!-- /.row -->
<?php
if (isset($error)) {
?>