Ejemplo n.º 1
0
/**
 * Выводит форму редактировая комментария в админке комментариев.
 *
 * @param int $type Тип группы комментариев
 * @param int $id   id комментария
 *
 * @return xajaxResponse
 */
function EditComment($type, $id)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/comments.php';
    session_start();
    $objResponse = new xajaxResponse();
    if (!hasPermissions('comments')) {
        return $objResponse;
    }
    $comments = new comments();
    $item = $comments->GetItem(intval($type), intval($id));
    $show_title = false;
    $show_files = $type == comments::T_ARTICLES;
    $show_video = $type == comments::T_ARTICLES;
    if (!empty($item)) {
        define('IS_SITE_ADMIN', 1);
        require_once $_SERVER['DOCUMENT_ROOT'] . '/siteadmin/comments/blocks.php';
        $objResponse->assign("edit-{$type}-{$id}", 'innerHTML', CommentEditor($item, $show_title, $show_files, $show_video));
        if ($show_video) {
            $objResponse->script("\$\$('.cl-form-files li input[type=image]').addEvent('click', FilesList)");
        }
    }
    return $objResponse;
}