Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup: move zoom_get_user_display_name function from view.php to locallib #584

Merged
merged 4 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1314,3 +1314,30 @@ function zoom_get_registrant_join_url($useremail, $meetingid, $iswebinar) {

return false;
}

/**
* Get the display name for a Zoom user.
* This is wrapped in a function to avoid unnecessary API calls.
*
* @package mod_zoom
jrchamp marked this conversation as resolved.
Show resolved Hide resolved
* @param string $zoomuserid Zoom user ID.
* @return ?string
*/
function zoom_get_user_display_name($zoomuserid) {
try {
$hostuser = zoom_get_user($zoomuserid);

// Compose Moodle user object for host.
$hostmoodleuser = new stdClass();
$hostmoodleuser->firstname = $hostuser->first_name;
$hostmoodleuser->lastname = $hostuser->last_name;
$hostmoodleuser->alternatename = '';
$hostmoodleuser->firstnamephonetic = '';
$hostmoodleuser->lastnamephonetic = '';
$hostmoodleuser->middlename = '';

return fullname($hostmoodleuser);
} catch (moodle_exception $error) {
return null;
}
}
27 changes: 0 additions & 27 deletions view.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,33 +90,6 @@
}
}

/**
* Get the display name for a Zoom user.
* This is wrapped in a function to avoid unnecessary API calls.
*
* @package mod_zoom
* @param string $zoomuserid Zoom user ID.
* @return ?string
*/
function zoom_get_user_display_name($zoomuserid) {
try {
$hostuser = zoom_get_user($zoomuserid);

// Compose Moodle user object for host.
$hostmoodleuser = new stdClass();
$hostmoodleuser->firstname = $hostuser->first_name;
$hostmoodleuser->lastname = $hostuser->last_name;
$hostmoodleuser->alternatename = '';
$hostmoodleuser->firstnamephonetic = '';
$hostmoodleuser->lastnamephonetic = '';
$hostmoodleuser->middlename = '';

return fullname($hostmoodleuser);
} catch (moodle_exception $error) {
return null;
}
}

$isrecurringnotime = ($zoom->recurring && $zoom->recurrence_type == ZOOM_RECURRINGTYPE_NOTIME);

$stryes = get_string('yes');
Expand Down
Loading