123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834 |
- <?php
- $language_file = 'admin';
- $cidReset=true;
- include_once ('../inc/global.inc.php');
- require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
- require_once (api_get_path(LIBRARY_PATH).'fileManage.lib.php');
- require_once (api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
- $this_section = SECTION_PLATFORM_ADMIN;
- api_protect_admin_script();
- if (!empty($_POST['submit_stylesheets']))
- {
- $message = store_stylesheets();
- header("Location: ".api_get_self()."?category=stylesheets");
- exit;
- }
- $table_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
- $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
- $tool_name = get_lang('DokeosConfigSettings');
- if (!empty($_GET['category']) and !in_array($_GET['category'], array('Plugins', 'stylesheets', 'Search')))
- {
- $form = new FormValidator('settings', 'post', 'settings.php?category='.$_GET['category']);
- $renderer = & $form->defaultRenderer();
- $renderer->setHeaderTemplate('<div class="sectiontitle">{header}</div>'."\n");
- $renderer->setElementTemplate('<div class="sectioncomment">{label}</div>'."\n".'<div class="sectionvalue">{element}</div>'."\n");
- $my_category = mysql_real_escape_string($_GET['category']);
-
- $sqlcountsettings = "SELECT COUNT(*) FROM $table_settings_current WHERE category='".$my_category."' AND type<>'checkbox'";
- $resultcountsettings = api_sql_query($sqlcountsettings, __FILE__, __LINE__);
- $countsetting = mysql_fetch_array($resultcountsettings);
-
- if ($_configuration['access_url']==1)
- {
- $settings = api_get_settings($my_category,'group',$_configuration['access_url']);
- }
- else
- {
- $url_info = api_get_access_url($_configuration['access_url']);
- if ($url_info['active']==1)
- {
-
- $settings = api_get_settings($my_category,'group',1,0);
-
- $settings_by_access = api_get_settings($my_category,'group',$_configuration['access_url'],1);
-
-
- $settings_by_access_list=array();
- foreach($settings_by_access as $row)
- {
- if (empty($row['variable']))
- $row['variable']=0;
- if (empty($row['subkey']))
- $row['subkey']=0;
- if (empty($row['category']))
- $row['category']=0;
-
- if ($row['access_url_changeable']==1)
- $settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ] = $row;
- else
- $settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ] = array();
- }
- }
- }
-
-
-
-
- $default_values = array();
- foreach($settings as $row) {
- ($countsetting['0']%10) < 5 ?$b=$countsetting['0']-10:$b=$countsetting['0'];
- if ($i % 10 == 0 and $i<$b){
- if ($_GET['category'] <> "Languages"){
- $form->addElement('html','<div align="right">');
- $form->addElement('submit', null,get_lang('SaveSettings'));
- $form->addElement('html','</div>');
- }
- }
- $i++;
- $form->addElement('header', null, get_lang($row['title']));
- $hideme=array();
- $hide_element=false;
- if ($_configuration['access_url']!=1)
- {
- if ($row['access_url_changeable']==0)
- {
-
- $hide_element=true;
- $hideme=array('disabled');
- }
- elseif($url_info['active']==1)
- {
-
- if (empty($row['variable']))
- $row['variable']=0;
- if (empty($row['subkey']))
- $row['subkey']=0;
- if (empty($row['category']))
- $row['category']=0;
-
- if (is_array ($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ]))
- {
-
- if ($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ]['selected_value']!='')
- $row['selected_value'] =$settings_by_access_list[$row['variable']] [$row['subkey']] [ $row['category'] ]['selected_value'];
- }
-
- }
- }
-
- switch ($row['type']) {
- case 'textfield' :
- if ($row['variable']=='account_valid_duration') {
- $form->addElement('text', $row['variable'], get_lang($row['comment']),array('maxlength'=>'5'));
- $default_values[$row['variable']] = $row['selected_value'];
- } else {
- $form->addElement('text', $row['variable'], get_lang($row['comment']),$hideme);
- $default_values[$row['variable']] = $row['selected_value'];
- }
- break;
- case 'textarea' :
- $form->addElement('textarea', $row['variable'], get_lang($row['comment']),$hideme);
- $default_values[$row['variable']] = $row['selected_value'];
- break;
- case 'radio' :
- $values = get_settings_options($row['variable']);
- $group = array ();
- foreach ($values as $key => $value) {
- $element = & $form->createElement('radio', $row['variable'], '', get_lang($value['display_text']), $value['value']);
- if ($hide_element) {
- $element->freeze();
- }
- $group[] = $element;
- }
-
- $form->addGroup($group, $row['variable'], get_lang($row['comment']), '<br />', false);
- $default_values[$row['variable']] = $row['selected_value'];
- break;
- case 'checkbox';
-
- if ($row['access_url_changeable']==1) {
-
- $access_url = $_configuration['access_url'];
- if (empty($access_url))
- $access_url = 1;
-
- $sql = "SELECT * FROM settings_current WHERE variable='".$row['variable']."' AND access_url = $access_url";
- } else {
- $sql = "SELECT * FROM settings_current WHERE variable='".$row['variable']."' AND access_url = 1";
- }
-
- $result = api_sql_query($sql, __FILE__, __LINE__);
- $group = array ();
- while ($rowkeys = Database::fetch_array($result)) {
- $element = & $form->createElement('checkbox', $rowkeys['subkey'], '', get_lang($rowkeys['subkeytext']));
- if ($rowkeys['selected_value'] == 'true' && ! $form->isSubmitted()) {
- $element->setChecked(true);
- }
- if ($hide_element) {
- $element->freeze();
- }
- $group[] = $element;
- }
- $form->addGroup($group, $row['variable'], get_lang($row['comment']), '<br />'."\n");
- break;
- case "link" :
- $form->addElement('static', null, get_lang($row['comment']), get_lang('CurrentValue').' : '.$row['selected_value'],$hideme);
- }
- }
- if ($_GET['category'] <> "Languages"){
- $form->addElement('html','<div align="right">');
- $form->addElement('submit', null,get_lang('SaveSettings'));
- $form->addElement('html','</div>');
- }
- $form->setDefaults($default_values);
- if ($form->validate())
- {
- $values = $form->exportValues();
-
-
-
-
-
- $r = api_set_settings_category($my_category,'false',$_configuration['access_url']);
-
-
-
- foreach ($values as $key => $value)
- {
- if (!is_array($value))
- {
-
-
- $result = api_set_setting($key,$value,null,null,$_configuration['access_url']);
- }
- else
- {
- foreach ($value as $subkey => $subvalue)
- {
-
-
- $result = api_set_setting($key,'true',$subkey,null,$_configuration['access_url']);
- }
- }
- }
- header('Location: settings.php?action=stored&category='.$_GET['category']);
- exit;
- }
- }
- Display :: display_header($tool_name);
- if (!empty($_GET['action']) && $_GET['action'] == "stored")
- {
- Display :: display_normal_message($SettingsStored);
- }
- $action_images['platform'] = 'dokeos.gif';
- $action_images['course'] = 'course.gif';
- $action_images['tools'] = 'reference.gif';
- $action_images['user'] = 'students.gif';
- $action_images['gradebook'] = 'gradebook_eval_not_empty.gif';
- $action_images['ldap'] = 'loginmanager.gif';
- $action_images['security'] = 'passwordprotected.gif';
- $action_images['languages'] = 'forum.gif';
- $action_images['tuning'] = 'tuning.gif';
- $action_images['plugins'] = 'plugin.gif';
- $action_images['stylesheets'] = 'theme.gif';
- $action_images['templates'] = 'template.gif';
- $action_images['search'] = 'search.gif';
- $resultcategories = api_get_settings_categories(array('stylesheets','Plugins', 'Templates', 'Search'));
- echo "\n<div class=\"actions\">";
- foreach($resultcategories as $row)
- {
- echo "\n\t<a href=\"".api_get_self()."?category=".$row['category']."\">".Display::return_icon($action_images[strtolower($row['category'])], ucfirst(get_lang($row['category']))).ucfirst(get_lang($row['category']))."</a>";
- }
- echo "\n\t<a href=\"".api_get_self()."?category=Plugins\">".Display::return_icon($action_images['plugins'], ucfirst(get_lang('Plugins'))).ucfirst(get_lang('Plugins'))."</a>";
- echo "\n\t<a href=\"".api_get_self()."?category=stylesheets\">".Display::return_icon($action_images['stylesheets'], ucfirst(get_lang('Stylesheets'))).ucfirst(get_lang('Stylesheets'))."</a>";
- echo "\n\t<a href=\"".api_get_self()."?category=Templates\">".Display::return_icon($action_images['templates'], ucfirst(get_lang('Templates'))).ucfirst(get_lang('Templates'))."</a>";
- echo "\n\t<a href=\"".api_get_self()."?category=Search\">".Display::return_icon($action_images['search'], ucfirst(get_lang('Search'))).ucfirst(get_lang('Search'))."</a>";
- echo "\n</div>";
- if (isset ($_GET['category']))
- {
- switch ($_GET['category'])
- {
-
-
- case 'Plugins' :
- handle_plugins();
- break;
-
- case 'stylesheets' :
- handle_stylesheets();
- break;
- case 'Search' :
- handle_search();
- break;
- default :
- $form->display();
- }
- }
- Display :: display_footer();
- function get_settings_options($var)
- {
- $table_settings_options = Database :: get_main_table(TABLE_MAIN_SETTINGS_OPTIONS);
- $sql = "SELECT * FROM $table_settings_options WHERE variable='$var'";
- $result = api_sql_query($sql, __FILE__, __LINE__);
- while ($row = mysql_fetch_array($result))
- {
- $temp_array = array ('value' => $row['value'], 'display_text' => $row['display_text']);
- $settings_options_array[] = $temp_array;
- }
- return $settings_options_array;
- }
- function handle_plugins()
- {
- global $SettingsStored;
- $userplugins = array();
- $table_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
- if (!empty($_POST['submit_plugins']))
- {
- store_plugins();
- Display :: display_normal_message($SettingsStored);
- }
- echo get_lang('AvailablePlugins')."<br/><br/>";
-
- $pluginpath = api_get_path(SYS_PLUGIN_PATH);
- $handle = @opendir($pluginpath);
- while (false !== ($file = readdir($handle)))
- {
- if ($file <> '.' AND $file <> '..' AND is_dir(api_get_path(SYS_PLUGIN_PATH).$file))
- {
- $possibleplugins[] = $file;
- }
- }
- @closedir($handle);
-
- echo '<form name="plugins" method="post" action="'.api_get_self().'?category='.$_GET['category'].'">';
- echo "<table class=\"data_table\">\n";
- echo "\t<tr>\n";
- echo "\t\t<th>\n";
- echo get_lang('Plugin');
- echo "\t\t</th>\n";
- echo "\t\t<th>\n";
- echo get_lang('LoginPageMainArea');
- echo "\t\t</th>\n";
- echo "\t\t<th>\n";
- echo get_lang('LoginPageMenu');
- echo "\t\t</th>\n";
- echo "\t\t<th>\n";
- echo get_lang('CampusHomepageMainArea');
- echo "\t\t</th>\n";
- echo "\t\t<th>\n";
- echo get_lang('CampusHomepageMenu');
- echo "\t\t</th>\n";
- echo "\t\t<th>\n";
- echo get_lang('MyCoursesMainArea');
- echo "\t\t</th>\n";
- echo "\t\t<th>\n";
- echo get_lang('MyCoursesMenu');
- echo "\t\t</th>\n";
- echo "\t\t<th>\n";
- echo get_lang('Header');
- echo "\t\t</th>\n";
- echo "\t\t<th>\n";
- echo get_lang('Footer');
- echo "\t\t</th>\n";
- echo "\t</tr>\n";
-
-
-
- $result = api_get_settings('Plugins');
-
- foreach($result as $row)
- {
- $usedplugins[$row['variable']][] = $row['selected_value'];
- }
-
- foreach ($possibleplugins as $testplugin)
- {
- $plugin_info_file = api_get_path(SYS_PLUGIN_PATH).$testplugin."/plugin.php";
- if (file_exists($plugin_info_file))
- {
- $plugin_info = array();
- include ($plugin_info_file);
- echo "\t<tr>\n";
- echo "\t\t<td>\n";
- foreach ($plugin_info as $key => $value)
- {
- if ($key <> 'location')
- {
- if ($key == 'title')
- {
- $value = '<strong>'.$value.'</strong>';
- }
- echo get_lang(ucwords($key)).': '.$value.'<br />';
- }
- }
- if (file_exists(api_get_path(SYS_PLUGIN_PATH).$testplugin.'/readme.txt'))
- {
- echo "<a href='".api_get_path(WEB_PLUGIN_PATH).$testplugin."/readme.txt'>readme.txt</a>";
- }
- echo "\t\t</td>\n";
-
- if(empty($usedplugins))
- {
- $usedplugins = array();
- }
- display_plugin_cell('loginpage_main', $plugin_info, $testplugin, $usedplugins);
- display_plugin_cell('loginpage_menu', $plugin_info, $testplugin, $usedplugins);
- display_plugin_cell('campushomepage_main', $plugin_info, $testplugin, $usedplugins);
- display_plugin_cell('campushomepage_menu', $plugin_info, $testplugin, $usedplugins);
- display_plugin_cell('mycourses_main', $plugin_info, $testplugin, $usedplugins);
- display_plugin_cell('mycourses_menu', $plugin_info, $testplugin, $usedplugins);
- display_plugin_cell('header', $plugin_info, $testplugin, $usedplugins);
- display_plugin_cell('footer', $plugin_info, $testplugin, $usedplugins);
- echo "\t</tr>\n";
- }
- }
- echo '</table>';
- echo '<input type="submit" name="submit_plugins" value="'.get_lang('Ok').'" /></form>';
- }
- function display_plugin_cell($location, $plugin_info, $current_plugin, $active_plugins)
- {
- echo "\t\t<td align=\"center\">\n";
- if (in_array($location, $plugin_info['location']))
- {
- if (isset($active_plugins[$location]) && is_array($active_plugins[$location])
- && in_array($current_plugin, $active_plugins[$location]))
- {
- $checked = "checked";
- }
- else
- {
- $checked = '';
- }
- echo '<input type="checkbox" name="'.$current_plugin.'-'.$location.'" value="true" '.$checked.'/>';
- }
- echo "\t\t</td>\n";
- }
- function handle_stylesheets()
- {
- global $_configuration;
-
- $currentstyle = api_get_setting('stylesheets');
- $is_style_changeable=false;
-
- if ($_configuration['access_url']!=1)
- {
- $style_info = api_get_settings('stylesheets','',1,0);
- $url_info = api_get_access_url($_configuration['access_url']);
- if ($style_info[0]['access_url_changeable']==1 && $url_info['active']==1)
- {
- $is_style_changeable=true;
- echo '<a href="" id="stylesheetuploadlink" onclick="document.getElementById(\'newstylesheetform\').style.display = \'block\'; document.getElementById(\'stylesheetuploadlink\').style.display = \'none\';return false; ">'.get_lang('UploadNewStylesheet').'</a>';
- }
- }
- else
- {
- $is_style_changeable=true;
- echo '<a href="" id="stylesheetuploadlink" onclick="document.getElementById(\'newstylesheetform\').style.display = \'block\'; document.getElementById(\'stylesheetuploadlink\').style.display = \'none\';return false; ">'.get_lang('UploadNewStylesheet').'</a>';
- }
-
- $form = new FormValidator('stylesheet_upload','post','settings.php?category=stylesheets&showuploadform=true');
- $form->addElement('text','name_stylesheet',get_lang('NameStylesheet'),array('size' => '40', 'maxlength' => '40'));
- $form->addRule('name_stylesheet', get_lang('ThisFieldIsRequired'), 'required');
- $form->addElement('file', 'new_stylesheet', get_lang('UploadNewStylesheet'));
- $allowed_file_types = array ('css');
- $form->addRule('new_stylesheet', get_lang('InvalidExtension').' ('.implode(',', $allowed_file_types).')', 'filetype', $allowed_file_types);
- $form->addRule('new_stylesheet', get_lang('ThisFieldIsRequired'), 'required');
- $form->addElement('submit', 'stylesheet_upload', get_lang('Ok'));
- if( $form->validate() AND is_writable(api_get_path(SYS_CODE_PATH).'css/'))
- {
- $values = $form->exportValues();
- $picture_element = & $form->getElement('new_stylesheet');
- $picture = $picture_element->getValue();
- upload_stylesheet($values, $picture);
- Display::display_confirmation_message(get_lang('StylesheetAdded'));
- }
- else
- {
- if (!is_writable(api_get_path(SYS_CODE_PATH).'css/'))
- {
- Display::display_error_message(api_get_path(SYS_CODE_PATH).'css/'.get_lang('IsNotWritable'));
- }
- else
- {
- if ($_GET['showuploadform'] == 'true')
- {
- echo '<div id="newstylesheetform">';
- }
- else
- {
- echo '<div id="newstylesheetform" style="display: none;">';
- }
-
- if ($_configuration['access_url']==1)
- {
- $form->display();
- }
- else
- {
- if ($is_style_changeable)
- {
- $form->display();
- }
- }
- echo '</div>';
- }
- }
-
- echo '<div><iframe src="style_preview.php" width="100%" height="300" name="preview"></iframe></div>';
- echo '<form name="stylesheets" method="post" action="'.api_get_self().'?category='.$_GET['category'].'">';
- if ($handle = @opendir(api_get_path(SYS_PATH).'main/css/'))
- {
- $counter=1;
- while (false !== ($style_dir = readdir($handle)))
- {
- if(substr($style_dir,0,1)=='.')
- {
- continue;
- }
- $dirpath = api_get_path(SYS_PATH).'main/css/'.$style_dir;
- if (is_dir($dirpath))
- {
- if ($style_dir != '.' && $style_dir != '..')
- {
- if ($currentstyle == $style_dir OR ($style_dir == 'dokeos_classic' AND !$currentstyle))
- {
- $selected = 'checked="checked"';
- }
- else
- {
- $selected = '';
- }
- $show_name=ucwords(str_replace('_',' ', $style_dir));
-
- if ($is_style_changeable)
- {
- echo "<input type=\"radio\" name=\"style\" value=\"".$style_dir."\" ".$selected." onClick=\"parent.preview.location='style_preview.php?style=".$style_dir."';\"/>";
- echo '<a href="style_preview.php?style='.$style_dir.'" target="preview">'.$show_name.'</a>';
- }
- else
- echo '<a href="style_preview.php?style='.$style_dir.'" target="preview">'.$show_name.'</a>';
-
-
-
- echo "<br />\n";
- $counter++;
- }
- }
- }
- @closedir($handle);
- }
- if ($is_style_changeable)
- {
- echo '<input type="submit" name="submit_stylesheets" value="'.get_lang('Ok').'" /></form>';
- }
- }
- function upload_stylesheet($values,$picture)
- {
-
- $style_name = ereg_replace("[^A-Za-z0-9]", "", $values['name_stylesheet'] );
-
-
- if(!is_dir(api_get_path(SYS_CODE_PATH).'css/'.$style_name.'/'))
- {
- if(mkdir(api_get_path(SYS_CODE_PATH).'css/'.$style_name.'/'))
- {
- $perm = api_get_setting('permissions_for_new_directories');
- $perm = octdec(!empty($perm)?$perm:'0770');
- chmod(api_get_path(SYS_CODE_PATH).'css/'.$style_name.'/');
- }
- }
-
-
- move_uploaded_file($picture['tmp_name'], api_get_path(SYS_CODE_PATH).'css/'.$style_name.'/'.$picture['name']);
- }
- function store_plugins()
- {
- $table_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
- global $_configuration;
-
-
-
- $r = api_delete_category_settings('Plugins',$_configuration['access_url']);
-
- foreach ($_POST as $form_name => $formvalue)
- {
- $form_name_elements = explode("-", $form_name);
- if (is_valid_plugin_location($form_name_elements[1]))
- {
-
-
- api_add_setting($form_name_elements['0'],$form_name_elements['1'],$form_name_elements['0'],null,'Plugins',$form_name_elements['0'],null,null,null,$_configuration['access_url'],1);
- }
- }
- }
- function is_valid_plugin_location($location)
- {
- $valid_locations=array('loginpage_main', 'loginpage_menu', 'campushomepage_main', 'campushomepage_menu', 'mycourses_main', 'mycourses_menu','header', 'footer');
- if (in_array($location, $valid_locations))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- function store_stylesheets()
- {
- global $_configuration;
-
- $table_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
-
- $style = Database::escape_string($_POST['style']);
- if (is_style($style))
- {
-
-
- api_set_setting('stylesheets',$style,null,'stylesheets',$_configuration['access_url']);
- }
- return true;
- }
- function is_style($style)
- {
- $dir = api_get_path(SYS_PATH).'main/css/';
- $dirs = scandir($dir);
- $style = str_replace(array('/','\\'),array('',''),$style);
- if (in_array($style,$dirs) && is_dir($dir.$style))
- {
- return true;
- }
- return false;
- }
- function handle_search() {
- global $SettingsStored, $_configuration;
- $search_enabled = api_get_setting('search_enabled');
- $settings = api_get_settings('Search');
- if ($search_enabled !== 'true' || count($settings) < 1) {
- Display::display_error_message(get_lang('SearchFeatureNotEnabledComment'));
- return;
- }
- require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
- $form = new FormValidator('search-options', 'post', api_get_self().'?category=Search');
- $renderer = & $form->defaultRenderer();
- $renderer->setHeaderTemplate('<div class="sectiontitle">{header}</div>'."\n");
- $renderer->setElementTemplate('<div class="sectioncomment">{label}</div>'."\n".'<div class="sectionvalue">{element}</div>'."\n");
-
- $form->addElement('header', null, get_lang('SearchShowUnlinkedResultsTitle'));
- $form->addElement('label', null, get_lang('SearchShowUnlinkedResultsComment'));
- $values = get_settings_options('search_show_unlinked_results');
- $group = array ();
- foreach ($values as $key => $value) {
- $element = & $form->createElement('radio', 'search_show_unlinked_results', '', get_lang($value['display_text']), $value['value']);
- $group[] = $element;
- }
- $form->addGroup($group, 'search_show_unlinked_results', get_lang('SearchShowUnlinkedResultsComment'), '<br />', false);
- $default_values['search_show_unlinked_results'] = api_get_setting('search_show_unlinked_results');
-
- $form->addElement('header', null, get_lang('SearchPrefilterPrefix'));
- $form->addElement('label', null, get_lang('SearchPrefilterPrefixComment'));
- $specific_fields = get_specific_field_list();
- $sf_values = array();
- foreach ($specific_fields as $sf) {
- $sf_values[$sf['code']] = $sf['name'];
- }
- $group = array ();
- $form->addElement('select', 'search_prefilter_prefix', get_lang('SearchPrefilterPrefix'), $sf_values, '');
- $default_values['search_prefilter_prefix'] = api_get_setting('search_prefilter_prefix');
-
- $form->addElement('submit', 'search-options-save', get_lang('Ok'));
- $form->setDefaults($default_values);
- if( $form->validate()) {
- $formvalues = $form->exportValues();
- $r = api_set_settings_category('Search','false',$_configuration['access_url']);
-
- foreach ($formvalues as $key => $value)
- {
- $result = api_set_setting($key,$value,null,null);
- }
- Display :: display_normal_message($SettingsStored);
- } else {
- echo '<div id="search-options-form">';
- $form->display();
- echo '</div>';
- }
- }
- ?>
|