Minor - format code.

1.10.x
Julio Montoya 10 years ago
parent 89322e016c
commit bde896ab53
  1. 20
      main/admin/user_add.php
  2. 32
      main/admin/user_edit.php
  3. 124
      main/course_description/course_description.class.php

@ -319,7 +319,25 @@ if( $form->validate()) {
} }
} }
$user_id = UserManager::create_user($firstname, $lastname, $status, $email, $username, $password, $official_code, $language, $phone, null, $auth_source, $expiration_date, $active, $hr_dept_id, $extra, null, $send_mail); $user_id = UserManager::create_user(
$firstname,
$lastname,
$status,
$email,
$username,
$password,
$official_code,
$language,
$phone,
null,
$auth_source,
$expiration_date,
$active,
$hr_dept_id,
$extra,
null,
$send_mail
);
Security::clear_token(); Security::clear_token();
$tok = Security::get_token(); $tok = Security::get_token();

@ -25,7 +25,6 @@ $htmlHeadXtra[] = '
<script> <script>
var is_platform_id = "'.$is_platform_admin.'"; var is_platform_id = "'.$is_platform_admin.'";
<!--
function enable_expiration_date() { function enable_expiration_date() {
document.user_edit.radio_expiration_date[0].checked=false; document.user_edit.radio_expiration_date[0].checked=false;
document.user_edit.radio_expiration_date[1].checked=true; document.user_edit.radio_expiration_date[1].checked=true;
@ -69,7 +68,6 @@ function confirmation(name) {
return false; return false;
} }
} }
//-->
</script>'; </script>';
$libpath = api_get_path(LIBRARY_PATH); $libpath = api_get_path(LIBRARY_PATH);
@ -81,7 +79,9 @@ $interbreadcrumb[] = array('url' => "user_list.php","name" => get_lang('UserList
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$table_admin = Database::get_main_table(TABLE_MAIN_ADMIN); $table_admin = Database::get_main_table(TABLE_MAIN_ADMIN);
$sql = "SELECT u.*, a.user_id AS is_admin FROM $table_user u LEFT JOIN $table_admin a ON a.user_id = u.user_id WHERE u.user_id = '".$user_id."'"; $sql = "SELECT u.*, a.user_id AS is_admin FROM $table_user u
LEFT JOIN $table_admin a ON a.user_id = u.user_id
WHERE u.user_id = '".$user_id."'";
$res = Database::query($sql); $res = Database::query($sql);
if (Database::num_rows($res) != 1) { if (Database::num_rows($res) != 1) {
header('Location: user_list.php'); header('Location: user_list.php');
@ -203,14 +203,24 @@ $form->addGroup($group, 'password', null, '', false);
// Status // Status
$status = array(); $status = array();
$status[COURSEMANAGER] = get_lang('Teacher'); $status[COURSEMANAGER] = get_lang('Teacher');
$status[STUDENT] = get_lang('Learner'); $status[STUDENT] = get_lang('Learner');
$status[DRH] = get_lang('Drh'); $status[DRH] = get_lang('Drh');
$status[SESSIONADMIN] = get_lang('SessionsAdmin'); $status[SESSIONADMIN] = get_lang('SessionsAdmin');
$status[STUDENT_BOSS] = get_lang('RoleStudentBoss'); $status[STUDENT_BOSS] = get_lang('RoleStudentBoss');
$status[INVITEE] = get_lang('Invitee'); $status[INVITEE] = get_lang('Invitee');
$form->addElement('select', 'status', get_lang('Profile'), $status, array('id' => 'status_select', 'onchange' => 'javascript: display_drh_list();','class'=>'chzn-select')); $form->addElement(
'select',
'status',
get_lang('Profile'),
$status,
array(
'id' => 'status_select',
'onchange' => 'javascript: display_drh_list();',
'class' => 'chzn-select'
)
);
$display = isset($user_data['status']) && ($user_data['status'] == STUDENT || (isset($_POST['status']) && $_POST['status'] == STUDENT)) ? 'block' : 'none'; $display = isset($user_data['status']) && ($user_data['status'] == STUDENT || (isset($_POST['status']) && $_POST['status'] == STUDENT)) ? 'block' : 'none';

@ -3,42 +3,42 @@
namespace CourseDescription; namespace CourseDescription;
/** /**
* Object Model for the "Course Description" database table. Allows to * Object Model for the "Course Description" database table. Allows to
* *
* - query database * - query database
* - create/insert new course descriptions * - create/insert new course descriptions
* - update/edit course descriptions * - update/edit course descriptions
* - delete course descriptions * - delete course descriptions
* *
* Course descriptions used to provide descriptions for course/sessions. * Course descriptions used to provide descriptions for course/sessions.
* A course/session can have several descriptions associated to it from various types. * A course/session can have several descriptions associated to it from various types.
* Course descriptions are primarily made primarily of * Course descriptions are primarily made primarily of
* *
* - a title * - a title
* - some content * - some content
* - a type (for ex: info, objectives, etc) * - a type (for ex: info, objectives, etc)
* *
* Usage: * Usage:
* *
* Create * Create
* *
* $des = new CourseDescription(); * $des = new CourseDescription();
* $des->set_title('...'); * $des->set_title('...');
* $des->set_content('...'); * $des->set_content('...');
* $des->set_description_type(...); * $des->set_description_type(...);
* $des->insert(); * $des->insert();
* *
* Update * Update
* *
* $des = CourseDescription::get_by_id(..., ...); * $des = CourseDescription::get_by_id(..., ...);
* $des->set_title('...'); * $des->set_title('...');
* $des->update(); * $des->update();
* *
* Delete * Delete
* *
* $des = CourseDescription::get_by_id(..., ...); * $des = CourseDescription::get_by_id(..., ...);
* $des->delete(); * $des->delete();
* *
* @package chamilo.course_description * @package chamilo.course_description
* @author Christian Fasanando <christian1827@gmail.com> * @author Christian Fasanando <christian1827@gmail.com>
* @author Laurent Opprecht <laurent@opprecht.info> for the University of Geneva * @author Laurent Opprecht <laurent@opprecht.info> for the University of Geneva
@ -49,8 +49,8 @@ class CourseDescription
/** /**
* Return the repository. * Return the repository.
* *
* @return \CourseDescription\CourseDescriptionRepository * @return \CourseDescription\CourseDescriptionRepository
*/ */
public static function repository() public static function repository()
{ {
@ -59,7 +59,7 @@ class CourseDescription
/** /**
* Returns the list of all available types * Returns the list of all available types
* *
* @return array * @return array
*/ */
public static function get_types() public static function get_types()
@ -69,7 +69,7 @@ class CourseDescription
// /** // /**
// * Deprecated (still used by web services) // * Deprecated (still used by web services)
// * // *
// * @param int Course id // * @param int Course id
// * @deprecated use get_descriptions_by_course // * @deprecated use get_descriptions_by_course
// * @return array Array of CourseDescriptions // * @return array Array of CourseDescriptions
@ -153,7 +153,7 @@ class CourseDescription
// /** // /**
// * Insert the course description object into the course_description table. // * Insert the course description object into the course_description table.
// * // *
// * @return bool True on success, false on failure // * @return bool True on success, false on failure
// */ // */
// public function insert() // public function insert()
@ -168,11 +168,11 @@ class CourseDescription
// //
// $table = Database::get_course_table(TABLE_COURSE_DESCRIPTION); // $table = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
// $sql = "INSERT IGNORE INTO $table SET // $sql = "INSERT IGNORE INTO $table SET
// c_id = $course_id, // c_id = $course_id,
// description_type = $description_type, // description_type = $description_type,
// title = '$title', // title = '$title',
// content = '$content', // content = '$content',
// progress = $progress, // progress = $progress,
// session_id = $session_id"; // session_id = $session_id";
// //
// Database::query($sql); // Database::query($sql);
@ -184,7 +184,7 @@ class CourseDescription
// $this->id = $id; // $this->id = $id;
// //
// /** // /**
// * @todo: course info should come from c_id // * @todo: course info should come from c_id
// */ // */
// api_item_property_update(api_get_course_info(), TOOL_COURSE_DESCRIPTION, $id, 'CourseDescriptionAdded', api_get_user_id()); // api_item_property_update(api_get_course_info(), TOOL_COURSE_DESCRIPTION, $id, 'CourseDescriptionAdded', api_get_user_id());
// //
@ -192,13 +192,13 @@ class CourseDescription
// } // }
// /** // /**
// * Insert a row like history inside track_e_item_property table // * Insert a row like history inside track_e_item_property table
// * // *
// * @param int description type // * @param int description type
// * @return int affected rows // * @return int affected rows
// */ // */
// public function insert_stats($description_type) // public function insert_stats($description_type)
// { // {
// $tbl_stats_item_property = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY); // $tbl_stats_item_property = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY);
// $description_id = $this->get_id_by_description_type($description_type); // $description_id = $this->get_id_by_description_type($description_type);
// $course_id = api_get_real_course_id(); // $course_id = api_get_real_course_id();
// $course_code = api_get_course_id(); // $course_code = api_get_course_id();
@ -219,7 +219,7 @@ class CourseDescription
// } // }
// /** // /**
// * Update a course description object to the database. // * Update a course description object to the database.
// * // *
// * @return bool True on success, false on failure. // * @return bool True on success, false on failure.
// */ // */
// public function update() // public function update()
@ -234,11 +234,11 @@ class CourseDescription
// $session_id = $this->get_session_id(); // $session_id = $this->get_session_id();
// //
// $table = Database::get_course_table(TABLE_COURSE_DESCRIPTION); // $table = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
// $sql = "UPDATE $table SET // $sql = "UPDATE $table SET
// title = '$title', // title = '$title',
// content = '$content', // content = '$content',
// progress = $progress // progress = $progress
// WHERE id = $id AND // WHERE id = $id AND
// c_id = $course_id "; // c_id = $course_id ";
// //
// Database::query($sql); // Database::query($sql);
@ -247,7 +247,7 @@ class CourseDescription
// if ($result) { // if ($result) {
// //insert into item_property // //insert into item_property
// /** // /**
// * @todo: course info should come from c_id // * @todo: course info should come from c_id
// */ // */
// api_item_property_update(api_get_course_info(), TOOL_COURSE_DESCRIPTION, $this->id, 'CourseDescriptionUpdated', api_get_user_id()); // api_item_property_update(api_get_course_info(), TOOL_COURSE_DESCRIPTION, $this->id, 'CourseDescriptionUpdated', api_get_user_id());
// } // }
@ -255,7 +255,7 @@ class CourseDescription
// } // }
// /** // /**
// * Delete a course description object from the database. // * Delete a course description object from the database.
// * // *
// * @return bool True on success false on failure // * @return bool True on success false on failure
// */ // */
// public function delete() // public function delete()
@ -269,7 +269,7 @@ class CourseDescription
// $result = (bool) Database::affected_rows(); // $result = (bool) Database::affected_rows();
// if ($result) { // if ($result) {
// /** // /**
// * @todo: should get course info from $this->c_id // * @todo: should get course info from $this->c_id
// */ // */
// api_item_property_update(api_get_course_info(), TOOL_COURSE_DESCRIPTION, $this->id, 'CourseDescriptionDeleted', api_get_user_id()); // api_item_property_update(api_get_course_info(), TOOL_COURSE_DESCRIPTION, $this->id, 'CourseDescriptionDeleted', api_get_user_id());
// } // }
@ -341,8 +341,8 @@ class CourseDescription
// } // }
/** /**
* The course id. * The course id.
* *
* @see get_course() property to get access to the course object * @see get_course() property to get access to the course object
* @return int * @return int
*/ */
@ -361,7 +361,7 @@ class CourseDescription
/** /**
* The id of the object. * The id of the object.
* *
* @return int * @return int
*/ */
public function get_id() public function get_id()
@ -370,7 +370,7 @@ class CourseDescription
} }
/** /**
* *
* @return void * @return void
*/ */
public function set_id($value) public function set_id($value)
@ -380,7 +380,7 @@ class CourseDescription
/** /**
* The title of the course description. * The title of the course description.
* *
* @return string * @return string
*/ */
public function get_title() public function get_title()
@ -389,7 +389,7 @@ class CourseDescription
} }
/** /**
* *
* @return void * @return void
*/ */
public function set_title($title) public function set_title($title)
@ -407,7 +407,7 @@ class CourseDescription
} }
/** /**
* *
* @return void * @return void
*/ */
public function set_content($content) public function set_content($content)
@ -417,7 +417,7 @@ class CourseDescription
/** /**
* The session id the object is associated with. * The session id the object is associated with.
* *
* @return int * @return int
*/ */
public function get_session_id() public function get_session_id()
@ -426,7 +426,7 @@ class CourseDescription
} }
/** /**
* *
* @return void * @return void
*/ */
public function set_session_id($value) public function set_session_id($value)
@ -437,7 +437,7 @@ class CourseDescription
/** /**
* The type of the course description. Should match one of the id returns * The type of the course description. Should match one of the id returns
* by CourseDescription::get_types(). * by CourseDescription::get_types().
* *
* @return int * @return int
*/ */
public function get_description_type() public function get_description_type()
@ -446,7 +446,7 @@ class CourseDescription
} }
/** /**
* *
* @return void * @return void
*/ */
public function set_description_type($value) public function set_description_type($value)
@ -464,7 +464,7 @@ class CourseDescription
} }
/** /**
* *
* @return void * @return void
*/ */
public function set_progress($value) public function set_progress($value)
@ -474,8 +474,8 @@ class CourseDescription
/** /**
* Return one type from its id * Return one type from its id
* *
* @return \CourseDescription\CourseDescriptionType * @return \CourseDescription\CourseDescriptionType
*/ */
public function get_type() public function get_type()
{ {
@ -504,7 +504,7 @@ class CourseDescription
/** /**
* The item property this object is associated with. * The item property this object is associated with.
* *
* @return \Model\ItemProperty * @return \Model\ItemProperty
*/ */
public function get_item_property() public function get_item_property()
@ -521,12 +521,12 @@ class CourseDescription
// //
///** ///**
// * The common routes (urls) for course description objects: // * The common routes (urls) for course description objects:
// * // *
// * - create new course description // * - create new course description
// * - edit course description // * - edit course description
// * - delete course description // * - delete course description
// * // *
// * @author Laurent Opprecht <laurent@opprecht.info> for the University of Geneva // * @author Laurent Opprecht <laurent@opprecht.info> for the University of Geneva
// * @licence /license.txt // * @licence /license.txt
// */ // */
@ -535,7 +535,7 @@ class CourseDescription
// //
// /** // /**
// * // *
// * @return CourseDescriptionRoutes // * @return CourseDescriptionRoutes
// */ // */
// public static function instance() // public static function instance()
// { // {
@ -553,7 +553,7 @@ class CourseDescription
// //
// /** // /**
// * Returns the url used to create a new course description from a specific type. // * Returns the url used to create a new course description from a specific type.
// * // *
// * @param CourseDescriptionType $type // * @param CourseDescriptionType $type
// * @param bool $html True to html escape the url, false otherwise. // * @param bool $html True to html escape the url, false otherwise.
// * @return string // * @return string
@ -573,10 +573,10 @@ class CourseDescription
// //
// /** // /**
// * The url to edit a course description object // * The url to edit a course description object
// * // *
// * @param CourseDescription $description // * @param CourseDescription $description
// * @param bool $html True to html escape the url, false otherwise. // * @param bool $html True to html escape the url, false otherwise.
// * @return string // * @return string
// */ // */
// function edit($description, $html = true) // function edit($description, $html = true)
// { // {
@ -592,9 +592,9 @@ class CourseDescription
// //
// /** // /**
// * The index route to list all course descriptions for the current course/session // * The index route to list all course descriptions for the current course/session
// * // *
// * @param bool $html True to html escape the url, false otherwise. // * @param bool $html True to html escape the url, false otherwise.
// * @return type // * @return type
// */ // */
// function index($html = true) // function index($html = true)
// { // {
@ -605,10 +605,10 @@ class CourseDescription
// //
// /** // /**
// * Url to delete a course description object. // * Url to delete a course description object.
// * // *
// * @param CourseDescription $description // * @param CourseDescription $description
// * @param bool $html True to html escape the url, false otherwise. // * @param bool $html True to html escape the url, false otherwise.
// * @return string // * @return string
// */ // */
// function delete($description, $html = true) // function delete($description, $html = true)
// { // {

Loading…
Cancel
Save