.
*/
require_once 'Widget.class.php';
require_once $gfwww.'include/my_utils.php';
/**
* Widget_MyMonitoredDocuments
*
* Documents that are actively monitored
*/
class Widget_MyMonitoredDocuments extends Widget {
function __construct() {
$this->Widget('mymonitoreddocuments');
}
function getTitle() {
return _("Monitored Documents");
}
function getContent() {
$html_my_monitored_documents = '';
$result=db_query_params('select DISTINCT groups.group_name, docdata_vw.group_id from groups, docdata_vw, docdata_monitored_docman where docdata_monitored_docman.doc_id = docdata_vw.docid and groups.group_id = docdata_vw.group_id and docdata_monitored_docman.user_id = $1',array(user_getid()));
$rows=db_numrows($result);
if (!$result || $rows < 1) {
$html_my_monitored_documents .= '
' . _("You are not monitoring any documents.") . '
' . _("If you monitor documents, you will be sent new update in the form of an email.") . '
' . _("You can monitor documents by clicking on the appropriate icon action in the directory itself.") . '
';
} else {
$request =& HTTPRequest::instance();
$html_my_monitored_documents .= '';
$vItemId = new Valid_UInt('hide_item_id');
$vItemId->required();
if($request->valid($vItemId)) {
$hide_item_id = $request->get('hide_item_id');
} else {
$hide_item_id = null;
}
for ($j=0; $j<$rows; $j++) {
$group_id = db_result($result,$j,'group_id');
$sql2 = "select docdata_vw.docid, docdata_vw.doc_group, docdata_vw.filename, docdata_vw.filetype, docdata_vw.description from docdata_vw,docdata_monitored_docman where docdata_vw.docid = docdata_monitored_docman.doc_id and docdata_vw.group_id = $1 and docdata_monitored_docman.user_id = $2 limit 100";
$result2 = db_query_params($sql2,array($group_id,user_getid()));
$rows2 = db_numrows($result2);
$vDocument = new Valid_WhiteList('hide_document', array(0, 1));
$vDocument->required();
if($request->valid($vDocument)) {
$hide_document = $request->get('hide_document');
} else {
$hide_document = null;
}
list($hide_now,$count_diff,$hide_url) = my_hide_url('document',$group_id,$hide_item_id,$rows2,$hide_document);
$html_hdr = ''.
$hide_url.''.
db_result($result,$j,'group_name').' ';
$html = '';
$count_new = max(0, $count_diff);
for ($i = 0; $i < $rows2; $i++) {
if (!$hide_now) {
$doc_group = db_result($result2,$i,'doc_group');
$docid = db_result($result2,$i,'docid');
$html .= '
|
boxGetAltRowStyle($i) .'>'.
' - '.
stripslashes(db_result($result2,$i,'filename')).' | '.
''.
' |
';
}
}
$html_hdr .= '['.$rows2.($count_new ? ", ".sprintf(_('%s new'), $count_new)."]" : ']').'';
$html_my_monitored_documents .= $html_hdr.$html;
}
$html_my_monitored_documents .= '
';
}
return $html_my_monitored_documents;
}
function getCategory() {
return 'Documents-Manager';
}
function getDescription() {
return _("List documents that you are currently monitoring, by project.
To cancel any of the monitored items just click on the trash icon next to the item label.");
}
}