Minor - format code

pull/3274/head
Julio Montoya 5 years ago
parent 85d9f1e873
commit 21533e911e
  1. 5
      main/admin/usergroup_user_import.php
  2. 5
      main/admin/usergroup_users.php
  3. 93
      main/inc/lib/social.lib.php
  4. 8
      main/inc/lib/usergroup.lib.php

@ -122,10 +122,9 @@ function save_data($users_classes, $deleteUsersNotInList = false)
*/
function parse_csv_data($file)
{
$courses = Import::csvToArray($file);
return $courses;
return Import::csvToArray($file);
}
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
require_once __DIR__.'/../inc/global.inc.php';
@ -231,8 +232,8 @@ function action_formatter(cellvalue, options, rowObject) {
function extra_formatter(cellvalue, options, rowObject) {
var calendarName = rowObject[1];
var calendarId = rowObject[7];
if (calendarName == "") {
if (calendarName == "") {
return \'<a href="'.
api_get_path(WEB_CODE_PATH).'admin/usergroup_users.php?user_id=\'+options.rowId+\'&id='.$id.'&action=add_calendar&width=700" class="btn btn-primary ajax">'.get_lang('Add').'</a>\';
} else {

@ -3170,6 +3170,55 @@ class SocialManager extends UserManager
return $social_group_block;
}
/**
* @param string $selected
*
* @return string
*/
public static function getHomeProfileTabs($selected = 'home')
{
$headers = [
[
'url' => api_get_path(WEB_CODE_PATH).'auth/profile.php',
'content' => get_lang('Profile'),
],
];
$allowJustification = api_get_plugin_setting('justification', 'tool_enable') === 'true';
if ($allowJustification) {
$plugin = Justification::create();
$headers[] = [
'url' => api_get_path(WEB_CODE_PATH).'auth/justification.php',
'content' => $plugin->get_lang('Justification'),
];
}
$allowPauseTraining = api_get_plugin_setting('pausetraining', 'tool_enable') === 'true';
$allowEdit = api_get_plugin_setting('pausetraining', 'allow_users_to_edit_pause_formation') === 'true';
if ($allowPauseTraining && $allowEdit) {
$plugin = PauseTraining::create();
$headers[] = [
'url' => api_get_path(WEB_CODE_PATH).'auth/pausetraining.php',
'content' => $plugin->get_lang('PauseTraining'),
];
}
$selectedItem = 1;
foreach ($headers as $header) {
$info = pathinfo($header['url']);
if ($selected === $info['filename']) {
break;
}
$selectedItem++;
}
$tabs = '';
if (count($headers) > 1) {
$tabs = Display::tabsOnlyLink($headers, $selectedItem);
}
return $tabs;
}
/**
* Returns the formatted header message post.
*
@ -3260,48 +3309,4 @@ class SocialManager extends UserManager
return $html;
}
public static function getHomeProfileTabs($selected = 'home')
{
$headers = [
[
'url' => api_get_path(WEB_CODE_PATH).'auth/profile.php',
'content' => get_lang('Profile'),
]
];
$allowJustification = api_get_plugin_setting('justification', 'tool_enable') === 'true';
if ($allowJustification) {
$plugin = Justification::create();
$headers[] = [
'url' => api_get_path(WEB_CODE_PATH).'auth/justification.php',
'content' => $plugin->get_lang('Justification'),
];
}
$allowPauseTraining = api_get_plugin_setting('pausetraining', 'tool_enable') === 'true';
$allowEdit = api_get_plugin_setting('pausetraining', 'allow_users_to_edit_pause_formation') === 'true';
if ($allowPauseTraining && $allowEdit) {
$plugin = PauseTraining::create();
$headers[] = [
'url' => api_get_path(WEB_CODE_PATH).'auth/pausetraining.php',
'content' => $plugin->get_lang('PauseTraining'),
];
}
$selectedItem = 1;
foreach ($headers as $header) {
$info = pathinfo($header['url']);
if ($selected === $info['filename']) {
break;
}
$selectedItem++;
}
$tabs = '';
if (count($headers) > 1) {
$tabs = Display::tabsOnlyLink($headers, $selectedItem);
}
return $tabs;
}
}

@ -295,7 +295,7 @@ class UserGroup extends Model
/**
* @param string $name
*
* @return mixed
* @return int
*/
public function getIdByName($name)
{
@ -306,7 +306,11 @@ class UserGroup extends Model
'first'
);
return $row['id'];
if ($row) {
return (int) $row['id'];
}
return 0;
}
/**

Loading…
Cancel
Save