Repository navigation
Expand file tree
/
Copy pathController_Project.class.php
More file actions
91 lines (82 loc) · 2.09 KB
/
Copy pathController_Project.class.php
File metadata and controls
91 lines (82 loc) · 2.09 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/**
* Controller for displaying a project summary
*
* @author Christopher Han <xiphux@gmail.com>
* @copyright Copyright (c) 2010 Christopher Han
* @package GitPHP
* @subpackage Controller
*/
class GitPHP_Controller_Project extends GitPHP_ControllerBase
{
/**
* Gets the template for this controller
*
* @return string template filename
*/
protected function GetTemplate()
{
return 'project.tpl';
}
/**
* Gets the cache key for this controller
*
* @return string cache key
*/
protected function GetCacheKey()
{
return '';
}
/**
* Gets the name of this controller's action
*
* @param boolean $local true if caller wants the localized action name
* @return string action name
*/
public function GetName($local = false)
{
if ($local && $this->resource) {
return $this->resource->translate('summary');
}
return 'summary';
}
/**
* Loads data for this template
*/
protected function LoadData()
{
$head = $this->GetProject()->GetHeadCommit();
$this->tpl->assign('head', $head);
if (!$head)
$this->tpl->assign('enablesearch', false);
$compat = $this->GetProject()->GetCompat();
$strategy = null;
//if ($compat) {
$strategy = new GitPHP_LogLoad_Git($this->exe);
//} else {
// $strategy = new GitPHP_LogLoad_Raw();
//}
$revlist = new GitPHP_Log($this->GetProject(), $this->GetProject()->GetHeadCommit(), $strategy, 17);
if ($revlist->GetCount() > 16) {
$this->tpl->assign('hasmorerevs', true);
$revlist->SetLimit(16);
}
$this->tpl->assign('revlist', $revlist);
$taglist = $this->GetProject()->GetTagList()->GetOrderedTags('-creatordate', 17);
if ($taglist) {
if (count($taglist) > 16) {
$this->tpl->assign('hasmoretags', true);
$taglist = array_slice($taglist, 0, 16);
}
$this->tpl->assign('taglist', $taglist);
}
$headlist = $this->GetProject()->GetHeadList()->GetOrderedHeads('-committerdate', 17);
if ($headlist) {
if (count($headlist) > 17) {
$this->tpl->assign('hasmoreheads', true);
$headlist = array_slice($headlist, 0, 16);
}
$this->tpl->assign('headlist', $headlist);
}
}
}