Public Member Functions

ilnetucateXMLAPI Class Reference

Inheritance diagram for ilnetucateXMLAPI:
Collaboration diagram for ilnetucateXMLAPI:

Public Member Functions

 ilnetucateXMLAPI ()
 Constructor public.
 xmlFormatData ($a_data)
 Indents text for better reading.
 setServerAddr ($a_server_addr)
 getServerAddr ()
 getServerPort ()
 getCustomerID ()
 setRequest ($a_data)
 sendRequest ($a_request= '')
 addUser (&$a_user_obj)
 registerUser ($a_ilinc_user_id, $a_ilinc_course_id, $a_instructor="False")
 unregisterUser (&$a_user_obj)
 findUser (&$a_user_obj)
 removeUser (&$a_user_obj)
 addClass ($a_icla_arr, $a_icrs_id)
 editClass (&$a_user_obj)
 joinClass (&$a_user_obj, $a_ilinc_class_id)
 removeClass ($a_icla_id)
 findCourseClasses ($a_icrs_id)
 addCourse (&$a_icrs_arr)
 editCourse (&$a_user_obj)
 removeCourse ($a_icrs_id)

Detailed Description

Definition at line 15 of file class.ilnetucateXMLAPI.php.


Member Function Documentation

ilnetucateXMLAPI::addClass ( a_icla_arr,
a_icrs_id 
)

Definition at line 291 of file class.ilnetucateXMLAPI.php.

References ilXmlWriter::xmlEndTag(), ilXmlWriter::xmlHeader(), and ilXmlWriter::xmlStartTag().

        {
                $this->xmlHeader();

                $this->xmlStartTag('netucate.API.Request');
                
                $attr = array();
                $attr['user'] = $this->login;
                $attr['password'] = $this->passwd;
                $attr['customerid'] = $this->customer_id;
                $attr['id'] = "";
                $attr['command'] = "Add";
                $attr['object'] = "Class";
                $this->xmlStartTag('netucate.Command',$attr);
                $this->xmlEndTag('netucate.Command');

                $attr = array();
                $attr['courseid'] = $a_icrs_id;
                $attr['name'] = $a_icla_arr['title'];
                $this->xmlStartTag('netucate.Class',$attr);
                $this->xmlEndTag('netucate.Class');
                
                $this->xmlEndTag('netucate.API.Request');
        }

Here is the call graph for this function:

ilnetucateXMLAPI::addCourse ( &$  a_icrs_arr  ) 

Definition at line 427 of file class.ilnetucateXMLAPI.php.

References ilXmlWriter::xmlEndTag(), ilXmlWriter::xmlHeader(), and ilXmlWriter::xmlStartTag().

        {
                $this->xmlHeader();

                $this->xmlStartTag('netucate.API.Request');
                
                $attr = array();
                $attr['user'] = $this->login;
                $attr['password'] = $this->passwd;
                $attr['customerid'] = $this->customer_id;
                $attr['id'] = "";
                $attr['command'] = "Add";
                $attr['object'] = "Course";
                $this->xmlStartTag('netucate.Command',$attr);
                $this->xmlEndTag('netucate.Command');

                $attr = array();
                $attr['name'] = $a_icrs_arr['title'];
                $attr['homepage'] = $a_icrs_arr['homepage']; // (optional; if present and not empty, the value will be changed)
                $attr['download'] = $a_icrs_arr['download']; // (optional; if present and not empty, the value will be changed)
                $attr['description'] = $a_icrs_arr['desc']; // (optional; if present and not empty, the value will be changed)
                $this->xmlStartTag('netucate.Course',$attr);
                $this->xmlEndTag('netucate.Course');
                
                $this->xmlEndTag('netucate.API.Request');
        }

Here is the call graph for this function:

ilnetucateXMLAPI::addUser ( &$  a_user_obj  ) 

Definition at line 127 of file class.ilnetucateXMLAPI.php.

References ilXmlWriter::xmlEndTag(), ilXmlWriter::xmlHeader(), and ilXmlWriter::xmlStartTag().

        {
                $this->xmlHeader();

                $this->xmlStartTag('netucate.API.Request');
                
                $attr = array();
                $attr['user'] = $this->login;
                $attr['password'] = $this->passwd;
                $attr['customerid'] = $this->customer_id;
                $attr['id'] = "";
                $attr['command'] = "Add";
                $attr['object'] = "User";
                $this->xmlStartTag('netucate.Command',$attr);
                $this->xmlEndTag('netucate.Command');

                $attr = array();
                $attr['loginname'] = $a_user_obj->getLogin();
                $attr['fullname'] = $a_user_obj->getFullname();
                $attr['password'] = $a_user_obj->getPasswd();
                $this->xmlStartTag('netucate.User',$attr);
                $this->xmlEndTag('netucate.User');
                
                $this->xmlEndTag('netucate.API.Request');
        }

Here is the call graph for this function:

ilnetucateXMLAPI::editClass ( &$  a_user_obj  ) 

Definition at line 316 of file class.ilnetucateXMLAPI.php.

References ilXmlWriter::xmlEndTag(), ilXmlWriter::xmlHeader(), and ilXmlWriter::xmlStartTag().

        {
                $this->xmlHeader();

                $this->xmlStartTag('netucate.API.Request');
                
                $attr = array();
                $attr['user'] = $this->login;
                $attr['password'] = $this->passwd;
                $attr['customerid'] = $this->customer_id;
                $attr['id'] = "";
                $attr['command'] = "Edit";
                $attr['object'] = "Class";
                $this->xmlStartTag('netucate.Command',$attr);
                $this->xmlEndTag('netucate.Command');

                $attr = array();
                $attr['classid'] = "2191";
                $attr['name'] = "New Name";
                $attr['instructoruserid'] = "";
                $attr['bandwidth'] = "";
                $attr['appsharebandwidth'] = "";
                $attr['description'] = "";
                $attr['alwaysopen'] = "";
                $attr['password'] = "";
                $attr['message'] = "";
                $attr['floorpolicy'] = "";
                $attr['conferencetypeid'] = "";
                $attr['videobandwidth'] = "";
                $attr['videoframerate'] = "";
                $attr['enablepush'] = "";
                $attr['issecure'] = "";
                $attr['akclassvalue1'] = "";
                $attr['akclassvalue2'] = "";
                $this->xmlStartTag('netucate.Class',$attr);
                $this->xmlEndTag('netucate.Class');
                
                $this->xmlEndTag('netucate.API.Request');
        }

Here is the call graph for this function:

ilnetucateXMLAPI::editCourse ( &$  a_user_obj  ) 

Definition at line 454 of file class.ilnetucateXMLAPI.php.

References ilXmlWriter::xmlEndTag(), ilXmlWriter::xmlHeader(), and ilXmlWriter::xmlStartTag().

        {
                $this->xmlHeader();

                $this->xmlStartTag('netucate.API.Request');
                
                $attr = array();
                $attr['user'] = $this->login;
                $attr['password'] = $this->passwd;
                $attr['customerid'] = $this->customer_id;
                $attr['id'] = "";
                $attr['command'] = "Edit";
                $attr['object'] = "Course";
                $this->xmlStartTag('netucate.Command',$attr);
                $this->xmlEndTag('netucate.Command');

                // 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.
                $attr = array();
                $attr['courseid'] = "2191"; // (required; existing courseID)
                $attr['name'] = "New Name"; // (optional; if present and not empty, the value will be changed)
                $attr['homepage'] = ""; // (optional; if present and not empty, the value will be changed)
                $attr['download'] = ""; // (optional; if present and not empty, the value will be changed)
                $attr['description'] = ""; // (optional; if present and not empty, the value will be changed)
                $this->xmlStartTag('netucate.Course',$attr);
                $this->xmlEndTag('netucate.Course');
                
                $this->xmlEndTag('netucate.API.Request');
        }

Here is the call graph for this function:

ilnetucateXMLAPI::findCourseClasses ( a_icrs_id  ) 

Definition at line 403 of file class.ilnetucateXMLAPI.php.

References ilXmlWriter::xmlEndTag(), ilXmlWriter::xmlHeader(), and ilXmlWriter::xmlStartTag().

        {
                $this->xmlHeader();

                $this->xmlStartTag('netucate.API.Request');
                
                $attr = array();
                $attr['user'] = $this->login;
                $attr['password'] = $this->passwd;
                $attr['customerid'] = $this->customer_id;
                $attr['id'] = "";
                $attr['command'] = "Find";
                $attr['object'] = "CourseClasses";
                $this->xmlStartTag('netucate.Command',$attr);
                $this->xmlEndTag('netucate.Command');

                $attr = array();
                $attr['courseid'] = $a_icrs_id;
                $this->xmlStartTag('netucate.Course',$attr);
                $this->xmlEndTag('netucate.Course');
                
                $this->xmlEndTag('netucate.API.Request');
        }

Here is the call graph for this function:

ilnetucateXMLAPI::findUser ( &$  a_user_obj  ) 

Definition at line 229 of file class.ilnetucateXMLAPI.php.

References ilXmlWriter::xmlEndTag(), ilXmlWriter::xmlHeader(), and ilXmlWriter::xmlStartTag().

        {
                $this->xmlHeader();

                $this->xmlStartTag('netucate.API.Request');
                
                $attr = array();
                $attr['user'] = $this->login;
                $attr['password'] = $this->passwd;
                $attr['customerid'] = $this->customer_id;
                $attr['id'] = "";
                $attr['command'] = "Find";
                $attr['object'] = "User";
                $this->xmlStartTag('netucate.Command',$attr);
                $this->xmlEndTag('netucate.Command');

                $attr = array();
                $attr['userid'] = "2191";
                $attr['loginname'] = "ffuss";
                $attr['fullname'] = "Fred Fuss";
                $attr['lotnumber'] = "1";
                $this->xmlStartTag('netucate.User',$attr);
                $this->xmlEndTag('netucate.User');
                
                $this->xmlEndTag('netucate.API.Request');
        }

Here is the call graph for this function:

ilnetucateXMLAPI::getCustomerID (  ) 

Definition at line 57 of file class.ilnetucateXMLAPI.php.

        {
                return $this->customer_id;
        }

ilnetucateXMLAPI::getServerAddr (  ) 

Definition at line 47 of file class.ilnetucateXMLAPI.php.

Referenced by sendRequest().

        {
                return $this->server_addr;
        }

Here is the caller graph for this function:

ilnetucateXMLAPI::getServerPort (  ) 

Definition at line 52 of file class.ilnetucateXMLAPI.php.

Referenced by sendRequest().

        {
                return $this->server_port;
        }

Here is the caller graph for this function:

ilnetucateXMLAPI::ilnetucateXMLAPI (  ) 

Constructor public.

Definition at line 21 of file class.ilnetucateXMLAPI.php.

References $ilias, ilXmlWriter::ilXmlWriter(), and login().

        {
                global $ilias;

                parent::ilXmlWriter();

                $this->ilias =& $ilias;

                $this->login = $this->ilias->ini->readVariable("iLinc","login");
                $this->passwd = $this->ilias->ini->readVariable("iLinc","passwd");
                $this->customer_id = $this->ilias->ini->readVariable("iLinc","customer_id");
                $this->server_addr      = $this->ilias->ini->readVariable("iLinc","server_addr");
                $this->server_port      = $this->ilias->ini->readVariable("iLinc","server_port");

        }

Here is the call graph for this function:

ilnetucateXMLAPI::joinClass ( &$  a_user_obj,
a_ilinc_class_id 
)

Definition at line 356 of file class.ilnetucateXMLAPI.php.

References ilXmlWriter::xmlEndTag(), ilXmlWriter::xmlHeader(), and ilXmlWriter::xmlStartTag().

        {
                $this->xmlHeader();

                $this->xmlStartTag('netucate.API.Request');
                
                $attr = array();
                $attr['user'] = $a_user_obj->getLogin();
                $attr['password'] = $a_user_obj->getPasswd();
                $attr['customerid'] = $this->customer_id;
                $attr['id'] = "";
                $attr['task'] = "JoinClass";
                $attr['classid'] = $a_ilinc_class_id;
                $this->xmlStartTag('netucate.Task',$attr);
                $this->xmlEndTag('netucate.Task');

                $this->xmlEndTag('netucate.API.Request');
        }

Here is the call graph for this function:

ilnetucateXMLAPI::registerUser ( a_ilinc_user_id,
a_ilinc_course_id,
a_instructor = "False" 
)

Definition at line 153 of file class.ilnetucateXMLAPI.php.

