Source for file NewsFeed.class.php
Documentation is available at NewsFeed.class.php
* Содержит класс NewsFeed
* @copyright Energine 2007
//require_once('core/modules/share/components/DBDataSet.class.php');
* @param Document $document
public function __construct($name, $module, Document $document, array $params = null) {
parent::__construct($name, $module, $document, $params);
* Добавляем поле - флаг указывающий на то - существует ли текст новости
protected function main() {
if($this->getData() && $newsID = $this->getData()->getFieldByName('news_id')){
$hasTextField = new FieldDescription('has_text');
$hasTextField->setType(FieldDescription::FIELD_TYPE_BOOL);
$this->getDataDescription()->addFieldDescription($hasTextField);
$hasTextField = new Field('has_text');
foreach ($newsID as $id) {
$hasTextField->addRowData(simplifyDBResult($this->dbh->select($this->getTranslationTableName(), array('news_text_rtf is not null as has_text'), array('news_id'=>$id)), 'has_text', true));
$this->getData()->addField($hasTextField);
protected function view() {
list ($day, $month, $year) = $params;
array('news_date'=> sprintf('%s-%s-%s', $year, $month, $day))
$this->setType(self::COMPONENT_TYPE_FORM);
if ($data instanceof Data) {
list ($newsTitle) = $data->getFieldByName('news_title')->getData();
$this->document->componentManager->getComponentByName('breadCrumbs')->addCrumb('', $newsTitle);
|