ILIAS  release_7 Revision v7.30-3-g800a261c036
ilCourseStart Class Reference

Class ilObj<module_name> More...

+ Inheritance diagram for ilCourseStart:
+ Collaboration diagram for ilCourseStart:

Public Member Functions

 __construct ($a_course_ref_id, $a_course_obj_id)
 Constructor @access public. More...
 
 setId ($a_id)
 set object id @access public More...
 
 getId ()
 get object id @access public More...
 
 setRefId ($a_ref_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getStartObjects ()
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone dependencies. More...
 
 delete ($a_crs_start_id)
 
 exists ($a_item_ref_id)
 
 add ($a_item_ref_id)
 
 __deleteAll ()
 
 getPossibleStarters ()
 
 allFullfilled ($user_id)
 
 isFullfilled ($user_id, $item_id)
 
 __read ()
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 setOfflineStatus ($a_status)
 Set offline status. More...
 
 getOfflineStatus ()
 Get offline status. More...
 
 supportsOfflineHandling ()
 Check whether object supports offline handling. More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 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) @access public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Data Fields

 $db
 
 $ref_id
 
 $id
 
 $start_objs = array()
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static lookupOfflineStatus ($a_obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id, $a_deleted_by)
 
static setDeletedDates ($a_ref_ids, $a_user_id)
 Set deleted date. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data@access public More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 
- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

Detailed Description

Class ilObj<module_name>

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 33 of file class.ilCourseStart.php.

Constructor & Destructor Documentation

◆ __construct()

ilCourseStart::__construct (   $a_course_ref_id,
  $a_course_obj_id 
)

Constructor @access public.

Parameters
intreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

Reimplemented from ilObject.

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

48 {
49 global $DIC;
50
51 $ilDB = $DIC['ilDB'];
52
53 $this->db = $ilDB;
54
55 $this->ref_id = $a_course_ref_id;
56 $this->id = $a_course_obj_id;
57
58 $this->__read();
59 }
global $DIC
Definition: goto.php:24
global $ilDB

References $DIC, $ilDB, and __read().

+ Here is the call graph for this function:

Member Function Documentation

◆ __deleteAll()

ilCourseStart::__deleteAll ( )

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

165 {
166 global $DIC;
167
168 $ilDB = $DIC['ilDB'];
169
170 $query = "DELETE FROM crs_start " .
171 "WHERE crs_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
172 $res = $ilDB->manipulate($query);
173
174 return true;
175 }
getId()
get object id @access public
$query
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $query, $res, and getId().

+ Here is the call graph for this function:

◆ __read()

ilCourseStart::__read ( )

Definition at line 248 of file class.ilCourseStart.php.

249 {
250 global $DIC;
251
252 $tree = $DIC['tree'];
253 $ilDB = $DIC['ilDB'];
254
255 $this->start_objs = array();
256
257 $query = "SELECT * FROM crs_start " .
258 "WHERE crs_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
259
260 $res = $this->db->query($query);
261 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
262 if ($tree->isInTree($row->item_ref_id)) {
263 $this->start_objs[$row->crs_start_id]['item_ref_id'] = $row->item_ref_id;
264 } else {
265 $this->delete($row->item_ref_id);
266 }
267 }
268 return true;
269 }

References $DIC, $ilDB, $query, $res, ilObject\$tree, ilDBConstants\FETCHMODE_OBJECT, and getId().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add()

ilCourseStart::add (   $a_item_ref_id)

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

145 {
146 global $DIC;
147
148 $ilDB = $DIC['ilDB'];
149
150 if ($a_item_ref_id) {
151 $next_id = $ilDB->nextId('crs_start');
152 $query = "INSERT INTO crs_start (crs_start_id,crs_id,item_ref_id) " .
153 "VALUES( " .
154 $ilDB->quote($next_id, 'integer') . ", " .
155 $ilDB->quote($this->getId(), 'integer') . ", " .
156 $ilDB->quote($a_item_ref_id, 'integer') . " " .
157 ")";
158 $res = $ilDB->manipulate($query);
159 return true;
160 }
161 return false;
162 }

