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