Skip to content

Commit

Permalink
views:
Browse files Browse the repository at this point in the history
"<?=" -> "<?php echo"
"foreach(){}" -> "foreach(): endforeach;"
for better compatibility with php5
controllers,models:
all messages stores in /messages/msg
Signed-off-by:d1ffuz0r <ап@10.65.197.35>
  • Loading branch information
d1ffuz0r committed Feb 27, 2011
1 parent 28ec331 commit da2fda3
Show file tree
Hide file tree
Showing 28 changed files with 130 additions and 107 deletions.
3 changes: 3 additions & 0 deletions .htaccess
@@ -0,0 +1,3 @@
RewriteEngine on
RewriteCond $1 !^(index\.php|img|style\.css|jquery\.js|slider\.css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
2 changes: 1 addition & 1 deletion application/bootstrap.php
Expand Up @@ -76,7 +76,7 @@
*/
Kohana::modules(array(
// 'auth' => MODPATH.'auth', // Basic authentication
// 'cache' => MODPATH.'cache', // Caching with multiple backends
'cache' => MODPATH.'cache', // Caching with multiple backends
// 'codebench' => MODPATH.'codebench', // Benchmarking tool
'database' => MODPATH.'database', // Database access
// 'image' => MODPATH.'image', // Image manipulation
Expand Down
2 changes: 1 addition & 1 deletion application/classes/controller/admin.php
Expand Up @@ -24,7 +24,7 @@ public function action_index()
{
$this->template->title = __('Ошибка');
$this->template->content = View::factory('tpl/msg')
->set('msg','В этот раздел имеют доступ только пользователи с рангом: 1');
->set('msg',Kohana::message('msg', 'no_access'));
}
}
}
2 changes: 1 addition & 1 deletion application/classes/controller/auth.php
Expand Up @@ -51,6 +51,6 @@ public function action_logout()

$this->template->title = __('До свидания');
$this->template->content = View::factory('tpl/msg')
->set('msg', 'До свидания! Приходите ещё!');
->set('msg',Kohana::message('msg','bye'));
}
}
2 changes: 1 addition & 1 deletion application/classes/controller/cashier.php
Expand Up @@ -24,7 +24,7 @@ public function action_index()
{
$this->template->title = __('Ошибка');
$this->template->content = View::factory('tpl/msg')
->set('msg','В этот раздел имеют доступ только пользователи с рангом: 1');
->set('msg',Kohana::message('msg', 'no_access'));
}
}
/**
Expand Down
2 changes: 1 addition & 1 deletion application/classes/controller/page.php
Expand Up @@ -73,7 +73,7 @@ public function action_kart()
{
$this->template->title = __('Ошибка');
$this->template->content = View::factory('tpl/msg')
->set('msg','Вы не авторизированы');
->set('msg',Kohana::message('msg','not_login'));
}
}
/**
Expand Down
10 changes: 5 additions & 5 deletions application/classes/controller/shop.php
Expand Up @@ -27,7 +27,7 @@ public function action_new_order($id)
{
$this->template->title = __('Ошибка');
$this->template->content = View::factory('tpl/msg')
->set('msg', 'Вы не авторизированы');
->set('msg',Kohana::message('msg','not_login'));
}
}

Expand Down Expand Up @@ -66,7 +66,7 @@ public function action_add_order()
{
$this->template->title = __('Ошибка');
$this->template->content = View::factory('tpl/msg')
->set('msg', 'Вы не заполнили все поля');
->set('msg', Kohana::message('msg','empty_field'));
}
}

Expand All @@ -93,7 +93,7 @@ public function action_search()
{
$this->template->title = __('Ошибка');
$this->template->content = View::factory('tpl/msg')
->set('msg', 'Вы не заполнили поле поиска');
->set('msg', Kohana::message('msg','not_search'));
}
}

Expand All @@ -107,7 +107,7 @@ public function action_order_y($id)
$order->set_status($id, 3);
$this->template->title = __('Подтверждено');
$this->template->content = View::factory('tpl/msg')
->set('msg', '<h2>Заказ принят</h2>');
->set('msg', Kohana::message('msg','order_add'));
}

/**
Expand All @@ -120,7 +120,7 @@ public function action_order_n($id)
$order->set_status($id, 2);
$this->template->title = __('Подтверждено');
$this->template->content = View::factory('tpl/msg')
->set('msg', '<h2>Заказ отклонён</h2>');
->set('msg', Kohana::message('msg','order_denied'));
}

}
3 changes: 2 additions & 1 deletion application/classes/controller/view.php
Expand Up @@ -25,6 +25,7 @@ public function action_cat($cat)
$per_page = $pagination->items_per_page;
$offset = $per_page * ($page-1);
$page_links = $pagination->render();

$this->template->title = __('Просмотр категории');
$this->template->content = View::factory('page/view/cat')
->set('id', $shop->view_category($cat,$offset))
Expand All @@ -37,8 +38,8 @@ public function action_cat($cat)
public function action_product($id)
{
$shop = Model::factory('shop');
$this->template->title = __('Просмотр категории');

$this->template->title = __('Просмотр категории');
$this->template->content = View::factory('page/view/product')
->set('id',$shop->view_product($id));
}
Expand Down
6 changes: 3 additions & 3 deletions application/classes/model/auth.php
Expand Up @@ -24,11 +24,11 @@ public function login($login, $password)
Cookie::set('loged_in', TRUE);
Cookie::set('username', $login);

return 'Вы авторизированы';
return Kohana::message('msg','auth_success');
}
else
{
return 'Ошибка. введите правильный логин или пароль';
return Kohana::message('msg','auth_error');
}
}

Expand All @@ -46,7 +46,7 @@ public function register($login, $password, $email)
->execute();
if ($query->count()>=1)
{
return 'Ошибка. такой логин уже существует';
return Kohana::message('msg', 'reg_error');
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion application/classes/model/order.php
Expand Up @@ -87,7 +87,7 @@ public function add_order($array,$status)
$price
))
->execute();
return '<h2>Ваш заказ добавлен.<br>№ заказа:' . $id . '<br>Просмотреть ваши заказы можно на странице <a href="/orders">Заказы</a></h2>';
return Kohana::message('msg','order_add');
}

/**
Expand Down
17 changes: 17 additions & 0 deletions application/messages/msg.php
@@ -0,0 +1,17 @@
<?php defined('SYSPATH') or die('No direct script access.');

return array(
'no_access' => 'Ваш уровень доступа не позволяет просматрвать эту страницу',
'bye' => 'До свидания!',
'auth_success' => 'Добро пожаловать! Вы авторизированы.',
'auth_error' => 'Ошибка. введите правильный логин или пароль',
'reg_error' => 'Ошибка. такой логин уже существует',
'reg_success' => 'Добро пожаловать! Вы зарегистрированы.',
'not_login' => 'Ощибка. Вы не авторизованы!',
'empty_field' => 'Вы не заполнили все поля',
'empty_search' => 'Вы не заполнили поле поиска',
'order_access' => 'Заказ принят',
'order_denied' => 'Заказ отклонён',
'order_add' => 'Ваш заказ принят.<br>Просмотреть заказы можно на странице <a href="/orders">Заказы</a>'

);
4 changes: 2 additions & 2 deletions application/views/cashier/index.php
Expand Up @@ -2,8 +2,8 @@
<hr>
<table width="100%">
<tr align="center" height="150">
<td width="50%"><a href="/cashier/order_manager"><img src="<?=Kohana::$base_url;?>img/order_manager.png" title="Менеджер заказов"></a></td>
<td width="50%"><a href="/cashier/order_add"><img src="<?=Kohana::$base_url;?>img/order_add.png" title="Оформить заказ"></a></td>
<td width="50%"><a href="/cashier/order_manager"><img src="<?php echo Kohana::$base_url;?>img/order_manager.png" title="Менеджер заказов"></a></td>
<td width="50%"><a href="/cashier/order_add"><img src="<?php echo Kohana::$base_url;?>img/order_add.png" title="Оформить заказ"></a></td>
</tr>
<tr align="center">
<td>Менеджер заказов</td>
Expand Down
26 changes: 13 additions & 13 deletions application/views/cashier/order_manager.php
@@ -1,19 +1,19 @@
<h1>Менеджер заказов</h1>
<hr>
<h2>
<? foreach ($list as $l) { ?>
id:<?=$l->ord_id ?> | дата:<?=$l->ord_date ?> | товар:<a href="/view/product/<?=$l->ord_product ?>"><?=$l->ord_product ?></a> сумма: <?=$l->ord_price?> р. | статус:<? if($l->ord_status == 1 ) { echo 'в рассмотрении'; } else {echo '<a style="color:red;">отказано</a>';}?><br>
<? foreach ($list as $l) : ?>
id:<?php echo $l->ord_id ?> | дата:<?php echo $l->ord_date ?> | товар:<a href="/view/product/<?php echo $l->ord_product ?>"><?php echo $l->ord_product ?></a> сумма: <?php echo $l->ord_price?> р. | статус:<? if($l->ord_status == 1 ) { echo 'в рассмотрении'; } else {echo '<a style="color:red;">отказано</a>';}?><br>
О заказщике:<br>
Имя:<?=$l->ord_realname ?><br>
Фамилия:<?=$l->ord_family ?><br>
Отчество:<?=$l->ord_ot4estvo ?><br>
Телефон:<?=$l->ord_telephone ?><br>
e-mail:<?=$l->ord_email ?><br>
Страна:<?=$l->ord_country ?><br>
Регион:<?=$l->ord_region ?><br>
Город:<?=$l->ord_city ?><br>
Индекс:<?=$l->ord_postindex ?><br>
<p align="right"><a href="/shop/order_y/<?=$l->ord_id ?>">принять</a> | <a href="/shop/order_n/<?=$l->ord_id ?>">отказать</a></p>
Имя:<?php echo $l->ord_realname ?><br>
Фамилия:<?php echo $l->ord_family ?><br>
Отчество:<?php echo $l->ord_ot4estvo ?><br>
Телефон:<?php echo $l->ord_telephone ?><br>
e-mail:<?php echo $l->ord_email ?><br>
Страна:<?php echo $l->ord_country ?><br>
Регион:<?php echo $l->ord_region ?><br>
Город:<?php echo $l->ord_city ?><br>
Индекс:<?php echo $l->ord_postindex ?><br>
<p align="right"><a href="/shop/order_y/<?php echo $l->ord_id ?>">принять</a> | <a href="/shop/order_n/<?php echo $l->ord_id ?>">отказать</a></p>
<hr>
<? }?>
<? endforeach; ?>
</h2>
2 changes: 1 addition & 1 deletion application/views/page/auth/login.php
@@ -1,6 +1,6 @@
<h1>Вход</h1>
<center>
<form action="<?=URL::base();?>auth/login" method="POST">
<form action="<?php echo URL::base();?>auth/login" method="POST">
<h2>Логин:</h2>
<input type="text" name="login"><br/>
<h2>Пароль:</h2>
Expand Down
2 changes: 1 addition & 1 deletion application/views/page/auth/reg.php
@@ -1,6 +1,6 @@
<h1>Регистрация</h1>
<center>
<form action="<?=URL::base();?>auth/register" method="POST">
<form action="<?php echo URL::base();?>auth/register" method="POST">
<h2>Логин:</h2>
<input type="text" name="login"><br/>
<h2>Пароль:</h2>
Expand Down
36 changes: 18 additions & 18 deletions application/views/page/index.php
Expand Up @@ -57,12 +57,12 @@ function manageControls(position){
<tr>
<div id="slideshow">
<div id="slidesContainer">
<? foreach($service as $serv) { ?>
<? foreach($service as $serv) : ?>
<div class="slide">
<a class="page_header_img"><img src="img/<?=$serv->image ?>" alt="<?=$serv->rusname ?>" /></a>
<a class="page_header_text" style="font-size: 20px;"><?=$serv->text ?></a>
<a class="page_header_img"><img src="img/<?php echo $serv->image ?>" alt="<?php echo $serv->rusname ?>" /></a>
<a class="page_header_text" style="font-size: 20px;"><?php echo $serv->text ?></a>
</div>
<? } ?>
<? endforeach; ?>
</div>
</div>
</tr>
Expand All @@ -82,38 +82,38 @@ function manageControls(position){
<tr>
<? foreach($prodone as $desk){?>
<td class="page_center_button">
<a class="page_center_buy" <? if(Cookie::get('loged_in') == TRUE) { ?> href="/shop/new_order/<?=$desk->p_id ?>" title="Оформить заказ"<? } ?> ><span>buy</span></a>
<a class="page_center_info" href="/view/product/<?=$desk->p_id ?>" title="Просмотр"><span>more-info</span></a>
<a class="page_center_buy" <? if(Cookie::get('loged_in') == TRUE) { ?> href="/shop/new_order/<?php echo $desk->p_id ?>" title="Оформить заказ"<? } ?> ><span>buy</span></a>
<a class="page_center_info" href="/view/product/<?php echo $desk->p_id ?>" title="Просмотр"><span>more-info</span></a>
</td>
<td class="page_center_content">
<div class="page_center_text">
<span class="blue2"><?=$desk->p_rusname ?></span><br/>
<span class="gray"><?=$desk->p_desc ?></span><br/>
<span class="blue2"><?php echo $desk->p_rusname ?></span><br/>
<span class="gray"><?php echo $desk->p_desc ?></span><br/>
<span class="gray">Cras ut: ligula nec</span><br/>
<br/>
<span class="green"><?=round($desk->p_price)?> руб</span><br/>
<span class="green"><?php echo round($desk->p_price)?> руб</span><br/>
</div>
</td>
<td class="page_center_img"><img align="right" src="<?=Kohana::$base_url;?>img/<?=$desk->p_category ?>/<?=$desk->p_name ?>.png" alt="" /> </td>
<td class="page_center_img"><img align="right" src="<?php echo Kohana::$base_url;?>img/<?php echo $desk->p_category ?>/<?php echo $desk->p_name ?>.png" alt="" /> </td>
<? } ?>
</tr>
<tr>
<? foreach($prowthree as $desk){?>
<? foreach($prowthree as $desk):?>
<td class="page_center_button">
<a class="page_center_buy" <? if(Cookie::get('loged_in') == TRUE) { ?> href="/shop/new_order/<?=$desk->p_id ?>" title="Оформить заказ"><? } ?></a>
<a class="page_center_info" href="/view/product/<?=$desk->p_id ?>" title="Просмотр"><span>more-info</span></a>
<a class="page_center_buy" <? if(Cookie::get('loged_in') == TRUE) { ?> href="/shop/new_order/<?php echo $desk->p_id ?>" title="Оформить заказ"><? } ?>></a>
<a class="page_center_info" href="/view/product/<?php echo $desk->p_id ?>" title="Просмотр"><span>more-info</span></a>
</td>
<td class="page_center_content">
<div class="page_center_text">
<span class="blue2"><?=$desk->p_rusname ?></span><br/>
<span class="gray"><?=$desk->p_desc ?></span><br/>
<span class="blue2"><?php echo $desk->p_rusname ?></span><br/>
<span class="gray"><?php echo $desk->p_desc ?></span><br/>
<span class="gray">Cras ut: ligula nec</span><br/>
<br/>
<span class="green"><?=round($desk->p_price)?> руб</span><br/>
<span class="green"><?php echo round($desk->p_price)?> руб</span><br/>
</div>
</td>
<td class="page_center_img"><img align="right" src="<?=Kohana::$base_url;?>img/<?=$desk->p_category ?>/<?=$desk->p_name ?>.png" alt="" /> </td>
<? } ?>
<td class="page_center_img"><img align="right" src="<?php echo Kohana::$base_url;?>img/<?php echo $desk->p_category ?>/<?php echo $desk->p_name ?>.png" alt="" /> </td>
<? endforeach; ?>
</tr>
</table>
</div>
6 changes: 3 additions & 3 deletions application/views/page/kart.php
@@ -1,8 +1,8 @@
<h1>Ваши покупки</h1>
<hr>
<h2>
<? foreach ($list as $l) { ?>
id:<?=$l->ord_id?> | дата:<?=$l->ord_date ?> | товар:<a href="/view/product/<?=$l->ord_product ?>"><?=$l->ord_product ?></a> | статус: <? if($l->ord_status == 3 ) echo 'принято';?>
<? foreach ($list as $l) : ?>
id:<?php echo $l->ord_id?> | дата:<?php echo $l->ord_date ?> | товар:<a href="/view/product/<?php echo $l->ord_product ?>"><?php echo $l->ord_product ?></a> | статус: <? if($l->ord_status == 3 ) echo 'принято';?>
<hr>
<? }?>
<? endforeach;?>
</h2>
6 changes: 3 additions & 3 deletions application/views/page/orders.php
@@ -1,8 +1,8 @@
<h1>Ваши заказы</h1>
<hr>
<h2>
<? foreach ($list as $l) { ?>
id:<?=$l->ord_id ?> | дата:<?=$l->ord_date ?> | товар:<a href="/view/product/<?=$l->ord_product ?>"><?=$l->ord_product ?></a> | статус:<? if($l->ord_status == 1 ) { echo 'в рассмотрении'; } else {echo '<a style="color:red;">отказано</a>';}?>
<? foreach ($list as $l) : ?>
id:<?php echo $l->ord_id ?> | дата:<?php echo $l->ord_date ?> | товар:<a href="/view/product/<?php echo $l->ord_product ?>"><?php echo $l->ord_product ?></a> | статус:<? if($l->ord_status == 1 ) { echo 'в рассмотрении'; } else {echo '<a style="color:red;">отказано</a>';}?>
<hr>
<? }?>
<? endforeach; ?>
</h2>
18 changes: 9 additions & 9 deletions application/views/page/shop/new_order.php
Expand Up @@ -3,17 +3,17 @@
<h2>
<form action="/shop/add_order/now" method="POST">
<table>
<? foreach ($product as $p) { ?>
<? foreach ($product as $p) : ?>
<tr>
<td width="120">
<label>Товар:</label>
</td>
<td>
<?=$p->p_rusname ?>
<?php echo $p->p_rusname ?>
</td>
<td>
<input type="hidden" name="ord_username" value="<?=Cookie::get('username');?>">
<input type="hidden" name="ord_id" value="<?=$p->p_id ?>">
<input type="hidden" name="ord_username" value="<?php echo Cookie::get('username');?>">
<input type="hidden" name="ord_id" value="<?php echo $p->p_id ?>">
</td>
</tr>
<tr>
Expand All @@ -29,8 +29,8 @@
<label>Цена(с НДС):</label>
</td>
<td>
<?=round($p->p_ndsprice) ?> р.
<input type="hidden" name="ord_price" value="<?=round($p->p_ndsprice) ?>">
<?php echo round($p->p_ndsprice) ?> р.
<input type="hidden" name="ord_price" value="<?php echo round($p->p_ndsprice) ?>">
</td>
</tr>
<tr>
Expand Down Expand Up @@ -113,8 +113,8 @@
<label>Город(etc.):</label>
</td>
<td>
<input type="hidden" name="ord_city" value="<?=Cookie::get('city')?>">
<?=Cookie::get('r_city')?>
<input type="hidden" name="ord_city" value="<?php echo Cookie::get('city')?>">
<?php echo Cookie::get('r_city')?>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -143,7 +143,7 @@
</td>
</tr>
</table>
<? } ?>
<? endforeach; ?>
</form>
</h2>
<p style="color: red; float: right;">Все поля обязательны к заполнению</p>

0 comments on commit da2fda3

Please sign in to comment.