defaultRenderer(); $renderer->setElementTemplate('
{element}
'); $form->add_html_editor('intro_content',null,null,false); $form->addElement('style_submit_button', 'intro_cmdUpdate', get_lang('SaveIntroText'), 'class="save"'); /*========================================================= INTRODUCTION MICRO MODULE - COMMANDS SECTION (IF ALLOWED) ========================================================*/ if ($intro_editAllowed) { /* Replace command */ if ( $intro_cmdUpdate ) { if ( $form->validate()) { $form_values = $form->exportValues(); $intro_content = $form_values['intro_content']; if ( ! empty($intro_content) ) { $sql = "REPLACE $TBL_INTRODUCTION SET id='$moduleId',intro_text='".Database::escape_string($intro_content)."'"; api_sql_query($sql,__FILE__,__LINE__); Display::display_confirmation_message(get_lang('IntroductionTextUpdated'),false); } else { $intro_cmdDel = true; // got to the delete command } } else { $intro_cmdEdit = true; } } /* Delete Command */ if ($intro_cmdDel) { api_sql_query("DELETE FROM $TBL_INTRODUCTION WHERE id='".$moduleId."'",__FILE__,__LINE__); Display::display_confirmation_message(get_lang('IntroductionTextDeleted')); } } /*=========================================== INTRODUCTION MICRO MODULE - DISPLAY SECTION ===========================================*/ /* Retrieves the module introduction text, if exist */ $sql = "SELECT intro_text FROM $TBL_INTRODUCTION WHERE id='".$moduleId."'"; $intro_dbQuery = api_sql_query($sql,__FILE__,__LINE__); $intro_dbResult = mysql_fetch_array($intro_dbQuery); $intro_content = $intro_dbResult['intro_text']; /* Determines the correct display */ if ($intro_cmdEdit || $intro_cmdAdd) { $intro_dispDefault = false; $intro_dispForm = true; $intro_dispCommand = false; } else { $intro_dispDefault = true; $intro_dispForm = false; if ($intro_editAllowed) { $intro_dispCommand = true; } else { $intro_dispCommand = false; } } /* Executes the display */ if ($intro_dispForm) { $default['intro_content'] = $intro_content; $form->setDefaults($default); //echo '
'; echo '
'; $form->display(); echo '
'; } if ($intro_dispDefault) { //$intro_content = make_clickable($intro_content); // make url in text clickable $intro_content = text_filter($intro_content); // parse [tex] codes if (!empty($intro_content)) { echo "
$intro_content
"; } } if ($intro_dispCommand) { if ( empty($intro_content) ) { //displays "Add intro" Commands echo "

\n"; if (!empty ($GLOBALS["_cid"])) { echo "\n".get_lang('AddIntro')."\n"; } else { echo "\n".get_lang('AddIntro')."\n"; } echo "

\n
"; } else { // displays "edit intro && delete intro" Commands echo "

\n"; if (!empty ($GLOBALS["_cid"])) { echo "\"".get_lang('Modify')."\"\n"; echo "\"".get_lang('Delete')."\"\n"; } else { echo "\"".get_lang('Modify')."\"\n"; echo "\"".get_lang('Delete')."\"\n"; } echo "

\n
"; } } ?>