public function ExpertAction($id) { $exper = new Consult($this->context); $cat = new ConsultUser($this->context, 'uid = "' . $id . '"'); if (!empty($_SESSION['auth']['id'])) { if (isset($_GET['del'])) { $this->db->prepare('update consult_questions set answer = "", isAnswer = 1, answerdate = "" where id =' . $_GET['del'])->execute(); echo '<meta http-equiv="refresh" content="0; url= /consult/cn-' . $_SESSION['auth']['cat'] . '/ex-' . $_SESSION['auth']['id'] . '" />'; } } $expr_user = $exper->getUser($id, $cat->cid); if (empty($expr_user)) { AddAlertMessage('warning', 'Указанного эксперта в категории не существует', '/consult/cn-' . $cid . '/'); } $questions = $exper->getQuestion($id, $cat->cid); $getall = $exper->getAllQuestion($cat->cid); $exper->getPOST(); $count = $exper->getCount($id, $cat->cid); $wAns = $count['cqu'] - $count['ans']; $wAns = $wAns . ' ' . $exper->pluralForm($wAns, 'вопрос', 'вопроса', 'вопросов'); $count['cns'] == NULL ? $cns = 0 : ($cns = $count['cns']); $cns = $cns . ' ' . $exper->pluralForm($cns, 'вопрос', 'вопроса', 'вопросов'); $plQuest = $count['cqu'] . ' ' . $exper->pluralForm($count['cqu'], 'вопрос', 'вопроса', 'вопросов'); $counta = !empty($count['ans']) ? $count['ans'] : '0'; $plAnsw = $counta . ' ' . $exper->pluralForm($counta, 'ответ', 'ответа', 'ответов'); $expert = $this->db->query(' SELECT cc.id, cc.name, cc.alt_name, ud.FirstName, ud.LastName, ud.UserID FROM UserData as ud, consult_category as cc, consult_user_category as cu WHERE ud.UserID=cu.uid and cc.id=cu.cid ')->fetchall(); $category = $this->db->query('select id, name, alt_name, small_img from consult_category')->fetchall(); $this->view->breadcrumbs = array(array('url' => '/', 'title' => 'Главная'), array('url' => '/consult/', 'title' => 'Консультации'), array('url' => '../cn-' . $expr_user['id'], 'title' => $expr_user['name']), array('url' => '../cn-' . $expr_user['id'] . '/ex-' . $expr_user['UserID'] . '/', 'title' => $expr_user['FirstName'] . ' ' . $expr_user['LastName'])); $this->view->setVars(array('category' => $category, 'expert' => $expert, 'expertuser' => $expr_user, 'questions' => $questions, 'getAllQuest' => $getall, 'count' => array('plq' => $plQuest, 'pla' => $plAnsw, 'cqu' => $count['cqu'], 'can' => $counta, 'waw' => $wAns, 'cns' => $cns))); $this->view->generate(); }