Add objectManager support to the monitor class
This commit is contained in:
committed by
WineHQ
parent
a923d0ff2f
commit
89c50400de
@@ -19,15 +19,20 @@ class Monitor {
|
|||||||
* Constructor.
|
* Constructor.
|
||||||
* If $iMonitorId is provided, fetches Monitor.
|
* If $iMonitorId is provided, fetches Monitor.
|
||||||
*/
|
*/
|
||||||
function Monitor($iMonitorId="")
|
function Monitor($iMonitorId="", $oRow = null)
|
||||||
{
|
{
|
||||||
if($iMonitorId)
|
if(!$iMonitorId && !$oRow)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!$oRow)
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT *
|
$sQuery = "SELECT *
|
||||||
FROM appMonitors
|
FROM appMonitors
|
||||||
WHERE monitorId = '".$iMonitorId."'";
|
WHERE monitorId = '".$iMonitorId."'";
|
||||||
$hResult = query_appdb($sQuery);
|
$hResult = query_appdb($sQuery);
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
|
}
|
||||||
|
|
||||||
if($oRow)
|
if($oRow)
|
||||||
{
|
{
|
||||||
$this->iMonitorId = $oRow->monitorId;
|
$this->iMonitorId = $oRow->monitorId;
|
||||||
@@ -36,7 +41,6 @@ class Monitor {
|
|||||||
$this->iUserId = $oRow->userId;
|
$this->iUserId = $oRow->userId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function find($iUserId, $iVersionId=0)
|
function find($iUserId, $iVersionId=0)
|
||||||
{
|
{
|
||||||
@@ -98,8 +102,12 @@ class Monitor {
|
|||||||
$hResult = query_parameters("DELETE FROM appMonitors WHERE monitorId = '?'", $this->iMonitorId);
|
$hResult = query_parameters("DELETE FROM appMonitors WHERE monitorId = '?'", $this->iMonitorId);
|
||||||
if(!$bSilent)
|
if(!$bSilent)
|
||||||
$this->SendNotificationMail("delete");
|
$this->SendNotificationMail("delete");
|
||||||
}
|
|
||||||
|
|
||||||
|
if(!$hResult)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
function SendNotificationMail($sAction="add",$sMsg=null)
|
function SendNotificationMail($sAction="add",$sMsg=null)
|
||||||
{
|
{
|
||||||
@@ -139,6 +147,99 @@ class Monitor {
|
|||||||
mail_appdb($sEmail, $sSubject ,$sMsg);
|
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function canEdit()
|
||||||
|
{
|
||||||
|
if($_SESSION['current']->hasPriv("admin") ||
|
||||||
|
($this->iUserId == $_SESSION['current']->iUserId))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mustBeQueued()
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stub */
|
||||||
|
function display()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stub */
|
||||||
|
function getOutputEditorValues()
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stub */
|
||||||
|
function objectGetHeader()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetId()
|
||||||
|
{
|
||||||
|
return $this->iMonitorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stub */
|
||||||
|
function objectGetTableRow()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stub */
|
||||||
|
function objectMakeLink()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stub */
|
||||||
|
function objectMakeUrl()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stub */
|
||||||
|
function outputEditor()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetEntries($bQueued, $bRejected)
|
||||||
|
{
|
||||||
|
$hResult = query_parameters("SELECT * FROM appMonitors");
|
||||||
|
|
||||||
|
if(!$hResult)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return $hResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetEntriesCount($bQueued, $bRejected)
|
||||||
|
{
|
||||||
|
$hResult = query_parameters("SELECT COUNT(DISTINCT monitorId) as count
|
||||||
|
FROM appMonitors");
|
||||||
|
|
||||||
|
if(!$hResult)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
$oRow = mysql_fetch_object($hResult);
|
||||||
|
|
||||||
|
if(!$oRow)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return $oRow->count;
|
||||||
|
}
|
||||||
|
|
||||||
|
function allowAnonymousSubmissions()
|
||||||
|
{
|
||||||
|
/* That makes no sense */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Retrieve the user's monitored versions */
|
/* Retrieve the user's monitored versions */
|
||||||
function getVersionsMonitored($oUser)
|
function getVersionsMonitored($oUser)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ require_once(BASE.'include/testData_queue.php');
|
|||||||
require_once(BASE.'include/version_queue.php');
|
require_once(BASE.'include/version_queue.php');
|
||||||
require_once(BASE.'include/application_queue.php');
|
require_once(BASE.'include/application_queue.php');
|
||||||
require_once(BASE.'include/browse_newest_apps.php');
|
require_once(BASE.'include/browse_newest_apps.php');
|
||||||
|
require_once(BASE.'include/monitor.php');
|
||||||
|
|
||||||
/* internal function */
|
/* internal function */
|
||||||
function test_class($sClassName, $aTestMethods)
|
function test_class($sClassName, $aTestMethods)
|
||||||
@@ -252,6 +253,7 @@ function test_object_methods()
|
|||||||
"distribution",
|
"distribution",
|
||||||
"downloadurl",
|
"downloadurl",
|
||||||
"maintainer",
|
"maintainer",
|
||||||
|
"monitor",
|
||||||
"note",
|
"note",
|
||||||
"screenshot",
|
"screenshot",
|
||||||
"testData",
|
"testData",
|
||||||
|
|||||||
Reference in New Issue
Block a user