Закажите бесплатную презентацию продуктов РосБизнесСофт прямо сейчас!
Блок Комментарии отвечает за добавление комментариев и их отображение на странице.
Для вывода блока Комментарии необходимо прописать в PHP-сценарии в методе onPlay():
$prototypeName = $this->Data->References->comments->getPrototypeCopy()->getName(); $this->printDataItems( "form", [ "name" => "author.name", "comment" => "text", "date" => function ($obj) { return (string)$obj->date->toFormat("d.m.Y H:i"); }, "photo" => function ($obj) { if ($obj->author->photo->path) return [ "src" => self::getRealPhotoNew($obj->author->photo->path, true), "width" => "90", "height" => "", "id" => $obj->id ]; }, 'actions' => function ($obj) use ($prototypeName) { return [ [ 'name' => Language::getVariable("main", "ActionDelete"), 'url' => "/api/" . $prototypeName . "/" . $obj->id . "/delete", 'mode' => "ajax", "access" => ACCESS_DELETE, ] ]; } ], null, $this->Data->References->comments->filter("owner=" . $this->structure->id)->filter("visible=1")->order(['date']), [ "add" => [ "action" => "/companies/" . $this->structure->id . "/comments/add/", "autoresize" => 1, "fieldName" => "object_text", "hiddenFields" => [ ["name" => "object_owner", "value" => $this->structure->id], ["name" => "object_author", "value" => $this->User->getEmployee()[0]], ["name" => "object_date", "value" => date("Y-m-d H:i:s", strtotime("now"))], ["name" => "object_visible", "value" => 1], ] ] ] );
Добавить в «Шаблон» в необходимое место следующие строки:
[[CONTAINER | header: #L:comment | name: appendComment ]] [[items | name: form]] [[CONTAINER_END]]