2006-12-31 19:48:07 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Functions related to application data
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
require_once(BASE."include/util.php");
|
|
|
|
|
|
|
|
|
|
class appData
|
|
|
|
|
{
|
2007-03-11 03:07:43 +00:00
|
|
|
var $iId;
|
|
|
|
|
var $iAppId;
|
|
|
|
|
var $iVersionId;
|
|
|
|
|
var $iSubmitterId;
|
|
|
|
|
var $sSubmitTime;
|
2007-03-13 00:26:31 +00:00
|
|
|
var $sDescription;
|
2007-03-11 03:07:43 +00:00
|
|
|
|
2007-06-10 23:07:51 +00:00
|
|
|
function appData($iId = null, $oRow = null, $oObject = null)
|
2007-03-11 03:07:43 +00:00
|
|
|
{
|
2007-06-10 18:51:33 +00:00
|
|
|
if(!$iId && !$oRow)
|
2007-03-11 03:07:43 +00:00
|
|
|
return;
|
|
|
|
|
|
2007-06-10 23:07:51 +00:00
|
|
|
/* Since all objects stored in the appData table have a number of common
|
|
|
|
|
members, we can import such an object into an appData one without
|
|
|
|
|
making an SQL query */
|
|
|
|
|
if($oObject && $iId)
|
|
|
|
|
{
|
|
|
|
|
$this->iSubmitterId = $oObject->iSubmitterId;
|
|
|
|
|
$this->sDescription = $oObject->sDescription;
|
|
|
|
|
$this->iAppId = $oObject->iAppId;
|
|
|
|
|
$this->iVersionId = $oObject->iVersionId;
|
|
|
|
|
$this->sSubmitTime = $oObject->sSubmitTime;
|
|
|
|
|
$this->iId = $iId;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-11 03:07:43 +00:00
|
|
|
if(!$oRow)
|
|
|
|
|
{
|
2007-03-13 00:26:31 +00:00
|
|
|
$hResult = query_parameters("SELECT * FROM appData WHERE id = '?'", $iId);
|
2007-08-03 23:27:25 +00:00
|
|
|
$oRow = query_fetch_object($hResult);
|
2007-03-11 03:07:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($oRow)
|
|
|
|
|
{
|
|
|
|
|
$this->iSubmitterId = $oRow->submitterId;
|
|
|
|
|
$this->iAppId = $oRow->appId;
|
|
|
|
|
$this->iVersionId = $oRow->versionId;
|
|
|
|
|
$this->sSubmitTime = $oRow->submitTime;
|
|
|
|
|
$this->iId = $iId;
|
2007-03-13 00:26:31 +00:00
|
|
|
$this->sDescription = $oRow->description;
|
2007-03-11 03:07:43 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-04-21 19:44:10 +00:00
|
|
|
function delete()
|
|
|
|
|
{
|
|
|
|
|
if(!$this->canEdit())
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
$sQuery = "DELETE FROM appData WHERE id = '?'";
|
|
|
|
|
|
|
|
|
|
$hResult = query_parameters($sQuery, $this->iId);
|
|
|
|
|
|
|
|
|
|
if(!$hResult)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return $hResult;
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-09 15:44:46 +00:00
|
|
|
function reQueue()
|
|
|
|
|
{
|
|
|
|
|
if(!$this->canEdit())
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
$sQuery = "UPDATE appData SET queued = '?' WHERE id = '?'";
|
|
|
|
|
$hResult = query_parameters($sQuery, "true", $this->iId);
|
|
|
|
|
|
|
|
|
|
if(!$hResult)
|
|
|
|
|
return FALSE;
|
|
|
|
|
else
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function reject()
|
|
|
|
|
{
|
|
|
|
|
if(!$this->canEdit())
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
$sQuery = "UPDATE appData SET queued = '?' WHERE id = '?'";
|
|
|
|
|
$hResult = query_parameters($sQuery, "rejected", $this->iId);
|
|
|
|
|
|
|
|
|
|
if(!$hResult)
|
|
|
|
|
return FALSE;
|
|
|
|
|
else
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2007-04-23 23:31:24 +00:00
|
|
|
function update($bSilent = FALSE)
|
|
|
|
|
{
|
|
|
|
|
if(!$this->canEdit())
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
$sQuery = "UPDATE appData SET versionId = '?', appId = '?', sDescription = '?'
|
|
|
|
|
WHERE id = '?'";
|
|
|
|
|
$hResult = query_parameters($this->iVersionId, $this->iAppId,
|
|
|
|
|
$this->sDescription, $this->iId);
|
|
|
|
|
|
|
|
|
|
if(!$hResult)
|
|
|
|
|
{
|
|
|
|
|
if(!$bResult)
|
|
|
|
|
addmsg("Failed to update add data", "red");
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!$bSilent)
|
|
|
|
|
addmsg("Updated app data successfully", "green");
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-31 19:48:07 +00:00
|
|
|
function listSubmittedBy($iUserId, $bQueued = true)
|
|
|
|
|
{
|
2007-03-15 23:43:46 +00:00
|
|
|
$hResult = query_parameters("SELECT * FROM appData WHERE
|
|
|
|
|
appData.submitterId = '?'
|
|
|
|
|
AND
|
2006-12-31 19:48:07 +00:00
|
|
|
appData.queued = '?'
|
|
|
|
|
ORDER BY appData.id",
|
2007-03-15 23:43:46 +00:00
|
|
|
$iUserId, $bQueued ? "true" : "false");
|
2006-12-31 19:48:07 +00:00
|
|
|
|
2007-08-03 23:27:25 +00:00
|
|
|
if(!$hResult || !query_num_rows($hResult))
|
2006-12-31 19:48:07 +00:00
|
|
|
return false;
|
|
|
|
|
|
2007-03-15 23:43:46 +00:00
|
|
|
$sReturn = html_table_begin("width=\"100%\" align=\"center\"");
|
2006-12-31 19:48:07 +00:00
|
|
|
$sReturn .= html_tr(array(
|
|
|
|
|
"Version",
|
|
|
|
|
"Type",
|
|
|
|
|
"Description",
|
|
|
|
|
"Submission Date"),
|
|
|
|
|
"color4");
|
|
|
|
|
|
2007-08-03 23:27:25 +00:00
|
|
|
for($i = 1; $oRow = query_fetch_object($hResult); $i++)
|
2006-12-31 19:48:07 +00:00
|
|
|
{
|
2007-03-15 23:43:46 +00:00
|
|
|
if($oRow->versionId)
|
|
|
|
|
{
|
|
|
|
|
$oVersion = new version($oRow->versionId);
|
|
|
|
|
$sLink = "<a href=\"".$oVersion->objectMakeUrl()."\">".
|
|
|
|
|
$oVersion->fullName($oVersion->iVersionId)."</a>";
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
$oApp = new application($this->appId);
|
|
|
|
|
$sLink = $oApp->objectMakeLink();
|
|
|
|
|
}
|
2006-12-31 19:48:07 +00:00
|
|
|
$sReturn .= html_tr(array(
|
2007-03-15 23:43:46 +00:00
|
|
|
$sLink,
|
|
|
|
|
$oRow->type,
|
2006-12-31 19:48:07 +00:00
|
|
|
$oRow->description,
|
2007-07-31 23:48:22 +00:00
|
|
|
print_date(mysqldatetime_to_unixtimestamp($oRow->submitTime))),
|
2006-12-31 19:48:07 +00:00
|
|
|
($i % 2) ? "color0" : "color1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$sReturn .= html_table_end("");
|
|
|
|
|
|
|
|
|
|
return $sReturn;
|
2007-03-15 23:43:46 +00:00
|
|
|
|
2006-12-31 19:48:07 +00:00
|
|
|
}
|
2007-01-05 05:20:05 +00:00
|
|
|
|
|
|
|
|
/* Get appData for a given version/application, optionally filter by type */
|
2007-06-09 15:44:46 +00:00
|
|
|
function getData($iId, $sType, $bIsVersion = TRUE, $bQueued = FALSE, $bRejected = FALSE)
|
2007-01-05 05:20:05 +00:00
|
|
|
{
|
|
|
|
|
$iAppId = 0;
|
|
|
|
|
$iVersionId = 0;
|
|
|
|
|
|
|
|
|
|
if($bIsVersion)
|
|
|
|
|
$iVersionId = $iId;
|
|
|
|
|
else
|
|
|
|
|
$iAppId = $iId;
|
|
|
|
|
|
2007-06-09 15:44:46 +00:00
|
|
|
$sQueued = objectManager::getQueueString($bQueued, $bRejected);
|
|
|
|
|
|
2007-01-18 02:34:19 +00:00
|
|
|
$hResult = query_parameters("SELECT * FROM appData WHERE appId = '?' AND
|
2007-06-10 22:11:31 +00:00
|
|
|
versionId = '?' AND TYPE = '?' AND queued = '?'",
|
|
|
|
|
$iAppId, $iVersionId, $sType, $sQueued);
|
2007-01-05 05:20:05 +00:00
|
|
|
|
2007-08-03 23:27:25 +00:00
|
|
|
if(!$hResult || !query_num_rows($hResult))
|
2007-01-05 05:20:05 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return $hResult;
|
|
|
|
|
}
|
2007-03-10 21:21:10 +00:00
|
|
|
|
2007-03-24 18:30:16 +00:00
|
|
|
function objectGetEntriesCount($sQueued, $bRejected, $sType = null)
|
2007-03-10 21:21:10 +00:00
|
|
|
{
|
2007-03-24 18:30:16 +00:00
|
|
|
/* Not implemented for appData */
|
|
|
|
|
if($bRejected)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
/* Compatibility with objectManager */
|
|
|
|
|
if($sQueued === true)
|
|
|
|
|
$sQueued = "true";
|
|
|
|
|
if($sQueued === false)
|
|
|
|
|
$sQueued = "false";
|
|
|
|
|
|
2007-05-31 02:44:51 +00:00
|
|
|
$sSelectType = "";
|
|
|
|
|
$sLimit = "";
|
|
|
|
|
|
2007-03-11 20:40:11 +00:00
|
|
|
if(($sQueued == "true" || $sQueued == "all") &&
|
2007-03-10 21:21:10 +00:00
|
|
|
!$_SESSION['current']->hasPriv("admin"))
|
|
|
|
|
{
|
2007-03-13 00:13:51 +00:00
|
|
|
$sQuery = "SELECT COUNT(DISTINCT appData.id) as count FROM appData,
|
|
|
|
|
appMaintainers, appVersion, appFamily WHERE
|
2007-03-11 20:40:11 +00:00
|
|
|
appFamily.appId = appVersion.appId
|
|
|
|
|
AND
|
|
|
|
|
appMaintainers.userId = '?'
|
|
|
|
|
AND
|
|
|
|
|
(
|
|
|
|
|
(
|
|
|
|
|
appMaintainers.appId = appFamily.appId
|
|
|
|
|
OR
|
|
|
|
|
appMaintainers.appId = appVersion.appId
|
|
|
|
|
)
|
|
|
|
|
AND
|
|
|
|
|
appMaintainers.superMaintainer = '1'
|
|
|
|
|
AND
|
|
|
|
|
(
|
|
|
|
|
appData.appId = appMaintainers.appId
|
|
|
|
|
OR
|
|
|
|
|
(
|
|
|
|
|
appData.versionId = appVersion.versionId
|
|
|
|
|
AND
|
|
|
|
|
appVersion.appId = appMaintainers.appId
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
OR
|
|
|
|
|
(
|
|
|
|
|
appMaintainers.superMaintainer = '0'
|
|
|
|
|
AND
|
|
|
|
|
appMaintainers.versionId = appVersion.versionId
|
|
|
|
|
AND
|
|
|
|
|
appMaintainers.versionId = appData.versionId
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
AND
|
|
|
|
|
appVersion.queued = 'false'
|
|
|
|
|
AND
|
2007-03-10 21:21:10 +00:00
|
|
|
appFamily.queued = 'false'";
|
|
|
|
|
|
|
|
|
|
if($sQueued == "true")
|
|
|
|
|
$sQuery .= " AND appData.queued = 'true'";
|
|
|
|
|
|
|
|
|
|
if($sType)
|
|
|
|
|
{
|
2007-03-11 03:07:43 +00:00
|
|
|
$sQuery .= " AND type = '?'";
|
2007-03-10 21:21:10 +00:00
|
|
|
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
|
|
|
|
|
$sType);
|
2007-05-28 20:10:49 +00:00
|
|
|
} else
|
|
|
|
|
{
|
2007-03-10 21:21:10 +00:00
|
|
|
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId);
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
{
|
2007-05-28 20:10:49 +00:00
|
|
|
if($sQueued == "true" || $sQueued == "false")
|
|
|
|
|
$sAppDataQueued = " AND appData.queued = '$sQueued'";
|
2007-07-24 01:45:19 +00:00
|
|
|
else
|
|
|
|
|
$sAppDataQueued = '';
|
2007-05-28 20:10:49 +00:00
|
|
|
|
|
|
|
|
if($sType)
|
|
|
|
|
$sSelectType = " AND type = '?'";
|
|
|
|
|
|
|
|
|
|
$sQuery = "(SELECT COUNT(DISTINCT appData.id) as count FROM appData,
|
2007-03-11 20:40:11 +00:00
|
|
|
appFamily, appVersion WHERE
|
|
|
|
|
appFamily.appId = appVersion.appId
|
|
|
|
|
AND
|
|
|
|
|
(
|
|
|
|
|
appData.appId = appFamily.appId
|
2007-05-28 20:10:49 +00:00
|
|
|
)
|
|
|
|
|
AND
|
|
|
|
|
appVersion.queued = 'false'
|
|
|
|
|
AND
|
|
|
|
|
appFamily.queued = 'false'$sAppDataQueued$sSelectType) UNION
|
|
|
|
|
(
|
|
|
|
|
SELECT COUNT(DISTINCT appData.id) as count FROM appData,
|
|
|
|
|
appFamily, appVersion WHERE
|
|
|
|
|
appFamily.appId = appVersion.appId
|
|
|
|
|
AND
|
|
|
|
|
(
|
2007-03-11 20:40:11 +00:00
|
|
|
appData.versionId = appVersion.versionId
|
|
|
|
|
)
|
|
|
|
|
AND
|
|
|
|
|
appVersion.queued = 'false'
|
|
|
|
|
AND
|
2007-05-28 20:10:49 +00:00
|
|
|
appFamily.queued = 'false'$sAppDataQueued$sSelectType)";
|
2007-03-11 20:40:11 +00:00
|
|
|
|
2007-03-10 21:21:10 +00:00
|
|
|
if($sType)
|
2007-05-28 20:10:49 +00:00
|
|
|
$hResult = query_parameters($sQuery, $sType, $sType);
|
|
|
|
|
else
|
2007-03-10 21:21:10 +00:00
|
|
|
$hResult = query_parameters($sQuery);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!$hResult)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2007-08-03 23:27:25 +00:00
|
|
|
for($iCount = 0; $oRow = query_fetch_object($hResult);)
|
2007-05-28 20:10:49 +00:00
|
|
|
$iCount += $oRow->count;
|
2007-03-11 03:07:43 +00:00
|
|
|
|
2007-05-28 20:10:49 +00:00
|
|
|
return $iCount;
|
2007-03-11 03:07:43 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-17 21:04:43 +00:00
|
|
|
function objectGetHeader($sType)
|
2007-03-11 03:07:43 +00:00
|
|
|
{
|
2007-07-31 01:51:40 +00:00
|
|
|
$oTableRow = new TableRow();
|
|
|
|
|
$oTableRow->AddTextCell("Submission Date");
|
|
|
|
|
$oTableRow->AddTextCell("Submitter");
|
|
|
|
|
$oTableRow->AddTextCell("Application");
|
|
|
|
|
$oTableRow->AddTextCell("Version");
|
|
|
|
|
return $oTableRow;
|
2007-03-11 03:07:43 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-24 18:30:16 +00:00
|
|
|
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sType)
|
2007-03-11 03:07:43 +00:00
|
|
|
{
|
2007-03-24 18:30:16 +00:00
|
|
|
/* Not implemented for appData */
|
|
|
|
|
if($bRejected)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2007-05-31 02:44:51 +00:00
|
|
|
$sSelectType = "";
|
|
|
|
|
$sLimit = "";
|
|
|
|
|
|
2007-03-11 03:07:43 +00:00
|
|
|
if($bQueued && !$_SESSION['current']->hasPriv("admin"))
|
|
|
|
|
{
|
|
|
|
|
$sQuery = "SELECT DISTINCT appData.* FROM appData, appMaintainers,
|
2007-03-11 20:40:11 +00:00
|
|
|
appVersion, appFamily WHERE
|
|
|
|
|
appFamily.appId = appVersion.appId
|
|
|
|
|
AND
|
|
|
|
|
appMaintainers.userId = '?'
|
|
|
|
|
AND
|
|
|
|
|
(
|
|
|
|
|
(
|
|
|
|
|
(
|
|
|
|
|
appMaintainers.appId = appFamily.appId
|
|
|
|
|
OR
|
|
|
|
|
appMaintainers.appId = appVersion.appId
|
|
|
|
|
)
|
|
|
|
|
AND
|
|
|
|
|
appMaintainers.superMaintainer = '1'
|
|
|
|
|
AND
|
|
|
|
|
(
|
|
|
|
|
appData.appId = appMaintainers.appId
|
|
|
|
|
OR
|
|
|
|
|
(
|
|
|
|
|
appData.versionId = appVersion.versionId
|
|
|
|
|
AND
|
|
|
|
|
appVersion.appId = appMaintainers.appId
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
OR
|
|
|
|
|
(
|
|
|
|
|
appMaintainers.superMaintainer = '0'
|
|
|
|
|
AND
|
|
|
|
|
appMaintainers.versionId = appVersion.versionId
|
|
|
|
|
AND
|
|
|
|
|
appMaintainers.versionId = appData.versionId
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
AND
|
|
|
|
|
appVersion.queued = 'false'
|
|
|
|
|
AND
|
|
|
|
|
appFamily.queued = 'false'
|
|
|
|
|
AND
|
|
|
|
|
appData.queued = '?'
|
|
|
|
|
AND
|
2007-03-11 03:07:43 +00:00
|
|
|
appData.type = '?'";
|
2007-06-11 23:20:55 +00:00
|
|
|
if(!$iRows && !$iStart)
|
2007-03-13 00:13:51 +00:00
|
|
|
{
|
|
|
|
|
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
|
2007-03-11 03:07:43 +00:00
|
|
|
$bQueued ? "true" : "false", $sType);
|
2007-03-13 00:13:51 +00:00
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
if(!$iRows)
|
|
|
|
|
$iRows = appData::objectGetEntriesCount($bQueued ? "true" : "false",
|
2007-03-24 18:30:16 +00:00
|
|
|
$bRejected, $sType);
|
2007-03-13 00:13:51 +00:00
|
|
|
$sQuery .= " LIMIT ?,?";
|
|
|
|
|
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
|
|
|
|
|
$bQueued ? "true" : "false", $sType,
|
|
|
|
|
$iStart, $iRows);
|
|
|
|
|
}
|
2007-03-11 03:07:43 +00:00
|
|
|
} else
|
|
|
|
|
{
|
2007-05-28 21:44:14 +00:00
|
|
|
if($iStart || $iRows)
|
|
|
|
|
$sLimit = " LIMIT ?,?";
|
|
|
|
|
|
|
|
|
|
$sQuery = "(SELECT DISTINCT appData.* FROM appData,
|
|
|
|
|
appFamily, appVersion WHERE
|
|
|
|
|
appFamily.appId = appVersion.appId
|
2007-03-11 20:40:11 +00:00
|
|
|
AND
|
|
|
|
|
(
|
|
|
|
|
appData.appId = appFamily.appId
|
2007-05-28 21:44:14 +00:00
|
|
|
)
|
|
|
|
|
AND
|
|
|
|
|
appVersion.queued = 'false'
|
|
|
|
|
AND
|
|
|
|
|
appFamily.queued = 'false'
|
|
|
|
|
AND
|
|
|
|
|
appData.queued = '?'
|
|
|
|
|
AND
|
|
|
|
|
appData.type = '?'$sLimit) UNION
|
|
|
|
|
(
|
|
|
|
|
SELECT DISTINCT appData.* FROM appData,
|
|
|
|
|
appFamily, appVersion WHERE
|
|
|
|
|
appFamily.appId = appVersion.appId
|
|
|
|
|
AND
|
|
|
|
|
(
|
2007-03-11 20:40:11 +00:00
|
|
|
appData.versionId = appVersion.versionId
|
|
|
|
|
)
|
|
|
|
|
AND
|
|
|
|
|
appVersion.queued = 'false'
|
|
|
|
|
AND
|
|
|
|
|
appFamily.queued = 'false'
|
|
|
|
|
AND
|
|
|
|
|
appData.queued = '?'
|
|
|
|
|
AND
|
2007-05-28 21:44:14 +00:00
|
|
|
appData.type = '?'$sLimit)";
|
2007-03-13 00:13:51 +00:00
|
|
|
if(!$iRows && !$iStart)
|
|
|
|
|
{
|
2007-05-28 21:44:14 +00:00
|
|
|
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType,
|
|
|
|
|
$bQueued ? "true" : "false", $sType);
|
2007-03-13 00:13:51 +00:00
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
if(!$iRows)
|
|
|
|
|
$iRows = appData::objectGetEntriesCount($bQueued ? "true" : "false",
|
2007-03-24 18:30:16 +00:00
|
|
|
$bRejected, $sType);
|
2007-03-13 00:13:51 +00:00
|
|
|
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType,
|
2007-05-28 21:44:14 +00:00
|
|
|
$iStart, $iRows,
|
|
|
|
|
$bQueued ? "true" : "false", $sType,
|
2007-03-13 00:13:51 +00:00
|
|
|
$iStart, $iRows);
|
|
|
|
|
}
|
2007-03-11 03:07:43 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-11 20:40:11 +00:00
|
|
|
if(!$hResult)
|
2007-03-11 03:07:43 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return $hResult;
|
2007-03-10 21:21:10 +00:00
|
|
|
}
|
|
|
|
|
|
2007-04-21 17:49:43 +00:00
|
|
|
function canEdit()
|
2007-03-10 21:21:10 +00:00
|
|
|
{
|
2007-04-21 17:49:43 +00:00
|
|
|
if($_SESSION['current']->hasPriv("admin"))
|
|
|
|
|
return TRUE;
|
|
|
|
|
if($this)
|
2007-03-10 21:21:10 +00:00
|
|
|
{
|
2007-04-21 17:49:43 +00:00
|
|
|
if($this->iVersionId)
|
|
|
|
|
{
|
|
|
|
|
$oVersion = new version($this->iVersionId);
|
|
|
|
|
if($oVersion->canEdit())
|
|
|
|
|
return TRUE;
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
} else if($this->iAppId)
|
|
|
|
|
{
|
|
|
|
|
$oApp = new application($this->iAppId);
|
|
|
|
|
if($oApp->canEdit())
|
|
|
|
|
return TRUE;
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
} else
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function mustBeQueued()
|
|
|
|
|
{
|
|
|
|
|
if($_SESSION['current']->hasPriv("admin"))
|
|
|
|
|
return FALSE;
|
|
|
|
|
if($this)
|
2007-03-10 21:21:10 +00:00
|
|
|
{
|
2007-04-21 17:49:43 +00:00
|
|
|
if($this->iVersionId)
|
|
|
|
|
{
|
|
|
|
|
$oVersion = new version($this->iVersionId);
|
2007-04-22 16:17:36 +00:00
|
|
|
if($oVersion->canEdit() && $oVersion->sQueued == "false")
|
2007-04-21 17:49:43 +00:00
|
|
|
return FALSE;
|
|
|
|
|
else
|
|
|
|
|
return TRUE;
|
|
|
|
|
} else if($this->iAppId)
|
|
|
|
|
{
|
|
|
|
|
$oApp = new application($this->iAppId);
|
2007-04-22 16:17:36 +00:00
|
|
|
if($oApp->canEdit() && $oApp->sQueued == "false")
|
2007-04-21 17:49:43 +00:00
|
|
|
return FALSE;
|
|
|
|
|
else
|
|
|
|
|
return TRUE;
|
|
|
|
|
} else
|
2007-03-10 21:21:10 +00:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-03-11 03:07:43 +00:00
|
|
|
|
2007-06-14 00:50:35 +00:00
|
|
|
function objectGetTableRow()
|
2007-03-11 03:07:43 +00:00
|
|
|
{
|
|
|
|
|
$oVersion = new Version($this->iVersionId);
|
|
|
|
|
|
|
|
|
|
if(!$this->iAppId)
|
|
|
|
|
$this->iAppId = $oVersion->iAppId;
|
|
|
|
|
|
|
|
|
|
$oApp = new Application($this->iAppId);
|
|
|
|
|
$oUser = new User($this->iSubmitterId);
|
|
|
|
|
|
2007-07-23 20:30:57 +00:00
|
|
|
$oTableRow = new TableRow();
|
2007-07-31 23:48:22 +00:00
|
|
|
$oTableRow->AddTextCell(print_date(mysqldatetime_to_unixtimestamp($this->sSubmitTime)));
|
2007-07-23 20:30:57 +00:00
|
|
|
$oTableRow->AddTextCell($oUser->objectMakeLink());
|
|
|
|
|
$oTableRow->AddTextCell($oApp->objectMakeLink());
|
|
|
|
|
$oTableRow->AddTextCell($this->iVersionId ? $oVersion->objectMakeLink() : "N/A");
|
|
|
|
|
|
|
|
|
|
// create the object manager specific row
|
|
|
|
|
$oOMTableRow = new OMTableRow($oTableRow);
|
|
|
|
|
|
|
|
|
|
return $oOMTableRow;
|
2007-03-11 03:07:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function objectDisplayQueueProcessingHelp()
|
|
|
|
|
{
|
|
|
|
|
$sHelp = "<p>This is a list of application data submitted by users. ".
|
|
|
|
|
"Please inspect the data carefully before accepting or rejecting it.</p>";
|
|
|
|
|
echo $sHelp;
|
|
|
|
|
}
|
2007-03-13 00:26:31 +00:00
|
|
|
|
|
|
|
|
/* Output the part of an appData editor which is the same for all data types */
|
|
|
|
|
function outputEditorGeneric()
|
|
|
|
|
{
|
|
|
|
|
$oVersion = new version($this->iVersionId);
|
|
|
|
|
if($oVersion->iVersionId)
|
|
|
|
|
{
|
|
|
|
|
$this->iAppId = $oVersion->iAppId;
|
|
|
|
|
$sVersionName = $oVersion->objectMakeLink();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
$sVersionName = "N/A";
|
|
|
|
|
|
|
|
|
|
$oApp = new Application($this->iAppId);
|
|
|
|
|
|
|
|
|
|
// view application details
|
|
|
|
|
echo html_frame_start("New Application Data Form",600,"",0);
|
|
|
|
|
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
|
|
|
|
|
|
|
|
|
|
// app name
|
|
|
|
|
echo '<tr valign=top><td class=color0><b>App Name</b></td>',"\n";
|
|
|
|
|
echo "<td>".$oApp->objectMakeLink()."</td></tr>\n";
|
|
|
|
|
|
|
|
|
|
// version
|
|
|
|
|
echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
|
|
|
|
|
echo "<td>$sVersionName</td></tr>\n";
|
|
|
|
|
|
|
|
|
|
//dataDescription
|
|
|
|
|
echo '<tr valign=top><td class=color0><b>Description</b></td>',"\n";
|
|
|
|
|
echo '<td><textarea name="sDescription" rows=10 cols=35>'.stripslashes($this->sDescription).'</textarea></td></tr>',"\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getDefaultReply()
|
|
|
|
|
{
|
|
|
|
|
$sReplyText = "Enter a personalized reason for acceptance or rejection of the".
|
|
|
|
|
" submitted application data here";
|
|
|
|
|
return $sReplyText;
|
|
|
|
|
}
|
2007-06-14 00:50:35 +00:00
|
|
|
|
|
|
|
|
function objectGetId()
|
|
|
|
|
{
|
|
|
|
|
return $this->iId;
|
|
|
|
|
}
|
2006-12-31 19:48:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|