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

remotes/angel/1.11.x
Yannick Warnier 8 years ago
parent 192c073954
commit d4e9222901
  1. 10
      main/gradebook/lib/fe/dataform.class.php
  2. 8
      main/gradebook/lib/fe/flatviewtable.class.php
  3. 10
      main/gradebook/lib/fe/userform.class.php
  4. 10
      main/gradebook/lib/flatview_data_generator.class.php
  5. 10
      main/inc/lib/notebook.lib.php
  6. 22
      main/lp/openoffice_text.class.php
  7. 8
      plugin/buycourses/src/Requests.php

@ -25,15 +25,15 @@ class DataForm extends FormValidator
{
parent:: __construct($form_name, $method, $action, $target);
$this->form_type = $form_type;
if ($this->form_type == self :: TYPE_IMPORT) {
if ($this->form_type == self::TYPE_IMPORT) {
$this->build_import_form();
} elseif ($this->form_type == self :: TYPE_EXPORT) {
} elseif ($this->form_type == self::TYPE_EXPORT) {
if ($locked_status == 0) {
$this->build_export_form_option(false);
} else {
$this->build_export_form();
}
} elseif ($this->form_type == self :: TYPE_EXPORT_PDF) {
} elseif ($this->form_type == self::TYPE_EXPORT_PDF) {
$this->build_pdf_export_form();
}
$this->setDefaults();
@ -106,11 +106,11 @@ class DataForm extends FormValidator
public function display()
{
parent :: display();
parent::display();
}
public function setDefaults($defaults = array(), $filter = null)
{
parent :: setDefaults($defaults, $filter);
parent::setDefaults($defaults, $filter);
}
}

@ -383,15 +383,15 @@ class FlatViewTable extends SortableTable
// retrieve sorting type
if ($is_western_name_order) {
$users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME : FlatViewDataGenerator :: FVDG_SORT_LASTNAME);
$users_sorting = ($this->column == 0 ? FlatViewDataGenerator::FVDG_SORT_FIRSTNAME : FlatViewDataGenerator::FVDG_SORT_LASTNAME);
} else {
$users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_LASTNAME : FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME);
$users_sorting = ($this->column == 0 ? FlatViewDataGenerator::FVDG_SORT_LASTNAME : FlatViewDataGenerator::FVDG_SORT_FIRSTNAME);
}
if ($this->direction == 'DESC') {
$users_sorting |= FlatViewDataGenerator :: FVDG_SORT_DESC;
$users_sorting |= FlatViewDataGenerator::FVDG_SORT_DESC;
} else {
$users_sorting |= FlatViewDataGenerator :: FVDG_SORT_ASC;
$users_sorting |= FlatViewDataGenerator::FVDG_SORT_ASC;
}
// step 1: generate columns: evaluations and links

