Minor - Code style - Use "self" instead of classname within the class and remove spaces around :: operator

pull/2487/head
Yannick Warnier 9 years ago
parent d4e9222901
commit 3bfbeee958
  1. 54
      main/admin/ldap_users_list.php
  2. 21
      main/course_progress/index.php
  3. 6
      main/exercise/export/exercise_import.inc.php
  4. 7
      main/gradebook/lib/be/studentpublicationlink.class.php
  5. 6
      main/gradebook/lib/fe/linkform.class.php
  6. 6
      main/gradebook/lib/fe/scoredisplayform.class.php
  7. 8
      main/inc/lib/AnnouncementManager.php
  8. 6
      main/inc/lib/dashboard.lib.php
  9. 9
      main/inc/lib/search/xapian/XapianQuery.php
  10. 6
      main/inc/lib/surveymanager.lib.php
  11. 12
      main/lp/aicc.class.php
  12. 8
      main/lp/openoffice_text_document.class.php
  13. 6
      plugin/dashboard/block_teacher/block_teacher.class.php
  14. 6
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseArchiver.php
  15. 6
      src/Chamilo/ThemeBundle/Helper/WidgetHelper.php

@ -32,7 +32,7 @@ if (($_GET['action']=="add_user") && ($_GET['id_session'] == strval(intval($_GET
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$tool_name = get_lang('SearchLDAPUsers');
//Display :: display_header($tool_name); //cannot display now as we need to redirect
//Display::display_header($tool_name); //cannot display now as we need to redirect
//api_display_tool_title($tool_name);
if (isset ($_GET['action']))
@ -43,31 +43,31 @@ if (isset ($_GET['action']))
switch ($_GET['action'])
{
case 'show_message' :
Display :: display_header($tool_name);
Display :: display_normal_message($_GET['message']);
Display::display_header($tool_name);
Display::display_normal_message($_GET['message']);
break;
case 'delete_user' :
Display :: display_header($tool_name);
if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id']))
Display::display_header($tool_name);
if ($user_id != $_user['user_id'] && UserManager::delete_user($_GET['user_id']))
{
Display :: display_normal_message(get_lang('UserDeleted'));
Display::display_normal_message(get_lang('UserDeleted'));
}
else
{
Display :: display_error_message(get_lang('CannotDeleteUser'));
Display::display_error_message(get_lang('CannotDeleteUser'));
}
break;
case 'lock' :
Display :: display_header($tool_name);
Display::display_header($tool_name);
$message=lock_unlock_user('lock',$_GET['user_id']);
Display :: display_normal_message($message);
Display::display_normal_message($message);
break;
case 'unlock';
Display :: display_header($tool_name);
case 'unlock':
Display::display_header($tool_name);
$message=lock_unlock_user('unlock',$_GET['user_id']);
Display :: display_normal_message($message);
Display::display_normal_message($message);
break;
case 'add_user';
case 'add_user':
$id=$_GET['id'];
$UserList=array();
$userid_match_login = array();
@ -80,7 +80,7 @@ if (isset ($_GET['action']))
ldap_add_user_to_session($UserList, $_GET['id_session']);
header('Location: resume_session.php?id_session='.intval($_GET['id_session']));
} else {
Display :: display_header($tool_name);
Display::display_header($tool_name);
if(count($userid_match_login)>0)
{
$message=get_lang('LDAPUsersAddedOrUpdated').':<br />';
@ -93,11 +93,11 @@ if (isset ($_GET['action']))
{
$message=get_lang('NoUserAdded');
}
Display :: display_normal_message($message,false);
Display::display_normal_message($message,false);
}
break;
default :
Display :: display_header($tool_name);
default:
Display::display_header($tool_name);
}
Security::clear_token();
}
@ -124,7 +124,7 @@ if (isset ($_POST['action']))
{
if($user_id != $_user['user_id'])
{
if(UserManager :: delete_user($user_id))
if(UserManager::delete_user($user_id))
{
$number_of_deleted_users++;
}
@ -132,11 +132,11 @@ if (isset ($_POST['action']))
}
if($number_of_selected_users == $number_of_deleted_users)
{
Display :: display_normal_message(get_lang('SelectedUsersDeleted'));
Display::display_normal_message(get_lang('SelectedUsersDeleted'));
}
else
{
Display :: display_error_message(get_lang('SomeUsersNotDeleted'));
Display::display_error_message(get_lang('SomeUsersNotDeleted'));
}
break;
case 'add_user' :
@ -154,11 +154,11 @@ if (isset ($_POST['action']))
addUserToSession($UserList, $_GET['id_session']);
if(count($UserList)>0)
{
Display :: display_normal_message(count($UserList)." ".get_lang('LDAPUsersAdded'));
Display::display_normal_message(count($UserList)." ".get_lang('LDAPUsersAdded'));
}
else
{
Display :: display_normal_message(get_lang('NoUserAdded'));
Display::display_normal_message(get_lang('NoUserAdded'));
}
break;
@ -210,13 +210,10 @@ $table = new SortableTable('users', 'ldap_get_number_of_users', 'ldap_get_user_d
$table->set_additional_parameters($parameters);
$table->set_header(0, '', false);
$table->set_header(1, get_lang('LoginName'));
if (api_is_western_name_order())
{
if (api_is_western_name_order()) {
$table->set_header(2, get_lang('FirstName'));
$table->set_header(3, get_lang('LastName'));
}
else
{
} else {
$table->set_header(2, get_lang('LastName'));
$table->set_header(3, get_lang('FirstName'));
}
@ -233,5 +230,4 @@ $table->display();
FOOTER
==============================================================================
*/
Display :: display_footer();
?>
Display::display_footer();

@ -252,42 +252,61 @@ if ($action == 'thematic_plan_list') {
";
}
// Distpacher actions to controller
// Dispatch actions to controller
switch ($action) {
case 'thematic_add':
//no break
case 'thematic_edit':
//no break
case 'thematic_delete':
//no break
case 'thematic_delete_select':
//no break
case 'thematic_copy':
//no break
case 'thematic_import_select':
//no break
case 'thematic_import':
//no break
case 'moveup':
//no break
case 'movedown':
if (!api_is_allowed_to_edit(null, true)) {
api_not_allowed();
}
//no break
case 'thematic_list':
//no break
case 'thematic_export':
//no break
case 'thematic_export_pdf':
//no break
case 'thematic_details':
//no break
case 'export_single_thematic':
$thematic_controller->thematic($action);
break;
case 'thematic_plan_add':
//no break
case 'thematic_plan_edit':
//no break
case 'thematic_plan_delete':
if (!api_is_allowed_to_edit(null, true)) {
api_not_allowed();
}
//no break
case 'thematic_plan_list':
$thematic_controller->thematic_plan($action);
break;
case 'thematic_advance_add':
//no break
case 'thematic_advance_edit':
//no break
case 'thematic_advance_delete':
if (!api_is_allowed_to_edit(null, true)) {
api_not_allowed();
}
//no break
case 'thematic_advance_list':
$thematic_controller->thematic_advance($action);
break;

@ -494,6 +494,7 @@ function startElementQti2($parser, $name, $attributes)
if (isset($attributes['DEFAULTVALUE'])) {
$exercise_info['question'][$current_question_ident]['default_weighting'] = $attributes['DEFAULTVALUE'];
}
// no break ?
case 'ITEMBODY':
$record_item_body = true;
$current_question_item_body = '';
@ -660,7 +661,7 @@ function elementDataQti2($parser, $data)
$exercise_info['description'] = $data;
}
}
break;
}
}
@ -797,6 +798,7 @@ function startElementQti1($parser, $name, $attributes)
$exercise_info['question'][$current_question_ident]['title'] = $current_question_item_body;
}
}
break;
}
}
@ -860,6 +862,7 @@ function endElementQti1($parser, $name, $attributes)
$current_question_item_body = '';
}
}
// no break ?
case 'RESPONSE_LID':
// Retrieve question type
if (!isset($exercise_info['question'][$current_question_ident]['type'])) {
@ -921,6 +924,7 @@ function elementDataQti1($parser, $data)
$lastLabelFieldName = $current_element;
$lastLabelFieldValue = $data;
}
// no break ?
case 'FIELDENTRY':
$current_question_item_body = $data;
switch ($lastLabelFieldValue) {

@ -81,7 +81,7 @@ class StudentPublicationLink extends AbstractLink
if (empty($this->course_code)) {
die('Error in get_not_created_links() : course code not set');
}
$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = 'SELECT id, url from '.$this->get_studpub_table()
.' pup WHERE c_id = '.$this->course_id.' AND has_properties != '."''".' AND id NOT IN'
@ -241,6 +241,7 @@ class StudentPublicationLink extends AbstractLink
$dql .= ' ORDER BY a.sentDate DESC';
break;
case 'first':
//no break
default:
// first attempt
$dql .= ' ORDER BY a.id';
@ -312,7 +313,7 @@ class StudentPublicationLink extends AbstractLink
*/
private function get_studpub_table()
{
return $this->studpub_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
return $this->studpub_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
}
/**
@ -320,7 +321,7 @@ class StudentPublicationLink extends AbstractLink
*/
private function get_itemprop_table()
{
return $this->itemprop_table = Database :: get_course_table(TABLE_ITEM_PROPERTY);
return $this->itemprop_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
}
public function needs_name_and_description()

@ -34,7 +34,7 @@ class LinkForm extends FormValidator
$action = null,
$extra = null
) {
parent :: __construct($form_name, $method, $action);
parent::__construct($form_name, $method, $action);
if (isset ($category_object)) {
$this->category_object = $category_object;
@ -47,9 +47,9 @@ class LinkForm extends FormValidator
if (isset($extra)) {
$this->extra = $extra;
}
if ($form_type == self :: TYPE_CREATE) {
if ($form_type == self::TYPE_CREATE) {
$this->build_create();
} elseif ($form_type == self :: TYPE_MOVE) {
} elseif ($form_type == self::TYPE_MOVE) {
$this->build_move();
}
}

@ -16,8 +16,8 @@ class ScoreDisplayForm extends FormValidator
*/
public function __construct($form_name, $action= null)
{
parent :: __construct($form_name, 'post', $action);
$displayscore = ScoreDisplay :: instance();
parent::__construct($form_name, 'post', $action);
$displayscore = ScoreDisplay::instance();
$customdisplays = $displayscore->get_custom_score_display_settings();
$nr_items = (count($customdisplays)!='0') ? count($customdisplays) : '1';
@ -158,6 +158,6 @@ class ScoreDisplayForm extends FormValidator
public function validate()
{
return parent :: validate();
return parent::validate();
}
}

@ -1195,7 +1195,7 @@ class AnnouncementManager
if (!filter_extension($new_file_name)) {
$return = -1;
Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
Display::display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
} else {
$new_file_name = uniqid('');
$new_path = $updir . '/' . $new_file_name;
@ -1252,7 +1252,7 @@ class AnnouncementManager
if (!filter_extension($new_file_name)) {
$return = -1;
Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
Display::display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
} else {
$new_file_name = uniqid('');
$new_path = $updir . '/' . $new_file_name;
@ -1270,7 +1270,7 @@ class AnnouncementManager
$result = Database::query($sql);
if ($result === false) {
$return = -1;
Display :: display_error_message(get_lang('UplUnableToSaveFile'));
Display::display_error_message(get_lang('UplUnableToSaveFile'));
} else {
$return = 1;
}
@ -1593,7 +1593,7 @@ class AnnouncementManager
$myrow['visibility'] = $item_visibility;
// show attachment list
$attachment_list = AnnouncementManager::get_attachment($myrow['id']);
$attachment_list = self::get_attachment($myrow['id']);
$attachment_icon = '';
if (count($attachment_list)>0) {

@ -139,7 +139,7 @@ class DashboardManager
*/
public static function store_dashboard_plugins($plugin_paths)
{
$tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
$tbl_block = Database::get_main_table(TABLE_MAIN_BLOCK);
$affected_rows = 0;
// get all plugins path inside plugin directory
@ -279,7 +279,7 @@ class DashboardManager
*/
public static function get_block_data_without_plugin()
{
$tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
$tbl_block = Database::get_main_table(TABLE_MAIN_BLOCK);
$possibleplugins = self::getPossibleDashboardPluginsPath();
// We check if plugin exists inside directory for updating active field
@ -320,7 +320,7 @@ class DashboardManager
*/
public static function get_enabled_dashboard_blocks($path = '')
{
$tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
$tbl_block = Database::get_main_table(TABLE_MAIN_BLOCK);
$condition_path = '';
if (!empty($path)) {
$path = Database::escape_string($path);

@ -213,11 +213,14 @@ function xapian_get_doc_terms($doc = NULL, $prefix) {
function xapian_join_queries($query1, $query2 = NULL, $op = 'or') {
// let decide how to join, avoiding include xapian.php outside
switch ($op) {
case 'or': $op = XapianQuery::OP_OR;
case 'or':
$op = XapianQuery::OP_OR;
break;
case 'and': $op = XapianQuery::OP_AND;
case 'and':
$op = XapianQuery::OP_AND;
break;
default: $op = XapianQuery::OP_OR;
default:
$op = XapianQuery::OP_OR;
break;
}

@ -18,9 +18,9 @@ class SurveyTree
public function __construct()
{
// Database table definitions
$table_survey = Database :: get_course_table(TABLE_SURVEY);
$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
$table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
// searching
$search_restriction = SurveyUtil::survey_search_restriction();

@ -709,8 +709,8 @@ class aicc extends learnpath
$zip_folder->create($scormfoldername.'/', PCLZIP_OPT_REMOVE_PATH, $scormfoldername.'/');
//this file sending implies removing the default mime-type from php.ini
//DocumentManager :: file_send_for_download($zipfilename, true, $LPnamesafe.".zip");
DocumentManager :: file_send_for_download($zipfilename, true);
//DocumentManager::file_send_for_download($zipfilename, true, $LPnamesafe.".zip");
DocumentManager::file_send_for_download($zipfilename, true);
// Delete the temporary zip file and directory in fileManage.lib.php
my_delete($zipfilename);
@ -933,8 +933,10 @@ class aicc extends learnpath
$fldval .= $chr;
break;
case "\r":
if (!$enclosed&&$data{$i+1} == "\n")
if (!$enclosed&&$data{$i+1} == "\n") {
continue;
}
// no break
case "\n":
if (!$enclosed) {
$ret_array[$linecount++][$fldcount] = $fldval;
@ -944,8 +946,10 @@ class aicc extends learnpath
$fldval .= $chr;
break;
case "\\r":
if (!$enclosed&&$data{$i+1} == "\\n")
if (!$enclosed&&$data{$i+1} == "\\n") {
continue;
}
// no break
case "\\n":
if (!$enclosed) {
$ret_array[$linecount++][$fldcount] = $fldval;

@ -83,8 +83,12 @@ class OpenOfficeTextDocument extends OpenofficeDocument {
$header = str_replace('absolute', 'relative', $header);
switch ($this->split_steps) {
case 'per_page': $this -> dealPerPage($header, $body); break;
case 'per_chapter': $this -> dealPerChapter($header, $body); break;
case 'per_page':
$this -> dealPerPage($header, $body);
break;
case 'per_chapter':
$this -> dealPerChapter($header, $body);
break;
}
}

@ -115,8 +115,8 @@ class BlockTeacher extends Block
$lastname = $teacher['lastname'];
$username = $teacher['username'];
$time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id));
$last_connection = Tracking :: get_last_connection_date($teacher_id);
$time_on_platform = api_time_to_hms(Tracking::get_time_spent_on_the_platform($teacher_id));
$last_connection = Tracking::get_last_connection_date($teacher_id);
if ($i%2 == 0) $class_tr = 'row_odd';
else $class_tr = 'row_even';
@ -172,7 +172,7 @@ class BlockTeacher extends Block
$firstname = $teacher['firstname'];
$lastname = $teacher['lastname'];
$username = $teacher['username'];
$time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id,true));
$time_on_platform = api_time_to_hms(Tracking::get_time_spent_on_the_platform($teacher_id,true));
if ($i%2 == 0) $class_tr = 'row_odd';
else $class_tr = 'row_even';

@ -64,8 +64,8 @@ class CourseArchiver
*/
public static function createBackup($course)
{
CourseArchiver::cleanBackupDir();
CourseArchiver::createBackupDir();
self::cleanBackupDir();
self::createBackupDir();
$perm_dirs = api_get_permissions_for_new_directories();
$backupDirectory = self::getBackupDir();
@ -255,7 +255,7 @@ class CourseArchiver
*/
public static function readCourse($filename, $delete = false)
{
CourseArchiver::cleanBackupDir();
self::cleanBackupDir();
// Create a temp directory
$tmp_dir_name = 'CourseArchiver_'.uniqid('');
$unzip_dir = self::getBackupDir().$tmp_dir_name;

@ -8,8 +8,12 @@
namespace Chamilo\ThemeBundle\Helper;
class WidgetHelper extends \Twig_Extension {
class WidgetHelper extends \Twig_Extension {
/**
* Get widget helper name
* @return string
*/
public function getName()
{
return 'widget';

Loading…
Cancel
Save