From 5f46466d1964d7c94ec9364d6d842c5bbcbd8ab0 Mon Sep 17 00:00:00 2001 From: Karen Liu <36342242+karenliulll@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:18:02 -0400 Subject: [PATCH] Cleanup: move function from view.php to locallib --- locallib.php | 27 +++++++++++++++++++++++++++ view.php | 27 --------------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/locallib.php b/locallib.php index 6f42e2c9..019b9266 100755 --- a/locallib.php +++ b/locallib.php @@ -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 + * @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; + } +} diff --git a/view.php b/view.php index d946ec9f..bf1033b8 100755 --- a/view.php +++ b/view.php @@ -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');