コード例 #1
0
ファイル: utils.php プロジェクト: jgjermeni/corebos
/** Function to get the tab module name for a given id
 * @param $tabid -- tab id:: Type integer
 * @returns $string -- string:: Type string
*/
function getTabModuleName($tabid)
{
    global $log, $adb;
    $log->debug("Entering getTabModuleName(" . $tabid . ") method ...");
    // Lookup information in cache first
    $tabname = VTCacheUtils::lookupModulename($tabid);
    if ($tabname === false) {
        if (file_exists('tabdata.php') && filesize('tabdata.php') != 0) {
            include 'tabdata.php';
            $tabname = array_search($tabid, $tab_info_array);
            if ($tabname == false) {
                $sql = "select name from vtiger_tab where tabid=?";
                $result = $adb->pquery($sql, array($tabid));
                $tabname = $adb->query_result($result, 0, "name");
            }
            // Update information to cache for re-use
            VTCacheUtils::updateTabidInfo($tabid, $tabname);
        } else {
            $log->info("tab id is " . $tabid);
            $sql = "select name from vtiger_tab where tabid=?";
            $result = $adb->pquery($sql, array($tabid));
            $tabname = $adb->query_result($result, 0, "name");
            // Update information to cache for re-use
            VTCacheUtils::updateTabidInfo($tabid, $tabname);
        }
    }
    $log->debug("Exiting getTabModuleName method ...");
    return $tabname;
}
コード例 #2
0
/**
 * Function to get the tabid
 * Takes the input as $module - module name
 * returns the tabid, integer type
 */
function getTabid($module)
{
    global $log;
    $log->debug("Entering getTabid(" . $module . ") method ...");
    // Lookup information in cache first
    $tabid = VTCacheUtils::lookupTabid($module);
    if ($tabid === false) {
        if (file_exists('tabdata.php') && filesize('tabdata.php') != 0) {
            include 'tabdata.php';
            $tabid = $tab_info_array[$module];
            // Update information to cache for re-use
            VTCacheUtils::updateTabidInfo($tabid, $module);
        } else {
            $log->info("module  is " . $module);
            global $adb;
            $sql = "select tabid from vtiger_tab where name=?";
            $result = $adb->pquery($sql, array($module));
            $tabid = $adb->query_result($result, 0, "tabid");
            // Update information to cache for re-use
            VTCacheUtils::updateTabidInfo($tabid, $module);
        }
    }
    $log->debug("Exiting getTabid method ...");
    return $tabid;
}