コード例 #1
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;
}