Commit f3369390 authored by Myriam Delaruelle's avatar Myriam Delaruelle
Browse files

removes timestamp from course->shortname

parent 6ebf2f7c
......@@ -195,9 +195,12 @@ class block_mahara_iena_connexion
$mo_user_group_id = $mo_user_groups[0][0]; // first groupment, first group
$mo_group_name = groups_get_group_name($mo_user_group_id);
$course_name=block_mahara_iena_getCourseName($COURSE->shortname);
var_dump($course_name);
$group = new stdClass();
$group->name = $COURSE->shortname . " – " . $mo_group_name;
$group->description = get_string('course_group', 'block_mahara_iena') . " " . $COURSE->shortname . " – " . $mo_group_name;
$group->name = get_string('course_group', 'block_mahara_iena') . " " . $course_name . " – " . $mo_group_name;
$group->description = get_string('course_group', 'block_mahara_iena') . " " . $course_name . " – " . $mo_group_name;
$group->grouptype = 'course';
$group->request = true;
$group->public = false;
......@@ -276,9 +279,11 @@ class block_mahara_iena_connexion
// $mo_group_name = groups_get_group_name($mo_user_group_id);
$mo_group_name = $mo_group->name;
$course_name=block_mahara_iena_getCourseName($COURSE->shortname);
$group = new stdClass();
$group->name = $COURSE->shortname . " – " . $mo_group_name;
$group->description = get_string('course_group', 'block_mahara_iena') . " " . $COURSE->shortname . " – " . $mo_group_name;
$group->name = get_string('course_group', 'block_mahara_iena') . " " . $course_name . " – " . $mo_group_name;
$group->description = get_string('course_group', 'block_mahara_iena') . " " . $course_name . " – " . $mo_group_name;
$group->grouptype = 'course';
$group->request = true;
$group->public = false;
......@@ -335,9 +340,11 @@ class block_mahara_iena_connexion
$mo_user_group_id = $mo_group_id;
$mo_group_name = groups_get_group_name($mo_user_group_id);
$course_name=block_mahara_iena_getCourseName($COURSE->shortname);
$group = new stdClass();
$group->name = $COURSE->shortname . " – " . $mo_group_name;
$group->description = get_string('course_group', 'block_mahara_iena') . " " . $COURSE->shortname . " – " . $mo_group_name;
$group->name = get_string('course_group', 'block_mahara_iena') . " " . $course_name . " – " . $mo_group_name;
$group->description = get_string('course_group', 'block_mahara_iena') . " " . $course_name . " – " . $mo_group_name;
$group->grouptype = 'course';
$group->request = true;
$group->public = false;
......@@ -389,7 +396,6 @@ class block_mahara_iena_connexion
}
<?php
function block_mahara_iena_isValidTimeStamp($timestamp)
{
return ((string) (int) $timestamp === $timestamp)
&& ($timestamp <= PHP_INT_MAX)
&& ($timestamp >= ~PHP_INT_MAX);
}
function block_mahara_iena_getCourseName($coursename){
$course_name=$coursename;
$isTimeStamp=substr($coursename, -1, 11);
if(block_mahara_iena_isValidTimeStamp($isTimeStamp)){
$course_name=substr($coursename, -11);
}
return $course_name;
}
?>
\ No newline at end of file
......@@ -75,14 +75,16 @@ if (count($students) == 0) {
'role' => "admin",
));
}
$course_name=block_mahara_iena_getCourseName($COURSE->shortname);
//All params used for mahara_group_create_groups her we can add/change some lines
$params = array (
'groups' =>
array (
0 =>
array (
'name' => $COURSE->shortname,
'description' => get_string('course_group', 'block_mahara_iena') . " " . $COURSE->shortname,
'name' => $course_name,
'description' => get_string('course_group', 'block_mahara_iena') . " " . $course_name,
'grouptype' => 'course',
'request' => true,
'public' => false,
......
......@@ -30,12 +30,7 @@ $connexion = new block_mahara_iena_connexion($CFG->wstoken,$CFG->base_mahara);
$course_ctx = context_course::instance($course->id);
$students = get_enrolled_users($course_ctx);
function isValidTimeStamp($timestamp)
{
return ((string) (int) $timestamp === $timestamp)
&& ($timestamp <= PHP_INT_MAX)
&& ($timestamp >= ~PHP_INT_MAX);
}
if (count($students) == 0) {
......@@ -79,12 +74,7 @@ if (count($students) == 0) {
continue;
}
$course_name=$COURSE_shortname;
$isTimeStamp=substr($COURSE->shortname, -1, 11);
if($isTimeStamp){
$course_name=substr($COURSE->shortname, -11);
}
$course_name=block_mahara_iena_getCourseName($COURSE->shortname);
var_dump($course_name);
array_push($mahara_groups, array(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment