当前位置: 首页>>代码示例>>PHP>>正文


PHP People::GetPersonByUserID方法代码示例

本文整理汇总了PHP中People::GetPersonByUserID方法的典型用法代码示例。如果您正苦于以下问题:PHP People::GetPersonByUserID方法的具体用法?PHP People::GetPersonByUserID怎么用?PHP People::GetPersonByUserID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在People的用法示例。


在下文中一共展示了People::GetPersonByUserID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: function

//	Returns: record as created
//
$app->put('/people/:userid', function ($userid) use($app, $person) {
    if (!$person->ContactAdmin) {
        $response['error'] = true;
        $response['errorcode'] = 400;
        $response['message'] = "Insufficient privilege level";
        echoResponse(200, $response);
        $app->stop();
    }
    // Only one field is required - all others are optional
    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.");
开发者ID:mnibbelink,项目名称:openDCIM,代码行数:31,代码来源:index.php

示例2: upgrade


//.........这里部分代码省略.........
        // Reload the config;
        $config->Config();
        // We have several things to convert this time around.
        // Bring up the rest of the classes
        require_once "facilities.inc.php";
        // People conversion
        $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();
开发者ID:Gusenichka,项目名称:openDCIM,代码行数:67,代码来源:install.php


注:本文中的People::GetPersonByUserID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。