if (in_array('draft', $_REQUEST['activity_types'])) {
     $sql = "SELECT\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "email_draft.*,\n                    iss_summary,\n                    sta_color\n                FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "email_draft,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "status\n                WHERE\n                    iss_sta_id = sta_id AND\n                    emd_iss_id = iss_id AND\n                    iss_prj_id = {$prj_id} AND\n";
     $sql .= createWhereClause('emd_updated_date', 'emd_usr_id');
     $res = $GLOBALS["db_api"]->dbh->getAll($sql, DB_FETCHMODE_ASSOC);
     if (PEAR::isError($res)) {
         print_r($res);
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
     } else {
         $data['draft'] = processResult($res, 'emd_updated_date', 'emd_iss_id');
         for ($i = 0; $i < count($data['draft']); $i++) {
             if (!empty($data['draft'][$i]['emd_unknown_user'])) {
                 $data['draft'][$i]['from'] = $data['draft'][$i]["emd_unknown_user"];
             } else {
                 $data['draft'][$i]['from'] = User::getFromHeader($data['draft'][$i]['emd_usr_id']);
             }
             list($data['draft'][$i]['to'], ) = Draft::getEmailRecipients($data['draft'][$i]['emd_id']);
             if (empty($data['draft'][$i]['to'])) {
                 $data['draft'][$i]['to'] = "Notification List";
             }
         }
     }
 }
 if (in_array('time', $_REQUEST['activity_types'])) {
     $sql = "SELECT\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "time_tracking.*,\n                    ttc_title,\n                    iss_summary,\n                    usr_full_name,\n                    sta_color\n                FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "time_tracking,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "time_tracking_category,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue,\n                    " . ETEL_USER_TABLE . ",\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "status\n                WHERE\n                    iss_sta_id = sta_id AND\n                    ttr_iss_id = iss_id AND\n                    ttr_ttc_id = ttc_id AND\n                    ttr_usr_id = usr_id AND\n                    iss_prj_id = {$prj_id} AND\n";
     $sql .= createWhereClause('ttr_created_date', 'ttr_usr_id');
     $res = $GLOBALS["db_api"]->dbh->getAll($sql, DB_FETCHMODE_ASSOC);
     if (PEAR::isError($res)) {
         print_r($res);
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
     } else {
         $data['time'] = processResult($res, 'ttr_created_date', 'ttr_iss_id');
Example #2
0
 private function draftActivity()
 {
     $sql = "SELECT\n                    {{%email_draft}}.*,\n                    iss_summary,\n                    sta_color\n                FROM\n                    {{%email_draft}},\n                    {{%issue}},\n                    {{%status}}\n                WHERE\n                    iss_sta_id = sta_id AND\n                    emd_iss_id = iss_id AND\n                    iss_prj_id = ? AND\n";
     $params = array($this->prj_id);
     $this->createWhereClause($sql, $params, 'emd_updated_date', 'emd_usr_id');
     $res = DB_Helper::getInstance()->getAll($sql, $params);
     $this->processResult($res, 'emd_updated_date', 'emd_iss_id');
     foreach ($res as &$draft) {
         if (!empty($draft['emd_unknown_user'])) {
             $draft['from'] = $draft['emd_unknown_user'];
         } else {
             $draft['from'] = User::getFromHeader($draft['emd_usr_id']);
         }
         list($draft['to']) = Draft::getEmailRecipients($draft['emd_id']);
         if (empty($draft['to'])) {
             $draft['to'] = 'Notification List';
         }
     }
     return $res;
 }
Example #3
0
 /**
  * Returns a list of drafts associated with an issue.
  *
  * @access  public
  * @param   integer $issue_id The ID of the issue.
  * @param   boolean $show_all If all draft statuses should be shown
  * @return  array An array of drafts.
  */
 function getList($issue_id, $show_all = false)
 {
     $issue_id = Misc::escapeInteger($issue_id);
     $stmt = "SELECT\n                    emd_id,\n                    emd_usr_id,\n                    emd_subject,\n                    emd_updated_date,\n                    emd_unknown_user,\n                    emd_status\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "email_draft\n                 WHERE\n                    emd_iss_id={$issue_id}\n";
     if ($show_all == false) {
         $stmt .= "AND emd_status = 'pending'\n";
     }
     $stmt .= "ORDER BY\n                    emd_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 {
         for ($i = 0; $i < count($res); $i++) {
             $res[$i]["emd_updated_date"] = Date_API::getFormattedDate($res[$i]["emd_updated_date"]);
             if (!empty($res[$i]['emd_unknown_user'])) {
                 $res[$i]['from'] = $res[$i]["emd_unknown_user"];
             } else {
                 $res[$i]['from'] = User::getFromHeader($res[$i]['emd_usr_id']);
             }
             list($res[$i]['to'], ) = Draft::getEmailRecipients($res[$i]['emd_id']);
             if (empty($res[$i]['to'])) {
                 $res[$i]['to'] = "Notification List";
             }
         }
         return $res;
     }
 }