@ -22,7 +22,7 @@ class UserForm extends FormValidator
*/
public function __construct($form_type, $user, $form_name, $method= 'post', $action= null)
{
parent :: __construct($form_name, $method, $action);
parent::__construct($form_name, $method, $action);
$this->form_type= $form_type;
if (isset ($user)) {
$this->user_info= $user;
@ -30,10 +30,10 @@ class UserForm extends FormValidator
if (isset ($result_object)) {
$this->result_object= $result_object;
}
if ($this->form_type == self :: TYPE_USER_INFO) {
if ($this->form_type == self::TYPE_USER_INFO) {
$this->build_user_info_form();
}
elseif ($this->form_type == self :: TYPE_SIMPLE_SEARCH) {
elseif ($this->form_type == self::TYPE_SIMPLE_SEARCH) {
$this->build_simple_search();
}
$this->setDefaults();
@ -70,11 +70,11 @@ class UserForm extends FormValidator
function display()
{
parent :: display();
parent::display();
}
function setDefaults($defaults= array(), $filter = null)
{
parent :: setDefaults($defaults, $filter);
parent::setDefaults($defaults, $filter);
}
}

@ -310,14 +310,14 @@ class FlatViewDataGenerator
}
// sort users array
if ($users_sorting & self :: FVDG_SORT_LASTNAME) {
if ($users_sorting & self::FVDG_SORT_LASTNAME) {
usort($userTable, array('FlatViewDataGenerator','sort_by_last_name'));
} elseif ($users_sorting & self :: FVDG_SORT_FIRSTNAME) {
} elseif ($users_sorting & self::FVDG_SORT_FIRSTNAME) {
usort($userTable, array('FlatViewDataGenerator','sort_by_first_name'));
}
if ($users_sorting & self :: FVDG_SORT_DESC) {
if ($users_sorting & self::FVDG_SORT_DESC) {
$userTable = array_reverse($userTable);
}
@ -600,7 +600,7 @@ class FlatViewDataGenerator
$evaluationsAlreadyAdded = array()
) {
// Generate actual data array
$scoredisplay = ScoreDisplay :: instance();
$scoredisplay = ScoreDisplay::instance();
$item_total = 0;
$item_value_total = 0;
@ -828,7 +828,7 @@ class FlatViewDataGenerator
usort($usertable, array ('FlatViewDataGenerator','sort_by_first_name'));
// generate actual data array
$scoredisplay = ScoreDisplay :: instance();
$scoredisplay = ScoreDisplay::instance();
$data = array();
$selected_users = $usertable;
foreach ($selected_users as $user) {

@ -55,7 +55,7 @@ class NotebookManager
return false;
}
// Database table definition
$table = Database :: get_course_table(TABLE_NOTEBOOK);
$table = Database::get_course_table(TABLE_NOTEBOOK);
$userId = $userId ?: api_get_user_id();
$courseId = $courseId ?: api_get_course_int_id();
$courseInfo = api_get_course_info_by_id($courseId);
@ -103,7 +103,7 @@ class NotebookManager
return array();
}
// Database table definition
$t_notebook = Database :: get_course_table(TABLE_NOTEBOOK);
$t_notebook = Database::get_course_table(TABLE_NOTEBOOK);
$course_id = api_get_course_int_id();
$sql = "SELECT
@ -136,7 +136,7 @@ class NotebookManager
return false;
}
// Database table definition
$table = Database :: get_course_table(TABLE_NOTEBOOK);
$table = Database::get_course_table(TABLE_NOTEBOOK);
$course_id = api_get_course_int_id();
$sessionId = api_get_session_id();
@ -183,7 +183,7 @@ class NotebookManager
return false;
}
// Database table definition
$t_notebook = Database :: get_course_table(TABLE_NOTEBOOK);
$t_notebook = Database::get_course_table(TABLE_NOTEBOOK);
$course_id = api_get_course_int_id();
@ -252,7 +252,7 @@ class NotebookManager
}
// Database table definition
$t_notebook = Database :: get_course_table(TABLE_NOTEBOOK);
$t_notebook = Database::get_course_table(TABLE_NOTEBOOK);
if ($_SESSION['notebook_view'] == 'creation_date' || $_SESSION['notebook_view'] == 'update_date') {
$order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
} else {

@ -34,7 +34,7 @@ class OpenofficeText extends OpenofficeDocument {
* @param integer Creator user id
* @return void
*/
function OpenofficeText($split_steps = false, $course_code = null, $resource_id = null, $user_id = null) {
public function __construct($split_steps = false, $course_code = null, $resource_id = null, $user_id = null) {
$this -> split_steps = $split_steps;
parent::__construct($course_code, $resource_id, $user_id);
}
@ -44,7 +44,7 @@ class OpenofficeText extends OpenofficeDocument {
* @param array The files that will compose the generated learning path. Unused so far.
* @return boolean False if file does not exit. Nothing otherwise.
*/
function make_lp($files = array())
public function make_lp($files = array())
{
$_course = api_get_course_info();
// We get a content where ||page_break|| indicates where the page is broken.
@ -87,8 +87,12 @@ class OpenofficeText 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;
}
}
@ -98,7 +102,7 @@ class OpenofficeText extends OpenofficeDocument {
* @param string Content
* @return void
*/
function dealPerChapter($header, $content)
public function dealPerChapter($header, $content)
{
$_course = api_get_course_info();
$content = str_replace('||page_break||', '', $content);
@ -189,7 +193,7 @@ class OpenofficeText extends OpenofficeDocument {
* @param string Page body
* @return void
*/
function dealPerPage($header, $body)
public function dealPerPage($header, $body)
{
$_course = api_get_course_info();
// Split document to pages.
@ -298,7 +302,7 @@ class OpenofficeText extends OpenofficeDocument {
* Returns additional Java command parameters
* @return string The additional parameters to be used in the Java call
*/
function add_command_parameters(){
public function add_command_parameters(){
return ' -d woogie "'.$this->base_work_dir.'/'.$this->file_path.'" "'.$this->base_work_dir.$this->created_dir.'/'.$this->file_name.'.html"';
}
@ -308,7 +312,7 @@ class OpenofficeText extends OpenofficeDocument {
* @param string Page content
* @return string Formatted page content
*/
function format_page_content($header, $content) {
public function format_page_content($header, $content) {
// Limit the width of the doc.
list($max_width, $max_height) = explode('x',api_get_setting('service_ppt2lp','size'));
@ -354,7 +358,7 @@ class OpenofficeText extends OpenofficeDocument {
/**
* Add documents to the visioconference (to be implemented)
*/
function add_docs_to_visio() {
public function add_docs_to_visio() {
}
}

@ -518,7 +518,7 @@ class Requests {
'idn' => true,
'hooks' => null,
'transport' => null,
'verify' => Requests::get_certificate_path(),
'verify' => self::get_certificate_path(),
'verifyname' => true,
);
if ($multirequest !== false) {
@ -533,8 +533,8 @@ class Requests {
* @return string Default certificate path.
*/
public static function get_certificate_path() {
if ( ! empty( Requests::$certificate_path ) ) {
return Requests::$certificate_path;
if ( ! empty( self::$certificate_path ) ) {
return self::$certificate_path;
}
return dirname(__FILE__) . '/Requests/Transport/cacert.pem';
@ -546,7 +546,7 @@ class Requests {
* @param string $path Certificate path, pointing to a PEM file.
*/
public static function set_certificate_path( $path ) {
Requests::$certificate_path = $path;
self::$certificate_path = $path;
}
/**

Loading…
Cancel
Save