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


PHP xajaxResponse::AddAssign方法代码示例

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


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

示例1: edit_process

function edit_process($form_data)
{
    global $conn, $id;
    $resp = new xajaxResponse();
    ossim_valid($form_data['bp_name'], OSS_INPUT, 'illegal:' . _("Name"));
    ossim_valid($form_data['bp_desc'], OSS_TEXT, 'illegal:' . _("Description"));
    if (ossim_error()) {
        $resp->AddAssign("form_errors", "innerHTML", ossim_error());
    } else {
        // Check if there is already a BP with that name
        $sql = "SELECT name FROM bp_process WHERE name=?";
        if ($id != 0) {
            $sql .= " AND id <> {$id}";
        }
        $params = array($form_data['bp_name']);
        if (!($rs = $conn->Execute($sql, $params))) {
            $resp->AddAssign("form_errors", "innerHTML", $conn->ErrorMsg());
            return $resp;
        } elseif (!$rs->EOF) {
            $resp->AddAssign("form_errors", "innerHTML", ossim_error(_("There is already a process with that name")));
            return $resp;
        }
        if ($id == 0) {
            $sql = "INSERT INTO bp_process (id, name, description) VALUES (?, ?, ?)";
            $id = $conn->GenID('bp_seq');
            $params = array($id, $form_data['bp_name'], $form_data['bp_desc']);
            if (!$conn->Execute($sql, $params)) {
                $resp->AddAssign("form_errors", "innerHTML", $conn->ErrorMsg());
            } else {
                $resp->addRedirect($_SERVER['SCRIPT_NAME'] . "?id={$id}");
            }
        } else {
            $sql = "UPDATE bp_process SET name=?, description=? WHERE id=?";
            $params = array($form_data['bp_name'], $form_data['bp_desc'], $id);
            if (!$conn->Execute($sql, $params)) {
                $resp->AddAssign("form_errors", "innerHTML", $conn->ErrorMsg());
            } else {
                $resp->addRedirect("./bp_list.php");
            }
        }
    }
    return $resp;
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:43,代码来源:bp_edit.php

示例2: search_assets

function search_assets($form_data)
{
    global $conn, $can_edit;
    $resp = new xajaxResponse();
    //xajax_debug($form_data, $resp);
    // Build SQL from Form data
    $proc_id = $form_data['proc_id'];
    $asset_name = $form_data['asset_name'];
    $where = array();
    if ($proc_id == 'none') {
        $where[] = "proc.id IS NULL";
    } elseif ($proc_id != 'all') {
        $where[] = "proc.id=" . $conn->qstr($proc_id, get_magic_quotes_gpc());
    }
    if ($asset_name) {
        // qstr doesn't seem to quote right if you introduce "\" in the search form
        //$esc = substr($conn->qstr($asset_name, get_magic_quotes_gpc()), 1, -1);
        // XXX too mysql dependant (maybe not so important as Ossim already if very mysql dependant)
        $esc = mysql_real_escape_string($asset_name);
        $where[] = "asset.name LIKE '%{$esc}%'";
    }
    if (count($where)) {
        $w = 'WHERE ' . implode(' AND ', $where);
    } else {
        $w = '';
    }
    $sql = "\n        SELECT \n            asset.id as asset_id,\n            asset.name as asset_name,\n            asset.description as asset_description,\n            proc.id as proc_id,\n            proc.name as proc_name,\n            proc.description AS proc_description\n        FROM\n            bp_asset AS asset\n        LEFT JOIN bp_process_asset_reference AS ref ON asset.id = ref.asset_id\n        LEFT JOIN bp_process AS proc ON ref.process_id = proc.id\n        {$w}\n        ORDER BY asset.name";
    if (!($rs = $conn->Execute($sql))) {
        die($conn->ErrorMsg());
    }
    $assets = $procs = $asset_ref = array();
    while (!$rs->EOF) {
        $aid = $rs->fields['asset_id'];
        $pid = $rs->fields['proc_id'];
        if (!empty($pid)) {
            $asset_ref[$aid][] = $pid;
            $procs[$rs->fields['proc_id']] = $rs->fields['proc_name'];
        }
        if (!isset($assets[$aid])) {
            $assets[$aid] = $rs->fields;
        }
        $rs->MoveNext();
    }
    // No results found
    if (!count($assets)) {
        $resp->AddAssign("search-results", "innerHTML", '<center><i>' . _("No results found") . '</i></center>');
        return $resp;
    }
    // Print the results in HTML
    $html = '<table width="60%" align="center">
    <tr>
        <th>' . _("Asset Name") . '</th>
        <th>' . _("Belongs to") . '</th>';
    if ($can_edit) {
        $html .= '<th>' . _("Actions") . '</th>';
    }
    $html .= '</tr>';
    foreach ($assets as $aid => $a) {
        $html .= '<tr>
            <td>' . $a['asset_name'] . '</td>
            <td style="text-align: left">';
        if (isset($asset_ref[$aid])) {
            $html .= '<ul>';
            foreach ($asset_ref[$aid] as $pid) {
                $html .= '<li>' . $procs[$pid] . '</li>';
            }
            $html .= '</ul>';
        } else {
            $html .= '&nbsp;';
        }
        $html .= '</td>';
        if ($can_edit) {
            $html .= '<td><a href="./asset_edit.php?id=' . $a['asset_id'] . '">(' . _("edit") . ')</a>&nbsp;';
            $html .= '<a href="#" onClick="javascript: xajax_delete_asset(' . $a['asset_id'] . ', xajax.getFormValues(\'search\')); return false;">(' . _("delete") . ')</a></td>';
        }
        $html .= '</tr>';
    }
    $html .= '</table>';
    $resp->AddAssign("search-results", "innerHTML", $html);
    return $resp;
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:81,代码来源:asset_list.php

示例3: draw_members_select

function draw_members_select($form_data)
{
    global $conn, $id;
    $resp = new xajaxResponse();
    $type = $form_data['member_type'];
    // The user selected the empty type
    if (!$type) {
        $resp->AddAssign("members_select", "innerHTML", _("Please select a type"));
        return $resp;
    }
    //
    // Get the list of members of the given type
    //
    $options = array();
    switch ($type) {
        case 'host':
            include_once 'classes/Host.inc';
            $list = Host::get_list($conn, "", 'ORDER BY hostname');
            print_r($list);
            foreach ($list as $obj) {
                $descr = $obj->get_descr();
                if (strlen($descr) > 50) {
                    $descr = substr($descr, 0, 47) . '...';
                }
                $options[$obj->get_ip()] = $obj->get_hostname() . ' ' . $obj->get_ip() . ' - ' . $descr;
            }
            break;
        case 'net':
            include_once 'classes/Net.inc';
            $list = Net::get_list($conn, "", 'ORDER BY name');
            foreach ($list as $obj) {
                $descr = $obj->get_descr();
                if (strlen($descr) > 50) {
                    $descr = substr($descr, 0, 47) . '...';
                }
                $options[$obj->get_name()] = $obj->get_name() . ' ' . $obj->get_ips() . ' - ' . $descr;
            }
            break;
        case 'host_group':
            include_once 'classes/Host_group.inc';
            $list = Host_group::get_list($conn, "", 'ORDER BY name');
            foreach ($list as $obj) {
                $descr = $obj->get_descr();
                if (strlen($descr) > 50) {
                    $descr = substr($descr, 0, 47) . '...';
                }
                $options[$obj->get_name()] = $obj->get_name() . ' - ' . $descr;
            }
            break;
        case 'net_group':
            include_once 'classes/Net_group.inc';
            $list = Net_group::get_list($conn, '', 'ORDER BY name');
            foreach ($list as $obj) {
                $descr = $obj->get_descr();
                if (strlen($descr) > 50) {
                    $descr = substr($descr, 0, 47) . '...';
                }
                $options[$obj->get_name()] = $obj->get_name() . ' - ' . $descr;
            }
            break;
    }
    //
    // Build the SELECT tag
    //
    $html = '<select name="member_name">';
    foreach ($options as $name => $description) {
        $html .= "<option value='{$name}'>{$description}</option>";
    }
    $html .= '</select>';
    $resp->AddAssign("members_select", "innerHTML", $html);
    return $resp;
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:72,代码来源:asset_edit.php

示例4: draw_asset_details


//.........这里部分代码省略.........
        if ($responsible['email']) {
            $str = '<a href="mailto:' . $responsible['email'] . '?subject=' . $asset->get_name() . '"><img border="0" src="../pixmaps/email_icon.gif"></a>&nbsp;';
        }
        $str .= $responsible['name'] . ' (' . $responsible['login'] . ')';
        $html .= '<tr><td style="text-align: left">' . $str . '</td></tr>';
        $times++;
    }
    if (!$times) {
        $html .= '<tr><td style="text-align: left"><i>' . _("None set") . '</i></td></tr>';
    }
    $html .= '
      </table>
    </tr>
    <tr>
        <th width="30%" colspan="2">' . _("Status of Members");
    if ($show_all_members) {
        $html .= '
            <a href="#" onClick="javascript: xajax_draw_asset_details(' . $asset_id . ',0); return false;">(' . _("Click to show only members with problems") . ')</a>&nbsp;';
    } else {
        $html .= '
            <a href="#" onClick="javascript: xajax_draw_asset_details(' . $asset_id . ',1); return false;">(' . _("Click to show all members") . ')</a>&nbsp;';
    }
    $html .= '
        </th>
    </tr>
    <tr>
        <td colspan="2">
            <table width="100%">
                <tr>
                    <th>Member type</th>
                    <th>Member</th>
                    <th>Measure type</th>
                    <th>Severity</th>
                    <th>Problem</th>
                    <th>History</th>
                </tr>
            ';
    $all_members = $asset->get_members();
    $members = array();
    //
    // list only members with "problems"
    //
    foreach ($all_members as $mem) {
        $mem_id = $mem['name'] . '-' . $mem['type'];
        if ($show_all_members) {
            $members[$mem_id][] = $mem;
        } elseif ($mem['severity'] != 0 || $mem['measure_type'] === null) {
            $members[$mem_id][] = $mem;
        }
    }
    /*
    //
    // if all the measures from a member were OK, consolidate the data
    // as "All measures" "OK"
    //
    $all_member_ids = array_unique($all_member_ids);
    $listed_member_ids = array_keys($members);
    $all_ok_members = ($show_all_members)?
    $all_member_ids : array_diff($all_member_ids, $listed_member_ids);
    foreach ($all_ok_members as $mem_id) {
    list($name, $type) = explode('-', $mem_id);
    $members[$mem_id][] = array(
    'name' => $name,
    'type' => $type,
    'measure_type' => 'all',
    'severity' => "0"
    );
    }
    */
    //
    // Display members
    //
    foreach ($members as $mem_id => $member) {
        foreach ($member as $mem) {
            if ($mem['measure_type'] === null) {
                $link = _('n/a');
            } else {
                $link = "../control_panel/" . Util::graph_image_link($mem['measure_type'] . "-" . $mem['name'], "bp", "bp", "N-1D", "N", 1, "all");
            }
            //xajax_debug($mem, $resp);
            $error_msg = "&nbsp;";
            if ($mem['severity'] >= LOW_PRIORITY) {
                $error_msg = BP_Asset::get_measure_link($mem);
            }
            $html .= '<tr valign="center">
                        <td>' . $mem['type'] . '</td>
                        <td>' . $mem['name'] . '</td>
                        <td>' . BP_Asset::get_measure_type_str($mem['measure_type']) . '</td>
                        <td><b>' . bp_member_status_html($mem['severity']) . '</b></td>
                        <td>' . $error_msg . '</td>
                        <td><a href="' . $link . '"><img
                            src="../pixmaps/graph.gif" border="0"/></a></td>
                    </tr>';
        }
    }
    $html .= '</table></td></tr></table>';
    $resp->addAssign("asset-info", "style.display", '');
    $resp->AddAssign("asset-info", "innerHTML", $html);
    return $resp;
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:101,代码来源:bp_list.php


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