本文整理汇总了PHP中CustomView::getViewId方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomView::getViewId方法的具体用法?PHP CustomView::getViewId怎么用?PHP CustomView::getViewId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomView
的用法示例。
在下文中一共展示了CustomView::getViewId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
function preProcess(Vtiger_Request $request, $display = true)
{
global $current_user;
parent::preProcess($request, false);
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$listViewModel = Vtiger_ListView_Model::getInstance($moduleName);
$linkParams = array('MODULE' => $moduleName, 'ACTION' => $request->get('view'));
$viewer->assign('CUSTOM_VIEWS', CustomView_Record_Model::getAllByGroup($moduleName));
$this->viewName = $request->get('viewname');
if (empty($this->viewName)) {
//If not view name exits then get it from custom view
//This can return default view id or view id present in session
$customView = new CustomView();
$this->viewName = $customView->getViewId($moduleName);
}
$quickLinkModels = $listViewModel->getSideBarLinks($linkParams);
$viewer->assign('QUICK_LINKS', $quickLinkModels);
$this->initializeListViewContents($request, $viewer);
$viewer->assign('VIEWID', $this->viewName);
//Modified by jmangarret 16jun2015
$viewer->assign('ROLEID', $current_user->roleid);
if ($display) {
$this->preProcessDisplay($request);
}
}
示例2: getContent
function getContent(Mobile_API_Request $request)
{
global $current_user, $adb;
$current_user = $this->getActiveUser();
$module = $request->get('module');
$limit = $request->get('number');
$offset = $request->get('offset');
$search = isset($_REQUEST['src_str']) ? $request->get('src_str') : '';
$customView = new CustomView($module);
if (!empty($_REQUEST['view'])) {
$viewid = $_REQUEST['view'];
} else {
$viewid = $customView->getViewId($module);
}
$queryGenerator = new QueryGenerator($module, $current_user);
if ($viewid != "0") {
$queryGenerator->initForCustomViewById($viewid);
} else {
$queryGenerator->initForDefaultCustomView();
}
$list_query = $queryGenerator->getQuery();
//get entity fields for each module
$entity_sql = "select fieldname,tablename,entityidfield from vtiger_entityname where modulename =?";
$ws_entity = $adb->pquery($entity_sql, array($module));
$fieldname = $adb->query_result($ws_entity, 0, 'fieldname');
$tablename = $adb->query_result($ws_entity, 0, 'tablename');
//set the list and content order
if ($module == 'Contacts' || $module == 'Leads') {
$list_query .= " AND (lastname LIKE '%{$search}%' OR firstname LIKE '%{$search}%') ORDER BY lastname";
} elseif ($module != 'Calendar' and $module != 'Events') {
$list_query .= " AND " . $tablename . "." . $fieldname . " LIKE '%{$search}%' ORDER BY " . $tablename . "." . $fieldname;
} elseif ($module == 'Calendar' || $module == 'Events') {
$calendarview_selected = $request->get('viewName');
$list_query .= " AND vtiger_activity.activitytype!='Emails'";
if ($calendarview_selected == 'week') {
$list_query .= " AND week(date_start) = week(NOW()) AND year(date_start) = year(NOW())";
} elseif ($calendarview_selected == 'month') {
$list_query .= " AND month(date_start) = month(NOW()) AND year(date_start) = year(NOW())";
} elseif ($calendarview_selected == 'year') {
$list_query .= " AND year(date_start) = year(NOW())";
} elseif ($calendarview_selected == 'today') {
$list_query .= " AND DATE(date_start) = DATE(NOW())";
}
$list_query .= " AND subject LIKE '%{$search}%' ORDER BY date_start DESC";
} else {
$list_query .= " AND " . $tablename . "." . $fieldname . " LIKE '%{$search}%' ORDER BY " . $tablename . "." . $fieldname;
}
$list_query .= " LIMIT {$offset}, {$limit};";
$listview_entries = $adb->pquery($list_query, array());
$response = new Mobile_API_Response();
$response->setResult(array('records' => $listview_entries, 'module' => $module));
return $response;
}
示例3: process
public function process(Vtiger_Request $request)
{
$customView = new CustomView();
$modules = $request->get('related_modules');
$cvIds = array();
if (is_array($modules)) {
foreach ($modules as $key => $module) {
$cvIds[$module] = $customView->getViewId($module);
}
}
$response = new Vtiger_Response();
$response->setResult($cvIds);
$response->emit();
}
示例4: vtws_getfilterfields
function vtws_getfilterfields($module, $user)
{
global $log, $adb, $default_language;
$log->debug("Entering function vtws_getfilterfields");
include_once "modules/{$module}/{$module}.php";
$focus = new $module();
$linkfields = array($focus->list_link_field);
if ($module == 'Contacts' or $module == 'Leads') {
$linkfields = array('firstname', 'lastname');
}
$customView = new CustomView($module);
$viewid = $customView->getViewId($module);
$viewinfo = $customView->getColumnsListByCvid($viewid);
$fields = array();
foreach ($viewinfo as $fld) {
$finfo = explode(':', $fld);
$fields[] = $finfo[1] == 'smownerid' ? 'assigned_user_id' : $finfo[2];
}
return array('fields' => $fields, 'linkfields' => $linkfields);
}
示例5: initForDefaultCustomView
public function initForDefaultCustomView()
{
$customView = new CustomView($this->module);
$viewId = $customView->getViewId($this->module);
$this->initForCustomViewById($viewId);
}
示例6: array
/**
* Function to get Campaign related Leads
* @param integer $id - campaignid
* returns related Leads record in array format
*/
function get_leads($id, $cur_tab_id, $rel_tab_id, $actions = false)
{
global $log, $singlepane_view, $currentModule;
$log->debug("Entering get_leads(" . $id . ") method ...");
$this_module = $currentModule;
$related_module = vtlib_getModuleNameById($rel_tab_id);
require_once "modules/{$related_module}/{$related_module}.php";
$other = new $related_module();
$is_CampaignStatusAllowed = false;
global $current_user;
if (getFieldVisibilityPermission('Leads', $current_user->id, 'campaignrelstatus') == '0') {
$other->list_fields['Status'] = array('vtiger_campaignrelstatus' => 'campaignrelstatus');
$other->list_fields_name['Status'] = 'campaignrelstatus';
$other->sortby_fields[] = 'campaignrelstatus';
$is_CampaignStatusAllowed = getFieldVisibilityPermission('Leads', $current_user->id, 'campaignrelstatus', 'readwrite') == '0' ? true : false;
}
vtlib_setup_modulevars($related_module, $other);
$singular_modname = vtlib_toSingular($related_module);
$parenttab = getParentTab();
if ($singlepane_view == 'true') {
$returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
} else {
$returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
}
$button = '';
// Send mail button for selected Leads
$button .= "<input title='" . getTranslatedString('LBL_SEND_MAIL_BUTTON') . "' class='crmbutton small edit' value='" . getTranslatedString('LBL_SEND_MAIL_BUTTON') . "' type='button' name='button' onclick='rel_eMail(\"{$this_module}\",this,\"{$related_module}\")'>";
$button .= '  ';
/* To get Leads CustomView -START */
require_once 'modules/CustomView/CustomView.php';
$lhtml = "<select id='" . $related_module . "_cv_list' class='small'><option value='None'>-- " . getTranslatedString('Select One') . " --</option>";
$oCustomView = new CustomView($related_module);
$viewid = $oCustomView->getViewId($related_module);
$customviewcombo_html = $oCustomView->getCustomViewCombo($viewid, false);
$lhtml .= $customviewcombo_html;
$lhtml .= "</select>";
/* To get Leads CustomView -END */
$button .= $lhtml . "<input title='" . getTranslatedString('LBL_LOAD_LIST', $this_module) . "' class='crmbutton small edit' value='" . getTranslatedString('LBL_LOAD_LIST', $this_module) . "' type='button' name='button' onclick='loadCvList(\"{$related_module}\",\"{$id}\")'>";
$button .= ' ';
$button .= "<input title='" . getTranslatedString('LBL_EMPTY_LIST', $this_module) . "' class='crmbutton small edit' value='" . getTranslatedString('LBL_EMPTY_LIST', $this_module) . "' type='button' name='button' onclick='emptyCvList(\"{$related_module}\",\"{$id}\")'>";
$button .= ' ';
if ($actions) {
if (is_string($actions)) {
$actions = explode(',', strtoupper($actions));
}
if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
$button .= "<input title='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module={$related_module}&return_module={$currentModule}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$id}&parenttab={$parenttab}','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "'> ";
}
if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
$button .= "<input type='hidden' name='createmode' id='createmode' value='link' />" . "<input title='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EditView\";this.form.module.value=\"{$related_module}\"' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "'> ";
}
}
$userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
$query = "SELECT vtiger_leaddetails.*, vtiger_crmentity.crmid,vtiger_leadaddress.phone,vtiger_leadsubdetails.website,\n\t\t\t\tCASE when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end as user_name,\n\t\t\t\tvtiger_crmentity.smownerid, vtiger_campaignrelstatus.*\n\t\t\t\tFROM vtiger_leaddetails\n\t\t\t\tINNER JOIN vtiger_campaignleadrel ON vtiger_campaignleadrel.leadid=vtiger_leaddetails.leadid\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_leaddetails.leadid\n\t\t\t\tINNER JOIN vtiger_leadsubdetails ON vtiger_leadsubdetails.leadsubscriptionid = vtiger_leaddetails.leadid\n\t\t\t\tINNER JOIN vtiger_leadaddress ON vtiger_leadaddress.leadaddressid = vtiger_leadsubdetails.leadsubscriptionid\n\t\t\t\tLEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id\n\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid=vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_campaignrelstatus ON vtiger_campaignrelstatus.campaignrelstatusid = vtiger_campaignleadrel.campaignrelstatusid\n\t\t\t\tWHERE vtiger_crmentity.deleted=0 AND vtiger_campaignleadrel.campaignid = " . $id;
$return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
if ($return_value == null) {
$return_value = array();
} else {
if ($is_CampaignStatusAllowed) {
$statusPos = count($return_value['header']) - 2;
// Last column is for Actions, exclude that. Also the index starts from 0, so reduce one more count.
$return_value = $this->add_status_popup($return_value, $statusPos, 'Leads');
}
}
$return_value['CUSTOM_BUTTON'] = $button;
$log->debug("Exiting get_leads method ...");
return $return_value;
}
示例7: CustomView
$checkForFieldAccess = $fieldName;
// Handling case where fieldname in vtiger_entityname mismatches fieldname in vtiger_field
if ($sModule == 'HelpDesk' && $checkForFieldAccess == 'title') {
$checkForFieldAccess = 'ticket_title';
} else {
if ($sModule == 'Documents' && $checkForFieldAccess == 'title') {
$checkForFieldAccess = 'notes_title';
}
}
// END
if (getFieldVisibilityPermission($sModule, $current_user->id, $checkForFieldAccess) == '0') {
$permittedFieldNameList[] = $fieldName;
}
}
$cv = new CustomView();
$viewId = $cv->getViewId($sModule);
if (!empty($_SESSION[$sModule . '_DetailView_Navigation' . $viewId])) {
$recordNavigationInfo = Zend_Json::decode($_SESSION[$sModule . '_DetailView_Navigation' . $viewId]);
$recordList = array();
$recordIndex = null;
$recordPageMapping = array();
foreach ($recordNavigationInfo as $start => $recordIdList) {
foreach ($recordIdList as $index => $recordId) {
if (!isRecordExists($recordId)) {
continue;
}
$recordList[] = $recordId;
$recordPageMapping[$recordId] = $start;
if ($recordId == $iCurRecord) {
$recordIndex = count($recordList) - 1;
}
示例8: CustomView
$smarty->assign("ERROR", $mod_strings["SHARED_EVENT_DEL_MSG"]);
} else {
$smarty->assign("ERROR", "");
}
if (ListViewSession::hasViewChanged($currentModule, $viewid)) {
$_SESSION['ACTIVITIES_ORDER_BY'] = '';
}
//<<<<<<< sort ordering >>>>>>>>>>>>>
$sorder = $focus->getSortOrder();
$order_by = $focus->getOrderBy();
$_SESSION['ACTIVITIES_ORDER_BY'] = $order_by;
$_SESSION['ACTIVITIES_SORT_ORDER'] = $sorder;
//<<<<<<< sort ordering >>>>>>>>>>>>>
//<<<<cutomview>>>>>>>
$oCustomView = new CustomView("Calendar");
$viewid = $oCustomView->getViewId("Calendar");
$customviewcombo_html = $oCustomView->getCustomViewCombo($viewid);
$viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
//Added to handle approving or denying status-public by the admin in CustomView
$statusdetails = $oCustomView->isPermittedChangeStatus($viewnamedesc['status']);
$smarty->assign("CUSTOMVIEW_PERMISSION", $statusdetails);
//To check if a user is able to edit/delete a customview
$edit_permit = $oCustomView->isPermittedCustomView($viewid, 'EditView', 'Calendar');
$delete_permit = $oCustomView->isPermittedCustomView($viewid, 'Delete', 'Calendar');
$smarty->assign("CV_EDIT_PERMIT", $edit_permit);
$smarty->assign("CV_DELETE_PERMIT", $delete_permit);
//<<<<<customview>>>>>
if ($viewid == 0) {
echo "<table border='0' cellpadding='5' cellspacing='0' width='100%' height='450px'><tr><td align='center'>";
echo "<div style='border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 55%; position: relative; z-index: 10000000;'>\n\t\t<table border='0' cellpadding='5' cellspacing='0' width='98%'>\n\t\t<tbody><tr>\n\t\t<td rowspan='2' width='11%'><img src='" . vtiger_imageurl('close.gif', $theme) . "'></td>\n\t\t<td style='border-bottom: 1px solid rgb(204, 204, 204);' nowrap='nowrap' width='70%'>\n\t\t\t<span class='genHeaderSmall'>" . $app_strings['LBL_PERMISSION'] . "</span></td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td class='small' align='right' nowrap='nowrap'>\n\t\t<a href='javascript:window.history.back();'>" . $app_strings['LBL_GO_BACK'] . "</a><br>\n\t\t</td>\n\t\t</tr>\n\t\t</tbody></table>\n\t\t</div>\n\t\t</td></tr></table>";
exit;
示例9: GetRelatedListBase
//.........这里部分代码省略.........
$_SESSION['rlvs'][$module][$relatedmodule]['sorder'] = $sorder;
$_SESSION['rlvs'][$module][$relatedmodule]['sortby'] = $order_by;
}
} elseif ($_SESSION['rlvs'][$module][$relatedmodule]) {
$sorder = $_SESSION['rlvs'][$module][$relatedmodule]['sorder'];
$order_by = $_SESSION['rlvs'][$module][$relatedmodule]['sortby'];
} else {
$order_by = $focus->default_order_by;
$sorder = $focus->default_sort_order;
}
//Added by Don for AssignedTo ordering issue in Related Lists
$query_order_by = $order_by;
if ($order_by == 'smownerid') {
$userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
$query_order_by = "case when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end ";
} elseif ($order_by != 'crmid' && !empty($order_by)) {
$tabname = getTableNameForField($relatedmodule, $order_by);
if ($tabname !== '' and $tabname != NULL) {
$query_order_by = $tabname . "." . $query_order_by;
}
}
if (!empty($query_order_by)) {
$query .= ' ORDER BY ' . $query_order_by . ' ' . $sorder;
}
if ($relatedmodule == 'Calendar') {
$mod_listquery = "activity_listquery";
} else {
$mod_listquery = strtolower($relatedmodule) . "_listquery";
}
$_SESSION[$mod_listquery] = $query;
$url_qry = "&order_by=" . $order_by . "&sorder=" . $sorder;
$computeCount = isset($_REQUEST['withCount']) ? $_REQUEST['withCount'] : '';
if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true || (bool) $computeCount == true) {
//Retreiving the no of rows
if ($relatedmodule == "Calendar") {
//for calendar related list, count will increase when we have multiple contacts
//relationship for single activity
$count_query = mkCountQuery($query);
$count_result = $adb->query($count_query);
$noofrows = $adb->query_result($count_result, 0, "count");
} else {
$count_query = mkCountQuery($query);
$count_result = $adb->query($count_query);
if ($adb->num_rows($count_result) > 0) {
$noofrows = $adb->query_result($count_result, 0, "count");
} else {
$noofrows = $adb->num_rows($count_result);
}
}
} else {
$noofrows = null;
}
//Setting Listview session object while sorting/pagination
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;
$list_result = $adb->pquery($query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
/* Save the related list in session for when we click in a register
* from this list we will can navigate with the arrows left and right, to move only in this related list
*/
$relcv = new CustomView();
$relviewId = $relcv->getViewId($relatedmodule);
ListViewSession::setSessionQuery($relatedmodule, $query, $relviewId);
$_SESSION['lvs'][$relatedmodule][$relviewId]['start'] = $start;
//Retreive the List View Table Header
$id = vtlib_purify($_REQUEST['record']);
$listview_header = getListViewHeader($focus, $relatedmodule, '', $sorder, $order_by, $id, '', $module, $skipActions);
//"Accounts");
if ($noofrows > 15) {
$smarty->assign('SCROLLSTART', '<div style="overflow:auto;height:315px;width:100%;">');
$smarty->assign('SCROLLSTOP', '</div>');
}
$smarty->assign("LISTHEADER", $listview_header);
if ($module == 'PriceBook' && $relatedmodule == 'Products') {
$listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, $edit_val, $del_val, '', '', '', '', $skipActions);
}
if ($module == 'Products' && $relatedmodule == 'PriceBooks') {
$listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, 'EditListPrice', 'DeletePriceBookProductRel', '', '', '', '', $skipActions);
} elseif ($relatedmodule == 'SalesOrder') {
$listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, 'SalesOrderEditView', 'DeleteSalesOrder', '', '', '', '', $skipActions);
} else {
$listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, $edit_val, $del_val, '', '', '', '', $skipActions);
}
$navigationOutput = array();
$navigationOutput[] = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows);
if (empty($id) && !empty($_REQUEST['record'])) {
$id = vtlib_purify($_REQUEST['record']);
}
$navigationOutput[] = getRelatedTableHeaderNavigation($navigation_array, $url_qry, $module, $relatedmodule, $id);
$related_entries = array('header' => $listview_header, 'entries' => $listview_entries, 'navigation' => $navigationOutput);
$log->debug("Exiting GetRelatedList method ...");
return $related_entries;
}
示例10: export
/**
* This function exports all the data for a given module
* Param $type - module name
* Return type text
*/
function export($type)
{
global $log, $list_max_entries_per_page;
$log->debug("Entering export(" . $type . ") method ...");
global $adb;
$focus = 0;
$content = '';
if ($type != "") {
// vtlib customization: Hook to dynamically include required module file.
// Refer to the logic in setting $currentModule in index.php
$focus = CRMEntity::getInstance($type);
}
$log = LoggerManager::getLogger('export_' . $type);
$db = PearDatabase::getInstance();
$oCustomView = new CustomView("{$type}");
$viewid = $oCustomView->getViewId("{$type}");
$sorder = $focus->getSortOrder();
$order_by = $focus->getOrderBy();
$search_type = $_REQUEST['search_type'];
$export_data = $_REQUEST['export_data'];
if (isset($_SESSION['export_where']) && $_SESSION['export_where'] != '' && $search_type == 'includesearch') {
$where = $_SESSION['export_where'];
}
$query = $focus->create_export_query($where);
if ($search_type != 'includesearch' && $type != 'Calendar') {
$stdfiltersql = $oCustomView->getCVStdFilterSQL($viewid);
$advfiltersql = $oCustomView->getCVAdvFilterSQL($viewid);
if (isset($stdfiltersql) && $stdfiltersql != '') {
$query .= ' and ' . $stdfiltersql;
}
if (isset($advfiltersql) && $advfiltersql != '') {
$query .= ' and ' . $advfiltersql;
}
}
$params = array();
if (($search_type == 'withoutsearch' || $search_type == 'includesearch') && $export_data == 'selecteddata') {
$idstring = explode(";", $_REQUEST['idstring']);
if ($type == 'Accounts' && count($idstring) > 0) {
$query .= ' and vtiger_account.accountid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} elseif ($type == 'Contacts' && count($idstring) > 0) {
$query .= ' and vtiger_contactdetails.contactid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} elseif ($type == 'Potentials' && count($idstring) > 0) {
$query .= ' and vtiger_potential.potentialid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} elseif ($type == 'Leads' && count($idstring) > 0) {
$query .= ' and vtiger_leaddetails.leadid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} elseif ($type == 'Products' && count($idstring) > 0) {
$query .= ' and vtiger_products.productid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} elseif ($type == 'Documents' && count($idstring) > 0) {
$query .= ' and vtiger_notes.notesid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} elseif ($type == 'HelpDesk' && count($idstring) > 0) {
$query .= ' and vtiger_troubletickets.ticketid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} elseif ($type == 'Vendors' && count($idstring) > 0) {
$query .= ' and vtiger_vendor.vendorid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} else {
if (count($idstring) > 0) {
// vtlib customization: Hook to make the export feature available for custom modules.
$query .= " and {$focus->table_name}.{$focus->table_index} in (" . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
// END
}
}
}
if (isset($order_by) && $order_by != '') {
if ($order_by == 'smownerid') {
$query .= ' ORDER BY user_name ' . $sorder;
} elseif ($order_by == 'lastname' && $type == 'Documents') {
$query .= ' ORDER BY vtiger_contactdetails.lastname ' . $sorder;
} elseif ($order_by == 'crmid' && $type == 'HelpDesk') {
$query .= ' ORDER BY vtiger_troubletickets.ticketid ' . $sorder;
} else {
$tablename = getTableNameForField($type, $order_by);
$tablename = $tablename != '' ? $tablename . "." : '';
if ($adb->dbType == "pgsql") {
$query .= ' GROUP BY ' . $tablename . $order_by;
}
$query .= ' ORDER BY ' . $tablename . $order_by . ' ' . $sorder;
}
}
if ($export_data == 'currentpage') {
$current_page = ListViewSession::getCurrentPage($type, $viewid);
$limit_start_rec = ($current_page - 1) * $list_max_entries_per_page;
if ($limit_start_rec < 0) {
$limit_start_rec = 0;
}
$query .= ' LIMIT ' . $limit_start_rec . ',' . $list_max_entries_per_page;
}
$result = $adb->pquery($query, $params, true, "Error exporting {$type}: " . "<BR>{$query}");
//.........这里部分代码省略.........
示例11: execute
function execute($fieldnames, $pagingModel = false)
{
if ($this->moduleName == 'Project') {
// Custom View
include_once 'modules/CustomView/CustomView.php';
include_once 'include/QueryGenerator/QueryGenerator.php';
include_once 'modules/Mobile/api/ws/Controller.php';
include_once 'include/DatabaseUtil.php';
$customView = new CustomView($this->moduleName);
$viewid = $customView->getViewId($this->moduleName);
$customview_html = $customView->getCustomViewCombo($viewid);
$viewinfo = $customView->getCustomViewByCvid($viewid);
global $current_user;
// Required for vtws_update API
$userid = $_SESSION['_authenticated_user_id'];
$current_user = CRMEntity::getInstance('Users');
$current_user = $current_user->retrieveCurrentUserInfoFromFile($userid);
$queryGenerator = new QueryGenerator($this->moduleName, $current_user);
if ($viewid != "0") {
$queryGenerator->initForCustomViewById($viewid);
} else {
$queryGenerator->initForDefaultCustomView();
}
$selectClause = sprintf("SELECT %s", implode(',', $fieldnames) . ",vtiger_project.projectid");
$fromClause = $queryGenerator->getFromClause();
$whereClause = $queryGenerator->getWhereClause();
$orderClause = "";
$groupClause = "";
$limitClause = $pagingModel ? " LIMIT {$pagingModel->currentCount()},{$pagingModel->limit()}" : "";
if (!empty($this->criterias)) {
$_sortCriteria = $this->criterias['_sort'];
if (!empty($_sortCriteria)) {
$orderClause = $_sortCriteria;
}
}
$query = sprintf("%s %s %s %s %s %s;", $selectClause, $fromClause, $whereClause, $orderClause, $groupClause, $limitClause);
global $adb;
$result = $adb->pquery($query, array());
$noofrows = $adb->num_rows($result);
$lstresult = array();
for ($i = 0; $i < $noofrows; $i++) {
$lstresult[$i]['firstname'] = $adb->query_result($result, $i, 'projectname');
$lstresult[$i]['id'] = "31x" . $adb->query_result($result, $i, 'projectid');
}
return $lstresult;
} else {
$selectClause = sprintf("SELECT %s", implode(',', $fieldnames));
$fromClause = sprintf("FROM %s", $this->moduleName);
$whereClause = "";
$orderClause = "";
$groupClause = "";
$limitClause = $pagingModel ? " LIMIT {$pagingModel->currentCount()},{$pagingModel->limit()}" : "";
if (!empty($this->criterias)) {
$_sortCriteria = $this->criterias['_sort'];
if (!empty($_sortCriteria)) {
$orderClause = $_sortCriteria;
}
}
$query = sprintf("%s %s %s %s %s %s;", $selectClause, $fromClause, $whereClause, $orderClause, $groupClause, $limitClause);
return vtws_query($query, $this->getUser());
}
}
示例12: CustomView
if (isset($_REQUEST['selected_module']) && $_REQUEST['selected_module'] != '') {
$select_module = vtlib_purify($_REQUEST['selected_module']);
if (!in_array($select_module, $module_name)) {
show_error_msg();
}
} else {
if (count($module_name) > 0) {
$select_module = $module_name[0];
} else {
show_error_msg('no_permitted_modules');
}
}
$focus = CRMEntity::getInstance($select_module);
if (count($module_name) > 0) {
$cur_mod_view = new CustomView($select_module);
$viewid = $cur_mod_view->getViewId($select_module);
global $current_user;
$queryGenerator = new QueryGenerator($select_module, $current_user);
$queryGenerator->initForDefaultCustomView();
// 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 != '') {
示例13: process
/** END */
function process(Mobile_API_Request $request)
{
global $config_settings, $app_strings, $mod_strings;
$wsResponse = parent::process($request);
if (isset($_REQUEST['delaction'])) {
//delete?
if ($_REQUEST['delaction'] == 'deleteEntity') {
$recordid = vtlib_purify($_REQUEST['record']);
if (trim($recordid) != '') {
//delete record
$delResponse = Mobile_WS_DeleteRecords::process($request);
}
}
}
$current_user = $this->getActiveUser();
$current_language = $this->sessionGet('language');
include_once dirname(__FILE__) . '/../language/' . $current_language . '.lang.php';
$response = false;
if ($wsResponse->hasError()) {
$response = $wsResponse;
} else {
$wsResponseResult = $wsResponse->getResult();
$tabid = getTabid($wsResponseResult['module']);
$CATEGORY = getParentTabFromModule($wsResponseResult['module']);
if ($wsResponseResult['module'] != 'Calendar' && $wsResponseResult['module'] != 'Events') {
$customView = new CustomView($wsResponseResult['module']);
$id1 = $_REQUEST['viewName'];
$id2 = $_REQUEST['view'];
if ($id2 !== "" && $id2 == '1') {
$viewid = $id1;
} else {
$viewid = $customView->getViewId($wsResponseResult['module']);
}
$customview_html = $customView->getCustomViewCombo($viewid);
$customview_html = str_replace("></option>", ">" . $mod_strings['LBL_FILTER'] . "</option>", $customview_html);
$viewinfo = $customView->getCustomViewByCvid($viewid);
$focus = new $wsResponseResult['module']();
$focus->initSortbyField($wsResponseResult['module']);
$order_by = $focus->getOrderBy();
$url_string = '';
} else {
$calendarview_selected = $_REQUEST['viewName'];
//week as default value
if ($calendarview_selected == "") {
if (isset($config_settings['calendarview']) and $config_settings['calendarview'] != '') {
//get the default view from config
$calendarview_selected = $config_settings['calendarview'];
} else {
$calendarview_selected = 'week';
}
}
$CATEGORY = getParentTabFromModule($wsResponseResult['module']);
$customView = new CustomView($wsResponseResult['module']);
$viewid = $customView->getViewId($wsResponseResult['module']);
//special view for Calendar, custom filters are not considered
$customview_arr = array('today' => 'LBL_TODAY', 'week' => 'LBL_WEEK', 'month' => 'LBL_MONTH', 'year' => 'LBL_YEAR');
$customview_html = '';
foreach ($customview_arr as $key => $value) {
if ($key != $calendarview_selected) {
$customview_html .= "<option value=" . $key . ">" . $mod_strings[$value] . "</option>";
} else {
$customview_html .= "<option value=" . $key . " selected='selected'>" . $mod_strings[$value] . "</option>";
}
}
}
$viewer = new Mobile_UI_Viewer();
if ($viewinfo['viewname'] == 'All' || $viewinfo['viewname'] == '') {
$viewer->assign('_ALL', 'ALL');
}
global $current_user, $adb, $list_max_entries_per_page;
$current_user = $this->getActiveUser();
$viewer->assign('_MODULE', $this->cachedModule($wsResponseResult['module']));
$viewer->assign('_MODE', $request->get('mode'));
$viewer->assign('_CATEGORY', $CATEGORY);
$viewer->assign('_CUSTOMVIEW_OPTION', $customview_html);
$viewer->assign('_PAGER', $this->getPagingModel($request));
$viewer->assign('_SEARCH', $request->get('search'));
$viewer->assign('MOD', $mod_strings);
$viewer->assign('LANGUAGE', $current_language);
$viewer->assign('_VIEW', $viewid);
$viewer->assign('_VIEWNAME', $calendarview_selected);
$viewer->assign('CALENDARSELECT', $config_settings['compactcalendar']);
$response = $viewer->process('generic/List.tpl');
}
return $response;
}
示例14: getParentTab
/**
* Function to get Campaign related Leads
* @param integer $id - campaignid
* returns related Leads record in array format
*/
function get_leads($id, $cur_tab_id, $rel_tab_id, $actions = false)
{
global $log, $singlepane_view, $currentModule;
$log->debug("Entering get_leads(" . $id . ") method ...");
$this_module = $currentModule;
$related_module = vtlib_getModuleNameById($rel_tab_id);
require_once "modules/{$related_module}/{$related_module}.php";
$other = new $related_module();
vtlib_setup_modulevars($related_module, $other);
$singular_modname = vtlib_toSingular($related_module);
$parenttab = getParentTab();
if ($singlepane_view == 'true') {
$returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
} else {
$returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
}
$button = '';
// Send mail button for selected Leads
$button .= "<input title='" . getTranslatedString('LBL_SEND_MAIL_BUTTON') . "' class='crmbutton small edit' value='" . getTranslatedString('LBL_SEND_MAIL_BUTTON') . "' type='button' name='button' onclick='rel_eMail(\"{$this_module}\",this,\"{$related_module}\")'>";
$button .= '  ';
/* To get Leads CustomView -START */
require_once 'modules/CustomView/CustomView.php';
$lhtml = "<select id='lead_cv_list' class='small'><option value='None'>-- " . getTranslatedString('Select One') . " --</option>";
$oCustomView = new CustomView($related_module);
$viewid = $oCustomView->getViewId($related_module);
$customviewcombo_html = $oCustomView->getCustomViewCombo($viewid, false);
$lhtml .= $customviewcombo_html;
$lhtml .= "</select>";
/* To get Leads CustomView -END */
$button .= $lhtml . "<input title='" . getTranslatedString('LBL_LOAD_LIST', $this_module) . "' class='crmbutton small edit' value='" . getTranslatedString('LBL_LOAD_LIST', $this_module) . "' type='button' name='button' onclick='loadCvList(\"{$related_module}\",\"{$id}\")'>";
$button .= '  ';
if ($actions) {
if (is_string($actions)) {
$actions = explode(',', strtoupper($actions));
}
if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
$button .= "<input title='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module={$related_module}&return_module={$currentModule}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$id}&parenttab={$parenttab}','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "'> ";
}
if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
$button .= "<input title='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EditView\";this.form.module.value=\"{$related_module}\"' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "'> ";
}
}
$query = "SELECT vtiger_leaddetails.*, vtiger_crmentity.crmid,vtiger_leadaddress.phone,vtiger_leadsubdetails.website, \n\t\t\t\t\tCASE when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name, \n\t\t\t\t\tvtiger_crmentity.smownerid FROM vtiger_leaddetails \n\t\t\t\t\tINNER JOIN vtiger_campaignleadrel ON vtiger_campaignleadrel.leadid=vtiger_leaddetails.leadid\n\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_leaddetails.leadid\n\t\t\t\t\tINNER JOIN vtiger_leadsubdetails ON vtiger_leadsubdetails.leadsubscriptionid = vtiger_leaddetails.leadid \t\t\t\n\t\t\t\t\tINNER JOIN vtiger_leadaddress ON vtiger_leadaddress.leadaddressid = vtiger_leadsubdetails.leadsubscriptionid\n\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id\n\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid=vtiger_crmentity.smownerid\n\t\t\t\t\tWHERE vtiger_crmentity.deleted=0 AND vtiger_campaignleadrel.campaignid = " . $id;
$return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
if ($return_value == null) {
$return_value = array();
}
$return_value['CUSTOM_BUTTON'] = $button;
$log->debug("Exiting get_leads method ...");
return $return_value;
}
示例15: getAllFilterByModule
/**
* Function gives default custom view for a module
* @param <String> $module
* @return <CustomView_Record_Model>
*/
public static function getAllFilterByModule($module)
{
$db = PearDatabase::getInstance();
$query = "SELECT cvid FROM vtiger_customview WHERE viewname='All' AND entitytype = ?";
$result = $db->pquery($query, array($module));
$viewId = $db->query_result($result, 0, 'cvid');
if (!$viewId) {
$customView = new CustomView($module);
$viewId = $customView->getViewId($module);
}
return self::getInstanceById($viewId);
}