Permalink
Browse files

добавлен проект. мелкие исправления форматирования

Signed-off-by:ап <ап@10.65.197.35>
  • Loading branch information...
0 parents commit e33f61bc80735b190ea616d0383cd86de8bba0a8 ап committed Feb 25, 2011
Showing with 6,817 additions and 0 deletions.
  1. +1 −0 README
  2. +137 −0 application/bootstrap.php
  3. +26 −0 application/classes/controller/admin.php
  4. +52 −0 application/classes/controller/auth.php
  5. +46 −0 application/classes/controller/cashier.php
  6. +101 −0 application/classes/controller/page.php
  7. +122 −0 application/classes/controller/shop.php
  8. +36 −0 application/classes/controller/tpl.php
  9. +53 −0 application/classes/controller/view.php
  10. +61 −0 application/classes/model/auth.php
  11. +71 −0 application/classes/model/main.php
  12. +99 −0 application/classes/model/order.php
  13. +120 −0 application/classes/model/shop.php
  14. +39 −0 application/classes/model/users.php
  15. +57 −0 application/config/database.php
  16. +15 −0 application/config/pagination.php
  17. +7 −0 application/config/site.php
  18. +133 −0 application/logs/2011/01/30.php
  19. +162 −0 application/logs/2011/02/03.php
  20. +3 −0 application/logs/2011/02/06.php
  21. +53 −0 application/logs/2011/02/07.php
  22. +1,037 −0 application/logs/2011/02/10.php
  23. +401 −0 application/logs/2011/02/11.php
  24. +694 −0 application/logs/2011/02/12.php
  25. +1,001 −0 application/logs/2011/02/13.php
  26. +382 −0 application/logs/2011/02/14.php
  27. +238 −0 application/logs/2011/02/15.php
  28. +189 −0 application/logs/2011/02/16.php
  29. +139 −0 application/logs/2011/02/17.php
  30. +19 −0 application/views/admin/index.php
  31. +12 −0 application/views/cashier/index.php
  32. +69 −0 application/views/cashier/order_add.php
  33. +19 −0 application/views/cashier/order_manager.php
  34. +3 −0 application/views/page/admin.php
  35. +10 −0 application/views/page/auth/login.php
  36. +12 −0 application/views/page/auth/reg.php
  37. +15 −0 application/views/page/contact.php
  38. +3 −0 application/views/page/help.php
  39. +119 −0 application/views/page/index.php
  40. +8 −0 application/views/page/kart.php
  41. +8 −0 application/views/page/orders.php
  42. +149 −0 application/views/page/shop/new_order.php
  43. +16 −0 application/views/page/view/cat.php
  44. +9 −0 application/views/page/view/product.php
  45. +16 −0 application/views/page/view/search.php
  46. +13 −0 application/views/page/view/user.php
  47. +6 −0 application/views/tpl/footer.php
  48. +27 −0 application/views/tpl/header.php
  49. +65 −0 application/views/tpl/left.php
  50. +1 −0 application/views/tpl/msg.php
  51. +30 −0 application/views/tpl/template.php
  52. BIN img/arrow.gif
  53. BIN img/bac_button.gif
  54. BIN img/bac_logo.gif
  55. BIN img/bac_menu.gif
  56. BIN img/banner.jpg
  57. BIN img/banner1.jpg
  58. BIN img/basket.gif
  59. BIN img/buy.gif
  60. BIN img/car.gif
  61. BIN img/contact.jpg
  62. BIN img/envelope.gif
  63. 0 img/goroda.json
  64. BIN img/help.jpg
  65. BIN img/home.jpg
  66. BIN img/idea.gif
  67. BIN img/info.gif
  68. BIN img/kart.jpg
  69. BIN img/leaf.gif
  70. BIN img/leaf2.gif
  71. BIN img/leaf_.gif
  72. BIN img/logo.gif
  73. BIN img/order_add.png
  74. BIN img/order_manager.png
  75. BIN img/orders.jpg
  76. BIN img/ornament_menu.gif
  77. BIN img/photo4.gif
  78. +109 −0 index.php
  79. +19 −0 jquery.js
  80. +68 −0 slider.css
  81. +517 −0 style.css
