_leftMenu.php 7.41 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<li style="padding: 0px;"><i class="br15"></i></li>
<style>
    .close {
        display: none; padding-left: 5px;
    }
    .open {
        padding-left:0px;margin:0;margin-top:5px;
    }
</style>

<?php

$open = $sf_data->getRaw('open');

$li_class = 'unselected';
if ($path == url_for('@catalog_special?type=sale') && count($open) == 0)
{
    $li_class = 'selected';
}


$special_sale_count = Doctrine_Query::create()
    ->select("COUNT(p.id)")
    ->from("Product p")
    ->where("p.sell_out = 1")
    ->andWhere('p.deleted_at is null')
    ->fetchArray();

if ($special_sale_count[0]['COUNT'] > 0)
{

    ?>

    <li class="special_sale <?php echo $li_class ?>"><a href="<?php echo url_for('@catalog_special?type=sale') ?>" style="color:#d57575;border-color:rgba(255,131,24,0.3);"><span>% Распродажа</span></a></li>

    <?php

}

foreach ($menu as $elem)
{

    $li_class = 'unselected';
    if (in_array($elem['id'], $open))
    {
        $li_class = 'selected';
    }
    echo '<li class="' . $li_class . '">';
    echo '<a href="' . url_for('@catalog_show_cat?alias=' . $elem['alias']) . '"><span>' . Page::niceTitleView($elem['title']) .'</span></a>';
//    if ($elem['Children'])
//    {
//
//        $ul_class = 'close';
//        if (in_array($elem['id'], $open))
//        {
//            $ul_class = 'open';
//        }
//        echo '<ul class="fs_13 ' . $ul_class . '">';
//        foreach ($elem['Children'] as $child)
//        {
//            $li_current_class = 'uncurrent';
//            if (in_array($child['id'], $open) && count($child['Children']) == 0)
//            {
//                $li_current_class = 'current';
//            }
//            echo '<li class="' . $li_current_class . '">';
//            echo '<a href="' . url_for('@catalog_show_cat?alias=' . $child['alias']) . '">' . Page::niceTitleView($child['title']) . '</a>';
//            if ($child['Children'])
//            {
//                // дети детей
//                $ul_class = 'close';
//                if (in_array($child['id'], $open))
//                {
//                    $ul_class = 'open';
//                }
//                echo '<ul class="fs_13 ' . $ul_class . '">';
//                foreach ($child['Children'] as $grandchildren)
//                {
//
//                    $li_class = 'uncurrent';
//                    $a_class = 'unselected';
//                    if (in_array($grandchildren['id'], $open) && count($grandchildren['Children']) == 0)
//                    {
//                        $li_class = 'current';
//                        $a_class = 'selected';
//                    }
//
//                    echo '<li class="' . $li_class . '">';
//                    echo '<a class="' . $a_class . '" href="' . url_for('@catalog_show_cat?alias=' . $grandchildren['alias']) . '">' . Page::niceTitleView($grandchildren['title']) . '</a>';
//                    ////
//                    if ($grandchildren['Children'])
//                    {
//                        // дети детей, детей
//                        $ul_class = 'close';
//                        if (in_array($grandchildren['id'], $open))
//                        {
//                            $ul_class = 'open';
//                        }
//                        echo '<ul class="fs_13 ' . $ul_class . '">';
//                        foreach ($grandchildren['Children'] as $grandchildrenChildren)
//                        {
//
//                            $li_class = 'uncurrent';
//                            $a_class = 'unselected';
//                            if (in_array($grandchildrenChildren['id'], $open) && count($grandchildrenChildren['Children']) == 0)
//                            {
//                                $li_class = 'current';
//                                $a_class = 'selected';
//                            }
//
//                            echo '<li class="' . $li_class . '">';
//                            echo '<a class="' . $a_class . '" href="' . url_for('@catalog_show_cat?alias=' . $grandchildrenChildren['alias']) . '">' . Page::niceTitleView($grandchildrenChildren['title']) . '</a>';
//                            ////////
//
//                            if ($grandchildrenChildren['Children'])
//                            {
//                                // дети детей, детей детей
//                                $ul_class = 'close';
//                                if (in_array($grandchildrenChildren['id'], $open))
//                                {
//                                    $ul_class = 'open';
//                                }
//                                echo '<ul class="fs_13 ' . $ul_class . '">';
//                                foreach ($grandchildrenChildren['Children'] as $grandchildrenChildrenChildren)
//                                {
//
//                                    $li_class = 'uncurrent';
//                                    $a_class = 'unselected';
//                                    if (in_array($grandchildrenChildrenChildren['id'], $open))
//                                    {
//                                        $li_class = 'current';
//                                        $a_class = 'selected';
//                                    }
//
//                                    echo '<li class="' . $li_class . '">';
//                                    echo '<a class="' . $a_class . '" href="' . url_for('@catalog_show_cat?alias=' . $grandchildrenChildrenChildren['alias']) . '">' . Page::niceTitleView($grandchildrenChildrenChildren['title']) . '</a>';
//                                    echo '</li>';
//                                }
//                                echo '</ul>';
//                            }
//
//                            ////////
//                            echo '</li>';
//                        }
//                        echo '</ul>';
//                    }
//                    ////
//                    echo '</li>';
//                }
//                echo '</ul>';
//            }
//            echo '</li>';
//        }
//        echo '</ul>';
//    }
    echo '</li>';
}


// Оригинал

//<li>
//    <a href="/catalog/815/"><span>1 Электротовары</span></a>
//    <ul class="fs_13"  style="display: none;padding-left:5px;">
//        <li>
//            <a href="/catalog/816/"><span>Боксы и Щитки.</span></a>
//            <ul class="fs_13"  style="display: none;padding-left:5px;">
//                <li><a href="/catalog/818/"><span>Бокс EL-BI</span></a></li>
//                <li><a href="/catalog/819/"><span>Боксы прочие</span></a></li>
//                <li><a href="/catalog/820/"><span>Щит металлический</span></a></li>
//                <li><a href="/catalog/822/"><span>Щит металлопластик</span></a></li>
//                <li><a href="/catalog/823/"><span>Щиток под счетчик</span></a></li>
//            </ul>
//        </li>
//        <li>
//            <a href="/catalog/824/"><span>Вилки и колодки</span></a>
//            <ul class="fs_13"  style="display: none;padding-left:5px;">
//                <li><a href="/catalog/825/"><span>Вилка+розетка в наборе</span></a></li>
//                <li><a href="/catalog/826/"><span>Вилки и колодки EL-BI</span></a></li>
//            </ul>
//        </li>
//    </ul>
//</li>

?>

<li style="padding: 0px"><i class="br15"></i></li>