//echo '<div style="color: #444;"><h3>Лучшие учасники</h3></div><div class="rating"><table border="0" width="600">';
//echo '<br /><div style="color: #444;"><h2>ТОР лучших</h2></div><div class="rating"><table border="0" width="100%">';
echo '<div style="color: #444; margin: 20px 0 0 0;"><img src="'.$s.'files/img/liders.jpg" alt="Лидеры" /></div><div class="rating_main"><table border="0" width="100%">';
$i = 1;
while ($row1 = $this->getdriver()->FetchResult())
{
$surname = $this->getdriver()->PutContent($row1['adept_surname']);
$name = $this->getdriver()->PutContent($row1['adept_name']);
$mark = $this->getdriver()->PutContent($row1['rat_mark']);
$time = $this->getdriver()->PutContent($row1['rat_time']);
$time = date("H:i:s", $time);
//$date = $this->getdriver()->PutContent($row1['rat_date']);
if ($i%2 != 0) echo '<tr class="t_r1"><td>'.$surname.' '.$name.'</td><td> </td><td width="50">IQ-'.$mark.'</td><td width="50">'.$time.'</td></tr>';
else if ($i%2 == 0) echo '<tr class="t_r2"><td>'.$surname.' '.$name.'</td><td> </td><td width="50">IQ-'.$mark.'</td><td width="50">'.$time.'</td></tr>';
$i++;
}
echo '</table></div>';
}
// метод для отображения рейтинга участников на главной странице
public function ShowRatingMain($limit_from, $s)
{
$kol = $this->ForRead('modules/test/test_config.php');
//$limit_count = $this->getdriver()->PutContent($kol[1]);
$limit_count = 17;
//$limit_count_super = $this->getdriver()->PutContent($kol[2]);
//$limit_from_super = 0;
if (!isset($limit_from)) $limit_from = 0;
/* $this->getdriver()->Select('t_rating, t_adept', '', 't_rating.rat_adept_id=t_adept.adept_id', '', 'rat_mark DESC, rat_date', 'DESC', $limit_from_super, $limit_count_super);
//$this->getdriver()->ExecQuery('SELECT * FROM (SELECT * FROM t_rating, t_adept WHERE t_rating.rat_adept_id=t_adept.adept_id ORDER BY rat_date LIMIT '.$limit_from_super.','.$limit_count_super.') AS T ORDER BY rat_mark DESC;');
echo '<div style="color: #444;"><h3>Лучшие учасники</h3></div><div class="rating"><table border="0" width="600">';
$i = 1;
while ($row1 = $this->getdriver()->FetchResult())
{
$surname = $this->getdriver()->PutContent($row1['adept_surname']);
$name = $this->getdriver()->PutContent($row1['adept_name']);
$mark = $this->getdriver()->PutContent($row1['rat_mark']);
$date = $this->getdriver()->PutContent($row1['rat_date']);
if ($i%2 != 0) echo '<tr class="t_r1" height="30"><td>'.$surname.' '.$name.'</td><td width="100">IQ - '.$mark.'</td><td width="200">'.date("d.m.Y H:i:s", $date).'</td></tr>';
else if ($i%2 == 0) echo '<tr class="t_r2"><td>'.$surname.' '.$name.'</td><td width="100">IQ - '.$mark.'</td><td width="200">'.date("d.m.Y H:i:s", $date).'</td></tr>';
$i++;
}
echo '</table></div>'; */
$this->getdriver()->Select('t_rating, t_adept', '', 't_rating.rat_adept_id=t_adept.adept_id', '', 'rat_date', 'DESC', $limit_from, $limit_count);
//$this->getdriver()->Select('t_rating, t_adept', '', 't_rating.rat_adept_id=t_adept.adept_id', '', '', '', '', '');
//echo '<div style="color: #444;"><h3>Рейтинг учасников</h3></div><div class="rating"><table border="0" width="600">';
//echo '<br /><div style="color: #444;"><h2>Участники</h2></div><div class="rating"><table border="0" width="100%">';
echo '<div style="color: #444; margin: 30px 0 0 0;"><img src="'.$s.'files/img/users.jpg" alt="учасники" /></div><div class="rating_main"><table border="0" width="100%">';
$i = 1;
while ($row = $this->getdriver()->FetchResult())
{
$surname = $this->getdriver()->PutContent($row['adept_surname']);
$name = $this->getdriver()->PutContent($row['adept_name']);
$mark = $this->getdriver()->PutContent($row['rat_mark']);
$time = $this->getdriver()->PutContent($row['rat_time']);
$time = date("H:i:s", $time);
//$date = $this->getdriver()->PutContent($row['rat_date']);
if ($i%2 != 0) echo '<tr class="t_r1"><td>'.$surname.' '.$name.'</td><td> </td><td width="50">IQ-'.$mark.'</td><td width="50">'.$time.'</td></tr>';
else if ($i%2 == 0) echo '<tr class="t_r2"><td>'.$surname.' '.$name.'</td><td> </td><td width="50">IQ-'.$mark.'</td><td width="50">'.$time.'</td></tr>';
$i++;
}
echo '</table></div>';
echo '<div style="color: #444; margin: 15px 0 0 0; _margin: 23px 0 0 0;"><img src="'.$s.'files/img/line.jpg" alt="" /></div>';
echo '
<a href="1.html">все участники »</a> ';
}
// метод для отображения рейтинга лидеров
public function ShowSuperRating($s)
{
$kol = $this->ForRead('modules/test/test_config.php');
$limit_count_super = $this->getdriver()->PutContent($kol[2]);
$limit_from_super = 0;
$this->getdriver()->Select('t_rating, t_adept', '', 't_rating.rat_adept_id=t_adept.adept_id', '', 'rat_mark DESC, rat_date', 'DESC', $limit_from_super, $limit_count_super);
echo '<br /><div style="color: #444;"><img src="'.$s.'files/img/liders.jpg" alt="Лидеры" /></div><div class="rating"><table border="0" width="100%">';
$i = 1;
while ($row1 = $this->getdriver()->FetchResult())
{
$surname = $this->getdriver()->PutContent($row1['adept_surname']);
$name = $this->getdriver()->PutContent($row1['adept_name']);
$mark = $this->getdriver()->PutContent($row1['rat_mark']);
$time = $this->getdriver()->PutContent($row1['rat_time']);
$time = date("H:i:s", $time);
if ($i%2 != 0) echo '<tr class="t_r1"><td>'.$surname.' '.$name.'</td><td> </td><td width="50">IQ-'.$mark.'</td><td width="50">'.$time.'</td></tr>';
else if ($i%2 == 0) echo '<tr class="t_r2"><td>'.$surname.' '.$name.'</td><td> </td><td width="50">IQ-'.$mark.'</td><td width="50">'.$time.'</td></tr>';
$i++;
}
echo '</table></div><br /><br />';
}
// метод для отображения рейтинга участников
public function ShowRating($limit_from, $s)
{
$kol = $this->ForRead('modules/test/test_config.php');
$limit_count = $this->getdriver()->PutContent($kol[1]);
if (!isset($limit_from)) $limit_from = 0;
$this->getdriver()->Select('t_rating, t_adept', '', 't_rating.rat_adept_id=t_adept.adept_id', '', 'rat_date', 'DESC', $limit_from, $limit_count);
echo '<br /><div style="color: #444;"><img src="'.$s.'files/img/users.jpg" alt="учасники" /></div><div class="rating"><table border="0" width="100%">';
$i = 1;
while ($row = $this->getdriver()->FetchResult())
{
$surname = $this->getdriver()->PutContent($row['adept_surname']);
$name = $this->getdriver()->PutContent($row['adept_name']);
$mark = $this->getdriver()->PutContent($row['rat_mark']);
$time = $this->getdriver()->PutContent($row['rat_time']);
$time = date("H:i:s", $time);
//$date = $this->getdriver()->PutContent($row['rat_date']);
if ($i%2 != 0) echo '<tr class="t_r1"><td>'.$surname.' '.$name.'</td><td> </td><td width="50">IQ-'.$mark.'</td><td width="50">'.$time.'</td></tr>';
else if ($i%2 == 0) echo '<tr class="t_r2"><td>'.$surname.' '.$name.'</td><td> </td><td width="50">IQ-'.$mark.'</td><td width="50">'.$time.'</td></tr>';
$i++;
}
echo '</table></div>';
echo '<div style="color: #444; margin: 15px 0 0 0; _margin: 22px 0 0 0;"><img src="'.$s.'files/img/line.jpg" alt="" /></div>';
echo '
<a href="index.php">« на главную</a>';
}
// метод для записи рейтинга
public function SaveRating($id, $mark, $date, $time)
{
$id = $this->getdriver()->PutContent($id);
$mark = $this->getdriver()->PutContent($mark);
$date = $this->getdriver()->PutContent($date);
$time = $this->getdriver()->PutContent($time);
$value = $id.", ".$mark.", ".$date.", ".$time;
$this->getdriver()->Insert('t_rating', 'rat_adept_id, rat_mark, rat_date, rat_time', $value);
$kol = $this->getdriver()->Result();
if ($kol != 0) return 1;
else return 0;
}
// метод для подщета записей в таблице рейтинг
public function CountRating()
{
$this->getdriver()->Select('t_rating', '', '', '', '', '', '', '');
$count = $this->getdriver()->Count();
return $count;
}
// метод для отображения вопросов и ответов
public function ShowTest1($perem)
{
$id = $this->getdriver()->PutContent($perem);
$this->getdriver()->Select('t_question', '', 'quest_id='.$id, '', '', '', '', '');
$row = $this->getdriver()->FetchResult();
$quest_id = $row['quest_id'];
$question = $row['quest_question'];
$image = $row['quest_image'];
if (!empty($image)) $img = '<br /><span class="png"><img src="images/'.$image.'" alt="" /></span><br /><br />';
else $img = '';
$i = 0;
$this->getdriver()->Select('t_answer', '', 'ans_question_id='.$id, '', '', '', '', '');
$f = '<table border="0">';
while($row1 = $this->getdriver()->FetchResult())
{
$answer_id = $row1['ans_id'];
$answer = $this->getdriver()->Strip($row1['ans_answer']);
//$f .= '<input type="radio" name="ans_id" value="'.$answer_id.'" onClick="setButton(\'next\');" /> '.$answer.'<br />';
//$f .= '<tr><td valign="middle"><div class="answer_link"><a href="test.php?q='.$quest_id.'&a='.$answer_id.'" onMouseOver="Answer_Underline(\''.$i.'\');" onMouseOut="Answer_None(\''.$i.'\');"><div class="strelka">»</div></a></div></td><td><div class="answer_link"><a href="test.php?q='.$quest_id.'&a='.$answer_id.'" onMouseOver="Answer_Underline(\''.$i.'\');" onMouseOut="Answer_None(\''.$i.'\');"><span id="'.$i.'">'.$answer.'</span></a></div></td></tr>';
$f .= '<tr><td valign="middle"><div class="answer_link"><a href="test.php?q='.$quest_id.'&a='.$answer_id.'" onMouseOver="Answer_Underline(\''.$i.'\');" onMouseOut="Answer_None(\''.$i.'\');"><div class="strelka">»</div></a></div></td><td><div class="answer_link"><a href="test.php?q='.$quest_id.'&a='.$answer_id.'" onMouseOver="Answer_Underline(\''.$i.'\');" onMouseOut="Answer_None(\''.$i.'\');"><span id="'.$i.'">'.$answer.'</span></a></div></td></tr>';
$i++;
}
$f .= '</table>';
/* echo '<br /><br /><form method="POST" action="test.php">
<table border="0" width="953">
<input name="quest_id" value="'.$quest_id.'" type="hidden" />
<tr><td width="80"></td><td colspan="2" align="center"><div>'.$img.'</div></td><td width="80"></td></tr>
<tr><td width="80"></td><td colspan="2" align="left"><div style="padding-left: 5px;">'.$question.'</div></td><td width="80"></td></tr>
<tr><td width="80"></td><td colspan="2" align="left"><div>'.$f.'</div></td><td width="80"></td></tr>
</td></tr>
<tr><td width="80"></td><td align="center"><span class="kn"><br /><button type="submit" id="next" name="next" disabled="disabled" value="ответить"><img src="files/img/next.jpg" alt="ответить" /></button></span></td>
<td align="center"><span class="kn"><br /><button type="submit" name="later" value="пропустить"><img src="files/img/later.jpg" alt="пропустить" /></button></span></td><td width="80"></td></tr>