Location: PHPKode > projects > PushOk SEMA > html/web/issue/issue_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 more information about some issue.
*/
$nIdIssue = 0;
if ( isset($_GET['idissue']) && $_GET['idissue']>0 )
	$nIdIssue = $_GET['idissue'];
else 
	web_RedirectRelative("sema.php");

class web_Issue extends web_Layout 
{
	function Info()
	{
		global $arIssueStatus, $nIdIssue, $arIssuePriority, $arIssueStatusInt;
		
		$oIn = array('idcontact_current' => $_SESSION['iduser'], 'id' => $nIdIssue);
		$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_ISSUE_SEARCH", $oIn, $arIssues);
		if (count($arIssues))
		{
		$arIssueInfo = $arIssues['issues'];
		
		$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_CONTACT_SHORTINFO", $oIn = array('idcontact_current'=>$_SESSION['iduser']), $arContacts);
		
		// check can we show parent object name as link to it
		$sParentTitle = "";
		if (isset($arIssueInfo[$nIdIssue]['parent_object']) && $arIssueInfo[$nIdIssue]['parent_object']>0) {
			$_oIn = array('idcontact'=>$_SESSION['iduser'], 'idobject'=>$arIssueInfo[$nIdIssue]['parent_object'], 'mask'=>'R');
			$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_CONTACT_HAS_MASK", $_oIn, $_oOut=array());
			if (isset($_oOut['result']) && $_oOut['result']) 
				$sParentTitle = $this->singleItem("link", $arIssueInfo[$nIdIssue]['parent_title'], array('href'=> "?page=/web/object_view.php&id=".$arIssueInfo[$nIdIssue]['parent_object']));
			else 
				$sParentTitle = $this->singleItem("string", $arIssueInfo[$nIdIssue]['parent_title']);
			$sParentTitle = $sParentTitle." -&gt; ";
		}
			
		$this->formStart($sParentTitle.$arIssueInfo[$nIdIssue]['title']."&nbsp;&nbsp;&nbsp;(".$nIdIssue.")");
        $this->formSection(_LW("General"));
        $this->formItem(_LW("Title"),"string",$arIssueInfo[$nIdIssue]['title']);
		$this->formItem(_LW("Creation date"),"date",$arIssueInfo[$nIdIssue]['creation_date']);
		$this->formItem(_LW("Modification date"),"date",$arIssueInfo[$nIdIssue]['modification_date']);
		$this->formItem(_LW("Responsible"),"string",$arContacts['contacts'][$arIssueInfo[$nIdIssue]['idresponsible']]);		
		$this->formItem(_LW("Worker"),"string",$arContacts['contacts'][$arIssueInfo[$nIdIssue]['idworker']]);
		$this->formItem(_LW("Priority"),"string",$arIssuePriority[$arIssueInfo[$nIdIssue]['priority']]);
		$this->formItem(_LW("Status"),"string",$arIssueStatus[$arIssueInfo[$nIdIssue]['status']]);
		$this->formItem(_LW("Internal status"),"string",$arIssueStatusInt[$arIssueInfo[$nIdIssue]['status2']]);

		if ($arIssueInfo[$nIdIssue]['status'] == 1 || $arIssueInfo[$nIdIssue]['status'] == 3) {
			$_oIn = array('idcontact_current'=>$_SESSION['iduser'], 'idissue'=>$nIdIssue);
			$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_ISSUE_CONTACT_STATUS", $_oIn, $_oOut=array());
			if (isset($_oOut['status']) && count($_oOut['status']) && ($_oOut['status']['responsible'] || $_oOut['status']['worker'])) {
				// if was some error then show the message about
				$bError = isset($_SESSION['last_post']);
				
				$this->formSection(_LW("New description"));
				echo "<FORM method=post>\n";
				echo "<INPUT type=\"hidden\" name=\"idform\" value=\"FM_ISSUE_DESCRIPTION_NEW\"></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=\"idissue\" value=\"$nIdIssue\"></INPUT>\n";
				$sFieldValue = "";
				if ( $bError )
					$sFieldValue = $_SESSION['last_post']['data']['text'];
				$this->formInputItem(_LW("Text"), "text", "text", $sFieldValue, array('cols'=>80, 'rows'=>10));
				$this->formInputItem(_LW("Add"), "submit");
				echo "</FORM>\n";
			}
		}
		
		$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_ISSUE_CONTENT_GET", $oIn=array('idcontact_current'=>$_SESSION['iduser'], 'idissue'=>$nIdIssue), $arIssueContent);
		if ( isset($arIssueContent['issue_content']) && count($arIssueContent['issue_content']) )
		{
            $this->formSection(_LW("Description"));
			foreach ( $arIssueContent['issue_content'] as $key => $arInfo )
			{
				$this->formItem(_LW("Author"), "string", $arContacts['contacts'][$arInfo['idcreator']]);
				$text = web_ChangeObject2Link($arInfo['text']);
				$this->formItem("", "subitem",$this->singleItem("memo",$text));
				$sFilesIds = $arInfo['files'];
				if ( strlen($sFilesIds) )
				{
					$arFilesIds = split(',', $sFilesIds);
					// show links to files
					$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_FILE_INFO_GET", $_oIn=array('idcontact_current'=>$_SESSION['iduser'], 'idfile'=>$arFilesIds), $_oOut=array());
					if ( isset($_oOut['files']) && count($_oOut['files']) )
					{
						foreach ( $_oOut['files'] as $nId => $sName )
							$this->formItem("", "subitem", $this->singleItem("link", $sName, array('href'=>"?page=/web/attach_download.php&id=$nId")));
					}
				}
			}
		}
		
		$oIn = array('idparent' => $nIdIssue, 'idcontact_current' => $_SESSION['iduser'], 'layout' => &$this);
		$GLOBALS['WEB_DISPATCHER']->ProcessMessage("WM_ISSUE_VIEW_SHOW", $oIn, $oOut);
		$this->formEnd();
		}
		else
			web_PageError(_LW("Access denied, or object deleted !"));
		?>
		<?PHP
	}
}

$oPage = new web_Issue;
$oPage->m_windowHeader = _LW("Issue info");
$oPage->WebStack("issue_view.php", $oPage->m_windowHeader, $oPage->m_windowHeader, web_GetPageGetParams());

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

$oPage->idobject = $nIdIssue;
$oPage->object_type = ID_SEMA_ISSUE;
$oPage->m_menuFLvl = "Issues";
$oPage->RenderPage();

?>
Return current item: PushOk SEMA