public function actionFollowBusinessPage($id, $text)
 {
     $userId = Yii::app()->user->userId;
     if ($text == 'follow') {
         $model = new UserpageFollow();
         $model->user_id = $userId;
         $model->business_page_id = $id;
         $model->save();
         echo "unfollow";
         $page = Pages::model()->findByPk($id);
         $name = UserProfile::model()->find('user_id=:uid', array(':uid' => Yii::app()->user->userId));
         $text = $name['first_name'] . " " . $name['last_name'] . " Follow your page <b>" . $page->company_name . "</b>";
         $date = date('Y-m-d H:i:s');
         $this->notification(Yii::app()->user->userId, $page->user_id, $text, $date, 'page_post');
     } else {
         $model = UserpageFollow::model()->find('user_id=:userId AND business_page_id=:pageId', array(':userId' => $userId, ':pageId' => $id));
         $model->delete();
         echo "follow";
     }
 }
Example #2
0
<?php

$pageFollow = UserpageFollow::model()->find('user_id=:userId AND business_page_id=:pageId', array(':userId' => Yii::app()->user->userId, ':pageId' => $id));
$model = Pages::model()->findByPk($id);
?>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<style type="text/css">#map_canvas {height:250px;width:250px;margin-left:-10px}</style>

<style>#notify{margin:0px auto;font-size:13px;width:100%;text-shadow:0 1px 0 rgba(255,255,255,0.4)}#notify_error{margin:15px 0 5px;border:1px solid #a34625;background-color:#f9d9ce;padding:8px 4px 4px;height:20px;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}#notify_success{margin:15px 0 5px;border:1px solid #25a336;background-color:#dfffe3;padding:8px 4px 4px;height:20px;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;}#notify_message{margin:15px 0 5px;border:1px solid #284797;background-color:#cedaf9;padding:8px 4px 4px;height:20px;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.flash_icon_container{margin-left: 150px; margin-right: 30px;float:left;width:20px;text-align:right;padding-right:8px;height:20px;position:relative;top:-3px}.flash_messages_container{margin-left: 200px; font-family:'Helvetica Neue', 'Myriad Pro', Calibri, 'trebuchet ms', Tahoma, Arial, Verdana, sans-serif;color:#333}.notify_message{width:400px;height:40px;background-color:#A6D6FF}</style>

<style>
    .well-for-table:hover {
        background-color: #e1eafe;
    }
    .well-for-table img{
        height:50px;
    }
    
    .well-for-table1:hover {
        background-color: #f5f5f5;
    }
    
    .well-for-table1 img{
        height:30px;
    }

</style>
<script>
    function addPost()
    {
        $('#show-empty-post').css('display','none');
 public function actionFollowBusinessPage($id, $text)
 {
     $userId = Yii::app()->user->userId;
     if ($text == 'follow') {
         $model = new UserpageFollow();
         $model->user_id = $userId;
         $model->business_page_id = $id;
         $model->save();
         echo "unfollow";
     } else {
         $model = UserpageFollow::model()->find('user_id=:userId AND business_page_id=:pageId', array(':userId' => $userId, ':pageId' => $id));
         $model->delete();
         echo "follow";
     }
 }