3 require_once 
"./Modules/ILinc/classes/class.ilnetucateResponse.php";
 
    4 require_once 
"./Services/Xml/classes/class.ilXmlWriter.php";
 
   25                 define(
'ILINC_MEMBER_NOTSET',
'ilinc_notset');
 
   26                 define(
'ILINC_MEMBER_DOCENT',
'ilinc_docent');
 
   27                 define(
'ILINC_MEMBER_STUDENT',
'ilinc_student');
 
   31                 $this->ilias =& $ilias;
 
   33                 $this->reg_login = $this->ilias->getSetting(
"ilinc_registrar_login");
 
   34                 $this->reg_passwd = $this->ilias->getSetting(
"ilinc_registrar_passwd");
 
   35                 $this->customer_id = $this->ilias->getSetting(
"ilinc_customer_id");
 
   36                 $this->server_scheme = $this->ilias->getSetting(
"ilinc_protocol");
 
   37                 $this->server_addr      = $this->ilias->getSetting(
"ilinc_server");
 
   38                 $this->server_path = $this->ilias->getSetting(
"ilinc_path");
 
   39                 $this->server_port      = $this->ilias->getSetting(
"ilinc_port");
 
   40                 $this->server_timeout   = $this->ilias->getSetting(
"ilinc_timeout");
 
   41                 $this->user_max_strlen = 32; 
 
   52                 $this->server_addr = $a_server_addr;
 
   57                 return $this->server_addr;
 
   62                 return $this->server_port;
 
   67                 return $this->server_timeout;
 
   77                 return $this->server_scheme;
 
   82                 return $this->customer_id;
 
   87                 $this->request = $a_data;
 
  100                 $header = 
"Host: ".$this->getServerAddr().
"\r\n";
 
  101                 $header .= 
"User-Agent: ILIAS open source\r\n";
 
  102                 $header .= 
"Content-Type: text/xml\r\n";
 
  103                 $header .= 
"Content-Length: ".strlen($this->request).
"\r\n";
 
  104                 $header .= 
"Connection: close\r\n\r\n";
 
  121                         $ilErr->raiseError($lng->txt(
'ilinc_connection_error'),$ilErr->MESSAGE);
 
  125                 fputs($sock, 
"POST ".$this->
getServerPath().
" HTTP/1.0\r\n");
 
  126                 fputs($sock,$header.$this->request);
 
  133                         $response .= @fgets($sock, 128);
 
  141                 return $response_obj;
 
  152         function addUserOLD(&$a_login_data,&$a_user_obj,$a_authority = 
"leader")
 
  160                 $attr[
'user'] = $this->reg_login;
 
  161                 $attr[
'password'] = $this->reg_passwd;
 
  162                 $attr[
'customerid'] = $this->customer_id;
 
  164                 $attr[
'command'] = 
"Add";
 
  165                 $attr[
'object'] = 
"User";
 
  170                 $attr[
'loginname'] = $a_login_data[
"login"]; 
 
  171                 $attr[
'fullname'] = $a_user_obj->getFullname($this->user_max_strlen); 
 
  172                 $attr[
'password'] = $a_login_data[
"passwd"]; 
 
  173                 $attr[
'authority'] = $a_authority; 
 
  174                 $attr[
'email'] = $a_user_obj->getEmail(); 
 
  175                 $attr[
'homepage'] = 
""; 
 
  176                 $attr[
'contactinfo'] = $a_user_obj->getInstitution(); 
 
  177                 $attr[
'comments'] = $a_user_obj->getComment(); 
 
  178                 $attr[
'phonenumber'] = $a_user_obj->getPhoneOffice(); 
 
  179                 $attr[
'akuservalue1'] = 
""; 
 
  180                 $attr[
'akuservalue2'] = 
""; 
 
  185                 $this->
