Example #1
0
 public function index()
 {
     if (isset($this->request->get['quiz_id'])) {
         $quiz_id = (int) $this->request->get['quiz_id'];
     } else {
         $this->response->redirect($this->url->link('common/home', '', 'SSL'));
     }
     $this->load->language('information/quiz');
     $this->load->model('catalog/quiz');
     $this->load->model('tool/image');
     $data['breadcrumbs'] = array();
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home', '', 'SSL'));
     //подсасываем скрипт для данного опроса
     $this->document->addScript('catalog/assets/js/znatokmoscow.v.1.1.js');
     //подтянем инфу о сушности опрос
     $quiz_info = $this->model_catalog_quiz->getQuiz($quiz_id);
     //seo
     $this->document->setTitle($quiz_info['meta_title']);
     $this->document->setDescription($quiz_info['meta_description']);
     $this->document->setKeywords($quiz_info['meta_keyword']);
     //
     $data['heading_title'] = $quiz_info['title'];
     $data['quiz_id'] = $quiz_id;
     $template_name = $quiz_info['template_id'];
     $data['share_rbtn_ya'] = 'rbtn_' . $template_name;
     //получим количество шагов для данного опроса $quiz_id
     $step_questions = $this->model_catalog_quiz->getSteps($quiz_id);
     //так как тест без картинок то не паримся насчет картинок и сразу отдаем его в шаблон
     shuffle($step_questions);
     $data['step_questions'] = array();
     foreach ($step_questions as $step) {
         $d_qitems = array();
         foreach ($step['ar_questions'] as $value) {
             if (!empty($value['image'])) {
                 $image = $this->model_tool_image->resize($value['image'], 350, 350, 'h');
                 $image_min = $this->model_tool_image->resize($value['image'], 350, 100, 'w');
             } else {
                 $image = $this->model_tool_image->resize('placeholder.png', 350, 350, 'h');
                 $image_min = $this->model_tool_image->resize('placeholder.png', 350, 100, 'w');
             }
             $d_qitems[] = array('question_id' => $value['question_id'], 'correct' => $value['correct'], 'answer_title' => $value['answer_title'], 'answer_comment' => $value['answer_comment'], 'image' => $image, 'image_min' => $image_min, 'sort_order' => $value['sort_order']);
         }
         $data['step_questions'][] = array('qitem_id' => $step['qitem_id'], 'title' => $step['title'], 'ar_questions' => $d_qitems);
     }
     //подтянем количество проголосавших
     $data['count_people'] = $this->model_catalog_quiz->getTotalQuizStatsFor($quiz_id);
     //добавим начальный стек
     $data['count_people'] += 3000;
     $data['voices'] = getNumEnding($data['count_people'], array('человек', 'человека', 'человек'));
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/quiz/quiz13.tpl')) {
         return $this->load->view($this->config->get('config_template') . '/template/quiz/quiz13.tpl', $data);
     } else {
         return $this->load->view('default/template/quiz/quiz13.tpl', $data);
     }
 }
