本文整理汇总了PHP中Reminder::setDB方法的典型用法代码示例。如果您正苦于以下问题:PHP Reminder::setDB方法的具体用法?PHP Reminder::setDB怎么用?PHP Reminder::setDB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reminder
的用法示例。
在下文中一共展示了Reminder::setDB方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Modifies a current reservation, setting new start and end times or deleting it
* @param array $all_invited_users array of all invited users to be used for DB insertion
* @param array $users_to_invite array of newly invited users to be used for invitation emails
* @param array $users_to_remove array of users that will be removed from invitation/participating in this reservation
* @param array $unchanged_users array of users who have no status change at all
* @param array $resources_to_add array of additional resources to add to this reservation
* @param array $resources_to_remove array of additional resources to remove from this reservation
* @param bool $del whether to delete it or not
* @param boolean $mod_recur whether to modify all recurring reservations in this group
*/
function mod_res($users_to_invite, $users_to_remove, $unchanged_users, $resources_to_add, $resources_to_remove, $del, $mod_recur)
{
$recurs = array();
$valid_resids = array();
$this->type = RES_TYPE_MODIFY;
$orig_start_date = $this->start_date;
// Store the original dates because they will be changed if we repeat
$orig_end_date = $this->end_date;
$accept_code = $this->db->get_new_id();
if ($del) {
// First, check if this should be deleted
$this->del_res($mod_recur, mktime(0, 0, 0));
return;
}
if (!$this->is_blackout) {
$this->check_perms();
// Check permissions
$this->check_min_max();
// Check min/max reservation times
}
if ($this->check_startdate()) {
$this->check_times();
// Check valid times
}
$this->is_repeat = $mod_recur;
// If the mod_recur flag is set, it must be a recurring reservation
$dates = array();
// First, modify the current reservation
if ($this->has_errors()) {
// Print any errors generated above and kill app
$this->print_all_errors(true);
}
$reminder = new Reminder();
$reminder->setDB(new ReminderDB());
$tmp_valid = false;
$this->is_pending = $this->resource->get_property('approval');
if ($this->is_repeat) {
// Check and place all recurring reservations
$recurs = $this->db->get_recur_ids($this->parentid, mktime(0, 0, 0));
for ($i = 0; $i < count($recurs); $i++) {
$this->id = $recurs[$i]['resid'];
// Load reservation data
$this->start_date = $recurs[$i]['start_date'];
if ($this->is_repeat) {
// End date will always be the same as the start date for recurring reservations
$this->end_date = $this->start_date;
}
$is_valid = $this->check_res($resources_to_add);
// Check overlap (dont kill)
if ($is_valid) {
$tmp_valid = true;
// Only one recurring needs to pass
$this->db->mod_res($this, $users_to_invite, $users_to_remove, $resources_to_add, $resources_to_remove, $accept_code);
// And place the reservation
if (!empty($this->reminderid)) {
$reminder->update($this, $this->reminder_minutes_prior);
} else {
if ($this->reminder_minutes_prior != 0 && empty($this->reminderid)) {
$reminder->save($this, $this->reminder_minutes_prior);
}
}
$dates[] = $this->start_date;
$valid_resids[] = $this->id;
CmnFns::write_log($this->word . ' ' . $this->id . ' modified. machid:' . $this->get_machid() . ', dates:' . $this->start_date . ' - ' . $this->end_date . ', start:' . $this->start . ', end:' . $this->end, $this->memberid, $_SERVER['REMOTE_ADDR']);
}
}
} else {
if ($this->check_res($resources_to_add)) {
// Check overlap
$this->db->mod_res($this, $users_to_invite, $users_to_remove, $resources_to_add, $resources_to_remove, $accept_code);
// And place the reservation
if (!empty($this->reminderid)) {
$reminder->update($this, $this->reminder_minutes_prior);
} else {
if ($this->reminder_minutes_prior != 0 && empty($this->reminderid)) {
$reminder->save($this, $this->reminder_minutes_prior);
}
}
$dates[] = $this->start_date;
$valid_resids[] = $this->id;
}
}
// Restore original reservation dates
$this->start_date = $orig_start_date;
$this->end_date = $orig_end_date;
if ($this->has_errors()) {
// Print any errors generated when adding the reservations
$this->print_all_errors(!$this->is_repeat);
}
//.........这里部分代码省略.........
示例2: dirname
* Sends all pending email reminders
* This file is meant to be run from the command line and has no HTML output
* @author Nick Korbel <lqqkout13@users.sourceforge.net>
* @version 06-14-06
* @package phpScheduleIt Command Line
*
* Copyright (C) 2003 - 2007 phpScheduleIt
* License: GPL, see LICENSE
*/
$basedir = dirname(__FILE__) . '/..';
require_once $basedir . '/lib/Reminder.class.php';
require_once $basedir . '/lib/db/ReminderDB.class.php';
require_once $basedir . '/lib/ReminderEmail.class.php';
$max_date = date(REMINDER_DATE_FORMAT);
$reminder = new Reminder();
$reminder->setDB(new ReminderDB());
$reminders = $reminder->getReminders($max_date);
$reminderids_sent = array();
for ($i = 0; $i < count($reminders); $i++) {
$cur = $reminders[$i];
if (is_lang_valid($cur->lang)) {
include get_language_path($cur->lang);
// Make sure email is in correct language
$mail = new ReminderEmail(new PHPMailer());
$mail->buildFromReminder($cur);
$mail->send();
$reminderids_sent[] = $cur->id;
}
}
$reminder->deleteReminders($reminderids_sent);
// Delete reminder records that were sent