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

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

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

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

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

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

@ -25,18 +25,22 @@ class UserGroupAdmin extends AbstractAdmin
$formMapper $formMapper
->add('name') ->add('name')
->add('description', 'ckeditor') ->add('description', 'ckeditor')
->add('users', 'sonata_type_collection', array( ->add(
'users',
'sonata_type_collection',
array(
'cascade_validation' => true, 'cascade_validation' => true,
), array( ),
// 'allow_delete' => true, array(
// 'allow_delete' => true,
'by_reference' => false, 'by_reference' => false,
'edit' => 'inline', 'edit' => 'inline',
'inline' => 'table', 'inline' => 'table',
//'btn_add' => true, //'btn_add' => true,
//'multiple' => true //'multiple' => true
//'sortable' => 'position', //'sortable' => 'position',
//'link_parameters' => array('content' => $users), //'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 class MessageAttachment
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* @var string * @var string
* *
@ -48,17 +57,6 @@ class MessageAttachment
*/ */
private $filename; private $filename;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set path * Set path
* *

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

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

Loading…
Cancel
Save