Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Яков
idivbanu
Commits
48680c56
Commit
48680c56
authored
May 29, 2018
by
Яков
Browse files
first
parents
Changes
359
Hide whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
359 of 359+
files are displayed.
Plain diff
Email patch
apps/www/modules/discount/actions/actions.class.php
0 → 100644
View file @
48680c56
<?php
/**
* discount actions.
*
* @package sf
* @subpackage discount
* @author Atma
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class
discountActions
extends
sfActions
{
public
function
executeIndex
(
sfWebRequest
$request
)
{
if
(
$request
->
hasParameter
(
'discount'
))
{
$data
=
$request
->
getParameter
(
'discount'
);
$discount
=
Doctrine
::
getTable
(
'Discount'
)
->
findOneByUrl
(
$data
[
'url'
]);
if
(
$discount
)
{
$date_now
=
new
DateTime
(
'now'
);
$date_now
->
modify
(
'+1 day'
);
$date_limit
=
new
DateTime
(
'now'
);
$date_limit
->
modify
(
'-30 day'
);
sfContext
::
getInstance
()
->
getConfiguration
()
->
loadHelpers
(
'Partial'
);
$check_discounts
=
Doctrine_Query
::
create
()
->
select
()
->
from
(
'DiscountPhone dp'
)
->
where
(
'dp.phone = ?'
,
$data
[
'phone'
])
->
andWhere
(
'dp.discount_id != ?'
,
$discount
->
getId
())
->
andWhere
(
'dp.order_id is null'
)
->
andWhere
(
'dp.created_at BETWEEN STR_TO_DATE(\''
.
$date_limit
->
format
(
'Y-m-d H:i:s'
)
.
'\', \'%Y-%m-%d %H:%i:%s\')
AND STR_TO_DATE(\''
.
$date_now
->
format
(
'Y-m-d H:i:s'
)
.
'\', \'%Y-%m-%d %H:%i:%s\')'
)
->
fetchArray
();
if
(
count
(
$check_discounts
)
==
1
)
{
echo
include_partial
(
'discount/form'
,
array
(
'status'
=>
'error'
,
'error'
=>
'У вас уже есть скидка '
.
$check_discounts
[
0
][
"active_discount"
]
.
'%'
));
}
else
{
$check_phone
=
Doctrine_Query
::
create
()
->
select
()
->
from
(
'DiscountPhone dp'
)
->
where
(
'dp.phone = ?'
,
$data
[
'phone'
])
->
andWhere
(
'dp.discount_id = ?'
,
$discount
->
getId
())
->
fetchArray
();
if
(
count
(
$check_phone
)
==
0
)
{
$discount_phone
=
new
DiscountPhone
();
$discount_phone
->
setDiscountId
(
$discount
->
getId
());
$discount_phone
->
setPhone
(
$data
[
'phone'
]);
$discount_phone
->
save
();
$this
->
getUser
()
->
setAttribute
(
'number_of_views'
,
3
);
$this
->
getUser
()
->
setAttribute
(
'phone_number'
,
$data
[
'phone'
]);
$this
->
getUser
()
->
setAttribute
(
'active_discount'
,
3
);
echo
include_partial
(
'discount/form'
,
array
(
'status'
=>
'complete'
));
}
else
{
if
(
is_numeric
(
$check_phone
[
0
][
'order_id'
]))
{
echo
include_partial
(
'discount/form'
,
array
(
'status'
=>
'error'
,
'error'
=>
'Вы уже использовали данную скидку'
));
}
else
{
$date_created
=
new
DateTime
(
$check_phone
[
0
][
'created_at'
]);
$interval
=
$date_now
->
diff
(
$date_created
);
$interval
=
$interval
->
format
(
'%a'
);
$remained
=
30
-
$interval
;
if
(
intval
(
$remained
)
<=
30
)
{
echo
include_partial
(
'discount/form'
,
array
(
'status'
=>
'error'
,
'error'
=>
"У вас уже есть данная скидка.
\n
Осталось "
.
$remained
.
" дней"
));
}
else
{
echo
include_partial
(
'discount/form'
,
array
(
'status'
=>
'error'
,
'error'
=>
'Вы не можете активировать скидку второй раз'
));
}
}
}
}
}
}
return
sfView
::
NONE
;
}
public
function
executeCheck_discount
(
sfWebRequest
$request
)
{
if
(
$request
->
hasParameter
(
'phone'
)
&&
$request
->
getParameter
(
'phone'
)
!=
false
)
{
$date_now
=
new
DateTime
(
'now'
);
$date_limit
=
new
DateTime
(
'now'
);
$date_limit
->
modify
(
'-30 day'
);
$discount
=
Doctrine_Query
::
create
()
->
select
()
->
from
(
'DiscountPhone dp'
)
->
where
(
'dp.phone = ?'
,
$request
->
getParameter
(
'phone'
))
->
andWhere
(
'dp.order_id is null'
)
->
andWhere
(
'dp.created_at BETWEEN STR_TO_DATE(\''
.
$date_limit
->
format
(
'Y-m-d H:i:s'
)
.
'\', \'%Y-%m-%d %H:%i:%s\')
AND STR_TO_DATE(\''
.
$date_now
->
format
(
'Y-m-d H:i:s'
)
.
'\', \'%Y-%m-%d %H:%i:%s\')'
)
->
execute
();
if
(
count
(
$discount
)
>
0
)
{
$discount
=
$discount
->
getFirst
();
$this
->
getUser
()
->
setAttribute
(
'active_discount'
,
$discount
->
getActiveDiscount
());
$this
->
getUser
()
->
setAttribute
(
'phone'
,
$request
->
getParameter
(
'phone'
));
//sfContext::getInstance()->getConfiguration()->loadHelpers('Components');
//$body = include_component('basket', 'basket');
echo
json_encode
(
array
(
'status'
=>
'success'
,
'active_discount'
=>
$discount
->
getActiveDiscount
(),
'body'
=>
$this
->
getComponent
(
'basket'
,
'basket'
)));
}
else
{
$this
->
getUser
()
->
setAttribute
(
'active_discount'
,
false
);
$this
->
getUser
()
->
setAttribute
(
'phone'
,
false
);
echo
json_encode
(
array
(
'status'
=>
'success'
,
'active_discount'
=>
0
,
'body'
=>
$this
->
getComponent
(
'basket'
,
'basket'
)));
}
}
return
sfView
::
NONE
;
}
public
function
executeCheck_discount_term
(
sfWebRequest
$request
)
{
if
(
$this
->
getUser
()
->
hasAttribute
(
'active_discount'
)
&&
$this
->
getUser
()
->
getAttribute
(
'active_discount'
)
!=
false
&&
$this
->
getUser
()
->
hasAttribute
(
'phone_number'
)
&&
$this
->
getUser
()
->
getAttribute
(
'phone_number'
)
!=
false
)
{
$date_now
=
new
DateTime
(
'now'
);
$date_limit
=
new
DateTime
(
'now'
);
$date_limit
->
modify
(
'-30 day'
);
$discount
=
Doctrine_Query
::
create
()
->
select
()
->
from
(
'DiscountPhone dp'
)
->
where
(
'dp.phone = ?'
,
$this
->
getUser
()
->
getAttribute
(
'phone_number'
))
->
andWhere
(
'dp.order_id is null'
)
->
andWhere
(
'dp.created_at BETWEEN STR_TO_DATE(\''
.
$date_limit
->
format
(
'Y-m-d H:i:s'
)
.
'\', \'%Y-%m-%d %H:%i:%s\')
AND STR_TO_DATE(\''
.
$date_now
->
format
(
'Y-m-d H:i:s'
)
.
'\', \'%Y-%m-%d %H:%i:%s\')'
)
->
execute
();
if
(
count
(
$discount
)
>
0
)
{
$discount
=
$discount
->
getFirst
();
echo
json_encode
(
array
(
'status'
=>
'success'
,
'active_discount'
=>
$discount
->
getActiveDiscount
()));
}
else
{
echo
json_encode
(
array
(
'status'
=>
'success'
,
'active_discount'
=>
0
));
}
}
else
{
echo
json_encode
(
array
(
'status'
=>
'success'
,
'active_discount'
=>
0
));
}
return
sfView
::
NONE
;
}
}
apps/www/modules/discount/actions/components.class.php
0 → 100644
View file @
48680c56
<?php
class
discountComponents
extends
sfComponents
{
public
function
executeForm
(
$request
)
{
if
(
$request
->
hasParameter
(
'url'
))
{
$discount
=
Doctrine
::
getTable
(
'Discount'
)
->
findOneByUrl
(
$request
->
getParameter
(
'url'
));
if
(
$discount
)
{
$this
->
status
=
'success'
;
$this
->
discount
=
$request
->
getParameter
(
'url'
);
}
else
{
$this
->
status
=
'error'
;
$this
->
error
=
'Cкидка не найдена'
;
$this
->
discount
=
$request
->
getParameter
(
'url'
);
}
}
}
}
\ No newline at end of file
apps/www/modules/discount/templates/_form.php
0 → 100644
View file @
48680c56
<?php
if
(
$status
==
'success'
)
{
echo
'<div class="image_discount">'
;
echo
'</div>'
;
echo
'<div class="form_discount">'
;
echo
'<div id="discount" class="discount_form__title">'
.
__
(
'Вы получили скидку 3%'
)
.
'</div>'
;
echo
'<div class="discount_form_text">Введите номер телефона, чтобы сохранить скидку</div>'
;
echo
'<form class="discount_form" method="post" action="'
.
url_for
(
'@discount'
)
.
'" onsubmit="discount.submit(this);return false;">'
;
echo
'<div class="discount_form__process">'
;
echo
'<div class="discount_form__inp_wrap"><input name="discount[phone]" type="text" id="phone_mask" class="form_type_1__input validate_it" placeholder="Номер телефона" onkeyup="form_validator.check($(this))" data-check-rule="phone" autocomplete="off" required></div>'
;
echo
'<input name="discount[url]" type="hidden" value="'
.
$discount
.
'">'
;
$culture
=
$sf_user
->
getCulture
();
?>
<div
class=
"discount_form__checkbox"
>
<label
class=
"checkbox ver2"
>
<input
type=
"checkbox"
class=
"validater validate_it not_custom"
onchange=
"form_validator.check($(this))"
data-check-rule=
"checked"
autocomplete=
"off"
required
>
<span
class=
"checkbox_span"
></span>
<span
class=
"checkbox_text"
>
<?php
echo
__
(
'Я принимаю условия'
)
?>
<a
href=
"
<?php
echo
'/'
.
$culture
.
'/terms-of-use/'
?>
"
target=
"_blank"
>
<?php
echo
__
(
'пользовательского соглашения'
)
?>
</a>
<?php
echo
__
(
' и '
)
?>
<a
href=
"
<?php
echo
'/'
.
$culture
.
'/privacy-policy/'
?>
"
target=
"_blank"
>
<?php
echo
__
(
'политики конфиденциальности'
)
?>
</a></span>
</label>
</div>
<i
class=
"br15"
></i>
<?php
echo
'<input type="submit" class="discount_form__submit green_b_btn send btn_disabled" value="'
.
__
(
'Cохранить'
)
.
'" disabled />'
;
echo
'</div>'
;
echo
'</form>'
;
echo
'<div class="discount_form_head_text">Хотите скидку больше?<br>Тогда посмотрите семь товаров.</div>'
;
echo
'<div class="discount_form_text">В течение 30 дней вы можете сделать заказ со скидкой.</div>'
;
echo
'</div>'
;
}
elseif
(
$status
==
'complete'
)
{
echo
'<div class="form_discount">'
;
echo
'<div id="discount" class="discount_form__title">'
.
__
(
'Скидка успешно активирована!'
)
.
'</div>'
;
echo
'<div class="discount_form__submit green_b_btn" onclick="discount.close();">Понятно</div>'
;
echo
'</div>'
;
}
elseif
(
$status
==
'error'
)
{
echo
'<div class="form_discount">'
;
echo
'<div id="discount" class="discount_form__title">'
.
__
(
$error
)
.
'</div>'
;
echo
'<div class="discount_form__submit green_b_btn" onclick="discount.close();">Понятно</div>'
;
echo
'</div>'
;
}
?>
<script>
var
lastvalue
=
''
;
var
lastvalueunmask
=
''
;
function
mask
(
str
)
{
var
arr
=
str
.
split
(
''
);
if
(
str
.
length
>=
2
)
{
arr
.
splice
(
2
,
0
,
"
(
"
);
if
(
str
.
length
>=
5
)
{
arr
.
splice
(
6
,
0
,
"
)
"
);
}
if
(
str
.
length
>=
8
)
{
arr
.
splice
(
10
,
0
,
"
-
"
);
}
if
(
str
.
length
>=
10
)
{
arr
.
splice
(
13
,
0
,
"
-
"
);
}
}
return
arr
.
join
(
''
);
}
function
unmask
(
str
)
{
var
rep
=
/
[
()
\-\s]
/g
;
var
value
=
str
.
replace
(
rep
,
''
);
return
value
;
}
$
(
'
#phone_mask
'
).
on
(
'
input
'
,
function
()
{
var
value
=
unmask
(
$
(
this
).
val
());
var
last
=
value
.
slice
(
-
1
);
var
first
=
value
.
charAt
(
0
);
var
rep
=
/
(
^
\+
7
)(
9
)([
0-9
]{0,9})
/g
;
if
((
value
.
length
==
2
)
&&
(
first
==
'
+
'
))
{
if
(
value
==
'
+9
'
)
{
value
=
'
+79
'
;
lastvalue
=
'
+79
'
;
}
else
{
value
=
'
+7
'
;
lastvalue
=
'
+7
'
;
}
}
else
if
((
value
==
'
7
'
)
||
(
value
==
'
8
'
))
{
value
=
'
+7
'
;
}
else
if
(
value
==
'
9
'
)
{
value
=
'
+79
'
;
}
else
{
var
execval
=
rep
.
exec
(
value
);
if
(
execval
!=
null
)
{
value
=
execval
[
0
];
}
else
{
if
((
last
!=
'
9
'
))
{
value
=
value
.
substring
(
0
,
value
.
length
-
1
)
}
}
}
$
(
this
).
val
(
mask
(
value
));
lastvalue
=
$
(
this
).
val
();
lastvalueunmask
=
value
;
});
$
(
'
#phone_mask
'
).
on
(
'
keydown
'
,
function
(
event
)
{
var
key
=
event
.
keyCode
||
event
.
charCode
;
if
(
key
==
8
||
key
==
46
){
var
value
=
unmask
(
$
(
'
#phone_mask
'
).
val
());
value
=
value
.
substring
(
0
,
value
.
length
-
1
);
$
(
'
#phone_mask
'
).
val
(
mask
(
value
));
lastvalue
=
$
(
'
#phone_mask
'
).
val
();
return
false
;
}
});
</script>
apps/www/modules/exchange/actions/actions.class.php
0 → 100644
View file @
48680c56
<?php
/**
* exchange actions.
*
* @package sf
* @subpackage exchange
* @author Atma
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class
exchangeActions
extends
sfActions
{
public
function
executeExchange
(
sfWebRequest
$request
)
{
if
(
$_SERVER
[
'PHP_AUTH_USER'
]
==
sfConfig
::
get
(
'app_import_auth_user'
)
&&
$_SERVER
[
'PHP_AUTH_PW'
]
==
sfConfig
::
get
(
'app_import_auth_pw'
)){
$type
=
$request
->
getParameter
(
'type'
);
$mode
=
$request
->
getParameter
(
'mode'
);
$classNew
=
false
;
$className
=
'ones'
.
ucfirst
(
$type
);
if
(
class_exists
(
$className
))
{
$classNew
=
new
$className
(
$request
);
if
(
method_exists
(
$classNew
,
$mode
))
{
file_put_contents
(
sfConfig
::
get
(
'sf_log_dir'
)
.
'/exchange'
,
date
(
'Y-m-d H:i:s'
)
.
" "
.
$classNew
.
"_"
.
$mode
.
"
\n
"
,
FILE_APPEND
);
$classNew
->
$mode
();
}
else
{
$classNew
=
false
;
}
}
if
(
$classNew
!==
false
)
{
$this
->
getResponse
()
->
setContentType
(
'text/plain'
);
echo
$classNew
;
}
}
else
{
$this
->
getResponse
()
->
setHttpHeader
(
'WWW-Authenticate'
,
'Basic realm="Need auth"'
);
}
return
sfView
::
NONE
;
}
}
class
onesCatalog
{
private
$request
;
private
$response
;
private
$dir
;
private
$zip
;
public
function
__construct
(
$request
)
{
$this
->
request
=
$request
;
$this
->
response
=
array
();
$this
->
dir
=
sfConfig
::
get
(
'sf_data_dir'
)
.
'/exchange'
;
$this
->
zip
=
$this
->
dir
.
'/1c_exchange.zip'
;
}
public
function
__toString
()
{
return
implode
(
"
\n
"
,
$this
->
response
);
}
public
function
checkauth
()
{
$this
->
response
[]
=
'success'
;
$this
->
response
[]
=
session_name
();
$this
->
response
[]
=
session_id
();
}
public
function
init
()
{
$objects
=
new
RecursiveIteratorIterator
(
new
RecursiveDirectoryIterator
(
$this
->
dir
),
RecursiveIteratorIterator
::
CHILD_FIRST
);
foreach
(
$objects
as
$name
=>
$object
)
{
if
(
basename
(
$name
)
!=
'.'
&&
basename
(
$name
)
!=
'..'
)
{
if
(
is_dir
(
$name
))
{
@
rmdir
(
$name
);
}
else
{
@
unlink
(
$name
);
}
}
}
$this
->
response
[]
=
'zip=yes'
;
$this
->
response
[]
=
'file_limit='
.
(
1024
*
1024
*
512
);
}
public
function
file
()
{
$raw_post
=
file_get_contents
(
'php://input'
);
if
(
$raw_post
!=
''
)
{
file_put_contents
(
$this
->
zip
,
$raw_post
,
FILE_APPEND
|
LOCK_EX
);
}
$this
->
response
[]
=
'success'
;
}
public
function
import
()
{
if
(
file_exists
(
$this
->
zip
))
{
exec
(
'unzip '
.
$this
->
zip
.
' -d '
.
$this
->
dir
.
' && chmod 0777 '
.
$this
->
dir
.
' -R'
);
rename
(
$this
->
zip
,
sfConfig
::
get
(
'sf_log_dir'
)
.
'/'
.
time
()
.
'_1c_exchange.zip'
);
$this
->
response
[]
=
'progress'
;
}
else
{
$task
=
false
;
if
(
$this
->
request
->
getParameter
(
'filename'
)
==
'import.xml'
)
{
$task
=
'exchange:import'
;
}
elseif
(
$this
->
request
->
getParameter
(
'filename'
)
==
'offers.xml'
)
{
$task
=
'exchange:offers'
;
}
if
(
$task
)
{
$cmd
=
sfConfig
::
get
(
'sf_root_dir'
)
.
'/symfony '
.
$task
;
file_put_contents
(
sfConfig
::
get
(
'sf_log_dir'
)
.
'/exchange'
,
date
(
'Y-m-d H:i:s'
)
.
" "
.
$cmd
.
" start
\n
"
,
FILE_APPEND
);
exec
(
$cmd
,
$output
);
file_put_contents
(
sfConfig
::
get
(
'sf_log_dir'
)
.
'/exchange'
,
date
(
'Y-m-d H:i:s'
)
.
" "
.
$cmd
.
"
\n
"
.
print_r
(
$output
,
true
)
.
"
\n\n
"
,
FILE_APPEND
);
$this
->
response
[]
=
'success'
;
$this
->
response
[]
=
$cmd
;
$this
->
response
=
array_merge
(
$this
->
response
,
$output
);
}
}
}
}
apps/www/modules/exchange/templates/_form.php
0 → 100644
View file @
48680c56
<?php
use_stylesheets_for_form
(
$form
)
?>
<?php
use_javascripts_for_form
(
$form
)
?>
<form
action=
"
<?php
echo
url_for
(
'exchange/'
.
(
$form
->
getObject
()
->
isNew
()
?
'create'
:
'update'
)
.
(
!
$form
->
getObject
()
->
isNew
()
?
'?id='
.
$form
->
getObject
()
->
getId
()
:
''
))
?>
"
method=
"post"
<?php
$form
->
isMultipart
()
and
print
'enctype="multipart/form-data" '
?>
>
<?php
if
(
!
$form
->
getObject
()
->
isNew
())
:
?>
<input
type=
"hidden"
name=
"sf_method"
value=
"put"
/>
<?php
endif
;
?>
<table>
<tfoot>
<tr>
<td
colspan=
"2"
>
<?php
echo
$form
->
renderHiddenFields
(
false
)
?>
<a
href=
"
<?php
echo
url_for
(
'exchange/index'
)
?>
"
>
Back to list
</a>
<?php
if
(
!
$form
->
getObject
()
->
isNew
())
:
?>
<?php
echo
link_to
(
'Delete'
,
'exchange/delete?id='
.
$form
->
getObject
()
->
getId
(),
array
(
'method'
=>
'delete'
,
'confirm'
=>
'Are you sure?'
))
?>
<?php
endif
;
?>
<input
type=
"submit"
value=
"Save"
/>
</td>
</tr>
</tfoot>
<tbody>
<?php
echo
$form
->
renderGlobalErrors
()
?>
<tr>
<th>
<?php
echo
$form
[
'created_at'
]
->
renderLabel
()
?>
</th>
<td>
<?php
echo
$form
[
'created_at'
]
->
renderError
()
?>
<?php
echo
$form
[
'created_at'
]
?>
</td>
</tr>
</tbody>
</table>
</form>
apps/www/modules/exchange/templates/editSuccess.php
0 → 100644
View file @
48680c56
<h1>
Edit Exchange
</h1>
<?php
include_partial
(
'form'
,
array
(
'form'
=>
$form
))
?>
apps/www/modules/exchange/templates/indexSuccess.php
0 → 100644
View file @
48680c56
<h1>
Exchanges List
</h1>
<table>
<thead>
<tr>
<th>
Id
</th>
<th>
Created at
</th>
<th>
Updated at
</th>
</tr>
</thead>
<tbody>
<?php
foreach
(
$exchanges
as
$exchange
)
:
?>
<tr>
<td><a
href=
"
<?php
echo
url_for
(
'exchange/edit?id='
.
$exchange
->
getId
())
?>
"
>
<?php
echo
$exchange
->
getId
()
?>
</a></td>
<td>
<?php
echo
$exchange
->
getCreatedAt
()
?>
</td>
<td>
<?php
echo
$exchange
->
getUpdatedAt
()
?>
</td>
</tr>
<?php
endforeach
;
?>
</tbody>
</table>
<a
href=
"
<?php
echo
url_for
(
'exchange/new'
)
?>
"
>
New
</a>
apps/www/modules/exchange/templates/newSuccess.php
0 → 100644
View file @
48680c56
<h1>
New Exchange
</h1>
<?php
include_partial
(
'form'
,
array
(
'form'
=>
$form
))
?>
apps/www/modules/main/actions/actions.class.php
0 → 100644
View file @
48680c56
<?php
/**
* main actions.
*
* @package sf
* @subpackage main
* @author Atma
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class
mainActions
extends
sfActions
{
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public
function
executeIndex
(
sfWebRequest
$request
)
{
$this
->
setLayout
(
'layoutHome'
);
$this
->
video
=
Doctrine_Query
::
create
()
->
select
(
"v.*, t.*"
)
->
from
(
"Video v"
)
->
innerJoin
(
"v.Translation t"
)
->
where
(
"t.lang = ?"
,
$this
->
getUser
()
->
getCulture
())
->
andWhere
(
"t.available = 1"
)
->
orderBy
(
"v.created_at DESC"
)
->
fetchOne
();
$this
->
products
=
Doctrine_Query
::
create
()
->
select
(
"p.id, p.alias, p.product_img, p.is_detail, p.offer_count, p.is_delete, pt.id, pt.lang, pt.title, o.id, o.product_id, o.price, o.quantity_type_select, ot.*"
)
->
from
(
"Product p"
)
->
leftJoin
(
"p.Translation pt"
)
->
leftJoin
(
"p.Offer o WITH o.is_wholesale = 0"
)
->
leftJoin
(
"o.Translation ot"
)
->
where
(
"p.offer_count > 0"
)
->
andWhere
(
"p.is_delete = 0"
)
->
andWhere
(
"CHAR_LENGTH(p.product_img) > 0"
)
->
limit
(
10
)
->
orderBy
(
"FIELD(p.show_main, '1') DESC, p.sort, RAND()"
)
->
fetchArray
();
$this
->
group_offers
=
Doctrine_Query
::
create
()
->
select
(
"p.id, p.alias, p.product_img, p.is_detail, p.offer_count, p.is_delete, pt.id, pt.lang, pt.title, o.id, o.product_id, o.price, o.quantity_type_select, ot.*, c.id, ct.title, ct.id, ct.lang"
)
->
from
(
"Product p"
)
->
innerJoin
(
"p.Translation pt"
)
->
innerJoin
(
"p.Offer o"
)
->
innerJoin
(
"o.Translation ot"
)
->
innerJoin
(
"p.Cats c"
)
->
innerJoin
(
"c.Translation ct WITH ct.title LIKE '%камень для бани%'"
)
->
where
(
"p.offer_count > 0"
)
->
andWhere
(
"p.is_delete = 0"
)
->
andWhere
(
"p.is_main = 1"
)
->
andWhere
(
"CHAR_LENGTH(p.product_img) > 0"
)
->
limit
(
2
)
->
orderBy
(
"RAND()"
)
->
fetchArray
();
$this
->
group_cat
=
Doctrine_Query
::
create
()
->
select
(
"c.*, t.*"
)
->
from
(
"Cat c"
)
->
innerJoin
(
"c.Translation t"
)
->
where
(
"CHAR_LENGTH(c.photo) > 0"
)
->
andWhere
(
"c.is_main = 1"
)
->
orderBy
(
"RAND()"
)
->
fetchOne
();
}
public
function
executeDl
(
sfWebRequest
$request
)
{
/*
$type = $request->getParameter('type');
$id = trim(strip_tags($request->getParameter('id')));
if($type == 'certificate' && $id){
$product = Doctrine::getTable("Product")->findOneByAlias($id);
$this->forward404Unless($product && $product->getCertificate());
$path = sfConfig::get('sf_upload_dir') . '/i/' . $product->getCertificate();
if(file_exists($path) && !is_dir($path)){
$exp = explode('.', $product->getCertificate());
$this->getResponse()->setHttpHeader('Content-type', mime_content_type($path));
$this->getResponse()->setHttpHeader('Content-Disposition', 'attachment; filename="certificate.' . ($exp[count($exp) - 1]) . '"');
$this->getResponse()->setHttpHeader('X-Accel-Redirect', '/web/u/i/' . $product->getCertificate());
}
}
*/
return
sfView
::
NONE
;
}
public
function
executeUploader
(
sfWebRequest
$request
)
{
$file
=
$request
->
getFiles
(
'file'
);
if
(
substr
(
$file
[
'type'
],
0
,
5
)
==
'image'
){
echo
Page
::
uploader
(
$file
,
'file'
,
true
,
array
(
'key'
=>
$request
->
getParameter
(
'key'
)));
}
return
sfView
::
NONE
;
}
}
apps/www/modules/main/actions/components.class.php
0 → 100644
View file @
48680c56
<?php
class
mainComponents
extends
sfComponents
{
public
function
executeMenu
(
sfWebRequest
$request
)
{
Cat
::
menuInit
();
$this
->
type
=
(
!
isset
(
$this
->
type
)
?
'top'
:
$this
->
type
);
$this
->
menus
=
array
(
'catalog'
=>
array
(
'url'
=>
'@catalog'
,
'title'
=>
__
(
'Каталог'
),
'sub'
=>
Cat
::
$menu
),
'video'
=>
array
(
'url'
=>
'@video'
,
'title'
=>
__
(
'Смотреть'
)),
'article'
=>
array
(
'url'
=>
'@article'
,
'title'
=>
__
(
'Читать'
)),
'review'
=>
array
(
'url'
=>
'@review'
,
'title'
=>
__
(
'Отзывы'
)),
'page'
=>
array
(
'url'
=>
'@page_show?alias=delivery'
,
'title'
=>
__
(
'Доставка'
))
);
if
(
$this
->
type
==
'bottom'
){
unset
(
$this
->
menus
[
'catalog'
]);
}
}
public
function
executeTag
(
sfWebRequest
$request
)
{
$this
->
culture
=
$this
->
getUser
()
->
getCulture
();
$this
->
tags
=
Doctrine_Query
::
create
()
->
select
(
"t.id, tr.*"
)
->
from
(
"Tag t"
)
->
innerJoin
(
"t.Translation tr"
)
->
where
(
"tr.lang = ?"
,
$this
->
culture
)
->
orderBy
(
"tr.title ASC"
)
->
fetchArray
();
}
public
function
executeBreadcrumbs
(
sfWebRequest
$request
)
{
$culture
=
$this
->
getUser
()
->
getCulture
();
if
(
isset
(
$this
->
cat
))
{
$parent_id
=
$this
->
cat
->
getParentId
();
$namesCats
=
array
();
$i
=
0
;
while
(
$parent_id
!=
null
)
{
$parentCat
=
Doctrine_Query
::
create
()
->
select
()
->
from
(
'Cat c'
)
->
where
(
'c.id = ?'
,
$parent_id
)
->
leftJoin
(
'c.Translation ct WITH ct.lang = ?'
,
$culture
)
->
fetchArray
();
$namesCats
[
$i
][
'title'
]
=
$parentCat
[
0
][
'Translation'
][
$culture
][
'title'
];
$namesCats
[
$i
][
'alias'
]
=
$parentCat
[
0
][
'alias'
];
$parent_id
=
$parentCat
[
0
][
'parent_id'
];
$i
++
;
}
$this
->
namesCats
=
array_reverse
(
$namesCats
);
}
if
(
isset
(
$this
->
product_id
))
{
$cat_id
=
Doctrine
::
getTable
(
'CatProduct'
)
->
findOneByProductId
(
$this
->
product_id
)
->
getCatId
();
$cat
=
Doctrine_Query
::
create
()
->
select
()
->
from
(
'Cat c'
)
->
where
(
'c.id = ?'
,
$cat_id
)
->
leftJoin
(
'c.Translation ct WITH ct.lang = ?'
,
$culture
)
->
fetchArray
();
$parent_id
=
$cat
[
0
][
'parent_id'
];
$namesCats
=
array
();
$namesCats
[
0
][
'title'
]
=
$cat
[
0
][
'Translation'
][
$culture
][
'title'
];
$namesCats
[
0
][
'alias'
]
=
$cat
[
0
][
'alias'
];
$i
=
1
;
while
(
$parent_id
!=
null
)
{
$parentCat
=
Doctrine_Query
::
create
()
->
select
()
->
from
(
'Cat c'
)
->
where
(
'c.id = ?'
,
$parent_id
)
->
leftJoin
(
'c.Translation ct WITH ct.lang = ?'
,
$culture
)
->
fetchArray
();
$namesCats
[
$i
][
'title'
]
=
$parentCat
[
0
][
'Translation'
][
$culture
][
'title'
];
$namesCats
[
$i
][
'alias'
]
=
$parentCat
[
0
][
'alias'
];
$parent_id
=
$parentCat
[
0
][
'parent_id'
];
$i
++
;
}
$this
->
namesCats
=
array_reverse
(
$namesCats
);
}
}
}
\ No newline at end of file
apps/www/modules/main/templates/_breadcrumbs.php
0 → 100644
View file @
48680c56
<?php
$module_action
=
$sf_request
->
getParameter
(
'module'
)
.
'_'
.
$sf_request
->
getParameter
(
'action'
);
$link_main
=
'<a href="'
.
url_for
(
'@homepage'
)
.
'">'
.
__
(
'Главная'
)
.
'</a>'
;
if
(
$module_action
==
'article_show'
)
{
echo
'<div class="breadcrumbs">'
.
$link_main
.
link_to
(
__
(
'Читать'
),
'@article'
)
.
'</div>'
;
}
elseif
(
$module_action
==
'catalog_show'
)
{
echo
'<div class="breadcrumbs">'
.
$link_main
.
link_to
(
__
(
'Каталог'
),
'@catalog'
);
if
(
isset
(
$namesCats
)
&&
count
(
$namesCats
)
>
0
)
{
foreach
(
$namesCats
as
$key
=>
$cat
){
echo
link_to
(
$cat
[
'title'
],
'@catalog_show?alias='
.
$cat
[
'alias'
]);
}
}
echo
'</div>'
;
}
elseif
(
$module_action
==
'product_show'
)
{
echo
'<div class="breadcrumbs">'
.
$link_main
.
link_to
(
__
(
'Каталог'
),
'@catalog'
);
if
(
isset
(
$namesCats
)
&&
count
(
$namesCats
)
>
0
){
foreach
(
$namesCats
as
$key
=>
$cat
){
echo
link_to
(
$cat
[
'title'
],
'@catalog_show?alias='
.
$cat
[
'alias'
]);
}
}
echo
'</div>'
;
}
?>
\ No newline at end of file
apps/www/modules/main/templates/_menu.php
0 → 100644
View file @
48680c56
<?php
$pathinfo
=
$sf_request
->
getPathInfo
();
$module
=
$sf_request
->
getParameter
(
'module'
);
if
(
$module
==
'product'
)
{
$module
=
'catalog'
;
}
if
(
count
(
$menus
)
>
0
)
{
echo
'<ul'
.
(
$type
==
'bottom'
?
' class="footer_table_link__ul"'
:
''
)
.
'>'
;
foreach
(
$menus
as
$key
=>
$menu
)
{
$url
=
((
strpos
(
$menu
[
'url'
],
$module
))
||
(
$pathinfo
==
url_for
(
$menu
[
'url'
]))
!=
false
?
''
:
url_for
(
$menu
[
'url'
]));
$sub_class
=
(
isset
(
$menu
[
'sub'
])
&&
(
is_object
(
$menu
[
'sub'
])
||
is_array
(
$menu
[
'sub'
]))
&&
count
(
$menu
[
'sub'
])
>
0
?
' top_menu__elem_full'
:
''
);
echo
'<li class="'
.
(
$type
!=
'bottom'
?
'top_menu__elem'
:
''
)
.
''
.
$sub_class
.
'"><'
.
(
$url
?
'a'
:
'span'
)
.
' '
.
(
$type
==
'bottom'
?
'class="black_link big"'
:
''
)
.
' href="'
.
url_for
(
$menu
[
'url'
])
.
'">'
.
$menu
[
'title'
]
.
'</'
.
(
$url
?
'a'
:
'span'
)
.
'>'
;
if
(
$sub_class
!=
''
)
{
echo
'<div class="top_menu_sub">'
;
echo
'<div class="max_width">'
;
echo
'<ul>'
;
foreach
(
$menu
[
'sub'
]
as
$sub
)
{
$url
=
(
$pathinfo
==
url_for
(
'@catalog_show?alias='
.
$sub
[
'alias'
])
?
''
:
url_for
(
'@catalog_show?alias='
.
$sub
[
'alias'
]));
echo
'<li><'
.
(
$url
?
'a'
:
'span'
)
.
' href="'
.
url_for
(
'@catalog_show?alias='
.
$sub
[
'alias'
])
.
'" class="white_link">'
.
mb_strtoupper
(
mb_substr
(
$sub
[
'Translation'
][
$sf_user
->
getCulture
()][
'title'
],
0
,
1
))
.
mb_substr
(
$sub
[
'Translation'
][
$sf_user
->
getCulture
()][
'title'
],
1
)
.
'</'
.
(
$url
?
'a'
:
'span'
)
.
'></li>'
;
}
echo
'</ul>'
;
echo
'</div>'
;
echo
'</div>'
;
}
echo
'</li>'
;
}
echo
'</ul>'
;
}
?>
\ No newline at end of file
apps/www/modules/main/templates/_tag.php
0 → 100644
View file @
48680c56
<?php
if
(
count
(
$tags
)
>
0
){
/*
foreach ($tags as $tag){
echo $tag['Translation'][$culture]['title'] . '<br>';
}
*/
}
?>
\ No newline at end of file
apps/www/modules/main/templates/indexSuccess.php
0 → 100644
View file @
48680c56
<table
class=
"lending"
style=
"width: 100%"
cellspacing=
"0"
cellpadding=
"0"
>
<tr>
<td>
<div
class=
"fly_stones"
>
<span
class=
"fly_stones__text"
>
<?php
echo
(
$sf_user
->
getCulture
()
==
'ru'
?
'Банный камень<i class="br5"></i>и товары для бани'
:
'Bath stone<i class="br5"></i>and products for bath'
);
?>
</span>
</div>
<div
class=
"stone_layout"
></div>
</td>
</tr>
<tr>
<td>
<div
class=
"lending_area_1 background_grey"
>
<?php
if
(
csSettings
::
get
(
'main_description_'
.
$sf_user
->
getCulture
())
!=
''
)
{
echo
'<div class="max_width">'
;
echo
'<div class="main_description">'
.
nl2br
(
csSettings
::
get
(
'main_description_'
.
$sf_user
->
getCulture
()))
.
'</div>'
;
echo
'</div>'
;
}
?>
</div>
</td>
</tr>
<tr>
<td>
<div
class=
"lending_area_3"
>
<i
class=
"br20"
></i>
<div
style=
"text-align: center"
class=
"caption"
>
<a
href=
"
<?php
echo
url_for
(
'@catalog'
)
?>
"
class=
"green_link"
>
Наши товары
</a>
</div>
<i
class=
"br20"
></i>
<div
class=
"lending_product_area product_card_wrap max_width"
>
<div
class=
"catalog_category_childs_wrap"
>
<?php
if
(
isset
(
$products
)
&&
count
(
$products
)
>
0
){
foreach
(
$products
as
$product
){
include_partial
(
'product/product'
,
array
(
'product'
=>
$product
));
}
}
?>
</div>
</div>
<i
class=
"br20"
></i>
<?php
if
(
isset
(
$group_offers
)
&&
count
(
$group_offers
)
==
2
&&
$group_cat
){
$culture
=
$sf_user
->
getCulture
();
?>
<div
class=
"max_width"
style=
"margin: 0 auto"
>
<table
class=
"group_product"
width=
"100%"
cellpadding=
"0"
cellspacing=
"0"
>
<tr>
<td
class=
"group_product_left"
>
<?php
$image1
=
$group_offers
[
0
][
'product_img'
];
if
(
$image1
)
{
$exp
=
explode
(
';'
,
$image1
);
$image1
=
$exp
[
0
];
}
?>
<div
class=
"big_product_card"
>
<a
href=
"
<?php
echo
url_for
(
'@product_show?alias='
.
$group_offers
[
0
][
'alias'
]);
?>
"
>
<div
class=
"big_product_card_info"
>
<table
width=
"100%"
cellpadding=
"0"
cellspacing=
"0"
>
<tr>
<td
class=
"big_product_card_info__left"
>
<table
width=
"100%"
cellspacing=
"0"
cellpadding=
"0"
>
<tr>
<td
class=
"title"
>
<span>
<?php
echo
$group_offers
[
0
][
'Offer'
][
0
][
'Translation'
][
$culture
][
'title'
];
?>
</span>
<i
class=
"br10"
></i>
</td>
</tr>
<tr>
<td
class=
"offer"
>
<span>
(
<?php
echo
$group_offers
[
0
][
'Offer'
][
0
][
'Translation'
][
$culture
][
'quantity_type'
];
?>
)
</span>
</td>
</tr>
</table>
</td>
<td
class=
"big_product_card_info__right"
valign=
"top"
><nobr>
<?php
echo
number_format
(
$group_offers
[
0
][
'Offer'
][
0
][
'price'
],
0
,
','
,
' '
);
?>
</nobr><span
class=
"rub"
>
i
</span></td>
</tr>
</table>
</div>
<div
class=
"big_product_card__image"
<?php
echo
(
$image1
?
'style="background-image:url(/u/i/'
.
Page
::
replaceImageSize
(
$image1
,
'L2'
)
.
');"'
:
''
);
?>
></div>
</a>
</div>
</td>
<td
class=
"group_product_right"
>
<table
width=
"100%"
cellspacing=
"0"
cellpadding=
"0"
>
<tr>
<td>
<?php
$image2
=
$group_offers
[
1
][
'product_img'
];
if
(
$image2
)
{
$exp
=
explode
(
';'
,
$image2
);
$image2
=
$exp
[
0
];
}
?>
<a
href=
"
<?php
echo
url_for
(
'@product_show?alias='
.
$group_offers
[
1
][
'alias'
]);
?>
"
style=
"display: block;"
>
<div
class=
"rect_product_card rect_product_card__first"
<?php
echo
(
$image1
?
'style="background-image:url(/u/i/'
.
Page
::
replaceImageSize
(
$image2
,
'L'
)
.
');"'
:
''
);
?>
>
<div
class=
"rect_product_card_info"
>
<span>
<?php
echo
$group_offers
[
1
][
'Offer'
][
0
][
'Translation'
][
$culture
][
'title'
];
?>
</span>
</div>
</div>
</a>
</td>
</tr>
<tr>
<td>
<a
href=
"
<?php
echo
url_for
(
'@catalog_show?alias='
.
$group_cat
->
getAlias
());
?>
"
style=
"display: block;"
>
<div
class=
"rect_product_card"
<?php
echo
(
$group_cat
->
getPhoto
()
?
'style="background-image:url(/u/i/'
.
Page
::
replaceImageSize
(
$group_cat
->
getPhoto
(),
'L'
)
.
');"'
:
''
);
?>
>
<div
class=
"rect_product_card_info special_text"
>
<span>
<?php
echo
$group_cat
[
'Translation'
][
$culture
][
'title'
];
?>
</span>
</div>
</div>
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<?php
}
?>
</div>
</td>
</tr>
<?php
include_component
(
"review"
,
"review"
);
?>
<tr>
<td>
<?php
include_partial
(
"pages/landingArea2"
);
?>
</td>
</tr>
<?php
if
(
$video
)
{
$culture
=
$sf_user
->
getCulture
();
?>
<tr>
<td>
<div
class=
"lending_area_video_and_article max_width"
>
<table
class=
"to_div"
cellspacing=
"0"
cellpadding=
"0"
width=
"100%"
>
<tr>
<?php
echo
'<td width="50%" valign="top">'
;
echo
'<div class="caption"><a class="green_link" href="/'
.
$culture
.
'/video/">'
.
__
(
'Видео'
)
.
'</a></div>'
;
include_partial
(
'video/video'
,
array
(
'videos'
=>
array
(
$video
)));
echo
'</td>'
;
echo
'<td width="50%" valign="top">'
;
echo
'<div class="caption"><a class="green_link" href="/'
.
$culture
.
'/article/">'
.
__
(
'Статьи'
)
.
'</a></div>'
;
include_component
(
'article'
,
'article'
,
array
(
'limit'
=>
3
));
echo
'</td>'
;
echo
'<td>'
;
echo
'<i class="br30"></i>'
;
echo
'</td>'
;
?>
</tr>
</table>
</div>
</td>
</tr>
<?php
}
include_component
(
"partner"
,
"partner"
);
?>
</table>
\ No newline at end of file
apps/www/modules/pages/actions/actions.class.php
0 → 100644
View file @
48680c56
<?php
class
pagesActions
extends
sfActions
{
public
function
executeIndex
(
sfWebRequest
$request
)
{
$this
->
setLayout
(
'layoutHome'
);
}
public
function
executeShow
(
sfWebRequest
$request
)
{
$this
->
page
=
$this
->
getRoute
()
->
getObject
();
}
public
function
executeContacts
(
sfWebRequest
$request
)
{
if
(
$request
->
isMethod
(
'post'
))
{
$text
=
$request
->
getParameter
(
'text'
);
$name
=
$request
->
getParameter
(
'name'
);
if
(
$name
&&
$text
)
{
$newFeedback
=
new
Feedback
();
$newFeedback
->
setAuthorName
(
trim
(
strip_tags
(
$name
)));
$newFeedback
->
setMsg
(
trim
(
strip_tags
(
$text
)));
$newFeedback
->
save
();
sfContext
::
getInstance
()
->
getConfiguration
()
->
loadHelpers
(
'Partial'
);
if
(
$this
->
getUser
()
->
isAuthenticated
())
{
$param
=
array
(
'organization'
=>
$this
->
getUser
()
->
getAccount
()
->
getOrganization
(),
'username'
=>
$this
->
getUser
()
->
getUsername
(),
'text'
=>
trim
(
strip_tags
(
$text
)),
'time'
=>
$newFeedback
->
getCreatedAt
()
);
}
else
{
$param
=
array
(
'organization'
=>
false
,
'username'
=>
false
,
'text'
=>
trim
(
strip_tags
(
$text
)),
'time'
=>
$newFeedback
->
getCreatedAt
()
);
}
get_component
(
'pages'
,
'emailSender'
,
array
(
'type'
=>
'adminNotificationAboutFeedback'
,
'emailTo'
=>
'admin'
,
'param'
=>
$param
)
);
echo
'ok'
;
return
sfView
::
NONE
;
}
}
}
public
function
executeService
(
sfWebRequest
$request
)
{
}
public
function
executePartners
(
sfWebRequest
$request
)
{
}
public
function
executeHow_to_buy
(
sfWebRequest
$request
)
{
}
public
function
executeAbout
(
sfWebRequest
$request
)
{
}
public
function
executeDelivery
(
sfWebRequest
$request
)
{
}
public
function
executeError404
(
sfWebRequest
$request
)
{
$this
->
setLayout
(
'layout404'
);
}
public
function
executeSitemap
(
sfWebRequest
$request
)
{
$this
->
getResponse
()
->
setHttpHeader
(
'Content-type'
,
'text/xml'
);
$this
->
getResponse
()
->
sendHttpHeaders
();
echo
'<?xml version="1.0" encoding="UTF-8"?>'
.
"
\n
"
;
sfApplicationConfiguration
::
getActive
()
->
loadHelpers
(
array
(
'Url'
));
$routes
=
array
(
'homepage'
,
'catalog'
,
'video'
,
'article'
,
'review'
);
echo
'<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">'
;
foreach
(
$routes
as
$route
)
{
$url
=
sfConfig
::
get
(
'app_protocol'
)
.
'://'
.
$request
->
getHost
()
.
url_for
(
'@'
.
$route
);
echo
'<url><loc>'
.
$url
.
'</loc><lastmod>'
.
date
(
'c'
)
.
'</lastmod><priority>1.0</priority></url>'
;
}
$products
=
Doctrine_Query
::
create
()
->
select
(
"p.alias"
)
->
from
(
"Product p"
)
->
where
(
'p.is_delete = 0'
)
->
fetchArray
()
;
foreach
(
$products
as
$product
)
{
$url
=
sfConfig
::
get
(
'app_protocol'
)
.
'://'
.
$request
->
getHost
()
.
url_for
(
'@product_show?alias='
.
$product
[
'alias'
]);
echo
'<url><loc>'
.
$url
.
'</loc><lastmod>'
.
date
(
'c'
)
.
'</lastmod><priority>1.0</priority></url>'
;
}
$catalogs
=
Doctrine_Query
::
create
()
->
select
(
"c.alias"
)
->
from
(
"Cat c"
)
->
fetchArray
()
;
foreach
(
$catalogs
as
$catalog
)
{
$url
=
sfConfig
::
get
(
'app_protocol'
)
.
'://'
.
$request
->
getHost
()
.
url_for
(
'@catalog_show?alias='
.
$catalog
[
'alias'
]);
echo
'<url><loc>'
.
$url
.
'</loc><lastmod>'
.
date
(
'c'
)
.
'</lastmod><priority>1.0</priority></url>'
;
}
$pages
=
Doctrine_Query
::
create
()
->
select
(
"p.alias"
)
->
from
(
"Page p"
)
->
fetchArray
()
;
foreach
(
$pages
as
$page
)
{
$url
=
sfConfig
::
get
(
'app_protocol'
)
.
'://'
.
$request
->
getHost
()
.
url_for
(
'@page_show?alias='
.
$page
[
'alias'
]);
echo
'<url><loc>'
.
$url
.
'</loc><lastmod>'
.
date
(
'c'
)
.
'</lastmod><priority>0.5</priority></url>'
;
}
echo
'</urlset>'
;
return
sfView
::
NONE
;
}
public
function
executeRobots
(
sfWebRequest
$request
)
{
$this
->
getResponse
()
->
setHttpHeader
(
'Content-type'
,
'text/plain'
);
$this
->
getResponse
()
->
sendHttpHeaders
();
$this
->
host
=
sfConfig
::
get
(
'app_protocol'
)
.
'://'
.
$request
->
getHost
();
$this
->
setLayout
(
false
);
}
}
\ No newline at end of file
apps/www/modules/pages/actions/components.class.php
0 → 100644
View file @
48680c56
<?php
class
pagesComponents
extends
sfComponents
{
public
function
executeSubMenu
(
sfWebRequest
$request
)
{
$menu
=
array
(
'Каталог'
=>
'@catalog'
,
'Новости и статьи'
=>
'@news'
,
);
$pagesFromDb
=
Doctrine
::
getTable
(
"Page"
)
->
findAll
();
$this
->
path
=
$request
->
getPathInfo
();
$this
->
menu
=
$menu
;
$this
->
pagesFromDb
=
$pagesFromDb
;
}
public
function
executeEmailSender
(
sfWebRequest
$request
)
{
$type
=
$this
->
type
;
$emailTo
=
$this
->
emailTo
;
$param
=
$this
->
param
;
$mailBody
=
false
;
$subject
=
false
;
if
(
$type
==
'simple'
)
{
// param - mailBody, subject
$subject
=
$param
[
'subject'
];
$mailBody
=
$param
[
'mailBody'
];
}
if
(
$type
==
'userRecoveryPassword'
)
{
// param - secretString
$subject
=
'Востановление пароля'
;
$mailBody
=
get_partial
(
'pages/userRecoveryPasswordLetter'
,
array
(
'secretString'
=>
$param
[
'secretString'
],
'host'
=>
$request
->
getHost
()
)
);
}
if
(
$type
==
'adminNotificationAboutOrder'
)
{
// param - delivery_address, delivery, org, products_order(array), order_id, inn, phone_number
$subject
=
'Оповещение о новом заказе'
;
$mailBody
=
get_partial
(
'pages/adminNotificationAboutOrderLetter'
,
array
(
'delivery_address'
=>
$param
[
'delivery_address'
],
'delivery'
=>
$param
[
'delivery'
],
'org'
=>
$param
[
'org'
],
'comment'
=>
$param
[
'comment'
],
'products_order'
=>
$param
[
'products_order'
],
'order_id'
=>
$param
[
'order_id'
],
'inn'
=>
$param
[
'inn'
],
'phone_number'
=>
$param
[
'phone_number'
],
'host'
=>
$request
->
getHost
()
)
);
}
if
(
$type
==
'adminNotificationAboutFastOrder'
)
{
// param - delivery_address, delivery, phone, products_order(array)
$subject
=
'Новый заказ на сайте "Иди в баню"'
;
$mailBody
=
get_partial
(
'pages/adminNotificationAboutFastOrderLetter'
,
array
(
'delivery_address'
=>
$param
[
'delivery_address'
],
'delivery_type'
=>
$param
[
'delivery_type'
],
'payment_type'
=>
$param
[
'payment_type'
],
'name'
=>
$param
[
'name'
],
'phone'
=>
$param
[
'phone'
],
'order_id'
=>
$param
[
'order_id'
],
'email'
=>
$param
[
'email'
],
'comment'
=>
$param
[
'comment'
],
'products_order'
=>
$param
[
'products_order'
],
'host'
=>
$request
->
getHost
()
)
);
}
if
(
$type
==
'userRegistration'
)
{
// param - organization, username, password
$subject
=
'Доступ к сайту ТриАр'
;
$mailBody
=
get_partial
(
'pages/userRegistrationLetter'
,
array
(
'organization'
=>
$param
[
'organization'
],
'username'
=>
$param
[
'username'
],
'password'
=>
$param
[
'password'
],
'host'
=>
$request
->
getHost
()
)
);
}
if
(
$type
==
'adminNotificationAboutReg'
)
{
// param - organization, username, email, address, city, phone_number
$subject
=
'Заявка на регистрацию'
;
$mailBody
=
get_partial
(
'pages/adminNotificationAboutRegLetter'
,
array
(
'organization'
=>
$param
[
'organization'
],
'username'
=>
$param
[
'username'
],
'email'
=>
$param
[
'email'
],
'address'
=>
$param
[
'address'
],
'city'
=>
$param
[
'city'
],
'phone_number'
=>
$param
[
'phone_number'
],
'host'
=>
$request
->
getHost
()
)
);
}
if
(
$type
==
'adminNotificationAboutFeedback'
)
{
// param - organization, username, text, time
$subject
=
'Обратная связь'
;
$mailBody
=
get_partial
(
'pages/adminNotificationAboutFeedbackLetter'
,
array
(
'organization'
=>
$param
[
'organization'
],
'username'
=>
$param
[
'username'
],
'text'
=>
$param
[
'text'
],
'time'
=>
$param
[
'time'
],
'host'
=>
$request
->
getHost
()
)
);
}
//sending
if
(
$mailBody
&&
$emailTo
)
{
$message
=
Swift_Message
::
newInstance
();
if
(
$type
==
'simple'
)
{
$content_type
=
'pain'
;
}
else
{
$content_type
=
'html'
;
}
if
(
$request
->
getHost
())
{
$from
=
'noreply@'
.
$request
->
getHost
();
}
else
{
$from
=
sfConfig
::
get
(
'app_email_from'
);
}
$message
->
setFrom
(
$from
)
->
setContentType
(
'text/'
.
$content_type
.
', charset = utf-8'
);
if
(
$subject
)
{
$message
->
setSubject
(
$subject
);
}
else
{
$message
->
setSubject
(
'Сайт'
);
}
$message
->
setBody
(
$mailBody
);
if
(
$emailTo
==
'admin'
)
{
$admin_emails
=
Doctrine
::
getTable
(
"NotificationEmails"
)
->
findByIsActive
(
1
);
$emails_array
=
array
();
foreach
(
$admin_emails
as
$email
)
{
$emails_array
[]
=
$email
->
getEmail
();
}
$message
->
setTo
(
$emails_array
);
}
else
{
$message
->
setTo
(
$emailTo
);
}
$this
->
getMailer
()
->
send
(
$message
);
file_put_contents
(
sfConfig
::
get
(
'sf_log_dir'
)
.
'/mail.log'
,
date
(
'Y-m-d H:i:s'
)
.
' mail send from '
.
$from
.
' to '
.
$emailTo
.
"
\n\r
"
,
FILE_APPEND
);
}
return
sfView
::
NONE
;
}
}
\ No newline at end of file
apps/www/modules/pages/templates/_adminNotificationAboutFastOrderLetter.php
0 → 100644
View file @
48680c56
<?php
//include_partial('pages/headerLetter', array('host' => $host));
?>
<style>
table
{
border-collapse
:
collapse
;
border
:
1px
solid
#9ac962
}
table
tr
td
{
border
:
1px
solid
#9ac962
;
padding
:
5px
;
}
table
.head
td
{
font-size
:
12px
;
text-align
:
center
;
}
</style>
<br
/>
Заказ №
<?php
echo
$order_id
?>
<br
/>
<br
/>
Имя клиента:
<?php
echo
$name
?>
<br
/>
Email клиента:
<?php
echo
$email
?>
<br
/>
Номер телефона клиента:
<?php
echo
$phone
?>
<br
/>
<?php
echo
$delivery_type
==
'Самовывоз'
?
'Самовывоз'
:
'Доставка: '
.
$delivery_address
?>
<br
/>
Тип оплаты:
<?php
echo
$payment_type
?>
<br
/>
</div>
Состав заказа:
<br
/>
<br
/>
<table
cellpadding=
"5"
cellspacing=
"0"
border=
"1"
style=
"border-color:#9ac962"
>
<tr
class=
"head"
>
<td>
Продукт
</td>
<td>
Цена
</td>
<td>
Кол-во
</td>
<td>
Итог
</td>
</tr>
<?php
foreach
(
$products_order
[
'elem'
]
as
$product
)
{
echo
'<tr>'
;
echo
'<td>'
;
echo
$product
[
'name'
];
echo
'</td>'
;
echo
'<td>'
;
echo
$product
[
'price'
]
.
'руб.'
;
echo
'</td>'
;
echo
'<td>'
;
echo
$product
[
'count'
];
echo
'</td>'
;
echo
'<td>'
;
echo
$product
[
'price'
]
*
$product
[
'count'
]
.
'руб.'
;
echo
'</td>'
;
echo
'</tr>'
;
}
?>
</table>
<br
/>
<b>
Сумма заказа:
<?php
echo
$products_order
[
'sum'
]
?>
руб.
</b>
<?php
if
(
$comment
)
{
echo
'Комментарий к заказу: '
.
$comment
.
'<br />'
;
}
?>
\ No newline at end of file
apps/www/modules/pages/templates/_adminNotificationAboutFeedbackLetter.php
0 → 100644
View file @
48680c56
<?php
include_partial
(
'pages/headerLetter'
,
array
(
'host'
=>
$host
));
?>
<br
/>
На сайте появился обратный отзыв.
<br
/><br
/>
<?php
if
(
$username
!=
false
&&
$organization
!=
false
)
{
?>
Организация:
<?php
echo
$organization
?>
<br
/>
Инн:
<?php
echo
$username
?>
<br
/>
<?php
}
?>
Текст:
<br
/>
<?php
echo
$text
?>
<br
/>
Время:
<?php
echo
$time
?>
<br
/>
\ No newline at end of file
apps/www/modules/pages/templates/_adminNotificationAboutOrderLetter.php
0 → 100644
View file @
48680c56
<?php
include_partial
(
'pages/headerLetter'
,
array
(
'host'
=>
$host
));
?>
<style>
table
{
border-collapse
:
collapse
;
border
:
1px
solid
#9ac962
}
table
tr
td
{
border
:
1px
solid
#9ac962
;
padding
:
5px
;
}
table
.head
td
{
font-size
:
12px
;
text-align
:
center
;
}
</style>
<br
/>
Новый заказ на сайте
<br
/>
<br
/>
Доставка:
<?php
echo
$delivery
?
$delivery_address
:
'Самовывоз'
?>
<br
/>
Организация:
<?php
echo
$org
?>
<br
/>
ИНН:
<?php
echo
$inn
?>
<br
/>
Телефон:
<?php
echo
$phone_number
?>
<br
/>
Номер заказа:
<?php
echo
$order_id
?>
<br
/>
<?php
if
(
$comment
)
{
echo
'Комментарий к заказу: '
.
$comment
.
'<br />'
;
}
?>
<br
/>
<div
style=
"width: 100%; height: 1px; background-color: #9ac962"
>
</div>
<br
/>
Состав заказа:
<br
/>
<br
/>
<table
cellpadding=
"5"
cellspacing=
"0"
border=
"1"
style=
"border-color:#9ac962"
>
<tr
class=
"head"
>
<td>
Продукт
</td>
<td>
Цена
</td>
<td>
Кол-во
</td>
<td>
Итог
</td>
</tr>
<?php
foreach
(
$products_order
[
'elem'
]
as
$product
)
{
echo
'<tr>'
;
echo
'<td>'
;
echo
$product
[
'name'
];
echo
'</td>'
;
echo
'<td>'
;
echo
$product
[
'price'
]
.
'руб.'
;
echo
'</td>'
;
echo
'<td>'
;
echo
$product
[
'count'
];
echo
'</td>'
;
echo
'<td>'
;
echo
$product
[
'price'
]
*
$product
[
'count'
]
.
'руб.'
;
echo
'</td>'
;
echo
'</tr>'
;
}
?>
</table>
<br
/>
<b>
Сумма заказа:
<?php
echo
$products_order
[
'sum'
]
?>
руб.
</b>
apps/www/modules/pages/templates/_adminNotificationAboutRegLetter.php
0 → 100644
View file @
48680c56
<?php
include_partial
(
'pages/headerLetter'
,
array
(
'host'
=>
$host
));
?>
<br
/>
Новый пользователь желает зарегестрирваться.
<br
/><br
/>
Он указал следующие данные:
<br
/>
Организация:
<?php
echo
$organization
?>
<br
/>
Инн:
<?php
echo
$username
?>
<br
/>
Email:
<?php
echo
$email
?>
<br
/>
Адрес:
<?php
echo
$address
?>
<br
/>
Город:
<?php
echo
$city
?>
<br
/>
Номер телефона:
<?php
echo
$phone_number
?>
\ No newline at end of file
Prev
1
…
8
9
10
11
12
13
14
15
16
…
18
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment