src/articles/classes/Controller/Admin/Content.php
protected function actionEdit(Eresus_CMS_Request $request)
    {
        if ($request->getMethod() == 'POST')
        {
            $args = $request->request;
            $article = $this->findArticle($args->getInt('id'));
            $article->image = 'image';
            $article->section = $args->getInt('section');
            if ($args->has('active'))
            {
                $article->active = (boolean) $args->getInt('active');
            }
            $article->posted = new DateTime($args->get('posted'));
            $article->block = (boolean) $args->getInt('block');
            $article->caption = $args->get('caption');
            $article->text = $args->get('text');
            $article->preview = $args->get('preview');
            if ($args->has('updatePreview'))
            {
                $article->createPreviewFromText();
            }
            $article->getTable()->update($article);
            $response = new Eresus_HTTP_Redirect($args->get('submitURL'));
            return $response;
        }

        $article = $this->findArticle($request->query->getInt('id'));
        /** @var Articles $plugin */
        $plugin = $this->getPlugin();
        $form = array(
            'name' => 'editArticles',
            'caption' => 'Изменить статью',
            'width' => '95%',
            'fields' => array (
                array('type' => 'hidden', 'name' => 'action', 'value' => 'edit'),
                array('type' => 'hidden', 'name' => 'id', 'value' => $article->id),
                array ('type' => 'edit', 'name' => 'caption', 'label' => 'Заголовок',
                    'width' => '100%', 'maxlength' => '255'),
                array ('type' => 'html', 'name' => 'text', 'label' => 'Полный текст',
                    'height' => '200px'),
                array ('type' => 'memo', 'name' => 'preview', 'label' => 'Краткое описание',
                    'height' => '5'),
                array ('type' => 'checkbox', 'name'=>'updatePreview',
                    'label'=>'Обновить краткое описание автоматически', 'value' => false),
                array ('type' => $plugin->settings['blockMode'] == 'manual'
                    ? 'checkbox' : 'hidden', 'name' => 'block', 'label' => 'Показывать в блоке'),
                array ('type' => 'file', 'name' => 'image', 'label' => 'Картинка', 'width' => '100',
                    'comment' => $article->imageUrl ?
                        '<a href="' . $this->getPage()->url(array('action'=>'delimage')) .
                        '">Удалить</a>'  : ''),
                array ('type' => 'divider'),
                array ('type' => 'edit', 'name' => 'section', 'label' => 'Раздел',
                    'access' => ADMIN),
                array ('type' => 'edit', 'name'=>'posted', 'label'=>'Написано'),
                array ('type' => 'checkbox', 'name'=>'active', 'label'=>'Активно'),
                array ('type' => 'text', 'value' => $article->imageUrl
                    ? 'Изображение: <br><img src="' . $article->thumbUrl . '" alt="">' : ''),
            ),
            'buttons' => array('ok', 'apply', 'cancel'),
        );

        /** @var array $article */
        $html = $this->getPage()->renderForm($form, $article);

        return $html;
    }
protected function actionEdit(Eresus_CMS_Request $request)
    {
        if ($request->getMethod() == 'POST')
        {
            $args = $request->request;
            $article = $this->findArticle($args->getInt('id'));
            $article->image = 'image';
            $article->section = $args->getInt('section');
            if ($args->has('active'))
            {
                $article->active = (boolean) $args->getInt('active');
            }
            $article->posted = new DateTime($args->get('posted'));
            $article->block = (boolean) $args->getInt('block');
            $article->caption = $args->get('caption');
            $article->text = $args->get('text');
            $article->preview = $args->get('preview');
            if ($args->has('updatePreview'))
            {
                $article->createPreviewFromText();
            }
            $article->getTable()->update($article);
            $response = new Eresus_HTTP_Redirect($args->get('submitURL'));
            return $response;
        }

        $article = $this->findArticle($request->query->getInt('id'));
        /** @var Articles $plugin */
        $plugin = $this->getPlugin();
        $form = array(
            'name' => 'editArticles',
            'caption' => 'Изменить статью',
            'width' => '95%',
            'fields' => array (
                array('type' => 'hidden', 'name' => 'action', 'value' => 'edit'),
                array('type' => 'hidden', 'name' => 'id', 'value' => $article->id),
                array ('type' => 'edit', 'name' => 'caption', 'label' => 'Заголовок',
                    'width' => '100%', 'maxlength' => '255'),
                array ('type' => 'html', 'name' => 'text', 'label' => 'Полный текст',
                    'height' => '200px'),
                array ('type' => 'memo', 'name' => 'preview', 'label' => 'Краткое описание',
                    'height' => '5'),
                array ('type' => 'checkbox', 'name'=>'updatePreview',
                    'label'=>'Обновить краткое описание автоматически', 'value' => false),
                array ('type' => $plugin->settings['blockMode'] == 'manual'
                    ? 'checkbox' : 'hidden', 'name' => 'block', 'label' => 'Показывать в блоке'),
                array ('type' => 'file', 'name' => 'image', 'label' => 'Картинка', 'width' => '100',
                    'comment' => $article->imageUrl ?
                        '<a href="' . $this->getPage()->url(array('action'=>'delimage')) .
                        '">Удалить</a>'  : ''),
                array ('type' => 'divider'),
                array ('type' => 'edit', 'name' => 'section', 'label' => 'Раздел',
                    'access' => ADMIN),
                array ('type' => 'edit', 'name'=>'posted', 'label'=>'Написано'),
                array ('type' => 'checkbox', 'name'=>'active', 'label'=>'Активно'),
                array ('type' => 'text', 'value' => $article->imageUrl
                    ? 'Изображение: <br><img src="' . $article->thumbUrl . '" alt="">' : ''),
            ),
            'buttons' => array('ok', 'apply', 'cancel'),
        );

        /** @var array $article */
        $html = $this->getPage()->renderForm($form, $article);

        return $html;
    }
Изменение статьи

@param Eresus_CMS_Request $request

@return string|Eresus_HTTP_Response