ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilnetucateXMLAPI.php
Go to the documentation of this file.
1 <?php
2 
3 require_once "./Modules/ILinc/classes/class.ilnetucateResponse.php";
4 require_once "./Services/Xml/classes/class.ilXmlWriter.php";
5 
16 {
21  function ilnetucateXMLAPI()
22  {
23  global $ilias;
24 
25  define('ILINC_MEMBER_NOTSET','ilinc_notset');
26  define('ILINC_MEMBER_DOCENT','ilinc_docent');
27  define('ILINC_MEMBER_STUDENT','ilinc_student');
28 
30 
31  $this->ilias =& $ilias;
32 
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; // Max string length of full username (title + firstname + lastname)
42 
43  }
44 
45  function xmlFormatData($a_data)
46  {
47  return $a_data;
48  }
49 
50  function setServerAddr($a_server_addr)
51  {
52  $this->server_addr = $a_server_addr;
53  }
54 
55  function getServerAddr()
56  {
57  return $this->server_addr;
58  }
59 
60  function getServerPort()
61  {
62  return $this->server_port;
63  }
64 
65  function getServerTimeOut()
66  {
67  return $this->server_timeout;
68  }
69 
70  function getServerPath()
71  {
72  return $this->server_path;
73  }
74 
75  function getServerScheme()
76  {
77  return $this->server_scheme;
78  }
79 
80  function getCustomerID()
81  {
82  return $this->customer_id;
83  }
84 
85  function setRequest($a_data)
86  {
87  $this->request = $a_data;
88  }
89 
90  // send request to iLinc server
91  // returns true if request was successfully sent (a response returned)
92  function sendRequest($a_request = '')
93  {
94  global $ilErr,$lng;
95 
96  // get request xml data
97  $this->request = $this->xmlDumpMem();
98 
99  // compose request header
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";
105 
106  // determine protocol
107  if ($this->getServerScheme() == "https")
108  {
109  $scheme = "ssl";
110  }
111  else
112  {
113  $scheme = "http";
114  }
115 
116  // open socket connection to server
117  $sock = @fsockopen($scheme."://".$this->getServerAddr(), $this->getServerPort(), $errno, $errstr, $this->getServerTimeOut());
118 
119  if (!$sock)
120  {
121  $ilErr->raiseError($lng->txt('ilinc_connection_error'),$ilErr->MESSAGE);
122  }
123 
124  // send request
125  fputs($sock, "POST ".$this->getServerPath()." HTTP/1.0\r\n");
126  fputs($sock,$header.$this->request);
127 
128  $response = "";
129 
130  // read response data and surpress error from buggy IIS software (missing 'close_notify' cause fatal error)
131  while (!feof($sock))
132  {
133  $response .= @fgets($sock, 128);
134  }
135 
136  fclose($sock);
137 
138  // return netucate response object
139  $response_obj = new ilnetucateResponse($response);
140 
141  return $response_obj;
142  }
143 
152  function addUserOLD(&$a_login_data,&$a_user_obj,$a_authority = "leader")
153  {
154  $this->xmlClear();
155  $this->xmlHeader();
156 
157  $this->xmlStartTag('netucate.API.Request');
158 
159  $attr = array();
160  $attr['user'] = $this->reg_login;
161  $attr['password'] = $this->reg_passwd;
162  $attr['customerid'] = $this->customer_id;
163  $attr['id'] = "";
164  $attr['command'] = "Add";
165  $attr['object'] = "User";
166  $this->xmlStartTag('netucate.Command',$attr);
167  $this->xmlEndTag('netucate.Command');
168 
169  $attr = array();
170  $attr['loginname'] = $a_login_data["login"]; // required; max 64 chars
171  $attr['fullname'] = $a_user_obj->getFullname($this->user_max_strlen); // required; max 32 chars
172  $attr['password'] = $a_login_data["passwd"]; // required; max 127 chars
173  $attr['authority'] = $a_authority; // optional; participant or leader, Default: leader
174  $attr['email'] = $a_user_obj->getEmail(); // optional; max 64 chars
175  $attr['homepage'] = ""; // no standard in ILIAS; optional; max 255 chars
176  $attr['contactinfo'] = $a_user_obj->getInstitution(); // optional; max 64 chars
177  $attr['comments'] = $a_user_obj->getComment(); // no standard in ILIAS; optional; max 64 chars
178  $attr['phonenumber'] = $a_user_obj->getPhoneOffice(); // optional; max 32 chars
179  $attr['akuservalue1'] = ""; // optional; max 64 chars
180  $attr['akuservalue2'] = ""; // optional; max 64 chars
181 
182  $this->xmlStartTag('netucate.User',$attr);
183  $this->xmlEndTag('netucate.User');
184 
185  $this->xmlEndTag('netucate.API.Request');
186  }
187 
196  function addUser(&$a_ilinc_user_obj,$a_authority = "leader")
197  {
198  $this->xmlClear();
199  $this->xmlHeader();
200 
201  $this->xmlStartTag('netucate.API.Request');
202 
203  $attr = array();
204  $attr['user'] = $this->reg_login;
205  $attr['password'] = $this->reg_passwd;
206  $attr['customerid'] = $this->customer_id;
207  $attr['id'] = "";
208  $attr['command'] = "Add";
209  $attr['object'] = "User";
210  $this->xmlStartTag('netucate.Command',$attr);
211  $this->xmlEndTag('netucate.Command');
212 
213  $attr = array();
214  $attr['loginname'] = $a_ilinc_user_obj->login; // required; max 64 chars
215  $attr['fullname'] = $a_ilinc_user_obj->user->getFullname($this->user_max_strlen); // required; max 32 chars
216  $attr['password'] = $a_ilinc_user_obj->passwd; // required; max 127 chars
217  $attr['authority'] = $a_authority; // optional; participant or leader, Default: leader
218  $attr['email'] = $a_ilinc_user_obj->user->getEmail(); // optional; max 64 chars
219  $attr['homepage'] = ""; // no standard in ILIAS; optional; max 255 chars
220  $attr['contactinfo'] = $a_ilinc_user_obj->user->getInstitution(); // optional; max 64 chars
221  $attr['comments'] = $a_ilinc_user_obj->user->getComment(); // no standard in ILIAS; optional; max 64 chars
222  $attr['phonenumber'] = $a_ilinc_user_obj->user->getPhoneOffice(); // optional; max 32 chars
223  $attr['akuservalue1'] = $a_ilinc_user_obj->akuservalue1; // optional; max 64 chars
224  $attr['akuservalue2'] = $a_ilinc_user_obj->akuservalue2; // optional; max 64 chars
225 
226  $this->xmlStartTag('netucate.User',$attr);
227  $this->xmlEndTag('netucate.User');
228 
229  $this->xmlEndTag('netucate.API.Request');
230  }
231 
240  function editUser(&$a_ilinc_user_obj)
241  {
242  $this->xmlClear();
243  $this->xmlHeader();
244 
245  $this->xmlStartTag('netucate.API.Request');
246 
247  $attr = array();
248  $attr['user'] = $this->reg_login;
249  $attr['password'] = $this->reg_passwd;
250  $attr['customerid'] = $this->customer_id;
251  $attr['id'] = "";
252  $attr['command'] = "Edit";
253  $attr['object'] = "User";
254  $this->xmlStartTag('netucate.Command',$attr);
255  $this->xmlEndTag('netucate.Command');
256 
257  $attr = array();
258  $attr['userid'] = $a_ilinc_user_obj->id; // required;
259  //$attr['loginname'] = $a_ilinc_user_obj->login; // required; max 64 chars
260  $attr['fullname'] = $a_ilinc_user_obj->user->getFullname($this->user_max_strlen); // required; max 32 chars
261  //$attr['password'] = $a_ilinc_user_obj->passwd; // required; max 127 chars
262  //$attr['authority'] = $a_authority; // optional; participant or leader, Default: leader
263  $attr['email'] = $a_ilinc_user_obj->user->getEmail(); // optional; max 64 chars
264  //$attr['homepage'] = ""; // no standard in ILIAS; optional; max 255 chars
265  $attr['contactinfo'] = $a_ilinc_user_obj->user->getInstitution(); // optional; max 64 chars
266  $attr['comments'] = $a_ilinc_user_obj->user->getComment(); // no standard in ILIAS; optional; max 64 chars
267  $attr['phonenumber'] = $a_ilinc_user_obj->user->getPhoneOffice(); // optional; max 32 chars
268  $attr['akuservalue1'] = $a_ilinc_user_obj->akuservalue1; // optional; max 64 chars
269  $attr['akuservalue2'] = $a_ilinc_user_obj->akuservalue2; // optional; max 64 chars
270 
271  $this->xmlStartTag('netucate.User',$attr);
272  $this->xmlEndTag('netucate.User');
273 
274  $this->xmlEndTag('netucate.API.Request');
275  }
276 
277  function registerUser($a_ilinc_course_id,$a_ilinc_user_arr)
278  {
279  $this->xmlClear();
280  $this->xmlHeader();
281 
282  $this->xmlStartTag('netucate.API.Request');
283 
284  $attr = array();
285  $attr['user'] = $this->reg_login;
286  $attr['password'] = $this->reg_passwd;
287  $attr['customerid'] = $this->customer_id;
288  $attr['id'] = "";
289  $attr['command'] = "Register";
290  $attr['object'] = "User";
291  $this->xmlStartTag('netucate.Command',$attr);
292  $this->xmlEndTag('netucate.Command');
293 
294  $attr = array();
295  $attr['courseid'] = $a_ilinc_course_id;
296  $this->xmlStartTag('netucate.Course',$attr);
297 
298  $this->xmlStartTag('netucate.User.List');
299 
300  foreach ($a_ilinc_user_arr as $user)
301  {
302  $attr = array();
303  $attr['userid'] = $user['id'];
304  $attr['instructorflag'] = $user['instructor'];
305  $this->xmlStartTag('netucate.User',$attr);
306  $this->xmlEndTag('netucate.User');
307  }
308 
309  $this->xmlEndTag('netucate.User.List');
310 
311  $this->xmlEndTag('netucate.Course');
312 
313  $this->xmlEndTag('netucate.API.Request');
314  //var_dump($a_ilinc_user_arr,$this->xmlDumpMem());exit;
315  }
316 
317  function findRegisteredUsersByRole($a_ilinc_course_id,$a_instructorflag = false)
318  {
319  $this->xmlClear();
320  $this->xmlHeader();
321 
322  $this->xmlStartTag('netucate.API.Request');
323 
324  $attr = array();
325  $attr['user'] = $this->reg_login;
326  $attr['password'] = $this->reg_passwd;
327  $attr['customerid'] = $this->customer_id;
328  $attr['id'] = "";
329  $attr['command'] = "Find";
330  $attr['object'] = "RegisteredUsersByRole";
331  $this->xmlStartTag('netucate.Command',$attr);
332  $this->xmlEndTag('netucate.Command');
333 
334  $attr = array();
335  $attr['courseid'] = $a_ilinc_course_id;
336  $attr['instructorflag'] = ($a_instructorflag) ? "True" : "False";
337  $this->xmlStartTag('netucate.Course',$attr);
338 
339  $this->xmlEndTag('netucate.Course');
340 
341  $this->xmlEndTag('netucate.API.Request');
342  }
343 
344  function unregisterUser($a_ilinc_course_id, $a_ilinc_user_ids)
345  {
346  $this->xmlClear();
347  $this->xmlHeader();
348 
349  $this->xmlStartTag('netucate.API.Request');
350 
351  $attr = array();
352  $attr['user'] = $this->reg_login;
353  $attr['password'] = $this->reg_passwd;
354  $attr['customerid'] = $this->customer_id;
355  $attr['id'] = "";
356  $attr['command'] = "UnRegister";
357  $attr['object'] = "User";
358  $this->xmlStartTag('netucate.Command',$attr);
359  $this->xmlEndTag('netucate.Command');
360 
361  $attr = array();
362  $attr['courseid'] = $a_ilinc_course_id;
363  $this->xmlStartTag('netucate.Course',$attr);
364 
365  $this->xmlStartTag('netucate.User.List');
366 
367  foreach ($a_ilinc_user_ids as $user_id)
368  {
369  $attr = array();
370  $attr['userid'] = $user_id;
371  $this->xmlStartTag('netucate.User',$attr);
372  $this->xmlEndTag('netucate.User');
373  }
374 
375  $this->xmlEndTag('netucate.User.List');
376 
377  $this->xmlEndTag('netucate.Course');
378 
379  $this->xmlEndTag('netucate.API.Request');
380  }
381 
382  // not used yet
383  function findUser(&$a_id,&$a_login,&$a_fullname)
384  {
385  $this->xmlClear();
386  $this->xmlHeader();
387 
388  $this->xmlStartTag('netucate.API.Request');
389 
390  $attr = array();
391  $attr['user'] = $this->reg_login;
392  $attr['password'] = $this->reg_passwd;
393  $attr['customerid'] = $this->customer_id;
394  $attr['id'] = "";
395  $attr['command'] = "Find";
396  $attr['object'] = "User";
397  $this->xmlStartTag('netucate.Command',$attr);
398  $this->xmlEndTag('netucate.Command');
399 
400  $attr = array();
401  $attr['userid'] = $a_id;
402  $attr['loginname'] = $a_login;
403  $attr['fullname'] = $a_fullname;
404  $attr['lotnumber'] = "0"; // optional; The set of matching records to return. If 0, all matching records will be returned. If 1, matches 1-25 will be returned. If 2, matches 26-50 will be returned, etc.; Default: 0
405  $this->xmlStartTag('netucate.User',$attr);
406  $this->xmlEndTag('netucate.User');
407 
408  $this->xmlEndTag('netucate.API.Request');
409  }
410 
411  // not used yet
412  function removeUser(&$a_user_obj)
413  {
414  $this->xmlClear();
415  $this->xmlHeader();
416 
417  $this->xmlStartTag('netucate.API.Request');
418 
419  $attr = array();
420  $attr['user'] = $this->reg_login;
421  $attr['password'] = $this->reg_passwd;
422  $attr['customerid'] = $this->customer_id;
423  $attr['id'] = "";
424  $attr['command'] = "Remove";
425  $attr['object'] = "User";
426  $this->xmlStartTag('netucate.Command',$attr);
427  $this->xmlEndTag('netucate.Command');
428 
429  $this->xmlStartTag('netucate.User.List');
430 
431  $attr = array();
432  $attr['userid'] = "2191";
433  $attr['instructorflag'] = "True";
434  $this->xmlStartTag('netucate.User',$attr);
435  $this->xmlEndTag('netucate.User');
436 
437  $attr = array();
438  $attr['userid'] = "2192";
439  $attr['loginname'] = "ffuss";
440  $this->xmlStartTag('netucate.User',$attr); // userid or loginname per User are required.
441  $this->xmlEndTag('netucate.User');
442 
443  $this->xmlEndTag('netucate.User.List');
444 
445  $this->xmlEndTag('netucate.API.Request');
446  }
447 
448  function addClass($a_course_id,$a_data)
449  {
450  $this->xmlClear();
451  $this->xmlHeader();
452 
453  $this->xmlStartTag('netucate.API.Request');
454 
455  $attr = array();
456  $attr['user'] = $this->reg_login;
457  $attr['password'] = $this->reg_passwd;
458  $attr['customerid'] = $this->customer_id;
459  $attr['id'] = "";
460  $attr['command'] = "Add";
461  $attr['object'] = "Class";
462  $this->xmlStartTag('netucate.Command',$attr);
463  $this->xmlEndTag('netucate.Command');
464 
465  $attr = array();
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'];
471  //$attr['password'] = $a_data['password'];
472  //$attr['bandwidth'] = $a_data['bandwidth'];
473  //$attr['appsharebandwidth'] = $a_data['appsharebandwidth'];
474  //$attr['message'] = $a_data['message'];
475  //$attr['floorpolicy'] = $a_data['floorpolicy'];
476  //$attr['conferencetypeid'] = $a_data['conferencetypeid'];
477  //$attr['videobandwidth'] = $a_data['videobandwidth'];
478  //$attr['videoframerate'] = $a_data['videoframerate'];
479  //$attr['enablepush'] = $a_data['enablepush'];
480  //$attr['issecure'] = $a_data['issecure'];
481 
482  // only update akclassvalues if akclassvalues are enabled
483  if (array_key_exists('akclassvalue1',$a_data))
484  {
485  $attr['akclassvalue1'] = $a_data['akclassvalue1'];
486  }
487  if (array_key_exists('akclassvalue2',$a_data))
488  {
489  $attr['akclassvalue2'] = $a_data['akclassvalue2'];
490  }
491 
492  $this->xmlStartTag('netucate.Class',$attr);
493  $this->xmlEndTag('netucate.Class');
494 
495  $this->xmlEndTag('netucate.API.Request');
496 
497  //var_dump($this->xmlDumpMem());exit;
498  }
499 
500  function editClass($a_class_id,$a_data)
501  {
502  $this->xmlClear();
503  $this->xmlHeader();
504 
505  $this->xmlStartTag('netucate.API.Request');
506 
507  $attr = array();
508  $attr['user'] = $this->reg_login;
509  $attr['password'] = $this->reg_passwd;
510  $attr['customerid'] = $this->customer_id;
511  $attr['id'] = "";
512  $attr['command'] = "Edit";
513  $attr['object'] = "Class";
514  $this->xmlStartTag('netucate.Command',$attr);
515  $this->xmlEndTag('netucate.Command');
516 
517  $attr = array();
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'];
523  //$attr['password'] = $a_data['password'];
524  //$attr['message'] = $a_data['message'];
525  //$attr['appsharebandwidth'] = $a_data['appsharebandwidth'];
526  //$attr['bandwidth'] = $a_data['bandwidth'];
527  //$attr['floorpolicy'] = $a_data['floorpolicy'];
528  //$attr['conferencetypeid'] = $a_data['conferencetypeid'];
529  //$attr['videobandwidth'] = $a_data['videobandwidth'];
530  //$attr['videoframerate'] = $a_data['videoframerate'];
531  //$attr['enablepush'] = $a_data['enablepush'];
532  //$attr['issecure'] = $a_data['issecure'];
533 
534  // only update akclassvalues if akclassvalues are enabled
535  if (array_key_exists('akclassvalue1',$a_data))
536  {
537  $attr['akclassvalue1'] = $a_data['akclassvalue1'];
538  }
539  if (array_key_exists('akclassvalue2',$a_data))
540  {
541  $attr['akclassvalue2'] = $a_data['akclassvalue2'];
542  }
543 
544  $this->xmlStartTag('netucate.Class',$attr);
545  $this->xmlEndTag('netucate.Class');
546 
547  $this->xmlEndTag('netucate.API.Request');
548 
549  //var_dump($this->xmlDumpMem());exit;
550  }
551 
552  function joinClass(&$a_ilinc_user_obj,$a_ilinc_class_id)
553  {
554  $this->xmlClear();
555  $this->xmlHeader();
556 
557  $this->xmlStartTag('netucate.API.Request');
558 
559  $attr = array();
560  $attr['user'] = $a_ilinc_user_obj->login;
561  $attr['password'] = $a_ilinc_user_obj->passwd;
562  $attr['customerid'] = $this->customer_id;
563  $attr['id'] = "";
564  $attr['task'] = "JoinClass";
565  $attr['classid'] = $a_ilinc_class_id;
566  $this->xmlStartTag('netucate.Task',$attr);
567  $this->xmlEndTag('netucate.Task');
568 
569  $this->xmlEndTag('netucate.API.Request');
570  }
571 
572  function userLogin(&$a_ilinc_user_obj)
573  {
574  $this->xmlClear();
575  $this->xmlHeader();
576 
577  $this->xmlStartTag('netucate.API.Request');
578 
579  $attr = array();
580  $attr['user'] = $a_ilinc_user_obj->login;
581  $attr['password'] = $a_ilinc_user_obj->passwd;
582  $attr['customerid'] = $this->customer_id;
583  $attr['id'] = "";
584  $attr['locale'] = $a_ilinc_user_obj->user->getLanguage();
585  $attr['task'] = "UserLogin";
586  $this->xmlStartTag('netucate.Task',$attr);
587  $this->xmlEndTag('netucate.Task');
588 
589  $this->xmlEndTag('netucate.API.Request');
590  }
591 
592  function uploadPicture(&$a_ilinc_user_obj)
593  {
594  $this->xmlHeader();
595 
596  $this->xmlStartTag('netucate.API.Request');
597 
598  $attr = array();
599  $attr['user'] = $a_ilinc_user_obj->login;
600  $attr['password'] = $a_ilinc_user_obj->passwd;
601  $attr['customerid'] = $this->customer_id;
602  $attr['id'] = "";
603  $attr['locale'] = $a_ilinc_user_obj->user->getLanguage();
604  $attr['task'] = "UploadPicture";
605  $this->xmlStartTag('netucate.Task',$attr);
606  $this->xmlEndTag('netucate.Task');
607 
608  $this->xmlEndTag('netucate.API.Request');
609  }
610 
611  function removeClass($a_icla_id)
612  {
613  $this->xmlClear();
614  $this->xmlHeader();
615 
616  $this->xmlStartTag('netucate.API.Request');
617 
618  $attr = array();
619  $attr['user'] = $this->reg_login;
620  $attr['password'] = $this->reg_passwd;
621  $attr['customerid'] = $this->customer_id;
622  $attr['id'] = "";
623  $attr['command'] = "Remove";
624  $attr['object'] = "Class";
625  $this->xmlStartTag('netucate.Command',$attr);
626  $this->xmlEndTag('netucate.Command');
627 
628  $this->xmlStartTag('netucate.Class.List');
629 
630  $attr = array();
631  $attr['classid'] = $a_icla_id;
632  $this->xmlStartTag('netucate.Class',$attr);
633  $this->xmlEndTag('netucate.Class');
634 
635  $this->xmlEndTag('netucate.Class.List');
636 
637  $this->xmlEndTag('netucate.API.Request');
638  }
639 
640  function findCourseClasses($a_icrs_id)
641  {
642  $this->xmlClear();
643  $this->xmlHeader();
644 
645  $this->xmlStartTag('netucate.API.Request');
646 
647  $attr = array();
648  $attr['user'] = $this->reg_login;
649  $attr['password'] = $this->reg_passwd;
650  $attr['customerid'] = $this->customer_id;
651  $attr['id'] = "";
652  $attr['command'] = "Find";
653  $attr['object'] = "CourseClasses";
654  $this->xmlStartTag('netucate.Command',$attr);
655  $this->xmlEndTag('netucate.Command');
656 
657  $attr = array();
658  $attr['courseid'] = $a_icrs_id;
659  $this->xmlStartTag('netucate.Course',$attr);
660  $this->xmlEndTag('netucate.Course');
661 
662  $this->xmlEndTag('netucate.API.Request');
663  }
664 
665  function findClass($a_class_id)
666  {
667  $this->xmlClear();
668  $this->xmlHeader();
669 
670  $this->xmlStartTag('netucate.API.Request');
671 
672  $attr = array();
673  $attr['user'] = $this->reg_login;
674  $attr['password'] = $this->reg_passwd;
675  $attr['customerid'] = $this->customer_id;
676  $attr['id'] = "";
677  $attr['command'] = "Find";
678  $attr['object'] = "Class";
679  $this->xmlStartTag('netucate.Command',$attr);
680  $this->xmlEndTag('netucate.Command');
681 
682  $attr = array();
683  $attr['classid'] = $a_class_id;
684  $this->xmlStartTag('netucate.Class',$attr);
685  $this->xmlEndTag('netucate.Class');
686 
687  $this->xmlEndTag('netucate.API.Request');
688  }
689 
690  function addCourse(&$a_icrs_arr)
691  {
692  $this->xmlClear();
693  $this->xmlHeader();
694 
695  $this->xmlStartTag('netucate.API.Request');
696 
697  $attr = array();
698  $attr['user'] = $this->reg_login;
699  $attr['password'] = $this->reg_passwd;
700  $attr['customerid'] = $this->customer_id;
701  $attr['id'] = "";
702  $attr['command'] = "Add";
703  $attr['object'] = "Course";
704  $this->xmlStartTag('netucate.Command',$attr);
705  $this->xmlEndTag('netucate.Command');
706 
707  $attr = array();
708  $attr['name'] = $a_icrs_arr['title'];
709  $attr['homepage'] = $a_icrs_arr['homepage']; // (optional; if present and not empty, the value will be changed)
710  $attr['download'] = $a_icrs_arr['download']; // (optional; if present and not empty, the value will be changed)
711  $attr['description'] = $a_icrs_arr['desc']; // (optional; if present and not empty, the value will be changed)
712  $this->xmlStartTag('netucate.Course',$attr);
713  $this->xmlEndTag('netucate.Course');
714 
715  $this->xmlEndTag('netucate.API.Request');
716  }
717 
718  function editCourse($a_icrs_id,$a_icrs_arr)
719  {
720  $this->xmlClear();
721  $this->xmlHeader();
722 
723  $this->xmlStartTag('netucate.API.Request');
724 
725  $attr = array();
726  $attr['user'] = $this->reg_login;
727  $attr['password'] = $this->reg_passwd;
728  $attr['customerid'] = $this->customer_id;
729  $attr['id'] = "";
730  $attr['command'] = "Edit";
731  $attr['object'] = "Course";
732  $this->xmlStartTag('netucate.Command',$attr);
733  $this->xmlEndTag('netucate.Command');
734 
735  // Modifies any or all of the fields in a Course record. An empty parameter in an existing attribute (except the name) will cause the corresponding field to be cleared.
736  $attr = array();
737  $attr['courseid'] = $a_icrs_id; // (required; existing courseID)
738  $attr['name'] = $a_icrs_arr['title']; // (optional; if present and not empty, the value will be changed)
739  $attr['homepage'] = $a_icrs_arr['homepage']; // (optional; if present and not empty, the value will be changed)
740  $attr['download'] = $a_icrs_arr['download']; // (optional; if present and not empty, the value will be changed)
741  $attr['description'] = $a_icrs_arr['desc']; // (optional; if present and not empty, the value will be changed)
742  $this->xmlStartTag('netucate.Course',$attr);
743  $this->xmlEndTag('netucate.Course');
744 
745  $this->xmlEndTag('netucate.API.Request');
746  }
747 
748  function removeCourse($a_icrs_id)
749  {
750  $this->xmlClear();
751  $this->xmlHeader();
752 
753  $this->xmlStartTag('netucate.API.Request');
754 
755  $attr = array();
756  $attr['user'] = $this->reg_login;
757  $attr['password'] = $this->reg_passwd;
758  $attr['customerid'] = $this->customer_id;
759  $attr['id'] = "";
760  $attr['command'] = "Remove";
761  $attr['object'] = "Course";
762  $this->xmlStartTag('netucate.Command',$attr);
763  $this->xmlEndTag('netucate.Command');
764 
765  $this->xmlStartTag('netucate.Course.List');
766 
767  $attr = array();
768  $attr['courseid'] = $a_icrs_id;
769  $this->xmlStartTag('netucate.Class',$attr);
770  $this->xmlEndTag('netucate.Class');
771 
772  /*
773  $attr = array();
774  $attr['courseid'] = "2191";
775  $this->xmlStartTag('netucate.Course',$attr);
776  $this->xmlEndTag('netucate.Course');
777  */
778 
779  $this->xmlEndTag('netucate.Course.List');
780 
781  $this->xmlEndTag('netucate.API.Request');
782  }
783 
784 }
785 ?>