Example #1
0
 public function Add($params)
 {
     //print_r($_SESSION['user']);
     if (user_admin()) {
         $this->view->Show('book_add.tpl', array('books' => Book::Find($this->conn, $params['pubId'], $params['catId']), 'pubs' => array(-1 => '- Все -') + Publisher::GetAll($this->conn), 'pubId' => $params['pubId'], 'cats' => array(-1 => '- Все -') + Category::GetAll($this->conn), 'catId' => $params['catId']));
     } else {
         $this->view->Show('access_denied.tpl', array('mode' => 'Добавление книги'));
     }
 }
 /**
  * Если форма пустая
  * Остаемся на странице добавления статьи
  * Если заполнены поля названия и содержимого статьи
  * Показываем шаблон успешного добавления статьи
  *
  * @param array $params Переменные из $_POST
  */
 public function Add($params)
 {
     if (!$params['content'] || !$params['name']) {
         $this->view->Show('edit_article.tpl', array('authors' => Author::GetAll($this->conn), 'authId' => $params['authId'], 'cats' => Category::GetAll($this->conn), 'catId' => $params['catId'], 'pubDate ' => $params['pubDate'], 'cuntent' => $params['content']));
     } else {
         Article::EditArticle($this->conn, $params);
         $this->view->Show('success.tpl');
     }
 }
 function testDeleteAll()
 {
     $category_name = "music";
     $new_category = new Category($category_name);
     $new_category->save();
     $category_name2 = "arts";
     $new_category2 = new Category($category_name);
     $new_category2->save();
     Category::deleteAll();
     $result = Category::GetAll();
     $this->assertEquals([], $result);
 }
Example #4
0
 public function Index($params)
 {
     $this->view->Show('books.tpl', array('books' => Book::Find($this->conn, $params['pubId'], $params['catId'], $params['authId']), 'pubs' => array(-1 => '- Все -') + Publisher::GetAll($this->conn), 'pubId' => $params['pubId'], 'cats' => array(-1 => '- Все -') + Category::GetAll($this->conn), 'catId' => $params['catId'], 'auth' => array(-1 => '- Все -') + Author::GetAll($this->conn), 'authId' => $params['authId']));
     //        $this->smarty->assign('books', Book::Find($this->conn, $params['pubId'], $params['catId']));
     //
     //        $this->smarty->assign('pubs', array(-1 => '- Все -') + Publisher::GetAll($this->conn));
     //        $this->smarty->assign('pubId', $params['pubId']);
     //
     //        $this->smarty->assign('cats', array(-1 => '- Все -') + Category::GetAll($this->conn));
     //        $this->smarty->assign('catId', $params['catId']);
     //
     //        $this->smarty->display('books.tpl');
 }
 public function Index($params)
 {
     print_r(Category::GetAll($this->conn));
 }
Example #6
0
<?php

require_once '../../models/Category.php';
$results = Category::GetAll();
?>


<!DOCTYPE html>
<html lang="en">
	<?php 
include '../../inc/head.php';
?>
	<body>
		<div>
			<?php 
include '../../inc/nav.php';
?>

			<div id="content">



				
			</div>
			<?php 
include '../../inc/footer.php';
?>
		</div>
	</body>
</html>