Commit 9f4f2745 authored by Игорь's avatar Игорь
Browse files

init

parent a765cdc4
<?php
/**
* statistic module configuration.
*
* @package sf
* @subpackage statistic
* @author Atma
* @version SVN: $Id: configuration.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class statisticGeneratorConfiguration extends BaseStatisticGeneratorConfiguration
{
}
<?php
/**
* statistic module helper.
*
* @package sf
* @subpackage statistic
* @author Atma
* @version SVN: $Id: helper.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class statisticGeneratorHelper extends BaseStatisticGeneratorHelper
{
}
<?php if (!$pager->getNbResults()): ?>
<div class="lui__list_empty">Нет элементов</div>
<?php else: ?>
<table width="100%" cellspacing="0" cellpadding="3" border="0" class="lui__list_table<?php echo (isset($_partial_no_scroll) && $_partial_no_scroll === true ? '' : ' lui__list_table_donor lui__list_table__sourse'); ?>" id="<?php echo (isset($_partial_no_scroll) && $_partial_no_scroll === true ? '' : 'lui__list_table_donor'); ?>">
<thead>
<tr>
<!-- <th id="sf_admin_list_batch_actions" class="sf_admin_batch_checkbox__td"><input id="sf_admin_list_batch_checkbox" type="checkbox" onclick="$('.sf_admin_batch_checkbox').prop('checked', $(this).is(':checked'));" /></th>-->
<?php include_partial('statistic/list_th_tabular', array('sort' => $sort, '_partial_filters' => (isset($_partial_filters) ? $_partial_filters : array()), '_partial' => $_partial)) ?>
<th id="sf_admin_list_th_actions">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
$e_count = Doctrine_Query::create()
->select("e.*")
->from("Export e")
->count();
$b_count = Doctrine_Query::create()
->select("e.*")
->from("Export e")
->where("e.logic_type = 'bid'")
->count();
$w_count = Doctrine_Query::create()
->select("e.*")
->from("Export e")
->where("e.logic_type = 'wait'")
->count();
$baw_count = Doctrine_Query::create()
->select("e.*")
->from("Export e")
->where("e.logic_type = 'bid_after_wait'")
->count();
$u_count = Doctrine_Query::create()
->select("u.*")
->from("User u")
->where("u.is_super_admin = '0'")
->count();
$ub_count = Doctrine_Query::create()
->select("u.*")
->from("User u")
->leftJoin("u.Export e")
->where("u.is_super_admin = '0'")
->andWhere("e.logic_type = 'bid'")
->count();
$uw_count = Doctrine_Query::create()
->select("u.*")
->from("User u")
->leftJoin("u.Export e")
->where("u.is_super_admin = '0'")
->andWhere("e.logic_type = 'wait'")
->count();
$ubaw_count = Doctrine_Query::create()
->select("u.*")
->from("User u")
->leftJoin("u.Export e")
->where("u.is_super_admin = '0'")
->andWhere("e.logic_type = 'bid_after_wait'")
->count();
?>
<tr class="sf_admin_row odd sf_admin_row_custom" data-href="" valign="top">
<td class="sf_admin_enum sf_admin_list_td_logic_type">Заявки «Будут копить»</td>
<td class="sf_admin_text sf_admin_list_td_weight"><?php echo $w_count . " из " . $e_count;?></td>
<td></td>
</tr>
<tr class="sf_admin_row even " data-href="" valign="top">
<td class="sf_admin_enum sf_admin_list_td_logic_type">Заявки «Накопили объём»</td>
<td class="sf_admin_text sf_admin_list_td_weight"><?php echo $baw_count . " из " . $e_count;?></td>
<td></td>
</tr>
<tr class="sf_admin_row odd sf_admin_row_custom" data-href="" valign="top">
<td class="sf_admin_enum sf_admin_list_td_logic_type">Заявки «Оставили заявку на вывоз»</td>
<td class="sf_admin_text sf_admin_list_td_weight"><?php echo $b_count . " из " . $e_count;?></td>
<td></td>
</tr>
<tr class="sf_admin_row even sf_admin_row_custom" data-href="" valign="top">
<td class="sf_admin_enum sf_admin_list_td_logic_type">Пользователи «Будут копить»</td>
<td class="sf_admin_text sf_admin_list_td_weight"><?php echo $uw_count . " из " . $u_count;?></td>
<td></td>
</tr>
<tr class="sf_admin_row odd sf_admin_row_custom" data-href="" valign="top">
<td class="sf_admin_enum sf_admin_list_td_logic_type">Пользователи «Накопили объём»</td>
<td class="sf_admin_text sf_admin_list_td_weight"><?php echo $ubaw_count . " из " . $u_count;?></td>
<td></td>
</tr>
<tr class="sf_admin_row even sf_admin_row_custom" data-href="" valign="top">
<td class="sf_admin_enum sf_admin_list_td_logic_type">Пользователи «Оставили заявку на вывоз»</td>
<td class="sf_admin_text sf_admin_list_td_weight"><?php echo $ub_count . " из " . $u_count;?></td>
<td></td>
</tr>
<!-- --><?php //$notice_ids = (class_exists(Export) && method_exists(Export, 'getNoticeIds')) ? Export::getNoticeIds() : array();?>
<!-- --><?php //foreach ($pager->getResults() as $i => $export): $odd = fmod(++$i, 2) ? 'odd' : 'even' ?>
<!-- <tr class="sf_admin_row --><?php //echo $odd ?><!-- --><?php //echo (in_array($export->getId(), $notice_ids) ? 'sf_admin_row_notice' : '') ?><!-- --><?php //echo !$sf_user->hasCredential('statistic_edit') ? ' sf_admin_tr_stop' : ''?><!--" valign="top" data-href="--><?php //echo ($_partial && (!isset($_partial_no_scroll) || $_partial_no_scroll === false) ? '?_spath=' : '') . url_for('export/edit?id=' . $export->getPrimaryKey() . (isset($_partial_no_scroll) && $_partial_no_scroll === true ? '&return=' . $sf_request->getUri() : ''));?><!--">-->
<!-- --><?php ////include_partial('statistic/list_td_batch_actions', array('export' => $export, 'helper' => $helper)) ?>
<!-- --><?php //include_partial('statistic/list_td_tabular', array('export' => $export, '_partial_filters' => (isset($_partial_filters) ? $_partial_filters->getRawValue() : array()), '_partial' => $_partial)) ?>
<!-- <td>-->
<!-- --><?php ////include_partial('statistic/list_td_actions', array('export' => $export, 'helper' => $helper)) ?>
<!-- </td>-->
<!-- </tr>-->
<!-- --><?php //endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<?php //include_partial('statistic/list_footer', array('export' => $export, 'helper' => $helper)) ?>
<style type="text/css">
.lui__list_actions__wrapper{
display: none;
}
.sf_admin_row_custom{
cursor: default;
}
</style>
\ No newline at end of file
<?php
require_once dirname(__FILE__) . '/../lib/userGeneratorConfiguration.class.php';
require_once dirname(__FILE__) . '/../lib/userGeneratorHelper.class.php';
/**
* user actions.
*
* @package sf
* @subpackage user
* @author Atma
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class userActions extends autoUserActions
{
protected function buildQuery()
{
$query = parent::buildQuery()
->andWhere("r.username <> 'root'");
return $query;
}
public function executeNew(sfWebRequest $request)
{
$this->form = $this->configuration->getForm();
if((int)$this->getTab() === 2){
$this->form->setDefault('is_super_admin', true);
}
$this->setPartialFilter();
$this->user = $this->form->getObject();
}
public function executeEdit(sfWebRequest $request)
{
$this->user = $this->getRoute()->getObject();
$this->forward404Unless($this->user->getUsername() !== 'root');
$this->forward404Unless($this->getUser()->getUsername() === 'root' || !$this->user->getIsSuperAdmin());
$user = $this->getUser();
$this->form = $this->configuration->getForm($this->user);
$this->setPartialFilter();
}
public function executeUpdate(sfWebRequest $request)
{
$this->user = $this->getRoute()->getObject();
$this->forward404Unless($this->user->getUsername() !== 'root');
$this->forward404Unless($this->getUser()->getUsername() === 'root' || !$this->user->getIsSuperAdmin());
$this->form = $this->configuration->getForm($this->user);
$this->setPartialFilter();
$user = $this->getUser();
$this->processForm($request, $this->form);
$this->setTemplate('edit');
}
public function executeDelete(sfWebRequest $request)
{
$this->dispatcher->notify(new sfEvent($this, 'admin.delete_object', array('object' => $this->getRoute()->getObject())));
$user = $this->getUser();
$object = $this->getRoute()->getObject();
$this->forward404Unless($object->getUsername() !== 'root');
$this->forward404Unless($this->getUser()->getUsername() === 'root' || !$object->getIsSuperAdmin());
if ($object->delete())
{
if(!$request->isXmlHttpRequest())
{
$this->getUser()->setFlash('notice', 'The item was deleted successfully.');
}
}
if(!$request->isXmlHttpRequest())
{
$redirect_url = (isset($this->_partial) ? $_SERVER['DOCUMENT_URI'] . '?_spath=' : '') . $this->generateUrl('user');
$this->redirect($redirect_url);
}
else
{
return sfView::NONE;
}
}
protected function executeBatchDelete(sfWebRequest $request)
{
$ids = $request->getParameter('ids');
$records = Doctrine_Query::create()
->from('User')
->whereIn('id', $ids)
->execute();
foreach ($records as $record)
{
if($record->getUsername() !== 'root' && ($this->getUser()->getUsername() === 'root' || !$record->getIsSuperAdmin())){
$record->delete();
}
}
$this->getUser()->setFlash('notice', 'The selected items have been deleted successfully.');
$redirect_url = (isset($this->_partial) ? $_SERVER['DOCUMENT_URI'] . '?_spath=' : '') . $this->generateUrl('user');
$this->redirect($redirect_url);
}
}
generator:
class: sfDoctrineGenerator
param:
model_class: User
theme: admin
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: user
with_doctrine_route: true
actions_base_class: sfActions
order: 16000
config:
actions: ~
fields:
id: {label: 'ID'}
username: {label: 'Логин'}
name: {label: 'Имя'}
email: {label: 'Эл. почта'}
phone: {label: 'Телефон'}
salt: {label: ''}
password: {label: 'Пароль'}
is_active: {label: 'Активирован (почта подтверждена)'}
status: {label: 'Статус'}
block_reason: {label: 'Причина блокировки'}
is_super_admin: {label: 'Доступ в АРМ'}
last_login: {label: 'Последний визит'}
created_info: {label: 'Зарегистрирован'}
created_at: {label: 'Зарегистрирован'}
updated_at: {label: ''}
user_group_list: {label: 'Группа'}
deleted_at: {label: 'Удалён'}
address: {label: 'Адрес'}
is_blocked: {label: 'Заблокирован навсегда', help: 'Если передумаете - галочку всегда можно убрать'}
list:
layout: ~
title: 'Учётные записи'
display: [name, phone, email, last_login, _created_at]
max_per_page: 100
object_actions:
_delete: ~
_edit: ~
search:
fields: [name, email, phone]
export: false
filter:
class: false
form: ~
edit:
title: Редактирование учётной записи
new:
title: Новая учётная запись
tabs:
0: {label: 'Все'}
1: {label: 'Пользователи', where: "r.is_super_admin = 0"}
2: {label: 'Администраторы', where: "r.is_super_admin = 1"}
\ No newline at end of file
<?php
/**
* user module configuration.
*
* @package sf
* @subpackage user
* @author Atma
* @version SVN: $Id: configuration.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class userGeneratorConfiguration extends BaseUserGeneratorConfiguration
{
}
<?php
/**
* user module helper.
*
* @package sf
* @subpackage user
* @author Atma
* @version SVN: $Id: helper.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class userGeneratorHelper extends BaseUserGeneratorHelper
{
}
<?php
echo $user->getCreatedAt();
if($user->getSocial()){
echo '<br>' . $user->getSocial();
}
\ No newline at end of file
<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>
<?php echo form_tag_for($form, '@user') ?>
<div id="lui_scroller" class="lui__scroller_class">
<div class="lui__scroller_wrapper" style="position:relative;z-index:102;padding-left:10px;">
<?php foreach ($configuration->getFormFields($form, $form->isNew() ? 'new' : 'edit') as $fieldset => $fields): ?>
<?php include_partial('user/form_fieldset', array('groups' => $groups, 'form' => $form, 'fields' => $fields, 'fieldset' => $fieldset)) ?>
<?php endforeach; ?>
<?php
// include_component('permission', 'map', array('form' => $form));
?>
</div>
</div>
</form>
<script type="text/javascript" class="ajax_eval">
var check_is_admin = function () {
if ($('#user_is_super_admin').is(':checked')) {
$('#user_password,#user_email').parent().parent().find('label').css('font-weight', 'bold');
$('.user_permission_map,.sf_admin_form_row_user_division, .sf_admin_form_field_user_group_list').show();
} else {
$('#user_password,#user_email').parent().parent().find('label').css('font-weight', 'normal');
$('.user_permission_map,.sf_admin_form_row_user_division, .sf_admin_form_field_user_group_list').hide();
}
};
check_is_admin();
$('#user_is_super_admin').click(check_is_admin);
/*var userStatus = $('#user_status');
userStatus.change(function(event){
$('.sf_admin_form_field_block_reason').css('display', (event.target.value == 'Заблокирован' ? 'inline-block' : 'none'));
});
$(document).ready(function(){
userStatus.change();
});*/
</script>
<style type="text/css">
/*.sf_admin_form_field_fname,
.sf_admin_form_field_iname,
.sf_admin_form_field_oname{
display:inline-block;
vertical-align:top;
}*/
</style>
\ No newline at end of file
<?php
//if(!$form->isNew()){
// $obj = $form->getObject();
// ?>
<!-- <div class="sf_admin_form_row">-->
<!-- <div class="fs_18">Временные блокировки:</div>-->
<!-- <div class="content">--><?php
// $blocking_count = Doctrine_Query::create()
// ->from("Blocking")
// ->where("user_id = " . $obj->getId())
// ->count();
// if($blocking_count > 0){
// echo 'Получено блокировок: ' . $blocking_count . ' <a target="_blank" onclick="event.stopPropagation();" class="lui_pseudo" href="/arm/blocking/filter?blocking_filters[user_id]=' . $obj->getId() . '">Открыть блокировки</a>';
// }else{
// echo 'Нет блокировок';
// }
// ?><!--</div>-->
<!-- <i class="br5"></i><a target="_blank" onclick="event.stopPropagation();" class="lui_pseudo" href="/arm/blocking/new?user_id=--><?php //echo $obj->getId();?><!--">Создать блокировку</a>-->
<!-- </div>-->
<!-- <div class="sf_admin_form_row">-->
<!-- <div class="fs_18">Обратная связь:</div>-->
<!-- <div class="content">--><?php
// $callback_count = Doctrine_Query::create()
// ->from("Callback")
// ->where("user_id = " . $obj->getId())
// ->count();
// if($callback_count > 0){
// echo 'Получено обращений: ' . $callback_count . ' <a target="_blank" onclick="event.stopPropagation();" class="lui_pseudo" href="/arm/callback/filter?callback_filters[user_id]=' . $obj->getId() . '">Открыть обращения</a>';
// }else{
// echo 'Нет обращений';
// }
// ?><!--</div>-->
<!-- </div>-->
<!-- <div class="sf_admin_form_row">-->
<!-- <div class="fs_18">Заказчик:</div>-->
<!-- <div style="background-color: #D8D8D8;height: 1px;margin:5px 0 10px 0;"></div>-->
<!-- <div class="content">--><?php
// $orders_count = Doctrine_Query::create()
// ->from("ClientOrder")
// ->where("user_id = " . $obj->getId())
// ->andWhere("is_payed = 1")
// ->count();
// if($orders_count > 0){
// echo 'Сделано заказов: ' . $orders_count . ' <a target="_blank" onclick="event.stopPropagation();" class="lui_pseudo" href="/arm/client_order/filter?client_order_filters[user_id]=' . $obj->getId() . '">Открыть заказы</a>';
// }else{
// echo 'Не сделал ни одного заказа';
// }
// ?><!--</div>-->
<!-- </div>-->
<!-- <div class="sf_admin_form_row">-->
<!-- Добавлено проблем: --><?php
// $client_problem_count = Doctrine_Query::create()
// ->from("ClientProblem")
// ->where("client_id = " . $obj->getId())
// ->count();
// echo $client_problem_count;
// if($client_problem_count > 0){
// echo ' <a target="_blank" onclick="event.stopPropagation();" class="lui_pseudo" href="/arm/client_problem/filter?client_problem_filters[client_id]=' . $obj->getId() . '">Открыть проблемы</a>';
// }
// ?>
<!-- </div>-->
<!-- <div class="sf_admin_form_row">-->
<!-- <div class="fs_18">Курьер:</div>-->
<!-- <div style="background-color: #D8D8D8;height: 1px;margin:5px 0 10px 0;"></div>-->
<!-- <div class="content">--><?php
// $orders_count = Doctrine_Query::create()
// ->from("ClientOrderItem")
// ->where("courier_id = " . $obj->getId())
// ->andWhere("completed IS NOT NULL")
// ->count();
// if($orders_count > 0){
// echo 'Завершено выносов: ' . $orders_count . ' <a target="_blank" onclick="event.stopPropagation();" class="lui_pseudo" href="/arm/client_order_item/filter?client_order_item_filters[courier_id]=' . $obj->getId() . '">Открыть выносы</a>';
// }else{
// echo 'Не сделал ни одного выноса';
// }
// ?><!--</div>-->
<!-- </div>-->
<!-- <div class="sf_admin_form_row">-->
<!-- Добавлено проблем: --><?php
// $courier_problem_count = Doctrine_Query::create()
// ->from("CourierProblem")
// ->where("courier_id = " . $obj->getId())
// ->count();
// echo $courier_problem_count;
// if($courier_problem_count > 0){
// echo ' <a target="_blank" onclick="event.stopPropagation();" class="lui_pseudo" href="/arm/courier_problem/filter?courier_problem_filters[courier_id]=' . $obj->getId() . '">Открыть проблемы</a>';
// }
// ?>
<!-- </div>-->
<!-- <div class="sf_admin_form_row">-->
<!-- Заработано всего: --><?php //echo $obj['courier_money_total'];?><!--&nbsp;₽-->
<!-- </div>-->
<!-- <div class="sf_admin_form_row">-->
<!-- Доступно к выводу: --><?php //echo $obj['courier_money_available'];?><!--&nbsp;₽-->
<!-- </div>-->
<!-- --><?php
//}
\ No newline at end of file
<?php
require_once dirname(__FILE__) . '/../lib/user_groupGeneratorConfiguration.class.php';
require_once dirname(__FILE__) . '/../lib/user_groupGeneratorHelper.class.php';
/**
* groups actions.
*
* @package sf
* @subpackage groups
* @author Atma
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class user_groupActions extends autoUser_groupActions
{
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
$notice = $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.';
try {
$user_group = $form->save();
$values = $request->hasParameter('user_group_permissions') && is_array($request->getParameter('user_group_permissions')) ? $request->getParameter('user_group_permissions') : array();
$existing = ProjectUtils::arrayKeysFilter($user_group->getUserGroupPermissions(), 'id');
$unlink = array_diff($existing, $values);
if (count($unlink) > 0) {
$q = Doctrine_Query::create()
->delete("r.*")
->from("UserGroupPermissions r")
->whereIn("r.permission_id", array_values($unlink))
->andWhere("r.user_group_id= ?", $user_group->getId())
->execute();
}
$link = array_diff($values, $existing);
if (count($link) > 0) {
foreach ($link as $id) {
$user_group_permissions = new UserGroupPermissions();
$user_group_permissions->setPermissionId($id);
$user_group_permissions->setUserGroupId($user_group->getId());
$user_group_permissions->save();
}
}
} catch (Doctrine_Validator_Exception $e) {
$errorStack = $form->getObject()->getErrorStack();
$message = get_class($form->getObject()) . ' has ' . count($errorStack) . " field" . (count($errorStack) > 1 ? 's' : null) . " with validation errors: ";
foreach ($errorStack as $field => $errors) {
$message .= "$field (" . implode(", ", $errors) . "), ";
}
$message = trim($message, ', ');
$this->getUser()->setFlash('error', $message);
return sfView::SUCCESS;
}
$this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $user_group)));
if ($request->hasParameter('_save_and_add')) {
$this->getUser()->setFlash('notice', $notice . ' You can add another one below.');
$this->redirect('@user_group');
} elseif ($request->hasParameter('_save_and_list')) {
$this->redirect('@user_group');
} else {
if (!$request->isXmlHttpRequest()) {
$this->getUser()->setFlash('notice', $notice);
$this->redirect(array('sf_route' => 'user_group_edit', 'sf_subject' => $user_group));
}
}
} else {
$this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
$this->getResponse()->addHttpMeta('Sf-Form-Error', '1', true);
}
}
}
generator:
class: sfDoctrineGenerator
param:
model_class: UserGroup
theme: admin
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: user_group
with_doctrine_route: true
actions_base_class: sfActions
order: 17000
hr: true
skip: true
config:
actions: ~
fields:
id: {label: 'ID'}
title: {label: Название}
created_at: {label: ''}
updated_at: {label: ''}
user_count: {label: 'В группе'}
user_list: {label: 'Состав группы'}
user_group_users_list: {label: 'Состав группы'}
list:
layout: ~
title: 'Группы пользователей'
display: [title, _user_count]
max_per_page: 100
object_actions:
_delete: ~
_edit: ~
search:
fields: [title]
filter:
class: false
form: ~
edit:
title: Редактирование группы
new:
title: Добавление группы пользователей
\ No newline at end of file
<?php
/**
* user_group module configuration.
*
* @package sf
* @subpackage user_group
* @author Atma
* @version SVN: $Id: configuration.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class user_groupGeneratorConfiguration extends BaseUser_groupGeneratorConfiguration
{
}
<?php
/**
* user_group module helper.
*
* @package sf
* @subpackage user_group
* @author Atma
* @version SVN: $Id: helper.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class user_groupGeneratorHelper extends BaseUser_groupGeneratorHelper
{
}
<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>
<?php echo form_tag_for($form, '@user_group') ?>
<div id="lui_scroller" class="lui__scroller_class">
<div class="lui__scroller_wrapper" style="position:relative;z-index:102;padding-left:10px;">
<?php foreach ($configuration->getFormFields($form, $form->isNew() ? 'new' : 'edit') as $fieldset => $fields): ?>
<?php include_partial('user_group/form_fieldset', array('groups' => $groups, 'form' => $form, 'fields' => $fields, 'fieldset' => $fieldset)) ?>
<?php endforeach; ?>
<?php
include_component('permission', 'map', array('form' => $form));
?>
</div>
</div>
</form>
<?php
echo Doctrine_Query::create()
->from("UserGroupUsers")
->where("user_group_id = " . $user_group->getId())
->count();
\ No newline at end of file
<?php
require_once dirname(__FILE__).'/../lib/user_logGeneratorConfiguration.class.php';
require_once dirname(__FILE__).'/../lib/user_logGeneratorHelper.class.php';
/**
* user_log actions.
*
* @package sf
* @subpackage user_log
* @author Atma
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class user_logActions extends autoUser_logActions
{
// @title Восстановление
public function executeReturn(sfWebRequest $request)
{
$user_log = $this->getRoute()->getObject();
$object = unserialize($user_log->getLog());
$model = $user_log->getModel();
$modelr = new $model();
foreach($object->getData() as $key => $value)
{
echo $method = 'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key)));
echo '<br />';
//$modelr->$method($value);
}
die();
$modelr->save();
$user_log->setLogType('return');
$user_log->save();
$this->redirect('@user_log');
}
}
generator:
class: sfDoctrineGenerator
param:
model_class: UserLog
theme: admin
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: user_log
with_doctrine_route: true
actions_base_class: sfActions
order: 10000
skip: true
config:
actions: ~
fields:
id: {label: ''}
user_id: {label: 'Пользователь'}
user: {label: 'Пользователь'}
log_type: {label: 'Действие'}
model: {label: 'Объект'}
log: {label: 'Изменения'}
created_at: {label: 'Дата'}
updated_at: {label: ''}
list:
layout: ~
title: 'Журнал действий'
display: [user, log_type, model, _log, created_at]
max_per_page: 100
sort: [created_at, desc]
actions: ~
object_actions: ~
search:
fields: false
export: false
filter:
class: false
form: ~
edit:
title: Просмотр действия
new:
title: Добавление
\ No newline at end of file
<?php
/**
* user_log module configuration.
*
* @package sf
* @subpackage user_log
* @author Atma
* @version SVN: $Id: configuration.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class user_logGeneratorConfiguration extends BaseUser_logGeneratorConfiguration
{
public function getListActions()
{
return array();
}
public function getListBatchActions()
{
return array();
}
}
<?php
/**
* user_log module helper.
*
* @package sf
* @subpackage user_log
* @author Atma
* @version SVN: $Id: helper.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class user_logGeneratorHelper extends BaseUser_logGeneratorHelper
{
}
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