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


PHP mkCountQuery函数代码示例

本文整理汇总了PHP中mkCountQuery函数的典型用法代码示例。如果您正苦于以下问题:PHP mkCountQuery函数的具体用法?PHP mkCountQuery怎么用?PHP mkCountQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getTopAccounts

function getTopAccounts($maxval, $calCnt)
{
    $log = LoggerManager::getLogger('top accounts_list');
    $log->debug("Entering getTopAccounts() method ...");
    require_once "data/Tracker.php";
    require_once 'modules/Potentials/Potentials.php';
    require_once 'include/logging.php';
    require_once 'include/ListView/ListView.php';
    global $app_strings;
    global $adb;
    global $current_language;
    global $current_user;
    $current_module_strings = return_module_language($current_language, "Accounts");
    require 'user_privileges/user_privileges_' . $current_user->id . '.php';
    require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
    $list_query = "select vtiger_account.accountid, vtiger_account.accountname, vtiger_account.tickersymbol, sum(vtiger_potential.amount) as amount from vtiger_potential inner join vtiger_crmentity on (vtiger_potential.potentialid=vtiger_crmentity.crmid) left join vtiger_account on (vtiger_potential.related_to=vtiger_account.accountid) left join vtiger_groups on (vtiger_groups.groupid = vtiger_crmentity.smownerid) where vtiger_crmentity.deleted=0 AND vtiger_crmentity.smownerid='" . $current_user->id . "' and vtiger_potential.sales_stage not in ('Closed Won', 'Closed Lost','" . $app_strings['LBL_CLOSE_WON'] . "','" . $app_strings['LBL_CLOSE_LOST'] . "')";
    if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[6] == 3) {
        $sec_parameter = getListViewSecurityParameter('Accounts');
        $list_query .= $sec_parameter;
    }
    $list_query .= " group by vtiger_account.accountid, vtiger_account.accountname, vtiger_account.tickersymbol order by amount desc";
    $list_query .= " LIMIT 0," . $adb->sql_escape_string($maxval);
    if ($calCnt == 'calculateCnt') {
        $list_result_rows = $adb->query(mkCountQuery($list_query));
        return $adb->query_result($list_result_rows, 0, 'count');
    }
    $list_result = $adb->query($list_query);
    $open_accounts_list = array();
    $noofrows = $adb->num_rows($list_result);
    if ($noofrows) {
        for ($i = 0; $i < $noofrows; $i++) {
            $open_accounts_list[] = array('accountid' => $adb->query_result($list_result, $i, 'accountid'), 'accountname' => $adb->query_result($list_result, $i, 'accountname'), 'amount' => $adb->query_result($list_result, $i, 'amount'), 'tickersymbol' => $adb->query_result($list_result, $i, 'tickersymbol'));
        }
    }
    $title = array();
    $title[] = 'myTopAccounts.gif';
    $title[] = $current_module_strings['LBL_TOP_ACCOUNTS'];
    $title[] = 'home_myaccount';
    $header = array();
    $header[] = $current_module_strings['LBL_LIST_ACCOUNT_NAME'];
    $currencyid = fetchCurrency($current_user->id);
    $rate_symbol = getCurrencySymbolandCRate($currencyid);
    $rate = $rate_symbol['rate'];
    $curr_symbol = $rate_symbol['symbol'];
    $header[] = $current_module_strings['LBL_LIST_AMOUNT'] . '(' . $curr_symbol . ')';
    $entries = array();
    foreach ($open_accounts_list as $account) {
        $value = array();
        $account_fields = array('ACCOUNT_ID' => $account['accountid'], 'ACCOUNT_NAME' => $account['accountname'], 'AMOUNT' => $account['amount']);
        $Top_Accounts = strlen($account['accountname']) > 20 ? substr($account['accountname'], 0, 20) . '...' : $account['accountname'];
        $value[] = '<a href="index.php?action=DetailView&module=Accounts&record=' . $account['accountid'] . '">' . $Top_Accounts . '</a>';
        $value[] = convertFromDollar($account['amount'], $rate);
        $entries[$account['accountid']] = $value;
    }
    $values = array('ModuleName' => 'Accounts', 'Title' => $title, 'Header' => $header, 'Entries' => $entries);
    $log->debug("Exiting getTopAccounts method ...");
    if ($display_empty_home_blocks && count($entries) == 0 || count($entries) > 0) {
        return $values;
    }
}
开发者ID:p6,项目名称:VF,代码行数:60,代码来源:ListViewTop.php

示例2: render

 public static function render($userInputObject, $user)
 {
     global $list_max_entries_per_page;
     $adb = PearDatabase::getInstance();
     $viewer = new Import_UI_Viewer();
     $ownerId = $userInputObject->get('foruser');
     $owner = new Users();
     $owner->id = $ownerId;
     $owner->retrieve_entity_info($ownerId, 'Users');
     if (!is_admin($user) && $user->id != $owner->id) {
         $viewer->display('OperationNotPermitted.tpl', 'Vtiger');
         exit;
     }
     $userDBTableName = Import_Utils::getDbTableName($owner);
     $moduleName = $userInputObject->get('module');
     $moduleMeta = self::getModuleMeta($moduleName, $user);
     $result = $adb->query('SELECT recordid FROM ' . $userDBTableName . ' WHERE status is NOT NULL AND recordid IS NOT NULL');
     $noOfRecords = $adb->num_rows($result);
     $importedRecordIds = array();
     for ($i = 0; $i < $noOfRecords; ++$i) {
         $importedRecordIds[] = $adb->query_result($result, $i, 'recordid');
     }
     if (count($importedRecordIds) == 0) {
         $importedRecordIds[] = 0;
     }
     $focus = CRMEntity::getInstance($moduleName);
     $queryGenerator = new QueryGenerator($moduleName, $user);
     $customView = new CustomView($moduleName);
     $viewId = $customView->getViewIdByName('All', $moduleName);
     $queryGenerator->initForCustomViewById($viewId);
     $list_query = $queryGenerator->getQuery();
     // Fetch only last imported records
     $list_query .= ' AND ' . $focus->table_name . '.' . $focus->table_index . ' IN (' . implode(',', $importedRecordIds) . ')';
     if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true) {
         $count_result = $adb->query(mkCountQuery($list_query));
         $noofrows = $adb->query_result($count_result, 0, "count");
     } else {
         $noofrows = null;
     }
     $start = ListViewSession::getRequestCurrentPage($moduleName, $list_query, $viewId, false);
     $navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
     $limit_start_rec = ($start - 1) * $list_max_entries_per_page;
     $list_result = $adb->pquery($list_query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
     $recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows);
     $viewer->assign('recordListRange', $recordListRangeMsg);
     $controller = new ListViewController($adb, $user, $queryGenerator);
     $listview_header = $controller->getListViewHeader($focus, $moduleName, $url_string, $sorder, $order_by, true);
     $listview_entries = $controller->getListViewEntries($focus, $moduleName, $list_result, $navigation_array, true);
     $viewer->assign('CURRENT_PAGE', $start);
     $viewer->assign('LISTHEADER', $listview_header);
     $viewer->assign('LISTENTITY', $listview_entries);
     $viewer->assign('FOR_MODULE', $moduleName);
     $viewer->assign('FOR_USER', $ownerId);
     $isAjax = $userInputObject->get('ajax');
     if (!empty($isAjax)) {
         echo $viewer->fetch('ListViewEntries.tpl');
     } else {
         $viewer->display('ImportListView.tpl');
     }
 }
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:60,代码来源:Import_ListView_Controller.php

