本文整理汇总了PHP中People::CreatePerson方法的典型用法代码示例。如果您正苦于以下问题:PHP People::CreatePerson方法的具体用法?PHP People::CreatePerson怎么用?PHP People::CreatePerson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类People
的用法示例。
在下文中一共展示了People::CreatePerson方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade
//.........这里部分代码省略.........
$p = new People();
$c = new Contact();
$u = new User();
$plist = $p->GetUserList();
// Check if we have an empty fac_People table then merge if that's the case
if (sizeof($plist) == 0) {
$clist = $c->GetContactList();
foreach ($clist as $tmpc) {
foreach ($tmpc as $prop => $val) {
$p->{$prop} = $val;
}
// we're keeping the Contact ID so assign it to the PersonID
$p->PersonID = $tmpc->ContactID;
$u->UserID = $p->UserID;
$u->GetUserRights();
foreach ($u as $prop => $val) {
$p->{$prop} = $val;
}
// This shouldn't be necessary but...
$p->MakeSafe();
$sql = "INSERT INTO fac_People SET PersonID={$p->PersonID}, UserID=\"{$p->UserID}\", \n\t\t\t\t\tAdminOwnDevices={$p->AdminOwnDevices}, ReadAccess={$p->ReadAccess}, \n\t\t\t\t\tWriteAccess={$p->WriteAccess}, DeleteAccess={$p->DeleteAccess}, \n\t\t\t\t\tContactAdmin={$p->ContactAdmin}, RackRequest={$p->RackRequest}, \n\t\t\t\t\tRackAdmin={$p->RackAdmin}, SiteAdmin={$p->SiteAdmin}, Disabled={$p->Disabled}, \n\t\t\t\t\tLastName=\"{$p->LastName}\", FirstName=\"{$p->FirstName}\", \n\t\t\t\t\tPhone1=\"{$p->Phone1}\", Phone2=\"{$p->Phone2}\", Phone3=\"{$p->Phone3}\", \n\t\t\t\t\tEmail=\"{$p->Email}\";";
$dbh->query($sql);
}
$ulist = $u->GetUserList();
foreach ($ulist as $tmpu) {
/* This time around we have to see if the User is already in the fac_People table */
$p->UserID = $tmpu->UserID;
if (!$p->GetPersonByUserID()) {
foreach ($tmpu as $prop => $val) {
$p->{$prop} = $val;
}
// Names have changed formats between the user table and the people table
$p->LastName = $tmpu->Name;
$p->CreatePerson();
}
}
}
// END - People conversion
// CDU template conversion, to be done prior to device conversion
/*
I made a poor asumption on the initial build of this that we'd always have fewer
CDU templates than device templates. We're seeing an overlap conversion that is
screwing the pooch. This will find the highest template id from the two sets then
we'll jump the line on the device_template id's and get them lined up.
*/
$sql = "SELECT TemplateID FROM fac_CDUTemplate UNION SELECT TemplateID FROM \n\t\t\tfac_DeviceTemplate ORDER BY TemplateID DESC LIMIT 1;";
$baseid = $dbh->query($sql)->fetchColumn();
class PowerTemplate extends DeviceTemplate
{
function CreateTemplate($templateid = null)
{
global $dbh;
$this->MakeSafe();
$sqlinsert = is_null($templateid) ? '' : " TemplateID={$templateid},";
$sql = "INSERT INTO fac_DeviceTemplate SET ManufacturerID={$this->ManufacturerID}, \n\t\t\t\t\tModel=\"{$this->Model}\", Height={$this->Height}, Weight={$this->Weight}, \n\t\t\t\t\tWattage={$this->Wattage}, DeviceType=\"{$this->DeviceType}\", \n\t\t\t\t\tSNMPVersion=\"{$this->SNMPVersion}\", PSCount={$this->PSCount}, \n\t\t\t\t\tNumPorts={$this->NumPorts}, Notes=\"{$this->Notes}\", \n\t\t\t\t\tFrontPictureFile=\"{$this->FrontPictureFile}\", \n\t\t\t\t\tRearPictureFile=\"{$this->RearPictureFile}\",{$sqlinsert}\n\t\t\t\t\tChassisSlots={$this->ChassisSlots}, RearChassisSlots={$this->RearChassisSlots};";
if (!$dbh->exec($sql)) {
error_log("SQL Error: " . $sql);
return false;
} else {
$this->TemplateID = $dbh->lastInsertId();
class_exists('LogActions') ? LogActions::LogThis($this) : '';
$this->MakeDisplay();
return true;
}
}
static function Convert($row)
示例2: verifyRequiredParams
verifyRequiredParams(array('UserID'));
$response = array();
$p = new People();
$p->UserID = $app->request->put('UserID');
if ($p->GetPersonByUserID()) {
$response['error'] = true;
$response['errorcode'] = 403;
$response['message'] = __("UserID already in database. Use the update API to modify record.");
echoResponse(200, $response);
} else {
// Slim Framework will simply return null for any variables that were not passed, so this is safe to call without blowing up the script
foreach ($p as $prop) {
$p->{$prop} = $app->request->put($prop);
}
$p->Disabled = false;
$p->CreatePerson();
if ($p->PersonID == false) {
$response['error'] = true;
$response['errorcode'] = 403;
$response['message'] = __("Unable to create People resource with the given parameters.");
echoResponse(200, $response);
} else {
$response['error'] = false;
$responde['errorcode'] = 200;
$response['message'] = __("People resource created successfully.");
$response['people'] = $p;
echoResponse(200, $response);
}
}
});
//
示例3: isset
$userRights->FirstName = $_POST['FirstName'];
$userRights->Phone1 = $_POST['Phone1'];
$userRights->Phone2 = $_POST['Phone2'];
$userRights->Phone3 = $_POST['Phone3'];
$userRights->Email = $_POST['Email'];
$userRights->AdminOwnDevices = isset($_POST['AdminOwnDevices']) ? 1 : 0;
$userRights->ReadAccess = isset($_POST['ReadAccess']) ? 1 : 0;
$userRights->WriteAccess = isset($_POST['WriteAccess']) ? 1 : 0;
$userRights->DeleteAccess = isset($_POST['DeleteAccess']) ? 1 : 0;
$userRights->ContactAdmin = isset($_POST['ContactAdmin']) ? 1 : 0;
$userRights->RackRequest = isset($_POST['RackRequest']) ? 1 : 0;
$userRights->RackAdmin = isset($_POST['RackAdmin']) ? 1 : 0;
$userRights->SiteAdmin = isset($_POST['SiteAdmin']) ? 1 : 0;
$userRights->Disabled = isset($_POST['Disabled']) ? 1 : 0;
if ($_POST['action'] == 'Create') {
$userRights->CreatePerson();
// We've, hopefully, successfully created a new device. Force them to the new device page.
header('Location: ' . redirect("usermgr.php?PersonID={$userRights->PersonID}"));
exit;
} else {
$status = __("Updated");
$userRights->UpdatePerson();
}
} else {
//Should we ever add a delete user function it will go here
}
// Reload rights because actions like disable reset other rights
$userRights->GetUserRights();
}
$userList = $userRights->GetUserList();
$adminown = $userRights->AdminOwnDevices ? "checked" : "";