本文整理汇总了PHP中Category::getAssocList方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::getAssocList方法的具体用法?PHP Category::getAssocList怎么用?PHP Category::getAssocList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category
的用法示例。
在下文中一共展示了Category::getAssocList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAssocCategory
/**
* Method used to get an associative array of the list of categories and the
* total number of issues associated with each of them.
*
* @param boolean $hide_closed If closed issues should be hidden.
* @return array List of categories
*/
public static function getAssocCategory($hide_closed = false)
{
$prj_id = Auth::getCurrentProject();
$list = Category::getAssocList($prj_id);
$stats = array();
foreach ($list as $prc_id => $prc_title) {
$stmt = 'SELECT
COUNT(*) AS total_items
FROM
{{%issue}},
{{%status}}
WHERE
iss_sta_id = sta_id AND
iss_prj_id=? AND
iss_prc_id=?';
if ($hide_closed) {
$stmt .= ' AND
sta_is_closed = 0';
}
$res = (int) DB_Helper::getInstance()->getOne($stmt, array($prj_id, $prc_id));
if ($res > 0) {
$stats[$prc_title] = $res;
}
}
arsort($stats);
return $stats;
}
示例2: getColumnsToDisplay
/**
* Returns the columns that should be displayed for the specified page.
* This method will remove columns that should not be displayed, due to
* lack of customer integration or insufficient role.
*
* @param integer $prj_id The ID of the project.
* @param string $page The page to return columns for.
* @return array An array of columns that should be displayed.
*/
public static function getColumnsToDisplay($prj_id, $page)
{
static $returns;
// poor man's caching system
if (!empty($returns[$prj_id][$page])) {
return $returns[$prj_id][$page];
}
$current_role = Auth::getCurrentRole();
$data = self::getSelectedColumns($prj_id, $page);
$has_customer_integration = CRM::hasCustomerIntegration($prj_id);
$only_with_customers = array('iss_customer_id', 'support_level');
// remove groups if there are no groups in the system.
if (count(Group::getAssocList($prj_id)) < 1) {
unset($data['iss_grp_id']);
}
// remove category column if there are no categories in the system
if (count(Category::getAssocList($prj_id)) < 1) {
unset($data['prc_title']);
}
// remove custom fields column if there are no custom fields
if (count(Custom_Field::getFieldsToBeListed($prj_id)) < 1) {
unset($data['custom_fields']);
}
// remove customer field if user has a role of customer
if ($current_role == User::getRoleID('Customer')) {
unset($data['iss_customer_id']);
}
foreach ($data as $field => $info) {
// remove fields based on role
if ($info['min_role'] > $current_role) {
unset($data[$field]);
continue;
}
// remove fields based on customer integration
if (!$has_customer_integration && in_array($field, $only_with_customers)) {
unset($data[$field]);
continue;
}
// get title
$data[$field] = self::getColumnInfo($page, $field);
if (!isset($data[$field]['width'])) {
$data[$field]['width'] = '';
}
}
$returns[$prj_id][$page] = $data;
return $data;
}
示例3: Template_Helper
* @copyright (c) Eventum Team
* @license GNU General Public License, version 2 or later (GPL-2+)
*
* For the full copyright and license information,
* please see the COPYING and AUTHORS files
* that were distributed with this source code.
*/
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/anonymous.tpl.html');
Auth::checkAuthentication();
@($prj_id = $_POST['prj_id'] ? $_POST['prj_id'] : $_GET['prj_id']);
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_MANAGER) {
Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
if (@$_POST['cat'] == 'update') {
$res = Project::updateAnonymousPost($prj_id);
$tpl->assign('result', $res);
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the information was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the information.'), Misc::MSG_ERROR)));
}
// load the form fields
$tpl->assign('project', Project::getDetails($prj_id));
$tpl->assign('cats', Category::getAssocList($prj_id));
$tpl->assign('priorities', Priority::getList($prj_id));
$tpl->assign('users', Project::getUserAssocList($prj_id, 'active'));
$tpl->assign('options', Project::getAnonymousPostOptions($prj_id));
$tpl->assign('prj_id', $prj_id);
$tpl->displayTemplate();
示例4: Template_API
// | 59 Temple Place - Suite 330 |
// | Boston, MA 02111-1307, USA. |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com> |
// +----------------------------------------------------------------------+
//
// @(#) $Id: s.searchbar.php 1.3 03/09/26 02:06:54-00:00 jpradomaia $
//
include_once "config.inc.php";
include_once APP_INC_PATH . "db_access.php";
include_once APP_INC_PATH . "class.template.php";
include_once APP_INC_PATH . "class.auth.php";
include_once APP_INC_PATH . "class.category.php";
include_once APP_INC_PATH . "class.priority.php";
include_once APP_INC_PATH . "class.misc.php";
include_once APP_INC_PATH . "class.release.php";
include_once APP_INC_PATH . "class.project.php";
include_once APP_INC_PATH . "class.filter.php";
include_once APP_INC_PATH . "class.status.php";
$tpl = new Template_API();
$tpl->setTemplate("searchbar.tpl.html");
Auth::checkAuthentication(APP_COOKIE);
$prj_id = Auth::getCurrentProject();
$tpl->assign("priorities", Priority::getList($prj_id));
$tpl->assign("status", Status::getAssocStatusList($prj_id));
$tpl->assign("users", Project::getUserAssocList($prj_id));
$tpl->assign("categories", Category::getAssocList($prj_id));
$tpl->assign("custom", Filter::getListing($prj_id));
$options = Issue::saveSearchParams();
$tpl->assign("options", $options);
$tpl->displayTemplate();
示例5: elseif
$info['rlc_rmf_id'] = $HTTP_GET_VARS['field'];
} else {
$HTTP_GET_VARS['field'] = $info['rlc_rmf_id'];
}
$tpl->assign("info", $info);
}
if (!empty($HTTP_GET_VARS['field'])) {
$field_title = Reminder_Condition::getFieldTitle($HTTP_GET_VARS['field']);
if (Reminder_Condition::canFieldBeCompared($HTTP_GET_VARS['field'])) {
$tpl->assign(array('show_field_options' => 'yes', 'comparable_fields' => Reminder_Condition::getFieldAdminList(true)));
} elseif (strtolower($field_title) == 'status') {
$prj_id = Reminder::getProjectID($rem_id);
$tpl->assign(array('show_status_options' => 'yes', 'statuses' => Status::getAssocStatusList($prj_id)));
} elseif (strtolower($field_title) == 'category') {
$prj_id = Reminder::getProjectID($rem_id);
$tpl->assign(array('show_category_options' => 'yes', 'categories' => Category::getAssocList($prj_id)));
} else {
$tpl->assign('show_status_options', 'no');
}
if (@$HTTP_GET_VARS["cat"] != "edit") {
$tpl->assign('info', array('rlc_rmf_id' => $HTTP_GET_VARS['field'], 'rlc_rmo_id' => '', 'rlc_value' => ''));
}
}
$tpl->assign("rem_id", $rem_id);
$tpl->assign("rma_id", $rma_id);
$tpl->assign("rem_title", Reminder::getTitle($rem_id));
$tpl->assign("rma_title", Reminder_Action::getTitle($rma_id));
$tpl->assign("fields", Reminder_Condition::getFieldAdminList());
$tpl->assign("operators", Reminder_Condition::getOperatorAdminList());
$tpl->assign("list", Reminder_Condition::getAdminList($rma_id));
} else {
示例6: getListing
//.........这里部分代码省略.........
$sort_by = 'cf_sort.' . Custom_Field::getDBValueFieldNameByType($fld_details['fld_type']);
} else {
$sort_by = Misc::escapeString($options['sort_by']);
}
$stmt .= '
GROUP BY
iss_id
ORDER BY
' . $sort_by . ' ' . Misc::escapeString($options['sort_order']) . ',
iss_id DESC';
$total_rows = Pager::getTotalRows($stmt);
$stmt .= '
LIMIT
' . Misc::escapeInteger($max) . ' OFFSET ' . Misc::escapeInteger($start);
try {
$res = DB_Helper::getInstance()->getAll($stmt);
} catch (DbException $e) {
return array('list' => null, 'info' => null, 'csv' => null);
}
if (count($res) > 0) {
Issue::getAssignedUsersByIssues($res);
Time_Tracking::fillTimeSpentByIssues($res);
// need to get the customer titles for all of these issues...
if (CRM::hasCustomerIntegration($prj_id)) {
$crm = CRM::getInstance($prj_id);
$crm->processListIssuesResult($res);
}
Issue::formatLastActionDates($res);
Issue::getLastStatusChangeDates($prj_id, $res);
} elseif ($current_row > 0) {
// if there are no results, and the page is not the first page reset page to one and reload results
Auth::redirect("list.php?pagerRow=0&rows={$max}");
}
$groups = Group::getAssocList($prj_id);
$categories = Category::getAssocList($prj_id);
$column_headings = array();
$columns_to_display = Display_Column::getColumnsToDisplay($prj_id, 'list_issues');
foreach ($columns_to_display as $col_key => $column) {
if ($col_key == 'custom_fields' && count($custom_fields) > 0) {
foreach ($custom_fields as $fld_id => $fld_title) {
$column_headings['cstm_' . $fld_id] = $fld_title;
}
} else {
$column_headings[$col_key] = $column['title'];
}
}
$csv[] = @implode("\t", $column_headings);
if (@$options['hide_excerpts'] != 1 && self::doesBackendSupportExcerpts() == true) {
$excerpts = self::getFullTextExcerpts();
}
foreach ($res as &$row) {
$issue_id = $row['iss_id'];
$row['time_spent'] = Misc::getFormattedTime($row['time_spent']);
$row['iss_created_date'] = Date_Helper::getFormattedDate($row['iss_created_date']);
$row['iss_expected_resolution_date'] = Date_Helper::getSimpleDate($row['iss_expected_resolution_date'], false);
$row['excerpts'] = isset($excerpts[$issue_id]) ? $excerpts[$issue_id] : '';
$fields = array();
foreach (array_keys($columns_to_display) as $col_key) {
switch ($col_key) {
case 'pri_rank':
$col_key = 'pri_title';
break;
case 'assigned':
$col_key = 'assigned_users';
break;
case 'sta_rank':
示例7: getActiveFilters
/**
* Returns an array of active filters
*
* @param array $options The options array
* @return array
*/
public static function getActiveFilters($options)
{
$prj_id = Auth::getCurrentProject();
$filter_info = self::getFiltersInfo();
$return = array();
foreach ($filter_info as $filter_key => $filter) {
$display = false;
if (isset($filter['param']) && isset($options[$filter['param']])) {
$filter_details = $options[$filter['param']];
}
if (isset($filter['is_custom'])) {
// custom fields
$fld_id = $filter['fld_id'];
if (!isset($options['custom_field'][$fld_id]) || empty($options['custom_field'][$fld_id])) {
continue;
} elseif ($filter['fld_type'] == 'date' && empty($options['custom_field'][$fld_id]['Year'])) {
continue;
} elseif ($filter['fld_type'] == 'integer') {
if (!isset($options['custom_field'][$fld_id]['value']) || empty($options['custom_field'][$fld_id]['value'])) {
continue;
} else {
$filter_details = $options['custom_field'][$fld_id];
switch ($filter_details['filter_type']) {
case 'ge':
$display = ev_gettext('%1$s or greater', $filter_details['value']);
break;
case 'le':
$display = ev_gettext('%1$s or less', $filter_details['value']);
break;
case 'gt':
$display = ev_gettext('Greater than %1$s', $filter_details['value']);
break;
case 'lt':
$display = ev_gettext('Less than %1$s', $filter_details['value']);
break;
default:
$display = $filter_details['value'];
}
}
} elseif (in_array($filter['fld_type'], array('multiple', 'combo'))) {
$display = implode(', ', Custom_Field::getOptions($fld_id, $options['custom_field'][$fld_id]));
} else {
$display = $options['custom_field'][$fld_id];
}
} elseif (!isset($options[$filter['param']]) || empty($options[$filter['param']]) || in_array($filter_key, array('sort_order', 'sort_by', 'rows', 'search_type'))) {
continue;
} elseif (isset($filter['is_date']) && $filter['is_date'] == true) {
if (!empty($filter_details['Year']) || isset($filter_details['time_period'])) {
switch ($filter_details['filter_type']) {
case 'in_past':
$display = ev_gettext('In Past %1$s hours', $filter_details['time_period']);
break;
case 'null':
$display = ev_gettext('Is NULL');
break;
case 'between':
$end = $options[$filter['param'] . '_end'];
$display = ev_gettext('Is between %1$s-%2$s-%3$s AND %4$s-%5$s-%6$s', $filter_details['Year'], $filter_details['Month'], $filter_details['Day'], $end['Year'], $end['Month'], $end['Day']);
break;
case 'greater':
$display = ev_gettext('Is greater than %1$s-%2$s-%3$s', $filter_details['Year'], $filter_details['Month'], $filter_details['Day']);
break;
case 'less':
$display = ev_gettext('Is less than %1$s-%2$s-%3$s', $filter_details['Year'], $filter_details['Month'], $filter_details['Day']);
}
}
} elseif ($filter['param'] == 'status') {
$statuses = Status::getAssocStatusList($prj_id);
$display = $statuses[$filter_details];
} elseif ($filter['param'] == 'category') {
$categories = Category::getAssocList($prj_id);
if (is_array($filter_details)) {
$active_categories = array();
foreach ($filter_details as $category) {
$active_categories[] = $categories[$category];
}
$display = implode(', ', $active_categories);
} else {
$display = $categories[$filter_details];
}
} elseif ($filter['param'] == 'priority') {
$priorities = Priority::getAssocList($prj_id);
$display = $priorities[$filter_details];
} elseif ($filter['param'] == 'severity') {
$severities = Severity::getAssocList($prj_id);
$display = $severities[$filter_details];
} elseif ($filter['param'] == 'users') {
if ($filter_details == -1) {
$display = ev_gettext('un-assigned');
} elseif ($filter_details == -2) {
$display = ev_gettext('myself and un-assigned');
} elseif ($filter_details == -3) {
$display = ev_gettext('myself and my group');
} elseif ($filter_details == -4) {
//.........这里部分代码省略.........
示例8: Template_Helper
*
* For the full copyright and license information,
* please see the COPYING and AUTHORS files
* that were distributed with this source code.
*/
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('reports/category_statuses.tpl.html');
Auth::checkAuthentication();
if (!Access::canAccessReports(Auth::getUserID())) {
echo 'Invalid role';
exit;
}
// TODO: move this query to some class
$prj_id = Auth::getCurrentProject();
$categories = Category::getAssocList($prj_id);
$statuses = Status::getAssocStatusList($prj_id, true);
$data = array();
foreach ($categories as $cat_id => $cat_title) {
$data[$cat_id] = array('title' => $cat_title, 'statuses' => array());
foreach ($statuses as $sta_id => $sta_title) {
$sql = 'SELECT
count(*)
FROM
{{%issue}}
WHERE
iss_prj_id = ? AND
iss_sta_id = ? AND
iss_prc_id = ?';
try {
$res = DB_Helper::getInstance()->getOne($sql, array($prj_id, $sta_id, $cat_id));
示例9: getListing
/**
* Method used to get the list of issues to be displayed in the grid layout.
*
* @access public
* @param integer $prj_id The current project ID
* @param array $options The search parameters
* @param integer $current_row The current page number
* @param integer $max The maximum number of rows per page
* @return array The list of issues to be displayed
*/
function getListing($prj_id, $options, $current_row = 0, $max = 5, $get_reporter = FALSE)
{
if (strtoupper($max) == "ALL") {
$max = 9999999;
}
$start = $current_row * $max;
// get the current user's role
$usr_id = Auth::getUserID();
$role_id = User::getRoleByUser($usr_id, $prj_id);
// get any custom fields that should be displayed
$custom_fields = Custom_Field::getFieldsToBeListed($prj_id);
$stmt = "SELECT\n iss_id,\n iss_grp_id,\n iss_prj_id,\n iss_sta_id,\n iss_customer_id,\n iss_created_date,\n iss_updated_date,\n iss_last_response_date,\n iss_closed_date,\n iss_last_customer_action_date,\n iss_usr_id,\n iss_summary,\n pri_title,\n prc_title,\n sta_title,\n sta_color status_color,\n sta_id,\n iqu_status,\n grp_name `group`,\n pre_title,\n iss_last_public_action_date,\n iss_last_public_action_type,\n iss_last_internal_action_date,\n iss_last_internal_action_type,\n " . Issue::getLastActionFields() . ",\n IF(iss_last_internal_action_date > iss_last_public_action_date, 'internal', 'public') AS action_type,\n iss_private,\n CONCAT(en_firstname,' ', en_lastname) as usr_full_name,\n iss_percent_complete,\n iss_dev_time,\n iss_expected_resolution_date\n FROM\n (\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue,\n " . ETEL_USER_TABLE_NOSUB . "";
// join custom fields if we are searching by custom fields
if (is_array($options['custom_field']) && count($options['custom_field']) > 0) {
foreach ($options['custom_field'] as $fld_id => $search_value) {
if (empty($search_value)) {
continue;
}
$field = Custom_Field::getDetails($fld_id);
if ($field['fld_type'] == 'date' && (empty($search_value['Year']) || empty($search_value['Month']) || empty($search_value['Day']))) {
continue;
}
if ($field['fld_type'] == 'multiple') {
$search_value = Misc::escapeInteger($search_value);
foreach ($search_value as $cfo_id) {
$stmt .= ",\n" . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_custom_field as cf" . $fld_id . '_' . $cfo_id . "\n";
}
} else {
$stmt .= ",\n" . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_custom_field as cf" . $fld_id . "\n";
}
}
}
$stmt .= ")";
// check for the custom fields we want to sort by
if (strstr($options['sort_by'], 'custom_field') !== false) {
$fld_id = str_replace("custom_field_", '', $options['sort_by']);
$stmt .= "\n LEFT JOIN \n" . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_custom_field as cf_sort\n ON\n (cf_sort.icf_iss_id = iss_id AND cf_sort.icf_fld_id = {$fld_id}) \n";
}
// START ETEL MODIFIED
if (!empty($options["show_authorized_issues"]) || $role_id <= User::getRoleID("Standard User") && Project::getSegregateReporters($prj_id)) {
$stmt .= "\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user_replier\n ON\n iur_iss_id=iss_id\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user\n ON\n isu_iss_id=iss_id";
} else {
if (!empty($options["users"])) {
$stmt .= "\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user\n ON\n isu_iss_id=iss_id";
}
}
// END ETEL MODIFIED
if (!empty($options["show_notification_list_issues"])) {
$stmt .= "\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "subscription\n ON\n sub_iss_id=iss_id";
}
$stmt .= "\n LEFT JOIN\n " . APP_DEFAULT_DB . ".`" . APP_TABLE_PREFIX . "group`\n ON\n iss_grp_id=grp_id\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_category\n ON\n iss_prc_id=prc_id\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_release\n ON\n iss_pre_id = pre_id\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "status\n ON\n iss_sta_id=sta_id\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_priority\n ON\n iss_pri_id=pri_id\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_quarantine\n ON\n iss_id=iqu_iss_id AND\n (iqu_expiration > '" . Date_API::getCurrentDateGMT() . "' OR iqu_expiration IS NULL)\n WHERE\n iss_prj_id= " . Misc::escapeInteger($prj_id);
$stmt .= Issue::buildWhereClause($options);
//echo $stmt;
if (strstr($options["sort_by"], 'custom_field') !== false) {
$sort_by = 'cf_sort.icf_value';
} else {
$sort_by = Misc::escapeString($options["sort_by"]);
}
$stmt .= "\n GROUP BY\n iss_id\n ORDER BY\n " . $sort_by . " " . Misc::escapeString($options["sort_order"]) . ",\n iss_id DESC";
$total_rows = Pager::getTotalRows($stmt);
if ($max > 100) {
$max = 100;
}
$stmt .= "\n LIMIT\n " . Misc::escapeInteger($start) . ", " . Misc::escapeInteger($max);
$res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
// echo $stmt;
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return array("list" => "", "info" => "");
} else {
if (count($res) > 0) {
if ($get_reporter) {
Issue::getReportersByIssues($res);
}
Issue::getAssignedUsersByIssues($res);
Time_Tracking::getTimeSpentByIssues($res);
// need to get the customer titles for all of these issues...
if (Customer::hasCustomerIntegration($prj_id)) {
Customer::getCustomerTitlesByIssues($prj_id, $res);
}
Issue::formatLastActionDates($res);
Issue::getLastStatusChangeDates($prj_id, $res);
} elseif ($current_row > 0) {
// if there are no results, and the page is not the first page reset page to one and reload results
Auth::redirect(APP_RELATIVE_URL . "list.php?pagerRow=0&rows={$max}");
}
$groups = Group::getAssocList($prj_id);
$categories = Category::getAssocList($prj_id);
$column_headings = Issue::getColumnHeadings($prj_id);
if (count($custom_fields) > 0) {
//.........这里部分代码省略.........
示例10: array
// customers should not be able to see this page
$role_id = Auth::getCurrentRole();
if ($role_id < User::getRoleID('Standard User')) {
Auth::redirect(APP_RELATIVE_URL . "list.php");
}
$prj_id = Auth::getCurrentProject();
// generate options for assign list. If there are groups and user is above a customer, include groups
$groups = Group::getAssocList($prj_id);
$users = Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer'));
$assign_options = array("" => "Any", "-1" => "un-assigned", "-2" => "myself and un-assigned");
if (User::getGroupID(Auth::getUserID()) != '') {
$assign_options['-3'] = 'myself and my group';
$assign_options['-4'] = 'myself, un-assigned and my group';
}
if (count($groups) > 0 && $role_id > User::getRoleID("Customer")) {
foreach ($groups as $grp_id => $grp_name) {
$assign_options["grp:{$grp_id}"] = "Group: " . $grp_name;
}
}
$assign_options += $users;
$tpl->assign(array("cats" => Category::getAssocList($prj_id), "priorities" => Priority::getList($prj_id), "status" => Status::getAssocStatusList($prj_id), "users" => $assign_options, "releases" => Release::getAssocList($prj_id, TRUE), "custom" => Filter::getListing($prj_id), "custom_fields" => Custom_Field::getListByProject($prj_id, ''), "reporters" => Project::getReporters($prj_id)));
if (!empty($HTTP_GET_VARS["custom_id"])) {
$check_perm = true;
if (Filter::isGlobal($HTTP_GET_VARS["custom_id"])) {
if ($role_id >= User::getRoleID('Manager')) {
$check_perm = false;
}
}
$tpl->assign("options", Filter::getDetails($HTTP_GET_VARS["custom_id"], $check_perm));
}
$tpl->displayTemplate();
示例11:
$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']);
}
示例12: getAssocCategory
/**
* Method used to get an associative array of the list of categories and the
* total number of issues associated with each of them.
*
* @access public
* @return array List of categories
*/
function getAssocCategory()
{
$prj_id = Auth::getCurrentProject();
$list = Category::getAssocList($prj_id);
$stats = array();
foreach ($list as $prc_id => $prc_title) {
$stmt = "SELECT\n COUNT(*) AS total_items\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\n WHERE\n iss_prj_id={$prj_id} AND\n iss_prc_id=" . $prc_id;
$res = (int) $GLOBALS["db_api"]->dbh->getOne($stmt);
if ($res > 0) {
$stats[$prc_title] = $res;
}
}
arsort($stats);
return $stats;
}
示例13: array
// generate options for assign list. If there are groups and user is above a customer, include groups
$groups = Group::getAssocList($prj_id);
$users = Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer'));
$assign_options = array('' => ev_gettext('Any'), '-1' => ev_gettext('un-assigned'), '-2' => ev_gettext('myself and un-assigned'));
if (Auth::isAnonUser()) {
unset($assign_options['-2']);
} elseif (User::getGroupID(Auth::getUserID()) != '') {
$assign_options['-3'] = ev_gettext('myself and my group');
$assign_options['-4'] = ev_gettext('myself, un-assigned and my group');
}
if (count($groups) > 0 && $role_id > User::getRoleID('Customer')) {
foreach ($groups as $grp_id => $grp_name) {
$assign_options["grp:{$grp_id}"] = 'Group: ' . $grp_name;
}
}
$assign_options += $users;
$tpl->assign(array('cats' => Category::getAssocList($prj_id), 'priorities' => Priority::getList($prj_id), 'severities' => Severity::getList($prj_id), 'status' => Status::getAssocStatusList($prj_id), 'users' => $assign_options, 'releases' => Release::getAssocList($prj_id, true), 'custom' => Filter::getListing($prj_id), 'custom_fields' => Custom_Field::getListByProject($prj_id, ''), 'reporters' => Project::getReporters($prj_id), 'products' => Product::getAssocList(false)));
if (!empty($_GET['custom_id'])) {
$check_perm = true;
if (Filter::isGlobal($_GET['custom_id'])) {
if ($role_id >= User::getRoleID('Manager')) {
$check_perm = false;
}
}
$options = Filter::getDetails($_GET['custom_id'], $check_perm);
} else {
$options = array();
$options['cst_rows'] = APP_DEFAULT_PAGER_SIZE;
}
$tpl->assign('options', $options);
$tpl->displayTemplate();
示例14: list
}
// if we are dealing with just one message, use the subject line as the
// summary for the issue, and the body as the description
if (count($HTTP_GET_VARS["item"]) == 1) {
$email_details = Support::getEmailDetails(Email_Account::getAccountByEmail($HTTP_GET_VARS["item"][0]), $HTTP_GET_VARS["item"][0]);
$tpl->assign(array('issue_summary' => $email_details['sup_subject'], 'issue_description' => $email_details['message']));
// also auto pre-fill the customer contact text fields
if (Customer::hasCustomerIntegration($prj_id)) {
$sender_email = Mail_API::getEmailAddress($email_details['sup_from']);
list(, $contact_id) = Customer::getCustomerIDByEmails($prj_id, array($sender_email));
if (!empty($contact_id)) {
$tpl->assign("contact_details", Customer::getContactDetails($prj_id, $contact_id));
}
}
}
}
}
$tpl->assign(array("cats" => Category::getAssocList($prj_id), "priorities" => Priority::getAssocList($prj_id), "users" => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), "releases" => Release::getAssocList($prj_id), "custom_fields" => Custom_Field::getListByProject($prj_id, 'report_form'), "max_attachment_size" => Attachment::getMaxAttachmentSize(), "field_display_settings" => Project::getFieldDisplaySettings($prj_id), "groups" => Group::getAssocList($prj_id)));
$setup = Setup::load();
$tpl->assign("allow_unassigned_issues", @$setup["allow_unassigned_issues"]);
$prefs = Prefs::get($usr_id);
$tpl->assign("user_prefs", $prefs);
$tpl->assign("zones", Date_API::getTimezoneList());
if (User::getRole(Auth::getCurrentRole()) == "Customer") {
$customer_contact_id = User::getCustomerContactID($usr_id);
$tpl->assign("contact_details", Customer::getContactDetails($prj_id, $customer_contact_id));
$customer_id = User::getCustomerID($usr_id);
$tpl->assign("contacts", Customer::getContactEmailAssocList($prj_id, $customer_id));
$tpl->assign(array("customer_id" => User::getCustomerID($usr_id), "contact_id" => User::getCustomerContactID($usr_id)));
}
$tpl->displayTemplate();
示例15: moveIssue
/**
* Move the issue to a new project
*
* @param integer $issue_id
* @param integer $new_prj_id
* @return integer 1 on success, -1 otherwise
*/
public function moveIssue($issue_id, $new_prj_id)
{
$stmt = 'UPDATE
{{%issue}}
SET
iss_prj_id = ?
WHERE
iss_id = ?';
try {
DB_Helper::getInstance()->query($stmt, array($new_prj_id, $issue_id));
} catch (DbException $e) {
return -1;
}
$currentDetails = self::getDetails($issue_id);
// set new category
$new_iss_prc_list = Category::getAssocList($new_prj_id);
$iss_prc_title = Category::getTitle($currentDetails['iss_prc_id']);
$new_prc_id = array_search($iss_prc_title, $new_iss_prc_list);
if ($new_prc_id === false) {
// use the first category listed in the new project
$new_prc_id = key($new_iss_prc_list);
}
// set new priority
$new_iss_pri_list = Priority::getAssocList($new_prj_id);
$iss_pri_title = Priority::getTitle($currentDetails['iss_pri_id']);
$new_pri_id = array_search($iss_pri_title, $new_iss_pri_list);
if ($new_pri_id === false) {
// use the first category listed in the new project
$new_pri_id = key($new_iss_pri_list);
}
// XXX: Set status if needed when moving issue
$stmt = 'UPDATE
{{%issue}}
SET
iss_prc_id=?,
iss_pri_id=?
WHERE
iss_id=?';
DB_Helper::getInstance()->query($stmt, array($new_prc_id, $new_pri_id, $issue_id));
// clear project cache
self::getProjectID($issue_id, true);
Notification::notifyNewIssue($new_prj_id, $issue_id);
return 1;
}