Location: PHPKode > projects > PushOk SEMA > html/web/rights/rights_view.php
<?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

/*
subscription: contain history information about some object.
*/
$nIdObject = 0;
if ( isset($_GET['idobject']) && $_GET['idobject']>0 )
	$nIdObject = $_GET['idobject'];
else 
	web_RedirectRelative("sema.php");
	
$nIdObjectType = 0;
if ( isset($_GET['idobject_type']) && $_GET['idobject_type']>0 )
	$nIdObjectType = $_GET['idobject_type'];
else 
	web_RedirectRelative("sema.php");
	
class web_Rights extends web_Layout 
{
	function Info()
	{
		global $nIdObject, $nIdObjectType;
		
		$oIn = array('idcontact'=>$_SESSION['iduser'], 'idobject'=>$nIdObject, 'type'=>$nIdObjectType, 'mask'=>'5');
		$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_CONTACT_HAS_MASK", $oIn, $oOut = array());
		if ( isset($oOut['result']) && $oOut['result'] )
		{
			$oIn = array('idcontact_current'=>$_SESSION['iduser'], 'idobject'=>$nIdObject, 'idobject_type'=>$nIdObjectType);
			$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_OBJECT_INFO", $oIn, $oOut = array());
			$sTitle = "";
			if ( isset($oOut['object']) && count($oOut['object']) )
				$sTitle = $oOut['object']['title'];
			//////////////////////
			// header
			$this->tableStart();
			$arHeader = array( 
				array('value'=>_LW('Contact'), 'colspan'=>0),
				array('value'=>_LW('Mask'), 'colspan'=>0),
				array('value'=>_LW('Action'), 'colspan'=>0),
								);
			$this->tableHeader($arHeader);
			//////////////////////
			// data
			$oIn = array('idcontact_current' => $_SESSION['iduser'], 'idobject' => $nIdObject);
			$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_RIGHTS_SEARCH", $oIn, $arRights);
			$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_CONTACT_SHORTINFO", $oIn, $arContacts);			
			if ( isset($arRights['rights']) && count($arRights['rights']) )
			{
				foreach ( $arRights['rights'] as $key => $arRightsInfo )		
				{
					$this->tableRow();
						$this->tableCol($arContacts['contacts'][$arRightsInfo['idcontact']]);
						$this->tableCol($arRightsInfo['mask']);
						$this->tableCol("<A href=\"?action=remove&idform=GT_CONTACT_RULE&id=".$arRightsInfo['id']."&idcontact=".$arRightsInfo['idcontact']."\">"._LW("Remove")."</A>");
				}
			}
			//////////////////////
			// form for adding new rules
			$this->tableRow();
            echo "<FORM method=post>";
			echo "<INPUT type=\"hidden\" name=\"idform\" value=\"FM_CONTACT_RULE_CREATE\"></INPUT>\n";
			echo "<INPUT type=\"hidden\" name=\"onsuccess\" value=\"?".web_GetPageGetParams()."\"></INPUT>\n";
			echo "<INPUT type=\"hidden\" name=\"onerror\" value=\"?".web_GetPageGetParams()."\"></INPUT>\n";
			echo "<INPUT type=\"hidden\" name=\"idobject\" value=\"$nIdObject\"></INPUT>\n";
			
			// contacts
			$this->tableCol($this->singleInputItem(false, "select", "idcontact", "", $arContacts['contacts']));
			// rule column
			$this->tableCol($this->singleInputItem(false, "accessrights", "mask", ""));
			$this->tableCol($this->singleInputItem(_LW("Add"), "submit"));
            echo "</FORM>";
			$this->tableEnd();
		}

		?>
		<?PHP
	}
}

$oPage = new web_Rights;
$oPage->m_windowHeader = _LW("Rights");
$oPage->WebStack("rights_view.php", $oPage->m_windowHeader, $oPage->m_windowHeader, web_GetPageGetParams());
$_SESSION['active_page'] = web_GetPageGetParams();

if ( !isset($_SESSION['iduser']) )
	web_RedirectRelative("sema.php");

$oPage->m_menuFLvl = "Rights";
$oPage->RenderPage();

?>
Return current item: PushOk SEMA