'', 'option'=>''); $result = array('success' => 'false', 'data' => $data); if (empty($title) && empty($course_id)) { echo json_encode($result); exit; } // Only available to logged_in user //TODO only facilitator if (is_logged_in()) { $category = new Category(); $category->name = $title; $category->parent = $parent; $category->course = $course_id; $cat = $category->create(); if ($cat) { $data['div'] = '
'; $data['div'] .= ''; $data['div'] .= $title; $data['div'] .= '
'; $data['option'] = ''; $result['success'] = 'true'; $result['data'] = $data; } } echo json_encode($result); exit; ?>