/** * Update action icons column * * @param integer $glossary_id * @param array Parameters to use to affect links * @param array The line of results from a query on the glossary table * @return string HTML string for the action icons columns * * @author Patrick Cool <*****@*****.**>, Ghent University, Belgium * @version januari 2009, dokeos 1.8.6 */ public static function actions_filter($glossary_id, $url_params, $row) { $glossary_id = $row[2]; $return = '<a href="' . api_get_self() . '?action=edit_glossary&glossary_id=' . $glossary_id . '&' . api_get_cidreq() . '&msg=edit">' . Display::return_icon('edit.png', get_lang('Edit'), '', 22) . '</a>'; $glossary_data = GlossaryManager::get_glossary_information($glossary_id); $glossary_term = $glossary_data['glossary_title']; if (api_is_allowed_to_edit(null, true)) { if ($glossary_data['session_id'] == api_get_session_id()) { $return .= '<a href="' . api_get_self() . '?action=delete_glossary&glossary_id=' . $glossary_id . '&' . api_get_cidreq() . '" onclick="return confirmation(\'' . $glossary_term . '\');">' . Display::return_icon('delete.png', get_lang('Delete'), '', 22) . '</a>'; } else { $return = get_lang('EditionNotAvailableFromSession'); } } return $return; }
if (is_numeric($_GET['glossary_id'])) { // initiate the object $form = new FormValidator('glossary', 'post', api_get_self() . '?action=' . Security::remove_XSS($_GET['action']) . '&glossary_id=' . Security::remove_XSS($_GET['glossary_id'])); // Setting the form elements $form->addElement('header', '', get_lang('TermEdit')); $form->addElement('hidden', 'glossary_id'); $form->addElement('text', 'glossary_title', get_lang('TermName'), array('size' => '80')); //$form->applyFilter('glossary_title', 'html_filter'); $form->addElement('html_editor', 'glossary_comment', get_lang('TermDefinition'), null, array('ToolbarSet' => 'Glossary', 'Width' => '90%', 'Height' => '300')); $element = $form->addElement('text', 'insert_date', get_lang('CreationDate'), array('size' => '100')); $element->freeze(); $element = $form->addElement('text', 'update_date', get_lang('UpdateDate'), array('size' => '100')); $element->freeze(); $form->addElement('style_submit_button', 'SubmitGlossary', get_lang('TermUpdateButton'), 'class="save"'); // setting the defaults $glossary_data = GlossaryManager::get_glossary_information($_GET['glossary_id']); // Date treatment for timezones if (!empty($glossary_data['insert_date']) && $glossary_data['insert_date'] != '0000-00-00 00:00:00:') { $glossary_data['insert_date'] = api_get_local_time($glossary_data['insert_date']); } else { $glossary_data['insert_date'] = ''; } if (!empty($glossary_data['update_date']) && $glossary_data['update_date'] != '0000-00-00 00:00:00:') { $glossary_data['update_date'] = api_get_local_time($glossary_data['update_date']); } else { $glossary_data['update_date'] = ''; } $form->setDefaults($glossary_data); // setting the rules $form->addRule('glossary_title', get_lang('ThisFieldIsRequired'), 'required'); // The validation or display