Example #1
0
 /**
  * Formats the return value
  *
  * @param   mixed   $value The value to format
  * @param   integer $fld_id The ID of the field
  * @param   integer $issue_id The ID of the issue
  * @return  mixed   the formatted value.
  */
 public function formatValue($value, $fld_id, $issue_id)
 {
     $backend = self::getBackend($fld_id);
     if (is_object($backend) && method_exists($backend, 'formatValue')) {
         return $backend->formatValue($value, $fld_id, $issue_id);
     } else {
         return Link_Filter::processText(Auth::getCurrentProject(), Misc::htmlentities($value));
     }
 }
 /**
  * Method used to get the full listing of time entries in the system for a
  * specific issue
  *
  * @param   integer $issue_id The issue ID
  * @return  array The full list of time entries
  */
 public static function getTimeEntryListing($issue_id)
 {
     $stmt = 'SELECT
                 ttr_id,
                 ttr_created_date,
                 ttr_summary,
                 ttr_time_spent,
                 ttc_title,
                 ttr_usr_id,
                 usr_full_name
              FROM
                 {{%time_tracking}},
                 {{%time_tracking_category}},
                 {{%user}}
              WHERE
                 ttr_ttc_id=ttc_id AND
                 ttr_usr_id=usr_id AND
                 ttr_iss_id=?
              ORDER BY
                 ttr_created_date ASC';
     try {
         $res = DB_Helper::getInstance()->getAll($stmt, array($issue_id));
     } catch (DbException $e) {
         return 0;
     }
     $total_time_spent = 0;
     $total_time_by_user = array();
     foreach ($res as &$row) {
         $row['ttr_summary'] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($row['ttr_summary'])));
         $row['formatted_time'] = Misc::getFormattedTime($row['ttr_time_spent']);
         $row['ttr_created_date'] = Date_Helper::getFormattedDate($row['ttr_created_date']);
         if (isset($total_time_by_user[$row['ttr_usr_id']])) {
             $total_time_by_user[$row['ttr_usr_id']]['time_spent'] += $row['ttr_time_spent'];
         } else {
             $total_time_by_user[$row['ttr_usr_id']] = array('usr_full_name' => $row['usr_full_name'], 'time_spent' => $row['ttr_time_spent']);
         }
         $total_time_spent += $row['ttr_time_spent'];
     }
     usort($total_time_by_user, function ($a, $b) {
         return $a['time_spent'] < $b['time_spent'];
     });
     foreach ($total_time_by_user as &$item) {
         $item['time_spent'] = Misc::getFormattedTime($item['time_spent']);
     }
     return array('total_time_spent' => Misc::getFormattedTime($total_time_spent), 'total_time_by_user' => $total_time_by_user, 'list' => $res);
 }
Example #3
0
/**
 * Selects a mail queue entry from the table and returns the contents.
 *
 * @param   string $id The mail queue entry ID.
 * @return  A string containing the body.
 */