References $DIC, $ilDB, $query, $res, and getId().

+ Here is the call graph for this function:

◆ allFullfilled()

ilCourseStart::allFullfilled (   $user_id)

Definition at line 193 of file class.ilCourseStart.php.

194 {
195 foreach ($this->getStartObjects() as $item) {
196 if (!$this->isFullfilled($user_id, $item['item_ref_id'])) {
197 return false;
198 }
199 }
200 return true;
201 }
isFullfilled($user_id, $item_id)

References getStartObjects(), and isFullfilled().

+ Here is the call graph for this function:

◆ cloneDependencies()

ilCourseStart::cloneDependencies (   $a_target_id,
  $a_copy_id 
)

Clone dependencies.

@access public

Parameters
inttarget id
intcopy id

Reimplemented from ilObject.

Definition at line 89 of file class.ilCourseStart.php.

90 {
91 global $DIC;
92
93 $ilObjDataCache = $DIC['ilObjDataCache'];
94 $ilLog = $DIC['ilLog'];
95
96 $ilLog->write(__METHOD__ . ': Begin course start objects...');
97
98 $new_obj_id = $ilObjDataCache->lookupObjId($a_target_id);
99 $start = new ilCourseStart($a_target_id, $new_obj_id);
100
101 include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
102 $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
103 $mappings = $cwo->getMappings();
104 foreach ($this->getStartObjects() as $start_id => $data) {
105 $item_ref_id = $data['item_ref_id'];
106 if (isset($mappings[$item_ref_id]) and $mappings[$item_ref_id]) {
107 $ilLog->write(__METHOD__ . ': Clone start object nr. ' . $item_ref_id);
108 $start->add($mappings[$item_ref_id]);
109 } else {
110 $ilLog->write(__METHOD__ . ': No mapping found for start object nr. ' . $item_ref_id);
111 }
112 }
113 $ilLog->write(__METHOD__ . ': ... end course start objects');
114 return true;
115 }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
Class ilObj<module_name>
$data
Definition: storeScorm.php:23

References $data, $DIC, ilCopyWizardOptions\_getInstance(), and getStartObjects().

+ Here is the call graph for this function:

◆ delete()

ilCourseStart::delete (   $a_crs_start_id)

Definition at line 117 of file class.ilCourseStart.php.

118 {
119 global $DIC;
120
121 $ilDB = $DIC['ilDB'];
122
123 $query = "DELETE FROM crs_start " .
124 "WHERE crs_start_id = " . $ilDB->quote($a_crs_start_id, 'integer') . " " .
125 "AND crs_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
126 $res = $ilDB->manipulate($query);
127 return true;
128 }

References $DIC, $ilDB, $query, $res, and getId().

+ Here is the call graph for this function:

◆ exists()

ilCourseStart::exists (   $a_item_ref_id)

Definition at line 130 of file class.ilCourseStart.php.

131 {
132 global $DIC;
133
134 $ilDB = $DIC['ilDB'];
135
136 $query = "SELECT * FROM crs_start " .
137 "WHERE crs_id = " . $ilDB->quote($this->getId(), 'integer') . " " .
138 "AND item_ref_id = " . $ilDB->quote($a_item_ref_id, 'integer') . " ";
139 $res = $this->db->query($query);
140
141 return $res->numRows() ? true : false;
142 }
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.

References $DIC, $ilDB, $query, $res, getId(), and true.

+ Here is the call graph for this function:

◆ getId()

ilCourseStart::getId ( )

get object id @access public

Returns
integer object id

Reimplemented from ilObject.

Definition at line 64 of file class.ilCourseStart.php.

65 {
66 return $this->id;
67 }

References $id.

Referenced by __deleteAll(), __read(), add(), delete(), and exists().

+ Here is the caller graph for this function:

◆ getPossibleStarters()

ilCourseStart::getPossibleStarters ( )

Definition at line 177 of file class.ilCourseStart.php.

