ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 
 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) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 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
 
 $ilias
 
 $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...
 

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 158 of file class.ilCourseStart.php.

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

159  {
160  global $ilDB;
161 
162  $query = "DELETE FROM crs_start ".
163  "WHERE crs_id = ".$ilDB->quote($this->getId() ,'integer')." ";
164  $res = $ilDB->manipulate($query);
165 
166  return true;
167  }
global $ilDB
+ Here is the call graph for this function:

◆ __read()

ilCourseStart::__read ( )

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

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

Referenced by __construct().

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

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

140  {
141  global $ilDB;
142 
143  if($a_item_ref_id)
144  {
145  $next_id = $ilDB->nextId('crs_start');
146  $query = "INSERT INTO crs_start (crs_start_id,crs_id,item_ref_id) ".
147  "VALUES( ".
148  $ilDB->quote($next_id, 'integer').", ".
149  $ilDB->quote($this->getId() ,'integer').", ".
150  $ilDB->quote($a_item_ref_id ,'integer')." ".
151  ")";
152  $res = $ilDB->manipulate($query);
153  return true;
154  }
155  return false;
156  }
global $ilDB
+ Here is the call graph for this function:

◆ allFullfilled()

ilCourseStart::allFullfilled (   $user_id)

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

References getStartObjects(), and isFullfilled().

188  {
189  foreach($this->getStartObjects() as $item)
190  {
191  if(!$this->isFullfilled($user_id,$item['item_ref_id']))
192  {
193  return false;
194  }
195  }
196  return true;
197  }
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, $start, 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  {
101  $item_ref_id = $data['item_ref_id'];
102  if(isset($mappings[$item_ref_id]) and $mappings[$item_ref_id])
103  {
104  $ilLog->write(__METHOD__.': Clone start object nr. '.$item_ref_id);
105  $start->add($mappings[$item_ref_id]);
106  }
107  else
108  {
109  $ilLog->write(__METHOD__.': No mapping found for start object nr. '.$item_ref_id);
110  }
111  }
112  $ilLog->write(__METHOD__.': ... end course start objects');
113  return true;
114  }
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 116 of file class.ilCourseStart.php.

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

117  {
118  global $ilDB;
119 
120  $query = "DELETE FROM crs_start ".
121  "WHERE crs_start_id = ".$ilDB->quote($a_crs_start_id ,'integer')." ".
122  "AND crs_id = ".$ilDB->quote($this->getId(),'integer')." ";
123  $res = $ilDB->manipulate($query);
124  return true;
125  }
global $ilDB
+ Here is the call graph for this function:

◆ exists()

ilCourseStart::exists (   $a_item_ref_id)

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

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

128  {
129  global $ilDB;
130 
131  $query = "SELECT * FROM crs_start ".
132  "WHERE crs_id = ".$ilDB->quote($this->getId() ,'integer')." ".
133  "AND item_ref_id = ".$ilDB->quote($a_item_ref_id ,'integer')." ";
134  $res = $this->db->query($query);
135 
136  return $res->numRows() ? true : false;
137  }
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 169 of file class.ilCourseStart.php.

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

170  {
171  include_once "Services/Object/classes/class.ilObjectActivation.php";
172  foreach(ilObjectActivation::getItems($this->getRefId(), false) as $node)
173  {
174  switch($node['type'])
175  {
176  case 'lm':
177  case 'sahs':
178  case 'svy':
179  case 'tst':
180  $poss_items[] = $node['ref_id'];
181  break;
182  }
183  }
184  return $poss_items ? $poss_items : array();
185  }
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 200 of file class.ilCourseStart.php.

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

Referenced by allFullfilled().

201  {
202  global $ilObjDataCache;
203 
204  include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
205  $lm_continue = new ilCourseLMHistory($this->getRefId(),$user_id);
206  $continue_data = $lm_continue->getLMHistory();
207 
208  $obj_id = $ilObjDataCache->lookupObjId($item_id);
209  $type = $ilObjDataCache->lookupType($obj_id);
210 
211  switch($type)
212  {
213  case 'tst':
214  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
215  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
216 
218  {
219  return false;
220  }
221  break;
222  case 'svy':
223  include_once './Modules/Survey/classes/class.ilObjSurveyAccess.php';
224  if(!ilObjSurveyAccess::_lookupFinished($obj_id, $user_id))
225  {
226  return false;
227  }
228  break;
229  case 'sahs':
230  include_once 'Services/Tracking/classes/class.ilLPStatus.php';
231  if(!ilLPStatus::_hasUserCompleted($obj_id, $user_id))
232  {
233  return false;
234  }
235  break;
236 
237  default:
238  if(!isset($continue_data[$item_id]))
239  {
240  return false;
241  }
242  }
243  return true;
244  }
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: