本文整理汇总了PHP中Department类的典型用法代码示例。如果您正苦于以下问题:PHP Department类的具体用法?PHP Department怎么用?PHP Department使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Department类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fillDepartment
function fillDepartment(Department $department, array $people)
{
foreach ($people as $value) {
for ($i = 0; $i < $value[0]; $i++) {
$department->addEmployee(new $value[1]($value[2]));
}
}
}
示例2: start_el
/**
* [start_el description]
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $elem Department data object.
* @param int $depth Depth of Department. Used for padding.
* @param int $current_page Department ID.
* @param array $args
*
* @return void
*/
public function start_el(&$output, $elem, $depth = 0, $args = array(), $id = 0)
{
static $alternate;
$department = new Department($elem);
$alternate = 'alternate' == $alternate ? 'even' : 'alternate';
$padding = str_repeat('— ', $depth);
?>
<tr class="<?php
echo $alternate;
?>
" id="erp-dept-<?php
echo $department->id;
?>
">
<th scope="row" class="check-column">
<input id="cb-select-1" type="checkbox" name="dept[]" value="1">
</th>
<td class="col-">
<strong><a href="#"><?php
echo $padding . $department->name;
?>
</a></strong>
<div class="row-actions">
<span class="edit"><a href="#" data-id="<?php
echo $department->id;
?>
" title="Edit this item"><?php
_e('Edit', 'wp-erp');
?>
</a> | </span>
<span class="trash"><a class="submitdelete" data-id="<?php
echo $department->id;
?>
" title="Delete this item" href="#"><?php
_e('Delete', 'wp-erp');
?>
</a></span>
</div>
</td>
<td class="col-">
<?php
if ($lead = $department->get_lead()) {
echo $lead->get_link();
} else {
echo '-';
}
?>
</td>
<td class="col-"><?php
echo $department->num_of_employees();
?>
</td>
</tr>
<?php
}
示例3: installDepartments
function installDepartments()
{
global $departmentsData, $departments;
foreach ($departmentsData as $departmenName) {
$department = new Department();
$department->setName($departmenName);
// $em->persist($department);
$departments[$departmenName] = $department;
}
}
示例4: list_drop
function list_drop()
{
$dept = new Department();
$dept->get();
foreach ($dept as $row) {
$data[''] = '[ Pilih Departement ]';
$data[$row->dept_name] = $row->dept_name;
}
return $data;
}
示例5: getDepartmentList
function getDepartmentList($compCode)
{
App::import("Model", "Department");
$model = new Department();
$con2 = $model->find('list', array('fields' => array('Department.dept_code', 'Department.dept_name'), 'conditions' => array('Department.comp_code' => $compCode)));
if (empty($con2)) {
return 0;
} else {
return $con2;
}
}
示例6: fillTheDepartment
private function fillTheDepartment(Department $department, $addToDepartment)
{
foreach ($addToDepartment as $item) {
foreach ($item as $count => $employee) {
for ($i = 0; $i < $count; $i++) {
$em = new $employee[0]($employee[1], $employee[2]);
$department->addEmployee($em);
}
}
}
}
示例7: depUid
/**
* Validate dep_uid
* @var string $dep_uid. Uid for Departament
* @var string $nameField. Name of field for message
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return string
*/
public static function depUid($dep_uid, $nameField = 'dep_uid')
{
$dep_uid = trim($dep_uid);
if ($dep_uid == '') {
throw new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array($nameField, '')));
}
$oDepartment = new \Department();
if (!$oDepartment->existsDepartment($dep_uid)) {
throw new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array($nameField, $dep_uid)));
}
return $dep_uid;
}
示例8: executeAdd
public function executeAdd(sfWebRequest $request)
{
if ($request->isMethod('Post')) {
$department = new Department();
$department->setTitle($request->getParameter('title'));
//$department->setDescription($request->getParameter('description'));
$department->setStatus(Constant::RECORD_STATUS_ACTIVE);
$department->save();
$this->getUser()->setFlash('SUCCESS_MESSAGE', Constant::RECORD_ADDED_SUCCESSFULLY);
$this->redirect('Department/list');
}
//end if
}
示例9: department_list
function department_list($id = null)
{
if ($id) {
$dept = new Department($id);
$list = new Department();
$list->where('parent_id', $id);
$list->order_by('orders', 'asc');
$list->get();
child_personnel(0, $id, $dept->title);
foreach ($list as $key_tmp => $tmp) {
department_list($tmp->id);
}
}
}
示例10: index
/**
* index method
*
* @return void
*/
public function index()
{
$this->layout = 'ajax';
$limit = 5;
$page = 2;
$dept_id = null;
// debug($page= $this->request);
$page = $this->request->query['page'];
$limit = $this->request->query['limit'];
$this->Paginator->settings['page'] = $page;
$this->Paginator->settings['limit'] = $limit;
// $this->Paginator->settings =array('limit'=>$limit,'page'=>$page);
if (isset($this->request->query['dept_number'])) {
$dept_number = $this->request->query['dept_number'];
App::import('Model', 'Department');
App::import('Controller', 'Departments');
$Department = new Department();
$dept_id = $Department->findByDept_number($dept_number)['Department']['id'];
$DepartmentsController = new DepartmentsController();
$depts = $DepartmentsController->getChildren($dept_id);
// debug($depts);
$deptdata = array();
foreach ($depts as $dept) {
$deptdata[] = $dept['dept_number'];
}
$logdept = array();
// debug(count($deptdata));
for ($i = 0; $i < count($deptdata); $i++) {
$logdept[] = array('logdept like' => $deptdata[$i] . '%');
}
if (count($depts) == 0) {
$deptdata = $dept_number;
$logdept = array('logdept like' => $deptdata . '%');
}
// debug($deptdata);
$conditions = array('or' => array('dept_number' => $deptdata, 'or' => $logdept));
// debug($conditions);
$this->Paginator->settings = array('conditions' => $conditions);
}
if (isset($this->request->query['stu_name'])) {
$qurey = $this->request->query['stu_name'];
$conditions = array('or' => array('stu_name like' => '%' . $qurey . '%', 'stu_number like' => $qurey . '%', 'id_card_number like' => $qurey . '%', 'note like' => '%' . $qurey . '%'));
$this->Paginator->settings = array('conditions' => $conditions);
}
$this->Paginator->settings['page'] = $page;
$this->Paginator->settings['limit'] = $limit;
$this->Student->recursive = 0;
$this->set('students', $this->Paginator->paginate());
}
示例11: get_by_doctor
public function get_by_doctor($id)
{
$conn = $this->db->conn;
try {
$query = $conn->prepare("\n\t\t\t\t\t\t\t\t\t\tSELECT De.Acronim, De.ID, De.Image, C.Content as Name\n\t\t\t\t\t\t\t\t\t\tFROM Departments as De \n\t\t\t\t\t\t\t\t\t\tINNER JOIN DepartmentsDoctors as DD ON De.ID = DD.DepartmentID\n\t\t\t\t\t\t\t\t\t\tINNER JOIN Doctors as D ON DD.DoctorID = D.ID\n\t\t\t\t\t\t\t\t\t\tINNER JOIN Contents as C \n\t\t\t\t\t\t\t\t\t\tON De.NameContentID = C.ID \n\t\t\t\t\t\t\t\t\t\tWHERE D.ID = ? AND C.Lang = ? AND De.Active = 1\n\t\t\t\t\t\t\t\t\t");
$query->execute(array($id, $this->db->lang));
} catch (PDOException $e) {
echo "Error: " . $e;
}
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
$department = new Department($this->db);
$department->update_class($row);
array_push($this->departments, $department);
}
}
示例12: editAction
public function editAction()
{
if ($this->isAjax()) {
$data = $this->request->getPost();
if (empty($data)) {
$this->pageError('param');
}
$modelForm = new DepartmentForm('edit');
if ($result = $modelForm->validate($data)) {
if ($modelForm->edit()) {
$this->success('操作成功');
} else {
$this->error('操作失败');
}
}
$this->error($result);
}
$oid = $this->dispatcher->getParams()[0];
if (empty($oid)) {
$this->pageError('param');
}
$operator = Department::findById($oid);
if (!$operator) {
$this->pageError('param');
}
$form = new DepartmentForm('edit', $operator);
$this->view->setVars(['formparams' => ['event' => 'edit', 'action' => \Func\url('/department/edit')], 'data' => $operator]);
$this->view->pick('department/add');
}
示例13: actionForm
public function actionForm($id = null)
{
if (Yii::app()->session["username"] != null) {
$this->layout = "main";
} else {
$this->layout = "front";
}
$model = new Department();
if (!empty($_POST["Department"])) {
// 1.step new Department
$model = new Department();
// 2.step edit Department
if (!empty($id)) {
$model = Department::model()->findByPk($id);
}
// 3. step merge data
$model->_attributes = $_POST["Department"];
// 6. step save/update
if ($model->save()) {
$this->redirect("index.php?r=department");
}
}
if (!empty($id)) {
$model = Department::model()->findByPk($id);
}
$this->render("//department/form", array("model" => $model));
}
示例14: checkReadScope
public static function checkReadScope($uid, $data)
{
if ($data["deptid"] == "alldept") {
return true;
}
if ($uid == $data["author"]) {
return true;
}
if (empty($data["deptid"]) && empty($data["positionid"]) && empty($data["uid"])) {
return true;
}
$user = User::model()->fetch(array("select" => array("deptid", "positionid"), "condition" => "uid=:uid", "params" => array(":uid" => $uid)));
$childDeptid = Department::model()->fetchChildIdByDeptids($data["deptid"]);
if (StringUtil::findIn($user["deptid"], $childDeptid . "," . $data["deptid"])) {
return true;
}
$childCcDeptid = Department::model()->fetchChildIdByDeptids($data["ccdeptid"]);
if (StringUtil::findIn($user["deptid"], $childCcDeptid . "," . $data["ccdeptid"])) {
return true;
}
if (StringUtil::findIn($data["positionid"], $user["positionid"])) {
return true;
}
if (StringUtil::findIn($data["uid"], $uid)) {
return true;
}
if (StringUtil::findIn($data["ccpositionid"], $user["positionid"])) {
return true;
}
if (StringUtil::findIn($data["ccuid"], $uid)) {
return true;
}
return false;
}
示例15: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Department::create([]);
}
}