コード例 #1
0
/**
 * Quota info for display in a (CSS) "progress bar"
 * Input: (not all these fields are currently being used)
 *   [user] => djbramer
 *   [quota_limit] => 2048
 *   [quota_usage] => 589
 *   [percent_usage] => 28.77
 *   [quota_available] => 1459
 *   [update_timestamp] => 2012-12-03 13:18:52
 * Sample Output: a bar with a colored background (green==OK, etc)
 *   "589 MB (28.77%)"
 */
function formatProgressBar($quota)
{
    $used_label = $quota['quota_usage'] . ' MB';
    $max_label = $quota['quota_limit'] . ' MB';
    if ($quota['quota_usage'] < 40) {
        $small_label = '&nbsp;' . $used_label;
        $used_label = '';
    }
    $params = array('text' => $used_label, 'percent' => $quota['percent_usage'], 'class' => $quota['percent_usage'] >= 90 ? 'progress-red' : '');
    $tpl = new PSUTemplate();
    return $tpl->psu_progress($params, $tpl);
}
コード例 #2
0
 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');
 }
コード例 #3
0
 /**
  * html
  *
  * Outputs the channel in the default channel html
  *
  * @since		version 2.0.0
  * @param  	string $text Text to output
  * @param   mixed $params Parameters to be appended to the JS callback
  */
 public function html($text, $params = false)
 {
     include_once 'PSUTemplate.class.php';
     $GLOBALS['NEW_STYLE'] = true;
     $tpl = new PSUTemplate();
     $tpl->channel_container = true;
     foreach ((array) $params['template_vars'] as $key => $value) {
         $tpl->assign($key, $value);
     }
     //end foreach
     if ($params['title']) {
         $tpl->assign('app_title', $params['title']);
     }
     $tpl->assign('output', $text);
     $tpl->assign('js_init', stripslashes($params['js_callback']));
     $tpl->addCSS('/webapp/my/templates/override.css');
     $tpl->addCSS('/webapp/my/templates/channels.css');
     ob_start();
     $tpl->display('/web/pscpages/webapp/portal/channel/templates/main.tpl');
     $text = ob_get_clean();
     return $text;
 }
コード例 #4
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
    }
}
コード例 #5
0
 function display($resource_name = 'index.tpl', $wrap = true, $cache_id = null, $compile_id = null)
 {
     // search-related template vars
     $this->assign('search_term', $_SESSION['ape_search_identifier']);
     if ($_SESSION['ape_search_type']) {
         $this->assign('search_' . $_SESSION['ape_search_type'], 'selected="1"');
     } else {
         $this->assign('search_name', 'selected="1"');
     }
     parent::display($resource_name, $wrap, $cache_id, $compile_id);
 }