本文整理汇总了PHP中Team::lookup方法的典型用法代码示例。如果您正苦于以下问题:PHP Team::lookup方法的具体用法?PHP Team::lookup怎么用?PHP Team::lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Team
的用法示例。
在下文中一共展示了Team::lookup方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStaffTeams
function getStaffTeams($staff_id)
{
$sql = "select * from " . TEAM_MEMBER_TABLE . " where staff_id=" . $staff_id;
if (!($res = db_query($sql)) || !db_num_rows($res)) {
return "";
} else {
$teams = "";
while ($row = db_fetch_array($res)) {
if ($team = Team::lookup(intval($row['team_id']))) {
if ($teamname = $team->getName()) {
$teams = $teams . stripslashes($teamname);
}
}
}
return trim($teams);
}
}
示例2: chr
if($userInfoArray = Staff::getStaffCSVFile())
{
// echo json_encode($userInfoArray);
foreach ($userInfoArray as $fields) {
// echo json_encode(array($fields['username'],$fields['firstname'],$fields['lastname'],$fields['isadmin'],$fields['onvacation'],$fields['created'],$fields['lastlogin'],Staff::getStaffTeams($fields['staff_id'])));
fprintf($fp, chr(0xEF).chr(0xBB).chr(0xBF));
// fputcsv($fp,$fields);
$teams = Staff::getStaffTeams($fields['staff_id']);
// logErrors(json_encode(Team::getActiveTeams()));
// echo $teams;
html_entity_decode(mb_convert_encoding(stripslashes($teams), "HTML-ENTITIES", 'UTF-8'));
try {
$resultArray = array($fields['username'],$fields['firstname'],$fields['lastname'],booleanToString($fields['isadmin']),$fields['created'],$fields['lastlogin']);
foreach ($teamsArray as $key=>$value) {
// logErrors("team id: ".$key);
if($team = Team::lookup(intval($key)))
{
logErrors(json_encode($team->getName()));
array_push($resultArray,booleanToString($team->hasMember(Staff::lookup(intval($fields['staff_id'])))));
}
}
// logErrors(json_encode($resultArray));
fputcsv($fp,$resultArray);
// fputcsv($fp, array_merge(array($fields['username'],$fields['firstname'],$fields['lastname'],$fields['isadmin'],$fields['onvacation'],$fields['created'],$fields['lastlogin']),null));
} catch (Exception $e) {
logErrors('Caught exception: ', $e->getMessage(), "\n");
}
}
}
示例3: assignToTeam
function assignToTeam($team, $note, $alert = true)
{
if (!is_object($team) && !($team = Team::lookup($team))) {
return false;
}
if (!$this->setTeamId($team->getId())) {
return false;
}
//Clear - staff if it's a closed ticket
// staff_id is overloaded -> assigned to & closed by.
if ($this->isClosed()) {
$this->setStaffId(0);
}
$this->onAssign($note, $alert);
return true;
}
示例4: IN
break;
case 'disable':
$sql = 'UPDATE ' . TEAM_TABLE . ' SET isenabled=0 ' . ' WHERE team_id IN (' . implode(',', db_input($_POST['ids'])) . ')';
if (db_query($sql) && ($num = db_affected_rows())) {
if ($num == $count) {
$msg = sprintf(__('Successfully disabled %s'), _N('selected team', 'selected teams', $count));
} else {
$warn = sprintf(__('%1$d of %2$d %3$s disabled'), $num, $count, _N('selected team', 'selected teams', $count));
}
} else {
$errors['err'] = sprintf(__('Unable to disable %s'), _N('selected team', 'selected teams', $count));
}
break;
case 'delete':
foreach ($_POST['ids'] as $k => $v) {
if (($t = Team::lookup($v)) && $t->delete()) {
$i++;
}
}
if ($i && $i == $count) {
$msg = sprintf(__('Successfully deleted %s'), _N('selected team', 'selected teams', $count));
} elseif ($i > 0) {
$warn = sprintf(__('%1$d of %2$d %3$s deleted'), $i, $count, _N('selected team', 'selected teams', $count));
} elseif (!$errors['err']) {
$errors['err'] = sprintf(__('Unable to delete %s'), _N('selected team', 'selected teams', $count));
}
break;
default:
$errors['err'] = __('Unknown action - get technical help.');
}
}
示例5: update
function update($vars, &$errors)
{
$valid = true;
$forms = $this->getForms($vars);
foreach ($forms as $cd) {
if (!$cd->isValid()) {
$valid = false;
}
if ($cd->get('type') == 'O' && ($form = $cd->getForm($vars)) && ($f = $form->getField('name')) && $f->getClean() && ($o = Organization::lookup(array('name' => $f->getClean()))) && $o->id != $this->getId()) {
$valid = false;
$f->addError('Organization with the same name already exists');
}
}
if ($vars['domain']) {
foreach (explode(',', $vars['domain']) as $d) {
if (!Validator::is_email('t@' . trim($d))) {
$errors['domain'] = 'Enter a valid email domain, like domain.com';
}
}
}
if ($vars['manager']) {
switch ($vars['manager'][0]) {
case 's':
if ($staff = Staff::lookup(substr($vars['manager'], 1))) {
break;
}
case 't':
if ($vars['manager'][0] == 't' && ($team = Team::lookup(substr($vars['manager'], 1)))) {
break;
}
default:
$errors['manager'] = 'Select a staff member or team from the list';
}
}
if (!$valid || $errors) {
return false;
}
foreach ($this->getDynamicData() as $cd) {
if (($f = $cd->getForm()) && $f->get('type') == 'O' && ($name = $f->getField('name'))) {
$this->name = $name->getClean();
$this->save();
}
$cd->save();
}
// Set flags
foreach (array('collab-all-flag' => Organization::COLLAB_ALL_MEMBERS, 'collab-pc-flag' => Organization::COLLAB_PRIMARY_CONTACT, 'assign-am-flag' => Organization::ASSIGN_AGENT_MANAGER) as $ck => $flag) {
if ($vars[$ck]) {
$this->setStatus($flag);
} else {
$this->clearStatus($flag);
}
}
// Set staff and primary contacts
$this->set('domain', $vars['domain']);
$this->set('manager', $vars['manager'] ?: '');
if ($vars['contacts'] && is_array($vars['contacts'])) {
foreach ($this->allMembers() as $u) {
$u->setPrimaryContact(array_search($u->id, $vars['contacts']) !== false);
$u->save();
}
}
return $this->save();
}