Example #1
0
/** recursive function to construct the catalog tree ui
 * @param $hrarray -- Hierarchial catalog tree array with only the catalogid:: Type array
 * @param $catalogout -- html string ouput of the constucted catalog tree ui:: Type varchar
 * @param $catalog_det -- Catalogdetails array got from calling getAllCatalogDetails():: Type array
 * @returns $catalog_out -- html string ouput of the constucted catalog tree ui:: Type string
 *
 */
function indent($hrarray, $catalogout)
{
    global $theme;
    global $mod_strings;
    global $current_user;
    global $adb;
    $multifieldid = $_REQUEST["multifieldid"];
    $level = $_REQUEST["level"];
    $parentfieldid = $_REQUEST["parentfieldid"];
    $multifieldinfo = getMultiFieldInfo($multifieldid);
    $tablename = $multifieldinfo["tablename"];
    $totallevel = $multifieldinfo["totallevel"];
    if ($level == 1) {
        $previousName = "根目录";
        $hreflink = "javascript:;";
    } else {
        $sql = "select * from {$tablename} where actualfieldid='{$parentfieldid}' ";
        $result = $adb->query($sql);
        $previousName = $adb->query_result($result, 0, "actualfieldname");
        $previousparentid = $adb->query_result($result, 0, "parentfieldid");
        $hreflink = "javascript:gotoPreviousLevel({$multifieldid},{$level},{$previousparentid});";
    }
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    $catalogout .= '<ul class="uil" id="-1" style="display:block;list-style-type:none;">';
    $catalogout .= '<li ><table border="0" cellpadding="0" cellspacing="0" onMouseOver="fnVisible(\'layer_-1\')" onMouseOut="fnInVisible(\'layer_-1\')">';
    $catalogout .= '<tr><td nowrap>';
    $catalogout .= '<b style="font-weight:bold;margin:0;padding:0;cursor:pointer;">';
    $catalogout .= '<img src="' . $image_path . '/menu_root.gif" id="img_-1" border="0"  alt="上一级目录" title="上一级目录" align="absmiddle">';
    $catalogout .= '&nbsp;<a href="' . $hreflink . '"><b class="genHeaderGray">' . $previousName . '</b></a></td>';
    $catalogout .= '<td nowrap><div id="layer_-1" class="drag_Element">';
    $catalogout .= '<a href="index.php?module=Settings&action=Popupcreatemultifieldnode&multifieldid=' . $multifieldid . '&level=' . $level . '&parentfieldid=' . $parentfieldid . '&parent=-1"><img src="' . $image_path . '/Rolesadd.gif" align="absmiddle" border="0" alt="添加选项在下拉框首位" title="添加选项在下拉框首位"></a>';
    $catalogout .= '</div></td></tr></table>';
    foreach ($hrarray as $row) {
        $actualfieldid = $row["actualfieldid"];
        $multifieldname = $row["actualfieldname"];
        $catalogout .= '<ul class="uil" id="' . $actualfieldid . '" style="display:block;list-style-type:none;">';
        $catalogout .= '<li ><table border="0" cellpadding="0" cellspacing="0" onMouseOver="fnVisible(\'layer_' . $actualfieldid . '\')" onMouseOut="fnInVisible(\'layer_' . $actualfieldid . '\')">';
        $catalogout .= '<tr><td nowrap>';
        $catalogout .= '<b style="font-weight:bold;margin:0;padding:0;cursor:pointer;">';
        $catalogout .= '<img src="' . $image_path . '/vtigerDevDocs.gif" id="img_' . $actualfieldid . '" border="0"  alt="' . $mod_strings["Expand/Collapse"] . '" title="' . $mod_strings["Expand/Collapse"] . '" align="absmiddle">';
        $catalogout .= '&nbsp;<a href="javascript:gotoNextLevel(' . $multifieldid . ',' . $level . ',' . $totallevel . ',' . $actualfieldid . ');" class="x" id="user_' . $actualfieldid . '">' . $multifieldname . '</a></td>';
        $catalogout .= '<td nowrap><div id="layer_' . $actualfieldid . '" class="drag_Element">';
        if (is_admin($current_user)) {
            $catalogout .= '<a href="index.php?module=Settings&action=Popupcreatemultifieldnode&multifieldid=' . $multifieldid . '&level=' . $level . '&parentfieldid=' . $parentfieldid . '&parent=' . $actualfieldid . '"><img src="' . $image_path . '/Rolesadd.gif" align="absmiddle" border="0" alt="在本选项后面添加一个新的选项" title="在本选项后面添加一个新的选项"></a>';
            $catalogout .= '<a href="index.php?module=Settings&action=Popupcreatemultifieldnode&multifieldid=' . $multifieldid . '&level=' . $level . '&parentfieldid=' . $parentfieldid . '&catalogid=' . $actualfieldid . '&mode=edit"><img src="' . $image_path . '/RolesEdit.gif" align="absmiddle" border="0" alt="编辑下拉框选项" title="编辑下拉框选项"></a>';
            $catalogout .= '<a href="javascript:deleteFieldNode(' . $actualfieldid . ',' . $multifieldid . ',' . $level . ',' . $parentfieldid . ');"><img src="' . $image_path . '/RolesDelete.gif" align="absmiddle" border="0" alt="删除下拉框选项" title="删除下拉框选项"></a>';
        }
        $catalogout .= '</div></td></tr></table>';
        $catalogout .= '</li>';
        $catalogout .= '</ul>';
    }
    return $catalogout;
}
Example #2
0
function getMultiOptsStr($multifieldid, $level, $parentid)
{
    global $adb;
    $optionsstr = "";
    $multifieldinfo = getMultiFieldInfo($multifieldid, false);
    $tablename = $multifieldinfo["tablename"];
    $moduleName = $multifieldinfo["modulename"];
    if ($moduleName == 'Events') {
        $temp_module_strings = return_module_language($current_language, 'Calendar');
    } else {
        $temp_module_strings = return_module_language($current_language, $moduleName);
    }
    if ($level == 1) {
        $sql = "select * from {$tablename} where thelevel=1 order by sortorderid asc";
        $result = $adb->query($sql);
        while ($row = $adb->fetch_array($result)) {
            if ($temp_module_strings[$row["actualfieldname"]] != '') {
                $optionsstr .= $temp_module_strings[$row["actualfieldname"]];
            } else {
                $optionsstr .= $row["actualfieldname"];
            }
            $optionsstr .= "\n";
            //               $opttxt=$row["actualfieldname"];
            //               $optionsstr.="<option value='$optval'>$opttxt</options>";
        }
    } else {
        $sql = "select * from {$tablename} where thelevel={$level} and parentfieldid='{$parentid}' order by sortorderid asc";
        $result = $adb->query($sql);
        while ($row = $adb->fetch_array($result)) {
            if ($temp_module_strings[$row["actualfieldname"]] != '') {
                $optionsstr .= $temp_module_strings[$row["actualfieldname"]];
            } else {
                $optionsstr .= $row["actualfieldname"];
            }
            $optionsstr .= "\n";
        }
    }
    return $optionsstr;
}
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
*
 ********************************************************************************/
require_once 'include/database/PearDatabase.php';
require_once 'include/utils/MultiFieldUtils.php';
$multifieldid = $_REQUEST["multifieldid"];
$level = $_REQUEST["level"];
$parentfieldid = $_REQUEST["parentfieldid"];
$fldPickList = $_REQUEST['listarea'];
//changed by dingjianting on 2006-10-1 for picklist editor
$fldPickList = utf8RawUrlDecode($fldPickList);
$multifieldinfo = getMultiFieldInfo($multifieldid, false);
$tablename = $multifieldinfo["tablename"];
$moduleName = $multifieldinfo["modulename"];
$totallevel = $multifieldinfo["totallevel"];
global $adb;
//changed by dingjianting on 2007-2-20 for picklist ,some items used in codes can not be changed such as close win.
if ($level == 1) {
    $delquery = "delete from {$tablename} ";
    $adb->query($delquery);
} else {
    //    $delquery="delete from $tablename where thelevel>$level or (thelevel=$level and parentfieldid=$parentfieldid)";
    deleteSubOptionNode($multifieldid, $level, $totallevel, $parentfieldid, $tablename);
}
if (substr_count($fldPickList, "br") > 0) {
    $fldPickList = str_replace("&lt;", "<", $fldPickList);
    $fldPickList = str_replace("&gt;", ">", $fldPickList);
Example #4
0
<?php

require_once 'include/database/PearDatabase.php';
require_once 'include/utils/MultiFieldUtils.php';
global $adb;
$multifieldid = $_REQUEST["multifieldid"];
$level = $_REQUEST["level"];
$parentfieldid = $_REQUEST["parentfieldid"];
$multifieldinfo = getMultiFieldInfo($multifieldid);
$tablename = $multifieldinfo["tablename"];
$fieldname = $_REQUEST['catalogName'];
$mode = $_REQUEST['mode'];
if (isset($_REQUEST['dup_check']) && $_REQUEST['dup_check'] != '') {
    if ($mode != 'edit') {
        if ($level == 1) {
            $query = "select actualfieldid from {$tablename} where thelevel=1 and actualfieldname='{$fieldname}' order by sortorderid asc";
        } else {
            $query = "select actualfieldid from {$tablename} where thelevel={$level} and parentfieldid='{$parentfieldid}' and actualfieldname='{$fieldname}' order by sortorderid asc";
        }
    } else {
        $fieldid = $_REQUEST['catalogid'];
        if ($level == 1) {
            $query = "select actualfieldid from {$tablename} where thelevel=1 and actualfieldname='{$fieldname}' and actualfieldid<>'{$fieldid}' order by sortorderid asc";
        } else {
            $query = "select actualfieldid from {$tablename} where thelevel={$level} and parentfieldid='{$parentfieldid}' and actualfieldname='{$fieldname}' and actualfieldid<>'{$fieldid}' order by sortorderid asc";
        }
    }
    $result = $adb->query($query);
    if ($adb->num_rows($result) > 0) {
        echo '下拉框选项已存在';
        die;
Example #5
0
function getMultiFieldPos($fieldid, $multifieldid)
{
    global $adb;
    if ($feildid == -1) {
        return 1;
    }
    $multifieldinfo = getMultiFieldInfo($multifieldid);
    $totallevel = $multifieldinfo["totallevel"];
    $tablename = $multifieldinfo["tablename"];
    $sql = "select * from {$tablename} where actualfieldid='{$fieldid}'";
    $row = $adb->getFirstLine($sql);
    if ($row) {
        $sortorderid = $row['sortorderid'];
        $sortorderid += 1;
    }
    return $sortorderid;
}