Definition at line 61 of file class.ilObjCourse.php.
ilObjCourse::__createDefaultSettings | ( | ) |
Definition at line 706 of file class.ilObjCourse.php.
References $query, $res, getContactConsultation(), getContactEmail(), getContactName(), getContactPhone(), getContactResponsibility(), getSubscriptionMaxMembers(), and getSyllabus().
Referenced by create(), and updateSettings().
{ 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_type = '".IL_CRS_ACTIVATION_UNLIMITED."', ". #"activation_unlimited = '1', ". "activation_start = '".$this->getActivationStart()."', ". "activation_end = '".$this->getActivationEnd()."', ". #"activation_offline = '1', ". "subscription_limitation_type = '".IL_CRS_SUBSCRIPTION_DEACTIVATED."', ". #"subscription_unlimited = '1', ". "subscription_start = '".$this->getSubscriptionStart()."', ". "subscription_end = '".$this->getSubscriptionEnd()."', ". "subscription_type = '".(int) IL_CRS_SUBSCRIPTION_DIRECT."', ". "subscription_password = '".ilUtil::prepareDBString($this->getSubscriptionPassword())."', ". "subscription_max_members = '".(int) $this->getSubscriptionMaxMembers()."', ". "subscription_notify = '1', ". "view_mode = '0', ". "sortorder = '".(int) IL_CRS_SORT_TITLE."', ". "archive_start = '".$this->getArchiveStart()."', ". "archive_end = '".$this->getArchiveEnd()."', ". "archive_type = '".IL_CRS_ARCHIVE_NONE."', ". "abo = '".(int) $this->ABO_ENABLED."', ". #"objective_view = '0', ". "waiting_list = '1', ". "show_members = '1'"; $res = $ilDB->query($query); }
ilObjCourse::__deleteSettings | ( | ) |
ilObjCourse::__getCrsNonMemberTemplateId | ( | ) |
get course non-member template private
return | obj_id of roletemplate containing permissionsettings for non-member roles of a course. |
Definition at line 998 of file class.ilObjCourse.php.
References $q, $res, and $row.
Referenced by __setCourseStatus().
{ $q = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_crs_non_member'"; $res = $this->ilias->db->query($q); $row = $res->fetchRow(DB_FETCHMODE_ASSOC); return $row["obj_id"]; }
ilObjCourse::__getDefaultCourseRoles | ( | $ | a_crs_id = "" |
) |
get default course roles, returns the defaultlike create roles il_crs_tutor, il_crs_admin and il_crs_member private
returns | the obj_ids of course specific roles in an associative array. key=descripiton of the role (i.e. "il_crs_tutor", "il_crs_admin", "il_crs_member". value=obj_id of the role |
Definition at line 1017 of file class.ilObjCourse.php.
References $rbacadmin, $rbacreview, $role_id, and ilObject::getRefId().
Referenced by __setCourseStatus().
{ global $rbacadmin, $rbacreview; if (strlen($a_crs_id) > 0) { $crs_id = $a_crs_id; } else { $crs_id = $this->getRefId(); } $rolf = $rbacreview->getRoleFolderOfObject($crs_id); $role_arr = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"]); foreach ($role_arr as $role_id) { $role_Obj =& $this->ilias->obj_factory->getInstanceByObjId($role_id); $crs_Member ="il_crs_member_".$crs_id; $crs_Admin ="il_crs_admin_".$crs_id; $crs_Tutor ="il_crs_tutor_".$crs_id; if (strcmp($role_Obj->getTitle(), $crs_Member) == 0 ) { $arr_crsDefaultRoles["crs_member_role"] = $role_Obj->getId(); } if (strcmp($role_Obj->getTitle(), $crs_Admin) == 0) { $arr_crsDefaultRoles["crs_admin_role"] = $role_Obj->getId(); } if (strcmp($role_Obj->getTitle(), $crs_Tutor) == 0) { $arr_crsDefaultRoles["crs_tutor_role"] = $role_Obj->getId(); } } return $arr_crsDefaultRoles; }
ilObjCourse::__getLocalRoles | ( | ) |
Definition at line 1060 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); }
ilObjCourse::__readSettings | ( | ) |
Definition at line 745 of file class.ilObjCourse.php.
References $query, $res, $row, enableWaitingList(), setAboStatus(), setActivationEnd(), setActivationStart(), setActivationType(), setArchiveEnd(), setArchiveStart(), setArchiveType(), setContactConsultation(), setContactEmail(), setContactName(), setContactPhone(), setContactResponsibility(), setImportantInformation(), setOrderType(), setShowMembers(), setSubscriptionEnd(), setSubscriptionLimitationType(), setSubscriptionMaxMembers(), setSubscriptionNotify(), setSubscriptionPassword(), setSubscriptionStart(), setSubscriptionType(), setSyllabus(), and setViewMode().
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->setActivationType($row->activation_type); #$this->setActivationUnlimitedStatus($row->activation_unlimited); $this->setActivationStart($row->activation_start); $this->setActivationEnd($row->activation_end); #$this->setOfflineStatus($row->activation_offline); $this->setSubscriptionLimitationType($row->subscription_limitation_type); #$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->setViewMode($row->view_mode); $this->setOrderType($row->sortorder); $this->setArchiveStart($row->archive_start); $this->setArchiveEnd($row->archive_end); $this->setArchiveType($row->archive_type); $this->setAboStatus($row->abo); $this->enableWaitingList($row->waiting_list); $this->setImportantInformation($row->important); $this->setShowMembers($row->show_members); } return true; }
ilObjCourse::__setCourseStatus | ( | ) |
set course status
Grants permissions on the course object for all parent roles. Each permission is granted by computing the intersection of the role template il_crs_non_member and the permission template of the parent role.
Creates linked roles in the local role folder object for all parent roles and initializes their permission templates. Each permission template is initialized by computing the intersection of the role template il_crs_non_member and the permission template of the parent role.
private
Definition at line 923 of file class.ilObjCourse.php.
References $rbacadmin, $rbacreview, $rbacsystem, __getCrsNonMemberTemplateId(), __getDefaultCourseRoles(), and ilObject::getRefId().
Referenced by initDefaultRoles().
{ global $rbacadmin, $rbacreview, $rbacsystem; //get Rolefolder of course $rolf_data = $rbacreview->getRoleFolderOfObject($this->getRefId()); //define all relevant roles for which rights are needed to be changed $arr_parentRoles = $rbacreview->getParentRoleIds($this->getRefId()); $arr_relevantParentRoleIds = array_diff(array_keys($arr_parentRoles),$this->__getDefaultCourseRoles()); $template_id = $this->__getCrsNonMemberTemplateId(); //get defined operations from template if (is_null($template_id)) { $template_ops = array(); } else { $template_ops = $rbacreview->getOperationsOfRole($template_id, 'crs', ROLE_FOLDER_ID); } foreach ($arr_relevantParentRoleIds as $parentRole) { if ($rbacreview->isProtected($arr_parentRoles[$parentRole]['parent'],$parentRole)) { continue; } $granted_permissions = array(); // Delete the linked role for the parent role // (just in case if it already exists). $rbacadmin->deleteLocalRole($parentRole,$rolf_data["child"]); // Grant permissions on the course object for // the parent role. In the foreach loop we // compute the intersection of the role // template il_crs_non_member and the // permission template of the parent role. $current_ops = $rbacreview->getRoleOperationsOnObject($parentRole, $this->getRefId()); $rbacadmin->revokePermission($this->getRefId(), $parentRole); foreach ($template_ops as $template_op) { if (in_array($template_op,$current_ops)) { array_push($granted_permissions,$template_op); } } if (!empty($granted_permissions)) { $rbacadmin->grantPermission($parentRole, $granted_permissions, $this->getRefId()); } // Create a linked role for the parent role and // initialize it with the intersection of // il_crs_non_member and the permission // template of the parent role if (! is_null($template_id)) { $rbacadmin->copyRolePermissionIntersection( $template_id, ROLE_FOLDER_ID, $parentRole, $arr_parentRoles[$parentRole]['parent'], $rolf_data["child"], $parentRole ); } $rbacadmin->assignRoleToFolder($parentRole,$rolf_data["child"],"false"); }//END foreach }
ilObjCourse::_checkCondition | ( | $ | a_obj_id, | |
$ | a_operator, | |||
$ | a_value | |||
) |
Definition at line 1131 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; } }
ilObjCourse::_deleteUser | ( | $ | a_usr_id | ) |
Definition at line 1147 of file class.ilObjCourse.php.
Referenced by ilObjUser::delete().
{ // Delete all user related data // delete lm_history include_once './course/classes/class.ilCourseLMHistory.php'; ilCourseLMHistory::_deleteUser($a_usr_id); include_once './course/classes/class.ilCourseMembers.php'; ilCourseMembers::_deleteUser($a_usr_id); // Course objectives include_once './course/classes/class.ilCourseObjectiveResult.php'; ilCourseObjectiveResult::_deleteUser($a_usr_id); }
ilObjCourse::_isActivated | ( | $ | a_obj_id | ) |
Static version of isActive() to avoid instantiation of course object.
int | id of user |
Definition at line 417 of file class.ilObjCourse.php.
References $query, $res, $row, and ilObject::$type.
Referenced by ilObjCourseAccess::_checkAccess(), ilObjCourseListGUI::getProperties(), and ilRepositoryExplorer::isClickable().
{ global $ilDB; $query = "SELECT * FROM crs_settings ". "WHERE obj_id = '".$a_obj_id."'"; $res = $ilDB->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $type = $row->activation_type; $start = $row->activation_start; $end = $row->activation_end; } switch($type) { case IL_CRS_ACTIVATION_OFFLINE: return false; case IL_CRS_ACTIVATION_UNLIMITED: return true; case IL_CRS_ACTIVATION_LIMITED: if(time() < $start or time() > $end) { return false; } return true; default: return false; } }
ilObjCourse::_lookupViewMode | ( | $ | a_id | ) |
Definition at line 300 of file class.ilObjCourse.php.
References $query, $res, and $row.
Referenced by ilLPObjSettings::_checkObjectives().
{ global $ilDB; $query = "SELECT view_mode FROM crs_settings WHERE obj_id = '".$a_id."'"; $res = $ilDB->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { return $row->view_mode; } return false; }
ilObjCourse::_registrationEnabled | ( | $ | a_obj_id | ) |
Definition at line 452 of file class.ilObjCourse.php.
References $query, $res, $row, and ilObject::$type.
Referenced by ilObjCourseAccess::_checkAccess(), and ilObjCourseGUI::viewObject().
{ global $ilDB; $query = "SELECT * FROM crs_settings ". "WHERE obj_id = '".$a_obj_id."'"; $res = $ilDB->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $type = $row->subscription_limitation_type; $reg_start = $row->subscription_start; $reg_end = $row->subscription_end; } switch($type) { case IL_CRS_SUBSCRIPTION_UNLIMITED: return true; case IL_CRS_SUBSCRIPTION_DEACTIVATED: return false; case IL_CRS_SUBSCRIPTION_LIMITED: if(time() > $reg_start and time() < $reg_end) { return true; } default: return false; } return false; }
ilObjCourse::allowAbo | ( | ) |
Definition at line 500 of file class.ilObjCourse.php.
{
return $this->ABO == $this->ABO_ENABLED;
}
ilObjCourse::appendMessage | ( | $ | a_message | ) |
Definition at line 371 of file class.ilObjCourse.php.
References getMessage().
Referenced by validate().
{ if($this->getMessage()) { $this->message .= "<br /> "; } $this->message .= $a_message; }
ilObjCourse::create | ( | $ | a_upload = false |
) |
Definition at line 511 of file class.ilObjCourse.php.
References __createDefaultSettings(), ilObject::create(), and ilObject::createMetaData().
{ parent::create($a_upload); if(!$a_upload) { $this->createMetaData(); } $this->__createDefaultSettings(); }
ilObjCourse::delete | ( | ) |
delete course and all related data
public
Reimplemented from ilObject.
Definition at line 605 of file class.ilObjCourse.php.
References __deleteSettings(), ilEvent::_deleteAll(), ilObjCourseGrouping::_deleteAll(), ilCourseObjective::_deleteAll(), ilCourseFile::_deleteByCourse(), 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()); include_once './course/classes/Event/class.ilEvent.php'; ilEvent::_deleteAll($this->getId()); include_once './course/classes/class.ilCourseFile.php'; ilCourseFile::_deleteByCourse($this->getId()); return true; }
ilObjCourse::enabledObjectiveView | ( | ) |
Definition at line 246 of file class.ilObjCourse.php.
{
return $this->view_mode == IL_CRS_VIEW_OBJECTIVE;
}
ilObjCourse::enabledWaitingList | ( | ) |
Definition at line 251 of file class.ilObjCourse.php.
Referenced by updateSettings().
{ return (bool) $this->waiting_list; }
ilObjCourse::enableWaitingList | ( | $ | a_status | ) |
Definition at line 256 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->waiting_list = (bool) $a_status; }
ilObjCourse::getAboStatus | ( | ) |
Definition at line 350 of file class.ilObjCourse.php.
Referenced by updateSettings().
{
return $this->abo;
}
ilObjCourse::getActivationEnd | ( | ) |
Definition at line 187 of file class.ilObjCourse.php.
Referenced by isActivated(), and validate().
{ return $this->activation_end ? $this->activation_end : mktime(0,0,0,12,12,date("Y",time())+2); }
ilObjCourse::getActivationStart | ( | ) |
Definition at line 179 of file class.ilObjCourse.php.
Referenced by isActivated(), and validate().
{
return $this->activation_start ? $this->activation_start : time();
}
ilObjCourse::getActivationType | ( | ) |
Definition at line 166 of file class.ilObjCourse.php.
Referenced by updateSettings(), and validate().
{ return (int) $this->activation_type; }
ilObjCourse::getActivationUnlimitedStatus | ( | ) |
Definition at line 174 of file class.ilObjCourse.php.
Referenced by isActivated().
{
return $this->activation_type == IL_CRS_ACTIVATION_UNLIMITED;
}
ilObjCourse::getArchiveEnd | ( | ) |
Definition at line 330 of file class.ilObjCourse.php.
Referenced by isArchived(), and validate().
{ return $this->archive_end ? $this->archive_end : mktime(0,0,0,12,12,date("Y",time())+2); }
ilObjCourse::getArchiveStart | ( | ) |
Definition at line 322 of file class.ilObjCourse.php.
Referenced by isArchived(), and validate().
{
return $this->archive_start ? $this->archive_start : time();
}
ilObjCourse::getArchiveType | ( | ) |
Definition at line 338 of file class.ilObjCourse.php.
Referenced by updateSettings().
{ return $this->archive_type ? IL_CRS_ARCHIVE_DOWNLOAD : IL_CRS_ARCHIVE_NONE; }
ilObjCourse::getContactConsultation | ( | ) |
Definition at line 133 of file class.ilObjCourse.php.
Referenced by __createDefaultSettings(), hasContactData(), and updateSettings().
{
return $this->contact_consultation;
}
ilObjCourse::getContactEmail | ( | ) |
Definition at line 149 of file class.ilObjCourse.php.
Referenced by __createDefaultSettings(), hasContactData(), updateSettings(), and validateInfoSettings().
{
return $this->contact_email;
}
ilObjCourse::getContactName | ( | ) |
Definition at line 125 of file class.ilObjCourse.php.
Referenced by __createDefaultSettings(), hasContactData(), and updateSettings().
{
return $this->contact_name;
}
ilObjCourse::getContactPhone | ( | ) |
Definition at line 141 of file class.ilObjCourse.php.
Referenced by __createDefaultSettings(), hasContactData(), and updateSettings().
{
return $this->contact_phone;
}
ilObjCourse::getContactResponsibility | ( | ) |
Definition at line 157 of file class.ilObjCourse.php.
Referenced by __createDefaultSettings(), hasContactData(), and updateSettings().
{
return $this->contact_responsibility;
}
ilObjCourse::getDefaultAdminRole | ( | ) |
Definition at line 1113 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; }
ilObjCourse::getDefaultMemberRole | ( | ) |
Definition at line 1081 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; }
ilObjCourse::getDefaultTutorRole | ( | ) |
Definition at line 1097 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; }
ilObjCourse::getImportantInformation | ( | ) |
Definition at line 109 of file class.ilObjCourse.php.
Referenced by updateSettings().
{
return $this->important;
}
ilObjCourse::getMembers | ( | ) |
Definition at line 380 of file class.ilObjCourse.php.
{
return $this->members_obj->getMembers();
}
ilObjCourse::getMessage | ( | ) |
Definition at line 363 of file class.ilObjCourse.php.
Referenced by appendMessage(), and validate().
{
return $this->message;
}
ilObjCourse::getOfflineStatus | ( | ) |
Definition at line 195 of file class.ilObjCourse.php.
Referenced by isActivated().
{
return $this->activation_type == IL_CRS_ACTIVATION_OFFLINE;
}
ilObjCourse::getOrderType | ( | ) |
Definition at line 314 of file class.ilObjCourse.php.
Referenced by updateSettings().
{
return $this->order_type ? $this->order_type : IL_CRS_SORT_TITLE;
}
ilObjCourse::getShowMembers | ( | ) |
Definition at line 358 of file class.ilObjCourse.php.
Referenced by updateSettings().
{
return $this->show_members;
}
ilObjCourse::getSubscriptionEnd | ( | ) |
Definition at line 221 of file class.ilObjCourse.php.
Referenced by inSubscriptionTime(), and validate().
{ return $this->subscription_end ? $this->subscription_end : mktime(0,0,0,12,12,date("Y",time())+2); }
ilObjCourse::getSubscriptionLimitationType | ( | ) |
Definition at line 201 of file class.ilObjCourse.php.
Referenced by validate().
{
return $this->subscription_limitation_type;
}
ilObjCourse::getSubscriptionMaxMembers | ( | ) |
Definition at line 274 of file class.ilObjCourse.php.
Referenced by __createDefaultSettings(), updateSettings(), and validate().
{
return $this->subscription_max_members;
}
ilObjCourse::getSubscriptionNotify | ( | ) |
Definition at line 282 of file class.ilObjCourse.php.
Referenced by updateSettings().
{ return $this->subscription_notify ? true : false; }
ilObjCourse::getSubscriptionPassword | ( | ) |
Definition at line 238 of file class.ilObjCourse.php.
Referenced by updateSettings(), and validate().
{
return $this->subscription_password;
}
ilObjCourse::getSubscriptionStart | ( | ) |
Definition at line 213 of file class.ilObjCourse.php.
Referenced by inSubscriptionTime(), and validate().
{
return $this->subscription_start ? $this->subscription_start : time();
}
ilObjCourse::getSubscriptionType | ( | ) |
Definition at line 229 of file class.ilObjCourse.php.
Referenced by updateSettings(), and validate().
{ return $this->subscription_type ? $this->subscription_type : IL_CRS_SUBSCRIPTION_DIRECT; #return $this->subscription_type ? $this->subscription_type : $this->SUBSCRIPTION_DEACTIVATED; }
ilObjCourse::getSubscriptionUnlimitedStatus | ( | ) |
Definition at line 209 of file class.ilObjCourse.php.
Referenced by inSubscriptionTime().
{
return $this->subscription_limitation_type == IL_CRS_SUBSCRIPTION_UNLIMITED;
}
ilObjCourse::getSyllabus | ( | ) |
Definition at line 117 of file class.ilObjCourse.php.
Referenced by __createDefaultSettings(), and updateSettings().
{
return $this->syllabus;
}
ilObjCourse::getViewMode | ( | ) |
Definition at line 295 of file class.ilObjCourse.php.
Referenced by isArchived(), updateSettings(), and validate().
{
return $this->view_mode;
}
ilObjCourse::hasContactData | ( | ) |
Definition at line 589 of file class.ilObjCourse.php.
References getContactConsultation(), getContactEmail(), getContactName(), getContactPhone(), and getContactResponsibility().
{ return strlen($this->getContactName()) or strlen($this->getContactResponsibility()) or strlen($this->getContactEmail()) or strlen($this->getContactPhone()) or strlen($this->getContactConsultation()); }
ilObjCourse::ilObjCourse | ( | $ | a_id = 0 , |
|
$ | a_call_by_reference = true | |||
) |
Constructor public.
integer | reference_id or object_id | |
boolean | treat the id as reference_id (true) or object_id (false) |
Definition at line 73 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->SHOW_MEMBERS_ENABLED = 1; $this->SHOW_MEMBERS_DISABLED = 0; $this->type = "crs"; $this->ilObject($a_id,$a_call_by_reference); if($a_id) { #$this->__initMetaObject(); $this->initCourseMemberObject(); } else { } }
ilObjCourse::initCourseArchiveObject | ( | ) |
Definition at line 820 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; }
ilObjCourse::initCourseItemObject | ( | $ | a_child_id = 0 |
) |
Definition at line 809 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; }
ilObjCourse::initCourseMemberObject | ( | ) |
Definition at line 798 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; }
ilObjCourse::initDefaultRoles | ( | ) |
init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public
Reimplemented from ilObject.
Definition at line 834 of file class.ilObjCourse.php.
References $ops, $query, $rbacadmin, $rbacreview, $res, __setCourseStatus(), 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); // Break inheritance, create local roles and initialize permission // settings depending on course status. $this->__setCourseStatus(); return true; }
ilObjCourse::initWaitingList | ( | ) |
Definition at line 786 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; }
ilObjCourse::inSubscriptionTime | ( | ) |
Definition at line 261 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; }
ilObjCourse::isActivated | ( | $ | a_check_archive = false |
) |
Definition at line 386 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; }
ilObjCourse::isArchived | ( | ) |
Definition at line 487 of file class.ilObjCourse.php.
References getArchiveEnd(), getArchiveStart(), and getViewMode().
Referenced by isActivated().
{ if($this->getViewMode() != IL_CRS_VIEW_ARCHIVE) { return false; } if(time() < $this->getArchiveStart() or time() > $this->getArchiveEnd()) { return false; } return true; }
ilObjCourse::read | ( | $ | a_force_db = false |
) |
read object data from db into object
boolean | public |
Reimplemented from ilObject.
Definition at line 505 of file class.ilObjCourse.php.
References __readSettings().
{ parent::read($a_force_db); $this->__readSettings(); }
ilObjCourse::setAboStatus | ( | $ | a_status | ) |
Definition at line 346 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->abo = $a_status; }
ilObjCourse::setActivationEnd | ( | $ | a_value | ) |
Definition at line 191 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->activation_end = $a_value; }
ilObjCourse::setActivationStart | ( | $ | a_value | ) |
Definition at line 183 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->activation_start = $a_value; }
ilObjCourse::setActivationType | ( | $ | a_type | ) |
Definition at line 170 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->activation_type = $a_type; }
ilObjCourse::setArchiveEnd | ( | $ | a_value | ) |
Definition at line 334 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->archive_end = $a_value; }
ilObjCourse::setArchiveStart | ( | $ | a_value | ) |
Definition at line 326 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->archive_start = $a_value; }
ilObjCourse::setArchiveType | ( | $ | a_value | ) |
Definition at line 342 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->archive_type = $a_value; }
ilObjCourse::setContactConsultation | ( | $ | a_value | ) |
Definition at line 137 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->contact_consultation = $a_value; }
ilObjCourse::setContactEmail | ( | $ | a_value | ) |
Definition at line 153 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->contact_email = $a_value; }
ilObjCourse::setContactName | ( | $ | a_cn | ) |
Definition at line 129 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->contact_name = $a_cn; }
ilObjCourse::setContactPhone | ( | $ | a_value | ) |
Definition at line 145 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->contact_phone = $a_value; }
ilObjCourse::setContactResponsibility | ( | $ | a_value | ) |
Definition at line 161 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->contact_responsibility = $a_value; }
ilObjCourse::setImportantInformation | ( | $ | a_info | ) |
Definition at line 113 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->important = $a_info; }
ilObjCourse::setMessage | ( | $ | a_message | ) |
Definition at line 367 of file class.ilObjCourse.php.
Referenced by validate().
{ $this->message = $a_message; }
ilObjCourse::setOrderType | ( | $ | a_value | ) |
Definition at line 318 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->order_type = $a_value; }
ilObjCourse::setShowMembers | ( | $ | a_status | ) |
Definition at line 354 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->show_members = $a_status; }
ilObjCourse::setSubscriptionEnd | ( | $ | a_value | ) |
Definition at line 225 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->subscription_end = $a_value; }
ilObjCourse::setSubscriptionLimitationType | ( | $ | a_type | ) |
Definition at line 205 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->subscription_limitation_type = $a_type; }
ilObjCourse::setSubscriptionMaxMembers | ( | $ | a_value | ) |
Definition at line 278 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->subscription_max_members = $a_value; }
ilObjCourse::setSubscriptionNotify | ( | $ | a_value | ) |
Definition at line 286 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->subscription_notify = $a_value ? true : false; }
ilObjCourse::setSubscriptionPassword | ( | $ | a_value | ) |
Definition at line 242 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->subscription_password = $a_value; }
ilObjCourse::setSubscriptionStart | ( | $ | a_value | ) |
Definition at line 217 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->subscription_start = $a_value; }
ilObjCourse::setSubscriptionType | ( | $ | a_value | ) |
Definition at line 234 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->subscription_type = $a_value; }
ilObjCourse::setSyllabus | ( | $ | a_syllabus | ) |
Definition at line 121 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->syllabus = $a_syllabus; }
ilObjCourse::setViewMode | ( | $ | a_mode | ) |
Definition at line 291 of file class.ilObjCourse.php.
Referenced by __readSettings().
{ $this->view_mode = $a_mode; }
ilObjCourse::update | ( | ) |
update complete object
Reimplemented from ilObject.
Definition at line 650 of file class.ilObjCourse.php.
References ilObject::updateMetaData(), and updateSettings().
{ $this->updateMetaData(); $this->updateSettings(); parent::update(); }
ilObjCourse::updateSettings | ( | ) |
Definition at line 657 of file class.ilObjCourse.php.
References $query, $res, __createDefaultSettings(), enabledWaitingList(), getAboStatus(), getActivationType(), getArchiveType(), getContactConsultation(), getContactEmail(), getContactName(), getContactPhone(), getContactResponsibility(), getImportantInformation(), getOrderType(), getShowMembers(), getSubscriptionMaxMembers(), getSubscriptionNotify(), getSubscriptionPassword(), getSubscriptionType(), getSyllabus(), and getViewMode().
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_type = '".(int) $this->getActivationType()."', ". #"activation_unlimited = '".(int) $this->getActivationUnlimitedStatus()."', ". "activation_start = '".$this->getActivationStart()."', ". "activation_end = '".$this->getActivationEnd()."', ". #"activation_offline = '".(int) $this->getOfflineStatus()."', ". "subscription_limitation_type = '".$this->getSubscriptionLimitationType()."', ". #"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()."', ". "view_mode = '".(int) $this->getViewMode()."', ". "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()."', ". "waiting_list = '".(int) $this->enabledWaitingList()."', ". "important = '".ilUtil::prepareDBString($this->getImportantInformation())."', ". "show_members = '".(int) $this->getShowMembers()."' ". "WHERE obj_id = '".$this->getId()."'"; $res = $ilDB->query($query); }
ilObjCourse::validate | ( | ) |
Definition at line 522 of file class.ilObjCourse.php.
References appendMessage(), getActivationEnd(), getActivationStart(), getActivationType(), getArchiveEnd(), getArchiveStart(), getMessage(), getSubscriptionEnd(), getSubscriptionLimitationType(), getSubscriptionMaxMembers(), getSubscriptionPassword(), getSubscriptionStart(), getSubscriptionType(), getViewMode(), initCourseMemberObject(), and setMessage().
{ $this->initCourseMemberObject(); $this->setMessage(''); #if(($this->getSubscriptionLimitationType() != IL_CRS_SUBSCRIPTION_DEACTIVATED) and # $this->getSubscriptionType() == ) #{ # $this->appendMessage($this->lng->txt('crs_select_registration_type')); #} if(($this->getActivationType() == IL_CRS_ACTIVATION_LIMITED) and $this->getActivationEnd() < $this->getActivationStart()) { $this->appendMessage($this->lng->txt("activation_times_not_valid")); } if(($this->getSubscriptionLimitationType() == IL_CRS_SUBSCRIPTION_LIMITED) 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() == IL_CRS_SUBSCRIPTION_PASSWORD and !$this->getSubscriptionPassword()) { $this->appendMessage($this->lng->txt("crs_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->getViewMode() == IL_CRS_VIEW_ARCHIVE) and $this->getArchiveStart() > $this->getArchiveEnd()) { $this->appendMessage($this->lng->txt("archive_times_not_valid")); } return $this->getMessage() ? false : true; }
ilObjCourse::validateInfoSettings | ( | ) |
Definition at line 575 of file class.ilObjCourse.php.
References $ilErr, getContactEmail(), ilObjUser::getUserIdByLogin(), and ilUtil::is_email().
{ global $ilErr; if($this->getContactEmail() and !(ilUtil::is_email($this->getContactEmail()) or ilObjUser::getUserIdByLogin($this->getContactEmail()))) { $ilErr->appendMessage($this->lng->txt('contact_email_not_valid')); return false; } return true; }
ilObjCourse::$archives_obj |
Definition at line 64 of file class.ilObjCourse.php.
ilObjCourse::$items_obj |
Definition at line 65 of file class.ilObjCourse.php.
ilObjCourse::$members_obj |
Definition at line 63 of file class.ilObjCourse.php.