Skip to content

Commit

Permalink
lib MDL-19236 Added boilerplates and copyrights
Browse files Browse the repository at this point in the history
  • Loading branch information
samhemelryk committed May 26, 2009
1 parent b37eac9 commit 72fb21b
Show file tree
Hide file tree
Showing 6 changed files with 523 additions and 344 deletions.
84 changes: 81 additions & 3 deletions lib/tablelib.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,49 @@
<?php // $Id$

<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* @package moodlecore
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

/** TABLE_VAR_SORT = 1 */
define('TABLE_VAR_SORT', 1);
/** TABLE_VAR_HIDE = 2 */
define('TABLE_VAR_HIDE', 2);
/** TABLE_VAR_SHOW = 3 */
define('TABLE_VAR_SHOW', 3);
/** TABLE_VAR_IFIRST = 4 */
define('TABLE_VAR_IFIRST', 4);
/** TABLE_VAR_ILAST = 5 */
define('TABLE_VAR_ILAST', 5);
/** TABLE_VAR_PAGE = 6 */
define('TABLE_VAR_PAGE', 6);

/** TABLE_P_TOP = 1 */
define('TABLE_P_TOP', 1);
/** TABLE_P_BOTTOM = 2 */
define('TABLE_P_BOTTOM', 2);


/**
* @package moodlecore
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class flexible_table {

var $uniqueid = NULL;
Expand Down Expand Up @@ -1140,6 +1173,11 @@ function make_attributes_string(&$attributes) {
}
}

/**
* @package moodlecore
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class table_sql extends flexible_table{

public $countsql = NULL;
Expand Down Expand Up @@ -1280,6 +1318,11 @@ function out($pagesize, $useinitialsbar, $downloadhelpbutton=''){
}
}

/**
* @package moodlecore
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class table_default_export_format_parent{
/**
* @var flexible_table or child class reference pointing to table class
Expand Down Expand Up @@ -1321,6 +1364,11 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL
}
}

/**
* @package moodlecore
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class table_spreadsheet_export_format_parent extends table_default_export_format_parent{
var $rownum;
var $workbook;
Expand Down Expand Up @@ -1391,6 +1439,11 @@ function finish_document(){
}
}

/**
* @package moodlecore
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class table_excel_export_format extends table_spreadsheet_export_format_parent{
var $fileextension = 'xls';

Expand All @@ -1403,6 +1456,11 @@ function define_workbook(){

}

/**
* @package moodlecore
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class table_ods_export_format extends table_spreadsheet_export_format_parent{
var $fileextension = 'ods';
function define_workbook(){
Expand All @@ -1413,6 +1471,11 @@ function define_workbook(){
}
}

/**
* @package moodlecore
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class table_text_export_format_parent extends table_default_export_format_parent{
var $seperator = "\t";
function start_document($filename){
Expand Down Expand Up @@ -1442,16 +1505,31 @@ function finish_document(){
}
}

/**
* @package moodlecore
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class table_tsv_export_format extends table_text_export_format_parent{
var $seperator = "\t";

}

/**
* @package moodlecore
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class table_csv_export_format extends table_text_export_format_parent{
var $seperator = ",";

}

/**
* @package moodlecore
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class table_xhtml_export_format extends table_default_export_format_parent{
function start_document($filename){
header("Content-Type: application/download\n");
Expand Down
68 changes: 36 additions & 32 deletions lib/textlib.class.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
<?php // $Id$

///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.com //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////

/// As we implement the singleton pattern to use this class (only one instance
/// is shared globally), we need this helper function

/// IMPORTANT Note: Typo3 libraries always expect lowercase charsets to use 100%
/// its capabilities so, don't forget to make the conversion
/// from every wrapper function!
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* @package moodlecore
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

/**
* As we implement the singleton pattern to use this class (only one instance
* is shared globally), we need this helper function
*
* IMPORTANT Note: Typo3 libraries always expect lowercase charsets to use 100%
* its capabilities so, don't forget to make the conversion
* from every wrapper function!
*
* @global object
*/
function textlib_get_instance() {
global $CFG;

Expand Down Expand Up @@ -92,6 +92,10 @@ function textlib_get_instance() {
* really a cool group of utilities to handle texts and encoding conversion.
*
* Take a look to its own copyright and license details.
*
* @package moodlecore
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class textlib {

Expand Down
98 changes: 54 additions & 44 deletions lib/tokeniserlib.php
Original file line number Diff line number Diff line change
@@ -1,48 +1,58 @@
<?php // $Id$

///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Original code: //
// //
// Drupal - The copyright of both the Drupal software and the //
// "Druplicon" logo belongs to all the original authors, //
// though both are licensed under the GPL. //
// http://drupal.org //
// //
// Modifications: //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.com //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com //
// (C) 2001-3001 Antonio Vicent http://ludens.es //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////

/// Based on Drupal's search.module version 1.224
/// http://cvs.drupal.org/viewcvs/drupal/drupal/modules/search/search.module?view=markup

/// Usage: $tokens = tokenise_text($text)
/// Returns an array of tokens (key) with their score (value)
/// (see function definition for more info)

/// Some constants
<?php

//
// NOTICE OF COPYRIGHT
//
// Original code:
//
// Drupal - The copyright of both the Drupal software and the
// "Druplicon" logo belongs to all the original authors,
// though both are licensed under the GPL.
// http://drupal.org
//
// Modifications:
//
// Moodle - Modular Object-Oriented Dynamic Learning Environment
// http://moodle.com
//
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
//

/**
* Based on Drupal's search.module version 1.224
*
* {@link http://cvs.drupal.org/viewcvs/drupal/drupal/modules/search/search.module?view=markup}
*
* Usage: $tokens = tokenise_text($text)
* Returns an array of tokens (key) with their score (value)
* (see function definition for more info)
*
* Major Contributors
* - Martin Dougiamas {@link http://moodle.com}
* - Eloy Lafuente (stronk7) {@link http://contiento.com}
* - Antonio Vicent {@link http://ludens.es}
*
* @package moodlecore
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

/**
* Some constants
*/
define ('MINIMUM_WORD_SIZE', 3); /// Minimum word size to index and search
define ('MAXIMUM_WORD_SIZE', 50); /// Maximum word size to index and search

Expand Down
Loading

0 comments on commit 72fb21b

Please sign in to comment.