public function addToDictionary() { $model = new DictModel(); $model->movie_id = $_POST['movie_id']; $model->en_word = $_POST['en_word']; $model->ru_word = $_POST['ru_word']; $model->series_id = $_POST['series_id']; $model->phrase_ru = "Взято из пикибука"; $model->date = date('Y-m-d'); $model->user_id = $_SESSION['user']['id']; $issetDictWord = DictModel::model()->where("`movie_id` = '{$model->movie_id}' AND `en_word` = '{$model->en_word}' AND `user_id`=={$model->user_id} ")->findRow(); if (empty($issetDictWord->id)) { $model->save(); } else { echo 'error'; } }
public function actionDeleteDict($id) { $model = DictModel::model()->where("`id`='" . (int) $id . "'")->findRow(); if ($model->user_id == Auth::getUser()['id']) { DictModel::model()->where("`id`='" . (int) $id . "'")->delete(); } $this->redirect($_SERVER['HTTP_REFERER']); }
public function search() { $key = $_POST['key']; $learned = $_POST['learned']; $words = DictModel::model()->where(" (en_word LIKE '%" . $key . "%' OR ru_word LIKE '%" . $key . "%') AND `user_id` = '" . Auth::getUser()['id'] . "' ")->findAll(); $html = '<div class="dictionary_items_table" id="toPrint"> <table class="table"> <tr> <td class="title"> Слово: </td> <td class="title"> Фраза: </td> <td class="title"> Добавлено: </td> </tr> '; foreach ($words as $word) { $moovie = MoviesModel::model()->where("`id`='" . $word->movie_id . "' ")->findRow(); $series = SeriesModel::model()->where("`id`='" . $word->series_id . "' ")->findRow(); $from = $moovie->en_name . " - " . $series->name; /*$html .= '<tr> <input type="hidden" id="learned_'.$word->id.'" /> <td><input type="checkbox" id="check_'.$word->id.'" onchange="check(\''.$word->id.'\');" /></td> <td>'.$word->en_word.' - '.$word->ru_word.'</td> <td>'.$word->phrase.'</td> <td>'.$from.'</td> </tr>';*/ $html .= '<tr><input type="hidden" id="learned_' . $word->id . '" /> <td> <div class="checkbox check_item"> <label><input type="checkbox" id="check_' . $word->id . '" onchange="check(\'' . $word->id . '\');" /></label> </div> <i class="glyphicon glyphicon-volume-up"></i> <div class="ttext"> ' . $word->en_word . ' - ' . $word->ru_word . ' </div> </td> <td> <i class="glyphicon glyphicon-volume-up"></i> <div class="ttext"> ' . $word->phrase . '.<br/> <span class="grey_color">Кэрол вывезла свои вещи сегодня.</span> </div> </td> <td> <div class="ttext"> <span class="grey_color">Взято 20.05.2015 из:</span><br/> ' . $from . ' </div> </td> </tr>'; } $html .= '</table>'; echo $html; }
} elseif ($r_U == "/faq/all") { echo 'bgfaq'; } else { echo 'bg' . $r_Ud; } ?> " style="<?php if ($l_rU > 14 && $r_U != "/words/nlearned" && $r_U != "/words/learned") { ?> display: none; <?php } ?> "></div> <header> <div class="wrapper group"> <a href="#" class="show_menu"><i class="fa fa-bars"></i> Меню</a> <div class="float_menu"> <a href="#" class="close_menu"><i></i> Меню</a> <nav> <p class="title"><a href="/profile">Профиль пользователя</a></p> <ul class="group"> <li><a href="/">Главная</a></li> <li><a href="/training">Тренировки</a></li> <li><a href="/faq/all">FAQ</a></li> <li><a href="/logout">Выход</a></li> </ul> </nav> <div class="mycontent"> <a href="/serials"><img src="/assets/images/icon2.png" alt="" class="img-resp"></a> <p><a href="/serials">Контент</a></p> </div> <div class="dictionary"> <a href="/dict"><img src="/assets/images/icon1.png" alt="" class="img-resp"></a> <p><a href="/dict">Мой словарь</a> <span class="number"><?php echo $dicts = DictModel::model()->where("`user_id`='" . Auth::getUser()['id'] . "'")->countAll(); ?> </span></p> </div> </div> </div> </header> <?php } ?> <?php if (Auth::isAdmin() && $r_U != "/personality" && $r_U != "/personcalc") { ?> <div class="admButton"><a href="#" onclick="adminBox();">[X]</a></div><div id="admin-box"><div class="admText"><a href="/admin" target="_blank">[АдминПанель]</a></div><ul> <li><a onclick="getMyCookie()">Cookie Get (!)</a> | <a onclick="getMyCookieLog()">Console</a> | <a onclick="clearCookieMy()">CleaR</a></li> <li>Help: <a onclick="scriptViewHelpPage()">On</a> | <a onclick="scriptHideHelpPage()">Off</a> | <a onclick="scriptLimitPopup(1)">Lim1</a></li> <li>Player: <a onclick="pauseMe()">PauseMe</a> | <a onclick="playMe()">PlayMe</a> | <a onclick="scriptTest()">test</a></li> <li><a onclick="scriptLimitClose()">LimClose</a> | <a onclick="scriptLimitPopup(2)">LimTimer</a></li></ul></div> <?php }