コード例 #1
0
 public function preProcess(Vtiger_Request $request, $display = true)
 {
     if ($this->checkPermission($request)) {
         $currentUser = Users_Record_Model::getCurrentUserModel();
         $viewer = $this->getViewer($request);
         $menuModelsList = Vtiger_Menu_Model::getAll(true);
         $selectedModule = $request->getModule();
         $menuStructure = Vtiger_MenuStructure_Model::getInstanceFromMenuList($menuModelsList, $selectedModule);
         // Order by pre-defined automation process for QuickCreate.
         uksort($menuModelsList, array('Vtiger_MenuStructure_Model', 'sortMenuItemsByProcess'));
         $companyDetails = Vtiger_CompanyDetails_Model::getInstanceById();
         $companyLogo = $companyDetails->getLogo();
         $viewer->assign('CURRENTDATE', date('Y-n-j'));
         $viewer->assign('MODULE', $selectedModule);
         $viewer->assign('PARENT_MODULE', $request->get('parent'));
         $viewer->assign('VIEW', $request->get('view'));
         $viewer->assign('MENUS', $menuModelsList);
         $viewer->assign('MENU_STRUCTURE', $menuStructure);
         $viewer->assign('MENU_SELECTED_MODULENAME', $selectedModule);
         $viewer->assign('MENU_TOPITEMS_LIMIT', $menuStructure->getLimit());
         $viewer->assign('COMPANY_LOGO', $companyLogo);
         $viewer->assign('USER_MODEL', $currentUser);
         $viewer->assign('SEARCHABLE_MODULES', Vtiger_Module_Model::getSearchableModules());
         $homeModuleModel = Vtiger_Module_Model::getInstance('Home');
         $viewer->assign('HOME_MODULE_MODEL', $homeModuleModel);
         $viewer->assign('HEADER_LINKS', $this->getHeaderLinks());
         $viewer->assign('ANNOUNCEMENT', $this->getAnnouncement());
         $viewer->assign('CURRENT_VIEW', $request->get('view'));
         $viewer->assign('PAGETITLE', $this->getPageTitle($request));
         $viewer->assign('SCRIPTS', $this->getHeaderScripts($request));
         $viewer->assign('STYLES', $this->getHeaderCss($request));
         $viewer->assign('LANGUAGE_STRINGS', $this->getJSLanguageStrings($request));
         $viewer->assign('SKIN_PATH', Vtiger_Theme::getCurrentUserThemePath());
         $viewer->assign('IS_PREFERENCE', true);
         $viewer->assign('LANGUAGE', $currentUser->get('language'));
         $allUsers = Users_Record_Model::getAll(true);
         $sharedUsers = Calendar_Module_Model::getCaledarSharedUsers($currentUser->id);
         $sharedType = Calendar_Module_Model::getSharedType($currentUser->id);
         $viewer->assign('ALL_USERS', $allUsers);
         $viewer->assign('SHAREDUSERS', $sharedUsers);
         $viewer->assign('SHARED_TYPE', $sharedType);
         // OpenSaaS
         $OSSMenu = OSSMenuManager_Record_Model::getMenu();
         $viewer->assign('MENU_STRUCTURE', $OSSMenu);
         //  OpenSaaS
         if ($display) {
             $this->preProcessDisplay($request);
         }
     }
 }
