Let application::getVersions() optionally return only accepted versions
This commit is contained in:
committed by
Chris Morgan
parent
7be5d6bd34
commit
64f3219c94
@@ -101,20 +101,20 @@ class Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _internal_retrieve_all_versions($bIncludeObsolete = TRUE, $bIncludeDeleted = false)
|
private function _internal_retrieve_all_versions($bOnlyAccepted = false, $bIncludeObsolete = TRUE, $bIncludeDeleted = false)
|
||||||
{
|
{
|
||||||
if(!$bIncludeObsolete)
|
$sExtraTerms = '';
|
||||||
$sObsolete = " AND obsoleteBy = '0'";
|
|
||||||
else
|
|
||||||
$sObsolete = "";
|
|
||||||
|
|
||||||
if($bIncludeDeleted)
|
if(!$bIncludeObsolete)
|
||||||
$sExcludeDeleted = "";
|
$sExtraTerms .= " AND obsoleteBy = '0'";
|
||||||
else
|
|
||||||
$sExcludeDeleted = " AND state != 'deleted'";
|
if($bOnlyAccepted)
|
||||||
|
$sExtraTerms .= " AND state = 'accepted'";
|
||||||
|
else if(!$bIncludeDeleted)
|
||||||
|
$sExtraTerms .= " AND state != 'deleted'";
|
||||||
|
|
||||||
$sQuery = "SELECT versionId FROM appVersion WHERE
|
$sQuery = "SELECT versionId FROM appVersion WHERE
|
||||||
appId = '?'$sObsolete$sExcludeDeleted ORDER by versionName";
|
appId = '?'$sExtraTerms ORDER by versionName";
|
||||||
$hResult = query_parameters($sQuery, $this->iAppId);
|
$hResult = query_parameters($sQuery, $this->iAppId);
|
||||||
return $hResult;
|
return $hResult;
|
||||||
}
|
}
|
||||||
@@ -1224,7 +1224,7 @@ class Application {
|
|||||||
return $oRow->count;
|
return $oRow->count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getVersions($bIncludeObsolete = TRUE, $bIncludeDeleted = false)
|
public function getVersions($bOnlyAccepted = false, $bIncludeObsolete = TRUE, $bIncludeDeleted = false)
|
||||||
{
|
{
|
||||||
/* If no id is set we cannot query for the versions, but perhaps objects are already cached? */
|
/* If no id is set we cannot query for the versions, but perhaps objects are already cached? */
|
||||||
if(!$this->iAppId)
|
if(!$this->iAppId)
|
||||||
@@ -1232,7 +1232,7 @@ class Application {
|
|||||||
|
|
||||||
$aVersions = array();
|
$aVersions = array();
|
||||||
|
|
||||||
$hResult = $this->_internal_retrieve_all_versions($bIncludeObsolete, $bIncludeDeleted);
|
$hResult = $this->_internal_retrieve_all_versions($bOnlyAccepted, $bIncludeObsolete, $bIncludeDeleted);
|
||||||
|
|
||||||
while($oRow = mysql_fetch_object($hResult))
|
while($oRow = mysql_fetch_object($hResult))
|
||||||
$aVersions[] = new version($oRow->versionId);
|
$aVersions[] = new version($oRow->versionId);
|
||||||
@@ -1268,7 +1268,7 @@ class Application {
|
|||||||
$aChildren = array();
|
$aChildren = array();
|
||||||
|
|
||||||
/* Get versions */
|
/* Get versions */
|
||||||
foreach($this->getVersions(true, $bIncludeDeleted) as $oVersion)
|
foreach($this->getVersions(false, true, $bIncludeDeleted) as $oVersion)
|
||||||
{
|
{
|
||||||
$aChildren += $oVersion->objectGetChildren($bIncludeDeleted);
|
$aChildren += $oVersion->objectGetChildren($bIncludeDeleted);
|
||||||
$aChildren[] = $oVersion;
|
$aChildren[] = $oVersion;
|
||||||
|
|||||||
@@ -687,7 +687,7 @@ class version {
|
|||||||
|
|
||||||
echo "<input type=\"hidden\" name=\"iObsoleteBy\" value=\"".
|
echo "<input type=\"hidden\" name=\"iObsoleteBy\" value=\"".
|
||||||
$oVersionInDB->iObsoleteBy."\" type=\"hidden\" >\n";
|
$oVersionInDB->iObsoleteBy."\" type=\"hidden\" >\n";
|
||||||
} else if(sizeof($oApp->getVersions(FALSE)) > 1)
|
} else if(sizeof($oApp->getVersions(TRUE, FALSE)) > 1)
|
||||||
{
|
{
|
||||||
if($this->iObsoleteBy)
|
if($this->iObsoleteBy)
|
||||||
$sObsolete = "checked=\"checked\"";
|
$sObsolete = "checked=\"checked\"";
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ if($aClean['iVersionId'] && $_SESSION['current']->isLoggedIn())
|
|||||||
echo html_frame_start("Upload Screenshot", "30%");
|
echo html_frame_start("Upload Screenshot", "30%");
|
||||||
echo 'If you would like to submit screenshots, please select an application version below.<br>';
|
echo 'If you would like to submit screenshots, please select an application version below.<br>';
|
||||||
echo '<ul>';
|
echo '<ul>';
|
||||||
foreach($oApp->getVersions() as $oVersion)
|
foreach($oApp->getVersions(true) as $oVersion)
|
||||||
echo '<li><a href="'.BASE.'screenshots.php?iVersionId='.$oVersion->objectGetId().'">'.$oVersion->sName.'</a></li>';
|
echo '<li><a href="'.BASE.'screenshots.php?iVersionId='.$oVersion->objectGetId().'">'.$oVersion->sName.'</a></li>';
|
||||||
|
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
|
|||||||
Reference in New Issue
Block a user