1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
12: class Ansel_Block_RecentFaces extends Horde_Core_Block
13: {
14: 15:
16: public function __construct($app, $params = array())
17: {
18: parent::__construct($app, $params);
19:
20: $this->enabled = !empty($GLOBALS['conf']['faces']['driver']);
21: $this->_name = _("Recent faces");
22: }
23:
24: 25:
26: protected function _params()
27: {
28: return array(
29: 'limit' => array(
30: 'name' => _("Maximum number of faces"),
31: 'type' => 'int',
32: 'default' => 10
33: )
34: );
35: }
36:
37: 38:
39: protected function _content()
40: {
41: $faces = $GLOBALS['injector']->getInstance('Ansel_Faces');
42: $results = $faces->allFaces(0, $this->_params['limit']);
43: $html = '';
44: foreach ($results as $face) {
45: $facename = htmlspecialchars($face['face_name']);
46: $html .= '<a href="' . Ansel_Faces::getLink($face) . '" title="' . $facename . '">'
47: . '<img src="' . $faces->getFaceUrl($face['image_id'], $face['face_id'])
48: . '" style="padding-bottom: 5px; padding-left: 5px" alt="' . $facename . '" /></a>';
49: }
50:
51: return $html;
52: }
53:
54: }
55: