ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjiLincCourse Class Reference

Class ilObjiLincCourse. More...

+ Inheritance diagram for ilObjiLincCourse:
+ Collaboration diagram for ilObjiLincCourse:

Public Member Functions

 ilObjiLincCourse ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 getViewMode ()
 Get container view mode.
 read ()
 private
 getiLincId ()
 getErrorMsg ()
 getAKClassValue1 ()
 getAKClassValue2 ()
 setAKClassValue1 ($a_str)
 setAKClassValue2 ($a_str)
 update ()
 update object data
 addCourse ()
 create course on iLinc server
 delete ()
 delete object and all related data
 storeiLincId ($a_icrs_id)
 saveActivationStatus ($a_activated)
 saveAKClassValues ($a_akclassvalue1, $a_akclassvalue2)
 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 ()
 updateClassrooms ()
 userExists (&$a_user_obj)
 addUser (&$a_user_obj)
 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)
 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)
 _getAKClassValues ($a_course_obj_id)
 _isMember ($a_user_id, $a_ref_id)
 __setCourseStatus ()
 getSubItems ()
 get all subitems of the container overwrites method in ilContainerGUI
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public.
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not)
 read ($a_force_db=false)
 read object data from db into object
 getId ()
 get object id public
 setId ($a_id)
 set object id public
 setRefId ($a_id)
 set reference id public
 getRefId ()
 get reference id public
 getType ()
 get object type public
 setType ($a_type)
 set object type public
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions
 getTitle ()
 get object title public
 getUntranslatedTitle ()
 get untranslated object title public
 setTitle ($a_title)
 set object title
 getDescription ()
 get object description
 setDescription ($a_desc)
 set object description
 getLongDescription ()
 get object long description (stored in object_description)
 getImportId ()
 get import id
 setImportId ($a_import_id)
 set import id
 _lookupObjIdByImportId ($a_import_id)
 getOwner ()
 get object owner
 getOwnerName ()
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id
 setOwner ($a_owner)
 set object owner
 getCreateDate ()
 get create date public
 getLastUpdateDate ()
 get last update date public
 getDiskUsage ()
 Gets the disk usage of the object in bytes.
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class)
 MDUpdateListener ($a_element)
 Meta data update listener.
 createMetaData ()
 create meta data entry
 updateMetaData ()
 update meta data entry
 deleteMetaData ()
 delete meta data entry
 updateOwner ()
 update owner of object in db
 _getIdForImportId ($a_import_id)
 get current object id for import id (static)
 _getAllReferences ($a_id)
 get all reference ids of object
 _lookupOwner ($a_id)
 lookup object owner
 _lookupDescription ($a_id)
 lookup object description
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects.
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static)
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static)
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static)
 _isInTrash ($a_ref_id)
 checks wether object is in trash
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash
 _lookupObjectId ($a_ref_id)
 lookup object id
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!?
 setPermissions ($a_parent_ref)
 set permissions of object
 createReference ()
 creates reference for object
 countReferences ()
 count references of object
 createRoleFolder ()
 creates a local role folder
 setRegisterMode ($a_bool)
 isUserRegistered ($a_user_id=0)
 requireRegistration ()
 getXMLZip ()
 getHTMLDirectory ()
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container.
 cloneMetaData ($target_obj)
 Copy meta data.
- Public Member Functions inherited from ilContainer
 ilContainer ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 createContainerDirectory ()
 Create directory for the container.
 getContainerDirectory ()
 Get the container directory.
 _getContainerDirectory ($a_id)
 Get the container directory.
 getBigIconPath ()
 Get path for big icon.
 getSmallIconPath ()
 Get path for small icon.
 getTinyIconPath ()
 Get path for tiny icon.
 setHiddenFilesFound ($a_hiddenfilesfound)
 Set Found hidden files (set by getSubItems).
 getHiddenFilesFound ()
 Get Found hidden files (set by getSubItems).
 getStyleSheetId ()
 get ID of assigned style sheet object
 setStyleSheetId ($a_style_id)
 set ID of assigned style sheet object
 _lookupContainerSetting ($a_id, $a_keyword)
 Lookup a container setting.
 _writeContainerSetting ($a_id, $a_keyword, $a_value)
 _lookupIconPath ($a_id, $a_size="big")
 lookup icon path
 saveIcons ($a_big_icon, $a_small_icon, $a_tiny_icon)
 save container icons
 removeBigIcon ()
 remove big icon
 removeSmallIcon ()
 remove small icon
 removeTinyIcon ()
 remove tiny icon
 getFirstColumn ()
 Get right column.
 cloneObject ($a_target_id, $a_copy_id=0)
 Clone container settings.
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies (container sorting)
 cloneAllObject ($session_id, $client_id, $new_type, $ref_id, $clone_source, $options, $soap_call=false)
 clone all objects according to this container
 getOrderType ()
 Get order type default implementation.
 setOrderType ($a_value)
 getSubItems ($a_admin_panel_enabled=false, $a_include_side_block=false)
 Get subitems of container.
 gotItems ()
 Check whether we got any items.
 addAdditionalSubItemInformation (&$object)
 Add additional information to sub item, e.g.
 getGroupedObjTypes ()
 Get grouped repository object types.
 enablePageEditing ()
 Check whether page editing is allowed for container.
 create ()
 Create.

Static Public Member Functions

 _getLinkToObject ($a_id)
 STATIC METHOD create a link to the object.
- Static Public Member Functions inherited from ilObject
static _lookupTitle ($a_id)
 lookup object title
static _getIdsForTitle ($title, $type= '', $partialmatch=false)
static _lookupObjId ($a_id)
static _lookupType ($a_id, $a_reference=false)
 lookup object type
 _exists ($a_id, $a_reference=false)
 checks if an object exists in object_data
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type.
static _prepareCloneSelection ($a_ref_ids, $new_type)
 Prepare copy wizard object selection.
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item.

Additional Inherited Members

- Data Fields inherited from ilObject
 $ilias
 $lng
 $id
 $ref_id
 $type
 $title
 $untranslatedTitle
 $desc
 $long_desc
 $owner
 $create_date
 $last_update
 $import_id
 $register = false
 $referenced
 $objectList
 $max_title
 $max_desc
 $add_dots
 $obj_data_record
 object_data record
- Data Fields inherited from ilContainer
const VIEW_SESSIONS = 0
const VIEW_OBJECTIVE = 1
const VIEW_TIMING = 2
const VIEW_ARCHIVE = 3
const VIEW_SIMPLE = 4
const VIEW_BY_TYPE = 5
const VIEW_INHERIT = 6
const VIEW_ILINC = 7
const SORT_TITLE = 0
const SORT_MANUAL = 1
const SORT_ACTIVATION = 2
- Protected Attributes inherited from ilContainer
 $order_type = 0
 $hiddenfilesfound = false

Detailed Description

Class ilObjiLincCourse.

Author
Sascha Hofmann sasch.nosp@m.ahof.nosp@m.mann@.nosp@m.gmx..nosp@m.de
Version
Id:
class.ilObjiLincCourse.php 21201 2009-08-21 07:06:18Z mjansen

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

Member Function Documentation

ilObjiLincCourse::__setCourseStatus ( )

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

Referenced by initDefaultRoles().

{
// empty
}

+ Here is the caller graph for this function:

ilObjiLincCourse::_getAKClassValues (   $a_course_obj_id)

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

References $ilDB, ilObject\$ilias, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilObjiLincClassroomGUI\getDefaultValues(), ilObjiLincClassroomGUI\getObjectValues(), ilObjiLincCourseListGUI\getProperties(), ilObjiLincClassroomGUI\save(), and ilObjiLincClassroomGUI\updateClassroom().

{
global $ilDB,$ilias;
$r = $ilDB->queryf('
SELECT akclassvalue1, akclassvalue2 FROM ilinc_data WHERE obj_id = %s',
array('integer'), array($a_course_obj_id));
$row = $r->fetchRow(DB_FETCHMODE_OBJECT);
return $akclassvalues = array($row->akclassvalue1,$row->akclassvalue2);
}

+ Here is the caller graph for this function:

ilObjiLincCourse::_getLinkToObject (   $a_id)
static

STATIC METHOD create a link to the object.

Parameters
intuniq id
Returns
array array('link','target') public

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

{
return array("repository.php?ref_id=".$a_id."&set_mode=flat&cmdClass=ilobjilinccoursegui","");
}
ilObjiLincCourse::_isActivated (   $a_course_obj_id)

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

References $ilDB, ilObject\$ilias, $row, DB_FETCHMODE_OBJECT, and ilUtil\yn2tf().

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

{
global $ilDB,$ilias;
if (!$ilias->getSetting("ilinc_active"))
{
return false;
}
$r = $ilDB->queryf('
SELECT activation_offline FROM ilinc_data WHERE obj_id = %s',
array('integer'), array($a_course_obj_id));
$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 1233 of file class.ilObjiLincCourse.php.

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 172 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
integeruser_id
integermember role_id of local group_role
booleanregister member on iLinc server as student(false) or docent(true)

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

References 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 799 of file class.ilObjiLincCourse.php.

Referenced by addMember().

{
include_once ('./Modules/ILinc/classes/class.ilObjiLincUser.php');
$ilinc_user = new ilObjiLincUser($a_user_obj);
return $ilinc_user->add();
}

+ Here is the caller graph for this function:

ilObjiLincCourse::checkiLincMemberStatus (   $a_ilinc_user_id,
  $a_docent_ids,
  $a_student_ids 
)

Definition at line 1187 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 195 of file class.ilObjiLincCourse.php.

References $ilDB, and getiLincId().

{
global $ilDB;
// always call parent delete function first!!
if (!parent::delete())
{
return false;
}
//put here your module specific stuff
$statement = $ilDB->manipulateF('
DELETE FROM ilinc_data WHERE course_id = %s',
array('integer'), array($this->getiLincId()));
// TODO: delete data in ilinc_registration table
/*
* not tested yet
*/
/* $statement = $ilDB->manipulateF('
DELETE FROM ilinc_registration
WHERE obj_id = %s',
array('integer'), array($this->getId()));
*/
// 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
integergroup id
returnsuserids that are assigned to a group administrator! role

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

References 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::getAKClassValue1 ( )

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

Referenced by update().

{
return $this->akclassvalue1;
}

+ Here is the caller graph for this function:

ilObjiLincCourse::getAKClassValue2 ( )

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

Referenced by update().

{
return $this->akclassvalue2;
}

+ Here is the caller graph for this function:

ilObjiLincCourse::getClassrooms ( )

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

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

Referenced by getSubItems().

{
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;
}
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:

+ Here is the caller graph for this function:

ilObjiLincCourse::getDefaultAdminRole ( )

returns object id of created default adminstrator role public

Definition at line 670 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 659 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
returnsthe obj_ids of group specific roles(il_grp_member,il_grp_admin)

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

References 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 97 of file class.ilObjiLincCourse.php.

{
$err_msg = $this->error_msg;
$this->error_msg = "";
return $err_msg;
}
ilObjiLincCourse::getiLincId ( )

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

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

{
return $this->ilinc_id;
}

+ Here is the caller graph for this function:

ilObjiLincCourse::getiLincMemberIds (   $a_instructorflag = false)

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

References getiLincId().

Referenced by isDocent().

{
if ($a_instructorflag == true)
{
if (!empty($this->docent_ids))
{
return $this->docent_ids;
}
}
else
{
if (!empty($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 562 of file class.ilObjiLincCourse.php.

References 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
arrayof user ids
Returns
return array of userdata

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

References $ilBench, $ilDB, $in, $query, and $row.

{
global $rbacadmin, $rbacreview, $ilBench, $ilDB;
$usr_arr= array();
$data_types = array();
$data_values = array();
$cnt_mem_ids = count($a_mem_ids);
$query = 'SELECT login,firstname,lastname,title,usr_id,ilinc_id
FROM usr_data WHERE usr_id IN ';
if (is_array($a_mem_ids) &&
$cnt_mem_ids > 0)
{
$in = '(';
$counter = 0;
foreach($a_mem_ids as $mem_id)
{
array_push($data_values, $mem_id);
array_push($data_types, 'integer');
if($counter > 0) $in .= ',';
$in .= '%s';
++$counter;
}
$in .= ')';
$query .= $in;
}
if (is_numeric($active) && $active > -1)
{
$query .= ' AND active = %s';
array_push($data_values,$active);
array_push($data_types, 'integer');
}
$r = $ilDB->queryf($query, $data_types, $data_values);
while($row = $ilDB->fetchObject($r))
{
$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 475 of file class.ilObjiLincCourse.php.

References 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
integeruser_id
Returns
returns array of obj_ids of assigned local roles

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

References 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
integeruser_id
Returns
returns string of role titles

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

References $ilBench, $ilDB, $in, $query, $row, ilObjRole\_getTranslation(), DB_FETCHMODE_ASSOC, and getLocalRoles().

{
global $ilDB,$ilBench;
include_once ('./Services/AccessControl/classes/class.ilObjRole.php');
$str_member_roles ="";
$data_types = array();
$data_values = array();
$query = 'SELECT title FROM object_data
LEFT JOIN rbac_ua ON object_data.obj_id = rbac_ua.rol_id
WHERE object_data.type = %s
AND rbac_ua.usr_id = %s
AND rbac_ua.rol_id IN';
array_push($data_types, 'text', 'integer');
array_push($data_values,'role', $a_user_id);
$local_roles = $this->getLocalRoles();
$cnt_local_roles = count($local_roles);
if (is_array($local_roles) &&
$cnt_local_roles > 0)
{
$in = '(';
$counter = 0;
foreach($local_roles as $local_role)
{
array_push($data_values, $local_role);
array_push($data_types, 'integer');
if($counter > 0) $in .= ',';
$in .= '%s';
++$counter;
}
$in .= ')';
$query .= $in;
}
$cnt_data_values = count($data_values);
$cnt_data_types = count($data_types);
$r = $ilDB->queryf($query, $data_types, $data_values);
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::getSubItems ( )

get all subitems of the container overwrites method in ilContainerGUI

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

References $key, getClassrooms(), and ilUtil\sendInfo().

{
$objects = array();
if(!($objects = $this->getClassrooms()))
{
ilUtil::sendInfo($this->lng->txt($this->getErrorMsg()));
return array();
}
foreach((array)$objects as $key => $object)
{
$this->items['icla'][$key] = $object;
}
return is_array($this->items) ? $this->items : array();
}

+ Here is the call graph for this function:

ilObjiLincCourse::getViewMode ( )

Get container view mode.

Reimplemented from ilContainer.

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

References ilContainer\VIEW_ILINC.

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

Constructor public.

Parameters
integerreference_id or object_id
booleantreat 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 279 of file class.ilObjiLincCourse.php.

References $ilDB, $res, __setCourseStatus(), ilObject\createRoleFolder(), ilObject\getId(), and ilObject\getRefId().

{
global $rbacadmin, $rbacreview, $ilDB;
// 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
$res = $ilDB->queryf('
SELECT obj_id FROM object_data WHERE type= %s AND title= %s',
array('text', 'text'), array('rolt', 'il_icrs_admin'));
$r = $ilDB->fetchObject($res);
$rbacadmin->copyRoleTemplatePermissions($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
$res = $ilDB->queryf('
SELECT obj_id FROM object_data WHERE type= %s AND title= %s',
array('text', 'text'), array('rolt', 'il_icrs_member'));
$r = $ilDB->fetchObject($res);
$rbacadmin->copyRoleTemplatePermissions($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;
// Break inheritance and initialize permission settings using intersection method with a non_member_template
// not implemented for ilinc. maybe never will...
return $roles ? $roles : array();
}

+ Here is the call graph for this function:

ilObjiLincCourse::isAdmin (   $a_user_id)

is Admin public

Parameters
integeruser_id
boolean,trueif user is group administrator

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

References 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 824 of file class.ilObjiLincCourse.php.

References getiLincMemberIds().

{
if (!$a_user_obj)
{
$a_user_obj =& $this->ilias->account;
}
$docents = $this->getiLincMemberIds(true);
include_once ('./Modules/ILinc/classes/class.ilObjiLincUser.php');
$ilinc_user = new ilObjiLincUser($a_user_obj);
if (in_array($ilinc_user->id,$docents))
{
return true;
}
return false;
}

+ Here is the call graph for this function:

ilObjiLincCourse::isMember (   $a_user_id = "")

Definition at line 807 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
integermember status = obj_id of local_group_role

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

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);
}
return true;
}

+ Here is the caller graph for this function:

ilObjiLincCourse::leave (   $a_user_id)

deassign member from group role private

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

References getMemberRoles().

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);
}
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
stringevent
integerreference id of object where the event occured
arraypasses optional parameters if required
Returns
boolean

Reimplemented from ilObject.

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

{
return true;
}
ilObjiLincCourse::read ( )

private

Reimplemented from ilContainer.

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

References $data, $ilDB, $ilErr, and ilUtil\yn2tf().

{
global $ilDB, $ilErr;
// TODO: fetching default role should be done in rbacadmin
$r = $ilDB->queryf('
SELECT * FROM ilinc_data
WHERE obj_id = %s',
array('integer'), array($this->id));
if($ilDB->numRows($r) > 0)
{
$data = $ilDB->fetchObject($r);
$this->ilinc_id = $data->course_id;
$this->activated = ilUtil::yn2tf($data->activation_offline);
$this->akclassvalue1 = $data->akclassvalue1;
$this->akclassvalue2 = $data->akclassvalue2;
}
else
{
$ilErr->raiseError("<b>Error: There is no dataset with id ".$this->id."!</b><br />class: ".get_class($this)."<br />Script: ".__FILE__."<br />Line: ".__LINE__, $ilErr->FATAL);
}
}

+ Here is the call graph for this function:

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

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

References $user, and getiLincId().

Referenced by addMember().

{
if ($a_instructor === true)
{
$a_instructor = "True";
}
else
{
$a_instructor = "False";
}
include_once ('./Modules/ILinc/classes/class.ilObjiLincUser.php');
$ilinc_user = new ilObjiLincUser($a_user_obj);
$user[] = array('id' => $ilinc_user->id, 'instructor' => $a_instructor);
$this->ilincAPI->registerUser($this->getiLincId(),$user);
$response = $this->ilincAPI->sendRequest("registerUser");
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 879 of file class.ilObjiLincCourse.php.

References 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 1051 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 245 of file class.ilObjiLincCourse.php.

References $ilDB, and ilObject\getId().

{
global $ilDB;
$statement = $ilDB->manipulateF('
UPDATE ilinc_data
SET activation_offline = %s
WHERE obj_id = %s',
array('text', 'integer'),
array($a_activated, $this->getId()));
}

+ Here is the call graph for this function:

ilObjiLincCourse::saveAKClassValues (   $a_akclassvalue1,
  $a_akclassvalue2 
)

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

References $ilDB, and ilObject\getId().

{
global $ilDB;
$statement = $ilDB->manipulateF('
UPDATE ilinc_data
SET akclassvalue1 = %s,
akclassvalue2 = %s
WHERE obj_id = %s',
array('text', 'text', 'integer'),
array($a_akclassvalue1, $a_akclassvalue2, $this->getId()));
}

+ Here is the call graph for this function:

ilObjiLincCourse::setAKClassValue1 (   $a_str)

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

{
$this->akclassvalue1 = $a_str;
}
ilObjiLincCourse::setAKClassValue2 (   $a_str)

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

{
$this->akclassvalue2 = $a_str;
}
ilObjiLincCourse::storeiLincId (   $a_icrs_id)

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

References $ilDB.

{
global $ilDB;
$statement = $ilDB->manipulateF('
INSERT INTO ilinc_data (
obj_id, i_type, course_id, activation_offline)
VALUES (%s, %s, %s, %s)',
array('integer', 'text', 'integer', 'text'),
array($this->id,'icrs',$a_icrs_id,$this->activated));
$this->ilinc_id = $a_icrs_id;
}
ilObjiLincCourse::unregisterUser (   $a_user_obj)

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

References getiLincId().

Referenced by removeMember().

{
include_once ('./Modules/ILinc/classes/class.ilObjiLincUser.php');
$ilinc_user = new ilObjiLincUser($a_user_obj);
// do not send request if user is not registered at iLinc server at all
if ($ilinc_user->id == '0')
{
return true;
}
$this->ilincAPI->unregisterUser($this->getiLincId(),array($ilinc_user->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 945 of file class.ilObjiLincCourse.php.

References getiLincId().

{
$this->ilincAPI->unregisterUser($this->getiLincId(),$a_ilinc_user_ids);
$response = $this->ilincAPI->sendRequest();
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 131 of file class.ilObjiLincCourse.php.

References $_POST, $ilDB, getAKClassValue1(), getAKClassValue2(), ilObject\getId(), and getiLincId().

{
global $ilDB;
$this->ilincAPI->editCourse($this->getiLincId(),$_POST["Fobject"]);
$response = $this->ilincAPI->sendRequest();
if ($response->isError())
{
$this->error_msg = $response->getErrorMsg();
return false;
}
// TODO: alter akclassvalues of classes here
if (!parent::update())
{
$this->error_msg = "database_error";
return false;
}
$db_activated_value = is_bool($this->activated) ? ($this->activated ? 'y' : 'n') : $this->activated;
$r = $ilDB->manipulateF('
UPDATE ilinc_data
SET activation_offline = %s,
akclassvalue1 = %s,
akclassvalue2 = %s
WHERE obj_id = %s',
array('text', 'text', 'text', 'integer'),
array($db_activated_value, $this->getAKClassValue1(), $this->getAKClassValue2(), $this->getId()));
return true;
}

+ Here is the call graph for this function:

ilObjiLincCourse::updateClassrooms ( )

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

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

{
global $ilErr;
$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;
}
if (array_key_exists('akclassvalue1',$_POST["Fobject"]))
{
$data["akclassvalue1"] = $_POST["Fobject"]["akclassvalue1"];
}
if (array_key_exists('akclassvalue2',$_POST["Fobject"]))
{
$data["akclassvalue2"] = $_POST["Fobject"]["akclassvalue2"];
}
foreach ($response->data['classes'] as $class_id => $data2)
{
include_once("./Modules/ILinc/classes/class.ilObjiLincClassroom.php");
$icla_obj = new ilObjiLincClassroom($class_id,$this->ref_id);
if (!$icla_obj->update($data))
{
$this->error_msg = $icla_obj->getErrorMsg();
return false;
}
unset($icla_obj);
}
return true;
}

+ Here is the call graph for this function:

ilObjiLincCourse::uploadPicture ( $a_user_obj,
  $a_lang 
)

Definition at line 994 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 783 of file class.ilObjiLincCourse.php.

Referenced by addMember().

{
//$data = $a_user_obj->getiLincData();
include_once ('./Modules/ILinc/classes/class.ilObjiLincUser.php');
$ilinc_user = new ilObjiLincUser($a_user_obj);
if (!$ilinc_user->id and !$ilinc_user->login)
{
return false;
}
return true;
}

+ Here is the caller graph for this function:

ilObjiLincCourse::userLogin ( $a_user_obj)

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

{
include_once ('./Modules/ILinc/classes/class.ilObjiLincUser.php');
$ilinc_user = new ilObjiLincUser($a_user_obj);
$this->ilincAPI->userLogin($ilinc_user);
$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: