Adding documentation, changinh lang vars

skala
Julio Montoya 14 years ago
parent d39be1097e
commit a23a10f8b2
  1. 15
      main/admin/careers.php
  2. 8
      main/admin/promotions.php
  3. 2
      main/admin/user_add.php
  4. 2
      main/admin/user_edit.php
  5. 4
      main/admin/user_list.php
  6. 8
      main/inc/lib/career.lib.php
  7. 14
      main/inc/lib/display.lib.php
  8. 13
      main/inc/lib/main_api.lib.php
  9. 14
      main/inc/lib/promotion.lib.php
  10. 20
      main/inc/lib/sessionmanager.lib.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();

@ -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();

@ -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';

@ -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'));

@ -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', '</td></tr>');
@ -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"');

@ -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);
}
}
}

@ -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() { <?php echo Display::grid_js('grid' ...); ?> }
* 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'];
}

@ -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 = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/'.$theme.'/jquery-ui-1.8.7.custom.css" type="text/css">';
}
//Jquery ui
$js .= '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-1.4.4.min.js" type="text/javascript" language="javascript"></script>'; //jQuery
$js .= '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-1.4.4.min.js" type="text/javascript" language="javascript"></script>'; //jQuery
}
//Jquery ui
$js .= '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/'.$theme.'/jquery-ui-1.8.7.custom.css" type="text/css">';
$js .= '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/'.$theme.'/jquery-ui-1.8.7.custom.min.js" type="text/javascript" language="javascript"></script>';
//Grid js
@ -4783,5 +4783,8 @@ function api_get_jqgrid_js($include_jquery = true) {
$js .= '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jqgrid/js/i18n/grid.locale-'.$languaje.'.js" type="text/javascript" language="javascript"></script>';
$js .= '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript" language="javascript"></script>';
//Adding default CSS changes for Chamilo in order to preserve the neutral layout
$js .= '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/default.css" type="text/css">';
return $js;
}

@ -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);
}
}
}
/**

@ -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));
}
}

Loading…
Cancel
Save