本文整理汇总了PHP中Notify::notifyGenreNewBook方法的典型用法代码示例。如果您正苦于以下问题:PHP Notify::notifyGenreNewBook方法的具体用法?PHP Notify::notifyGenreNewBook怎么用?PHP Notify::notifyGenreNewBook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notify
的用法示例。
在下文中一共展示了Notify::notifyGenreNewBook方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_genre
function add_genre()
{
global $current_user;
$this->ca();
if (is_numeric($_POST['id_genre'])) {
$id_genre = (int) $_POST['id_genre'];
} else {
$id_genre = Database::sql2single('SELECT `id` FROM `genre` WHERE `name`=' . Database::escape($_POST['id_genre']));
}
$id_book = (int) $_POST['id'];
if ($id_genre && $id_book) {
$query = 'SELECT `id`,`name`,`title` FROM `genre` WHERE id=' . $id_genre . ' AND `id_parent`>0';
$result = Database::sql2row($query);
if (!isset($result['id'])) {
$this->data['success'] = 0;
$this->data['error'] = 'Нет такого жанра';
return;
}
$query = 'INSERT INTO `book_genre` SET `id_book`=' . $id_book . ' , `id_genre`=' . $id_genre;
$r = Database::query($query, false);
if ($r) {
$this->data['success'] = 1;
$this->data['item_id'] = $id_genre;
$this->data['name'] = $result['name'];
$this->data['title'] = $result['title'];
BookLog::addLog(array('id_genre' => $id_genre), array('id_genre' => 0), $id_book);
BookLog::saveLog($id_book, BookLog::TargetType_book, $current_user->id, BiberLog::BiberLogType_bookEditGenre);
$search = Search::getInstance();
/* @var $search Search */
$search->updateBook(new Book($id_book));
Notify::notifyGenreNewBook($id_genre, $id_book);
} else {
$this->data['error'] = 'Жанр уже есть в списке жанров';
}
return;
}
$this->data['item_id'] = $id_genre;
$this->data['success'] = 0;
}