Location: PHPKode > projects > PushOk SEMA > html/web/project/project_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

/*
subscription: contain main information about active projects.
*/
class web_Project extends web_Layout 
{
	function Info()
	{
		global $arProjectStatus, $arProjectTT;
		
		$this->formStart("", "filter");
        echo "<FORM method=get>";
        echo "<INPUT type=\"hidden\" name=\"idform\" value=\"FM_PROJECT_SEARCH\"></INPUT>\n";
        echo "<INPUT type=\"hidden\" name=\"action\" value=\"filter\"></INPUT>\n";
        echo "<INPUT type=\"hidden\" name=\"redirect\" value=\"page@@/web/project/project_main.php\"></INPUT>\n";
        
        // fill filter with default values
        if ( !isset($_SESSION['last_filter']) || $_SESSION['last_filter']['idform'] != "FM_PROJECT_SEARCH" )
        	$_SESSION['last_filter'] = array('status'=>-1, 'my_projects'=>'', 'idform'=>"FM_PROJECT_SEARCH");
    	
        $arStatuses = $arProjectStatus; 
        $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 = 0;
        if ( isset($_SESSION['last_filter']['overdue']) )
        	$sFieldValue = 1;
        $this->formInputItem(_LW("Overdue"),"checkbox","overdue",$sFieldValue);
        
        $sFieldValue = 1;
        if ( !isset($_SESSION['last_filter']['my_projects']) )
        	$sFieldValue = 0;
        $this->formInputItem(_LW("My projects"),"checkbox","my_projects",$sFieldValue);
        $this->formInputItem(_LW("Refresh"), "submit");
		echo "</FORM>\n";
		$this->formEnd();
		
		// prepare filter data for search function
		$oIn = array('idcontact_current' => $_SESSION['iduser']);
		$oIn['status'] = $_SESSION['last_filter']['status'];
		if ( isset($_SESSION['last_filter']['overdue']) )
			$oIn['overdue'] = 1;
		if ( isset($_SESSION['last_filter']['my_projects']) )
			$oIn['my_projects'] = 1;
		$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_PROJECT_SEARCH", $oIn, $arProjects);
		
		$this->tableStart();
		$arHeader = array( 
			array('value'=>_LW('ID'), 'colspan'=>0),
			array('value'=>_LW('Title'), 'colspan'=>0),
			array('value'=>_LW('Time type'), 'colspan'=>0),
			array('value'=>_LW('Start date'), 'colspan'=>0),
			array('value'=>_LW('End date'), 'colspan'=>0),
			array('value'=>_LW('Status'), 'colspan'=>0),
			array('value'=>_LW('Action'), 'colspan'=>0),
							);
		$this->tableHeader($arHeader);
		
		if ( count($arProjects['projects']) )
		{
			foreach ( $arProjects['projects'] as $nIdProject => $arProjectInfo )
			{
				$this->tableRow();
				$this->tableCol($this->singleItem("string", $nIdProject));
				$this->tableCol($this->singleItem("link",$arProjectInfo['title'],
                    array("href" => "?page=/web/project/project_view.php&idproject=$nIdProject")));
				$this->tableCol($this->singleItem("string",$arProjectTT[$arProjectInfo['time_type']]));
				$this->tableCol($this->singleItem("date",$arProjectInfo['bdate']));
				$this->tableCol($this->singleItem("date",$arProjectInfo['edate']));
				$this->tableCol($this->singleItem("string",$arProjectStatus[$arProjectInfo['status']]));
				// prepare actions for current project
				$this->tableCol();
				
				$_oIn=array('idobject'=>$nIdProject, 'type'=>ID_SEMA_PROJECT);
				$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_Project;
$oPage->m_windowHeader = _LW("Project main");
$oPage->WebStack("project_main.php", $oPage->m_windowHeader, $oPage->m_windowHeader, web_GetPageGetParams());

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

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

?>
Return current item: PushOk SEMA