'index.php', 'name' => get_lang('PlatformAdmin'));
// Database Table Definitions
$tbl_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$message = '';
require api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
if(isset($_POST['activeExtension'])){
switch ($_POST['extension_code']){
case 'visio' :
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="true"
WHERE variable="service_visio"
AND subkey="active"';
$rs = api_sql_query($sql, __FILE__, __LINE__);
if(mysql_affected_rows()>0)
{
// select all the courses and insert the tool inside
$sql = 'SELECT db_name FROM '.Database::get_main_table(TABLE_MAIN_COURSE);
$rs = api_sql_query($sql, __FILE__, __LINE__);
while($row = mysql_fetch_array($rs)){
if(!empty($_POST['visio_host']))
{
$tool_table = Database::get_course_table(TABLE_TOOL_LIST,$row['db_name']);
$select = "SELECT id FROM $toos_table WHERE name='".TOOL_VISIO_CONFERENCE."'";
$selectres = api_sql_query($select);
if(Database::num_rows($selectres)<1)
{
$sql = 'INSERT INTO '.$tool_table.' SET
name="'.TOOL_VISIO_CONFERENCE.'",
link="conference/index.php?type=conference",
image="visio.gif",
visibility="1",
admin="0",
address="squaregrey.gif",
target="_self",
category="interaction"';
api_sql_query($sql, __FILE__, __LINE__);
}
$select = "SELECT id FROM $toos_table WHERE name='".TOOL_VISIO_CLASSROOM."'";
$selectres = api_sql_query($select);
if(Database::num_rows($selectres)<1)
{
$sql = 'INSERT INTO '.$tool_table.' SET
name="'.TOOL_VISIO_CLASSROOM.'",
link="conference/index.php?type=classroom",
image="visio.gif",
visibility="1",
admin="0",
address="squaregrey.gif",
target="_self",
category="authoring"';
api_sql_query($sql, __FILE__, __LINE__);
}
}
}
$message = get_lang('ServiceActivated');
}
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.Database::escape_string($_POST['visio_host']).'"
WHERE variable="service_visio"
AND subkey="visio_host"';
$rs = api_sql_query($sql, __FILE__, __LINE__);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.Database::escape_string($_POST['visio_port']).'"
WHERE variable="service_visio"
AND subkey="visio_port"';
$rs = api_sql_query($sql, __FILE__, __LINE__);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.Database::escape_string($_POST['visio_pass']).'"
WHERE variable="service_visio"
AND subkey="visio_pass"';
$rs = api_sql_query($sql, __FILE__, __LINE__);
if(empty($message))
{
$message = get_lang('ServiceReconfigured');
}
break;
case 'ppt2lp' :
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="true"
WHERE variable="service_ppt2lp"
AND subkey="active"';
$rs = api_sql_query($sql, __FILE__, __LINE__);
if(mysql_affected_rows()>0){
$message = get_lang('ServiceActivated');
}
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['host']).'"
WHERE variable="service_ppt2lp"
AND subkey="host"';
api_sql_query($sql, __FILE__, __LINE__);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['port']).'"
WHERE variable="service_ppt2lp"
AND subkey="port"';
api_sql_query($sql, __FILE__, __LINE__);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['ftp_password']).'"
WHERE variable="service_ppt2lp"
AND subkey="ftp_password"';
api_sql_query($sql, __FILE__, __LINE__);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['user']).'"
WHERE variable="service_ppt2lp"
AND subkey="user"';
api_sql_query($sql, __FILE__, __LINE__);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['path_to_lzx']).'"
WHERE variable="service_ppt2lp"
AND subkey="path_to_lzx"';
api_sql_query($sql, __FILE__, __LINE__);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['size']).'"
WHERE variable="service_ppt2lp"
AND subkey="size"';
api_sql_query($sql, __FILE__, __LINE__);
break;
}
}
$listActiveServices = array();
// get the list of active services
$sql = 'SELECT variable FROM '.$tbl_settings_current.' WHERE variable LIKE "service_%" AND subkey="active" and selected_value="true"';
$rs = api_sql_query($sql, __FILE__, __LINE__);
while($row = mysql_fetch_array($rs)){
$listActiveServices[] = $row['variable'];
}
$javascript_service_displayed = '';
if(isset($_GET['display'])){
$javascript_service_displayed = 'document.getElementById("extension_content_'.$_GET['display'].'").style.display = "block"';
}
// javascript to handle accordion behaviour
$javascript_message = '';
if(!empty($message)){
$javascript_message =
'
document.getElementById("message").style.display = "block";
var timer = setTimeout(hideMessage,5000);
';
}
$htmlHeadXtra[]= '
';
$nameTool = get_lang('ConfigureExtensions');
Display::display_header($nameTool);
?>
|
addElement('text', 'visio_host', get_lang('VisioHost'));
$form -> addElement('html','
');
$form -> addElement('text', 'visio_port', get_lang('VisioPort'));
$form -> addElement('html','
');
$form -> addElement('text', 'visio_pass', get_lang('VisioPassword'));
$form -> addElement('html','
');
//$form -> addElement('text', 'visio_is_web_rtmp', get_lang('VisioRTMPIsWeb'));
//$form -> addElement('html','
');
$form -> addElement('hidden', 'extension_code', 'visio');
$defaults = array();
$renderer = $form -> defaultRenderer();
$renderer -> setElementTemplate('{label} {element} ');
$form -> addElement('html','
');
if(in_array('service_visio',$listActiveServices))
{
$sql = 'SELECT subkey, selected_value FROM '.$tbl_settings_current.'
WHERE variable = "service_visio"';
$rs = api_sql_query($sql, __FILE__, __LINE__);
while($row = mysql_fetch_assoc($rs))
{
$defaults[$row['subkey']] = $row['selected_value'];
}
$form -> addElement('submit', 'activeExtension', get_lang('ReconfigureExtension'));
}
else {
$form -> addElement('submit', 'activeExtension', get_lang('ActivateExtension'));
}
$form -> setDefaults($defaults);
$form -> display();
?>
|