xmlEndTag(
'netucate.API.Request');
 
  196         function addUser(&$a_ilinc_user_obj,$a_authority = 
"leader")
 
  204                 $attr[
'user'] = $this->reg_login;
 
  205                 $attr[
'password'] = $this->reg_passwd;
 
  206                 $attr[
'customerid'] = $this->customer_id;
 
  208                 $attr[
'command'] = 
"Add";
 
  209                 $attr[
'object'] = 
"User";
 
  214                 $attr[
'loginname'] = $a_ilinc_user_obj->login; 
 
  215                 $attr[
'fullname'] = $a_ilinc_user_obj->user->getFullname($this->user_max_strlen); 
 
  216                 $attr[
'password'] = $a_ilinc_user_obj->passwd; 
 
  217                 $attr[
'authority'] = $a_authority; 
 
  218                 $attr[
'email'] = $a_ilinc_user_obj->user->getEmail(); 
 
  219                 $attr[
'homepage'] = 
""; 
 
  220                 $attr[
'contactinfo'] = $a_ilinc_user_obj->user->getInstitution(); 
 
  221                 $attr[
'comments'] = $a_ilinc_user_obj->user->getComment(); 
 
  222                 $attr[
'phonenumber'] = $a_ilinc_user_obj->user->getPhoneOffice(); 
 
  223                 $attr[
'akuservalue1'] = $a_ilinc_user_obj->akuservalue1; 
 
  224                 $attr[
'akuservalue2'] = $a_ilinc_user_obj->akuservalue2; 
 
  229                 $this->
xmlEndTag(
'netucate.API.Request');
 
  248                 $attr[
'user'] = $this->reg_login;
 
  249                 $attr[
'password'] = $this->reg_passwd;
 
  250                 $attr[
'customerid'] = $this->customer_id;
 
  252                 $attr[
'command'] = 
"Edit";
 
  253                 $attr[
'object'] = 
"User";
 
  258                 $attr[
'userid'] = $a_ilinc_user_obj->id; 
 
  260                 $attr[
'fullname'] = $a_ilinc_user_obj->user->getFullname($this->user_max_strlen); 
 
  263                 $attr[
'email'] = $a_ilinc_user_obj->user->getEmail(); 
 
  265                 $attr[
'contactinfo'] = $a_ilinc_user_obj->user->getInstitution(); 
 
  266                 $attr[
'comments'] = $a_ilinc_user_obj->user->getComment(); 
 
  267                 $attr[
'phonenumber'] = $a_ilinc_user_obj->user->getPhoneOffice(); 
 
  268                 $attr[
'akuservalue1'] = $a_ilinc_user_obj->akuservalue1; 
 
  269                 $attr[
'akuservalue2'] = $a_ilinc_user_obj->akuservalue2; 
 
  274                 $this->
xmlEndTag(
'netucate.API.Request');
 
  285                 $attr[
'user'] = $this->reg_login;
 
  286                 $attr[
'password'] = $this->reg_passwd;
 
  287                 $attr[
'customerid'] = $this->customer_id;
 
  289                 $attr[
'command'] = 
"Register";
 
  290                 $attr[
'object'] = 
"User";
 
  295                 $attr[
'courseid'] = $a_ilinc_course_id;
 
  300                 foreach ($a_ilinc_user_arr as 
$user)
 
  303                         $attr[
'userid'] = $user[
'id'];
 
  304                         $attr[
'instructorflag'] = $user[
'instructor'];
 
  313                 $this->
xmlEndTag(
'netucate.API.Request');
 
  325                 $attr[
'user'] = $this->reg_login;
 
  326                 $attr[
'password'] = $this->reg_passwd;
 
  327                 $attr[
'customerid'] = $this->customer_id;
 
  329                 $attr[
'command'] = 
"Find";
 
  330                 $attr[
'object'] = 
"RegisteredUsersByRole";
 
  335                 $attr[
'courseid'] = $a_ilinc_course_id;
 
  336                 $attr[
'instructorflag'] = ($a_instructorflag) ? 
"True" : 
"False";
 
  341                 $this->
xmlEndTag(
'netucate.API.Request');
 
  352                 $attr[
'user'] = $this->reg_login;
 
  353                 $attr[
'password'] = $this->reg_passwd;
 
  354                 $attr[
'customerid'] = $this->customer_id;
 
  356                 $attr[
'command'] = 
"UnRegister";
 
  357                 $attr[
'object'] = 
"User";
 
  362                 $attr[
'courseid'] = $a_ilinc_course_id;
 
  367                 foreach ($a_ilinc_user_ids as $user_id)
 
  370                         $attr[
'userid'] = $user_id;
 
  379                 $this->
