本文整理汇总了PHP中Vtiger_Viewer::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Viewer::assign方法的具体用法?PHP Vtiger_Viewer::assign怎么用?PHP Vtiger_Viewer::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Viewer
的用法示例。
在下文中一共展示了Vtiger_Viewer::assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
$moduleName = $this->getModule($request);
$sourceModule = $request->get('src_module');
$sourceRecord = $request->get('src_record');
//list of records is narrowed to contacts related to help desks account, only in Help Desk Contacts relation view
if ($moduleName == 'Contacts' && $sourceModule == 'HelpDesk' && isRecordExists($sourceRecord) && strpos($_SERVER['QUERY_STRING'], 'module=Contacts&src_module=HelpDesk') === 0) {
$request->set('related_parent_module', 'Accounts');
$helpDeskRecord = Vtiger_Record_Model::getInstanceById($sourceRecord, 'HelpDesk');
$request->set('related_parent_id', $helpDeskRecord->get('parent_id'));
$viewer->assign('SWITCH', true);
}
if ($moduleName == 'Contacts' && $sourceModule == 'SSalesProcesses' && isRecordExists($sourceRecord) && strpos($_SERVER['QUERY_STRING'], 'module=Contacts&src_module=SSalesProcesses') === 0) {
$request->set('related_parent_module', 'Accounts');
$moduleRecord = Vtiger_Record_Model::getInstanceById($sourceRecord, 'SSalesProcesses');
$request->set('related_parent_id', $moduleRecord->get('related_to'));
$viewer->assign('SWITCH', true);
}
if ($moduleName == 'Contacts' && $sourceModule == 'Project' && isRecordExists($sourceRecord) && strpos($_SERVER['QUERY_STRING'], 'module=Contacts&src_module=Project') === 0) {
$request->set('related_parent_module', 'Accounts');
$moduleRecord = Vtiger_Record_Model::getInstanceById($sourceRecord, 'Project');
$request->set('related_parent_id', $moduleRecord->get('linktoaccountscontacts'));
$viewer->assign('SWITCH', true);
}
parent::initializeListViewContents($request, $viewer);
}
示例2: process
public function process($fieldName, $moduleName)
{
$viewer = new Vtiger_Viewer();
$viewer->assign('FLD_NAME', $fieldName);
$viewer->assign('FLD_ID', $fieldName);
return $viewer->view($this->tplAddress, "Settings:OSSProjectTemplates", true);
}
示例3: ShowModuleIdField
function ShowModuleIdField($selected_module, $tab_only = false)
{
$db = PearDatabase::getInstance();
$names = array('Emails', 'PBXManager', 'ModComments', 'SMSNotifier', 'OSSPdf');
foreach ($names as $id) {
$in .= "'" . $id . "',";
}
$in = trim($in, ',');
$query = "select tabid, name, customized from vtiger_tab where isentitytype = '1' and presence <> '2' and name not in ( {$in} )";
$wynik = $db->query($query, true);
$tablist = array();
for ($i = 0; $i < $db->num_rows($wynik); $i++) {
$tablist[$i]['id'] = $db->query_result($wynik, $i, "tabid");
$label = $db->query_result($wynik, $i, "name");
if ($db->query_result($wynik, $i, "customized") == 0) {
$tablist[$i]['label'] = getTranslatedString($label);
} else {
$tablist[$i]['label'] = getTranslatedString($label, $label);
}
}
if ($selected_module == '') {
$SMODULE = $tablist[0]['id'];
} else {
$SMODULE = $selected_module;
}
if ($tab_only == false) {
$viewer = new Vtiger_Viewer();
$viewer->assign("TABLIST", $tablist);
$viewer->assign("SMODULE", $SMODULE);
$viewer->assign("SELECTED_MODULE", $selected_module);
return $viewer->fetch('modules/OSSPdf/FieldModuleid.tpl');
} else {
return $tablist;
}
}
示例4: process
public function process($fieldName, $moduleName)
{
$viewer = new Vtiger_Viewer();
$viewer->assign('OPTION_LIST', $this->getOptions($fieldName));
$viewer->assign('FLD_ID', $fieldName);
$viewer->assign('FLD_NAME', $fieldName);
$viewer->assign('FLD_REQUIRED', $this->fieldIsRequired($fieldName, $moduleName));
return $viewer->view($this->tplAddress, "Settings:OSSProjectTemplates", true);
}
示例5: viewController
function viewController()
{
$smarty = new Vtiger_Viewer();
foreach ($this->parameters as $k => $v) {
$smarty->assign($k, $v);
}
$smarty->assign("IS_SAFARI", Mobile::isSafari());
$smarty->assign("SKIN", Mobile::config('Default.Skin'));
return $smarty;
}
示例6: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
$moduleName = $request->getModule();
$pageNumber = $request->get('page');
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
$searchValue = $request->get('search_value');
/*if(empty($orderBy) && empty($searchValue) && empty($pageNumber)) {
$orderParams = Vtiger_ListView_Model::getSortParamsSession($moduleName);
if($orderParams) {
$pageNumber = $orderParams['page'];
$orderBy = $orderParams['orderby'];
$sortOrder = $orderParams['sortorder'];
$searchValue = $orderParams['search_value'];
}
} else {
$params = array('page' => $pageNumber, 'orderby' => $orderBy, 'sortorder' => $sortOrder, 'search_value' => $searchValue);
Vtiger_ListView_Model::setSortParamsSession($moduleName, $params);
}*/
if ($sortOrder == "ASC") {
$nextSortOrder = "DESC";
$sortImage = "icon-chevron-down";
} else {
$nextSortOrder = "ASC";
$sortImage = "icon-chevron-up";
}
if (empty($pageNumber)) {
$pageNumber = '1';
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
$listViewModel = new Portal_ListView_Model();
if (!empty($orderBy)) {
$listViewModel->set('orderby', $orderBy);
$listViewModel->set('sortorder', $sortOrder);
}
if (!empty($searchValue)) {
$listViewModel->set('search_value', $searchValue);
}
$listviewEntries = $listViewModel->getListViewEntries($pagingModel);
$viewer->assign('LISTVIEW_ENTRIES', $listviewEntries);
$viewer->assign('ALPHABET_VALUE', $searchValue);
$viewer->assign('COLUMN_NAME', $orderBy);
$viewer->assign('SORT_ORDER', $sortOrder);
$viewer->assign('SORT_IMAGE', $sortImage);
$viewer->assign('NEXT_SORT_ORDER', $nextSortOrder);
$viewer->assign('RECORD_COUNT', count($listviewEntries));
$viewer->assign('CURRENT_PAGE', $pageNumber);
$viewer->assign('PAGING_INFO', $listViewModel->calculatePageRange($listviewEntries, $pagingModel));
}
示例7: showErrorPage
public static function showErrorPage($errorMessage, $errorDetails = false, $customActions = false)
{
$viewer = new Vtiger_Viewer();
$viewer->assign('ERROR_MESSAGE', $errorMessage);
$viewer->assign('ERROR_DETAILS', $errorDetails);
$viewer->assign('CUSTOM_ACTIONS', $customActions);
$viewer->assign('MODULE', 'Import');
$viewer->view('ImportError.tpl', 'Import');
}
示例8: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
$listViewModel = Settings_Vtiger_ListView_Model::getInstance($qualifiedModuleName);
$listViewModel->set('orderby', 'sequence');
$pagingModel = new Vtiger_Paging_Model();
if (!$this->listViewHeaders) {
$this->listViewHeaders = $listViewModel->getListViewHeaders();
}
if (!$this->listViewEntries) {
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
$viewer->assign('MODULE_MODEL', $listViewModel->getModule());
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
$viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
}
示例9: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$widgetView = new Reports_ChartDetail_View();
$currentUser = Users_Record_Model::getCurrentUserModel();
$widget = Vtiger_Widget_Model::getInstance($request->get('linkid'), $currentUser->getId());
$widget->applyTemplateRecordId($request->get('report_record_id'));
$viewer = new Vtiger_Viewer();
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$content = $request->get('content');
$reportDisplay = $widgetView->getReport($request, true);
if (!empty($content)) {
echo $reportDisplay;
} else {
$viewer->assign('CHART_REPORT_WIDGET_CONTENTS', $reportDisplay);
$viewer->view('dashboards/ChartReportWidget.tpl', $moduleName);
}
}
示例10: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
$moduleName = $this->getModule($request);
$recordId = $request->get('record');
$tooltipViewModel = Vtiger_TooltipView_Model::getInstance($moduleName, $recordId);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('MODULE_MODEL', $tooltipViewModel->getRecord()->getModule());
$viewer->assign('TOOLTIP_FIELDS', $tooltipViewModel->getFields());
$viewer->assign('RECORD', $tooltipViewModel->getRecord());
$viewer->assign('RECORD_STRUCTURE', $tooltipViewModel->getStructure());
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
}
示例11: checkLimits
public function checkLimits(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$record = $request->get('record');
$currency = $request->get('currency');
$price = $request->get('price');
$limitConfig = $request->get('limitConfig');
$limitFieldName = 'creditlimit';
$balanceFieldName = 'inventorybalance';
$moduleInstance = Vtiger_Module_Model::getInstance('Accounts');
$limitField = Vtiger_Field_Model::getInstance($limitFieldName, $moduleInstance);
$balanceField = Vtiger_Field_Model::getInstance($balanceFieldName, $moduleInstance);
if (!$limitField->isActiveField() || !$balanceField->isActiveField()) {
$response = new Vtiger_Response();
$response->setResult(['status' => true]);
$response->emit();
return;
}
$recordModel = Vtiger_Record_Model::getInstanceById($record, 'Accounts');
$limitID = $recordModel->get($limitFieldName);
$balance = $recordModel->get($balanceFieldName);
$limit = reset(Vtiger_InventoryLimit_UIType::getValues($limitID))['value'];
$baseCurrency = Vtiger_Util_Helper::getBaseCurrency();
$symbol = $baseCurrency['currency_symbol'];
if ($baseCurrency['id'] != $currency) {
$selectedCurrency = Vtiger_Functions::getCurrencySymbolandRate($currency);
$price = floatval($price) * $selectedCurrency['rate'];
$symbol = $selectedCurrency['symbol'];
}
$totalPrice = $price + $balance;
$status = $totalPrice > $limit ? false : true;
if (!$status) {
$viewer = new Vtiger_Viewer();
$viewer->assign('PRICE', $price);
$viewer->assign('BALANCE', $balance);
$viewer->assign('SYMBOL', $symbol);
$viewer->assign('LIMIT', $limit);
$viewer->assign('TOTALS', $totalPrice);
$viewer->assign('LIMIT_CONFIG', $limitConfig);
$html = $viewer->view('InventoryLimitAlert.tpl', $moduleName, true);
}
$response = new Vtiger_Response();
$response->setResult([
'status' => $status,
'html' => $html
]);
$response->emit();
}
示例12: throwNewException
static function throwNewException($Message)
{
$request = new Vtiger_Request($_REQUEST);
if (!$request->get('action') != '') {
$viewer = new Vtiger_Viewer();
$viewer->assign('MESSAGE', $Message);
$viewer->view('OperationNotPermitted.tpl', 'Vtiger');
} else {
echo $Message;
}
}
示例13: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
$moduleName = $request->getModule();
$cvId = $this->viewName;
$pageNumber = $request->get('page');
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
if ($sortOrder == "ASC") {
$nextSortOrder = "DESC";
$sortImage = "icon-chevron-down";
} else {
$nextSortOrder = "ASC";
$sortImage = "icon-chevron-up";
}
if (empty($pageNumber)) {
$pageNumber = '1';
}
$listViewModel = Vtiger_ListView_Model::getInstance($moduleName, $cvId);
$currentUser = Users_Record_Model::getCurrentUserModel();
$linkParams = array('MODULE' => $moduleName, 'ACTION' => $request->get('view'), 'CVID' => $cvId);
$linkModels = $listViewModel->getListViewMassActions($linkParams);
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
$pagingModel->set('viewid', $request->get('viewname'));
if (!empty($orderBy)) {
$listViewModel->set('orderby', $orderBy);
$listViewModel->set('sortorder', $sortOrder);
}
$searchKey = $request->get('search_key');
$searchValue = $request->get('search_value');
$operator = $request->get('operator');
if (!empty($operator)) {
$listViewModel->set('operator', $operator);
$viewer->assign('OPERATOR', $operator);
$viewer->assign('ALPHABET_VALUE', $searchValue);
}
if (!empty($searchKey) && !empty($searchValue)) {
$listViewModel->set('search_key', $searchKey);
$listViewModel->set('search_value', $searchValue);
}
$searchParmams = $request->get('search_params');
if (empty($searchParmams)) {
$searchParmams = array();
}
$transformedSearchParams = $this->transferListSearchParamsToFilterCondition($searchParmams, $listViewModel->getModule());
$listViewModel->set('search_params', $transformedSearchParams);
//To make smarty to get the details easily accesible
foreach ($searchParmams as $fieldListGroup) {
foreach ($fieldListGroup as $fieldSearchInfo) {
$fieldSearchInfo['searchValue'] = $fieldSearchInfo[2];
$fieldSearchInfo['fieldName'] = $fieldName = $fieldSearchInfo[0];
$searchParmams[$fieldName] = $fieldSearchInfo;
}
}
if (!$this->listViewHeaders) {
$this->listViewHeaders = $listViewModel->getListViewHeaders();
}
if (!$this->listViewEntries) {
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
$noOfEntries = count($this->listViewEntries);
$viewer->assign('MODULE', $moduleName);
if (!$this->listViewLinks) {
$this->listViewLinks = $listViewModel->getListViewLinks($linkParams);
}
$viewer->assign('LISTVIEW_LINKS', $this->listViewLinks);
$viewer->assign('LISTVIEW_MASSACTIONS', $linkModels['LISTVIEWMASSACTION']);
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('PAGE_NUMBER', $pageNumber);
$viewer->assign('ORDER_BY', $orderBy);
$viewer->assign('SORT_ORDER', $sortOrder);
$viewer->assign('NEXT_SORT_ORDER', $nextSortOrder);
$viewer->assign('SORT_IMAGE', $sortImage);
$viewer->assign('COLUMN_NAME', $orderBy);
if ($moduleName == 'SalesOrder') {
/**
* красим поле "сумма счета" (cf_773) или "оплата водителю"(cf_791)
* по полям "дата оплаты счета"(cf_819) и "водитель оплачен"/"водитель поставлен на оплату" (cf_892/897 )
*/
$filterFields = $listViewModel->get('query_generator')->getFields();
if (in_array('cf_773', $filterFields) || in_array('cf_791', $filterFields)) {
$analysisFields = $listViewModel->getFieldsForPainting($this->listViewEntries);
foreach ($this->listViewEntries as $key => &$entry) {
$rawData = $entry->getRawData();
$billPayedAt = $analysisFields[$rawData['salesorderid']]['cf_819'];
$driverQueue = $analysisFields[$rawData['salesorderid']]['cf_897'];
$driverPayed = $analysisFields[$rawData['salesorderid']]['cf_892'];
//дополняем значениями
if (!empty($billPayedAt)) {
$rawData['colored_bill'] = 'rgb(73, 215, 73)';
//нам оплатили
} else {
$rawData['colored_bill'] = '';
//нам не оплатили
}
if ($driverPayed == '1') {
$rawData['colored_driver'] = 'rgb(249, 81, 81)';
//если оплатили
} elseif ($driverQueue == '1') {
$rawData['colored_driver'] = 'yellow';
//.........这里部分代码省略.........
示例14: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer) {
$moduleName = $request->getModule();
$cvId = $request->get('viewname');
$pageNumber = $request->get('page');
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
if($sortOrder == "ASC"){
$nextSortOrder = "DESC";
$sortImage = "icon-chevron-down";
}else{
$nextSortOrder = "ASC";
$sortImage = "icon-chevron-up";
}
if(empty ($pageNumber)){
$pageNumber = '1';
}
$listViewModel = EmailTemplates_ListView_Model::getInstance($moduleName, $cvId);
$linkParams = array('MODULE'=>$moduleName, 'ACTION'=>$request->get('view'), 'CVID'=>$cvId);
$linkModels = $listViewModel->getListViewMassActions($linkParams);
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
if(!empty($orderBy)) {
$listViewModel->set('orderby', $orderBy);
$listViewModel->set('sortorder',$sortOrder);
}
$searchKey = $request->get('search_key');
$searchValue = $request->get('search_value');
$operator = $request->get('operator');
if(!empty($operator)) {
$listViewModel->set('operator', $operator);
$viewer->assign('OPERATOR',$operator);
$viewer->assign('ALPHABET_VALUE',$searchValue);
}
if(!empty($searchKey) && !empty($searchValue)) {
$listViewModel->set('search_key', $searchKey);
$listViewModel->set('search_value', $searchValue);
}
if(!$this->listViewHeaders){
$this->listViewHeaders = $listViewModel->getListViewHeaders();
}
if(!$this->listViewEntries){
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
$noOfEntries = count($this->listViewEntries);
$viewer->assign('VIEWID', $cvId);
$viewer->assign('MODULE', $moduleName);
if(!$this->listViewLinks){
$this->listViewLinks = $listViewModel->getListViewLinks($linkParams);
}
$viewer->assign('LISTVIEW_LINKS', $this->listViewLinks);
$viewer->assign('LISTVIEW_MASSACTIONS', $linkModels['LISTVIEWMASSACTION']);
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('PAGE_NUMBER',$pageNumber);
$viewer->assign('ORDER_BY',$orderBy);
$viewer->assign('SORT_ORDER',$sortOrder);
$viewer->assign('NEXT_SORT_ORDER',$nextSortOrder);
$viewer->assign('SORT_IMAGE',$sortImage);
$viewer->assign('COLUMN_NAME',$orderBy);
$viewer->assign('LISTVIEW_ENTIRES_COUNT',$noOfEntries);
$viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
$viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false)) {
if(!$this->listViewCount){
$this->listViewCount = $listViewModel->getListViewCount();
}
$viewer->assign('LISTVIEW_COUNT', $this->listViewCount);
}
$viewer->assign('IS_MODULE_EDITABLE', $listViewModel->getModule()->isPermitted('EditView'));
$viewer->assign('IS_MODULE_DELETABLE', $listViewModel->getModule()->isPermitted('Delete'));
}
示例15: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
$moduleName = $request->get('for_module');
$cvId = $request->get('viewname');
$pageNumber = $request->get('page');
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
if ($sortOrder == "ASC") {
$nextSortOrder = "DESC";
$sortImage = "downArrowSmall.png";
} else {
$nextSortOrder = "ASC";
$sortImage = "upArrowSmall.png";
}
if (empty($pageNumber)) {
$pageNumber = '1';
}
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$listViewModel = Import_ListView_Model::getInstance($moduleName, $cvId);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
if (!empty($orderBy)) {
$listViewModel->set('orderby', $orderBy);
$listViewModel->set('sortorder', $sortOrder);
}
if (!$this->listViewHeaders) {
$this->listViewHeaders = $listViewModel->getListViewHeaders();
}
if (!$this->listViewEntries) {
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
$noOfEntries = count($this->listViewEntries);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('PAGE_NUMBER', $pageNumber);
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
$viewer->assign('ORDER_BY', $orderBy);
$viewer->assign('SORT_ORDER', $sortOrder);
$viewer->assign('NEXT_SORT_ORDER', $nextSortOrder);
$viewer->assign('SORT_IMAGE', $sortImage);
$viewer->assign('COLUMN_NAME', $orderBy);
$viewer->assign('LISTVIEW_ENTIRES_COUNT', $noOfEntries);
$viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
$viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
$viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel());
}