Example #2
0
 public function index()
 {
     //	$this->response->redirect($this->url->link('common/home', '', 'SSL'));
     $this->language->load('information/quiz');
     $this->load->model('tool/image');
     $this->load->model('catalog/quiz');
     $data['heading_title'] = $this->language->get('heading_title');
     $detect = new Mobile_Detect();
     // Если не планшет и не мобильное устройство
     //seo
     $this->document->setTitle($data['heading_title']);
     $this->document->setDescription($this->language->get('heading_description'));
     $this->document->setKeywords($this->language->get('heading_keywords'));
     //получим список активных рейтингов
     $filter_data = array('filter_status' => 1, 'filter_visibility' => 1);
     $quizs = $this->model_catalog_quiz->getQuizs($filter_data);
     $data['quizs'] = array();
     foreach ($quizs as $quiz) {
         if (!empty($quiz['image'])) {
             if (!$detect->isMobile() && !$detect->isTablet()) {
                 $image = $this->model_tool_image->resize($quiz['image'], 1920, 1080, 'h');
             } else {
                 $image = $this->model_tool_image->resize($quiz['image'], 1024, 768, 'h');
             }
         } else {
             $image = $this->model_tool_image->resize('placeholder.png', 1024, 768, 'h');
         }
         $random_csore = rand(2000, 2500);
         $data['quizs'][] = array('quiz_id' => $quiz['quiz_id'], 'quiz_title' => $quiz['title'], 'quiz_voice' => sprintf($this->language->get('text_quiz_voice'), $random_csore, getNumEnding($random_csore, array('человек', 'человека', 'человек'))), 'quiz_image' => $image, 'quiz_href' => $this->url->link('information/quiz/view', 'quiz_id=' . $quiz['quiz_id']));
     }
     $data['column_left'] = $this->load->controller('common/column_left');
     $data['column_right'] = $this->load->controller('common/column_right');
     $data['content_top'] = $this->load->controller('common/content_top');
     $data['content_bottom'] = $this->load->controller('common/content_bottom');
     $data['footer'] = $this->load->controller('common/footer');
     $data['header'] = $this->load->controller('common/header');
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/information/quiz/quizs_list.tpl')) {
         $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/information/quiz/quizs_list.tpl', $data));
     } else {
         $this->response->setOutput($this->load->view('default/template/information/quiz/quizs_list.tpl', $data));
     }
 }
Example #3
0
 public function index()
 {
     if (isset($this->request->get['quiz_id'])) {
         $quiz_id = (int) $this->request->get['quiz_id'];
     } else {
         $this->response->redirect($this->url->link('common/home', '', 'SSL'));
     }
     $this->load->language('information/quiz');
     $this->load->model('catalog/quiz');
     $data['breadcrumbs'] = array();
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home', '', 'SSL'));
     //подсасываем скрипт для данного опроса
     $this->document->addScript('catalog/assets/js/whatmuscovite.v.1.1.js');
     //подтянем инфу о сушности опрос
     $quiz_info = $this->model_catalog_quiz->getQuiz($quiz_id);
     //seo
     $this->document->setTitle($quiz_info['meta_title']);
     $this->document->setDescription($quiz_info['meta_description']);
     $this->document->setKeywords($quiz_info['meta_keyword']);
     //
     $data['heading_title'] = $quiz_info['title'];
     $data['quiz_id'] = $quiz_id;
     $template_name = $quiz_info['template_id'];
     $data['share_rbtn_ya'] = 'rbtn_' . $template_name;
     //получим количество шагов для данного опроса $quiz_id
     $data['step_questions'] = $this->model_catalog_quiz->getSteps($quiz_id);
     //так как тест без картинок то не паримся насчет картинок и сразу отдаем его в шаблон
     shuffle($data['step_questions']);
     //подтянем количество проголосавших
     $data['count_people'] = $this->model_catalog_quiz->getTotalQuizStatsFor($quiz_id);
     //добавим начальный стек
     $data['count_people'] += 3000;
     $data['voices'] = getNumEnding($data['count_people'], array('человек', 'человека', 'человек'));
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/quiz/quiz10.tpl')) {
         return $this->load->view($this->config->get('config_template') . '/template/quiz/quiz10.tpl', $data);
     } else {
         return $this->load->view('default/template/quiz/quiz10.tpl', $data);
     }
 }
Example #4
0
    //CIBlockElement::GetList(array(), array("IBLOCK_ID" => 6, "PROPERTY_LIKE" => $arPost['ID'], "PROPERTY_USER" => $USER->GetID() ),array());
    $res_like_star = CIBlockElement::GetList(array(), array("IBLOCK_ID" => 10, "PROPERTY_LIKE" => $arPost['ID'], "PROPERTY_USER" => $USER->GetID()), array());
    ?>
		<div class="group_info_details">
			<img src="<?php 
    echo SITE_TEMPLATE_PATH;
    ?>
/images/date_comments.png" width="" height="" alt="">
			<?php 
    $tmp_comm_count = $arPost["PROPERTIES"]["COMMENTS_COUNT"]["VALUE"];
    ?>
			<span><?php 
    echo intval($tmp_comm_count);
    ?>
 <?php 
    echo getNumEnding(intval($tmp_comm_count), array("КОММЕНТАРИЙ", "КОММЕНТАРИЯ", "КОММЕНТАРИЕВ"));
    ?>
</span>
			<?php 
    if ($arPost["PROPERTIES"]["SHARE"]["VALUE"] == "Y") {
        ?>
			<img src="<?php 
        echo SITE_TEMPLATE_PATH;
        ?>
/images/arrow.png" width="" height="" alt=""> <span link="<?php 
        echo urlencode("http://" . SITE_SERVER_NAME . $link_share);
        ?>
" class= "fb_share_count" style="vertical-align: baseline; color:#fff;"></span><span style="margin-left:-20px;">ПОДЕЛИЛИСЬ</span>
			<?php 
    }
    ?>
Example #5
0
if ($CurentUser["ID"] == $USER->GetID()) {
    echo 'Вы состоите в';
} else {
    echo 'состоит в';
}
?>
</div>
						<div class="profile-soc-infoblock-bottom"><?php 
if ($CurentUser["UF_GROUPS"]) {
    echo count($CurentUser["UF_GROUPS"]);
} else {
    echo 0;
}
?>
 <?php 
echo getNumEnding(count($CurentUser["UF_GROUPS"]), array("группе", "группах", "группах"));
?>
</div>
					</div>



				</div>
				
			</div>
			<div class="down-left-profile-head">
				<?php 
if ($CurentUser["ID"] !== $USER->GetID()) {
    if (!$friends) {
        echo '<button class="add-or-del-friend" data-id="' . $CurentUser["ID"] . '">Добавить в друзья</button>';
    } else {
Example #6
0
/images/members_icon.png" width="" height="" alt="">
			<?php 
    $tmp_comm_count = $arPost["PROPERTIES"]["COMMENTS_COUNT"]["VALUE"];
    ?>
			<!--span><?php 
    echo intval($tmp_comm_count);
    ?>
 <?php 
    echo getNumEnding(intval($tmp_comm_count), array("КОММЕНТАРИЙ", "КОММЕНТАРИЯ", "КОММЕНТАРИЕВ"));
    ?>
</span-->
			<span><?php 
    echo count($arPost["PROPERTIES"]["ANC_ID"]["VALUE"]);
    ?>
 <?php 
    echo getNumEnding(count($arPost["PROPERTIES"]["ANC_ID"]["VALUE"]), array("УЧАСТНИК", "УЧАСТНИКА", "УЧАСТНИКОВ"));
    ?>
</span>
			<?php 
    if ($arPost["PROPERTIES"]["SHARE"]["VALUE"] == "Y") {
        $link_2 = str_replace("#group_id#", $group_id, $arPost["DETAIL_PAGE_URL"]);
        ?>
			<img src="<?php 
        echo SITE_TEMPLATE_PATH;
        ?>
/images/arrow.png" width="" height="" alt=""> <span link="<?php 
        echo urlencode("http://" . SITE_SERVER_NAME . $link_2 . '/');
        ?>
" class= "fb_share_count" style="vertical-align: baseline; color:#fff;"></span><span style="margin-left:-20px;">ПОДЕЛИЛИСЬ</span>
			<?php 
    }
Example #7
0
    }
    if ($code) {
        $json['success'] = 1;
        $json['share_image'] = HTTP_SERVER . 'share/' . $code . '.jpg';
        $json['share_url'] = HTTP_SERVER . '/share.php?share_id=' . $code . '&point=' . (int) $request->get['point'];
    } else {
        $json['error'] = 'ERROR DB';
    }
    $response->addHeader('Content-Type: application/json');
    $response->setOutput(json_encode($json));
} else {
    $share_id = $request->get['share_id'];
    $point = $request->get['point'];
    $template = new Template();
    $template->base = HTTP_SERVER;
    $template->image = 'share/' . $share_id . '.jpg';
    $template->share_url = HTTP_SERVER . 'share.php?share_id=' . $share_id . '&point=' . $point;
    if ((int) $point > 10) {
        $template->title = 'Я собрал ' . $point . ' ' . getNumEnding($point, array('услугу', 'услуги', 'услуг'));
        $template->description = 'А ты сможешь лучше?';
    } elseif ((int) $point < 10 && (int) $point >= 5) {
        $template->title = 'Я собрал ' . $point . ' ' . getNumEnding($point, array('услугу', 'услуги', 'услуг'));
        $template->description = 'А ты сможешь лучше?';
    } else {
        $template->title = 'Я собрал ' . $point . ' ' . getNumEnding($point, array('услугу', 'услуги', 'услуг'));
        $template->description = 'А ты сможешь лучше?';
    }
    $out = $template->render(DIR_APPLICATION . '/template/share.tpl');
    $response->setOutput($out);
}
$response->output();
Example #8
0
					.social-buttons {cursor: default;}
					.comments-icon {cursor: default !important;}
				</style>
				<div class="photo_list_info">
					<div class="likes-wrap" style='width: 60px; float: left;'>
						<?php 
    $APPLICATION->IncludeComponent("radia:likes", "", array("ELEMENT" => $arPost['ID'], "PHOTOS" => $arPost["PROPERTIES"]["PHOTO"]["VALUE"], "INACTIVE" => true));
    ?>
					</div>
					<a class="comments-wrap">
								<div class="comments-icon"></div>
								<div class="comments-number"><?php 
    echo intval($arPost["PROPERTIES"]["COMMENTS_COUNT"]["VALUE"]);
    ?>
 <?php 
    echo getNumEnding(intval($arPost["PROPERTIES"]["COMMENTS_COUNT"]["VALUE"]), array("комментарий", "комментария", "комментариев"));
    ?>
</div>
					</a>
					<?php 
    if ($arPost["PROPERTIES"]["SHARE"]["VALUE"] == "Y") {
        ?>
						<div class="socwrap">
							<!-- Кнопка репоста -->
							<div class="social-buttons"></div>
							 <span link="<?php 
        echo urlencode("http://" . SITE_SERVER_NAME . "/group/1/photo/" . $arPost["ID"] . '/');
        ?>
" class= "fb_share_count" style="vertical-align: baseline; color:#fff; text-align:center; padding-top:4px; font-size: 11px;"></span>
						</div>
					<?php 
Example #9
0
    ?>
</div></a>
				</div>
			<div class="bottom-small-menu">
					<div class="likes-wrap">
						<?php 
    $APPLICATION->IncludeComponent("radia:likes", "", array("ELEMENT" => $arFields["ID"]));
    ?>
					</div>
					<div class="users-wrap">
						<div class="users-icon" style="cursor:default;"></div>
						<div class="users-number"><?php 
    echo intval($arProps["USERS_M"]["VALUE"]);
    ?>
 <span class="nomobile-span"><?php 
    echo getNumEnding(intval($arProps["USERS_M"]["VALUE"]), array("участник", "участника", "участников"));
    ?>
</span></div>
					</div>
					<div class="socwrap">
						<div class="social-buttons" style="cursor:default;"></div>
						<div class="socblock"><?php 
    echo intval($arProps["SHARES"]["VALUE"]);
    ?>
</div> <span style="top: 4px; position: relative; font-size: 11px;"><span class="nomobile-span">ПОДЕЛИЛИСЬ</span></span>
					</div>
				</div>
			</div>
		</div>
		<?php 
}
Example #10
0
function show_test_results($postid)
{
    // global $post;
    $questions = get_post_meta($postid, 'test_questions', false);
    $questions = reset($questions);
    if (test_is_adv()) {
        $questions_total = 24;
    } else {
        foreach ($questions as $question) {
            if (!array_key_exists('is_advanced', $question)) {
                $questions_simple[] = $question;
            }
        }
        $questions = $questions_simple;
        $questions_total = 12;
    }
    // if (isset($_GET['result'])) {
    $user_answers = $_GET['q'];
    $user_answers = reset($user_answers);
    foreach ($questions as $question) {
        $real_answers[] = mb_substr($question['is_correct'], -2, 1);
    }
    // Returns an array containing all the values from array1 that are not present in any of the other arrays
    $questions_not_answered = array_diff_key($real_answers, $user_answers);
    $questions_user_wrong = array_diff_assoc($user_answers, $real_answers);
    $questions_not_answered_and_wrong = $questions_not_answered + $questions_user_wrong;
    ksort($questions_not_answered_and_wrong);
    // $level_beginner = range(0, 5);
    //Уровни вопросов
    $stages_elementary = range(0, 5);
    $stages_preint = range(6, 11);
    $stages_int = range(12, 17);
    $stages_uppint = range(18, 23);
    // $stages_adv = array(24);
    if (test_is_adv()) {
        $stages = array($stages_elementary, $stages_preint, $stages_int, $stages_uppint);
        $wrong_answers_by_stage = array(0, 0, 0, 0);
        foreach ($questions_not_answered_and_wrong as $q_number => $value) {
            $i = 0;
            foreach ($stages as $stage) {
                if (in_array($q_number, $stage)) {
                    $wrong_answers_by_stage[$i]++;
                }
                $i++;
            }
        }
    } else {
        $stages = array($stages_elementary, $stages_preint);
        $wrong_answers_by_stage = array(0, 0);
        foreach ($questions_not_answered_and_wrong as $q_number => $value) {
            $i = 0;
            foreach ($stages as $stage) {
                if (in_array($q_number, $stage)) {
                    $wrong_answers_by_stage[$i]++;
                }
                $i++;
            }
        }
    }
    $user_level = 10;
    $uniqum = false;
    if (test_is_adv()) {
        if (count($questions_not_answered_and_wrong) === 0) {
            $user_level = 5;
        } else {
            if (count($questions_not_answered_and_wrong) < 3) {
                $user_level = 4;
            }
        }
        if ($wrong_answers_by_stage[0] + $wrong_answers_by_stage[1] === 0 && $wrong_answers_by_stage[2] < 2 && $wrong_answers_by_stage[3] > 2) {
            $user_level = 3;
        }
        if ($wrong_answers_by_stage[0] + $wrong_answers_by_stage[1] < 3 && $wrong_answers_by_stage[2] + $wrong_answers_by_stage[3] > 6) {
            $user_level = 2;
        }
        if ($wrong_answers_by_stage[0] === 0 && count($questions_not_answered_and_wrong) > 15) {
            $user_level = 1;
        }
        if (count($questions_not_answered_and_wrong) > 18) {
            $user_level = 0;
        }
        if ($user_level === 10) {
            $uniqum = true;
            if (count($questions_not_answered_and_wrong) < 8) {
                $user_level = 3;
            } else {
                if (count($questions_not_answered_and_wrong) < 14) {
                    $user_level = 2;
                } else {
                    if (count($questions_not_answered_and_wrong) < 19) {
                        $user_level = 1;
                    } else {
                        $user_level = 0;
                    }
                }
            }
        }
    } else {
        if (count($questions_not_answered_and_wrong) < 3) {
            $user_level = 2;
        } else {
            if (count($questions_not_answered_and_wrong) < 6) {
                $user_level = 1;
            } else {
                $user_level = 0;
            }
        }
    }
    $user_level_titles = array('Beginner', 'Elementary', 'Pre-Intermediate', 'Intermediate', 'Upper Intermediate', 'Advanced');
    $user_level_desc_pageids = array(73, 73, 75, 77, 81, 81);
    $level_desc_module_id = 'lmmb_pages_modules_levels_desc';
    if ($user_level === 0 || $user_level === 5) {
        $level_desc_module_id = 'lmmb_pages_modules_levels_desc_extremum';
    }
    $level_desc = get_post_meta($user_level_desc_pageids[$user_level], $level_desc_module_id, true);
    $level_img = rwmb_meta('lmmb_pages_modules_image', array('type' => 'file_advanced'), $user_level_desc_pageids[$user_level]);
    $level_img = reset($level_img);
    $correct_answers_total = $questions_total - count($questions_not_answered_and_wrong);
    $test_results_pre = '';
    $test_results_pre .= '<a class="post-image-intro-round" href="javascript:;"><img class="wp-post-image" src="' . $level_img['url'] . '" alt="' . $level_img['title'] . '"></a>';
    $test_results_pre .= '<a class="button-big" href="' . add_query_arg(array('test_language' => $postid, 'test_level' => $user_level, 'test_correct_answers' => $correct_answers_total, 'is_test_adv' => test_is_adv() ? 'true' : 'false'), get_permalink(21)) . '">Записаться на бесплатное занятие</a>';
    $test_results_pre .= '<div class="testing-intro"><h2>' . $user_level_titles[$user_level] . ' (' . $correct_answers_total . ' ';
    $test_results_pre .= getNumEnding($correct_answers_total, array('правильный', 'правильных', 'правильных')) . ' ';
    $test_results_pre .= getNumEnding($correct_answers_total, array('ответ', 'ответа', 'ответов'));
    $test_results_pre .= ' из ' . $questions_total . ')</h2>';
    $test_results_pre .= $level_desc;
    $test_results_pre .= '<ul class="social-buttons"><li class="vk"><a href="http://vk.com/share.php?url=' . urlencode(getCurrentUrl()) . '" target="_blank">Поделиться результатом</a></li><li class="facebook"><a href="http://www.facebook.com/sharer/sharer.php?u=' . urlencode(getCurrentUrl()) . '" target="_blank">Поделиться результатом</a></li></ul>';
    $test_results_pre .= '</div>';
    $test_results_pre .= '<div class="testing">';
    $test_results_pre .= '<ul class="result_legend"><li><span class="correct"><span>Красный</span></span> &mdash; правильный ответ</li><li><span class="incorrect"><span>Желтый</span></span> &mdash; допущена ошибка</li></ul>';
    $test_results = '';
    if ($questions) {
        $test_results .= '<ol class="question_list">';
        $i = 0;
        foreach ($questions as $question_n => $question) {
            $test_results .= '<li><h2 class="question_name">' . $question['question'] . '</h2><ol>';
            $incorrect_answer = NULL;
            if (array_key_exists($question_n, $questions_user_wrong)) {
                $incorrect_answer = $questions_user_wrong[$question_n];
            }
            $question_not_answered = false;
            if (array_key_exists($question_n, $questions_not_answered)) {
                $question_not_answered = true;
            }
            foreach ($question as $key => $value) {
                $exp_key = explode('_', $key);
                $correct_answer = mb_substr($question['is_correct'], -2, 1);
                if ($exp_key[0] == 'answer') {
                    $test_results .= '<li class="';
                    if ($exp_key[1] === $correct_answer) {
                        if ($question_not_answered) {
                            $test_results .= 'correct-not-answered';
                        } else {
                            $test_results .= 'correct';
                        }
                    }
                    if ($exp_key[1] === $incorrect_answer) {
                        $test_results .= 'incorrect';
                    }
                    $test_results .= '">';
                    $test_results .= '<label>' . $value . '</label>';
                    $test_results .= '</li>';
                }
            }
            $test_results .= '</ol></li>';
            $i++;
        }
        $test_results .= '</ol>';
    }
    $test_results_post = '';
    $test_results_post .= '<a class="button-big" href="http://linguamore.ru/wordpress/wp-content/themes/linguamore/external/htmltodocx/download.php?download=true">Сохранить в файл DOCX</a>';
    $test_results_post .= '</div>';
    $_SESSION['download_data'] = $test_results;
    return array('user_level' => $user_level, 'level_desc' => $level_desc, 'test_results' => $test_results_pre . $test_results . $test_results_post);
}
Example #11
0
 public function result()
 {
     if (isset($this->request->get['qshare_id'])) {
         $qshare_id = $this->request->get['qshare_id'];
     } else {
         $this->response->redirect($this->url->link('common/home', '', 'SSL'));
     }
     $this->load->model('catalog/quiz');
     $result_quiz = $this->model_catalog_quiz->getMyStatsForQuiz($qshare_id);
     /* временная заплатка */
     $quiz_id = 10;
     ////////
     if (!empty($result_quiz)) {
         $quiz_id = $result_quiz['quiz_id'];
     }
     if ($quiz_id < 11 || $quiz_id > 12) {
         $data['result_share'] = $this->load->controller('quiz/quiz' . $quiz_id . '/result');
         if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/quiz/share_quiz_template.tpl')) {
             $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/quiz/share_quiz_template.tpl', $data));
         } else {
             $this->response->setOutput($this->load->view('default/template/quiz/share_quiz_template.tpl', $data));
         }
     } else {
         $this->load->language('information/quiz');
         $this->load->model('tool/image');
         $this->load->model('catalog/achievement');
         $data['breadcrumbs'] = array();
         $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home', '', 'SSL'));
         //определим с какой соц сети пришел рефер
         // ok - однокласник
         // fb - facebook
         // tw - twitter
         // vk - vkontakte
         $data['social'] = 'false';
         $template_name = 'quiz/result_quiz.tpl';
         if ($quiz_id == 12) {
             //подтянем результаты тестирования
             $results_stats = $this->model_catalog_quiz->getStatsForQuiz($quiz_id);
             $data['count_voices'] = count($results_stats);
             $data['results_battle'] = array('win_mer_1' => 0, 'win_mer_2' => 0, 'friend' => 0);
             //всего 14 вопросов
             $count_all_q = 14;
             foreach ($results_stats as $result) {
                 $data_voice = array();
                 $data_voice = unserialize($result['value']);
                 // 0  - уволить
                 // 1 - в команду
                 // 2 - не знаю кто это
                 $count_win_mer_1 = 0;
                 foreach ($data_voice as $k => $voice) {
                     if ($voice == 1) {
                         $count_win_mer_1++;
                     }
                 }
                 if ($count_win_mer_1 > 7) {
                     $data['results_battle'] = array('win_mer_1' => $data['results_battle']['win_mer_1'] + 1, 'win_mer_2' => $data['results_battle']['win_mer_2'], 'friend' => $data['results_battle']['friend']);
                 }
                 if ($count_win_mer_1 < 7) {
                     $data['results_battle'] = array('win_mer_1' => $data['results_battle']['win_mer_1'], 'win_mer_2' => $data['results_battle']['win_mer_2'] + 1, 'friend' => $data['results_battle']['friend']);
                 }
                 if ($count_win_mer_1 == 7) {
                     $data['results_battle'] = array('win_mer_1' => $data['results_battle']['win_mer_1'], 'win_mer_2' => $data['results_battle']['win_mer_2'], 'friend' => $data['results_battle']['friend'] + 1);
                 }
             }
             $_win_percent = $data['results_battle']['win_mer_1'] * 100 / $data['count_voices'];
             $_fail_percent = $data['results_battle']['win_mer_2'] * 100 / $data['count_voices'];
             $_friend_percent = $data['results_battle']['friend'] * 100 / $data['count_voices'];
             $data['results_battle'] = array('win_mer_1' => $data['results_battle']['win_mer_1'] + 2000 + 2500, 'win_mer_2' => $data['results_battle']['win_mer_2'] + 500, 'word_win_mer_1' => getNumEnding($data['results_battle']['win_mer_1'], array('бое', 'боях', 'боёв')), 'word_win_mer_2' => getNumEnding($data['results_battle']['win_mer_2'], array('бое', 'боях', 'боёв')), 'friend' => $data['results_battle']['friend'], '_win_percent' => $_win_percent, '_fail_percent' => $_fail_percent, '_friend_percent' => $_friend_percent);
             $template_name = 'quiz/result_quiz_battle.tpl';
         }
         if (!empty($this->request->get['uid'])) {
             $data['social'] = 'true';
             $social_name = $this->request->get['uid'];
             switch ($social_name) {
                 case 'vk':
                     $template_name = 'quiz/my_quiz_template_vk.tpl';
                     break;
                 case 'fb':
                     $template_name = 'quiz/my_quiz_template_fb.tpl';
                     break;
                 case 'ok':
                     $template_name = 'quiz/my_quiz_template_fb.tpl';
                     break;
                 case 'tw':
                     $template_name = 'quiz/my_quiz_template_fb.tpl';
                     break;
                 default:
                     $template_name = 'quiz/result_quiz.tpl';
                     break;
             }
         }
         $data['heading_title'] = $this->language->get('text_your_choise');
         $data['sub_heading_title'] = $this->language->get('text_sub_your_choise');
         $more_link = $this->url->link('information/raiting/topresult', '', 'SSL');
         $data['text_more_raiting'] = sprintf($this->language->get('text_more_raiting'), $more_link);
         //расчехляем количество процентов полученных у данного игрока
         $value_result = unserialize($result_quiz['value']);
         //получим quiz_id и quiz_template
         $quiz_id = 10;
         ////////
         if (!empty($result_quiz)) {
             $quiz_id = $result_quiz['quiz_id'];
         }
         //получаем результируюшую картинку
         $result_calculate = $this->getCalculateResult($value_result, $quiz_id, $qshare_id);
         // ok - однокласник
         // fb - facebook
         // tw - twitter
         // vk - vkontakte
         //подтянем инфу о quiz
         $quiz_info = $this->model_catalog_quiz->getQuiz($quiz_id);
         //добавим url для шаринга для каждой соцсети
         $template_id = $quiz_info['template_id'];
         $data['share_url_ok'] = $result_calculate['share_url_ok'];
         $data['share_btn_ok'] = 'share_ok_' . $template_id;
         $data['share_url_vk'] = $result_calculate['share_url_vk'];
         $data['share_btn_vk'] = 'share_vk_' . $template_id;
         $data['share_url_fb'] = $result_calculate['share_url_fb'];
         $data['share_btn_fb'] = 'share_fb_' . $template_id;
         $data['share_url_tw'] = $result_calculate['share_url_tw'];
         $data['share_btn_tw'] = 'share_tw_' . $template_id;
         if (!empty($this->request->get['uid'])) {
             $social_name = $this->request->get['uid'];
             switch ($social_name) {
                 case 'vk':
                     $data['share_image'] = $result_calculate['share_img_cub'];
                     break;
                 case 'fb':
                     $data['share_image'] = $result_calculate['share_img_normal'];
                     break;
                 case 'ok':
                     $data['share_image'] = $result_calculate['share_img_cub'];
                     break;
                 case 'tw':
                     $data['share_image'] = $result_calculate['share_img_normal'];
                     break;
                 default:
                     $data['share_image'] = $result_calculate['share_img_normal'];
                     break;
             }
         } else {
             $data['share_image'] = $result_calculate['share_img_normal'];
             $data['image'] = $result_calculate['image'];
             $data['share_title'] = $result_calculate['share_title'];
             $data['share_text'] = $result_calculate['share_text'];
         }
         $this->document->setTitle($result_calculate['share_title']);
         $this->document->setDescription($result_calculate['share_text']);
         $this->document->setSocialImg($result_calculate['share_img_normal']);
         $data['redirect'] = $result_calculate['redirect'];
         $filter_data = array('filter_visibility' => 1, 'limit' => 5, 'start' => 0);
         $quizs = $this->model_catalog_quiz->getQuizs($filter_data);
         $data['quizs'] = array();
         foreach ($quizs as $quiz) {
             if ($quiz['quiz_id'] != $quiz_id) {
                 $data['quizs'][] = array('quiz_id' => $quiz['quiz_id'], 'status' => $quiz['status'], 'quiz_title' => html_entity_decode($quiz['title']), 'quiz_href' => $this->url->link('information/quiz/view', 'quiz_id=' . $quiz['quiz_id']), 'share_id' => 'btn_' . $quiz['template_id']);
             } else {
                 $data['quizs'][] = array('status' => 1, 'quiz_title' => 'Поучаствовать в рейтинге', 'quiz_href' => $this->url->link('information/raiting', ''), 'share_id' => 'btn_independent_rating');
             }
         }
         $data['column_left'] = $this->load->controller('common/column_left');
         $data['column_right'] = $this->load->controller('common/column_right');
         $data['content_top'] = $this->load->controller('common/content_top');
         $data['content_bottom'] = $this->load->controller('common/content_bottom');
         $data['footer'] = $this->load->controller('common/footer');
         $data['header'] = $this->load->controller('common/header');
         $data['social_header'] = $this->load->controller('common/sheader');
         if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/information/' . $template_name)) {
             $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/information/' . $template_name, $data));
         } else {
             $this->response->setOutput($this->load->view('default/template/information/' . $template_name, $data));
         }
     }
     /***********************/
 }