本文整理汇总了PHP中Employee::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::setName方法的具体用法?PHP Employee::setName怎么用?PHP Employee::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Employee
的用法示例。
在下文中一共展示了Employee::setName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadEmployee
function loadEmployee($id)
{
// name
$request = "SELECT * FROM employee WHERE id = {$id}";
$result = mysql_query($request);
$row = mysql_fetch_object($result);
$name = $row->name;
$address = $row->address;
$salary = $row->salary;
$did = $row->did;
$departments = array();
$request = "SELECT * FROM department";
$result = mysql_query($request);
while ($row = mysql_fetch_object($result)) {
$department["id"] = $row->id;
$department["name"] = $row->name;
if ($row->id == $did) {
$department["parent"] = true;
} else {
$department["parent"] = false;
}
$departments[] = $department;
}
// create employee object
$employee = new Employee();
$employee->setId($id);
$employee->setName($name);
$employee->setAddress($address);
$employee->setSalary($salary);
$employee->setDepartments($departments);
// return employee object
return $employee;
}
示例2: constructReturnArr
public function constructReturnArr($res)
{
$arr = array();
$i = 0;
while ($row = mysql_fetch_assoc($res)) {
$emp = new Employee();
$emp->setName($row['name']);
$emp->setCode($row['code']);
$emp->setSalary($row['salary']);
$emp->setGrade($row['grade']);
$arr[$i] = $emp;
$i++;
}
$this->getConnection()->releaseRes($res);
return $arr;
}
示例3: loadEmployee
function loadEmployee($jsonObject)
{
$id = $jsonObject->id;
// name
$request = "SELECT * FROM employee WHERE id = {$id}";
$result = mysql_query($request);
$row = mysql_fetch_object($result);
$name = $row->name;
$address = $row->address;
$salary = $row->salary;
// create department object
$employee = new Employee();
$employee->setName($name);
$employee->setAddress($address);
$employee->setSalary($salary);
// return department object
return $employee;
}
示例4: loadEmployees
function loadEmployees($cid, $id)
{
// employees
$employees = array();
$request = "SELECT * FROM employee WHERE did = {$id}";
$result = mysql_query($request);
$count = mysql_num_rows($result);
while ($row = mysql_fetch_object($result)) {
$maximumSalary = getMaximumSalaryForEmployee($row->did, $row->manager);
$employee = new Employee();
if ($row->salary > $maximumSalary) {
$employee->setInconsistent(true);
$employee->setMessage("Salary > {$maximumSalary}");
}
$employee->setId($row->id);
$employee->setName($row->name);
$employee->setManager($row->manager);
$employees[] = $employee;
}
return $employees;
}
示例5: Employee
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Employees</title>
</head>
<body>
<h3>Employees</h3>
<?php
include './Employee.php';
include './Manager.php';
$emp1 = new Employee();
$emp1->setName("Raynald");
echo "{$emp1->getName()}";
// $emp1->name = "Pancho"; // Causes error
$manager = new Manager();
$manager->setName('raynaldmo');
echo "{$manager->getName()}";
?>
</body>
</html>
示例6: setPhone
}
function setPhone($phone)
{
$this->phone = $phone;
}
function getPhone()
{
return $this->phone;
}
function printPersonInfo()
{
echo "<hr><b>Employee Info</b><br>";
echo $this->name . "<br>\n";
echo $this->address . "<br>\n";
echo $this->phone . "<br>\n";
}
}
// Create objects of the class
$Heidi = new Employee();
$Heidi->setName("Heidi Clum");
$Heidi->setAddress("1234 Somewhere Blvd ");
$Heidi->setPhone("123-456-7890");
echo $Heidi->getName() . "<br>\n";
echo $Heidi->getAddress() . "<br>\n";
echo $Heidi->getPhone() . "<br>\n";
$Brad = new Employee();
$Brad->setName("Brad Bit");
$Brad->setAddress("4321 Sunset Blvd ");
$Brad->setPhone("987-654-3210");
$Heidi->printPersonInfo();
$Brad->printPersonInfo();
示例7: __construct
{
public $name;
public $age;
public $job;
public $salary;
public function __construct()
{
$this->name = "名無しさん";
$this->age = 0;
$this->job = "研修員";
$this->salary = 300;
}
public function work()
{
echo '働いている!';
}
public function getName()
{
return $this->name;
}
public function setName($name)
{
$this->name = $name;
}
}
$saji = new Employee();
echo $saji->getName() . "<BR>";
//名無しさん
$saji->setName("佐治");
echo $saji->getName() . "<BR>";
//佐治
示例8: getMedicalCondition
{
$this->name = $name;
}
/**
* @return string
*/
public function getMedicalCondition()
{
return $this->medicalCondition;
}
/**
* @param string $medicalCondition
*/
public function setMedicalCondition($medicalCondition)
{
$this->medicalCondition = $medicalCondition;
}
// public function __construct($name, $medicalCondition){
// $this->name = $name;
// $this->medicalCondition = $medicalCondition;
// }
public function createBadge()
{
return 'EmployeeBadge: ' . $this->getName() . ' Has the condition: ' . $this->getMedicalCondition();
}
}
$Adult = new Employee();
$Adult->setMedicalCondition('The Shakes');
$Adult->setName('John Doe');
echo $Adult->createBadge();
echo "\n\n";
示例9: setName
<?php
class Test
{
public $name;
public function setName($name)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
}
class Employee extends Test
{
public function __toString()
{
echo $this->name;
}
}
$me1 = new Employee();
$me1->setName('Joshua');
echo $me1->getName();
示例10: executeAddStaff
public function executeAddStaff(sfWebRequest $request)
{
if ($request->isMethod('Post')) {
/*Varialbes for Redirecting
$user_name = $this->getRequestParameter('user_name');
$password = $this->getRequestParameter('password');
if (strlen($password) != 0)
{
$password = md5($password);
}
else $password = '';*/
// Setting Department from Selected Designation
$a = new Criteria();
$a->add(DesignationPeer::ID, $this->getRequestParameter('designation_id'));
$designation_record = DesignationPeer::DoSelectOne($a);
$department_id = $designation_record->getDepartmentId();
// Checking if Entered Username already exist
/*if($user_name != NULL)
{
$c = new Criteria ( );
$c->add(UserPeer::STATUS, Constant::RECORD_STATUS_DELETED, Criteria::NOT_EQUAL );
$c->add(UserPeer::USER, $user_name);
$check_username = UserPeer::doSelectOne($c);
if ($check_username)
{
$this->getUser ()->setFlash ( 'ERROR_MESSAGE', 'Username Already exist. Please Choose Different Username.' );
$this->redirect ('Register/add');
}
}*/
$employee = new Employee();
$employee->setRoleId($this->getRequestParameter('role_id'));
$employee->setName($this->getRequestParameter('name'));
$employee->setCnic($this->getRequestParameter('cnic'));
$employee->setDob($this->getRequestParameter('dob'));
$employee->setGender($this->getRequestParameter('gender[0]'));
$employee->setContactCell($this->getRequestParameter('contact_cell'));
$employee->setContactRes($this->getRequestParameter('contact_res'));
$employee->setContactOff($this->getRequestParameter('contact_off'));
$employee->setEmergencyContact($this->getRequestParameter('emergency_contact'));
$employee->setMailAddress($this->getRequestParameter('mail_address'));
$employee->setDesignationId($this->getRequestParameter('designation_id'));
$employee->setDepartmentId($department_id);
//$employee->setRoleId(2);
$employee->setEmploymentDate($this->getRequestParameter('employment_date'));
$employee->setLocalResident($this->getRequestParameter('local[0]'));
$employee->setQualification($this->getRequestParameter('qualification'));
$employee->setEmpCategory('staff');
$employee->setStatus(Constant::RECORD_STATUS_ACTIVE);
$employee->save();
$this->getUser()->setFlash('SUCCESS_MESSAGE', Constant::REGISTRATION_ACCOUNT_APPROVAL);
$this->redirect('Employee/list');
/*if($user_name != NULL)
{
$user = new User();
$user->setEmployeeId($employee_id);
$user->setUser($user_name);
$user->setPassword($password);
$user->setStatus(Constant::RECORD_STATUS_ACTIVE);
$user->save();
// TODO: Default Rights here
}// END if
$this->getUser ()->setFlash ( 'SUCCESS_MESSAGE', Constant::REGISTRATION_ACCOUNT_APPROVAL );
$this->redirect('Register/list');
*/
}
// end IF
}
示例11: __construct
private $first_name;
private $last_name;
private $age;
private $job;
private $salary;
public function __construct()
{
$this->last_name = "名無し";
$this->first_name = "さん";
$this->age = 0;
$this->job = "研修員";
$this->salary = 300;
}
public function work()
{
echo '働いている!';
}
public function getName()
{
return $this->last_name . " " . $this->first_name;
}
public function setName($last_name, $first_name)
{
$this->last_name = $last_name;
$this->first_name = $first_name;
}
}
$saji = new Employee();
$saji->setName("佐治", "和弘");
echo $saji->getName();
//佐治 和弘
示例12: Person
<?php
// load all classes we need
require 'NameInterface.php';
require 'AbstractAge.php';
require 'Person.php';
require 'Employee.php';
require 'Animal.php';
require 'Application.php';
// thanks to the abstract class, Person has setAge method enforced
$person = new Person();
$person->setAge(10);
$person->setName("Gary Tong");
// thanks to inheritance, Employee has the Person methods available
$employee = new Employee();
$employee->setAge(30);
$employee->setName("Gary Tong");
// thanks to an interface, Animal has the setName method enforced
$animal = new Animal();
$animal->setName("Snofu Tong");
$app = new Application($person);
echo $app::VERSION;
// get the class constant
$app->run();
示例13: Teacher
$newTchr2->store();
$newTchr2->displayInfo();
$newTchr3 = new Teacher();
$newTchr3->setName('Ivan');
$newTchr3->setSurname('Ivanov');
$newTchr3->setFamilyName('Todorov');
$newTchr3->setPersonalId(789012134);
$newTchr3->setItem('Math');
$newTchr3->store();
$newTchr3->displayInfo();
$newEmpl1 = new Employee();
$newEmpl1->setName('Milena');
$newEmpl1->setSurname('Todorova');
$newEmpl1->setFamilyName('Todorova');
$newEmpl1->setPersonalId(233456789);
$newEmpl1->setPosition('Librarist');
$newEmpl1->store();
$newEmpl1->displayInfo();
$newEmpl2 = new Employee();
$newEmpl2->setName('Petia');
$newEmpl2->setSurname('Ivanova');
$newEmpl2->setFamilyName('Todorova');
$newEmpl2->setPersonalId(890412345);
$newEmpl2->setPosition('Cleaner');
$newEmpl2->store();
$newEmpl2->setPosition('Accountant');
$newEmpl2->store();
$newEmpl2->displayInfo();
echo "Total students: " . Student::$addNewStudent . "<br/>";
echo "Total lectors: " . Teacher::$addNewTeacher . "<br/>";
echo "Total employees: " . Employee::$addNewEmployee . "<br/><hr/>";