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


PHP Vtiger_Functions::mkCountQuery方法代码示例

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


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

示例1: getKeyMetricsWithCount

 protected function getKeyMetricsWithCount()
 {
     global $current_user, $adb;
     $current_user = Users_Record_Model::getCurrentUserModel();
     require_once 'modules/CustomView/ListViewTop.php';
     $metriclists = getMetricList();
     foreach ($metriclists as $key => $metriclist) {
         $metricresult = NULL;
         if ($metriclist['module'] == "Calendar") {
             $listquery = getListQuery($metriclist['module']);
             $oCustomView = new CustomView($metriclist['module']);
             $metricsql = $oCustomView->getModifiedCvListQuery($metriclist['id'], $listquery, $metriclist['module']);
             $metricresult = $adb->query(Vtiger_Functions::mkCountQuery($metricsql));
         } else {
             $queryGenerator = new QueryGenerator($metriclist['module'], $current_user);
             $queryGenerator->initForCustomViewById($metriclist['id']);
             $metricsql = $queryGenerator->getQuery();
             $metricresult = $adb->query(Vtiger_Functions::mkCountQuery($metricsql));
         }
         if ($metricresult) {
             $rowcount = $adb->fetch_array($metricresult);
             $metriclists[$key]['count'] = $rowcount['count'];
         }
     }
     return $metriclists;
 }
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:26,代码来源:Notebook.php

示例2: getKeyMetricsWithCount

 protected function getKeyMetricsWithCount()
 {
     global $log;
     $log->debug("Entering ./dashboards/KeyMetrics.php::getKeyMetricsWithCount");
     global $current_user, $adb;
     $current_user = Users_Record_Model::getCurrentUserModel();
     require_once 'modules/CustomView/ListViewTop.php';
     $metriclists = getMetricList();
     foreach ($metriclists as $key => $metriclist) {
         $metricresult = NULL;
         $queryGenerator = new QueryGenerator($metriclist['module'], $current_user);
         $queryGenerator->initForCustomViewById($metriclist['id']);
         if ($metriclist['module'] == "Calendar") {
             // For calendar we need to eliminate emails or else it will break in status empty condition
             $queryGenerator->addCondition('activitytype', "Emails", 'n', QueryGenerator::$AND);
         }
         $metricsql = $queryGenerator->getQuery();
         $metricresult = $adb->query(Vtiger_Functions::mkCountQuery($metricsql));
         if ($metricresult) {
             $rowcount = $adb->fetch_array($metricresult);
             $metriclists[$key]['count'] = $rowcount['count'];
         }
     }
     return $metriclists;
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:25,代码来源:KeyMetrics.php

示例3: 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(Vtiger_Functions::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:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:22,代码来源:FilterDetailsWithCount.php

示例4: 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');
    $no_of_decimal_places = getCurrencyDecimalPlaces();
    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/";
    $computeCount = $_REQUEST['withCount'];
    if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true || (bool) $computeCount == true) {
        $noofrows = $adb->query_result($adb->query(Vtiger_Functions::mkCountQuery($query)), 0, 'count');
    } else {
        $noofrows = null;
    }
    $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);
        }
    }
    global $relationId;
    $start = RelatedListViewSession::getRequestCurrentPage($relationId, $query);
    $navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
    $limit_start_rec = ($start - 1) * $list_max_entries_per_page;
    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[] = CurrencyField::convertToUserFormat($unit_price, null, true);
        }
        $entries[] = CurrencyField::convertToUserFormat($listprice, null, true);
        $action = "";
        if (isPermitted("PriceBooks", "EditView", "") == 'yes' && isPermitted('Products', 'EditView', $entity_id) == 'yes') {
            $action .= '<img style="cursor:pointer;" src="' . vtiger_imageurl('editfield.gif', $theme) . '" border="0" onClick="fnvshobj(this,\'editlistprice\'),editProductListPrice(\'' . $entity_id . '\',\'' . $pricebook_id . '\',\'' . number_format($listprice, $no_of_decimal_places, '.', '') . '\')" alt="' . $app_strings["LBL_EDIT_BUTTON"] . '" title="' . $app_strings["LBL_EDIT_BUTTON"] . '"/>';
        } else {
            $action .= '<img src="' . vtiger_imageurl('blank.gif', $theme) . '" border="0" />';
        }
        if (isPermitted("PriceBooks", "Delete", "") == 'yes' && isPermitted('Products', 'Delete', $entity_id) == '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;
    }
