本文整理汇总了PHP中Toolbox::strpos方法的典型用法代码示例。如果您正苦于以下问题:PHP Toolbox::strpos方法的具体用法?PHP Toolbox::strpos怎么用?PHP Toolbox::strpos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toolbox
的用法示例。
在下文中一共展示了Toolbox::strpos方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reconstrucTimeline
function reconstrucTimeline()
{
global $DB;
$query = "TRUNCATE `" . $this->getTable() . "`";
$DB->query($query);
$query = "SELECT id\n FROM `glpi_tickets`";
$result = $DB->query($query);
while ($data = $DB->fetch_array($result)) {
$queryGroup = "SELECT * FROM `glpi_logs`";
$queryGroup .= " WHERE `itemtype_link` = 'Group'";
$queryGroup .= " AND `items_id` = " . $data['id'];
$queryGroup .= " AND `itemtype` = 'Ticket'";
$queryGroup .= " ORDER BY date_mod ASC";
$resultGroup = $DB->query($queryGroup);
if ($resultGroup) {
while ($dataGroup = $DB->fetch_array($resultGroup)) {
if ($dataGroup['new_value'] != null) {
$start = Toolbox::strpos($dataGroup['new_value'], "(");
$end = Toolbox::strpos($dataGroup['new_value'], ")");
$length = $end - $start;
$groups_id = Toolbox::substr($dataGroup['new_value'], $start + 1, $length - 1);
$group = new Group();
if ($group->getFromDB($groups_id)) {
if ($group->fields['is_requester'] == 0 && $group->fields['is_assign'] == 1) {
$ticket = new Ticket();
$ticket->getFromDB($data['id']);
$this->createGroup($ticket, $dataGroup['date_mod'], $groups_id, 'new');
}
}
} else {
if ($dataGroup['old_value'] != null) {
$start = Toolbox::strpos($dataGroup['old_value'], "(");
$end = Toolbox::strpos($dataGroup['old_value'], ")");
$length = $end - $start;
$groups_id = Toolbox::substr($dataGroup['old_value'], $start + 1, $length - 1);
$group = new Group();
if ($group->getFromDB($groups_id)) {
if ($group->fields['is_requester'] == 0 && $group->fields['is_assign'] == 1) {
$ticket = new Ticket();
$ticket->getFromDB($data['id']);
$this->createGroup($ticket, $dataGroup['date_mod'], $groups_id, 'delete');
}
}
}
}
}
}
}
}
示例2: printPager
/**
* Print pager for search option (first/previous/next/last)
*
* @param $start from witch item we start
* @param $numrows total items
* @param $target page would be open when click on the option (last,previous etc)
* @param $parameters parameters would be passed on the URL.
* @param $item_type_output item type display - if >0 display export PDF et Sylk form
* (default 0)
* @param $item_type_output_param item type parameter for export (default 0)
* @param $additional_info Additional information to display (default '')
*
* @return nothing (print a pager)
*
**/
static function printPager($start, $numrows, $target, $parameters, $item_type_output = 0, $item_type_output_param = 0, $additional_info = '')
{
global $CFG_GLPI;
$list_limit = $_SESSION['glpilist_limit'];
// Forward is the next step forward
$forward = $start + $list_limit;
// This is the end, my friend
$end = $numrows - $list_limit;
// Human readable count starts here
$current_start = $start + 1;
// And the human is viewing from start to end
$current_end = $current_start + $list_limit - 1;
if ($current_end > $numrows) {
$current_end = $numrows;
}
// Empty case
if ($current_end == 0) {
$current_start = 0;
}
// Backward browsing
if ($current_start - $list_limit <= 0) {
$back = 0;
} else {
$back = $start - $list_limit;
}
// Print it
echo "<div><table class='tab_cadre_pager'>";
echo "<tr>";
if (strpos($target, '?') == false) {
$fulltarget = $target . "?" . $parameters;
} else {
$fulltarget = $target . "&" . $parameters;
}
// Back and fast backward button
if (!$start == 0) {
echo "<th class='left'>";
echo "<a href='{$fulltarget}&start=0'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/first.png' alt=\"" . __s('Start') . "\" title=\"" . __s('Start') . "\" class='pointer'>";
echo "</a></th>";
echo "<th class='left'>";
echo "<a href='{$fulltarget}&start={$back}'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/left.png' alt=\"" . __s('Previous') . "\" title=\"" . __s('Previous') . "\" class='pointer'>";
echo "</a></th>";
}
// Print the "where am I?"
echo "<td width='31%' class='tab_bg_2'>";
self::printPagerForm("{$fulltarget}&start={$start}");
echo "</td>";
if (!empty($additional_info)) {
echo "<td class='tab_bg_2'>";
echo $additional_info;
echo "</td>";
}
if (!empty($item_type_output) && isset($_SESSION["glpiactiveprofile"]) && $_SESSION["glpiactiveprofile"]["interface"] == "central") {
echo "<td class='tab_bg_2 responsive_hidden' width='30%'>";
echo "<form method='GET' action='" . $CFG_GLPI["root_doc"] . "/front/report.dynamic.php'\n target='_blank'>";
echo Html::hidden('item_type', array('value' => $item_type_output));
if ($item_type_output_param != 0) {
echo Html::hidden('item_type_param', array('value' => Toolbox::prepareArrayForInput($item_type_output_param)));
}
$split = explode("&", $parameters);
for ($i = 0; $i < count($split); $i++) {
$pos = Toolbox::strpos($split[$i], '=');
$length = Toolbox::strlen($split[$i]);
echo Html::hidden(Toolbox::substr($split[$i], 0, $pos), array('value' => urldecode(Toolbox::substr($split[$i], $pos + 1))));
}
Dropdown::showOutputFormat();
Html::closeForm();
echo "</td>";
}
echo "<td width='20%' class='tab_bg_2 b'>";
//TRANS: %1$d, %2$d, %3$d are page numbers
printf(__('From %1$d to %2$d on %3$d'), $current_start, $current_end, $numrows);
echo "</td>\n";
// Forward and fast forward button
if ($forward < $numrows) {
echo "<th class='right'>";
echo "<a href='{$fulltarget}&start={$forward}'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/right.png' alt=\"" . __s('Next') . "\" title=\"" . __s('Next') . "\" class='pointer'>";
echo "</a></th>\n";
echo "<th class='right'>";
echo "<a href='{$fulltarget}&start={$end}'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/last.png' alt=\"" . __s('End') . "\" title=\"" . __s('End') . "\" class='pointer'>";
echo "</a></th>\n";
}
//.........这里部分代码省略.........
示例3: printPager
/**
* Print pager for search option (first/previous/next/last)
*
* @param $start from witch item we start
* @param $numrows total items
* @param $target page would be open when click on the option (last,previous etc)
* @param $parameters parameters would be passed on the URL.
* @param $item_type_output item type display - if >0 display export PDF et Sylk form
* (default 0)
* @param $item_type_output_param item type parameter for export (default 0)
* @param $additional_info Additional information to display (default '')
*
* @return nothing (print a pager)
*
* */
function printPager($start, $numrows, $target, $parameters, $item_type_output = 0, $item_type_output_param = 0, $additional_info = '')
{
global $CFG_GLPI;
$list_limit = $_SESSION['glpilist_limit'];
// Forward is the next step forward
$forward = $start + $list_limit;
// This is the end, my friend
$end = $numrows - $list_limit;
// Human readable count starts here
$current_start = $start + 1;
// And the human is viewing from start to end
$current_end = $current_start + $list_limit - 1;
if ($current_end > $numrows) {
$current_end = $numrows;
}
// Empty case
if ($current_end == 0) {
$current_start = 0;
}
// Backward browsing
if ($current_start - $list_limit <= 0) {
$back = 0;
} else {
$back = $start - $list_limit;
}
// Print it
echo "<div><table class='tab_cadre_pager'>";
echo "<tr>";
// Back and fast backward button
if (!$start == 0) {
echo "<th class='left'>";
echo "<a href='{$target}?{$parameters}&start=0'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/first.png' alt=\"" . __s('Start') . "\" title=\"" . __s('Start') . "\">";
echo "</a></th>";
echo "<th class='left'>";
echo "<a href='{$target}?{$parameters}&start={$back}'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/left.png' alt=\"" . __s('Previous') . "\" title=\"" . __s('Previous') . "\">";
echo "</a></th>";
}
// Print the "where am I?"
echo "<td width='50%' class='tab_bg_2'>";
Html::printPagerForm("{$target}?{$parameters}&start={$start}");
echo "</td>";
if (!empty($additional_info)) {
echo "<td class='tab_bg_2'>";
echo $additional_info;
echo "</td>";
}
if (!empty($item_type_output) && isset($_SESSION["glpiactiveprofile"]) && $_SESSION["glpiactiveprofile"]["interface"] == "central") {
echo "<td class='tab_bg_2' width='30%'>";
echo "<form method='GET' action='" . $target . "' target='_blank'>";
echo Html::hidden('item_type', array('value' => $item_type_output));
if ($item_type_output_param != 0) {
echo Html::hidden('item_type_param', array('value' => Toolbox::prepareArrayForInput($item_type_output_param)));
}
$split = explode("&", $parameters);
for ($i = 0; $i < count($split); $i++) {
$pos = Toolbox::strpos($split[$i], '=');
$length = Toolbox::strlen($split[$i]);
echo Html::hidden(Toolbox::substr($split[$i], 0, $pos), array('value' => urldecode(Toolbox::substr($split[$i], $pos + 1))));
}
Dropdown::showOutputFormat();
$this->showCSVOptions();
echo "<script type='text/javascript'>";
echo "\$('select[name=display_type]').change(function() {\r\n switch(\$(this).val()){\r\n case '3' :case '-3' :\r\n \$('#display_csv_preferences').css('display', 'block');\r\n break;\r\n default : \r\n \$('#display_csv_preferences').css('display', 'none');\r\n break;\r\n }\r\n });";
echo "</script>";
Html::closeForm();
echo "</td>";
}
echo "<td width='50%' class='tab_bg_2 b'>";
//TRANS: %1$d, %2$d, %3$d are page numbers
printf(__('From %1$d to %2$d on %3$d'), $current_start, $current_end, $numrows);
echo "</td>\n";
// Forward and fast forward button
if ($forward < $numrows) {
echo "<th class='right'>";
echo "<a href='{$target}?{$parameters}&start={$forward}'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/right.png' alt=\"" . __s('Next') . "\" title=\"" . __s('Next') . "\">";
echo "</a></th>\n";
echo "<th class='right'>";
echo "<a href='{$target}?{$parameters}&start={$end}'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/last.png' alt=\"" . __s('End') . "\" title=\"" . __s('End') . "\">";
echo "</a></th>\n";
}
// End pager
//.........这里部分代码省略.........