PHP warning/notices avoided

skala
Julio Montoya 13 years ago
parent 2115f0dfcc
commit 96f894c62b
  1. 149
      main/admin/configure_homepage.php
  2. 7
      main/admin/configure_inscription.php
  3. 2
      main/admin/group_add.php
  4. 4
      main/admin/group_edit.php
  5. 558
      main/admin/group_list.php
  6. 393
      main/admin/session_category_list.php
  7. 31
      main/admin/user_add.php
  8. 1
      main/calendar/agenda_js.php
  9. 2
      main/social/group_edit.php

@ -16,7 +16,7 @@ require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
global $_configuration;
$action = Security::remove_XSS($_GET['action']);
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
$tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY);
$tool_name = get_lang('ConfigureHomePage');
@ -78,7 +78,7 @@ if (!empty($_SESSION['user_language_choice'])) {
// Ensuring availability of main files in the corresponding language
if ($_configuration['multiple_access_urls']) {
if (api_is_multiple_url_enabled()) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$url_info = api_get_access_url($access_url_id);
@ -111,7 +111,7 @@ $homef = array($menuf, $newsf, $topf, $noticef, $menutabs);
// If language-specific file does not exist, create it by copying default file
foreach ($homef as $my_file) {
if ($_configuration['multiple_access_urls']) {
if (api_is_multiple_url_enabled()) {
if (!file_exists($homep_new.$my_file.'_'.$lang.$ext)) {
copy($homep.$my_file.$ext, $homep_new.$my_file.'_'.$lang.$ext);
}
@ -121,7 +121,7 @@ foreach ($homef as $my_file) {
}
}
}
if ($_configuration['multiple_access_urls']) {
if (api_is_multiple_url_enabled()) {
$homep = $homep_new;
}
@ -173,10 +173,10 @@ if (!empty($action)) {
fputs($fp, $home_top);
fclose($fp);
}
if (EventsMail::check_if_using_class('portal_homepage_edited')) {
if (EventsMail::check_if_using_class('portal_homepage_edited')) {
EventsDispatcher::events('portal_homepage_edited',array('about_user' => api_get_user_id()));
}
}
event_system(LOG_HOMEPAGE_CHANGED, 'edit_top', cut(strip_tags($home_top), 254), api_get_utc_datetime(), api_get_user_id());
break;
case 'edit_notice':
@ -255,7 +255,7 @@ if (!empty($action)) {
event_system(LOG_HOMEPAGE_CHANGED, 'edit_news', strip_tags(cut($home_news, 254)), api_get_utc_datetime(), api_get_user_id());
break;
case 'insert_tabs':
case 'edit_tabs':
case 'edit_tabs':
case 'insert_link':
case 'edit_link':
$link_index = intval($_POST['link_index']);
@ -263,14 +263,14 @@ if (!empty($action)) {
$link_name = trim(stripslashes($_POST['link_name']));
$link_url = trim(stripslashes($_POST['link_url']));
$add_in_tab = intval($_POST['add_in_tab']);
// WCAG
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
$link_html = WCAG_Rendering::prepareXHTML();
} else {
$link_html = trim(stripslashes($_POST['link_html']));
}
}
$filename = trim(stripslashes($_POST['filename']));
$target_blank = $_POST['target_blank'] ? true : false;
@ -321,8 +321,8 @@ if (!empty($action)) {
$link_url = api_get_path(WEB_PATH).'index.php?include='.urlencode($filename);
// If the file doesn't exist, then create it and
// fill it with default text
$fp = @fopen($homep.$filename, 'w');
$fp = @fopen($homep.$filename, 'w');
if ($fp) {
if (empty($link_html)) {
fputs($fp, get_lang('MyTextHere'));
@ -330,23 +330,23 @@ if (!empty($action)) {
fputs($fp, $link_html);
}
fclose($fp);
}
}
}
// If the requested action is to edit a link, open the file and
// write to it (if the file doesn't exist, create it)
if (in_array($action, array('edit_link')) && !empty($link_html)) {
if (in_array($action, array('edit_link')) && !empty($link_html)) {
$fp = @fopen($homep.$filename, 'w');
if ($fp) {
fputs($fp, $link_html);
fclose($fp);
}
}
}
$class_add_in_tab = 'class="show_menu"';
if (!$add_in_tab) {
$class_add_in_tab = 'class="hide_menu"';
}
}
// If the requested action is to create a link, make some room
// for the new link in the home_menu array at the requested place
// and insert the new link there
@ -358,8 +358,8 @@ if (!empty($action)) {
break;
}
}
$home_menu[$insert_where + 1] = '<li '.$class_add_in_tab.'><a href="'.$link_url.'" target="'.($target_blank ? '_blank' : '_self').'"><span>'.$link_name.'</span></a></li>';
} else {
// If the request is about a link edition, change the link
@ -367,10 +367,10 @@ if (!empty($action)) {
}
// Re-build the file from the home_menu array
$home_menu = implode("\n", $home_menu);
// Write
// Write
if (file_exists($homep.$menuf.'_'.$lang.$ext)) {
if (is_writable($homep.$menuf.'_'.$lang.$ext)) {
$fp = fopen($homep.$menuf.'_'.$lang.$ext, 'w');
$fp = fopen($homep.$menuf.'_'.$lang.$ext, 'w');
fputs($fp, $home_menu);
fclose($fp);
if (file_exists($homep.$menuf.$ext)) {
@ -424,7 +424,7 @@ if (!empty($action)) {
}
$home_menu = implode("\n", $home_menu);
$home_menu = api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
$fp = fopen($homep.$menuf.'_'.$lang.$ext, 'w');
fputs($fp, $home_menu);
fclose($fp);
@ -563,7 +563,7 @@ if (!empty($action)) {
// For each line of the home_menu file
foreach ($home_menu as $key => $enreg) {
// Check if the current item is the one we want to update
if ($key == $link_index) {
// This is the link we want to update
@ -571,13 +571,13 @@ if (!empty($action)) {
if (strstr($enreg, 'target="_blank"')) {
$target_blank = true;
}
if (strstr($enreg, 'hide_menu')) {
$add_in_tab = false;
} else {
$add_in_tab = true;
}
// Remove dangerous HTML tags from the link itself (this is an
// additional measure in case a link previously contained
// unsecure tags)
@ -635,7 +635,7 @@ switch ($action) {
<input type="hidden" name="formSent" value="1"/>
<?php
if (!empty($errorMsg)) {
Display::display_normal_message($errorMsg);
Display::display_normal_message($errorMsg);
}
?>
<table border="0" cellpadding="5" cellspacing="0">
@ -667,53 +667,53 @@ switch ($action) {
$default = array();
$form = new FormValidator('configure_homepage_'.$action, 'post', api_get_self().'?action='.$action, '', array('style' => 'margin: 0px;'));
$renderer =& $form->defaultRenderer();
$form->addElement('header', '', $tool_name);
$form->addElement('hidden', 'formSent', '1');
$form->addElement('hidden', 'link_index', ($action == 'edit_link' || $action == 'edit_tabs') ? $link_index : '0');
$form->addElement('hidden', 'filename', ($action == 'edit_link' || $action == 'edit_tabs') ? $filename : '');
$form->addElement('text', 'link_name', get_lang('LinkName'), array('size' => '30', 'maxlength' => '50'));
$default['link_name'] = $link_name;
$default['link_url'] = empty($link_url) ? 'http://' : api_htmlentities($link_url, ENT_QUOTES);
$form->addElement('text', 'link_url', array(get_lang('LinkURL'), get_lang('Optional')), array('size' => '30', 'maxlength' => '100', 'style' => 'width: 350px;'));
$options = array('-1' => get_lang('FirstPlace'));
$selected = '';
if ($action == 'insert_link' || $action == 'insert_tabs') {
$add_in_tab = 1;
if (is_array($home_menu)){
foreach ($home_menu as $key => $enreg) {
if (strlen($enreg = trim(strip_tags($enreg))) > 0) {
$options[$key] = get_lang('After').' &quot;'.$enreg.'&quot;';
$selected = $formSent && $insert_where == $key ? $key : '';
$selected = $formSent && $insert_where == $key ? $key : '';
}
}
}
}
$default['insert_link'] = $selected;
$form->addElement('select', 'insert_where', get_lang('InsertThisLink') , $options);
}
}
$target_blank_checkbox = $form->addElement('checkbox', 'target_blank', null, get_lang('OpenInNewWindow'), 1);
if ($action == 'insert_tabs' || $action == 'edit_tabs') {
$form->addElement('checkbox', 'add_in_tab', null, get_lang('AddInMenu'), 1);
$form->addElement('checkbox', 'add_in_tab', null, get_lang('AddInMenu'), 1);
$default['add_in_tab'] = $add_in_tab;
}
}
if ($target_blank) $target_blank_checkbox->setChecked(true);
if ($action == 'edit_link' && (empty($link_url) || $link_url == 'http://' || $link_url == 'https://')) {
if ($action == 'edit_link' && (empty($link_url) || $link_url == 'http://' || $link_url == 'https://')) {
if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
$form->addElement('html', WCAG_Rendering::create_xhtml(isset($_POST['link_html'])?$_POST['link_html']:$link_html));
} else {
$default['link_html'] = isset($_POST['link_html']) ? $_POST['link_html'] : $link_html;
$form->add_html_editor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
}
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
}
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
} else {
if (in_array($action, array('edit_tabs','insert_tabs'))) {
if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
@ -723,8 +723,8 @@ switch ($action) {
$default['link_html'] = isset($_POST['link_html']) ? $_POST['link_html'] : $link_html;
$form->add_html_editor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
}
}
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
}
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
}
$form->setDefaults($default);
@ -815,9 +815,10 @@ switch ($action) {
</tr>
<tr>
<?php
$access_url_id = 1;
// we only show the category options for the main chamilo installation
if ($_configuration['multiple_access_urls']) {
if (api_is_multiple_url_enabled()) {
$access_url_id = api_get_current_access_url_id();
}
echo '<td width="50%">';
@ -864,10 +865,10 @@ switch ($action) {
</td>-->
</tr>
</table>
<?php
<?php
// Add new page
$home_menu = '';
if (file_exists($homep.$menutabs.'_'.$lang.$ext)) {
$home_menu = @file($homep.$menutabs.'_'.$lang.$ext);
@ -883,35 +884,35 @@ switch ($action) {
$home_menu = explode("\n", $home_menu);
}
$link_list = '';
$tab_counter = 0;
$tab_counter = 0;
foreach ($home_menu as $enreg) {
$enreg = trim($enreg);
if (!empty($enreg)) {
$edit_link = ' <a href="'.api_get_self().'?action=edit_tabs&amp;link_index='.$tab_counter.'" ><span>'.Display::return_icon('edit.gif', get_lang('Edit')).'</span></a>';
$delete_link = ' <a href="'.api_get_self().'?action=delete_tabs&amp;link_index='.$tab_counter.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;"><span>'.Display::return_icon('delete.gif', get_lang('Delete')).'</span></a>';
$tab_string = str_replace(array('href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'),
array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename(api_get_self()).'?action=open_link&link=', $edit_link.$delete_link.'</li>'),
$tab_string = str_replace(array('href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'),
array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename(api_get_self()).'?action=open_link&link=', $edit_link.$delete_link.'</li>'),
$enreg);
$tab_string = str_replace(array('<li>', '</li>','class="hide_menu"', 'hide_menu'), '', $tab_string);
$tab_string = str_replace(array('<li>', '</li>','class="hide_menu"', 'hide_menu'), '', $tab_string);
$link_list .= Display::tag('tr', Display::tag('td', $tab_string));
$tab_counter++;
}
}
}
?>
<div class="actions">
<a href="<?php echo api_get_self(); ?>?action=insert_tabs"><?php Display::display_icon('addd.gif', get_lang('InsertLink')); echo get_lang('InsertLink'); ?></a>
</div>
<?php
echo '<table class="data_table">';
echo $link_list;
echo '</table>';
<?php
echo '<table class="data_table">';
echo $link_list;
echo '</table>';
?>
</td>
<td width="10%" valign="top"></td>
<td width="20%" rowspan="3" valign="top">
<div id="login_block" class="well sidebar-nav">
<div id="login_block" class="well sidebar-nav">
<?php echo api_display_language_form(); ?>
<form id="formLogin">
<div><label><?php echo get_lang('LoginName'); ?></label></div>
@ -920,8 +921,8 @@ switch ($action) {
<div><input type="password" id="password" size="15" value="" disabled="disabled" /></div>
<div><button class="btn" type="button" name="submitAuth" value="<?php echo get_lang('Ok'); ?>" disabled="disabled"><?php echo get_lang('Ok'); ?></button></div>
</form>
</div>
</div>
<div id="profile_block" class="well sidebar-nav">
<h4><?php echo get_lang('MenuUser'); ?></h4>
<ul class="nav nav-list">
@ -929,12 +930,12 @@ switch ($action) {
<li><span style="color: #9D9DA1; font-weight: bold;"><?php echo api_ucfirst(get_lang('LostPassword')); ?></span></li>
</ul>
</div>
<div id="notice_block" class="well sidebar-nav">
<h4><?php echo get_lang('Notice'); ?>
<a href="<?php echo api_get_self(); ?>?action=edit_notice"><?php Display::display_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL); ?></a>
<h4><?php echo get_lang('Notice'); ?>
<a href="<?php echo api_get_self(); ?>?action=edit_notice"><?php Display::display_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL); ?></a>
</h4>
<?php
<?php
$home_notice = '';
if (file_exists($homep.$noticef.'_'.$lang.$ext)) {
$home_notice = @(string)file_get_contents($homep.$noticef.'_'.$lang.$ext);
@ -943,16 +944,16 @@ switch ($action) {
}
$home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice)));
echo '<div class="homepage_notice">';
echo $home_notice;
echo $home_notice;
echo '</div>';
?>
</div>
<div class="well sidebar-nav">
<a href="<?php echo api_get_self(); ?>?action=insert_link"><?php Display::display_icon('addd.gif', get_lang('InsertLink')); ?></a>
<a href="<?php echo api_get_self(); ?>?action=insert_link"><?php echo get_lang('InsertLink'); ?></a>
<h4><?php echo api_ucfirst(get_lang('General')); ?></h4>
<ul class="menulist">
<?php
@ -983,7 +984,7 @@ switch ($action) {
?>
</ul>
</div>
</td>
</tr>
</table>

@ -45,7 +45,8 @@ if (get_setting('allow_terms_conditions') == 'true') {
}
}
$action = Security::remove_XSS($_GET['action']);
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$tool_name = get_lang('ConfigureInscription');
if (!empty($action)) {
@ -67,7 +68,7 @@ if (!empty($_SESSION['user_language_choice'])) {
}
// ----- Ensuring availability of main files in the corresponding language -----
if ($_configuration['multiple_access_urls']) {
if (api_is_multiple_url_enabled()) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$url_info = api_get_access_url($access_url_id);
@ -97,7 +98,7 @@ $homef = array($topf);
// If language-specific file does not exist, create it by copying default file
foreach ($homef as $my_file) {
if ($_configuration['multiple_access_urls']) {
if (api_is_multiple_url_enabled()) {
if (!file_exists($homep_new.$my_file.'_'.$lang.$ext)) {
copy($homep.$my_file.$ext, $homep_new.$my_file.'_'.$lang.$ext);
}

@ -53,7 +53,7 @@ $form->applyFilter('name', 'trim');
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
// Description
$form->addElement('textarea', 'description', get_lang('Description'), array('rows'=>3, 'cols'=>58, onKeyDown => "text_longitud()", onKeyUp => "text_longitud()"));
$form->addElement('textarea', 'description', get_lang('Description'), array('rows'=>3, 'cols'=>58, 'onKeyDown' => "text_longitud()", 'onKeyUp' => "text_longitud()"));
$form->applyFilter('description', 'html_filter');
$form->applyFilter('description', 'trim');

@ -59,7 +59,7 @@ $form->applyFilter('name', 'trim');
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
// Description
$form->addElement('textarea', 'description', get_lang('Description'), array('rows'=>3, 'cols'=>58, onKeyDown => "text_longitud()", onKeyUp => "text_longitud()"));
$form->addElement('textarea', 'description', get_lang('Description'), array('rows'=>3, 'cols'=>58, 'onKeyDown' => "text_longitud()", 'onKeyUp' => "text_longitud()"));
$form->applyFilter('description', 'html_filter');
$form->applyFilter('description', 'trim');
@ -114,7 +114,7 @@ if ( $form->validate()) {
$description = $group['description'];
$url = $group['url'];
$status = intval($group['visibility']);
$parent_group_id = intval($group['parent_group']);
$parent_group_id = intval($group['parent_group']);
GroupPortalManager::update($group_id, $name, $description, $url, $status, $picture_uri);
GroupPortalManager::set_parent_group($group_id,$parent_group_id);

@ -1,13 +1,13 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/**
@author Bart Mollet
* @package chamilo.admin
*/
@author Bart Mollet
* @package chamilo.admin
*/
// name of the language file that needs to be included
$language_file = array ('registration','admin','userInfo');
$language_file = array('registration', 'admin', 'userInfo');
$cidReset = true;
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'xajax/xajax.inc.php';
@ -16,39 +16,38 @@ require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true);
/**
* Get the total number of users on the platform
* @see SortableTable#get_total_number_of_items()
*/
function get_number_of_groups()
{
$group_table = Database :: get_main_table(TABLE_MAIN_GROUP);
$sql = "SELECT COUNT(g.id) AS total_number_of_items FROM $group_table g";
// adding the filter to see the user's only of the current access_url
/*
global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
function get_number_of_groups() {
$group_table = Database :: get_main_table(TABLE_MAIN_GROUP);
$sql = "SELECT COUNT(g.id) AS total_number_of_items FROM $group_table g";
// adding the filter to see the user's only of the current access_url
/*
global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
}
*/
if (isset($_GET['keyword'])) {
$keyword = Database::escape_string(trim($_GET['keyword']));
$sql .= " WHERE (g.name LIKE '%".$keyword."%' OR g.description LIKE '%".$keyword."%' OR g.url LIKE '%".$keyword."%' )";
}
*/
if ( isset ($_GET['keyword'])) {
$keyword = Database::escape_string(trim($_GET['keyword']));
$sql .= " WHERE (g.name LIKE '%".$keyword."%' OR g.description LIKE '%".$keyword."%' OR g.url LIKE '%".$keyword."%' )";
}
// adding the filter to see the user's only of the current access_url
/*
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
}*/
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
} */
$res = Database::query($sql);
$obj = Database::fetch_object($res);
return $obj->total_number_of_items;
$res = Database::query($sql);
$obj = Database::fetch_object($res);
return $obj->total_number_of_items;
}
/**
* Get the users to display on the current page (fill the sortable-table)
* @param int offset of first user to recover
@ -57,11 +56,10 @@ function get_number_of_groups()
* @param string Order (ASC,DESC)
* @see SortableTable#get_table_data($from)
*/
function get_group_data($from, $number_of_items, $column, $direction)
{
$group_table = Database :: get_main_table(TABLE_MAIN_GROUP);
function get_group_data($from, $number_of_items, $column, $direction) {
$group_table = Database :: get_main_table(TABLE_MAIN_GROUP);
$sql = "SELECT
$sql = "SELECT
g.id AS col0,
g.name AS col1,
g.description AS col2,
@ -70,56 +68,54 @@ function get_group_data($from, $number_of_items, $column, $direction)
FROM $group_table g ";
// adding the filter to see the user's only of the current access_url
/*global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
}*/
if (isset ($_GET['keyword'])) {
$keyword = Database::escape_string(trim($_GET['keyword']));
$sql .= " WHERE (g.name LIKE '%".$keyword."%' OR g.description LIKE '%".$keyword."%' OR g.url LIKE '%".$keyword."%' )";
}
/*
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
}*/
/* global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
} */
if (isset($_GET['keyword'])) {
$keyword = Database::escape_string(trim($_GET['keyword']));
$sql .= " WHERE (g.name LIKE '%".$keyword."%' OR g.description LIKE '%".$keyword."%' OR g.url LIKE '%".$keyword."%' )";
}
/*
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
} */
if (!in_array($direction, array('ASC','DESC'))) {
$direction = 'ASC';
if (!in_array($direction, array('ASC', 'DESC'))) {
$direction = 'ASC';
}
$column = intval($column);
$from = intval($from);
$number_of_items = intval($number_of_items);
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
$res = Database::query($sql);
$res = Database::query($sql);
$users = array ();
$users = array();
$t = time();
// Status
$status = array();
$status[GROUP_PERMISSION_OPEN] = get_lang('Open');
$status[GROUP_PERMISSION_CLOSED] = get_lang('Closed');
$status = array();
$status[GROUP_PERMISSION_OPEN] = get_lang('Open');
$status[GROUP_PERMISSION_CLOSED] = get_lang('Closed');
while ($group = Database::fetch_row($res)) {
$group[3] = $status[$group[3]];
$group['1'] = '<a href="'.api_get_path(WEB_CODE_PATH).'social/groups.php?id='.$group['0'].'">'.$group['1'].'</a>';
while ($group = Database::fetch_row($res)) {
$group[3] = $status[$group[3]];
$group['1'] = '<a href="'.api_get_path(WEB_CODE_PATH).'social/groups.php?id='.$group['0'].'">'.$group['1'].'</a>';
$groups[] = $group;
}
return $groups;
}
return $groups;
}
function get_recent_group_data($from = 0, $number_of_items = 5, $column, $direction) {
$group_table = Database :: get_main_table(TABLE_MAIN_GROUP);
function get_recent_group_data($from =0 , $number_of_items = 5, $column, $direction)
{
$group_table = Database :: get_main_table(TABLE_MAIN_GROUP);
$sql = "SELECT
$sql = "SELECT
g.id AS col0,
g.name AS col1,
g.description AS col2,
@ -128,44 +124,43 @@ function get_recent_group_data($from =0 , $number_of_items = 5, $column, $direct
FROM $group_table g ";
// adding the filter to see the user's only of the current access_url
/*global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
}*/
if (isset ($_GET['keyword'])) {
$keyword = Database::escape_string(trim($_GET['keyword']));
$sql .= " WHERE (g.name LIKE '%".$keyword."%' OR g.description LIKE '%".$keyword."%' OR g.url LIKE '%".$keyword."%' )";
}
/*
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
}*/
/* global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
} */
if (isset($_GET['keyword'])) {
$keyword = Database::escape_string(trim($_GET['keyword']));
$sql .= " WHERE (g.name LIKE '%".$keyword."%' OR g.description LIKE '%".$keyword."%' OR g.url LIKE '%".$keyword."%' )";
}
/*
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
} */
if (!in_array($direction, array('ASC','DESC'))) {
$direction = 'ASC';
if (!in_array($direction, array('ASC', 'DESC'))) {
$direction = 'ASC';
}
$column = intval($column);
$from = intval($from);
$number_of_items = intval($number_of_items);
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
$res = Database::query($sql);
$res = Database::query($sql);
$users = array ();
$users = array();
$t = time();
while ($group = Database::fetch_row($res)) {
while ($group = Database::fetch_row($res)) {
// forget about the expiration date field
$groups[] = $group;
}
return $groups;
}
return $groups;
}
/**
* Build the modify-column of the table
* @param int The user id
@ -173,20 +168,19 @@ function get_recent_group_data($from =0 , $number_of_items = 5, $column, $direct
* @param array Row of elements to alter
* @return string Some HTML-code with modify-buttons
*/
function modify_filter($group_id,$url_params,$row)
{
global $charset;
global $_user;
global $_admins_list;
if (api_is_platform_admin()) {
$result .= '<a href="'.api_get_path(WEB_CODE_PATH).'admin/add_users_to_group.php?id='.$group_id.'">'.Display::return_icon('subscribe_users_social_network.png',get_lang('AddUsersToGroup'),'',ICON_SIZE_SMALL).'</a>';
$result .= '<a href="group_edit.php?id='.$group_id.'">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;&nbsp;';
$result .= '<a href="group_list.php?action=delete_group&amp;group_id='.$group_id.'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
}
return $result;
function modify_filter($group_id, $url_params, $row) {
global $charset;
global $_user;
global $_admins_list;
$result = null;
if (api_is_platform_admin()) {
$result .= '<a href="'.api_get_path(WEB_CODE_PATH).'admin/add_users_to_group.php?id='.$group_id.'">'.Display::return_icon('subscribe_users_social_network.png', get_lang('AddUsersToGroup'), '', ICON_SIZE_SMALL).'</a>';
$result .= '<a href="group_edit.php?id='.$group_id.'">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;&nbsp;';
$result .= '<a href="group_list.php?action=delete_group&amp;group_id='.$group_id.'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
}
return $result;
}
/**
* Build the active-column of the table to lock or unlock a certain user
* lock = the user can no longer use this account
@ -197,25 +191,25 @@ function modify_filter($group_id,$url_params,$row)
* @return string Some HTML-code with the lock/unlock button
*/
function active_filter($active, $url_params, $row) {
global $_user;
if ($active=='1') {
$action='lock';
$image='right';
} elseif ($active=='-1') {
$action='edit';
$image='expired';
} elseif ($active=='0') {
$action='unlock';
$image='wrong';
}
if ($action=='edit') {
global $_user;
if ($active == '1') {
$action = 'lock';
$image = 'right';
} elseif ($active == '-1') {
$action = 'edit';
$image = 'expired';
} elseif ($active == '0') {
$action = 'unlock';
$image = 'wrong';
}
if ($action == 'edit') {
$result = Display::return_icon($image.'.gif', get_lang('AccountExpired'));
}elseif ($row['0']<>$_user['user_id']) { // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
$result = '<a href="user_list.php?action='.$action.'&amp;user_id='.$row['0'].'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'">'.Display::return_icon($image.'.gif', get_lang(ucfirst($action))).'</a>';
}
return $result;
} elseif ($row['0'] <> $_user['user_id']) { // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
$result = '<a href="user_list.php?action='.$action.'&amp;user_id='.$row['0'].'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'">'.Display::return_icon($image.'.gif', get_lang(ucfirst($action))).'</a>';
}
return $result;
}
/**
@ -225,30 +219,25 @@ function active_filter($active, $url_params, $row) {
* @param int $user_id The user id
* @return language variable
*/
function lock_unlock_user($status,$user_id)
{
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
if ($status=='lock')
{
$status_db='0';
$return_message=get_lang('UserLocked');
}
if ($status=='unlock')
{
$status_db='1';
$return_message=get_lang('UserUnlocked');
}
if(($status_db=='1' OR $status_db=='0') AND is_numeric($user_id))
{
$sql="UPDATE $user_table SET active='".Database::escape_string($status_db)."' WHERE user_id='".Database::escape_string($user_id)."'";
$result = Database::query($sql);
}
if ($result)
{
return $return_message;
}
function lock_unlock_user($status, $user_id) {
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
if ($status == 'lock') {
$status_db = '0';
$return_message = get_lang('UserLocked');
}
if ($status == 'unlock') {
$status_db = '1';
$return_message = get_lang('UserUnlocked');
}
if (($status_db == '1' OR $status_db == '0') AND is_numeric($user_id)) {
$sql = "UPDATE $user_table SET active='".Database::escape_string($status_db)."' WHERE user_id='".Database::escape_string($user_id)."'";
$result = Database::query($sql);
}
if ($result) {
return $return_message;
}
}
/**
@ -261,154 +250,151 @@ function lock_unlock_user($status,$user_id)
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
*/
function status_filter($status) {
$statusname = api_get_status_langvars();
return $statusname[$status];
$statusname = api_get_status_langvars();
return $statusname[$status];
}
// INIT SECTION
$action = $_GET["action"];
if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array ("url" => 'group_list.php', "name" => get_lang('GroupList'));
$tool_name = get_lang('SearchAUser');
Display :: display_header($tool_name);
//api_display_tool_title($tool_name);
$form = new FormValidator('advanced_search','get');
$form->addElement('header', '', $tool_name);
$form->add_textfield('keyword_firstname',get_lang('FirstName'),false);
$form->add_textfield('keyword_lastname',get_lang('LastName'),false);
$form->add_textfield('keyword_username',get_lang('LoginName'),false);
$form->add_textfield('keyword_email',get_lang('Email'),false);
$form->add_textfield('keyword_officialcode',get_lang('OfficialCode'),false);
$status_options = array();
$status_options['%'] = get_lang('All');
$status_options[STUDENT] = get_lang('Student');
$status_options[COURSEMANAGER] = get_lang('Teacher');
$status_options[SESSIONADMIN] = get_lang('Administrator');//
$form->addElement('select','keyword_status',get_lang('Status'),$status_options);
$active_group = array();
$active_group[] = $form->createElement('checkbox','keyword_active','',get_lang('Active'));
$active_group[] = $form->createElement('checkbox','keyword_inactive','',get_lang('Inactive'));
$form->addGroup($active_group,'',get_lang('ActiveAccount'),'<br/>',false);
$form->addElement('style_submit_button', 'submit',get_lang('SearchUsers'),'class="search"');
$defaults['keyword_active'] = 1;
$defaults['keyword_inactive'] = 1;
$form->setDefaults($defaults);
$form->display();
}
else
{
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$tool_name = get_lang('GroupList');
Display :: display_header($tool_name, "");
//api_display_tool_title($tool_name);
if (isset ($_GET['action'])) {
$check = Security::check_token('get');
if($check) {
switch ($_GET['action']) {
case 'show_message' :
$action = isset($_GET["action"]) ? $_GET["action"] : null;
if (isset($_GET['search']) && $_GET['search'] == 'advanced') {
$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array("url" => 'group_list.php', "name" => get_lang('GroupList'));
$tool_name = get_lang('SearchAUser');
Display :: display_header($tool_name);
//api_display_tool_title($tool_name);
$form = new FormValidator('advanced_search', 'get');
$form->addElement('header', '', $tool_name);
$form->add_textfield('keyword_firstname', get_lang('FirstName'), false);
$form->add_textfield('keyword_lastname', get_lang('LastName'), false);
$form->add_textfield('keyword_username', get_lang('LoginName'), false);
$form->add_textfield('keyword_email', get_lang('Email'), false);
$form->add_textfield('keyword_officialcode', get_lang('OfficialCode'), false);
$status_options = array();
$status_options['%'] = get_lang('All');
$status_options[STUDENT] = get_lang('Student');
$status_options[COURSEMANAGER] = get_lang('Teacher');
$status_options[SESSIONADMIN] = get_lang('Administrator'); //
$form->addElement('select', 'keyword_status', get_lang('Status'), $status_options);
$active_group = array();
$active_group[] = $form->createElement('checkbox', 'keyword_active', '', get_lang('Active'));
$active_group[] = $form->createElement('checkbox', 'keyword_inactive', '', get_lang('Inactive'));
$form->addGroup($active_group, '', get_lang('ActiveAccount'), '<br/>', false);
$form->addElement('style_submit_button', 'submit', get_lang('SearchUsers'), 'class="search"');
$defaults['keyword_active'] = 1;
$defaults['keyword_inactive'] = 1;
$form->setDefaults($defaults);
$form->display();
} else {
$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$tool_name = get_lang('GroupList');
Display :: display_header($tool_name, "");
//api_display_tool_title($tool_name);
if (isset($_GET['action'])) {
$check = Security::check_token('get');
if ($check) {
switch ($_GET['action']) {
case 'show_message' :
if (!empty($_GET['warn'])) {
// to prevent too long messages
if ($_GET['warn'] == 'session_message'){
$_GET['warn'] = $_SESSION['session_message_import_users'];
}
Display::display_warning_message(urldecode($_GET['warn']),false);
// to prevent too long messages
if ($_GET['warn'] == 'session_message') {
$_GET['warn'] = $_SESSION['session_message_import_users'];
}
Display::display_warning_message(urldecode($_GET['warn']), false);
}
if (!empty($_GET['message'])) {
Display :: display_confirmation_message(stripslashes($_GET['message']));
}
break;
case 'delete_group' :
if (api_is_platform_admin()) {
if (GroupPortalManager :: delete($_GET['group_id'])) {
Display :: display_confirmation_message(get_lang('GroupDeleted'));
} else {
Display :: display_error_message(get_lang('CannotDeleteGroup'));
}
}
break;
case 'lock' :
$message=lock_unlock_user('lock',$_GET['user_id']);
Display :: display_normal_message($message);
break;
case 'unlock';
$message=lock_unlock_user('unlock',$_GET['user_id']);
Display :: display_normal_message($message);
break;
}
Security::clear_token();
}
}
if (isset ($_POST['action'])) {
$check = Security::check_token('get');
if ($check) {
switch ($_POST['action']) {
case 'delete' :
if (api_is_platform_admin()) {
$number_of_selected_groups = count($_POST['id']);
$number_of_deleted_groups = 0;
foreach ($_POST['id'] as $index => $group_id) {
if (GroupPortalManager :: delete($group_id)) {
$number_of_deleted_groups++;
}
}
}
if ($number_of_selected_groups == $number_of_deleted_groups) {
Display :: display_confirmation_message(get_lang('SelectedGroupsDeleted'));
} else {
Display :: display_error_message(get_lang('SomeGroupsNotDeleted'));
}
break;
}
Security::clear_token();
}
}
// Create a search-box
$form = new FormValidator('search_simple','get','','',null,false);
$renderer =& $form->defaultRenderer();
$renderer->setElementTemplate('<span>{element}</span> ');
$form->addElement('text','keyword',get_lang('keyword'));
$form->addElement('style_submit_button', 'submit',get_lang('Search'),'class="search"');
//$form->addElement('static','search_advanced_link',null,'<a href="user_list.php?search=advanced">'.get_lang('AdvancedSearch').'</a>');
echo '<div class="actions" style="width:100%;">';
if (api_is_platform_admin()) {
echo '<span style="float:right;">'.
'<a href="'.api_get_path(WEB_CODE_PATH).'admin/group_add.php">'.Display::return_icon('create_group_social_network.png',get_lang('AddGroups'),'',ICON_SIZE_MEDIUM).'</a>'.
'</span>';
}
$form->display();
echo '</div>';
if (isset ($_GET['keyword'])) {
$parameters = array ('keyword' => Security::remove_XSS($_GET['keyword']));
}
// Create a sortable table with user-data
$parameters['sec_token'] = Security::get_token();
// get the list of all admins to mark them in the users list
$admin_table = Database::get_main_table(TABLE_MAIN_ADMIN);
$sql_admin = "SELECT user_id FROM $admin_table";
$res_admin = Database::query($sql_admin);
$_admins_list = array();
while ($row_admin = Database::fetch_row($res_admin)) {
$_admins_list[] = $row_admin[0];
}
$table = new SortableTable('group_list', 'get_number_of_groups', 'get_group_data', 2);
$table->set_additional_parameters($parameters);
$table->set_header(0, '', false);
$table->set_header(1, get_lang('Name'));
$table->set_header(2, get_lang('Description'));
$table->set_header(3, get_lang('Visibility'));
$table->set_header(4, '', false);
$table->set_column_filter(4, 'modify_filter');
//$table->set_column_filter(6, 'status_filter');
//$table->set_column_filter(7, 'active_filter');
//$table->set_column_filter(8, 'modify_filter');
if (api_is_platform_admin())
$table->set_form_actions(array ('delete' => get_lang('DeleteFromPlatform')));
$table->display();
break;
case 'delete_group' :
if (api_is_platform_admin()) {
if (GroupPortalManager :: delete($_GET['group_id'])) {
Display :: display_confirmation_message(get_lang('GroupDeleted'));
} else {
Display :: display_error_message(get_lang('CannotDeleteGroup'));
}
}
break;
case 'lock' :
$message = lock_unlock_user('lock', $_GET['user_id']);
Display :: display_normal_message($message);
break;
case 'unlock';
$message = lock_unlock_user('unlock', $_GET['user_id']);
Display :: display_normal_message($message);
break;
}
Security::clear_token();
}
}
if (isset($_POST['action'])) {
$check = Security::check_token('get');
if ($check) {
switch ($_POST['action']) {
case 'delete' :
if (api_is_platform_admin()) {
$number_of_selected_groups = count($_POST['id']);
$number_of_deleted_groups = 0;
foreach ($_POST['id'] as $index => $group_id) {
if (GroupPortalManager :: delete($group_id)) {
$number_of_deleted_groups++;
}
}
}
if ($number_of_selected_groups == $number_of_deleted_groups) {
Display :: display_confirmation_message(get_lang('SelectedGroupsDeleted'));
} else {
Display :: display_error_message(get_lang('SomeGroupsNotDeleted'));
}
break;
}
Security::clear_token();
}
}
// Create a search-box
$form = new FormValidator('search_simple', 'get', '', '', null, false);
$renderer = & $form->defaultRenderer();
$renderer->setElementTemplate('<span>{element}</span> ');
$form->addElement('text', 'keyword', get_lang('keyword'));
$form->addElement('style_submit_button', 'submit', get_lang('Search'), 'class="search"');
//$form->addElement('static','search_advanced_link',null,'<a href="user_list.php?search=advanced">'.get_lang('AdvancedSearch').'</a>');
echo '<div class="actions" style="width:100%;">';
if (api_is_platform_admin()) {
echo '<span style="float:right;">'.
'<a href="'.api_get_path(WEB_CODE_PATH).'admin/group_add.php">'.Display::return_icon('create_group_social_network.png', get_lang('AddGroups'), '', ICON_SIZE_MEDIUM).'</a>'.
'</span>';
}
$form->display();
echo '</div>';
if (isset($_GET['keyword'])) {
$parameters = array('keyword' => Security::remove_XSS($_GET['keyword']));
}
// Create a sortable table with user-data
$parameters['sec_token'] = Security::get_token();
// get the list of all admins to mark them in the users list
$admin_table = Database::get_main_table(TABLE_MAIN_ADMIN);
$sql_admin = "SELECT user_id FROM $admin_table";
$res_admin = Database::query($sql_admin);
$_admins_list = array();
while ($row_admin = Database::fetch_row($res_admin)) {
$_admins_list[] = $row_admin[0];
}
$table = new SortableTable('group_list', 'get_number_of_groups', 'get_group_data', 2);
$table->set_additional_parameters($parameters);
$table->set_header(0, '', false);
$table->set_header(1, get_lang('Name'));
$table->set_header(2, get_lang('Description'));
$table->set_header(3, get_lang('Visibility'));
$table->set_header(4, '', false);
$table->set_column_filter(4, 'modify_filter');
//$table->set_column_filter(6, 'status_filter');
//$table->set_column_filter(7, 'active_filter');
//$table->set_column_filter(8, 'modify_filter');
if (api_is_platform_admin())
$table->set_form_actions(array('delete' => get_lang('DeleteFromPlatform')));
$table->display();
}
Display :: display_footer();

@ -1,16 +1,16 @@
<?php
/* For licensing terms, see /license.txt */
$language_file='admin';
$cidReset=true;
$language_file = 'admin';
$cidReset = true;
require_once '../inc/global.inc.php';
require_once '../inc/global.inc.php';
api_protect_admin_script(true);
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
$htmlHeadXtra[] = '<script language="javascript">
$htmlHeadXtra[] = '<script>
function selectAll(idCheck,numRows,action) {
for(i=0;i<numRows;i++) {
idcheck = document.getElementById(idCheck+"_"+i);
@ -23,215 +23,212 @@ $htmlHeadXtra[] = '<script language="javascript">
}
</script>';
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$page=intval($_GET['page']);
$action= Security::remove_XSS($_REQUEST['action']);
$sort=in_array($_GET['sort'],array('name','nbr_session','date_start','date_end'))? Security::remove_XSS($_GET['sort']) : 'name';
$idChecked = Security::remove_XSS($_REQUEST['idChecked']);
$order = (isset($_REQUEST['order']))? Security::remove_XSS($_REQUEST['order']): 'ASC';
$page = isset($_GET['page']) ? intval($_GET['page']) : null;
$action = isset($_REQUEST['action']) ? Security::remove_XSS($_REQUEST['action']) : null;
$sort = isset($_GET['sort']) && in_array($_GET['sort'], array('name', 'nbr_session', 'date_start', 'date_end')) ? Security::remove_XSS($_GET['sort']) : 'name';
$idChecked = isset($_REQUEST['idChecked']) ? Security::remove_XSS($_REQUEST['idChecked']) : null;
$order = isset($_REQUEST['order']) ? Security::remove_XSS($_REQUEST['order']) : 'ASC';
if ($action == 'delete_on_session' || $action == 'delete_off_session') {
$delete_session = ($action == 'delete_on_session')? true: false;
SessionManager::delete_session_category($idChecked, $delete_session);
header('Location: '.api_get_self().'?sort='.$sort.'&action=show_message&message='.urlencode(get_lang('SessionCategoryDelete')));
exit();
$delete_session = ($action == 'delete_on_session') ? true : false;
SessionManager::delete_session_category($idChecked, $delete_session);
header('Location: '.api_get_self().'?sort='.$sort.'&action=show_message&message='.urlencode(get_lang('SessionCategoryDelete')));
exit();
}
$interbreadcrumb[] = array("url" => "index.php","name" => get_lang('PlatformAdmin'));
if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
$interbreadcrumb[] = array ("url" => 'session_category_list.php', "name" => get_lang('ListSessionCategory'));
$tool_name = get_lang('SearchASession');
Display :: display_header($tool_name);
$form = new FormValidator('advanced_search','get');
$form->addElement('header', '', $tool_name);
$active_group = array();
$active_group[] = $form->createElement('checkbox','active','',get_lang('Active'));
$active_group[] = $form->createElement('checkbox','inactive','',get_lang('Inactive'));
$form->addGroup($active_group,'',get_lang('ActiveSession'),'<br/>',false);
$form->addElement('style_submit_button', 'submit',get_lang('SearchUsers'),'class="search"');
$defaults['active'] = 1;
$defaults['inactive'] = 1;
$form->setDefaults($defaults);
$form->display();
$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('PlatformAdmin'));
if (isset($_GET['search']) && $_GET['search'] == 'advanced') {
$interbreadcrumb[] = array("url" => 'session_category_list.php', "name" => get_lang('ListSessionCategory'));
$tool_name = get_lang('SearchASession');
Display :: display_header($tool_name);
$form = new FormValidator('advanced_search', 'get');
$form->addElement('header', '', $tool_name);
$active_group = array();
$active_group[] = $form->createElement('checkbox', 'active', '', get_lang('Active'));
$active_group[] = $form->createElement('checkbox', 'inactive', '', get_lang('Inactive'));
$form->addGroup($active_group, '', get_lang('ActiveSession'), '<br/>', false);
$form->addElement('style_submit_button', 'submit', get_lang('SearchUsers'), 'class="search"');
$defaults['active'] = 1;
$defaults['inactive'] = 1;
$form->setDefaults($defaults);
$form->display();
} else {
$limit = 20;
$from = $page * $limit;
//if user is crfp admin only list its sessions
if(!api_is_platform_admin()) {
$where .= (empty($_REQUEST['keyword']) ? "" : " WHERE name LIKE '%".Database::escape_string(trim($_REQUEST['keyword']))."%'");
} else {
$where .= (empty($_REQUEST['keyword']) ? "" : " WHERE name LIKE '%".Database::escape_string(trim($_REQUEST['keyword']))."%'");
}
if (empty($where)) {
$where = " WHERE access_url_id = ".api_get_current_access_url_id()." ";
} else {
$where .= " AND access_url_id = ".api_get_current_access_url_id()." ";
}
$query = "SELECT sc.*, (select count(id) FROM $tbl_session WHERE session_category_id = sc.id) as nbr_session
$limit = 20;
$from = $page * $limit;
//if user is crfp admin only list its sessions
$where = null;
if (!api_is_platform_admin()) {
$where .= (empty($_REQUEST['keyword']) ? "" : " WHERE name LIKE '%".Database::escape_string(trim($_REQUEST['keyword']))."%'");
} else {
$where .= (empty($_REQUEST['keyword']) ? "" : " WHERE name LIKE '%".Database::escape_string(trim($_REQUEST['keyword']))."%'");
}
if (empty($where)) {
$where = " WHERE access_url_id = ".api_get_current_access_url_id()." ";
} else {
$where .= " AND access_url_id = ".api_get_current_access_url_id()." ";
}
$query = "SELECT sc.*, (select count(id) FROM $tbl_session WHERE session_category_id = sc.id) as nbr_session
FROM $tbl_session_category sc
$where
ORDER BY $sort $order
LIMIT $from,".($limit+1);
$query_rows = "SELECT count(*) as total_rows FROM $tbl_session_category sc $where ";
$order = ($order == 'ASC')? 'DESC': 'ASC';
$result_rows = Database::query($query_rows);
$recorset = Database::fetch_array($result_rows);
$num = $recorset['total_rows'];
$result = Database::query($query);
$Sessions = Database::store_result($result);
$nbr_results = sizeof($Sessions);
$tool_name = get_lang('ListSessionCategory');
Display::display_header($tool_name);
//api_display_tool_title($tool_name);
LIMIT $from,".($limit + 1);
$query_rows = "SELECT count(*) as total_rows FROM $tbl_session_category sc $where ";
$order = ($order == 'ASC') ? 'DESC' : 'ASC';
$result_rows = Database::query($query_rows);
$recorset = Database::fetch_array($result_rows);
$num = $recorset['total_rows'];
$result = Database::query($query);
$Sessions = Database::store_result($result);
$nbr_results = sizeof($Sessions);
$tool_name = get_lang('ListSessionCategory');
Display::display_header($tool_name);
//api_display_tool_title($tool_name);
if (!empty($_GET['warn'])) {
Display::display_warning_message(urldecode($_GET['warn']),false);
Display::display_warning_message(urldecode($_GET['warn']), false);
}
if(isset($_GET['action'])) {
Display::display_confirmation_message(stripslashes($_GET['message']),false);
if (isset($_GET['action'])) {
Display::display_confirmation_message(stripslashes($_GET['message']), false);
}
$keyword = isset($_GET['keyword']) ? Security::remove_XSS($_GET['keyword']) : null;
?>
<div class="actions">
<?php
echo '<div style="float:right;">
<a href="'.api_get_path(WEB_CODE_PATH).'admin/session_category_add.php">'.Display::return_icon('new_folder.png',get_lang('AddSessionCategory'),'',ICON_SIZE_MEDIUM).'</a>
<a href="'.api_get_path(WEB_CODE_PATH).'admin/session_list.php">'.Display::return_icon('session.png',get_lang('ListSession'),'',ICON_SIZE_MEDIUM).'</a>
<div class="actions">
<?php
echo '<div style="float:right;">
<a href="'.api_get_path(WEB_CODE_PATH).'admin/session_category_add.php">'.Display::return_icon('new_folder.png', get_lang('AddSessionCategory'), '', ICON_SIZE_MEDIUM).'</a>
<a href="'.api_get_path(WEB_CODE_PATH).'admin/session_list.php">'.Display::return_icon('session.png', get_lang('ListSession'), '', ICON_SIZE_MEDIUM).'</a>
</div>';
?>
<form method="POST" action="session_category_list.php">
<input type="text" name="keyword" value="<?php echo Security::remove_XSS($_GET['keyword']); ?>"/>
<button class="search" type="submit" name="name" value="<?php echo get_lang('Search') ?>"><?php echo get_lang('Search') ?></button>
<!-- <a href="session_list.php?search=advanced"><?php echo get_lang('AdvancedSearch'); ?></a> -->
</form>
<form method="post" action="<?php echo api_get_self(); ?>?action=delete&sort=<?php echo $sort; ?>" onsubmit="javascript:if(!confirm('<?php echo get_lang('ConfirmYourChoice'); ?>')) return false;">
</div><br />
<div align="left">
<?php
if(count($Sessions)==0 && isset($_POST['keyword'])) {
echo get_lang('NoSearchResults');
echo '</div>';
} else {
if ($num > $limit) {
if ($page) {
?>
<a href="<?php echo api_get_self(); ?>?page=<?php echo $page-1; ?>&sort=<?php echo $sort; ?>&order=<?php echo Security::remove_XSS($_REQUEST['order']); ?>&keyword=<?php echo $_REQUEST['keyword']; ?><?php echo @$cond_url; ?>"><?php echo get_lang('Previous'); ?></a>
<?php
} else {
echo get_lang('Previous');
}
?>
|
<?php
if($nbr_results > $limit) {
?>
<a href="<?php echo api_get_self(); ?>?page=<?php echo $page+1; ?>&sort=<?php echo $sort; ?>&order=<?php echo Security::remove_XSS($_REQUEST['order']); ?>&keyword=<?php echo $_REQUEST['keyword']; ?><?php echo @$cond_url; ?>"><?php echo get_lang('Next'); ?></a>
<?php
} else {
echo get_lang('Next');
}
}
?>
</div>
<br />
<table class="data_table" width="100%">
<tr>
<th>&nbsp;</th>
<th><a href="<?php echo api_get_self(); ?>?sort=name&order=<?php echo ($sort=='name')? $order: 'ASC'; ?>"><?php echo get_lang('SessionCategoryName'); ?></a></th>
<th><a href="<?php echo api_get_self(); ?>?sort=nbr_session&order=<?php echo ($sort=='nbr_session')? $order: 'ASC'; ?>"><?php echo get_lang('NumberOfSession'); ?></a></th>
<th><a href="<?php echo api_get_self(); ?>?sort=date_start&order=<?php echo ($sort=='date_start')? $order: 'ASC'; ?>"><?php echo get_lang('StartDate'); ?></a></th>
<th><a href="<?php echo api_get_self(); ?>?sort=date_end&order=<?php echo ($sort=='date_end')? $order: 'ASC'; ?>"><?php echo get_lang('EndDate'); ?></a></th>
<th><?php echo get_lang('Actions'); ?></th>
</tr>
<?php
$i=0;
$x=0;
foreach ($Sessions as $key=>$enreg) {
if($key == $limit) {
break;
}
$sql = 'SELECT COUNT(session_category_id) FROM '.$tbl_session.' WHERE session_category_id = '.intval($enreg['id']);
$rs = Database::query($sql);
list($nb_courses) = Database::fetch_array($rs);
?>
<tr class="<?php echo $i?'row_odd':'row_even'; ?>">
<td><input type="checkbox" id="idChecked_<?php echo $x; ?>" name="idChecked[]" value="<?php echo $enreg['id']; ?>"></td>
<td><?php echo api_htmlentities($enreg['name'],ENT_QUOTES,$charset); ?></td>
<td><?php echo "<a href=\"session_list.php?id_category=".$enreg['id']."\">".$nb_courses." Sesion(es) </a>"; ?></td>
<td><?php echo api_htmlentities($enreg['date_start'],ENT_QUOTES,$charset); ?></td>
<td><?php echo api_htmlentities($enreg['date_end'],ENT_QUOTES,$charset); ?></td>
<td>
<a href="session_category_edit.php?&id=<?php echo $enreg['id']; ?>">
<?php Display::display_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL); ?>
</a>
<a href="<?php echo api_get_self(); ?>?sort=<?php echo $sort; ?>&action=delete_off_session&idChecked=<?php echo $enreg['id']; ?>" onclick="javascript:if(!confirm('<?php echo get_lang('ConfirmYourChoice'); ?>')) return false;">
<?php Display::display_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL); ?>
</a>
</td>
</tr>
<?php
$i=$i ? 0 : 1;
$x++;
}
unset($Sessions);
?>
</table>
<br />
<div align="left">
<?php
if ($num > $limit) {
if ($page)
{
?>
<a href="<?php echo api_get_self(); ?>?page=<?php echo $page-1; ?>&sort=<?php echo $sort; ?>&order=<?php echo Security::remove_XSS($_REQUEST['order']); ?>&keyword=<?php echo $_REQUEST['keyword']; ?><?php echo @$cond_url; ?>"><?php echo get_lang('Previous'); ?></a>
<?php
}
else
{
echo get_lang('Previous');
}
?>
|
<?php
if($nbr_results > $limit)
{
?>
<a href="<?php echo api_get_self(); ?>?page=<?php echo $page+1; ?>&sort=<?php echo $sort; ?>&order=<?php echo Security::remove_XSS($_REQUEST['order']); ?>&keyword=<?php echo $_REQUEST['keyword']; ?><?php echo @$cond_url; ?>"><?php echo get_lang('Next'); ?></a>
<?php
}
else
{
echo get_lang('Next');
}
} ?>
</div>
<br />
<a href="#" onclick="selectAll('idChecked',<?php echo $x; ?>,'true');return false;"><?php echo get_lang('SelectAll') ?></a>&nbsp;-&nbsp;
<a href="#" onclick="selectAll('idChecked',<?php echo $x; ?>,'false');return false;"><?php echo get_lang('UnSelectAll') ?></a>
<select name="action">
<option value="delete_off_session" selected="selected"><?php echo get_lang('DeleteSelectedSessionCategory'); ?></option>
<option value="delete_on_session"><?php echo get_lang('DeleteSelectedFullSessionCategory'); ?></option>
</select>
<button class="save" type="submit" name="name" value="<?php echo get_lang('Ok') ?>"><?php echo get_lang('Ok') ?></button>
<?php } ?>
</table>
?>
<form method="POST" action="session_category_list.php">
<input type="text" name="keyword" value="<?php echo $keyword; ?>"/>
<button class="search" type="submit" name="name" value="<?php echo get_lang('Search') ?>"><?php echo get_lang('Search') ?></button>
<!-- <a href="session_list.php?search=advanced"><?php echo get_lang('AdvancedSearch'); ?></a> -->
</form>
<form method="post" action="<?php echo api_get_self(); ?>?action=delete&sort=<?php echo $sort; ?>" onsubmit="javascript:if(!confirm('<?php echo get_lang('ConfirmYourChoice'); ?>')) return false;">
</div><br />
<div align="left">
<?php
if (count($Sessions) == 0 && isset($_POST['keyword'])) {
echo get_lang('NoSearchResults');
echo '</div>';
} else {
if ($num > $limit) {
if ($page) {
?>
<a href="<?php echo api_get_self(); ?>?page=<?php echo $page - 1; ?>&sort=<?php echo $sort; ?>&order=<?php echo Security::remove_XSS($_REQUEST['order']); ?>&keyword=<?php echo $_REQUEST['keyword']; ?><?php echo @$cond_url; ?>"><?php echo get_lang('Previous'); ?></a>
<?php
} else {
echo get_lang('Previous');
}
?>
|
<?php
if ($nbr_results > $limit) {
?>
<a href="<?php echo api_get_self(); ?>?page=<?php echo $page + 1; ?>&sort=<?php echo $sort; ?>&order=<?php echo Security::remove_XSS($_REQUEST['order']); ?>&keyword=<?php echo $_REQUEST['keyword']; ?><?php echo @$cond_url; ?>"><?php echo get_lang('Next'); ?></a>
<?php
} else {
echo get_lang('Next');
}
}
?>
</div>
<br />
<table class="data_table" width="100%">
<tr>
<th>&nbsp;</th>
<th><a href="<?php echo api_get_self(); ?>?sort=name&order=<?php echo ($sort == 'name') ? $order : 'ASC'; ?>"><?php echo get_lang('SessionCategoryName'); ?></a></th>
<th><a href="<?php echo api_get_self(); ?>?sort=nbr_session&order=<?php echo ($sort == 'nbr_session') ? $order : 'ASC'; ?>"><?php echo get_lang('NumberOfSession'); ?></a></th>
<th><a href="<?php echo api_get_self(); ?>?sort=date_start&order=<?php echo ($sort == 'date_start') ? $order : 'ASC'; ?>"><?php echo get_lang('StartDate'); ?></a></th>
<th><a href="<?php echo api_get_self(); ?>?sort=date_end&order=<?php echo ($sort == 'date_end') ? $order : 'ASC'; ?>"><?php echo get_lang('EndDate'); ?></a></th>
<th><?php echo get_lang('Actions'); ?></th>
</tr>
<?php
$i = 0;
$x = 0;
foreach ($Sessions as $key => $enreg) {
if ($key == $limit) {
break;
}
$sql = 'SELECT COUNT(session_category_id) FROM '.$tbl_session.' WHERE session_category_id = '.intval($enreg['id']);
$rs = Database::query($sql);
list($nb_courses) = Database::fetch_array($rs);
?>
<tr class="<?php echo $i ? 'row_odd' : 'row_even'; ?>">
<td><input type="checkbox" id="idChecked_<?php echo $x; ?>" name="idChecked[]" value="<?php echo $enreg['id']; ?>"></td>
<td><?php echo api_htmlentities($enreg['name'], ENT_QUOTES, $charset); ?></td>
<td><?php echo "<a href=\"session_list.php?id_category=".$enreg['id']."\">".$nb_courses." Sesion(es) </a>"; ?></td>
<td><?php echo api_htmlentities($enreg['date_start'], ENT_QUOTES, $charset); ?></td>
<td><?php echo api_htmlentities($enreg['date_end'], ENT_QUOTES, $charset); ?></td>
<td>
<a href="session_category_edit.php?&id=<?php echo $enreg['id']; ?>">
<?php Display::display_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL); ?>
</a>
<a href="<?php echo api_get_self(); ?>?sort=<?php echo $sort; ?>&action=delete_off_session&idChecked=<?php echo $enreg['id']; ?>" onclick="javascript:if(!confirm('<?php echo get_lang('ConfirmYourChoice'); ?>')) return false;">
<?php Display::display_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL); ?>
</a>
</td>
</tr>
<?php
$i = $i ? 0 : 1;
$x++;
}
unset($Sessions);
?>
</table>
<br />
<div align="left">
<?php
if ($num > $limit) {
if ($page) {
?>
<a href="<?php echo api_get_self(); ?>?page=<?php echo $page - 1; ?>&sort=<?php echo $sort; ?>&order=<?php echo Security::remove_XSS($_REQUEST['order']); ?>&keyword=<?php echo $_REQUEST['keyword']; ?><?php echo @$cond_url; ?>"><?php echo get_lang('Previous'); ?></a>
<?php
} else {
echo get_lang('Previous');
}
?>
|
<?php
if ($nbr_results > $limit) {
?>
<a href="<?php echo api_get_self(); ?>?page=<?php echo $page + 1; ?>&sort=<?php echo $sort; ?>&order=<?php echo Security::remove_XSS($_REQUEST['order']); ?>&keyword=<?php echo $_REQUEST['keyword']; ?><?php echo @$cond_url; ?>"><?php echo get_lang('Next'); ?></a>
<?php
} else {
echo get_lang('Next');
}
}
?>
</div>
<br />
<a href="#" onclick="selectAll('idChecked',<?php echo $x; ?>,'true');return false;"><?php echo get_lang('SelectAll') ?></a>&nbsp;-&nbsp;
<a href="#" onclick="selectAll('idChecked',<?php echo $x; ?>,'false');return false;"><?php echo get_lang('UnSelectAll') ?></a>
<select name="action">
<option value="delete_off_session" selected="selected"><?php echo get_lang('DeleteSelectedSessionCategory'); ?></option>
<option value="delete_on_session"><?php echo get_lang('DeleteSelectedFullSessionCategory'); ?></option>
</select>
<button class="save" type="submit" name="name" value="<?php echo get_lang('Ok') ?>"><?php echo get_lang('Ok') ?></button>
<?php } ?>
</table>
<?php } Display::display_footer(); ?>

@ -22,6 +22,8 @@ api_protect_admin_script(true);
$is_platform_admin = api_is_platform_admin() ? 1 : 0;
$message = null;
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
$htmlHeadXtra[] = '<link href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css" rel="stylesheet" type="text/css" />';
$htmlHeadXtra[] = '
@ -48,16 +50,16 @@ function display_drh_list(){
document.getElementById("drh_list").style.display="block";
if (is_platform_id == 1)
document.getElementById("id_platform_admin").style.display="none";
} else if (document.getElementById("status_select").value=='.COURSEMANAGER.') {
document.getElementById("drh_list").style.display="none";
if (is_platform_id == 1)
if (is_platform_id == 1)
document.getElementById("id_platform_admin").style.display="block";
} else {
document.getElementById("drh_list").style.display="none";
if (is_platform_id == 1)
if (is_platform_id == 1)
document.getElementById("id_platform_admin").style.display="none";
}
}
@ -109,7 +111,7 @@ $form->addRule('email', get_lang('EmailWrong'), 'required');
if (api_get_setting('login_is_email') == 'true') {
$form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
$form->addRule('email', get_lang('UserTaken'), 'username_available', $user_data['username']);
$form->addRule('email', get_lang('UserTaken'), 'username_available');
}
// Phone
@ -126,7 +128,7 @@ if (api_get_setting('login_is_email') != 'true') {
$form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
$form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username');
$form->addRule('username', get_lang('UserTaken'), 'username_available', $user_data['username']);
$form->addRule('username', get_lang('UserTaken'), 'username_available');
}
// Password
@ -166,11 +168,12 @@ $status[SESSIONADMIN] = get_lang('SessionsAdmin');
$form->addElement('select', 'status', get_lang('Profile'), $status, array('id' => 'status_select', 'class'=>'chzn-select', 'onchange' => 'javascript: display_drh_list();'));
//drh list (display only if student)
$display = ($_POST['status'] == STUDENT || !isset($_POST['status'])) ? 'block' : 'none';
$display = isset($_POST['status']) && $_POST['status'] == STUDENT || !isset($_POST['status']) ? 'block' : 'none';
//@todo remove the drh list here. This code is unused
$form->addElement('html', '<div id="drh_list" style="display:'.$display.';">');
if (is_array($drh_list)) {
if (isset($drh_list) && is_array($drh_list)) {
foreach ($drh_list as $drh) {
$drh_select->addOption(api_get_person_name($drh['firstname'], $drh['lastname']), $drh['user_id']);
}
@ -182,7 +185,7 @@ if (api_is_platform_admin()) {
$group = array();
$group[] = $form->createElement('radio', 'platform_admin', 'id="id_platform_admin"', get_lang('Yes'), 1);
$group[] = $form->createElement('radio', 'platform_admin', 'id="id_platform_admin"', get_lang('No'), 0);
$display = ($_POST['status'] == STUDENT || !isset($_POST['status'])) ? 'none' : 'block';
//$display = ($_POST['status'] == STUDENT || !isset($_POST['status'])) ? 'none' : 'block';
$form->addElement('html', '<div id="id_platform_admin" style="display:'.$display.';">');
$form->addGroup($group, 'admin', get_lang('PlatformAdmin'), '&nbsp;');
$form->addElement('html', '</div>');
@ -293,7 +296,7 @@ if( $form->validate()) {
$picture_uri = UserManager::update_user_picture($user_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);
UserManager::update_user($user_id, $firstname, $lastname, $username, $password, $auth_source, $email, $status, $official_code, $phone, $picture_uri, $expiration_date, $active, null, $hr_dept_id, null, $language);
}
foreach ($user as $key => $value) {
if (substr($key, 0, 6) == 'extra_') { //an extra field
UserManager::update_extra_field_value($user_id, substr($key, 6), $value);
@ -323,13 +326,13 @@ if( $form->validate()) {
$form->setConstants(array('sec_token' => $token));
}
if(!empty($message)){
if (!empty($message)){
$message = Display::return_message(stripslashes($message));
}
$content .= $form->return_form();
$content = $form->return_form();
$tpl = new Template($tool_name);
$tpl->assign('actions', $actions);
//$tpl->assign('actions', $actions);
$tpl->assign('message', $message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -133,6 +133,7 @@ $export_icon_high = '../img/export_high_fade.png';
$tpl->assign('export_ical_confidential_icon', Display::return_icon($export_icon_high, get_lang('ExportiCalConfidential')));
$actions = null;
if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()) && api_is_allowed_to_session_edit(false,true) OR $is_group_tutor) {
if ($type == 'course') {
$actions = display_courseadmin_links();

@ -71,7 +71,7 @@ $form->applyFilter('name', 'trim');
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
// Description
$form->addElement('textarea', 'description', get_lang('Description'), array('class'=>'span5', 'cols'=>58, onKeyDown => "textarea_maxlength()", onKeyUp => "textarea_maxlength()"));
$form->addElement('textarea', 'description', get_lang('Description'), array('class'=>'span5', 'cols'=>58, 'onKeyDown' => "textarea_maxlength()", 'onKeyUp' => "textarea_maxlength()"));
$form->applyFilter('description', 'html_filter');
$form->applyFilter('description', 'trim');
$form->addRule('name', '', 'maxlength',255);

Loading…
Cancel
Save