//.........这里部分代码省略.........
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:101,代码来源:RelatedListView.php

示例5: getRequestCurrentPage

 function getRequestCurrentPage($currentModule, $query, $viewid, $queryMode = false)
 {
     global $list_max_entries_per_page, $adb;
     $start = 1;
     if (isset($_REQUEST['query']) && $_REQUEST['query'] == 'true' && $_REQUEST['start'] != "last") {
         return ListViewSession::getRequestStartPage();
     }
     if (!empty($_REQUEST['start'])) {
         $start = $_REQUEST['start'];
         if ($start == 'last') {
             $count_result = $adb->query(Vtiger_Functions::mkCountQuery($query));
             $noofrows = $adb->query_result($count_result, 0, "count");
             if ($noofrows > 0) {
                 $start = ceil($noofrows / $list_max_entries_per_page);
             }
         }
         if (!is_numeric($start)) {
             $start = 1;
         } elseif ($start < 1) {
             $start = 1;
         }
         $start = ceil($start);
     } else {
         if (!empty($_SESSION['lvs'][$currentModule][$viewid]['start'])) {
             $start = $_SESSION['lvs'][$currentModule][$viewid]['start'];
         }
     }
     if (!$queryMode) {
         $_SESSION['lvs'][$currentModule][$viewid]['start'] = intval($start);
     }
     return $start;
 }
开发者ID:gitter-badger,项目名称:openshift-salesplatform,代码行数:32,代码来源:ListViewSession.php

示例6: getKeyMetrics

