720006f08df3f333bda6df6520354c013c03d485
[acontent.git] / docs / home / course / content_nav_inline_editor_submit.php
1 /************************************************************************/\r
2 /* AContent                                                             */\r
3 /************************************************************************/\r
4 /* Copyright (c) 2010                                                   */\r
5 /* Inclusive Design Institute                                           */\r
6 /*                                                                      */\r
7 /* This program is free software. You can redistribute it and/or        */\r
8 /* modify it under the terms of the GNU General Public License          */\r
9 /* as published by the Free Software Foundation.                        */\r
10 /************************************************************************/\r
11 \r
12 define('TR_INCLUDE_PATH', '../../include/');\r
13 require(TR_INCLUDE_PATH.'vitals.inc.php');\r
14 require_once(TR_INCLUDE_PATH.'classes/DAO/ContentDAO.class.php');\r
15 \r
16 global $db;\r
17 \r
18 if (trim($_POST['field']) <> "" && trim($_POST['value']) <> "")\r
19 {\r
20         $fields = explode('-', $_POST['field']);\r
21         $content_id = intval($fields[1]);\r
22         \r
23         if ($content_id > 0)\r
24         {\r
25                 $contentDAO = new ContentDAO();\r
26                 \r
27                 if ($contentDAO->UpdateField($content_id, 'title', $_POST['value']))\r
28                 {\r
29                         $rtn['status'] = 'success';\r
30                         $rtn['success'][] = _AT('TR_FEEDBACK_ACTION_COMPLETED_SUCCESSFULLY');\r
31                 }\r
32                 else\r
33                 {\r
34                         $rtn['status'] = 'fail';\r
35                         $rtn['success'][] = _AT('TR_ERROR_UNABLE_UPDATE_DB');\r
36                 }\r
37                 echo json_encode($rtn);\r
38         }\r
39 }\r
40 ?>