public function delete_permission($task_set_id, $task_set_permission_id) { $output = new stdClass(); $output->result = FALSE; $output->message = ''; $this->_transaction_isolation(); $this->db->trans_begin(); $task_set = new Task_set(); $task_set->get_by_id((int) $task_set_id); $task_set_permission = new Task_set_permission(); $task_set_permission->get_by_id((int) $task_set_permission_id); if ($task_set->exists() && !is_null($task_set->course_id)) { if ($task_set_permission->exists() && $task_set_permission->is_related_to($task_set)) { $task_set_permission->delete(); if ($this->db->trans_status()) { $this->db->trans_commit(); $output->result = TRUE; $output->message = $this->lang->line('admin_task_set_permissions_success_message_deleted'); $this->_action_success(); } else { $this->db->trans_rollback(); $output->message = $this->lang->line('admin_task_set_permissions_error_message_delete_error'); } } else { $this->db->trans_rollback(); $output->message = $this->lang->line('admin_task_set_permissions_error_message_cant_find_task_set_permission_or_is_not_related_to_task_set'); } } else { $this->db->trans_rollback(); $output->message = $this->lang->line('lang:admin_task_set_permissions_error_message_cant_find_task_set_or_course'); } $this->output->set_content_type('application/json'); $this->output->set_output(json_encode($output)); }