• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Group_User类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: cleanDBonPurge

 function cleanDBonPurge()
 {
     global $DB;
     $gu = new Group_User();
     $gu->cleanDBonItemDelete($this->getType(), $this->fields['id']);
     $gt = new Group_Ticket();
     $gt->cleanDBonItemDelete($this->getType(), $this->fields['id']);
     $gp = new Group_Problem();
     $gp->cleanDBonItemDelete($this->getType(), $this->fields['id']);
     $cg = new Change_Group();
     $cg->cleanDBonItemDelete($this->getType(), $this->fields['id']);
     $query1 = "DELETE\n                 FROM `glpi_projecttaskteams`\n                 WHERE `items_id` = '" . $this->fields['id'] . "'\n                       AND `itemtype` = '" . __CLASS__ . "'";
     $DB->query($query1);
     $query1 = "DELETE\n                 FROM `glpi_projectteams`\n                 WHERE `items_id` = '" . $this->fields['id'] . "'\n                       AND `itemtype` = '" . __CLASS__ . "'";
     $DB->query($query1);
     $gki = new Group_KnowbaseItem();
     $gki->cleanDBonItemDelete($this->getType(), $this->fields['id']);
     $gr = new Group_Reminder();
     $gr->cleanDBonItemDelete($this->getType(), $this->fields['id']);
     // Ticket rules use various _groups_id_*
     Rule::cleanForItemAction($this, '_groups_id%');
     Rule::cleanForItemCriteria($this, '_groups_id%');
     // GROUPS for RuleMailcollector
     Rule::cleanForItemCriteria($this, 'GROUPS');
     // Set no group to consumables
     $query = "UPDATE `glpi_consumables`\n                SET `items_id` = '0'\n                WHERE `items_id` = '" . $this->fields['id'] . "'\n                      AND `itemtype` = 'Group'";
     $DB->query($query);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:28,代码来源:group.class.php


示例2: cleanDBonPurge

 function cleanDBonPurge()
 {
     global $DB;
     $gu = new Group_User();
     $gu->cleanDBonItemDelete($this->getType(), $this->fields['id']);
     $gt = new Group_Ticket();
     $gt->cleanDBonItemDelete($this->getType(), $this->fields['id']);
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:8,代码来源:group.class.php


示例3: getGroups

 function getGroups($ticket_id, $removeAlreadyAssigned = true)
 {
     $groups = $user_groups = $ticket_groups = array();
     // get groups for user connected
     $tmp_user_groups = Group_User::getUserGroups($_SESSION['glpiID']);
     foreach ($tmp_user_groups as $current_group) {
         $user_groups[$current_group['id']] = $current_group['id'];
         $groups[$current_group['id']] = $current_group['id'];
     }
     // get groups already assigned in the ticket
     if ($ticket_id > 0) {
         $ticket = new Ticket();
         $ticket->getFromDB($ticket_id);
         foreach ($ticket->getGroups(CommonITILActor::ASSIGN) as $current_group) {
             $ticket_groups[$current_group['groups_id']] = $current_group['groups_id'];
         }
     }
     // To do an escalation, the user must be in a group currently assigned to the ticket
     // or no group is assigned to the ticket
     // TODO : matching with "view all tickets (yes/no) option in profile user"
     if (!empty($ticket_groups) && count(array_intersect($ticket_groups, $user_groups)) == 0) {
         return array();
     }
     //get all group which we can climb
     if (count($groups) > 0) {
         $group_group = $this->find("groups_id_source IN (" . implode(", ", $groups) . ")");
         foreach ($group_group as $current_group) {
             $groups[$current_group['groups_id_destination']] = $current_group['groups_id_destination'];
         }
     }
     //remove already assigned groups
     if (!empty($ticket_groups) && $removeAlreadyAssigned) {
         $groups = array_diff_assoc($groups, $ticket_groups);
     }
     //add name to returned groups and remove non assignable groups
     $group_obj = new Group();
     foreach ($groups as $groups_id => &$groupname) {
         $group_obj->getFromDB($groups_id);
         //check if we can assign this group
         if ($group_obj->fields['is_assign'] == 0) {
             unset($groups[$groups_id]);
             continue;
         }
         //add name
         $groupname = $group_obj->fields['name'];
     }
     //sort by group name (and keep associative index)
     asort($groups);
     return $groups;
 }
开发者ID:korial29,项目名称:escalade,代码行数:50,代码来源:group_group.class.php


示例4: pdfForGroup

 static function pdfForGroup(PluginPdfSimplePDF $pdf, Group $group, $tree)
 {
     global $DB, $CFG_GLPI;
     $used = array();
     $ids = array();
     // Retrieve member list
     $entityrestrict = Group_User::getDataForGroup($group, $used, $ids, '', $tree);
     $title = "<b>" . sprintf(__('%1$s (%2$s)'), _n('User', 'Users', 2) . "</b>", __('D=Dynamic'));
     $number = count($used);
     if ($number > $_SESSION['glpilist_limit']) {
         $title = sprintf(__('%1$s (%2$s)'), $title, $_SESSION['glpilist_limit'] . "/" . $number);
     } else {
         $title = sprintf(__('%1$s (%2$s)'), $title, $number);
     }
     $pdf->setColumnsSize(100);
     $pdf->displayTitle($title);
     if ($number) {
         $user = new User();
         $group = new Group();
         if ($tree) {
             $pdf->setColumnsSize(35, 45, 10, 10);
             $pdf->displayTitle(User::getTypeName(1), Group::getTypeName(1), __('Manager'), __('Delegatee'));
         } else {
             $pdf->setColumnsSize(60, 20, 20);
             $pdf->displayTitle(User::getTypeName(1), __('Manager'), __('Delegatee'));
         }
         for ($i = 0; $i < $number && $i < $_SESSION['glpilist_limit']; $i++) {
             $data = $used[$i];
             $name = Html::clean(getUserName($data["id"]));
             if ($data["is_dynamic"]) {
                 $name = sprintf(__('%1$s (%2$s)'), $name, '<b>' . __('D') . '</b>');
             }
             if ($tree) {
                 $group->getFromDB($data["groups_id"]);
                 $pdf->displayLine($name, $group->getName(), Dropdown::getYesNo($data['is_manager']), Dropdown::getYesNo($data['is_userdelegate']));
             } else {
                 $pdf->displayLine($name, Dropdown::getYesNo($data['is_manager']), Dropdown::getYesNo($data['is_userdelegate']));
             }
         }
     } else {
         $pdf->setColumnsAlign('center');
         $pdf->displayLine(__('No item found'));
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:45,代码来源:group_user.class.php


示例5: checkGroupUserFromForm

 static function checkGroupUserFromForm($formID)
 {
     //$formID = $_REQUEST['id'];
     $grupos = Group_User::getUserGroups($_SESSION['glpiID']);
     $gruposUsuario = array("0");
     $found = 0;
     foreach ($grupos as $grupo) {
         if (in_array($grupo['id'], PluginFormcreatorForm::getGroupForm($formID))) {
             $found = 1;
         }
     }
     return $found;
 }
开发者ID:OscarLoayzaB,项目名称:formcreator,代码行数:13,代码来源:form.class.php


示例6: define

// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
header("Content-Type: text/html; charset=UTF-8");
header_nocache();
if (!isset($_POST["id"])) {
    exit;
}
checkRight("group", "r");
$group = new Group();
if ($_POST["id"] > 0 && $group->can($_POST["id"], 'r')) {
    switch ($_REQUEST['glpi_tab']) {
        case -1:
            Group_User::showForGroup($_POST['target'], $group);
            $group->showItems();
            $group->showLDAPForm($_POST['target'], $_POST["id"]);
            Plugin::displayAction($group, $_REQUEST['glpi_tab']);
            break;
        case 2:
            $group->showItems();
            break;
        case 3:
            $group->showLDAPForm($_POST['target'], $_POST["id"]);
            break;
        default:
            if (!Plugin::displayAction($group, $_REQUEST['glpi_tab'])) {
                Group_User::showForGroup($_POST['target'], $group);
            }
    }
}
ajaxFooter();
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:group.tabs.php


示例7: generate_entity


//.........这里部分代码省略.........
                               'name'         => "group d'$i",
                               'comment'      => "comment group d'$i",
                               'is_assign'    => 0)));

      // Generate sub group
      for ($j=0 ; $j<$MAX['groups'] ; $j++) {
         $group->add(toolbox::addslashes_deep(
                     array('entities_id'  => $ID_entity,
                           'name'         => "subgroup d'$j",
                           'comment'      => "comment subgroup d'$j of group $i",
                           'groups_id'    => $gID,
                           'is_assign'    => 0)));
      }
   }

   $LAST["groups"]      = getMaxItem("glpi_groups");

   $FIRST["techgroups"] = $LAST["groups"]+1;

   for ($i=0 ; $i<$MAX['groups'] ; $i++) {
         $group->add(toolbox::addslashes_deep(
                     array('entities_id'  => $ID_entity,
                           'name'         => "tech group d'$i",
                           'comment'      => "comment tech group d'$i")));
   }

   $LAST["techgroups"] = getMaxItem("glpi_groups");
   regenerateTreeCompleteName("glpi_groups");


   // glpi_users
   $FIRST["users_sadmin"] = getMaxItem("glpi_users")+1;
   $user                  = new User();
   $gu                    = new Group_User();
   for ($i=0 ; $i<$MAX['users_sadmin'] ; $i++) {
      $users_id = $user->add(toolbox::addslashes_deep(
                             array('name'               => "sadmin$i-$ID_entity",
                                   'password'           => "sadmin'$i",
                                   'password2'          => "sadmin'$i",
                                   'phone'              => "tel $i",
                                   'phone2'             => "tel2 $i",
                                   'mobile'             => "mobile $i",
                                   'realname'           => "sadmin '$i name",
                                   'firstname'          => "sadmin '$i firstname",
                                   'comment'            => "comment' $i",
                                   'usertitles_id'      => mt_rand(0,$MAX['user_title']),
                                   'usercategories_id'  => mt_rand(0,$MAX['user_type']),
                                   '_profiles_id'       => 4,
                                   '_entities_id'       => $ID_entity,
                                   '_is_recursive'      => 1
                                   )));

      $gu->add(array('users_id'     => $users_id,
                     'groups_id'    => mt_rand($FIRST['groups'], $LAST['groups'])));

      $gu->add(array('users_id'     => $users_id,
                     'groups_id'    => mt_rand($FIRST['techgroups'], $LAST['techgroups'])));
   }
   $LAST["users_sadmin"] = getMaxItem("glpi_users");
   $FIRST["users_admin"] = getMaxItem("glpi_users")+1;

   for ($i=0 ; $i<$MAX['users_admin'] ; $i++) {

      $users_id = $user->add(toolbox::addslashes_deep(
                             array('name'               => "admin$i-$ID_entity",
                                   'password'           => "admin'$i",
开发者ID:KaneoGmbH,项目名称:glpi,代码行数:67,代码来源:generate_bigdump.function.php


示例8: deleteGroups

 static function deleteGroups($user_ID, $only_dynamic = false)
 {
     global $DB;
     $crit['users_id'] = $user_ID;
     if ($only_dynamic) {
         $crit['is_dynamic'] = '1';
     }
     $obj = new Group_User();
     $obj->deleteByCriteria($crit);
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:10,代码来源:group_user.class.php


示例9: sendAddGroupUsersForm

 /**
  * Recieve 'All users of a group' data from self::showAddGroupUsersForm and save them to session and DB
  *
  * @since 9.1
  *
  * @param $params (array) : must contais form data (typically $_REQUEST)
  */
 static function sendAddGroupUsersForm($params = array())
 {
     $current_group =& $_SESSION['glpi_plannings']['plannings']["group_" . $params['groups_id'] . "_users"];
     $current_group = array('display' => true, 'type' => 'group_users');
     $users = Group_User::getGroupUsers($params['groups_id']);
     $index_color = count($_SESSION['glpi_plannings']['plannings']);
     $group_user_index = 0;
     foreach ($users as $user_data) {
         // do not add an already set user
         if (!isset($_SESSION['glpi_plannings']['plannings']['user_' . $user_data['id']])) {
             $current_group['users']['user_' . $user_data['id']] = array('color' => self::$palette_bg[$_SESSION['glpi_plannings_color_index']], 'display' => true, 'type' => 'user');
             $_SESSION['glpi_plannings_color_index']++;
         }
     }
     self::savePlanningsInDB();
 }
开发者ID:korial29,项目名称:glpi,代码行数:23,代码来源:planning.class.php


示例10: getAllUsers

 /**
  * get users linked to an object including groups ones
  *
  * @since version 0.85
  *
  * @param $type type to search (see constants)
  *
  * @return array
  **/
 function getAllUsers($type)
 {
     $users = array();
     foreach ($this->getUsers($type) as $link) {
         $users[$link['users_id']] = $link['users_id'];
     }
     foreach ($this->getGroups($type) as $link) {
         $gusers = Group_User::getGroupUsers($link['groups_id']);
         foreach ($gusers as $user) {
             $users[$user['id']] = $user['id'];
         }
     }
     return $users;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:23,代码来源:commonitilobject.class.php


示例11: manageDeletedUserInLdap

 /**
  * @param $users_id
  **/
 static function manageDeletedUserInLdap($users_id)
 {
     global $CFG_GLPI;
     //User is present in DB but not in the directory : it's been deleted in LDAP
     $tmp['id'] = $users_id;
     $myuser = new User();
     switch ($CFG_GLPI['user_deleted_ldap']) {
         //DO nothing
         default:
         case 0:
             break;
             //Put user in dustbin
         //Put user in dustbin
         case 1:
             $myuser->delete($tmp);
             break;
             //Delete all user dynamic habilitations and groups
         //Delete all user dynamic habilitations and groups
         case 2:
             Profile_User::deleteRights($users_id, true);
             Group_User::deleteGroups($users_id, true);
             break;
             //Deactivate the user
         //Deactivate the user
         case 3:
             $tmp['is_active'] = 0;
             $myuser->update($tmp);
             break;
     }
     $changes[0] = '0';
     $changes[1] = '';
     $changes[2] = __('Deleted user in LDAP directory');
     Log::history($users_id, 'User', $changes, 0, Log::HISTORY_LOG_SIMPLE_MESSAGE);
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:37,代码来源:user.class.php


示例12: Group_User

This file is part of GLPI.

GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
* @since vesion 0.84
*/
include '../inc/includes.php';
Session::checkCentralAccess();
$group_user = new Group_User();
if (isset($_POST["add"])) {
    $group_user->check(-1, 'w', $_POST);
    if ($group_user->add($_POST)) {
        Event::log($_POST["groups_id"], "groups", 4, "setup", sprintf(__('%s adds a user to a group'), $_SESSION["glpiname"]));
    }
    Html::back();
}
Html::displayErrorAndDie("lost");
开发者ID:gaforeror,项目名称:glpi,代码行数:31,代码来源:group_user.form.php


示例13: manageValidationAdd

 /**
  * Manage Validation add from input
  *
  * @since version 0.85
  *
  * @param $input array : input array
  *
  * @return nothing
  **/
 function manageValidationAdd($input)
 {
     //Action for send_validation rule
     if (isset($input["_add_validation"])) {
         if (isset($input['entities_id'])) {
             $entid = $input['entities_id'];
         } else {
             if (isset($this->fields['entities_id'])) {
                 $entid = $this->fields['entities_id'];
             } else {
                 return false;
             }
         }
         $validations_to_send = array();
         if (!is_array($input["_add_validation"])) {
             $input["_add_validation"] = array($input["_add_validation"]);
         }
         foreach ($input["_add_validation"] as $key => $validation) {
             switch ($validation) {
                 case 'requester_supervisor':
                     if (isset($input['_groups_id_requester']) && $input['_groups_id_requester']) {
                         $users = Group_User::getGroupUsers($input['_groups_id_requester'], "is_manager='1'");
                         foreach ($users as $data) {
                             $validations_to_send[] = $data['id'];
                         }
                     }
                     // Add to already set groups
                     foreach ($this->getGroups(CommonITILActor::REQUESTER) as $d) {
                         $users = Group_User::getGroupUsers($d['groups_id'], "is_manager='1'");
                         foreach ($users as $data) {
                             $validations_to_send[] = $data['id'];
                         }
                     }
                     break;
                 case 'assign_supervisor':
                     if (isset($input['_groups_id_assign']) && $input['_groups_id_assign']) {
                         $users = Group_User::getGroupUsers($input['_groups_id_assign'], "is_manager='1'");
                         foreach ($users as $data) {
                             $validations_to_send[] = $data['id'];
                         }
                     }
                     foreach ($this->getGroups(CommonITILActor::ASSIGN) as $d) {
                         $users = Group_User::getGroupUsers($d['groups_id'], "is_manager='1'");
                         foreach ($users as $data) {
                             $validations_to_send[] = $data['id'];
                         }
                     }
                     break;
                 default:
                     // Group case from rules
                     if ($key === 'group') {
                         foreach ($validation as $groups_id) {
                             $validation_right = 'validate_incident';
                             if (isset($input['type']) && $input['type'] == Ticket::DEMAND_TYPE) {
                                 $validation_right = 'validate_request';
                             }
                             $opt = array('groups_id' => $groups_id, 'right' => $validation_right, 'entity' => $entid);
                             $data_users = TicketValidation::getGroupUserHaveRights($opt);
                             foreach ($data_users as $user) {
                                 $validations_to_send[] = $user['id'];
                             }
                         }
                     } else {
                         $validations_to_send[] = $validation;
                     }
             }
         }
         // Validation user added on ticket form
         if (isset($input['users_id_validate'])) {
             if (array_key_exists('groups_id', $input['users_id_validate'])) {
                 foreach ($input['users_id_validate'] as $key => $validation_to_add) {
                     if (is_numeric($key)) {
                         $validations_to_send[] = $validation_to_add;
                     }
                 }
             } else {
                 foreach ($input['users_id_validate'] as $key => $validation_to_add) {
                     if (is_numeric($key)) {
                         $validations_to_send[] = $validation_to_add;
                     }
                 }
             }
         }
         // Keep only one
         $validations_to_send = array_unique($validations_to_send);
         $validation = new TicketValidation();
         if (count($validations_to_send)) {
             $values = array();
             $values['tickets_id'] = $this->fields['id'];
             if (isset($input['id']) && $input['id'] != $this->fields['id']) {
                 $values['_ticket_add'] = true;
//.........这里部分代码省略.........
开发者ID:glpi-project,项目名称:glpi,代码行数:101,代码来源:ticket.class.php


示例14: prepareRun

 function prepareRun($taskjob_id, $definitions_filter = NULL)
 {
     global $DB;
     $task = new PluginFusioninventoryTask();
     $job = new PluginFusioninventoryTaskjob();
     $joblog = new PluginFusioninventoryTaskjoblog();
     $jobstate = new PluginFusioninventoryTaskjobstate();
     $agent = new PluginFusioninventoryAgent();
     $agentmodule = new PluginFusioninventoryAgentmodule();
     $job->getFromDB($taskjob_id);
     $task->getFromDB($job->fields['plugin_fusioninventory_tasks_id']);
     $communication = $task->fields['communication'];
     $actions = importArrayFromDB($job->fields['action']);
     $definitions = importArrayFromDB($job->fields['definition']);
     $taskvalid = 0;
     $computers = array();
     foreach ($actions as $action) {
         $itemtype = key($action);
         $items_id = current($action);
         switch ($itemtype) {
             case 'Computer':
                 if ($this->definitionFiltered("Computer", $definitions_filter)) {
                     break;
                 }
                 $computers[] = $items_id;
                 break;
             case 'Group':
                 if ($this->definitionFiltered("Group", $definitions_filter)) {
                     break;
                 }
                 $computer_object = new Computer();
                 //find computers by user associated with this group
                 $group_users = new Group_User();
                 $group = new Group();
                 $group->getFromDB($items_id);
                 $members = array();
                 $computers_a_1 = array();
                 $computers_a_2 = array();
                 //array_keys($group_users->find("groups_id = '$items_id'"));
                 $members = $group_users->getGroupUsers($items_id);
                 foreach ($members as $member) {
                     $computers = $computer_object->find("users_id = '{$member['id']}' " . " AND `is_deleted`='0' AND `is_template`='0'");
                     foreach ($computers as $computer) {
                         $computers_a_1[] = $computer['id'];
                     }
                 }
                 //find computers directly associated with this group
                 $computers = $computer_object->find("groups_id = '{$items_id}' " . " AND `is_deleted`='0' AND `is_template`='0'");
                 foreach ($computers as $computer) {
                     $computers_a_2[] = $computer['id'];
                 }
                 //merge two previous array and deduplicate entries
                 $computers = array_unique(array_merge($computers_a_1, $computers_a_2));
                 break;
             case 'PluginFusioninventoryDeployGroup':
                 $group = new PluginFusioninventoryDeployGroup();
                 $group->getFromDB($items_id);
                 switch ($group->getField('type')) {
                     case 'STATIC':
                         if ($this->definitionFiltered("PluginFusioninventoryDeployGroupStatic", $definitions_filter)) {
                             break;
                         }
                         $query = "SELECT items_id\n                     FROM glpi_plugin_fusioninventory_deploygroups_staticdatas\n                     WHERE groups_id = '{$items_id}'\n                     AND itemtype = 'Computer'";
                         $res = $DB->query($query);
                         while ($row = $DB->fetch_assoc($res)) {
                             $computers[] = $row['items_id'];
                         }
                         break;
                     case 'DYNAMIC':
                         if ($this->definitionFiltered("PluginFusioninventoryDeployGroupDynamic", $definitions_filter)) {
                             break;
                         }
                         //$definitions_filter is NULL = update by crontask !
                         if ($definitions_filter != NULL) {
                             $where = " AND `can_update_group`='1'";
                         } else {
                             $where = "";
                         }
                         $query = "SELECT fields_array\n                     FROM glpi_plugin_fusioninventory_deploygroups_dynamicdatas\n                     WHERE groups_id = '{$items_id}' {$where}\n                     LIMIT 1";
                         $res = $DB->query($query);
                         $row = $DB->fetch_assoc($res);
                         //No dynamic groups have been found : break
                         if ($DB->numrows($res) == 0) {
                             break;
                         }
                         if (isset($_GET)) {
                             $get_tmp = $_GET;
                         }
                         if (isset($_SESSION["glpisearchcount"]['Computer'])) {
                             unset($_SESSION["glpisearchcount"]['Computer']);
                         }
                         if (isset($_SESSION["glpisearchcount2"]['Computer'])) {
                             unset($_SESSION["glpisearchcount2"]['Computer']);
                         }
                         $_GET = importArrayFromDB($row['fields_array']);
                         $_GET["glpisearchcount"] = count($_GET['field']);
                         if (isset($_GET['field2'])) {
                             $_GET["glpisearchcount2"] = count($_GET['field2']);
                         }
                         $pfSearch = new PluginFusioninventorySearch();
//.........这里部分代码省略.........
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:101,代码来源:deploycommon.class.php


示例15: manageDeletedUserInLdap

 /**
  * @param $users_id
  **/
 static function manageDeletedUserInLdap($users_id)
 {
     global $CFG_GLPI;
     //The only case where users_id can be null if when a user has been imported into GLPi
     //it's dn still exists, but doesn't match the connection filter anymore
     //In this case, do not try to process the user
     if (!$users_id) {
         return true;
     }
     //User is present in DB but not in the directory : it's been deleted in LDAP
     $tmp['id'] = $users_id;
     $tmp['is_deleted_ldap'] = 1;
     $myuser = new self();
     $myuser->getFromDB($users_id);
     //User is already considered as delete from ldap
     if ($myuser->fields['is_deleted_ldap'] == 1) {
         return;
     }
     switch ($CFG_GLPI['user_deleted_ldap']) {
         //DO nothing
         default:
         case 0:
             $myuser->update($tmp);
             break;
             //Put user in dustbin
         //Put user in dustbin
         case 1:
             $myuser->delete($tmp);
             break;
             //Delete all user dynamic habilitations and groups
         //Delete all user dynamic habilitations and groups
         case 2:
             Profile_User::deleteRights($users_id, true);
             Group_User::deleteGroups($users_id, true);
             $myuser->update($tmp);
             break;
             //Deactivate the user
         //Deactivate the user
         case 3:
             $tmp['is_active'] = 0;
             $myuser->update($tmp);
             break;
             //Deactivate the user+ Delete all user dynamic habilitations and groups
         //Deactivate the user+ Delete all user dynamic habilitations and groups
         case 4:
             $tmp['is_active'] = 0;
             $myuser->update($tmp);
             Profile_User::deleteRights($users_id, true);
             Group_User::deleteGroups($users_id, true);
             break;
     }
     /*
           $changes[0] = '0';
           $changes[1] = '';
           $changes[2] = __('Deleted user in LDAP directory');
           Log::history($users_id, 'User', $changes, 0, Log::HISTORY_LOG_SIMPLE_MESSAGE);*/
 }
开发者ID:stweil,项目名称:glpi,代码行数:60,代码来源:user.class.php


示例16: prepareInputDataForProcess

 /**
  * @see RuleCollection::prepareInputDataForProcess()
  **/
 function prepareInputDataForProcess($input, $params)
 {
     // Pass x-priority header if exists
     if (isset($input['_head']['x-priority'])) {
         $input['_x-priority'] = $input['_head']['x-priority'];
     }
     $input['_groups_id_of_requester'] = array();
     // Get groups of users
     if (isset($input['_users_id_requester'])) {
         foreach (Group_User::getUserGroups($input['_users_id_requester']) as $g) {
             $input['_groups_id_of_requester'][$g['id']] = $g['id'];
         }
     }
     return $input;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:18,代码来源:ruleticketcollection.class.php


示例17: getWidgetContentForItem

 function getWidgetContentForItem($widgetId)
 {
     global $CFG_GLPI, $DB;
     if (empty($this->form)) {
         $this->init();
     }
     switch ($widgetId) {
         case $this->getType() . "1":
             $plugin = new Plugin();
             if ($plugin->isActivated("tasklists")) {
                 $widget = new PluginMydashboardDatatable();
                 $headers = array(__('Name'), __('Priority'), _n('Context', 'Contexts', 1, 'tasklists'), __('User'), __('Percent done'), __('Due date'), __('Action'));
                 $query = "SELECT `glpi_plugin_tasklists_tasks`.*,`glpi_plugin_tasklists_tasktypes`.`completename` as 'type' \n                            FROM `glpi_plugin_tasklists_tasks`\n                            LEFT JOIN `glpi_plugin_tasklists_tasktypes` ON (`glpi_plugin_tasklists_tasks`.`plugin_tasklists_tasktypes_id` = `glpi_plugin_tasklists_tasktypes`.`id`) \n                            WHERE NOT `glpi_plugin_tasklists_tasks`.`is_deleted`\n                                 AND `glpi_plugin_tasklists_tasks`.`state` < 2 ";
                 $query .= getEntitiesRestrictRequest('AND', 'glpi_plugin_tasklists_tasks');
                 $query .= "ORDER BY `glpi_plugin_tasklists_tasks`.`priority`DESC ";
                 $tasks = array();
                 if ($result = $DB->query($query)) {
                     if ($DB->numrows($result)) {
                         while ($data = $DB->fetch_array($result)) {
                             //$groups = Group_User::getGroupUsers($data['groups_id']);
                             $groupusers = Group_User::getGroupUsers($data['groups_id']);
                             $groups = array();
                             foreach ($groupusers as $groupuser) {
                                 $groups[] = $groupuser["id"];
                             }
                             if ($data['visibility'] == 1 && $data['users_id'] == Session::getLoginUserID() || $data['visibility'] == 2 && ($data['users_id'] == Session::getLoginUserID() || in_array(Session::getLoginUserID(), $groups)) || $data['visibility'] == 3) {
                                 $ID = $data['id'];
                                 $rand = mt_rand();
                                 $url = Toolbox::getItemTypeFormURL("PluginTasklistsTask") . "?id=" . $data['id'];
                                 $tasks[$data['id']][0] = "<a id='task" . $data["id"] . $rand . "' target='_blank' href='{$url}'>" . $data['name'] . "</a>";
                                 $tasks[$data['id']][0] .= Html::showToolTip($data['comment'], array('applyto' => 'task' . $data["id"] . $rand, 'display' => false));
                                 $bgcolor = $_SESSION["glpipriority_" . $data['priority']];
                                 $tasks[$data['id']][1] = "<div class='center' style='background-color:{$bgcolor};'>" . CommonITILObject::getPriorityName($data['priority']) . "</div>";
                                 $tasks[$data['id']][2] = $data['type'];
                                 $tasks[$data['id']][3] = getUserName($data['users_id']);
                                 $tasks[$data['id']][4] = Dropdown::getValueWithUnit($data['percent_done'], "%");
                                 $due_date = $data['due_date'];
                                 $display = Html::convDate($data['due_date']);
                                 if ($due_date <= date('Y-m-d') && !empty($due_date)) {
                                     $display = "<div class='deleted'>" . Html::convDate($data['due_date']) . "</div>";
                                 }
                                 $tasks[$data['id']][5] = $display;
                                 $tasks[$data['id']][6] = "<div align='center'>";
                                 if (Session::haveRight("plugin_tasklists", UPDATE)) {
                                     $tasks[$data['id']][6] .= "<a class='pointer' onclick=\" submitGetLink('" . $CFG_GLPI['root_doc'] . "/plugins/tasklists/front/task.form.php', {'done': 'done', 'id': '" . $data['id'] . "', '_glpi_csrf_token': '" . Session::getNewCSRFToken() . "', '_glpi_simple_form': '1'});\"><img src='" . $CFG_GLPI['root_doc'] . "/plugins/tasklists/pics/ok.png' title='" . __('Mark as done', 'tasklists') . "'></a>";
                                 }
                                 if (Session::haveRight("plugin_tasklists", UPDATENOTE)) {
                                     $link = "&nbsp;<a href=\"javascript:" . Html::jsGetElementbyID('comment' . $rand) . ".dialog('open');\">";
                                     $link .= "<img class='pointer' src='" . $CFG_GLPI['root_doc'] . "/plugins/tasklists/pics/plus.png' title='" . __('Add comment', 'tasklists') . "'>";
                                     $link .= "</a>";
                                     $link .= Ajax::createIframeModalWindow('comment' . $rand, $CFG_GLPI["root_doc"] . "/plugins/tasklists/front/comment.form.php?id=" . $ID, array('title' => __('Add comment', 'tasklists'), 'reloadonclose' => false, 'width' => 1100, 'display' => false, 'height' => 300));
                                     $tasks[$data['id']][6] .= $link;
                                 }
                                 $tasks[$data['id']][6] .= "</div>";
                             }
                         }
                     }
                 }
                 $widget->setTabDatas($tasks);
                 $widget->setTabNames($headers);
                 $widget->setOption("bSort", false);
                 $widget->toggleWidgetRefresh();
                 $link = "<div align='right'><a class='vsubmit' href=\"javascript:" . Html::jsGetElementbyID('task') . ".dialog('open');\">";
                 $link .= __('Add task', 'tasklists');
                 $link .= "</a></div>";
                 $link .= Ajax::createIframeModalWindow('task', $CFG_GLPI["root_doc"] . "/plugins/tasklists/front/task.form.php", array('title' => __('Add task', 'tasklists'), 'reloadonclose' => false, 'width' => 1180, 'display' => false, 'height' => 600));
                 $widget->appendWidgetHtmlContent($link);
                 $widget->setWidgetTitle(__("Tasks list", 'tasklists'));
                 return $widget;
             } else {
                 $widget = new PluginMydashboardDatatable();
                 $widget->setWidgetTitle(__("Tasks list", 'tasklists'));
                 return $widget;
             }
             break;
     }
 }
开发者ID:InfotelGLPI,项目名称:tasklists,代码行数:77,代码来源:dashboard.class.php


示例18: checkAvailability

 /**
  * Show the availability of a user
  *
  * @since version 0.83
  *
  * @param $params   array of params
  *    must contain :
  *          - begin: begin date to check (default '')
  *          - end: end date to check (default '')
  *          - itemtype : User or Object type (Ticket...)
  *          - foreign key field of the itemtype to define which item to used
  *    optional :
  *          - limitto : limit display to a specific user
  *
  * @return Nothing (display function)
  **/
 static function checkAvailability($params = array())
 {
     global $CFG_GLPI, $DB;
     if (!isset($params['itemtype'])) {
         return false;
     }
     if (!($item = getItemForItemtype($params['itemtype']))) {
         return false;
     }
     if (!isset($params[$item->getForeignKeyField()]) || !$item->getFromDB($params[$item->getForeignKeyField()])) {
         return false;
     }
     // No limit by default
     if (!isset($params['limitto'])) {
         $params['limitto'] = 0;
     }
     if (isset($params['begin']) && !empty($params['begin'])) {
         $begin = $params['begin'];
     } else {
         $begin = date("Y-m-d");
     }
     if (isset($params['end']) && !empty($params['end'])) {
         $end = $params['end'];
     } else {
         $end = date("Y-m-d");
     }
     if ($end < $begin) {
         $end = $begin;
     }
     $realbegin = $begin . " " . $CFG_GLPI["planning_begin"];
     $realend = $end . " " . $CFG_GLPI["planning_end"];
     $users = array();
     switch ($item->getType()) {
         case 'User':
             $users[$item->getID()] = $item->getName();
             break;
         default:
             if (Toolbox::is_a($item, 'CommonITILObject')) {
                 foreach ($item->getUsers(CommonITILActor::ASSIGN) as $data) {
                     $users[$data['users_id']] = getUserName($data['users_id']);
                 }
                 foreach ($item->getGroups(CommonITILActor::ASSIGN) as $data) {
                     foreach (Group_User::getGroupUsers($data['groups_id']) as $data2) {
                         $users[$data2['id']] = formatUserName($data2["id"], $data2["name"], $data2["realname"], $data2["firstname"]);
                     }
                 }
             }
             break;
     }
     asort($users);
     // Use get method to check availability
     echo "<div class='center'><form method='GET' name='form' action='planning.php'>\n";
     echo "<table class='tab_cadre_fixe'>";
     $colspan = 5;
     if (count($users) > 1) {
         $colspan++;
     }
     echo "<tr class='tab_bg_1'><th colspan='{$colspan}'>" . __('Availability') . "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Start') . "</td>\n";
     echo "<td>&quo 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Group_member类代码示例发布时间:2022-05-23
下一篇:
PHP GroupTest类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap