Public Member Functions | Data Fields

ilObjCourse Class Reference

Inheritance diagram for ilObjCourse:
Collaboration diagram for ilObjCourse:

Public Member Functions

 ilObjCourse ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 setId ($a_id)
 set object id public
 getDescription ()
 get object description
 setDescription ($a_description)
 set object description
 getTitle ()
 get object title public
 setTitle ($a_title)
 set object title
 getSyllabus ()
 setSyllabus ($a_syllabus)
 getContactName ()
 setContactName ($a_cn)
 getContactConsultation ()
 setContactConsultation ($a_value)
 getContactPhone ()
 setContactPhone ($a_value)
 getcontactEmail ()
 setContactEmail ($a_value)
 getContactResponsibility ()
 setContactResponsibility ($a_value)
 getActivationUnlimitedStatus ()
 setActivationUnlimitedStatus ($a_unlimited)
 getActivationStart ()
 setActivationStart ($a_value)
 getActivationEnd ()
 setActivationEnd ($a_value)
 getOfflineStatus ()
 setOfflineStatus ($a_value)
 getSubscriptionUnlimitedStatus ()
 setSubscriptionUnlimitedStatus ($a_unlimited)
 getSubscriptionStart ()
 setSubscriptionStart ($a_value)
 getSubscriptionEnd ()
 getSubscriptionType ()
 setSubscriptionType ($a_value)
 setSubscriptionEnd ($a_value)
 getSubscriptionPassword ()
 setSubscriptionPassword ($a_value)
 setObjectiveViewStatus ($a_status)
 enabledObjectiveView ()
 inSubscriptionTime ()
 getSubscriptionMaxMembers ()
 setSubscriptionMaxMembers ($a_value)
 getSubscriptionNotify ()
 setSubscriptionNotify ($a_value)
 getOrderType ()
 setOrderType ($a_value)
 getArchiveStart ()
 setArchiveStart ($a_value)
 getArchiveEnd ()
 setArchiveEnd ($a_value)
 getArchiveType ()
 setArchiveType ($a_value)
 setAboStatus ($a_status)
 getAboStatus ()
 getMessage ()
 setMessage ($a_message)
 appendMessage ($a_message)
 getMembers ()
 isActivated ($a_check_archive=false)
 _isActivated ($a_obj_id)
 Static version of isActive() to avoid instantiation of course object.
 isArchived ()
 allowAbo ()
 read ($a_force_db=false)
 read object data from db into object
 create ($a_upload=false)
 validate ()
 ilClone ($a_parent_ref)
 copy all properties and subobjects of a course.
 delete ()
 delete course and all related data
 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.
 update ()
 update meta data only
 __updateSettings ()
 __createDefaultSettings ()
 __readSettings ()
 initWaitingList ()
 initCourseMemberObject ()
 initCourseItemObject ($a_child_id=0)
 initCourseArchiveObject ()
 __initDefaultRoles ()
 __getLocalRoles ()
 __deleteSettings ()
 getDefaultMemberRole ()
 getDefaultTutorRole ()
 getDefaultAdminRole ()
 _checkCondition ($a_obj_id, $a_operator, $a_value)

Data Fields

 $members_obj
 $archives_obj
 $items_obj

Detailed Description

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


Member Function Documentation

ilObjCourse::__createDefaultSettings (  ) 

Definition at line 760 of file class.ilObjCourse.php.

References $query, $res, getContactConsultation(), getContactName(), getContactPhone(), getContactResponsibility(), getSubscriptionMaxMembers(), and getSyllabus().

