function getDisplayIntro() { if (!($intro = $this->getHeaderRef())) { $intro = new Article(AMP_Registry::getDbcon()); $intro->setDefaults(); $intro->mergeData(array('publish' => 1, 'title' => $this->getName() . $this->getListNameSuffix(), 'body' => $this->getBlurb(), 'class' => AMP_CONTENT_CLASS_SECTIONHEADER)); } return $intro->getDisplay(); }
function save($data, $options = array()) { $options = array_merge($this->getOptions(), $options); $data = $this->validate($data, $options); if (!$data) { return false; } $article = new Article(AMP_Registry::getDbcon()); $article->setDefaults(); $article->mergeData($data); $result = $article->save(); if (!$result) { return false; } if (isset($options['result_mapping']) && $options['result_mapping']) { $update_array[$options['result_mapping']] = $article->id; $save_plugin =& $this->udm->registerPlugin('AMP', 'Save'); $save_plugin->save($update_array); } return $result; }
function publish($section_id, $class_id, $destroy_self = true) { $text = utf8_decode(preg_replace("/\\n/", "<br/>", $this->getBody())); $blurb = AMP_trimText($text, AMP_CONTENT_ARTICLE_BLURB_LENGTH_DEFAULT, false); # this line doesnt work since upgrading adodb? ap #$title = $this->dbcon->qstr( utf8_decode( $this->getName( ))); $title = utf8_decode($this->getName()); $feed_name = $this->getFeedName(); if (!$section_id) { return false; } $article_data = array('title' => $title, 'body' => $text, 'shortdesc' => $blurb, 'uselink' => !AMP_CONTENT_RSS_FULLTEXT, 'linkover' => !AMP_CONTENT_RSS_FULLTEXT, 'link' => $this->getLinkURL(), 'subtitle' => $this->getSubtitle(), 'source' => $feed_name, 'sourceurl' => AMP_validate_url($this->getLinkURL()), 'type' => $section_id, 'class' => $class_id, 'date' => $this->getItemDate(), 'publish' => AMP_CONTENT_STATUS_LIVE, 'enteredby' => AMP_SYSTEM_USER_ID, 'updatedby' => AMP_SYSTEM_USER_ID, 'contact' => $this->getContacts()); require_once 'AMP/Content/Article.inc.php'; $article = new Article($this->dbcon); $article->setDefaults(); $article->setData($article_data); if (!$article->save()) { return false; } if ($destroy_self) { $this->delete(); } return true; }
function _create_section_header() { require_once 'AMP/Content/Article.inc.php'; $section_header = new Article($this->dbcon); $section_header->setDefaults(); $article_data = array('title' => $this->getName(), 'body' => $this->getBlurb(), 'publish' => true, 'class' => AMP_CONTENT_CLASS_SECTIONHEADER, 'section' => $this->id); $section_header->setData($article_data); return $section_header->save(); }