本文整理汇总了PHP中User::getField方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getField方法的具体用法?PHP User::getField怎么用?PHP User::getField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User
的用法示例。
在下文中一共展示了User::getField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayUser
function displayUser(User $user)
{
printf("\nLogin: %s\n", $user->getField('name'));
printf("Name: %s\n", $user->getRawName());
printf("Password: %s\n", $user->getField('password'));
// ? 'set' : 'sot set');
printf("Authent: %s\n", Auth::getMethodName($user->getField('authtype'), $user->getField('auths_id')));
printf("Active: %s\n\n", $user->getField('is_active') ? 'yes' : 'no');
}
示例2: getTaskAssignUser
/**
* Get tech related to the task
*
* @param $options array
**/
function getTaskAssignUser()
{
$item = new $this->obj->fields['itemtype']();
if ($item->getFromDB($this->obj->fields['items_id'])) {
$user = new User();
if ($item->isField('users_id_tech') && $user->getFromDB($item->getField('users_id_tech'))) {
$this->addToAddressesList(array('language' => $user->getField('language'), 'users_id' => $user->getField('id')));
}
}
}
示例3: showLicenses
/**
* Show table wiht linked licenses to user
* @param User $user
*/
static function showLicenses(User $user)
{
global $DB;
$ID = $user->getField('id');
echo "<div class='spaced'><table class='tab_cadre_fixehov'>";
$header = "<tr><th>" . __('Software') . "</th>";
$header .= "<th>" . __('Licenses') . "</th>";
$header .= "<th>" . __('Added') . "</th></tr>";
echo $header;
$query = "SELECT\n ul.added,\n sl.name AS licenses_name,\n s.name AS software_name,\n\t\t\t\tsl.id AS licenses_id,\n\t\t\t\ts.id AS software_id\n FROM\n glpi_users_softwarelicenses ul\n JOIN glpi_softwarelicenses sl ON (sl.id = ul.softwarelicenses_id)\n JOIN glpi_softwares s ON (s.id = sl.softwares_id)\n WHERE\n ul.users_id = '{$ID}'\n ORDER BY\n ul.added DESC";
$result = $DB->query($query);
if ($DB->numrows($result) > 0) {
while ($data = $DB->fetch_assoc($result)) {
echo "<tr class='tab_bg_1'>";
echo "<td class='center'><a href='software.form.php?id=" . $data['software_id'] . "'>" . $data["software_name"] . "</a></td>";
echo "<td class='center'><a href='softwarelicense.form.php?id=" . $data['licenses_id'] . "'>" . $data["licenses_name"] . "</a></td>";
echo "<td class='center' style='width:20%'>" . $data["added"] . "</td>";
echo "</tr>";
}
} else {
echo "<tr class='tab_bg_1'><td class='center' colspan='3'>No results.</td></tr>";
}
echo "</table></div>";
return true;
}
示例4: getSpecificTargets
/**
* @see NotificationTarget::getSpecificTargets()
**/
function getSpecificTargets($data, $options)
{
$user = new User();
if ($user->getFromDB($this->obj->fields['users_id'])) {
$this->addToAddressesList(array('language' => $user->getField('language'), 'users_id' => $user->getID()));
}
}
示例5: postLists
public function postLists()
{
User::onlyHas('user-view');
$jqgrid = new jQgrid(User::getTableName());
return $jqgrid->populate(function ($start, $limit) {
return User::select(User::getField('id'), User::getField('username'), User::getField('email'))->skip($start)->take($limit)->get();
});
}
示例6: getTeamUsers
/**
* Add team users to the notified user list
**/
function getTeamUsers()
{
global $DB;
$query = "SELECT `items_id`\n FROM `glpi_projecttaskteams`\n WHERE `glpi_projecttaskteams`.`itemtype` = 'User'\n AND `glpi_projecttaskteams`.`projecttasks_id` = '" . $this->obj->fields["id"] . "'";
$user = new User();
foreach ($DB->request($query) as $data) {
if ($user->getFromDB($data['items_id'])) {
$this->addToAddressesList(array('language' => $user->getField('language'), 'users_id' => $user->getField('id')));
}
}
}
示例7: getItemAuthorAddress
/**
* Get the email of the item's user
**/
function getItemAuthorAddress()
{
$user = new User();
if ($this->obj->isField('users_id') && $user->getFromDB($this->obj->getField('users_id'))) {
$this->addToAddressesList(array('language' => $user->getField('language'), 'users_id' => $user->getField('id')));
}
}
示例8: showForUser
/**
* Show rights of a user
*
* @param $user User object
**/
static function showForUser(User $user)
{
global $DB, $CFG_GLPI, $LANG;
$ID = $user->getField('id');
if (!$user->can($ID, 'r')) {
return false;
}
$canedit = $user->can($ID, 'w');
$strict_entities = self::getUserEntities($ID, false);
if (!haveAccessToOneOfEntities($strict_entities) && !isViewAllEntities()) {
$canedit = false;
}
$canshowentity = haveRight("entity", "r");
$rand = mt_rand();
echo "<form name='entityuser_form{$rand}' id='entityuser_form{$rand}' method='post' action='";
echo getItemTypeFormURL(__CLASS__) . "'>";
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th colspan='4'>" . $LANG['setup'][605] . "</tr>";
echo "<tr class='tab_bg_2'><td class='center'>";
echo "<input type='hidden' name='users_id' value='{$ID}'>";
Dropdown::show('Entity', array('entity' => $_SESSION['glpiactiveentities']));
echo "</td><td class='center'>" . $LANG['profiles'][22] . " : ";
Profile::dropdownUnder(array('value' => Profile::getDefault()));
echo "</td><td class='center'>" . $LANG['profiles'][28] . " : ";
Dropdown::showYesNo("is_recursive", 0);
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
echo "</td></tr>";
echo "</table></div>";
}
echo "<div class='spaced'><table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='2'>" . $LANG['Menu'][37] . "</th>";
echo "<th>" . $LANG['profiles'][22] . " (D=" . $LANG['profiles'][29] . ", R=" . $LANG['profiles'][28] . ")";
echo "</th></tr>";
$query = "SELECT DISTINCT `glpi_profiles_users`.`id` AS linkID,\n `glpi_profiles`.`id`,\n `glpi_profiles`.`name`,\n `glpi_profiles_users`.`is_recursive`,\n `glpi_profiles_users`.`is_dynamic`,\n `glpi_entities`.`completename`,\n `glpi_profiles_users`.`entities_id`\n FROM `glpi_profiles_users`\n LEFT JOIN `glpi_profiles`\n ON (`glpi_profiles_users`.`profiles_id` = `glpi_profiles`.`id`)\n LEFT JOIN `glpi_entities`\n ON (`glpi_profiles_users`.`entities_id` = `glpi_entities`.`id`)\n WHERE `glpi_profiles_users`.`users_id` = '{$ID}'\n ORDER BY `glpi_profiles`.`name`, `glpi_entities`.`completename`";
$result = $DB->query($query);
if ($DB->numrows($result) > 0) {
while ($data = $DB->fetch_array($result)) {
echo "<tr class='tab_bg_1'>";
echo "<td width='10'>";
if ($canedit && in_array($data["entities_id"], $_SESSION['glpiactiveentities'])) {
echo "<input type='checkbox' name='item[" . $data["linkID"] . "]' value='1'>";
} else {
echo " ";
}
echo "</td>";
if ($data["entities_id"] == 0) {
$data["completename"] = $LANG['entity'][2];
}
echo "<td>";
if ($canshowentity) {
echo "<a href='" . getItemTypeFormURL('Entity') . "?id=" . $data["entities_id"] . "'>";
}
echo $data["completename"] . ($_SESSION["glpiis_ids_visible"] ? " (" . $data["entities_id"] . ")" : "");
if ($canshowentity) {
echo "</a>";
}
echo "</td>";
echo "<td>" . $data["name"];
if ($data["is_dynamic"] || $data["is_recursive"]) {
echo "<strong> (";
if ($data["is_dynamic"]) {
echo "D";
}
if ($data["is_dynamic"] && $data["is_recursive"]) {
echo ", ";
}
if ($data["is_recursive"]) {
echo "R";
}
echo ")</strong>";
}
echo "</td>";
}
echo "</tr>";
}
echo "</table>";
if ($canedit) {
openArrowMassive("entityuser_form{$rand}", true);
closeArrowMassive('delete', $LANG['buttons'][6]);
}
echo "</form></div>";
}
示例9: define
// Purpose of file:
// ----------------------------------------------------------------------
$AJAX_INCLUDE = 1;
if (strpos($_SERVER['PHP_SELF'], "uemailUpdate.php")) {
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
header("Content-Type: text/html; charset=UTF-8");
header_nocache();
}
checkLoginUser();
// print_r($_REQUEST);
if (isset($_REQUEST['field']) && $_REQUEST["value"] > 0 || isset($_REQUEST['allow_email']) && $_REQUEST['allow_email']) {
$user = new User();
$email = "";
if ($user->getFromDB($_REQUEST["value"])) {
$email = $user->getField('email');
}
echo $LANG['job'][19] . ' : ';
$default_notif = true;
if (isset($_REQUEST['use_notification'])) {
$default_notif = $_REQUEST['use_notification'];
}
$rand = Dropdown::showYesNo($_REQUEST['field'] . '[use_notification]', $default_notif);
echo '<br>' . $LANG['mailing'][118] . " : ";
if (!empty($email) && NotificationMail::isUserAddressValid($email)) {
echo $email;
} else {
echo "<input type='text' size='25' name='" . $_REQUEST['field'] . "[alternative_email]'\n value='{$email}'>";
}
}
commonDropdownUpdateItem($_POST);
示例10: showForm
/**
* Print the ticket user form for notification
*
* @param $ID integer ID of the item
* @param $options array
*
* @return Nothing (display)
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI, $LANG;
$this->check($ID, 'w');
echo "<br><form method='post' action='" . $CFG_GLPI['root_doc'] . "/front/popup.php'>";
echo "<div class='center'>";
echo "<table class='tab_cadre'>";
echo "<tr class='tab_bg_2'><td>" . $LANG['job'][38] . " :</td>";
echo "<td>";
$ticket = new Ticket();
if ($ticket->getFromDB($this->fields["tickets_id"])) {
echo $ticket->getField('name');
}
echo "</td></tr>";
$user = new User();
$email = "";
if ($user->getFromDB($this->fields["users_id"])) {
$email = $user->getField('email');
}
echo "<tr class='tab_bg_2'><td>" . $LANG['common'][34] . " :</td>";
echo "<td>" . $user->getName() . "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['job'][19] . " :</td>";
echo "<td>";
Dropdown::showYesNo('use_notification', $this->fields['use_notification']);
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['mailing'][118] . " :</td>";
echo "<td>";
if (!empty($email) && NotificationMail::isUserAddressValid($email)) {
echo $email;
} else {
echo "<input type='text' size='40' name='alternative_email' value='" . $this->fields['alternative_email'] . "'>";
}
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td class='center' colspan='2'>";
echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][7] . "\" class='submit'>";
echo "<input type='hidden' name='id' value='{$ID}'>";
echo "</td></tr>";
echo "</table></div></form>";
}
示例11: getUserEntities
/**
* Get entities for which a user have a right
*
* @param $user_ID user ID
* @param $is_recursive check also using recursive rights (true by default)
* @param $default_first user default entity first (false by default)
*
* @return array of entities ID
**/
static function getUserEntities($user_ID, $is_recursive = true, $default_first = false)
{
global $DB;
$query = "SELECT DISTINCT `entities_id`, `is_recursive`\n FROM `glpi_profiles_users`\n WHERE `users_id` = '{$user_ID}'";
$result = $DB->query($query);
if ($DB->numrows($result) > 0) {
$entities = array();
while ($data = $DB->fetch_assoc($result)) {
if ($data['is_recursive'] && $is_recursive) {
$tab = getSonsOf('glpi_entities', $data['entities_id']);
$entities = array_merge($tab, $entities);
} else {
$entities[] = $data['entities_id'];
}
}
// Set default user entity at the begin
if ($default_first) {
$user = new User();
if ($user->getFromDB($user_ID)) {
$ent = $user->getField('entities_id');
if (in_array($ent, $entities)) {
array_unshift($entities, $ent);
}
}
}
return array_unique($entities);
}
return array();
}
示例12: executeActions
/**
* @see Rule::executeActions()
**/
function executeActions($output, $params)
{
if (count($this->actions)) {
foreach ($this->actions as $action) {
switch ($action->fields["action_type"]) {
case "assign":
switch ($action->fields["field"]) {
default:
$output[$action->fields["field"]] = $action->fields["value"];
break;
case "_affect_entity_by_user_entity":
//3 cases :
//1 - rule contains a criteria like : Profil is XXXX
// -> in this case, profiles_id is stored in
// $this->criterias_results['PROFILES'] (one value possible)
//2- rule contains criteria "User has only one profile"
// -> in this case, profiles_id is stored in
// $this->criterias_results['PROFILES'] (one value possible) (same as 1)
//3 -> rule contains only one profile
$profile = 0;
//Case 2:
if (isset($this->criterias_results['ONE_PROFILE'])) {
$profile = $this->criterias_results['ONE_PROFILE'];
//Case 3
} else {
if (isset($this->criterias_results['UNIQUE_PROFILE'])) {
$profile = $this->criterias_results['UNIQUE_PROFILE'];
//Case 1
} else {
if (isset($this->criterias_results['PROFILES'])) {
$profile = $this->criterias_results['PROFILES'];
}
}
}
if ($profile) {
$entities = array();
if (isset($params['_users_id_requester'])) {
// Not set when testing
$entities = Profile_User::getEntitiesForProfileByUser($params['_users_id_requester'], $profile);
}
//Case 2 : check if there's only one profile for this user
if (isset($this->criterias_results['ONE_PROFILE']) && count($entities) == 1 || !isset($this->criterias_results['ONE_PROFILE'])) {
if (count($entities) == 1) {
//User has right on only one entity
$output['entities_id'] = array_pop($entities);
} else {
if (isset($this->criterias_results['UNIQUE_PROFILE'])) {
$output['entities_id'] = array_pop($entities);
} else {
//Rights on more than one entity : get the user's prefered entity
if (isset($params['_users_id_requester'])) {
// Not set when testing
$user = new User();
$user->getFromDB($params['_users_id_requester']);
$tmpid = $user->getField('entities_id');
// Retrieve all the entities (pref could be set on a child)
$entities = Profile_User::getEntitiesForProfileByUser($params['_users_id_requester'], $profile, true);
// If an entity is defined in user's preferences,
// and this entity allowed for this profile, use this one
// else do not set the rule as matched
if (in_array($tmpid, $entities)) {
$output['entities_id'] = $user->fields['entities_id'];
}
}
}
}
}
}
}
break;
case "regex_result":
foreach ($this->regex_results as $regex_result) {
$entity_found = -1;
$res = RuleAction::getRegexResultById($action->fields["value"], $regex_result);
if ($res != null) {
switch ($action->fields["field"]) {
case "_affect_entity_by_domain":
$entity_found = Entity::getEntityIDByDomain(addslashes($res));
break;
case "_affect_entity_by_tag":
$entity_found = Entity::getEntityIDByTag(addslashes($res));
break;
}
//If an entity was found
if ($entity_found > -1) {
$output['entities_id'] = $entity_found;
break;
}
}
}
// switch (field)
break;
}
}
}
return $output;
}
示例13:
$contact = $setting->getAppContactDetails($appid);
}
// get left sidebar navigation menu
$navigation_menu = $setting->getNavigationMenu($appid, $rs, "guest");
//$navigation_menu = $setting->getNavigationMenu($appid,"guest");
// get app's sharing setting data
$sharingsetting = $setting->getAppShareSettingData($appid);
// get unread news count for guest
//$news->getNewsCountGuest($appid,'guest');
//$newscount=$news->numofrows();
$newscount = $usr->getUnreadNewsCount($userid, "guest");
$bgrs = $usr->getAppBackground($appid);
$rec = $usr->numofrows();
if ($rec > 0) {
$usr->getrow();
$bgURL = $usr->getField("backgroundImageURL");
$isvisible = $usr->getField("visibleTo");
if ($isvisible == "guest" || $isvisible == "everyone") {
// get background URL
$json["status"] = 1;
$json["statusInfo"] = "success";
$json["appid"] = $rs;
//$appid;
$json["imported_appid"] = $appid;
$json["appBackgroundImageURL"] = AbstractDB::APP_BACKGROUND . $bgURL;
$json["businessJoinURL"] = $businessJoinURL;
// get started button link
} else {
$json["status"] = 1;
$json["statusInfo"] = "success";
$json["appid"] = $rs;
示例14: getDatasForObject
/**
* @param $item CommonDBTM object
* @param $options array
* @param $simple (false by default)
**/
function getDatasForObject(CommonDBTM $item, array $options, $simple = false)
{
global $CFG_GLPI, $DB;
$objettype = strtolower($item->getType());
$datas["##{$objettype}.title##"] = $item->getField('name');
$datas["##{$objettype}.content##"] = $item->getField('content');
$datas["##{$objettype}.description##"] = $item->getField('content');
$datas["##{$objettype}.id##"] = sprintf("%07d", $item->getField("id"));
if ($_SESSION['glpiticket_timeline'] == 1) {
$datas["##{$objettype}.url##"] = $this->formatURL($options['additionnaloption']['usertype'], $objettype . "_" . $item->getField("id") . "_" . $item->getType() . '$1');
} else {
$datas["##{$objettype}.url##"] = $this->formatURL($options['additionnaloption']['usertype'], $objettype . "_" . $item->getField("id"));
}
$tab = '$2';
if ($_SESSION['glpiticket_timeline'] == 1) {
$tab = '$1';
}
$datas["##{$objettype}.urlapprove##"] = $this->formatURL($options['additionnaloption']['usertype'], $objettype . "_" . $item->getField("id") . "_" . $item->getType() . $tab);
$entity = new Entity();
if ($entity->getFromDB($this->getEntity())) {
$datas["##{$objettype}.entity##"] = $entity->getField('completename');
$datas["##{$objettype}.shortentity##"] = $entity->getField('name');
}
$datas["##{$objettype}.storestatus##"] = $item->getField('status');
$datas["##{$objettype}.status##"] = $item->getStatus($item->getField('status'));
$datas["##{$objettype}.urgency##"] = $item->getUrgencyName($item->getField('urgency'));
$datas["##{$objettype}.impact##"] = $item->getImpactName($item->getField('impact'));
$datas["##{$objettype}.priority##"] = $item->getPriorityName($item->getField('priority'));
$datas["##{$objettype}.time##"] = $item->getActionTime($item->getField('actiontime'));
$datas["##{$objettype}.creationdate##"] = Html::convDateTime($item->getField('date'));
$datas["##{$objettype}.closedate##"] = Html::convDateTime($item->getField('closedate'));
$datas["##{$objettype}.solvedate##"] = Html::convDateTime($item->getField('solvedate'));
$datas["##{$objettype}.duedate##"] = Html::convDateTime($item->getField('due_date'));
$datas["##{$objettype}.category##"] = '';
if ($item->getField('itilcategories_id')) {
$datas["##{$objettype}.category##"] = Dropdown::getDropdownName('glpi_itilcategories', $item->getField('itilcategories_id'));
}
$datas["##{$objettype}.authors##"] = '';
$datas['authors'] = array();
if ($item->countUsers(CommonITILActor::REQUESTER)) {
$users = array();
foreach ($item->getUsers(CommonITILActor::REQUESTER) as $tmpusr) {
$uid = $tmpusr['users_id'];
$user_tmp = new User();
if ($uid && $user_tmp->getFromDB($uid)) {
$users[] = $user_tmp->getName();
$tmp = array();
$tmp['##author.id##'] = $uid;
$tmp['##author.name##'] = $user_tmp->getName();
if ($user_tmp->getField('locations_id')) {
$tmp['##author.location##'] = Dropdown::getDropdownName('glpi_locations', $user_tmp->getField('locations_id'));
} else {
$tmp['##author.location##'] = '';
}
if ($user_tmp->getField('usertitles_id')) {
$tmp['##author.title##'] = Dropdown::getDropdownName('glpi_usertitles', $user_tmp->getField('usertitles_id'));
} else {
$tmp['##author.title##'] = '';
}
if ($user_tmp->getField('usercategories_id')) {
$tmp['##author.category##'] = Dropdown::getDropdownName('glpi_usercategories', $user_tmp->getField('usercategories_id'));
} else {
$tmp['##author.category##'] = '';
}
$tmp['##author.email##'] = $user_tmp->getDefaultEmail();
$tmp['##author.mobile##'] = $user_tmp->getField('mobile');
$tmp['##author.phone##'] = $user_tmp->getField('phone');
$tmp['##author.phone2##'] = $user_tmp->getField('phone2');
$datas['authors'][] = $tmp;
} else {
// Anonymous users only in xxx.authors, not in authors
$users[] = $tmpusr['alternative_email'];
}
}
$datas["##{$objettype}.authors##"] = implode(', ', $users);
}
$datas["##{$objettype}.openbyuser##"] = '';
if ($item->getField('users_id_recipient')) {
$user_tmp = new User();
$user_tmp->getFromDB($item->getField('users_id_recipient'));
$datas["##{$objettype}.openbyuser##"] = $user_tmp->getName();
}
$datas["##{$objettype}.lastupdater##"] = '';
if ($item->getField('users_id_lastupdater')) {
$user_tmp = new User();
$user_tmp->getFromDB($item->getField('users_id_lastupdater'));
$datas["##{$objettype}.lastupdater##"] = $user_tmp->getName();
}
$datas["##{$objettype}.assigntousers##"] = '';
if ($item->countUsers(CommonITILActor::ASSIGN)) {
$users = array();
foreach ($item->getUsers(CommonITILActor::ASSIGN) as $tmp) {
$uid = $tmp['users_id'];
$user_tmp = new User();
if ($user_tmp->getFromDB($uid)) {
//.........这里部分代码省略.........
示例15: getDatasForObject
/**
* @param $item CommonDBTM object
* @param $options array
* @param $simple (false by default)
**/
function getDatasForObject(CommonDBTM $item, array $options, $simple = false)
{
global $CFG_GLPI, $DB;
$objettype = strtolower($item->getType());
$datas["##{$objettype}.title##"] = $item->getField('name');
$datas["##{$objettype}.content##"] = $item->getField('content');
$datas["##{$objettype}.description##"] = $item->getField('content');
$datas["##{$objettype}.id##"] = sprintf("%07d", $item->getField("id"));
$datas["##{$objettype}.url##"] = $this->formatURL($options['additionnaloption']['usertype'], $objettype . "_" . $item->getField("id"));
$datas["##{$objettype}.urlapprove##"] = $this->formatURL($options['additionnaloption']['usertype'], $objettype . "_" . $item->getField("id") . "_" . $item->getType() . '$2');
$entity = new Entity();
if ($entity->getFromDB($this->getEntity())) {
$datas["##{$objettype}.entity##"] = $entity->getField('completename');
$datas["##{$objettype}.shortentity##"] = $entity->getField('name');
}
$datas["##{$objettype}.storestatus##"] = $item->getField('status');
$datas["##{$objettype}.status##"] = $item->getStatus($item->getField('status'));
$datas["##{$objettype}.urgency##"] = $item->getUrgencyName($item->getField('urgency'));
$datas["##{$objettype}.impact##"] = $item->getImpactName($item->getField('impact'));
$datas["##{$objettype}.priority##"] = $item->getPriorityName($item->getField('priority'));
$datas["##{$objettype}.time##"] = $item->getActionTime($item->getField('actiontime'));
$datas["##{$objettype}.creationdate##"] = Html::convDateTime($item->getField('date'));
$datas["##{$objettype}.closedate##"] = Html::convDateTime($item->getField('closedate'));
$datas["##{$objettype}.solvedate##"] = Html::convDateTime($item->getField('solvedate'));
$datas["##{$objettype}.duedate##"] = Html::convDateTime($item->getField('due_date'));
$datas["##{$objettype}.category##"] = '';
if ($item->getField('itilcategories_id')) {
$datas["##{$objettype}.category##"] = Dropdown::getDropdownName('glpi_itilcategories', $item->getField('itilcategories_id'));
}
$datas["##{$objettype}.authors##"] = '';
$datas['authors'] = array();
if ($item->countUsers(CommonITILActor::REQUESTER)) {
$users = array();
foreach ($item->getUsers(CommonITILActor::REQUESTER) as $tmpusr) {
$uid = $tmpusr['users_id'];
$user_tmp = new User();
if ($uid && $user_tmp->getFromDB($uid)) {
$users[] = $user_tmp->getName();
$tmp = array();
$tmp['##author.id##'] = $uid;
$tmp['##author.name##'] = $user_tmp->getName();
if ($user_tmp->getField('locations_id')) {
$tmp['##author.location##'] = Dropdown::getDropdownName('glpi_locations', $user_tmp->getField('locations_id'));
} else {
$tmp['##author.location##'] = '';
}
if ($user_tmp->getField('usertitles_id')) {
$tmp['##author.title##'] = Dropdown::getDropdownName('glpi_usertitles', $user_tmp->getField('usertitles_id'));
} else {
$tmp['##author.title##'] = '';
}
if ($user_tmp->getField('usercategories_id')) {
$tmp['##author.category##'] = Dropdown::getDropdownName('glpi_usercategories', $user_tmp->getField('usercategories_id'));
} else {
$tmp['##author.category##'] = '';
}
$tmp['##author.email##'] = $user_tmp->getDefaultEmail();
$tmp['##author.mobile##'] = $user_tmp->getField('mobile');
$tmp['##author.phone##'] = $user_tmp->getField('phone');
$tmp['##author.phone2##'] = $user_tmp->getField('phone2');
$datas['authors'][] = $tmp;
} else {
// Anonymous users only in xxx.authors, not in authors
$users[] = $tmpusr['alternative_email'];
}
}
$datas["##{$objettype}.authors##"] = implode(', ', $users);
}
$datas["##{$objettype}.openbyuser##"] = '';
if ($item->getField('users_id_recipient')) {
$user_tmp = new User();
$user_tmp->getFromDB($item->getField('users_id_recipient'));
$datas["##{$objettype}.openbyuser##"] = $user_tmp->getName();
}
$datas["##{$objettype}.lastupdater##"] = '';
if ($item->getField('users_id_lastupdater')) {
$user_tmp = new User();
$user_tmp->getFromDB($item->getField('users_id_lastupdater'));
$datas["##{$objettype}.lastupdater##"] = $user_tmp->getName();
}
$datas["##{$objettype}.assigntousers##"] = '';
if ($item->countUsers(CommonITILActor::ASSIGN)) {
$users = array();
foreach ($item->getUsers(CommonITILActor::ASSIGN) as $tmp) {
$uid = $tmp['users_id'];
$user_tmp = new User();
if ($user_tmp->getFromDB($uid)) {
$users[$uid] = $user_tmp->getName();
}
}
$datas["##{$objettype}.assigntousers##"] = implode(', ', $users);
}
$datas["##{$objettype}.assigntosupplier##"] = '';
if ($item->countSuppliers(CommonITILActor::ASSIGN)) {
$suppliers = array();
//.........这里部分代码省略.........