<?php
 class vB_Api_NodeField extends vB_Api { private $library; protected function __construct() { $this->library = vB_Library::instance('nodefield'); } public function saveCategory($data) { $this->checkHasAdminPermission('canadminforums'); $id = $this->library->saveCategory($data); return ['categoryid' => $id]; } public function getCategoryList() { $list = $this->library->getCategoryList(); return ['categorylist' => $list]; } public function getCategory($categoryid) { $category = $this->library->getCategory($categoryid); return ['category' => $category]; } public function deleteCategory($categoryid) { $this->checkHasAdminPermission('canadminforums'); $this->library->deleteCategory($categoryid); return ['success' => true]; } public function saveField($data) { $this->checkHasAdminPermission('canadminforums'); $id = $this->library->saveField($data); return ['fieldid' => $id]; } public function getFieldList($fieldid = null) { $list = $this->library->getFieldList(); return ['fieldlist' => $list]; } public function getFieldsForNode($nodeid) { vB_Api::instanceInternal('node')->getNode($nodeid); $list = $this->library->getFieldsForNode($nodeid); return ['fieldlist' => $list]; } public function getFieldValuesForDisplay($nodeid) { vB_Api::instanceInternal('node')->getNode($nodeid); $list = $this->library->getFieldValuesForDisplay($nodeid); return ['fieldlist' => $list]; } public function getFieldsForChannel($channelid) { $list = $this->library->getFieldsForChannel($channelid); return ['fieldlist' => $list]; } public function getField($fieldid) { $field = $this->library->getField($fieldid); return ['field' => $field]; } public function deleteField($fieldid) { $this->checkHasAdminPermission('canadminforums'); $this->library->deleteField($fieldid); return ['success' => true]; } } 