<?php

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

        $scheduleId = idval($this->Get->get('scid'));
        if ($scheduleId > 0) {
            $DB  = DB::singleton(dsn());
            $SQL = SQL::newSelect('schedule');
            $SQL->setSelect('schedule_name');
            $SQL->addWhereOpr('schedule_id', $scheduleId);
            $SQL->addWhereOpr('schedule_blog_id', BID);
            $name = strval($DB->query($SQL->get(dsn()), 'one'));
            if ($name !== '') {
                $Tpl->add(null, ['scid' => $scheduleId, 'name' => $name]);
            }
        }
        return $Tpl->get();
    }
}