xmlEndTag(
'netucate.API.Request');
 
  391                 $attr[
'user'] = $this->reg_login;
 
  392                 $attr[
'password'] = $this->reg_passwd;
 
  393                 $attr[
'customerid'] = $this->customer_id;
 
  395                 $attr[
'command'] = 
"Find";
 
  396                 $attr[
'object'] = 
"User";
 
  401                 $attr[
'userid'] = $a_id;
 
  402                 $attr[
'loginname'] = $a_login;
 
  403                 $attr[
'fullname'] = $a_fullname;
 
  404                 $attr[
'lotnumber'] = 
"0"; 
 
  408                 $this->
xmlEndTag(
'netucate.API.Request');
 
  420                 $attr[
'user'] = $this->reg_login;
 
  421                 $attr[
'password'] = $this->reg_passwd;
 
  422                 $attr[
'customerid'] = $this->customer_id;
 
  424                 $attr[
'command'] = 
"Remove";
 
  425                 $attr[
'object'] = 
"User";
 
  432                 $attr[
'userid'] = 
"2191";
 
  433                 $attr[
'instructorflag'] = 
"True";
 
  438                 $attr[
'userid'] = 
"2192";
 
  439                 $attr[
'loginname'] = 
"ffuss";
 
  445                 $this->
xmlEndTag(
'netucate.API.Request');
 
  456                 $attr[
'user'] = $this->reg_login;
 
  457                 $attr[
'password'] = $this->reg_passwd;
 
  458                 $attr[
'customerid'] = $this->customer_id;
 
  460                 $attr[
'command'] = 
"Add";
 
  461                 $attr[
'object'] = 
"Class";
 
  466                 $attr[
'courseid'] = $a_course_id;
 
  467                 $attr[
'name'] = $a_data[
'title'];
 
  468                 $attr[
'instructoruserid'] = $a_data[
'instructoruserid'];
 
  469                 $attr[
'description'] = $a_data[
'desc'];
 
  470                 $attr[
'alwaysopen'] = $a_data[
'alwaysopen'];
 
  483                 if (array_key_exists(
'akclassvalue1',$a_data))
 
  485                         $attr[
'akclassvalue1'] = $a_data[
'akclassvalue1'];
 
  487                 if (array_key_exists(
'akclassvalue2',$a_data))
 
  489                         $attr[
'akclassvalue2'] = $a_data[
'akclassvalue2'];
 
  495                 $this->
xmlEndTag(
'netucate.API.Request');
 
  508                 $attr[
'user'] = $this->reg_login;
 
  509                 $attr[
'password'] = $this->reg_passwd;
 
  510                 $attr[
'customerid'] = $this->customer_id;
 
  512                 $attr[
'command'] = 
"Edit";
 
  513                 $attr[
'object'] = 
"Class";
 
  518                 $attr[
'classid'] = $a_class_id;
 
  519                 $attr[
'name'] = $a_data[
'name'];
 
  520                 $attr[
'instructoruserid'] = $a_data[
'instructoruserid'];
 
  521                 $attr[
'description'] = $a_data[
'description'];
 
  522                 $attr[
'alwaysopen'] = $a_data[
'alwaysopen'];
 
  535                 if (array_key_exists(
'akclassvalue1',$a_data))
 
  537                         $attr[
'akclassvalue1'] = $a_data[
'akclassvalue1'];
 
  539                 if (array_key_exists(
'akclassvalue2',$a_data))
 
  541                         $attr[
'akclassvalue2'] = $a_data[
'akclassvalue2'];
 
  547                 $this->
xmlEndTag(
'netucate.API.Request');
 
  552         function joinClass(&$a_ilinc_user_obj,$a_ilinc_class_id)
 
  560                 $attr[
'user'] = $a_ilinc_user_obj->login;
 
  561                 $attr[
'password'] = $a_ilinc_user_obj->passwd;
 
  562                 $attr[
'customerid'] = $this->customer_id;
 
  564                 $attr[
'task'] = 
"JoinClass";
 
  565                 $attr[
'classid'] = $a_ilinc_class_id;
 
  569                 $this->
