| @@ 26-84 (lines=59) @@ | ||
| 23 | /** |
|
| 24 | * Class FanChartModule |
|
| 25 | */ |
|
| 26 | class FanChartModule extends AbstractModule implements ModuleChartInterface { |
|
| 27 | /** |
|
| 28 | * How should this module be labelled on tabs, menus, etc.? |
|
| 29 | * |
|
| 30 | * @return string |
|
| 31 | */ |
|
| 32 | public function getTitle() { |
|
| 33 | return /* I18N: Name of a module/chart */ I18N::translate('Fan chart'); |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * A sentence describing what this module does. |
|
| 38 | * |
|
| 39 | * @return string |
|
| 40 | */ |
|
| 41 | public function getDescription() { |
|
| 42 | return /* I18N: Description of the “FamilyBookChart” module */ I18N::translate('A fan chart of an individual’s ancestors.'); |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * What is the default access level for this module? |
|
| 47 | * |
|
| 48 | * Some modules are aimed at admins or managers, and are not generally shown to users. |
|
| 49 | * |
|
| 50 | * @return int |
|
| 51 | */ |
|
| 52 | public function defaultAccessLevel() { |
|
| 53 | return Auth::PRIV_PRIVATE; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * Return a menu item for this chart. |
|
| 58 | * |
|
| 59 | * We can only do this if the GD2 library is installed with TrueType support. |
|
| 60 | * |
|
| 61 | * @return Menu|null |
|
| 62 | */ |
|
| 63 | public function getChartMenu(Individual $individual) { |
|
| 64 | if (function_exists('imagettftext')) { |
|
| 65 | return new Menu( |
|
| 66 | $this->getTitle(), |
|
| 67 | 'fanchart.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), |
|
| 68 | 'menu-chart-fanchart', |
|
| 69 | array('rel' => 'nofollow') |
|
| 70 | ); |
|
| 71 | } else { |
|
| 72 | return null; |
|
| 73 | } |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * Return a menu item for this chart - for use in individual boxes. |
|
| 78 | * |
|
| 79 | * @return Menu|null |
|
| 80 | */ |
|
| 81 | public function getBoxChartMenu(Individual $individual) { |
|
| 82 | return $this->getChartMenu($individual); |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| @@ 26-78 (lines=53) @@ | ||
| 23 | /** |
|
| 24 | * Class TimelineChartModule |
|
| 25 | */ |
|
| 26 | class TimelineChartModule extends AbstractModule implements ModuleChartInterface { |
|
| 27 | /** |
|
| 28 | * How should this module be labelled on tabs, menus, etc.? |
|
| 29 | * |
|
| 30 | * @return string |
|
| 31 | */ |
|
| 32 | public function getTitle() { |
|
| 33 | return /* I18N: Name of a module/chart */ I18N::translate('Timeline'); |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * A sentence describing what this module does. |
|
| 38 | * |
|
| 39 | * @return string |
|
| 40 | */ |
|
| 41 | public function getDescription() { |
|
| 42 | return /* I18N: Description of the “TimelineChart” module */ I18N::translate('A timeline displaying individual events.'); |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * What is the default access level for this module? |
|
| 47 | * |
|
| 48 | * Some modules are aimed at admins or managers, and are not generally shown to users. |
|
| 49 | * |
|
| 50 | * @return int |
|
| 51 | */ |
|
| 52 | public function defaultAccessLevel() { |
|
| 53 | return Auth::PRIV_PRIVATE; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * Return a menu item for this chart. |
|
| 58 | * |
|
| 59 | * @return Menu|null |
|
| 60 | */ |
|
| 61 | public function getChartMenu(Individual $individual) { |
|
| 62 | return new Menu( |
|
| 63 | $this->getTitle(), |
|
| 64 | 'timeline.php?pids%5B%5D=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), |
|
| 65 | 'menu-chart-timeline', |
|
| 66 | array('rel' => 'nofollow') |
|
| 67 | ); |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * Return a menu item for this chart - for use in individual boxes. |
|
| 72 | * |
|
| 73 | * @return Menu|null |
|
| 74 | */ |
|
| 75 | public function getBoxChartMenu(Individual $individual) { |
|
| 76 | return null; |
|
| 77 | } |
|
| 78 | } |
|
| 79 | ||