Public Member Functions

ilObjiLincCourse Class Reference

Inheritance diagram for ilObjiLincCourse:
Collaboration diagram for ilObjiLincCourse:

Public Member Functions

 ilObjiLincCourse ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 read ()
 private
 getiLincId ()
 getErrorMsg ()
 update ()
 update object data
 addCourse ()
 create course on iLinc server
 ilClone ($a_parent_ref)
 copy all entries of your object.
 delete ()
 delete object and all related data
 storeiLincId ($a_icrs_id)
 saveActivationStatus ($a_activated)
 initDefaultRoles ()
 init default roles settings
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event happend, each object may decide how it reacts.
 addMember (&$a_user_obj, $a_mem_role, $a_instructor=false)
 add Member to iLic course public
 join ($a_user_id, $a_mem_role="")
 join icrs, assigns user to role private
 leave ($a_user_id)
 deassign member from group role private
 getMemberRoles ($a_user_id)
 get group member status public
 getMemberIds ()
 get all group Member ids regardless of role public
 getMemberData ($a_mem_ids, $active=1)
 get all group Members regardless of group role.
 getLocalRoles ($a_translate=false)
 get ALL local roles of group, also those created and defined afterwards only fetch data once from database.
 getMemberRolesTitle ($a_user_id)
 get group member status public
 getDefaultMemberRole ()
 returns object id of created default member role public
 getDefaultAdminRole ()
 returns object id of created default adminstrator role public
 getClassrooms ()
 userExists (&$a_user_obj)
 addUser (&$a_user_obj)
 __createLoginData ($a_user_id, $a_user_login, $a_inst_id)
 creates login and password for ilinc login format is: <first 3 letter of ilias login> _ <user_id> _ <inst_id> _ <timestamp> passwd format is a random md5 hash
 isMember ($a_user_id="")
 isDocent ($a_user_obj="")
 registerUser (&$a_user_obj, $a_instructor=false)
 registerUsers ($a_user_arr)
 unregisterUser ($a_user_obj)
 unregisterUsers ($a_ilinc_user_ids)
 joinClass (&$a_user_obj, $a_ilinc_class_id)
 userLogin (&$a_user_obj)
 uploadPicture (&$a_user_obj, $a_lang)
 getAdminIds ($a_grpId="")
 get Group Admin Id public
 removeMember (&$a_user_obj)
 removes Member from group public
 isAdmin ($a_user_id)
 is Admin public
 getDefaultRoles ($a_grp_id="")
 get default group roles, returns the defaultlike create roles il_grp_member, il_grp_admin public
 getiLincMemberIds ($a_instructorflag=false)
 checkiLincMemberStatus ($a_ilinc_user_id, $a_docent_ids, $a_student_ids)
 _isActivated ($a_course_obj_id)
 _isMember ($a_user_id, $a_ref_id)

Detailed Description

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


Member Function Documentation

ilObjiLincCourse::__createLoginData ( a_user_id,
a_user_login,
a_inst_id 
)

creates login and password for ilinc login format is: <first 3 letter of ilias login> _ <user_id> _ <inst_id> _ <timestamp> passwd format is a random md5 hash

Definition at line 658 of file class.ilObjiLincCourse.php.

References $data.

Referenced by addUser().

        {
                if (!$a_inst_id)
                {
                        $a_inst_id = "0";
                }

                $data["login"] = substr($a_user_login,0,3)."_".$a_user_id."_".$a_inst_id."_".time();
                $data["passwd"] = md5(microtime().$a_user_login.rand(10000, 32000));
                
                return $data;
        }

Here is the caller graph for this function:

ilObjiLincCourse::_isActivated ( a_course_obj_id  ) 

Definition at line 1086 of file class.ilObjiLincCourse.php.

References ilObject::$ilias, $q, $row, and ilUtil::yn2tf().