Referenced by __updateSettings(), and create().

        {
                global $ilDB;

                $query = "INSERT INTO crs_settings SET ".
                        "obj_id = '".$this->getId()."', ".
                        "syllabus = '".ilUtil::prepareDBString($this->getSyllabus())."', ".
                        "contact_name = '".ilUtil::prepareDBString($this->getContactName())."', ".
                        "contact_responsibility = '".ilUtil::prepareDBString($this->getContactResponsibility())."', ".
                        "contact_phone = '".ilUtil::prepareDBString($this->getContactPhone())."', ".
                        "contact_email = '".ilUtil::prepareDBString($this->getContactEmail())."', ".
                        "contact_consultation = '".ilUtil::prepareDBString($this->getContactConsultation())."', ".
                        "activation_unlimited = '1', ".
                        "activation_start = '".$this->getActivationStart()."', ".
                        "activation_end = '".$this->getActivationEnd()."', ".
                        "activation_offline = '1', ".
                        "subscription_unlimited = '1', ".
                        "subscription_start = '".$this->getSubscriptionStart()."', ".
                        "subscription_end = '".$this->getSubscriptionEnd()."', ".
                        "subscription_type = '".(int) $this->SUBSCRIPTION_DEACTIVATED."', ".
                        "subscription_password = '".ilUtil::prepareDBString($this->getSubscriptionPassword())."', ".
                        "subscription_max_members = '".(int) $this->getSubscriptionMaxMembers()."', ".
                        "subscription_notify = '1', ".
                        "sortorder = '".(int) $this->SORT_MANUAL."', ".
                        "archive_start = '".$this->getArchiveStart()."', ".
                        "archive_end = '".$this->getArchiveEnd()."', ".
                        "archive_type = '".(int) $this->ARCHIVE_DISABLED."', ".
                        "abo = '".(int) $this->ABO_ENABLED."', ".
                        "objective_view = '0'";

                $res = $ilDB->query($query);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjCourse::__deleteSettings (  ) 

Definition at line 959 of file class.ilObjCourse.php.

References $query.

Referenced by delete().

        {
                $query = "DELETE FROM crs_settings ".
                        "WHERE obj_id = '".$this->getId()."'";

                $this->ilias->db->query($query);

                return true;
        }       

Here is the caller graph for this function:

ilObjCourse::__getLocalRoles (  ) 

Definition at line 948 of file class.ilObjCourse.php.

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

Referenced by getDefaultAdminRole(), getDefaultMemberRole(), and getDefaultTutorRole().

        {
                global $rbacreview;

                // GET role_objects of predefined roles
                
                $rolf = $rbacreview->getRoleFolderOfObject($this->getRefId());

                return $rbacreview->getRolesOfRoleFolder($rolf["ref_id"],false);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjCourse::__initDefaultRoles (  ) 

Definition at line 879 of file class.ilObjCourse.php.

References $ops, $query, $rbacadmin, $rbacreview, $res, ilObject::createRoleFolder(), ilObject::getId(), and ilObject::getRefId().

        {
                global $rbacadmin,$rbacreview;

                $rolf_obj = $this->createRoleFolder();

                // CREATE ADMIN ROLE
                $role_obj = $rolf_obj->createRole("il_crs_admin_".$this->getRefId(),"Admin of course obj_no.".$this->getId());
                $admin_id = $role_obj->getId();
                
                // SET PERMISSION TEMPLATE OF NEW LOCAL ADMIN ROLE
                $query = "SELECT obj_id FROM object_data ".
                        " WHERE type='rolt' AND title='il_crs_admin'";

                $res = $this->ilias->db->getRow($query, DB_FETCHMODE_OBJECT);
                $rbacadmin->copyRolePermission($res->obj_id,ROLE_FOLDER_ID,$rolf_obj->getRefId(),$role_obj->getId());

                // SET OBJECT PERMISSIONS OF COURSE OBJECT
                $ops = $rbacreview->getOperationsOfRole($role_obj->getId(),"crs",$rolf_obj->getRefId());
                $rbacadmin->grantPermission($role_obj->getId(),$ops,$this->getRefId());

                // SET OBJECT PERMISSIONS OF ROLE FOLDER OBJECT
                $ops = $rbacreview->getOperationsOfRole($role_obj->getId(),"rolf",$rolf_obj->getRefId());
                $rbacadmin->grantPermission($role_obj->getId(),$ops,$rolf_obj->getRefId());

                // CREATE TUTOR ROLE
                // CREATE ROLE AND ASSIGN ROLE TO ROLEFOLDER...
                $role_obj = $rolf_obj->createRole("il_crs_tutor_".$this->getRefId(),"Tutors of course obj_no.".$this->getId());
                $member_id = $role_obj->getId();

                // SET PERMISSION TEMPLATE OF NEW LOCAL ROLE
                $query = "SELECT obj_id FROM object_data ".
                        " WHERE type='rolt' AND title='il_crs_tutor'";
                $res = $this->ilias->db->getRow($query, DB_FETCHMODE_OBJECT);
                $rbacadmin->copyRolePermission($res->obj_id,ROLE_FOLDER_ID,$rolf_obj->getRefId(),$role_obj->getId());

                // SET OBJECT PERMISSIONS OF COURSE OBJECT
                $ops = $rbacreview->getOperationsOfRole($role_obj->getId(),"crs",$rolf_obj->getRefId());
                $rbacadmin->grantPermission($role_obj->getId(),$ops,$this->getRefId());

                // SET OBJECT PERMISSIONS OF ROLE FOLDER OBJECT
                $ops = $rbacreview->getOperationsOfRole($role_obj->getId(),"rolf",$rolf_obj->getRefId());
                $rbacadmin->grantPermission($role_obj->getId(),$ops,$rolf_obj->getRefId());

                // CREATE MEMBER ROLE
                // CREATE ROLE AND ASSIGN ROLE TO ROLEFOLDER...
                $role_obj = $rolf_obj->createRole("il_crs_member_".$this->getRefId(),"Member of course obj_no.".$this->getId());
                $member_id = $role_obj->getId();

                // SET PERMISSION TEMPLATE OF NEW LOCAL ROLE
                $query = "SELECT obj_id FROM object_data ".
                        " WHERE type='rolt' AND title='il_crs_member'";
                $res = $this->ilias->db->getRow($query, DB_FETCHMODE_OBJECT);
                $rbacadmin->copyRolePermission($res->obj_id,ROLE_FOLDER_ID,$rolf_obj->getRefId(),$role_obj->getId());
                
                // SET OBJECT PERMISSIONS OF COURSE OBJECT
                $ops = $rbacreview->getOperationsOfRole($role_obj->getId(),"crs",$rolf_obj->getRefId());
                $rbacadmin->grantPermission($role_obj->getId(),$ops,$this->getRefId());

                // SET OBJECT PERMISSIONS OF ROLE FOLDER OBJECT
                $ops = $rbacreview->getOperationsOfRole($role_obj->getId(),"rolf",$rolf_obj->getRefId());
                $rbacadmin->grantPermission($role_obj->getId(),$ops,$rolf_obj->getRefId());

                unset($role_obj);
                unset($rolf_obj);

                return true;
        }

Here is the call graph for this function:

ilObjCourse::__readSettings (  ) 

Definition at line 794 of file class.ilObjCourse.php.

References $query, $res, $row, setAboStatus(), setActivationEnd(), setActivationStart(), setActivationUnlimitedStatus(), setArchiveEnd(), setArchiveStart(), setArchiveType(), setContactConsultation(), setContactEmail(), setContactName(), setContactPhone(), setContactResponsibility(), setObjectiveViewStatus(), setOfflineStatus(), setOrderType(), setSubscriptionEnd(), setSubscriptionMaxMembers(), setSubscriptionNotify(), setSubscriptionPassword(), setSubscriptionStart(), setSubscriptionType(), setSubscriptionUnlimitedStatus(), and setSyllabus().

Referenced by read().

        {
                global $ilDB;

                $query = "SELECT * FROM crs_settings WHERE obj_id = '".$this->getId()."'";

                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->setSyllabus($row->syllabus);
                        $this->setContactName($row->contact_name);
                        $this->setContactResponsibility($row->contact_responsibility);
                        $this->setContactPhone($row->contact_phone);
                        $this->setContactEmail($row->contact_email);
                        $this->setContactConsultation($row->contact_consultation);
                        $this->setActivationUnlimitedStatus($row->activation_unlimited);
                        $this->setActivationStart($row->activation_start);
                        $this->setActivationEnd($row->activation_end);
                        $this->setOfflineStatus($row->activation_offline);
                        $this->setSubscriptionUnlimitedStatus($row->subscription_unlimited);
                        $this->setSubscriptionStart($row->subscription_start);
                        $this->setSubscriptionEnd($row->subscription_end);
                        $this->setSubscriptionType($row->subscription_type);
                        $this->setSubscriptionPassword($row->subscription_password);
                        $this->setSubscriptionMaxMembers($row->subscription_max_members);
                        $this->setSubscriptionNotify($row->subscription_notify);
                        $this->setOrderType($row->sortorder);
                        $this->setArchiveStart($row->archive_start);
                        $this->setArchiveEnd($row->archive_end);
                        $this->setArchiveType($row->archive_type);
                        $this->setAboStatus($row->abo);
                        $this->setObjectiveViewStatus($row->objective_view);
                }
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjCourse::__updateSettings (  ) 

Definition at line 717 of file class.ilObjCourse.php.

References $query, $res, __createDefaultSettings(), enabledObjectiveView(), getAboStatus(), getActivationUnlimitedStatus(), getArchiveType(), getContactConsultation(), getContactName(), getContactPhone(), getContactResponsibility(), getOfflineStatus(), getOrderType(), getSubscriptionMaxMembers(), getSubscriptionNotify(), getSubscriptionPassword(), getSubscriptionType(), getSubscriptionUnlimitedStatus(), and getSyllabus().

Referenced by update().

        {
                global $ilDB;

                // Due to a bug 3.5.alpha maybe no settings exist. => create default settings

                $query = "SELECT * FROM crs_settings WHERE obj_id = '".$this->getId()."'";
                $res = $ilDB->query($query);

                if(!$res->numRows())
                {
                        $this->__createDefaultSettings();
                }

                $query = "UPDATE crs_settings SET ".
                        "syllabus = '".ilUtil::prepareDBString($this->getSyllabus())."', ".
                        "contact_name = '".ilUtil::prepareDBString($this->getContactName())."', ".
                        "contact_responsibility = '".ilUtil::prepareDBString($this->getContactResponsibility())."', ".
                        "contact_phone = '".ilUtil::prepareDBString($this->getContactPhone())."', ".
                        "contact_email = '".ilUtil::prepareDBString($this->getContactEmail())."', ".
                        "contact_consultation = '".ilUtil::prepareDBString($this->getContactConsultation())."', ".
                        "activation_unlimited = '".(int) $this->getActivationUnlimitedStatus()."', ".
                        "activation_start = '".$this->getActivationStart()."', ".
                        "activation_end = '".$this->getActivationEnd()."', ".
                        "activation_offline = '".(int) $this->getOfflineStatus()."', ".
                        "subscription_unlimited = '".(int) $this->getSubscriptionUnlimitedStatus()."', ".
                        "subscription_start = '".$this->getSubscriptionStart()."', ".
                        "subscription_end = '".$this->getSubscriptionEnd()."', ".
                        "subscription_type = '".(int) $this->getSubscriptionType()."', ".
                        "subscription_password = '".ilUtil::prepareDBString($this->getSubscriptionPassword())."', ".
                        "subscription_max_members = '".(int) $this->getSubscriptionMaxMembers()."', ".
                        "subscription_notify = '".(int) $this->getSubscriptionNotify()."', ".
                        "sortorder = '".(int) $this->getOrderType()."', ".
                        "archive_start = '".$this->getArchiveStart()."', ".
                        "archive_end = '".$this->getArchiveEnd()."', ".
                        "archive_type = '".(int) $this->getArchiveType()."', ".
                        "abo = '".(int) $this->getAboStatus()."', ".
                        "objective_view = '".(int) $this->enabledObjectiveView()."' ".
                        "WHERE obj_id = '".$this->getId()."'";

                $res = $ilDB->query($query);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjCourse::_checkCondition ( a_obj_id,
a_operator,
a_value 
)

Definition at line 1019 of file class.ilObjCourse.php.

References ilObject::$ilias, and ilCourseMembers::_hasPassed().

        {
                global $ilias;

                include_once "./course/classes/class.ilCourseMembers.php";
                
                switch($a_operator)
                {
                        case 'passed':
                                return ilCourseMembers::_hasPassed($a_obj_id,$ilias->account->getId());
                                
                        default:
                                return true;
                }
        }

Here is the call graph for this function:

ilObjCourse::_isActivated ( a_obj_id  ) 

Static version of isActive() to avoid instantiation of course object.

Parameters:
int id of user
Returns:
boolean

Definition at line 370 of file class.ilObjCourse.php.

References $query, $res, $row, and $start.

Referenced by ilObjCourseAccess::_checkAccess(), and ilObjCourseListGUI::getProperties().

        {
                global $ilDB;

                $query = "SELECT * FROM crs_settings ".
                        "WHERE obj_id = '".$a_obj_id."'";

                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $offline = $row->activation_offline;
                        $unlimited = $row->activation_unlimited;
                        $start = $row->activation_start;
                        $end = $row->activation_end;
                }
                if($offline)
                {
                        return false;
                }
                if($unlimited)
                {
                        return true;
                }
                if(time() < $start or
                   time() > $end)
                {
                        return false;
                }
                return true;
        }

Here is the caller graph for this function:

ilObjCourse::allowAbo (  ) 

Definition at line 415 of file class.ilObjCourse.php.

        {
                return $this->ABO == $this->ABO_ENABLED;
        }

ilObjCourse::appendMessage ( a_message  ) 

Definition at line 324 of file class.ilObjCourse.php.

References getMessage().

Referenced by validate().

        {
                if($this->getMessage())
                {
                        $this->message .= "<br /> ";
                }
                $this->message .= $a_message;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjCourse::create ( a_upload = false  ) 

Definition at line 426 of file class.ilObjCourse.php.

References __createDefaultSettings(), ilObject::create(), and ilObject::createMetaData().

        {
                parent::create($a_upload);
                $this->createMetaData();

                if (!$a_upload)
                {
                        #$this->__initMetaObject();
                        #$this->meta_data->setId($this->getId());
                        #$this->meta_data->setType($this->getType());
                        #$this->meta_data->setTitle($this->getTitle());
                        #$this->meta_data->setDescription($this->getDescription());
                        #$this->meta_data->setObject($this);
                        #$this->meta_data->create();

                        $this->__createDefaultSettings();
                }
        }

Here is the call graph for this function:

ilObjCourse::delete (  ) 

delete course 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 560 of file class.ilObjCourse.php.

References __deleteSettings(), ilObjCourseGrouping::_deleteAll(), ilCourseObjective::_deleteAll(), ilObject::deleteMetaData(), ilObject::getId(), initCourseArchiveObject(), initCourseItemObject(), and initCourseMemberObject().

        {
                // always call parent delete function first!!
                if (!parent::delete())
                {
                        return false;
                }


                // delete meta data
                $this->deleteMetaData();

                // put here course specific stuff

                $this->__deleteSettings();

                $this->initCourseItemObject();
                $this->items_obj->deleteAllEntries();

                $this->initCourseMemberObject();
                $this->members_obj->deleteAllEntries();

                $this->initCourseArchiveObject();
                $this->archives_obj->deleteAll();

                include_once './course/classes/class.ilCourseObjective.php';

                ilCourseObjective::_deleteAll($this->getId());

                include_once './course/classes/class.ilObjCourseGrouping.php';

                ilObjCourseGrouping::_deleteAll($this->getId());

                return true;
        }

Here is the call graph for this function:

ilObjCourse::enabledObjectiveView (  ) 

Definition at line 240 of file class.ilObjCourse.php.

Referenced by __updateSettings(), and ilClone().

        {
                return (bool) $this->objective_view;
        }

Here is the caller graph for this function:

ilObjCourse::getAboStatus (  ) 

Definition at line 310 of file class.ilObjCourse.php.

Referenced by __updateSettings(), and ilClone().

        {
                return $this->abo;
        }

Here is the caller graph for this function:

ilObjCourse::getActivationEnd (  ) 

Definition at line 180 of file class.ilObjCourse.php.

Referenced by ilClone(), isActivated(), and validate().

        {
                return $this->activation_end ? $this->activation_end : mktime(0,0,0,12,12,date("Y",time())+2);
        }

Here is the caller graph for this function:

ilObjCourse::getActivationStart (  ) 

Definition at line 172 of file class.ilObjCourse.php.

Referenced by ilClone(), isActivated(), and validate().

        {
                return $this->activation_start ? $this->activation_start : time();
        }

Here is the caller graph for this function:

ilObjCourse::getActivationUnlimitedStatus (  ) 

Definition at line 164 of file class.ilObjCourse.php.

Referenced by __updateSettings(), ilClone(), isActivated(), and validate().

        {
                return $this->activation_unlimited ? true : false;
        } 

Here is the caller graph for this function:

ilObjCourse::getArchiveEnd (  ) 

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

Referenced by ilClone(), isArchived(), and validate().

        {
                return $this->archive_end ? $this->archive_end : mktime(0,0,0,12,12,date("Y",time())+2);
        }

Here is the caller graph for this function:

ilObjCourse::getArchiveStart (  ) 

Definition at line 282 of file class.ilObjCourse.php.

Referenced by ilClone(), isArchived(), and validate().

        {
                return $this->archive_start ? $this->archive_start : time();
        }

Here is the caller graph for this function:

ilObjCourse::getArchiveType (  ) 

Definition at line 298 of file class.ilObjCourse.php.

Referenced by __updateSettings(), ilClone(), and isArchived().

        {
                return $this->archive_type ? $this->archive_type : $this->ARCHIVE_DISABLED;
        }

Here is the caller graph for this function:

ilObjCourse::getContactConsultation (  ) 

Definition at line 132 of file class.ilObjCourse.php.

Referenced by __createDefaultSettings(), __updateSettings(), and ilClone().

        {
                return $this->contact_consultation;
        }

Here is the caller graph for this function:

ilObjCourse::getcontactEmail (  ) 

Definition at line 148 of file class.ilObjCourse.php.

        {
                return $this->contact_email;
        }

ilObjCourse::getContactName (  ) 

Definition at line 124 of file class.ilObjCourse.php.

Referenced by __createDefaultSettings(), __updateSettings(), and ilClone().

        {
                return $this->contact_name;
        }

Here is the caller graph for this function:

ilObjCourse::getContactPhone (  ) 

Definition at line 140 of file class.ilObjCourse.php.

Referenced by __createDefaultSettings(), __updateSettings(), and ilClone().

        {
                return $this->contact_phone;
        }

Here is the caller graph for this function:

ilObjCourse::getContactResponsibility (  ) 

Definition at line 156 of file class.ilObjCourse.php.

Referenced by __createDefaultSettings(), __updateSettings(), and ilClone().

        {
                return $this->contact_responsibility;
        }

Here is the caller graph for this function:

ilObjCourse::getDefaultAdminRole (  ) 

Definition at line 1001 of file class.ilObjCourse.php.

References $role_id, __getLocalRoles(), and ilObjectFactory::getInstanceByObjId().

        {
                $local_roles = $this->__getLocalRoles();

                foreach($local_roles as $role_id)
                {
                        if($tmp_role =& ilObjectFactory::getInstanceByObjId($role_id,false))
                        {
                                if(!strcmp($tmp_role->getTitle(),"il_crs_admin_".$this->getRefId()))
                                {
                                        return $role_id;
                                }
                        }
                }
                return false;
        }

Here is the call graph for this function:

ilObjCourse::getDefaultMemberRole (  ) 

Definition at line 969 of file class.ilObjCourse.php.

References $role_id, __getLocalRoles(), and ilObjectFactory::getInstanceByObjId().

        {
                $local_roles = $this->__getLocalRoles();

                foreach($local_roles as $role_id)
                {
                        if($tmp_role =& ilObjectFactory::getInstanceByObjId($role_id,false))
                        {
                                if(!strcmp($tmp_role->getTitle(),"il_crs_member_".$this->getRefId()))
                                {
                                        return $role_id;
                                }
                        }
                }
                return false;
        }

Here is the call graph for this function:

ilObjCourse::getDefaultTutorRole (  ) 

Definition at line 985 of file class.ilObjCourse.php.

References $role_id, __getLocalRoles(), and ilObjectFactory::getInstanceByObjId().

        {
                $local_roles = $this->__getLocalRoles();

                foreach($local_roles as $role_id)
                {
                        if($tmp_role =& ilObjectFactory::getInstanceByObjId($role_id,false))
                        {
                                if(!strcmp($tmp_role->getTitle(),"il_crs_tutor_".$this->getRefId()))
                                {
                                        return $role_id;
                                }
                        }
                }
                return false;
        }

Here is the call graph for this function:

ilObjCourse::getDescription (  ) 

get object description

public

Returns:
string object description

Reimplemented from ilObject.

Definition at line 93 of file class.ilObjCourse.php.

        {
                return parent::getDescription();
        }

ilObjCourse::getMembers (  ) 

Definition at line 333 of file class.ilObjCourse.php.

        {
                return $this->members_obj->getMembers();
        }

ilObjCourse::getMessage (  ) 

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

Referenced by appendMessage(), and validate().

        {
                return $this->message;
        }

Here is the caller graph for this function:

ilObjCourse::getOfflineStatus (  ) 

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

Referenced by __updateSettings(), ilClone(), and isActivated().

        {
                return $this->offline_status ? true : false;
        }

Here is the caller graph for this function:

ilObjCourse::getOrderType (  ) 

Definition at line 274 of file class.ilObjCourse.php.

Referenced by __updateSettings(), and ilClone().

        {
                return $this->order_type ? $this->order_type : $this->SORT_TITLE;
        }

Here is the caller graph for this function:

ilObjCourse::getSubscriptionEnd (  ) 

Definition at line 212 of file class.ilObjCourse.php.

Referenced by ilClone(), inSubscriptionTime(), and validate().

        {
                return $this->subscription_end ? $this->subscription_end : mktime(0,0,0,12,12,date("Y",time())+2);
        }

Here is the caller graph for this function:

ilObjCourse::getSubscriptionMaxMembers (  ) 

Definition at line 258 of file class.ilObjCourse.php.

Referenced by __createDefaultSettings(), __updateSettings(), ilClone(), and validate().

        {
                return $this->subscription_max_members;
        }

Here is the caller graph for this function:

ilObjCourse::getSubscriptionNotify (  ) 

Definition at line 266 of file class.ilObjCourse.php.

Referenced by __updateSettings(), and ilClone().

        {
                return $this->subscription_notify ? true : false;
        }

Here is the caller graph for this function:

ilObjCourse::getSubscriptionPassword (  ) 

Definition at line 228 of file class.ilObjCourse.php.

Referenced by __updateSettings(), ilClone(), and validate().

        {
                return $this->subscription_password;
        }

Here is the caller graph for this function:

ilObjCourse::getSubscriptionStart (  ) 

Definition at line 204 of file class.ilObjCourse.php.

Referenced by ilClone(), inSubscriptionTime(), and validate().

        {
                return $this->subscription_start ? $this->subscription_start : time();
        }

Here is the caller graph for this function:

ilObjCourse::getSubscriptionType (  ) 

Definition at line 216 of file class.ilObjCourse.php.

Referenced by __updateSettings(), ilClone(), and validate().

        {
                return $this->subscription_type ? $this->subscription_type : $this->SUBSCRIPTION_DEACTIVATED;
        }

Here is the caller graph for this function:

ilObjCourse::getSubscriptionUnlimitedStatus (  ) 

Definition at line 196 of file class.ilObjCourse.php.

Referenced by __updateSettings(), ilClone(), inSubscriptionTime(), and validate().

        {
                return $this->subscription_unlimited ? true : false;
        } 

Here is the caller graph for this function:

ilObjCourse::getSyllabus (  ) 

Definition at line 116 of file class.ilObjCourse.php.

Referenced by __createDefaultSettings(), __updateSettings(), and ilClone().

        {
                return $this->syllabus;
        }

Here is the caller graph for this function:

ilObjCourse::getTitle (  ) 

get object title public

Returns:
string object title

Reimplemented from ilObject.

Definition at line 106 of file class.ilObjCourse.php.

        {
                return parent::getTitle();
        }

ilObjCourse::ilClone ( a_parent_ref  ) 

copy all properties and subobjects of a course.

public

Returns:
integer new ref id

Reimplemented from ilObject.

Definition at line 506 of file class.ilObjCourse.php.

References $rbacadmin, enabledObjectiveView(), getAboStatus(), getActivationEnd(), getActivationStart(), getActivationUnlimitedStatus(), getArchiveEnd(), getArchiveStart(), getArchiveType(), getContactConsultation(), getContactName(), getContactPhone(), getContactResponsibility(), ilObjectFactory::getInstanceByRefId(), getOfflineStatus(), getOrderType(), getSubscriptionEnd(), getSubscriptionMaxMembers(), getSubscriptionNotify(), getSubscriptionPassword(), getSubscriptionStart(), getSubscriptionType(), getSubscriptionUnlimitedStatus(), and getSyllabus().

        {               
                global $rbacadmin;

                // always call parent ilClone function first!!
                $new_ref_id = parent::ilClone($a_parent_ref);
                
                // put here crs specific stuff
                $new_course =& ilObjectFactory::getInstanceByRefId($new_ref_id);

                $new_course->__initDefaultRoles();
                $new_course->initCourseMemberObject();
                $new_course->members_obj->add($this->ilias->account,$new_course->members_obj->ROLE_ADMIN);
                $new_course->__createDefaultSettings();


                $new_course->setSyllabus($this->getSyllabus());
                $new_course->setContactName($this->getContactName());
                $new_course->setContactConsultation($this->getContactConsultation());
                $new_course->setContactPhone($this->getContactPhone());
                $new_course->setContactEmail($this->getContactEmail());
                $new_course->setContactResponsibility($this->getContactResponsibility());

                $new_course->setActivationUnlimitedStatus($this->getActivationUnlimitedStatus());
                $new_course->setActivationStart($this->getActivationStart());
                $new_course->setActivationEnd($this->getActivationEnd());
                $new_course->setOfflineStatus($this->getOfflineStatus());

                $new_course->setSubscriptionUnlimitedStatus($this->getSubscriptionUnlimitedStatus());
                $new_course->setSubscriptionStart($this->getSubscriptionStart());
                $new_course->setSubscriptionEnd($this->getSubscriptionEnd());
                $new_course->setSubscriptionType($this->getSubscriptionType());
                $new_course->setSubscriptionPassword($this->getSubscriptionPassword());
                $new_course->setSubscriptionMaxMembers($this->getSubscriptionMaxMembers());
                $new_course->setSubscriptionNotify($this->getSubscriptionNotify());
                $new_course->setOrderType($this->getOrderType());
                $new_course->setArchiveStart($this->getArchiveStart());
                $new_course->setArchiveEnd($this->getArchiveEnd());
                $new_course->setArchiveType($this->getArchiveType());
                $new_course->setAboStatus($this->getAboStatus());
                $new_course->setObjectiveViewStatus($this->enabledObjectiveView());

                $new_course->update();

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

Here is the call graph for this function:

ilObjCourse::ilObjCourse ( 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 49 of file class.ilObjCourse.php.

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

        {
                #define("ILIAS_MODULE","course");
                #define("KEEP_IMAGE_PATH",1);

                $this->SUBSCRIPTION_DEACTIVATED = 1;
                $this->SUBSCRIPTION_CONFIRMATION = 2;
                $this->SUBSCRIPTION_DIRECT = 3;
                $this->SUBSCRIPTION_PASSWORD = 4;
                $this->SUBSCRIPTION_AUTOSUBSCRIPTION = 5;
                $this->SORT_MANUAL = 1;
                $this->SORT_TITLE = 2;
                $this->SORT_ACTIVATION = 3;
                $this->ARCHIVE_DISABLED = 1;
                $this->ARCHIVE_READ = 2;
                $this->ARCHIVE_DOWNLOAD = 3;
                $this->ABO_ENABLED = 1;
                $this->ABO_DISABLED = 0;

                $this->type = "crs";
                $this->ilObject($a_id,$a_call_by_reference);

                if($a_id)
                {
                        #$this->__initMetaObject();
                        $this->initCourseMemberObject();
                }
                else
                {

                }

        }

Here is the call graph for this function:

ilObjCourse::initCourseArchiveObject (  ) 

Definition at line 865 of file class.ilObjCourse.php.

Referenced by delete().

        {
                include_once "./course/classes/class.ilCourseArchives.php";

                if(!is_object($this->archives_obj))
                {
                        $this->archives_obj =& new ilCourseArchives($this);
                }
                return true;
        }

Here is the caller graph for this function:

ilObjCourse::initCourseItemObject ( a_child_id = 0  ) 

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

Referenced by delete().

        {
                include_once "./course/classes/class.ilCourseItems.php";
                
                if(!is_object($this->items_obj))
                {
                        $this->items_obj =& new ilCourseItems($this,$a_child_id);
                }
                return true;
        }

Here is the caller graph for this function:

ilObjCourse::initCourseMemberObject (  ) 

Definition at line 843 of file class.ilObjCourse.php.

Referenced by delete(), ilObjCourse(), and validate().

        {
                include_once "./course/classes/class.ilCourseMembers.php";

                if(!is_object($this->members_obj))
                {
                        $this->members_obj =& new ilCourseMembers($this);
                }
                return true;
        }

Here is the caller graph for this function:

ilObjCourse::initWaitingList (  ) 

Definition at line 830 of file class.ilObjCourse.php.

References ilObject::getId().

        {
                include_once "./course/classes/class.ilCourseWaitingList.php";

                if(!is_object($this->waiting_list_obj))
                {
                        $this->waiting_list_obj =& new ilCourseWaitingList($this->getId());
                }
                return true;
        }

Here is the call graph for this function:

ilObjCourse::inSubscriptionTime (  ) 

Definition at line 245 of file class.ilObjCourse.php.

References getSubscriptionEnd(), getSubscriptionStart(), and getSubscriptionUnlimitedStatus().

        {
                if($this->getSubscriptionUnlimitedStatus())
                {
                        return true;
                }
                if(time() > $this->getSubscriptionStart() and time() < $this->getSubscriptionEnd())
                {
                        return true;
                }
                return false;
        }

Here is the call graph for this function:

ilObjCourse::isActivated ( a_check_archive = false  ) 

Definition at line 339 of file class.ilObjCourse.php.

References getActivationEnd(), getActivationStart(), getActivationUnlimitedStatus(), getOfflineStatus(), and isArchived().

        {
                if($a_check_archive)
                {
                        if($this->isArchived())
                        {
                                return true;
                        }
                }
                if($this->getOfflineStatus())
                {
                        return false;
                }
                if($this->getActivationUnlimitedStatus())
                {
                        return true;
                }
                if(time() < $this->getActivationStart() or
                   time() > $this->getActivationEnd())
                {
                        return false;
                }
                return true;
        }

Here is the call graph for this function:

ilObjCourse::isArchived (  ) 

Definition at line 402 of file class.ilObjCourse.php.

References getArchiveEnd(), getArchiveStart(), and getArchiveType().

Referenced by isActivated().

        {
                if($this->getArchiveType() == $this->ARCHIVE_DISABLED)
                {
                        return false;
                }
                if(time() < $this->getArchiveStart() or time() > $this->getArchiveEnd())
                {
                        return false;
                }
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjCourse::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.

public

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

Reimplemented from ilObject.

Definition at line 606 of file class.ilObjCourse.php.

References $_GET, $tree, and ilObject::getType().

        {
                global $tree;
                
                switch ($a_event)
                {
                        case "link":
                                
                                break;
                        
                        case "cut":
                                
                                break;
                                
                        case "copy":
                        
                                break;

                        case "paste":
                                
                                break;
                        
                        case "new":
                                
                                break;
                }
                
                // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
                if ($a_node_id==$_GET["ref_id"])
                {       
                        $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
                        $parent_type = $parent_obj->getType();
                        if($parent_type == $this->getType())
                        {
                                $a_node_id = (int) $tree->getParentId($a_node_id);
                        }
                }
                
                parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
        }

Here is the call graph for this function:

ilObjCourse::read ( a_force_db = false  ) 

read object data from db into object

Parameters:
boolean public

Reimplemented from ilObject.

Definition at line 420 of file class.ilObjCourse.php.

References __readSettings().

        {
                parent::read($a_force_db);

                $this->__readSettings();
        }

Here is the call graph for this function:

ilObjCourse::setAboStatus ( a_status  ) 

Definition at line 306 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->abo = $a_status;
        }

Here is the caller graph for this function:

ilObjCourse::setActivationEnd ( a_value  ) 

Definition at line 184 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->activation_end = $a_value;
        }

Here is the caller graph for this function:

ilObjCourse::setActivationStart ( a_value  ) 

Definition at line 176 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->activation_start = $a_value;
        }

Here is the caller graph for this function:

ilObjCourse::setActivationUnlimitedStatus ( a_unlimited  ) 

Definition at line 168 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->activation_unlimited = (bool) $a_unlimited;
        }

Here is the caller graph for this function:

ilObjCourse::setArchiveEnd ( a_value  ) 

Definition at line 294 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->archive_end = $a_value;
        }

Here is the caller graph for this function:

ilObjCourse::setArchiveStart ( a_value  ) 

Definition at line 286 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->archive_start = $a_value;
        }

Here is the caller graph for this function:

ilObjCourse::setArchiveType ( a_value  ) 

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

Referenced by __readSettings().

        {
                $this->archive_type = $a_value;
        }

Here is the caller graph for this function:

ilObjCourse::setContactConsultation ( a_value  ) 

Definition at line 136 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->contact_consultation = $a_value;
        }

Here is the caller graph for this function:

ilObjCourse::setContactEmail ( a_value  ) 

Definition at line 152 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->contact_email = $a_value;
        }

Here is the caller graph for this function:

ilObjCourse::setContactName ( a_cn  ) 

Definition at line 128 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->contact_name = $a_cn;
        }

Here is the caller graph for this function:

ilObjCourse::setContactPhone ( a_value  ) 

Definition at line 144 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->contact_phone = $a_value;
        }

Here is the caller graph for this function:

ilObjCourse::setContactResponsibility ( a_value  ) 

Definition at line 160 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->contact_responsibility = $a_value;
        }

Here is the caller graph for this function:

ilObjCourse::setDescription ( a_desc  ) 

set object description

public

Parameters:
string $a_desc object description

Reimplemented from ilObject.

Definition at line 97 of file class.ilObjCourse.php.

        {
                parent::setDescription($a_description);

//              $this->__initMetaObject();
//              $this->meta_data->setDescription($a_description);

                return true;
        }

