public function get_children($id)
 {
     $categories = array($id);
     $docwatch_category = new docwatch_category($id);
     $children = $docwatch_category->get_children();
     foreach ($children as $child) {
         $categories[] = $child;
         $categories = array_merge($categories, $this->get_children($child));
     }
     return $categories;
 }
Example #2
0
     print encoding_normalize::json_encode(array($docwatch_watches));
     break;
 case "save_category":
     $docwatch_category = new docwatch_category($id);
     $docwatch_category->set_parent(stripslashes($parent));
     $docwatch_category->set_title(stripslashes($title));
     $result = $docwatch_category->save();
     $response = "";
     if ($docwatch_category->get_id()) {
         $response = new docwatch_watches($docwatch_category->get_id());
     }
     $response = array('result' => $result, 'elementId' => $docwatch_category->get_id(), 'response' => $response);
     print encoding_normalize::json_encode($response);
     break;
 case "delete_category":
     $docwatch_category = new docwatch_category($id);
     $result = $docwatch_category->delete();
     $response = "";
     if (!$result) {
         $response = $docwatch_category->get_error();
     }
     $response = array('result' => $result, 'elementId' => $docwatch_category->get_id(), 'response' => $response);
     print encoding_normalize::json_encode($response);
     break;
 case "save_watch":
     $docwatch_watch = new docwatch_watch($id);
     if ($docwatch_watch->get_id() != 0 && $docwatch_watch->check_rights() || $docwatch_watch->get_id() == 0 && in_array(SESSuserid, $allowed_users)) {
         $docwatch_watch->set_title(stripslashes($title));
         $docwatch_watch->set_ttl(stripslashes($ttl));
         $docwatch_watch->set_logo_url(stripslashes($logo_url));
         $docwatch_watch->set_desc(stripslashes($desc));