function getMailQueue($id)
{
    if (Auth::getCurrentRole() < User::getRoleID('Developer')) {
        return;
    }
    $res = Mail_Queue::getEntry($id);
    if (!Issue::canAccess($res['maq_iss_id'], $GLOBALS['usr_id'])) {
        return '';
    }
    if (empty($_GET['ec_id'])) {
        return $res['maq_body'];
    }
    return Link_Filter::processText(Auth::getCurrentProject(), nl2br(htmlspecialchars($res['maq_headers'] . "\n" . $res['maq_body'])));
}
 /**
  * Method used to get the full list of requirements and impact analysis for
  * a specific issue.
  *
  * @param   integer $issue_id The issue ID
  * @return  array The full list of requirements
  */
 public static function getListing($issue_id)
 {
     $stmt = 'SELECT
                 isr_id,
                 isr_requirement,
                 isr_dev_time,
                 isr_impact_analysis,
                 A.usr_full_name AS submitter_name,
                 B.usr_full_name AS handler_name
              FROM
                 (
                 {{%issue_requirement}},
                 {{%user}} A
                 )
              LEFT JOIN
                 {{%user}} B
              ON
                 isr_updated_usr_id=B.usr_id
              WHERE
                 isr_iss_id=? AND
                 isr_usr_id=A.usr_id';
     try {
         $res = DB_Helper::getInstance()->getAll($stmt, array($issue_id));
     } catch (DbException $e) {
         return '';
     }
     if (count($res) == 0) {
         return '';
     }
     $prj_id = Issue::getProjectID($issue_id);
     foreach ($res as &$row) {
         $row['isr_requirement'] = Link_Filter::processText($prj_id, nl2br(htmlspecialchars($row['isr_requirement'])));
         $row['isr_impact_analysis'] = Link_Filter::processText($prj_id, nl2br(htmlspecialchars($row['isr_impact_analysis'])));
         $row['formatted_dev_time'] = Misc::getFormattedTime($row['isr_dev_time']);
     }
     return $res;
 }
 /**
  * Method used to return the full list of attachments related to a specific
  * issue in the database.
  *
  * @param   integer $issue_id The issue ID
  * @return  array The full list of attachments
  */
 public static function getList($issue_id)
 {
     $usr_id = Auth::getUserID();
     $prj_id = Issue::getProjectID($issue_id);
     $stmt = 'SELECT
                 iat_id,
                 iat_usr_id,
                 usr_full_name,
                 iat_created_date,
                 iat_description,
                 iat_unknown_user,
                 iat_status
              FROM
                 {{%issue_attachment}},
                 {{%user}}
              WHERE
                 iat_iss_id=? AND
                 iat_usr_id=usr_id';
     if (User::getRoleByUser($usr_id, $prj_id) <= User::ROLE_CUSTOMER) {
         $stmt .= " AND iat_status='public' ";
     }
     $stmt .= '
              ORDER BY
                 iat_created_date ASC';
     $params = array($issue_id);
     try {
         $res = DB_Helper::getInstance()->getAll($stmt, $params);
     } catch (DbException $e) {
         return '';
     }
     foreach ($res as &$row) {
         $row['iat_description'] = Link_Filter::processText($prj_id, nl2br(htmlspecialchars($row['iat_description'])));
         $row['files'] = self::getFileList($row['iat_id']);
         // if there is an unknown user, user that instead of the user_full_name
         if (!empty($row['iat_unknown_user'])) {
             $row['usr_full_name'] = $row['iat_unknown_user'];
         }
     }
     return $res;
 }
 /**
  * Method used to get the full listing of phone support entries
  * associated with a specific issue.
  *
  * @param   integer $issue_id The issue ID
  * @return  array The list of notes
  */
 public static function getListing($issue_id)
 {
     $stmt = 'SELECT
                 {{%phone_support}}.*,
                 usr_full_name,
                 phc_title,
                 iss_prj_id
              FROM
                 {{%phone_support}},
                 {{%project_phone_category}},
                 {{%user}},
                 {{%issue}}
              WHERE
                 phs_iss_id=iss_id AND
                 iss_prj_id=phc_prj_id AND
                 phs_phc_id=phc_id AND
                 phs_usr_id=usr_id AND
                 phs_iss_id=?
              ORDER BY
                 phs_created_date ASC';
     try {
         $res = DB_Helper::getInstance()->getAll($stmt, array($issue_id));
     } catch (DbException $e) {
         return '';
     }
     foreach ($res as &$row) {
         $row['phs_description'] = Misc::activateLinks(nl2br(htmlspecialchars($row['phs_description'])));
         $row['phs_description'] = Link_Filter::processText($row['iss_prj_id'], $row['phs_description']);
         $row['phs_created_date'] = Date_Helper::getFormattedDate($row['phs_created_date']);
     }
     return $res;
 }
 /**
  * Formats the return value
  *
  * @access  public
  * @param   mixed   $value The value to format
  * @param   integer $fld_id The ID of the field
  * @param   integer $issue_id The ID of the issue
  * @return  mixed   the formatted value.
  */
 function formatValue($value, $fld_id, $issue_id, $functional = false)
 {
     $backend = Custom_Field::getBackend($fld_id);
     if (is_object($backend) && method_exists($backend, 'formatValue')) {
         return $backend->formatValue($value, $fld_id, $issue_id, $functional);
     } else {
         return Link_Filter::processText(Auth::getCurrentProject(), htmlspecialchars($value));
     }
 }
 /**
  * Method used to get the full listing of time entries in the system for a
  * specific issue
  *
  * @access  public
  * @param   integer $issue_id The issue ID
  * @return  array The full list of time entries
  */
 function getListing($issue_id)
 {
     $stmt = "SELECT\n                    ttr_id,\n                    ttr_created_date,\n                    ttr_summary,\n                    ttr_time_spent,\n                    ttc_title,\n                    ttr_usr_id,\n                    usr_full_name\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "time_tracking,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "time_tracking_category,\n                    " . ETEL_USER_TABLE . "\n                 WHERE\n                    ttr_ttc_id=ttc_id AND\n                    ttr_usr_id=usr_id AND\n                    ttr_iss_id=" . Misc::escapeInteger($issue_id) . "\n                 ORDER BY\n                    ttr_created_date ASC";
     $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return 0;
     } else {
         $total_time_spent = 0;
         for ($i = 0; $i < count($res); $i++) {
             $res[$i]["ttr_summary"] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($res[$i]["ttr_summary"])));
             $res[$i]["formatted_time"] = Misc::getFormattedTime($res[$i]["ttr_time_spent"]);
             $res[$i]["ttr_created_date"] = Date_API::getFormattedDate($res[$i]["ttr_created_date"]);
             $total_time_spent += $res[$i]["ttr_time_spent"];
         }
         return array("total_time_spent" => Misc::getFormattedTime($total_time_spent), "list" => $res);
     }
 }
