本文整理汇总了PHP中Attachment::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP Attachment::getList方法的具体用法?PHP Attachment::getList怎么用?PHP Attachment::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachment
的用法示例。
在下文中一共展示了Attachment::getList方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFileList
/**
* @param int $issue_id
* @return array
* @access protected
*/
public function getFileList($issue_id)
{
AuthCookie::setProjectCookie(Issue::getProjectID($issue_id));
$res = Attachment::getList($issue_id);
if (empty($res)) {
throw new RemoteApiException('No files could be found');
}
return $res;
}
示例2:
$show_releases = 0;
}
// get if categories should be displayed
$cats = Category::getList($prj_id);
if (count($cats) > 0) {
$show_category = 1;
} else {
$show_category = 0;
}
$cookie = Auth::getCookieInfo(APP_PROJECT_COOKIE);
if (!empty($auto_switched_from)) {
$tpl->assign(array("project_auto_switched" => 1, "old_project" => Project::getName($auto_switched_from)));
}
$setup = Setup::load();
$tpl->assign("allow_unassigned_issues", @$setup["allow_unassigned_issues"]);
$tpl->assign(array('next_issue' => @$sides['next'], 'previous_issue' => @$sides['previous'], 'subscribers' => Notification::getSubscribers($issue_id), 'custom_fields' => Custom_Field::getListByIssue($prj_id, $issue_id), 'files' => Attachment::getList($issue_id), 'emails' => Support::getEmailsByIssue($issue_id), 'zones' => Date_API::getTimezoneList(), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'ema_id' => Email_Account::getEmailAccount(), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'show_releases' => $show_releases, 'show_category' => $show_category, 'categories' => Category::getAssocList($prj_id), 'quarantine' => Issue::getQuarantineInfo($issue_id)));
if ($role_id != User::getRoleID('customer')) {
if (@$_REQUEST['show_all_drafts'] == 1) {
$show_all_drafts = true;
} else {
$show_all_drafts = false;
}
if (Workflow::hasWorkflowIntegration($prj_id)) {
$statuses = Workflow::getAllowedStatuses($prj_id, $issue_id);
// if currently selected release is not on list, go ahead and add it.
} else {
$statuses = Status::getAssocStatusList($prj_id);
}
if (!empty($details['iss_sta_id']) && empty($statuses[$details['iss_sta_id']])) {
$statuses[$details['iss_sta_id']] = Status::getStatusTitle($details['iss_sta_id']);
}
示例3: getFileList
function getFileList($p)
{
$email = XML_RPC_decode($p->getParam(0));
$password = XML_RPC_decode($p->getParam(1));
$auth = authenticate($email, $password);
if (is_object($auth)) {
return $auth;
}
$issue_id = XML_RPC_decode($p->getParam(2));
createFakeCookie($email, Issue::getProjectID($issue_id));
$res = Attachment::getList($issue_id);
if (empty($res)) {
return new XML_RPC_Response(0, $XML_RPC_erruser + 1, "No files could be found");
} else {
return new XML_RPC_Response(XML_RPC_Encode($res));
}
}
示例4: getFileList
/**
* @param int $issue_id
* @return array
* @access protected
*/
public function getFileList($issue_id)
{
self::createFakeCookie(false, Issue::getProjectID($issue_id));
$res = Attachment::getList($issue_id);
if (empty($res)) {
throw new RemoteApiException('No files could be found');
}
return $res;
}
示例5: array
$columns[1][] = array('title' => ev_gettext('Associated Issues'), 'field' => 'associated_issues');
if (!isset($issue_fields_display['expected_resolution']) || $issue_fields_display['expected_resolution'] != false) {
$columns[1][] = array('title' => ev_gettext('Expected Resolution Date'), 'field' => 'expected_resolution');
}
if (!isset($issue_fields_display['estimated_dev_time']) || $issue_fields_display['estimated_dev_time'] != false) {
$columns[1][] = array('title' => ev_gettext('Estimated Dev. Time'), 'data' => empty($details['iss_dev_time']) ? '' : $details['iss_dev_time'] . ' hours', 'field' => 'estimated_dev_time');
}
if ($role_id > User::getRoleID('Customer')) {
$columns[1][] = array('title' => ev_gettext('Duplicates'), 'field' => 'duplicates', 'title_bgcolor' => APP_INTERNAL_COLOR);
$columns[1][] = array('title' => ev_gettext('Authorized Repliers'), 'field' => 'authorized_repliers', 'title_bgcolor' => APP_INTERNAL_COLOR);
}
$groups = Group::getAssocList($prj_id);
if ($role_id > User::getRoleID('Customer') && count($groups) > 0) {
$columns[1][] = array('title' => ev_gettext('Group'), 'data' => isset($details['group']) ? $details['group']['grp_name'] : '', 'title_bgcolor' => APP_INTERNAL_COLOR);
}
$tpl->assign(array('next_issue' => @$sides['next'], 'previous_issue' => @$sides['previous'], 'subscribers' => Notification::getSubscribers($issue_id), 'custom_fields' => Custom_Field::getListByIssue($prj_id, $issue_id), 'files' => Attachment::getList($issue_id), 'emails' => Support::getEmailsByIssue($issue_id), 'zones' => Date_Helper::getTimezoneList(), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'ema_id' => Email_Account::getEmailAccount(), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'quarantine' => Issue::getQuarantineInfo($issue_id), 'grid' => $columns, 'can_update' => Issue::canUpdate($issue_id, $usr_id), 'enabled_partners' => Partner::getPartnersByProject($prj_id), 'partners' => Partner::getPartnersByIssue($issue_id), 'issue_access' => Access::getIssueAccessArray($issue_id, $usr_id), 'is_user_notified' => Notification::isUserNotified($issue_id, $usr_id)));
if ($role_id != User::getRoleID('customer')) {
if (@$_COOKIE['show_all_drafts'] == 1) {
$show_all_drafts = true;
} else {
$show_all_drafts = false;
}
if (Workflow::hasWorkflowIntegration($prj_id)) {
$statuses = Workflow::getAllowedStatuses($prj_id, $issue_id);
// if currently selected release is not on list, go ahead and add it.
} else {
$statuses = Status::getAssocStatusList($prj_id, false);
}
if (!empty($details['iss_sta_id']) && empty($statuses[$details['iss_sta_id']])) {
$statuses[$details['iss_sta_id']] = Status::getStatusTitle($details['iss_sta_id']);
}
示例6: notifyNewIssue
/**
* Method used to send an email notification to users that want
* to be alerted when new issues are created in the system.
*
* @param integer $prj_id The project ID
* @param integer $issue_id The issue ID
* @param array $exclude_list The list of users NOT to notify.
* @return void
*/
public static function notifyNewIssue($prj_id, $issue_id, $exclude_list = array())
{
// get all users associated with this project
$stmt = "SELECT\n usr_id,\n usr_full_name,\n usr_email,\n pru_role,\n usr_customer_id,\n usr_customer_contact_id\n FROM\n {{%user}},\n {{%project_user}}\n WHERE\n pru_prj_id=? AND\n usr_id=pru_usr_id AND\n usr_status = 'active' AND\n pru_role > ?";
$params = array($prj_id, User::ROLE_CUSTOMER);
if (count($exclude_list) > 0) {
$stmt .= ' AND
usr_id NOT IN (' . DB_Helper::buildList($exclude_list) . ')';
$params = array_merge($params, $exclude_list);
}
$res = DB_Helper::getInstance()->getAll($stmt, $params);
$emails = array();
foreach ($res as $row) {
$subscriber = Mail_Helper::getFormattedName($row['usr_full_name'], $row['usr_email']);
// don't send these emails to customers
if ($row['pru_role'] == User::ROLE_CUSTOMER || !empty($row['usr_customer_id']) || !empty($row['usr_customer_contact_id'])) {
continue;
}
$prefs = Prefs::get($row['usr_id']);
if (!empty($prefs['receive_new_issue_email'][$prj_id]) && @$prefs['receive_new_issue_email'][$prj_id] && !in_array($subscriber, $emails)) {
$emails[] = $subscriber;
}
}
// get assignees
$stmt = "SELECT\n usr_id,\n usr_full_name,\n usr_email\n FROM\n {{%user}},\n {{%issue_user}}\n WHERE\n isu_iss_id=? AND\n usr_id=isu_usr_id AND\n usr_status = 'active'";
$res = DB_Helper::getInstance()->getAll($stmt, array($issue_id));
foreach ($res as $row) {
$subscriber = Mail_Helper::getFormattedName($row['usr_full_name'], $row['usr_email']);
$prefs = Prefs::get($row['usr_id']);
if (!empty($prefs['receive_assigned_email'][$prj_id]) && @$prefs['receive_assigned_email'][$prj_id] && !in_array($subscriber, $emails)) {
$emails[] = $subscriber;
}
}
// get any email addresses from products
$products = Product::getProductsByIssue($issue_id);
if (count($products) > 0) {
foreach ($products as $product) {
$emails[] = $product['pro_email'];
}
}
// get notification list members
$emails = array_merge($emails, self::getSubscribedNameEmails($issue_id));
// get any additional emails
$emails = array_merge($emails, Workflow::getAdditionalEmailAddresses($prj_id, $issue_id, 'new_issue'));
$data = Issue::getDetails($issue_id, true);
$data['attachments'] = Attachment::getList($issue_id);
// notify new issue to irc channel
$irc_notice = "New Issue #{$issue_id} (";
$quarantine = Issue::getQuarantineInfo($issue_id);
if (!empty($quarantine)) {
$irc_notice .= 'Quarantined; ';
}
$irc_notice .= 'Priority: ' . $data['pri_title'];
// also add information about the assignee, if any
$assignment = Issue::getAssignedUsers($issue_id);
if (count($assignment) > 0) {
$irc_notice .= '; Assignment: ' . implode(', ', $assignment);
}
if (!empty($data['iss_grp_id'])) {
$irc_notice .= '; Group: ' . Group::getName($data['iss_grp_id']);
}
$irc_notice .= '), ';
if (@isset($data['customer'])) {
$irc_notice .= $data['customer']['name'] . ', ';
}
$irc_notice .= $data['iss_summary'];
self::notifyIRC($prj_id, $irc_notice, $issue_id, false, false, 'new_issue');
$data['custom_fields'] = array();
// empty place holder so notifySubscribers will fill it in with appropriate data for the user
$subject = ev_gettext('New Issue');
// generate new Message-ID
$message_id = Mail_Helper::generateMessageID();
$headers = array('Message-ID' => $message_id);
self::notifySubscribers($issue_id, $emails, 'new_issue', $data, $subject, false, false, $headers);
}
示例7: activateAttachmentLinks
/**
* Callback function to be used from template class.
*
* @param string $text The text to process
* @param integer $issue_id The ID of the issue from where attachment list is taken
* @return string the processed text.
*/
public function activateAttachmentLinks($text, $issue_id)
{
// build list of files to replace, so duplicate matches will always
// take last matching filename.
$files = array();
foreach (Attachment::getList($issue_id) as $attachment) {
foreach ($attachment['files'] as $file) {
// TRANSLATORS: %1: iaf_filename, %2: iaf_filesize
$title = ev_gettext('download file (%1$s - %2$s)', $file['iaf_filename'], $file['iaf_filesize']);
$link = sprintf('<a class="link" target="_blank" title="%s" href="download.php?cat=attachment&id=%d">%s</a>', htmlspecialchars($title), htmlspecialchars($file['iaf_id']), htmlspecialchars($file['iaf_filename']));
$files[$file['iaf_filename']] = $link;
}
}
foreach ($files as $file => $link) {
// we use attachment prefix, so we don't accidentally match already processed urls
$text = preg_replace('/attachment:?\\s*' . preg_quote($file, '/') . '\\b/', $link, $text);
}
return $text;
}
示例8: notifyNewIssue
/**
* Method used to send an email notification to users that want
* to be alerted when new issues are created in the system.
*
* @access public
* @param integer $prj_id The project ID
* @param integer $issue_id The issue ID
* @param array $exclude_list The list of users NOT to notify.
* @return void
*/
function notifyNewIssue($prj_id, $issue_id, $exclude_list = array())
{
$prj_id = Misc::escapeInteger($prj_id);
$issue_id = Misc::escapeInteger($issue_id);
$exclude_list = Misc::escapeInteger($exclude_list);
// get all users associated with this project
$stmt = "SELECT\r\n usr_id,\r\n usr_full_name,\r\n usr_email,\r\n usr_preferences,\r\n pru_role,\r\n usr_customer_id,\r\n usr_customer_contact_id\r\n FROM\r\n " . ETEL_USER_TABLE . ",\r\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_user\r\n WHERE\r\n pru_prj_id={$prj_id} AND\r\n usr_id=pru_usr_id AND\r\n usr_status = 'active' AND\r\n pru_role > " . User::getRoleID("Customer");
if (count($exclude_list) > 0) {
$stmt .= " AND\r\n usr_id NOT IN (" . join(', ', $exclude_list) . ")";
}
$res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
$emails = array();
for ($i = 0; $i < count($res); $i++) {
@($res[$i]['usr_preferences'] = unserialize($res[$i]['usr_preferences']));
$subscriber = Mail_API::getFormattedName($res[$i]['usr_full_name'], $res[$i]['usr_email']);
// don't send these emails to customers
if ($res[$i]['pru_role'] == User::getRoleID('Customer') || !empty($res[$i]['usr_customer_id']) || !empty($res[$i]['usr_customer_contact_id'])) {
continue;
}
if (!empty($res[$i]['usr_preferences']['receive_new_emails'][$prj_id]) && @$res[$i]['usr_preferences']['receive_new_emails'][$prj_id] && !in_array($subscriber, $emails)) {
$emails[] = $subscriber;
}
}
// get assignees
$stmt = "SELECT\r\n usr_id,\r\n usr_full_name,\r\n usr_email,\r\n usr_preferences\r\n FROM\r\n " . ETEL_USER_TABLE . ",\r\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user\r\n WHERE\r\n isu_iss_id={$issue_id} AND\r\n usr_id=isu_usr_id AND\r\n usr_status = 'active'";
$res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
for ($i = 0; $i < count($res); $i++) {
@($res[$i]['usr_preferences'] = unserialize($res[$i]['usr_preferences']));
$subscriber = Mail_API::getFormattedName($res[$i]['usr_full_name'], $res[$i]['usr_email']);
if (!empty($res[$i]['usr_preferences']['receive_assigned_emails'][$prj_id]) && @$res[$i]['usr_preferences']['receive_assigned_emails'][$prj_id] && !in_array($subscriber, $emails)) {
$emails[] = $subscriber;
}
}
// get any additional emails
$emails = array_merge($emails, Workflow::getAdditionalEmailAddresses($prj_id, $issue_id, 'new_issue'));
$data = Issue::getDetails($issue_id, true);
$data['attachments'] = Attachment::getList($issue_id);
// notify new issue to irc channel
$irc_notice = "New Issue #{$issue_id} (";
$quarantine = Issue::getQuarantineInfo($issue_id);
if (!empty($quarantine)) {
$irc_notice .= "Quarantined; ";
}
$irc_notice .= "Priority: " . $data['pri_title'];
// also add information about the assignee, if any
$assignment = Issue::getAssignedUsers($issue_id);
if (count($assignment) > 0) {
$irc_notice .= "; Assignment: " . implode(', ', $assignment);
}
if (!empty($data['iss_grp_id'])) {
$irc_notice .= "; Group: " . Group::getName($data['iss_grp_id']);
}
$irc_notice .= "), ";
if (@isset($data['customer_info'])) {
$irc_notice .= $data['customer_info']['customer_name'] . ", ";
}
$irc_notice .= $data['iss_summary'];
Notification::notifyIRC($prj_id, $irc_notice, $issue_id);
$data['custom_fields'] = array();
// empty place holder so notifySubscribers will fill it in with appropriate data for the user
$subject = 'New Issue';
$headers = array("Message-ID" => $data['iss_root_message_id']);
Notification::notifySubscribers($issue_id, $emails, 'new_issue', $data, $subject, false, false, $headers);
}