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');
     }
 }
예제 #2
0
 /**
  * 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>");
     }
 }
예제 #3
0
 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
 if ($start_rec == 0) {
예제 #4
0
/**	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);
    $values = array('ModuleName' => 'Quotes', 'Title' => $title, 'Header' => $header, 'Entries' => $entries, 'search_qry' => $search_qry);
    if ($display_empty_home_blocks && $noofrows == 0 || $noofrows > 0) {
        return $values;
    }
}
예제 #5
0
파일: ListView.php 프로젝트: hardikk/HNH
        $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);
$fieldnames = $controller->getAdvancedSearchOptionString();
예제 #6
0
파일: ListView.php 프로젝트: hardikk/HNH
     }
     $limit_start_rec = ($start[$folder_id] - 1) * $max_entries_per_page;
     if ($adb->dbType == "pgsql") {
         $list_result = $adb->pquery($query . " OFFSET {$limit_start_rec} LIMIT {$max_entries_per_page}", array());
     } else {
         $list_result = $adb->pquery($query . " LIMIT {$limit_start_rec}, {$max_entries_per_page}", array());
     }
     //navigation end
     $folder_details = array();
     $folderid = $adb->query_result($result, $i, "folderid");
     $folder_details['folderid'] = $folderid;
     $folder_details['foldername'] = $adb->query_result($result, $i, "foldername");
     $foldername = $folder_details['foldername'];
     $folder_details['description'] = $adb->query_result($result, $i, "description");
     $folder_url_string = $url_string . "&folderid={$folderid}";
     $folder_details['header'] = $controller->getListViewHeader($focus, $currentModule, $folder_url_string, $sorder, $order_by);
     $folder_files = $controller->getListViewEntries($focus, $currentModule, $list_result, $navigation_array);
     $folder_details['entries'] = $folder_files;
     $folder_details['navigation'] = getTableHeaderSimpleNavigation($navigation_array, $url_string, "Documents", $folder_id, $viewid);
     $folder_details['recordListRange'] = getRecordRangeMessage($list_result, $limit_start_rec, $num_records);
     if ($displayFolder == true) {
         $folders[$foldername] = $folder_details;
     } else {
         $emptyfolders[$foldername] = $folder_details;
     }
     if ($folderid == 1) {
         $default_folder_details = $folder_details;
     }
 }
 if (count($folders) == 0) {
     $folders[$default_folder_details['foldername']] = $default_folder_details;
예제 #7
0
/**	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;
    }
}
예제 #8
0
파일: home.php 프로젝트: hardikk/HNH
 /**
  * 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>");
     }
 }