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


PHP Link::check方法代码示例

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


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

示例1: showForItem

 /**
  * Print the HTML array for device on link
  *
  * Print the HTML array for device on link for link $instID
  *
  *@param $links_id array : Link identifier.
  *
  *@return Nothing (display)
  *
  **/
 static function showForItem($links_id)
 {
     global $DB, $CFG_GLPI, $LANG;
     $link = new Link();
     if ($links_id > 0) {
         $link->check($links_id, 'r');
     } else {
         // Create item
         $link->check(-1, 'w');
         $link->getEmpty();
     }
     $canedit = $link->can($links_id, 'w');
     $canrecu = $link->can($links_id, 'recursive');
     if (!haveRight("link", "r")) {
         return false;
     }
     //$canedit= haveRight("link","w");
     $query = "SELECT *\n                FROM `glpi_links_itemtypes`\n                WHERE `links_id`='{$links_id}'\n                ORDER BY `itemtype`";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $i = 0;
     $used = array();
     echo "<form method='post' action=\"" . $CFG_GLPI["root_doc"] . "/front/link_itemtype.form.php\">";
     echo "<div class='center'><table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2'>" . $LANG['links'][4] . "&nbsp;:</th></tr>";
     echo "<tr><th>" . $LANG['common'][17] . "</th>";
     echo "<th>&nbsp;</th></tr>";
     while ($i < $number) {
         $ID = $DB->result($result, $i, "id");
         $itemtype = $DB->result($result, $i, "itemtype");
         $typename = NOT_AVAILABLE;
         if (class_exists($itemtype)) {
             $item = new $itemtype();
             $typename = $item->getTypeName();
         }
         echo "<tr class='tab_bg_1'>";
         echo "<td class='center'>{$typename}</td>";
         echo "<td class='center'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/link_itemtype.form.php?delete=deletedevice&amp;id={$ID}&amp;links_id={$links_id}'>\n               <strong>" . $LANG['buttons'][6] . "</strong></a></td></tr>";
         $used[$itemtype] = $itemtype;
         $i++;
     }
     if ($canedit) {
         echo "<tr class='tab_bg_1'><td>&nbsp;</td><td class='center'>";
         echo "<input type='hidden' name='links_id' value='{$links_id}'>";
         Dropdown::dropdownTypes("itemtype", '', $CFG_GLPI["link_types"], $used);
         echo "&nbsp;&nbsp;<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
         echo "</td></tr>";
     }
     echo "</table></div></form>";
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:61,代码来源:link_itemtype.class.php

示例2: addLink

 /**
  * Add a single link to the links collection
  *
  * @param   string   $rel        The relation of the link to the document. See RFC 5988
  *                               http://tools.ietf.org/html/rfc5988#section-6.2.2 A document
  *                               MUST always have a "self" link.
  * @param   Link     $link       The actual link object
  * @param   boolean  $overwrite  When false and a link of $rel relation exists, an array of
  *                               links is created. Otherwise the existing link is overwriten
  *                               with the new one
  *
  * @return  boolean  True if the link was added to the collection
  */
 public function addLink($rel, Link $link, $overwrite = true)
 {
     if (!$link->check()) {
         return false;
     }
     if (!array_key_exists($rel, $this->_links) || $overwrite) {
         $this->_links[$rel] = $link;
     } else {
         if (!is_array($this->_links[$rel])) {
             $this->_links[$rel] = array($this->_links[$rel]);
         }
         $this->_links[$rel][] = $link;
     }
 }
开发者ID:Joal01,项目名称:fof,代码行数:27,代码来源:Links.php

示例3: Link

You should have received a copy of the GNU General Public License
along with GLPI; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file: Julien Dombre
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
if (empty($_GET["id"])) {
    $_GET["id"] = "";
}
$link = new Link();
$link_itemtype = new Link_ItemType();
if (isset($_POST["add"])) {
    $link->check($_GET["id"], 'w');
    if ($link_itemtype->add($_POST)) {
        Event::log($_POST["links_id"], "links", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][32]);
    }
    glpi_header($CFG_GLPI["root_doc"] . "/front/link.form.php?id=" . $_POST["links_id"]);
} else {
    if (isset($_GET["delete"])) {
        $link->check($_GET["links_id"], 'w');
        $link_itemtype->delete($_GET);
        Event::log($_GET["links_id"], "links", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][33]);
        glpi_header($_SERVER['HTTP_REFERER']);
    }
}
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:30,代码来源:link_itemtype.form.php

示例4: Link

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
*/
include '../inc/includes.php';
Session::checkCentralAccess();
$link = new Link();
$link_itemtype = new Link_ItemType();
if (isset($_POST["add"])) {
    $link->check(-1, CREATE, $_POST);
    if ($link_itemtype->add($_POST)) {
        Event::log($_POST["links_id"], "links", 4, "setup", sprintf(__('%s adds a link with an item'), $_SESSION["glpiname"]));
    }
    Html::redirect($CFG_GLPI["root_doc"] . "/front/link.form.php?id=" . $_POST["links_id"]);
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:30,代码来源:link_itemtype.form.php

示例5: Link

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
*/
include '../inc/includes.php';
Session::checkRight("link", READ);
if (empty($_GET["id"])) {
    $_GET["id"] = "";
}
$link = new Link();
if (isset($_POST["add"])) {
    $link->check(-1, CREATE);
    $newID = $link->add($_POST);
    Event::log($newID, "links", 4, "setup", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
    Html::redirect(Toolbox::getItemTypeFormURL('Link') . "?id=" . $newID);
} else {
    if (isset($_POST["purge"])) {
        $link->check($_POST["id"], PURGE);
        $link->delete($_POST, 1);
        Event::log($_POST["id"], "links", 4, "setup", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
        $link->redirectToList();
    } else {
        if (isset($_POST["update"])) {
            $link->check($_POST["id"], UPDATE);
            $link->update($_POST);
            Event::log($_POST["id"], "links", 4, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
            Html::back();
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:30,代码来源:link.form.php

示例6: Link

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
*/
include '../inc/includes.php';
Session::checkRight("link", "r");
if (empty($_GET["id"])) {
    $_GET["id"] = "";
}
$link = new Link();
if (isset($_POST["add"])) {
    $link->check(-1, 'w');
    $newID = $link->add($_POST);
    Event::log($newID, "links", 4, "setup", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
    Html::redirect(Toolbox::getItemTypeFormURL('Link') . "?id=" . $newID);
} else {
    if (isset($_POST["delete"])) {
        $link->check($_POST["id"], 'd');
        $link->delete($_POST);
        Event::log($_POST["id"], "links", 4, "setup", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
        $link->redirectToList();
    } else {
        if (isset($_POST["update"])) {
            $link->check($_POST["id"], 'w');
            $link->update($_POST);
            Event::log($_POST["id"], "links", 4, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
            Html::back();
开发者ID:geldarr,项目名称:hack-space,代码行数:30,代码来源:link.form.php

示例7: Link

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
*/
include '../inc/includes.php';
Session::checkCentralAccess();
$link = new Link();
$link_itemtype = new Link_ItemType();
if (isset($_POST["add"])) {
    $link->check(-1, 'w', $_POST);
    if ($link_itemtype->add($_POST)) {
        Event::log($_POST["links_id"], "links", 4, "setup", sprintf(__('%s adds a link with an item'), $_SESSION["glpiname"]));
    }
    Html::redirect($CFG_GLPI["root_doc"] . "/front/link.form.php?id=" . $_POST["links_id"]);
}
开发者ID:geldarr,项目名称:hack-space,代码行数:30,代码来源:link_itemtype.form.php

示例8: Link

along with GLPI; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file: Julien Dombre
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
if (empty($_GET["id"])) {
    $_GET["id"] = "";
}
$link = new Link();
if (isset($_POST["add"])) {
    $link->check(-1, 'w');
    $newID = $link->add($_POST);
    Event::log($newID, "links", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][20] . " " . $_POST["name"] . ".");
    glpi_header(getItemTypeFormURL('Link') . "?id=" . $newID);
} else {
    if (isset($_POST["delete"])) {
        $link->check($_GET["id"], 'w');
        $link->delete($_POST);
        Event::log($_GET["id"], "links", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][22]);
        $link->redirectToList();
    } else {
        if (isset($_POST["update"])) {
            $link->check($_GET["id"], 'w');
            $link->update($_POST);
            Event::log($_GET["id"], "links", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
            glpi_header($_SERVER['HTTP_REFERER']);
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:link.form.php


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