ILIAS  release_4-4 Revision
ilMailCronAddressbookSync Class Reference

Address book sync. More...

+ Inheritance diagram for ilMailCronAddressbookSync:
+ Collaboration diagram for ilMailCronAddressbookSync:

Public Member Functions

 getId ()
 
 getTitle ()
 
 getDescription ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 hasAutoActivation ()
 
 hasFlexibleSchedule ()
 
 hasCustomSettings ()
 
 run ()
 
 activationWasToggled ($a_currently_active)
 
- Public Member Functions inherited from ilCronJob
 isActive ($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual=false)
 Is job currently active? More...
 
 getScheduleType ()
 Get current schedule type (if flexible) More...
 
 getScheduleValue ()
 Get current schedule value (if flexible) More...
 
 setSchedule ($a_type, $a_value)
 Update current schedule (if flexible) More...
 
 getValidScheduleTypes ()
 Get all available schedule types. More...
 
 getTitle ()
 Get title. More...
 
 getDescription ()
 Get description. More...
 
 isManuallyExecutable ()
 Defines whether or not a cron job can be started manually. More...
 
 hasCustomSettings ()
 Has cron job any custom setting which can be edited? More...
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 Add custom settings to form. More...
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 Save custom settings. More...
 
 addToExternalSettingsForm ($a_form_id, array &$a_fields, $a_is_active)
 Add external settings to form. More...
 
 activationWasToggled ($a_currently_active)
 Cron job status was changed. More...
 
 getId ()
 Get id. More...
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 run ()
 Run job. More...
 

Additional Inherited Members

- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 
const SCHEDULE_TYPE_IN_HOURS = 3
 
const SCHEDULE_TYPE_IN_DAYS = 4
 
const SCHEDULE_TYPE_WEEKLY = 5
 
const SCHEDULE_TYPE_MONTHLY = 6
 
const SCHEDULE_TYPE_QUARTERLY = 7
 
const SCHEDULE_TYPE_YEARLY = 8
 
- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)
 

Detailed Description

Address book sync.

Author
Nadia Ahmad nahma.nosp@m.d@da.nosp@m.tabay.nosp@m..de

Definition at line 12 of file class.ilMailCronAddressbookSync.php.

Member Function Documentation

◆ activationWasToggled()

ilMailCronAddressbookSync::activationWasToggled (   $a_currently_active)

Definition at line 116 of file class.ilMailCronAddressbookSync.php.

References $ilSetting.

117  {
118  global $ilSetting;
119 
120  // propagate cron-job setting to object setting
121  $ilSetting->set('cron_upd_adrbook', (bool)$a_currently_active);
122  }
global $ilSetting
Definition: privfeed.php:40

◆ getDefaultScheduleType()

ilMailCronAddressbookSync::getDefaultScheduleType ( )

Definition at line 35 of file class.ilMailCronAddressbookSync.php.

36  {
37  return self::SCHEDULE_TYPE_DAILY;
38  }

◆ getDefaultScheduleValue()

ilMailCronAddressbookSync::getDefaultScheduleValue ( )

Definition at line 40 of file class.ilMailCronAddressbookSync.php.

41  {
42  return;
43  }

◆ getDescription()

ilMailCronAddressbookSync::getDescription ( )

Definition at line 27 of file class.ilMailCronAddressbookSync.php.

References $lng.

28  {
29  global $lng;
30 
31  $lng->loadLanguageModule("mail");
32  return $lng->txt("cron_update_addressbook_desc");
33  }
global $lng
Definition: privfeed.php:40

◆ getId()

ilMailCronAddressbookSync::getId ( )

Definition at line 14 of file class.ilMailCronAddressbookSync.php.

15  {
16  return "mail_address_sync";
17  }

◆ getTitle()

ilMailCronAddressbookSync::getTitle ( )

Definition at line 19 of file class.ilMailCronAddressbookSync.php.

References $lng.

20  {
21  global $lng;
22 
23  $lng->loadLanguageModule("mail");
24  return $lng->txt("cron_update_addressbook");
25  }
global $lng
Definition: privfeed.php:40

◆ hasAutoActivation()

ilMailCronAddressbookSync::hasAutoActivation ( )

Definition at line 45 of file class.ilMailCronAddressbookSync.php.

46  {
47  return false;
48  }

◆ hasCustomSettings()

ilMailCronAddressbookSync::hasCustomSettings ( )

Definition at line 55 of file class.ilMailCronAddressbookSync.php.

56  {
57  return false;
58  }

◆ hasFlexibleSchedule()

ilMailCronAddressbookSync::hasFlexibleSchedule ( )

Definition at line 50 of file class.ilMailCronAddressbookSync.php.

51  {
52  return false;
53  }

◆ run()

ilMailCronAddressbookSync::run ( )

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

References $result, $row, and ilCronJobResult\STATUS_OK.

61  {
62  global $ilDB;
63 
64  if($ilDB->getDBType() == 'oracle')
65  {
66  $res1 = $ilDB->queryF('
67  SELECT addressbook.addr_id,
68  usr_data.firstname,
69  usr_data.lastname,
70  (CASE WHEN epref.value = %s THEN usr_data.email ELSE addressbook.email END) email
71  FROM addressbook
72  INNER JOIN usr_data ON usr_data.login = addressbook.login
73  INNER JOIN usr_pref ppref ON ppref.usr_id = usr_data.usr_id AND ppref.keyword = %s AND ppref.value != %s
74  LEFT JOIN usr_pref epref ON epref.usr_id = usr_data.usr_id AND epref.keyword = %s
75  WHERE addressbook.auto_update = %s',
76  array('text', 'text', 'text', 'text', 'integer'),
77  array('y', 'public_profile', 'n', 'public_email', 1)
78  );
79 
80  $stmt = $ilDB->prepare('
81  UPDATE addressbook
82  SET firstname = ?,
83  lastname = ?,
84  email = ?
85  WHERE addr_id = ?',
86  array('text','text','text', 'integer')
87  );
88 
89  while($row = $ilDB->fetchAssoc($res1))
90  {
91  $ilDB->execute($stmt, array($row['firstname'], $row['lastname'], $row['email'], $row['addr_id']));
92  }
93  }
94  else
95  {
96  $ilDB->queryF('
97  UPDATE addressbook
98  INNER JOIN usr_data ON usr_data.login = addressbook.login
99  INNER JOIN usr_pref ppref ON ppref.usr_id = usr_data.usr_id AND ppref.keyword = %s AND ppref.value != %s
100  LEFT JOIN usr_pref epref ON epref.usr_id = usr_data.usr_id AND epref.keyword = %s
101  SET
102  addressbook.firstname = usr_data.firstname,
103  addressbook.lastname = usr_data.lastname,
104  addressbook.email = (CASE WHEN epref.value = %s THEN usr_data.email ELSE addressbook.email END)
105  WHERE addressbook.auto_update = %s',
106  array('text', 'text', 'text', 'text', 'integer'),
107  array('public_profile', 'n', 'public_email', 'y', 1)
108  );
109  }
110 
111  $result = new ilCronJobResult();
112  $result->setStatus(ilCronJobResult::STATUS_OK);
113  return $result;
114  }
$result
Cron job result data container.

The documentation for this class was generated from the following file: