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


PHP Employee::setName方法代码示例

本文整理汇总了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;
}
开发者ID:nuzil,项目名称:101repo,代码行数:33,代码来源:employeeServer.php

示例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;
 }
开发者ID:fishling,项目名称:empManager,代码行数:16,代码来源:EmployeeAccess.class.php

示例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;
}
开发者ID:nuzil,项目名称:101repo,代码行数:18,代码来源:employeeServer.php

示例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;
}
开发者ID:nuzil,项目名称:101repo,代码行数:21,代码来源:treeServer.php

示例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>

开发者ID:raynaldmo,项目名称:php-education,代码行数:23,代码来源:Employee.php

示例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();
开发者ID:JesseMcGilAllen,项目名称:madisoncollege_php_webdevelopment,代码行数:31,代码来源:indiv_setNget.php

示例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>";
//佐治
开发者ID:slogan-tech,项目名称:object_oriented,代码行数:31,代码来源:employee_capsule.php

示例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";
开发者ID:sameg14,项目名称:PHPMastery,代码行数:31,代码来源:visibility.php

示例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();
开发者ID:joshua1234511,项目名称:movies,代码行数:24,代码来源:test.php

示例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
 }
开发者ID:lejacome,项目名称:hospital-mgt,代码行数:75,代码来源:actions.class.php

示例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();
//佐治 和弘
开发者ID:slogan-tech,项目名称:object_oriented,代码行数:31,代码来源:employee_capsule_complete.php

示例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();
开发者ID:chrisbautista,项目名称:bcit-applied-development,代码行数:24,代码来源:index.php

示例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/>";
开发者ID:nadiaborisova,项目名称:php-mysql-course-softacad,代码行数:31,代码来源:index.php


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