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


PHP ListViewController类代码示例

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


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

示例1: process

 function process(Vtiger_Request $request)
 {
     global $log;
     $log->debug("Entering ./views/MiniListWizard.php::process");
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('WIZARD_STEP', $request->get('step'));
     switch ($request->get('step')) {
         case 'step1':
             $modules = Vtiger_Module_Model::getSearchableModules();
             //Since comments is not treated as seperate module
             unset($modules['ModComments']);
             $viewer->assign('MODULES', $modules);
             break;
         case 'step2':
             $selectedModule = $request->get('selectedModule');
             $filters = CustomView_Record_Model::getAllByGroup($selectedModule);
             $viewer->assign('ALLFILTERS', $filters);
             break;
         case 'step3':
             $selectedModule = $request->get('selectedModule');
             $filterid = $request->get('filterid');
             $db = PearDatabase::getInstance();
             $generator = new QueryGenerator($selectedModule, $currentUser);
             $generator->initForCustomViewById($filterid);
             $listviewController = new ListViewController($db, $currentUser, $generator);
             $listviewController->getListViewHeaderFields();
             $viewer->assign('LIST_VIEW_CONTROLLER', $listviewController);
             $viewer->assign('SELECTED_MODULE', $selectedModule);
             break;
     }
     $viewer->view('dashboards/MiniListWizard.tpl', $moduleName);
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:35,代码来源:MiniListWizard.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: 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>");
     }
 }
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:89,代码来源:home.php

示例4: getSearchURL

 $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(mkCountQuery($list_query));
 $noofrows = $adb->query_result($count_result, 0, "count");
 $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'];
 $end_rec = $navigation_array['end_val'];
 //By Raju Ends
 //limiting the query
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:31,代码来源:ListView.php

示例5: 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);
//.........这里部分代码省略.........
开发者ID:latechdirect,项目名称:vtiger,代码行数:101,代码来源:ListTopQuotes.php

示例6: process

 public function process(Vtiger_Request $request)
 {
     require_once "libraries/PHPExcel/PHPExcel.php";
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $module = $request->getModule(false);
     //this is the type of things in the current view
     $filter = $request->get('viewname');
     //this is the cvid of the current custom filter
     $recordIds = $this->getRecordsListFromRequest($request);
     //this handles the 'all' situation.
     //we now know what we want to render and can get a handle to the respective view, probably should use a listviewcontroller to get the data
     $selectedModule = $request->get("targetmodule");
     //set up our spreadsheet to write out to
     $workbook = new PHPExcel();
     $worksheet = $workbook->setActiveSheetIndex(0);
     $header_styles = array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'E1E0F7')), 'font' => array('bold' => true));
     $row = 1;
     $col = 0;
     $generator = new QueryGenerator($selectedModule, $currentUser);
     $generator->initForCustomViewById($filter);
     $customView = CustomView_Record_Model::getInstanceById($filter);
     $listviewController = new ListViewController($db, $currentUser, $generator);
     $headers = $listviewController->getListViewHeaderFields();
     //get the column headers, they go in row 0 of the spreadsheet
     foreach ($headers as $column => $webserviceField) {
         $fieldObj = Vtiger_Field::getInstance($webserviceField->getFieldId());
         //echo $fieldObj->label;
         $fields[] = $fieldObj;
         $worksheet->setCellValueExplicitByColumnAndRow($col, $row, decode_html(vtranslate($fieldObj->label, $selectedModule)), PHPExcel_Cell_DataType::TYPE_STRING);
         $col++;
     }
     $row++;
     $targetModuleFocus = CRMEntity::getInstance($selectedModule);
     //ListViewController has lots of paging stuff and things we don't want
     //so lets just itterate across the list of IDs we have and get the field values
     foreach ($recordIds as $id) {
         $col = 0;
         $record = Vtiger_Record_Model::getInstanceById($id, $selectedModule);
         foreach ($fields as $field) {
             //depending on the uitype we might want the raw value, the display value or something else.
             //we might also want the display value sans-links so we can use strip_tags for that
             //phone numbers need to be explicit strings
             $value = $record->getDisplayValue($field->name);
             $uitype = $field->uitype;
             switch ($uitype) {
                 case 4:
                     //numbers
                 //numbers
                 case 25:
                 case 7:
                 case 71:
                     $worksheet->setCellvalueExplicitByColumnAndRow($col, $row, strip_tags($value), PHPExcel_Cell_DataType::TYPE_NUMERIC);
                     break;
                 case 6:
                     //datetimes
                 //datetimes
                 case 23:
                 case 70:
                     $worksheet->setCellvalueExplicitByColumnAndRow($col, $row, PHPExcel_Shared_Date::PHPToExcel(strtotime($value)), PHPExcel_Cell_DataType::TYPE_NUMERIC);
                     $worksheet->getStyleByColumnAndRow($col, $row)->getNumberFormat()->setFormatCode('DD/MM/YYYY HH:MM:SS');
                     //format the date to the users preference
                     break;
                 default:
                     $worksheet->setCellValueExplicitByColumnAndRow($col, $row, decode_html(strip_tags($value)), PHPExcel_Cell_DataType::TYPE_STRING);
             }
             //echo strip_tags($value);
             $col++;
         }
         //echo "<br>";
         $row++;
     }
     //having written out all the data lets have a go at getting the columns to auto-size
     $col = 0;
     $row = 1;
     foreach ($headers as $column => $webserviceField) {
         $cell = $worksheet->getCellByColumnAndRow($col, $row);
         $worksheet->getStyleByColumnAndRow($col, $row)->applyFromArray($header_styles);
         $worksheet->getColumnDimension($cell->getColumn())->setAutoSize(true);
         $col++;
     }
     $rootDirectory = vglobal('root_directory');
     $tmpDir = vglobal('tmp_dir');
     $tempFileName = tempnam($rootDirectory . $tmpDir, 'xls');
     $workbookWriter = PHPExcel_IOFactory::createWriter($workbook, 'Excel5');
     $workbookWriter->save($tempFileName);
     if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
         header('Pragma: public');
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     }
     header('Content-Type: application/x-msexcel');
     header('Content-Length: ' . @filesize($tempFileName));
     $filename = decode_html($customView->get('viewname')) . ".xls";
     header('Content-disposition: attachment; filename="' . $filename . '"');
     $fp = fopen($tempFileName, 'rb');
     fpassthru($fp);
 }
开发者ID:Alby1507,项目名称:LSWYSIWYG,代码行数:96,代码来源:ViewToSheet.php

示例7: massMerge

    if ($tempCount > 0) {
        $smarty->assign("WORDTEMPLATEOPTIONS", "<td>" . $app_strings['LBL_SELECT_TEMPLATE_TO_MAIL_MERGE'] . "</td><td style=\"padding-left:5px;padding-right:5px\"><select class=\"small\" name=\"mergefile\">" . $optionString . "</select></td>");
        $smarty->assign("MERGEBUTTON", "<td><input title=\"{$app_strings['LBL_MERGE_BUTTON_TITLE']}\" accessKey=\"{$app_strings['LBL_MERGE_BUTTON_KEY']}\" class=\"crmbutton small create\" onclick=\"return massMerge('Contacts')\" type=\"submit\" name=\"Merge\" value=\" {$app_strings['LBL_MERGE_BUTTON_LABEL']}\"></td>");
    } else {
        require "user_privileges/user_privileges_" . $current_user->id . ".php";
        if ($is_admin == true) {
            $smarty->assign("MERGEBUTTON", "<td><a href=index.php?module=Settings&action=upload&tempModule=" . $currentModule . "&parenttab=Settings>" . $app_strings['LBL_CREATE_MERGE_TEMPLATE'] . "</td>");
        }
    }
}
//mass merge for word templates
//Retreive the List View Table Header
if (!empty($viewid)) {
    $url_string .= "&viewname=" . $viewid;
}
$controller = new ListViewController($adb, $current_user, $queryGenerator);
$listview_header = $controller->getListViewHeader($focus, $currentModule, $url_string, $sorder, $order_by);
$smarty->assign("LISTHEADER", $listview_header);
$listview_header_search = $controller->getBasicSearchFieldInfoList();
$smarty->assign("SEARCHLISTHEADER", $listview_header_search);
$listview_entries = $controller->getListViewEntries($focus, $currentModule, $list_result, $navigation_array);
$smarty->assign("LISTENTITY", $listview_entries);
$smarty->assign("SELECT_SCRIPT", $view_script);
$smarty->assign("AVALABLE_FIELDS", getMergeFields($currentModule, "available_fields"));
$smarty->assign("FIELDS_TO_MERGE", getMergeFields($currentModule, "fileds_to_merge"));
//Added to select Multiple records in multiple pages
$smarty->assign("SELECTEDIDS", vtlib_purify($_REQUEST['selobjs']));
$smarty->assign("ALLSELECTEDIDS", vtlib_purify($_REQUEST['allselobjs']));
$smarty->assign("CURRENT_PAGE_BOXES", implode(array_keys($listview_entries), ";"));
$navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string, "Contacts", "index", $viewid);
$alphabetical = AlphabeticalSearch($currentModule, 'index', 'lastname', 'true', 'basic', "", "", "", "", $viewid);
开发者ID:hardikk,项目名称:HNH,代码行数:31,代码来源:ListView.php

示例8: 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

示例9: getListQuery

    }
    $query = getListQuery($currentModule, $where_relquery);
}
if ($currentModule == 'Products' && $_REQUEST['record_id'] && ($popuptype == 'inventory_prod' || $popuptype == 'inventory_prod_po')) {
    $product_name = getProductName(vtlib_purify($_REQUEST['record_id']));
    $smarty->assign("PRODUCT_NAME", $product_name);
    $smarty->assign("RECORD_ID", vtlib_purify($_REQUEST['record_id']));
}
//Added to fix the issue #2307
$order_by = $focus->getOrderBy();
$sorder = $focus->getSortOrder();
$listview_header_search = getSearchListHeaderValues($focus, $currentModule, $url_string, $sorder, $order_by);
$smarty->assign("SEARCHLISTHEADER", $listview_header_search);
$smarty->assign("ALPHABETICAL", $alphabetical);
$queryGenerator = new QueryGenerator($currentModule, $current_user);
$controller = new ListViewController($adb, $current_user, $queryGenerator);
$fieldnames = $controller->getAdvancedSearchOptionString();
$criteria = getcriteria_options();
$smarty->assign("CRITERIA", $criteria);
$smarty->assign("FIELDNAMES", $fieldnames);
if (isset($_REQUEST['query']) && $_REQUEST['query'] == 'true') {
    list($where, $ustring) = explode("#@@#", getWhereCondition($currentModule));
    $url_string .= "&query=true" . $ustring;
}
if (isset($where) && $where != '') {
    $query .= ' and ' . $where;
}
if (isset($order_by) && $order_by != '') {
    $query .= ' ORDER BY ' . $order_by . ' ' . $sorder;
}
// vtlib customization: To override module specific popup query for a given field
开发者ID:kduqi,项目名称:corebos,代码行数:31,代码来源:Popup.php

示例10: 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


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