public function actionView($id)
 {
     Yii::beginProfile('jukebox_view');
     if (isset($_GET['attributeidC'])) {
         JukeboxAnswersApi::undoCorrectAnswer($_GET['attributeidC']);
     }
     if (isset($_GET['attributeidW'])) {
         JukeboxAnswersApi::undoWrongAnswer($_GET['attributeidW']);
     }
     $jukeboxQuestion = '';
     $userProfile = '';
     $geoCity = '';
     $jukeboxAnswers = '';
     $userdata = '';
     $jukeboxRating = '';
     $juckboxRatingEnable = false;
     $modelJukeboxQuestions = new JukeboxQuestions();
     $jukeboxNewAnswers = new JukeboxAnswers();
     $jukeboxQuestion = JukeboxQuestionsApi::getJukeboxQuestionById($id);
     $userProfile = UserApi::getUserProfileDetails($jukeboxQuestion->user_id);
     $juckboxRatingReadOnly = JukeboxRatingApi::checkUserRating($jukeboxQuestion->id, Yii::app()->user->id);
     if ($userProfile) {
         if (!$juckboxRatingReadOnly) {
             if ($userProfile->id == Yii::app()->user->id) {
                 $juckboxRatingReadOnly = true;
             } else {
                 $juckboxRatingReadOnly = false;
             }
         } else {
             $juckboxRatingReadOnly = true;
         }
     }
     if ($jukeboxQuestion) {
         if (isset($_POST['submit'])) {
             $model = new JukeboxAnswers();
             $model->attributes = $_POST['JukeboxAnswers'];
             $data = JukeboxAnswersApi::addJukeboxAnswer(Yii::app()->user->id, $jukeboxQuestion->id, $model);
             if ($data) {
                 $emailData = array();
                 $user = UserApi::getUserById(Yii::app()->user->id);
                 $user ? $emailData["user"] = $user->id : null;
                 $emailData["answer"] = $data->id;
                 EmailApi::sendEmail($user->email_id, "ACTIVITY.JUKEBOX.RESPONSE", $emailData);
             }
         }
         $geoCity = GeoCityApi::getCitynameByID($userProfile->city_id);
         $jukeboxAnswers = JukeboxAnswersApi::getJukeboxAnswers($jukeboxQuestion->id);
         if ($jukeboxAnswers) {
             foreach ($jukeboxAnswers as $answers) {
                 $jukeboxAnswersID[] = $answers->user_id;
             }
             $criteria = new CDbCriteria();
             $criteria->addInCondition('user_id', $jukeboxAnswersID);
             $users = UserProfiles::model()->findAll($criteria);
             $user_data = '';
             foreach ($users as $user) {
                 $userdata[$user->user_id] = $user->first_name;
             }
         }
         $jukeboxRating = JukeboxRatingApi::getRating($jukeboxQuestion->id);
     } else {
         $jukeboxQuestion->question = "No Questions have been posted by user";
         $jukeboxQuestion->description = '';
         $jukeboxQuestion->id = '';
     }
     $this->render('view', array('modelJukeboxQuestions' => $modelJukeboxQuestions, 'jukeboxNewAnswers' => $jukeboxNewAnswers, 'jukeboxQuestion' => $jukeboxQuestion, 'userProfile' => $userProfile, 'geoCity' => $geoCity, 'jukeboxAnswers' => $jukeboxAnswers, 'userdata' => $userdata, 'jukeboxRating' => $jukeboxRating, 'juckboxRatingReadOnly' => $juckboxRatingReadOnly));
     Yii::endProfile('jukebox_view');
 }
<?php 
if ($questions) {
    ?>
		<div class="right cols2">
<?php 
    echo '<div id="property_search_results">
		        	<h1 class="property_search_results_top">' . $jukeboxCount . ' Questions Found <span class="right"></span> </h1>
		            ';
    foreach ($questions as $question) {
        $userdetails = UserApi::getUserProfileDetails($question->user_id);
        $answers = count(JukeboxAnswersApi::getJukeboxAnswers($question->id));
        ?>
 
			
			<div class="post jukebox" style="cursor:pointer;" onClick="location.href='<?php 
        echo Yii::app()->createAbsoluteUrl('/jukebox/' . $question->id);
        ?>
'">
                    <div>
                    	<h1><?php 
        echo $question->question;
        ?>
</h1>
                        <p><?php 
        echo $question->description;
        ?>
</p>
		                <div class="left bedrooms width_auto">Posted in <span><?php 
        echo $question->category->category;
        ?>