File: ProjectLabelsPlugin.class.php

package info (click to toggle)
fusionforge 5.3.2%2B20141104-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 60,472 kB
  • sloc: php: 271,846; sql: 36,817; python: 14,575; perl: 6,406; sh: 5,980; xml: 4,294; pascal: 1,411; makefile: 911; cpp: 52; awk: 27
file content (40 lines) | stat: -rw-r--r-- 1,291 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php

class ProjectLabelsPlugin extends Plugin {
	function ProjectLabelsPlugin () {
		$this->Plugin() ;
		$this->name = "projectlabels" ;
		$this->text = "Project labels";
		$this->hooks[] = "project_before_widgets" ;
		$this->hooks[] = "site_admin_option_hook" ;
	}

	function CallHook ($hookname, &$params) {
		global $HTML;

		if ($hookname == "site_admin_option_hook") {
			echo '<li>' . util_make_link ('/plugins/projectlabels/index.php',
						      _('Project labels'). ' [' . _('Project labels plugin') . ']') . '</li>';
		} elseif ($hookname == "project_before_widgets") {
			$group_id=$params['group_id'];
			$project = group_get_object($group_id);
			if (!$project || !is_object($project))
				return;
			if ($project->isError())
				return;
			if (!$project->isProject())
				return;
			$res_tabs = db_query_params ('SELECT plugin_projectlabels_labels.label_text FROM plugin_projectlabels_labels, plugin_projectlabels_group_labels
					      WHERE plugin_projectlabels_group_labels.group_id=$1 AND plugin_projectlabels_group_labels.label_id = plugin_projectlabels_labels.label_id',
						     array ($group_id));
			while ($row_tab = db_fetch_array($res_tabs)) {
				print ($row_tab['label_text']);
			}
		}
	}
}

// Local Variables:
// mode: php
// c-file-style: "bsd"
// End: