public function create_section($section_num_parent = 0) { global $dbh; global $pmb_keyword_sep; $section = new cms_section(); $section->id = 0; $section->num_type = 0; // ? $section->num_parent = 0; // ? $section->title = $this->title; $section->resume = $this->summary; $section->start_date = $this->publication_date; $section->publication_state = 0; // ? $section->descriptors = $this->descriptors; //$section->logo->id ? $section->save(); if (!$section->id) { return array(); } $query .= "update docwatch_items set\titem_num_section = '" . $section->id . "' where id_item = '" . $this->id . "'"; pmb_mysql_query($query, $dbh); return array('id' => $section->id, 'title' => $this->title, 'link' => ""); }
break; case "article": $article = new cms_article($id); print $article->get_ajax_form("cms_article_edit", "cms_article_edit"); break; case "list_articles": $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"); }
public function create_section($section_num_parent = 0) { global $dbh; global $pmb_keyword_sep; if (docwatch_watch::check_watch_rights($this->num_watch)) { $query = "select watch_section_default_parent, watch_section_default_content_type,watch_section_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); $section_type = $row->watch_section_default_content_type; $section_status = $row->watch_section_default_publication_status; $section_parent = $row->watch_section_default_parent; } else { return array(); } $section = new cms_section(); $section->id = 0; $section->title = $this->title; $section->resume = $this->summary; $section->start_date = $this->publication_date; $section->publication_state = $section_status; $section->descriptors = $this->descriptors; $section->num_parent = $section_num_parent; $section->num_type = $section_type; $section->save(); if (!$section->id) { return array(); } $query = "update docwatch_items set\titem_num_section = '" . $section->id . "' where id_item = '" . $this->id . "'"; pmb_mysql_query($query, $dbh); $this->set_num_section($section->id); return array('id' => $section->id, 'title' => $this->title, 'link' => "./cms.php?categ=section&sub=edit&id=" . $section->id); } }