function reportBugFormTop($p_event, $p_project_id) { # allow to change reporter_id (if access level is higher than defined) $t_user_id = auth_get_current_user_id(); $t_access_level = user_get_access_level($t_user_id, $p_project_id); if ($t_access_level >= plugin_config_get('select_threshold')) { ?> <tr <?php echo helper_alternate_class(); ?> > <td class="category" width="30%"> <?php echo lang_get('reporter'); ?> </td> <td width="70%"> <select <?php echo helper_get_tab_index(); ?> name="reporter_id"> <?php print_reporter_option_list($t_user_id, $p_project_id); ?> </select> </td> </tr> <?php } }
public function display(BugData $p_bug, $p_columns_target) { plugin_push_current('RelationshipColumnView'); $p_bug_id = $p_bug->id; echo GetRelationshipContent($p_bug_id, plugin_config_get('ShowRelationshipsColorful'), $p_columns_target == COLUMNS_TARGET_VIEW_PAGE, plugin_config_get('ShowRelationships'), plugin_config_get('ShowRelationshipIcons')); plugin_pop_current(); }
function background() { if (plugin_config_get('ShowBackgroundImage')) { echo '<link rel="stylesheet" href="' . BACKGROUNDIMAGEVIEW_PLUGIN_URL . 'css/BackgroundImageView.css">' . "\n"; } return null; }
/** * Export Issues Menu * @return array */ function export_issues_menu() { if (!access_has_project_level(plugin_config_get('export_threshold'))) { return array(); } return array('<a href="' . plugin_page('export') . '">' . plugin_lang_get('export') . '</a>'); }
/** * If the whiteboard menu plugin isnt installed, show the storyboard menu instead * * @return null|string */ function menu() { if (!plugin_is_installed('WhiteboardMenu') && plugin_config_get('ShowMenu') && $this->getUserHasLevel()) { return '<a href="' . plugin_page('storyboard_index') . '">' . plugin_lang_get('menu_title') . '</a>'; } return null; }
/** * @param $value * @param $constant */ public function updateDynamicValues($value, $constant) { $column_amount = plugin_config_get('CAmount'); for ($columnIndex = 1; $columnIndex <= $column_amount; $columnIndex++) { $act_value = $value . $columnIndex; $this->updateValue($act_value, $constant); } }
function add_lightbox($event) { $currentUrl = explode('/', $_SERVER['PHP_SELF']); if (end($currentUrl) !== 'view.php') { return; } return ' <script type="text/javascript">' . 'var lightbox_display_on_img_preview = ' . plugin_config_get('display_on_img_preview') . ';' . 'var lightbox_display_on_img_link = ' . plugin_config_get('display_on_img_link') . ';' . 'var lightboxlocation = "' . plugin_file('lightbox/js/lightbox-min.js') . '";' . 'var lightboxExtensions = "' . plugin_config_get('img_extensions') . '";' . '</script>' . '<link href="' . plugin_file('lightbox/css/lightbox.css') . '" rel="stylesheet">' . '<script type="text/javascript" src="' . plugin_file('Lightbox.js') . '"></script>'; }
function options() { plugin_push_current('CustomerManagement'); if (access_has_global_level(plugin_config_get('view_customer_fields_threshold'))) { $options = array(1 => lang_get('yes'), 2 => lang_get('no')); } plugin_pop_current(); return $options; }
/** * Load the theme file */ function loadTheme() { global $g_css_include_file; $themes = getcwd() . "/css/themes/"; $active_theme = plugin_config_get('active_theme'); if (file_exists($themes . $active_theme)) { $g_css_include_file = "css/themes/" . $active_theme . "/default.css"; } }
function menu_main() { $t_links = array(); if (plugin_config_get('show_gantt_roadmap_link') && access_has_project_level(config_get('view_summary_threshold'))) { $t_page = plugin_page('summary_gantt_chart_page', false, 'GanttChart'); $t_lang = plugin_lang_get('menu', 'GanttChart'); $t_links[] = "<a href=\"{$t_page}\">{$t_lang}</a>"; } return $t_links; }
/** * Create the onload script to initialize jQuery Decorate plugin. */ function onload($p_event) { $selectors = explode(';', plugin_config_get('selectors')); $decorators = explode(';', plugin_config_get('decorators')); $html = ''; for ($i = 0; $i < count($selectors); $i++) { $html .= '$("' . $selectors[$i] . '").decorate({cssClass: "' . $decorators[$i] . '"});' . "\n"; } return $html; }
function menu() { require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'userprojectapi.php'; if (!userprojectapi::checkPluginIsRegisteredInWhiteboardMenu()) { userprojectapi::addPluginToWhiteboardMenu(); } if ((!plugin_is_installed('WhiteboardMenu') || !file_exists(config_get_global('plugin_path') . 'WhiteboardMenu')) && plugin_config_get('ShowMenu') && $this->getUserHasLevel()) { return '<a href="' . plugin_page('UserProject') . '&sortVal=userName&sort=ASC">' . plugin_lang_get('menu_title') . '</a>'; } return null; }
/** * L'envoi d'une requête sur un site externe doit être autorisé via les headers http ! */ function prepareHeaders(){ foreach(headers_list() as $header){ if(strpos($header, "X-Content-Security-Policy:") === 0){ $header = str_replace("allow 'self';", "allow 'self' ".plugin_config_get('piwikUrl').";",$header); header($header); break; } } }
function options() { plugin_push_current('CustomerManagement'); if (access_has_global_level(plugin_config_get('view_customer_fields_threshold'))) { $options = array(); foreach (CustomerManagementDao::findAllGroups() as $group) { $options[$group['id']] = $group['name']; } } plugin_pop_current(); return $options; }
public function display($p_bug, $p_columns_target) { plugin_push_current('CustomerManagement'); if (access_has_global_level(plugin_config_get('view_customer_fields_threshold'))) { $bugData = CustomerManagementDao::getBugData($p_bug->id); if (count($bugData) > 0) { $isBillable = CustomerManagementDao::getService($bugData['is_billable']); echo string_display_line($isBillable ? lang_get('yes') : lang_get('no')); } } plugin_pop_current(); }
/** * Create the resource link to load the jQuery library. */ function resources($p_event) { $html = ''; $use_cdn = plugin_config_get('use_cdn'); if ($use_cdn) { $html .= '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/' . $this->version . '/jquery.min.js"></script>' . "\n"; } else { $html .= '<script type="text/javascript" src="' . plugin_file('script.js') . '"</script>' . "\n"; } $html .= $this->render_ready_function(); return $html; }
public function display($p_bug, $p_columns_target) { plugin_push_current('CustomerManagement'); if (access_has_global_level(plugin_config_get('view_customer_fields_threshold'))) { $bugData = CustomerManagementDao::getBugData($p_bug->id); if (count($bugData) > 0) { $group = CustomerManagementDao::getGroupForCustomer($bugData['customer_id']); echo string_display_line($group['name']); } } plugin_pop_current(); }
function reminder_print_status_option_list($p_name) { $t_enum_values = MantisEnum::getValues(config_get('status_enum_string')); $t_selection = plugin_config_get($p_name); echo '<select name="' . $p_name . '[]" multiple="multiple" size="' . count($t_enum_values) . '">'; foreach ($t_enum_values as $t_key) { $t_elem2 = get_enum_element('status', $t_key); echo '<option value="' . $t_key . '"'; reminder_check_selected($t_selection, $t_key); echo '>' . $t_elem2 . '</option>'; } echo '</select>'; }
function query($p_filter_input) { $invoice = $p_filter_input; if (is_blank($invoice)) { return; } plugin_push_current('CustomerManagement'); if (access_has_global_level(plugin_config_get('view_customer_fields_threshold'))) { $t_query = CustomerManagementDao::buildFilterArrayForInvoice($invoice); } plugin_pop_current(); return $t_query; }
function menu_main() { $t_links = array(); if (plugin_config_get('show_repo_link')) { $t_page = plugin_page('index', false, 'Source'); $t_lang = plugin_lang_get('repositories', 'Source'); $t_links[] = "<a href=\"{$t_page}\">{$t_lang}</a>"; } if (plugin_config_get('show_search_link')) { $t_page = plugin_page('search_page', false, 'Source'); $t_lang = plugin_lang_get('search', 'Source'); $t_links[] = "<a href=\"{$t_page}\">{$t_lang}</a>"; } return $t_links; }
function add_columns() { $t_project_id = helper_get_current_project(); $t_user_id = auth_get_current_user_id(); $t_user_has_level = user_get_access_level($t_user_id, $t_project_id) >= plugin_config_get('RelationshipColumnAccessLevel', PLUGINS_RELATIONSHIPCOLUMNVIEW_THRESHOLD_LEVEL_DEFAULT); $t_result = array(); if (plugin_config_get('ShowRelationshipColumn') == gpc_get_int('ShowRelationshipColumn', ON) && $t_user_has_level) { if ('1.2.' == substr(MANTIS_VERSION, 0, 4)) { require_once 'classes' . DIRECTORY_SEPARATOR . 'RelationshipColumn.class.1.2.0.php'; } else { require_once 'classes' . DIRECTORY_SEPARATOR . 'RelationshipColumn.class.1.3.0.php'; } $t_result[] = 'RelationshipColumn'; } return $t_result; }
function getDeveloperSprintCapacity($taskUnit) { $t_mantis_custom_field_string_table = db_get_table('mantis_custom_field_string_table'); # Fetch User Story Information $userstory = $this->checkForUserStory($this->us_id); $this->getAdditionalProjectFields(); $t_params = array($this->spr, $userstory['sprint'], $this->developer); # Add Condition to WHERE-Clause if ($this->id > 0) { $addSql = " AND id != " . db_param(3); $t_params[] = $this->id; } # Fetch all Tasks and sum up Rest Capacity $t_sql = "SELECT sum(rest_capacity) AS rest_capacity \n\t\t\t\t\tFROM {$t_mantis_custom_field_string_table} \n\t\t\t\t\tLEFT JOIN gadiv_tasks ON bug_id = us_id \n\t\t\t\t\tWHERE field_id = " . db_param(0) . " \n\t\t\t\t\tAND value = " . db_param(1) . " \n\t\t\t\t\tAND us_id IS NOT NULL \n\t\t\t\t\tAND status < 4 \n\t\t\t\t\tAND developer_id = " . db_param(2) . " " . $addSql . "\n\t\t\t\t\tGROUP BY field_id"; $sprint = $this->executeQuery($t_sql, $t_params); # Fetch Sprint Start and End $t_sql = "SELECT start, enddate as " . AGILEMANTIS_END_FIELD . ", team_id, status \n\t\t\t\t\tFROM gadiv_sprints \n\t\t\t\t\tWHERE name = " . db_param(0); $t_params = array($userstory['sprint']); $sprintinfo = $this->executeQuery($t_sql, $t_params); # Set correct Start date for Capacity if ($sprintinfo[0]['status'] == 0) { $date_start = $sprintinfo[0]['start']; } if ($sprintinfo[0]['status'] == 1) { $date_start = $this->getNormalDateFormat(date('Y-m-d')); } if ($sprintinfo[0]['status'] == 2) { return true; } # Fetch Developer Capacity in a Sprint $t_sql = "SELECT sum(capacity) AS capacity \n\t\t\t\t\tFROM gadiv_rel_user_team_capacity \n\t\t\t\t\tWHERE user_id = " . db_param(0) . " \n\t\t\t\t\tAND team_id = " . db_param(1) . " \n\t\t\t\t\tAND date >= " . db_param(2) . " \n\t\t\t\t\tAND date <= " . db_param(3) . "\n\t\t\t\t\tGROUP BY user_id"; $t_params = array($this->developer, $sprintinfo[0]['team_id'], $date_start, $sprintinfo[0]['end']); $developer = $this->executeQuery($t_sql, $t_params); # If Unit is "T", calculate result with workday hours if ($taskUnit == 'T') { $multiplier = str_replace(',', '.', plugin_config_get('gadiv_workday_in_hours')); } else { $multiplier = 1; } # Check if Sprint Rest Capacity + New Planned Capacity is larger than Developer Capacity if (($sprint[0]['rest_capacity'] + $this->rest_capacity) * $multiplier > $developer[0]['capacity']) { return false; } return true; }
/** * Builds notification emails for the selected customers about changes made in bugs reports they are linked to * * @param array $customer_ids the ids of the customer to notify * @param string $from the start of the interval * @param string $to the end of the interval * * @return array notified customers */ static function buildNotificationEmails($customer_ids, $from, $to) { $emails = array(); lang_push(plugin_config_get('email_notification_language')); $fromDate = self::startOfDay(strtotime($from)); $toDate = self::endOfDay(strtotime($to)); $changedBugIds = CustomerManagementDao::findAllChangedBugIds($customer_ids, $fromDate, $toDate); $dateFormat = config_get('short_date_format'); foreach ($customer_ids as $customer_id) { $changesForCustomer = array(); foreach ($changedBugIds as $changedBugId) { if ($changedBugId['customer_id'] == $customer_id) { $changesForCustomer[] = array('bug' => bug_get($changedBugId['bug_id'])); } } if (count($changesForCustomer) > 0) { $counter = 0; $text = ''; foreach ($changesForCustomer as $changeForCustomer) { $counter++; $bugId = $changeForCustomer['bug']->id; $text .= $counter . '. '; $text .= sprintf(plugin_lang_get('email_notification_bug_header'), $changeForCustomer['bug']->id, $changeForCustomer['bug']->summary, date($dateFormat, $changeForCustomer['bug']->date_submitted), get_enum_element('status', $changeForCustomer['bug']->status)); $text .= "\n"; $reporterName = user_get_name($changeForCustomer['bug']->reporter_id); $reporterEmail = user_get_email($changeForCustomer['bug']->reporter_id); $text .= sprintf(plugin_lang_get('email_notification_bug_reported_by'), $reporterName, $reporterEmail); $text .= "\n"; $text .= sprintf(plugin_lang_get('email_notification_bug_description'), $changeForCustomer['bug']->description); $text .= "\n\n"; } $customer = CustomerManagementDao::getCustomer($customer_id); $email = new EmailData(); $email->email = $customer['email']; $email->subject = sprintf(plugin_lang_get('email_notification_title'), $customer['name'], $from, $to); $email->body = $text; $email->metadata['priority'] = config_get('mail_priority'); $email->metadata['charset'] = 'utf-8'; array_push($emails, $email); } } lang_pop(); return $emails; }
/** * Returns an array of time tracking stats * @param int $p_project_id project id * @param string $p_from Starting date (yyyy-mm-dd) inclusive, if blank, then ignored. * @param string $p_to Ending date (yyyy-mm-dd) inclusive, if blank, then ignored. * @return array array of bugnote stats * @access public */ function plugin_TimeTracking_stats_get_project_array($p_project_id, $p_from, $p_to) { $c_project_id = db_prepare_int($p_project_id); $c_to = "'" . date("Y-m-d", strtotime("{$p_to}") + SECONDS_PER_DAY - 1) . "'"; $c_from = "'" . $p_from . "'"; //strtotime( $p_from ) if ($c_to === false || $c_from === false) { error_parameters(array($p_form, $p_to)); trigger_error(ERROR_GENERIC, ERROR); } $t_timereport_table = plugin_table('data', 'TimeTracking'); $t_bug_table = db_get_table('mantis_bug_table'); $t_user_table = db_get_table('mantis_user_table'); $t_project_table = db_get_table('mantis_project_table'); if (!is_blank($c_from)) { $t_from_where = " AND expenditure_date >= {$c_from}"; } else { $t_from_where = ''; } if (!is_blank($c_to)) { $t_to_where = " AND expenditure_date <= {$c_to}"; } else { $t_to_where = ''; } if (ALL_PROJECTS != $c_project_id) { $t_project_where = " AND b.project_id = '{$c_project_id}' "; } else { $t_project_where = ''; } if (!access_has_global_level(plugin_config_get('view_others_threshold'))) { $t_user_id = auth_get_current_user_id(); $t_user_where = " AND user = '******' "; } else { $t_user_where = ''; } $t_results = array(); $query = "SELECT u.username, p.name as project_name, bug_id, expenditure_date, hours, timestamp, info \nFROM {$t_timereport_table} tr, {$t_bug_table} b, {$t_user_table} u, {$t_project_table} p\nWHERE tr.bug_id=b.id and tr.user=u.id AND p.id = b.project_id\n{$t_project_where} {$t_from_where} {$t_to_where} {$t_user_where}\nORDER BY user, expenditure_date, bug_id"; $result = db_query($query); while ($row = db_fetch_array($result)) { $t_results[] = $row; } return $t_results; }
function worklogmenu() { if (ON == plugin_config_get('promote_text')) { $bugid = gpc_get_int('id'); if (access_has_bug_level(plugin_config_get('promote_threshold'), $bugid)) { $t_bug_p = bug_get($bugid, true); if (OFF == plugin_config_get('project_text')) { $proj_id = 0; } else { $proj_id = $t_bug_p->project_id; } $subject = urlencode($t_bug_p->description); $subject .= " "; $subject .= urlencode($t_bug_p->additional_information); $content = category_full_name($t_bug_p->category_id); $content .= " -> "; $content .= urlencode($t_bug_p->summary); if (ON == plugin_config_get('worklog_view_check')) { $import_page = 'worklog_add_page2.php'; } else { $import_page = 'worklog_add.php'; } $import_page .= '&log_type=0&'; $import_page .= '&ref_log_ids='; $import_page .= '&ref_issue_ids='; $import_page .= '&log_begin='; $import_page .= '&log_end='; $import_page .= '&content='; $import_page .= $content; $import_page .= '&subject='; $import_page .= $subject; $import_page .= '&project_id='; $import_page .= $proj_id; if (ON == plugin_config_get('worklog_view_check')) { return array(plugin_lang_get('import_worklog') => plugin_page($import_page) . '" target=_new>'); } else { return array(plugin_lang_get('import_worklog') => plugin_page($import_page)); } } } }
function display_bug_id($p_event, $p_text) { $p_bug_id = (int) $p_text; if (!bug_exists($p_bug_id)) { return $p_text; } $bug = bug_get($p_bug_id); $project = $bug->__get("project_id"); if ($project != plugin_config_get('project_id')) { return $p_text; } $p_field_id = plugin_config_get('field_id'); $prefix = plugin_config_get('prefix'); $has_parent = false; $t_bugs_ids = relationship_get_all_src($p_bug_id); foreach ($t_bugs_ids as $t_relaship) { if ($t_relaship->type == BUG_BLOCKS) { $has_parent = true; break; } } $t_bugs_ids = relationship_get_all_dest($p_bug_id); foreach ($t_bugs_ids as $t_relaship) { if ($t_relaship->type == BUG_DEPENDANT) { $has_parent = true; break; } } $prefix_two = plugin_config_get('prefix_two'); if ($has_parent) { $prefix = $prefix_two; } $p_def = custom_field_get_definition($p_field_id); $t_custom_field_value = custom_field_get_value($p_field_id, $p_bug_id); global $g_custom_field_type_definition; if (isset($g_custom_field_type_definition[$p_def['type']]['#function_string_value'])) { return $prefix . call_user_func($g_custom_field_type_definition[$p_def['type']]['#function_string_value'], $t_custom_field_value); } return $prefix . $t_custom_field_value; }
function print_users_in_group_option_list($usergroup_id) { if (plugin_config_get('assign_to_groups', '') == 1 && plugin_config_get('assign_group_threshold', '') <= user_get_access_level(auth_get_current_user_id())) { $show_groups = 1; } else { $show_groups = 0; } $t_table_users = plugin_table('users'); $t_user_table = db_get_table('mantis_user_table'); $query = "SELECT * FROM ("; $query .= " SELECT u.id, u.username, u.realname, ug.group_user_id"; $query .= " FROM {$t_user_table} AS u"; $query .= " LEFT JOIN {$t_table_users} AS ug ON (u.id=ug.user)"; //if( plugin_config_get('assign_to_groups', '') == 0 || plugin_config_get('assign_group_threshold','') > user_get_access_level( auth_get_current_user_id() ) ) if ($show_groups == 0) { $query .= " WHERE u.username NOT LIKE " . db_param(); } $query .= ") AS t1 WHERE group_user_id=" . db_param() . " OR group_user_id IS NULL ORDER BY username ASC"; if ($show_groups == 0) { $result = db_query_bound($query, array(plugin_config_get('group_prefix') . '%', (int) $usergroup_id)); } else { $result = db_query_bound($query, array((int) $usergroup_id)); } $count = db_num_rows($result); for ($i = 0; $i < $count; $i++) { $row = db_fetch_array($result); if ($row['id'] == $usergroup_id) { continue; //usergroup must not be nested with itself } echo '<option value="' . $row['id'] . '" '; if (!is_null($row['group_user_id'])) { echo 'selected="selected"'; } else { echo ''; } echo '>' . $row['username'] . '</option>'; } }
function menu() { if (plugin_config_get('show_menu')) { require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'wmApi.php'; $projectId = helper_get_current_project(); $userId = auth_get_current_user_id(); $userAccessLevel = user_get_access_level($userId, $projectId); $whiteboardPlugins = wmApi::getWhiteboardPlugins(); $showMenu = false; foreach ($whiteboardPlugins as $whiteboardPlugin) { $pluginAccessLevel = $whiteboardPlugin[2]; if (user_is_administrator($userId) || $userAccessLevel >= $pluginAccessLevel) { $showMenu = true; break; } } if ($showMenu) { return '<a href="' . plugin_page('whiteboard_menu') . '">' . plugin_lang_get('menu_title') . '</a>'; } } return null; }
function addAdditionalProjectFields($project_id) { $this->deleteAdditionalProjectFields($project_id); $this->getAdditionalProjectFields(); if ($project_id != "") { $this->addAdditionalProjectField($this->bv, $project_id); $this->addAdditionalProjectField($this->pb, $project_id); $this->addAdditionalProjectField($this->sp, $project_id); $this->addAdditionalProjectField($this->spr, $project_id); if (plugin_config_get('gadiv_presentable') == '1') { $this->addAdditionalProjectField($this->pr, $project_id); } if (plugin_config_get('gadiv_ranking_order') == '1') { $this->addAdditionalProjectField($this->ro, $project_id); } if (plugin_config_get('gadiv_technical') == '1') { $this->addAdditionalProjectField($this->tech, $project_id); } if (plugin_config_get('gadiv_release_documentation') == '1') { $this->addAdditionalProjectField($this->rld, $project_id); } if (plugin_config_get('gadiv_tracker_planned_costs') == '1') { $this->addAdditionalProjectField($this->pw, $project_id); } $this->addAdditionalProjectField($this->un, $project_id); } $this->bv = ""; $this->pb = ""; $this->sp = ""; $this->ro = ""; $this->pr = ""; $this->spr = ""; $this->tech = ""; $this->rld = ""; $this->pw = ""; $this->un = ""; }
function faqmenu() { if (ON == plugin_config_get('promote_text')) { $bugid = gpc_get_int('id'); if (access_has_bug_level(plugin_config_get('promote_threshold'), $bugid)) { $t_bug_p = bug_get($bugid, true); if (OFF == plugin_config_get('project_text')) { $proj_id = 0; } else { $proj_id = $t_bug_p->project_id; } $answer = urlencode($t_bug_p->description); $answer .= " "; $answer .= urlencode($t_bug_p->additional_information); $question = category_full_name($t_bug_p->category_id); $question .= " -> "; $question .= urlencode($t_bug_p->summary); if (ON == plugin_config_get('faq_view_check')) { $import_page = 'faq_add_page2.php'; } else { $import_page = 'faq_add.php'; } $import_page .= '&question='; $import_page .= $question; $import_page .= '&answere='; $import_page .= $answer; $import_page .= '&project_id='; $import_page .= $proj_id; if (ON == plugin_config_get('faq_view_check')) { return array(plugin_lang_get('import_faq') => plugin_page($import_page) . '" target=_new>'); } else { return array(plugin_lang_get('import_faq') => plugin_page($import_page)); } } } }