<?PHP
// Pushok's SEMA (Small Enterprise Management Application)
//
// Copyright (C) 2004 Pushok Software http://www.pushok.com
//
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
$nIdParent = 0;
if ( isset($_GET['idparent']) && $_GET['idparent']>0 )
$nIdParent = $_GET['idparent'];
class web_Note extends web_Layout
{
function Info()
{
global $nIdParent;
// main section
$oIn = array('idcontact_current' => $_SESSION['iduser']);
if ( $nIdParent )
$oIn['idparent'] = $nIdParent;
$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_NOTE_SEARCH", $oIn, $arNotes);
$this->tableStart();
$arHeader = array(
array('value'=>_LW('Parent title'), 'colspan'=>0),
array('value'=>_LW('ID'), 'colspan'=>0),
array('value'=>_LW('Title'), 'colspan'=>0),
array('value'=>_LW('Action'), 'colspan'=>0),
);
$this->tableHeader($arHeader);
if ( count($arNotes['notes']) )
{
foreach ( $arNotes['notes'] as $nIdNote => $arNoteInfo )
{
$this->tableRow();
$sSingle = "";
if (isset($arNoteInfo['parent_object']) && $arNoteInfo['parent_object']>0) {
$_oIn = array('idcontact'=>$_SESSION['iduser'], 'idobject'=>$arNoteInfo['parent_object'], 'mask'=>'R');
$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_CONTACT_HAS_MASK", $_oIn, $_oOut=array());
if (isset($_oOut['result']) && $_oOut['result'])
$sSingle = $this->singleItem("link",$arNoteInfo['parent_title'], array('href'=> "?page=/web/object_view.php&id=".$arNoteInfo['parent_object']));
else
$sSingle = $this->singleItem("string",$arNoteInfo['parent_title']);
}
$this->tableCol($sSingle);
$this->tableCol($this->singleItem("string", $nIdNote));
$this->tableCol($this->singleItem("link",$arNoteInfo['title'], array("href" => "?page=/web/note/note_view.php&idnote=$nIdNote")));
$this->tableCol();
// prepare actions for current issue
$_oIn=array('idobject'=>$nIdNote, 'type'=>ID_SEMA_NOTE);
$GLOBALS['WEB_DISPATCHER']->ProcessMessage("WM_ACTION_MENU_CREATE", $_oIn, $_oOut=array());
if ( count($_oOut) )
{
krsort($_oOut);
foreach ($_oOut as $nPriority=>$arMenues)
foreach ($arMenues as $sName => $arData)
echo $this->singleItem("action",$sName,$arData);
}
}
}
$this->tableEnd();
?>
<?PHP
}
}
$oPage = new web_Note;
$oPage->m_windowHeader = _LW("Notes");
$oPage->WebStack("note_main.php", $oPage->m_windowHeader, $oPage->m_windowHeader, web_GetPageGetParams());
if ( !isset($_SESSION['iduser']) )
web_RedirectRelative("sema.php");
$oPage->m_menuFLvl = "Notes";
$oPage->RenderPage();
?>