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


PHP getLoginUserID函数代码示例

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


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

示例1: can

 /**
  * Check right on an item - overloaded to check user access to its datas
  *
  * @param $ID ID of the item (-1 if new item)
  * @param $right Right to check : r / w / recursive
  * @param $input array of input data (used for adding item)
  *
  * @return boolean
  **/
 function can($ID, $right, &$input = NULL)
 {
     if ($ID > 0) {
         if ($this->fields['users_id'] === getLoginUserID()) {
             return true;
         }
     }
     return parent::can($ID, $right, $input);
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:18,代码来源:ticket_user.class.php

示例2: canUpdateItem

 /**
  * Is the current user have right to update the current satisfaction
  *
  * @return boolean
  */
 function canUpdateItem()
 {
     $ticket = new Ticket();
     if (!$ticket->getFromDB($this->fields['tickets_id'])) {
         return false;
     }
     // you can't change if your answer > 12h
     if (!is_null($this->fields['date_answered']) && strtotime("now") - strtotime($this->fields['date_answered']) > 12 * HOUR_TIMESTAMP) {
         return false;
     }
     if ($ticket->isUser(Ticket::REQUESTER, getLoginUserID()) || $ticket->fields["users_id_recipient"] === getLoginUserID() || isset($_SESSION["glpigroups"]) && $ticket->haveAGroup(Ticket::REQUESTER, $_SESSION["glpigroups"])) {
         return true;
     }
     return false;
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:20,代码来源:ticketsatisfaction.class.php

示例3: countForItem

 static function countForItem(CommonDBTM $item)
 {
     $restrict = "`glpi_documents_items`.`documents_id` = `glpi_documents`.`id`\n                   AND `glpi_documents_items`.`items_id` = '" . $item->getField('id') . "'\n                   AND `glpi_documents_items`.`itemtype` = '" . $item->getType() . "'";
     if (getLoginUserID()) {
         $restrict .= getEntitiesRestrictRequest(" AND ", "glpi_documents", '', '', true);
     } else {
         // Anonymous access from FAQ
         $restrict .= " AND `glpi_documents`.`entities_id` = '0' ";
     }
     $nb = countElementsInTable(array('glpi_documents_items', 'glpi_documents'), $restrict);
     // Document case : search in both
     if ($item->getType() == 'Document') {
         $restrict = "`glpi_documents_items`.`items_id` = `glpi_documents`.`id`\n                      AND `glpi_documents_items`.`documents_id` = '" . $item->getField('id') . "'\n                      AND `glpi_documents_items`.`itemtype` = '" . $item->getType() . "'";
         if (getLoginUserID()) {
             $restrict .= getEntitiesRestrictRequest(" AND ", "glpi_documents", '', '', true);
         } else {
             // Anonymous access from FAQ
             $restrict .= " AND `glpi_documents`.`entities_id` = '0' ";
         }
         $nb += countElementsInTable(array('glpi_documents_items', 'glpi_documents'), $restrict);
     }
     return $nb;
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:23,代码来源:document_item.class.php

示例4: showBookmarkList

 /**
  * Show bookmarks list
  *
  * @param $target target to use for links
  * @param $is_private show private of public bookmarks ?
  *
  * @return nothing
  **/
 function showBookmarkList($target, $is_private = 1)
 {
     global $DB, $LANG, $CFG_GLPI;
     if (!$is_private && !haveRight('bookmark_public', 'r')) {
         return false;
     }
     $query = "SELECT `" . $this->getTable() . "`.*,\n                       `glpi_bookmarks_users`.`id` AS IS_DEFAULT\n                FROM `" . $this->getTable() . "`\n                LEFT JOIN `glpi_bookmarks_users`\n                  ON (`" . $this->getTable() . "`.`itemtype` = `glpi_bookmarks_users`.`itemtype`\n                      AND `" . $this->getTable() . "`.`id` = `glpi_bookmarks_users`.`bookmarks_id`)\n                WHERE ";
     if ($is_private) {
         $query .= "(`" . $this->getTable() . "`.`is_private`='1'\n                     AND `" . $this->getTable() . "`.`users_id`='" . getLoginUserID() . "') ";
     } else {
         $query .= "(`" . $this->getTable() . "`.`is_private`='0' " . getEntitiesRestrictRequest("AND", $this->getTable(), "", "", true) . ")";
     }
     $query .= " ORDER BY `itemtype`, `name`";
     if ($result = $DB->query($query)) {
         $rand = mt_rand();
         echo "<form method='post' id='form_load_bookmark{$rand}' action=\"{$target}\">";
         echo "<div class='center' id='tabsbody' >";
         echo "<table class='tab_cadrehov' width='" . self::WIDTH . "px'>";
         echo "<tr>";
         echo "<th class='center' colspan='3'>" . $LANG['buttons'][52] . " " . $LANG['bookmark'][1] . "</th>";
         echo "<th width='20px'>&nbsp;</th>";
         echo "<th>" . $LANG['bookmark'][6] . "</th></tr>";
         if ($DB->numrows($result)) {
             $current_type = -1;
             $current_type_name = NOT_AVAILABLE;
             while ($this->fields = $DB->fetch_assoc($result)) {
                 if ($current_type != $this->fields['itemtype']) {
                     $current_type = $this->fields['itemtype'];
                     $current_type_name = NOT_AVAILABLE;
                     if ($current_type == "States") {
                         $current_type_name = $LANG['state'][0];
                     } else {
                         if (class_exists($current_type)) {
                             $item = new $current_type();
                             $current_type_name = $item->getTypeName();
                         }
                     }
                 }
                 $canedit = $this->can($this->fields["id"], "w");
                 echo "<tr class='tab_bg_1'>";
                 echo "<td width='10px'>";
                 if ($canedit) {
                     $sel = "";
                     if (isset($_GET["select"]) && $_GET["select"] == "all") {
                         $sel = "checked";
                     }
                     echo "<input type='checkbox' name='bookmark[" . $this->fields["id"] . "]'" . $sel . ">";
                 } else {
                     echo "&nbsp;";
                 }
                 echo "</td>";
                 echo "<td>{$current_type_name}</td>";
                 echo "<td><a href=\"" . GLPI_ROOT . "/front/popup.php?popup=load_bookmark&amp;id=" . $this->fields["id"] . "\">" . $this->fields["name"] . "</a></td>";
                 if ($canedit) {
                     echo "<td><a href=\"" . GLPI_ROOT . "/front/popup.php?popup=edit_bookmark&amp;id=" . $this->fields["id"] . "\">\n                            <img src='" . $CFG_GLPI["root_doc"] . "/pics/edit.png' alt='" . $LANG['buttons'][14] . "'></a></td>";
                 } else {
                     echo "<td>&nbsp;</td>";
                 }
                 echo "<td class='center'>";
                 if ($this->fields['type'] == BOOKMARK_SEARCH) {
                     if (is_null($this->fields['IS_DEFAULT'])) {
                         echo "<a href=\"" . GLPI_ROOT . "/front/popup.php?popup=edit_bookmark&amp;\n                            mark_default=1&amp;id=" . $this->fields["id"] . "\">" . $LANG['choice'][0] . "</a>";
                     } else {
                         echo "<a href=\"" . GLPI_ROOT . "/front/popup.php?popup=edit_bookmark&amp;\n                            mark_default=0&amp;id=" . $this->fields["id"] . "\">" . $LANG['choice'][1] . "</a>";
                     }
                 }
                 echo "</td></tr>";
             }
             echo "</table></div>";
             openArrowMassive("form_load_bookmark{$rand}");
             closeArrowMassive('delete_several', $LANG['buttons'][6]);
         } else {
             echo "<tr class='tab_bg_1'><td colspan='5'>" . $LANG['bookmark'][3] . "</td></tr></table>";
         }
         echo '</form>';
     }
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:85,代码来源:bookmark.class.php

示例5: showCentralCount

 /**
  * Get tickets count
  *
  * @param $foruser boolean : only for current login user as requester
  */
 static function showCentralCount($foruser = false)
 {
     global $DB, $CFG_GLPI, $LANG;
     // show a tab with count of jobs in the central and give link
     if (!haveRight("show_all_ticket", "1") && !haveRight("create_ticket", 1)) {
         return false;
     }
     if (!haveRight("show_all_ticket", "1")) {
         $foruser = true;
     }
     $query = "SELECT `status`,\n                       COUNT(*) AS COUNT\n                FROM `glpi_tickets` ";
     if ($foruser) {
         $query .= " LEFT JOIN `glpi_tickets_users`\n                        ON (`glpi_tickets`.`id` = `glpi_tickets_users`.`tickets_id`)";
     }
     $query .= getEntitiesRestrictRequest("WHERE", "glpi_tickets");
     if ($foruser) {
         $query .= " AND `glpi_tickets_users`.`type` = '" . self::REQUESTER . "'\n                     AND `glpi_tickets_users`.`users_id` = '" . getLoginUserID() . "' ";
     }
     $query .= "GROUP BY `status`";
     $result = $DB->query($query);
     $status = array('new' => 0, 'assign' => 0, 'plan' => 0, 'waiting' => 0, 'solved' => 0, 'closed' => 0);
     if ($DB->numrows($result) > 0) {
         while ($data = $DB->fetch_assoc($result)) {
             $status[$data["status"]] = $data["COUNT"];
         }
     }
     $options['field'][0] = 12;
     $options['searchtype'][0] = 'equals';
     $options['contains'][0] = 'process';
     $options['link'][0] = 'AND';
     $options['reset'] = 'reset';
     echo "<table class='tab_cadrehov' >";
     echo "<tr><th colspan='2'>";
     if ($foruser) {
         echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?create_ticket=1\">" . $LANG['profiles'][5] . "&nbsp;<img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_add.png' title=\"" . $LANG['buttons'][8] . "\" alt=\"" . $LANG['buttons'][8] . "\"></a>";
     } else {
         echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . append_params($options, '&amp;') . "\">" . $LANG['title'][10] . "</a></th></tr>";
     }
     echo "</th></tr>";
     echo "<tr><th>" . $LANG['title'][28] . "</th><th>" . $LANG['tracking'][29] . "</th></tr>";
     $options['contains'][0] = 'new';
     echo "<tr class='tab_bg_2'>";
     echo "<td><a href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . append_params($options, '&amp;') . "\">" . $LANG['tracking'][30] . "</a></td>";
     echo "<td>" . $status["new"] . "</td></tr>";
     $options['contains'][0] = 'assign';
     echo "<tr class='tab_bg_2'>";
     echo "<td><a href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . append_params($options, '&amp;') . "\">" . $LANG['tracking'][31] . "</a></td>";
     echo "<td>" . $status["assign"] . "</td></tr>";
     $options['contains'][0] = 'plan';
     echo "<tr class='tab_bg_2'>";
     echo "<td><a href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . append_params($options, '&amp;') . "\">" . $LANG['tracking'][32] . "</a></td>";
     echo "<td>" . $status["plan"] . "</td></tr>";
     $options['contains'][0] = 'waiting';
     echo "<tr class='tab_bg_2'>";
     echo "<td><a href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . append_params($options, '&amp;') . "\">" . $LANG['joblist'][26] . "</a></td>";
     echo "<td>" . $status["waiting"] . "</td></tr>";
     $options['contains'][0] = 'solved';
     echo "<tr class='tab_bg_2'>";
     echo "<td><a href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . append_params($options, '&amp;') . "\">" . $LANG['job'][15] . "</a></td>";
     echo "<td>" . $status["solved"] . "</td></tr>";
     $options['contains'][0] = 'closed';
     echo "<tr class='tab_bg_2'>";
     echo "<td><a href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . append_params($options, '&amp;') . "\">" . $LANG['joblist'][33] . "</a></td>";
     echo "<td>" . $status["closed"] . "</td></tr>";
     echo "</table><br>";
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:71,代码来源:ticket.class.php

示例6: printHelpDesk

/**
 * Print the helpdesk
 *
 * @param $ID int : ID of the user who want to display the Helpdesk
 * @param $from_helpdesk int : is display from the helpdesk.php ?
 *
 * @return nothing (print the helpdesk)
 **/
function printHelpDesk($ID, $from_helpdesk)
{
    global $DB, $CFG_GLPI, $LANG;
    if (!haveRight("create_ticket", "1")) {
        return false;
    }
    if (haveRight('validate_ticket', 1)) {
        $opt = array();
        $opt['reset'] = 'reset';
        $opt['field'][0] = 55;
        // validation status
        $opt['searchtype'][0] = 'equals';
        $opt['contains'][0] = 'waiting';
        $opt['link'][0] = 'AND';
        $opt['field'][1] = 59;
        // validation aprobator
        $opt['searchtype'][1] = 'equals';
        $opt['contains'][1] = getLoginUserID();
        $opt['link'][1] = 'AND';
        $url_validate = $CFG_GLPI["root_doc"] . "/front/ticket.php?" . append_params($opt, '&amp;');
        if (TicketValidation::getNumberTicketsToValidate(getLoginUserID()) > 0) {
            echo "<a href='{$url_validate}' title=\"" . $LANG['validation'][15] . "\"\n                alt=\"" . $LANG['validation'][15] . "\">" . $LANG['validation'][33] . "</a><br><br>";
        }
    }
    $query = "SELECT `email`, `realname`, `firstname`, `name`\n             FROM `glpi_users`\n             WHERE `id` = '{$ID}'";
    $result = $DB->query($query);
    $email = $DB->result($result, 0, "email");
    // Get saved data from a back system
    $use_email_notification = 1;
    if ($email == "") {
        $use_email_notification = 0;
    }
    $itemtype = 0;
    $items_id = "";
    $content = "";
    $title = "";
    $ticketcategories_id = 0;
    $urgency = 3;
    $type = 0;
    if (isset($_SESSION["helpdeskSaved"]['_users_id_requester_notif']) && isset($_SESSION["helpdeskSaved"]['_users_id_requester_notif']['use_notification'])) {
        $use_email_notification = stripslashes($_SESSION["helpdeskSaved"]['_users_id_requester_notif']['use_notification']);
    }
    if (isset($_SESSION["helpdeskSaved"]["email"])) {
        $email = stripslashes($_SESSION["helpdeskSaved"]["user_email"]);
    }
    if (isset($_SESSION["helpdeskSaved"]["itemtype"])) {
        $itemtype = stripslashes($_SESSION["helpdeskSaved"]["itemtype"]);
    }
    if (isset($_SESSION["helpdeskSaved"]["items_id"])) {
        $items_id = stripslashes($_SESSION["helpdeskSaved"]["items_id"]);
    }
    if (isset($_SESSION["helpdeskSaved"]["content"])) {
        $content = cleanPostForTextArea($_SESSION["helpdeskSaved"]["content"]);
    }
    if (isset($_SESSION["helpdeskSaved"]["name"])) {
        $title = stripslashes($_SESSION["helpdeskSaved"]["name"]);
    }
    if (isset($_SESSION["helpdeskSaved"]["ticketcategories_id"])) {
        $ticketcategories_id = stripslashes($_SESSION["helpdeskSaved"]["ticketcategories_id"]);
    }
    if (isset($_SESSION["helpdeskSaved"]["type"])) {
        $type = stripslashes($_SESSION["helpdeskSaved"]["type"]);
    }
    if (isset($_SESSION["helpdeskSaved"]["urgency"])) {
        $urgency = stripslashes($_SESSION["helpdeskSaved"]["urgency"]);
    }
    unset($_SESSION["helpdeskSaved"]);
    echo "<form method='post' name='helpdeskform' action='" . $CFG_GLPI["root_doc"] . "/front/tracking.injector.php' enctype='multipart/form-data'>";
    echo "<input type='hidden' name='_from_helpdesk' value='{$from_helpdesk}'>";
    echo "<input type='hidden' name='requesttypes_id' value='" . RequestType::getDefault('helpdesk') . "'>";
    if ($CFG_GLPI['urgency_mask'] == 1 << 3) {
        // Dont show dropdown if only 1 value enabled
        echo "<input type='hidden' name='urgency' value='3'>";
    }
    echo "<input type='hidden' name='entities_id' value='" . $_SESSION["glpiactive_entity"] . "'>";
    echo "<div class='center'><table class='tab_cadre'>";
    echo "<tr><th colspan='2'>" . $LANG['job'][11] . "&nbsp;:&nbsp;";
    if (isMultiEntitiesMode()) {
        echo "&nbsp;(" . Dropdown::getDropdownName("glpi_entities", $_SESSION["glpiactive_entity"]) . ")";
    }
    echo "</th></tr>";
    if ($CFG_GLPI['urgency_mask'] != 1 << 3) {
        echo "<tr class='tab_bg_1'>";
        echo "<td>" . $LANG['joblist'][29] . "&nbsp;:&nbsp;</td>";
        echo "<td>";
        Ticket::dropdownUrgency("urgency", $urgency);
        echo "</td></tr>";
    }
    if (NotificationTargetTicket::isAuthorMailingActivatedForHelpdesk()) {
        echo "<tr class='tab_bg_1'>";
        echo "<td>" . $LANG['help'][8] . "&nbsp;:&nbsp;</td>";
        echo "<td>";
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:display.function.php

示例7: foreach

 foreach ($_POST['items'] as $reservationitems_id) {
     $_POST['reservationitems_id'] = $reservationitems_id;
     $times = $_POST["periodicity_times"];
     $begin = $_POST["begin"];
     list($begin_year, $begin_month, $begin_day) = explode("-", $_POST["begin"]);
     $end = $_POST["end"];
     $to_add = 1;
     if ($_POST["periodicity"] == "week") {
         $to_add = 7;
     }
     $_POST['_target'] = $_SERVER['PHP_SELF'];
     $_POST['_ok'] = true;
     for ($i = 0; $i < $times && $_POST['_ok']; $i++) {
         $_POST["begin"] = date('Y-m-d H:i:s', strtotime($begin) + $i * $to_add * DAY_TIMESTAMP);
         $_POST["end"] = date('Y-m-d H:i:s', strtotime($end) + $i * $to_add * DAY_TIMESTAMP);
         if (haveRight("reservation_central", "w") || getLoginUserID() === $_POST["users_id"]) {
             unset($rr->fields["id"]);
             $_POST['_ok'] = $rr->add($_POST);
         }
     }
     // Positionnement du calendrier au mois de debut
     $_GET["mois_courant"] = $begin_month;
     $_GET["annee_courant"] = $begin_year;
     if ($_POST['_ok']) {
         Event::log($_POST["reservationitems_id"], "reservation", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][20]);
     } else {
         $all_ok = false;
     }
 }
 if ($all_ok) {
     $toadd = "";
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:reservation.form.php

示例8: define

// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
// Redirect management
if (isset($_GET["redirect"])) {
    manageRedirect($_GET["redirect"]);
}
//*******************
// Affichage Module FAQ
//******************
$name = "";
checkFaqAccess();
if (getLoginUserID()) {
    helpHeader($LANG['Menu'][20], $_SERVER['PHP_SELF'], $_SESSION["glpiname"]);
} else {
    $_SESSION["glpilanguage"] = $CFG_GLPI['language'];
    // Anonymous FAQ
    simpleHeader($LANG['Menu'][20], array($LANG['Menu'][20] => $_SERVER['PHP_SELF']));
}
if (!isset($_GET["contains"])) {
    $_GET["contains"] = "";
}
if (!isset($_GET["knowbaseitemcategories_id"])) {
    $_GET["knowbaseitemcategories_id"] = 0;
}
if (isset($_GET["id"])) {
    $kb = new KnowbaseItem();
    if ($kb->getFromDB($_GET["id"])) {
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:helpdesk.faq.php

示例9: showFormPerso

 /**
  * Print the search config form
  *
  * @param $target form target
  * @param $itemtype item type
  *
  * @return nothing
  **/
 function showFormPerso($target, $itemtype)
 {
     global $CFG_GLPI, $LANG, $DB;
     $searchopt = Search::getCleanedOptions($itemtype);
     if (!is_array($searchopt)) {
         return false;
     }
     $item = NULL;
     if ($itemtype != 'States' && class_exists($itemtype)) {
         $item = new $itemtype();
     }
     $IDuser = getLoginUserID();
     echo "<div class='center' id='tabsbody' >";
     // Defined items
     $query = "SELECT *\n                FROM `" . $this->getTable() . "`\n                WHERE `itemtype` = '{$itemtype}'\n                      AND `users_id` = '{$IDuser}'\n                ORDER BY `rank`";
     $result = $DB->query($query);
     $numrows = 0;
     $numrows = $DB->numrows($result);
     if ($numrows == 0) {
         checkRight("search_config", "w");
         echo "<table class='tab_cadre_fixe'><tr><th colspan='4'>";
         echo "<form method='post' action='{$target}'>";
         echo "<input type='hidden' name='itemtype' value='{$itemtype}'>";
         echo "<input type='hidden' name='users_id' value='{$IDuser}'>";
         echo $LANG['setup'][241] . "<span class='small_space'>";
         echo "<input type='submit' name='activate' value=\"" . $LANG['buttons'][2] . "\" class='submit'>";
         echo "</span></form></th></tr></table>\n";
     } else {
         $already_added = self::getForTypeUser($itemtype, $IDuser);
         echo "<table class='tab_cadre_fixe'><tr><th colspan='4'>";
         echo $LANG['setup'][252] . "&nbsp;: </th></tr>";
         echo "<tr class='tab_bg_1'><td colspan='4' class='center'>";
         echo "<form method='post' action=\"{$target}\">";
         echo "<input type='hidden' name='itemtype' value='{$itemtype}'>";
         echo "<input type='hidden' name='users_id' value='{$IDuser}'>";
         echo "<select name='num'>";
         $first_group = true;
         foreach ($searchopt as $key => $val) {
             if (!is_array($val)) {
                 if (!$first_group) {
                     echo "</optgroup>\n";
                 } else {
                     $first_group = false;
                 }
                 echo "<optgroup label=\"{$val}\">";
             } else {
                 if ($key != 1 && !in_array($key, $already_added)) {
                     echo "<option value='{$key}'>" . $val["name"] . "</option>\n";
                 }
             }
         }
         if (!$first_group) {
             echo "</optgroup>\n";
         }
         echo "</select><span class='small_space'>";
         echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
         echo "</span></form>";
         echo "</td></tr>\n";
         // print first element
         echo "<tr class='tab_bg_2'>";
         echo "<td class='center' width='50%'>" . $searchopt[1]["name"] . "</td>";
         echo "<td colspan='3'>&nbsp;</td>";
         echo "</tr>";
         // print entity
         if (isMultiEntitiesMode() && (isset($CFG_GLPI["union_search_type"][$itemtype]) || $item && $item->maybeRecursive() || count($_SESSION["glpiactiveentities"]) > 1) && isset($searchopt[80])) {
             echo "<tr class='tab_bg_2'>";
             echo "<td class='center' width='50%'>" . $searchopt[80]["name"] . "</td>";
             echo "<td colspan='3'>&nbsp;</td>";
             echo "</tr>";
         }
         $i = 0;
         if ($numrows) {
             while ($data = $DB->fetch_array($result)) {
                 if ($data["num"] != 1 && isset($searchopt[$data["num"]])) {
                     echo "<tr class='tab_bg_2'>";
                     echo "<td class='center' width='50%' >";
                     echo $searchopt[$data["num"]]["name"] . "</td>";
                     if ($i != 0) {
                         echo "<td class='center middle'>";
                         echo "<form method='post' action='{$target}'>";
                         echo "<input type='hidden' name='id' value='" . $data["id"] . "'>";
                         echo "<input type='hidden' name='users_id' value='{$IDuser}'>";
                         echo "<input type='hidden' name='itemtype' value='{$itemtype}'>";
                         echo "<input type='image' name='up' value=\"" . $LANG['buttons'][24] . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/puce-up2.png' alt=\"" . $LANG['buttons'][24] . "\" title=\"" . $LANG['buttons'][24] . "\">";
                         echo "</form></td>\n";
                     } else {
                         echo "<td>&nbsp;</td>";
                     }
                     if ($i != $numrows - 1) {
                         echo "<td class='center middle'>";
                         echo "<form method='post' action='{$target}'>";
                         echo "<input type='hidden' name='id' value='" . $data["id"] . "'>";
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:displaypreference.class.php

示例10: showSummary

 /**
  * Show the current tickettask sumnary
  **/
 function showSummary($ticket)
 {
     global $DB, $LANG, $CFG_GLPI;
     if (!haveRight("observe_ticket", "1") && !haveRight("show_full_ticket", "1")) {
         return false;
     }
     $tID = $ticket->fields['id'];
     // Display existing Followups
     $showprivate = haveRight("show_full_ticket", "1");
     $caneditall = haveRight("update_tasks", "1");
     $tmp = array('tickets_id' => $tID);
     $canadd = $this->can(-1, 'w', $tmp);
     $RESTRICT = "";
     if (!$showprivate) {
         $RESTRICT = " AND (`is_private` = '0'\n                            OR `users_id` ='" . getLoginUserID() . "') ";
     }
     $query = "SELECT `id`, `date`\n                FROM `glpi_tickettasks`\n                 WHERE `tickets_id` = '{$tID}'\n                        {$RESTRICT}\n                ORDER BY `date` DESC";
     $result = $DB->query($query);
     $rand = mt_rand();
     if ($caneditall || $canadd) {
         echo "<div id='viewfollowup" . $tID . "{$rand}'></div>\n";
     }
     if ($canadd) {
         echo "<script type='text/javascript' >\n";
         echo "function viewAddFollowup" . $ticket->fields['id'] . "{$rand}() {\n";
         $params = array('type' => __CLASS__, 'tickets_id' => $ticket->fields['id'], 'id' => -1);
         ajaxUpdateItemJsCode("viewfollowup" . $ticket->fields['id'] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewfollowup.php", $params, false);
         echo "};";
         echo "</script>\n";
         if ($ticket->fields["status"] != 'solved' && $ticket->fields["status"] != 'closed') {
             echo "<div class='center'>" . "<a href='javascript:viewAddFollowup" . $ticket->fields['id'] . "{$rand}();'>";
             echo $LANG['job'][30] . "</a></div></p><br>\n";
         }
     }
     //echo "<h3>" . $LANG['job'][37] . "</h3>";
     if ($DB->numrows($result) == 0) {
         echo "<table class='tab_cadre_fixe'><tr class='tab_bg_2'><th class='b'>" . $LANG['job'][50];
         echo "</th></tr></table>";
     } else {
         echo "<table class='tab_cadre_fixehov'>";
         echo "<tr><th>" . $LANG['common'][17] . "</th><th>" . $LANG['common'][27] . "</th>";
         echo "<th>" . $LANG['joblist'][6] . "</th><th>" . $LANG['job'][31] . "</th>";
         echo "<th>" . $LANG['common'][37] . "</th>";
         if ($showprivate) {
             echo "<th>" . $LANG['common'][77] . "</th>";
         }
         echo "<th>" . $LANG['job'][35] . "</th></tr>\n";
         while ($data = $DB->fetch_array($result)) {
             if ($this->getFromDB($data['id'])) {
                 $this->showInTicketSumnary($ticket, $rand, $showprivate);
             }
         }
         echo "</table>";
     }
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:58,代码来源:tickettask.class.php

示例11: logInFile

/**
 * Log a message in log file
 *
 * @param $name string: name of the log file
 * @param $text string: text to log
 * @param $force boolean: force log in file not seeing use_log_in_files config
**/
function logInFile($name, $text, $force = false)
{
    global $CFG_GLPI;
    $user = '';
    if (function_exists('getLoginUserID')) {
        $user = " [" . getLoginUserID() . '@' . php_uname('n') . "]";
    }
    if (isset($CFG_GLPI["use_log_in_files"]) && $CFG_GLPI["use_log_in_files"] || $force) {
        error_log(convDateTime(date("Y-m-d H:i:s")) . "{$user}\n" . $text, 3, GLPI_LOG_DIR . "/" . $name . ".log");
    }
}
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:18,代码来源:common.function.php

示例12: Copyright

  FusionInventory 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 Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with FusionInventory. If not, see <http://www.gnu.org/licenses/>.

  ------------------------------------------------------------------------

  @package   FusionInventory
  @author    Kevin Roy
  @co-author
  @copyright Copyright (c) 2010-2014 FusionInventory team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      http://www.fusioninventory.org/
  @link      http://forge.fusioninventory.org/projects/fusioninventory-for-glpi/
  @since     2010

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
$loggedin = array();
$loggedin['result'] = 1;
if (!isset($_SESSION["glpiname"])) {
    if (!getLoginUserID()) {
        $loggedin['result'] = 0;
    }
}
echo json_encode($loggedin);
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:31,代码来源:deployuser.logged.in.php

示例13: showDebug

 /**
  * Display debug information for reservation of current object
  **/
 function showDebug()
 {
     $resa = new Reservation();
     $resa->fields['id'] = '1';
     $resa->fields['reservationitems_id'] = $this->getField('id');
     $resa->fields['begin'] = $_SESSION['glpi_currenttime'];
     $resa->fields['end'] = $_SESSION['glpi_currenttime'];
     $resa->fields['users_id'] = getLoginUserID();
     $resa->fields['comment'] = '';
     NotificationEvent::debugEvent($resa);
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:14,代码来源:reservationitem.class.php

示例14: showGraph

 /** Get groups assigned to tickets between 2 dates
  *
  * @param $entrees array : array containing data to displayed
  * @param $options array : options
  *     - title string title displayed (default empty)
  *     - showtotal boolean show total in title (default false)
  *     - width integer width of the graph (default 700)
  *     - height integer height of the graph (default 300)
  *     - unit integer height of the graph (default empty)
  *     - type integer height of the graph (default line) : line bar pie
  *     - csv boolean export to CSV (default true)
  *     - datatype string datatype (count or average / default is count)
  *
  * @return array contains the distinct groups assigned to a tickets
  **/
 static function showGraph($entrees, $options = array())
 {
     global $CFG_GLPI, $LANG;
     if ($uid = getLoginUserID(false)) {
         if (!isset($_SESSION['glpigraphtype'])) {
             $_SESSION['glpigraphtype'] = $CFG_GLPI['default_graphtype'];
         }
         $param['showtotal'] = false;
         $param['title'] = '';
         $param['width'] = 900;
         $param['height'] = 300;
         $param['unit'] = '';
         $param['type'] = 'line';
         $param['csv'] = true;
         $param['datatype'] = 'count';
         if (is_array($options) && count($options)) {
             foreach ($options as $key => $val) {
                 $param[$key] = $val;
             }
         }
         // Clean data
         if (is_array($entrees) && count($entrees)) {
             foreach ($entrees as $key => $val) {
                 if (!is_array($val) || count($val) == 0) {
                     unset($entrees[$key]);
                 }
             }
         }
         if (!is_array($entrees) || count($entrees) == 0) {
             if (!empty($param['title'])) {
                 echo "<div class='center'>" . $param['title'] . " : " . $LANG['stats'][2] . "</div>";
             }
             return false;
         }
         echo "<div class='center-h' style='width:" . $param['width'] . "px'>";
         echo "<div>";
         switch ($param['type']) {
             case 'pie':
                 // Check datas : sum must be > 0
                 reset($entrees);
                 $sum = array_sum(current($entrees));
                 while ($sum == 0 && ($data = next($entrees))) {
                     $sum += array_sum($data);
                 }
                 if ($sum == 0) {
                     return false;
                 }
                 $graph = new ezcGraphPieChart();
                 $graph->palette = new GraphPalette();
                 $graph->options->font->maxFontSize = 15;
                 $graph->title->background = '#EEEEEC';
                 $graph->renderer = new ezcGraphRenderer3d();
                 $graph->renderer->options->pieChartHeight = 20;
                 $graph->renderer->options->moveOut = 0.2;
                 $graph->renderer->options->pieChartOffset = 63;
                 $graph->renderer->options->pieChartGleam = 0.3;
                 $graph->renderer->options->pieChartGleamColor = '#FFFFFF';
                 $graph->renderer->options->pieChartGleamBorder = 2;
                 $graph->renderer->options->pieChartShadowSize = 5;
                 $graph->renderer->options->pieChartShadowColor = '#BABDB6';
                 if (count($entrees) == 1) {
                     $graph->legend = false;
                 }
                 break;
             case 'bar':
                 $graph = new ezcGraphBarChart();
                 $graph->options->fillLines = 210;
                 $graph->xAxis->axisLabelRenderer = new ezcGraphAxisRotatedBoxedLabelRenderer();
                 $graph->xAxis->axisLabelRenderer->angle = 45;
                 $graph->xAxis->axisSpace = 0.2;
                 $graph->yAxis->min = 0;
                 $graph->palette = new GraphPalette();
                 $graph->options->font->maxFontSize = 15;
                 $graph->title->background = '#EEEEEC';
                 $graph->renderer = new ezcGraphRenderer3d();
                 $graph->renderer->options->legendSymbolGleam = 0.5;
                 $graph->renderer->options->barChartGleam = 0.5;
                 $max = 0;
                 foreach ($entrees as $key => $val) {
                     if (count($val) > $max) {
                         $max = count($val);
                     }
                 }
                 $graph->xAxis->labelCount = $max;
                 break;
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:stat.class.php

示例15: array

 /**
  * Get the SEARCH_OPTION array
  *
  * @param $itemtype
  * @param $withplugins boolean get search options from plugins
  *
  * @return the reference to  array of search options for the given item type
  **/
 static function &getOptions($itemtype, $withplugins = true)
 {
     global $LANG, $CFG_GLPI;
     static $search = array();
     if (!isset($search[$itemtype])) {
         // standard type first
         if ($itemtype == 'States') {
             $search[$itemtype]['common'] = $LANG['common'][32];
             $search['States'][1]['table'] = 'state_types';
             $search['States'][1]['field'] = 'name';
             $search['States'][1]['name'] = $LANG['common'][16];
             $search['States'][1]['datatype'] = 'itemlink';
             $search['States'][1]['searchtype'] = 'contains';
             $search['States'][2]['table'] = 'state_types';
             $search['States'][2]['field'] = 'id';
             $search['States'][2]['name'] = $LANG['common'][2];
             $search['States'][2]['searchtype'] = 'contains';
             $search['States'][31]['table'] = 'glpi_states';
             $search['States'][31]['field'] = 'name';
             $search['States'][31]['name'] = $LANG['state'][0];
             $search['States'] += Location::getSearchOptionsToAdd();
             $search['States'][5]['table'] = 'state_types';
             $search['States'][5]['field'] = 'serial';
             $search['States'][5]['name'] = $LANG['common'][19];
             $search['States'][6]['table'] = 'state_types';
             $search['States'][6]['field'] = 'otherserial';
             $search['States'][6]['name'] = $LANG['common'][20];
             $search['States'][16]['table'] = 'state_types';
             $search['States'][16]['field'] = 'comment';
             $search['States'][16]['name'] = $LANG['common'][25];
             $search['States'][16]['datatype'] = 'text';
             $search['States'][70]['table'] = 'glpi_users';
             $search['States'][70]['field'] = 'name';
             $search['States'][70]['name'] = $LANG['common'][34];
             $search['States'][71]['table'] = 'glpi_groups';
             $search['States'][71]['field'] = 'name';
             $search['States'][71]['name'] = $LANG['common'][35];
             $search['States'][19]['table'] = 'state_types';
             $search['States'][19]['field'] = 'date_mod';
             $search['States'][19]['name'] = $LANG['common'][26];
             $search['States'][19]['datatype'] = 'datetime';
             $search['States'][19]['massiveaction'] = false;
             $search['States'][23]['table'] = 'glpi_manufacturers';
             $search['States'][23]['field'] = 'name';
             $search['States'][23]['name'] = $LANG['common'][5];
             $search['States'][24]['table'] = 'glpi_users';
             $search['States'][24]['field'] = 'name';
             $search['States'][24]['name'] = $LANG['common'][10];
             $search['States'][80]['table'] = 'glpi_entities';
             $search['States'][80]['field'] = 'completename';
             $search['States'][80]['name'] = $LANG['entity'][0];
         } else {
             if (class_exists($itemtype)) {
                 $item = new $itemtype();
                 $search[$itemtype] = $item->getSearchOptions();
             }
         }
         if (getLoginUserID() && in_array($itemtype, $CFG_GLPI["ticket_types"])) {
             $search[$itemtype]['tracking'] = $LANG['title'][24];
             $search[$itemtype][60]['table'] = 'glpi_tickets';
             $search[$itemtype][60]['linkfield'] = 'items_id';
             $search[$itemtype][60]['field'] = 'count';
             $search[$itemtype][60]['name'] = $LANG['stats'][13];
             $search[$itemtype][60]['forcegroupby'] = true;
             $search[$itemtype][60]['usehaving'] = true;
             $search[$itemtype][60]['datatype'] = 'number';
             $search[$itemtype][60]['massiveaction'] = false;
             $search[$itemtype][60]['joinparams'] = array('jointype' => "itemtype_item", 'condition' => getEntitiesRestrictRequest('AND', 'NEWTABLE'));
         }
         if (in_array($itemtype, $CFG_GLPI["networkport_types"])) {
             $search[$itemtype] += NetworkPort::getSearchOptionsToAdd($itemtype);
         }
         if (in_array($itemtype, $CFG_GLPI["contract_types"])) {
             $search[$itemtype] += Contract::getSearchOptionsToAdd();
         }
         if (in_array($itemtype, $CFG_GLPI["infocom_types"])) {
             $search[$itemtype] += Infocom::getSearchOptionsToAdd($itemtype);
         }
         if ($withplugins) {
             // Search options added by plugins
             $plugsearch = getPluginSearchOptions($itemtype);
             if (count($plugsearch)) {
                 $search[$itemtype] += array('plugins' => $LANG['common'][29]);
                 $search[$itemtype] += $plugsearch;
             }
         }
         // Complete linkfield if not define
         if ($itemtype === 'States') {
             $itemtable = 'states_types';
         } else {
             $itemtable = $item->getTable();
         }
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:search.class.php


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