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


PHP SugarBean::isFavoritesEnabled方法代码示例

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


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

示例1: getListViewData

 /**
 * takes in a seed and creates the list view query based off of that seed
 * if the $limit value is set to -1 then it will use the default limit and offset values
 *
 * it will return an array with two key values
 * 	1. 'data'=> this is an array of row data
 *  2. 'pageData'=> this is an array containg three values
 * 			a.'ordering'=> array('orderBy'=> the field being ordered by , 'sortOrder'=> 'ASC' or 'DESC')
 * 			b.'urls'=>array('baseURL'=>url used to generate other urls ,
 * 							'orderBy'=> the base url for order by
 * 							//the following may not be set (so check empty to see if they are set)
 * 							'nextPage'=> the url for the next group of results,
 * 							'prevPage'=> the url for the prev group of results,
 * 							'startPage'=> the url for the start of the group,
 * 							'endPage'=> the url for the last set of results in the group
 * 			c.'offsets'=>array(
 * 								'current'=>current offset
 * 								'next'=> next group offset
 * 								'prev'=> prev group offset
 * 								'end'=> the offset of the last group
 * 								'total'=> the total count (only accurate if totalCounted = true otherwise it is either the total count if less than the limit or the total count + 1 )
 * 								'totalCounted'=> if a count query was used to get the total count
 *
 * @param SugarBean $seed
 * @param string $where
 * @param int:0 $offset
 * @param int:-1 $limit
 * @param string[]:array() $filter_fields
 * @param array:array() $params
 * 	Potential $params are
 		$params['distinct'] = use distinct key word
 		$params['include_custom_fields'] = (on by default)
         $params['custom_XXXX'] = append custom statements to query
 * @param string:'id' $id_field
 * @return array('data'=> row data, 'pageData' => page data information, 'query' => original query string)
 */
 function getListViewData($seed, $where, $offset = -1, $limit = -1, $filter_fields = array(), $params = array(), $id_field = 'id', $singleSelect = true)
 {
     global $current_user;
     SugarVCR::erase($seed->module_dir);
     $this->seed = $seed;
     $totalCounted = empty($GLOBALS['sugar_config']['disable_count_query']);
     $_SESSION['MAILMERGE_MODULE_FROM_LISTVIEW'] = $seed->module_dir;
     if (empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') {
         $_SESSION['MAILMERGE_MODULE'] = $seed->module_dir;
     }
     $this->setVariableName($seed->object_name, $where, $this->listviewName);
     $this->seed->id = '[SELECT_ID_LIST]';
     // if $params tell us to override all ordering
     if (!empty($params['overrideOrder']) && !empty($params['orderBy'])) {
         $order = $this->getOrderBy(strtolower($params['orderBy']), empty($params['sortOrder']) ? '' : $params['sortOrder']);
         // retreive from $_REQUEST
     } else {
         $order = $this->getOrderBy();
         // retreive from $_REQUEST
     }
     // still empty? try to use settings passed in $param
     if (empty($order['orderBy']) && !empty($params['orderBy'])) {
         $order['orderBy'] = $params['orderBy'];
         $order['sortOrder'] = empty($params['sortOrder']) ? '' : $params['sortOrder'];
     }
     //rrs - bug: 21788. Do not use Order by stmts with fields that are not in the query.
     // Bug 22740 - Tweak this check to strip off the table name off the order by parameter.
     // Samir Gandhi : Do not remove the report_cache.date_modified condition as the report list view is broken
     $orderby = $order['orderBy'];
     if (strpos($order['orderBy'], '.') && $order['orderBy'] != "report_cache.date_modified") {
         $orderby = substr($order['orderBy'], strpos($order['orderBy'], '.') + 1);
     }
     if ($orderby != 'date_entered' && !in_array($orderby, array_keys($filter_fields))) {
         $order['orderBy'] = '';
         $order['sortOrder'] = '';
     }
     if (empty($order['orderBy'])) {
         $orderBy = '';
     } else {
         $orderBy = $order['orderBy'] . ' ' . $order['sortOrder'];
         //wdong, Bug 25476, fix the sorting problem of Oracle.
         if (isset($params['custom_order_by_override']['ori_code']) && $order['orderBy'] == $params['custom_order_by_override']['ori_code']) {
             $orderBy = $params['custom_order_by_override']['custom_code'] . ' ' . $order['sortOrder'];
         }
     }
     if (empty($params['skipOrderSave'])) {
         // don't save preferences if told so
         $current_user->setPreference('listviewOrder', $order, 0, $this->var_name);
         // save preference
     }
     if ($seed->isFavoritesEnabled()) {
         $params['favorites'] = !empty($_REQUEST['my_favorites']) ? 2 : 1;
     }
     //Make sure all dependent fields have thier required data
     require_once "include/Expressions/DependencyManager.php";
     $triggers = DependencyManager::getDependentFieldTriggerFields($filter_fields, $this->seed->field_defs);
     foreach ($triggers as $field) {
         $filter_fields[$field] = true;
     }
     // If $params tells us to override for the special last_name, first_name sorting
     if (!empty($params['overrideLastNameOrder']) && $order['orderBy'] == 'last_name') {
         $orderBy = 'last_name ' . $order['sortOrder'] . ', first_name ' . $order['sortOrder'];
     }
     $ret_array = $seed->create_new_list_query($orderBy, $where, $filter_fields, $params, 0, '', true, $seed, $singleSelect);
//.........这里部分代码省略.........
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:101,代码来源:ListViewData.php


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