diff --git a/main/admin/careers.php b/main/admin/careers.php
index fe23596296..3837a94646 100644
--- a/main/admin/careers.php
+++ b/main/admin/careers.php
@@ -119,14 +119,15 @@ if (isset($_GET['action']) && $_GET['action'] == 'add') {
$check = Security::check_token('post');
if ($check) {
$values = $form->exportValues();
- $career->update_all_promotion_status_by_career_id($values['id'],$values['status']);
-
- $res = $career->update($values);
-
-
-
+ $career->update_all_promotion_status_by_career_id($values['id'],$values['status']);
+ $res = $career->update($values);
if ($res) {
- Display::display_confirmation_message(get_lang('Updated'));
+
+ }
+ if ($values['status']) {
+ Display::display_confirmation_message(sprintf(get_lang('CareerXArchived'), $values['name']), false);
+ } else {
+ Display::display_confirmation_message(sprintf(get_lang('CareerXUnarchived'), $values['name']), false);
}
}
Security::clear_token();
diff --git a/main/admin/promotions.php b/main/admin/promotions.php
index a2365c4856..865c89074c 100644
--- a/main/admin/promotions.php
+++ b/main/admin/promotions.php
@@ -101,7 +101,6 @@ if (isset($_GET['action']) && $_GET['action'] == 'add') {
}
} elseif (isset($_GET['action']) && $_GET['action'] == 'edit' && is_numeric($_GET['id'])) {
//Editing
- // Initialize the object
$url = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']);
$form = $promotion->return_form($url, get_lang('Modify'));
@@ -111,8 +110,11 @@ if (isset($_GET['action']) && $_GET['action'] == 'add') {
if ($check) {
$values = $form->exportValues();
$res = $promotion->update($values);
- if ($res) {
- Display::display_confirmation_message(get_lang('Updated'));
+ $promotion->update_all_sessions_status_by_promotion_id($values['id'], $values['status']);
+ if ($values['status']) {
+ Display::display_confirmation_message(sprintf(get_lang('PromotionXUnarchived'), $values['name']), false);
+ } else {
+ Display::display_confirmation_message(sprintf(get_lang('PromotionXArchived'), $values['name']), false);
}
}
Security::clear_token();
diff --git a/main/admin/user_add.php b/main/admin/user_add.php
index 4a3d616ce0..8cd04ff189 100755
--- a/main/admin/user_add.php
+++ b/main/admin/user_add.php
@@ -147,7 +147,7 @@ $status[STUDENT] = get_lang('Learner');
$status[DRH] = get_lang('Drh');
$status[SESSIONADMIN] = get_lang('SessionsAdmin');
-$form->addElement('select', 'status', get_lang('Status'), $status, array('id' => 'status_select', 'onchange' => 'javascript: display_drh_list();'));
+$form->addElement('select', 'status', get_lang('Profile'), $status, array('id' => 'status_select', 'onchange' => 'javascript: display_drh_list();'));
$form->addElement('select_language', 'language', get_lang('Language'));
//drh list (display only if student)
$display = ($_POST['status'] == STUDENT || !isset($_POST['status'])) ? 'block' : 'none';
diff --git a/main/admin/user_edit.php b/main/admin/user_edit.php
index 941a97f60c..1ed1d3b708 100755
--- a/main/admin/user_edit.php
+++ b/main/admin/user_edit.php
@@ -177,7 +177,7 @@ $status[STUDENT] = get_lang('Learner');
$status[DRH] = get_lang('Drh');
$status[SESSIONADMIN] = get_lang('SessionsAdmin');
-$form->addElement('select', 'status', get_lang('Status'), $status, array('id' => 'status_select', 'onchange' => 'javascript: display_drh_list();'));
+$form->addElement('select', 'status', get_lang('Profile'), $status, array('id' => 'status_select', 'onchange' => 'javascript: display_drh_list();'));
//Language
$form->addElement('select_language', 'language', get_lang('Language'));
diff --git a/main/admin/user_list.php b/main/admin/user_list.php
index 14b66ee3da..79befbc174 100755
--- a/main/admin/user_list.php
+++ b/main/admin/user_list.php
@@ -920,7 +920,7 @@ if ($_GET['action'] == "login_as" && isset ($login_as_user_id))
$status_options[COURSEMANAGER] = get_lang('Teacher');
$status_options[DRH] = get_lang('Drh');
$status_options[SESSIONADMIN] = get_lang('Administrator');
- $form->addElement('select','keyword_status',get_lang('Status'),$status_options, array('style'=>'margin-left:17px'));
+ $form->addElement('select','keyword_status',get_lang('Profile'),$status_options, array('style'=>'margin-left:17px'));
$form->addElement('html', '');
@@ -980,7 +980,7 @@ if ($_GET['action'] == "login_as" && isset ($login_as_user_id))
}
$table->set_header(5, get_lang('LoginName'));
$table->set_header(6, get_lang('Email'));
- $table->set_header(7, get_lang('Status'));
+ $table->set_header(7, get_lang('Profile'));
$table->set_header(8, get_lang('Active'),true, 'width="15px"');
$table->set_header(9, get_lang('Action'), false,'width="220px"');
diff --git a/main/inc/lib/career.lib.php b/main/inc/lib/career.lib.php
index 3ca984dc28..2c1518b649 100644
--- a/main/inc/lib/career.lib.php
+++ b/main/inc/lib/career.lib.php
@@ -28,6 +28,11 @@ class Career extends Model {
return Database::select('*',$this->table, array('order' =>'name ASC'));
}
+ /**
+ * Update all promotion status by career
+ * @param int career id
+ * @param int status (1 or 0)
+ */
public function update_all_promotion_status_by_career_id($career_id, $status) {
$promotion = new Promotion();
$promotion_list = $promotion->get_all_promotions_by_career_id($career_id);
@@ -35,7 +40,8 @@ class Career extends Model {
foreach($promotion_list as $item) {
$params['id'] = $item['id'];
$params['status'] = $status;
- $promotion->update($params);
+ $promotion->update($params);
+ $promotion->update_all_sessions_status_by_promotion_id($params['id'], $status);
}
}
}
diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php
index cd44599d95..cb5f81a2fc 100755
--- a/main/inc/lib/display.lib.php
+++ b/main/inc/lib/display.lib.php
@@ -822,11 +822,12 @@ class Display {
}
/**
- * This is just a wrapper to use the jqgrid For the other options go here http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options
+ * This is a wrapper to use the jqgrid in Chamilo. For the other jqgrid options visit http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options
* This function need to be in the ready jquery function example --> $(function() { }
* In order to work this function needs the Display::grid_html function with the same div id
+ *
* @param string div id
- * @param string url where the jqgrid will ask for data
+ * @param string url where the jqgrid will ask for data (if datatype = json)
* @param array Visible columns (you should use get_lang). An array in which we place the names of the columns. This is the text that appears in the head of the grid (Header layer). Example: colname {name:'date', index:'date', width:120, align:'right'},
* @param array the column model : Array which describes the parameters of the columns.This is the most important part of the grid. For a full description of all valid values see colModel API. See the url above.
* @param array extra parameters
@@ -838,7 +839,8 @@ class Display {
$obj = new stdClass();
if (!empty($url))
- $obj->url = $url;
+ $obj->url = $url;
+
$obj->colNames = $column_names;
$obj->colModel = $column_model;
$obj->pager = $div_id.'_pager';
@@ -848,6 +850,12 @@ class Display {
$obj->datatype = $extra_params['datatype'];
}
+ //Row even odd style
+ $obj->altRows = true;
+ if (!empty($extra_params['altRows'])) {
+ $obj->altRows = $extra_params['altRows'];
+ }
+
if (!empty($extra_params['sortname'])) {
$obj->sortname = $extra_params['sortname'];
}
diff --git a/main/inc/lib/main_api.lib.php b/main/inc/lib/main_api.lib.php
index 9f26a6671d..46b17df8f1 100755
--- a/main/inc/lib/main_api.lib.php
+++ b/main/inc/lib/main_api.lib.php
@@ -4753,7 +4753,7 @@ function api_check_browscap(){
}
/**
- * Returns the jgrid js headers
+ * Returns the jqgrid js headers
* @param bool add the jquery library
* @return string html tags
*
@@ -4772,10 +4772,10 @@ function api_get_jqgrid_js($include_jquery = true) {
}
if ($include_jquery) {
//Jquery
- $js = '';
- }
- //Jquery ui
- $js .= ''; //jQuery
+ $js .= ''; //jQuery
+ }
+ //Jquery ui
+ $js .= '';
$js .= '';
//Grid js
@@ -4783,5 +4783,8 @@ function api_get_jqgrid_js($include_jquery = true) {
$js .= '';
$js .= '';
+ //Adding default CSS changes for Chamilo in order to preserve the neutral layout
+ $js .= '';
+
return $js;
}
diff --git a/main/inc/lib/promotion.lib.php b/main/inc/lib/promotion.lib.php
index e129d3621a..dd344cf3d2 100644
--- a/main/inc/lib/promotion.lib.php
+++ b/main/inc/lib/promotion.lib.php
@@ -48,6 +48,20 @@ class Promotion extends Model {
echo Display::grid_html('promotions');
}
+ /**
+ * Update all session status by promotion
+ * @param int promotion id
+ * @param int status (1, 0)
+ */
+ public function update_all_sessions_status_by_promotion_id($promotion_id, $status) {
+ require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php';
+ $session_list = SessionManager::get_all_sessions_by_promotion($promotion_id);
+ if (!empty($session_list)) {
+ foreach($session_list as $item) {
+ SessionManager::set_session_status($item['id'], $status);
+ }
+ }
+ }
/**
diff --git a/main/inc/lib/sessionmanager.lib.php b/main/inc/lib/sessionmanager.lib.php
index 5577325828..b814d30a9d 100755
--- a/main/inc/lib/sessionmanager.lib.php
+++ b/main/inc/lib/sessionmanager.lib.php
@@ -1255,12 +1255,11 @@ class SessionManager {
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$order_clause ='';
$sql = 'SELECT '.$tbl_user.'.user_id, lastname, firstname, username
- FROM '.$tbl_user.'
- INNER JOIN '.$tbl_session_rel_user.'
- ON '.$tbl_user.'.user_id = '.$tbl_session_rel_user.'.id_user
- AND '.$tbl_session_rel_user.'.id_session = '.$id.$order_clause;
+ FROM '.$tbl_user.'
+ INNER JOIN '.$tbl_session_rel_user.'
+ ON '.$tbl_user.'.user_id = '.$tbl_session_rel_user.'.id_user
+ AND '.$tbl_session_rel_user.'.id_session = '.$id.$order_clause;
$result=Database::query($sql);
- //$users=Database::store_result($result);
while ($row = Database::fetch_array($result,'ASSOC')) {
$return_array[] = $row;
}
@@ -1296,6 +1295,17 @@ class SessionManager {
}
}
+ /**
+ * Updates a session status
+ * @param int session id
+ * @param int status
+ */
+ function set_session_status($session_id, $status) {
+ $t = Database::get_main_table(TABLE_MAIN_SESSION);
+ $params['visibility'] = $status;
+ Database::update($t, $params, array('id = ?'=>$session_id));
+ }
+
}