Ejemplo n.º 1
0
                if ($p['user_id'] == Yii::app()->user->userId) {
                    ?>
                            <span id="del_<?php 
                    echo $p['id'];
                    ?>
"><i class="icon-eye-open"></i><a href="javascript:void(0)" onclick="deletePost(<?php 
                    echo $p['id'];
                    ?>
)">DELETE</a></span></td>
                            <?php 
                }
                ?>
                    </tr>
                        
                <?php 
                $comments = CommentPost::model()->findAll(array('select' => '*', 'condition' => "post_id = {$p['id']}", 'order' => 'id ASC'));
                if ($comments) {
                    foreach ($comments as $c) {
                        ?>
                    <?php 
                        $userId1 = $c->user_id;
                        $user1 = UserProfile::model()->findByAttributes(array('user_id' => $userId1));
                        if (!empty($user1->first_name)) {
                            $userName1 = ucfirst($user1->first_name) . ' ' . ucfirst($user1->last_name);
                        } else {
                            $user2 = User::model()->findByAttributes(array('id' => $userId1));
                            $userName1 = $user2['username'];
                        }
                        ?>
                    <tr id="comment_<?php 
                        echo $c->id;
Ejemplo n.º 2
0
                            <?php 
        if ($p->user_id == Yii::app()->user->userId) {
            ?>
                            <span id="del_<?php 
            echo $p->id;
            ?>
"><i class="icon-eye-open"></i><a href="javascript:void(0)" onclick="deletePost(<?php 
            echo $p->id;
            ?>
)">DELETE</a></span></td>
                            <?php 
        }
        ?>
                    </tr>
                    <?php 
        $comments = CommentPost::model()->findAll('post_id=:pid', array(':pid' => $P->id));
        ////$comments = CommentPost::model()->findAll(array('select' => '*',
        //'condition' => "post_id = $p->id",
        //'order' => 'date ASC',
        //  ));
        if ($comments) {
            foreach ($comments as $c) {
                ?>
                    <?php 
                $userId1 = $c->user_id;
                $user1 = UserProfile::model()->findByAttributes(array('user_id' => $userId1));
                if ($user1->first_name) {
                    $userName1 = $user1->first_name . ' ' . $user1->last_name;
                } else {
                    $user1 = User::model()->findByAttributes(array('id' => $userId1));
                    $userName1 = $user1->username;
Ejemplo n.º 3
0
 public function actioncommentdelete($commentId, $text)
 {
     if ($text == 'post') {
         $comment = CommentPost::model()->find('id=:id', array('id' => $commentId));
         $comment->delete();
     } elseif ($text == 'page') {
         $comment = CommentBussinessPage::model()->find('id=:id', array('id' => $commentId));
         $comment->delete();
     }
 }
Ejemplo n.º 4
0
                            <?php 
        if ($p->user_id == Yii::app()->user->userId) {
            ?>
                            <span id="del_<?php 
            echo $p->id;
            ?>
"><i class="icon-eye-open"></i><a href="javascript:void(0)" onclick="deletePost(<?php 
            echo $p->id;
            ?>
)">DELETE</a></span></td>
                            <?php 
        }
        ?>
                    </tr>
                    <?php 
        $comments = CommentPost::model()->findAll(array('select' => '*', 'condition' => "post_id = {$p->id}"));
        if ($comments) {
            foreach ($comments as $c) {
                ?>
                    <?php 
                $userId1 = $c->user_id;
                $user1 = UserProfile::model()->findByAttributes(array('user_id' => $userId1));
                if ($user1->first_name) {
                    $userName1 = $user1->first_name . ' ' . $user1->last_name;
                } else {
                    $user1 = User::model()->findByAttributes(array('id' => $userId1));
                    $userName1 = $user1->username;
                }
                ?>
                    <tr>
                        <td>&nbsp;</td>