Example #9
0
 /**
  * Method used to get the full list of checkins associated with an issue.
  *
  * @param   integer $issue_id The issue ID
  * @return  array The list of checkins
  */
 public static function getCheckinList($issue_id)
 {
     $stmt = 'SELECT
                 *
              FROM
                 {{%issue_checkin}}
              WHERE
                 isc_iss_id=?
              ORDER BY
                 isc_created_date ASC';
     try {
         $res = DB_Helper::getInstance()->getAll($stmt, array($issue_id));
     } catch (DbException $e) {
         return array();
     }
     if (empty($res)) {
         return array();
     }
     foreach ($res as $i => &$checkin) {
         $scm = self::getScmCheckinByName($checkin['isc_reponame']);
         // add ADDED and REMOVED fields
         $checkin['added'] = !isset($checkin['isc_old_version']);
         $checkin['removed'] = !isset($checkin['isc_new_version']);
         $checkin['isc_commit_msg'] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($checkin['isc_commit_msg'])));
         $checkin['checkout_url'] = $scm->getCheckoutUrl($checkin);
         $checkin['diff_url'] = $scm->getDiffUrl($checkin);
         $checkin['scm_log_url'] = $scm->getLogUrl($checkin);
     }
     return $res;
 }
/**
 * Selects a mail queue entry from the table and returns the contents.
 * 
 * @param   string $id The mail queue entry ID.
 * @return  A string containing the body.
 */
