index.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. <?php //$id: $
  2. /* For licensing terms, see /dokeos_license.txt */
  3. /**
  4. * @package dokeos.glossary
  5. * @author Christian Fasanando, initial version
  6. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium, refactoring and tighter integration in Dokeos
  7. */
  8. // name of the language file that needs to be included
  9. $language_file = array('glossary');
  10. // including the global dokeos file
  11. require_once('../inc/global.inc.php');
  12. require_once('../inc/lib/events.lib.inc.php');
  13. // the section (tabs)
  14. $this_section=SECTION_COURSES;
  15. // notice for unauthorized people.
  16. api_protect_course_script(true);
  17. // including additional libraries
  18. require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
  19. // additional javascript
  20. $htmlHeadXtra[] = javascript_glossary();
  21. // setting the tool constants
  22. $tool = TOOL_GLOSSARY;
  23. // tracking
  24. event_access_tool(TOOL_GLOSSARY);
  25. // displaying the header
  26. if ( isset($_GET['action']) && ($_GET['action'] == 'addglossary' || $_GET['action'] == 'edit_glossary')) {
  27. $tool=get_lang('GlossaryManagement');
  28. $interbreadcrumb[] = array ("url"=>"index.php", "name"=> api_ucfirst(get_lang(TOOL_GLOSSARY)));
  29. }
  30. Display::display_header(get_lang(ucfirst($tool)));
  31. // Tool introduction
  32. $fck_attribute['Width'] = '100%';
  33. $fck_attribute['Height'] = '300';
  34. $fck_attribute['ToolbarSet'] = 'Introduction';
  35. Display::display_introduction_section(TOOL_GLOSSARY,'left');
  36. $fck_attribute = null; // Clearing this global variable immediatelly after it has been used.
  37. // Glossary FckEditor setting
  38. $fck_attribute['Width'] = '100%';
  39. $fck_attribute['Height'] = '300';
  40. $fck_attribute['ToolbarSet'] = 'Glossary';
  41. if ($_GET['action'] == 'changeview' AND in_array($_GET['view'],array('list','table')))
  42. {
  43. $_SESSION['glossary_view'] = $_GET['view'];
  44. }
  45. if (api_is_allowed_to_edit())
  46. {
  47. // Adding a glossary
  48. if (isset($_GET['action']) && $_GET['action'] == 'addglossary')
  49. {
  50. // initiate the object
  51. $form = new FormValidator('glossary','post', api_get_self().'?action='.Security::remove_XSS($_GET['action']));
  52. // settting the form elements
  53. $form->addElement('header', '', get_lang('TermAddNew'));
  54. $form->addElement('text', 'glossary_title', get_lang('TermName'), array('size'=>'95'));
  55. $form->applyFilter('glossary_title', 'html_filter');
  56. $form->addElement('html_editor', 'glossary_comment', get_lang('TermDefinition'));
  57. $form->addElement('style_submit_button', 'SubmitGlossary', get_lang('TermAddButton'), 'class="save"');
  58. // setting the rules
  59. $form->addRule('glossary_title', '<div class="required">'.get_lang('ThisFieldIsRequired'), 'required');
  60. // The validation or display
  61. if ( $form->validate() )
  62. {
  63. $check = Security::check_token('post');
  64. if ($check)
  65. {
  66. $values = $form->exportValues();
  67. save_glossary($values);
  68. }
  69. Security::clear_token();
  70. display_glossary();
  71. }
  72. else
  73. {
  74. $token = Security::get_token();
  75. $form->addElement('hidden','sec_token');
  76. $form->setConstants(array('sec_token' => $token));
  77. $form->display();
  78. }
  79. }
  80. // Editing a glossary
  81. else if (isset($_GET['action']) && $_GET['action'] == 'edit_glossary' && is_numeric($_GET['glossary_id']))
  82. {
  83. // initiate the object
  84. $form = new FormValidator('glossary','post', api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&glossary_id='.Security::remove_XSS($_GET['glossary_id']));
  85. // settting the form elements
  86. $form->addElement('header', '', get_lang('TermEdit'));
  87. $form->addElement('hidden', 'glossary_id');
  88. $form->addElement('text', 'glossary_title', get_lang('TermName'),array('size'=>'100'));
  89. $form->applyFilter('glossary_title', 'html_filter');
  90. $form->addElement('html_editor', 'glossary_comment', get_lang('TermDefinition'));
  91. $form->addElement('style_submit_button', 'SubmitGlossary', get_lang('TermUpdateButton'), 'class="save"');
  92. // setting the defaults
  93. $defaults = get_glossary_information(Security::remove_XSS($_GET['glossary_id']));
  94. $form->setDefaults($defaults);
  95. // setting the rules
  96. $form->addRule('glossary_title', '<div class="required">'.get_lang('ThisFieldIsRequired'), 'required');
  97. // The validation or display
  98. if ( $form->validate() )
  99. {
  100. $check = Security::check_token('post');
  101. if ($check)
  102. {
  103. $values = $form->exportValues();
  104. update_glossary($values);
  105. }
  106. Security::clear_token();
  107. display_glossary();
  108. }
  109. else
  110. {
  111. $token = Security::get_token();
  112. $form->addElement('hidden','sec_token');
  113. $form->setConstants(array('sec_token' => $token));
  114. $form->display();
  115. }
  116. }
  117. // deleting a glossary
  118. else if (isset($_GET['action']) && $_GET['action'] == 'delete_glossary' && is_numeric($_GET['glossary_id']))
  119. {
  120. delete_glossary(Security::remove_XSS($_GET['glossary_id']));
  121. display_glossary();
  122. }
  123. // moving a glossary term up
  124. else if (isset($_GET['action']) && $_GET['action'] == 'moveup' && is_numeric($_GET['glossary_id']))
  125. {
  126. move_glossary('up',$_GET['glossary_id']);
  127. display_glossary();
  128. }
  129. // moving a glossary term up
  130. else if (isset($_GET['action']) && $_GET['action'] == 'movedown' && is_numeric($_GET['glossary_id']))
  131. {
  132. move_glossary('down',$_GET['glossary_id']);
  133. display_glossary();
  134. } else {
  135. display_glossary();
  136. }
  137. } else {
  138. display_glossary();
  139. }
  140. // footer
  141. Display::display_footer();
  142. /**
  143. * This functions stores the glossary in the database
  144. *
  145. * @param unknown_type $values
  146. *
  147. * @author Christian Fasanando <christian.fasanando@dokeos.com>
  148. * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
  149. * @version januari 2009, dokeos 1.8.6
  150. */
  151. function save_glossary($values)
  152. {
  153. // Database table definition
  154. $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
  155. // get the maximum display order of all the glossary items
  156. $max_glossary_item = get_max_glossary_item();
  157. // check if the glossary term already exists
  158. if (glossary_exists($values['glossary_title']))
  159. {
  160. // display the feedback message
  161. Display::display_error_message('GlossaryTermAlreadyExistsYouShouldEditIt');
  162. }
  163. else
  164. {
  165. $sql = "INSERT INTO $t_glossary (name, description,display_order)
  166. VALUES(
  167. '".Database::escape_string($values['glossary_title'])."',
  168. '".Database::escape_string($values['glossary_comment'])."',
  169. '".(int)($max_glossary_item + 1)."')";
  170. $result = api_sql_query($sql, __FILE__, __LINE__);
  171. $id = Database::get_last_insert_id();
  172. if ($id>0) {
  173. //insert into item_property
  174. api_item_property_update(api_get_course_info(),TOOL_GLOSSARY,$id,'GlossaryAdded',api_get_user_id());
  175. }
  176. $_SESSION['max_glossary_display'] = get_max_glossary_item();
  177. // display the feedback message
  178. Display::display_confirmation_message(get_lang('TermAdded'));
  179. }
  180. }
  181. /**
  182. * update the information of a glossary term in the database
  183. *
  184. * @param array $values an array containing all the form elements
  185. *
  186. * @author Christian Fasanando <christian.fasanando@dokeos.com>
  187. * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
  188. * @version januari 2009, dokeos 1.8.6
  189. */
  190. function update_glossary($values)
  191. {
  192. // Database table definition
  193. $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
  194. // check if the glossary term already exists
  195. if (glossary_exists($values['glossary_title'],$values['glossary_id']))
  196. {
  197. // display the feedback message
  198. Display::display_error_message('GlossaryTermAlreadyExistsYouShouldEditIt');
  199. }
  200. else
  201. {
  202. $sql = "UPDATE $t_glossary SET
  203. name = '".Database::escape_string($values['glossary_title'])."',
  204. description = '".Database::escape_string($values['glossary_comment'])."'
  205. WHERE glossary_id = ".Database::escape_string($values['glossary_id']);
  206. $result = api_sql_query($sql, __FILE__, __LINE__);
  207. //update glossary into item_property
  208. api_item_property_update(api_get_course_info(),TOOL_GLOSSARY,Database::escape_string($values['glossary_id']),'GlossaryModified',api_get_user_id());
  209. // display the feedback message
  210. Display::display_confirmation_message(get_lang('TermUpdated'));
  211. }
  212. }
  213. /**
  214. * Get the maximum display order of the glossary item
  215. *
  216. * @author Christian Fasanando <christian.fasanando@dokeos.com>
  217. * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
  218. * @version januari 2009, dokeos 1.8.6
  219. */
  220. function get_max_glossary_item()
  221. {
  222. // Database table definition
  223. $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
  224. $get_max = "SELECT MAX(display_order) FROM $t_glossary";
  225. $res_max = api_sql_query($get_max, __FILE__, __LINE__);
  226. $dsp=0;
  227. $row = Database::fetch_array($res_max);
  228. return $row[0];
  229. }
  230. /**
  231. * check if the glossary term exists or not
  232. *
  233. * @param unknown_type $term
  234. * @param unknown_type $not_id
  235. * @return unknown
  236. *
  237. * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
  238. * @version januari 2009, dokeos 1.8.6
  239. */
  240. function glossary_exists($term,$not_id='')
  241. {
  242. // Database table definition
  243. $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
  244. $sql = "SELECT name FROM $t_glossary WHERE name = '".Database::escape_string($term)."'";
  245. if ($not_id<>'')
  246. {
  247. $sql .= " AND glossary_id <> '".Database::escape_string($not_id)."'";
  248. }
  249. $result = api_sql_query($sql,__FILE__,__LINE__);
  250. $count = Database::num_rows($result);
  251. if ($count > 0)
  252. {
  253. return true;
  254. }
  255. else
  256. {
  257. return false;
  258. }
  259. }
  260. /**
  261. * get all the information about one specific glossary term
  262. *
  263. * @param unknown_type $glossary_id
  264. * @return unknown
  265. *
  266. * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
  267. * @version januari 2009, dokeos 1.8.6
  268. */
  269. function get_glossary_information($glossary_id)
  270. {
  271. // Database table definition
  272. $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
  273. $t_item_propery = Database :: get_course_table(TABLE_ITEM_PROPERTY);
  274. $sql = "SELECT g.glossary_id AS glossary_id,
  275. g.name AS glossary_title,
  276. g.description AS glossary_comment,
  277. g.display_order AS glossary_display_order
  278. FROM $t_glossary g, $t_item_propery ip
  279. WHERE g.glossary_id = ip.ref
  280. AND tool = '".TOOL_GLOSSARY."'
  281. AND g.glossary_id = '".Database::escape_string($glossary_id)."' ";
  282. $result = api_sql_query($sql, __FILE__, __LINE__);
  283. return Database::fetch_array($result);
  284. }
  285. /**
  286. * Delete a glossary term (and re-order all the others)
  287. *
  288. * @param integer $glossary_id the id of the glossary
  289. *
  290. * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
  291. * @version januari 2009, dokeos 1.8.6
  292. */
  293. function delete_glossary($glossary_id)
  294. {
  295. // Database table definition
  296. $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
  297. $sql = "DELETE FROM $t_glossary WHERE glossary_id='".Database::escape_string($glossary_id)."'";
  298. $result = api_sql_query($sql, __FILE__, __LINE__);
  299. // reorder the remaining terms
  300. reorder_glossary();
  301. $_SESSION['max_glossary_display'] = get_max_glossary_item();
  302. Display::display_confirmation_message(get_lang('TermDeleted'));
  303. }
  304. /**
  305. * This is the main function that display the list or the table with all the glossary terms
  306. *
  307. * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
  308. * @version januari 2009, dokeos 1.8.6
  309. */
  310. function display_glossary()
  311. {
  312. // action links
  313. echo '<div class="actions" style="margin-bottom:10px">';
  314. if (api_is_allowed_to_edit())
  315. {
  316. echo '<a href="index.php?'.api_get_cidreq().'&action=addglossary&msg=add">'.Display::return_icon('filenew.gif',get_lang('TermAddNew')).get_lang('TermAddNew').'</a>';
  317. }
  318. echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=list">'.Display::return_icon('view_list.gif',get_lang('ListView')).get_lang('ListView').'</a>';
  319. echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=table">'.Display::return_icon('view_table.gif',get_lang('TableView')).get_lang('TableView').'</a>';
  320. echo '</div>';
  321. if (!$_SESSION['glossary_view'] OR $_SESSION['glossary_view'] == 'table')
  322. {
  323. $table = new SortableTable('glossary', 'get_number_glossary_terms', 'get_glossary_data',0);
  324. $table->set_header(0, get_lang('DisplayOrder'), true);
  325. $table->set_header(1, get_lang('TermName'), true);
  326. $table->set_header(2, get_lang('TermDefinition'), true);
  327. $table->set_header(3, get_lang('CreationDate'), false);
  328. $table->set_header(4, get_lang('UpdateDate'), false);
  329. if (api_is_allowed_to_edit()) {
  330. $table->set_header(5, get_lang('Actions'), false);
  331. $table->set_column_filter(5, 'actions_filter');
  332. }
  333. $table->display();
  334. }
  335. if ($_SESSION['glossary_view'] == 'list')
  336. {
  337. display_glossary_list();
  338. }
  339. }
  340. /**
  341. * display the glossary terms in a list
  342. *
  343. * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
  344. * @version januari 2009, dokeos 1.8.6
  345. */
  346. function display_glossary_list()
  347. {
  348. $glossary_data = get_glossary_data(0,1000,0,ASC);
  349. foreach($glossary_data as $key=>$glossary_item)
  350. {
  351. echo '<div class="sectiontitle">'.$glossary_item[1].'</div>';
  352. echo '<div class="sectioncomment">'.$glossary_item[2].'</div>';
  353. if (api_is_allowed_to_edit()) {
  354. echo '<div>'.actions_filter($glossary_item[5], '',$glossary_item).'</div>';
  355. }
  356. }
  357. }
  358. /**
  359. * Get the number of glossary terms
  360. *
  361. * @return unknown
  362. *
  363. * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
  364. * @version januari 2009, dokeos 1.8.6
  365. */
  366. function get_number_glossary_terms()
  367. {
  368. // Database table definition
  369. $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
  370. $sql = "SELECT count(glossary_id) as total FROM $t_glossary";
  371. $res = api_sql_query($sql, __FILE__, __LINE__);
  372. $obj = Database::fetch_object($res);
  373. return $obj->total;
  374. }
  375. /**
  376. * get all the data of the glossary
  377. *
  378. * @param unknown_type $from
  379. * @param unknown_type $number_of_items
  380. * @param unknown_type $column
  381. * @param unknown_type $direction
  382. * @return unknown
  383. *
  384. * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
  385. * @version januari 2009, dokeos 1.8.6
  386. */
  387. function get_glossary_data($from, $number_of_items, $column, $direction)
  388. {
  389. // Database table definition
  390. $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
  391. $t_item_propery = Database :: get_course_table(TABLE_ITEM_PROPERTY);
  392. if (api_is_allowed_to_edit()) {
  393. $col5 = ", glossary.glossary_id as col5";
  394. } else {
  395. $col5 = " ";
  396. }
  397. $sql = "SELECT
  398. glossary.display_order as col0,
  399. glossary.name as col1,
  400. glossary.description as col2,
  401. ip.insert_date as col3,
  402. ip.lastedit_date as col4
  403. $col5
  404. FROM $t_glossary glossary, $t_item_propery ip
  405. WHERE glossary.glossary_id = ip.ref
  406. AND tool = '".TOOL_GLOSSARY."' ";
  407. $sql .= " ORDER BY col$column $direction ";
  408. $sql .= " LIMIT $from,$number_of_items";
  409. $res = api_sql_query($sql, __FILE__, __LINE__);
  410. $return = array ();
  411. while ($data = Database::fetch_row($res))
  412. {
  413. if (!$_SESSION['glossary_view'] OR $_SESSION['glossary_view'] == 'table') {
  414. $data[2] = str_replace(array('<p>','</p>'),array('','<br />'),$data[2]);
  415. }
  416. $return[] = $data;
  417. }
  418. return $return;
  419. }
  420. /**
  421. * Enter description here...
  422. *
  423. * @param unknown_type $glossary_id
  424. * @param unknown_type $url_params
  425. * @param unknown_type $row
  426. * @return unknown
  427. *
  428. * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
  429. * @version januari 2009, dokeos 1.8.6
  430. */
  431. function actions_filter($glossary_id,$url_params,$row)
  432. {
  433. if (!$_SESSION['max_glossary_display'] OR $_SESSION['max_glossary_display'] == '')
  434. {
  435. $_SESSION['max_glossary_display'] = get_max_glossary_item();
  436. }
  437. if (empty($_GET['glossary_column'])) {
  438. if ($row[0] > 1)
  439. {
  440. $return .= '<a href="'.api_get_self().'?action=moveup&amp;glossary_id='.$row[5].'">'.Display::return_icon('up.gif', get_lang('Up')).'</a>';
  441. }
  442. else
  443. {
  444. $return .= Display::return_icon('up_na.gif','&nbsp;');
  445. }
  446. if ($row[0] < $_SESSION['max_glossary_display'])
  447. {
  448. $return .= '<a href="'.api_get_self().'?action=movedown&amp;glossary_id='.$row[5].'">'.Display::return_icon('down.gif',get_lang('Down')).'</a>';
  449. }
  450. else
  451. {
  452. $return .= Display::return_icon('down_na.gif','&nbsp;');
  453. }
  454. }
  455. $return .= '<a href="'.api_get_self().'?action=edit_glossary&amp;glossary_id='.$row[5].'&msg=edit">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>';
  456. $return .= '<a href="'.api_get_self().'?action=delete_glossary&amp;glossary_id='.$row[5].'" onclick="return confirmation(\''.$row[1].'\');">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
  457. return $return;
  458. }
  459. /**
  460. * a little bit of javascript to display a prettier warning when deleting a term
  461. *
  462. * @return unknown
  463. *
  464. * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
  465. * @version januari 2009, dokeos 1.8.6
  466. */
  467. function javascript_glossary()
  468. {
  469. return "<script type=\"text/javascript\">
  470. function confirmation (name)
  471. {
  472. if (confirm(\" ". get_lang("TermConfirmDelete") ." \"+ name + \" ?\"))
  473. {return true;}
  474. else
  475. {return false;}
  476. }
  477. </script>";
  478. }
  479. /**
  480. * Enter description here...
  481. *
  482. * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
  483. * @version januari 2009, dokeos 1.8.6
  484. */
  485. function reorder_glossary()
  486. {
  487. // Database table definition
  488. $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
  489. $sql = "SELECT * FROM $t_glossary ORDER by display_order ASC";
  490. $res = api_sql_query($sql, __FILE__, __LINE__);
  491. $i = 1;
  492. while ($data = Database::fetch_array($res))
  493. {
  494. $sql_reorder = "UPDATE $t_glossary SET display_order = $i WHERE glossary_id = '".Database::escape_string($data['glossary_id'])."'";
  495. api_sql_query($sql_reorder, __FILE__, __LINE__);
  496. $i++;
  497. }
  498. }
  499. /**
  500. * Enter description here...
  501. *
  502. * @param unknown_type $direction
  503. * @param unknown_type $glossary_id
  504. *
  505. * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
  506. * @version januari 2009, dokeos 1.8.6
  507. */
  508. function move_glossary($direction, $glossary_id)
  509. {
  510. // Database table definition
  511. $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
  512. // sort direction
  513. if ($direction == 'up')
  514. {
  515. $sortorder = 'DESC';
  516. }
  517. else
  518. {
  519. $sortorder = 'ASC';
  520. }
  521. $sql = "SELECT * FROM $t_glossary ORDER BY display_order $sortorder";
  522. $res = api_sql_query($sql, __FILE__, __LINE__);
  523. while ($row = Database::fetch_array($res))
  524. {
  525. if ($found == true and empty($next_id))
  526. {
  527. $next_id = $row['glossary_id'];
  528. $next_display_order = $row['display_order'];
  529. }
  530. if ($row['glossary_id'] == $glossary_id)
  531. {
  532. $current_id = $glossary_id;
  533. $current_display_order = $row['display_order'];
  534. $found = true;
  535. }
  536. }
  537. $sql1 = "UPDATE $t_glossary SET display_order = '".Database::escape_string($next_display_order)."' WHERE glossary_id = '".Database::escape_string($current_id)."'";
  538. $sql2 = "UPDATE $t_glossary SET display_order = '".Database::escape_string($current_display_order)."' WHERE glossary_id = '".Database::escape_string($next_id)."'";
  539. $res = api_sql_query($sql1, __FILE__, __LINE__);
  540. $res = api_sql_query($sql2, __FILE__, __LINE__);
  541. Display::display_confirmation_message(get_lang('TermMoved'));
  542. }