/**
  * Fetch datas
  * 
  */
 public function fetch_datas()
 {
     global $dbh;
     if ($this->id) {
         $query = "select category_title, category_num_parent from docwatch_categories where id_category=" . $this->id;
         $result = pmb_mysql_query($query, $dbh);
         if ($row = pmb_mysql_fetch_object($result)) {
             $this->title = $row->category_title;
             $this->num_parent = $row->category_num_parent;
         }
     } else {
         $this->title = "Racine";
         $this->num_parent = -1;
     }
     $query = "select id_watch from docwatch_watches where watch_num_category=" . $this->id;
     $result = pmb_mysql_query($query, $dbh);
     while ($row = pmb_mysql_fetch_object($result)) {
         $docwatch_watch = new docwatch_watch($row->id_watch);
         //Gestion des droits utilisateurs (on affiche uniquement les veilles paramétrées pour le current user)
         if (in_array(SESSuserid, $docwatch_watch->get_allowed_users())) {
             $this->watches[] = $docwatch_watch->get_informations();
         }
     }
     $query = "select id_category from docwatch_categories where category_num_parent=" . $this->id;
     $result = pmb_mysql_query($query, $dbh);
     while ($row = pmb_mysql_fetch_object($result)) {
         $this->children[] = new docwatch_watches($row->id_category);
     }
 }
예제 #2
0
             $allowed_users = array();
         }
         $docwatch_watch->set_allowed_users($allowed_users);
         $docwatch_watch->set_num_category(stripslashes($parent));
         $docwatch_watch->set_record_default_status(stripslashes($record_status));
         $docwatch_watch->set_record_default_type(stripslashes($record_types));
         $docwatch_watch->set_article_default_content_type(stripslashes($article_type));
         $docwatch_watch->set_article_default_parent(stripslashes($article_parent));
         $docwatch_watch->set_article_default_publication_status(stripslashes($article_status));
         $docwatch_watch->set_section_default_content_type(stripslashes($section_type));
         $docwatch_watch->set_section_default_parent(stripslashes($section_parent));
         $docwatch_watch->set_section_default_publication_status(stripslashes($section_status));
         $result = $docwatch_watch->save();
         $response = "";
         if ($docwatch_watch->get_id()) {
             $response = $docwatch_watch->get_informations();
         }
         $response = array('result' => $result, 'elementId' => $docwatch_watch->get_id(), 'response' => $response);
         print encoding_normalize::json_encode($response);
     } else {
         $response = array('result' => false, 'elementId' => $docwatch_watch->get_id(), 'response' => "");
         print encoding_normalize::json_encode($response);
     }
     break;
 case "delete_watch":
     $docwatch_watch = new docwatch_watch($id);
     $result = $docwatch_watch->delete();
     $response = "";
     if (!$result) {
         $response = $docwatch_watch->get_error();
     }