References ilXmlWriter::xmlEndTag(), ilXmlWriter::xmlHeader(), and ilXmlWriter::xmlStartTag().

        {
                $this->xmlHeader();

                $this->xmlStartTag('netucate.API.Request');
                
                $attr = array();
                $attr['user'] = $this->login;
                $attr['password'] = $this->passwd;
                $attr['customerid'] = $this->customer_id;
                $attr['id'] = "";
                $attr['command'] = "Register";
                $attr['object'] = "User";
                $this->xmlStartTag('netucate.Command',$attr);
                $this->xmlEndTag('netucate.Command');

                $attr = array();
                $attr['courseid'] = $a_ilinc_course_id;
                $this->xmlStartTag('netucate.Course',$attr);

                $this->xmlStartTag('netucate.User.List');

                $attr = array();
                $attr['userid'] = $a_ilinc_user_id;
                $attr['instructorflag'] =$a_instructor;
                $this->xmlStartTag('netucate.User',$attr);
                $this->xmlEndTag('netucate.User');
                
                $this->xmlEndTag('netucate.User.List');
                
                $this->xmlEndTag('netucate.Course');
                
                $this->xmlEndTag('netucate.API.Request');
        }

Here is the call graph for this function:

ilnetucateXMLAPI::removeClass ( a_icla_id  ) 

Definition at line 375 of file class.ilnetucateXMLAPI.php.

References ilXmlWriter::xmlEndTag(), ilXmlWriter::xmlHeader(), and ilXmlWriter::xmlStartTag().

        {
                $this->xmlHeader();

                $this->xmlStartTag('netucate.API.Request');
                
                $attr = array();
                $attr['user'] = $this->login;
                $attr['password'] = $this->passwd;
                $attr['customerid'] = $this->customer_id;
                $attr['id'] = "";
                $attr['command'] = "Remove";
                $attr['object'] = "Class";
                $this->xmlStartTag('netucate.Command',$attr);
                $this->xmlEndTag('netucate.Command');

                $this->xmlStartTag('netucate.Class.List');

                $attr = array();
                $attr['classid'] = $a_icla_id;
                $this->xmlStartTag('netucate.Class',$attr);
                $this->xmlEndTag('netucate.Class');
                
                $this->xmlEndTag('netucate.Class.List');
                
                $this->xmlEndTag('netucate.API.Request');
        }

Here is the call graph for this function:

ilnetucateXMLAPI::removeCourse ( a_icrs_id  ) 

Definition at line 483 of file class.ilnetucateXMLAPI.php.

References ilXmlWriter::xmlEndTag(), ilXmlWriter::xmlHeader(), and ilXmlWriter::xmlStartTag().

        {
                $this->xmlHeader();

                $this->xmlStartTag('netucate.API.Request');
                
                $attr = array();
                $attr['user'] = $this->login;
                $attr['password'] = $this->passwd;
                $attr['customerid'] = $this->customer_id;
                $attr['id'] = "";
                $attr['command'] = "Remove";
                $attr['object'] = "Course";
                $this->xmlStartTag('netucate.Command',$attr);
                $this->xmlEndTag('netucate.Command');

                $this->xmlStartTag('netucate.Course.List');

                $attr = array();
                $attr['courseid'] = $a_icrs_id;
                $this->xmlStartTag('netucate.Class',$attr);
                $this->xmlEndTag('netucate.Class');
                
                /*
                $attr = array();
                $attr['courseid'] = "2191";
                $this->xmlStartTag('netucate.Course',$attr);
                $this->xmlEndTag('netucate.Course');
                */

                $this->xmlEndTag('netucate.Course.List');
                
                $this->xmlEndTag('netucate.API.Request');
        }

Here is the call graph for this function:

ilnetucateXMLAPI::removeUser ( &$  a_user_obj  ) 

Definition at line 256 of file class.ilnetucateXMLAPI.php.

References ilXmlWriter::xmlEndTag(), ilXmlWriter::xmlHeader(), and ilXmlWriter::xmlStartTag().

        {
                $this->xmlHeader();

                $this->xmlStartTag('netucate.API.Request');
                
                $attr = array();
                $attr['user'] = $this->login;
                $attr['password'] = $this->passwd;
                $attr['customerid'] = $this->customer_id;
                $attr['id'] = "";
                $attr['command'] = "Remove";
                $attr['object'] = "User";
                $this->xmlStartTag('netucate.Command',$attr);
                $this->xmlEndTag('netucate.Command');

                $this->xmlStartTag('netucate.User.List');

                $attr = array();
                $attr['userid'] = "2191";
                $attr['instructorflag'] = "True";
                $this->xmlStartTag('netucate.User',$attr);
                $this->xmlEndTag('netucate.User');
                
                $attr = array();
                $attr['userid'] = "2192";
                $attr['loginname'] = "ffuss";
                $this->xmlStartTag('netucate.User',$attr); // userid or loginname per User are required.
                $this->xmlEndTag('netucate.User');
                
                $this->xmlEndTag('netucate.User.List');
                
                $this->xmlEndTag('netucate.API.Request');
        }

