當前位置: 首頁>>代碼示例>>PHP>>正文


PHP People::CreatePerson方法代碼示例

本文整理匯總了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)
開發者ID:Gusenichka,項目名稱:openDCIM,代碼行數:67,代碼來源:install.php

示例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);
        }
    }
});
//
開發者ID:mnibbelink,項目名稱:openDCIM,代碼行數:31,代碼來源:index.php

示例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" : "";
開發者ID:ghasedak,項目名稱:openDCIM,代碼行數:31,代碼來源:usermgr.php


注:本文中的People::CreatePerson方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。