/** to get the details of a KeyMetrics on Home page 
* @returns  $customviewlist Array in the following format
* $values = Array('Title'=>Array(0=>'image name',
*				 1=>'Key Metrics',
*			 	 2=>'home_metrics'
*			 	),
*		  'Header'=>Array(0=>'Metrics',
*	  			  1=>'Count'
*			  	),
*		  'Entries'=>Array($cvid=>Array(
*			  			0=>$customview name,
*						1=>$no of records for the view
*					       ),
*				   $cvid=>Array(
*                                               0=>$customview name,
*                                               1=>$no of records for the view
*                                              ),
*					|
*					|
*				   $cvid=>Array(
*                                               0=>$customview name,
*                                               1=>$no of records for the view
*                                              )	
*				  )
*
*/
function getKeyMetrics($maxval, $calCnt)
{
    require_once "include/Tracker.php";
    require_once 'modules/CustomView/CustomView.php';
    require_once 'include/logging.php';
    require_once 'include/ListView/ListView.php';
    global $app_strings;
    $adb = PearDatabase::getInstance();
    $log = vglobal('log');
    $metricviewnames = "'Hot Leads'";
    $current_language = vglobal('current_language');
    $current_module_strings = return_module_language($current_language, "CustomView");
    $log = LoggerManager::getLogger('metrics');
    $metriclists = getMetricList();
    // Determine if the KeyMetrics widget should appear or not?
    if ($calCnt == 'calculateCnt') {
        return count($metriclists);
    }
    $log->info("Metrics :: Successfully got MetricList to be displayed");
    if (isset($metriclists)) {
        $current_user = vglobal('current_user');
        foreach ($metriclists as $key => $metriclist) {
            if ($metriclist['module'] == "Calendar") {
                $listquery = getListQuery($metriclist['module']);
                $oCustomView = new CustomView($metriclist['module']);
                $metricsql = $oCustomView->getModifiedCvListQuery($metriclist['id'], $listquery, $metriclist['module']);
                $metricsql = Vtiger_Functions::mkCountQuery($metricsql);
                $metricresult = $adb->query($metricsql);
                if ($metricresult) {
                    $rowcount = $adb->fetch_array($metricresult);
                    $metriclists[$key]['count'] = $rowcount['count'];
                }
            } else {
                $queryGenerator = new QueryGenerator($metriclist['module'], $current_user);
                $queryGenerator->initForCustomViewById($metriclist['id']);
                $metricsql = $queryGenerator->getQuery();
                $metricsql = Vtiger_Functions::mkCountQuery($metricsql);
                $metricresult = $adb->query($metricsql);
                if ($metricresult) {
                    $rowcount = $adb->fetch_array($metricresult);
                    $metriclists[$key]['count'] = $rowcount['count'];
                }
            }
        }
        $log->info("Metrics :: Successfully build the Metrics");
    }
    $title = array();
    $title[] = 'keyMetrics.gif';
    $title[] = $app_strings['LBL_HOME_KEY_METRICS'];
    $title[] = 'home_metrics';
    $header = array();
    $header[] = $app_strings['LBL_HOME_METRICS'];
    $header[] = $app_strings['LBL_MODULE'];
    $header[] = $app_strings['LBL_HOME_COUNT'];
    $entries = array();
    if (isset($metriclists)) {
        $oddRow = true;
        foreach ($metriclists as $metriclist) {
            $value = array();
            $CVname = strlen($metriclist['name']) > 20 ? substr($metriclist['name'], 0, 20) . '...' : $metriclist['name'];
            $value[] = '<a href="index.php?action=ListView&module=' . $metriclist['module'] . '&viewname=' . $metriclist['id'] . '">' . $CVname . '</a> <font style="color:#6E6E6E;">(' . $metriclist['user'] . ')</font>';
            $value[] = '<a href="index.php?action=ListView&module=' . $metriclist['module'] . '&viewname=' . $metriclist['id'] . '">' . getTranslatedString($metriclist['module']) . '</a>';
            $value[] = '<a href="index.php?action=ListView&module=' . $metriclist['module'] . '&viewname=' . $metriclist['id'] . '">' . $metriclist['count'] . '</a>';
            $entries[$metriclist['id']] = $value;
        }
    }
    $values = array('Title' => $title, 'Header' => $header, 'Entries' => $entries);
    if ($display_empty_home_blocks || count($value) != 0) {
        return $values;
    }
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:97,代码来源:ListViewTop.php

示例7: getRequestCurrentPage

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

示例8: 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", Vtiger_Functions::mkCountQuery($sql));
 }
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:5,代码来源:PotentialsDueIn5Days.php

示例9: countQuery

 protected function countQuery()
 {
     return Vtiger_Functions::mkCountQuery($this->query());
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:4,代码来源:Alert.php

示例10: getSearchURL

 $queryGenerator->initForCustomViewById($viewid);
 // Enabling Module Search
 $url_string = '';
 if ($_REQUEST['query'] == 'true') {
     $queryGenerator->addUserSearchConditions($_REQUEST);
     $ustring = getSearchURL($_REQUEST);
     $url_string .= "&query=true{$ustring}";
     $smarty->assign('SEARCH_URL', $url_string);
 }
 $list_query = $queryGenerator->getQuery();
 $list_query = preg_replace("/vtiger_crmentity.deleted\\s*=\\s*0/i", 'vtiger_crmentity.deleted = 1', $list_query);
 //Search criteria added to the list Query
 if (isset($where) && $where != '') {
     $list_query .= ' AND ' . $where;
 }
 $count_result = $adb->query(Vtiger_Functions::mkCountQuery($list_query));
 $noofrows = $adb->query_result($count_result, 0, "count");
 $smarty->assign("NUMOFROWS", $noofrows);
 $controller = new ListViewController($adb, $current_user, $queryGenerator);
 $rb_listview_header = $controller->getListViewHeader($focus, $select_module, $url_string, $sorder, $order_by, true);
 $listview_header_search = $controller->getBasicSearchFieldInfoList();
 $smarty->assign("SEARCHLISTHEADER", $listview_header_search);
 if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
     $start = vtlib_purify($_REQUEST['start']);
 } else {
     $start = 1;
 }
 $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
 // Setting the record count string
 //modified by rdhital
 $start_rec = $navigation_array['start'];
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:31,代码来源:ListView.php


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