Minor - format code

remotes/angel/1.11.x
jmontoyaa 8 years ago
parent fdadb054d2
commit 03de0860c2
  1. 20
      main/admin/specific_fields_add.php
  2. 43
      main/auth/ldap/newUser.php
  3. 6
      main/exercise/question.class.php
  4. 6
      main/inc/ajax/skill.ajax.php
  5. 107
      main/reports/templates/exercicesMultiCourses.reports.php
  6. 2
      main/session/add_students_to_session.php
  7. 4
      plugin/openmeetings/lib/openmeetings.class.php
  8. 16
      src/Chamilo/CoreBundle/Admin/UserGroupAdmin.php
  9. 20
      src/Chamilo/CoreBundle/Entity/MessageAttachment.php
  10. 5
      src/Chamilo/CoreBundle/Menu/NavBuilder.php
  11. 4
      src/Chamilo/PageBundle/Entity/User.php

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Add form
* @package chamilo.admin
@ -17,17 +18,24 @@ $this_section = SECTION_PLATFORM_ADMIN;
// user permissions
api_protect_admin_script();
$fieldId = isset($_REQUEST['field_id']) ? intval($_REQUEST['field_id']) : 0;
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings'));
$interbreadcrumb[] = array('url' => 'specific_fields.php', 'name' => get_lang('SpecificSearchFields'));
$interbreadcrumb[] = array(
'url' => 'index.php',
'name' => get_lang('PlatformAdmin'),
);
$interbreadcrumb[] = array(
'url' => 'settings.php?category=Search',
'name' => get_lang('PlatformConfigSettings'),
);
$interbreadcrumb[] = array(
'url' => 'specific_fields.php',
'name' => get_lang('SpecificSearchFields'),
);
$tool_name = get_lang('AddSpecificSearchField');
if (isset($_GET['action']) && $_GET['action'] === 'edit') {
$tool_name = get_lang('EditSpecificSearchField');
$tool_name = get_lang('EditSpecificSearchField');
}
// Create the form
$form = new FormValidator('specific_fields_add');

@ -1,37 +1,34 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Users trying to login, who do not yet exist in the Chamilo database,
* can be added by this script which tries to retrieve ldap information
* about them.
* @author Roan Embrechts
* @package chamilo.auth.ldap
*/
* Users trying to login, who do not yet exist in the Chamilo database,
* can be added by this script which tries to retrieve ldap information
* about them.
* @author Roan Embrechts
* @package chamilo.auth.ldap
*/
/**
* when a user does not exist yet in dokeos,
* but he or she does exist in the LDAP,
* we add him to the dokeos database
*/
*/
//require_once('../../inc/global.inc.php'); - this script should be loaded by the /index.php script anyway, so global is already loaded
require_once('authldap.php');
//error_log('Trying to register new user '.$login.' with pass '.$password,0);
require_once 'authldap.php';
$ldap_login_success = ldap_login($login, $password);
if ($ldap_login_success)
{
//error_log('Found user '.$login.' on LDAP server',0);
/*
In here, we know that
- the user does not exist in dokeos
- the users login and password are correct
*/
$info_array = ldap_find_user_info($login);
ldap_put_user_info_locally($login, $info_array);
if ($ldap_login_success) {
//error_log('Found user '.$login.' on LDAP server',0);
/*
In here, we know that
- the user does not exist in dokeos
- the users login and password are correct
*/
$info_array = ldap_find_user_info($login);
ldap_put_user_info_locally($login, $info_array);
} else {
//error_log('Could not find '.$login.' on LDAP server',0);
$loginFailed = true;
unset($_user['user_id']);
$uidReset = false;
$loginFailed = true;
unset($_user['user_id']);
$uidReset = false;
}

@ -493,12 +493,16 @@ abstract class Question
* in this version, a question can only have 1 category
* if category is 0, then question has no category then delete the category entry
* @param int $categoryId
* @return bool
*
* @author Hubert Borderiou 12-10-2011
*/
public function saveCategory($categoryId)
{
$courseId = api_get_course_int_id();
if (empty($courseId)) {
return false;
}
if ($categoryId <= 0) {
$this->deleteCategory();
} else {
@ -524,6 +528,8 @@ abstract class Question
VALUES (".$courseId.", $question_id, $categoryId)";
Database::query($sql);
}
return true;
}
}

