本文整理汇总了PHP中Vtiger_Widget_Model类的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Widget_Model类的具体用法?PHP Vtiger_Widget_Model怎么用?PHP Vtiger_Widget_Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vtiger_Widget_Model类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$moduleName = $request->getModule();
$componentName = $request->get('name');
$linkId = $request->get('linkid');
$id = $request->get('widgetid');
if (!empty($componentName)) {
$className = Vtiger_Loader::getComponentClassName('Dashboard', $componentName, $moduleName);
if (!empty($className)) {
$widget = NULL;
if (!empty($linkId)) {
$widget = new Vtiger_Widget_Model();
$widget->set('linkid', $linkId);
$widget->set('userid', $currentUser->getId());
$widget->set('widgetid', $id);
$widget->set('active', $request->get('active'));
$widget->set('filterid', $request->get('filterid', NULL));
if ($request->has('data')) {
$widget->set('data', $request->get('data'));
}
$widget->show();
}
$classInstance = new $className();
$classInstance->process($request, $widget);
return;
}
}
$response = new Vtiger_Response();
$response->setResult(array('success' => false, 'message' => vtranslate('NO_DATA')));
$response->emit();
}
示例2: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$linkId = $request->get('linkid');
$owner = $request->get('owner');
$dates = $request->get('expectedclosedate');
//Date conversion from user to database format
if (!empty($dates)) {
$dates['start'] = Vtiger_Date_UIType::getDBInsertedValue($dates['start']);
$dates['end'] = Vtiger_Date_UIType::getDBInsertedValue($dates['end']);
}
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$data = $moduleModel->getPotentialsCountBySalesStage($owner, $dates);
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('DATA', $data);
//Include special script and css needed for this widget
$viewer->assign('SCRIPTS', $this->getHeaderScripts($request));
$viewer->assign('STYLES', $this->getHeaderCss($request));
$viewer->assign('CURRENTUSER', $currentUser);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/GroupBySalesStage.tpl', $moduleName);
}
}
示例3: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$linkId = $request->get('linkid');
$expectedclosedate = $request->get('expectedclosedate');
//Date conversion from user to database format
if (!empty($expectedclosedate)) {
$closingdates['start'] = Vtiger_Date_UIType::getDBInsertedValue($expectedclosedate['start']);
$closingdates['end'] = Vtiger_Date_UIType::getDBInsertedValue($expectedclosedate['end']);
}
$createdTime = $request->get('createdtime');
//Date conversion from user to database format
if (!empty($createdTime)) {
$dates['start'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['start']);
$dates['end'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['end']);
}
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$data = $moduleModel->getForecast($closingdates, $dates);
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
//Include special script and css needed for this widget
$viewer->assign('SCRIPTS', $this->getHeaderScripts($request));
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('DATA', $data);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/Forecast.tpl', $moduleName);
}
}
示例4: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$linkId = $request->get('linkid');
$data = $request->get('data');
$createdTime = $request->get('createdtime');
//Date conversion from user to database format
if (!empty($createdTime)) {
$dates['start'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['start']);
$dates['end'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['end']);
}
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$data = $moduleModel->getCountriesByRating($request->get('owner'), $dates);
$listViewUrl = $moduleModel->getListViewUrl();
for ($i = 0; $i < count($data); $i++) {
$data[$i]["links"] = $listViewUrl . $this->getSearchParams($data[$i][2], $request->get('owner'), $dates);
}
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
//Include special script and css needed for this widget
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('DATA', $data);
$viewer->assign('CURRENTUSER', $currentUser);
$accessibleUsers = $currentUser->getAccessibleUsersForModule($moduleName);
$viewer->assign('ACCESSIBLE_USERS', $accessibleUsers);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/CountriesByRating.tpl', $moduleName);
}
}
示例5: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$number = $request->get('number');
$page = $request->get('page');
$linkId = $request->get('linkid');
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
$limit = (int) $widget->get('limit');
if (empty($limit)) {
$limit = 10;
}
if (empty($page)) {
$page = 1;
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $page);
$pagingModel->set('limit', $limit);
$columnList = array('LBL_NAME' => 'label', 'LBL_MODULE_NAME' => 'setype', 'Last Modified By' => 'modifiedtime', 'LBL_OWNER' => 'smownerid');
$recordList = ListUpdatedRecord::getListRecord(NULL, $columnList);
$viewer->assign('COLUMN_LIST', $columnList);
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('LIST', $recordList);
$viewer->assign('PAGE', $page);
$viewer->assign('NEXTPAGE', count($recordList) < $limit ? 0 : $page + 1);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/ListUpdatedRecordContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/ListUpdatedRecord.tpl', $moduleName);
}
}
示例6: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$linkId = $request->get('linkid');
$user = $request->get('user');
$time = $request->get('time');
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
$data = $moduleModel->getWidgetTimeControl($user, $time);
$workDays = $moduleModel->getWorkingDays($time['start'], $time['end']);
$selectedDays = (strtotime($time['end']) - strtotime($time['start'])) / (60 * 60 * 24) + 1;
$viewer->assign('SELECTEDDAYS', $selectedDays);
$viewer->assign('WORKDAYS', $workDays);
$viewer->assign('AVERAGE', $data['average']);
$viewer->assign('COUNTDAYS', $data['countDays']);
$viewer->assign('USERID', $user);
$viewer->assign('DTIME', $time);
$viewer->assign('DATA', $data['data']);
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('CURRENTUSER', $currentUser);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/TimeControlContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/TimeControl.tpl', $moduleName);
}
}
示例7: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$linkId = $request->get('linkid');
$page = $request->get('page');
if (empty($page)) {
$page = 1;
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $page);
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$models = $moduleModel->getTopPotentials($pagingModel);
$moduleHeader = $moduleModel->getTopPotentialsHeader();
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('MODULE_HEADER', $moduleHeader);
$viewer->assign('MODELS', $models);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/TopPotentialsContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/TopPotentials.tpl', $moduleName);
}
}
示例8: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$linkId = $request->get('linkid');
//var_dump($request->get('createdtime'));
$kpiHelper = new Vtiger_Kpi_Helper($request);
$data = $kpiHelper->getData($request);
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
$viewer->assign('KPILIST', $kpiHelper->getKpiList());
$viewer->assign('KPITYPES', $kpiHelper->getKpiTypes());
$viewer->assign('DTYPE', $request->get('type'));
$viewer->assign('DSERVICE', $request->get('service'));
$viewer->assign('DTIME', $request->get('time'));
//$viewer->assign('KPIHELPER', $kpiHelper);
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('DATA', $data);
//Include special script and css needed for this widget
$viewer->assign('CURRENTUSER', $currentUser);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/KpiContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/Kpi.tpl', $moduleName);
}
}
示例9: getDashboards
/**
* Function returns List of User's selected Dashboard Widgets
* @return <Array of Vtiger_Widget_Model>
*/
public function getDashboards()
{
$db = PearDatabase::getInstance();
$currentUser = Users_Record_Model::getCurrentUserModel();
$moduleModel = $this->getModule();
$sql = " SELECT vtiger_links.*, vtiger_module_dashboard_widgets.userid, vtiger_module_dashboard_widgets.id as widgetid, vtiger_module_dashboard_widgets.position as position, vtiger_links.linkid as id FROM vtiger_links " . " INNER JOIN vtiger_module_dashboard_widgets ON vtiger_links.linkid=vtiger_module_dashboard_widgets.linkid" . " WHERE (vtiger_module_dashboard_widgets.userid = ? AND linktype = ? AND tabid = ?)";
$params = array($currentUser->getId(), 'DASHBOARDWIDGET', $moduleModel->getId());
$result = $db->pquery($sql, $params);
$widgets = array();
for ($i = 0, $len = $db->num_rows($result); $i < $len; $i++) {
$row = $db->query_result_rowdata($result, $i);
$row['linkid'] = $row['id'];
$widgets[] = Vtiger_Widget_Model::getInstanceFromValues($row);
}
foreach ($widgets as $index => $widget) {
$label = $widget->get('linklabel');
if ($label == 'Tag Cloud') {
$isTagCloudExists = getTagCloudView($currentUser->getId());
if ($isTagCloudExists === 'false') {
unset($widgets[$index]);
}
}
}
return $widgets;
}
示例10: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$linkId = $request->get('linkid');
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$data = $moduleModel->getPotentialTotalAmountBySalesStage();
$listViewUrl = $moduleModel->getListViewUrl();
for ($i = 0; $i < count($data); $i++) {
$data[$i]["links"] = $listViewUrl . $this->getSearchParams($data[$i][1]);
}
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('DATA', $data);
$viewer->assign('STYLES', $this->getHeaderCss($request));
$viewer->assign('CURRENTUSER', $currentUser);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/FunnelAmount.tpl', $moduleName);
}
}
示例11: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$linkId = $request->get('linkid');
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$data = $moduleModel->getOpenTickets();
$listViewUrl = $moduleModel->getListViewUrl();
for ($i = 0; $i < count($data); $i++) {
$data[$i]["links"] = $listViewUrl . $this->getSearchParams($data[$i][name]);
}
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('DATA', $data);
//Include special script and css needed for this widget
$viewer->assign('CURRENTUSER', $currentUser);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/OpenTickets.tpl', $moduleName);
}
}
示例12: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$page = $request->get('page');
$linkId = $request->get('linkid');
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
if (!$request->has('owner')) {
$owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget);
} else {
$owner = $request->get('owner');
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $page);
$pagingModel->set('limit', (int) $widget->get('limit'));
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$projectsTasks = $owner === false ? array() : $moduleModel->getAssignedProjectsTasks('upcoming', $pagingModel, $owner);
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('PROJECTSTASKS', $projectsTasks);
$viewer->assign('PAGING', $pagingModel);
$viewer->assign('CURRENTUSER', $currentUser);
global $title_max_length, $href_max_length;
$viewer->assign('NAMELENGHT', $title_max_length);
$viewer->assign('HREFNAMELENGHT', $href_max_length);
$viewer->assign('NODATAMSGLABLE', 'LBL_NO_OVERDUE_ACTIVITIES');
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/AssignedProjectsTasksContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/AssignedProjectsTasks.tpl', $moduleName);
}
}
示例13: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$linkId = $request->get('linkid');
$createdTime = $request->get('createdtime');
$owner = $request->get('owner');
//Date conversion from user to database format
if (!empty($createdTime)) {
$dates['start'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['start']);
$dates['end'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['end']);
}
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$data = $moduleModel->getLeadsCreated($owner, $dates);
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
//Include special script and css needed for this widget
$viewer->assign('SCRIPTS', $this->getHeaderScripts($request));
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('DATA', $data);
$viewer->assign('CURRENTUSER', $currentUser);
$accessibleUsers = $currentUser->getAccessibleUsersForModule('Leads');
$viewer->assign('ACCESSIBLE_USERS', $accessibleUsers);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/LeadsCreated.tpl', $moduleName);
}
}
示例14: process
public function process(Vtiger_Request $request)
{
$LIMIT = 10;
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$type = $request->get('type');
$page = $request->get('page');
$linkId = $request->get('linkid');
if (empty($page)) {
$page = 1;
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $page);
$pagingModel->set('limit', $LIMIT);
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$history = $moduleModel->getHistory($pagingModel, $type);
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
$modCommentsModel = Vtiger_Module_Model::getInstance('ModComments');
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('HISTORIES', $history);
$viewer->assign('PAGE', $page);
$viewer->assign('NEXTPAGE', count($history) < $LIMIT ? 0 : $page + 1);
$viewer->assign('COMMENTS_MODULE_MODEL', $modCommentsModel);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/HistoryContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/History.tpl', $moduleName);
}
}
示例15: process
public function process(Vtiger_Request $request, $widget = NULL)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
// Initialize Widget to the right-state of information
if ($widget && !$request->has('widgetid')) {
$widgetId = $widget->get('id');
} else {
$widgetId = $request->get('widgetid');
}
$widget = Vtiger_Widget_Model::getInstanceWithWidgetId($widgetId, $currentUser->getId());
if (!$request->has('owner')) {
$owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget);
} else {
$owner = $request->get('owner');
}
$minilistWidgetModel = new Vtiger_MiniList_Model();
$minilistWidgetModel->setWidgetModel($widget);
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('USER', $owner);
$viewer->assign('CURRENTUSER', $currentUser);
$viewer->assign('MINILIST_WIDGET_MODEL', $minilistWidgetModel);
$viewer->assign('BASE_MODULE', $minilistWidgetModel->getTargetModule());
$viewer->assign('SCRIPTS', $this->getFooterScripts());
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/MiniListContents.tpl', $moduleName);
} else {
$widget->set('title', $minilistWidgetModel->getTitle());
$viewer->view('dashboards/MiniList.tpl', $moduleName);
}
}