if(isset($_POST['get_user_achievs'])){ //$user_id = clean($_POST['id'], "int"); $user_auth = checkJs($_POST['user_auth'],null); $tpl = new Template; $tpl->dir = '../templates/'.$conf->template.'/tpl/'; $j=0; if(!empty($user_auth)) { $STH = $pdo->prepare("SELECT *, `achievs`.`rus_name`, `achievs`.`value`, `achievs`.`ach_img`, `achievs`.`description` FROM `achievs_stats` LEFT JOIN achievs ON `achievs`.`unic_id` = `achievs_stats`.`ach_id` WHERE `achievs_stats`.`user_auth`=:user_auth ORDER BY `achievs_stats`.`ach_id`"); $STH->setFetchMode(PDO::FETCH_OBJ); $STH->execute(array( ':user_auth' => $user_auth )); while($row = $STH->fetch()) { $j++; $tmpDate = $row->collect_date; if($tmpDate == '0000-00-00 00:00:00') { $tmpDate = ''.$row->curr_value.' из '.$row->value.''; $status = 'info'; } else if($row->ach_collect == 1) $status = 'success'; $tpl->load_template('elements/achievs.tpl'); $tpl->set("{ach_id}", $row->ach_id); $tpl->set("{rus_name}", $row->rus_name); $tpl->set("{value}", $row->value); $tpl->set("{ach_img}", $row->ach_img); $tpl->set("{description}", $row->description); $tpl->set("{curr_value}", $row->curr_value); $tpl->set("{ach_collect}", $row->ach_collect); $tpl->set("{collect_date}", $tmpDate); $tpl->set("{status}", $status); $tpl->compile( 'achievs' ); $tpl->clear(); } } if($j == 0){ $tpl->result['achievs'] = '