Example #1
0
function getModulesWithPhones()
{
    global $adb;
    $querystr = "select semodule from vtiger_modentity_num where active=?";
    $res = $adb->pquery($querystr, array('1'));
    $numrows = $adb->num_rows($res);
    $modules = "";
    for ($i = 0; $i < $numrows; $i++) {
        $modules .= getTabid($adb->query_result($res, $i, "semodule")) . ",";
    }
    $mods = rtrim($modules, ",");
    $mods = "'" . str_replace(",", "','", $mods) . "'";
    $querystr = "select tabid from vtiger_field where tabid IN(" . $mods . ") AND uitype=11 GROUP BY tabid";
    $res = $adb->pquery($querystr, array());
    $numrows = $adb->num_rows($res);
    $modules = array();
    for ($i = 0; $i < $numrows; $i++) {
        array_push($modules, Accounting::getModuleFromTabid($adb->query_result($res, $i, "tabid")));
    }
    array_push($modules, "Vendors");
    array_push($modules, "Users");
    $buttons = Accounting::loadActiveModsButtons();
    $search = Accounting::loadActiveModsSearch();
    $mods = array();
    for ($i = 0; $i < count($modules); $i++) {
        $bButton = "0";
        $bSearch = "0";
        if (in_array($modules[$i], $buttons)) {
            $bButton = "1";
        }
        if (in_array($modules[$i], $search)) {
            $bSearch = "1";
        }
        array_push($mods, array($modules[$i], $bButton, $bSearch));
    }
    return $mods;
}