ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 public. More...
 
 setId ($a_id)
 
 getId ()
 
 setRefId ($a_ref_id)
 
 getRefId ()
 
 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 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 public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title 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 public More...
 
 getLastUpdateDate ()
 get last update date 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...
 
 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 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)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 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 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 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 public.

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

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

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

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: saml.php:7
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ __deleteAll()

ilCourseStart::__deleteAll ( )

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

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

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  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ __read()

ilCourseStart::__read ( )

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

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

Referenced by __construct().

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

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

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  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ allFullfilled()

ilCourseStart::allFullfilled (   $user_id)

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

References getStartObjects(), and isFullfilled().

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)
+ Here is the call graph for this function:

◆ cloneDependencies()

ilCourseStart::cloneDependencies (   $a_target_id,
  $a_copy_id 
)

Clone dependencies.

public

Parameters
inttarget id
intcopy id

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

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

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  }
global $DIC
Definition: saml.php:7
Class ilObj<module_name>
$start
Definition: bench.php:8
static _getInstance($a_copy_id)
Get instance of copy wizard options.
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ delete()

ilCourseStart::delete (   $a_crs_start_id)

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

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

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  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ exists()

ilCourseStart::exists (   $a_item_ref_id)

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

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

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  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ getId()

ilCourseStart::getId ( )

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

References $id.

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

65  {
66  return $this->id;
67  }
+ Here is the caller graph for this function:

◆ getPossibleStarters()

ilCourseStart::getPossibleStarters ( )

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

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

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  }
static getItems($a_parent_id, $a_with_list_data=true)
Get sub item data.
+ Here is the call graph for this function:

◆ getRefId()

ilCourseStart::getRefId ( )

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

References $ref_id.

Referenced by getPossibleStarters(), and isFullfilled().

73  {
74  return $this->ref_id;
75  }
+ Here is the caller graph for this function:

◆ getStartObjects()

ilCourseStart::getStartObjects ( )

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

Referenced by allFullfilled(), and cloneDependencies().

77  {
78  return $this->start_objs ? $this->start_objs : array();
79  }
+ Here is the caller graph for this function:

◆ isFullfilled()

ilCourseStart::isFullfilled (   $user_id,
  $item_id 
)

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

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

Referenced by allFullfilled().

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  include_once './Modules/Survey/classes/class.ilObjSurveyAccess.php';
228  if (!ilObjSurveyAccess::_lookupFinished($obj_id, $user_id)) {
229  return false;
230  }
231  break;
232  case 'sahs':
233  include_once 'Services/Tracking/classes/class.ilLPStatus.php';
234  if (!ilLPStatus::_hasUserCompleted($obj_id, $user_id)) {
235  return false;
236  }
237  break;
238 
239  default:
240  if (!isset($continue_data[$item_id])) {
241  return false;
242  }
243  }
244  return true;
245  }
global $DIC
Definition: saml.php:7
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
class ilCourseLMHistory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setId()

ilCourseStart::setId (   $a_id)

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

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

◆ setRefId()

ilCourseStart::setRefId (   $a_ref_id)

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: