Skip to content
Snippets Groups Projects
Commit 34be68ab authored by Didier Cadiou's avatar Didier Cadiou
Browse files

Version 2017032103 obtenue par application du différentiel entre le dépôt...

Version 2017032103 obtenue par application du différentiel entre le dépôt originel, branche developpement (2017032102) et l'archive téléchargeable sur moodle.org le 2 novembre 2023 (2017032103).
parent 57e337f2
No related branches found
No related tags found
No related merge requests found
......@@ -70,9 +70,9 @@ if ($lp_id && $t_id) {
if ($g_id != 0) {
$attributes3 = $DB->get_records_sql_menu('SELECT u.id, CONCAT(firstname," ", lastname) as name FROM {user} as u inner join {groups_members} gm on u.id= gm.userid
where u.firstname != "Guest User" AND gm.groupid=?', array($g_id), $limitfrom = 0, $limitnum = 0);
where u.firstname != "Guest User" AND u.suspended <> 1 AND u.deleted <> 1 AND gm.groupid=?', array($g_id), $limitfrom = 0, $limitnum = 0);
} else {
$attributes3 = $DB->get_records_sql_menu('SELECT id, CONCAT(firstname," ", lastname) as name FROM {user} where firstname != "Guest User"', null, $limitfrom = 0, $limitnum = 0);
$attributes3 = $DB->get_records_sql_menu('SELECT id, CONCAT(firstname," ", lastname) as name FROM {user} where firstname != "Guest User" AND suspended <> 1 AND deleted <> 1 ', null, $limitfrom = 0, $limitnum = 0);
}
......@@ -80,8 +80,9 @@ if ($lp_id && $t_id) {
where lp_id = ?', array($lp_id), $limitfrom = 0, $limitnum = 0);
$attributes = array_diff($attributes3, $attributes4);
} else if ($lp_id) {
$attributes = $DB->get_records_sql_menu('SELECT u.u_id as id, (SELECT CONCAT(firstname," ", lastname)FROM {user} where username!="guest" AND id = u. u_id) as name FROM
{learning_user_learningplan} as u where lp_id= ?', array($lp_id), $limitfrom = 0, $limitnum = 0);
$attributes = $DB->get_records_sql_menu('SELECT lu.u_id as id , CONCAT(firstname," ", lastname) as name '
. 'FROM {user} as u, {learning_user_learningplan} as lu '
. 'where u.username!="guest" AND u.suspended <> 1 AND u.deleted <> 1 AND u.id = lu.u_id AND lu.lp_id= ?', array($lp_id), $limitfrom = 0, $limitnum = 0);
}
$data = "";
foreach ($attributes as $key => $attrib) {
......@@ -89,3 +90,14 @@ if ($lp_id && $t_id) {
}
return print_r($data);
}
/*
SELECT u.u_id as id, (SELECT CONCAT(firstname, " ", lastname)FROM {
user
} where username != "guest" AND suspended <> 1 AND deleted <> 1 AND id = u. u_id) as name FROM {
learning_user_learningplan
} as u where lp_id= ?
*
*
*/
\ No newline at end of file
......@@ -346,7 +346,7 @@ class assignlerningplan_user_form extends moodleform {
$mform->disabledIf('g_id', 'g_selection', 'eq', 1);
$attributes = $DB->get_records_sql_menu('SELECT id, name FROM {groups}', null, $limitfrom = 0, $limitnum = 0);
$select = $mform->addElement('select', 'g_id', get_string('department', 'block_learning_plan'), $attributes, null, array(null));
$attributes = $DB->get_records_sql_menu('SELECT id, CONCAT(firstname," ", lastname)FROM {user} where username!="guest"', array($params = null), $limitfrom = 0, $limitnum = 0);
$attributes = $DB->get_records_sql_menu('SELECT id, CONCAT(firstname," ", lastname)FROM {user} where username!="guest" AND suspended <> 1 AND deleted <> 1 ' , array($params = null), $limitfrom = 0, $limitnum = 0);
$select = $mform->addElement('select', 'u_id', get_string('users', 'block_learning_plan'), $attributes, null, array('link' => $CFG->wwwroot . '/user/editadvanced.php?id=-1', 'label' => get_string('addusers', 'block_learning_plan'), $attributes1));
$select->setMultiple(true);
$mform->addRule('u_id', get_string('select_user', 'block_learning_plan'), 'required', null, 'client');
......@@ -371,12 +371,19 @@ class assignlerningplan_user_form extends moodleform {
$table->align = array('center', 'left', 'left', 'center');
$table->width = '100%';
$table->data = array();
$sql = "SELECT id, u_id, lp_id, (SELECT concat(firstname,' ', lastname) FROM {user} WHERE id = u_id) as fullname,
$sql = "SELECT concat(u.firstname,' ', u.lastname) as fullname, lu.u_id, lu.lp_id, lp.learning_plan "
. "FROM {user} as u , {learning_user_learningplan} as lu , {learning_learningplan} as lp "
. "WHERE u.id = lu.u_id AND lu.lp_id = lp.id AND username!='guest' AND suspended <> 1 AND deleted <> 1";
//AND username!='guest' AND suspended <> 1 AND deleted <> 1
/*SELECT id, u_id, lp_id, (SELECT concat(firstname,' ', lastname) FROM {user} WHERE id = u_id AND username!='guest' AND suspended <> 1 AND deleted <> 1) as fullname,
(SELECT learning_plan FROM {learning_learningplan} WHERE id = lp_id) as learning_plan,
(SELECT concat(firstname,' ', lastname) FROM {user} WHERE id = assignee_id) as assignee
FROM {learning_user_learningplan}";
FROM {learning_user_learningplan}
*/
$inc = 0;
//$rs = $DB->get_recordset_sql($sql, array(), $page * $perpage, $perpage);
$rs = $DB->get_recordset_sql($sql, array());
if ($DB->record_exists_sql($sql, array())) {
......@@ -421,9 +428,9 @@ class trainingstatus_form extends moodleform {
}
$mform->addElement('selectwithlink', 'l_id', get_string('learningplan', 'block_learning_plan'), $attributes, null, null);
if (isset($u_id)) {
$attributes = $DB->get_records_sql_menu('SELECT id, CONCAT(firstname," ", lastname)FROM {user} where username!="guest" AND id=?', array($u_id), $limitfrom = 0, $limitnum = 0);
$attributes = $DB->get_records_sql_menu('SELECT id, CONCAT(firstname," ", lastname) as name FROM {user} where username!="guest" AND id=?', array($u_id), $limitfrom = 0, $limitnum = 0);
} else {
$attributes = $DB->get_records_sql_menu('SELECT id, CONCAT(firstname," ", lastname)FROM {user} where username!="guest"', array($params = null), $limitfrom = 0, $limitnum = 0);
$attributes = $DB->get_records_sql_menu('SELECT id, CONCAT(firstname," ", lastname) as name FROM {user} where username!="guest"', array($params = null), $limitfrom = 0, $limitnum = 0);
}
$mform->addElement('selectwithlink', 'u_id', get_string('users', 'block_learning_plan'), $attributes, null, null);
if (isset($t_id)) {
......
......@@ -24,7 +24,7 @@
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2017032102; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2017032103; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2010112400; // Requires Moodle 2.1 or later.
$plugin->release = '3.2';
$plugin->maturity = MATURITY_STABLE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment