user_edit.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <?php // $Id: user_edit.php 22233 2009-07-20 09:54:05Z ivantcholakov $
  2. /* For licensing terms, see /dokeos_license.txt */
  3. /**
  4. ==============================================================================
  5. * @package dokeos.admin
  6. ==============================================================================
  7. */
  8. // Language files that should be included
  9. $language_file = array('admin', 'registration');
  10. $cidReset = true;
  11. include '../inc/global.inc.php';
  12. $this_section = SECTION_PLATFORM_ADMIN;
  13. api_protect_admin_script();
  14. $htmlHeadXtra[] = '
  15. <script type="text/javascript">
  16. <!--
  17. function enable_expiration_date() { //v2.0
  18. document.user_edit.radio_expiration_date[0].checked=false;
  19. document.user_edit.radio_expiration_date[1].checked=true;
  20. }
  21. function password_switch_radio_button(){
  22. var input_elements = document.getElementsByTagName("input");
  23. for (var i = 0; i < input_elements.length; i++) {
  24. if(input_elements.item(i).name == "reset_password" && input_elements.item(i).value == "2") {
  25. input_elements.item(i).checked = true;
  26. }
  27. }
  28. }
  29. function display_drh_list(){
  30. if(document.getElementById("status_select").value=='.COURSEMANAGER.')
  31. {
  32. document.getElementById("id_platform_admin").style.display="block";
  33. }
  34. else if (document.getElementById("status_select").value=='.STUDENT.')
  35. {
  36. document.getElementById("id_platform_admin").style.display="none";
  37. }
  38. else
  39. {
  40. document.getElementById("id_platform_admin").style.display="none";
  41. }
  42. }
  43. function show_image(image,width,height) {
  44. width = parseInt(width) + 20;
  45. height = parseInt(height) + 20;
  46. window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \' , resizable=0\');
  47. }
  48. //-->
  49. </script>';
  50. $libpath = api_get_path(LIBRARY_PATH);
  51. require_once $libpath.'fileManage.lib.php';
  52. require_once $libpath.'fileUpload.lib.php';
  53. require_once $libpath.'usermanager.lib.php';
  54. require_once $libpath.'formvalidator/FormValidator.class.php';
  55. require_once $libpath.'image.lib.php';
  56. require_once $libpath.'mail.lib.inc.php';
  57. $user_id = isset($_GET['user_id']) ? intval($_GET['user_id']) : intval($_POST['user_id']);
  58. $noPHP_SELF = true;
  59. $tool_name = get_lang('ModifyUserInfo');
  60. $interbreadcrumb[] = array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
  61. $interbreadcrumb[] = array('url' => "user_list.php","name" => get_lang('UserList'));
  62. $table_user = Database::get_main_table(TABLE_MAIN_USER);
  63. $table_admin = Database::get_main_table(TABLE_MAIN_ADMIN);
  64. $sql = "SELECT u.*, a.user_id AS is_admin FROM $table_user u LEFT JOIN $table_admin a ON a.user_id = u.user_id WHERE u.user_id = '".$user_id."'";
  65. $res = Database::query($sql);
  66. if (Database::num_rows($res) != 1) {
  67. header('Location: user_list.php');
  68. exit;
  69. }
  70. $user_data = Database::fetch_array($res, 'ASSOC');
  71. $user_data['platform_admin'] = is_null($user_data['is_admin']) ? 0 : 1;
  72. $user_data['send_mail'] = 0;
  73. $user_data['old_password'] = $user_data['password'];
  74. //Convert the registration date of the user
  75. $user_data['registration_date'] = api_get_local_time($user_data['registration_date'], null, date_default_timezone_get());
  76. unset($user_data['password']);
  77. $user_data = array_merge($user_data, Usermanager :: get_extra_user_data($user_id, true));
  78. // Create the form
  79. $form = new FormValidator('user_edit', 'post', '', '', array('style' => 'width: 60%; float: '.($text_dir == 'rtl' ? 'right;' : 'left;')));
  80. $form->addElement('header', '', $tool_name);
  81. $form->addElement('hidden', 'user_id', $user_id);
  82. if (api_is_western_name_order()) {
  83. // Firstname
  84. $form->addElement('text', 'firstname', get_lang('FirstName'));
  85. $form->applyFilter('firstname', 'html_filter');
  86. $form->applyFilter('firstname', 'trim');
  87. $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
  88. // Lastname
  89. $form->addElement('text', 'lastname', get_lang('LastName'));
  90. $form->applyFilter('lastname', 'html_filter');
  91. $form->applyFilter('lastname', 'trim');
  92. $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
  93. } else {
  94. // Lastname
  95. $form->addElement('text', 'lastname', get_lang('LastName'));
  96. $form->applyFilter('lastname', 'html_filter');
  97. $form->applyFilter('lastname', 'trim');
  98. $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
  99. // Firstname
  100. $form->addElement('text', 'firstname', get_lang('FirstName'));
  101. $form->applyFilter('firstname', 'html_filter');
  102. $form->applyFilter('firstname', 'trim');
  103. $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
  104. }
  105. // Official code
  106. $form->addElement('text', 'official_code', get_lang('OfficialCode'), array('size' => '40'));
  107. $form->applyFilter('official_code', 'html_filter');
  108. $form->applyFilter('official_code', 'trim');
  109. // Email
  110. $form->addElement('text', 'email', get_lang('Email'), array('size' => '40'));
  111. $form->addRule('email', get_lang('EmailWrong'), 'email');
  112. $form->addRule('email', get_lang('EmailWrong'), 'required');
  113. // OpenID
  114. if (api_get_setting('openid_authentication') == 'true') {
  115. $form->addElement('text', 'openid', get_lang('OpenIDURL'), array('size' => '40'));
  116. }
  117. // Phone
  118. $form->addElement('text', 'phone', get_lang('PhoneNumber'));
  119. // Picture
  120. $form->addElement('file', 'picture', get_lang('AddPicture'));
  121. $allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif');
  122. $form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
  123. if (strlen($user_data['picture_uri']) > 0) {
  124. $form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage'));
  125. }
  126. // Username
  127. $form->addElement('text', 'username', get_lang('LoginName'), array('maxlength' => USERNAME_MAX_LENGTH));
  128. $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
  129. $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
  130. $form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username');
  131. $form->addRule('username', get_lang('UserTaken'), 'username_available', $user_data['username']);
  132. // Password
  133. $form->addElement('radio', 'reset_password', get_lang('Password'), get_lang('DontResetPassword'), 0);
  134. if (count($extAuthSource) > 0)
  135. {
  136. $group[] =& HTML_QuickForm::createElement('radio', 'reset_password', null, get_lang('ExternalAuthentication').' ', 3);
  137. $auth_sources = array();
  138. foreach($extAuthSource as $key => $info) {
  139. $auth_sources[$key] = $key;
  140. }
  141. $group[] =& HTML_QuickForm::createElement('select', 'auth_source', null, $auth_sources);
  142. $group[] =& HTML_QuickForm::createElement('static', '', '', '<br />');
  143. $form->addGroup($group, 'password', null, '', false);
  144. }
  145. $form->addElement('radio', 'reset_password', null, get_lang('AutoGeneratePassword'), 1);
  146. $group = array();
  147. $group[] =& HTML_QuickForm::createElement('radio', 'reset_password', null, null, 2);
  148. $group[] =& HTML_QuickForm::createElement('password', 'password', null, array('onkeydown' => 'javascript: password_switch_radio_button();'));
  149. $form->addGroup($group, 'password', null, '', false);
  150. // Status
  151. $status = array();
  152. $status[COURSEMANAGER] = get_lang('Teacher');
  153. $status[STUDENT] = get_lang('Learner');
  154. $status[DRH] = get_lang('Drh');
  155. $status[SESSIONADMIN] = get_lang('SessionsAdmin');
  156. $form->addElement('select', 'status', get_lang('Status'), $status, array('id' => 'status_select', 'onchange' => 'javascript: display_drh_list();'));
  157. //Language
  158. $form->addElement('select_language', 'language', get_lang('Language'));
  159. $display = $user_data['status'] == STUDENT || $_POST['status'] == STUDENT ? 'block' : 'none';
  160. /*
  161. $form->addElement('html', '<div id="drh_list" style="display:'.$display.';">');
  162. $drh_select = $form->addElement('select', 'hr_dept_id', get_lang('Drh'), array(), 'id="drh_select"');
  163. $drh_list = UserManager :: get_user_list(array('status' => DRH), api_sort_by_first_name() ? array('firstname', 'lastname') : array('lastname', 'firstname'));
  164. if (count($drh_list) == 0) {
  165. $drh_select->addOption('- '.get_lang('ThereIsNotStillAResponsible', '').' -', 0);
  166. } else {
  167. $drh_select->addOption('- '.get_lang('SelectAResponsible').' -', 0);
  168. }
  169. foreach($drh_list as $drh) {
  170. $drh_select->addOption(api_get_person_name($drh['firstname'], $drh['lastname']), $drh['user_id']);
  171. }
  172. $form->addElement('html', '</div>');
  173. */
  174. // Platform admin
  175. // Only when changing another user!
  176. if ($user_id != $_user['user_id']) {
  177. $group = array();
  178. $group[] =& HTML_QuickForm::createElement('radio', 'platform_admin', null, get_lang('Yes'), 1);
  179. $group[] =& HTML_QuickForm::createElement('radio', 'platform_admin', null, get_lang('No'), 0);
  180. $user_data['status'] == 1 ? $display = 'block':$display = 'none';
  181. $form->addElement('html', '<div id="id_platform_admin" style="display:'.$display.'">');
  182. $form->addGroup($group, 'admin', get_lang('PlatformAdmin'), null, false);
  183. $form->addElement('html', '</div>');
  184. }
  185. // Send email
  186. $group = array();
  187. $group[] =& HTML_QuickForm::createElement('radio', 'send_mail', null, get_lang('Yes'), 1);
  188. $group[] =& HTML_QuickForm::createElement('radio', 'send_mail', null, get_lang('No'), 0);
  189. $form->addGroup($group, 'mail', get_lang('SendMailToNewUser'), '&nbsp;', false);
  190. // Registration Date
  191. $form->addElement('static', 'registration_date', get_lang('RegistrationDate'), $user_data['registration_date']);
  192. if (!$user_data['platform_admin']) {
  193. // Expiration Date
  194. $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0);
  195. $group = array ();
  196. $group[] = & $form->createElement('radio', 'radio_expiration_date', null, get_lang('On'), 1);
  197. $group[] = & $form->createElement('datepicker', 'expiration_date', null, array('form_name' => $form->getAttribute('name'), 'onchange' => 'javascript: enable_expiration_date();'));
  198. $form->addGroup($group, 'max_member_group', null, '', false);
  199. // Active account or inactive account
  200. $form->addElement('radio', 'active', get_lang('ActiveAccount'), get_lang('Active'), 1);
  201. $form->addElement('radio', 'active', '', get_lang('Inactive'), 0);
  202. }
  203. // EXTRA FIELDS
  204. $extra = UserManager::get_extra_fields(0, 50, 5, 'ASC');
  205. foreach ($extra as $id => $field_details) {
  206. if ($field_details[6] == 0) {
  207. continue;
  208. }
  209. switch ($field_details[2]) {
  210. case USER_FIELD_TYPE_TEXT:
  211. $form->addElement('text', 'extra_'.$field_details[1], $field_details[3], array('size' => 40));
  212. $form->applyFilter('extra_'.$field_details[1], 'stripslashes');
  213. $form->applyFilter('extra_'.$field_details[1], 'trim');
  214. break;
  215. case USER_FIELD_TYPE_TEXTAREA:
  216. $form->add_html_editor('extra_'.$field_details[1], $field_details[3], false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
  217. //$form->addElement('textarea', 'extra_'.$field_details[1], $field_details[3], array('size' => 80));
  218. $form->applyFilter('extra_'.$field_details[1], 'stripslashes');
  219. $form->applyFilter('extra_'.$field_details[1], 'trim');
  220. break;
  221. case USER_FIELD_TYPE_RADIO:
  222. $group = array();
  223. foreach ($field_details[9] as $option_id => $option_details) {
  224. $options[$option_details[1]] = $option_details[2];
  225. $group[] =& HTML_QuickForm::createElement('radio', 'extra_'.$field_details[1], $option_details[1], $option_details[2].'<br />', $option_details[1]);
  226. }
  227. $form->addGroup($group, 'extra_'.$field_details[1], $field_details[3], '');
  228. break;
  229. case USER_FIELD_TYPE_SELECT:
  230. $options = array();
  231. foreach ($field_details[9] as $option_id => $option_details) {
  232. $options[$option_details[1]] = $option_details[2];
  233. }
  234. $form->addElement('select', 'extra_'.$field_details[1], $field_details[3], $options, '');
  235. break;
  236. case USER_FIELD_TYPE_SELECT_MULTIPLE:
  237. $options = array();
  238. foreach ($field_details[9] as $option_id => $option_details) {
  239. $options[$option_details[1]] = $option_details[2];
  240. }
  241. $form->addElement('select', 'extra_'.$field_details[1], $field_details[3], $options, array('multiple' => 'multiple'));
  242. break;
  243. case USER_FIELD_TYPE_DATE:
  244. $form->addElement('datepickerdate', 'extra_'.$field_details[1], $field_details[3], array('form_name' => 'user_edit'));
  245. $form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear', 1900);
  246. $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
  247. $form -> setDefaults($defaults);
  248. $form->applyFilter('theme', 'trim');
  249. break;
  250. case USER_FIELD_TYPE_DATETIME:
  251. $form->addElement('datepicker', 'extra_'.$field_details[1], $field_details[3], array('form_name' => 'user_edit'));
  252. $form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear', 1900);
  253. $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
  254. $form -> setDefaults($defaults);
  255. $form->applyFilter('theme', 'trim');
  256. break;
  257. }
  258. }
  259. // Submit button
  260. $form->addElement('style_submit_button', 'submit', get_lang('ModifyInformation'), 'class="save"');
  261. // Set default values
  262. $user_data['reset_password'] = 0;
  263. $expiration_date = $user_data['expiration_date'];
  264. if ($expiration_date == '0000-00-00 00:00:00') {
  265. $user_data['radio_expiration_date'] = 0;
  266. $user_data['expiration_date'] = array();
  267. $user_data['expiration_date']['d'] = date('d');
  268. $user_data['expiration_date']['F'] = date('m');
  269. $user_data['expiration_date']['Y'] = date('Y');
  270. } else {
  271. $user_data['radio_expiration_date'] = 1;
  272. $user_data['expiration_date'] = array();
  273. $user_data['expiration_date']['d'] = substr($expiration_date, 8, 2);
  274. $user_data['expiration_date']['F'] = substr($expiration_date, 5, 2);
  275. $user_data['expiration_date']['Y'] = substr($expiration_date, 0, 4);
  276. }
  277. $form->setDefaults($user_data);
  278. $error_drh = false;
  279. // Validate form
  280. if ( $form->validate()) {
  281. $user = $form->exportValues();
  282. $is_user_subscribed_in_course = CourseManager::is_user_subscribed_in_course($user['user_id']);
  283. if ($user['status'] == DRH && $is_user_subscribed_in_course) {
  284. $error_drh = true;
  285. } else {
  286. $picture_element = & $form->getElement('picture');
  287. $picture = $picture_element->getValue();
  288. $picture_uri = $user_data['picture_uri'];
  289. if ($user['delete_picture']) {
  290. $picture_uri = UserManager::delete_user_picture($user_id);
  291. }
  292. elseif (!empty($picture['name'])) {
  293. $picture_uri = UserManager::update_user_picture($user_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);
  294. }
  295. $lastname = $user['lastname'];
  296. $firstname = $user['firstname'];
  297. $official_code = $user['official_code'];
  298. $email = $user['email'];
  299. $phone = $user['phone'];
  300. $username = $user['username'];
  301. $status = intval($user['status']);
  302. $platform_admin = intval($user['platform_admin']);
  303. $send_mail = intval($user['send_mail']);
  304. $reset_password = intval($user['reset_password']);
  305. $hr_dept_id = intval($user['hr_dept_id']);
  306. $language = $user['language'];
  307. if ($user['radio_expiration_date'] == '1' && !$user_data['platform_admin']) {
  308. $expiration_date=$user['expiration_date'];
  309. } else {
  310. $expiration_date='0000-00-00 00:00:00';
  311. }
  312. $active = $user_data['platform_admin'] ? 1 : intval($user['active']);
  313. if ($reset_password == 0) {
  314. $password = null;
  315. $auth_source = $user_data['auth_source'];
  316. }
  317. elseif($reset_password == 1) {
  318. $password = api_generate_password();
  319. $auth_source = PLATFORM_AUTH_SOURCE;
  320. }
  321. elseif($reset_password == 2) {
  322. $password = $user['password'];
  323. $auth_source = PLATFORM_AUTH_SOURCE;
  324. }
  325. elseif($reset_password == 3) {
  326. $password = $user['password'];
  327. $auth_source = $user['auth_source'];
  328. }
  329. UserManager::update_user($user_id, $firstname, $lastname, $username, $password, $auth_source, $email, $status, $official_code, $phone, $picture_uri, $expiration_date, $active, null, $hr_dept_id, null, $language);
  330. if (api_get_setting('openid_authentication') == 'true' && !empty($user['openid'])) {
  331. $up = UserManager::update_openid($user_id,$user['openid']);
  332. }
  333. if ($user_id != $_SESSION['_uid']) {
  334. if ($platform_admin == 1) {
  335. $sql = "INSERT IGNORE INTO $table_admin SET user_id = '".$user_id."'";
  336. Database::query($sql);
  337. } else {
  338. $sql = "DELETE FROM $table_admin WHERE user_id = '".$user_id."'";
  339. Database::query($sql);
  340. }
  341. }
  342. $extras = array();
  343. foreach($user as $key => $value) {
  344. if(substr($key, 0, 6) == 'extra_') { //an extra field
  345. $myres = UserManager::update_extra_field_value($user_id, substr($key, 6), $value);
  346. }
  347. }
  348. if (!empty ($email) && $send_mail) {
  349. $recipient_name = api_get_person_name($firstname, $lastname, null, PERSON_NAME_EMAIL_ADDRESS);
  350. $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
  351. $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
  352. $email_admin = api_get_setting('emailAdministrator');
  353. if ($_configuration['multiple_access_urls'] == true) {
  354. $access_url_id = api_get_current_access_url_id();
  355. if ($access_url_id != -1) {
  356. $url = api_get_access_url($access_url_id);
  357. $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".get_lang('YouAreReg')." ". api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $username . (($reset_password > 0) ? "\n". get_lang('Pass')." : ".stripslashes($password) : "") . "\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $url['url'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator');
  358. }
  359. }
  360. else {
  361. $emailbody=get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".get_lang('YouAreReg')." ". api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $username . (($reset_password > 0) ? "\n". get_lang('Pass')." : ".stripslashes($password) : "") . "\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $_configuration['root_web'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator');
  362. }
  363. @api_mail($recipient_name, $email, $emailsubject, $emailbody, $sender_name, $email_admin);
  364. }
  365. $tok = Security::get_token();
  366. header('Location: user_list.php?action=show_message&message='.urlencode(get_lang('UserUpdated')).'&sec_token='.$tok);
  367. exit();
  368. }
  369. }
  370. Display::display_header($tool_name);
  371. if ($error_drh) {
  372. $err_msg = get_lang('StatusCanNotBeChangedToHumanResourcesManager');
  373. Display::display_error_message($err_msg);
  374. }
  375. // USER PICTURE
  376. $image_path = UserManager::get_user_picture_path_by_id($user_id,'web');
  377. $image_dir = $image_path['dir'];
  378. $image = $image_path['file'];
  379. $image_file = ($image != '' ? $image_dir.$image : api_get_path(WEB_CODE_PATH).'img/unknown.jpg');
  380. $image_size = api_getimagesize($image_file);
  381. $img_attributes = 'src="'.$image_file.'?rand='.time().'" '
  382. .'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" '
  383. .'style="float:'.($text_dir == 'rtl' ? 'left' : 'right').'; padding:5px;" ';
  384. if ($image_size[0] > 300) { //limit display width to 300px
  385. $img_attributes .= 'width="300" ';
  386. }
  387. // get the path,width and height from original picture
  388. $big_image = $image_dir.'big_'.$image;
  389. $big_image_size = api_getimagesize($big_image);
  390. $big_image_width = $big_image_size[0];
  391. $big_image_height = $big_image_size[1];
  392. $url_big_image = $big_image.'?rnd='.time();
  393. if ($image == '') {
  394. echo '<img '.$img_attributes.' />';
  395. } else {
  396. echo '<input type="image" '.$img_attributes.' onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>';
  397. }
  398. // Display form
  399. $form->display();
  400. // Footer
  401. Display::display_footer();