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


PHP Profile::getRightsFor方法代码示例

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


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

示例1: createFirstAccess

 public static function createFirstAccess($ID)
 {
     $talk_profile = new self();
     $profile = new Profile();
     $dataprofile = array('id' => $ID);
     $profile->getFromDB($ID);
     foreach ($talk_profile->getAllRights(true) as $talk_r) {
         $g_rights = $profile->getRightsFor($talk_r['itemtype']);
         foreach ($g_rights as $g_right => $label) {
             $dataprofile['_' . $talk_r['field']][$g_right . "_0"] = 1;
         }
     }
     $profile->update($dataprofile);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:14,代码来源:profile.class.php

示例2: showFormToolsHelpdesk

 /**
  * Print the helpdesk right form for the current profile
  *
  * @since version 0.85
  **/
 function showFormToolsHelpdesk()
 {
     global $CFG_GLPI;
     if (!self::canView()) {
         return false;
     }
     echo "<div class='spaced'>";
     if ($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) {
         echo "<form method='post' action='" . $this->getFormURL() . "'>";
     }
     $matrix_options = array('canedit' => $canedit, 'default_class' => 'tab_bg_2');
     $rights = array(array('rights' => Profile::getRightsFor('KnowbaseItem', 'helpdesk'), 'label' => __('FAQ'), 'field' => 'knowbase'), array('rights' => Profile::getRightsFor('ReservationItem', 'helpdesk'), 'label' => _n('Reservation', 'Reservations', Session::getPluralNumber()), 'field' => 'reservation'), array('rights' => Profile::getRightsFor('Reminder', 'helpdesk'), 'label' => _n('Public reminder', 'Public reminders', Session::getPluralNumber()), 'field' => 'reminder_public'), array('rights' => Profile::getRightsFor('RSSFeed', 'helpdesk'), 'label' => _n('Public RSS feed', 'Public RSS feeds', Session::getPluralNumber()), 'field' => 'rssfeed_public'));
     $matrix_options['title'] = __('Tools');
     $this->displayRightsChoiceMatrix($rights, $matrix_options);
     if ($canedit) {
         echo "<div class='center'>";
         echo "<input type='hidden' name='id' value='" . $this->fields['id'] . "'>";
         echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\" class='submit'>";
         echo "</div>\n";
         Html::closeForm();
     }
     echo "</div>";
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:28,代码来源:profile.class.php

示例3: initProfile

 /**
  * Init profiles during installation :
  * - add rights in profile table for the current user's profile
  * - current profile has all rights on the plugin
  */
 static function initProfile()
 {
     $pfProfile = new self();
     $profile = new Profile();
     $a_rights = $pfProfile->getAllRights();
     foreach ($a_rights as $data) {
         if (countElementsInTable("glpi_profilerights", "`name` = '" . $data['field'] . "'") == 0) {
             ProfileRight::addProfileRights(array($data['field']));
             $_SESSION['glpiactiveprofile'][$data['field']] = 0;
         }
     }
     // Add all rights to current profile of the user
     if (isset($_SESSION['glpiactiveprofile'])) {
         $dataprofile = array();
         $dataprofile['id'] = $_SESSION['glpiactiveprofile']['id'];
         $profile->getFromDB($_SESSION['glpiactiveprofile']['id']);
         foreach ($a_rights as $info) {
             if (is_array($info) && (!empty($info['itemtype']) || !empty($info['rights'])) && !empty($info['label']) && !empty($info['field'])) {
                 if (isset($info['rights'])) {
                     $rights = $info['rights'];
                 } else {
                     $rights = $profile->getRightsFor($info['itemtype']);
                 }
                 foreach ($rights as $right => $label) {
                     $dataprofile['_' . $info['field']][$right] = 1;
                     $_SESSION['glpiactiveprofile'][$data['field']] = $right;
                 }
             }
         }
         $profile->update($dataprofile);
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:37,代码来源:profile.class.php

示例4: getAllRights

 static function getAllRights($all = false)
 {
     $rights = array(array('rights' => Profile::getRightsFor('PluginAccountsAccount', 'central'), 'label' => _n('Account', 'Accounts', 2, 'accounts'), 'field' => 'plugin_accounts'));
     if ($all) {
         $rights[] = array('itemtype' => 'PluginAccountsAccount', 'label' => __('See accounts of my groups', 'accounts'), 'field' => 'plugin_accounts_my_groups');
         $rights[] = array('itemtype' => 'PluginAccountsAccount', 'label' => __('See all accounts', 'accounts'), 'field' => 'plugin_accounts_see_all_users');
         $rights[] = array('itemtype' => 'PluginAccountsAccount', 'label' => __('Associable items to a ticket'), 'field' => 'plugin_accounts_open_ticket');
     }
     return $rights;
 }
开发者ID:puchadesc,项目名称:accounts,代码行数:10,代码来源:profile.class.php

示例5: getValueToSelect


//.........这里部分代码省略.........
             case "date":
             case "date_delay":
                 if (isset($options['relative_dates']) && $options['relative_dates']) {
                     if (isset($searchoptions['maybefuture']) && $searchoptions['maybefuture']) {
                         $options['with_future'] = true;
                     }
                     return Html::showGenericDateTimeSearch($name, $value, $options);
                 }
                 $copytooption = array('min', 'max', 'maybeempty', 'showyear');
                 foreach ($copytooption as $key) {
                     if (isset($searchoptions[$key]) && !isset($options[$key])) {
                         $options[$key] = $searchoptions[$key];
                     }
                 }
                 $options['value'] = $value;
                 return Html::showDateField($name, $options);
             case "datetime":
                 if (isset($options['relative_dates']) && $options['relative_dates']) {
                     if (isset($searchoptions['maybefuture']) && $searchoptions['maybefuture']) {
                         $options['with_future'] = true;
                     }
                     $options['with_time'] = true;
                     return Html::showGenericDateTimeSearch($name, $value, $options);
                 }
                 $copytooption = array('mindate', 'maxdate', 'mintime', 'maxtime', 'maybeempty', 'timestep');
                 foreach ($copytooption as $key) {
                     if (isset($searchoptions[$key]) && !isset($options[$key])) {
                         $options[$key] = $searchoptions[$key];
                     }
                 }
                 $options['value'] = $value;
                 return Html::showDateTimeField($name, $options);
             case "timestamp":
                 $copytooption = array('addfirstminutes', 'emptylabel', 'inhours', 'max', 'min', 'step', 'toadd', 'display_emptychoice');
                 foreach ($copytooption as $key) {
                     if (isset($searchoptions[$key]) && !isset($options[$key])) {
                         $options[$key] = $searchoptions[$key];
                     }
                 }
                 $options['value'] = $value;
                 return Dropdown::showTimeStamp($name, $options);
             case "itemlink":
                 // Do not use dropdown if wanted to select string value instead of ID
                 if (isset($options['itemlink_as_string']) && $options['itemlink_as_string']) {
                     break;
                 }
             case "dropdown":
                 $copytooption = array('condition', 'displaywith', 'emptylabel', 'right', 'toadd');
                 $options['name'] = $name;
                 $options['value'] = $value;
                 foreach ($copytooption as $key) {
                     if (isset($searchoptions[$key]) && !isset($options[$key])) {
                         $options[$key] = $searchoptions[$key];
                     }
                 }
                 if (!isset($options['entity'])) {
                     $options['entity'] = $_SESSION['glpiactiveentities'];
                 }
                 $itemtype = getItemTypeForTable($searchoptions['table']);
                 return $itemtype::dropdown($options);
             case "right":
                 return Profile::dropdownRights(Profile::getRightsFor($searchoptions['rightclass']), $name, $value, array('multiple' => false, 'display' => false));
             case "itemtypename":
                 if (isset($searchoptions['itemtype_list'])) {
                     $options['types'] = $CFG_GLPI[$searchoptions['itemtype_list']];
                 }
                 $copytooption = array('types');
                 $options['value'] = $value;
                 foreach ($copytooption as $key) {
                     if (isset($searchoptions[$key]) && !isset($options[$key])) {
                         $options[$key] = $searchoptions[$key];
                     }
                 }
                 if (isset($options['types'])) {
                     return Dropdown::showItemTypes($name, $options['types'], $options);
                 }
                 return false;
             case "language":
                 $copytooption = array('emptylabel', 'display_emptychoice');
                 foreach ($copytooption as $key) {
                     if (isset($searchoptions[$key]) && !isset($options[$key])) {
                         $options[$key] = $searchoptions[$key];
                     }
                 }
                 $options['value'] = $value;
                 return Dropdown::showLanguages($name, $options);
         }
         // Get specific display if available
         $itemtype = getItemTypeForTable($searchoptions['table']);
         if ($item = getItemForItemtype($itemtype)) {
             $specific = $item->getSpecificValueToSelect($searchoptions['field'], $name, $values, $options);
             if (strlen($specific)) {
                 return $specific;
             }
         }
     }
     // default case field text
     $this->fields[$name] = $value;
     return Html::autocompletionTextField($this, $name, $options);
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:101,代码来源:commondbtm.class.php

示例6: getAllRights

 static function getAllRights($all = false)
 {
     $rights = array(array('rights' => Profile::getRightsFor('PluginFinancialreportsConfig', 'central'), 'label' => _n('Asset situation', 'Asset situations', 1, 'financialreports'), 'field' => 'plugin_financialreports'));
     return $rights;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:5,代码来源:profile.class.php


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