From d9d1869ce299480b4918b2be11243baa249c3762 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Mon, 25 Jul 2016 11:02:16 +0200 Subject: [PATCH] WIP ChamiloApi adding "ChamiloApi::getConfigurationValue()" function --- app/AppKernel.php | 9 ++ main/admin/configure_extensions.php | 121 ++++++++---------- main/inc/global.inc.php | 12 +- .../CoreBundle/Component/Utils/ChamiloApi.php | 33 +++-- 4 files changed, 91 insertions(+), 84 deletions(-) diff --git a/app/AppKernel.php b/app/AppKernel.php index 78be104c53..e0de3111ad 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -3,6 +3,7 @@ use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; +use Chamilo\CoreBundle\Component\Utils\ChamiloApi; /** * Class AppKernel @@ -203,5 +204,13 @@ class AppKernel extends Kernel { return $this->getRealRootDir().'app/config/configuration.php'; } + + /** + * @param array $configuration + */ + public function setApi(array $configuration) + { + new ChamiloApi($configuration); + } } diff --git a/main/admin/configure_extensions.php b/main/admin/configure_extensions.php index cbe4202c82..8c1396efe1 100755 --- a/main/admin/configure_extensions.php +++ b/main/admin/configure_extensions.php @@ -31,7 +31,8 @@ if (isset($_POST['activeExtension'])) { while($row = Database::fetch_array($rs)){ if(!empty($_POST['visio_host'])) { $tool_table = Database::get_course_table(TABLE_TOOL_LIST); - $select = "SELECT id FROM $tool_table WHERE c_id =".$row['id']." AND name='".TOOL_VISIO_CONFERENCE."'"; + $select = "SELECT id FROM $tool_table + WHERE c_id =".$row['id']." AND name='".TOOL_VISIO_CONFERENCE."'"; $selectres = Database::query($select); if (Database::num_rows($selectres)<1) { $sql = 'INSERT INTO '.$tool_table.' SET @@ -46,23 +47,24 @@ if (isset($_POST['activeExtension'])) { category="interaction"'; Database::query($sql); } - $select = "SELECT id FROM $tool_table WHERE c_id =".$row['id']." AND name='".TOOL_VISIO_CLASSROOM."'"; - $selectres = Database::query($select); - if(Database::num_rows($selectres)<1) { - $sql = 'INSERT INTO '.$tool_table.' SET - c_id = '.$row['id'].', - name="'.TOOL_VISIO_CLASSROOM.'", - link="conference/index.php?type=classroom", - image="visio.gif", - visibility="1", - admin="0", - address="squaregrey.gif", - target="_self", - category="authoring"'; - Database::query($sql); - } - } - } + $select = "SELECT id FROM $tool_table + WHERE c_id =".$row['id']." AND name='".TOOL_VISIO_CLASSROOM."'"; + $selectres = Database::query($select); + if (Database::num_rows($selectres) < 1) { + $sql = 'INSERT INTO '.$tool_table.' SET + c_id = '.$row['id'].', + name="'.TOOL_VISIO_CLASSROOM.'", + link="conference/index.php?type=classroom", + image="visio.gif", + visibility="1", + admin="0", + address="squaregrey.gif", + target="_self", + category="authoring"'; + Database::query($sql); + } + } + } $message = get_lang('ServiceActivated'); } @@ -90,12 +92,12 @@ if (isset($_POST['activeExtension'])) { AND subkey="visio_use_rtmpt"'; $rs = Database::query($sql); - if(empty($message)) { + if (empty($message)) { $message = get_lang('ServiceReconfigured'); } break; - case 'ppt2lp' : + case 'ppt2lp': $sql = 'UPDATE '.$tbl_settings_current.' SET selected_value="true" WHERE variable="service_ppt2lp" @@ -142,13 +144,10 @@ if (isset($_POST['activeExtension'])) { WHERE variable="service_ppt2lp" AND subkey="size"'; Database::query($sql); - break; } - } - $listActiveServices = array(); // get the list of active services @@ -163,14 +162,11 @@ while($row = Database::fetch_array($rs)){ // javascript to handle accordion behaviour $javascript_message = ''; if(!empty($message)){ - $javascript_message = - ' + $javascript_message = ' document.getElementById("message").style.display = "block"; - var timer = setTimeout(hideMessage,5000); - '; + var timer = setTimeout(hideMessage, 5000);'; } -$htmlHeadXtra[]= ' -