示例3: getTopPotentials

function getTopPotentials($maxval, $calCnt)
{
    $log = LoggerManager::getLogger('top opportunity_list');
    $log->debug("Entering getTopPotentials() method ...");
    require_once "data/Tracker.php";
    require_once 'modules/Potentials/Potentials.php';
    require_once 'include/logging.php';
    require_once 'include/ListView/ListView.php';
    global $app_strings;
    global $adb;
    global $current_language;
    global $current_user;
    $current_module_strings = return_module_language($current_language, "Potentials");
    $title = array();
    $title[] = 'myTopOpenPotentials.gif';
    $title[] = $current_module_strings['LBL_TOP_OPPORTUNITIES'];
    $title[] = 'home_mypot';
    $where = "AND vtiger_potential.potentialid > 0 AND vtiger_potential.sales_stage not in ('Closed Won','Closed Lost','" . $current_module_strings['Closed Won'] . "','" . $current_module_strings['Closed Lost'] . "') AND vtiger_crmentity.smownerid='" . $current_user->id . "' AND vtiger_potential.amount > 0";
    $header = array();
    $header[] = $current_module_strings['LBL_LIST_OPPORTUNITY_NAME'];
    //$header[]=$current_module_strings['LBL_LIST_ACCOUNT_NAME'];
    $currencyid = fetchCurrency($current_user->id);
    $rate_symbol = getCurrencySymbolandCRate($currencyid);
    $rate = $rate_symbol['rate'];
    $curr_symbol = $rate_symbol['symbol'];
    $header[] = $current_module_strings['LBL_LIST_AMOUNT'] . '(' . $curr_symbol . ')';
    $list_query = "SELECT vtiger_crmentity.crmid, vtiger_potential.potentialname,\n\t\t\tvtiger_potential.amount, potentialid\n\t\t\tFROM vtiger_potential\n\t\t\tIGNORE INDEX(PRIMARY) INNER JOIN vtiger_crmentity\n\t\t\t\tON vtiger_crmentity.crmid = vtiger_potential.potentialid";
    $list_query .= getNonAdminAccessControlQuery('Potentials', $current_user);
    $list_query .= "WHERE vtiger_crmentity.deleted = 0 " . $where;
    $list_query .= " ORDER BY amount DESC";
    $list_query .= " LIMIT " . $adb->sql_escape_string($maxval);
    if ($calCnt == 'calculateCnt') {
        $list_result_rows = $adb->query(mkCountQuery($list_query));
        return $adb->query_result($list_result_rows, 0, 'count');
    }
    $list_result = $adb->query($list_query);
    $open_potentials_list = array();
    $noofrows = $adb->num_rows($list_result);
    $entries = array();
    if ($noofrows) {
        for ($i = 0; $i < $noofrows; $i++) {
            $open_potentials_list[] = array('name' => $adb->query_result($list_result, $i, 'potentialname'), 'id' => $adb->query_result($list_result, $i, 'potentialid'), 'amount' => $adb->query_result($list_result, $i, 'amount'));
            $potentialid = $adb->query_result($list_result, $i, 'potentialid');
            $potentialname = $adb->query_result($list_result, $i, 'potentialname');
            $Top_Potential = strlen($potentialname) > 20 ? substr($potentialname, 0, 20) . '...' : $potentialname;
            $value = array();
            $value[] = '<a href="index.php?action=DetailView&module=Potentials&record=' . $potentialid . '">' . $Top_Potential . '</a>';
            $value[] = CurrencyField::convertToUserFormat($adb->query_result($list_result, $i, 'amount'));
            $entries[$potentialid] = $value;
        }
    }
    $advft_criteria_groups = array('1' => array('groupcondition' => null));
    $advft_criteria = array(array('groupid' => 1, 'columnname' => 'vtiger_potential:sales_stage:sales_stage:Potentials_Sales_Stage:V', 'comparator' => 'k', 'value' => 'closed', 'columncondition' => 'and'), array('groupid' => 1, 'columnname' => 'vtiger_potential:amount:amount:Potentials_Amount:N', 'comparator' => 'g', 'value' => '0', 'columncondition' => 'and'), array('groupid' => 1, 'columnname' => 'vtiger_crmentity:smownerid:assigned_user_id:Leads_Assigned_To:V', 'comparator' => 'e', 'value' => getFullNameFromArray('Users', $current_user->column_fields), 'columncondition' => null));
    $search_qry = '&advft_criteria=' . Zend_Json::encode($advft_criteria) . '&advft_criteria_groups=' . Zend_Json::encode($advft_criteria_groups) . '&searchtype=advance&query=true';
    $values = array('ModuleName' => 'Potentials', 'Title' => $title, 'Header' => $header, 'Entries' => $entries, 'search_qry' => $search_qry);
    if (count($open_potentials_list) == 0 || count($open_potentials_list) > 0) {
        $log->debug("Exiting getTopPotentials method ...");
        return $values;
    }
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:60,代码来源:ListViewTop.php

示例4: getTopPotentials

function getTopPotentials($maxval, $calCnt)
{
    $log = LoggerManager::getLogger('top opportunity_list');
    $log->debug("Entering getTopPotentials() method ...");
    require_once "data/Tracker.php";
    require_once 'modules/Potentials/Potentials.php';
    require_once 'include/logging.php';
    require_once 'include/ListView/ListView.php';
    global $app_strings;
    global $adb;
    global $current_language;
    global $current_user;
    $current_module_strings = return_module_language($current_language, "Potentials");
    $title = array();
    $title[] = 'myTopOpenPotentials.gif';
    $title[] = $current_module_strings['LBL_TOP_OPPORTUNITIES'];
    $title[] = 'home_mypot';
    $where = "AND vtiger_potential.potentialid > 0 AND vtiger_potential.sales_stage not in ('Closed Won','Closed Lost','" . $current_module_strings['Closed Won'] . "','" . $current_module_strings['Closed Lost'] . "') AND vtiger_crmentity.smownerid='" . $current_user->id . "' AND vtiger_potential.amount > 0";
    $header = array();
    $header[] = $current_module_strings['LBL_LIST_OPPORTUNITY_NAME'];
    //$header[]=$current_module_strings['LBL_LIST_ACCOUNT_NAME'];
    $currencyid = fetchCurrency($current_user->id);
    $rate_symbol = getCurrencySymbolandCRate($currencyid);
    $rate = $rate_symbol['rate'];
    $curr_symbol = $rate_symbol['symbol'];
    $header[] = $current_module_strings['LBL_LIST_AMOUNT'] . '(' . $curr_symbol . ')';
    $list_query = "SELECT vtiger_crmentity.crmid, vtiger_potential.potentialname,\n\t\t\tvtiger_potential.amount, potentialid\n\t\t\tFROM vtiger_potential\n\t\t\tIGNORE INDEX(PRIMARY) INNER JOIN vtiger_crmentity\n\t\t\t\tON vtiger_crmentity.crmid = vtiger_potential.potentialid";
    $list_query .= getNonAdminAccessControlQuery('Potentials', $current_user);
    $list_query .= "WHERE vtiger_crmentity.deleted = 0 " . $where;
    $list_query .= " ORDER BY amount DESC";
    $list_query .= " LIMIT " . $adb->sql_escape_string($maxval);
    if ($calCnt == 'calculateCnt') {
        $list_result_rows = $adb->query(mkCountQuery($list_query));
        return $adb->query_result($list_result_rows, 0, 'count');
    }
    $list_result = $adb->query($list_query);
    $open_potentials_list = array();
    $noofrows = $adb->num_rows($list_result);
    $entries = array();
    if ($noofrows) {
        for ($i = 0; $i < $noofrows; $i++) {
            $open_potentials_list[] = array('name' => $adb->query_result($list_result, $i, 'potentialname'), 'id' => $adb->query_result($list_result, $i, 'potentialid'), 'amount' => $adb->query_result($list_result, $i, 'amount'));
            $potentialid = $adb->query_result($list_result, $i, 'potentialid');
            $potentialname = $adb->query_result($list_result, $i, 'potentialname');
            $Top_Potential = strlen($potentialname) > 20 ? substr($potentialname, 0, 20) . '...' : $potentialname;
            $value = array();
            $value[] = '<a href="index.php?action=DetailView&module=Potentials&record=' . $potentialid . '">' . $Top_Potential . '</a>';
            $value[] = convertFromDollar($adb->query_result($list_result, $i, 'amount'), $rate);
            $entries[$potentialid] = $value;
        }
    }
    $search_qry = "&query=true&Fields0=assigned_user_id&Condition0=e&Srch_value0=" . $current_user->column_fields['user_name'] . "&Fields1=sales_stage&Condition1=k&Srch_value1=closed&searchtype=advance&search_cnt=2&matchtype=all";
    $values = array('ModuleName' => 'Potentials', 'Title' => $title, 'Header' => $header, 'Entries' => $entries, 'search_qry' => $search_qry);
    if ($display_empty_home_blocks && count($open_potentials_list) == 0 || count($open_potentials_list) > 0) {
        $log->debug("Exiting getTopPotentials method ...");
        return $values;
    }
}
开发者ID:hardikk,项目名称:HNH,代码行数:58,代码来源:ListViewTop.php

示例5: getMyTickets

/**	Function to get the list of tickets for the currently loggedin user
**/
function getMyTickets($maxval, $calCnt)
{
    global $log;
    $log->debug("Entering getMyTickets() method ...");
    global $current_user;
    global $theme;
    global $current_language;
    global $adb;
    $current_module_strings = return_module_language($current_language, 'HelpDesk');
    $theme_path = "themes/" . $theme . "/";
    $image_path = "themes/images/";
    $search_query = "SELECT vtiger_troubletickets.*, vtiger_crmentity.*\n\t\tFROM vtiger_troubletickets \n\t\tINNER JOIN vtiger_crmentity on vtiger_crmentity.crmid = vtiger_troubletickets.ticketid \n\t\tINNER JOIN vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid\n\t\twhere vtiger_crmentity.smownerid = ? and vtiger_crmentity.deleted = 0 and " . "vtiger_troubletickets.ticketid > 0 and vtiger_troubletickets.status <> 'Closed' " . "AND vtiger_crmentity.setype='HelpDesk' ORDER BY createdtime DESC";
    $search_query .= " LIMIT 0," . $adb->sql_escape_string($maxval);
    if ($calCnt == 'calculateCnt') {
        $list_result_rows = $adb->pquery(mkCountQuery($search_query), array($current_user->id));
        return $adb->query_result($list_result_rows, 0, 'count');
    }
    $tktresult = $adb->pquery($search_query, array($current_user->id));
    if ($adb->num_rows($tktresult)) {
        $title = array();
        $title[] = 'myTickets.gif';
        $title[] = $current_module_strings['LBL_MY_TICKETS'];
        $title[] = 'home_mytkt';
        $header = array();
        $header[] = $current_module_strings['LBL_SUBJECT'];
        $header[] = $current_module_strings['Related To'];
        $noofrows = $adb->num_rows($tktresult);
        for ($i = 0; $i < $adb->num_rows($tktresult); $i++) {
            $value = array();
            $ticketid = $adb->query_result($tktresult, $i, "ticketid");
            $viewstatus = $adb->query_result($tktresult, $i, "viewstatus");
            if ($viewstatus == 'Unread') {
                $value[] = '<a style="color:red;" href="index.php?action=DetailView&module=HelpDesk&record=' . substr($adb->query_result($tktresult, $i, "ticketid"), 0, 20) . '">' . $adb->query_result($tktresult, $i, "title") . '</a>';
            } elseif ($viewstatus == 'Marked') {
                $value[] = '<a style="color:yellow;" href="index.php?action=DetailView&module=HelpDesk&record=' . substr($adb->query_result($tktresult, $i, "ticketid"), 0, 20) . '">' . $adb->query_result($tktresult, $i, "title") . '</a>';
            } else {
                $value[] = '<a href="index.php?action=DetailView&module=HelpDesk&record=' . substr($adb->query_result($tktresult, $i, "ticketid"), 0, 20) . '">' . substr($adb->query_result($tktresult, $i, "title"), 0, 20) . '</a>';
            }
            $parent_id = $adb->query_result($tktresult, $i, "parent_id");
            $parent_name = '';
            if ($parent_id != '' && $parent_id != NULL) {
                $parent_name = getParentLink($parent_id);
            }
            $value[] = $parent_name;
            $entries[$ticketid] = $value;
        }
        $search_qry = "&query=true&Fields0=ticketstatus&Condition0=n&Srch_value0=closed&Fields1=assigned_user_id&Condition1=e&Srch_value1=" . $current_user->column_fields['user_name'] . "&searchtype=advance&search_cnt=2&matchtype=all";
        $values = array('ModuleName' => 'HelpDesk', 'Title' => $title, 'Header' => $header, 'Entries' => $entries, 'search_qry' => $search_qry);
        if ($display_empty_home_blocks && $noofrows == 0 || $noofrows > 0) {
            $log->debug("Exiting getMyTickets method ...");
            return $values;
        }
    }
    $log->debug("Exiting getMyTickets method ...");
}
开发者ID:latechdirect,项目名称:vtiger,代码行数:57,代码来源:ListTickets.php

示例6: getMyTickets

/**	Function to get the list of tickets for the currently loggedin user
**/
function getMyTickets($maxval, $calCnt)
{
    global $log;
    $log->debug("Entering getMyTickets() method ...");
    global $current_user, $current_language, $adb;
    $current_module_strings = return_module_language($current_language, 'HelpDesk');
    $search_query = "SELECT vtiger_troubletickets.*, vtiger_crmentity.*\n\t\tFROM vtiger_troubletickets\n\t\tINNER JOIN vtiger_crmentity on vtiger_crmentity.crmid = vtiger_troubletickets.ticketid\n\t\tINNER JOIN vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid\n\t\twhere vtiger_crmentity.smownerid = ? and vtiger_crmentity.deleted = 0 and " . "vtiger_troubletickets.ticketid > 0 and vtiger_troubletickets.status <> 'Closed' " . "AND vtiger_crmentity.setype='HelpDesk' ORDER BY createdtime DESC";
    $search_query .= " LIMIT 0," . $adb->sql_escape_string($maxval);
    if ($calCnt == 'calculateCnt') {
        $list_result_rows = $adb->pquery(mkCountQuery($search_query), array($current_user->id));
        return $adb->query_result($list_result_rows, 0, 'count');
    }
    $tktresult = $adb->pquery($search_query, array($current_user->id));
    if ($adb->num_rows($tktresult)) {
        $title = array();
        $title[] = 'myTickets.gif';
        $title[] = $current_module_strings['LBL_MY_TICKETS'];
        $title[] = 'home_mytkt';
        $header = array();
        $header[] = $current_module_strings['LBL_SUBJECT'];
        $header[] = $current_module_strings['Related To'];
        $noofrows = $adb->num_rows($tktresult);
        for ($i = 0; $i < $adb->num_rows($tktresult); $i++) {
            $value = array();
            $ticketid = $adb->query_result($tktresult, $i, "ticketid");
            $viewstatus = $adb->query_result($tktresult, $i, "viewstatus");
            if ($viewstatus == 'Unread') {
                $value[] = '<a style="color:red;" href="index.php?action=DetailView&module=HelpDesk&record=' . substr($adb->query_result($tktresult, $i, "ticketid"), 0, 20) . '">' . $adb->query_result($tktresult, $i, "title") . '</a>';
            } elseif ($viewstatus == 'Marked') {
                $value[] = '<a style="color:yellow;" href="index.php?action=DetailView&module=HelpDesk&record=' . substr($adb->query_result($tktresult, $i, "ticketid"), 0, 20) . '">' . $adb->query_result($tktresult, $i, "title") . '</a>';
            } else {
                $value[] = '<a href="index.php?action=DetailView&module=HelpDesk&record=' . substr($adb->query_result($tktresult, $i, "ticketid"), 0, 20) . '">' . substr($adb->query_result($tktresult, $i, "title"), 0, 20) . '</a>';
            }
            $parent_id = $adb->query_result($tktresult, $i, "parent_id");
            $parent_name = '';
            if ($parent_id != '' && $parent_id != NULL) {
                $parent_name = getParentLink($parent_id);
            }
            $value[] = $parent_name;
            $entries[$ticketid] = $value;
        }
        $advft_criteria_groups = array('1' => array('groupcondition' => null));
        $advft_criteria = array(array('groupid' => 1, 'columnname' => 'vtiger_troubletickets:status:ticketstatus:HelpDesk_Status:V', 'comparator' => 'n', 'value' => 'Closed', 'columncondition' => 'and'), array('groupid' => 1, 'columnname' => 'vtiger_crmentity:smownerid:assigned_user_id:HelpDesk_Assigned_To:V', 'comparator' => 'e', 'value' => getFullNameFromArray('Users', $current_user->column_fields), 'columncondition' => null));
        $search_qry = '&advft_criteria=' . Zend_Json::encode($advft_criteria) . '&advft_criteria_groups=' . Zend_Json::encode($advft_criteria_groups) . '&searchtype=advance&query=true';
        $values = array('ModuleName' => 'HelpDesk', 'Title' => $title, 'Header' => $header, 'Entries' => $entries, 'search_qry' => $search_qry);
        if ($noofrows == 0 || $noofrows > 0) {
            $log->debug("Exiting getMyTickets method ...");
            return $values;
        }
    }
    $log->debug("Exiting getMyTickets method ...");
}
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:54,代码来源:ListTickets.php

示例7: getModuleFilterDetails

 protected function getModuleFilterDetails($filterid)
 {
     global $adb;
     $result = $adb->pquery("SELECT * FROM vtiger_customview WHERE cvid=?", array($filterid));
     if ($result && $adb->num_rows($result)) {
         $resultrow = $adb->fetch_array($result);
         $module = $resultrow['entitytype'];
         $view = new CustomView($module);
         $viewid = $resultrow['cvid'];
         $view->getCustomViewByCvid($viewid);
         $viewQuery = $view->getModifiedCvListQuery($viewid, getListQuery($module), $module);
         $countResult = $adb->pquery(mkCountQuery($viewQuery), array());
         $count = 0;
         if ($countResult && $adb->num_rows($countResult)) {
             $count = $adb->query_result($countResult, 0, 'count');
         }
         $filter = $this->prepareFilterDetailUsingResultRow($resultrow);
         $filter['userName'] = getUserName($resultrow['userid']);
         $filter['count'] = $count;
         return $filter;
     }
 }
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:22,代码来源:FilterDetailsWithCount.php

示例8: getRequestCurrentPage

 public static function getRequestCurrentPage($relationId, $query)
 {
     global $list_max_entries_per_page, $adb, $log;
     $relstart = 1;
     if (!empty($_REQUEST['relstart'])) {
         $relstart = $_REQUEST['relstart'];
         if ($relstart == 'last') {
             $count_result = $adb->query(mkCountQuery($query));
             $noofrows = $adb->query_result($count_result, 0, 'count');
             if ($noofrows > 0) {
                 $relstart = ceil($noofrows / $list_max_entries_per_page);
             }
         }
         if (!is_numeric($relstart)) {
             $relstart = 1;
         } elseif ($relstart < 1) {
             $relstart = 1;
         }
         $relstart = ceil($relstart);
     } else {
         $relstart = RelatedListViewSession::getCurrentPage($relationId);
     }
     return $relstart;
 }
开发者ID:kduqi,项目名称:corebos,代码行数:24,代码来源:RelatedListViewSession.php

示例9: getPriceBookRelatedProducts

/**	Function to display the Products which are related to the PriceBook
 *	@param string $query - query to get the list of products which are related to the current PriceBook
 *	@param object $focus - PriceBook object which contains all the information of the current PriceBook
 *	@param string $returnset - return_module, return_action and return_id which are sequenced with & to pass to the URL which is optional
 *	return array $return_data which will be formed like array('header'=>$header,'entries'=>$entries_list) where as $header contains all the header columns and $entries_list will contain all the Product entries
 */
function getPriceBookRelatedProducts($query, $focus, $returnset = '')
{
    global $log;
    $log->debug("Entering getPriceBookRelatedProducts(" . $query . "," . get_class($focus) . "," . $returnset . ") method ...");
    global $adb;
    global $app_strings;
    global $mod_strings;
    global $current_language, $current_user;
    $current_module_strings = return_module_language($current_language, 'PriceBook');
    global $list_max_entries_per_page;
    global $urlPrefix;
    global $theme;
    $pricebook_id = vtlib_purify($_REQUEST['record']);
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    $noofrows = $adb->query_result($adb->query(mkCountQuery($query)), 0, 'count');
    $module = 'PriceBooks';
    $relatedmodule = 'Products';
    if (!$_SESSION['rlvs'][$module][$relatedmodule]) {
        $modObj = new ListViewSession();
        $modObj->sortby = $focus->default_order_by;
        $modObj->sorder = $focus->default_sort_order;
        $_SESSION['rlvs'][$module][$relatedmodule] = get_object_vars($modObj);
    }
    if (isset($_REQUEST['relmodule']) && $_REQUEST['relmodule'] != '' && $_REQUEST['relmodule'] == $relatedmodule) {
        $relmodule = vtlib_purify($_REQUEST['relmodule']);
        if ($_SESSION['rlvs'][$module][$relmodule]) {
            setSessionVar($_SESSION['rlvs'][$module][$relmodule], $noofrows, $list_max_entries_per_page, $module, $relmodule);
        }
    }
    $start = $_SESSION['rlvs'][$module][$relatedmodule]['start'];
    $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
    $start_rec = $navigation_array['start'];
    $end_rec = $navigation_array['end_val'];
    //limiting the query
    if ($start_rec == 0) {
        $limit_start_rec = 0;
    } else {
        $limit_start_rec = $start_rec - 1;
    }
    if ($adb->dbType == "pgsql") {
        $list_result = $adb->pquery($query . " OFFSET {$limit_start_rec} LIMIT {$list_max_entries_per_page}", array());
    } else {
        $list_result = $adb->pquery($query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
    }
    $header = array();
    $header[] = $mod_strings['LBL_LIST_PRODUCT_NAME'];
    if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0') {
        $header[] = $mod_strings['LBL_PRODUCT_CODE'];
    }
    if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0') {
        $header[] = $mod_strings['LBL_PRODUCT_UNIT_PRICE'];
    }
    $header[] = $mod_strings['LBL_PB_LIST_PRICE'];
    if (isPermitted("PriceBooks", "EditView", "") == 'yes' || isPermitted("PriceBooks", "Delete", "") == 'yes') {
        $header[] = $mod_strings['LBL_ACTION'];
    }
    $currency_id = $focus->column_fields['currency_id'];
    $numRows = $adb->num_rows($list_result);
    for ($i = 0; $i < $numRows; $i++) {
        $entity_id = $adb->query_result($list_result, $i, "crmid");
        $unit_price = $adb->query_result($list_result, $i, "unit_price");
        if ($currency_id != null) {
            $prod_prices = getPricesForProducts($currency_id, array($entity_id));
            $unit_price = $prod_prices[$entity_id];
        }
        $listprice = $adb->query_result($list_result, $i, "listprice");
        $field_name = $entity_id . "_listprice";
        $entries = array();
        $entries[] = textlength_check($adb->query_result($list_result, $i, "productname"));
        if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0') {
            $entries[] = $adb->query_result($list_result, $i, "productcode");
        }
        if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0') {
            $entries[] = $unit_price;
        }
        $entries[] = $listprice;
        $action = "";
        if (isPermitted("PriceBooks", "EditView", "") == 'yes') {
            $action .= '<img style="cursor:pointer;" src="' . vtiger_imageurl('editfield.gif', $theme) . '" border="0" onClick="fnvshobj(this,\'editlistprice\'),editProductListPrice(\'' . $entity_id . '\',\'' . $pricebook_id . '\',\'' . $listprice . '\')" alt="' . $app_strings["LBL_EDIT_BUTTON"] . '" title="' . $app_strings["LBL_EDIT_BUTTON"] . '"/>';
        }
        if (isPermitted("PriceBooks", "Delete", "") == 'yes') {
            if ($action != "") {
                $action .= '&nbsp;|&nbsp;';
            }
            $action .= '<img src="' . vtiger_imageurl('delete.gif', $theme) . '" onclick="if(confirm(\'' . $app_strings['ARE_YOU_SURE'] . '\')) deletePriceBookProductRel(' . $entity_id . ',' . $pricebook_id . ');" alt="' . $app_strings["LBL_DELETE"] . '" title="' . $app_strings["LBL_DELETE"] . '" style="cursor:pointer;" border="0">';
        }
        if ($action != "") {
            $entries[] = $action;
        }
        $entries_list[] = $entries;
    }
    if ($numRows > 0) {
        $module_rel = "{$module}&relmodule={$relatedmodule}&record=" . $focus->id;
//.........这里部分代码省略.........
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:101,代码来源:RelatedListView.php

示例10: getTodoList

/**
 * Function to get todos list scheduled between specified dates
 * @param array   $calendar              -  collection of objects and strings
 * @param string  $start_date            -  date string
 * @param string  $end_date              -  date string
 * @param string  $info                  -  string 'listcnt' or empty string. if 'listcnt' means it returns no. of todos and no. of pending todos in array format else it returns todos list in array format
 * return array   $Entries               -  todolists in array format
 */
function getTodoList(&$calendar, $start_date, $end_date, $info = '')
{
    global $log, $app_strings, $theme;
    $Entries = array();
    $category = getParentTab();
    global $adb, $current_user, $mod_strings, $cal_log, $list_max_entries_per_page;
    $cal_log->debug("Entering getTodoList() method...");
    require 'user_privileges/user_privileges_' . $current_user->id . '.php';
    require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
    $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
    $query = "SELECT vtiger_groups.groupname, {$userNameSql} as user_name, vtiger_crmentity.crmid, vtiger_cntactivityrel.contactid,\n\t\t\t\tvtiger_activity.* FROM vtiger_activity\n                INNER JOIN vtiger_crmentity\n\t\t\t\t\tON vtiger_crmentity.crmid = vtiger_activity.activityid\n                LEFT JOIN vtiger_cntactivityrel\n\t\t\t\t\tON vtiger_cntactivityrel.activityid = vtiger_activity.activityid\n\t\t\t\tLEFT JOIN vtiger_groups\n\t\t\t\t\tON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_users\n\t\t\t\t\tON vtiger_users.id = vtiger_crmentity.smownerid";
    $query .= getNonAdminAccessControlQuery('Calendar', $current_user);
    $query .= "WHERE vtiger_crmentity.deleted = 0 AND vtiger_activity.activitytype = 'Task'" . " AND ((CAST(CONCAT(date_start,' ',time_start) AS DATETIME) >= ? AND CAST(CONCAT(date_start,' ',time_start) AS DATETIME) <= ?)\n\t\t\t\t\t\t\tOR\t(CAST(CONCAT(due_date,' ',time_end) AS DATETIME) >= ? AND CAST(CONCAT(due_date,' ',time_end) AS DATETIME) <= ? )\n\t\t\t\t\t\t\tOR\t(CAST(CONCAT(date_start,' ',time_start) AS DATETIME) <= ? AND CAST(CONCAT(due_date,' ',time_end) AS DATETIME) >= ?)\n\t\t\t\t\t\t)";
    $list_query = $query . " AND vtiger_crmentity.smownerid = " . $current_user->id;
    $startDate = new DateTimeField($start_date . ' 00:00');
    $endDate = new DateTimeField($end_date . ' 23:59');
    $params = $info_params = array($startDate->getDBInsertDateTimeValue(), $endDate->getDBInsertDateTimeValue(), $startDate->getDBInsertDateTimeValue(), $endDate->getDBInsertDateTimeValue(), $startDate->getDBInsertDateTimeValue(), $endDate->getDBInsertDateTimeValue());
    if ($info != '') {
        //added to fix #4816
        $groupids = explode(",", fetchUserGroupids($current_user->id));
        if (count($groupids) > 0 && !is_admin($current_user)) {
            $com_q = " AND (vtiger_crmentity.smownerid = ?\n\t\t\t\t\tOR vtiger_groups.groupid in (" . generateQuestionMarks($groupids) . "))";
            array_push($info_params, $current_user->id);
            array_push($info_params, $groupids);
        } elseif (!is_admin($current_user)) {
            $com_q = " AND vtiger_crmentity.smownerid = ?";
            array_push($info_params, $current_user->id);
        }
        //end
        $pending_query = $query . " AND (vtiger_activity.status != 'Completed')" . $com_q;
        $total_q = $query . "" . $com_q;
        $total_res = $adb->pquery($total_q, $info_params);
        $total = $adb->num_rows($total_res);
        $res = $adb->pquery($pending_query, $info_params);
        $pending_rows = $adb->num_rows($res);
        $cal_log->debug("Exiting getTodoList() method...");
        return array('totaltodo' => $total, 'pendingtodo' => $pending_rows);
    }
    $group_cond = '';
    $group_cond .= " ORDER BY vtiger_activity.date_start,vtiger_activity.time_start ASC";
    if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
        $start = vtlib_purify($_REQUEST['start']);
    } else {
        $start = 1;
    }
    //T6477 changes
    if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true) {
        $count_res = $adb->pquery(mkCountQuery($query), $params);
        $total_rec_count = $adb->query_result($count_res, 0, 'count');
    } else {
        $total_rec_count = null;
    }
    $navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $total_rec_count);
    $start_rec = ($start - 1) * $list_max_entries_per_page;
    $end_rec = $navigation_array['end_val'];
    $list_query = $adb->convert2Sql($query, $params);
    $_SESSION['Calendar_listquery'] = $list_query;
    if ($start_rec < 0) {
        $start_rec = 0;
    }
    //ends
    $query .= $group_cond . " limit {$start_rec},{$list_max_entries_per_page}";
    $result = $adb->pquery($query, $params);
    $rows = $adb->num_rows($result);
    $c = 0;
    if ($start > 1) {
        $c = ($start - 1) * $list_max_entries_per_page;
    }
    for ($i = 0; $i < $rows; $i++) {
        $element = array();
        $contact_name = '';
        $element['no'] = $c + 1;
        $more_link = "";
        $start_time = $adb->query_result($result, $i, "time_start");
        $date_start = $adb->query_result($result, $i, "date_start");
        $due_date = $adb->query_result($result, $i, "due_date");
        $date = new DateTimeField($date_start . ' ' . $start_time);
        $endDate = new DateTimeField($due_date);
        if (!empty($start_time)) {
            $start_time = $date->getDisplayTime();
        }
        $format = $calendar['calendar']->hour_format;
        $value = getaddEventPopupTime($start_time, $start_time, $format);
        $element['starttime'] = $value['starthour'] . ':' . $value['startmin'] . '' . $value['startfmt'];
        $element['startdate'] = $date->getDisplayDate();
        $element['duedate'] = $endDate->getDisplayDate();
        $id = $adb->query_result($result, $i, "activityid");
        $subject = $adb->query_result($result, $i, "subject");
        $more_link = "<a href='index.php?action=DetailView&module=Calendar&record=" . $id . "&activity_mode=Task&viewtype=calendar&parenttab=" . $category . "' class='webMnu'>" . $subject . "</a>";
        $element['tododetail'] = $more_link;
        if (getFieldVisibilityPermission('Calendar', $current_user->id, 'taskstatus') == '0') {
            $taskstatus = $adb->query_result($result, $i, "status");
//.........这里部分代码省略.........
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:101,代码来源:calendarLayout.php

示例11: getModuleFilters

 /**
  * this function returns the widget information for an module type widget
  */
 private function getModuleFilters($sid)
 {
     global $adb, $current_user;
     $querycvid = "select vtiger_homemoduleflds.fieldname,vtiger_homemodule.* from vtiger_homemoduleflds\n\t\t\t\t\tleft join vtiger_homemodule on vtiger_homemodule.stuffid=vtiger_homemoduleflds.stuffid\n\t\t\t\t\twhere vtiger_homemoduleflds.stuffid=?";
     $resultcvid = $adb->pquery($querycvid, array($sid));
     $modname = $adb->query_result($resultcvid, 0, "modulename");
     $cvid = $adb->query_result($resultcvid, 0, "customviewid");
     $maxval = $adb->query_result($resultcvid, 0, "maxentries");
     $column_count = $adb->num_rows($resultcvid);
     $cvid_check_query = $adb->pquery("SELECT * FROM vtiger_customview WHERE cvid = ?", array($cvid));
     if (isPermitted($modname, 'index') == "yes") {
         if ($adb->num_rows($cvid_check_query) > 0) {
             $focus = CRMEntity::getInstance($modname);
             $oCustomView = new CustomView($modname);
             $queryGenerator = new QueryGenerator($modname, $current_user);
             $queryGenerator->initForCustomViewById($cvid);
             $customViewFields = $queryGenerator->getCustomViewFields();
             $fields = $queryGenerator->getFields();
             $newFields = array_diff($fields, $customViewFields);
             for ($l = 0; $l < $column_count; $l++) {
                 $customViewColumnInfo = $adb->query_result($resultcvid, $l, "fieldname");
                 $details = explode(':', $customViewColumnInfo);
                 $newFields[] = $details[2];
             }
             $queryGenerator->setFields($newFields);
             $query = $queryGenerator->getQuery();
             $count_result = $adb->query(mkCountQuery($query));
             $noofrows = $adb->query_result($count_result, 0, "count");
             $navigation_array = getNavigationValues(1, $noofrows, $maxval);
             //To get the current language file
             global $current_language, $app_strings;
             $fieldmod_strings = return_module_language($current_language, $modname);
             if ($adb->dbType == "pgsql") {
                 $list_result = $adb->query($query . " OFFSET 0 LIMIT " . $maxval);
             } else {
                 $list_result = $adb->query($query . " LIMIT 0," . $maxval);
             }
             $controller = new ListViewController($adb, $current_user, $queryGenerator);
             $controller->setHeaderSorting(false);
             $header = $controller->getListViewHeader($focus, $modname, '', '', '', true);
             $listview_entries = $controller->getListViewEntries($focus, $modname, $list_result, $navigation_array, true);
             $return_value = array('ModuleName' => $modname, 'cvid' => $cvid, 'Maxentries' => $maxval, 'Header' => $header, 'Entries' => $listview_entries);
             if (sizeof($header) != 0) {
                 return $return_value;
             } else {
                 return array('Entries' => "Fields not found in Selected Filter");
             }
         } else {
             return array('Entries' => "<font color='red'>Filter You have Selected is Not Found</font>");
         }
     } else {
         return array('Entries' => "<font color='red'>Permission Denied</font>");
     }
 }
开发者ID:hardikk,项目名称:HNH,代码行数:57,代码来源:home.php

示例12: getMyFaq

/**	function used to get the top 5 recent FAQs from Listview query
 *	@return array $values - array with the title, header and entries like  Array('Title'=>$title,'Header'=>$listview_header,'Entries'=>$listview_entries) where as listview_header and listview_entries are arrays of header and entity values which are returned from function getListViewHeader and getListViewEntries
 */
function getMyFaq($maxval, $calCnt)
{
    require_once "data/Tracker.php";
    require_once 'modules/Faq/Faq.php';
    require_once 'include/logging.php';
    require_once 'include/ListView/ListView.php';
    require_once 'include/utils/utils.php';
    require_once 'modules/CustomView/CustomView.php';
    global $current_language, $current_user, $list_max_entries_per_page, $adb;
    $current_module_strings = return_module_language($current_language, 'Faq');
    $url_string = '';
    $sorder = '';
    $oCustomView = new CustomView("Faq");
    if (isset($_REQUEST['viewname']) == false || $_REQUEST['viewname'] == '') {
        if ($oCustomView->setdefaultviewid != "") {
            $viewid = $oCustomView->setdefaultviewid;
        } else {
            $viewid = "0";
        }
    }
    $focus = new Faq();
    //Retreive the list from Database
    //<<<<<<<<<customview>>>>>>>>>
    $currentModule = 'Faq';
    $viewId = getCvIdOfAll($currentModule);
    $queryGenerator = new QueryGenerator($currentModule, $current_user);
    $queryGenerator->initForCustomViewById($viewId);
    $meta = $queryGenerator->getMeta($currentModule);
    $accessibleFieldNameList = array_keys($meta->getModuleFields());
    $customViewFields = $queryGenerator->getCustomViewFields();
    $fields = $queryGenerator->getFields();
    $newFields = array_diff($fields, $customViewFields);
    $widgetFieldsList = array('question', 'product_id');
    $widgetFieldsList = array_intersect($accessibleFieldNameList, $widgetFieldsList);
    $widgetSelectedFields = array_chunk(array_intersect($customViewFields, $widgetFieldsList), 2);
    //select the first chunk of two fields
    $widgetSelectedFields = $widgetSelectedFields[0];
    if (count($widgetSelectedFields) < 2) {
        $widgetSelectedFields = array_chunk(array_merge($widgetSelectedFields, $accessibleFieldNameList), 2);
        //select the first chunk of two fields
        $widgetSelectedFields = $widgetSelectedFields[0];
    }
    $newFields = array_merge($newFields, $widgetSelectedFields);
    $queryGenerator->setFields($newFields);
    $_REQUEST = getMyFaqSearch($_REQUEST);
    $queryGenerator->addUserSearchConditions($_REQUEST);
    $search_qry = '&query=true' . getSearchURL($_REQUEST);
    $query = $queryGenerator->getQuery();
    //<<<<<<<<customview>>>>>>>>>
    $query .= " LIMIT 0," . $adb->sql_escape_string($maxval);
    if ($calCnt == 'calculateCnt') {
        $list_result_rows = $adb->query(mkCountQuery($query));
        return $adb->query_result($list_result_rows, 0, 'count');
    }
    $list_result = $adb->query($query);
    //Retreiving the no of rows
    $noofrows = $adb->num_rows($list_result);
    //Retreiving the start value from request
    if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
        $start = vtlib_purify($_REQUEST['start']);
    } else {
        $start = 1;
    }
    //Retreive the Navigation array
    $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
    if ($navigation_array['start'] == 1) {
        if ($noofrows != 0) {
            $start_rec = $navigation_array['start'];
        } else {
            $start_rec = 0;
        }
        if ($noofrows > $list_max_entries_per_page) {
            $end_rec = $navigation_array['start'] + $list_max_entries_per_page - 1;
        } else {
            $end_rec = $noofrows;
        }
    } else {
        if ($navigation_array['next'] > $list_max_entries_per_page) {
            $start_rec = $navigation_array['next'] - $list_max_entries_per_page;
            $end_rec = $navigation_array['next'] - 1;
        } else {
            $start_rec = $navigation_array['prev'] + $list_max_entries_per_page;
            $end_rec = $noofrows;
        }
    }
    //Retreive the List View Table Header
    $title = array('myFaqs.gif', $current_module_strings['LBL_MY_FAQ'], 'home_myfaq');
    $controller = new ListViewController($adb, $current_user, $queryGenerator);
    $controller->setHeaderSorting(false);
    $header = $controller->getListViewHeader($focus, $currentModule, $url_string, $sorder, $order_by, true);
    $entries = $controller->getListViewEntries($focus, $currentModule, $list_result, $navigation_array, true);
    $values = array('ModuleName' => 'Faq', 'Title' => $title, 'Header' => $header, 'Entries' => $entries, 'search_qry' => $search_qry);
    if ($noofrows == 0 || $noofrows > 0) {
        return $values;
    }
}
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:99,代码来源:ListFaq.php

示例13: GetRelatedList

/** Function to get related list entries in detailed array format
 * @param $module -- modulename:: Type string
 * @param $relatedmodule -- relatedmodule:: Type string
 * @param $focus -- focus:: Type object
 * @param $query -- query:: Type string
 * @param $button -- buttons:: Type string
 * @param $returnset -- returnset:: Type string
 * @param $id -- id:: Type string
 * @param $edit_val -- edit value:: Type string
 * @param $del_val -- delete value:: Type string
 * @returns $related_entries -- related entires:: Type string array
 *
 */
function GetRelatedList($module, $relatedmodule, $focus, $query, $button, $returnset, $id = '', $edit_val = '', $del_val = '')
{
    global $log;
    //changed by dingjianting on 2007-11-05 for php5.2.x
    $log->debug("Entering GetRelatedList() method ...");
    require_once 'include/CRMSmarty.php';
    require_once 'include/DatabaseUtil.php';
    global $adb;
    global $app_strings;
    global $current_language;
    $current_module_strings = return_module_language($current_language, $module);
    global $list_max_entries_per_page;
    global $urlPrefix;
    global $currentModule;
    global $theme;
    global $theme_path;
    global $mod_strings;
    $list_max_entries_per_page = 10000;
    // focus_list is the means of passing data to a ListView.
    global $focus_list;
    $smarty = new CRMSmarty();
    if (!isset($where)) {
        $where = "";
    }
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    $smarty->assign("MOD", $mod_strings);
    $smarty->assign("APP", $app_strings);
    $smarty->assign("IMAGE_PATH", $image_path);
    $smarty->assign("MODULE", $relatedmodule);
    if (isset($where) && $where != '') {
        $query .= ' and ' . $where;
    }
    /*
    if(!isset($_SESSION['rlvs'][$module][$relatedmodule]) || !$_SESSION['rlvs'][$module][$relatedmodule])
    {
    	$modObj = new ListViewSession();
    	$modObj->sortby = $focus->default_order_by;
    	$modObj->sorder = $focus->default_sort_order;
    	$_SESSION['rlvs'][$module][$relatedmodule] = get_object_vars($modObj);
    }
    */
    if (empty($order_by)) {
        $order_by = $focus->entity_table . "." . $focus->default_order_by;
    }
    if (empty($sorder)) {
        $sorder = $focus->default_sort_order;
    }
    $url_qry = "&order_by=" . $order_by;
    $count_query = mkCountQuery($query);
    $count_result = $adb->query($count_query);
    $noofrows = $adb->query_result($count_result, 0, "count");
    //Setting Listview session object while sorting/pagination
    if (isset($_REQUEST['relmodule']) && $_REQUEST['relmodule'] != '' && $_REQUEST['relmodule'] == $relatedmodule) {
        if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
            $start = $_REQUEST['start'];
        } else {
            $start = 1;
        }
    } else {
        $start = 1;
    }
    $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
    $start_rec = $navigation_array['start'];
    $end_rec = $navigation_array['end_val'];
    //limiting the query
    if ($start_rec <= 0) {
        $limit_start_rec = 0;
    } else {
        $limit_start_rec = $start_rec - 1;
    }
    //$list_result = $adb->limitQuery2($query,$limit_start_rec,$list_max_entries_per_page,$order_by,$sorder);
    $list_result = $adb->limitQuery($query, $limit_start_rec, $list_max_entries_per_page, $order_by, $sorder);
    //Retreive the List View Table Header
    if ($noofrows == 0) {
        $smarty->assign('NOENTRIES', $app_strings['LBL_NONE_SCHEDULED']);
    } else {
        setRelmodFieldList($relatedmodule, $focus);
        //set more module field
        $id = $_REQUEST['record'];
        $listview_header = getListViewHeader($focus, $relatedmodule, '', $sorder, $order_by, $id, '', $module);
        //"Accounts");
        if ($noofrows > 15) {
            $smarty->assign('SCROLLSTART', '<div style="overflow:auto;height:315px;width:100%;">');
            $smarty->assign('SCROLLSTOP', '</div>');
        }
        $smarty->assign("LISTHEADER", $listview_header);
//.........这里部分代码省略.........
开发者ID:Pengzw,项目名称:c3crm,代码行数:101,代码来源:RelatedListView.php

示例14: query

 function query()
 {
     $sql = Mobile_WS_Utils::getModuleListQuery('Potentials', "vtiger_potential.sales_stage not like 'Closed%' AND \n\t\t\t\t\tDATEDIFF(vtiger_potential.closingdate, CURDATE()) <= 5");
     return preg_replace("/^SELECT count\\(\\*\\) as count(.*)/i", "SELECT crmid \$1", mkCountQuery($sql));
 }
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:5,代码来源:PotentialsDueIn5Days.php

示例15: getModuleFilters

 private function getModuleFilters($sid)
 {
     global $adb, $current_user;
     $querycvid = "select ec_homemoduleflds.fieldname,ec_homemodule.* from ec_homemoduleflds left join ec_homemodule on ec_homemodule.stuffid=ec_homemoduleflds.stuffid where ec_homemoduleflds.stuffid=" . $sid;
     $resultcvid = $adb->query($querycvid);
     $modname = $adb->query_result($resultcvid, 0, "modulename");
     $cvid = $adb->query_result($resultcvid, 0, "customviewid");
     $maxval = $adb->query_result($resultcvid, 0, "maxentries");
     $column_count = $adb->num_rows($resultcvid);
     $cvid_check_query = $adb->pquery("SELECT * FROM ec_customview WHERE cvid = '{$cvid}'");
     if (isPermitted($modname, 'index') == "yes") {
         if ($adb->num_rows($cvid_check_query) > 0) {
             if ($modname == 'Calendar') {
                 require_once "modules/Calendar/Activity.php";
                 $focus = new Activity();
             } else {
                 require_once "modules/{$modname}/{$modname}.php";
                 $focus = new $modname();
             }
             $oCustomView = new CustomView($modname);
             $listquery = getListQuery($modname);
             if (trim($listquery) == '') {
                 $listquery = $focus->getListQuery($modname);
             }
             $query = $oCustomView->getModifiedCvListQuery($cvid, $listquery, $modname);
             $count_result = $adb->query(mkCountQuery($query));
             $noofrows = $adb->query_result($count_result, 0, "count");
             $navigation_array = getNavigationValues(1, $noofrows, $maxval);
             //To get the current language file
             global $current_language, $app_strings;
             $fieldmod_strings = return_module_language($current_language, $modname);
             if ($modname == 'Calendar') {
                 $query .= "AND ec_activity.activitytype NOT IN ('Emails')";
             }
             if ($adb->dbType == "pgsql") {
                 $list_result = $adb->query($query . " OFFSET 0 LIMIT " . $maxval);
             } else {
                 $list_result = $adb->query($query . " LIMIT 0," . $maxval);
             }
             for ($l = 0; $l < $column_count; $l++) {
                 $fieldinfo = $adb->query_result($resultcvid, $l, "fieldname");
                 list($tabname, $colname, $fldname, $fieldmodlabel) = explode(":", $fieldinfo);
                 //For Header starts
                 $fieldheader = explode("_", $fieldmodlabel, 2);
                 $fldlabel = $fieldheader[1];
                 $pos = strpos($fldlabel, "_");
                 if ($pos == true) {
                     $fldlabel = str_replace("_", " ", $fldlabel);
                 }
                 $field_label = isset($app_strings[$fldlabel]) ? $app_strings[$fldlabel] : (isset($fieldmod_strings[$fldlabel]) ? $fieldmod_strings[$fldlabel] : $fldlabel);
                 $cv_presence = $adb->query("SELECT * from ec_cvcolumnlist WHERE cvid = {$cvid} and columnname LIKE '%" . $fldname . "%'");
                 if ($is_admin == false) {
                     $fld_permission = getFieldVisibilityPermission($modname, $current_user->id, $fldname);
                 }
                 if ($fld_permission == 0 && $adb->num_rows($cv_presence)) {
                     $field_query = $adb->query("SELECT fieldlabel FROM ec_field WHERE fieldname = '{$fldname}' AND tablename = '{$tabname}'");
                     $field_label = $adb->query_result($field_query, 0, 'fieldlabel');
                     $header[] = $field_label;
                 }
                 $fieldcolumns[$fldlabel] = array($tabname => $colname);
                 //For Header ends
             }
             $listview_entries = getListViewEntries($focus, $modname, $list_result, $navigation_array, "", "", "EditView", "Delete", $oCustomView, 'HomePage', $fieldcolumns);
             $return_value = array('ModuleName' => $modname, 'cvid' => $cvid, 'Maxentries' => $maxval, 'Header' => $header, 'Entries' => $listview_entries);
             if (sizeof($header) != 0) {
                 return $return_value;
             } else {
                 echo "Fields not found in Selected Filter";
             }
         } else {
             echo "<font color='red'>Filter You have Selected is Not Found</font>";
         }
     } else {
         echo "<font color='red'>Permission Denied</font>";
     }
 }
开发者ID:Pengzw,项目名称:c3crm,代码行数:76,代码来源:home.php


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