Commit 48680c56 authored by Яков's avatar Яков
Browse files

first

parents
<?php
class mainActions extends sfActions
{
public function executeUploader(sfWebRequest $request)
{
if ($request->getParameter('key') != 'partner' && $request->getParameter('key') != 'review' && $request->getParameter('key') != 'video' && $request->getParameter('key') != 'article')
{
echo Page::uploader(($request->hasParameter('url') ? $request->getParameter('url') : $request->getFiles('file')), ($request->hasParameter('url') ? 'url' : 'file'), true, array('key' => $request->getParameter('key')), true);
}else
{
echo Page::uploader(($request->hasParameter('url') ? $request->getParameter('url') : $request->getFiles('file')), ($request->hasParameter('url') ? 'url' : 'file'), true, array('key' => $request->getParameter('key')));
}
return sfView::NONE;
}
public function executeB64uploader(sfWebRequest $request)
{
$json = array(
'state' => 'error',
'errorTxt' => 'Not uploaded',
);
$file = $request->getFiles('file');
if (file_exists($file['tmp_name']))
{
$ext_post = strrpos($file['name'], '.');
$ext = strtolower(substr($file['name'], $ext_post));
$newName = sha1_file($file['tmp_name']) . $ext;
if(rename($file['tmp_name'], sfConfig::get('sf_upload_dir') . '/tmp/' . $newName))
{
$path = sfConfig::get('sf_upload_dir') . '/tmp/' . $newName;
$fileInBase64 = base64_encode(file_get_contents($path));
unlink($path);
$json = array(
'state' => 'success',
'b64' => $fileInBase64
);
}
}
echo json_encode($json);
return sfView::NONE;
}
public function executeJcrop(sfWebRequest $request)
{
if($request->isMethod('get'))
{
$c = $request->getParameter('c');
$key = $request->getParameter('key');
if(is_array($cfg_sizes = sfConfig::get('app_' . $key . '_sizes')))
{
if($cfg_sizes['min'])
{
$min_width = $cfg_sizes['min']['width'];
$min_height = $cfg_sizes['min']['height'];
if(($request->getParameter('w') * $c) > $min_width && ($request->getParameter('h') * $c) > $min_height)
{
$img = new sfImage(sfConfig::get('sf_upload_dir') . '/i/' . $request->getParameter('src'));
$img->crop(($request->getParameter('x') * $c), ($request->getParameter('y') * $c), ($request->getParameter('w') * $c), ($request->getParameter('h') * $c));
$img->thumbnail($min_width, $min_height, true);
$image_src = sfConfig::get('sf_upload_dir') . '/i/' . str_replace('.', '-M.', $request->getParameter('src'));
$img->saveAs($image_src);
if($cfg_sizes['M']['watermark'])
{
Page::watermarkAdd($image_src);
}
$result = 'ok';
}
else
{
$result = 'small';
}
}
}
}
echo $result;
return sfView::NONE;
}
public function executeError404(sfWebRequest $request)
{
$this->setLayout('404');
}
}
<?php
class mainComponents extends sfComponents
{
}
<?php
if ($image) {
$image_arr = explode(';', $image);
if(count($image_arr) > 0){
foreach ($image_arr as $key => $image_item){
echo ($line_length ? ($key % $line_length == 0 && $key != 0 ? '<br>' : '') : '') . '<img width="100%"' . ($type == 'fotorama' ? 'data-ad_id="' . $id . '" class="ftm_used_image ftm_used_image_' . $id . '" onclick="ftm.init(\'list\', this);event.stopPropagation();return false;"' : '') . ' src="/u/i/' . (isset($equal) ? $image_item : Page::replaceImageSize($image_item, 'S')) . ($sf_request->isXmlHttpRequest() ? '?u=' . rand(1, 10000) : '') . '">';
}
}
}
?>
\ No newline at end of file
<?php
$arr = array();
foreach ($elem->getTranslation() as $t){
$html = '<div class="sf_admin_list_td_title__ru_en_title">';
if(!isset($t['available']) || $t['available']){
$html .= '<span class="small_gray">' . mb_strtoupper($t['lang']) . ':</span>' . (isset($t['title']) ? $t['title'] : $t['variant']) . '</div>';
if($t['lang'] == 'ru'){
array_unshift($arr, $html);
}else{
$arr[] = $html;
}
}
}
echo implode('<i class="br5"></i>', $arr);
\ No newline at end of file
<p>Блюда в категории:</p>
<table cellpadding="0" cellspacing="0" class="my_admin_table" width="600">
<tr>
<td colspan="3" style="line-height: 23px;">
Название
</td>
</tr>
<?php
foreach ($children as $food)
{
?>
<tr class="hovered elem_<?php echo $food['id'] ?>">
<td>
<img class="position_img" src="/u/i/<?php echo str_replace(".", "-M.", $food['photo']); ?>"
alt="">
<a href="<?php echo url_for('@restauran_business_lunch_edit?id=' . $food['id']) ?>"><?php echo $food['title'] ?></a>
</td>
<?php if ($food['menu_category_id'] != 1)
{
?>
<td style="text-align: center">
Позиция: <input style="width: 60px;" type="number"
data-cat-id="<?php echo $food['menu_category_id'] ?>"
data-id="<?php echo $food['id'] ?>" data-table="RestauranBusinessLunch" class="change_pos"
value="<?php echo $food['sort'] ?>">
</td>
<?php
}
?>
<td class="tcenter" width="80">
<a class="my_edit" href="<?php echo url_for('@restauran_business_lunch_edit?id=' . $food['id']) ?>"></a>
<a onclick="if (confirm('Вы уверены что хотите удалить объект?')) { f.createHiddenFormAndSubmit($(this).attr('href'), {'sf_method': 'delete', '_csrf_token': 'd7fd71d9d52932863f7b44eec40f7dda'}); };return false;" class="my_delete" href="<?php echo url_for('@restauran_business_lunch_delete?id=' . $food['id']) ?>"></a>
</td>
</tr>
<?php
}
?>
</table>
\ No newline at end of file
<p>Блюда в категории:</p>
<table cellpadding="0" cellspacing="0" class="my_admin_table" width="600">
<tr>
<td colspan="4" style="line-height: 23px;">
Название <a class="lui_pseudo" style="float: right" href="<?php echo url_for('@restauran_food_new?spec_id='.$cat_id) ?>">Добавить позицию</a>
</td>
</tr>
<?php
foreach ($children as $food)
{
if (!$food['parent_id'])
{
if (count($food['SpecialsFood']) > 0)
{
$new_price = $food['SpecialsFood'][0]['new_price'];
$price = '<s class="small_text">' . $food['price'] . ' руб</s><br> ' . $new_price;
}
else
{
if ($food['price'])
{
$price = $food['price'];
}
else
{
$price = 0;
}
}
?>
<tr class="hovered elem_<?php echo $food['id'] ?>">
<td>
<a href="<?php echo url_for('@restauran_food_edit?id=' . $food['id']) ?>"><?php echo $food['title'] ?></a>
</td>
<td class="tcenter">
<?php echo $price ?> руб
</td>
<td style="text-align: center">
Позиция: <input style="width: 60px;" type="number" data-cat-id="<?php echo $food['menu_category_id'] ?>" data-id="<?php echo $food['id'] ?>" data-table="RestauranFood" class="change_pos" value="<?php echo $food['sort'] ?>">
</td>
<td class="tcenter" width="80">
<a class="my_edit" href="<?php echo url_for('@restauran_food_edit?id=' . $food['id']) ?>"></a>
<a onclick="if (confirm('Вы уверены что хотите удалить объект?')) { f.createHiddenFormAndSubmit($(this).attr('href'), {'sf_method': 'delete', '_csrf_token': 'd7fd71d9d52932863f7b44eec40f7dda'}); };return false;" class="my_delete" href="<?php echo url_for('@restauran_food_delete?id=' . $food['id']) ?>"></a>
</td>
</tr>
<?php
}
}
?>
</table>
\ No newline at end of file
<p>Категории:</p>
<table cellpadding="0" cellspacing="0" class="my_admin_table" width="600">
<tr>
<td colspan="3" style="line-height: 23px;">
Название <a class="lui_pseudo" style="float: right" href="<?php echo url_for('@restauran_menu_category_new?spec_id='.$cat_id) ?>">Добавить категорию</a>
</td>
</tr>
<?php
foreach ($children as $food)
{
?>
<tr class="hovered elem_<?php echo $food['id'] ?>">
<td>
<a href="<?php echo url_for('@restauran_menu_category_edit?id=' . $food['id']) ?>"><?php echo $food['title'] ?></a>
</td>
<td style="text-align: center">
Позиция: <input style="width: 60px;" type="number" data-cat-id="<?php echo $food['group_menu_category_id'] ?>" data-id="<?php echo $food['id'] ?>" data-table="RestauranMenuCategory" class="change_pos" value="<?php echo $food['sort'] ?>">
</td>
<td class="tcenter" width="80">
<a class="my_edit" href="<?php echo url_for('@restauran_menu_category_edit?id=' . $food['id']) ?>"></a>
<a onclick="if (confirm('Вы уверены что хотите удалить объект?')) { f.createHiddenFormAndSubmit($(this).attr('href'), {'sf_method': 'delete', '_csrf_token': 'd7fd71d9d52932863f7b44eec40f7dda'}); };return false;" class="my_delete" href="<?php echo url_for('@restauran_menu_category_delete?id=' . $food['id']) ?>"></a>
</td>
</tr>
<?php
}
?>
</table>
<p>Блюда в категории:</p>
<table cellpadding="0" cellspacing="0" class="my_admin_table" width="600">
<tr>
<td colspan="4" style="line-height: 23px;">
<div>Название <a class="lui_pseudo" style="float: right"
href="<?php echo url_for('@food_new?cat_id=' . $cat_id ) ?>">Добавить
позицию</a>
</td>
</tr>
<?php
foreach ($children as $food)
{
if (count($food['SpecialsFood']) > 0)
{
$new_price = $food['SpecialsFood'][0]['new_price'];
$price = '<s class="small_text">' . $food['price'] . ' руб</s><br> ' . $new_price;
}
else
{
$price = $food['price'];
}
?>
<tr class="hovered elem_<?php echo $food['id'] ?>">
<td>
<img class="position_img" src="/u/i/<?php echo str_replace(".", "-M.", $food['photo']); ?>"
alt="">
<a href="<?php echo url_for('@food_edit?id=' . $food['id']) ?>"><?php echo $food['title'] ?></a>
</td>
<td class="tcenter">
<?php echo $price ?> руб
</td>
<td style="text-align: center">
Позиция: <input style="width: 60px;" type="number" data-cat-id="<?php echo $food['menu_category_id'] ?>" data-id="<?php echo $food['id'] ?>" data-table="Food" class="change_pos" value="<?php echo $food['sort'] ?>">
</td>
<td class="tcenter" width="80">
<a class="my_edit" href="<?php echo url_for('@food_edit?id=' . $food['id']) ?>"></a>
<a onclick="if (confirm('Вы уверены что хотите удалить объект?')) { f.createHiddenFormAndSubmit($(this).attr('href'), {'sf_method': 'delete', '_csrf_token': 'd7fd71d9d52932863f7b44eec40f7dda'}); };return false;" class="my_delete" href="<?php echo url_for('@food_delete?id=' . $food['id']) ?>"></a>
</td>
</tr>
<?php
}
?>
</table>
\ No newline at end of file
<?php
require_once dirname(__FILE__).'/../lib/notification_emailsGeneratorConfiguration.class.php';
require_once dirname(__FILE__).'/../lib/notification_emailsGeneratorHelper.class.php';
/**
* notification_emails actions.
*
* @package sf
* @subpackage notification_emails
* @author Atma
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class notification_emailsActions extends autoNotification_emailsActions
{
}
generator:
class: sfDoctrineGenerator
param:
model_class: NotificationEmails
theme: admin
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: notification_emails
with_doctrine_route: true
actions_base_class: sfActions
order: 100
config:
actions: ~
fields:
id: {label: ''}
email: {label: 'Email'}
is_active: {label: 'Участвует в получении уведомлений'}
notic_type: {label: 'Тип уведомлений'}
created_at: {label: ''}
updated_at: {label: ''}
list:
layout: ~
title: 'Почта для уведомлений'
display: [email, _notic_type, is_active]
max_per_page: 100
object_actions:
_delete: ~
_edit: ~
search:
fields: false
export: false
filter:
class: false
form: ~
edit:
title: Редактирование
new:
title: Добавление
\ No newline at end of file
<?php
/**
* notification_emails module configuration.
*
* @package sf
* @subpackage notification_emails
* @author Atma
* @version SVN: $Id: configuration.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class notification_emailsGeneratorConfiguration extends BaseNotification_emailsGeneratorConfiguration
{
}
<?php
/**
* notification_emails module helper.
*
* @package sf
* @subpackage notification_emails
* @author Atma
* @version SVN: $Id: helper.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class notification_emailsGeneratorHelper extends BaseNotification_emailsGeneratorHelper
{
}
<?php
$notic_type = $notification_emails->getNoticType();
if ($notic_type == 'exchange')
{
echo 'Импорт';
}
elseif ($notic_type == 'order')
{
echo 'Заказ';
}
elseif ($notic_type == 'call')
{
echo 'Обратный звонок';
}
elseif ($notic_type == 'all')
{
echo 'Все';
}
\ No newline at end of file
<?php
require_once dirname(__FILE__).'/../lib/offerGeneratorConfiguration.class.php';
require_once dirname(__FILE__).'/../lib/offerGeneratorHelper.class.php';
/**
* offer actions.
*
* @package sf
* @subpackage offer
* @author Atma
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class offerActions extends autoOfferActions
{
public function executeUpdate(sfWebRequest $request)
{
parent::executeUpdate($request);
return sfView::NONE;
}
public function executeCreate(sfWebRequest $request)
{
parent::executeCreate($request);
return sfView::NONE;
}
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid())
{
try
{
$offer = $form->save();
echo $this->getPartial('cat/struct_form', array('form' => new OfferForm($offer), 'parent_id' => Cat::$parentId, 'link' => '/arm/offer' . ($offer ? '/' . $offer->getId() : '')));
return sfView::NONE;
}
catch (Doctrine_Validator_Exception $e)
{
$errorStack = $form->getObject()->getErrorStack();
return sfView::NONE;
}
$this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $offer)));
}
echo $this->getPartial('cat/struct_form', array('form' => $form, 'parent_id' => Cat::$parentId, 'link' => '/arm/offer' . ($this->offer && $this->offer->getId() ? '/' . $this->offer->getId() : '')));
}
}
generator:
class: sfDoctrineGenerator
param:
model_class: Offer
theme: admin
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: offer
with_doctrine_route: true
actions_base_class: sfActions
order: 15
skip: true
config:
actions: ~
fields:
id: {label: ''}
inner_id: {label: ''}
price: {label: 'Цена'}
product_id: {label: ''}
img: {label: 'Изображение'}
quantity_type: {label: 'Единица измерения'}
created_at: {label: ''}
updated_at: {label: ''}
is_wholesale: {label: 'Оптовая цена'}
list:
layout: ~
title: 'Торговые предложения'
display: [price, product_id, img]
max_per_page: 100
object_actions:
_delete: ~
_edit: ~
search:
fields: false
export: false
filter:
class: false
form: ~
edit:
title: Редактирование предложения
new:
title: Добавление предложения
\ No newline at end of file
<?php
/**
* offer module configuration.
*
* @package sf
* @subpackage offer
* @author Atma
* @version SVN: $Id: configuration.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class offerGeneratorConfiguration extends BaseOfferGeneratorConfiguration
{
}
<?php
/**
* offer module helper.
*
* @package sf
* @subpackage offer
* @author Atma
* @version SVN: $Id: helper.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class offerGeneratorHelper extends BaseOfferGeneratorHelper
{
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment