Location: PHPKode > projects > PushOk SEMA > html/web/task/task_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 task.
*/
$nIdTask = 0;
if ( isset($_GET['idtask']) && $_GET['idtask']>0 )
	$nIdTask = $_GET['idtask'];
else 
	web_RedirectRelative("sema.php");

class web_Task extends web_Layout 
{
	function Info()
	{
		global $arTaskStatus, $nIdTask, $arTaskTT, $arTaskPriority;
		
		$oIn = array('idcontact_current' => $_SESSION['iduser'], 'id' => $nIdTask);
		$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_TASK_SEARCH", $oIn, $arTasks);
		if (count($arTasks))
		{
		$arTaskInfo = $arTasks['tasks'];
		
		$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($arTaskInfo[$nIdTask]['parent_object']) && $arTaskInfo[$nIdTask]['parent_object']>0) {
			$_oIn = array('idcontact'=>$_SESSION['iduser'], 'idobject'=>$arTaskInfo[$nIdTask]['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", $arTaskInfo[$nIdTask]['parent_title'], array('href'=> "?page=/web/object_view.php&id=".$arTaskInfo[$nIdTask]['parent_object']));
			else 
				$sParentTitle = $this->singleItem("string", $arTaskInfo[$nIdTask]['parent_title']);
			$sParentTitle = $sParentTitle." -&gt; ";
		}
			
		$this->formStart($sParentTitle.$arTaskInfo[$nIdTask]['title']."&nbsp;&nbsp;&nbsp;(".$nIdTask.")");
        $this->formSection(_LW("General"));
        $this->formItem(_LW("Title"),"string",$arTaskInfo[$nIdTask]['title']);
		$this->formItem(_LW("Time type"),"string",$arTaskTT[$arTaskInfo[$nIdTask]['time_type']]);
		$this->formItem(_LW("Start date"),"date",$arTaskInfo[$nIdTask]['bdate']);
		$this->formItem(_LW("End date"),"date",$arTaskInfo[$nIdTask]['edate']);
		$this->formItem(_LW("Work time"),"string",$arTaskInfo[$nIdTask]['work_time']);
		$this->formItem(_LW("Worker"),"string",$arContacts['contacts'][$arTaskInfo[$nIdTask]['idworker']]);
		$this->formItem(_LW("Responsible"),"string",$arContacts['contacts'][$arTaskInfo[$nIdTask]['idresponsible']]);
		$this->formItem(_LW("Priority"),"string",$arTaskPriority[$arTaskInfo[$nIdTask]['priority']]);
		$this->formItem(_LW("Status"),"string",$arTaskStatus[$arTaskInfo[$nIdTask]['status']]);
		
		$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_TASK_SEARCH", $oIn=array('idcontact_current'=>$_SESSION['iduser'], 'idparent'=>$nIdTask), $arSubTasks);
		if ( isset($arSubTasks['tasks']) && count($arSubTasks['tasks']) )
		{
			$this->formSection(_LW("Subtasks"));
			$this->formItem("" ,"subitem");
		    $this->tableStart("default_sub");
		    $arHeader = array( 
				array('value'=>_LW('Title'), 'colspan'=>0, 'align'=>'left'),
				array('value'=>_LW('Status'), 'colspan'=>0, 'align'=>'left'),
								);
			$this->tableHeader($arHeader);
			
		    foreach ( $arSubTasks['tasks'] as $nIdSubTask => $arTaskInfo )
		    {
				$this->tableRow();
				$this->tableCol("<A href=\"?page=/web/task/task_view.php&idtask=$nIdSubTask\">".$arTaskInfo['title']."</A>");
				$this->tableCol($arTaskStatus[$arTaskInfo['status']]);
		    }
		    $this->tableEnd();
		    $this->formSectionEnd();
		}

		$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_TASK_CONTENT_GET", $oIn=array('idcontact_current'=>$_SESSION['iduser'], 'idtask'=>$nIdTask), $arTaskContent);
		if ( isset($arTaskContent['task_content']) && count($arTaskContent['task_content']) )
		{
            $this->formSection(_LW("Description"));
			foreach ( $arTaskContent['task_content'] as $key => $text )
			{
				$text = web_ChangeObject2Link($text);
				$this->formItem("", "subitem",$this->singleItem("memo",$text));
			}
		}

		$oIn = array('idparent' => $nIdTask, 'idcontact_current' => $_SESSION['iduser'], 'layout' => &$this);
		$GLOBALS['WEB_DISPATCHER']->ProcessMessage("WM_TASK_VIEW_SHOW", $oIn, $oOut);
		$this->formEnd();
		}
		else
			web_PageError(_LW("Access denied, or object deleted !"));
		?>
		<?PHP
	}
}

$oPage = new web_Task;
$oPage->m_windowHeader = _LW("Task info");
$oPage->WebStack("task_view.php", $oPage->m_windowHeader, $oPage->m_windowHeader, web_GetPageGetParams());

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

$oPage->idobject = $nIdTask;
$oPage->object_type = ID_SEMA_TASK;
$oPage->m_menuFLvl = "Tasks";
$oPage->RenderPage();

?>
Return current item: PushOk SEMA