Ejemplo n.º 1
0
/**
 * Selects a phone support entry from the table and returns the contents.
 *
 * @param   string $id The phone support entry ID.
 * @return  A string containing the description.
 */
function getPhoneSupport($id)
{
    $res = Phone_Support::getDetails($id);
    if (!Issue::canAccess($res['phs_iss_id'], $GLOBALS['usr_id'])) {
        return '';
    }
    if (empty($_GET['ec_id'])) {
        return $res['phs_description'];
    }
    return Link_Filter::processText(Auth::getCurrentProject(), nl2br(htmlspecialchars($res['phs_description'])));
}
 public function getExcerpts()
 {
     if (count($this->matches) < 1) {
         return false;
     }
     $excerpt_options = array('query_mode' => $this->match_mode, 'before_match' => $this->excerpt_placeholder . '-before', 'after_match' => $this->excerpt_placeholder . '-after', 'allow_empty' => true);
     $excerpts = array();
     foreach ($this->matches as $issue_id => $matches) {
         $excerpt = array('issue' => array(), 'email' => array(), 'phone' => array(), 'note' => array());
         foreach ($matches as $match) {
             if ($match['index'] == 'issue') {
                 $issue = Issue::getDetails($issue_id);
                 $documents = array($issue['iss_summary']);
                 $res = $this->sphinx->BuildExcerpts($documents, 'issue_stemmed', $this->keywords, $excerpt_options);
                 if ($res[0] != $issue['iss_summary']) {
                     $excerpt['issue']['summary'] = self::cleanUpExcerpt($res[0]);
                 }
                 $documents = array($issue['iss_original_description']);
                 $res = $this->sphinx->BuildExcerpts($documents, 'issue_stemmed', $this->keywords, $excerpt_options);
                 if ($res[0] != $issue['iss_original_description']) {
                     $excerpt['issue']['description'] = self::cleanUpExcerpt($res[0]);
                     error_log(print_r($excerpt['issue']['description'], 1));
                 }
             } elseif ($match['index'] == 'email') {
                 $email = Support::getEmailDetails(null, $match['match_id']);
                 $documents = array($email['sup_subject'] . "\n" . $email['message']);
                 $res = $this->sphinx->BuildExcerpts($documents, 'email_stemmed', $this->keywords, $excerpt_options);
                 $excerpt['email'][Support::getSequenceByID($match['match_id'])] = self::cleanUpExcerpt($res[0]);
             } elseif ($match['index'] == 'phone') {
                 $phone_call = Phone_Support::getDetails($match['match_id']);
                 $documents = array($phone_call['phs_description']);
                 $res = $this->sphinx->BuildExcerpts($documents, 'phonesupport_stemmed', $this->keywords, $excerpt_options);
                 $excerpt['phone'][] = self::cleanUpExcerpt($res[0]);
             } elseif ($match['index'] == 'note') {
                 $note = Note::getDetails($match['match_id']);
                 $documents = array($note['not_title'] . "\n" . $note['not_note']);
                 $res = $this->sphinx->BuildExcerpts($documents, 'note_stemmed', $this->keywords, $excerpt_options);
                 $note_seq = Note::getNoteSequenceNumber($issue_id, $match['match_id']);
                 $excerpt['note'][$note_seq] = self::cleanUpExcerpt($res[0]);
             }
         }
         foreach ($excerpt as $key => $val) {
             if (count($val) < 1) {
                 unset($excerpt[$key]);
             }
         }
         $excerpts[$issue_id] = $excerpt;
     }
     return $excerpts;
 }
Ejemplo n.º 3
0
/**
 * Selects a phone support entry from the table and returns the contents.
 * 
 * @param   string $id The phone support entry ID.
 * @return  A string containing the description.
 */
function getPhoneSupport($id)
{
    $res = Phone_Support::getDetails($id);
    if (!empty($_GET["ec_id"])) {
        return Link_Filter::processText(Auth::getCurrentProject(), nl2br(htmlspecialchars($_GET["ec_id"] . ":" . $id . ":" . $res["phs_description"])));
    } else {
        return $res["phs_description"];
    }
}