178 {
179 include_once "Services/Object/classes/class.ilObjectActivation.php";
180 foreach (ilObjectActivation::getItems($this->getRefId(), false) as $node) {
181 switch ($node['type']) {
182 case 'lm':
183 case 'sahs':
184 case 'svy':
185 case 'tst':
186 $poss_items[] = $node['ref_id'];
187 break;
188 }
189 }
190 return $poss_items ? $poss_items : array();
191 }
getRefId()
get reference id @access public
static getItems($a_parent_id, $a_with_list_data=true)
Get sub item data.

References ilObjectActivation\getItems(), and getRefId().

+ Here is the call graph for this function:

◆ getRefId()

ilCourseStart::getRefId ( )

get reference id @access public

Returns
integer reference id

Reimplemented from ilObject.

Definition at line 72 of file class.ilCourseStart.php.

73 {
74 return $this->ref_id;
75 }

References $ref_id.

Referenced by getPossibleStarters(), and isFullfilled().

+ Here is the caller graph for this function:

◆ getStartObjects()

ilCourseStart::getStartObjects ( )

Definition at line 76 of file class.ilCourseStart.php.

77 {
78 return $this->start_objs ? $this->start_objs : array();
79 }

Referenced by allFullfilled(), and cloneDependencies().

+ Here is the caller graph for this function:

◆ isFullfilled()

ilCourseStart::isFullfilled (   $user_id,
  $item_id 
)

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

205 {
206 global $DIC;
207
208 $ilObjDataCache = $DIC['ilObjDataCache'];
209
210 include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
211 $lm_continue = new ilCourseLMHistory($this->getRefId(), $user_id);
212 $continue_data = $lm_continue->getLMHistory();
213
214 $obj_id = $ilObjDataCache->lookupObjId($item_id);
215 $type = $ilObjDataCache->lookupType($obj_id);
216
217 switch ($type) {
218 case 'tst':
219 include_once './Modules/Test/classes/class.ilObjTestAccess.php';
220 include_once './Services/Conditions/classes/class.ilConditionHandler.php';
221
223 return false;
224 }
225 break;
226 case 'svy':
227 if (!ilObjSurveyAccess::_lookupFinished($obj_id, $user_id)) {
228 return false;
229 }
230 break;
231 case 'sahs':
232 include_once 'Services/Tracking/classes/class.ilLPStatus.php';
233 if (!ilLPStatus::_hasUserCompleted($obj_id, $user_id)) {
234 return false;
235 }
236 break;
237
238 default:
239 if (!isset($continue_data[$item_id])) {
240 return false;
241 }
242 }
243 return true;
244 }
class ilCourseLMHistory
static _hasUserCompleted($a_obj_id, $a_user_id)
Lookup user object completion.
static _lookupFinished($a_obj_id, $a_user_id="")
get finished status
static checkCondition($a_obj_id, $a_operator, $a_value, $a_usr_id)
check condition

References $DIC, ilObject\$type, ilLPStatus\_hasUserCompleted(), ilObjSurveyAccess\_lookupFinished(), ilObjTestAccess\checkCondition(), getRefId(), and ilConditionHandler\OPERATOR_FINISHED.

Referenced by allFullfilled().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setId()

ilCourseStart::setId (   $a_id)

set object id @access public

Parameters
integer$a_idobject id

Reimplemented from ilObject.

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

61 {
62 $this->id = $a_id;
63 }

◆ setRefId()

ilCourseStart::setRefId (   $a_id)

set reference id @access public

Parameters
integer$a_idreference id

Reimplemented from ilObject.

Definition at line 68 of file class.ilCourseStart.php.

69 {
70 $this->ref_id = $a_ref_id;
71 }

Field Documentation

◆ $db

ilCourseStart::$db

Definition at line 35 of file class.ilCourseStart.php.

◆ $id

ilCourseStart::$id

Definition at line 38 of file class.ilCourseStart.php.

Referenced by getId().

◆ $ref_id

ilCourseStart::$ref_id

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

Referenced by getRefId().

◆ $start_objs

ilCourseStart::$start_objs = array()

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


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