diff --git a/main/admin/access_url_edit_course_category_to_url.php b/main/admin/access_url_edit_course_category_to_url.php index e6b805ee75..be698c3c75 100755 --- a/main/admin/access_url_edit_course_category_to_url.php +++ b/main/admin/access_url_edit_course_category_to_url.php @@ -1,16 +1,18 @@ -*/ + * @package chamilo.admin + * @author Julio Montoya + */ // resetting the course id $cidReset = true; require_once __DIR__.'/../inc/global.inc.php'; $xajax = new xajax(); -$xajax->registerFunction(array('searchCourseCategoryAjax', 'UrlManager', 'searchCourseCategoryAjax')); +$xajax->registerFunction( + array('searchCourseCategoryAjax', 'UrlManager', 'searchCourseCategoryAjax') +); // Setting the section (for the tabs) $this_section = SECTION_PLATFORM_ADMIN; @@ -221,10 +223,11 @@ foreach($userGroupList as $item) {
'.get_lang('Add').''; - else - echo ''; + if (isset($_GET['add'])) { + echo ''; + } else { + echo ''; + } ?> @@ -273,10 +276,8 @@ function valide(){ document.forms.formulaire.submit(); } -function loadUsersInSelect(select){ - +function loadUsersInSelect(select) { var xhr_object = null; - if(window.XMLHttpRequest) // Firefox xhr_object = new XMLHttpRequest(); else if(window.ActiveXObject) // Internet Explorer @@ -291,7 +292,6 @@ function loadUsersInSelect(select){ nosessionClasses = makepost(document.getElementById('origin_classes')); sessionClasses = makepost(document.getElementById('destination_classes')); xhr_object.send("nosessionusers="+nosessionUsers+"&sessionusers="+sessionUsers+"&nosessionclasses="+nosessionClasses+"&sessionclasses="+sessionClasses); - xhr_object.onreadystatechange = function() { if(xhr_object.readyState == 4) { document.getElementById('content_source').innerHTML = result = xhr_object.responseText; diff --git a/main/auth/courses_controller.php b/main/auth/courses_controller.php index 23594ffaa1..1ee7372cca 100755 --- a/main/auth/courses_controller.php +++ b/main/auth/courses_controller.php @@ -31,8 +31,8 @@ class CoursesController /** * It's used for listing courses, * render to courses_list view - * @param string action - * @param string confirmation message(optional) + * @param string $action + * @param string $message confirmation message(optional) * @param string $action */ public function courses_list($action, $message = '') @@ -57,11 +57,11 @@ class CoursesController /** * It's used for listing categories, * render to categories_list view - * @param string $action - * @param string $message confirmation message(optional) - * @param string $error error message(optional) + * @param string $action + * @param string $message confirmation message(optional) + * @param string $error error message(optional) */ - public function categories_list($action, $message='', $error='') + public function categories_list($action, $message = '', $error = '') { $data = array(); $data['user_course_categories'] = $this->model->get_user_course_categories(); @@ -139,16 +139,13 @@ class CoursesController $data['message'] = $message; $data['content'] = $content; $data['error'] = $error; - $data['catalogShowCoursesSessions'] = 0; - $showCoursesSessions = intval('catalog_show_courses_sessions'); if ($showCoursesSessions > 0) { $data['catalogShowCoursesSessions'] = $showCoursesSessions; } // render to the view - $this->view->set_data($data); $this->view->set_layout('layout'); $this->view->set_template('courses_categories'); @@ -173,7 +170,6 @@ class CoursesController ) { $data = array(); $limit = !empty($limit) ? $limit : CourseCategory::getLimitArray(); - $browse_course_categories = $this->model->browse_course_categories(); $data['countCoursesInCategory'] = $this->model->count_courses_in_category('ALL', $search_term); $data['browse_courses_in_category'] = $this->model->search_courses($search_term, $limit, $justVisible); @@ -422,9 +418,7 @@ class CoursesController $subCategory1Name = $subCategory1['name']; $subCategory1Code = $subCategory1['code']; $subCategory1Courses = $subCategory1['count_courses']; - $html .= '
  • '; - if ($code == $subCategory1Code) { $html .= "$subCategory1Name ($subCategory1Courses)"; } else { @@ -512,6 +506,8 @@ class CoursesController * @param boolean $checkRequirements Optional. * Whether the session has requirement. Default is false * @param bool $includeText Optional. Whether show the text in button + * @param bool $btnBing + * * @return string The button HTML */ public function getRegisteredInSessionButton( @@ -521,9 +517,9 @@ class CoursesController $includeText = false, $btnBing = false ) { - if($btnBing){ + if ($btnBing) { $btnBing = 'btn-lg'; - }else{ + } else { $btnBing = 'btn-sm'; } if ($checkRequirements) { @@ -551,7 +547,6 @@ class CoursesController } $catalogSessionAutoSubscriptionAllowed = false; - if (api_get_setting('catalog_allow_session_auto_subscription') === 'true') { $catalogSessionAutoSubscriptionAllowed = true; } @@ -631,7 +626,12 @@ class CoursesController */ public function getSessionIcon($sessionName) { - return Display::return_icon('window_list.png', $sessionName, null,ICON_SIZE_MEDIUM); + return Display::return_icon( + 'window_list.png', + $sessionName, + null, + ICON_SIZE_MEDIUM + ); } /** @@ -645,7 +645,6 @@ class CoursesController $date = isset($_POST['date']) ? $_POST['date'] : date('Y-m-d'); $hiddenLinks = isset($_GET['hidden_links']) ? intval($_GET['hidden_links']) == 1 : false; $limit = isset($limit) ? $limit : CourseCategory::getLimitArray(); - $countSessions = $this->model->countSessions($date); $sessions = $this->model->browseSessions($date, $limit); diff --git a/main/auth/profile.php b/main/auth/profile.php index 8c29cd5b07..f0c7b08f26 100755 --- a/main/auth/profile.php +++ b/main/auth/profile.php @@ -369,7 +369,8 @@ $form->setDefaults($user_data); * * @return boolean if auth_source is platform */ -function is_platform_authentication() { +function is_platform_authentication() +{ $tab_user_info = api_get_user_info(); return $tab_user_info['auth_source'] == PLATFORM_AUTH_SOURCE; } @@ -422,7 +423,8 @@ function upload_user_production($user_id) * @return bool true o false * @uses Gets user ID from global variable */ -function check_user_email($email) { +function check_user_email($email) +{ $user_id = api_get_user_id(); if ($user_id != strval(intval($user_id)) || empty($email)) { return false; diff --git a/main/dropbox/dropbox_functions.inc.php b/main/dropbox/dropbox_functions.inc.php index 5e9e77f17e..44c3051780 100755 --- a/main/dropbox/dropbox_functions.inc.php +++ b/main/dropbox/dropbox_functions.inc.php @@ -504,7 +504,12 @@ function display_add_form($dropbox_unid, $viewReceivedCategory, $viewSentCategor $form->addElement('hidden', 'dropbox_unid', $dropbox_unid); $form->addElement('hidden', 'sec_token', $token); $form->addElement('hidden', 'origin', $origin); - $form->addElement('file', 'file', get_lang('UploadFile'), array('onChange' => 'javascript: checkfile(this.value);')); + $form->addElement( + 'file', + 'file', + get_lang('UploadFile'), + array('onChange' => 'javascript: checkfile(this.value);') + ); $allowOverwrite = api_get_setting('dropbox_allow_overwrite'); if ($allowOverwrite == 'true') { diff --git a/main/gradebook/lib/be/abstractlink.class.php b/main/gradebook/lib/be/abstractlink.class.php index e2235c1512..87d36f2994 100755 --- a/main/gradebook/lib/be/abstractlink.class.php +++ b/main/gradebook/lib/be/abstractlink.class.php @@ -246,16 +246,22 @@ abstract class AbstractLink implements GradebookItem $paramcount ++; } if (isset($type)) { - if ($paramcount != 0) $sql .= ' AND'; - else $sql .= ' WHERE'; + if ($paramcount != 0) { + $sql .= ' AND'; + } else { + $sql .= ' WHERE'; + } $sql .= ' type = '.intval($type); - $paramcount ++; + $paramcount++; } if (isset($ref_id)) { - if ($paramcount != 0) $sql .= ' AND'; - else $sql .= ' WHERE'; + if ($paramcount != 0) { + $sql .= ' AND'; + } else { + $sql .= ' WHERE'; + } $sql .= ' ref_id = '.intval($ref_id); - $paramcount ++; + $paramcount++; } if (isset($user_id)) { if ($paramcount != 0) { @@ -464,7 +470,7 @@ abstract class AbstractLink implements GradebookItem $targets = array(); $level = 0; - $crscats = Category::load(null,null,$this->get_course_code(),0); + $crscats = Category::load(null, null, $this->get_course_code(), 0); foreach ($crscats as $cat) { $targets[] = array($cat->get_id(), $cat->get_name(), $level+1); $targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id()); @@ -479,7 +485,7 @@ abstract class AbstractLink implements GradebookItem */ private function add_target_subcategories($targets, $level, $catid) { - $subcats = Category::load(null,null,null,$catid); + $subcats = Category::load(null, null, null, $catid); foreach ($subcats as $cat) { $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1); $targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id()); diff --git a/main/gradebook/lib/be/result.class.php b/main/gradebook/lib/be/result.class.php index 17f2264cb3..1ce76d3fb8 100755 --- a/main/gradebook/lib/be/result.class.php +++ b/main/gradebook/lib/be/result.class.php @@ -158,12 +158,13 @@ class Result $paramcount ++; } if (!empty($user_id)) { - if ($paramcount != 0) + if ($paramcount != 0) { $sql .= ' AND'; - else + } else { $sql .= ' WHERE'; - $sql .= ' gr.user_id = ' . intval($user_id); - $paramcount ++; + } + $sql .= ' gr.user_id = '.intval($user_id); + $paramcount++; } if (!empty($evaluation_id)) { if ($paramcount != 0) { diff --git a/main/inc/ajax/course_home.ajax.php b/main/inc/ajax/course_home.ajax.php index 410f8e3984..d8215a7dfb 100755 --- a/main/inc/ajax/course_home.ajax.php +++ b/main/inc/ajax/course_home.ajax.php @@ -20,7 +20,14 @@ switch ($action) { $tool_image = $tool_info['image']; if (api_get_setting('homepage_view') != 'activity_big') { - $tool_image = Display::return_icon($tool_image, null, null, null, null, true); + $tool_image = Display::return_icon( + $tool_image, + null, + null, + null, + null, + true + ); $na_image = str_replace('.gif', '_na.gif', $tool_image); } else { // Display::return_icon() also checks in the app/Resources/public/css/themes/{theme}/icons folder @@ -46,7 +53,6 @@ switch ($action) { $requested_message = ($tool_visibility == 0 ) ? 'is_active' : 'is_inactive'; $requested_view = ($tool_visibility == 0 ) ? 'visible.png' : 'invisible.png'; $requested_visible = ($tool_visibility == 0 ) ? 1 : 0; - $requested_view = ($tool_visibility == 0 ) ? 'visible.png' : 'invisible.png'; $requested_visible = ($tool_visibility == 0 ) ? 1 : 0; @@ -122,8 +128,9 @@ switch ($action) { $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id()); $my_session_list = array(); foreach ($new_session_list as $item) { - if (!empty($item['id_session'])) + if (!empty($item['id_session'])) { $my_session_list[] = $item['id_session']; + } } if (!in_array($session_id, $my_session_list)) { break; @@ -207,7 +214,7 @@ switch ($action) { $i =0; $response = new stdClass(); - foreach ($temp as $key=>$row) { + foreach ($temp as $key => $row) { $row = $row['cell']; if (!empty($row)) { if ($key >= $start && $key < ($start + $limit)) { @@ -217,13 +224,11 @@ switch ($action) { } } } - + $total_pages = 0; if ($count > 0 && $limit > 0) { $total_pages = ceil($count/$limit); - } else { - $total_pages = 0; } - $response->total = $total_pages; + $response->total = $total_pages; if ($page > $total_pages) { $response->page= $total_pages; } else { @@ -235,19 +240,17 @@ switch ($action) { case 'session_courses_lp_by_week': require_once __DIR__.'/../global.inc.php'; $now = time(); - - $page = intval($_REQUEST['page']); //page + $page = intval($_REQUEST['page']); //page $limit = intval($_REQUEST['rows']); // quantity of rows - $sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'course'; + $sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'course'; $sidx = str_replace(array('week desc,', ' '), '', $sidx); - - $sord = $_REQUEST['sord']; //asc or desc + $sord = $_REQUEST['sord']; //asc or desc if (!in_array($sord, array('asc','desc'))) { $sord = 'desc'; } - $session_id = intval($_REQUEST['session_id']); - $course_id = intval($_REQUEST['course_id']); + $session_id = intval($_REQUEST['session_id']); + $course_id = intval($_REQUEST['course_id']); //Filter users that does not belong to the session if (!api_is_platform_admin()) { @@ -263,7 +266,7 @@ switch ($action) { } } - $start = $limit*$page - $limit; + $start = $limit * $page - $limit; $course_list = SessionManager::get_course_list_by_session_id($session_id); $count = 0; @@ -354,7 +357,7 @@ switch ($action) { $response = new stdClass(); $i =0; - foreach($temp as $key=>$row) { + foreach ($temp as $key => $row) { $row = $row['cell']; if (!empty($row)) { if ($key >= $start && $key < ($start + $limit)) { @@ -364,11 +367,9 @@ switch ($action) { } } } - + $total_pages = 0; if ($count > 0 && $limit > 0) { $total_pages = ceil($count/$limit); - } else { - $total_pages = 0; } $response->total = $total_pages; if ($page > $total_pages) { @@ -397,10 +398,11 @@ switch ($action) { //Filter users that does not belong to the session if (!api_is_platform_admin()) { $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id()); - $my_session_list = array(); - foreach($new_session_list as $item) { - if (!empty($item['id_session'])) + $my_session_list = array(); + foreach ($new_session_list as $item) { + if (!empty($item['id_session'])) { $my_session_list[] = $item['id_session']; + } } if (!in_array($session_id, $my_session_list)) { break; @@ -418,7 +420,11 @@ switch ($action) { } } - $list = new LearnpathList(api_get_user_id(),$item['code'],$session_id); + $list = new LearnpathList( + api_get_user_id(), + $item['code'], + $session_id + ); $flat_list = $list->get_flat_list(); $lps[$item['code']] = $flat_list; $item['title'] = Display::url( @@ -478,7 +484,6 @@ switch ($action) { } $temp = msort($temp, $sidx, $sord); - $response = new stdClass(); $i =0; foreach ($temp as $key => $row) { @@ -491,17 +496,14 @@ switch ($action) { } } } - + $total_pages = 0; if ($count > 0 && $limit > 0) { $total_pages = ceil($count / $limit); - } else { - $total_pages = 0; } $response->total = $total_pages; + $response->page = $page; if ($page > $total_pages) { $response->page = $total_pages; - } else { - $response->page = $page; } $response->records = $count; diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 20e1d4b076..74ea3d1906 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -677,10 +677,11 @@ class Display $result = ''; for ($i = $min; $i <= $max; $i ++) { $result .= '