ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
40  protected $course_logger = null;
41 
42 
43  const CAL_REG_START = 1;
44  const CAL_REG_END = 2;
46  const CAL_ACTIVATION_END = 4;
47  const CAL_COURSE_START = 5;
48  const CAL_COURSE_END = 6;
49 
52 
53  private $member_obj = null;
54  private $members_obj = null;
56 
57  private $latitude = '';
58  private $longitude = '';
59  private $locationzoom = 0;
60  private $enablemap = 0;
61 
62  private $session_limit = 0;
63  private $session_prev = -1;
64  private $session_next = -1;
65 
66  private $reg_access_code = '';
67  private $reg_access_code_enabled = false;
68  private $status_dt = null;
69 
71 
72  protected $crs_start; // [ilDate]
73  protected $crs_end; // [ilDate]
74  protected $leave_end; // [ilDate]
75  protected $min_members; // [int]
76  protected $auto_fill_from_waiting; // [bool]
77 
86  private $auto_notification = true;
87 
94  public function __construct($a_id = 0,$a_call_by_reference = true)
95  {
96 
97  #define("ILIAS_MODULE","course");
98  #define("KEEP_IMAGE_PATH",1);
99 
100  $this->SUBSCRIPTION_DEACTIVATED = 1;
101  $this->SUBSCRIPTION_CONFIRMATION = 2;
102  $this->SUBSCRIPTION_DIRECT = 3;
103  $this->SUBSCRIPTION_PASSWORD = 4;
104  $this->SUBSCRIPTION_AUTOSUBSCRIPTION = 5;
105  $this->ARCHIVE_DISABLED = 1;
106  $this->ARCHIVE_READ = 2;
107  $this->ARCHIVE_DOWNLOAD = 3;
108  $this->ABO_ENABLED = 1;
109  $this->ABO_DISABLED = 0;
110  $this->SHOW_MEMBERS_ENABLED = 1;
111  $this->SHOW_MEMBERS_DISABLED = 0;
112  $this->setStatusDetermination(self::STATUS_DETERMINATION_LP);
113 
114  $this->type = "crs";
115 
116  $this->course_logger = $GLOBALS['DIC']->logger()->crs();
117 
118  parent::__construct($a_id,$a_call_by_reference);
119 
120  }
121 
127  public static function lookupShowMembersEnabled($a_obj_id)
128  {
129  $query = 'SELECT show_members FROM crs_settings '.
130  'WHERE obj_id = '.$GLOBALS['ilDB']->quote($a_obj_id,'integer');
131  $res = $GLOBALS['ilDB']->query($query);
132  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
133  {
134  return (bool) $row->show_members;
135  }
136  return false;
137  }
138 
143  public function getRegistrationAccessCode()
144  {
145  return $this->reg_access_code;
146  }
147 
153  public function setRegistrationAccessCode($a_code)
154  {
155  $this->reg_access_code = $a_code;
156  }
157 
163  {
164  return (bool) $this->reg_access_code_enabled;
165  }
166 
172  public function enableRegistrationAccessCode($a_status)
173  {
174  $this->reg_access_code_enabled = $a_status;
175  }
176 
178  {
179  return $this->important;
180  }
181  function setImportantInformation($a_info)
182  {
183  $this->important = $a_info;
184  }
185  function getSyllabus()
186  {
187  return $this->syllabus;
188  }
189  function setSyllabus($a_syllabus)
190  {
191  $this->syllabus = $a_syllabus;
192  }
193  function getContactName()
194  {
195  return $this->contact_name;
196  }
197  function setContactName($a_cn)
198  {
199  $this->contact_name = $a_cn;
200  }
202  {
203  return $this->contact_consultation;
204  }
205  function setContactConsultation($a_value)
206  {
207  $this->contact_consultation = $a_value;
208  }
209  function getContactPhone()
210  {
211  return $this->contact_phone;
212  }
213  function setContactPhone($a_value)
214  {
215  $this->contact_phone = $a_value;
216  }
217  function getContactEmail()
218  {
219  return $this->contact_email;
220  }
221  function setContactEmail($a_value)
222  {
223  $this->contact_email = $a_value;
224  }
226  {
227  return $this->contact_responsibility;
228  }
229  function setContactResponsibility($a_value)
230  {
231  $this->contact_responsibility = $a_value;
232  }
233  function getActivationType()
234  {
235  return (int) $this->activation_type;
236  }
238  {
239  // offline is separate property now
241  {
242  $this->setOfflineStatus(true);
244  }
245 
246  $this->activation_type = $a_type;
247  }
249  {
250  return $this->activation_type == IL_CRS_ACTIVATION_UNLIMITED;
251  }
253  {
254  return $this->activation_start;
255  }
256  function setActivationStart($a_value)
257  {
258  $this->activation_start = $a_value;
259  }
260  function getActivationEnd()
261  {
262  return $this->activation_end;
263  }
264  function setActivationEnd($a_value)
265  {
266  $this->activation_end = $a_value;
267  }
268  function getOfflineStatus()
269  {
270  return (bool)$this->activation_offline;
271  }
272  function setOfflineStatus($a_value)
273  {
274  $this->activation_offline = (bool) $a_value;
275  }
276  function setActivationVisibility($a_value)
277  {
278  $this->activation_visibility = (bool) $a_value;
279  }
281  {
282  return $this->activation_visibility;
283  }
284 
286  {
287  return $this->subscription_limitation_type;
288  }
290  {
291  $this->subscription_limitation_type = $a_type;
292  }
294  {
295  return $this->subscription_limitation_type == IL_CRS_SUBSCRIPTION_UNLIMITED;
296  }
298  {
299  return $this->subscription_start;
300  }
301  function setSubscriptionStart($a_value)
302  {
303  $this->subscription_start = $a_value;
304  }
306  {
307  return $this->subscription_end;
308  }
309  function setSubscriptionEnd($a_value)
310  {
311  $this->subscription_end = $a_value;
312  }
314  {
315  return $this->subscription_type ? $this->subscription_type : IL_CRS_SUBSCRIPTION_DIRECT;
316  #return $this->subscription_type ? $this->subscription_type : $this->SUBSCRIPTION_DEACTIVATED;
317  }
318  function setSubscriptionType($a_value)
319  {
320  $this->subscription_type = $a_value;
321  }
323  {
324  return $this->subscription_password;
325  }
326  function setSubscriptionPassword($a_value)
327  {
328  $this->subscription_password = $a_value;
329  }
331  {
332  return $this->view_mode == IL_CRS_VIEW_OBJECTIVE;
333  }
334 
336  {
337  return (bool) $this->waiting_list;
338  }
339 
340  function enableWaitingList($a_status)
341  {
342  $this->waiting_list = (bool) $a_status;
343  }
344 
346  {
347  if($this->getSubscriptionUnlimitedStatus())
348  {
349  return true;
350  }
351  if(time() > $this->getSubscriptionStart() and time() < $this->getSubscriptionEnd())
352  {
353  return true;
354  }
355  return false;
356  }
357 
363  public function enableSessionLimit($a_status)
364  {
365  $this->session_limit = $a_status;
366  }
367 
368  public function isSessionLimitEnabled()
369  {
370  return (bool) $this->session_limit;
371  }
372 
380  public function enableSubscriptionMembershipLimitation($a_status)
381  {
382  $this->subscription_membership_limitation = $a_status;
383  }
384 
390  public function setNumberOfPreviousSessions($a_num)
391  {
392  $this->session_prev = $a_num;
393  }
394 
399  public function getNumberOfPreviousSessions()
400  {
401  return $this->session_prev;
402  }
403 
409  public function setNumberOfNextSessions($a_num)
410  {
411  $this->session_next = $a_num;
412  }
413 
418  public function getNumberOfNextSessions()
419  {
420  return $this->session_next;
421  }
430  {
431  return (bool) $this->subscription_membership_limitation;
432  }
433 
435  {
436  return $this->subscription_max_members;
437  }
438  function setSubscriptionMaxMembers($a_value)
439  {
440  $this->subscription_max_members = $a_value;
441  }
442 
451  public static function _isSubscriptionNotificationEnabled($a_course_id)
452  {
453  global $ilDB;
454 
455  $query = "SELECT * FROM crs_settings ".
456  "WHERE obj_id = ".$ilDB->quote($a_course_id ,'integer')." ".
457  "AND sub_notify = 1";
458  $res = $ilDB->query($query);
459  return $res->numRows() ? true : false;
460  }
461 
468  public function getSubItems($a_admin_panel_enabled = false, $a_include_side_block = false, $a_get_single = 0)
469  {
470  global $ilUser;
471 
472  // Caching
473  if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]))
474  {
475  return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
476  }
477 
478  // Results are stored in $this->items
479  parent::getSubItems($a_admin_panel_enabled,$a_include_side_block, $a_get_single);
480 
481  $limit_sess = false;
482  if(!$a_admin_panel_enabled &&
483  !$a_include_side_block &&
484  $this->items['sess'] &&
485  is_array($this->items['sess']) &&
486  $this->isSessionLimitEnabled() &&
487  $this->getViewMode() == ilContainer::VIEW_SESSIONS) // #16686
488  {
489  $limit_sess = true;
490  }
491 
492  if(!$limit_sess)
493  {
494  return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
495  }
496 
497 
498  // do session limit
499 
500  // @todo move to gui class
501  if(isset($_GET['crs_prev_sess']))
502  {
503  $ilUser->writePref('crs_sess_show_prev_'.$this->getId(), (string) (int) $_GET['crs_prev_sess']);
504  }
505  if(isset($_GET['crs_next_sess']))
506  {
507  $ilUser->writePref('crs_sess_show_next_'.$this->getId(), (string) (int) $_GET['crs_next_sess']);
508  }
509 
510  $sessions = ilUtil::sortArray($this->items['sess'],'start','ASC',true,false);
511  $today = new ilDate(date('Ymd',time()),IL_CAL_DATE);
512  $previous = $current = $next = array();
513  foreach($sessions as $key => $item)
514  {
515  $start = new ilDateTime($item['start'],IL_CAL_UNIX);
516  $end = new ilDateTime($item['end'],IL_CAL_UNIX);
517 
518  if(ilDateTime::_within($today, $start, $end, IL_CAL_DAY))
519  {
520  $current[] = $item;
521  }
522  elseif(ilDateTime::_before($start, $today, IL_CAL_DAY))
523  {
524  $previous[] = $item;
525  }
526  elseif(ilDateTime::_after($start, $today, IL_CAL_DAY))
527  {
528  $next[] = $item;
529  }
530  }
531  $num_previous_remove = max(
532  count($previous) - $this->getNumberOfPreviousSessions(),
533  0
534  );
535  while($num_previous_remove--)
536  {
537  if(!$ilUser->getPref('crs_sess_show_prev_'.$this->getId()))
538  {
539  array_shift($previous);
540  }
541  $this->items['sess_link']['prev']['value'] = 1;
542  }
543 
544  $num_next_remove = max(
545  count($next) - $this->getNumberOfNextSessions(),
546  0
547  );
548  while($num_next_remove--)
549  {
550  if(!$ilUser->getPref('crs_sess_show_next_'.$this->getId()))
551  {
552  array_pop($next);
553  }
554  // @fixme
555  $this->items['sess_link']['next']['value'] = 1;
556  }
557 
558  $sessions = array_merge($previous,$current,$next);
559  $this->items['sess'] = $sessions;
560 
561  // #15389 - see ilContainer::getSubItems()
562  include_once('Services/Container/classes/class.ilContainerSorting.php');
563  $sort = ilContainerSorting::_getInstance($this->getId());
564  $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block] = $sort->sortItems($this->items);
565 
566  return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
567  }
568 
570  {
571  return true;
572  return $this->subscription_notify ? true : false;
573  }
574  function setSubscriptionNotify($a_value)
575  {
576  $this->subscription_notify = $a_value ? true : false;
577  }
578 
579  function setViewMode($a_mode)
580  {
581  $this->view_mode = $a_mode;
582  }
583  function getViewMode()
584  {
585  return $this->view_mode;
586  }
587 
593  public static function _lookupViewMode($a_id)
594  {
595  global $ilDB;
596 
597  $query = "SELECT view_mode FROM crs_settings WHERE obj_id = ".$ilDB->quote($a_id ,'integer')." ";
598  $res = $ilDB->query($query);
599  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
600  {
601  return $row->view_mode;
602  }
603  return false;
604  }
605 
606  static function _lookupAboStatus($a_id)
607  {
608  global $ilDB;
609 
610  $query = "SELECT abo FROM crs_settings WHERE obj_id = ".$ilDB->quote($a_id ,'integer')." ";
611  $res = $ilDB->query($query);
612  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
613  {
614  return $row->abo;
615  }
616  return false;
617  }
618 
619  function getArchiveStart()
620  {
621  return $this->archive_start ? $this->archive_start : time();
622  }
623  function setArchiveStart($a_value)
624  {
625  $this->archive_start = $a_value;
626  }
627  function getArchiveEnd()
628  {
629  return $this->archive_end ? $this->archive_end : mktime(0,0,0,12,12,date("Y",time())+2);
630  }
631  function setArchiveEnd($a_value)
632  {
633  $this->archive_end = $a_value;
634  }
635  function getArchiveType()
636  {
637  return $this->archive_type ? IL_CRS_ARCHIVE_DOWNLOAD : IL_CRS_ARCHIVE_NONE;
638  }
639  function setArchiveType($a_value)
640  {
641  $this->archive_type = $a_value;
642  }
643  function setAboStatus($a_status)
644  {
645  $this->abo = $a_status;
646  }
647  function getAboStatus()
648  {
649  return $this->abo;
650  }
651  function setShowMembers($a_status)
652  {
653  $this->show_members = $a_status;
654  }
655  function getShowMembers()
656  {
657  return $this->show_members;
658  }
659 
665  public function setMailToMembersType($a_type)
666  {
667  $this->mail_members = $a_type;
668  }
669 
674  public function getMailToMembersType()
675  {
676  return $this->mail_members;
677  }
678 
679  function getMessage()
680  {
681  return $this->message;
682  }
683  function setMessage($a_message)
684  {
685  $this->message = $a_message;
686  }
687  function appendMessage($a_message)
688  {
689  if($this->getMessage())
690  {
691  $this->message .= "<br /> ";
692  }
693  $this->message .= $a_message;
694  }
695 
696  function isActivated()
697  {
698  if($this->getOfflineStatus())
699  {
700  return false;
701  }
702  if($this->getActivationUnlimitedStatus())
703  {
704  return true;
705  }
706  if(time() < $this->getActivationStart() or
707  time() > $this->getActivationEnd())
708  {
709  return false;
710  }
711  return true;
712  }
713 
720  public static function _isActivated($a_obj_id)
721  {
722  include_once("./Modules/Course/classes/class.ilObjCourseAccess.php");
723  return ilObjCourseAccess::_isActivated($a_obj_id);
724  }
725 
732  public static function _registrationEnabled($a_obj_id)
733  {
734  include_once("./Modules/Course/classes/class.ilObjCourseAccess.php");
735  return ilObjCourseAccess::_registrationEnabled($a_obj_id);
736  }
737 
738 
739  function allowAbo()
740  {
741  return $this->ABO == $this->ABO_ENABLED;
742  }
743 
747  public function read()
748  {
749  parent::read();
750 
751  include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
753 
754  $this->__readSettings();
755  }
756  function create($a_upload = false)
757  {
758  global $ilAppEventHandler;
759 
760  parent::create($a_upload);
761 
762  if(!$a_upload)
763  {
764  $this->createMetaData();
765  }
766  $this->__createDefaultSettings();
767 
768  $ilAppEventHandler->raise('Modules/Course',
769  'create',
770  array('object' => $this,
771  'obj_id' => $this->getId(),
772  'appointments' => $this->prepareAppointments('create')));
773 
774  }
775 
781  function setLatitude($a_latitude)
782  {
783  $this->latitude = $a_latitude;
784  }
785 
791  function getLatitude()
792  {
793  return $this->latitude;
794  }
795 
801  function setLongitude($a_longitude)
802  {
803  $this->longitude = $a_longitude;
804  }
805 
811  function getLongitude()
812  {
813  return $this->longitude;
814  }
815 
821  function setLocationZoom($a_locationzoom)
822  {
823  $this->locationzoom = $a_locationzoom;
824  }
825 
831  function getLocationZoom()
832  {
833  return $this->locationzoom;
834  }
835 
841  function setEnableCourseMap($a_enablemap)
842  {
843  $this->enablemap = $a_enablemap;
844  }
845 
850  public function getEnableMap()
851  {
852  return $this->getEnableCourseMap();
853  }
854 
861  {
862  return $this->enablemap;
863  }
864 
865  function setCourseStart(ilDate $a_value = null)
866  {
867  $this->crs_start = $a_value;
868  }
869 
870  function getCourseStart()
871  {
872  return $this->crs_start;
873  }
874 
875  function setCourseEnd(ilDate $a_value = null)
876  {
877  $this->crs_end = $a_value;
878  }
879 
880  function getCourseEnd()
881  {
882  return $this->crs_end;
883  }
884 
885  function setCancellationEnd(ilDate $a_value = null)
886  {
887  $this->leave_end = $a_value;
888  }
889 
891  {
892  return $this->leave_end;
893  }
894 
895  function setSubscriptionMinMembers($a_value)
896  {
897  if($a_value !== null)
898  {
899  $a_value = (int)$a_value;
900  }
901  $this->min_members = $a_value;
902  }
903 
905  {
906  return $this->min_members;
907  }
908 
909  function setWaitingListAutoFill($a_value)
910  {
911  $this->auto_fill_from_waiting = (bool)$a_value;
912  }
913 
915  {
916  return (bool)$this->auto_fill_from_waiting;
917  }
918 
927  public function cloneObject($a_target_id,$a_copy_id = 0, $a_omit_tree = false)
928  {
929  global $ilDB,$ilUser;
930 
931  $new_obj = parent::cloneObject($a_target_id,$a_copy_id, $a_omit_tree);
932 
933  $this->cloneAutoGeneratedRoles($new_obj);
934  $this->cloneMetaData($new_obj);
935 
936  // Assign admin
937  $new_obj->getMemberObject()->add($ilUser->getId(),IL_CRS_ADMIN);
938  // cognos-blu-patch: begin
939  $new_obj->getMemberObject()->updateContact($ilUser->getId(), 1);
940  // cognos-blu-patch: end
941 
942 
943  // #14596
944  $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
945  if($cwo->isRootNode($this->getRefId()))
946  {
947  $this->setOfflineStatus(true);
948  }
949 
950  // Copy settings
951  $this->cloneSettings($new_obj);
952 
953  // Course Defined Fields
954  include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
955  ilCourseDefinedFieldDefinition::_clone($this->getId(),$new_obj->getId());
956 
957  // Clone course files
958  include_once('Modules/Course/classes/class.ilCourseFile.php');
959  ilCourseFile::_cloneFiles($this->getId(),$new_obj->getId());
960 
961  // Copy learning progress settings
962  include_once('Services/Tracking/classes/class.ilLPObjSettings.php');
963  $obj_settings = new ilLPObjSettings($this->getId());
964  $obj_settings->cloneSettings($new_obj->getId());
965  unset($obj_settings);
966 
967  // clone icons
968  global $ilLog;
969  $ilLog->write(__METHOD__.': '.$this->getBigIconPath().' '.$this->getSmallIconPath());
970  $new_obj->saveIcons($this->getBigIconPath(),
971  $this->getSmallIconPath(),
972  $this->getTinyIconPath());
973 
974  // clone certificate (#11085)
975  include_once "./Services/Certificate/classes/class.ilCertificate.php";
976  include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
977  $cert = new ilCertificate(new ilCourseCertificateAdapter($this));
978  $newcert = new ilCertificate(new ilCourseCertificateAdapter($new_obj));
979  $cert->cloneCertificate($newcert);
980 
981  return $new_obj;
982  }
983 
992  public function cloneDependencies($a_target_id,$a_copy_id)
993  {
994  parent::cloneDependencies($a_target_id,$a_copy_id);
995 
996  // Clone course start objects
997  include_once('Services/Container/classes/class.ilContainerStartObjects.php');
998  $start = new ilContainerStartObjects($this->getRefId(),$this->getId());
999  $start->cloneDependencies($a_target_id,$a_copy_id);
1000 
1001  // Clone course item settings
1002  include_once('Services/Object/classes/class.ilObjectActivation.php');
1003  ilObjectActivation::cloneDependencies($this->getRefId(),$a_target_id,$a_copy_id);
1004 
1005  // clone objective settings
1006  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
1007  ilLOSettings::cloneSettings($a_copy_id, $this->getId(), ilObject::_lookupObjId($a_target_id));
1008 
1009  // Clone course learning objectives
1010  include_once('Modules/Course/classes/class.ilCourseObjective.php');
1011  $crs_objective = new ilCourseObjective($this);
1012  $crs_objective->ilClone($a_target_id,$a_copy_id);
1013 
1014  return true;
1015  }
1016 
1024  public function cloneAutoGeneratedRoles($new_obj)
1025  {
1026  global $ilLog,$rbacadmin,$rbacreview;
1027 
1028  $admin = $this->getDefaultAdminRole();
1029  $new_admin = $new_obj->getDefaultAdminRole();
1030 
1031  if(!$admin || !$new_admin || !$this->getRefId() || !$new_obj->getRefId())
1032  {
1033  $ilLog->write(__METHOD__.' : Error cloning auto generated role: il_crs_admin');
1034  }
1035  $rbacadmin->copyRolePermissions($admin,$this->getRefId(),$new_obj->getRefId(),$new_admin,true);
1036  $ilLog->write(__METHOD__.' : Finished copying of role crs_admin.');
1037 
1038  $tutor = $this->getDefaultTutorRole();
1039  $new_tutor = $new_obj->getDefaultTutorRole();
1040  if(!$tutor || !$new_tutor)
1041  {
1042  $ilLog->write(__METHOD__.' : Error cloning auto generated role: il_crs_tutor');
1043  }
1044  $rbacadmin->copyRolePermissions($tutor,$this->getRefId(),$new_obj->getRefId(),$new_tutor,true);
1045  $ilLog->write(__METHOD__.' : Finished copying of role crs_tutor.');
1046 
1047  $member = $this->getDefaultMemberRole();
1048  $new_member = $new_obj->getDefaultMemberRole();
1049  if(!$member || !$new_member)
1050  {
1051  $ilLog->write(__METHOD__.' : Error cloning auto generated role: il_crs_member');
1052  }
1053  $rbacadmin->copyRolePermissions($member,$this->getRefId(),$new_obj->getRefId(),$new_member,true);
1054  $ilLog->write(__METHOD__.' : Finished copying of role crs_member.');
1055 
1056  return true;
1057  }
1058 
1059 
1060  function validate()
1061  {
1062  $this->setMessage('');
1063 
1064  #if(($this->getSubscriptionLimitationType() != IL_CRS_SUBSCRIPTION_DEACTIVATED) and
1065  # $this->getSubscriptionType() == )
1066  #{
1067  # $this->appendMessage($this->lng->txt('crs_select_registration_type'));
1068  #}
1069 
1071  $this->getActivationEnd() < $this->getActivationStart())
1072  {
1073  $this->appendMessage($this->lng->txt("activation_times_not_valid"));
1074  }
1076  $this->getSubscriptionStart() > $this->getSubscriptionEnd())
1077  {
1078  $this->appendMessage($this->lng->txt("subscription_times_not_valid"));
1079  }
1080  #if((!$this->getActivationUnlimitedStatus() and
1081  # !$this->getSubscriptionUnlimitedStatus()) and
1082  # ($this->getSubscriptionStart() > $this->getActivationEnd() or
1083  # $this->getSubscriptionStart() < $this->getActivationStart() or
1084  # $this->getSubscriptionEnd() > $this->getActivationEnd() or
1085  # $this->getSubscriptionEnd() < $this->getActivationStart()))
1086  #
1087  #{
1088  # $this->appendMessage($this->lng->txt("subscription_time_not_within_activation"));
1089  #}
1091  {
1092  $this->appendMessage($this->lng->txt("crs_password_required"));
1093  }
1094  if($this->isSubscriptionMembershipLimited())
1095  {
1096  if($this->getSubscriptionMinMembers() <= 0 && $this->getSubscriptionMaxMembers() <= 0)
1097  {
1098  $this->appendMessage($this->lng->txt("crs_max_and_min_members_needed"));
1099  }
1100  if($this->getSubscriptionMaxMembers() <= 0 && $this->enabledWaitingList())
1101  {
1102  $this->appendMessage($this->lng->txt("crs_max_members_needed"));
1103  }
1104  if($this->getSubscriptionMaxMembers() > 0 && $this->getSubscriptionMinMembers() > $this->getSubscriptionMaxMembers())
1105  {
1106  $this->appendMessage($this->lng->txt("crs_max_and_min_members_invalid"));
1107  }
1108  }
1109  if(!$this->getTitle() || !$this->getStatusDetermination())
1110  {
1111  $this->appendMessage($this->lng->txt('err_check_input'));
1112  }
1113 
1114  // :TODO: checkInput() is not used properly
1115  if(($this->getCourseStart() && !$this->getCourseEnd()) ||
1116  (!$this->getCourseStart() && $this->getCourseEnd()) ||
1117  ($this->getCourseStart() && $this->getCourseEnd() && $this->getCourseStart()->get(IL_CAL_UNIX) > $this->getCourseEnd()->get(IL_CAL_UNIX)))
1118  {
1119  $this->appendMessage($this->lng->txt("crs_course_period_not_valid"));
1120  }
1121 
1122  return $this->getMessage() ? false : true;
1123  }
1124 
1126  {
1127  global $ilErr;
1128  $error = false;
1129  if($this->getContactEmail()) {
1130  $emails = explode(",",$this->getContactEmail());
1131 
1132  foreach ($emails as $email) {
1133  $email = trim($email);
1134  if (!(ilUtil::is_email($email) or ilObjUser::getUserIdByLogin($email)))
1135  {
1136  $ilErr->appendMessage($this->lng->txt('contact_email_not_valid')." '".$email."'");
1137  $error = true;
1138  }
1139  }
1140  }
1141  return !$error;
1142  }
1143 
1144  function hasContactData()
1145  {
1146  return strlen($this->getContactName()) or
1147  strlen($this->getContactResponsibility()) or
1148  strlen($this->getContactEmail()) or
1149  strlen($this->getContactPhone()) or
1150  strlen($this->getContactConsultation());
1151  }
1152 
1153 
1160  function delete()
1161  {
1162  global $ilAppEventHandler;
1163 
1164  // always call parent delete function first!!
1165  if (!parent::delete())
1166  {
1167  return false;
1168  }
1169 
1170  // delete meta data
1171  $this->deleteMetaData();
1172 
1173  // put here course specific stuff
1174 
1175  $this->__deleteSettings();
1176 
1177  include_once('Modules/Course/classes/class.ilCourseParticipants.php');
1179 
1180  include_once './Modules/Course/classes/class.ilCourseObjective.php';
1182 
1183  include_once './Modules/Course/classes/class.ilObjCourseGrouping.php';
1185 
1186  include_once './Modules/Course/classes/class.ilCourseFile.php';
1188 
1189  include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
1191 
1192  $ilAppEventHandler->raise('Modules/Course',
1193  'delete',
1194  array('object' => $this,
1195  'obj_id' => $this->getId(),
1196  'appointments' => $this->prepareAppointments('delete')));
1197 
1198 
1199  return true;
1200  }
1201 
1202 
1203 
1207  function update()
1208  {
1209  global $ilAppEventHandler,$ilLog;
1210 
1211  include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
1212  $sorting = new ilContainerSortingSettings($this->getId());
1213  $sorting->setSortMode($this->getOrderType());
1214  $sorting->update();
1215 
1216  $this->updateMetaData();
1217  $this->updateSettings();
1218  parent::update();
1219 
1220  $ilAppEventHandler->raise('Modules/Course',
1221  'update',
1222  array('object' => $this,
1223  'obj_id' => $this->getId(),
1224  'appointments' => $this->prepareAppointments('update')));
1225 
1226  }
1227 
1228  function updateSettings()
1229  {
1230  global $ilDB;
1231 
1232  // Due to a bug 3.5.alpha maybe no settings exist. => create default settings
1233 
1234  $query = "SELECT * FROM crs_settings WHERE obj_id = ".$ilDB->quote($this->getId() ,'integer')." ";
1235  $res = $ilDB->query($query);
1236 
1237  if(!$res->numRows())
1238  {
1239  $this->__createDefaultSettings();
1240  }
1241 
1242  $query = "UPDATE crs_settings SET ".
1243  "syllabus = ".$ilDB->quote($this->getSyllabus() ,'text').", ".
1244  "contact_name = ".$ilDB->quote($this->getContactName() ,'text').", ".
1245  "contact_responsibility = ".$ilDB->quote($this->getContactResponsibility() ,'text').", ".
1246  "contact_phone = ".$ilDB->quote($this->getContactPhone() ,'text').", ".
1247  "contact_email = ".$ilDB->quote($this->getContactEmail() ,'text').", ".
1248  "contact_consultation = ".$ilDB->quote($this->getContactConsultation() ,'text').", ".
1249  "activation_type = ".$ilDB->quote(!$this->getOfflineStatus() ,'integer').", ".
1250  "sub_limitation_type = ".$ilDB->quote($this->getSubscriptionLimitationType() ,'integer').", ".
1251  "sub_start = ".$ilDB->quote($this->getSubscriptionStart() ,'integer').", ".
1252  "sub_end = ".$ilDB->quote($this->getSubscriptionEnd() ,'integer').", ".
1253  "sub_type = ".$ilDB->quote($this->getSubscriptionType() ,'integer').", ".
1254  "sub_password = ".$ilDB->quote($this->getSubscriptionPassword() ,'text').", ".
1255  "sub_mem_limit = ".$ilDB->quote((int) $this->isSubscriptionMembershipLimited() ,'integer').", ".
1256  "sub_max_members = ".$ilDB->quote($this->getSubscriptionMaxMembers() ,'integer').", ".
1257  "sub_notify = ".$ilDB->quote($this->getSubscriptionNotify() ,'integer').", ".
1258  "view_mode = ".$ilDB->quote($this->getViewMode() ,'integer').", ".
1259  "abo = ".$ilDB->quote($this->getAboStatus() ,'integer').", ".
1260  "waiting_list = ".$ilDB->quote($this->enabledWaitingList() ,'integer').", ".
1261  "important = ".$ilDB->quote($this->getImportantInformation() ,'text').", ".
1262  "show_members = ".$ilDB->quote($this->getShowMembers() ,'integer').", ".
1263  "latitude = ".$ilDB->quote($this->getLatitude() ,'text').", ".
1264  "longitude = ".$ilDB->quote($this->getLongitude() ,'text').", ".
1265  "location_zoom = ".$ilDB->quote($this->getLocationZoom() ,'integer').", ".
1266  "enable_course_map = ".$ilDB->quote((int) $this->getEnableCourseMap() ,'integer').", ".
1267  'session_limit = '.$ilDB->quote($this->isSessionLimitEnabled(),'integer').', '.
1268  'session_prev = '.$ilDB->quote($this->getNumberOfPreviousSessions(),'integer').', '.
1269  'session_next = '.$ilDB->quote($this->getNumberOfNextSessions(),'integer').', '.
1270  'reg_ac_enabled = '.$ilDB->quote($this->isRegistrationAccessCodeEnabled(),'integer').', '.
1271  'reg_ac = '.$ilDB->quote($this->getRegistrationAccessCode(),'text').', '.
1272  'auto_notification = '.$ilDB->quote( (int)$this->getAutoNotification(), 'integer').', '.
1273  'status_dt = '.$ilDB->quote((int) $this->getStatusDetermination()).', '.
1274  'mail_members_type = '.$ilDB->quote((int) $this->getMailToMembersType(),'integer').', '.
1275  'crs_start = '.$ilDB->quote(($this->getCourseStart() && !$this->getCourseStart()->isNull()) ? $this->getCourseStart()->get(IL_CAL_UNIX) : null, 'integer').', '.
1276  'crs_end = '.$ilDB->quote(($this->getCourseEnd() && !$this->getCourseEnd()->isNull()) ? $this->getCourseEnd()->get(IL_CAL_UNIX) : null, 'integer').', '.
1277  'auto_wait = '.$ilDB->quote((int) $this->hasWaitingListAutoFill(),'integer').', '.
1278  'leave_end = '.$ilDB->quote(($this->getCancellationEnd() && !$this->getCancellationEnd()->isNull()) ? $this->getCancellationEnd()->get(IL_CAL_UNIX) : null, 'integer').', '.
1279  'min_members = '.$ilDB->quote((int) $this->getSubscriptionMinMembers(),'integer').' '.
1280  "WHERE obj_id = ".$ilDB->quote($this->getId() ,'integer')."";
1281 
1282  $res = $ilDB->manipulate($query);
1283 
1284  // moved activation to ilObjectActivation
1285  if($this->ref_id)
1286  {
1287  include_once "./Services/Object/classes/class.ilObjectActivation.php";
1288  ilObjectActivation::getItem($this->ref_id);
1289 
1290  $item = new ilObjectActivation;
1291  if($this->getActivationUnlimitedStatus())
1292  {
1294  }
1295  else
1296  {
1297  $item->setTimingType(ilObjectActivation::TIMINGS_ACTIVATION);
1298  $item->setTimingStart($this->getActivationStart());
1299  $item->setTimingEnd($this->getActivationEnd());
1300  $item->toggleVisible($this->getActivationVisibility());
1301  }
1302 
1303  $item->update($this->ref_id);
1304  }
1305  }
1306 
1314  public function cloneSettings($new_obj)
1315  {
1316  $new_obj->setSyllabus($this->getSyllabus());
1317  $new_obj->setContactName($this->getContactName());
1318  $new_obj->setContactResponsibility($this->getContactResponsibility());
1319  $new_obj->setContactPhone($this->getContactPhone());
1320  $new_obj->setContactEmail($this->getContactEmail());
1321  $new_obj->setContactConsultation($this->getContactConsultation());
1322  $new_obj->setOfflineStatus($this->getOfflineStatus()); // #9914
1323  $new_obj->setActivationType($this->getActivationType());
1324  $new_obj->setActivationStart($this->getActivationStart());
1325  $new_obj->setActivationEnd($this->getActivationEnd());
1326  $new_obj->setActivationVisibility($this->getActivationVisibility());
1327  $new_obj->setSubscriptionLimitationType($this->getSubscriptionLimitationType());
1328  $new_obj->setSubscriptionStart($this->getSubscriptionStart());
1329  $new_obj->setSubscriptionEnd($this->getSubscriptionEnd());
1330  $new_obj->setSubscriptionType($this->getSubscriptionType());
1331  $new_obj->setSubscriptionPassword($this->getSubscriptionPassword());
1332  $new_obj->enableSubscriptionMembershipLimitation($this->isSubscriptionMembershipLimited());
1333  $new_obj->setSubscriptionMaxMembers($this->getSubscriptionMaxMembers());
1334  $new_obj->setSubscriptionNotify($this->getSubscriptionNotify());
1335  $new_obj->setViewMode($this->getViewMode());
1336  $new_obj->setOrderType($this->getOrderType());
1337  $new_obj->setAboStatus($this->getAboStatus());
1338  $new_obj->enableWaitingList($this->enabledWaitingList());
1339  $new_obj->setImportantInformation($this->getImportantInformation());
1340  $new_obj->setShowMembers($this->getShowMembers());
1341  $new_obj->enableSessionLimit($this->isSessionLimitEnabled());
1342  $new_obj->setNumberOfPreviousSessions($this->getNumberOfPreviousSessions());
1343  $new_obj->setNumberOfNextSessions($this->getNumberOfNextSessions());
1344  $new_obj->setAutoNotification( $this->getAutoNotification() );
1345  $new_obj->enableRegistrationAccessCode($this->isRegistrationAccessCodeEnabled());
1346  include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
1347  $new_obj->setRegistrationAccessCode(ilMembershipRegistrationCodeUtils::generateCode());
1348  $new_obj->setStatusDetermination($this->getStatusDetermination());
1349  $new_obj->setMailToMembersType($this->getMailToMembersType());
1350  $new_obj->setCourseStart($this->getCourseStart());
1351  $new_obj->setCourseEnd($this->getCourseEnd());
1352  $new_obj->setCancellationEnd($this->getCancellationEnd());
1353  $new_obj->setWaitingListAutoFill($this->hasWaitingListAutoFill());
1354  $new_obj->setSubscriptionMinMembers($this->getSubscriptionMinMembers());
1355 
1356  // #10271
1357  $new_obj->setEnableCourseMap($this->getEnableCourseMap());
1358  $new_obj->setLatitude($this->getLatitude());
1359  $new_obj->setLongitude($this->getLongitude());
1360  $new_obj->setLocationZoom($this->getLocationZoom());
1361 
1362  $new_obj->update();
1363  }
1364 
1366  {
1367  global $ilDB;
1368 
1369  include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
1371 
1372  $query = "INSERT INTO crs_settings (obj_id,syllabus,contact_name,contact_responsibility,".
1373  "contact_phone,contact_email,contact_consultation,activation_type,activation_start,".
1374  "activation_end,sub_limitation_type,sub_start,sub_end,sub_type,sub_password,sub_mem_limit,".
1375  "sub_max_members,sub_notify,view_mode,abo," .
1376  "latitude,longitude,location_zoom,enable_course_map,waiting_list,show_members, ".
1377  "session_limit,session_prev,session_next, reg_ac_enabled, reg_ac, auto_notification, status_dt,mail_members_type) ".
1378  "VALUES( ".
1379  $ilDB->quote($this->getId() ,'integer').", ".
1380  $ilDB->quote($this->getSyllabus() ,'text').", ".
1381  $ilDB->quote($this->getContactName() ,'text').", ".
1382  $ilDB->quote($this->getContactResponsibility() ,'text').", ".
1383  $ilDB->quote($this->getContactPhone() ,'text').", ".
1384  $ilDB->quote($this->getContactEmail() ,'text').", ".
1385  $ilDB->quote($this->getContactConsultation() ,'text').", ".
1386  $ilDB->quote(0 ,'integer').", ".
1387  $ilDB->quote($this->getActivationStart() ,'integer').", ".
1388  $ilDB->quote($this->getActivationEnd() ,'integer').", ".
1389  $ilDB->quote(IL_CRS_SUBSCRIPTION_DEACTIVATED ,'integer').", ".
1390  $ilDB->quote($this->getSubscriptionStart() ,'integer').", ".
1391  $ilDB->quote($this->getSubscriptionEnd() ,'integer').", ".
1392  $ilDB->quote(IL_CRS_SUBSCRIPTION_DIRECT ,'integer').", ".
1393  $ilDB->quote($this->getSubscriptionPassword() ,'text').", ".
1394  "0, ".
1395  $ilDB->quote($this->getSubscriptionMaxMembers() ,'integer').", ".
1396  "1, ".
1397  "0, ".
1398  $ilDB->quote($this->ABO_ENABLED ,'integer').", ".
1399  $ilDB->quote($this->getLatitude() ,'text').", ".
1400  $ilDB->quote($this->getLongitude() ,'text').", ".
1401  $ilDB->quote($this->getLocationZoom() ,'integer').", ".
1402  $ilDB->quote($this->getEnableCourseMap() ,'integer').", ".
1403  #"objective_view = '0', ".
1404  "1, ".
1405  "1,".
1406  $ilDB->quote($this->isSessionLimitEnabled(),'integer').', '.
1407  $ilDB->quote($this->getNumberOfPreviousSessions(),'integer').', '.
1408  $ilDB->quote($this->getNumberOfPreviousSessions(),'integer').', '.
1409  $ilDB->quote($this->isRegistrationAccessCodeEnabled(),'integer').', '.
1410  $ilDB->quote($this->getRegistrationAccessCode(),'text').', '.
1411  $ilDB->quote((int)$this->getAutoNotification(),'integer').', '.
1412  $ilDB->quote((int)$this->getStatusDetermination(),'integer').', '.
1413  $ilDB->quote((int) $this->getMailToMembersType(),'integer').' '.
1414  ")";
1415 
1416  $res = $ilDB->manipulate($query);
1417  $this->__readSettings();
1418 
1419  include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
1420  $sorting = new ilContainerSortingSettings($this->getId());
1421  $sorting->setSortMode(ilContainer::SORT_MANUAL);
1422  $sorting->update();
1423  }
1424 
1425 
1426  function __readSettings()
1427  {
1428  global $ilDB;
1429 
1430  $query = "SELECT * FROM crs_settings WHERE obj_id = ".$ilDB->quote($this->getId() ,'integer')."";
1431 
1432  $res = $ilDB->query($query);
1433  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
1434  {
1435  $this->setSyllabus($row->syllabus);
1436  $this->setContactName($row->contact_name);
1437  $this->setContactResponsibility($row->contact_responsibility);
1438  $this->setContactPhone($row->contact_phone);
1439  $this->setContactEmail($row->contact_email);
1440  $this->setContactConsultation($row->contact_consultation);
1441  $this->setOfflineStatus(!(bool)$row->activation_type); // see below
1442  $this->setSubscriptionLimitationType($row->sub_limitation_type);
1443  $this->setSubscriptionStart($row->sub_start);
1444  $this->setSubscriptionEnd($row->sub_end);
1445  $this->setSubscriptionType($row->sub_type);
1446  $this->setSubscriptionPassword($row->sub_password);
1447  $this->enableSubscriptionMembershipLimitation($row->sub_mem_limit);
1448  $this->setSubscriptionMaxMembers($row->sub_max_members);
1449  $this->setSubscriptionNotify($row->sub_notify);
1450  $this->setViewMode($row->view_mode);
1451  $this->setAboStatus($row->abo);
1452  $this->enableWaitingList($row->waiting_list);
1453  $this->setImportantInformation($row->important);
1454  $this->setShowMembers($row->show_members);
1455  $this->setLatitude($row->latitude);
1456  $this->setLongitude($row->longitude);
1457  $this->setLocationZoom($row->location_zoom);
1458  $this->setEnableCourseMap($row->enable_course_map);
1459  $this->enableSessionLimit($row->session_limit);
1460  $this->setNumberOfPreviousSessions($row->session_prev);
1461  $this->setNumberOfNextSessions($row->session_next);
1462  $this->enableRegistrationAccessCode($row->reg_ac_enabled);
1463  $this->setRegistrationAccessCode($row->reg_ac);
1464  $this->setAutoNotification($row->auto_notification == 1 ? true : false);
1465  $this->setStatusDetermination((int) $row->status_dt);
1466  $this->setMailToMembersType($row->mail_members_type);
1467  $this->setCourseStart($row->crs_start ? new ilDate($row->crs_start, IL_CAL_UNIX) : null);
1468  $this->setCourseEnd($row->crs_end ? new ilDate($row->crs_end, IL_CAL_UNIX) : null);
1469  $this->setCancellationEnd($row->leave_end ? new ilDate($row->leave_end, IL_CAL_UNIX) : null);
1470  $this->setWaitingListAutoFill($row->auto_wait);
1471  $this->setSubscriptionMinMembers($row->min_members ? $row->min_members : null);
1472  }
1473 
1474  // moved activation to ilObjectActivation
1475  if($this->ref_id)
1476  {
1477  include_once "./Services/Object/classes/class.ilObjectActivation.php";
1478  $activation = ilObjectActivation::getItem($this->ref_id);
1479  switch($activation["timing_type"])
1480  {
1483  $this->setActivationStart($activation["timing_start"]);
1484  $this->setActivationEnd($activation["timing_end"]);
1485  $this->setActivationVisibility($activation["visible"]);
1486  break;
1487 
1488  default:
1490  break;
1491  }
1492  }
1493  else
1494  {
1495  // #13176 - there should always be default
1497  }
1498 
1499  return true;
1500  }
1501 
1502  function initWaitingList()
1503  {
1504  include_once "./Modules/Course/classes/class.ilCourseWaitingList.php";
1505 
1506  if(!is_object($this->waiting_list_obj))
1507  {
1508  $this->waiting_list_obj = new ilCourseWaitingList($this->getId());
1509  }
1510  return true;
1511  }
1512 
1513 
1519  protected function initCourseMemberObject()
1520  {
1521  global $ilUser;
1522 
1523  include_once "./Modules/Course/classes/class.ilCourseParticipant.php";
1524  $this->member_obj = ilCourseParticipant::_getInstanceByObjId($this->getId(),$ilUser->getId());
1525  return true;
1526  }
1527 
1533  protected function initCourseMembersObject()
1534  {
1535  global $ilUser;
1536 
1537  include_once "./Modules/Course/classes/class.ilCourseParticipants.php";
1538  $this->members_obj = ilCourseParticipants::_getInstanceByObjId($this->getId());
1539  return true;
1540  }
1541 
1546  public function getMemberObject()
1547  {
1548  if(!$this->member_obj instanceof ilCourseParticipant)
1549  {
1550  $this->initCourseMemberObject();
1551  }
1552  return $this->member_obj;
1553  }
1554 
1558  public function getMembersObject()
1559  {
1560  if(!$this->members_obj instanceof ilCourseParticipants)
1561  {
1562  $this->initCourseMembersObject();
1563  }
1564  return $this->members_obj;
1565  }
1566 
1567 
1568 
1569  // RBAC METHODS
1570  function initDefaultRoles()
1571  {
1572  global $rbacadmin,$rbacreview,$ilDB;
1573 
1574  include_once './Services/AccessControl/classes/class.ilObjRole.php';
1576  'il_crs_admin_'.$this->getRefId(),
1577  "Admin of crs obj_no.".$this->getId(),
1578  'il_crs_admin',
1579  $this->getRefId()
1580  );
1582  'il_crs_tutor_'.$this->getRefId(),
1583  "Tutor of crs obj_no.".$this->getId(),
1584  'il_crs_tutor',
1585  $this->getRefId()
1586  );
1588  'il_crs_member_'.$this->getRefId(),
1589  "Member of crs obj_no.".$this->getId(),
1590  'il_crs_member',
1591  $this->getRefId()
1592  );
1593 
1594  return array();
1595  }
1596 
1606  public function setParentRolePermissions($a_parent_ref)
1607  {
1608  global $rbacadmin, $rbacreview;
1609 
1610  $parent_roles = $rbacreview->getParentRoleIds($a_parent_ref);
1611  foreach((array) $parent_roles as $parent_role)
1612  {
1613  $rbacadmin->initIntersectionPermissions(
1614  $this->getRefId(),
1615  $parent_role['obj_id'],
1616  $parent_role['parent'],
1617  $this->__getCrsNonMemberTemplateId(),
1618  ROLE_FOLDER_ID
1619  );
1620  }
1621  }
1622 
1630  {
1631  global $ilDB;
1632 
1633  $q = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_crs_non_member'";
1634  $res = $this->ilias->db->query($q);
1636 
1637  return $row["obj_id"];
1638  }
1639 
1644  public static function lookupCourseNonMemberTemplatesId()
1645  {
1646  global $ilDB;
1647 
1648  $query = 'SELECT obj_id FROM object_data WHERE type = '.$ilDB->quote('rolt','text').' AND title = '.$ilDB->quote('il_crs_non_member','text');
1649  $res = $ilDB->query($query);
1651 
1652  return isset($row['obj_id']) ? $row['obj_id'] : 0;
1653  }
1654 
1661  public function getLocalCourseRoles($a_translate = false)
1662  {
1663  global $rbacadmin,$rbacreview;
1664 
1665  if (empty($this->local_roles))
1666  {
1667  $this->local_roles = array();
1668  $role_arr = $rbacreview->getRolesOfRoleFolder($this->getRefId());
1669 
1670  foreach ($role_arr as $role_id)
1671  {
1672  if ($rbacreview->isAssignable($role_id,$this->getRefId()) == true)
1673  {
1674  $role_Obj = $this->ilias->obj_factory->getInstanceByObjId($role_id);
1675 
1676  if ($a_translate)
1677  {
1678  $role_name = ilObjRole::_getTranslation($role_Obj->getTitle());
1679  }
1680  else
1681  {
1682  $role_name = $role_Obj->getTitle();
1683  }
1684  $this->local_roles[$role_name] = $role_Obj->getId();
1685  }
1686  }
1687  }
1688 
1689  return $this->local_roles;
1690  }
1691 
1692 
1693 
1703  public function getDefaultCourseRoles($a_crs_id = "")
1704  {
1705  global $rbacadmin, $rbacreview;
1706 
1707  if (strlen($a_crs_id) > 0)
1708  {
1709  $crs_id = $a_crs_id;
1710  }
1711  else
1712  {
1713  $crs_id = $this->getRefId();
1714  }
1715 
1716  $role_arr = $rbacreview->getRolesOfRoleFolder($crs_id);
1717 
1718  foreach ($role_arr as $role_id)
1719  {
1720  $role_Obj =& $this->ilias->obj_factory->getInstanceByObjId($role_id);
1721 
1722  $crs_Member ="il_crs_member_".$crs_id;
1723  $crs_Admin ="il_crs_admin_".$crs_id;
1724  $crs_Tutor ="il_crs_tutor_".$crs_id;
1725 
1726  if (strcmp($role_Obj->getTitle(), $crs_Member) == 0 )
1727  {
1728  $arr_crsDefaultRoles["crs_member_role"] = $role_Obj->getId();
1729  }
1730 
1731  if (strcmp($role_Obj->getTitle(), $crs_Admin) == 0)
1732  {
1733  $arr_crsDefaultRoles["crs_admin_role"] = $role_Obj->getId();
1734  }
1735 
1736  if (strcmp($role_Obj->getTitle(), $crs_Tutor) == 0)
1737  {
1738  $arr_crsDefaultRoles["crs_tutor_role"] = $role_Obj->getId();
1739  }
1740  }
1741 
1742  return $arr_crsDefaultRoles;
1743  }
1744 
1745  function __getLocalRoles()
1746  {
1747  global $rbacreview;
1748 
1749  // GET role_objects of predefined roles
1750 
1751  return $rbacreview->getRolesOfRoleFolder($this->getRefId(),false);
1752  }
1753 
1754  function __deleteSettings()
1755  {
1756  global $ilDB;
1757 
1758  $query = "DELETE FROM crs_settings ".
1759  "WHERE obj_id = ".$ilDB->quote($this->getId() ,'integer')." ";
1760  $res = $ilDB->manipulate($query);
1761 
1762  return true;
1763  }
1764 
1765 
1766  public function getDefaultMemberRole()
1767  {
1768  $local_roles = $this->__getLocalRoles();
1769 
1770  foreach($local_roles as $role_id)
1771  {
1772  $title = ilObject::_lookupTitle($role_id);
1773  if(substr($title,0,8) == 'il_crs_m')
1774  {
1775  return $role_id;
1776  }
1777  }
1778  return 0;
1779  }
1780  public function getDefaultTutorRole()
1781  {
1782  $local_roles = $this->__getLocalRoles();
1783 
1784  foreach($local_roles as $role_id)
1785  {
1786  if($tmp_role =& ilObjectFactory::getInstanceByObjId($role_id,false))
1787  {
1788  if(!strcmp($tmp_role->getTitle(),"il_crs_tutor_".$this->getRefId()))
1789  {
1790  return $role_id;
1791  }
1792  }
1793  }
1794  return false;
1795  }
1796  public function getDefaultAdminRole()
1797  {
1798  $local_roles = $this->__getLocalRoles();
1799 
1800  foreach($local_roles as $role_id)
1801  {
1802  if($tmp_role =& ilObjectFactory::getInstanceByObjId($role_id,false))
1803  {
1804  if(!strcmp($tmp_role->getTitle(),"il_crs_admin_".$this->getRefId()))
1805  {
1806  return $role_id;
1807  }
1808  }
1809  }
1810  return false;
1811  }
1812 
1813  public static function _deleteUser($a_usr_id)
1814  {
1815  // Delete all user related data
1816  // delete lm_history
1817  include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
1818  ilCourseLMHistory::_deleteUser($a_usr_id);
1819 
1820  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
1822 
1823  // Course objectives
1824  include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
1826  }
1827 
1834  public function MDUpdateListener($a_element)
1835  {
1836  global $ilLog;
1837 
1838  parent::MDUpdateListener($a_element);
1839 
1840  switch($a_element)
1841  {
1842  case 'General':
1843  // Update ecs content
1844  include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
1845  $ecs = new ilECSCourseSettings($this);
1846  $ecs->handleContentUpdate();
1847  break;
1848 
1849  default:
1850  return true;
1851  }
1852  }
1853 
1858  function addAdditionalSubItemInformation(&$a_item_data)
1859  {
1860  include_once './Services/Object/classes/class.ilObjectActivation.php';
1862  }
1863 
1871  protected function prepareAppointments($a_mode = 'create')
1872  {
1873  include_once('./Services/Calendar/classes/class.ilCalendarAppointmentTemplate.php');
1874  include_once('./Services/Calendar/classes/class.ilDateTime.php');
1875 
1876  switch($a_mode)
1877  {
1878  case 'create':
1879  case 'update':
1880  if(!$this->getActivationUnlimitedStatus() and !$this->getOfflineStatus())
1881  {
1882  $app = new ilCalendarAppointmentTemplate(self::CAL_ACTIVATION_START);
1883  $app->setTitle($this->getTitle());
1884  $app->setSubtitle('crs_cal_activation_start');
1885  $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1886  $app->setDescription($this->getLongDescription());
1887  $app->setStart(new ilDateTime($this->getActivationStart(),IL_CAL_UNIX));
1888  $apps[] = $app;
1889 
1890  $app = new ilCalendarAppointmentTemplate(self::CAL_ACTIVATION_END);
1891  $app->setTitle($this->getTitle());
1892  $app->setSubtitle('crs_cal_activation_end');
1893  $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1894  $app->setDescription($this->getLongDescription());
1895  $app->setStart(new ilDateTime($this->getActivationEnd(),IL_CAL_UNIX));
1896  $apps[] = $app;
1897  }
1899  {
1900  $app = new ilCalendarAppointmentTemplate(self::CAL_REG_START);
1901  $app->setTitle($this->getTitle());
1902  $app->setSubtitle('crs_cal_reg_start');
1903  $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1904  $app->setDescription($this->getLongDescription());
1905  $app->setStart(new ilDateTime($this->getSubscriptionStart(),IL_CAL_UNIX));
1906  $apps[] = $app;
1907 
1908  $app = new ilCalendarAppointmentTemplate(self::CAL_REG_END);
1909  $app->setTitle($this->getTitle());
1910  $app->setSubtitle('crs_cal_reg_end');
1911  $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1912  $app->setDescription($this->getLongDescription());
1913  $app->setStart(new ilDateTime($this->getSubscriptionEnd(),IL_CAL_UNIX));
1914  $apps[] = $app;
1915  }
1916  if($this->getCourseStart() && $this->getCourseEnd())
1917  {
1918  $app = new ilCalendarAppointmentTemplate(self::CAL_COURSE_START);
1919  $app->setTitle($this->getTitle());
1920  $app->setSubtitle('crs_start');
1921  $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1922  $app->setDescription($this->getLongDescription());
1923  $app->setStart($this->getCourseStart());
1924  $app->setFullday(true);
1925  $apps[] = $app;
1926 
1927  $app = new ilCalendarAppointmentTemplate(self::CAL_COURSE_END);
1928  $app->setTitle($this->getTitle());
1929  $app->setSubtitle('crs_end');
1930  $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1931  $app->setDescription($this->getLongDescription());
1932  $app->setStart($this->getCourseEnd());
1933  $app->setFullday(true);
1934  $apps[] = $app;
1935  }
1936 
1937 
1938  return $apps ? $apps : array();
1939 
1940  case 'delete':
1941  // Nothing to do: The category and all assigned appointments will be deleted.
1942  return array();
1943  }
1944  }
1945 
1946  ###### Interface ilMembershipRegistrationCodes
1947 
1951  public static function lookupObjectsByCode($a_code)
1952  {
1953  global $ilDB;
1954 
1955  $query = "SELECT obj_id FROM crs_settings ".
1956  "WHERE reg_ac_enabled = ".$ilDB->quote(1,'integer')." ".
1957  "AND reg_ac = ".$ilDB->quote($a_code,'text');
1958  $res = $ilDB->query($query);
1959 
1960  $obj_ids = array();
1961  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
1962  {
1963  $obj_ids[] = $row->obj_id;
1964  }
1965  return $obj_ids;
1966  }
1967 
1974  public function register($a_user_id,$a_role = ilCourseConstants::CRS_MEMBER, $a_force_registration = false)
1975  {
1976  global $ilCtrl, $tree;
1977  include_once './Services/Membership/exceptions/class.ilMembershipRegistrationException.php';
1978  include_once "./Modules/Course/classes/class.ilCourseParticipants.php";
1980 
1981  if($part->isAssigned($a_user_id))
1982  {
1983  return true;
1984  }
1985 
1986  if(!$a_force_registration)
1987  {
1988  // Availability
1990  {
1991  include_once './Modules/Group/classes/class.ilObjGroupAccess.php';
1992 
1994  {
1995  throw new ilMembershipRegistrationException('Cant registrate to course '.$this->getId().
1996  ', course subscription is deactivated.', ilMembershipRegistrationException::REGISTRATION_CODE_DISABLED);
1997  }
1998  }
1999 
2000  // Time Limitation
2002  {
2003  if( !$this->inSubscriptionTime() )
2004  {
2005  throw new ilMembershipRegistrationException('Cant registrate to course '.$this->getId().
2006  ', course is out of registration time.', ilMembershipRegistrationException::OUT_OF_REGISTRATION_PERIOD);
2007  }
2008  }
2009 
2010  // Max members
2011  if($this->isSubscriptionMembershipLimited())
2012  {
2013  $free = max(0,$this->getSubscriptionMaxMembers() - $part->getCountMembers());
2014  include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
2015  $waiting_list = new ilCourseWaitingList($this->getId());
2016  if($this->enabledWaitingList() and (!$free or $waiting_list->getCountUsers()))
2017  {
2018  $waiting_list->addToList($a_user_id);
2019  $this->lng->loadLanguageModule("crs");
2020  $info = sprintf($this->lng->txt('crs_added_to_list'),
2021  $waiting_list->getPosition($a_user_id));
2022  include_once('./Modules/Course/classes/class.ilCourseParticipants.php');
2023  $participants = ilCourseParticipants::_getInstanceByObjId($this->getId());
2024  $participants->sendNotification($participants->NOTIFY_WAITING_LIST,$a_user_id);
2025 
2027  }
2028 
2029  if(!$this->enabledWaitingList() && !$free)
2030  {
2031  throw new ilMembershipRegistrationException('Cant registrate to course '.$this->getId().
2032  ', membership is limited.',ilMembershipRegistrationException::OBJECT_IS_FULL);
2033  }
2034  }
2035  }
2036 
2037  $part->add($a_user_id,$a_role);
2038  $part->sendNotification($part->NOTIFY_ACCEPT_USER, $a_user_id);
2039  $part->sendNotification($part->NOTIFY_ADMINS,$a_user_id);
2040 
2041 
2042  include_once './Modules/Forum/classes/class.ilForumNotification.php';
2044 
2045  return true;
2046  }
2047 
2054  public function getAutoNotification()
2055  {
2056  return $this->auto_notification;
2057  }
2058 
2059 
2066  public function setAutoNotification($value)
2067  {
2068  $this->auto_notification = $value;
2069  }
2070 
2076  public function setStatusDetermination($a_value)
2077  {
2078  $a_value = (int)$a_value;
2079 
2080  // #13905
2081  if($a_value == self::STATUS_DETERMINATION_LP)
2082  {
2083  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
2085  {
2086  $a_value = self::STATUS_DETERMINATION_MANUAL;
2087  }
2088  }
2089 
2090  $this->status_dt = $a_value;
2091  }
2092 
2098  public function getStatusDetermination()
2099  {
2100  return $this->status_dt;
2101  }
2102 
2106  public function syncMembersStatusWithLP()
2107  {
2108  include_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
2109  foreach($this->getMembersObject()->getParticipants() as $user_id)
2110  {
2111  // #15529 - force raise on sync
2112  ilLPStatusWrapper::_updateStatus($this->getId(), $user_id, null, false, true);
2113  }
2114  }
2115 
2123  public function checkLPStatusSync($a_member_id)
2124  {
2125  // #11113
2126  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
2129  {
2130  include_once("Services/Tracking/classes/class.ilLPStatus.php");
2131  // #13811 - we need to suppress creation if status entry
2132  $has_completed = (ilLPStatus::_lookupStatus($this->getId(), $a_member_id, false) == ilLPStatus::LP_STATUS_COMPLETED_NUM);
2133  $this->getMembersObject()->updatePassed($a_member_id, $has_completed, false, true);
2134  }
2135  }
2136 
2137  function getOrderType()
2138  {
2139  if($this->enabledObjectiveView())
2140  {
2141  return ilContainer::SORT_MANUAL;
2142  }
2143  return parent::getOrderType();
2144  }
2145 
2149  public function handleAutoFill()
2150  {
2151  if(
2152  !$this->enabledWaitingList() or
2153  !$this->hasWaitingListAutoFill()
2154  )
2155  {
2156  $this->course_logger->debug('Waiting list or auto fill disabled.');
2157  return;
2158  }
2159 
2160  $max = $this->getSubscriptionMaxMembers();
2162 
2163  $this->course_logger->debug('Max members: ' . $max);
2164  $this->course_logger->debug('Current members: ' . $now);
2165 
2166  if($max <= $now)
2167  {
2168  return;
2169  }
2170 
2171  // see assignFromWaitingListObject()
2172  include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
2173  $waiting_list = new ilCourseWaitingList($this->getId());
2174 
2175  foreach($waiting_list->getUserIds() as $user_id)
2176  {
2177  if(!$tmp_obj = ilObjectFactory::getInstanceByObjId($user_id,false))
2178  {
2179  $this->course_logger->warning('Cannot create user instance for id: ' . $user_id);
2180  continue;
2181  }
2182  if($this->getMembersObject()->isAssigned($user_id))
2183  {
2184  $this->course_logger->warning('User is already assigned to course. uid: ' . $user_id. ' course_id: ' . $this->getRefId());
2185  continue;
2186  }
2187  $this->getMembersObject()->add($user_id,IL_CRS_MEMBER);
2188  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_ACCEPT_USER,$user_id,true);
2189  $waiting_list->removeFromList($user_id);
2190  $this->checkLPStatusSync($user_id);
2191 
2192  $this->course_logger->info('Assigned user from waiting list to course: ' . $this->getTitle());
2193  $now++;
2194  if($now >= $max)
2195  {
2196  break;
2197  }
2198  }
2199  }
2200 
2201  public static function mayLeave($a_course_id, $a_user_id = null, &$a_date = null)
2202  {
2203  global $ilUser, $ilDB;
2204 
2205  if(!$a_user_id)
2206  {
2207  $a_user_id = $ilUser->getId();
2208  }
2209 
2210  $set = $ilDB->query("SELECT leave_end".
2211  " FROM crs_settings".
2212  " WHERE obj_id = ".$ilDB->quote($a_course_id, "integer"));
2213  $row = $ilDB->fetchAssoc($set);
2214  if($row && $row["leave_end"])
2215  {
2216  // timestamp to date
2217  $limit = date("Ymd", $row["leave_end"]);
2218  if($limit < date("Ymd"))
2219  {
2220  $a_date = new ilDate(date("Y-m-d", $row["leave_end"]), IL_CAL_DATE);
2221  return false;
2222  }
2223  }
2224  return true;
2225  }
2226 
2232  public static function findCoursesWithNotEnoughMembers()
2233  {
2234  $ilDB = $GLOBALS['DIC']->database();
2235  $tree = $GLOBALS['DIC']->repositoryTree();
2236 
2237  $res = array();
2238 
2239  $now = time();
2240 
2241  include_once "Modules/Course/classes/class.ilCourseParticipants.php";
2242 
2243  $set = $ilDB->query("SELECT obj_id, min_members".
2244  " FROM crs_settings".
2245  " WHERE min_members > ".$ilDB->quote(0, "integer").
2246  " AND sub_mem_limit = ".$ilDB->quote(1, "integer"). // #17206
2247  " AND ((leave_end IS NOT NULL".
2248  " AND leave_end < ".$ilDB->quote($now, "text").")".
2249  " OR (leave_end IS NULL".
2250  " AND sub_end IS NOT NULL".
2251  " AND sub_end < ".$ilDB->quote($now, "text")."))".
2252  " AND (crs_start IS NULL OR crs_start > ".$ilDB->quote($now, "integer").")");
2253  while($row = $ilDB->fetchAssoc($set))
2254  {
2255  $refs = ilObject::_getAllReferences($row['obj_id']);
2256  $ref = end($refs);
2257 
2258  if($tree->isDeleted($ref))
2259  {
2260  continue;
2261  }
2262 
2263  $part = new ilCourseParticipants($row["obj_id"]);
2264  $reci = $part->getNotificationRecipients();
2265  if(sizeof($reci))
2266  {
2267  $missing = (int)$row["min_members"]-$part->getCountMembers();
2268  if($missing > 0)
2269  {
2270  $res[$row["obj_id"]] = array($missing, $reci);
2271  }
2272  }
2273  }
2274 
2275  return $res;
2276  }
2277 
2278 } //END class.ilObjCourse
2279 ?>
const LP_STATUS_COMPLETED_NUM
setActivationEnd($a_value)
static getUserIdByLogin($a_login)
setArchiveType($a_value)
global $ilErr
Definition: raiseError.php:16
$error
Definition: Error.php:17
setSubscriptionNotify($a_value)
const IL_CRS_ACTIVATION_LIMITED
getEnableMap()
Type independent wrapper.
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)
static _deleteUser($a_usr_id)
Delete user type $ilDB.
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.
static _registrationEnabled($a_obj_id)
Registration enabled? Method is in Access class, since it is needed by Access/ListGUI.
setImportantInformation($a_info)
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.
static getItem($a_ref_id)
Get item data.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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.
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone course (no member data)
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.
static _lookupViewMode($a_id)
lookup view mode of container
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
handleAutoFill()
Handle course auto fill.
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)
setLatitude($a_latitude)
Set Latitude.
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)
static _deleteAll($a_course_id)
$a_type
Definition: workflow.php:93
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
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.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
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.
Date and time handling
$ilUser
Definition: imgupload.php:18
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.
cloneSettings($new_obj)
Clone entries in settings table.
const STATUS_DETERMINATION_MANUAL
static _getInstanceByObjId($a_obj_id, $a_usr_id)
Get singleton instance.
getRegistrationAccessCode()
get access code
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
enableRegistrationAccessCode($a_status)
En/disable registration access code.
static _getTranslation($a_role_title)
Create styles array
The data for the language used.
getSubItems($a_admin_panel_enabled=false, $a_include_side_block=false, $a_get_single=0)
Get subitems of container.
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)
static _isActivated($a_obj_id)
Is activated.
const IL_CAL_DATE
static generateCode()
Generate new registration key.
setContactPhone($a_value)
static _lookupAboStatus($a_id)
setCancellationEnd(ilDate $a_value=null)
setOrderType($a_value)
static findCoursesWithNotEnoughMembers()
Minimum members check type $ilDB.
static _deleteByCourse($a_course_id)
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)
static _deleteAll($course_id)
getRefId()
get reference id public
enableWaitingList($a_status)
static _deleteUser($a_usr_id)
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
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static _getInstance($a_obj_id)
get instance by obj_id
__construct($a_id=0, $a_call_by_reference=true)
Constructor public.
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?
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.
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.
setArchiveStart($a_value)
setSubscriptionLimitationType($a_type)