public function actionAnswerCorrectRating($answerid, $questionId) { if (JukeboxAnswersApi::userAnswercorrect($answerid, $questionId)) { $jukeboxAttribute = JukeboxAnswersApi::userAnswercorrect($answerid); echo JukeboxAnswersApi::getCorrectAnswerCount($answerid) . CHtml::link(' undo', array('/jukebox/' . $questionId . '?attributeidC=' . $jukeboxAttribute->id . ''), array('class' => 'red')); } else { JukeboxAnswersApi::addCorrectAnswer($answerid, Yii::app()->user->id); $jukeboxAttribute = JukeboxAnswersApi::userAnswercorrect($answerid, Yii::app()->user->id); echo JukeboxAnswersApi::getCorrectAnswerCount($answerid) . CHtml::link(' undo', array('/jukebox/' . $questionId . '?attributeidC=' . $jukeboxAttribute->id . ''), array('class' => 'red')); } }
</div> </div>'; ?> </div> </div><?php if ($jukeboxAnswers) { foreach ($jukeboxAnswers as $i => $answers) { $correctUndo = ''; $wrongUndo = ''; $correctText = 'display:none'; $wrongText = 'display:none'; $imgcorrect = '<img src="' . Yii::app()->theme->baseUrl . '/images/icon-success.png" alt="" class="left correctimg' . $i . '" />'; $imgWrong = '<img src="' . Yii::app()->theme->baseUrl . '/images/deletered.png" alt="" class="left wrongimg' . $i . '" />'; $answerCorrectCount = JukeboxAnswersApi::getCorrectAnswerCount($answers->id); $answerWrongCount = JukeboxAnswersApi::getWrongAnswerCount($answers->id); $userAnswers = JukeboxAnswersApi::userCorrectAnswers($answers->id); if ($userAnswers && $userAnswers->status == 1) { $correctUndo = CHtml::link(' undo', array('/jukebox/' . $jukeboxQuestion->id . '?attributeidC=' . $userAnswers->id . ''), array('class' => 'red')); $imgWrong = ''; $correctText = 'display:block'; } else { if ($userAnswers && $userAnswers->status == 0) { $wrongUndo = CHtml::link(' undo', array('/jukebox/' . $jukeboxQuestion->id . '?attributeidW=' . $userAnswers->id . ''), array('class' => 'red')); $imgcorrect = ''; $wrongText = 'display:block'; } } echo '<div class="search-jukebox-answer-part"> <h2 class="question">Answer ' . ($i + 1) . '</h2> <div class="search-jukebox-answer"> <p>' . $answers->answer . '</p>
<?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; ?>