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


PHP Profile_User::getUserProfiles方法代码示例

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


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

示例1: showMyForm

 /**
  * Print the user preference form
  *
  * @param $target          form target
  * @param $ID     integer  Id of the user
  *
  * @return boolean : user found
  **/
 function showMyForm($target, $ID)
 {
     global $CFG_GLPI, $PLUGIN_HOOKS;
     // Affiche un formulaire User
     if ($ID != Session::getLoginUserID() && !$this->currentUserHaveMoreRightThan($ID)) {
         return false;
     }
     if ($this->getFromDB($ID)) {
         $authtype = $this->getAuthMethodsByID();
         $extauth = !($this->fields["authtype"] == Auth::DB_GLPI || $this->fields["authtype"] == Auth::NOT_YET_AUTHENTIFIED && !empty($this->fields["password"]));
         // No autocopletion :
         $save_autocompletion = $CFG_GLPI["use_ajax_autocompletion"];
         $CFG_GLPI["use_ajax_autocompletion"] = false;
         echo "<div class='center'>";
         echo "<form method='post' name='user_manager' action='" . $target . "'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr><th colspan='4'>" . sprintf(__('%1$s: %2$s'), __('Login'), $this->fields["name"]);
         echo "<input type='hidden' name='name' value='" . $this->fields["name"] . "'>";
         echo "<input type='hidden' name='id' value='" . $this->fields["id"] . "'>";
         echo "</th></tr>";
         echo "<tr class='tab_bg_1'><td>" . __('Surname') . "</td><td>";
         if ($extauth && isset($authtype['realname_field']) && !empty($authtype['realname_field'])) {
             echo $this->fields["realname"];
         } else {
             Html::autocompletionTextField($this, "realname");
         }
         echo "</td>";
         //do some rights verification
         if (!$extauth && Session::haveRight("password_update", "1")) {
             echo "<td>" . __('Password') . "</td>";
             echo "<td><input id='password' type='password' name='password' value='' size='30' autocomplete='off' onkeyup=\"return passwordCheck();\">";
             echo "</td></tr>";
         } else {
             echo "<td colspan='2'></tr>";
         }
         echo "<tr class='tab_bg_1'><td>" . __('First name') . "</td><td>";
         if ($extauth && isset($authtype['firstname_field']) && !empty($authtype['firstname_field'])) {
             echo $this->fields["firstname"];
         } else {
             Html::autocompletionTextField($this, "firstname");
         }
         echo "</td>";
         if (!$extauth && Session::haveRight("password_update", "1")) {
             echo "<td>" . __('Password confirmation') . "</td>";
             echo "<td><input type='password' name='password2' value='' size='30' autocomplete='off'>";
             echo "</td></tr>";
         } else {
             echo "<td colspan='2'></tr>";
         }
         echo "<tr class='tab_bg_1'><td class='top'>" . _n('Email', 'Emails', 2);
         UserEmail::showAddEmailButton($this);
         echo "</td><td>";
         UserEmail::showForUser($this);
         echo "</td>";
         if (!$extauth && Session::haveRight("password_update", "1")) {
             echo "<td>" . __('Password security policy') . "</td>";
             echo "<td>";
             Config::displayPasswordSecurityChecks();
             echo "</td>";
         } else {
             echo "<td colspan='2'>";
         }
         echo "</tr>";
         echo "<tr class='tab_bg_1'><td>" . __('Mobile phone') . "&nbsp;:</td><td>";
         if ($extauth && isset($authtype['mobile_field']) && !empty($authtype['mobile_field'])) {
             echo $this->fields["mobile"];
         } else {
             Html::autocompletionTextField($this, "mobile");
         }
         echo "</td>";
         if (!GLPI_DEMO_MODE) {
             echo "<td>" . __('Language') . "</td><td>";
             // Use session variable because field in table may be null if same of the global config
             Dropdown::showLanguages("language", array('value' => $_SESSION["glpilanguage"]));
         } else {
             echo "<td colspan='2'>&nbsp;";
         }
         echo "</td></tr>";
         echo "<tr class='tab_bg_1'><td>" . __('Phone') . "</td><td>";
         if ($extauth && isset($authtype['phone_field']) && !empty($authtype['phone_field'])) {
             echo $this->fields["phone"];
         } else {
             Html::autocompletionTextField($this, "phone");
         }
         echo "</td>";
         if (count($_SESSION['glpiprofiles']) > 1) {
             echo "<td>" . __('Default profile') . "</td><td>";
             $options = array(0 => Dropdown::EMPTY_VALUE);
             $options += Dropdown::getDropdownArrayNames('glpi_profiles', Profile_User::getUserProfiles($this->fields['id']));
             Dropdown::showFromArray("profiles_id", $options, array('value' => $this->fields["profiles_id"]));
         } else {
             echo "<td colspan='2'>&nbsp;";
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:user.class.php

示例2: addToAddressesList

 /**
  * Add new mail with lang to current email array
  *
  * @param $data : array of data (mail, lang)
  **/
 function addToAddressesList($data)
 {
     global $CFG_GLPI;
     $new_mail = trim(utf8_strtolower($data['email']));
     $new_lang = '';
     if (isset($data['language'])) {
         $new_lang = trim($data['language']);
     }
     $username = '';
     if (isset($data['name']) && !empty($data['name'])) {
         $username = $data['name'];
     }
     if (isset($data['id']) && $data['id'] > 0) {
         $user = new User();
         if (!$user->getFromDB($data['id']) || $user->getField('is_deleted') == 1 || $user->getField('is_active') == 0) {
             // unknown, deleted or disabled user
             return false;
         }
         $filt = getEntitiesRestrictRequest('AND', 'glpi_profiles_users', '', $this->getEntity(), true);
         $prof = Profile_User::getUserProfiles($data['id'], $filt);
         if (!count($prof)) {
             // No right on the entity of the object
             return false;
         }
         if (empty($username)) {
             $username = formatUserName(0, $user->getField('name'), $user->getField('realname'), $user->getField('firstname'), 0, 0, true);
         }
     }
     $notificationoption = $this->addAdditionnalUserInfo($data);
     if (!empty($new_mail)) {
         if (NotificationMail::isUserAddressValid($new_mail) && !isset($this->target[$new_mail])) {
             $this->target[$new_mail] = array('language' => empty($new_lang) ? $CFG_GLPI["language"] : $new_lang, 'email' => $new_mail, 'additionnaloption' => $notificationoption, 'username' => $username);
         }
     }
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:40,代码来源:notificationtarget.class.php

示例3: addToAddressesList

 /**
  * Add new mail with lang to current email array
  *
  * @param $data   array of data (mail, lang[, id for user])
  **/
 function addToAddressesList(array $data)
 {
     global $CFG_GLPI;
     // No email set : get default for user
     if (!isset($data['email']) && isset($data['users_id'])) {
         $data['email'] = UserEmail::getDefaultForUser($data['users_id']);
     }
     $new_mail = trim(Toolbox::strtolower($data['email']));
     $new_lang = '';
     // Default USER TYPE is ANONYMOUS
     $notificationoption = array('usertype' => self::ANONYMOUS_USER);
     if (isset($data['language'])) {
         $new_lang = trim($data['language']);
     }
     $username = '';
     if (isset($data['name']) && !empty($data['name'])) {
         $username = $data['name'];
     }
     if (isset($data['users_id']) && $data['users_id'] > 0) {
         $user = new User();
         if (!$user->getFromDB($data['users_id']) || $user->getField('is_deleted') == 1 || $user->getField('is_active') == 0 || !is_null($user->getField('begin_date')) && $user->getField('begin_date') > $_SESSION["glpi_currenttime"] || !is_null($user->getField('end_date')) && $user->getField('end_date') < $_SESSION["glpi_currenttime"]) {
             // unknown, deleted or disabled user
             return false;
         }
         $filt = getEntitiesRestrictRequest('AND', 'glpi_profiles_users', '', $this->getEntity(), true);
         $prof = Profile_User::getUserProfiles($data['users_id'], $filt);
         if (!count($prof)) {
             // No right on the entity of the object
             return false;
         }
         if (empty($username)) {
             $username = formatUserName(0, $user->getField('name'), $user->getField('realname'), $user->getField('firstname'), 0, 0, true);
         }
         // It is a GLPI user :
         $notificationoption['usertype'] = self::GLPI_USER;
         if (Auth::isAlternateAuth($user->fields['authtype']) || $user->fields['authtype'] == Auth::NOT_YET_AUTHENTIFIED && Auth::isAlternateAuth(Auth::checkAlternateAuthSystems())) {
             $notificationoption['usertype'] = self::EXTERNAL_USER;
         }
     }
     // Pass user type as argument ? forced for specific cases
     if (isset($data['usertype'])) {
         $notificationoption['usertype'] = $data['usertype'];
     }
     $notificationoption = array_merge($this->addAdditionnalUserInfo($data), $notificationoption);
     if (!empty($new_mail)) {
         if (NotificationMail::isUserAddressValid($new_mail) && !isset($this->target[$new_mail])) {
             $param = array('language' => empty($new_lang) ? $CFG_GLPI["language"] : $new_lang, 'email' => $new_mail, 'additionnaloption' => $notificationoption, 'username' => $username);
             if (isset($data['users_id']) && $data['users_id']) {
                 $param['users_id'] = $data['users_id'];
             }
             $this->target[$new_mail] = $param;
         }
     }
 }
开发者ID:kipman,项目名称:glpi,代码行数:59,代码来源:notificationtarget.class.php

示例4: showMyForm

 /**
  * Print the user preference form
  *
  * @param $target form target
  * @param $ID Integer : Id of the user
  *
  * @return boolean : user found
  **/
 function showMyForm($target, $ID)
 {
     global $CFG_GLPI, $LANG, $PLUGIN_HOOKS;
     // Affiche un formulaire User
     if ($ID != getLoginUserID() && !$this->currentUserHaveMoreRightThan($ID)) {
         return false;
     }
     if ($this->getFromDB($ID)) {
         $authtype = $this->getAuthMethodsByID();
         $extauth = !($this->fields["authtype"] == Auth::DB_GLPI || $this->fields["authtype"] == Auth::NOT_YET_AUTHENTIFIED && !empty($this->fields["password"]));
         // No autocopletion :
         $save_autocompletion = $CFG_GLPI["use_ajax_autocompletion"];
         $CFG_GLPI["use_ajax_autocompletion"] = false;
         echo "<div class='center'>";
         echo "<form method='post' name='user_manager' action='" . $target . "'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr><th colspan='4'>" . $LANG['setup'][18] . "&nbsp;: " . $this->fields["name"];
         echo "<input type='hidden' name='name' value='" . $this->fields["name"] . "'>";
         echo "<input type='hidden' name='id' value='" . $this->fields["id"] . "'>";
         echo "</th></tr>";
         echo "<tr class='tab_bg_1'><td>" . $LANG['common'][48] . "&nbsp;:</td><td>";
         if ($extauth && isset($authtype['realname_field']) && !empty($authtype['realname_field'])) {
             echo $this->fields["realname"];
         } else {
             autocompletionTextField($this, "realname");
         }
         echo "</td>";
         //do some rights verification
         if (!$extauth && haveRight("password_update", "1")) {
             echo "<td>" . $LANG['setup'][19] . "&nbsp;:</td>";
             echo "<td><input type='password' name='password' value='' size='30' autocomplete='off'>";
             echo "</td></tr>";
         } else {
             echo "<td colspan='2'></tr>";
         }
         echo "<tr class='tab_bg_1'><td>" . $LANG['common'][43] . "&nbsp;:</td><td>";
         if ($extauth && isset($authtype['firstname_field']) && !empty($authtype['firstname_field'])) {
             echo $this->fields["firstname"];
         } else {
             autocompletionTextField($this, "firstname");
         }
         echo "</td>";
         if (!$extauth && haveRight("password_update", "1")) {
             echo "<td>" . $LANG['setup'][20] . "&nbsp;:</td>";
             echo "<td><input type='password' name='password2' value='' size='30' autocomplete='off'>";
             echo "</td></tr>";
         } else {
             echo "<td colspan='2'></tr>";
         }
         echo "</td></tr>";
         echo "<tr class='tab_bg_1'><td>" . $LANG['setup'][14] . "&nbsp;:</td><td>";
         if ($extauth && isset($authtype['email_field']) && !empty($authtype['email_field'])) {
             echo $this->fields["email"];
         } else {
             autocompletionTextField($this, "email", array('name' => "email_form"));
             if (!NotificationMail::isUserAddressValid($this->fields["email"])) {
                 echo "<br><span class='red'>" . $LANG['mailing'][110] . "</span>";
             }
         }
         echo "</td>";
         if (!GLPI_DEMO_MODE) {
             echo "<td>" . $LANG['setup'][41] . "&nbsp;:</td><td>";
             /// Use sesion variable because field in table may be null if same of the global config
             Dropdown::showLanguages("language", array('value' => $_SESSION["glpilanguage"]));
         } else {
             echo "<td colspan='2'>&nbsp;";
         }
         echo "</td></tr>";
         echo "<tr class='tab_bg_1'><td>" . $LANG['common'][42] . "&nbsp;:</td><td>";
         if ($extauth && isset($authtype['mobile_field']) && !empty($authtype['mobile_field'])) {
             echo $this->fields["mobile"];
         } else {
             autocompletionTextField($this, "mobile");
         }
         echo "</td>";
         if (count($_SESSION['glpiprofiles']) > 1) {
             echo "<td>" . $LANG['profiles'][13] . "&nbsp;:</td><td>";
             $options = array(0 => DROPDOWN_EMPTY_VALUE);
             $options += Dropdown::getDropdownArrayNames('glpi_profiles', Profile_User::getUserProfiles($this->fields['id']));
             Dropdown::showFromArray("profiles_id", $options, array('value' => $this->fields["profiles_id"]));
         } else {
             echo "<td colspan='2'>&nbsp;";
         }
         echo "</td></tr>";
         echo "<tr class='tab_bg_1'><td>" . $LANG['help'][35] . "&nbsp;:</td><td>";
         if ($extauth && isset($authtype['phone_field']) && !empty($authtype['phone_field'])) {
             echo $this->fields["phone"];
         } else {
             autocompletionTextField($this, "phone");
         }
         echo "</td>";
         if (!GLPI_DEMO_MODE && count($_SESSION['glpiactiveentities']) > 1) {
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:user.class.php


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