本文整理汇总了PHP中ListViewController::setHeaderSorting方法的典型用法代码示例。如果您正苦于以下问题:PHP ListViewController::setHeaderSorting方法的具体用法?PHP ListViewController::setHeaderSorting怎么用?PHP ListViewController::setHeaderSorting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListViewController
的用法示例。
在下文中一共展示了ListViewController::setHeaderSorting方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
if ($modname == "Calendar") {
$listquery = getListQuery($modname);
if (trim($listquery) == '') {
$listquery = $focus->getListQuery($modname);
}
$query = $oCustomView->getModifiedCvListQuery($cvid, $listquery, $modname);
} else {
$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 ($modname == "Calendar") {
$query .= "AND vtiger_activity.activitytype NOT IN ('Emails')";
}
$list_result = $adb->query($query . " LIMIT 0," . $maxval);
if ($modname == "Calendar") {
for ($l = 0; $l < $column_count; $l++) {
$fieldinfo = $adb->query_result($resultcvid, $l, "fieldname");
list($tabname, $colname, $fldname, $fieldmodlabel) = explode(":", $fieldinfo);
$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->pquery("SELECT * from vtiger_cvcolumnlist WHERE cvid = ? and columnname LIKE '%" . $fldname . "%'", array($cvid));
if ($is_admin == false) {
$fld_permission = getFieldVisibilityPermission($modname, $current_user->id, $fldname);
}
if ($fld_permission == 0 && $adb->num_rows($cv_presence)) {
$field_query = $adb->pquery("SELECT fieldlabel FROM vtiger_field WHERE fieldname = ? AND tablename = ? and vtiger_field.presence in (0,2)", array($fldname, $tabname));
$field_label = $adb->query_result($field_query, 0, 'fieldlabel');
$header[] = $field_label;
}
$fieldcolumns[$fldlabel] = array($tabname => $colname);
}
$listview_entries = getListViewEntries($focus, $modname, $list_result, $navigation_array, "", "", "EditView", "Delete", $oCustomView, 'HomePage', $fieldcolumns);
} else {
$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>");
}
}
示例2: 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;
}
}
示例3: getTopQuotes
/** function used to get the top 5 quotes from the 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 getTopQuotes($maxval, $calCnt)
{
require_once "data/Tracker.php";
require_once 'modules/Quotes/Quotes.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 $app_strings, $current_language, $current_user;
$current_module_strings = return_module_language($current_language, 'Quotes');
global $list_max_entries_per_page, $adb, $theme, $mod_strings;
$log = LoggerManager::getLogger('quote_list');
$url_string = '';
$sorder = '';
$oCustomView = new CustomView("Quotes");
$customviewcombo_html = $oCustomView->getCustomViewCombo();
if (isset($_REQUEST['viewname']) == false || $_REQUEST['viewname'] == '') {
if ($oCustomView->setdefaultviewid != "") {
$viewid = $oCustomView->setdefaultviewid;
} else {
$viewid = "0";
}
}
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
//Retreive the list from Database
//<<<<<<<<<customview>>>>>>>>>
$date_var = date('Y-m-d');
$currentModule = 'Quotes';
$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('subject', 'potential_id', 'account_id', 'total');
$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 = getTopQuotesSearch($_REQUEST, array('assigned_user_id' => $current_user->column_fields['user_name'], 'validtill' => $date_var, 'quotestage.Rejected' => $current_module_strings['Rejected'], 'quotestage.Accepted' => $current_module_strings['Accepted']));
$queryGenerator->addUserSearchConditions($_REQUEST);
$search_qry = '&query=true' . getSearchURL($_REQUEST);
$query = $queryGenerator->getQuery();
//<<<<<<<<customview>>>>>>>>>
$query .= " LIMIT " . $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;
}
}
$focus = new Quotes();
$title = array('TopOpenQuotes.gif', $current_module_strings['LBL_MY_TOP_QUOTE'], 'home_mytopquote');
//Retreive the List View Table Header
$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);
//.........这里部分代码省略.........
示例4: 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>");
}
}