xmlEndTag(
'netucate.API.Request');
 
  580                 $attr[
'user'] = $a_ilinc_user_obj->login;
 
  581                 $attr[
'password'] = $a_ilinc_user_obj->passwd;
 
  582                 $attr[
'customerid'] = $this->customer_id;
 
  584                 $attr[
'locale'] = $a_ilinc_user_obj->user->getLanguage();
 
  585                 $attr[
'task'] = 
"UserLogin";
 
  589                 $this->
xmlEndTag(
'netucate.API.Request');
 
  599                 $attr[
'user'] = $a_ilinc_user_obj->login;
 
  600                 $attr[
'password'] = $a_ilinc_user_obj->passwd;
 
  601                 $attr[
'customerid'] = $this->customer_id;
 
  603                 $attr[
'locale'] = $a_ilinc_user_obj->user->getLanguage();
 
  604                 $attr[
'task'] = 
"UploadPicture";
 
  608                 $this->
xmlEndTag(
'netucate.API.Request');
 
  619                 $attr[
'user'] = $this->reg_login;
 
  620                 $attr[
'password'] = $this->reg_passwd;
 
  621                 $attr[
'customerid'] = $this->customer_id;
 
  623                 $attr[
'command'] = 
"Remove";
 
  624                 $attr[
'object'] = 
"Class";
 
  631                 $attr[
'classid'] = $a_icla_id;
 
  637                 $this->
xmlEndTag(
'netucate.API.Request');
 
  648                 $attr[
'user'] = $this->reg_login;
 
  649                 $attr[
'password'] = $this->reg_passwd;
 
  650                 $attr[
'customerid'] = $this->customer_id;
 
  652                 $attr[
'command'] = 
"Find";
 
  653                 $attr[
'object'] = 
"CourseClasses";
 
  658                 $attr[
'courseid'] = $a_icrs_id;
 
  662                 $this->
xmlEndTag(
'netucate.API.Request');
 
  673                 $attr[
'user'] = $this->reg_login;
 
  674                 $attr[
'password'] = $this->reg_passwd;
 
  675                 $attr[
'customerid'] = $this->customer_id;
 
  677                 $attr[
'command'] = 
"Find";
 
  678                 $attr[
'object'] = 
"Class";
 
  683                 $attr[
'classid'] = $a_class_id;
 
  687                 $this->
xmlEndTag(
'netucate.API.Request');
 
  698                 $attr[
'user'] = $this->reg_login;
 
  699                 $attr[
'password'] = $this->reg_passwd;
 
  700                 $attr[
'customerid'] = $this->customer_id;
 
  702                 $attr[
'command'] = 
"Add";
 
  703                 $attr[
'object'] = 
"Course";
 
  708                 $attr[
'name'] = $a_icrs_arr[
'title'];
 
  709                 $attr[
'homepage'] = $a_icrs_arr[
'homepage']; 
 
  710                 $attr[
'download'] = $a_icrs_arr[
'download']; 
 
  711                 $attr[
'description'] = $a_icrs_arr[
'desc']; 
 
  715                 $this->
xmlEndTag(
'netucate.API.Request');
 
  726                 $attr[
'user'] = $this->reg_login;
 
  727                 $attr[
'password'] = $this->reg_passwd;
 
  728                 $attr[
'customerid'] = $this->customer_id;
 
  730                 $attr[
'command'] = 
"Edit";
 
  731                 $attr[
'object'] = 
"Course";
 
  737                 $attr[
'courseid'] = $a_icrs_id; 
 
  738                 $attr[
'name'] = $a_icrs_arr[
'title']; 
 
  739                 $attr[
'homepage'] = $a_icrs_arr[
'homepage']; 
 
  740                 $attr[
'download'] = $a_icrs_arr[
'download']; 
 
  741                 $attr[
'description'] = $a_icrs_arr[
'desc']; 
 
  745                 $this->
xmlEndTag(
'netucate.API.Request');
 
  756                 $attr[
'user'] = $this->reg_login;
 
  757                 $attr[
'password'] = $this->reg_passwd;
 
  758                 $attr[
'customerid'] = $this->customer_id;
 
  760                 $attr[
'command'] = 
"Remove";
 
  761                 $attr[
'object'] = 
"Course";
 
  768                 $attr[
'courseid'] = $a_icrs_id;
 
  779                 $this->
xmlEndTag(
'netucate.Course.List');
 
  781                 $this->
xmlEndTag(
'netucate.API.Request');