Esempio n. 1
0
 /**
  * Actually submit the feedback 
  * @param array &$postData An array containing the data that has been validated
  * @param array &$responseData An array containing the data for the JSON response
  */
 public static function submit(&$postData, &$responseData)
 {
     // Email settings
     $email_settings = array('email_recip_address' => '*****@*****.**', 'subject_prefix' => 'PSU Mobile Feedback');
     // Create headers
     $mail_to = $email_settings['email_recip_address'];
     $mail_subject = $email_settings['subject_prefix'] . ' - ' . $postData['title'];
     $mail_headers = 'From: ' . $postData['email'] . "\r\n" . 'Reply-To: ' . $postData['email'];
     // Grab the message from a template
     $tpl = new \MobileTemplate();
     $tpl->assign('message', $postData['message']);
     $tpl->assign('feeling', $postData['feeling']);
     $mail_message = $tpl->fetch('feedback-email.tpl');
     // Mail the recipient
     if (\PSU::mail($mail_to, $mail_subject, $mail_message, $mail_headers)) {
         $responseData['success'] = true;
         $responseData['error'] = false;
         $responseData['response']['title'] = 'Success!';
         $responseData['response']['message'] = 'Your feedback was submitted! Thank you!';
     } else {
         $responseData['error'] = true;
         $responseData['response']['title'] = 'Uh oh...';
         $responseData['response']['message'] = 'There was a processing error. Please try again later.';
     }
     return $responseData;
 }
 public static function mail($id)
 {
     $tpl = new PSUTemplate();
     $f = PSU::db('myplymouth')->GetRow("SELECT * FROM woodwindday WHERE id_ = ?", array($id));
     $form = new WoodwindApply($f, true);
     $form->readonly(true);
     $tpl->assign('form', $form);
     $message = $tpl->fetch('email.tpl');
     $to = array('*****@*****.**');
     $subject = sprintf("[PSU Woodwind Day 2011] Registration for %s %s", $form->first_name->value(), $form->last_name->value());
     PSU::mail($to, $subject, $message, 'Content-Type: text/html');
 }
 public function mail($pay, $level, $people)
 {
     $current_pay = $pay['current'];
     $future_pay = $pay['future'];
     $current_user = $people['current'];
     $active_user = $people['active'];
     $active_user_name = $active_user->formatName("f l");
     $current_user_name = $current_user->formatName("f l");
     $usnh_id = $current_user->usnh_id;
     $email_to = "*****@*****.**";
     $message = "{$current_user_name} (" . $current_user->username . ") has completed their current level of {$level}\nand would enjoy a pay raise from \${$current_pay} to \${$future_pay}.\n\nUSNH ID: {$usnh_id} \n\nSent by\n\t{$active_user_name}";
     PSU::mail($email_to, "Training Tracker - " . $current_user->formatName("f l") . " pay raise request", "{$message}");
 }
 function email_user_approved($reservation_idx)
 {
     //emails the user when thier loan has been approved
     $reserve = ReserveDatabaseAPI::by_id($reservation_idx);
     $reservation = $reserve[$reservation_idx];
     $index = $reserve[$reservation_idx]['building_idx'];
     $categories = ReserveDatabaseAPI::categories();
     $locations = ReserveDatabaseAPI::locations();
     $email = new \PSUSmarty();
     $email->assign('categories', $categories);
     $email->assign('locations', $locations);
     $email->assign('reserve', $reservation);
     $contents = $email->fetch($GLOBALS['TEMPLATES'] . '/email.user.approve.tpl');
     return PSU::mail($reserve[$reservation_idx]['email'], 'Media Request Approved!', $contents, self::headers());
 }
 public static function mail($id)
 {
     $tpl = new PSU\Template();
     $f = PSU::db('myplymouth')->GetRow("SELECT * FROM anejf WHERE id_ = ?", array($id));
     $form = new AnejfApply($f, true);
     $form->readonly(true);
     $tpl->assign('form', $form);
     $message = $tpl->fetch('email.tpl');
     $to = '*****@*****.**';
     if (PSU::isdev()) {
         $to = '*****@*****.**';
     }
     $subject = sprintf("[ANEJF %d] Application for %s %s", $GLOBALS['ANEJF']['YEAR'], $form->first_name->value(), $form->last_name->value());
     PSU::mail($to, $subject, $message, 'Content-Type: text/html');
 }
        $partcost = $_POST[$ourcost];
        $customercost = $_POST[$custcost];
        $productnumber = $_POST[$prodnum];
        $totalcost = $customercost * $quantity;
        if ($_POST[$warranty] == 1) {
            $warranty_part = 1;
            $warranty_text = " - Warranty";
        } else {
            $warranty_part = 0;
            $warranty_text = "";
        }
        $insert_query = "INSERT INTO shop_workorder_items(workorder_id,item,vendor,product_num,quantity,part,warranty,ordered,part_cost,part_charged,cost,username,time_entered) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,CURRENT_TIMESTAMP)";
        //echo $insert_query;
        $args = array('workorder_id' => $id, 'item' => $quantity . " x " . $item . $warranty_text, 'vendor' => addslashes($vendor), 'product_num' => $productnumber, 'quantity' => $quantity, 'part' => 1, 'warranty' => $warranty_part, 'ordered' => 0, 'part_cost' => $partcost, 'part_charged' => $customercost, 'cost' => $totalcost, 'username' => $_SESSION['username']);
        $GLOBALS['SYSTEMS_DB']->Execute($insert_query, $args) or die("DB error updating items & costs");
        if ($warranty_part) {
            $message .= "WARRANTY - ";
        }
        $message .= $quantity . "\tx\t" . $productnumber . "\t" . $item . "\t\$" . $partcost . "\t\n";
    }
}
$update_current = "UPDATE shop_workorder SET current_status='Delayed: waiting for parts', closed=0, time_closed=0 WHERE id=?";
$args = array('id' => $id);
$GLOBALS['SYSTEMS_DB']->Execute($update_current, $args) or die("DB error updating current status");
$insert_current = "INSERT INTO shop_status_history(workorder_id,status,username) VALUES(?,'Delayed: waiting for parts','Part Request')";
$GLOBALS['SYSTEMS_DB']->Execute($insert_current, $args) or die("DB error inserting current status update into history");
if ($send_mail) {
    PSU::mail($to, $subject, $message, $headers);
}
/********End Confirmation Email **************/
header("Location: parts_request.html?id=" . $id . "&s=1");
 public function process()
 {
     if ($this->psu_status == 'eod') {
         \PSU::db('banner')->StartTrans();
         if ($this->status_flag == 'success') {
             if ($this->transactiontype == 1) {
                 $this->detail_code = 'IQEW';
                 $this->detail_desc = 'Credit-Card-Payment-Thank You';
                 $this->multiplier = -1;
                 // send notification to bursar if an unknown creditcard payment has been received
                 if ($this->transactionstatus == 4) {
                     $message = 'There was a "Transaction Status = 4" payment paid via Commerce Manager.  Here is the debug information:' . "\n\n";
                     $message .= print_r($this, true);
                     \PSU::mail('bursar@plymouth.edu,mtbatchelder@plymouth.edu', 'Alert: Unknown Credit Card Payment via Nelnet', $message);
                 }
                 //end if
             } elseif ($this->transactiontype == 2) {
                 $this->detail_code = 'IREW';
                 $this->detail_desc = 'Credit-Card-Refund';
                 $this->multiplier = 1;
                 // send notification to bursar if an unknown creditcard refund has been received
                 if ($this->transactionstatus == 4) {
                     $message = 'There was a "Transaction Status = 4" credit card refund fed by via Commerce Manager.  Here is the debug information:' . "\n\n";
                     $message .= print_r($this, true);
                     $email = array('*****@*****.**');
                     if (!\PSU::isDev()) {
                         $email[] = '*****@*****.**';
                     }
                     //end if
                     \PSU::mail($email, 'Alert: Unknown Credit Card Refund via Nelnet', $message);
                 }
                 //end if
             } elseif ($this->transactiontype == 3) {
                 $this->detail_code = 'IQEC';
                 $this->detail_desc = 'E-Check-Payment-Thank You';
                 $this->multiplier = -1;
             }
             //end else
             $this->transaction = new \PSU\AR\Transaction\Receivable($this->ordernumber, $this->totalamount / 100, $this->multiplier);
             $this->bursar_term = $this->transaction->term_code;
             $receivable_template = $this->init_template();
             $this->transaction->split($receivable_template);
             if (\PSU::has_filter('etrans_post_split')) {
                 \PSU::apply_filters('etrans_post_split', $this);
             }
             //end if
             $this->transaction->save();
             if (\PSU::has_filter('etrans_post_save')) {
                 \PSU::apply_filters('etrans_post_save', $this);
             }
             //end if
             $this->psu_status = 'loaded';
             $this->save();
             $amount = !PSU::db('banner')->HasFailedTrans() ? $this->totalamount / 100 : false;
         } else {
             $this->psu_status = 'no_load';
             $this->save();
             $amount = 0;
         }
         //end else
         PSU::db('banner')->CompleteTrans();
         return $amount;
     }
     //end if
     PSU::db('banner')->CompleteTrans(false);
     return false;
 }
Esempio n. 8
0
function sendOpenCallMail($call_info, $action)
{
    global $db;
    $person_cache = array();
    $call = $db->GetRow("SELECT * FROM call_log WHERE call_id = ?", array($call_info['call_id']));
    $call_info['call_date'] = $call['call_date'] . ' ' . $call['call_time'];
    $headers = array();
    $headers['content-type'] = 'text/html';
    $caller = PSU::nvl($call_info['caller_wp_id'], $call_info['caller_pidm'], $call_info['call_log_username']);
    $caller_data = $GLOBALS['user']->getCallerData($caller);
    $logger = $person_cache[$call_info['call_log_username']] = PSUPerson::get($call_info['call_log_username']);
    $groupInfo = getGroupInfo($call_info['its_group_assigned_to']);
    $call_log_employee = checkEmployee($call_info['call_log_username']);
    $assigned_employee = checkEmployee($call_info['tlc_assigned_to']);
    $to = array();
    // always send to the submitter if the submitter is an employee
    if ($call_log_employee) {
        if ($logger->system_account_exists) {
            $to[] = $logger->wp_email;
        }
        //end
    } else {
        $end_user_to = $logger->wp_email;
    }
    //end else
    if ($action == "its_staff") {
        $call_info['call_id'] = $call_info['new_call_id'] . $call_info['call_id'];
        $call_info['comments'] = $call_info['problem_details'] . $call_info['comments'];
        if ($call_info['tlc_assigned_to'] != "unassigned") {
            if ($assigned_employee) {
                $to[] = PSUPerson::get($call_info['tlc_assigned_to'])->wp_email;
            } elseif ($call_info['tlc_assigned_to'] == 'caller' && $call_info['call_id']) {
                $sql = "SELECT caller_username \n\t\t\t\t\t\t\t\t\tFROM call_log \n\t\t\t\t\t\t\t\t WHERE call_log.call_id = ?";
                $end_user_to = $db->GetOne($sql, array($call_info['call_id']));
                if ($end_user_to) {
                    $end_user = PSUPerson::get($end_user_to);
                    if ($end_user) {
                        $end_user_to = $end_user->wp_email;
                    }
                }
                //end if
            } else {
                $end_user = PSUPerson::get($call_info['tlc_assigned_to']);
                $end_user_to = $end_user->wp_email;
            }
            //end if
        }
        //end if
        if ($call_info['its_assigned_group'] != 0) {
            $sql = "SELECT email_to \n\t\t\t\t\t\t\t\tFROM   itsgroups\n\t\t\t\t\t\t\t\t     , call_log \n\t\t\t\t\t\t\t\t\t\t , call_history \n\t\t\t\t\t\t\t WHERE itsgroups.deleted = 0 \n\t\t\t\t\t\t\t\t AND call_log.call_id = call_history.call_id \n\t\t\t\t\t\t\t\t AND itsgroups.itsgroupid = ?\n\t\t\t           AND call_log.call_id = ?";
            $email_to = $db->GetOne($sql, array($call_info['its_assigned_group'], $call_info['call_id']));
            if ($email_to == 'all') {
                $sql = "SELECT user_name\n\t\t\t\t\t\t\t\t\tFROM   itsgroups\n\t\t\t\t\t\t\t\t\t     , its_employee_groups\n\t\t\t\t\t\t\t\t\t     , call_log_employee\n\t\t\t\t\t\t\t\t\tWHERE itsgroups.deleted = 0 \n\t\t\t\t\t\t\t\t\t\tAND call_log_employee.call_log_user_id = its_employee_groups.employee_id \n\t\t\t\t\t\t\t\t\t\tAND its_employee_groups.group_id = ?\n\t\t\t\t\t\t\t\t\t\tAND itsgroups.itsgroupid = its_employee_groups.group_id \n\t\t\t\t\t\t\t\t\t\tAND call_log_employee.status = 'active' \n\t\t\t\t            AND its_employee_groups.option_id = '2'";
                $email_list = $db->GetCol($sql, array($call_info['its_assigned_group']));
            } else {
                $email_list = explode(',', $email_to);
            }
            //end else
            foreach ((array) $email_list as $identifier) {
                $user = PSUPerson::get($identifier);
                $to[] = $user->wp_email;
            }
            //end foreach
        }
        //end if
        if ($call_info['its_group_assigned_to'] != 0) {
            $subject = '[Call Log] [' . $groupInfo[1] . '] ' . $caller_data['name_full'];
        } else {
            $subject = '[Call Log] ' . $caller_data['name_full'];
        }
        $subject .= ' (#' . $call_info['call_id'] . ')';
        if ($call_info['call_status'] == 'closed') {
            $subject .= ' [CLOSED]';
            // always send close to the owner, if they are allowed to see the
            // full history
            $caller_identifier = $db->GetOne("SELECT calllog_username FROM call_log WHERE call_log.call_id = '{$call_info['call_id']}'");
            $caller_user = PSUPerson::get($caller_identifier);
            if ($GLOBALS['end_user_email']) {
                $closing_user = PSUPerson::get($_SESSION['wp_id']);
                if ($caller_user->wp_email == $closing_user->wp_email) {
                    $end_user_to = $closing_user->wp_email;
                }
                //end if
            } elseif (checkEmployee($caller_to)) {
                $to[] = $caller_user->wp_email;
            }
            //end else
        }
        $sql = "SELECT * \n\t\t\t\t\t\t\tFROM   call_log\n\t\t\t\t\t\t\t     , call_history \n\t\t\t\t\t\t WHERE call_log.call_id = ?\n\t\t\t\t\t\t\t AND call_log.call_id = call_history.call_id\n\t\t\t\t\t\t ORDER BY date_assigned DESC\n\t\t               , time_assigned DESC";
        $call_info_query = $db->Execute($sql, array($call_info['call_id']));
        foreach ($call_info_query as $call_info2) {
            $group_name = getGroupInfo($call_info2['its_assigned_group']);
            if ($group_name[0] == '') {
                $group_name = 'Unassigned';
            } else {
                $group_name = $group_name[0];
            }
            $call_info2['group_name'] = $group_name;
            $call_info2['update_date'] = $call_info2['date_assigned'] . ' ' . $call_info2['time_assigned'];
            if ($call_info2['tlc_assigned_to'] && $call_info2['tlc_assigned_to'] != 'unassigned') {
                if (!$person_cache[$call_info2['tlc_assigned_to']]) {
                    $person_cache[$call_info2['tlc_assigned_to']] = PSUPerson::get($call_info2['tlc_assigned_to']);
                }
                //end else
                $call_info2['assigned_to'] = $call_info2['tlc_assigned_to'];
            }
            //end if
            if ($call_info2['updated_by']) {
                if (!$person_cache[$call_info2['updated_by']]) {
                    $person_cache[$call_info2['updated_by']] = PSUPerson::get($call_info2['updated_by']);
                }
                //end else
                $call_info2['logger'] = $call_info2['updated_by'];
            }
            //end if
            $history[] = $call_info2;
        }
        $caller_id = $caller_data['identifier'];
        if (!$person_cache[$caller_id]) {
            $person_cache[$caller_id] = PSUPerson::get($caller_id);
        }
        //end else
        $current = array_slice($history, 0, 1);
        $current = $current[0];
        // email ITS
        $tpl = new PSUTemplate();
        $tpl->assign('caller', $caller_data);
        $tpl->assign('caller_id', $caller_id);
        $tpl->assign('pcache', $person_cache);
        $tpl->assign('call', $call_info);
        $tpl->assign('current', $current);
        $tpl->assign('history', array_slice($history, 1));
        $text_message = $tpl->fetch('email.ticket.text.tpl');
        $html_message = $tpl->fetch('email.ticket.html.tpl');
        $to = implode(',', array_unique($to));
        if ($to) {
            $headers['from'] = $logger->formatName('f l') . ' <' . $logger->wp_email . '>';
            PSU::mail($to, $subject, array($text_message, $html_message), $headers);
        }
        //end if
        // email user
        if ($end_user_to) {
            $headers['from'] = 'Support Tickets <*****@*****.**>';
            $tpl->assign('is_caller', true);
            $tpl->assign('history', array());
            $text_message = $tpl->fetch('email.ticket.text.tpl');
            $html_message = $tpl->fetch('email.ticket.html.tpl');
            PSU::mail($end_user_to, $subject, array($text_message, $html_message), $headers);
        }
        //end if
    }
}
    if (!isset($_SESSION['mtecd'])) {
        $_SESSION['mtecd'] = array();
    }
    $app->mail = function ($id) {
        $tpl = new PSU\Template();
        $f = PSU::db('myplymouth')->GetRow("SELECT * FROM mte_career_day WHERE id_ = ?", array($id));
        $form = new PSU\Festivals\MusicCareerDay\Model($f, true);
        $form->readonly(true);
        $tpl->assign('form', $form);
        $message = $tpl->fetch('email.tpl');
        $to = array('*****@*****.**');
        if (PSU::isdev()) {
            $to[0] = '*****@*****.**';
        }
        $subject = sprintf("[MTECD {$app->event_year}] Application for %s %s", $form->first_name->value(), $form->last_name->value());
        PSU::mail($to, $subject, $message, 'Content-Type: text/html');
    };
    $app->tpl = new PSU\Template();
    $app->tpl->assign('event_year', $app->event_year);
});
respond('/apply', function ($request, $response, $app) {
    $f = isset($_SESSION['mtecd']['f']) ? $_SESSION['mtecd']['f'] : array();
    $form = new PSU\Festivals\MusicCareerDay\Model($f);
    $app->tpl->assign('form', $form);
    $app->tpl->display('apply.tpl');
});
respond('/', function ($request, $response, $app) {
    $app->tpl->display('index.tpl');
});
respond('/thank-you', function ($request, $response, $app) {
    $f = $_SESSION['mtecd']['f'];
Esempio n. 10
0
 /**
  * page
  *
  * page someone about the cron
  *
  * @access	public
  */
 function page($message)
 {
     PSU::mail($this->page, 'Cron Email (' . $this->_app_name . ')', $message, 'From: Cron-Paging@www');
 }
 /**
  * This function is used to send off an email regaurding information on the employee exit checklist. 
  * This function is a bit smashed together to only work with employee exit checklist. If a future checklist was made this function
  * will have to be rethought.
  *
  * @param $attribute string containing pa.attribute and pa.type keys in order to populate usernames by attribute
  * @param $type_id int 1 = permission 2 = role 6 = admin. Must be one of these numebrs
  * @param $subject PSUPerson the person the email is about. 
  * @param $end_date string the date the person will be leaving the institution
  * @param $list string the checklist the email is using. 
  */
 public static function email($subject, $end_date, $attribute, $type_id, $list, $checklist_id, $response)
 {
     global $config;
     $emails = array();
     $people = self::contributors($subject, $checklist_id, $attribute, $type_id);
     $emails = self::contributor_email($people);
     $checklist = self::get($subject->pidm, 'employee-exit');
     if ($emails) {
         $url = $config->get('ape', 'base_url') . '/user/' . $subject->pidm . '/checklist/' . $list;
         $email = new PSUSmarty();
         $email->assign('no_outstanding_charges', $response->no_outstanding_charges);
         $email->assign('no_ape_attributes', $response->no_ape_attributes);
         $email->assign('no_academic_admin', $response->no_academic_admin);
         $email->assign('end_date', $end_date);
         $email->assign('employee_name', $subject->formatName('f m l'));
         $email->assign('employee_username', $subject->username);
         $email->assign('subject', $subject);
         $email->assign('position', $subject->employee_positions[$checklist['position_code']]);
         $email->assign('link', $url);
         $headers = 'Content-type: text/html; charset=UTF-8' . "\r\n";
         PSU::mail($emails, '[Action Required] ' . $subject->formatName('f m l') . ' - Leaving ' . date('M j, Y', $end_date), $email->fetch($GLOBALS['TEMPLATES'] . '/email.checklist.employee-exit.tpl'), $headers);
     }
     //end foreach
     return $emails;
 }
Esempio n. 12
0
require dirname(__DIR__) . '/webapp/calllog/includes/functions/open_call_functions.php';
// needed to fetch open calls
$GLOBALS['db'] = PSU::db('calllog');
$GLOBALS['BANNER'] = PSU::db('banner');
$GLOBALS['BannerGeneral'] = new BannerGeneral($GLOBALS['BANNER']);
$GLOBALS['user'] = new User(PSU::db('calllog'));
$HOST = 'https://www.plymouth.edu';
$GLOBALS['BASE_URL'] = $HOST . '/webapp/calllog';
$GLOBALS['BASE_DIR'] = dirname(__FILE__);
$GLOBALS['TEMPLATES'] = dirname(__DIR__) . '/webapp/calllog/templates';
$GLOBALS['CALLLOG_WEB'] = $GLOBALS['BASE_URL'] . '/calls/my/';
$tpl = new PSU\Template();
$users = getTLCUsers('active');
foreach ($users as $person) {
    $reminder = $GLOBALS['user']->getReminderSetting($person['user_name']);
    if ($reminder == 'yes') {
        $options = array('which' => 'my', 'who' => $person['user_name']);
        $calls = getOpenCalls($options);
        if (count($calls) > 0) {
            $tpl->assign('calls', $calls);
            $tpl->assign('user', $person);
            $html = $tpl->fetch('email.calls.tpl');
            $text = 'This email is optimized for HTML.  View your open calls here: ' . $GLOBALS['CALLLOG_WEB'];
            $p = new PSUPerson($person['user_name']);
            PSU::mail($p->email['CA'][0], '[CallLog] Daily Open Call Report', array($text, $html));
        }
        // end if
    }
    // end if
}
// end foreach