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; }
$response = $http->sparqlQuery($query); $json = json_decode($response, true); $temp = $json["results"]["bindings"]; $Keywords = array(); foreach ($temp as $t) { array_push($keywords, $t["keyword_value"]["value"]); } $article->setKeyword($keywords); //estraggo journal e anno $query = $prefixs . $sparql->getJournalAndAnnoByArticle($title); $response = $http->sparqlQuery($query); $json = json_decode($response, true); $temp = $json["results"]["bindings"]; foreach ($temp as $t) { $article->setJournal($t["journal"]["value"]); $article->setData($t["anno"]["value"]); } //estraggo autori $query = $prefixs . $sparql->getAuthorByArticle($title); $response = $http->sparqlQuery($query); $json = json_decode($response, true); $temp = $json["results"]["bindings"]; foreach ($temp as $t) { array_push($author, $t["author_name"]["value"]); } $article->setAuthor($author); //estraggo URL $query = $prefixs . $sparql->getUrlByTitle($title); $response = $http->sparqlQuery($query); $json = json_decode($response, true); $temp = $json["results"]["bindings"];
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(); }
function setData($data) { $data['class'] = AMP_CONTENT_CLASS_BLOG; parent::setData($data); }