ilObjCourse::setId ( a_id  ) 

set object id public

Parameters:
integer $a_id object id

Reimplemented from ilObject.

Definition at line 84 of file class.ilObjCourse.php.

        {
                parent::setId($a_id);

//              unset($this->meta_data);
                #$this->__initMetaObject();
        }

ilObjCourse::setMessage ( a_message  ) 

Definition at line 320 of file class.ilObjCourse.php.

Referenced by validate().

        {
                $this->message = $a_message;
        }

Here is the caller graph for this function:

ilObjCourse::setObjectiveViewStatus ( a_status  ) 

Definition at line 236 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->objective_view = $a_status;
        }

Here is the caller graph for this function:

ilObjCourse::setOfflineStatus ( a_value  ) 

Definition at line 192 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->offline_status = $a_value ? true : false;
        }

Here is the caller graph for this function:

ilObjCourse::setOrderType ( a_value  ) 

Definition at line 278 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->order_type = $a_value;
        }

Here is the caller graph for this function:

ilObjCourse::setSubscriptionEnd ( a_value  ) 

Definition at line 224 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->subscription_end = $a_value;
        }

Here is the caller graph for this function:

ilObjCourse::setSubscriptionMaxMembers ( a_value  ) 

Definition at line 262 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->subscription_max_members = $a_value;
        }

