function getCategory() { $session = Session::singletone(); $db = Database::singletone()->db(); $cid = Utils::pg("cid", 0); $fn_sep = Utils::pg('sub-separator', ' / '); $this->_query->appendChild($this->_dom->createElement("category-id", $cid)); if ($cid <= 0) { $this->error("bad-arguments"); return; } $category = new Category($cid); $parents = $category->getParentsObjs(); $parents[] = $category; $parents_n = array(); foreach ($parents as $p) { $parents_n[] = $p->dbdata('category_name'); } $this->_response->appendChild($this->_dom->createElement('category-id', $category->dbdata('category_id'))); $this->_response->appendChild($this->_dom->createElement('category-name', $category->dbdata('category_name'))); $this->_response->appendChild($this->_dom->createElement('category-full-name', implode($fn_sep, $parents_n))); $this->_response->appendChild($this->_dom->createElement('category-description', $category->dbdata('category_description'))); $this->_response->appendChild($this->_dom->createElement('category-parent', $category->dbdata('category_parent'))); $this->_response->appendChild($this->_dom->createElement('category-order', $category->dbdata('category_order'))); $this->_response->appendChild($this->_dom->createElement('category-created', Utils::formatTime($category->dbdata('category_created'), Config::getUser($session->uid(), 'datetime-format')))); $this->_response->appendChild($category->creator()->xml($this->_dom, 'creator')); $this->_response->appendChild($this->_dom->createElement('photos-count', $category->photosCount(false))); $this->_response->appendChild($this->_dom->createElement('total-photos-count', $category->photosCount(true))); $this->_response->appendChild($this->_dom->createElement('subcategories-count', $category->subCategoriesCount())); $pids = $category->photosPIDs(false); $tpids = $category->photosPIDs(true); $photos = $this->_dom->createElement('photos'); foreach ($pids as $pid) { $photos->appendChild($this->_dom->createElement('photo-id', $pid)); } $this->_response->appendChild($photos); $photos = $this->_dom->createElement('all-photos'); foreach ($tpids as $pid) { $photos->appendChild($this->_dom->createElement('photo-id', $pid)); } $this->_response->appendChild($photos); $this->success(); }