function getMailQueue($id)
{
    if (Auth::getCurrentRole() < User::getRoleID('Developer')) {
        return;
    }
    $res = Mail_Queue::getEntry($id);
    if (!empty($_GET["ec_id"])) {
        return Link_Filter::processText(Auth::getCurrentProject(), nl2br(htmlspecialchars($_GET["ec_id"] . ":" . $id . ":" . $res["maq_headers"] . "\n" . $res["maq_body"])));
    } else {
        return $res["maq_body"];
    }
}
 /**
  * Method used to get the full list of requirements and impact analysis for
  * a specific issue.
  *
  * @access  public
  * @param   integer $issue_id The issue ID
  * @return  array The full list of requirements
  */
 function getListing($issue_id)
 {
     $stmt = "SELECT\n                    isr_id,\n                    isr_requirement,\n                    isr_dev_time,\n                    isr_impact_analysis,\n                    CONCAT(A.en_firstname,' ', A.en_lastname) AS submitter_name,\n                     CONCAT(B.en_firstname,' ', B.en_lastname) AS handler_name\n                 FROM\n                    (\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_requirement,\n                    " . ETEL_USER_TABLE_NOSUB . " A\n                    )\n                 LEFT JOIN\n                    " . ETEL_USER_TABLE_NOSUB . " B\n                 ON\n                    isr_updated_usr_id=B.en_ID\n                 WHERE\n                    isr_iss_id=" . Misc::escapeInteger($issue_id) . " AND\n                    isr_usr_id=A.en_ID";
     $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return "";
     } else {
         if (count($res) == 0) {
             return "";
         } else {
             for ($i = 0; $i < count($res); $i++) {
                 $res[$i]["isr_requirement"] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($res[$i]["isr_requirement"])));
                 $res[$i]["isr_impact_analysis"] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($res[$i]["isr_impact_analysis"])));
                 $res[$i]["formatted_dev_time"] = Misc::getFormattedTime($res[$i]["isr_dev_time"]);
             }
             return $res;
         }
     }
 }
Example #12
0
 /**
  * Method used to get the full list of checkins associated with an issue.
  *
  * @access  public
  * @param   integer $issue_id The issue ID
  * @return  array The list of checkins
  */
 function getCheckinList($issue_id)
 {
     $setup = Setup::load();
     $stmt = "SELECT\n                    *\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_checkin\n                 WHERE\n                    isc_iss_id=" . Misc::escapeInteger($issue_id) . "\n                 ORDER BY\n                    isc_created_date ASC";
     $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return "";
     } else {
         if (empty($res)) {
             return "";
         } else {
             for ($i = 0; $i < count($res); $i++) {
                 $res[$i]["isc_commit_msg"] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($res[$i]["isc_commit_msg"])));
                 @($res[$i]["checkout_url"] = SCM::parseURL($setup["checkout_url"], $res[$i]));
                 @($res[$i]["diff_url"] = SCM::parseURL($setup["diff_url"], $res[$i]));
                 $res[$i]["isc_created_date"] = Date_API::getFormattedDate($res[$i]["isc_created_date"]);
             }
             return $res;
         }
     }
 }
 /**
  * Callback function to be used from template class.
  * 
  * @access  public
  * @param   string $text The text to process
  * @return  string the processed text.
  */
 function activateLinks($text)
 {
     return Link_Filter::processText(Auth::getCurrentProject(), $text);
 }
 /**
  * Method used to get the full listing of phone support entries 
  * associated with a specific issue.
  *
  * @access  public
  * @param   integer $issue_id The issue ID
  * @return  array The list of notes
  */
 function getListing($issue_id)
 {
     $stmt = "SELECT\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "phone_support.*,\n                    usr_full_name,\n                    phc_title,\n                    iss_prj_id\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "phone_support,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_phone_category,\n                    " . ETEL_USER_TABLE . ",\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\n                 WHERE\n                    phs_iss_id=iss_id AND\n                    iss_prj_id=phc_prj_id AND\n                    phs_phc_id=phc_id AND\n                    phs_usr_id=usr_id AND\n                    phs_iss_id=" . Misc::escapeInteger($issue_id) . "\n                 ORDER BY\n                    phs_created_date ASC";
     $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return "";
     } else {
         for ($i = 0; $i < count($res); $i++) {
             $res[$i]["phs_description"] = Misc::activateLinks(nl2br(htmlspecialchars($res[$i]["phs_description"])));
             $res[$i]["phs_description"] = Link_Filter::processText($res[$i]['iss_prj_id'], $res[$i]["phs_description"]);
             $res[$i]["phs_created_date"] = Date_API::getFormattedDate($res[$i]["phs_created_date"]);
         }
         return $res;
     }
 }