Here is the call graph for this function:

ilnetucateXMLAPI::sendRequest ( a_request = ''  ) 

Definition at line 69 of file class.ilnetucateXMLAPI.php.

References getServerAddr(), getServerPort(), and ilXmlWriter::xmlDumpMem().

        {
                $this->request = $this->xmlDumpMem();

                /*switch ($a_request)
                {
                        case "addClass":
                                $this->request = ereg_replace('></netucate.Class>','/>',$this->request);
                                break;
                        
                        default:
                        
                                break;
                }*/


                //var_dump($this->request);exit;
                
                $sock = fsockopen($this->getServerAddr(), $this->getServerPort(), $errno, $errstr, 30);
                if (!$sock) die("$errstr ($errno)\n");
                
                fputs($sock, "POST /campus/XMLAPI/netucateXMLAPI.asp HTTP/1.0\r\n");
                fputs($sock, "Host: ".$this->getServerAddr()."\r\n");
                fputs($sock, "Content-type: text/xml\r\n");
                fputs($sock, "Content-length: " . strlen($this->request) . "\r\n");
                fputs($sock, "Accept: */*\r\n");
                fputs($sock, "\r\n");
                fputs($sock, $this->request."\r\n");
                fputs($sock, "\r\n");
                
                $headers = "";
                
                while ($str = trim(fgets($sock, 4096)))
                {
                        $headers .= "$str\n";
                }
                
                $response = "";

                while (!feof($sock))
                {
                        $response .= fgets($sock, 4096);
                }
                
                fclose($sock);
                

                // return netucate response object
                $response_obj =  new ilnetucateResponse($response);
                
                /*if ($a_request == "registerUser")
                {
                var_dump($response,$response_obj->data);exit;
                }*/

                return $response_obj;
        }

Here is the call graph for this function:

ilnetucateXMLAPI::setRequest ( a_data  ) 

Definition at line 62 of file class.ilnetucateXMLAPI.php.

        {
                $this->request = $a_data;
        }

ilnetucateXMLAPI::setServerAddr ( a_server_addr  ) 

Definition at line 42 of file class.ilnetucateXMLAPI.php.

        {
                $this->server_addr = $a_server_addr;
        }

ilnetucateXMLAPI::unregisterUser ( &$  a_user_obj  ) 

Definition at line 188 of file class.ilnetucateXMLAPI.php.

References ilXmlWriter::xmlEndTag(), ilXmlWriter::xmlHeader(), and ilXmlWriter::xmlStartTag().

        {
                $this->xmlHeader();

                $this->xmlStartTag('netucate.API.Request');
                
                $attr = array();
                $attr['user'] = $this->login;
                $attr['password'] = $this->passwd;
                $attr['customerid'] = $this->customer_id;
                $attr['id'] = "";
                $attr['command'] = "UnRegister";
                $attr['object'] = "User";
                $this->xmlStartTag('netucate.Command',$attr);
                $this->xmlEndTag('netucate.Command');

                $attr = array();
                $attr['courseid'] = "2191";
                $this->xmlStartTag('netucate.Course',$attr);

                $this->xmlStartTag('netucate.User.List');

                $attr = array();
                $attr['userid'] = "2191";
                $attr['instructorflag'] = "True";
                $this->xmlStartTag('netucate.User',$attr);
                $this->xmlEndTag('netucate.User');
                
                $attr = array();
                $attr['userid'] = "2192";
                $attr['instructorflag'] = "False";
                $this->xmlStartTag('netucate.User',$attr);
                $this->xmlEndTag('netucate.User');
                
                $this->xmlEndTag('netucate.User.List');
                
                $this->xmlEndTag('netucate.Course');
                
                $this->xmlEndTag('netucate.API.Request');
        }

Here is the call graph for this function:

ilnetucateXMLAPI::xmlFormatData ( data  ) 

Indents text for better reading.

Parameters:
string input text
Returns:
string indented text private

Reimplemented from ilXmlWriter.

Definition at line 37 of file class.ilnetucateXMLAPI.php.

        {
                return $a_data;
        }


The documentation for this class was generated from the following file: