/** * 发送通知 * * @param unknown_type $uid 接收者用户ID或用户名,多个ID用","连接,如:"501,yuanwei" * @param unknown_type $msg 消息文本 * @param unknown_type $url 连接地址 * @param unknown_type $notifyType 通知类型 'rtx' | 'mail' * @param unknown_type $title 标题,可以为空 */ public static function notify($uids, $msg, $url, $notifyType, $title = '') { // 得到 userid 得到 username $usernames = $spr = ''; $uidArr = explode(',', $uids); foreach ($uidArr as $uid) { $idtype = is_numeric($uid) ? 0 : 1; $uinfo = self::getInfo($uid, '', $idtype); $value = $notifyType == 'rtx' ? $uinfo['username'] : $uinfo['email']; if ($value) { $usernames .= $spr . $value; $spr = ','; } } // 找不到接收者则退出 if ($usernames == '') { return; } // 发送对应的通知 if ($title == '') { $title = 'QuickBug Notify'; } else { $title = 'QuickBug-' . $title; } if ($notifyType == 'rtx') { Rtx::send($usernames, $msg, $url, $title); } else { $usernames = str_replace(',', ';', $usernames); $mailObj = new Qmail(); $view = new QP_View(); $contents = $view->render('/Common/Mail-tpl.html'); $body = str_replace(array('{title}', '{msg}', '{url}'), array($title, $msg, $url), $contents); $mailObj->send($usernames, $title, $body); } }
/** * 得到默认模板的内容 * */ function getDefaultBugTpl() { $view = new QP_View(); return $view->render('/Common/Default-bugtpl.html'); }
/** * 解析得到BUG的详细信息 */ private function bugHtml($bugid) { $view = new QP_View(); $view->setPath('Bug'); // 得到BUG详细信息 $view->buginfo = $this->bugModel->bugInfo($bugid); // 得到所有的附件 $view->doclist = $this->bugModel->bugDocList($bugid); // 所有的评论 $view->commentlist = $this->bugModel->commentList($bugid); // 所有的操作历史 $view->operatelist = $this->bugModel->operateList($bugid); return $view->render('Print.html'); }