@ -17,7 +17,6 @@ api_block_anonymous_users();
$skill = new Skill();
$gradebook = new Gradebook();
$skill_gradebook = new SkillRelGradebook();
$userId = api_get_user_id();
switch ($action) {
@ -128,9 +127,7 @@ switch ($action) {
$skill_info = $skill->get_skill_info($id);
$courses = $skill->get_courses_by_skill($id);
$sessions = $skill->getSessionsBySkill($id);
$html = '';
if (!empty($courses) || !empty($sessions)) {
Display::display_no_header();
Display::$global_template->assign('skill', $skill_info);
@ -175,7 +172,7 @@ switch ($action) {
echo json_encode($info);
break;
case 'load_children':
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
$load_user_data = isset($_REQUEST['load_user_data']) ? $_REQUEST['load_user_data'] : null;
$skills = $skill->get_children($id, $load_user_data);
@ -337,7 +334,6 @@ switch ($action) {
case 'delete_profile':
if (api_is_platform_admin() || api_is_drh()) {
$profileId = $_REQUEST['profile'];
$skillProfile = new SkillProfile();
$isDeleted = $skillProfile->delete($profileId);

@ -1,70 +1,71 @@
<?php
// @deprecated? @todo check if this file is used
$reports_template['exercicesMultiCourses'] = array(
'description' => 'Result of each test per student',
'getSQL' => 'reports_template_exercicesMultiCourses_getSQL',
'wizard' =>
'description' => 'Result of each test per student',
'getSQL' => 'reports_template_exercicesMultiCourses_getSQL',
'wizard' =>
'
<span id="exercicesMultiCourses" class="step">
<span class="font_normal_07em_black">Result of each test per student</span><br />
<span class="font_normal_07em_black">Result of each test per student</span><br />
<!-- <label for="scoremin">Score min</label><br />
<input class="input_field_25em" name="scoremin" id="scoremin" value="0"><br />
<label for="scoremax">Score max</label><br />
<input class="input_field_25em" name="scoremax" id="scoremax" value="0"><br />
<input class="input_field_25em" name="scoremin" id="scoremin" value="0"><br />
<label for="scoremax">Score max</label><br />
<input class="input_field_25em" name="scoremax" id="scoremax" value="0"><br />
--> <label for="tattempt">How to treat Attempts</label><br />
<select name="tattempt" id="tattempt">
<select name="tattempt" id="tattempt">
<!-- <option value="first">take only the first one</option>
<option value="last">take only the last one</option>
<option value="last">take only the last one</option>
--> <option value="avg">take the average value</option>
<option value="min">take the minimum value</option>
<option value="max">take the maximum value</option>
</select><br />
<option value="min">take the minimum value</option>
<option value="max">take the maximum value</option>
</select><br />
<!-- <label name="gcourses">Do you want to group quiz per courses</label><br />
<select name="gcourses" id="gcourses">
<option value="nogroup">Do not group</option>
<option value="average">group and take the average value</option>
<option value="min">group and take the minimum value</option>
<option value="max">group and take the maximum value</option>
</select><br />
<select name="gcourses" id="gcourses">
<option value="nogroup">Do not group</option>
<option value="average">group and take the average value</option>
<option value="min">group and take the minimum value</option>
<option value="max">group and take the maximum value</option>
</select><br />
--> <input type="hidden" class="link" value="format" />
</span>
');
function reports_template_exercicesMultiCourses_getSQL() {
// foreach quiz
$result = array();
$columns = Database::query('select r.id as kid, c.title as course, '.
'r.child_name as test from '.
Database::get_main_table(TABLE_MAIN_REPORTS_KEYS).' r, '.
Database::get_main_table(TABLE_MAIN_COURSE).' c '.
'where r.course_id=c.id and r.tool_id='.
reports_getToolId(TOOL_QUIZ).
' order by r.course_id, r.child_name');
if (Database::num_rows($columns) == 0)
die('<b>'.get_lang('no data found').'</b>');
$query = 'select u.lastname Name, u.firstname Firstname';
$columns = Database::store_result($columns);
if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max')
$function = $_REQUEST['tattempt'];
else
$function = 'avg';
foreach ($columns as $key => $column)
$query .= ', '.$function.'(k'.$key.'.score) as `'.
$column['course'].' - '.
$column['test'].'` ';
$query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
foreach ($columns as $key => $column) // fixme sessions
$query .= 'left outer join '.
Database::get_main_table(TABLE_MAIN_REPORTS_VALUES).
' k'.$key.
' on k'.$key.'.key_id = '.$column['kid'].
' and k'.$key.'.user_id = u.user_id ';
$query .= ' group by ';
foreach ($columns as $key => $column) // grouping attempt
$query .= 'k'.$key.'.attempt, ';
$query = substr($query, 0, -2); // removing last ', ';
function reports_template_exercicesMultiCourses_getSQL()
{
// foreach quiz
$result = array();
$columns = Database::query('select r.id as kid, c.title as course, '.
'r.child_name as test from '.
Database::get_main_table(TABLE_MAIN_REPORTS_KEYS).' r, '.
Database::get_main_table(TABLE_MAIN_COURSE).' c '.
'where r.course_id=c.id and r.tool_id='.
reports_getToolId(TOOL_QUIZ).
' order by r.course_id, r.child_name');
if (Database::num_rows($columns) == 0)
die('<b>'.get_lang('no data found').'</b>');
$query = 'select u.lastname Name, u.firstname Firstname';
$columns = Database::store_result($columns);
if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max')
$function = $_REQUEST['tattempt'];
else
$function = 'avg';
foreach ($columns as $key => $column)
$query .= ', '.$function.'(k'.$key.'.score) as `'.
$column['course'].' - '.
$column['test'].'` ';
$query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
foreach ($columns as $key => $column) // fixme sessions
$query .= 'left outer join '.
Database::get_main_table(TABLE_MAIN_REPORTS_VALUES).
' k'.$key.
' on k'.$key.'.key_id = '.$column['kid'].
' and k'.$key.'.user_id = u.user_id ';
$query .= ' group by ';
foreach ($columns as $key => $column) // grouping attempt
$query .= 'k'.$key.'.attempt, ';
$query = substr($query, 0, -2); // removing last ', ';
return $query;
return $query;
}

@ -24,9 +24,7 @@ if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
$form_sent = 0;
$errorMsg = '';
$users = $sessions = array();
$id = isset($_GET['id']) ? intval($_GET['id']) : null;
SessionManager::protectSession($id);
$htmlResult = null;

@ -4,9 +4,7 @@
* to OpenMeetings from Chamilo by calling its web services
* @package chamilo.plugin.openmeetings
*/
/**
* Initialization
*/
namespace Chamilo\Plugin\OpenMeetings;
include_once __DIR__.'/session.class.php';

@ -25,18 +25,22 @@ class UserGroupAdmin extends AbstractAdmin
$formMapper
->add('name')
->add('description', 'ckeditor')
->add('users', 'sonata_type_collection', array(
->add(
'users',
'sonata_type_collection',
array(
'cascade_validation' => true,
), array(
// 'allow_delete' => true,
),
array(
// 'allow_delete' => true,
'by_reference' => false,
'edit' => 'inline',
'inline' => 'table',
'edit' => 'inline',
'inline' => 'table',
//'btn_add' => true,
//'multiple' => true
//'sortable' => 'position',
//'link_parameters' => array('content' => $users),
'admin_code' => 'sonata.admin.user_group_rel_user'
'admin_code' => 'sonata.admin.user_group_rel_user',
)
)
;

@ -13,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/
class MessageAttachment
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
@ -48,17 +57,6 @@ class MessageAttachment
*/
private $filename;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* Set path
*

@ -66,7 +66,6 @@ class NavBuilder extends ContainerAware
);
if ($checker->isGranted('IS_AUTHENTICATED_FULLY')) {
$menu->addChild(
$translator->trans('My courses'),
array('route' => 'userportal')
@ -103,7 +102,6 @@ class NavBuilder extends ContainerAware
);
if ($checker->isGranted('ROLE_ADMIN')) {
$menu->addChild(
$translator->trans('Dashboard'),
array(
@ -136,7 +134,7 @@ class NavBuilder extends ContainerAware
);
/** @var Category $category */
foreach ($categories as $category) {
$faq->addChild(
$faq->addChild(
$category->getHeadline(),
array(
'route' => 'faq',
@ -227,7 +225,6 @@ class NavBuilder extends ContainerAware
// <nav class="navbar navbar-default">
if ($checker->isGranted('IS_AUTHENTICATED_FULLY')) {
$token = $this->container->get('security.token_storage');
/** @var User $user */
$user = $token->getToken()->getUser();

@ -1796,7 +1796,7 @@ class User extends BaseUser
return $this->locale;
}
/**
/**
* @param string $timezone
*
* @return User
@ -1969,7 +1969,7 @@ class User extends BaseUser
return $this->plainPassword;
}
/**
/**
* Returns the user roles
*
* @return array The roles

Loading…
Cancel
Save