Location: PHPKode > projects > PushOk SEMA > html/web/issue/issue_main.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

$nIdParent = 0;
if ( isset($_GET['idparent']) && $_GET['idparent']>0 )
	$nIdParent = $_GET['idparent'];
	
class web_Issue extends web_Layout 
{
	function Info()
	{
		global $nIdParent, $arIssuePriority, $arIssueStatus, $arIssueStatusInt;
		
		// filter section
		$this->formStart("", "filter");
        echo "<FORM method=get>";
        echo "<INPUT type=\"hidden\" name=\"idform\" value=\"FM_ISSUE_SEARCH\"></INPUT>\n";
        echo "<INPUT type=\"hidden\" name=\"action\" value=\"filter\"></INPUT>\n";
        echo "<INPUT type=\"hidden\" name=\"redirect\" value=\"page@@/web/issue/hide@address.com@@$nIdParent\"></INPUT>\n";
        
        // fill filter with default values
        if ( !isset($_SESSION['last_filter']) || $_SESSION['last_filter']['idform'] != "FM_ISSUE_SEARCH" )
        	$_SESSION['last_filter'] = array('status'=>-1, 'my_issues'=>'', 'idform'=>"FM_ISSUE_SEARCH");
    	
        $arStatuses = $arIssueStatus; 
        $arStatuses[-1] = _LW("Active");
        $arStatuses[-2] = _LW("All");
        $sFieldValue = 0;
        if ( isset($_SESSION['last_filter']['status']) )
        	$sFieldValue = $_SESSION['last_filter']['status'];
        $this->formInputItem(_LW("Status"),"select","status",$sFieldValue,$arStatuses);
        
        $sFieldValue = 1;
        if ( !isset($_SESSION['last_filter']['my_issues']) )
        	$sFieldValue = 0;
        $this->formInputItem(_LW("My issues"),"checkbox","my_issues",$sFieldValue);
        $this->formInputItem(_LW("Refresh"), "submit");
		echo "</FORM>\n";
		$this->formEnd();
		
		// main section
		$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_CONTACT_SHORTINFO", $oIn = array('idcontact_current'=>$_SESSION['iduser']), $arContacts);
		
		$oIn = array('idcontact_current' => $_SESSION['iduser'], 'status'=>$_SESSION['last_filter']['status']);
		// tasks for work with
		if ( isset($_SESSION['last_filter']['my_issues']) )
			$oIn['my_issues'] = 1;
			
		if ( $nIdParent )
			$oIn['idparent'] = $nIdParent;
		$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_ISSUE_SEARCH", $oIn, $arIssues);
		
		$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('Creation date'), 'colspan'=>0),
			array('value'=>_LW('Modification date'), 'colspan'=>0),
			array('value'=>_LW('Responsible'), 'colspan'=>0),
			array('value'=>_LW('Worker'), 'colspan'=>0),
			array('value'=>_LW('Priority'), 'colspan'=>0),
			array('value'=>_LW('Status'), 'colspan'=>0),
			array('value'=>_LW('Internal status'), 'colspan'=>0),
			array('value'=>_LW('Action'), 'colspan'=>0),
							);
		$this->tableHeader($arHeader);
		
		if ( count($arIssues['issues']) )
		{	
			foreach ( $arIssues['issues'] as $nIdIssue => $arIssueInfo )
			{
				$this->tableRow();
				$sSingle = "";
				if (isset($arIssueInfo['parent_object']) && $arIssueInfo['parent_object']>0) {
					$_oIn = array('idcontact'=>$_SESSION['iduser'], 'idobject'=>$arIssueInfo['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",$arIssueInfo['parent_title'], array('href'=> "?page=/web/object_view.php&id=".$arIssueInfo['parent_object']));
					else 
						$sSingle = $this->singleItem("string",$arIssueInfo['parent_title']);
				}
				$this->tableCol($sSingle);
				$this->tableCol($this->singleItem("string", $nIdIssue));
				$this->tableCol($this->singleItem("link",$arIssueInfo['title'], array("href" => "?page=/web/issue/issue_view.php&idissue=$nIdIssue")));
				$this->tableCol($this->singleItem("date",$arIssueInfo['creation_date']));
				$this->tableCol($this->singleItem("date",$arIssueInfo['modification_date']));
				$this->tableCol($this->singleItem("string",$arContacts['contacts'][$arIssueInfo['idresponsible']]));
				$this->tableCol($this->singleItem("string",$arContacts['contacts'][$arIssueInfo['idworker']]));
				$this->tableCol($this->singleItem("string",$arIssuePriority[$arIssueInfo['priority']]));
				$this->tableCol($this->singleItem("string",$arIssueStatus[$arIssueInfo['status']]));
				$this->tableCol($this->singleItem("string",$arIssueStatusInt[$arIssueInfo['status2']]));

				$this->tableCol();
				// prepare actions for current issue
				$_oIn=array('idobject'=>$nIdIssue, 'type'=>ID_SEMA_ISSUE);
				$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_Issue;
$oPage->m_windowHeader = _LW("Issues");
$oPage->WebStack("issue_main.php", $oPage->m_windowHeader, $oPage->m_windowHeader, web_GetPageGetParams());

if ( !isset($_SESSION['iduser']) )
	web_RedirectRelative("sema.php");
	
$oPage->m_menuFLvl = "Issues";
$oPage->RenderPage();

?>
Return current item: PushOk SEMA