1 README
@@ -0,0 +1 @@
+проект для курсовой работы
@@ -0,0 +1,137 @@
+<?php defined('SYSPATH') or die('No direct script access.');
+
+//-- Environment setup --------------------------------------------------------
+
+/**
+ * Set the default time zone.
+ *
+ * @see http://kohanaframework.org/guide/using.configuration
+ * @see http://php.net/timezones
+ */
+date_default_timezone_set('Europe/Moscow');
+
+/**
+ * Set the default locale.
+ *
+ * @see http://kohanaframework.org/guide/using.configuration
+ * @see http://php.net/setlocale
+ */
+setlocale(LC_ALL, 'en_US.utf-8');
+
+/**
+ * Enable the Kohana auto-loader.
+ *
+ * @see http://kohanaframework.org/guide/using.autoloading
+ * @see http://php.net/spl_autoload_register
+ */
+spl_autoload_register(array('Kohana', 'auto_load'));
+
+/**
+ * Enable the Kohana auto-loader for unserialization.
+ *
+ * @see http://php.net/spl_autoload_call
+ * @see http://php.net/manual/var.configuration.php#unserialize-callback-func
+ */
+ini_set('unserialize_callback_func', 'spl_autoload_call');
+
+//-- Configuration and initialization -----------------------------------------
+
+/**
+ * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
+ */
+if (getenv('KOHANA_ENV') !== FALSE)
+{
+ Kohana::$environment = getenv('KOHANA_ENV');
+}
+
+/**
+ * Initialize Kohana, setting the default options.
+ *
+ * The following options are available:
+ *
+ * - string base_url path, and optionally domain, of your application NULL
+ * - string index_file name of your index file, usually "index.php" index.php
+ * - string charset internal character set used for input and output utf-8
+ * - string cache_dir set the internal cache directory APPPATH/cache
+ * - boolean errors enable or disable error handling TRUE
+ * - boolean profile enable or disable internal profiling TRUE
+ * - boolean caching enable or disable internal caching FALSE
+ */
+Kohana::init(array(
+ 'base_url' => '/',
+));
+
+/**
+ * Attach the file write to logging. Multiple writers are supported.
+ */
+Kohana::$log->attach(new Kohana_Log_File(APPPATH.'logs'));
+
+/**
+ * Attach a file reader to config. Multiple readers are supported.
+ */
+Kohana::$config->attach(new Kohana_Config_File);
+
+/**
+ * Enable modules. Modules are referenced by a relative or absolute path.
+ */
+Kohana::modules(array(
+ // 'auth' => MODPATH.'auth', // Basic authentication
+ // 'cache' => MODPATH.'cache', // Caching with multiple backends
+ // 'codebench' => MODPATH.'codebench', // Benchmarking tool
+ 'database' => MODPATH.'database', // Database access
+ // 'image' => MODPATH.'image', // Image manipulation
+ // 'orm' => MODPATH.'orm', // Object Relationship Mapping
+ // 'oauth' => MODPATH.'oauth', // OAuth authentication
+ 'pagination' => MODPATH.'pagination', // Paging of results
+ // 'unittest' => MODPATH.'unittest', // Unit testing
+ // 'userguide' => MODPATH.'userguide', // User guide and API documentation
+ ));
+
+/**
+ * Set the routes. Each route must have a minimum of a name, a URI and a set of
+ * defaults for the URI.
+ */
+/*Route::set('default', '(<controller>(/<action>(/<id>)))')
+ ->defaults(array(
+ 'controller' => 'welcome',
+ 'action' => 'index',
+ ));
+ */
+Route::set('auth','auth(/<action>)')
+ ->defaults(array(
+ 'controller' => 'Auth'
+ ));
+Route::set('admin','admin(/<action>(/<id>))')
+ ->defaults(array(
+ 'controller' => 'Admin',
+ 'action' => 'index'
+ ));
+Route::set('cashier','cashier(/<action>(/<id>))')
+ ->defaults(array(
+ 'controller' => 'Cashier',
+ 'action' => 'index'
+ ));
+Route::set('default', '(<action>(/<id>))')
+ ->defaults(array(
+ 'controller' => 'Page',
+ 'action' => 'home'
+ ));
+Route::set('view', '(view(/<action>(/<id>)))')
+ ->defaults(array(
+ 'controller'=>'View'
+ ));
+Route::set('shop','(<controller>(/<action>(/<id>)))')
+ ->defaults(array(
+ 'controller'=>'Shop'
+ ));
+if ( ! defined('SUPPRESS_REQUEST'))
+{
+ /**
+ * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
+ * If no source is specified, the URI will be automatically detected.
+ */
+ echo Request::instance()
+ ->execute()
+ ->send_headers()
+ ->response;
+}
@@ -0,0 +1,26 @@
+<?php defined('SYSPATH') or die('No direct script access.');
+
+class Controller_Admin extends Controller_Tpl
+ {
+ /**
+ * @param POST читаем имя пользователя
+ * @return HTML выводим главную страницы админки
+ * @111
+ */
+ public function action_index()
+ {
+ $username = Cookie::get('username');
+ $user = Model::factory('users');
+ if($user->get_rang($username) == 1)
+ {
+ $this->template->title = __('Администратор');
+ $this->template->content = View::factory('admin/index');
+ }
+ else
+ {
+ $this->template->title = __('Ошибка');
+ $this->template->content = View::factory('tpl/msg')
+ ->set('msg','В этот раздел имеют доступ только пользователи с рангом: 1');
+ }
+ }
+ }
@@ -0,0 +1,52 @@
+<?php defined('SYSPATH') or die('No direct script access.');
+
+class Controller_Auth extends Controller_Tpl
+ {
+ /**
+ * @return HTML выводит страницу логина
+ */
+ public function action_login()
+ {
+ $auth = Model::factory('Auth');
+
+ if(!empty($_POST))
+ {
+ $login = Arr::get($_POST, 'login');
+ $password = Arr::get($_POST, 'password');
+
+ $this->template->title = __('Авторизация');
+ $this->template->content = View::factory('tpl/msg')
+ ->set('msg', $auth->login($login,$password));
+ }
+ }
+ /**
+ * @return HTML выводит страницу регистрации
+ */
+ public function action_register()
+ {
+ $auth = Model::factory('Auth');
+ if(!empty($_POST))
+ {
+ $login = Arr::get($_POST, 'login');
+ $password = Arr::get($_POST, 'password');
+ $email = Arr::get($_POST, 'email');
+
+ $this->template->title = __('Зарегистрированы');
+ $this->template->content = View::factory('tpl/msg')
+ ->set('msg', $auth->register($login,$password,$email));
+ }
+ }
+
+ /**
+ * @return HTML выход из сайта. удаление куков
+ */
+ public function action_logout()
+ {
+ Cookie::delete('loged_in');
+ Cookie::delete('username');
+
+ $this->template->title = __('До свидания');
+ $this->template->content = View::factory('tpl/msg')
+ ->set('msg', 'До свидания! Приходите ещё!');
+ }
+ }
@@ -0,0 +1,46 @@
+<?php defined('SYSPATH') or die('No direct script access.');
+
+class Controller_Cashier extends Controller_Tpl
+ {
+ /**
+ * @param POST читаем имя пользователя
+ * @return HTML выводим главную страницы интерфейса кассира
+ */
+ public function action_index()
+ {
+ $username = Cookie::get('username');
+ $user = Model::factory('users');
+ $rang = $user->get_rang($username);
+ if($rang == 2 or $rang == 1)
+ {
+ $this->template->title = __('Кассир: главная');
+ $this->template->content = View::factory('cashier/index');
+ }
+ else
+ {
+ $this->template->title = __('Ошибка');
+ $this->template->content = View::factory('tpl/msg')
+ ->set('msg','В этот раздел имеют доступ только пользователи с рангом: 1');
+ }
+ }
+ /**
+ * @return HTML вывод менеджера заказов
+ */
+ public function action_order_manager()
+ {
+ $order = Model::factory('order');
+ $this->template->title = __('Кассир: Менеджер заказов');
+ $this->template->content = View::factory('cashier/order_manager')
+ ->set('list',$order->view_order_s(1));
+ }
+ /**
+ * @return HTML вывод формы оформления нового заказа
+ */
+ public function action_order_add()
+ {
+ $shop = Model::factory('shop');
+ $this->template->title = __('Кассир: оформление заказа');
+ $this->template->content = View::factory('cashier/order_add')
+ ->set('list_cat', $shop->get_category());
+ }
+ }
@@ -0,0 +1,101 @@
+<?php defined('SYSPATH') or die('No direct script access.');
+
+class Controller_Page extends Controller_Tpl
+ {
+ /**
+ * @return HTML вывод главной страницы
+ */
+ public function action_home()
+ {
+ $main = Model::factory('main');
+ $this->template->title = __('Добро пожаловать');
+ $this->template->content = View::factory('page/index')
+ ->set('service', $main->get_services())
+ ->set('prodone', $main->get_fisttwo())
+ ->set('prowthree',$main->get_threefour());
+ }
+ /**
+ * @return HTML вывод страницы помощи
+ */
+ public function action_help()
+ {
+ $this->template->title = __('Помощь');
+ $this->template->content = View::factory('page/help');
+ }
+ /**
+ * @return HTML вывод страницы контактов
+ */
+ public function action_contact()
+ {
+ $this->template->title = __('Контактная информация');
+ $this->template->content = View::factory('page/contact');
+ }
+ /**
+ * @param POST читаем из кук имя пользователя
+ * @return HTML вывод заказов пользователя
+ */
+ public function action_orders()
+ {
+ if(Cookie::get('loged_in')==TRUE)
+ {
+ $order = Model::factory('order');
+ $orders = $order->view_orders(Cookie::get('username'));
+ $this->template->title = __('Заказы');
+ $this->template->content = View::factory('page/orders')
+ ->set('list', $orders);
+ }
+ else
+ {
+ $this->template->title = __('Ошибка');
+ $this->template->content = View::factory('tpl/msg')
+ ->set('msg','Вы не авторизированы');
+ }
+ }
+ /**
+ * @param POST проверяем из кук,залогинен ли пользователь, читаем имя пользователя
+ * @return HTML вывод покупок пользователя
+ */
+ public function action_kart()
+ {
+ if(Cookie::get('loged_in')==TRUE)
+ {
+ $shop = Model::factory('shop');
+ $orders = $shop->view_kart(Cookie::get('username'));
+ $this->template->title = __('Заказы');
+ $this->template->content = View::factory('page/kart')
+ ->set('list', $orders);
+ }
+ else
+ {
+ $this->template->title = __('Ошибка');
+ $this->template->content = View::factory('tpl/msg')
+ ->set('msg','Вы не авторизированы');
+ }
+ }
+ /**
+ * @return HTML вывод страницы входа
+ */
+ public function action_login()
+ {
+ $this->template->title = __('Вход');
+ $this->template->content = View::factory('page/auth/login');
+ }
+ /**
+ * @return HTML вывод страницы регистрации
+ */
+ public function action_reg()
+ {
+ $this->template->title = __('Регистрация');
+ $this->template->content = View::factory('page/auth/reg');
+ }
+ /**
+ * @return set_cookie
+ */
+ public function action_changecity()
+ {
+ $main = Model::factory('main');
+ $main->set_city($_POST['region']);
+ $this->request->redirect('/index');
+ }
+ }
+
Oops, something went wrong.

0 comments on commit e33f61b

Please sign in to comment.