Here is the caller graph for this function:

ilObjCourse::setSubscriptionNotify ( a_value  ) 

Definition at line 270 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->subscription_notify = $a_value ? true : false;
        }

Here is the caller graph for this function:

ilObjCourse::setSubscriptionPassword ( a_value  ) 

Definition at line 232 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->subscription_password = $a_value;
        }

Here is the caller graph for this function:

ilObjCourse::setSubscriptionStart ( a_value  ) 

Definition at line 208 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->subscription_start = $a_value;
        }

Here is the caller graph for this function:

ilObjCourse::setSubscriptionType ( a_value  ) 

Definition at line 220 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->subscription_type = $a_value;
        }

Here is the caller graph for this function:

ilObjCourse::setSubscriptionUnlimitedStatus ( a_unlimited  ) 

Definition at line 200 of file class.ilObjCourse.php.

Referenced by __readSettings().

        {
                $this->subscription_unlimited = (bool) $a_unlimited;
        }

Here is the caller graph for this function:

ilObjCourse::setSyllabus ( a_syllabus  ) 

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

Referenced by __readSettings().

        {
                $this->syllabus = $a_syllabus;
        }

Here is the caller graph for this function:

ilObjCourse::setTitle ( a_title  ) 

set object title

public

Parameters:
string $a_title object title

