Minor - Fixing tab/whitespaces, adding docs.

1.9.x
Julio Montoya 12 years ago
parent c0c1452952
commit 890071bde1
  1. 13
      main/calendar/agenda.lib.php
  2. 34
      main/gradebook/lib/gradebook_functions.inc.php
  3. 26
      main/inc/lib/display.lib.php

@ -56,10 +56,19 @@ class Agenda
* @param string content
* @param array users to send array('everyone') or a list of user ids
* @param bool add event as a *course* announcement
* @return int
*
*/
public function add_event($start, $end, $all_day, $view, $title, $content, $users_to_send = array(), $add_as_announcement = false)
{
public function add_event(
$start,
$end,
$all_day,
$view,
$title,
$content,
$users_to_send = array(),
$add_as_announcement = false
) {
$start = api_get_utc_datetime($start);
$end = api_get_utc_datetime($end);
$all_day = isset($all_day) && $all_day == 'true' ? 1 : 0;

@ -17,6 +17,7 @@ require_once 'gradebook_functions_users.inc.php';
/**
* Adds a resource to the unique gradebook of a given course
* @param int
* @param string Course code
* @param int Resource type (use constants defined in linkfactory.class.php)
* @param int Resource ID in the corresponding tool
@ -24,12 +25,24 @@ require_once 'gradebook_functions_users.inc.php';
* @param int Resource weight to set in the gradebook
* @param int Resource max
* @param string Resource description
* @param string Date
* @param int Visibility (0 hidden, 1 shown)
* @param int Session ID (optional or 0 if not defined)
* @param int
* @return boolean True on success, false on failure
*/
function add_resource_to_course_gradebook($category_id, $course_code, $resource_type, $resource_id, $resource_name = '', $weight = 0, $max = 0, $resource_description = '', $visible = 0, $session_id = 0, $link_id = null) {
function add_resource_to_course_gradebook(
$category_id,
$course_code,
$resource_type,
$resource_id,
$resource_name = '',
$weight = 0,
$max = 0,
$resource_description = '',
$visible = 0,
$session_id = 0,
$link_id = null
) {
$link = LinkFactory :: create($resource_type);
$link->set_user_id(api_get_user_id());
$link->set_course_code($course_code);
@ -64,9 +77,12 @@ function add_resource_to_course_gradebook($category_id, $course_code, $resource_
/**
* Update a resource weight
* @param int Link/Resource ID
* @param string
* @param float
* @return bool false on error, true on success
*/
function update_resource_from_course_gradebook($link_id, $course_code, $weight) {
function update_resource_from_course_gradebook($link_id, $course_code, $weight)
{
$course_code = Database::escape_string($course_code);
if (!empty($link_id)) {
$link_id = intval($link_id);
@ -83,18 +99,21 @@ function update_resource_from_course_gradebook($link_id, $course_code, $weight)
* @param int Link/Resource ID
* @return bool false on error, true on success
*/
function remove_resource_from_course_gradebook($link_id) {
function remove_resource_from_course_gradebook($link_id)
{
if (empty($link_id)) {
return false;
}
// TODO find the corresponding category (the first one for this course, ordered by ID)
$l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = "DELETE FROM $l WHERE id = " . (int) $link_id;
$sql = "DELETE FROM $l WHERE id = ".(int)$link_id;
Database::query($sql);
return true;
}
function block_students() {
function block_students()
{
if (!api_is_allowed_to_edit()) {
api_not_allowed();
}
@ -104,7 +123,8 @@ function block_students() {
* Returns the course name from a given code
* @param string $code
*/
function get_course_name_from_code($code) {
function get_course_name_from_code($code)
{
$tbl_main_categories = Database :: get_main_table(TABLE_MAIN_COURSE);
$sql = 'SELECT title, code FROM ' . $tbl_main_categories . 'WHERE code = "' . Database::escape_string($code) . '"';
$result = Database::query($sql);

@ -828,13 +828,20 @@ class Display {
* @return string html
*
*/
public static function grid_html($div_id){
$table = self::tag('table','',array('id'=>$div_id));
$table .= self::tag('div','',array('id'=>$div_id.'_pager'));
public static function grid_html($div_id)
{
$table = self::tag('table','', array('id' => $div_id));
$table .= self::tag('div','', array('id' => $div_id.'_pager'));
return $table;
}
public static function form_row($label, $form_item) {
/**
* @param string $label
* @param string $form_item
* @return string
*/
public static function form_row($label, $form_item)
{
$label = self::span($label, array('class' =>'control-label'));
$form_item = self::div($form_item, array('class' =>'controls'));
return self::div($label.$form_item, array('class'=>'control-group'));
@ -857,7 +864,16 @@ class Display {
* @return string the js code
*
*/
public static function grid_js($div_id, $url, $column_names, $column_model, $extra_params, $data = array(), $formatter = '', $width_fix = false) {
public static function grid_js(
$div_id,
$url,
$column_names,
$column_model,
$extra_params,
$data = array(),
$formatter = '',
$width_fix = false
) {
$obj = new stdClass();
if (!empty($url)) {

Loading…
Cancel
Save