public static function Instance()
 {
     if (self::$instance == null) {
         self::$instance = new M_Library();
     }
     return self::$instance;
 }
 protected function OnInput()
 {
     parent::OnInput();
     // Подключаем необходимые классы.
     $mUsers = M_Users::Instance();
     $mLibrary = M_Library::Instance();
     // Текущий пользователь.
     $this->user = $mUsers->Get();
     $this->title = 'Поиск по сайту - Электронная библиотека';
     if (!empty($_POST)) {
         $this->result = $mLibrary->Search($_POST['search']);
     }
 }
 protected function OnInput()
 {
     parent::OnInput();
     // Подключаем необходимый класс.
     $mUsers = M_Users::Instance();
     $mLibrary = M_Library::Instance();
     // Текущий пользователь.
     $this->user = $mUsers->Get();
     // Может ли пользователь просматривать данную страницу
     if (!$mUsers->Can('Add_book')) {
         header("Location: index.php");
         die('Отказано в доступе');
     }
     $this->title = 'ПУ Добавить книгу - Электронная библиотека';
     // Обработка отправки формы.
     if (!empty($_POST)) {
         if ($mLibrary->AddBook($_POST['title_book'])) {
             header('Location: index.php?act=section_books');
             die;
         }
     }
 }
 protected function OnInput()
 {
     parent::OnInput();
     // Подключаем необходимые классы.
     $mUsers = M_Users::Instance();
     $mLibrary = M_Library::Instance();
     // Текущий пользователь.
     $this->user = $mUsers->Get();
     // Может ли пользователь просматривать данную страницу
     if (!$mUsers->Can('Editor_library')) {
         header("Location: index.php");
         die('Отказано в доступе');
     }
     if (isset($_GET['id_author_del'])) {
         if ($mLibrary->DeleteAuthor($_GET['id_author_del'])) {
             header('Location: index.php?act=section_authors');
             die;
         }
     }
     $this->title = 'ПУ Раздел авторов - Электронная библиотека';
     $this->authors = $mLibrary->AllAuthors();
 }
 protected function OnInput()
 {
     parent::OnInput();
     // Подключаем необходимый класс.
     $mUsers = M_Users::Instance();
     $mLibrary = M_Library::Instance();
     // Текущий пользователь.
     $this->user = $mUsers->Get();
     // Может ли пользователь просматривать данную страницу
     if (!$mUsers->Can('Edit_author')) {
         header("Location: index.php");
         die('Отказано в доступе');
     }
     $this->title = 'ПУ Редактировать запись о авторе - Электронная библиотека';
     $this->author = $mLibrary->GetAuthor($_GET['id_author']);
     // Обработка отправки формы.
     if (!empty($_POST)) {
         if ($mLibrary->EditAuthor($_GET['id_author'], $_POST['name'])) {
             header('Location: index.php?act=section_authors');
             die;
         }
     }
 }