/** * @param ValueObject $other * * @return bool */ public function sameValueAs(Username $other) { if (!$other instanceof self) { return false; } return $this->toString() === $other->toString(); }
/** * Finds user by username * * @param string $username * @return static|null */ public static function findByUsername($username) { $dbUser = Username::find()->where(["username" => $username])->one(); if (!count($dbUser)) { return null; } return new static($dbUser); }
/** @test */ public function should_return_as_string() { $username = new Username('philipbrown'); $this->assertEquals('philipbrown', $username->toString()); }
} $stringIDs = implode(",", $IDs); while ($row = $objUserList->rNext()) { if ($row->NTID == $_GET[userName]) { $initiatorID = $row->userID; break; } } $updateStatus = $objTestbedList->updateMulti($stringIDs, $initiatorID, "Y"); $Error = $updateStatus ? '<p style="font-size: 13pt; font-weight: bold; color: green;" id="msg">Successfully Updated Lock Status</p>' : '<p style="font-size: 13pt; font-weight: bold; color: red;" id="msg">Failed to update Lock Status</p>'; } else { $Error = '<p style="font-size: 13pt; font-weight: bold; color: red;" id="msg">Wrong Password!</p>'; } } // After updating the lock status, refresh the list of unlocked testbeds $objUserList = new Username(); $objUserList->loadList(); $objTestbedList = new TestbedLocked(); $objTestbedList->addWhere("lockInitiatorID=userID"); //$objTestbedList->addWhere("launchServerID!=0"); $objTestbedList->addWhere("launchServerID > 0"); $objTestbedList->addWhere("lockStatus='N'"); $objTestbedList->loadlist(); $testbeds = array(); while ($row = $objTestbedList->rNext()) { $objElegibleTb = new lockElegibleTb(); $objElegibleTb->addWhere("testbed='TB:" . $row->testbed . "'"); $objElegibleTb->getElegibleTbList("TB:" . $row->testbed); $qualify_flag = 1; // if no entry found for this TB in queue table, automatically qualifies if ($objElegibleTb->rTotal() != 0) {
/** * @return \yii\db\ActiveQuery */ public function getUsername() { return $this->hasOne(Username::className(), ['id' => 'username']); }
/** * @param Username $other * * @return bool */ public function sameValueAs(Username $other) { return $this->toString() === $other->toString(); }
<?php include 'config.php'; include PRJ_ROOT_PATH . 'lang/lg_en.php'; include PRJ_CLASS_PATH . 'tzn_generic.php'; include PRJ_CLASS_PATH . TZN_DB_CLASS; include PRJ_CLASS_PATH . 'pkg_jobQueue.php'; $objUserList = new Username(); $objUserList->loadList(); $objTestbedList = new TestbedLocked(); $objTestbedList->addWhere("lockInitiatorID=userID"); //$objTestbedList->addWhere("launchServerID!=0"); $objTestbedList->addWhere("launchServerID > 0"); $objTestbedList->addWhere("lockStatus='Y'"); $objTestbedList->loadlist(); $Error = '<p style="font-size: 13pt; font-weight: bold; color: green;" id="msg"></p>'; if (isset($_GET[saveSelection])) { if ($_GET[password] == 'only4auto') { $IDs = array(); while ($row = $objTestbedList->rNext()) { if ($_GET['box' . $row->testbedID] == "on") { array_push($IDs, $row->testbedID); } } $stringIDs = implode(",", $IDs); while ($row = $objUserList->rNext()) { if ($row->NTID == $_GET[userName]) { $initiatorID = $row->userID; break; } }