ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 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 _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 type $ilDB. 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 _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 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 $ilDB, and __read().

48  {
49  global $ilDB;
50 
51  $this->db = $ilDB;
52 
53  $this->ref_id = $a_course_ref_id;
54  $this->id = $a_course_obj_id;
55 
56  $this->__read();
57  }
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ __deleteAll()

ilCourseStart::__deleteAll ( )

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

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

154  {
155  global $ilDB;
156 
157  $query = "DELETE FROM crs_start " .
158  "WHERE crs_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
159  $res = $ilDB->manipulate($query);
160 
161  return true;
162  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ __read()

ilCourseStart::__read ( )

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

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

Referenced by __construct().

235  {
236  global $tree,$ilDB;
237 
238  $this->start_objs = array();
239 
240  $query = "SELECT * FROM crs_start " .
241  "WHERE crs_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
242 
243  $res = $this->db->query($query);
244  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
245  if ($tree->isInTree($row->item_ref_id)) {
246  $this->start_objs[$row->crs_start_id]['item_ref_id'] = $row->item_ref_id;
247  } else {
248  $this->delete($row->item_ref_id);
249  }
250  }
251  return true;
252  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
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 135 of file class.ilCourseStart.php.

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

136  {
137  global $ilDB;
138 
139  if ($a_item_ref_id) {
140  $next_id = $ilDB->nextId('crs_start');
141  $query = "INSERT INTO crs_start (crs_start_id,crs_id,item_ref_id) " .
142  "VALUES( " .
143  $ilDB->quote($next_id, 'integer') . ", " .
144  $ilDB->quote($this->getId(), 'integer') . ", " .
145  $ilDB->quote($a_item_ref_id, 'integer') . " " .
146  ")";
147  $res = $ilDB->manipulate($query);
148  return true;
149  }
150  return false;
151  }
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 180 of file class.ilCourseStart.php.

References getStartObjects(), and isFullfilled().

181  {
182  foreach ($this->getStartObjects() as $item) {
183  if (!$this->isFullfilled($user_id, $item['item_ref_id'])) {
184  return false;
185  }
186  }
187  return true;
188  }
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 87 of file class.ilCourseStart.php.

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

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

◆ delete()

ilCourseStart::delete (   $a_crs_start_id)

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

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

113  {
114  global $ilDB;
115 
116  $query = "DELETE FROM crs_start " .
117  "WHERE crs_start_id = " . $ilDB->quote($a_crs_start_id, 'integer') . " " .
118  "AND crs_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
119  $res = $ilDB->manipulate($query);
120  return true;
121  }
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 123 of file class.ilCourseStart.php.

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

124  {
125  global $ilDB;
126 
127  $query = "SELECT * FROM crs_start " .
128  "WHERE crs_id = " . $ilDB->quote($this->getId(), 'integer') . " " .
129  "AND item_ref_id = " . $ilDB->quote($a_item_ref_id, 'integer') . " ";
130  $res = $this->db->query($query);
131 
132  return $res->numRows() ? true : false;
133  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ getId()

ilCourseStart::getId ( )

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

References $id.

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

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

◆ getPossibleStarters()

ilCourseStart::getPossibleStarters ( )

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

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

165  {
166  include_once "Services/Object/classes/class.ilObjectActivation.php";
167  foreach (ilObjectActivation::getItems($this->getRefId(), false) as $node) {
168  switch ($node['type']) {
169  case 'lm':
170  case 'sahs':
171  case 'svy':
172  case 'tst':
173  $poss_items[] = $node['ref_id'];
174  break;
175  }
176  }
177  return $poss_items ? $poss_items : array();
178  }
static getItems($a_parent_id, $a_with_list_data=true)
Get sub item data.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getRefId()

ilCourseStart::getRefId ( )

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

References $ref_id.

Referenced by getPossibleStarters(), and isFullfilled().

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

◆ getStartObjects()

ilCourseStart::getStartObjects ( )

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

References array.

Referenced by allFullfilled(), and cloneDependencies().

75  {
76  return $this->start_objs ? $this->start_objs : array();
77  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ isFullfilled()

ilCourseStart::isFullfilled (   $user_id,
  $item_id 
)

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

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

Referenced by allFullfilled().

192  {
193  global $ilObjDataCache;
194 
195  include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
196  $lm_continue = new ilCourseLMHistory($this->getRefId(), $user_id);
197  $continue_data = $lm_continue->getLMHistory();
198 
199  $obj_id = $ilObjDataCache->lookupObjId($item_id);
200  $type = $ilObjDataCache->lookupType($obj_id);
201 
202  switch ($type) {
203  case 'tst':
204  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
205  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
206 
208  return false;
209  }
210  break;
211  case 'svy':
212  include_once './Modules/Survey/classes/class.ilObjSurveyAccess.php';
213  if (!ilObjSurveyAccess::_lookupFinished($obj_id, $user_id)) {
214  return false;
215  }
216  break;
217  case 'sahs':
218  include_once 'Services/Tracking/classes/class.ilLPStatus.php';
219  if (!ilLPStatus::_hasUserCompleted($obj_id, $user_id)) {
220  return false;
221  }
222  break;
223 
224  default:
225  if (!isset($continue_data[$item_id])) {
226  return false;
227  }
228  }
229  return true;
230  }
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 58 of file class.ilCourseStart.php.

59  {
60  $this->id = $a_id;
61  }

◆ setRefId()

ilCourseStart::setRefId (   $a_ref_id)

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

67  {
68  $this->ref_id = $a_ref_id;
69  }

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: