ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjCourse.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without ceven the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 require_once "./Services/Container/classes/class.ilContainer.php";
25 include_once './Modules/Course/classes/class.ilCourseConstants.php';
26 include_once './Services/Membership/interfaces/interface.ilMembershipRegistrationCodes.php';
27 
36 {
37 
38  const CAL_REG_START = 1;
39  const CAL_REG_END = 2;
41  const CAL_ACTIVATION_END = 4;
42  const CAL_COURSE_START = 5;
43  const CAL_COURSE_END = 6;
44 
47 
48  private $member_obj = null;
49  private $members_obj = null;
51 
52  private $latitude = '';
53  private $longitude = '';
54  private $locationzoom = 0;
55  private $enablemap = 0;
56 
57  private $session_limit = 0;
58  private $session_prev = -1;
59  private $session_next = -1;
60 
61  private $reg_access_code = '';
62  private $reg_access_code_enabled = false;
63  private $status_dt = null;
64 
66 
67  protected $crs_start; // [ilDate]
68  protected $crs_end; // [ilDate]
69  protected $leave_end; // [ilDate]
70  protected $min_members; // [int]
71  protected $auto_fill_from_waiting; // [bool]
72 
81  private $auto_notification = true;
82 
89  function ilObjCourse($a_id = 0,$a_call_by_reference = true)
90  {
91 
92  #define("ILIAS_MODULE","course");
93  #define("KEEP_IMAGE_PATH",1);
94 
95  $this->SUBSCRIPTION_DEACTIVATED = 1;
96  $this->SUBSCRIPTION_CONFIRMATION = 2;
97  $this->SUBSCRIPTION_DIRECT = 3;
98  $this->SUBSCRIPTION_PASSWORD = 4;
99  $this->SUBSCRIPTION_AUTOSUBSCRIPTION = 5;
100  $this->ARCHIVE_DISABLED = 1;
101  $this->ARCHIVE_READ = 2;
102  $this->ARCHIVE_DOWNLOAD = 3;
103  $this->ABO_ENABLED = 1;
104  $this->ABO_DISABLED = 0;
105  $this->SHOW_MEMBERS_ENABLED = 1;
106  $this->SHOW_MEMBERS_DISABLED = 0;
107  $this->setStatusDetermination(self::STATUS_DETERMINATION_LP);
108 
109  $this->type = "crs";
110 
111  parent::__construct($a_id,$a_call_by_reference);
112 
113  }
114 
120  public static function lookupShowMembersEnabled($a_obj_id)
121  {
122  $query = 'SELECT show_members FROM crs_settings '.
123  'WHERE obj_id = '.$GLOBALS['ilDB']->quote($a_obj_id,'integer');
124  $res = $GLOBALS['ilDB']->query($query);
125  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
126  {
127  return (bool) $row->show_members;
128  }
129  return false;
130  }
131 
136  public function getRegistrationAccessCode()
137  {
138  return $this->reg_access_code;
139  }
140 
146  public function setRegistrationAccessCode($a_code)
147  {
148  $this->reg_access_code = $a_code;
149  }
150 
156  {
157  return (bool) $this->reg_access_code_enabled;
158  }
159 
165  public function enableRegistrationAccessCode($a_status)
166  {
167  $this->reg_access_code_enabled = $a_status;
168  }
169 
171  {
172  return $this->important;
173  }
174  function setImportantInformation($a_info)
175  {
176  $this->important = $a_info;
177  }
178  function getSyllabus()
179  {
180  return $this->syllabus;
181  }
182  function setSyllabus($a_syllabus)
183  {
184  $this->syllabus = $a_syllabus;
185  }
186  function getContactName()
187  {
188  return $this->contact_name;
189  }
190  function setContactName($a_cn)
191  {
192  $this->contact_name = $a_cn;
193  }
195  {
196  return $this->contact_consultation;
197  }
198  function setContactConsultation($a_value)
199  {
200  $this->contact_consultation = $a_value;
201  }
202  function getContactPhone()
203  {
204  return $this->contact_phone;
205  }
206  function setContactPhone($a_value)
207  {
208  $this->contact_phone = $a_value;
209  }
210  function getContactEmail()
211  {
212  return $this->contact_email;
213  }
214  function setContactEmail($a_value)
215  {
216  $this->contact_email = $a_value;
217  }
219  {
220  return $this->contact_responsibility;
221  }
222  function setContactResponsibility($a_value)
223  {
224  $this->contact_responsibility = $a_value;
225  }
226  function getActivationType()
227  {
228  return (int) $this->activation_type;
229  }
230  function setActivationType($a_type)
231  {
232  // offline is separate property now
233  if($a_type == IL_CRS_ACTIVATION_OFFLINE)
234  {
235  $this->setOfflineStatus(true);
236  $a_type = IL_CRS_ACTIVATION_UNLIMITED;
237  }
238 
239  $this->activation_type = $a_type;
240  }
242  {
243  return $this->activation_type == IL_CRS_ACTIVATION_UNLIMITED;
244  }
246  {
247  return $this->activation_start ? $this->activation_start : time();
248  }
249  function setActivationStart($a_value)
250  {
251  $this->activation_start = $a_value;
252  }
253  function getActivationEnd()
254  {
255  return $this->activation_end ? $this->activation_end : mktime(0,0,0,12,12,date("Y",time())+2);
256  }
257  function setActivationEnd($a_value)
258  {
259  $this->activation_end = $a_value;
260  }
261  function getOfflineStatus()
262  {
263  return (bool)$this->activation_offline;
264  }
265  function setOfflineStatus($a_value)
266  {
267  $this->activation_offline = (bool) $a_value;
268  }
269  function setActivationVisibility($a_value)
270  {
271  $this->activation_visibility = (bool) $a_value;
272  }
274  {
275  return $this->activation_visibility;
276  }
277 
279  {
280  return $this->subscription_limitation_type;
281  }
283  {
284  $this->subscription_limitation_type = $a_type;
285  }
287  {
288  return $this->subscription_limitation_type == IL_CRS_SUBSCRIPTION_UNLIMITED;
289  }
291  {
292  return $this->subscription_start ? $this->subscription_start : time();
293  }
294  function setSubscriptionStart($a_value)
295  {
296  $this->subscription_start = $a_value;
297  }
299  {
300  return $this->subscription_end ? $this->subscription_end : mktime(0,0,0,12,12,date("Y",time())+2);
301  }
302  function setSubscriptionEnd($a_value)
303  {
304  $this->subscription_end = $a_value;
305  }
307  {
308  return $this->subscription_type ? $this->subscription_type : IL_CRS_SUBSCRIPTION_DIRECT;
309  #return $this->subscription_type ? $this->subscription_type : $this->SUBSCRIPTION_DEACTIVATED;
310  }
311  function setSubscriptionType($a_value)
312  {
313  $this->subscription_type = $a_value;
314  }
316  {
317  return $this->subscription_password;
318  }
319  function setSubscriptionPassword($a_value)
320  {
321  $this->subscription_password = $a_value;
322  }
324  {
325  return $this->view_mode == IL_CRS_VIEW_OBJECTIVE;
326  }
327 
329  {
330  return (bool) $this->waiting_list;
331  }
332 
333  function enableWaitingList($a_status)
334  {
335  $this->waiting_list = (bool) $a_status;
336  }
337 
339  {
340  if($this->getSubscriptionUnlimitedStatus())
341  {
342  return true;
343  }
344  if(time() > $this->getSubscriptionStart() and time() < $this->getSubscriptionEnd())
345  {
346  return true;
347  }
348  return false;
349  }
350 
356  public function enableSessionLimit($a_status)
357  {
358  $this->session_limit = $a_status;
359  }
360 
361  public function isSessionLimitEnabled()
362  {
363  return (bool) $this->session_limit;
364  }
365 
373  public function enableSubscriptionMembershipLimitation($a_status)
374  {
375  $this->subscription_membership_limitation = $a_status;
376  }
377 
383  public function setNumberOfPreviousSessions($a_num)
384  {
385  $this->session_prev = $a_num;
386  }
387 
392  public function getNumberOfPreviousSessions()
393  {
394  return $this->session_prev;
395  }
396 
402  public function setNumberOfNextSessions($a_num)
403  {
404  $this->session_next = $a_num;
405  }
406 
411  public function getNumberOfNextSessions()
412  {
413  return $this->session_next;
414  }
423  {
424  return (bool) $this->subscription_membership_limitation;
425  }
426 
428  {
429  return $this->subscription_max_members;
430  }
431  function setSubscriptionMaxMembers($a_value)
432  {
433  $this->subscription_max_members = $a_value;
434  }
435 
444  public static function _isSubscriptionNotificationEnabled($a_course_id)
445  {
446  global $ilDB;
447 
448  $query = "SELECT * FROM crs_settings ".
449  "WHERE obj_id = ".$ilDB->quote($a_course_id ,'integer')." ".
450  "AND sub_notify = 1";
451  $res = $ilDB->query($query);
452  return $res->numRows() ? true : false;
453  }
454 
461  public function getSubItems($a_admin_panel_enabled = false, $a_include_side_block = false)
462  {
463  global $ilUser;
464 
465  // Caching
466  if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]))
467  {
468  return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
469  }
470 
471  // Results are stored in $this->items
472  parent::getSubItems($a_admin_panel_enabled,$a_include_side_block);
473 
474  $limit_sess = false;
475  if(!$a_admin_panel_enabled &&
476  !$a_include_side_block &&
477  $this->items['sess'] &&
478  is_array($this->items['sess']) &&
479  $this->isSessionLimitEnabled() &&
480  $this->getViewMode() == ilContainer::VIEW_SESSIONS) // #16686
481  {
482  $limit_sess = true;
483  }
484 
485  if(!$limit_sess)
486  {
487  return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
488  }
489 
490 
491  // do session limit
492 
493  // @todo move to gui class
494  if(isset($_GET['crs_prev_sess']))
495  {
496  $ilUser->writePref('crs_sess_show_prev_'.$this->getId(), (string) (int) $_GET['crs_prev_sess']);
497  }
498  if(isset($_GET['crs_next_sess']))
499  {
500  $ilUser->writePref('crs_sess_show_next_'.$this->getId(), (string) (int) $_GET['crs_next_sess']);
501  }
502 
503  $sessions = ilUtil::sortArray($this->items['sess'],'start','ASC',true,false);
504  $today = new ilDate(date('Ymd',time()),IL_CAL_DATE);
505  $previous = $current = $next = array();
506  foreach($sessions as $key => $item)
507  {
508  $start = new ilDateTime($item['start'],IL_CAL_UNIX);
509  $end = new ilDateTime($item['end'],IL_CAL_UNIX);
510 
511  if(ilDateTime::_within($today, $start, $end, IL_CAL_DAY))
512  {
513  $current[] = $item;
514  }
515  elseif(ilDateTime::_before($start, $today, IL_CAL_DAY))
516  {
517  $previous[] = $item;
518  }
519  elseif(ilDateTime::_after($start, $today, IL_CAL_DAY))
520  {
521  $next[] = $item;
522  }
523  }
524  $num_previous_remove = max(
525  count($previous) - $this->getNumberOfPreviousSessions(),
526  0
527  );
528  while($num_previous_remove--)
529  {
530  if(!$ilUser->getPref('crs_sess_show_prev_'.$this->getId()))
531  {
532  array_shift($previous);
533  }
534  $this->items['sess_link']['prev']['value'] = 1;
535  }
536 
537  $num_next_remove = max(
538  count($next) - $this->getNumberOfNextSessions(),
539  0
540  );
541  while($num_next_remove--)
542  {
543  if(!$ilUser->getPref('crs_sess_show_next_'.$this->getId()))
544  {
545  array_pop($next);
546  }
547  // @fixme
548  $this->items['sess_link']['next']['value'] = 1;
549  }
550 
551  $sessions = array_merge($previous,$current,$next);
552  $this->items['sess'] = $sessions;
553 
554  // #15389 - see ilContainer::getSubItems()
555  include_once('Services/Container/classes/class.ilContainerSorting.php');
556  $sort = ilContainerSorting::_getInstance($this->getId());
557  $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block] = $sort->sortItems($this->items);
558 
559  return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
560  }
561 
563  {
564  return true;
565  return $this->subscription_notify ? true : false;
566  }
567  function setSubscriptionNotify($a_value)
568  {
569  $this->subscription_notify = $a_value ? true : false;
570  }
571 
572  function setViewMode($a_mode)
573  {
574  $this->view_mode = $a_mode;
575  }
576  function getViewMode()
577  {
578  return $this->view_mode;
579  }
580 
581  function _lookupViewMode($a_id)
582  {
583  global $ilDB;
584 
585  $query = "SELECT view_mode FROM crs_settings WHERE obj_id = ".$ilDB->quote($a_id ,'integer')." ";
586  $res = $ilDB->query($query);
587  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
588  {
589  return $row->view_mode;
590  }
591  return false;
592  }
593 
594  function _lookupAboStatus($a_id)
595  {
596  global $ilDB;
597 
598  $query = "SELECT abo FROM crs_settings WHERE obj_id = ".$ilDB->quote($a_id ,'integer')." ";
599  $res = $ilDB->query($query);
600  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
601  {
602  return $row->abo;
603  }
604  return false;
605  }
606 
607  function getArchiveStart()
608  {
609  return $this->archive_start ? $this->archive_start : time();
610  }
611  function setArchiveStart($a_value)
612  {
613  $this->archive_start = $a_value;
614  }
615  function getArchiveEnd()
616  {
617  return $this->archive_end ? $this->archive_end : mktime(0,0,0,12,12,date("Y",time())+2);
618  }
619  function setArchiveEnd($a_value)
620  {
621  $this->archive_end = $a_value;
622  }
623  function getArchiveType()
624  {
625  return $this->archive_type ? IL_CRS_ARCHIVE_DOWNLOAD : IL_CRS_ARCHIVE_NONE;
626  }
627  function setArchiveType($a_value)
628  {
629  $this->archive_type = $a_value;
630  }
631  function setAboStatus($a_status)
632  {
633  $this->abo = $a_status;
634  }
635  function getAboStatus()
636  {
637  return $this->abo;
638  }
639  function setShowMembers($a_status)
640  {
641  $this->show_members = $a_status;
642  }
643  function getShowMembers()
644  {
645  return $this->show_members;
646  }
647 
653  public function setMailToMembersType($a_type)
654  {
655  $this->mail_members = $a_type;
656  }
657 
662  public function getMailToMembersType()
663  {
664  return $this->mail_members;
665  }
666 
667  function getMessage()
668  {
669  return $this->message;
670  }
671  function setMessage($a_message)
672  {
673  $this->message = $a_message;
674  }
675  function appendMessage($a_message)
676  {
677  if($this->getMessage())
678  {
679  $this->message .= "<br /> ";
680  }
681  $this->message .= $a_message;
682  }
683 
684  function isActivated($a_check_archive = false)
685  {
686  if($a_check_archive)
687  {
688  if($this->isArchived())
689  {
690  return true;
691  }
692  }
693  if($this->getOfflineStatus())
694  {
695  return false;
696  }
697  if($this->getActivationUnlimitedStatus())
698  {
699  return true;
700  }
701  if(time() < $this->getActivationStart() or
702  time() > $this->getActivationEnd())
703  {
704  return false;
705  }
706  return true;
707  }
708 
715  function _isActivated($a_obj_id)
716  {
717  include_once("./Modules/Course/classes/class.ilObjCourseAccess.php");
718  return ilObjCourseAccess::_isActivated($a_obj_id);
719  }
720 
727  function _registrationEnabled($a_obj_id)
728  {
729  include_once("./Modules/Course/classes/class.ilObjCourseAccess.php");
730  return ilObjCourseAccess::_registrationEnabled($a_obj_id);
731  }
732 
733  function isArchived()
734  {
735  if($this->getViewMode() != IL_CRS_VIEW_ARCHIVE)
736  {
737  return false;
738  }
739  if(time() < $this->getArchiveStart() or time() > $this->getArchiveEnd())
740  {
741  return false;
742  }
743  return true;
744  }
745 
746  function allowAbo()
747  {
748  return $this->ABO == $this->ABO_ENABLED;
749  }
750 
751  function read($a_force_db = false)
752  {
753  parent::read($a_force_db);
754 
755  include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
757 
758  $this->__readSettings();
759  }
760  function create($a_upload = false)
761  {
762  global $ilAppEventHandler;
763 
764  parent::create($a_upload);
765 
766  if(!$a_upload)
767  {
768  $this->createMetaData();
769  }
770  $this->__createDefaultSettings();
771 
772  $ilAppEventHandler->raise('Modules/Course',
773  'create',
774  array('object' => $this,
775  'obj_id' => $this->getId(),
776  'appointments' => $this->prepareAppointments('create')));
777 
778  }
779 
785  function setLatitude($a_latitude)
786  {
787  $this->latitude = $a_latitude;
788  }
789 
795  function getLatitude()
796  {
797  return $this->latitude;
798  }
799 
805  function setLongitude($a_longitude)
806  {
807  $this->longitude = $a_longitude;
808  }
809 
815  function getLongitude()
816  {
817  return $this->longitude;
818  }
819 
825  function setLocationZoom($a_locationzoom)
826  {
827  $this->locationzoom = $a_locationzoom;
828  }
829 
835  function getLocationZoom()
836  {
837  return $this->locationzoom;
838  }
839 
845  function setEnableCourseMap($a_enablemap)
846  {
847  $this->enablemap = $a_enablemap;
848  }
849 
856  {
857  return $this->enablemap;
858  }
859 
860  function setCourseStart(ilDate $a_value = null)
861  {
862  $this->crs_start = $a_value;
863  }
864 
865  function getCourseStart()
866  {
867  return $this->crs_start;
868  }
869 
870  function setCourseEnd(ilDate $a_value = null)
871  {
872  $this->crs_end = $a_value;
873  }
874 
875  function getCourseEnd()
876  {
877  return $this->crs_end;
878  }
879 
880  function setCancellationEnd(ilDate $a_value = null)
881  {
882  $this->leave_end = $a_value;
883  }
884 
886  {
887  return $this->leave_end;
888  }
889 
890  function setSubscriptionMinMembers($a_value)
891  {
892  if($a_value !== null)
893  {
894  $a_value = (int)$a_value;
895  }
896  $this->min_members = $a_value;
897  }
898 
900  {
901  return $this->min_members;
902  }
903 
904  function setWaitingListAutoFill($a_value)
905  {
906  $this->auto_fill_from_waiting = (bool)$a_value;
907  }
908 
910  {
911  return (bool)$this->auto_fill_from_waiting;
912  }
913 
922  public function cloneObject($a_target_id,$a_copy_id = 0)
923  {
924  global $ilDB,$ilUser;
925 
926  $new_obj = parent::cloneObject($a_target_id,$a_copy_id);
927 
928  $this->cloneAutoGeneratedRoles($new_obj);
929  $this->cloneMetaData($new_obj);
930 
931  // Assign admin
932  $new_obj->getMemberObject()->add($ilUser->getId(),IL_CRS_ADMIN);
933  // cognos-blu-patch: begin
934  $new_obj->getMemberObject()->updateContact($ilUser->getId(), 1);
935  // cognos-blu-patch: end
936 
937 
938  // #14596
939  $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
940  if($cwo->isRootNode($this->getRefId()))
941  {
942  $this->setOfflineStatus(true);
943  }
944 
945  // Copy settings
946  $this->cloneSettings($new_obj);
947 
948  // Course Defined Fields
949  include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
950  ilCourseDefinedFieldDefinition::_clone($this->getId(),$new_obj->getId());
951 
952  // Clone course files
953  include_once('Modules/Course/classes/class.ilCourseFile.php');
954  ilCourseFile::_cloneFiles($this->getId(),$new_obj->getId());
955 
956  // Copy learning progress settings
957  include_once('Services/Tracking/classes/class.ilLPObjSettings.php');
958  $obj_settings = new ilLPObjSettings($this->getId());
959  $obj_settings->cloneSettings($new_obj->getId());
960  unset($obj_settings);
961 
962  // clone icons
963  global $ilLog;
964  $ilLog->write(__METHOD__.': '.$this->getBigIconPath().' '.$this->getSmallIconPath());
965  $new_obj->saveIcons($this->getBigIconPath(),
966  $this->getSmallIconPath(),
967  $this->getTinyIconPath());
968 
969  // clone certificate (#11085)
970  include_once "./Services/Certificate/classes/class.ilCertificate.php";
971  include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
972  $cert = new ilCertificate(new ilCourseCertificateAdapter($this));
973  $newcert = new ilCertificate(new ilCourseCertificateAdapter($new_obj));
974  $cert->cloneCertificate($newcert);
975 
976  return $new_obj;
977  }
978 
987  public function cloneDependencies($a_target_id,$a_copy_id)
988  {
989  parent::cloneDependencies($a_target_id,$a_copy_id);
990 
991  // Clone course start objects
992  include_once('Services/Container/classes/class.ilContainerStartObjects.php');
993  $start = new ilContainerStartObjects($this->getRefId(),$this->getId());
994  $start->cloneDependencies($a_target_id,$a_copy_id);
995 
996  // Clone course item settings
997  include_once('Services/Object/classes/class.ilObjectActivation.php');
998  ilObjectActivation::cloneDependencies($this->getRefId(),$a_target_id,$a_copy_id);
999 
1000  // clone objective settings
1001  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
1002  ilLOSettings::cloneSettings($a_copy_id, $this->getId(), ilObject::_lookupObjId($a_target_id));
1003 
1004  // Clone course learning objectives
1005  include_once('Modules/Course/classes/class.ilCourseObjective.php');
1006  $crs_objective = new ilCourseObjective($this);
1007  $crs_objective->ilClone($a_target_id,$a_copy_id);
1008 
1009  return true;
1010  }
1011 
1019  public function cloneAutoGeneratedRoles($new_obj)
1020  {
1021  global $ilLog,$rbacadmin,$rbacreview;
1022 
1023  $admin = $this->getDefaultAdminRole();
1024  $new_admin = $new_obj->getDefaultAdminRole();
1025 
1026  if(!$admin || !$new_admin || !$this->getRefId() || !$new_obj->getRefId())
1027  {
1028  $ilLog->write(__METHOD__.' : Error cloning auto generated role: il_crs_admin');
1029  }
1030  $rbacadmin->copyRolePermissions($admin,$this->getRefId(),$new_obj->getRefId(),$new_admin,true);
1031  $ilLog->write(__METHOD__.' : Finished copying of role crs_admin.');
1032 
1033  $tutor = $this->getDefaultTutorRole();
1034  $new_tutor = $new_obj->getDefaultTutorRole();
1035  if(!$tutor || !$new_tutor)
1036  {
1037  $ilLog->write(__METHOD__.' : Error cloning auto generated role: il_crs_tutor');
1038  }
1039  $rbacadmin->copyRolePermissions($tutor,$this->getRefId(),$new_obj->getRefId(),$new_tutor,true);
1040  $ilLog->write(__METHOD__.' : Finished copying of role crs_tutor.');
1041 
1042  $member = $this->getDefaultMemberRole();
1043  $new_member = $new_obj->getDefaultMemberRole();
1044  if(!$member || !$new_member)
1045  {
1046  $ilLog->write(__METHOD__.' : Error cloning auto generated role: il_crs_member');
1047  }
1048  $rbacadmin->copyRolePermissions($member,$this->getRefId(),$new_obj->getRefId(),$new_member,true);
1049  $ilLog->write(__METHOD__.' : Finished copying of role crs_member.');
1050 
1051  return true;
1052  }
1053 
1054 
1055  function validate()
1056  {
1057  $this->setMessage('');
1058 
1059  #if(($this->getSubscriptionLimitationType() != IL_CRS_SUBSCRIPTION_DEACTIVATED) and
1060  # $this->getSubscriptionType() == )
1061  #{
1062  # $this->appendMessage($this->lng->txt('crs_select_registration_type'));
1063  #}
1064 
1065  if(($this->getActivationType() == IL_CRS_ACTIVATION_LIMITED) and
1066  $this->getActivationEnd() < $this->getActivationStart())
1067  {
1068  $this->appendMessage($this->lng->txt("activation_times_not_valid"));
1069  }
1071  $this->getSubscriptionStart() > $this->getSubscriptionEnd())
1072  {
1073  $this->appendMessage($this->lng->txt("subscription_times_not_valid"));
1074  }
1075  #if((!$this->getActivationUnlimitedStatus() and
1076  # !$this->getSubscriptionUnlimitedStatus()) and
1077  # ($this->getSubscriptionStart() > $this->getActivationEnd() or
1078  # $this->getSubscriptionStart() < $this->getActivationStart() or
1079  # $this->getSubscriptionEnd() > $this->getActivationEnd() or
1080  # $this->getSubscriptionEnd() < $this->getActivationStart()))
1081  #
1082  #{
1083  # $this->appendMessage($this->lng->txt("subscription_time_not_within_activation"));
1084  #}
1086  {
1087  $this->appendMessage($this->lng->txt("crs_password_required"));
1088  }
1089  if($this->isSubscriptionMembershipLimited())
1090  {
1091  if($this->getSubscriptionMinMembers() <= 0 && $this->getSubscriptionMaxMembers() <= 0)
1092  {
1093  $this->appendMessage($this->lng->txt("crs_max_and_min_members_needed"));
1094  }
1095  if($this->getSubscriptionMaxMembers() <= 0 && $this->enabledWaitingList())
1096  {
1097  $this->appendMessage($this->lng->txt("crs_max_members_needed"));
1098  }
1099  if($this->getSubscriptionMaxMembers() > 0 && $this->getSubscriptionMinMembers() > $this->getSubscriptionMaxMembers())
1100  {
1101  $this->appendMessage($this->lng->txt("crs_max_and_min_members_invalid"));
1102  }
1103  }
1104  if(($this->getViewMode() == IL_CRS_VIEW_ARCHIVE) and
1105  $this->getArchiveStart() > $this->getArchiveEnd())
1106  {
1107  $this->appendMessage($this->lng->txt("archive_times_not_valid"));
1108  }
1109  if(!$this->getTitle() || !$this->getStatusDetermination())
1110  {
1111  $this->appendMessage($this->lng->txt('err_check_input'));
1112  }
1113 
1114  if($this->getCourseStart() &&
1115  $this->getCourseStart()->get(IL_CAL_UNIX) > $this->getCourseEnd()->get(IL_CAL_UNIX))
1116  {
1117  $this->appendMessage($this->lng->txt("crs_course_period_not_valid"));
1118  }
1119 
1120  return $this->getMessage() ? false : true;
1121  }
1122 
1124  {
1125  global $ilErr;
1126  $error = false;
1127  if($this->getContactEmail()) {
1128  $emails = split(",",$this->getContactEmail());
1129 
1130  foreach ($emails as $email) {
1131  $email = trim($email);
1132  if (!(ilUtil::is_email($email) or ilObjUser::getUserIdByLogin($email)))
1133  {
1134  $ilErr->appendMessage($this->lng->txt('contact_email_not_valid')." '".$email."'");
1135  $error = true;
1136  }
1137  }
1138  }
1139  return !$error;
1140  }
1141 
1142  function hasContactData()
1143  {
1144  return strlen($this->getContactName()) or
1145  strlen($this->getContactResponsibility()) or
1146  strlen($this->getContactEmail()) or
1147  strlen($this->getContactPhone()) or
1148  strlen($this->getContactConsultation());
1149  }
1150 
1151 
1158  function delete()
1159  {
1160  global $ilAppEventHandler;
1161 
1162  // always call parent delete function first!!
1163  if (!parent::delete())
1164  {
1165  return false;
1166  }
1167 
1168  // delete meta data
1169  $this->deleteMetaData();
1170 
1171  // put here course specific stuff
1172 
1173  $this->__deleteSettings();
1174 
1175  include_once('Modules/Course/classes/class.ilCourseParticipants.php');
1177 
1178  $this->initCourseArchiveObject();
1179  $this->archives_obj->deleteAll();
1180 
1181  include_once './Modules/Course/classes/class.ilCourseObjective.php';
1183 
1184  include_once './Modules/Course/classes/class.ilObjCourseGrouping.php';
1186 
1187  include_once './Modules/Course/classes/class.ilCourseFile.php';
1189 
1190  include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
1192 
1193  $ilAppEventHandler->raise('Modules/Course',
1194  'delete',
1195  array('object' => $this,
1196  'obj_id' => $this->getId(),
1197  'appointments' => $this->prepareAppointments('delete')));
1198 
1199 
1200  return true;
1201  }
1202 
1203 
1204 
1208  function update()
1209  {
1210  global $ilAppEventHandler,$ilLog;
1211 
1212  include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
1213  $sorting = new ilContainerSortingSettings($this->getId());
1214  $sorting->setSortMode($this->getOrderType());
1215  $sorting->update();
1216 
1217  $this->updateMetaData();
1218  $this->updateSettings();
1219  parent::update();
1220 
1221  $ilAppEventHandler->raise('Modules/Course',
1222  'update',
1223  array('object' => $this,
1224  'obj_id' => $this->getId(),
1225  'appointments' => $this->prepareAppointments('update')));
1226 
1227  }
1228 
1229  function updateSettings()
1230  {
1231  global $ilDB;
1232 
1233  // Due to a bug 3.5.alpha maybe no settings exist. => create default settings
1234 
1235  $query = "SELECT * FROM crs_settings WHERE obj_id = ".$ilDB->quote($this->getId() ,'integer')." ";
1236  $res = $ilDB->query($query);
1237 
1238  if(!$res->numRows())
1239  {
1240  $this->__createDefaultSettings();
1241  }
1242 
1243  $query = "UPDATE crs_settings SET ".
1244  "syllabus = ".$ilDB->quote($this->getSyllabus() ,'text').", ".
1245  "contact_name = ".$ilDB->quote($this->getContactName() ,'text').", ".
1246  "contact_responsibility = ".$ilDB->quote($this->getContactResponsibility() ,'text').", ".
1247  "contact_phone = ".$ilDB->quote($this->getContactPhone() ,'text').", ".
1248  "contact_email = ".$ilDB->quote($this->getContactEmail() ,'text').", ".
1249  "contact_consultation = ".$ilDB->quote($this->getContactConsultation() ,'text').", ".
1250  "activation_type = ".$ilDB->quote(!$this->getOfflineStatus() ,'integer').", ".
1251  "sub_limitation_type = ".$ilDB->quote($this->getSubscriptionLimitationType() ,'integer').", ".
1252  "sub_start = ".$ilDB->quote($this->getSubscriptionStart() ,'integer').", ".
1253  "sub_end = ".$ilDB->quote($this->getSubscriptionEnd() ,'integer').", ".
1254  "sub_type = ".$ilDB->quote($this->getSubscriptionType() ,'integer').", ".
1255  "sub_password = ".$ilDB->quote($this->getSubscriptionPassword() ,'text').", ".
1256  "sub_mem_limit = ".$ilDB->quote((int) $this->isSubscriptionMembershipLimited() ,'integer').", ".
1257  "sub_max_members = ".$ilDB->quote($this->getSubscriptionMaxMembers() ,'integer').", ".
1258  "sub_notify = ".$ilDB->quote($this->getSubscriptionNotify() ,'integer').", ".
1259  "view_mode = ".$ilDB->quote($this->getViewMode() ,'integer').", ".
1260  "archive_start = ".$ilDB->quote($this->getArchiveStart() ,'integer').", ".
1261  "archive_end = ".$ilDB->quote($this->getArchiveEnd() ,'integer').", ".
1262  "archive_type = ".$ilDB->quote($this->getArchiveType() ,'integer').", ".
1263  "abo = ".$ilDB->quote($this->getAboStatus() ,'integer').", ".
1264  "waiting_list = ".$ilDB->quote($this->enabledWaitingList() ,'integer').", ".
1265  "important = ".$ilDB->quote($this->getImportantInformation() ,'text').", ".
1266  "show_members = ".$ilDB->quote($this->getShowMembers() ,'integer').", ".
1267  "latitude = ".$ilDB->quote($this->getLatitude() ,'text').", ".
1268  "longitude = ".$ilDB->quote($this->getLongitude() ,'text').", ".
1269  "location_zoom = ".$ilDB->quote($this->getLocationZoom() ,'integer').", ".
1270  "enable_course_map = ".$ilDB->quote((int) $this->getEnableCourseMap() ,'integer').", ".
1271  'session_limit = '.$ilDB->quote($this->isSessionLimitEnabled(),'integer').', '.
1272  'session_prev = '.$ilDB->quote($this->getNumberOfPreviousSessions(),'integer').', '.
1273  'session_next = '.$ilDB->quote($this->getNumberOfNextSessions(),'integer').', '.
1274  'reg_ac_enabled = '.$ilDB->quote($this->isRegistrationAccessCodeEnabled(),'integer').', '.
1275  'reg_ac = '.$ilDB->quote($this->getRegistrationAccessCode(),'text').', '.
1276  'auto_notification = '.$ilDB->quote( (int)$this->getAutoNotification(), 'integer').', '.
1277  'status_dt = '.$ilDB->quote((int) $this->getStatusDetermination()).', '.
1278  'mail_members_type = '.$ilDB->quote((int) $this->getMailToMembersType(),'integer').', '.
1279  'crs_start = '.$ilDB->quote(($this->getCourseStart() && !$this->getCourseStart()->isNull()) ? $this->getCourseStart()->get(IL_CAL_UNIX) : null, 'integer').', '.
1280  'crs_end = '.$ilDB->quote(($this->getCourseEnd() && !$this->getCourseEnd()->isNull()) ? $this->getCourseEnd()->get(IL_CAL_UNIX) : null, 'integer').', '.
1281  'auto_wait = '.$ilDB->quote((int) $this->hasWaitingListAutoFill(),'integer').', '.
1282  'leave_end = '.$ilDB->quote(($this->getCancellationEnd() && !$this->getCancellationEnd()->isNull()) ? $this->getCancellationEnd()->get(IL_CAL_UNIX) : null, 'integer').', '.
1283  'min_members = '.$ilDB->quote((int) $this->getSubscriptionMinMembers(),'integer').' '.
1284  "WHERE obj_id = ".$ilDB->quote($this->getId() ,'integer')."";
1285 
1286  $res = $ilDB->manipulate($query);
1287 
1288  // moved activation to ilObjectActivation
1289  if($this->ref_id)
1290  {
1291  include_once "./Services/Object/classes/class.ilObjectActivation.php";
1292  ilObjectActivation::getItem($this->ref_id);
1293 
1294  $item = new ilObjectActivation;
1295  if($this->getActivationUnlimitedStatus())
1296  {
1298  }
1299  else
1300  {
1301  $item->setTimingType(ilObjectActivation::TIMINGS_ACTIVATION);
1302  $item->setTimingStart($this->getActivationStart());
1303  $item->setTimingEnd($this->getActivationEnd());
1304  $item->toggleVisible($this->getActivationVisibility());
1305  }
1306 
1307  $item->update($this->ref_id);
1308  }
1309  }
1310 
1318  public function cloneSettings($new_obj)
1319  {
1320  $new_obj->setSyllabus($this->getSyllabus());
1321  $new_obj->setContactName($this->getContactName());
1322  $new_obj->setContactResponsibility($this->getContactResponsibility());
1323  $new_obj->setContactPhone($this->getContactPhone());
1324  $new_obj->setContactEmail($this->getContactEmail());
1325  $new_obj->setContactConsultation($this->getContactConsultation());
1326  $new_obj->setOfflineStatus($this->getOfflineStatus()); // #9914
1327  $new_obj->setActivationType($this->getActivationType());
1328  $new_obj->setActivationStart($this->getActivationStart());
1329  $new_obj->setActivationEnd($this->getActivationEnd());
1330  $new_obj->setActivationVisibility($this->getActivationVisibility());
1331  $new_obj->setSubscriptionLimitationType($this->getSubscriptionLimitationType());
1332  $new_obj->setSubscriptionStart($this->getSubscriptionStart());
1333  $new_obj->setSubscriptionEnd($this->getSubscriptionEnd());
1334  $new_obj->setSubscriptionType($this->getSubscriptionType());
1335  $new_obj->setSubscriptionPassword($this->getSubscriptionPassword());
1336  $new_obj->enableSubscriptionMembershipLimitation($this->isSubscriptionMembershipLimited());
1337  $new_obj->setSubscriptionMaxMembers($this->getSubscriptionMaxMembers());
1338  $new_obj->setSubscriptionNotify($this->getSubscriptionNotify());
1339  $new_obj->setViewMode($this->getViewMode());
1340  $new_obj->setOrderType($this->getOrderType());
1341  $new_obj->setArchiveStart($this->getArchiveStart());
1342  $new_obj->setArchiveEnd($this->getArchiveEnd());
1343  $new_obj->setArchiveType($this->getArchiveType());
1344  $new_obj->setAboStatus($this->getAboStatus());
1345  $new_obj->enableWaitingList($this->enabledWaitingList());
1346  $new_obj->setImportantInformation($this->getImportantInformation());
1347  $new_obj->setShowMembers($this->getShowMembers());
1348  $new_obj->enableSessionLimit($this->isSessionLimitEnabled());
1349  $new_obj->setNumberOfPreviousSessions($this->getNumberOfPreviousSessions());
1350  $new_obj->setNumberOfNextSessions($this->getNumberOfNextSessions());
1351  $new_obj->setAutoNotification( $this->getAutoNotification() );
1352  $new_obj->enableRegistrationAccessCode($this->isRegistrationAccessCodeEnabled());
1353  include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
1354  $new_obj->setRegistrationAccessCode(ilMembershipRegistrationCodeUtils::generateCode());
1355  $new_obj->setStatusDetermination($this->getStatusDetermination());
1356  $new_obj->setMailToMembersType($this->getMailToMembersType());
1357  $new_obj->setCourseStart($this->getCourseStart());
1358  $new_obj->setCourseEnd($this->getCourseEnd());
1359  $new_obj->setCancellationEnd($this->getCancellationEnd());
1360  $new_obj->setWaitingListAutoFill($this->hasWaitingListAutoFill());
1361  $new_obj->setSubscriptionMinMembers($this->getSubscriptionMinMembers());
1362 
1363  // #10271
1364  $new_obj->setEnableCourseMap($this->getEnableCourseMap());
1365  $new_obj->setLatitude($this->getLatitude());
1366  $new_obj->setLongitude($this->getLongitude());
1367  $new_obj->setLocationZoom($this->getLocationZoom());
1368 
1369  $new_obj->update();
1370  }
1371 
1373  {
1374  global $ilDB;
1375 
1376  include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
1378 
1379  $query = "INSERT INTO crs_settings (obj_id,syllabus,contact_name,contact_responsibility,".
1380  "contact_phone,contact_email,contact_consultation,activation_type,activation_start,".
1381  "activation_end,sub_limitation_type,sub_start,sub_end,sub_type,sub_password,sub_mem_limit,".
1382  "sub_max_members,sub_notify,view_mode,archive_start,archive_end,archive_type,abo," .
1383  "latitude,longitude,location_zoom,enable_course_map,waiting_list,show_members, ".
1384  "session_limit,session_prev,session_next, reg_ac_enabled, reg_ac, auto_notification, status_dt,mail_members_type) ".
1385  "VALUES( ".
1386  $ilDB->quote($this->getId() ,'integer').", ".
1387  $ilDB->quote($this->getSyllabus() ,'text').", ".
1388  $ilDB->quote($this->getContactName() ,'text').", ".
1389  $ilDB->quote($this->getContactResponsibility() ,'text').", ".
1390  $ilDB->quote($this->getContactPhone() ,'text').", ".
1391  $ilDB->quote($this->getContactEmail() ,'text').", ".
1392  $ilDB->quote($this->getContactConsultation() ,'text').", ".
1393  $ilDB->quote(0 ,'integer').", ".
1394  $ilDB->quote($this->getActivationStart() ,'integer').", ".
1395  $ilDB->quote($this->getActivationEnd() ,'integer').", ".
1396  $ilDB->quote(IL_CRS_SUBSCRIPTION_DEACTIVATED ,'integer').", ".
1397  $ilDB->quote($this->getSubscriptionStart() ,'integer').", ".
1398  $ilDB->quote($this->getSubscriptionEnd() ,'integer').", ".
1399  $ilDB->quote(IL_CRS_SUBSCRIPTION_DIRECT ,'integer').", ".
1400  $ilDB->quote($this->getSubscriptionPassword() ,'text').", ".
1401  "0, ".
1402  $ilDB->quote($this->getSubscriptionMaxMembers() ,'integer').", ".
1403  "1, ".
1404  "0, ".
1405  $ilDB->quote($this->getArchiveStart() ,'integer').", ".
1406  $ilDB->quote($this->getArchiveEnd() ,'integer').", ".
1407  $ilDB->quote(IL_CRS_ARCHIVE_NONE ,'integer').", ".
1408  $ilDB->quote($this->ABO_ENABLED ,'integer').", ".
1409  $ilDB->quote($this->getLatitude() ,'text').", ".
1410  $ilDB->quote($this->getLongitude() ,'text').", ".
1411  $ilDB->quote($this->getLocationZoom() ,'integer').", ".
1412  $ilDB->quote($this->getEnableCourseMap() ,'integer').", ".
1413  #"objective_view = '0', ".
1414  "1, ".
1415  "1,".
1416  $ilDB->quote($this->isSessionLimitEnabled(),'integer').', '.
1417  $ilDB->quote($this->getNumberOfPreviousSessions(),'integer').', '.
1418  $ilDB->quote($this->getNumberOfPreviousSessions(),'integer').', '.
1419  $ilDB->quote($this->isRegistrationAccessCodeEnabled(),'integer').', '.
1420  $ilDB->quote($this->getRegistrationAccessCode(),'text').', '.
1421  $ilDB->quote((int)$this->getAutoNotification(),'integer').', '.
1422  $ilDB->quote((int)$this->getStatusDetermination(),'integer').', '.
1423  $ilDB->quote((int) $this->getMailToMembersType(),'integer').' '.
1424  ")";
1425 
1426  $res = $ilDB->manipulate($query);
1427  $this->__readSettings();
1428 
1429  include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
1430  $sorting = new ilContainerSortingSettings($this->getId());
1431  $sorting->setSortMode(ilContainer::SORT_MANUAL);
1432  $sorting->update();
1433  }
1434 
1435 
1436  function __readSettings()
1437  {
1438  global $ilDB;
1439 
1440  $query = "SELECT * FROM crs_settings WHERE obj_id = ".$ilDB->quote($this->getId() ,'integer')."";
1441 
1442  $res = $ilDB->query($query);
1443  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1444  {
1445  $this->setSyllabus($row->syllabus);
1446  $this->setContactName($row->contact_name);
1447  $this->setContactResponsibility($row->contact_responsibility);
1448  $this->setContactPhone($row->contact_phone);
1449  $this->setContactEmail($row->contact_email);
1450  $this->setContactConsultation($row->contact_consultation);
1451  $this->setOfflineStatus(!(bool)$row->activation_type); // see below
1452  $this->setSubscriptionLimitationType($row->sub_limitation_type);
1453  $this->setSubscriptionStart($row->sub_start);
1454  $this->setSubscriptionEnd($row->sub_end);
1455  $this->setSubscriptionType($row->sub_type);
1456  $this->setSubscriptionPassword($row->sub_password);
1457  $this->enableSubscriptionMembershipLimitation($row->sub_mem_limit);
1458  $this->setSubscriptionMaxMembers($row->sub_max_members);
1459  $this->setSubscriptionNotify($row->sub_notify);
1460  $this->setViewMode($row->view_mode);
1461  $this->setArchiveStart($row->archive_start);
1462  $this->setArchiveEnd($row->archive_end);
1463  $this->setArchiveType($row->archive_type);
1464  $this->setAboStatus($row->abo);
1465  $this->enableWaitingList($row->waiting_list);
1466  $this->setImportantInformation($row->important);
1467  $this->setShowMembers($row->show_members);
1468  $this->setLatitude($row->latitude);
1469  $this->setLongitude($row->longitude);
1470  $this->setLocationZoom($row->location_zoom);
1471  $this->setEnableCourseMap($row->enable_course_map);
1472  $this->enableSessionLimit($row->session_limit);
1473  $this->setNumberOfPreviousSessions($row->session_prev);
1474  $this->setNumberOfNextSessions($row->session_next);
1475  $this->enableRegistrationAccessCode($row->reg_ac_enabled);
1476  $this->setRegistrationAccessCode($row->reg_ac);
1477  $this->setAutoNotification($row->auto_notification == 1 ? true : false);
1478  $this->setStatusDetermination((int) $row->status_dt);
1479  $this->setMailToMembersType($row->mail_members_type);
1480  $this->setCourseStart($row->crs_start ? new ilDate($row->crs_start, IL_CAL_UNIX) : null);
1481  $this->setCourseEnd($row->crs_end ? new ilDate($row->crs_end, IL_CAL_UNIX) : null);
1482  $this->setCancellationEnd($row->leave_end ? new ilDate($row->leave_end, IL_CAL_UNIX) : null);
1483  $this->setWaitingListAutoFill($row->auto_wait);
1484  $this->setSubscriptionMinMembers($row->min_members ? $row->min_members : null);
1485  }
1486 
1487  // moved activation to ilObjectActivation
1488  if($this->ref_id)
1489  {
1490  include_once "./Services/Object/classes/class.ilObjectActivation.php";
1491  $activation = ilObjectActivation::getItem($this->ref_id);
1492  switch($activation["timing_type"])
1493  {
1496  $this->setActivationStart($activation["timing_start"]);
1497  $this->setActivationEnd($activation["timing_end"]);
1498  $this->setActivationVisibility($activation["visible"]);
1499  break;
1500 
1501  default:
1503  break;
1504  }
1505  }
1506  else
1507  {
1508  // #13176 - there should always be default
1510  }
1511 
1512  return true;
1513  }
1514 
1515  function initWaitingList()
1516  {
1517  include_once "./Modules/Course/classes/class.ilCourseWaitingList.php";
1518 
1519  if(!is_object($this->waiting_list_obj))
1520  {
1521  $this->waiting_list_obj = new ilCourseWaitingList($this->getId());
1522  }
1523  return true;
1524  }
1525 
1526 
1532  protected function initCourseMemberObject()
1533  {
1534  global $ilUser;
1535 
1536  include_once "./Modules/Course/classes/class.ilCourseParticipant.php";
1537  $this->member_obj = ilCourseParticipant::_getInstanceByObjId($this->getId(),$ilUser->getId());
1538  return true;
1539  }
1540 
1546  protected function initCourseMembersObject()
1547  {
1548  global $ilUser;
1549 
1550  include_once "./Modules/Course/classes/class.ilCourseParticipants.php";
1551  $this->members_obj = ilCourseParticipants::_getInstanceByObjId($this->getId());
1552  return true;
1553  }
1554 
1559  public function getMemberObject()
1560  {
1561  if(!$this->member_obj instanceof ilCourseParticipant)
1562  {
1563  $this->initCourseMemberObject();
1564  }
1565  return $this->member_obj;
1566  }
1567 
1572  public function getMembersObject()
1573  {
1574  if(!$this->members_obj instanceof ilCourseParticipants)
1575  {
1576  $this->initCourseMembersObject();
1577  }
1578  return $this->members_obj;
1579  }
1580 
1582  {
1583  include_once "./Modules/Course/classes/class.ilCourseArchives.php";
1584 
1585  if(!is_object($this->archives_obj))
1586  {
1587  $this->archives_obj =& new ilCourseArchives($this);
1588  }
1589  return true;
1590  }
1591 
1592 
1593 
1594  // RBAC METHODS
1595  function initDefaultRoles()
1596  {
1597  global $rbacadmin,$rbacreview,$ilDB;
1598 
1599  include_once './Services/AccessControl/classes/class.ilObjRole.php';
1601  'il_crs_admin_'.$this->getRefId(),
1602  "Admin of crs obj_no.".$this->getId(),
1603  'il_crs_admin',
1604  $this->getRefId()
1605  );
1607  'il_crs_tutor_'.$this->getRefId(),
1608  "Tutor of crs obj_no.".$this->getId(),
1609  'il_crs_tutor',
1610  $this->getRefId()
1611  );
1613  'il_crs_member_'.$this->getRefId(),
1614  "Member of crs obj_no.".$this->getId(),
1615  'il_crs_member',
1616  $this->getRefId()
1617  );
1618 
1619  return array();
1620  }
1621 
1631  public function setParentRolePermissions($a_parent_ref)
1632  {
1633  global $rbacadmin, $rbacreview;
1634 
1635  $parent_roles = $rbacreview->getParentRoleIds($a_parent_ref);
1636  foreach((array) $parent_roles as $parent_role)
1637  {
1638  $rbacadmin->initIntersectionPermissions(
1639  $this->getRefId(),
1640  $parent_role['obj_id'],
1641  $parent_role['parent'],
1642  $this->__getCrsNonMemberTemplateId(),
1643  ROLE_FOLDER_ID
1644  );
1645  }
1646  }
1647 
1655  {
1656  global $ilDB;
1657 
1658  $q = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_crs_non_member'";
1659  $res = $this->ilias->db->query($q);
1660  $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
1661 
1662  return $row["obj_id"];
1663  }
1664 
1669  public static function lookupCourseNonMemberTemplatesId()
1670  {
1671  global $ilDB;
1672 
1673  $query = 'SELECT obj_id FROM object_data WHERE type = '.$ilDB->quote('rolt','text').' AND title = '.$ilDB->quote('il_crs_non_member','text');
1674  $res = $ilDB->query($query);
1675  $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
1676 
1677  return isset($row['obj_id']) ? $row['obj_id'] : 0;
1678  }
1679 
1686  public function getLocalCourseRoles($a_translate = false)
1687  {
1688  global $rbacadmin,$rbacreview;
1689 
1690  if (empty($this->local_roles))
1691  {
1692  $this->local_roles = array();
1693  $role_arr = $rbacreview->getRolesOfRoleFolder($this->getRefId());
1694 
1695  foreach ($role_arr as $role_id)
1696  {
1697  if ($rbacreview->isAssignable($role_id,$this->getRefId()) == true)
1698  {
1699  $role_Obj = $this->ilias->obj_factory->getInstanceByObjId($role_id);
1700 
1701  if ($a_translate)
1702  {
1703  $role_name = ilObjRole::_getTranslation($role_Obj->getTitle());
1704  }
1705  else
1706  {
1707  $role_name = $role_Obj->getTitle();
1708  }
1709  $this->local_roles[$role_name] = $role_Obj->getId();
1710  }
1711  }
1712  }
1713 
1714  return $this->local_roles;
1715  }
1716 
1717 
1718 
1728  public function getDefaultCourseRoles($a_crs_id = "")
1729  {
1730  global $rbacadmin, $rbacreview;
1731 
1732  if (strlen($a_crs_id) > 0)
1733  {
1734  $crs_id = $a_crs_id;
1735  }
1736  else
1737  {
1738  $crs_id = $this->getRefId();
1739  }
1740 
1741  $role_arr = $rbacreview->getRolesOfRoleFolder($crs_id);
1742 
1743  foreach ($role_arr as $role_id)
1744  {
1745  $role_Obj =& $this->ilias->obj_factory->getInstanceByObjId($role_id);
1746 
1747  $crs_Member ="il_crs_member_".$crs_id;
1748  $crs_Admin ="il_crs_admin_".$crs_id;
1749  $crs_Tutor ="il_crs_tutor_".$crs_id;
1750 
1751  if (strcmp($role_Obj->getTitle(), $crs_Member) == 0 )
1752  {
1753  $arr_crsDefaultRoles["crs_member_role"] = $role_Obj->getId();
1754  }
1755 
1756  if (strcmp($role_Obj->getTitle(), $crs_Admin) == 0)
1757  {
1758  $arr_crsDefaultRoles["crs_admin_role"] = $role_Obj->getId();
1759  }
1760 
1761  if (strcmp($role_Obj->getTitle(), $crs_Tutor) == 0)
1762  {
1763  $arr_crsDefaultRoles["crs_tutor_role"] = $role_Obj->getId();
1764  }
1765  }
1766 
1767  return $arr_crsDefaultRoles;
1768  }
1769 
1770  function __getLocalRoles()
1771  {
1772  global $rbacreview;
1773 
1774  // GET role_objects of predefined roles
1775 
1776  return $rbacreview->getRolesOfRoleFolder($this->getRefId(),false);
1777  }
1778 
1779  function __deleteSettings()
1780  {
1781  global $ilDB;
1782 
1783  $query = "DELETE FROM crs_settings ".
1784  "WHERE obj_id = ".$ilDB->quote($this->getId() ,'integer')." ";
1785  $res = $ilDB->manipulate($query);
1786 
1787  return true;
1788  }
1789 
1790 
1792  {
1793  $local_roles = $this->__getLocalRoles();
1794 
1795  foreach($local_roles as $role_id)
1796  {
1797  $title = ilObject::_lookupTitle($role_id);
1798  if(substr($title,0,8) == 'il_crs_m')
1799  {
1800  return $role_id;
1801  }
1802  }
1803  return 0;
1804  }
1806  {
1807  $local_roles = $this->__getLocalRoles();
1808 
1809  foreach($local_roles as $role_id)
1810  {
1811  if($tmp_role =& ilObjectFactory::getInstanceByObjId($role_id,false))
1812  {
1813  if(!strcmp($tmp_role->getTitle(),"il_crs_tutor_".$this->getRefId()))
1814  {
1815  return $role_id;
1816  }
1817  }
1818  }
1819  return false;
1820  }
1822  {
1823  $local_roles = $this->__getLocalRoles();
1824 
1825  foreach($local_roles as $role_id)
1826  {
1827  if($tmp_role =& ilObjectFactory::getInstanceByObjId($role_id,false))
1828  {
1829  if(!strcmp($tmp_role->getTitle(),"il_crs_admin_".$this->getRefId()))
1830  {
1831  return $role_id;
1832  }
1833  }
1834  }
1835  return false;
1836  }
1837 
1838  function _deleteUser($a_usr_id)
1839  {
1840  // Delete all user related data
1841  // delete lm_history
1842  include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
1843  ilCourseLMHistory::_deleteUser($a_usr_id);
1844 
1845  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
1847 
1848  // Course objectives
1849  include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
1851  }
1852 
1859  public function MDUpdateListener($a_element)
1860  {
1861  global $ilLog;
1862 
1863  parent::MDUpdateListener($a_element);
1864 
1865  switch($a_element)
1866  {
1867  case 'General':
1868  // Update ecs content
1869  include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
1870  $ecs = new ilECSCourseSettings($this);
1871  $ecs->handleContentUpdate();
1872  break;
1873 
1874  default:
1875  return true;
1876  }
1877  }
1878 
1883  function addAdditionalSubItemInformation(&$a_item_data)
1884  {
1885  include_once './Services/Object/classes/class.ilObjectActivation.php';
1887  }
1888 
1896  protected function prepareAppointments($a_mode = 'create')
1897  {
1898  include_once('./Services/Calendar/classes/class.ilCalendarAppointmentTemplate.php');
1899  include_once('./Services/Calendar/classes/class.ilDateTime.php');
1900 
1901  switch($a_mode)
1902  {
1903  case 'create':
1904  case 'update':
1905  if(!$this->getActivationUnlimitedStatus() and !$this->getOfflineStatus())
1906  {
1907  $app = new ilCalendarAppointmentTemplate(self::CAL_ACTIVATION_START);
1908  $app->setTitle($this->getTitle());
1909  $app->setSubtitle('crs_cal_activation_start');
1910  $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1911  $app->setDescription($this->getLongDescription());
1912  $app->setStart(new ilDateTime($this->getActivationStart(),IL_CAL_UNIX));
1913  $apps[] = $app;
1914 
1915  $app = new ilCalendarAppointmentTemplate(self::CAL_ACTIVATION_END);
1916  $app->setTitle($this->getTitle());
1917  $app->setSubtitle('crs_cal_activation_end');
1918  $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1919  $app->setDescription($this->getLongDescription());
1920  $app->setStart(new ilDateTime($this->getActivationEnd(),IL_CAL_UNIX));
1921  $apps[] = $app;
1922  }
1924  {
1925  $app = new ilCalendarAppointmentTemplate(self::CAL_REG_START);
1926  $app->setTitle($this->getTitle());
1927  $app->setSubtitle('crs_cal_reg_start');
1928  $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1929  $app->setDescription($this->getLongDescription());
1930  $app->setStart(new ilDateTime($this->getSubscriptionStart(),IL_CAL_UNIX));
1931  $apps[] = $app;
1932 
1933  $app = new ilCalendarAppointmentTemplate(self::CAL_REG_END);
1934  $app->setTitle($this->getTitle());
1935  $app->setSubtitle('crs_cal_reg_end');
1936  $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1937  $app->setDescription($this->getLongDescription());
1938  $app->setStart(new ilDateTime($this->getSubscriptionEnd(),IL_CAL_UNIX));
1939  $apps[] = $app;
1940  }
1941  if($this->getCourseStart() && $this->getCourseEnd())
1942  {
1943  $app = new ilCalendarAppointmentTemplate(self::CAL_COURSE_START);
1944  $app->setTitle($this->getTitle());
1945  $app->setSubtitle('crs_start');
1946  $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1947  $app->setDescription($this->getLongDescription());
1948  $app->setStart($this->getCourseStart());
1949  $app->setFullday(true);
1950  $apps[] = $app;
1951 
1952  $app = new ilCalendarAppointmentTemplate(self::CAL_COURSE_END);
1953  $app->setTitle($this->getTitle());
1954  $app->setSubtitle('crs_end');
1955  $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1956  $app->setDescription($this->getLongDescription());
1957  $app->setStart($this->getCourseEnd());
1958  $app->setFullday(true);
1959  $apps[] = $app;
1960  }
1961 
1962 
1963  return $apps ? $apps : array();
1964 
1965  case 'delete':
1966  // Nothing to do: The category and all assigned appointments will be deleted.
1967  return array();
1968  }
1969  }
1970 
1971  ###### Interface ilMembershipRegistrationCodes
1972 
1976  public static function lookupObjectsByCode($a_code)
1977  {
1978  global $ilDB;
1979 
1980  $query = "SELECT obj_id FROM crs_settings ".
1981  "WHERE reg_ac_enabled = ".$ilDB->quote(1,'integer')." ".
1982  "AND reg_ac = ".$ilDB->quote($a_code,'text');
1983  $res = $ilDB->query($query);
1984 
1985  $obj_ids = array();
1986  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1987  {
1988  $obj_ids[] = $row->obj_id;
1989  }
1990  return $obj_ids;
1991  }
1992 
1999  public function register($a_user_id,$a_role = ilCourseConstants::CRS_MEMBER, $a_force_registration = false)
2000  {
2001  global $ilCtrl, $tree;
2002  include_once './Services/Membership/exceptions/class.ilMembershipRegistrationException.php';
2003  include_once "./Modules/Course/classes/class.ilCourseParticipants.php";
2005 
2006  if($part->isAssigned($a_user_id))
2007  {
2008  return true;
2009  }
2010 
2011  if(!$a_force_registration)
2012  {
2013  // Availability
2015  {
2016  include_once './Modules/Group/classes/class.ilObjGroupAccess.php';
2017 
2019  {
2020  throw new ilMembershipRegistrationException('Cant registrate to course '.$this->getId().
2021  ', course subscription is deactivated.', '456');
2022  }
2023  }
2024 
2025  // Time Limitation
2027  {
2028  if( !$this->inSubscriptionTime() )
2029  {
2030  throw new ilMembershipRegistrationException('Cant registrate to course '.$this->getId().
2031  ', course is out of registration time.', '789');
2032  }
2033  }
2034 
2035  // Max members
2036  if($this->isSubscriptionMembershipLimited())
2037  {
2038  $free = max(0,$this->getSubscriptionMaxMembers() - $part->getCountMembers());
2039  include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
2040  $waiting_list = new ilCourseWaitingList($this->getId());
2041  if($this->enabledWaitingList() and (!$free or $waiting_list->getCountUsers()))
2042  {
2043  $waiting_list->addToList($a_user_id);
2044  $this->lng->loadLanguageModule("crs");
2045  $info = sprintf($this->lng->txt('crs_added_to_list'),
2046  $waiting_list->getPosition($a_user_id));
2047  include_once('./Modules/Course/classes/class.ilCourseParticipants.php');
2048  $participants = ilCourseParticipants::_getInstanceByObjId($this->getId());
2049  $participants->sendNotification($participants->NOTIFY_WAITING_LIST,$a_user_id);
2050 
2051  throw new ilMembershipRegistrationException($info, '124');
2052  }
2053 
2054  if(!$this->enabledWaitingList() && !$free)
2055  {
2056  throw new ilMembershipRegistrationException('Cant registrate to course '.$this->getId().
2057  ', membership is limited.', '123');
2058  }
2059  }
2060  }
2061 
2062  $part->add($a_user_id,$a_role);
2063  $part->sendNotification($part->NOTIFY_ACCEPT_USER, $a_user_id);
2064  $part->sendNotification($part->NOTIFY_ADMINS,$a_user_id);
2065 
2066 
2067  include_once './Modules/Forum/classes/class.ilForumNotification.php';
2069 
2070  return true;
2071  }
2072 
2079  public function getAutoNotification()
2080  {
2081  return $this->auto_notification;
2082  }
2083 
2084 
2091  public function setAutoNotification($value)
2092  {
2093  $this->auto_notification = $value;
2094  }
2095 
2101  public function setStatusDetermination($a_value)
2102  {
2103  $a_value = (int)$a_value;
2104 
2105  // #13905
2106  if($a_value == self::STATUS_DETERMINATION_LP)
2107  {
2108  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
2110  {
2111  $a_value = self::STATUS_DETERMINATION_MANUAL;
2112  }
2113  }
2114 
2115  $this->status_dt = $a_value;
2116  }
2117 
2123  public function getStatusDetermination()
2124  {
2125  return $this->status_dt;
2126  }
2127 
2131  public function syncMembersStatusWithLP()
2132  {
2133  include_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
2134  foreach($this->getMembersObject()->getParticipants() as $user_id)
2135  {
2136  // #15529 - force raise on sync
2137  ilLPStatusWrapper::_updateStatus($this->getId(), $user_id, null, false, true);
2138  }
2139  }
2140 
2148  public function checkLPStatusSync($a_member_id)
2149  {
2150  // #11113
2151  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
2154  {
2155  include_once("Services/Tracking/classes/class.ilLPStatus.php");
2156  // #13811 - we need to suppress creation if status entry
2157  $has_completed = (ilLPStatus::_lookupStatus($this->getId(), $a_member_id, false) == ilLPStatus::LP_STATUS_COMPLETED_NUM);
2158  $this->getMembersObject()->updatePassed($a_member_id, $has_completed, false, true);
2159  }
2160  }
2161 
2162  function getOrderType()
2163  {
2164  if($this->enabledObjectiveView())
2165  {
2166  return ilContainer::SORT_MANUAL;
2167  }
2168  return parent::getOrderType();
2169  }
2170 
2171  public function handleAutoFill()
2172  {
2173  if($this->enabledWaitingList() &&
2174  $this->hasWaitingListAutoFill())
2175  {
2176  $max = $this->getSubscriptionMaxMembers();
2178  if($max > $now)
2179  {
2180  // see assignFromWaitingListObject()
2181  include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
2182  $waiting_list = new ilCourseWaitingList($this->getId());
2183 
2184  foreach($waiting_list->getUserIds() as $user_id)
2185  {
2186  if(!$tmp_obj = ilObjectFactory::getInstanceByObjId($user_id,false))
2187  {
2188  continue;
2189  }
2190  if($this->getMembersObject()->isAssigned($user_id))
2191  {
2192  continue;
2193  }
2194  $this->getMembersObject()->add($user_id,IL_CRS_MEMBER);
2195  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_ACCEPT_USER,$user_id);
2196  $waiting_list->removeFromList($user_id);
2197 
2198  $this->checkLPStatusSync($user_id);
2199 
2200  $now++;
2201  if($now >= $max)
2202  {
2203  break;
2204  }
2205  }
2206  }
2207  }
2208  }
2209 
2210  public static function mayLeave($a_course_id, $a_user_id = null, &$a_date = null)
2211  {
2212  global $ilUser, $ilDB;
2213 
2214  if(!$a_user_id)
2215  {
2216  $a_user_id = $ilUser->getId();
2217  }
2218 
2219  $set = $ilDB->query("SELECT leave_end".
2220  " FROM crs_settings".
2221  " WHERE obj_id = ".$ilDB->quote($a_course_id, "integer"));
2222  $row = $ilDB->fetchAssoc($set);
2223  if($row && $row["leave_end"])
2224  {
2225  // timestamp to date
2226  $limit = date("Ymd", $row["leave_end"]);
2227  if($limit < date("Ymd"))
2228  {
2229  $a_date = new ilDate(date("Y-m-d", $row["leave_end"]), IL_CAL_DATE);
2230  return false;
2231  }
2232  }
2233  return true;
2234  }
2235 
2241  public static function findCoursesWithNotEnoughMembers()
2242  {
2243  global $ilDB;
2244 
2245  $res = array();
2246 
2247  $now = time();
2248 
2249  include_once "Modules/Course/classes/class.ilCourseParticipants.php";
2250 
2251  $set = $ilDB->query("SELECT obj_id, min_members".
2252  " FROM crs_settings".
2253  " WHERE min_members > ".$ilDB->quote(0, "integer").
2254  " AND sub_mem_limit = ".$ilDB->quote(1, "integer"). // #17206
2255  " AND ((leave_end IS NOT NULL".
2256  " AND leave_end < ".$ilDB->quote($now, "text").")".
2257  " OR (leave_end IS NULL".
2258  " AND sub_end IS NOT NULL".
2259  " AND sub_end < ".$ilDB->quote($now, "text")."))".
2260  " AND (crs_start IS NULL OR crs_start > ".$ilDB->quote($now, "integer").")");
2261  while($row = $ilDB->fetchAssoc($set))
2262  {
2263  $refs = ilObject::_getAllReferences($row['obj_id']);
2264  $ref = end($refs);
2265 
2266  if($GLOBALS['tree']->isDeleted($ref))
2267  {
2268  continue;
2269  }
2270 
2271  $part = new ilCourseParticipants($row["obj_id"]);
2272  $reci = $part->getNotificationRecipients();
2273  if(sizeof($reci))
2274  {
2275  $missing = (int)$row["min_members"]-$part->getCountMembers();
2276  if($missing > 0)
2277  {
2278  $res[$row["obj_id"]] = array($missing, $reci);
2279  }
2280  }
2281  }
2282 
2283  return $res;
2284  }
2285 
2286 } //END class.ilObjCourse
2287 ?>
const LP_STATUS_COMPLETED_NUM
setActivationEnd($a_value)
setArchiveType($a_value)
setSubscriptionNotify($a_value)
const IL_CRS_ACTIVATION_LIMITED
setContactResponsibility($a_value)
getMailToMembersType()
Get mail to members type.
setSubscriptionStart($a_value)
setSubscriptionEnd($a_value)
static _deleteAllEntries($a_obj_id)
Delete all entries Normally called for course deletion.
const IL_CRS_SUBSCRIPTION_LIMITED
static lookupNumberOfMembers($a_ref_id)
Lookup number of members ilRbacReview $rbacreview <type> $ilObjDataCache.
const IL_CRS_VIEW_OBJECTIVE
setNumberOfPreviousSessions($a_num)
Set number of previous sessions.
getLongitude()
Get Longitude.
setAutoNotification($value)
Sets automatic notification status in $this->auto_notification, using given $status.
static cloneSettings($a_copy_id, $a_container_id, $a_new_container_id)
Clone settings.
static lookupObjectsByCode($a_code)
isActivated($a_check_archive=false)
setParentRolePermissions($a_parent_ref)
This method is called before "initDefaultRoles".
getDefaultCourseRoles($a_crs_id="")
get default course roles, returns the defaultlike create roles il_crs_tutor, il_crs_admin and il_crs_...
const IL_CAL_TRANSLATION_SYSTEM
$_GET["client_id"]
static lookupCourseNonMemberTemplatesId()
Lookup course non member id.
setImportantInformation($a_info)
_registrationEnabled($a_obj_id)
Registration enabled? Method is in Access class, since it is needed by Access/ListGUI.
static _registrationEnabled($a_obj_id)
updateMetaData()
update meta data entry
static _after(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
setMailToMembersType($a_type)
Set mail to members type.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
_getTranslation($a_role_title)
static getItem($a_ref_id)
Get item data.
static _isSubscriptionNotificationEnabled($a_course_id)
Check if subscription notification is enabled.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
setContactEmail($a_value)
enableSubscriptionMembershipLimitation($a_status)
enable max members
getBigIconPath()
Get path for big icon.
static is_email($a_email)
This preg-based function checks whether an e-mail address is formally valid.
setOfflineStatus($a_value)
createMetaData()
create meta data entry
getTinyIconPath()
Get path for tiny icon.
enableSessionLimit($a_status)
en/disable limited number of sessions
static _lookupTitle($a_id)
lookup object title
Apointment templates are used for automatic generated apointments.
isRegistrationAccessCodeEnabled()
Check if access code is enabled.
getStatusDetermination()
Get status determination mode.
const IL_CAL_UNIX
setSubscriptionPassword($a_value)
setCourseEnd(ilDate $a_value=null)
static _deleteByContainer($a_container_id)
Delete all fields of a container.
const STATUS_DETERMINATION_LP
addAdditionalSubItemInformation(&$a_item_data)
Add additional information to sub item, e.g.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
setRegistrationAccessCode($a_code)
Set refistration access code.
static _clone($a_source_id, $a_target_id)
Clone fields.
static deleteResultsForUser($a_user_id)
Delete all result entries for user.
setSyllabus($a_syllabus)
static _usingRegistrationCode()
Using Registration code.
static _getAllReferences($a_id)
get all reference ids of object
const IL_CRS_ARCHIVE_NONE
update()
update complete object
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)
setLatitude($a_latitude)
Set Latitude.
getUserIdByLogin($a_login)
setViewMode($a_mode)
global $ilCtrl
Definition: ilias.php:18
setEnableCourseMap($a_enablemap)
Set Enable Course Map.
const IL_CRS_MEMBER
setActivationVisibility($a_value)
static lookupShowMembersEnabled($a_obj_id)
Check if show member is enabled.
setAboStatus($a_status)
setLocationZoom($a_locationzoom)
Set LocationZoom.
const IL_CAL_DAY
$info
Definition: example_052.php:80
const CAL_ACTIVATION_END
static _enabledLearningProgress()
check wether learing progress is enabled or not
const IL_CRS_SUBSCRIPTION_PASSWORD
static addAdditionalSubItemInformation(array &$a_item)
Parse item data for list entries.
const CAL_ACTIVATION_START
static _getInstance($a_copy_id)
Get instance of copy wizard options.
getLocationZoom()
Get LocationZoom.
setActivationStart($a_value)
Class ilObjCourse.
getMemberObject()
Get course member object.
Class for single dates.
setLongitude($a_longitude)
Set Longitude.
getId()
get object id public
_isActivated($a_obj_id)
Is activated.
Interface for all objects that offer registration with access codes.
getNumberOfNextSessions()
Set number of previous sessions.
setSubscriptionType($a_value)
const IL_CRS_ACTIVATION_OFFLINE
class ilcourseobjective
syncMembersStatusWithLP()
Set course status for all members by lp status.
__getCrsNonMemberTemplateId()
get course non-member template private
static _lookupObjId($a_id)
prepareAppointments($a_mode='create')
Prepare calendar appointments.
ilObjCourse($a_id=0, $a_call_by_reference=true)
Constructor public.
cloneDependencies($a_target_id, $a_copy_id)
Clone object dependencies (start objects, preconditions)
setSubscriptionMinMembers($a_value)
setNumberOfNextSessions($a_num)
Set number of previous sessions.
const IL_CRS_SUBSCRIPTION_UNLIMITED
setArchiveEnd($a_value)
getTitle()
get object title public
setContactConsultation($a_value)
MDUpdateListener($a_element)
Overwriten Metadata update listener for ECS functionalities.
const IL_CRS_VIEW_ARCHIVE
Date and time handling
redirection script todo: (a better solution should control the processing via a xml file) ...
cloneMetaData($target_obj)
Copy meta data.
Class ilContainer.
const IL_CRS_ADMIN
Base class for course and group participants.
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
cloneSettings($new_obj)
Clone entries in settings table.
const STATUS_DETERMINATION_MANUAL
getSubItems($a_admin_panel_enabled=false, $a_include_side_block=false)
Get subitems of container.
static _getInstanceByObjId($a_obj_id, $a_usr_id)
Get singleton instance.
getRegistrationAccessCode()
get access code
enableRegistrationAccessCode($a_status)
En/disable registration access code.
setTimingType($a_type)
Set timing type.
getLocalCourseRoles($a_translate=false)
get ALL local roles of course, also those created and defined afterwards only fetch data once from da...
static mayLeave($a_course_id, $a_user_id=null, &$a_date=null)
getAutoNotification()
Returns automatic notification status from $this->auto_notification.
checkLPStatusSync($a_member_id)
sync course status from lp
getLatitude()
Get Latitude.
getSmallIconPath()
Get path for small icon.
cloneAutoGeneratedRoles($new_obj)
Clone automatic genrated roles (permissions and template permissions)
setMessage($a_message)
isSubscriptionMembershipLimited()
is membership limited
setActivationType($a_type)
const IL_CAL_DATE
static generateCode()
Generate new registration key.
setContactPhone($a_value)
setCancellationEnd(ilDate $a_value=null)
global $ilUser
Definition: imgupload.php:15
setOrderType($a_value)
static findCoursesWithNotEnoughMembers()
Minimum members check type $ilDB.
initCourseMembersObject()
Init course member object ilObjUser $ilUser.
static cloneDependencies($a_ref_id, $a_target_id, $a_copy_id)
Clone dependencies.
create($a_upload=false)
global $ilDB
const IL_CRS_ARCHIVE_DOWNLOAD
static _deleteUser($a_usr_id)
Delete user data.
getNumberOfPreviousSessions()
Set number of previous sessions.
getLongDescription()
get object long description (stored in object_description)
setSubscriptionMaxMembers($a_value)
getRefId()
get reference id public
enableWaitingList($a_status)
deleteMetaData()
delete meta data entry
Create PDF certificates.
initCourseMemberObject()
Init course member object ilObjUser $ilUser.
const IL_CRS_SUBSCRIPTION_DIRECT
setWaitingListAutoFill($a_value)
static _lookupSortMode($a_obj_id)
lookup sort mode
cloneObject($a_target_id, $a_copy_id=0)
Clone course (no member data)
static _getInstance($a_obj_id)
get instance by obj_id
_deleteByCourse($a_course_id)
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
getEnableCourseMap()
Get Enable Course Map.
static checkForumsExistsInsert($ref_id, $user_id=0)
static _isActivated($a_obj_id, &$a_visible_flag=null, $a_mind_member_view=true)
Is activated?
class ilCourseArchives
static _within(ilDateTime $dt, ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check whether an date is within a date duration given by start and end.
Class ilObjectActivation.
read($a_force_db=false)
static _cloneFiles($a_source_id, $a_target_id)
Clone course files.
appendMessage($a_message)
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
setShowMembers($a_status)
Class ilECSCourseSettings.
const IL_CRS_SUBSCRIPTION_DEACTIVATED
setCourseStart(ilDate $a_value=null)
const IL_CRS_ACTIVATION_UNLIMITED
setStatusDetermination($a_value)
Set status determination mode.
_deleteUser($a_usr_id)
setArchiveStart($a_value)
setSubscriptionLimitationType($a_type)