本文整理汇总了PHP中Reminder::setRemindersEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Reminder::setRemindersEnabled方法的具体用法?PHP Reminder::setRemindersEnabled怎么用?PHP Reminder::setRemindersEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reminder
的用法示例。
在下文中一共展示了Reminder::setRemindersEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Reminder
function update_prefs()
{
prepare_company_website_controller($this, 'account');
$user = logged_user();
if (!$user instanceof User) {
flash_error(lang('user dnx'));
$this->redirectTo('dashboard');
}
// if
$company = $user->getCompany();
if (!$company instanceof Company) {
flash_error(lang('company dnx'));
$this->redirectToReferer(get_url('administration'));
}
// if
if (!$user->canUpdateProfile(logged_user())) {
flash_error(lang('no access permissions'));
$this->redirectTo('dashboard');
}
// if
$redirect_to = array_var($_GET, 'redirect_to');
if (trim($redirect_to) == '' || !is_valid_url($redirect_to)) {
$redirect_to = $user->getCardUrl();
}
// if
$this->setTemplate('edit_preferences');
$reminder_prefs = Reminders::findById(logged_user()->getId());
if (!$reminder_prefs instanceof Reminder) {
$reminder_prefs = new Reminder();
}
$prefs_form = array_var($_POST, 'prefs_form');
$reminder_prefs->setUserId(logged_user()->getId());
$reminder_prefs->setRemindersEnabled($prefs_form['reminders_enabled']);
$reminder_prefs->setSummarizedBy($prefs_form['summarized_by']);
$reminder_prefs->setRemindersFuture($prefs_form['future']);
$reminder_prefs->setIncludeEveryone($prefs_form['ivsteam']);
$weekArray = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
$days = '';
for ($i = 0; $i < 7; $i++) {
if (isset($prefs_form[$weekArray[$i]])) {
$days .= "" . $weekArray[$i] . ",";
}
}
$reminder_prefs->setReminderDaysToSend($days);
$reminder_prefs->setReportsEnabled($prefs_form['reports_enabled']);
$reminder_prefs->setReportsSummarizedBy($prefs_form['reports_summarized']);
$reminder_prefs->setReportsIncludeEveryone($prefs_form['ivsteam2']);
$reminder_prefs->setReportDay($prefs_form['reportDay']);
$reminder_prefs->setReportsIncludeActivity($prefs_form['report_activity']);
try {
DB::beginWork();
$reminder_prefs->save();
DB::commit();
flash_success(lang('prefs updated'));
} catch (Exception $e) {
DB::rollback();
flash_error('Error: ' . $e);
}
$dayOfWeek = ConfigOptions::getByName('calendar_first_day_of_week');
tpl_assign('dayOfWeek', $dayOfWeek->getValue());
tpl_assign('redirect_to', $redirect_to);
tpl_assign('user', $user);
tpl_assign('company', $company);
tpl_assign('reminder_prefs', $reminder_prefs);
}