extra_field.lib.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. <?php
  2. class ExtraField extends Model {
  3. public $columns = array('id', 'field_type', 'field_variable', 'field_display_text', 'field_default_value', 'field_order', 'field_visible', 'field_changeable', 'field_filter', 'tms');
  4. CONST FIELD_TYPE_TEXT = 1;
  5. CONST FIELD_TYPE_TEXTAREA = 2;
  6. CONST FIELD_TYPE_RADIO = 3;
  7. CONST FIELD_TYPE_SELECT = 4;
  8. CONST FIELD_TYPE_SELECT_MULTIPLE = 5;
  9. CONST FIELD_TYPE_DATE = 6;
  10. CONST FIELD_TYPE_DATETIME = 7;
  11. CONST FIELD_TYPE_DOUBLE_SELECT = 8;
  12. CONST FIELD_TYPE_DIVIDER = 9;
  13. CONST FIELD_TYPE_TAG = 10;
  14. CONST FIELD_TYPE_TIMEZONE = 11;
  15. CONST FIELD_TYPE_SOCIAL_PROFILE = 12;
  16. public $type = 'user'; //or session or course
  17. public $handler_id = 'user_id';
  18. function __construct($type) {
  19. $this->type = $type;
  20. switch ($this->type) {
  21. case 'course':
  22. $this->table_field_options = Database::get_main_table(TABLE_MAIN_COURSE_FIELD_OPTIONS);
  23. $this->table_field_values = Database::get_main_table(TABLE_MAIN_COURSE_FIELD_VALUES);
  24. //Used for the model
  25. $this->table = Database::get_main_table(TABLE_MAIN_COURSE_FIELD);
  26. $this->handler_id = 'course_code';
  27. break;
  28. case 'user':
  29. $this->table_field_options = Database::get_main_table(TABLE_MAIN_USER_FIELD_OPTIONS);
  30. $this->table_field_values = Database::get_main_table(TABLE_MAIN_USER_FIELD_VALUES);
  31. //Used for the model
  32. $this->table = Database::get_main_table(TABLE_MAIN_USER_FIELD);
  33. $this->handler_id = 'user_id';
  34. break;
  35. case 'session':
  36. $this->table_field_options = Database::get_main_table(TABLE_MAIN_SESSION_FIELD_OPTIONS);
  37. $this->table_field_values = Database::get_main_table(TABLE_MAIN_SESSION_FIELD_VALUES);
  38. //Used for the model
  39. $this->table = Database::get_main_table(TABLE_MAIN_SESSION_FIELD);
  40. $this->handler_id = 'session_id';
  41. break;
  42. }
  43. }
  44. public function get_count() {
  45. $row = Database::select('count(*) as count', $this->table, array(), 'first');
  46. return $row['count'];
  47. }
  48. public function get_all($where_conditions = array(), $order_field_options_by = null) {
  49. $options = Database::select('*', $this->table, array('where'=>$where_conditions, 'order' =>'field_order ASC'));
  50. $field_option = new ExtraFieldOption($this->type);
  51. if (!empty($options)) {
  52. foreach ($options as &$option) {
  53. $option['options'] = $field_option->get_field_options_by_field($option['id'], false, $order_field_options_by);
  54. }
  55. }
  56. return $options;
  57. }
  58. public function get_handler_field_info_by_field_variable($field_variable) {
  59. $field_variable = Database::escape_string($field_variable);
  60. $sql_field = "SELECT * FROM {$this->table} WHERE field_variable = '$field_variable'";
  61. $result = Database::query($sql_field);
  62. if (Database::num_rows($result)) {
  63. $r_field = Database::fetch_array($result, 'ASSOC');
  64. return $r_field;
  65. } else {
  66. return false;
  67. }
  68. }
  69. public function get_max_field_order() {
  70. $sql = "SELECT MAX(field_order) FROM {$this->table}";
  71. $res = Database::query($sql);
  72. $order = 0;
  73. if (Database::num_rows($res)>0) {
  74. $row = Database::fetch_row($res);
  75. $order = $row[0]+1;
  76. }
  77. return $order;
  78. }
  79. public static function get_extra_fields_by_handler($handler) {
  80. $types = array();
  81. $types[self::FIELD_TYPE_TEXT] = get_lang('FieldTypeText');
  82. $types[self::FIELD_TYPE_TEXTAREA] = get_lang('FieldTypeTextarea');
  83. $types[self::FIELD_TYPE_RADIO] = get_lang('FieldTypeRadio');
  84. $types[self::FIELD_TYPE_SELECT] = get_lang('FieldTypeSelect');
  85. $types[self::FIELD_TYPE_SELECT_MULTIPLE] = get_lang('FieldTypeSelectMultiple');
  86. $types[self::FIELD_TYPE_DATE] = get_lang('FieldTypeDate');
  87. $types[self::FIELD_TYPE_DATETIME] = get_lang('FieldTypeDatetime');
  88. $types[self::FIELD_TYPE_DOUBLE_SELECT] = get_lang('FieldTypeDoubleSelect');
  89. $types[self::FIELD_TYPE_DIVIDER] = get_lang('FieldTypeDivider');
  90. $types[self::FIELD_TYPE_TAG] = get_lang('FieldTypeTag');
  91. $types[self::FIELD_TYPE_TIMEZONE] = get_lang('FieldTypeTimezone');
  92. $types[self::FIELD_TYPE_SOCIAL_PROFILE] = get_lang('FieldTypeSocialProfile');
  93. switch ($handler) {
  94. case 'course':
  95. case 'session':
  96. unset($types[self::FIELD_TYPE_TAG]);
  97. unset($types[self::FIELD_TYPE_SOCIAL_PROFILE]);
  98. break;
  99. case 'user':
  100. break;
  101. }
  102. return $types;
  103. }
  104. public function add_elements($form, $item_id = null) {
  105. if (empty($form)) {
  106. return false;
  107. }
  108. $extra_data = false;
  109. if (!empty($item_id)) {
  110. $extra_data = self::get_handler_extra_data($item_id);
  111. if ($form) {
  112. $form->setDefaults($extra_data);
  113. }
  114. }
  115. $extra_fields = self::get_all();
  116. $extra = ExtraField::set_extra_fields_in_form($form, $extra_data, $this->type.'_field', false, false, $this->type, $extra_fields);
  117. return $extra;
  118. }
  119. public function get_handler_extra_data($item_id) {
  120. if (empty($item_id)) {
  121. return array();
  122. }
  123. $extra_data = array();
  124. $fields = self::get_all();
  125. $field_values = new ExtraFieldValue($this->type);
  126. if (!empty($fields) > 0) {
  127. foreach ($fields as $field) {
  128. $field_value = $field_values->get_values_by_handler_and_field_id($item_id, $field['id']);
  129. if ($field_value) {
  130. $field_value = $field_value['field_value'];
  131. switch ($field['field_type']) {
  132. case ExtraField::FIELD_TYPE_DOUBLE_SELECT:
  133. $selected_options = explode('::', $field_value);
  134. $extra_data['extra_'.$field['field_variable']]['extra_'.$field['field_variable']] = $selected_options[0];
  135. $extra_data['extra_'.$field['field_variable']]['extra_'.$field['field_variable'].'_second'] = $selected_options[1];
  136. break;
  137. case ExtraField::FIELD_TYPE_SELECT_MULTIPLE:
  138. $field_value = explode(';', $field_value);
  139. case ExtraField::FIELD_TYPE_RADIO:
  140. $extra_data['extra_'.$field['field_variable']]['extra_'.$field['field_variable']] = $field_value;
  141. break;
  142. default:
  143. $extra_data['extra_'.$field['field_variable']] = $field_value;
  144. break;
  145. }
  146. }
  147. }
  148. }
  149. return $extra_data;
  150. }
  151. public static function get_all_extra_field_by_type($field_type) {
  152. // all the information of the field
  153. $sql = "SELECT * FROM {$this->table} WHERE field_type='".Database::escape_string($field_type)."'";
  154. $result = Database::query($sql);
  155. $return = array();
  156. while ($row = Database::fetch_array($result)) {
  157. $return[] = $row['id'];
  158. }
  159. return $return;
  160. }
  161. public function get_field_types() {
  162. return self::get_extra_fields_by_handler($this->type);
  163. }
  164. public function get_field_type_by_id($id) {
  165. $types = self::get_field_types();
  166. if (isset($types[$id])) {
  167. return $types[$id];
  168. }
  169. return null;
  170. }
  171. /**
  172. * Converts a string like this:
  173. * France:Paris;Bretagne;Marseilles;Lyon|Belgique:Bruxelles;Namur;Liège;Bruges|Peru:Lima;Piura;
  174. * into
  175. * array('France' => array('Paris', 'Bregtane', 'Marseilles'), 'Belgique' => array('Namur', 'Liège', etc
  176. * @param string $string
  177. * @return array
  178. */
  179. static function extra_field_double_select_convert_string_to_array($string) {
  180. $options = explode('|', $string);
  181. $options_parsed = array();
  182. $id = 0;
  183. if (!empty($options)) {
  184. foreach ($options as $sub_options) {
  185. $options = explode(':', $sub_options);
  186. $sub_sub_options = explode(';', $options[1]);
  187. $options_parsed[$id] = array('label' => $options[0], 'options' => $sub_sub_options);
  188. $id++;
  189. }
  190. }
  191. return $options_parsed;
  192. }
  193. static function extra_field_double_select_convert_array_to_ordered_array($options) {
  194. $options_parsed = array();
  195. if (!empty($options)) {
  196. foreach ($options as $option) {
  197. if ($option['option_value'] == 0 ) {
  198. $options_parsed[$option['id']][] = $option;
  199. } else {
  200. $options_parsed[$option['option_value']][] = $option;
  201. }
  202. }
  203. }
  204. return $options_parsed;
  205. }
  206. /**
  207. * @param array options the result of the get_field_options_by_field() array
  208. */
  209. static function extra_field_double_select_convert_array_to_string($options) {
  210. $string = null;
  211. //var_dump($options);
  212. $options_parsed = self::extra_field_double_select_convert_array_to_ordered_array($options);
  213. if (!empty($options_parsed)) {
  214. foreach ($options_parsed as $option) {
  215. foreach ($option as $key => $item) {
  216. $string .= $item['option_display_text'];
  217. if ($key == 0) {
  218. $string .= ':';
  219. } else {
  220. if (isset($option[$key+1])) {
  221. $string .= ';';
  222. }
  223. }
  224. }
  225. $string .= '|';
  226. }
  227. }
  228. if (!empty($string)) {
  229. $string = substr($string, 0, strlen($string)-1);
  230. }
  231. return $string;
  232. }
  233. function clean_parameters($params) {
  234. if (!isset($params['field_variable']) || empty($params['field_variable'])) {
  235. $params['field_variable'] = trim(strtolower(str_replace(" ","_", $params['field_display_text'])));
  236. }
  237. if (!isset($params['field_order'])) {
  238. $max_order = self::get_max_field_order();
  239. $params['field_order'] = $max_order;
  240. }
  241. return $params;
  242. }
  243. public function save($params, $show_query = false) {
  244. $session_field_info = self::get_handler_field_info_by_field_variable($params['field_variable']);
  245. $params = self::clean_parameters($params);
  246. if ($session_field_info) {
  247. return $session_field_info['id'];
  248. } else {
  249. if (!isset($params['tms'])) {
  250. $params['tms'] = api_get_utc_datetime();
  251. }
  252. $id = parent::save($params, $show_query);
  253. if ($id) {
  254. $session_field_option = new SessionFieldOption();
  255. $params['field_id'] = $id;
  256. $session_field_option->save($params);
  257. }
  258. return $id;
  259. }
  260. }
  261. public function update($params) {
  262. $params = self::clean_parameters($params);
  263. if (isset($params['id'])) {
  264. $field_option = new ExtraFieldOption($this->type);
  265. $params['field_id'] = $params['id'];
  266. $field_option->save($params);
  267. }
  268. parent::update($params);
  269. }
  270. public function delete($id) {
  271. parent::delete($id);
  272. $field_option = new ExtraFieldOption($this->type);
  273. $field_option->delete_all_options_by_field_id($id);
  274. $session_field_values = new ExtraFieldValue($this->type);
  275. $session_field_values->delete_all_values_by_field_id($id);
  276. }
  277. static function set_extra_fields_in_form($form, $extra_data, $form_name, $admin_permissions = false, $user_id = null, $type = 'user', $extra = null) {
  278. $user_id = intval($user_id);
  279. // User extra fields
  280. if ($type == 'user') {
  281. $extra = UserManager::get_extra_fields(0, 50, 5, 'ASC', true, null, true);
  282. }
  283. $jquery_ready_content = null;
  284. if (!empty($extra))
  285. foreach ($extra as $field_details) {
  286. if (!$admin_permissions) {
  287. if ($field_details['field_visible'] == 0) {
  288. continue;
  289. }
  290. }
  291. switch ($field_details['field_type']) {
  292. case ExtraField::FIELD_TYPE_TEXT:
  293. $form->addElement('text', 'extra_'.$field_details['field_variable'], $field_details['field_display_text'], array('class' => 'span4'));
  294. $form->applyFilter('extra_'.$field_details['field_variable'], 'stripslashes');
  295. $form->applyFilter('extra_'.$field_details['field_variable'], 'trim');
  296. if (!$admin_permissions) {
  297. if ($field_details['field_visible'] == 0) $form->freeze('extra_'.$field_details['field_variable']);
  298. }
  299. break;
  300. case ExtraField::FIELD_TYPE_TEXTAREA:
  301. $form->add_html_editor('extra_'.$field_details['field_variable'], $field_details['field_display_text'], false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
  302. //$form->addElement('textarea', 'extra_'.$field_details['field_variable'], $field_details['field_display_text'], array('size' => 80));
  303. $form->applyFilter('extra_'.$field_details['field_variable'], 'stripslashes');
  304. $form->applyFilter('extra_'.$field_details['field_variable'], 'trim');
  305. if (!$admin_permissions) {
  306. if ($field_details['field_visible'] == 0) $form->freeze('extra_'.$field_details['field_variable']);
  307. }
  308. break;
  309. case ExtraField::FIELD_TYPE_RADIO:
  310. $group = array();
  311. foreach ($field_details['options'] as $option_id => $option_details) {
  312. $options[$option_details['option_value']] = $option_details['option_display_text'];
  313. $group[] = $form->createElement('radio', 'extra_'.$field_details['field_variable'], $option_details['option_value'],$option_details['option_display_text'].'<br />',$option_details['option_value']);
  314. }
  315. $form->addGroup($group, 'extra_'.$field_details['field_variable'], $field_details['field_display_text'], '');
  316. if (!$admin_permissions) {
  317. if ($field_details['field_visible'] == 0) $form->freeze('extra_'.$field_details['field_variable']);
  318. }
  319. break;
  320. case ExtraField::FIELD_TYPE_SELECT:
  321. $get_lang_variables = false;
  322. if (in_array($field_details['field_variable'], array('mail_notify_message','mail_notify_invitation', 'mail_notify_group_message'))) {
  323. $get_lang_variables = true;
  324. }
  325. $options = array();
  326. foreach ($field_details['options'] as $option_id => $option_details) {
  327. //$options[$option_details['option_value']] = $option_details['option_display_text'];
  328. if ($get_lang_variables) {
  329. $options[$option_details['option_value']] = get_lang($option_details['option_display_text']);
  330. } else {
  331. $options[$option_details['option_value']] = $option_details['option_display_text'];
  332. }
  333. }
  334. if ($get_lang_variables) {
  335. $field_details['field_display_text'] = get_lang($field_details['field_display_text']);
  336. }
  337. //chzn-select doesn't work for sessions??
  338. $form->addElement('select','extra_'.$field_details['field_variable'], $field_details['field_display_text'], $options, array('class'=>'', 'id'=>'extra_'.$field_details['field_variable']));
  339. if (!$admin_permissions) {
  340. if ($field_details['field_visible'] == 0) {
  341. $form->freeze('extra_'.$field_details['field_variable']);
  342. }
  343. }
  344. break;
  345. case ExtraField::FIELD_TYPE_SELECT_MULTIPLE:
  346. $options = array();
  347. foreach ($field_details['options'] as $option_id => $option_details) {
  348. $options[$option_details['option_value']] = $option_details['option_display_text'];
  349. }
  350. $form->addElement('select','extra_'.$field_details['field_variable'], $field_details['field_display_text'], $options, array('multiple' => 'multiple'));
  351. if (!$admin_permissions) {
  352. if ($field_details['field_visible'] == 0) {
  353. $form->freeze('extra_'.$field_details['field_variable']);
  354. }
  355. }
  356. break;
  357. case ExtraField::FIELD_TYPE_DATE:
  358. $form->addElement('datepickerdate', 'extra_'.$field_details['field_variable'], $field_details['field_display_text'], array('form_name' => $form_name));
  359. $form->_elements[$form->_elementIndex['extra_'.$field_details['field_variable']]]->setLocalOption('minYear', 1900);
  360. $defaults['extra_'.$field_details['field_variable']] = date('Y-m-d 12:00:00');
  361. $form -> setDefaults($defaults);
  362. if (!$admin_permissions) {
  363. if ($field_details['field_visible'] == 0) {
  364. $form->freeze('extra_'.$field_details['field_variable']);
  365. }
  366. }
  367. $form->applyFilter('theme', 'trim');
  368. break;
  369. case ExtraField::FIELD_TYPE_DATETIME:
  370. $form->addElement('datepicker', 'extra_'.$field_details['field_variable'], $field_details['field_display_text'], array('form_name' => $form_name));
  371. $form->_elements[$form->_elementIndex['extra_'.$field_details['field_variable']]]->setLocalOption('minYear', 1900);
  372. $defaults['extra_'.$field_details['field_variable']] = date('Y-m-d 12:00:00');
  373. $form -> setDefaults($defaults);
  374. if (!$admin_permissions) {
  375. if ($field_details['field_visible'] == 0) {
  376. $form->freeze('extra_'.$field_details['field_variable']);
  377. }
  378. }
  379. $form->applyFilter('theme', 'trim');
  380. break;
  381. case ExtraField::FIELD_TYPE_DOUBLE_SELECT:
  382. $first_select_id = 'first_extra_'.$field_details['field_variable'];
  383. $url = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1';
  384. $jquery_ready_content .= '
  385. $("#'.$first_select_id.'").on("change", function() {
  386. var id = $(this).val();
  387. if (id) {
  388. $.ajax({
  389. url: "'.$url.'&a=get_second_select_options",
  390. dataType: "json",
  391. data: "type='.$type.'&field_id='.$field_details['id'].'&option_value_id="+id,
  392. success: function(data) {
  393. $("#second_extra_'.$field_details['field_variable'].'").empty();
  394. $.each(data, function(index, value) {
  395. $("#second_extra_'.$field_details['field_variable'].'").append($("<option/>", {
  396. value: index,
  397. text: value
  398. }));
  399. });
  400. },
  401. });
  402. } else {
  403. $("#second_extra_'.$field_details['field_variable'].'").empty();
  404. }
  405. });';
  406. $first_id = null;
  407. $second_id = null;
  408. if (!empty($extra_data)) {
  409. $first_id = $extra_data['extra_'.$field_details['field_variable']]['extra_'.$field_details['field_variable']];
  410. $second_id = $extra_data['extra_'.$field_details['field_variable']]['extra_'.$field_details['field_variable'].'_second'];
  411. }
  412. $options = ExtraField::extra_field_double_select_convert_array_to_ordered_array($field_details['options']);
  413. $values = array('' => get_lang('Select'));
  414. $second_values = array();
  415. if (!empty($options)) {
  416. foreach ($options as $option) {
  417. foreach ($option as $sub_option) {
  418. if ($sub_option['option_value'] == '0') {
  419. $values[$sub_option['id']] = $sub_option['option_display_text'];
  420. } else {
  421. if ($first_id === $sub_option['option_value']) {
  422. $second_values[$sub_option['id']] = $sub_option['option_display_text'];
  423. }
  424. }
  425. }
  426. }
  427. }
  428. $group = array();
  429. $group[] = $form->createElement('select', 'extra_'.$field_details['field_variable'], null, $values, array('id' => $first_select_id));
  430. $group[] = $form->createElement('select', 'extra_'.$field_details['field_variable'].'_second', null, $second_values, array('id'=>'second_extra_'.$field_details['field_variable']));
  431. $form->addGroup($group, 'extra_'.$field_details['field_variable'], $field_details['field_display_text'], '&nbsp;');
  432. if (!$admin_permissions) {
  433. if ($field_details['field_visible'] == 0) {
  434. $form->freeze('extra_'.$field_details['field_variable']);
  435. }
  436. }
  437. break;
  438. case ExtraField::FIELD_TYPE_DIVIDER:
  439. $form->addElement('static', $field_details['field_variable'], '<br /><strong>'.$field_details['field_display_text'].'</strong>');
  440. break;
  441. case ExtraField::FIELD_TYPE_TAG:
  442. //the magic should be here
  443. $user_tags = UserManager::get_user_tags($user_id, $field_details['id']);
  444. $tag_list = '';
  445. if (is_array($user_tags) && count($user_tags) > 0) {
  446. foreach ($user_tags as $tag) {
  447. $tag_list .= '<option value="'.$tag['tag'].'" class="selected">'.$tag['tag'].'</option>';
  448. }
  449. }
  450. $multi_select = '<select id="extra_'.$field_details['field_variable'].'" name="extra_'.$field_details['field_variable'].'">
  451. '.$tag_list.'
  452. </select>';
  453. $form->addElement('label',$field_details['field_display_text'], $multi_select);
  454. $url = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php';
  455. $complete_text = get_lang('StartToType');
  456. //if cache is set to true the jquery will be called 1 time
  457. $field_variable = $field_details['field_variable'];
  458. $field_id = $field_details['id'];
  459. $jquery_ready_content .= <<<EOF
  460. $("#extra_$field_variable").fcbkcomplete({
  461. json_url: "$url?a=search_tags&field_id=$field_id",
  462. cache: false,
  463. filter_case: true,
  464. filter_hide: true,
  465. complete_text:"$complete_text",
  466. firstselected: false,
  467. filter_selected: true,
  468. newel: true
  469. });
  470. EOF;
  471. break;
  472. case ExtraField::FIELD_TYPE_TIMEZONE:
  473. $form->addElement('select', 'extra_'.$field_details['field_variable'], $field_details['field_display_text'], api_get_timezones(), '');
  474. if ($field_details['field_visible'] == 0) $form->freeze('extra_'.$field_details['field_variable']);
  475. break;
  476. case ExtraField::FIELD_TYPE_SOCIAL_PROFILE:
  477. // get the social network's favicon
  478. $icon_path = UserManager::get_favicon_from_url($extra_data['extra_'.$field_details['field_variable']], $field_details['field_default_value']);
  479. // special hack for hi5
  480. $leftpad = '1.7';
  481. $top = '0.4';
  482. $domain = parse_url($icon_path, PHP_URL_HOST);
  483. if ($domain == 'www.hi5.com' or $domain == 'hi5.com') {
  484. $leftpad = '3'; $top = '0';
  485. }
  486. // print the input field
  487. $form->addElement('text', 'extra_'.$field_details['field_variable'], $field_details['field_display_text'], array('size' => 60, 'style' => 'background-image: url(\''.$icon_path.'\'); background-repeat: no-repeat; background-position: 0.4em '.$top.'em; padding-left: '.$leftpad.'em; '));
  488. $form->applyFilter('extra_'.$field_details['field_variable'], 'stripslashes');
  489. $form->applyFilter('extra_'.$field_details['field_variable'], 'trim');
  490. if ($field_details['field_visible'] == 0) {
  491. $form->freeze('extra_'.$field_details['field_variable']);
  492. }
  493. break;
  494. }
  495. }
  496. $return = array();
  497. $return['jquery_ready_content'] = $jquery_ready_content;
  498. return $return;
  499. }
  500. }