public function create_article($section_num_parent = 0) { global $dbh; global $pmb_keyword_sep; $article = new cms_article(); $article->id = 0; $article->num_type = 0; // ? $article->num_parent = 0; // ? $article->title = $this->title; $article->resume = $this->summary; $article->contenu = $this->content; $article->start_date = $this->publication_date; $article->publication_state = 0; // ? $article->descriptors = $this->descriptors; //$article->logo->id ? $article->save(); if (!$article->id) { return array(); } $query .= "update docwatch_items set\titem_num_article = '" . $article->id . "' where id_item = '" . $this->id . "'"; pmb_mysql_query($query, $dbh); return array('id' => $article->id, 'title' => $this->title, 'link' => ""); }
$articles = new cms_articles($id); print $articles->get_tab(); break; } break; case "save_section": //header('Content-type: text/html;charset=iso-8859-1'); $section = new cms_section(); $section->get_from_form(); $section->save(); break; case "save_article": //header('Content-type: text/html;charset=iso-8859-1'); $article = new cms_article(); $article->get_from_form(); $article->save(); break; case "delete_section": $section = new cms_section($id); $res = $section->delete(); if ($res !== true) { $result = array("status" => "ko", "error_message" => $charset != "uft-8" ? utf8_encode($res) : $res); } else { $result = array('status' => "ok"); } print json_encode($result); break; case "delete_article": $article = new cms_article($id); $res = $article->delete(); if ($res !== true) {
public function create_article($section_num_parent = 0) { global $dbh; global $pmb_keyword_sep; if (docwatch_watch::check_watch_rights($this->num_watch)) { $query = "select watch_article_default_parent, watch_article_default_content_type,watch_article_default_publication_status from docwatch_watches where id_watch =" . $this->num_watch; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { $row = pmb_mysql_fetch_object($result); $article_type = $row->watch_article_default_content_type; $article_status = $row->watch_article_default_publication_status; $article_parent = $row->watch_article_default_parent; } else { return array(); } $article = new cms_article(); $article->id = 0; $article->num_type = $article_type; $article->num_parent = $article_parent; $article->title = $this->title; $article->resume = $this->summary; $article->contenu = $this->content; $article->start_date = $this->publication_date; $article->publication_state = $article_status; $article->descriptors = $this->descriptors; //$article->logo->id ? $article->save(); if (!$article->id) { return array(); } $query = "update docwatch_items set\titem_num_article = '" . $article->id . "' where id_item = '" . $this->id . "'"; pmb_mysql_query($query, $dbh); $this->set_num_article($article->id); return array('id' => $article->id, 'title' => $this->title, 'link' => "./cms.php?categ=article&sub=edit&id=" . $article->id); } }