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


PHP Department::setName方法代码示例

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


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

示例1: loadDepartments

function loadDepartments($cid, $id)
{
    // subdepartments
    $departments = array();
    if ($id == -1) {
        $request = "SELECT * FROM department WHERE cid = {$cid} AND did IS NULL";
    } else {
        $request = "SELECT * FROM department WHERE cid = {$cid} and did = {$id}";
    }
    $result = mysql_query($request);
    $count = mysql_num_rows($result);
    while ($row = mysql_fetch_object($result)) {
        $department = new Department();
        $department->setId($row->id);
        $department->setName($row->name);
        $department->setDepartments(loadDepartments($cid, $row->id));
        $employees = loadEmployees($cid, $row->id);
        $department->setEmployees($employees);
        $inconsistent = containsManager($employees);
        if ($inconsistent == true) {
            $department->setInconsistent(true);
            $department->setMessage("No Manager!");
        }
        $departments[] = $department;
    }
    return $departments;
}
开发者ID:nuzil,项目名称:101repo,代码行数:27,代码来源:treeServer.php

示例2: installDepartments

function installDepartments()
{
    global $departmentsData, $departments;
    foreach ($departmentsData as $departmenName) {
        $department = new Department();
        $department->setName($departmenName);
        //        $em->persist($department);
        $departments[$departmenName] = $department;
    }
}
开发者ID:sailor744,项目名称:emp-directory,代码行数:10,代码来源:install.php

示例3: loadDepartment

function loadDepartment($jsonObject)
{
    $id = $jsonObject->id;
    // name
    $request = "SELECT * FROM department WHERE id = {$id}";
    $result = mysql_query($request);
    $row = mysql_fetch_object($result);
    $name = $row->name;
    // departments
    $departments = array();
    $request = "SELECT * FROM department WHERE did = {$id}";
    $result = mysql_query($request);
    $count = mysql_num_rows($result);
    while ($row = mysql_fetch_object($result)) {
        $departments[] = $row->name;
    }
    // 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)) {
        if ($row->manager == true) {
            $manager = $row->name;
        } else {
            $employees[] = $row->name;
        }
    }
    // total
    $total = totalDepartment($id);
    // create department object
    $department = new Department();
    $department->setDepartments($departments);
    $department->setEmployees($employees);
    $department->setManager($manager);
    $department->setName($name);
    $department->setTotal($total);
    // return department object
    return $department;
}
开发者ID:nuzil,项目名称:101repo,代码行数:40,代码来源:departmentServer.php

示例4: Department

<?php

/**
 * @copyright 2012 City of Bloomington, Indiana
 * @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
 * @author Cliff Ingham <inghamn@bloomington.in.gov>
 */
require_once './config.inc';
// Departments, People, and Categories foreign key each other
// We'll need to do an initial pass, then add the foreign keys
// Start with Departments adding only basic information
$result = $mongo->departments->find();
foreach ($result as $r) {
    $d = new Department();
    $d->setName($r['name']);
    if (isset($r['customStatuses'])) {
        $d->setCustomStatuses(implode(',', $r['customStatuses']));
    }
    if (isset($r['actions'])) {
        $actions = array();
        foreach ($r['actions'] as $a) {
            $actions[] = $a['name'];
        }
        $d->setActions($actions);
    }
    $d->save();
    echo "Department: {$d->getName()}\n";
}
// Load People records from Mongo
$result = $mongo->people->find();
foreach ($result as $row) {
开发者ID:CodeForEindhoven,项目名称:uReport,代码行数:31,代码来源:2_DepartmentsPeopleCategories.php

示例5: loadDepartment

function loadDepartment($id)
{
    // name
    $request = "SELECT * FROM department WHERE id = " . $id;
    $result = mysql_query($request);
    $row = mysql_fetch_object($result);
    $name = $row->name;
    $parent = $row->did;
    // departments
    $unselectable = unselectable($id);
    $departments = array();
    $request = "SELECT * FROM department WHERE id NOT IN (" . $unselectable . ")";
    $result = mysql_query($request);
    while ($row = mysql_fetch_object($result)) {
        $department["id"] = $row->id;
        $department["name"] = $row->name;
        if ($row->id == $parent) {
            $department["parent"] = true;
        } else {
            $department["parent"] = false;
        }
        $departments[] = $department;
    }
    // employees
    $employees = array();
    $request = "SELECT * FROM employee";
    $result = mysql_query($request);
    while ($row = mysql_fetch_object($result)) {
        $employee = array();
        $employee["id"] = $row->id;
        $employee["name"] = $row->name;
        if ($row->manager == true && $row->did == $id) {
            $employee["manager"] = true;
        } else {
            $employee["manager"] = false;
        }
        $employees[] = $employee;
    }
    // total
    $total = totalDepartment($id);
    // create department object
    $department = new Department();
    $department->setId($id);
    $department->setDepartments($departments);
    $department->setEmployees($employees);
    $department->setName($name);
    $department->setTotal($total);
    // return department object
    return $department;
}
开发者ID:nuzil,项目名称:101repo,代码行数:50,代码来源:departmentServer.php

示例6: unset

// Grab all the departments
$result = $pdo->query('select * from departments where dept_no!=0');
foreach ($result->fetchAll(PDO::FETCH_ASSOC) as $row) {
    unset($user);
    // Make sure we have at least one user for the department
    $query = $pdo->prepare('select userid from complain_authorized where dept=? order by role desc');
    $query->execute(array($row['dept_no']));
    $r = $query->fetch(PDO::FETCH_ASSOC);
    if ($r) {
        $person = new Person($r['userid']);
    } elseif (array_key_exists($row['dept_name'], $lookup)) {
        $person = new Person($lookup[$row['dept_name']]);
    }
    if (isset($person)) {
        $department = new Department();
        $department->setName($row['dept_name']);
        $department->setDefaultPerson($person);
        $query->closeCursor();
        // Load the Department's commonly used categories
        $sql = "select distinct c.comp_desc\n\t\t\t\tfrom ce_eng_comp a,c_types c\n\t\t\t\twhere a.c_type=c.c_type1 and a.dept=?\n\t\t\t\tand a.c_type is not null\n\t\t\t\tand a.c_type!=0\n\t\t\t\torder by c.comp_desc";
        $query = $pdo->prepare($sql);
        $query->execute(array($row['dept_no']));
        $department->setCategories($query->fetchAll(PDO::FETCH_COLUMN));
        try {
            $department->save();
            echo $department->getName() . "\n";
        } catch (Exception $e) {
            print_r($e);
            print_r($department);
            print_r($person);
            exit;
开发者ID:CodeForEindhoven,项目名称:uReport,代码行数:31,代码来源:4_departments.php


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