Referenced by ilObjiLincCourseAccess::_checkAccess(), and ilObjiLincCourseListGUI::getProperties().

        {
                global $ilDB,$ilias;

                if (!$ilias->getSetting("ilinc_active"))
                {
                        return false;
                }
                
                $q = "SELECT activation_offline FROM ilinc_data WHERE obj_id=".$ilDB->quote($a_course_obj_id);
                $r = $ilDB->query($q);
                
                $row = $r->fetchRow(DB_FETCHMODE_OBJECT);

                return ilUtil::yn2tf($row->activation_offline);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjiLincCourse::_isMember ( a_user_id,
a_ref_id 
)

Definition at line 1103 of file class.ilObjiLincCourse.php.

References $rbacreview.

Referenced by ilObjiLincCourseAccess::_checkAccess(), and ilObjiLincClassroomAccess::_checkAccess().

        {
                global $rbacreview;
                
                $rolf = $rbacreview->getRoleFolderOfObject($a_ref_id);
                $local_roles = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"],false);
                $user_roles = $rbacreview->assignedRoles($a_user_id);
                
                if (!array_intersect($local_roles,$user_roles))
                {
                        return false;
                }
                
                return true;
        }

Here is the caller graph for this function:

ilObjiLincCourse::addCourse (  ) 

create course on iLinc server

public

Returns:
boolean

Definition at line 131 of file class.ilObjiLincCourse.php.

References $_POST.

        {
                $this->ilincAPI->addCourse($_POST["Fobject"]);
                $response = $this->ilincAPI->sendRequest();
                
                if ($response->isError())
                {
                        $this->error_msg = $response->getErrorMsg();
                        return false;
                }
                
                $this->ilinc_id = $response->getFirstID();
                
                return true;
        }

ilObjiLincCourse::addMember ( &$  a_user_obj,
a_mem_role,
a_instructor = false 
)

add Member to iLic course public

Parameters:
integer user_id
integer member role_id of local group_role
boolean register member on iLinc server as student(false) or docent(true)

Definition at line 302 of file class.ilObjiLincCourse.php.

References $rbacadmin, addUser(), join(), registerUser(), and userExists().

        {
                global $rbacadmin;
//echo "0";
                if (!isset($a_user_obj) && !isset($a_mem_role))
                {
                        $this->error_msg = get_class($this)."::addMember(): Missing parameters !";
                        return false;
                }
//echo "1";
                // check if user is registered at iLinc server
                if (!$this->userExists($a_user_obj))
                {
                        // if not, add user on iLinc server
                        if ($this->addUser($a_user_obj) == false)
                        {
                                // error_msg already set
                                return false;
                        }
                }
//echo "2";
                // assign membership to icourse on iLinc server
                if (!$this->registerUser($a_user_obj,$a_instructor))
                {
                        // error_msg already set
                        return false;
                }
//echo "3";
                // finally assign user to member role in ILIAS
                $this->join($a_user_obj->getId(),$a_mem_role);
//echo "4";
                return true;
        }

Here is the call graph for this function:

ilObjiLincCourse::addUser ( &$  a_user_obj  ) 

Definition at line 623 of file class.ilObjiLincCourse.php.

References __createLoginData().

Referenced by addMember().

        {
                // create login and passwd for iLinc account
                $login_data = $this->__createLoginData($a_user_obj->getId(),$a_user_obj->getLogin(),$this->ilias->getSetting($inst_id));
                
                $this->ilincAPI->addUser($login_data,$a_user_obj);
                $response = $this->ilincAPI->sendRequest();

                if ($response->isError())
                {
                        if (!$response->getErrorMsg())
                        {
                                $this->error_msg = "err_add_user";
                        }
                        else
                        {
                                $this->error_msg = $response->getErrorMsg();
                        }
                        
                        return false;
                }
                
                $ilinc_user_id = $response->getFirstID();
                $a_user_obj->setiLincData($ilinc_user_id,$login_data["login"],$login_data["passwd"]);
                $a_user_obj->update();
                
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjiLincCourse::checkiLincMemberStatus ( a_ilinc_user_id,
a_docent_ids,
a_student_ids 
)

Definition at line 1071 of file class.ilObjiLincCourse.php.

        {
                if (in_array($a_ilinc_user_id,$a_docent_ids))
                {
                        return ILINC_MEMBER_DOCENT;
                }
                
                if (in_array($a_ilinc_user_id,$a_student_ids))
                {
                        return ILINC_MEMBER_STUDENT;
                }
                        
                return ILINC_MEMBER_NOTSET;
        }

ilObjiLincCourse::delete (  ) 

delete object and all related data

public

Returns:
boolean true if all object data were removed; false if only a references were removed

Reimplemented from ilObject.

Definition at line 183 of file class.ilObjiLincCourse.php.

References $q, and getiLincId().

        {               
                // always call parent delete function first!!
                if (!parent::delete())
                {
                        return false;
                }
                
                //put here your module specific stuff
                $q = "DELETE FROM ilinc_data WHERE course_id='".$this->getiLincId()."'";
                $this->ilias->db->query($q);
                
                // TODO: delete data in ilinc_registration table
                
                // remove course from ilinc server
                $this->ilincAPI->removeCourse($this->getiLincId());
                $response = $this->ilincAPI->sendRequest();

                return true;
        }

Here is the call graph for this function:

ilObjiLincCourse::getAdminIds ( a_grpId = ""  ) 

get Group Admin Id public

Parameters:
integer group id
returns userids that are assigned to a group administrator! role

Definition at line 907 of file class.ilObjiLincCourse.php.

References $rbacreview, $roles, getDefaultRoles(), and ilObject::getRefId().

Referenced by removeMember().

        {
                global $rbacreview;

                if (!empty($a_grpId))
                {
                        $grp_id = $a_grpId;
                }
                else
                {
                        $grp_id = $this->getRefId();
                }

                $usr_arr = array();
                $roles = $this->getDefaultRoles($this->getRefId());

                foreach ($rbacreview->assignedUsers($this->getDefaultAdminRole()) as $member_id)
                {
                        array_push($usr_arr,$member_id);
                }

                return $usr_arr;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjiLincCourse::getClassrooms (  ) 

Definition at line 559 of file class.ilObjiLincCourse.php.

References $data, $ilErr, and getiLincId().

        {
                global $ilErr;
                
                if (!$this->ilias->getSetting("ilinc_active"))
                {
                        $this->error_msg = "ilinc_server_not_active";
                        return false;
                }

                $this->ilincAPI->findCourseClasses($this->getiLincId());
                $response = $this->ilincAPI->sendRequest();

                if ($response->isError())
                {
                        if (!$response->getErrorMsg())
                        {
                                $this->error_msg = "err_get_classrooms";
                        }
                        else
                        {
                                $this->error_msg = $response->getErrorMsg();
                        }
                        
                        return false;
                }

                if (!$response->data['classes'])
                {

                        $this->error_msg = $response->data['result']['cdata'];
                        return false;
                }

                //echo "3";
                foreach ($response->data['classes'] as $class_id => $data)
                {
                        $this->ilincAPI->findClass($class_id);
                        $response = $this->ilincAPI->sendRequest("findClass");

                        if ($response->data['classes'])
                        {
                                $full_class_data[$class_id] = $response->data['classes'][$class_id];
                        }
                }
                
                return $full_class_data;
        }

Here is the call graph for this function:

ilObjiLincCourse::getDefaultAdminRole (  ) 

returns object id of created default adminstrator role public

Definition at line 552 of file class.ilObjiLincCourse.php.

References getLocalRoles().

        {
                $local_icrs_Roles = $this->getLocalRoles();

                return $local_icrs_Roles["il_icrs_admin_".$this->getRefId()];
        }

Here is the call graph for this function:

ilObjiLincCourse::getDefaultMemberRole (  ) 

returns object id of created default member role public

Definition at line 541 of file class.ilObjiLincCourse.php.

References getLocalRoles().

        {
                $local_icrs_Roles = $this->getLocalRoles();

                return $local_icrs_Roles["il_icrs_member_".$this->getRefId()];
        }

Here is the call graph for this function:

ilObjiLincCourse::getDefaultRoles ( a_grp_id = ""  ) 

get default group roles, returns the defaultlike create roles il_grp_member, il_grp_admin public

Parameters:
returns the obj_ids of group specific roles(il_grp_member,il_grp_admin)

Definition at line 996 of file class.ilObjiLincCourse.php.

References $rbacadmin, $rbacreview, $role_id, and ilObject::getRefId().

Referenced by getAdminIds(), and isAdmin().

        {
                global $rbacadmin, $rbacreview;

                if (strlen($a_grp_id) > 0)
                {
                        $grp_id = $a_grp_id;
                }
                else
                {
                        $grp_id = $this->getRefId();
                }

                $rolf      = $rbacreview->getRoleFolderOfObject($grp_id);
                $role_arr  = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"]);

                foreach ($role_arr as $role_id)
                {
                        $role_Obj =& $this->ilias->obj_factory->getInstanceByObjId($role_id);

                        $grp_Member ="il_icrs_member_".$grp_id;
                        $grp_Admin  ="il_icrs_admin_".$grp_id;

                        if (strcmp($role_Obj->getTitle(), $grp_Member) == 0 )
                        {
                                $arr_grpDefaultRoles["icrs_member_role"] = $role_Obj->getId();
                        }

                        if (strcmp($role_Obj->getTitle(), $grp_Admin) == 0)
                        {
                                $arr_grpDefaultRoles["icrs_admin_role"] = $role_Obj->getId();
                        }
                }

                return $arr_grpDefaultRoles;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjiLincCourse::getErrorMsg (  ) 

Definition at line 87 of file class.ilObjiLincCourse.php.

        {
                $err_msg = $this->error_msg;
                $this->error_msg = "";

                return $err_msg;
        }

ilObjiLincCourse::getiLincId (  ) 

Definition at line 82 of file class.ilObjiLincCourse.php.

Referenced by delete(), getClassrooms(), getiLincMemberIds(), registerUser(), registerUsers(), unregisterUser(), unregisterUsers(), and update().

        {
                return $this->ilinc_id;
        }

Here is the caller graph for this function:

ilObjiLincCourse::getiLincMemberIds ( a_instructorflag = false  ) 

Definition at line 1034 of file class.ilObjiLincCourse.php.

References getiLincId().

Referenced by isDocent().

        {
                if ($a_instructorflag == true)
                {
                        if ($this->docent_ids)
                        {
                                return $this->docent_ids;
                        }
                }
                else
                {
                        if ($this->student_ids)
                        {
                                return $this->student_ids;
                        }
                }
                
                $this->ilincAPI->findRegisteredUsersByRole($this->getiLincId(),$a_instructorflag);
                $response = $this->ilincAPI->sendRequest();
                        
                if (is_array($response->data['users']))
                {
                        if ($a_instructorflag == true)
                        {
                                $this->docent_ids = array_keys($response->data['users']);
                        }
                        else
                        {
                                $this->student_ids = array_keys($response->data['users']);
                        }

                        return array_keys($response->data['users']);
                }
                
                return array();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjiLincCourse::getLocalRoles ( a_translate = false  ) 

get ALL local roles of group, also those created and defined afterwards only fetch data once from database.

info is stored in object variable public

Returns:
return array [title|id] of roles...

Definition at line 472 of file class.ilObjiLincCourse.php.

References $rbacadmin, $rbacreview, $role_id, ilObjRole::_getTranslation(), and ilObject::getRefId().

Referenced by getDefaultAdminRole(), getDefaultMemberRole(), getMemberIds(), getMemberRoles(), and getMemberRolesTitle().

        {
                global $rbacadmin,$rbacreview;
                
                if (empty($this->local_roles))
                {
                        $this->local_roles = array();
                        $rolf      = $rbacreview->getRoleFolderOfObject($this->getRefId());
                        $role_arr  = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"]);

                        foreach ($role_arr as $role_id)
                        {
                                if ($rbacreview->isAssignable($role_id,$rolf["ref_id"]) == true)
                                {
                                        $role_Obj =& $this->ilias->obj_factory->getInstanceByObjId($role_id);
                                        
                                        if ($a_translate)
                                        {
                                                $role_name = ilObjRole::_getTranslation($role_Obj->getTitle());
                                        }
                                        else
                                        {
                                                $role_name = $role_Obj->getTitle();
                                        }
                                        
                                        $this->local_roles[$role_name] = $role_Obj->getId();
                                }
                        }
                }
                
                return $this->local_roles;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjiLincCourse::getMemberData ( a_mem_ids,
active = 1 
)

get all group Members regardless of group role.

fetch all users data in one shot to improve performance public

Parameters:
array of user ids
Returns:
return array of userdata

Definition at line 438 of file class.ilObjiLincCourse.php.

References $ilBench, $q, $rbacadmin, $rbacreview, and $row.

        {
                global $rbacadmin, $rbacreview, $ilBench, $ilDB;

                $usr_arr= array();
                
                $q = "SELECT login,firstname,lastname,title,usr_id,ilinc_id ".
                         "FROM usr_data ".
                         "WHERE usr_id IN (".implode(',',$a_mem_ids).")";
                         
                if (is_numeric($active) && $active > -1)
                        $q .= "AND active = '$active'";                  
                
                $r = $ilDB->query($q);
                
                while($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $mem_arr[] = array("id" => $row->usr_id,
                                                                "login" => $row->login,
                                                                "firstname" => $row->firstname,
                                                                "lastname" => $row->lastname,
                                                                "ilinc_id" => $row->ilinc_id
                                                                );
                }

                return $mem_arr ? $mem_arr : array();
        }

ilObjiLincCourse::getMemberIds (  ) 

get all group Member ids regardless of role public

Returns:
return array of users (obj_ids) that are assigned to the groupspecific roles (grp_member,grp_admin)

Definition at line 410 of file class.ilObjiLincCourse.php.

References $rbacadmin, $rbacreview, and getLocalRoles().

Referenced by isMember(), and removeMember().

        {
                global $rbacadmin, $rbacreview;

                $usr_arr= array();

                $rol  = $this->getLocalRoles();

                foreach ($rol as $value)
                {
                        foreach ($rbacreview->assignedUsers($value) as $member_id)
                        {
                                array_push($usr_arr,$member_id);
                        }
                }

                $mem_arr = array_unique($usr_arr);
                
                return $mem_arr ? $mem_arr : array();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjiLincCourse::getMemberRoles ( a_user_id  ) 

get group member status public

Parameters:
integer user_id
Returns:
returns array of obj_ids of assigned local roles

Definition at line 393 of file class.ilObjiLincCourse.php.

References $rbacadmin, $rbacreview, and getLocalRoles().

Referenced by leave().

        {
                global $rbacadmin, $rbacreview;

                $arr_assignedRoles = array();

                $arr_assignedRoles = array_intersect($rbacreview->assignedRoles($a_user_id),$this->getLocalRoles());

                return $arr_assignedRoles;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjiLincCourse::getMemberRolesTitle ( a_user_id  ) 

get group member status public

Parameters:
integer user_id
Returns:
returns string of role titles

Definition at line 511 of file class.ilObjiLincCourse.php.

References $ilBench, $q, $row, ilObjRole::_getTranslation(), and getLocalRoles().

        {
                global $ilDB,$ilBench;
                
                include_once ('classes/class.ilObjRole.php');

                $str_member_roles ="";

                $q = "SELECT title ".
                         "FROM object_data ".
                         "LEFT JOIN rbac_ua ON object_data.obj_id=rbac_ua.rol_id ".
                         "WHERE object_data.type = 'role' ".
                         "AND rbac_ua.usr_id = ".$ilDB->quote($a_user_id)." ".
                         "AND rbac_ua.rol_id IN (".implode(',',$this->getLocalRoles()).")";

                $r = $ilDB->query($q);

                while($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        // display human readable role names for autogenerated roles
                        $str_member_roles .= ilObjRole::_getTranslation($row["title"]).", ";
                }

                return substr($str_member_roles,0,-2);
        }

Here is the call graph for this function:

ilObjiLincCourse::ilClone ( a_parent_ref  ) 

copy all entries of your object.

public

Parameters:
integer ref_id of parent object
Returns:
integer new ref id

Reimplemented from ilObject.

Definition at line 154 of file class.ilObjiLincCourse.php.

References $rbacadmin.

        {               
                global $rbacadmin;

                // always call parent clone function first!!
                $new_ref_id = parent::ilClone($a_parent_ref);
                
                // get object instance of cloned object
                //$newObj =& $this->ilias->obj_factory->getInstanceByRefId($new_ref_id);

                // create a local role folder & default roles
                //$roles = $newObj->initDefaultRoles();

                // ...finally assign role to creator of object
                //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "n");          

                // always destroy objects in clone method because clone() is recursive and creates instances for each object in subtree!
                //unset($newObj);

                // ... and finally always return new reference ID!!
                return $new_ref_id;
        }

ilObjiLincCourse::ilObjiLincCourse ( a_id = 0,
a_call_by_reference = true 
)

Constructor public.

Parameters:
integer reference_id or object_id
boolean treat the id as reference_id (true) or object_id (false)

Definition at line 45 of file class.ilObjiLincCourse.php.

References ilObject::ilObject(), and ilObject::setRegisterMode().

        {
                $this->type = "icrs";
                $this->ilObject($a_id,$a_call_by_reference);
                $this->setRegisterMode(false);
                $this->ilincAPI = new ilnetucateXMLAPI();
                
                $this->docent_ids = array();
                $this->student_ids = array();
        }

Here is the call graph for this function:

ilObjiLincCourse::initDefaultRoles (  ) 

init default roles settings

public

Returns:
array object IDs of created local roles.

Reimplemented from ilObject.

Definition at line 226 of file class.ilObjiLincCourse.php.

References $ops, $q, $rbacadmin, $rbacreview, $roles, ilObject::createRoleFolder(), ilObject::getId(), and ilObject::getRefId().

        {
                global $rbacadmin, $rbacreview;

                // create a local role folder
                $rfoldObj =& $this->createRoleFolder();

                // ADMIN ROLE
                // create role and assign role to rolefolder...
                $roleObj = $rfoldObj->createRole("il_icrs_admin_".$this->getRefId(),"LearnLinc admin of seminar obj_no.".$this->getId());
                $this->m_roleAdminId = $roleObj->getId();

                //set permission template of new local role
                $q = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_icrs_admin'";
                $r = $this->ilias->db->getRow($q, DB_FETCHMODE_OBJECT);
                $rbacadmin->copyRolePermission($r->obj_id,ROLE_FOLDER_ID,$rfoldObj->getRefId(),$roleObj->getId());

                // set object permissions of icrs object
                $ops = $rbacreview->getOperationsOfRole($roleObj->getId(),"icrs",$rfoldObj->getRefId());
                $rbacadmin->grantPermission($roleObj->getId(),$ops,$this->getRefId());

                // set object permissions of role folder object
                $ops = $rbacreview->getOperationsOfRole($roleObj->getId(),"rolf",$rfoldObj->getRefId());
                $rbacadmin->grantPermission($roleObj->getId(),$ops,$rfoldObj->getRefId());

                // MEMBER ROLE
                // create role and assign role to rolefolder...
                $roleObj = $rfoldObj->createRole("il_icrs_member_".$this->getRefId(),"LearnLinc admin of seminar obj_no.".$this->getId());
                $this->m_roleMemberId = $roleObj->getId();

                //set permission template of new local role
                $q = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_icrs_member'";
                $r = $this->ilias->db->getRow($q, DB_FETCHMODE_OBJECT);
                $rbacadmin->copyRolePermission($r->obj_id,ROLE_FOLDER_ID,$rfoldObj->getRefId(),$roleObj->getId());
                
                // set object permissions of icrs object
                $ops = $rbacreview->getOperationsOfRole($roleObj->getId(),"icrs",$rfoldObj->getRefId());
                $rbacadmin->grantPermission($roleObj->getId(),$ops,$this->getRefId());

                // set object permissions of role folder object
                $ops = $rbacreview->getOperationsOfRole($roleObj->getId(),"rolf",$rfoldObj->getRefId());
                $rbacadmin->grantPermission($roleObj->getId(),$ops,$rfoldObj->getRefId());

                unset($rfoldObj);
                unset($roleObj);

                $roles[] = $this->m_roleAdminId;
                $roles[] = $this->m_roleMemberId;
                return $roles ? $roles : array();
        }

Here is the call graph for this function:

ilObjiLincCourse::isAdmin ( a_user_id  ) 

is Admin public

Parameters:
integer user_id
boolean,true if user is group administrator

Definition at line 975 of file class.ilObjiLincCourse.php.

References $rbacreview, and getDefaultRoles().

Referenced by removeMember().

        {
                global $rbacreview;

                $icrs_roles = $this->getDefaultRoles();

                if (in_array($a_user_id,$rbacreview->assignedUsers($icrs_roles["icrs_admin_role"])))
                {
                        return true;
                }
                else
                {
                        return false;
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjiLincCourse::isDocent ( a_user_obj = ""  ) 

Definition at line 688 of file class.ilObjiLincCourse.php.

References getiLincMemberIds().

        {
                if (!$a_user_obj)
                {
                        $a_user_obj =& $this->ilias->account;
                }
                
                $docents = $this->getiLincMemberIds(true);
                
                $ilinc_data = $a_user_obj->getiLincData();
                
                if (in_array($ilinc_data['id'],$docents))
                {
                        return true;
                }
                
                return false;
        }

Here is the call graph for this function:

ilObjiLincCourse::isMember ( a_user_id = ""  ) 

Definition at line 671 of file class.ilObjiLincCourse.php.

References getMemberIds().

Referenced by removeMember().

        {
                if (strlen($a_user_id) == 0)
                {
                        $a_user_id = $this->ilias->account->getId();
                }

                $arr_members = $this->getMemberIds();

                if (in_array($a_user_id, $arr_members))
                {
                        return true;
                }
                
                return false;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjiLincCourse::join ( a_user_id,
a_mem_role = "" 
)

join icrs, assigns user to role private

Parameters:
integer member status = obj_id of local_group_role

Definition at line 341 of file class.ilObjiLincCourse.php.

References $rbacadmin, and ilObjUser::updateActiveRoles().

Referenced by addMember().

        {
                global $rbacadmin;

                if (is_array($a_mem_role))
                {
                        foreach ($a_mem_role as $role)
                        {
                                $rbacadmin->assignUser($role,$a_user_id, false);
                        }
                }
                else
                {
                        $rbacadmin->assignUser($a_mem_role,$a_user_id, false);
                }

                ilObjUser::updateActiveRoles($a_user_id);
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjiLincCourse::joinClass ( &$  a_user_obj,
a_ilinc_class_id 
)

Definition at line 831 of file class.ilObjiLincCourse.php.

        {
                $this->ilincAPI->joinClass($a_user_obj,$a_ilinc_class_id);
                $response = $this->ilincAPI->sendRequest("joinClass");

                if ($response->isError())
                {
                        if (!$response->getErrorMsg())
                        {
                                $this->error_msg = "err_join_class";
                        }
                        else
                        {
                                $this->error_msg = $response->getErrorMsg();
                        }
                        
                        return false;
                }
                
                // return URL to join class room
                return $response->data['url']['cdata'];
        }

ilObjiLincCourse::leave ( a_user_id  ) 

deassign member from group role private

Definition at line 365 of file class.ilObjiLincCourse.php.

References $rbacadmin, getMemberRoles(), and ilObjUser::updateActiveRoles().

Referenced by removeMember().

        {
                global $rbacadmin;

                $arr_groupRoles = $this->getMemberRoles($a_user_id);

                if (is_array($arr_groupRoles))
                {
                        foreach ($arr_groupRoles as $groupRole)
                        {
                                $rbacadmin->deassignUser($groupRole, $a_user_id);
                        }
                }
                else
                {
                        $rbacadmin->deassignUser($arr_groupRoles, $a_user_id);
                }

                ilObjUser::updateActiveRoles($a_user_id);
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjiLincCourse::notify ( a_event,
a_ref_id,
a_parent_non_rbac_id,
a_node_id,
a_params = 0 
)

notifys an object about an event occured Based on the event happend, each object may decide how it reacts.

If you are not required to handle any events related to your module, just delete this method. (For an example how this method is used, look at ilObjGroup)

public

Parameters:
string event
integer reference id of object where the event occured
array passes optional parameters if required
Returns:
boolean

Reimplemented from ilObject.

Definition at line 290 of file class.ilObjiLincCourse.php.

        {
                return true;
        }

ilObjiLincCourse::read (  ) 

private

Definition at line 60 of file class.ilObjiLincCourse.php.

References $data, $q, and ilUtil::yn2tf().

        {
                parent::read();
                
                // TODO: fetching default role should be done in rbacadmin
                $q = "SELECT * FROM ilinc_data ".
                         "WHERE obj_id='".$this->id."'";
                $r = $this->ilias->db->query($q);

                if ($r->numRows() > 0)
                {
                        $data = $r->fetchRow(DB_FETCHMODE_OBJECT);

                        $this->ilinc_id = $data->course_id;
                        $this->activated = ilUtil::yn2tf($data->activation_offline);
                }
                else
                {
                         $this->ilias->raiseError("<b>Error: There is no dataset with id ".$this->id."!</b><br />class: ".get_class($this)."<br />Script: ".__FILE__."<br />Line: ".__LINE__, $this->ilias->FATAL);
                }
        }

Here is the call graph for this function:

ilObjiLincCourse::registerUser ( &$  a_user_obj,
a_instructor = false 
)

Definition at line 707 of file class.ilObjiLincCourse.php.

References $user, and getiLincId().

Referenced by addMember().

        {
                if ($a_instructor === true)
                {
                        $a_instructor = "True";
                }
                else
                {
                        $a_instructor = "False";
                }

                $ilinc_data = $a_user_obj->getiLincData();
                $user[] = array('id' => $ilinc_data['id'], 'instructor' => $a_instructor);
                $this->ilincAPI->registerUser($this->getiLincId(),$user);
                $response = $this->ilincAPI->sendRequest("registerUser");
                
//var_dump($response->data);exit;

                if ($response->isError())
                {
                        if (!$response->getErrorMsg())
                        {
                                $this->error_msg = "err_register_user";
                        }
                        else
                        {
                                $this->error_msg = $response->getErrorMsg();
                        }
                        
                        return false;
                }
                
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjiLincCourse::registerUsers ( a_user_arr  ) 

Definition at line 742 of file class.ilObjiLincCourse.php.

References $user_id, and getiLincId().

        {
                foreach ($a_user_arr as $user_id => $instructorflag)
                {
                        $flag = "False";
                        
                        if ($instructorflag == ILINC_MEMBER_DOCENT)
                        {
                                $flag = "True";
                        }
                        
                        $ilinc_users[] = array('id' => $user_id,'instructor' => $flag);
                }
                
                $this->ilincAPI->registerUser($this->getiLincId(),$ilinc_users);
                $response = $this->ilincAPI->sendRequest("registerUser");

                if ($response->isError())
                {
                        if (!$response->getErrorMsg())
                        {
                                $this->error_msg = "err_register_users";
                        }
                        else
                        {
                                $this->error_msg = $response->getErrorMsg();
                        }
                        
                        return false;
                }
                
                return true;
        }

Here is the call graph for this function:

ilObjiLincCourse::removeMember ( &$  a_user_obj  ) 

removes Member from group public

Definition at line 935 of file class.ilObjiLincCourse.php.

References getAdminIds(), getMemberIds(), isAdmin(), isMember(), leave(), and unregisterUser().

        {
                if (!isset($a_user_obj))
                {
                        $this->error_msg = get_class($this)."::removeMember(): Missing parameters !";
                        return false;
                }
                
                if (!$this->isMember($a_user_obj->getId()))
                {
                        return true;
                }

                if (count($this->getMemberIds()) > 1)
                {
                        if ($this->isAdmin($a_user_obj->getId()) && count($this->getAdminIds()) < 2)
                        {
                                $this->error_msg = "ilinc_err_administrator_required";
                                return false;
                        }
                }
                
                // unregister from course on iLinc server
                if (!$this->unregisterUser($a_user_obj))
                {
                        // error_msg already set
                        return false;
                }

                $this->leave($a_user_obj->getId());

                return true;
        }

Here is the call graph for this function:

ilObjiLincCourse::saveActivationStatus ( a_activated  ) 

Definition at line 214 of file class.ilObjiLincCourse.php.

References $q, and ilObject::getId().

        {
                $q = "UPDATE ilinc_data SET activation_offline='".$a_activated."' WHERE obj_id=".$this->getId()."";
                $r = $this->ilias->db->query($q);
        }

Here is the call graph for this function:

ilObjiLincCourse::storeiLincId ( a_icrs_id  ) 

Definition at line 205 of file class.ilObjiLincCourse.php.

References $q.

        {
                $q = "INSERT INTO ilinc_data (obj_id,type,course_id,activation_offline) VALUES (".$this->id.",'icrs','".$a_icrs_id."','".$this->activated."')";
                $this->ilias->db->query($q);
                
                $this->ilinc_id = $a_icrs_id;
        }

ilObjiLincCourse::unregisterUser ( a_user_obj  ) 

Definition at line 777 of file class.ilObjiLincCourse.php.

References getiLincId().

Referenced by removeMember().

        {
                $ilinc_data = $a_user_obj->getiLincData();
                
                // do not send request if user is not registered at iLinc server at all
                if ($ilinc_data['id'] == '0')
                {
                        return true;
                }
                
                $this->ilincAPI->unregisterUser($this->getiLincId(),array($ilinc_data['id']));
                $response = $this->ilincAPI->sendRequest();

                if ($response->isError())
                {
                        if (!$response->getErrorMsg())
                        {
                                $this->error_msg = "err_unregister_user";
                        }
                        else
                        {
                                $this->error_msg = $response->getErrorMsg();
                        }
                        
                        return false;
                }
                
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjiLincCourse::unregisterUsers ( a_ilinc_user_ids  ) 

Definition at line 807 of file class.ilObjiLincCourse.php.

References getiLincId().

        {
                $this->ilincAPI->unregisterUser($this->getiLincId(),$a_ilinc_user_ids);
                $response = $this->ilincAPI->sendRequest();
                
                //var_dump($response->data);exit;
                
                if ($response->isError())
                {
                        if (!$response->getErrorMsg())
                        {
                                $this->error_msg = "err_unregister_users";
                        }
                        else
                        {
                                $this->error_msg = $response->getErrorMsg();
                        }
                        
                        return false;
                }
                
                return true;
        }

Here is the call graph for this function:

ilObjiLincCourse::update (  ) 

update object data

public

Returns:
boolean

Reimplemented from ilObject.

Definition at line 101 of file class.ilObjiLincCourse.php.

References $_POST, $q, ilObject::getId(), and getiLincId().

        {
                $this->ilincAPI->editCourse($this->getiLincId(),$_POST["Fobject"]);
                $response = $this->ilincAPI->sendRequest();
                
                if ($response->isError())
                {
                        $this->error_msg = $response->getErrorMsg();
                        return false;
                }


                if (!parent::update())
                {                       
                        $this->error_msg = "database_error";
                        return false;
                }
                
                $q = "UPDATE ilinc_data SET activation_offline='".$this->activated."' WHERE obj_id=".$this->getId()."";
                $r = $this->ilias->db->query($q);
                
                return true;
        }

Here is the call graph for this function:

ilObjiLincCourse::uploadPicture ( &$  a_user_obj,
a_lang 
)

Definition at line 878 of file class.ilObjiLincCourse.php.

        {
                $this->ilincAPI->uploadPicture($a_user_obj,$a_lang);
                $response = $this->ilincAPI->sendRequest("uploadPicture");

                if ($response->isError())
                {
                        if (!$response->getErrorMsg())
                        {
                                $this->error_msg = "err_upload_picture";
                        }
                        else
                        {
                                $this->error_msg = $response->getErrorMsg();
                        }
                        
                        return false;
                }
                
                // return URL to user's personal page
                return $response->data['url']['cdata'];
        }

ilObjiLincCourse::userExists ( &$  a_user_obj  ) 

Definition at line 610 of file class.ilObjiLincCourse.php.

References $data.

Referenced by addMember().

        {
                $data = $a_user_obj->getiLincData();
                
                if (empty($data["id"]) and empty($data["login"]))
                {
                        return false;
                }
                
                return true;
        }

Here is the caller graph for this function:

ilObjiLincCourse::userLogin ( &$  a_user_obj  ) 

Definition at line 854 of file class.ilObjiLincCourse.php.

        {
                $this->ilincAPI->userLogin($a_user_obj);
                $response = $this->ilincAPI->sendRequest("userLogin");

                if ($response->isError())
                {
                        if (!$response->getErrorMsg())
                        {
                                $this->error_msg = "err_user_login";
                        }
                        else
                        {
                                $this->error_msg = $response->getErrorMsg();
                        }
                        
                        return false;
                }
                
                // return URL to join class room
                return $response->data['url']['cdata'];
        }


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