public function newRecurringTask($nrt_details) { //`RTID`, `RT_project`, `RT_assignto`, `RT_createdby`, `RT_createdDate`, `RT_Desc`, `RT_isPrivate`, `RT_startdate`, `RT_enddate`, `RT_type`, `RT_EVERYNDAYS`, `RT_EVERYNTHDAYOFMONTH`, `RT_EVERYXWEEKDAY`, `RT_EVERYDAYOFYEAR_MONTH` global $DE_GLOBALS_WORK_SCHEDULED; $newRTDetails = array(); $newRTDetails['RT_project'] = $nrt_details['nrt_project']; $newRTDetails['RT_Desc'] = $nrt_details['nrt_desc']; $newRTDetails['RT_assignto'] = $nrt_details['nrt_assignTo']; $newRTDetails['RT_createdby'] = $nrt_details['nrt_createdby']; $newRTDetails['RT_startdate'] = $nrt_details['nrt_startDate']; $newRTDetails['RT_enddate'] = $nrt_details['nrt_endDate']; $newRTDetails['RT_type'] = $nrt_details['nrt_type']; $newRTDetails['RT_EVERYNDAYS'] = ''; $newRTDetails['RT_EVERYNTHDAYOFMONTH'] = ''; $newRTDetails['RT_EVERYXWEEKDAY'] = ''; $newRTDetails['RT_EVERYDAYOFYEAR_MONTH'] = ''; $newRTDetails['RT_deadlineDays'] = $nrt_details['nrt_deadlineDays']; switch ($nrt_details['nrt_type']) { case "W": $newRTDetails['RT_EVERYXWEEKDAY'] = $nrt_details['nrt_frq_weekday']; break; case "M": $newRTDetails['RT_EVERYNTHDAYOFMONTH'] = $nrt_details['nrt_frq_dayofmonth']; break; case "N": $newRTDetails['RT_EVERYNDAYS'] = $nrt_details['nrt_frq_ndays']; break; case "Y": $newRTDetails['RT_EVERYNTHDAYOFMONTH'] = $nrt_details['nrt_frq_EVERYDAYOFYEAR_day']; $newRTDetails['RT_EVERYDAYOFYEAR_MONTH'] = $nrt_details['nrt_frq_EVERYDAYOFYEAR_month']; break; } $newRTDetails['RT_isPrivate'] = $nrt_details['nrt_isPublic']; //$newRTDetails['RT_LASTRANON'] = '2008-01-01'; $success = execute_sqlInsert("RECCURING_TASKS", $newRTDetails); $new_RTID = mysql_insert_id(); // Created Recurring Task // Now Create Schedules tasks for all matched instances in this date range $MATCHED_DATES = get_DateInstances_inTimeRange(array('StartDate' => $newRTDetails['RT_startdate'], 'EndDate' => $newRTDetails['RT_enddate'], 'RT_EVERYNTHDAYOFMONTH' => $newRTDetails['RT_EVERYNTHDAYOFMONTH'], 'RT_EVERYDAYOFYEAR_MONTH ' => $newRTDetails['RT_EVERYDAYOFYEAR_MONTH'], 'RT_EVERYNDAYS' => $newRTDetails['RT_EVERYNDAYS'], 'RT_EVERYXWEEKDAY' => $newRTDetails['RT_EVERYXWEEKDAY'], 'nrt_type' => $newRTDetails['RT_type'])); $newTASKDetails = array(); $newTASKDetails['work_userAssigned'] = $newRTDetails['RT_assignto']; $newTASKDetails['work_addedBy'] = $newRTDetails['RT_createdby']; $newTASKDetails['work_briefDesc'] = $newRTDetails['RT_Desc']; $newTASKDetails['work_status'] = $DE_GLOBALS_WORK_SCHEDULED; $newTASKDetails['work_Notes'] = ''; $newTASKDetails['work_priority'] = 'N'; $newTASKDetails['work_isPrivate'] = $newRTDetails['RT_isPrivate']; $newTASKDetails['work_projectName'] = $newRTDetails['RT_project']; $newTASKDetails['daysb4deadline'] = $newRTDetails['RT_deadlineDays']; $newTASKDetails['work_RTID'] = $new_RTID; $manageWorks = new manageWorks(); foreach ($MATCHED_DATES as $MATCHEDDATE) { $newTASKDetails['work_deadLine'] = $MATCHEDDATE; $manageWorks->newWork($newTASKDetails); } }
<?php include_once "include_db.php"; include_once "include_functions.php"; $USERNAME = $_POST['username']; $USERPASS = $_POST['password']; if (!authenticateUser($USERNAME, $USERPASS)) { echo "Invalid Username or Password!"; exit; } else { $_SESSION["uname"] = $USERNAME; } $projectName = DEFAULTPERSONALPROJECT; $briefDesc = urldecode($_POST['newtask']); $deadline = getTomorrowCaldate(2); $manageWorks = new manageWorks(); $manageWorks->newWork(array(work_userAssigned => $USERNAME, work_addedBy => $USERNAME, work_deadLine => $deadline, work_briefDesc => $briefDesc, work_Notes => '', work_status => $DE_GLOBALS_WORK_NEW, work_priority => 'N', work_projectName => $projectName, work_isPrivate => 'Y', daysb4deadline => 0, afterCompletionID => 0)); $this_taskid = mysql_insert_id(); $COMMENTLOGMESSAGE = "<B>{$USERNAME}</B> Created New Task -- User Assigned:{$USERNAME}, DeadLine:{$deadline}, Project:{$projectName}"; $manageWorks->addComment($this_taskid, APPNAME, $COMMENTLOGMESSAGE); echo "Task '{$this_taskid}' Created !";
// Connect to this subdomain's database if (!@mysql_select_db($CLIENTDBNAME)) { $processemail_debugoutput = "Unable to connect to client database"; exit(0); } // see if this user is active $SUBDOMAIN_USER = executesql_returnArray("select username from users where user_primaryEmail='" . $thisemail_fromAddress . "' and user_status='A'"); if (!$SUBDOMAIN_USER) { $processemail_debugoutput = "No user found with this emailid under this subdomain "; exit(0); } if ($before_underscore == 'tasks') { list($task_deadline, $task_hour, $task_briefDescription) = parseReminderSubject($thisemail_subject); // (caldate, timeofday , subject) $manageWorks = new manageWorks(); $manageWorks->newWork(array(work_userAssigned => $SUBDOMAIN_USER, work_addedBy => $SUBDOMAIN_USER, work_deadLine => $task_deadline, work_briefDesc => $task_briefDescription, work_Notes => '', work_status => $DE_GLOBALS_WORK_FROMEMAIL, work_priority => 'N', work_projectName => DEFAULTPROJECT, work_isPrivate => 'N')); $this_taskid = mysql_insert_id(); simpleEmail($thisemail_fromAddress, "Added Task {$this_taskid}", "Added Task {$this_taskid} for \n {$task_briefDescription}"); $processemail_debugoutput = "Added Task {$this_taskid} for \n {$thisemail_subject}"; } if ($before_underscore == 'reminders') { list($reminder_emailWhen, $reminder_emailHour, $reminder_emailBody) = parseReminderSubject($thisemail_subject); // (caldate, timeofday , subject) $reminder_emailTo = $thisemail_fromAddress; $reminder_emailSubject = "[Reminder] {$reminder_emailBody}"; if ($DEVELOPMENT_MODE) { echo "\n\t\t\t<PRE>\n\t\t\tIncoming Subject : {$thisemail_subject}\n\t\t\t-------------------------------------------\n\t\t\tReminder to : {$reminder_emailTo}\n\t\t\tReminder email body : {$reminder_emailBody}\n\t\t\tReminder email Subject : {$reminder_emailSubject}\n\t\t\tReminder email when : {$reminder_emailWhen}\n\t\t\tReminder email Hour : {$reminder_emailHour}\n\t\t\tSubdomain User : {$SUBDOMAIN_USER}\n\t\t\t</PRE>\n\t\t"; scheduleNewEmail_temp($reminder_emailTo, $reminder_emailBody, $reminder_emailSubject, $reminder_emailWhen, $reminder_emailHour, $SUBDOMAIN_USER); } else { scheduleNewEmail_temp($reminder_emailTo, $reminder_emailBody, $reminder_emailSubject, $reminder_emailWhen, $reminder_emailHour, $SUBDOMAIN_USER); }
$isprivate = get_POST_var('isprivate'); $priority = get_POST_var('priority'); $daysb4deadline = get_POST_var('daysb4deadline'); $onCompletionOf = get_POST_var('onCompletionOf'); $nutask_notify = get_POST_var('notifyAssigned'); $daysb4deadline = (int) $daysb4deadline; $onCompletionOf = (int) $onCompletionOf; $work_status = $DE_GLOBALS_WORK_NEW; if ($daysb4deadline > 0) { $work_status = $DE_GLOBALS_WORK_SCHEDULED; } if ($onCompletionOf > 0) { $work_status = $DE_GLOBALS_WORK_TASKONTASK; } $manageWorks = new manageWorks(); $manageWorks->newWork(array(work_userAssigned => $userassigned, work_addedBy => $USERNAME, work_deadLine => $deadline, work_briefDesc => $briefDesc, work_Notes => $notes, work_status => $work_status, work_priority => $priority, work_projectName => $projectName, work_isPrivate => $isprivate, daysb4deadline => $daysb4deadline, afterCompletionID => $onCompletionOf)); $this_taskid = mysql_insert_id(); $COMMENTLOGMESSAGE = "<B>{$USERNAME}</B> Created New Task -- User Assigned:{$userassigned}, DeadLine:{$deadline}, Project:{$projectName}, Appear {$daysb4deadline} days before deadline, Appear after completion of task {$onCompletionOf}"; $manageWorks->addComment($this_taskid, APPNAME, $COMMENTLOGMESSAGE); if ($nutask_notify == 'Y') { $tmp_notify_subject = "[#DE New Task] TN{$this_taskid} created by user {$USERNAME} under project '{$projectName}'"; $tmp_email_body = array(); $tmp_email_body[] = "Task Description: {$briefDesc}"; $tmp_email_body[] = "Task Deadline: " . caldate_to_human($deadline); $tmp_email_body[] = "Task URL : http://{$_SESSION['subdomain']}.discreteevents.com/taskdetails.php?taskid={$this_taskid} "; if ($notes) { $tmp_email_body[] = "Task Notes: {$notes}"; } $tmp_notify_body = implode("<BR>", $tmp_email_body); NotifyEventEmail($userassigned, $USERNAME, $tmp_notify_subject, $tmp_notify_body); }