本文整理汇总了PHP中Department::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Department::getName方法的具体用法?PHP Department::getName怎么用?PHP Department::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Department
的用法示例。
在下文中一共展示了Department::getName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Department
function test_getName()
{
//Arrange
$name = "Biology";
$address = "346 Stupid Avenue";
$test_department = new Department($name, $address);
//Act
$result = $test_department->getName();
//Assert
$this->assertEquals($name, $result);
}
示例2: urlencode
$stmt = $pdo->prepare($query);
$stmt->execute(array(':assigned_id' => $_REQUEST['assigned_id'], ':id' => $_REQUEST['id']));
// Update entries in dept_reviewer
$query = "UPDATE {$GLOBALS['CONFIG']['db_prefix']}dept_reviewer SET dept_id = :assigned_id WHERE dept_id = :id";
$stmt = $pdo->prepare($query);
$stmt->execute(array(':assigned_id' => $_REQUEST['assigned_id'], ':id' => $_REQUEST['id']));
// Delete from department
$query = "DELETE FROM {$GLOBALS['CONFIG']['db_prefix']}department where id = :id";
$stmt = $pdo->prepare($query);
$stmt->execute(array(':id' => $_REQUEST['id']));
// back to main page
$last_message = urlencode(msg('message_all_actions_successfull') . ' id:' . (int) $_REQUEST['id']);
header('Location: admin.php?last_message=' . $last_message);
} elseif (isset($_REQUEST['submit']) && $_REQUEST['submit'] == 'modify') {
$dept_obj = new Department($_REQUEST['item'], $pdo);
draw_header(msg('area_update_department') . ': ' . $dept_obj->getName(), $last_message);
?>
<form action="department.php" id="modifyDeptForm" method="POST" enctype="multipart/form-data">
<table border="0" cellspacing="5" cellpadding="5">
<tr>
<?php
$query = "SELECT id, name FROM {$GLOBALS['CONFIG']['db_prefix']}department where id = :item";
$stmt = $pdo->prepare($query);
$stmt->execute(array(':item' => $_REQUEST['item']));
$result = $stmt->fetchAll();
foreach ($result as $row) {
?>
<td>
<b><?php
示例3: delDepartment
/**
* Delete a department from database with the passed ID.
*/
public static function delDepartment($departmentId)
{
$dept = new Department($departmentId);
if ($dept->id == 0) {
// Department wasn't loaded correctly
NQ::simple('intern', INTERN_ERROR, "Error occurred while loading department from database.");
return;
}
$name = $dept->getName();
try {
// Try to delete department.
if (!$dept->delete()) {
// Something bad happend. This should have been caught in the check above...
NQ::simple('intern', INTERN_SUCCESS, "Error occurred deleting department from database.");
return;
}
} catch (Exception $e) {
NQ::simple('intern', INTERN_ERROR, $e->getMessage());
return;
}
// Department deleted successfully.
NQ::simple('intern', INTERN_SUCCESS, "Deleted department <i>{$name}</i>");
}
示例4: sendInternshipCancelNotice
public static function sendInternshipCancelNotice(Internship $i)
{
$settings = InternSettings::getInstance();
$tpl = array();
$tpl['NAME'] = $i->getFullName();
$tpl['BANNER'] = $i->banner;
$tpl['TERM'] = Term::rawToRead($i->term);
$dept = new Department($i->department_id);
$tpl['DEPARTMENT'] = $dept->getName();
$to = $i->email . '@appstate.edu';
$faculty = $i->getFaculty();
if ($faculty instanceof Faculty) {
$cc = array($faculty->getUsername() . '@' . $settings->getEmailDomain(), $settings->getRegistrarEmail());
} else {
$cc = array();
}
$subject = 'Internship Cancelled ' . Term::rawToRead($i->getTerm()) . '[' . $i->getBannerId() . '] ' . $i->getFullName();
Email::sendTemplateMessage($to, $subject, 'email/StudentCancellationNotice.tpl', $tpl, $cc);
}
示例5: Department
}
$c->save();
echo "Category: {$c->getName()}\n";
}
// Now that we've got People and Categories in the database,
// Link the Departments with their Categories and Default Person
$result = $mongo->departments->find();
foreach ($result as $r) {
$d = new Department($r['name']);
if (!empty($r['defaultPerson']['_id'])) {
$id = getPersonIdFromCrosswalk($r['defaultPerson']['_id']);
$d->setDefaultPerson_id($id);
}
if (!empty($r['categories'])) {
$ids = array();
foreach ($r['categories'] as $c) {
try {
$category = new Category($c['name']);
$ids[] = $category->getId();
} catch (Exception $e) {
// Departments may have old categories we have deleted
// Just ignore them
}
}
$d->setCategories($ids);
}
$d->save();
$p = $d->getDefaultPerson();
$p = $p ? $p->getFullname() : '';
echo "Department: {$d->getName()} Person: {$p}\n";
}
示例6: processvariablesAction
function processvariablesAction()
{
$session = SessionWrapper::getInstance();
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
$formvalues = $this->_getAllParams();
// debugMessage($formvalues); // exit;
if (isArrayKeyAnEmptyString('noreload', $formvalues)) {
$hasnoreload = false;
} else {
$hasnoreload = true;
}
$haserror = false;
if (isArrayKeyAnEmptyString('value', $formvalues) && !$hasnoreload) {
$haserror = true;
$session->setVar(ERROR_MESSAGE, 'Error: No value specified for addition');
$session->setVar(FORM_VALUES, $formvalues);
$this->_helper->redirector->gotoUrl($this->view->baseUrl('config/variables/' . $formvalues['lookupid']));
}
$successurl = $this->view->baseUrl('config/variables/type/' . $formvalues['lookupid']);
$type_ext = '';
$alias = '';
if (!isArrayKeyAnEmptyString('alias', $formvalues)) {
$alias = trim($formvalues['alias']);
if ($alias == 'undefined') {
$alias = '';
}
}
if ($formvalues['lookupid'] == 7) {
$alias = decode($formvalues['alias']);
if (isArrayKeyAnEmptyString('id', $formvalues)) {
$alias = $formvalues['alias'];
}
}
// exit;
// debugMessage()
switch ($formvalues['lookupid']) {
case 9:
$formvalues['defaultamount'] = $formvalues['alias'];
if (!isArrayKeyAnEmptyString('id', $formvalues)) {
$formvalues['defaultamount'] = decode($formvalues['alias']);
}
$formvalues['amounttype'] = $formvalues['alias2'];
$formvalues['name'] = decode(trim($formvalues['value']));
if (!isArrayKeyAnEmptyString('id', $formvalues)) {
$formvalues['name'] = $formvalues['name'];
}
$formvalues['companyid'] = getCompanyID();
$benefittype = new BenefitType();
if (!isArrayKeyAnEmptyString('id', $formvalues)) {
$benefittype->populate($formvalues['id']);
$formvalues['lastupdatedby'] = $session->getVar('userid');
} else {
$formvalues['createdby'] = $session->getVar('userid');
}
$benefittype->processPost($formvalues);
/* debugMessage($benefittype->toArray());
debugMessage('errors are '.$benefittype->getErrorStackAsString()); exit(); */
$result = array('id' => '', 'name' => '', 'error' => '');
if ($benefittype->hasError()) {
$session->setVar(ERROR_MESSAGE, $benefittype->getErrorStackAsString());
$session->setVar(FORM_VALUES, $formvalues);
$result['error'] = $benefittype->getErrorStackAsString();
} else {
try {
$benefittype->save();
// debugMessage($benefittype->toArray()); exit;
$result = array('id' => $benefittype->getID(), 'name' => $benefittype->getName(), 'alias' => $benefittype->getdefaultamount(), 'alias2' => $benefittype->getamounttype());
$session->setVar(SUCCESS_MESSAGE, "Successfully saved");
} catch (Exception $e) {
$session->setVar(ERROR_MESSAGE, $e->getMessage() . "<br />" . $benefittype->getErrorStackAsString());
$session->setVar(FORM_VALUES, $formvalues);
$result['error'] = $benefittype->getErrorStackAsString();
}
}
break;
case 11:
$formvalues['name'] = trim($formvalues['value']);
$department = new Department();
if (!isArrayKeyAnEmptyString('id', $formvalues)) {
$department->populate($formvalues['id']);
$formvalues['lastupdatedby'] = $session->getVar('userid');
} else {
$formvalues['createdby'] = $session->getVar('userid');
}
$formvalues['companyid'] = getCompanyID();
$department->processPost($formvalues);
/* debugMessage($department->toArray());
debugMessage('errors are '.$department->getErrorStackAsString()); // exit(); */
$result = array('id' => '', 'name' => '', 'error' => '');
if ($department->hasError()) {
$session->setVar(ERROR_MESSAGE, $department->getErrorStackAsString());
$session->setVar(FORM_VALUES, $formvalues);
$result['error'] = $department->getErrorStackAsString();
} else {
try {
$department->save();
$result = array('id' => $department->getID(), 'name' => $department->getName(), 'error' => '');
$session->setVar(SUCCESS_MESSAGE, "Successfully saved");
} catch (Exception $e) {
//.........这里部分代码省略.........
示例7: elseif
} 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;
}
}
}
// Assign all the users to their departments
$sql = "select u.userid,d.dept_name\n\t\tfrom complain_authorized u,departments d\n\t\twhere u.dept=d.dept_no and u.userid=?";
$query = $pdo->prepare($sql);
$people = new PersonList(array('username' => array('$exists' => true)));
foreach ($people as $person) {
$query->execute(array($person->getUsername()));
$row = $query->fetch(PDO::FETCH_ASSOC);