actions.class.php 1.31 KB
Newer Older
Яков's avatar
first  
Яков committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php

require_once dirname(__FILE__) . '/../lib/product_propGeneratorConfiguration.class.php';
require_once dirname(__FILE__) . '/../lib/product_propGeneratorHelper.class.php';

/**
 * product_prop actions.
 *
 * @package    sf
 * @subpackage product_prop
 * @author     Atma
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class product_propActions extends autoProduct_propActions
{
    protected function buildQuery()
    {
        $query = parent::buildQuery();
        $query->leftJoin("r.Translation t");
        return $query;
    }

    public function executeAjax_delete(sfWebRequest $request)
    {
        if ($request->hasParameter('id')) {
            $id = $request->getParameter('id');
            $elem = Doctrine::getTable("ProductPropList")->find($id);
            if ($elem) {
                $elem->delete();
                $response['status'] = 'success';
            } else {
                $response['status'] = 'error';
                $response['errorText'] = 'Не удалось удалить обьект';
            }

        } else {
            $response['status'] = 'error';
            $response['errorText'] = 'Не переданы необходимые параметры';
        }

        echo json_encode($response);

        return sfView::NONE;
    }
}