예제 #1
0
 /**
  * Table of moderated products grouped by languages and statuses
  */
 public function moderatedAction()
 {
     $stats['done'] = PProdInfo::count(["coder_status = 5", 'group' => 'lang', 'order' => 'id'])->toArray();
     $stats['done_hold'] = PStats::count(["coder_status = 5 AND hold = 1", 'group' => 'lang', 'order' => 'id'])->toArray();
     $stats['inmoder'] = PProdInfo::count(["coder_status = 3", 'group' => 'lang', 'order' => 'id'])->toArray();
     $stats['inmoder_hold'] = PStats::count(["coder_status = 3 AND hold = 1", 'group' => 'lang', 'order' => 'id'])->toArray();
     $stats['returned'] = PProdInfo::count(["coder_status = 6", 'group' => 'lang', 'order' => 'id'])->toArray();
     $stats['returned_hold'] = PStats::count(["coder_status = 6 AND hold = 1", 'group' => 'lang', 'order' => 'id'])->toArray();
     $stats['todo_hold'] = PStats::count(["coder_status < 3 AND hold = 1", 'group' => 'lang', 'order' => 'id'])->toArray();
     $stats['translator'] = PProdInfo::count(["coder_status = 1", 'group' => 'lang', 'order' => 'id'])->toArray();
     $stats['translator_hold'] = PStats::count(["coder_status = 1 AND hold = 1", 'group' => 'lang', 'order' => 'id'])->toArray();
     $stats['hold_total'] = PStats::count(["hold = 1", 'group' => 'lang', 'order' => 'id'])->toArray();
     $stats['langs'] = PProdInfo::count(['group' => 'lang', 'order' => 'id'])->toArray();
     $this->view->total_ru = PStats::count("coder_status = 5 AND lang = 'ru'");
     $this->view->total = PProductMain::count();
     $this->view->total_hold = PProductMain::count("hold=1");
     $this->view->total_hold_photocoder = PProductMain::count("hold=1 AND status<4");
     $this->view->stats = $stats;
     $this->view->current_date = date('H:i:s d.m.Y');
 }
예제 #2
0
    public function moderAction()
    {
        $stats = [];
        $stats['done'] = PProdInfo::count(["coder_status = 5", 'group' => 'lang', 'order' => 'id']);
        $stats['done_hold'] = PStats::count(["coder_status = 5 AND hold = 1", 'group' => 'lang', 'order' => 'id']);
        $stats['inmoder'] = PProdInfo::count(["coder_status = 3", 'group' => 'lang', 'order' => 'id']);
        $stats['inmoder_hold'] = PStats::count(["coder_status = 3 AND hold = 1", 'group' => 'lang', 'order' => 'id']);
        $stats['returned'] = PProdInfo::count(["coder_status = 6", 'group' => 'lang', 'order' => 'id']);
        $stats['returned_hold'] = PStats::count(["coder_status = 6 AND hold = 1", 'group' => 'lang', 'order' => 'id']);
        $stats['todo_hold'] = PStats::count(["coder_status < 3 AND hold = 1", 'group' => 'lang', 'order' => 'id']);
        $stats['hold_total'] = PStats::count(["hold = 1", 'group' => 'lang', 'order' => 'id']);
        $langs = PProdInfo::count(['group' => 'lang', 'order' => 'id']);
        $total_ru = PStats::count("coder_status = 5 AND lang = 'ru'");
        $total = PProductMain::count();
        $date = date('d.m.Y');
        $titles = ["Сделано (5) (из них на холде)", "На модерации (3) (из них на холде)", "Возвращено (6) (из них на холде)", "Не обработано еще (0) (из них на холде)", "Замороженые товары (hold), всего"];
        $stat_titles = ["done", "inmoder", "returned"];
        $text = <<<TEXT
<p style="margin-bottom: 20px">Всего товаров: <span id="total">{$total}</span></p>
<p style="margin-bottom: 20px">Отчет на {$date}</p>
<table border='1'>
<tr>
<th></th>
TEXT;
        foreach ($langs as $lang => $stat) {
            $text .= "<th width='110px'>{$stat['lang']}</th>";
        }
        $text .= "</tr>";
        for ($i = 0; $i < 3; $i++) {
            $text .= "<tr><td>{$titles[$i]}</td>";
            foreach ($langs as $lang => $stat) {
                $text .= "<td>";
                foreach ($stats[$stat_titles[$i]] as $lang_total => $stat_total) {
                    if ($stat_total['lang'] == $stat['lang']) {
                        $text .= $stat_total['rowcount'] . " ";
                        foreach ($stats[$stat_titles[$i] . '_hold'] as $lang_hold => $stat_hold) {
                            if ($stat_hold['lang'] == $stat['lang']) {
                                $text .= "({$stat_hold['rowcount']})";
                            }
                        }
                    }
                }
                $text .= "</td>";
            }
            $text .= "</tr>";
        }
        $text .= "<tr><td>{$titles[3]}</td>";
        foreach ($langs as $lang => $stat) {
            $text .= "<td>";
            if ($stat['lang'] == 'ru') {
                $text .= $total - $stat['rowcount'];
            } else {
                $text .= $total_ru - $stat['rowcount'];
            }
            foreach ($stats['todo_hold'] as $lang_hold => $stat_hold) {
                if ($stat_hold['lang'] == $stat['lang']) {
                    $text .= "({$stat_hold['rowcount']})";
                }
            }
            $text .= "</td>";
        }
        $text .= "</tr>";
        $text .= "<tr><td>{$titles[4]}</td>";
        foreach ($langs as $lang => $stat) {
            $text .= "<td>";
            foreach ($stats['hold_total'] as $lang_hold => $stat_hold) {
                if ($stat_hold['lang'] == $stat['lang']) {
                    $text .= "{$stat_hold['rowcount']}";
                }
            }
            $text .= "</td>";
        }
        $text .= "</tr></table>";
        $text .= <<<TEXT
<br><br><b>Описание</b>
<p>Сделано (5) - товары со статусом перевода на данный язык == 5 ( в случае с RU статус копирайта == 5)</p>
<p>На модерации (3) - товары со статусом перевода на данный язык == 3 ( в случае с RU статус копирайта == 3)</p>
<p>Возвращено (6) - товары со статусом перевода на данный язык == 6 ( в случае с RU статус копирайта == 6)</p>
<p>Не обработано еще (0) - товары со статусом перевода на данный язык == 0 ( в случае с RU статус копирайта == 0)</p>
<p>Замороженые товары (hold) - товары со статусом hold == Да</p>
TEXT;
        $message[] = ['To' => '*****@*****.**', 'From' => POSTMARK_FROM, 'Subject' => "Количество отмодерированных товаров. Отчет за {$date}", 'HtmlBody' => $text];
        $client = new PostmarkClient(POSTMARK_API);
        //        var_dump($message);
        $send = $client->sendEmailBatch($message);
    }