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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
<?php
$block_name = _("Notes Summary");
/**
* Implementation of Horde_Block api to show notes summary.
*
* $Horde: mnemo/lib/Block/summary.php,v 1.22.8.9 2008/05/20 22:02:10 jan Exp $
*
* @package Horde_Block
*/
class Horde_Block_Mnemo_summary extends Horde_Block {
var $_app = 'mnemo';
function _title()
{
global $registry;
return Horde::link(Horde::url($registry->getInitialPage(), true)) .
htmlspecialchars($registry->get('name')) . '</a>';
}
function _params()
{
require_once dirname(__FILE__) . '/../base.php';
require_once 'Horde/Prefs/CategoryManager.php';
$cManager = new Prefs_CategoryManager();
$categories = array();
foreach ($cManager->get() as $c) {
$categories[$c] = $c;
}
return array('show_actions' => array(
'type' => 'checkbox',
'name' => _("Show action buttons?"),
'default' => 1),
'show_notepad' => array(
'type' => 'checkbox',
'name' => _("Show notepad name?"),
'default' => 1),
'show_categories' => array(
'type' => 'multienum',
'name' => _("Show notes from these categories"),
'default' => array(),
'values' => $categories));
}
function _content()
{
require_once dirname(__FILE__) . '/../base.php';
global $prefs;
require_once 'Horde/Prefs/CategoryManager.php';
$cManager = new Prefs_CategoryManager();
$colors = $cManager->colors();
$fgcolors = $cManager->fgColors();
if (!empty($this->_params['show_notepad'])) {
$shares = &Horde_Share::singleton('mnemo');
}
$html = '';
$memos = Mnemo::listMemos($prefs->getValue('sortby'),
$prefs->getValue('sortdir'));
foreach ($memos as $id => $memo) {
if (!empty($this->_params['show_categories']) &&
!in_array($memo['category'], $this->_params['show_categories'])) {
continue;
}
$html .= '<tr>';
if (!empty($this->_params['show_actions'])) {
$editurl = Util::addParameter(
'memo.php',
array('memo' => $memo['memo_id'],
'memolist' => $memo['memolist_id']));
$html .= '<td width="1%">'
. Horde::link(htmlspecialchars(Horde::applicationUrl(Util::addParameter($editurl, 'actionID', 'modify_memo'), true)), _("Edit Note"))
. Horde::img('edit.png', _("Edit Note"), '',
$GLOBALS['registry']->getImageDir('horde'))
. '</a></td>';
}
if (!empty($this->_params['show_notepad'])) {
$owner = $memo['memolist_id'];
$share = &$shares->getShare($owner);
if (!is_a($share, 'PEAR_Error')) {
$owner = $share->get('name');
}
$html .= '<td>' . htmlspecialchars($owner) . '</td>';
}
$viewurl = Util::addParameter(
'view.php',
array('memo' => $memo['memo_id'],
'memolist' => $memo['memolist_id']));
$html .= '<td>'
. Horde::linkTooltip(
htmlspecialchars(Horde::applicationUrl($viewurl, true)),
'', '', '', '',
$memo['body'] != $memo['desc'] ? Mnemo::getNotePreview($memo) : '')
. (strlen($memo['desc']) ? htmlspecialchars($memo['desc']) : '<em>' . _("Empty Note") . '</em>')
. '</a></td><td width="1%" class="category'
. md5($memo['category']) . '">'
. htmlspecialchars($memo['category'] ? $memo['category'] : _("Unfiled"))
. "</td></tr>\n";
}
if (!$memos) {
return '<p><em>' . _("No notes to display") . '</em></p>';
}
return '<link href="'
. htmlspecialchars(Horde::applicationUrl('themes/categoryCSS.php',
true))
. '" rel="stylesheet" type="text/css" />'
. '<table cellspacing="0" width="100%" class="linedRow">' . $html
. '</table>';
}
}
|