Minor - flint fixes

pull/3368/head
Julio Montoya 6 years ago
parent 51e396f23b
commit 20752ea528
  1. 12
      main/inc/ajax/course_home.ajax.php
  2. 13
      main/inc/introductionSection.inc.php
  3. 10
      main/inc/lib/course_home.lib.php
  4. 2
      plugin/google_meet/lang/english.php
  5. 2
      plugin/google_meet/lang/french.php
  6. 2
      plugin/google_meet/lang/spanish.php
  7. 10
      plugin/google_meet/meets.php
  8. 2
      plugin/google_meet/plugin.php
  9. 67
      plugin/google_meet/src/google_meet_plugin.class.php
  10. 3
      plugin/google_meet/start.php

@ -138,7 +138,7 @@ switch ($action) {
}
break;
case 'set_visibility_for_all':
require_once __DIR__ . '/../global.inc.php';
require_once __DIR__.'/../global.inc.php';
$course_id = api_get_course_int_id();
$sessionId = api_get_session_id();
$allowEditionInSession = api_get_configuration_value('allow_edit_tool_visibility_in_session');
@ -151,7 +151,7 @@ switch ($action) {
if (is_array($tools_ids) && count($tools_ids) != 0) {
$total_tools = count($tools_ids);
for ($i = 0; $i < $total_tools; $i++) {
$tool_id = (int)$tools_ids[$i];
$tool_id = (int) $tools_ids[$i];
$criteria = [
'cId' => $course_id,
@ -208,7 +208,7 @@ switch ($action) {
$inactiveImage = str_replace('.gif', '_na.gif', $toolImage);
} else {
// Display::return_icon() also checks in the app/Resources/public/css/themes/{theme}/icons folder
$toolImage = (substr($toolImage, 0, strpos($toolImage, '.'))) . '.png';
$toolImage = (substr($toolImage, 0, strpos($toolImage, '.'))).'.png';
$toolImage = Display::return_icon(
$toolImage,
get_lang(ucfirst($tool->getName())),
@ -221,8 +221,8 @@ switch ($action) {
}
if (isset($customIcon) && !empty($customIcon)) {
$toolImage = CourseHome::getCustomWebIconPath() . $customIcon;
$inactiveImage = CourseHome::getCustomWebIconPath() . CourseHome::getDisableIcon($customIcon);
$toolImage = CourseHome::getCustomWebIconPath().$customIcon;
$inactiveImage = CourseHome::getCustomWebIconPath().CourseHome::getDisableIcon($customIcon);
}
$requested_image = $visibility == 0 ? $toolImage : $inactiveImage;
@ -265,7 +265,7 @@ switch ($action) {
'message' => $requested_message,
'view' => $requested_view,
'fclass' => $requested_fa_class,
'id'=>$tool_id,
'id' => $tool_id,
];
}
}

@ -290,13 +290,12 @@ if (api_is_allowed_to_edit() && empty($session_id)) {
api_get_path(WEB_CODE_PATH).'course_info/tools.php?'.api_get_cidreq(),
['class' => 'btn btn-default', 'title' => get_lang('CustomizeIcons')]
);
}
/* Tool to show /hide all tools on course */
$toolAllShowHide = '';
if (api_is_allowed_to_edit() && empty($session_id)) {
$toolAllShowHide = '<button class="btn btn-default hidden visible-all show-hide-all-tools" title="'.get_lang('Activate', '').'"><em class="fa fa-eye"></em></button>';
$toolAllShowHide .= '<button class="btn btn-default hidden invisible-all show-hide-all-tools" title="'.get_lang('Deactivate', '').'"><em class="fa fa-eye-slash"></em></button>';
$toolAllShowHide = '<button class="btn btn-default hidden visible-all show-hide-all-tools" title="'.get_lang('Activate', '').'"><em class="fa fa-eye"></em></button>';
$toolAllShowHide .= '<button class="btn btn-default hidden invisible-all show-hide-all-tools" title="'.get_lang('Deactivate', '').'"><em class="fa fa-eye-slash"></em></button>';
}
$toolbar = '';
@ -310,10 +309,10 @@ if ($intro_dispCommand) {
$textIntro = '<a class="btn btn-default" title="'.addslashes(get_lang('AddIntro')).'" href="'.api_get_self().'?'.api_get_cidreq().$blogParam.'&intro_cmdAdd=1">';
$textIntro .= '<em class="fa fa-file-text"></em> ';
$textIntro .= "</a>";
$toolbar .= $textIntro . $editIconButton.$toolAllShowHide;
$toolbar .= $textIntro.$editIconButton.$toolAllShowHide;
} else {
$toolbar .= '<a class="btn btn-default" href="'.api_get_self().'?intro_cmdAdd=1">'.get_lang('AddIntro').'</a>';
$toolbar .= $editIconButton . $toolAllShowHide;
$toolbar .= $editIconButton.$toolAllShowHide;
}
$toolbar .= '</div></div>';
} else {
@ -324,7 +323,7 @@ if ($intro_dispCommand) {
$toolbar .=
'<a class="btn btn-default" href="'.api_get_self().'?'.api_get_cidreq().$blogParam.'&intro_cmdEdit=1" title="'.get_lang('Modify').'">
<em class="fa fa-pencil"></em></a>';
$toolbar .= $editIconButton . $toolAllShowHide;
$toolbar .= $editIconButton.$toolAllShowHide;
$toolbar .= "<a class=\"btn btn-default\" href=\"".api_get_self()."?".api_get_cidreq().$blogParam."&intro_cmdDel=1\" onclick=\"javascript:
if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).
"')) return false;\"><em class=\"fa fa-trash-o\"></em></a>";
@ -333,7 +332,7 @@ if ($intro_dispCommand) {
'<a class="btn btn-default" href="'.api_get_self().'?intro_cmdEdit=1" title="'.get_lang('Modify').'">
<em class="fa fa-pencil"></em>
</a>"';
$toolbar .= $editIconButton . $toolAllShowHide;
$toolbar .= $editIconButton.$toolAllShowHide;
$toolbar .= "<a class=\"btn btn-default\" href=\"".api_get_self()."?".api_get_cidreq()."&intro_cmdDel=1\" onclick=\"javascript:
if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).
"')) return false;\"><em class=\"fa fa-trash-o\"></em></a>";

@ -896,7 +896,7 @@ class CourseHome
ICON_SIZE_SMALL,
false
);
$link['name']='<em id="'.'linktool_'.$tool['iid'].'" class="fa fa-eye" title="'.get_lang('Deactivate').'"></em>';
$link['name'] = '<em id="'.'linktool_'.$tool['iid'].'" class="fa fa-eye" title="'.get_lang('Deactivate').'"></em>';
$link['cmd'] = 'hide=yes';
$lnk[] = $link;
}
@ -908,7 +908,7 @@ class CourseHome
ICON_SIZE_SMALL,
false
);
$link['name']='<em id="'.'linktool_'.$tool['iid'].'" class="fa fa-eye-slash text-muted" title="'.get_lang('Activate').'"></em>';
$link['name'] = '<em id="'.'linktool_'.$tool['iid'].'" class="fa fa-eye-slash text-muted" title="'.get_lang('Activate').'"></em>';
$link['cmd'] = 'restore=yes';
$lnk[] = $link;
}
@ -937,7 +937,7 @@ class CourseHome
ICON_SIZE_SMALL,
false
);
$link['name']='<em id="'.'linktool_'.$tool['iid'].'"class="fa fa-eye" title="'.get_lang('Deactivate').'"></em>';
$link['name'] = '<em id="'.'linktool_'.$tool['iid'].'"class="fa fa-eye" title="'.get_lang('Deactivate').'"></em>';
$link['cmd'] = 'restore=yes';
$lnk[] = $link;
break;
@ -949,7 +949,7 @@ class CourseHome
ICON_SIZE_SMALL,
false
);
$link['name']='<em id="'.'linktool_'.$tool['iid'].'"class="fa fa-eye-slash text-muted" title="'.get_lang('Activate').'"></em>';
$link['name'] = '<em id="'.'linktool_'.$tool['iid'].'"class="fa fa-eye-slash text-muted" title="'.get_lang('Activate').'"></em>';
$link['cmd'] = 'hide=yes';
$lnk[] = $link;
break;
@ -962,7 +962,7 @@ class CourseHome
ICON_SIZE_SMALL,
false
);
$link['name']='<em id="'.'linktool_'.$tool['iid'].'"class="fa fa-eye-slash text-muted" title="'.get_lang('Activate').'"></em>';
$link['name'] = '<em id="'.'linktool_'.$tool['iid'].'"class="fa fa-eye-slash text-muted" title="'.get_lang('Activate').'"></em>';
$link['cmd'] = 'hide=yes';
$lnk[] = $link;
}

@ -20,5 +20,3 @@ $strings['MeetingDescription'] = 'Description';
$strings['MeetingDescriptionHelp'] = '(Optional) Add a short description for the meeting.';
$strings['MeetColor'] = 'Color of Meet';
$strings['MeetColorHelp'] = '(Optional)';

@ -20,5 +20,3 @@ $strings['MeetingDescription'] = 'Description';
$strings['MeetingDescriptionHelp'] = '(Optionnel) Ajouter une brève description.';
$strings['MeetColor'] = 'Couleur de la réunion';
$strings['MeetColorHelp'] = '(Optionnel)';

@ -20,5 +20,3 @@ $strings['MeetingDescription'] = 'Descripción';
$strings['MeetingDescriptionHelp'] = '(Opcional) Añada una breve descripción sobre la reunión.';
$strings['MeetColor'] = 'Color de Meet';
$strings['MeetColorHelp'] = '(Opcional)';

@ -85,7 +85,7 @@ if ($enable) {
$plugin->get_lang('MeetColorHelp'),
],
[
'value' => '#1CC88A'
'value' => '#1CC88A',
]
);
} catch (HTML_QuickForm_Error $e) {
@ -135,7 +135,7 @@ if ($enable) {
api_get_path(WEB_PLUGIN_PATH).'google_meet/start.php?'.api_get_cidreq()
);
$idMeet = isset($_GET['id_meet']) ? (int)$_GET['id_meet'] : 0;
$idMeet = isset($_GET['id_meet']) ? (int) $_GET['id_meet'] : 0;
$dataMeet = $plugin->getMeet($idMeet);
//create form
@ -175,7 +175,7 @@ if ($enable) {
'meet_color',
[
$plugin->get_lang('MeetColor'),
$plugin->get_lang('MeetColorHelp')
$plugin->get_lang('MeetColorHelp'),
]
);
$form->addHtmlEditor(
@ -204,13 +204,10 @@ if ($enable) {
$url = api_get_path(WEB_PLUGIN_PATH).'google_meet/start.php?'.api_get_cidreq();
header('Location: '.$url);
}
}
$tpl->assign('form_room', $form->returnForm());
break;
}
}
@ -218,7 +215,6 @@ if ($enable) {
}
if ($isAdmin || $isTeacher) {
$tpl->assign(
'actions',
Display::toolbarAction('toolbar', [$actionLinks])

@ -1,4 +1,4 @@
<?php
require_once __DIR__.'/config.php';
$plugin_info = GoogleMeetPlugin::create()->get_info();
$plugin_info = GoogleMeetPlugin::create()->get_info();

@ -1,12 +1,12 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Plugin class for the Google Meet plugin.
*
* @package chamilo.plugin.google_meet
*
* @author Alex Aragón Calixto <alex.aragon@tunqui.pe>
*/
class GoogleMeetPlugin extends Plugin
{
const TABLE_MEET_LIST = 'plugin_google_meet_room';
@ -54,7 +54,8 @@ class GoogleMeetPlugin extends Plugin
}
/**
* Create a plugin instance
* Create a plugin instance.
*
* @return GoogleMeetPlugin
*/
public static function create()
@ -64,10 +65,9 @@ class GoogleMeetPlugin extends Plugin
return $result ? $result : $result = new self();
}
/**
* This method creates the tables required to this plugin and copies icons
* to the right places
* to the right places.
*/
public function install()
{
@ -97,7 +97,7 @@ class GoogleMeetPlugin extends Plugin
}
/**
* This method drops the plugin tables and icons
* This method drops the plugin tables and icons.
*/
public function uninstall()
{
@ -122,11 +122,11 @@ class GoogleMeetPlugin extends Plugin
}
$this->manageTab(false);
}
/**
* {@inheritDoc}
* {@inheritdoc}
*
* @return GoogleMeetPlugin
*/
public function performActionsAfterConfigure()
@ -146,18 +146,8 @@ class GoogleMeetPlugin extends Plugin
return $this;
}
/**
* Delete links to the tool from the c_tool table
*/
private function deleteCourseToolLinks()
public function saveMeet($values)
{
Database::getManager()
->createQuery('DELETE FROM ChamiloCourseBundle:CTool t WHERE t.category = :category AND t.link LIKE :link')
->execute(['category' => 'plugin', 'link' => 'google_meet/start.php%']);
}
public function saveMeet($values){
if (!is_array($values) || empty($values['meet_name'])) {
return false;
}
@ -189,8 +179,8 @@ class GoogleMeetPlugin extends Plugin
}
}
public function listMeets($idCourse){
public function listMeets($idCourse)
{
$list = [];
$tableMeetList = Database::get_main_table(self::TABLE_MEET_LIST);
@ -200,8 +190,7 @@ class GoogleMeetPlugin extends Plugin
if (Database::num_rows($result) > 0) {
while ($row = Database::fetch_array($result)) {
$action = Display::url(
$action = Display::url(
Display::return_icon(
'delete.png',
get_lang('Delete'),
@ -234,13 +223,14 @@ class GoogleMeetPlugin extends Plugin
'activate' => $active,
'actions' => $action,
];
}
}
return $list;
}
public function getMeet($idMeet){
public function getMeet($idMeet)
{
if (empty($idMeet)) {
return false;
}
@ -267,10 +257,12 @@ class GoogleMeetPlugin extends Plugin
];
}
}
return $meet;
}
public function updateMeet($values){
public function updateMeet($values)
{
if (!is_array($values) || empty($values['meet_name'])) {
return false;
}
@ -309,8 +301,10 @@ class GoogleMeetPlugin extends Plugin
}
/**
* Delete a given meeting
* Delete a given meeting.
*
* @param int $idMeet Chamilo's internal ID of the meeting
*
* @return bool True on success, false on failure
*/
public function deleteMeet($idMeet)
@ -328,15 +322,27 @@ class GoogleMeetPlugin extends Plugin
}
return true;
}
/**
* Delete links to the tool from the c_tool table.
*/
private function deleteCourseToolLinks()
{
Database::getManager()
->createQuery('DELETE FROM ChamiloCourseBundle:CTool t WHERE t.category = :category AND t.link LIKE :link')
->execute(['category' => 'plugin', 'link' => 'google_meet/start.php%']);
}
/**
* Do a bit of prevention on the meeting URL format
* Do a bit of prevention on the meeting URL format.
*
* @param string $url The URL received from the user
*
* @return string Reformatted URL
*/
private function filterUrl($url) {
private function filterUrl($url)
{
if (!empty($url)) {
if (preg_match('#^'.self::GOOGLE_MEET_URL.'#', $url)) {
// The URL starts with the right Google Meet protocol and domain, do nothing
@ -352,6 +358,7 @@ class GoogleMeetPlugin extends Plugin
$url = self::GOOGLE_MEET_URL.$url;
}
}
return $url;
}
}

@ -28,12 +28,9 @@ $enable = $plugin->get('google_meet_enabled') == 'true';
$urlAddMeet = api_get_path(WEB_PLUGIN_PATH).'google_meet/meets.php?action=add&'.api_get_cidreq();
if ($enable) {
if ($isAdmin || $isTeacher || $isStudent) {
$meets = $plugin->listMeets($courseInfo['real_id']);
}
}

Loading…
Cancel
Save