コード例 #2
0
ファイル: Basic.php プロジェクト: rcrrich/UpdatePackages
 function preProcess(Vtiger_Request $request, $display = true)
 {
     parent::preProcess($request, false);
     $viewer = $this->getViewer($request);
     $menuModelsList = Vtiger_Menu_Model::getAll(true);
     $selectedModule = $request->getModule();
     $menuStructure = Vtiger_MenuStructure_Model::getInstanceFromMenuList($menuModelsList, $selectedModule);
     $companyDetails = Vtiger_CompanyDetails_Model::getInstanceById();
     $companyLogo = $companyDetails->getLogo();
     $currentDate = Vtiger_Date_UIType::getDisplayDateValue(date('Y-n-j'));
     $viewer->assign('CURRENTDATE', $currentDate);
     $viewer->assign('MODULE', $selectedModule);
     $viewer->assign('MODULE_NAME', $selectedModule);
     $viewer->assign('QUALIFIED_MODULE', $selectedModule);
     $viewer->assign('PARENT_MODULE', $request->get('parent'));
     $viewer->assign('VIEW', $request->get('view'));
     // Order by pre-defined automation process for QuickCreate.
     uksort($menuModelsList, array('Vtiger_MenuStructure_Model', 'sortMenuItemsByProcess'));
     $viewer->assign('MENUS', $menuModelsList);
     //$viewer->assign('MENU_STRUCTURE', $menuStructure);
     $viewer->assign('MENU_SELECTED_MODULENAME', $selectedModule);
     $viewer->assign('MENU_TOPITEMS_LIMIT', $menuStructure->getLimit());
     $viewer->assign('COMPANY_LOGO', $companyLogo);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $homeModuleModel = Vtiger_Module_Model::getInstance('Home');
     $viewer->assign('HOME_MODULE_MODEL', $homeModuleModel);
     $viewer->assign('HEADER_LINKS', $this->getHeaderLinks());
     $viewer->assign('ANNOUNCEMENT', $this->getAnnouncement());
     $viewer->assign('SEARCHABLE_MODULES', Vtiger_Module_Model::getSearchableModules());
     $viewer->assign('CHAT_ACTIVE', vtlib_isModuleActive('AJAXChat'));
     // OpenSaaS
     $OSSMenu = OSSMenuManager_Record_Model::getMenu();
     $paintedIcon = OSSMenuManager_Record_Model::getIcon();
     $viewer->assign('MENU_STRUCTURE', $OSSMenu);
     $viewer->assign('PAINTEDICON', $paintedIcon);
     $viewer->assign('WORKTIME', OSSEmployees_Record_Model::getWorkTime());
     //  OpenSaaS
     if ($display) {
         $this->preProcessDisplay($request);
     }
 }
コード例 #3
0
ファイル: init.php プロジェクト: rcrrich/UpdatePackages
 public function addModuleToMenu($moduleName, $parent)
 {
     global $log;
     $log->debug("Entering YetiForceUpdate::addModuleToMenu({$moduleName}, {$parent}) method ...");
     $adb = PearDatabase::getInstance();
     if (!$parent) {
         return false;
     }
     $sql = "SELECT `profileid` FROM `vtiger_profile` WHERE 1;";
     $result = $adb->query($sql, true);
     $num = $adb->num_rows($result);
     $profiles = array();
     for ($i = 0; $i < $num; $i++) {
         $profiles[] = $adb->query_result($result, $i, 'profileid');
     }
     $profilePermissions = implode(' |##| ', $profiles);
     $profilePermissions = ' ' . $profilePermissions . ' ';
     //$blocksModule = array('My Home Page','Companies','Human resources','Sales','Projects','Support','Databases');
     $sql = "SELECT `id` FROM `vtiger_ossmenumanager` WHERE label = ? AND tabid = ? AND parent_id = ?;";
     $result = $adb->pquery($sql, array($parent, 0, 0), true);
     $num = $adb->num_rows($result);
     if ($num == 0) {
         $subParams = array('name' => $parent, 'visible' => '1', 'permission' => $profilePermissions, 'locationicon' => '', 'sizeicon' => '', 'langfield' => '');
         $id = OSSMenuManager_Record_Model::addBlock($subParams);
         if ($id) {
             $subParams = array('parent_id' => $id, 'tabid' => getTabid($moduleName), 'label' => $moduleName, 'sequence' => -1, 'visible' => '1', 'type' => 0, 'url' => '', 'new_window' => 0, 'permission' => $profilePermissions, 'locationicon' => '', 'sizeicon' => '', 'langfield' => '');
             $id = OSSMenuManager_Record_Model::addMenu($subParams);
         }
     } elseif ($num == 1) {
         $subParams = array('parent_id' => $adb->query_result($result, 0, 'id'), 'tabid' => getTabid($moduleName), 'label' => $moduleName, 'sequence' => -1, 'visible' => '1', 'type' => 0, 'url' => '', 'new_window' => 0, 'permission' => $profilePermissions, 'locationicon' => '', 'sizeicon' => '', 'langfield' => '');
         $id = OSSMenuManager_Record_Model::addMenu($subParams);
     }
     $log->debug("Exiting YetiForceUpdate::addModuleToMenu() method ...");
 }