<?php

class ACMS_GET_Admin_Webhook_Name extends ACMS_GET
{
    function get()
    {
        $Tpl = new Template($this->tpl, new ACMS_Corrector());

        $webhookId = idval($this->Get->get('id'));
        if ($webhookId > 0) {
            $DB  = DB::singleton(dsn());
            $SQL = SQL::newSelect('webhook');
            $SQL->setSelect('webhook_name');
            $SQL->addWhereOpr('webhook_id', $webhookId);
            $SQL->addWhereOpr('webhook_blog_id', BID);
            $name = strval($DB->query($SQL->get(dsn()), 'one'));
            if ($name !== '') {
                $Tpl->add(null, ['id' => $webhookId, 'name' => $name]);
            }
        }
        return $Tpl->get();
    }
}
