Exemplo n.º 1
0
 /**
  * Finds the external_authority name of this LMS at the SWITCHcast server
  *
  * @return string|bool name if found, false if not found
  */
 public function getExternalAuthName($id = 0)
 {
     // TODO remove as we're now only using local org (i.e. unil.ch for us)
     if ($id === 0) {
         $id = $this->getValueForKey('external_authority_id');
     }
     $url = $this->getValueForKey('switch_api_host');
     $url .= '/users/' . $this->getSysAccount();
     $url .= '/channels';
     $url .= '/new.xml';
     $new = mod_opencast_oldapi::sendRequest($url, 'GET');
     if (count($new->external_authority_id[0]) > 0) {
         foreach ($new->external_authority_id[0] as $external_auth) {
             $attr = $external_auth->attributes();
             if ((int) $attr['value'] == (int) $id) {
                 return (string) $external_auth;
             }
         }
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * Reads user data from the SWITCHcast server
  *
  */
 public function doRead()
 {
     if (!$this->getExternalAccount()) {
         return;
     }
     $url = $this->switch_api;
     $url .= '/users/' . $this->getExternalAccount() . '.xml?full=true';
     $simplexmlobj = mod_opencast_oldapi::sendRequest($url, 'GET');
     $this->setLastName((string) $simplexmlobj->lastname);
     $this->setFirstName((string) $simplexmlobj->firstname);
     $this->setEmail((string) $simplexmlobj->email);
     $this->setExternalAccount((string) $simplexmlobj->login);
 }