Reimplemented from ilObject.

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

        {
                parent::setTitle($a_title);
//              $this->__initMetaObject();
//              $this->meta_data->setTitle($a_title);
        }

ilObjCourse::update (  ) 

update meta data only

update complete object

Reimplemented from ilObject.

Definition at line 687 of file class.ilObjCourse.php.

References __updateSettings(), and ilObject::updateMetaData().

        {
                $this->updateMetaData();
                $this->__updateSettings();
                parent::update();
        }

Here is the call graph for this function:

ilObjCourse::validate (  ) 

Definition at line 445 of file class.ilObjCourse.php.

References appendMessage(), getActivationEnd(), getActivationStart(), getActivationUnlimitedStatus(), getArchiveEnd(), getArchiveStart(), getMessage(), getSubscriptionEnd(), getSubscriptionMaxMembers(), getSubscriptionPassword(), getSubscriptionStart(), getSubscriptionType(), getSubscriptionUnlimitedStatus(), ilObjUser::getUserIdByLogin(), initCourseMemberObject(), ilUtil::is_email(), and setMessage().

        {
                $this->initCourseMemberObject();

                $this->setMessage('');

                if(!$this->getSubscriptionType())
                {
                        $this->appendMessage($this->lng->txt('crs_select_registration_type'));
                }

                if(!$this->getActivationUnlimitedStatus() and $this->getActivationEnd() < $this->getActivationStart())
                {
                        $this->appendMessage($this->lng->txt("activation_times_not_valid"));
                }
                if(!$this->getSubscriptionUnlimitedStatus() and $this->getSubscriptionStart() > $this->getSubscriptionEnd())
                {
                        $this->appendMessage($this->lng->txt("subscription_times_not_valid"));
                }
                #if((!$this->getActivationUnlimitedStatus() and
                #       !$this->getSubscriptionUnlimitedStatus()) and
                #       ($this->getSubscriptionStart() > $this->getActivationEnd() or
                #        $this->getSubscriptionStart() < $this->getActivationStart() or
                #        $this->getSubscriptionEnd() > $this->getActivationEnd() or
                #        $this->getSubscriptionEnd() <  $this->getActivationStart()))
                #   
                #{
                #       $this->appendMessage($this->lng->txt("subscription_time_not_within_activation"));
                #}
                if($this->getSubscriptionType() == $this->SUBSCRIPTION_PASSWORD and !$this->getSubscriptionPassword())
                {
                        $this->appendMessage($this->lng->txt("password_required"));
                }
                if($this->getSubscriptionMaxMembers() and !is_numeric($this->getSubscriptionMaxMembers()))
                {
                        $this->appendMessage($this->lng->txt("max_members_not_numeric"));
                }
                #if($this->getSubscriptionMaxMembers() and
                #       $this->getSubscriptionMaxMembers() < $this->members_obj->getCountMembers())
                #{
                #       $this->appendMessage($this->lng->txt("crs_max_members_smaller_members"));
                #}
                if($this->getArchiveStart() > $this->getArchiveEnd())
                {
                        $this->appendMessage($this->lng->txt("archive_times_not_valid"));
                }
                if($this->getContactEmail() and 
                   !(ilUtil::is_email($this->getContactEmail()) or 
                         ilObjUser::getUserIdByLogin($this->getContactEmail())))
                {
                        $this->appendMessage($this->lng->txt("contact_email_not_valid"));
                }
                return $this->getMessage() ? false : true;
        }

Here is the call graph for this function:


Field Documentation

ilObjCourse::$archives_obj

Definition at line 40 of file class.ilObjCourse.php.

ilObjCourse::$items_obj

Definition at line 41 of file class.ilObjCourse.php.

ilObjCourse::$members_obj

Definition at line 39 of file class.ilObjCourse.php.


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