本文整理汇总了PHP中Report::setID方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::setID方法的具体用法?PHP Report::setID怎么用?PHP Report::setID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report::setID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadAll
/**
* Carica da database tutti i report per l'oggetto passato e li salva nell'oggetto.
* @param Editable $object un oggetto di cui si possono caricare i report.
* @return l'oggetto aggiornato
*/
function loadAll($object)
{
parent::load($object);
$objectClass = get_class($object);
$rs = $this->db->execute($s = Query::generateSelectStm(array($this->table), array(), array(new WhereConstraint($this->table->getColumn(REPORT_OBJECT_ID), Operator::EQUAL, $object->getID()), new WhereConstraint($this->table->getColumn(REPORT_OBJECT_CLASS), Operator::EQUAL, get_class($object))), array()));
$reports = array();
while ($row = $this->db->fetch_result()) {
$report = new Report(intval($row[DB::REPORT_USER]), $object, $row[DB::REPORT_TEXT]);
$report->setID($row[REPORT_ID]);
$reports[] = $report;
}
return $object->setReports($reports);
}
示例2: loadReports
/**
* Carica in this i report recuperati dal database per questo post (deve avere un ID!).
*/
function loadReports()
{
require_once "query.php";
$db = new DBManager();
if (!$db->connect_errno()) {
define_tables();
defineReportColumns();
$table = Query::getDBSchema()->getTable(TABLE_REPORT);
$rs = $db->execute($s = Query::generateSelectStm(array($table), array(), array(new WhereConstraint($table->getColumn(REPORT_POST), Operator::EQUAL, $this->getID())), array()), $table->getName(), $this);
if ($rs !== false) {
$reports = array();
while ($row = $db->fetch_result()) {
require_once "common.php";
$report = new Report(intval($row[REPORT_USER]), intval($row[REPORT_POST]), $row[REPORT_TEXT]);
$report->setID($row[REPORT_ID]);
$reports[] = $report;
}
$this->setReports($reports);
} else {
if ($db->errno()) {
$db->display_error("Post::loadReports()");
}
}
} else {
$db->display_connect_error("Post::loadReports()");
}
return $this;
}
示例3: reportPost
private function reportPost()
{
$report = new Report();
//update if an id exists
if (isset($this->request['id'])) {
$report->setID($this->request['id']);
}
$report->setDescription($this->request['description']);
//given name. get id
$report->setInvolvementKindID(getInvolvementKindID($this->request['involvementKind']));
//given name. get id
$report->setReportKindID(getReportKindID($this->request['reportKind']));
//set up location
if (!$this->requestFieldsSubmitted(["buildingName"])) {
$this->response['message'] = "error: missing location information";
$this->response['code'] = 400;
}
$locID = $this->setUpLocation();
if ($locID != -1) {
$report->setLocationID($locID);
} else {
$this->response['message'] = "error: invalid location information";
$this->response['code'] = 400;
}
//set up person
if (!$this->requestFieldsSubmitted(["personKind", "username", "name", "phone"])) {
$this->response['message'] = "error: missing person information";
$this->response['code'] = 400;
}
$personID = $this->setUpPerson();
if ($personID != -1) {
$report->setPersonID($personID);
} else {
$this->response['message'] = "error: invalid person data";
$this->response['code'] = 400;
}
//given dept name. get id
$report->setDepartmentID(getDepartmentID($this->request['department']));
$report->setDateTime($this->request['dateTime']);
$report->setStatusID($this->request['statusID']);
$report->setActionTaken($this->request['actionTaken']);
$report->save();
//return the report item in array format
return $report->toArray();
}