• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Portlet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Portlet的典型用法代码示例。如果您正苦于以下问题:PHP Portlet类的具体用法?PHP Portlet怎么用?PHP Portlet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Portlet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: renderViewForAgreementWithAgmntProduct

 protected function renderViewForAgreementWithAgmntProduct(Portlet $portlet)
 {
     if ($this->params['relationModel']->modelClassNameToBean['Agreement']->id != null) {
         $id = $this->params['relationModel']->modelClassNameToBean['Agreement']->id;
         $data = $this::getAllAgreementProducts($this->params['relationModel']->modelClassNameToBean['Agreement']->id);
         if (count($data) > 0) {
             $content = $portlet->renderContent();
             $tableCreation = '<div class="view-toolbar-container clearfix"><div class="panel"><div class="panelTitle">Agreement Products</div>';
             //$tableCreation .= '<div><table style="padding-left: 3%; text-align: right; vertical-align: top;" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="pbTitle">&nbsp;</td><td id="thePage:theTable:theSelectedBlock:j_id3" class="pbButton "><input type="submit" name="thePage:theTable:theSelectedBlock:j_id3:j_id5" value="Estimator Summary" onclick="top.location.replace(\'/apex/OpportunitProductsSummary?id=006j000000Ljedx\');return false;" class="btn"></td></tr></tbody></table></div>';
             //$tableCreation .= '<div class="form-toolbar clearfix"><a id="addProduct" name="Add Products" class="attachLoading z-button" href="/app/index.php/agreementProducts/default/AddProductsInAgreement?optId='.$id.'"><span class="z-spinner"></span><span class="z-icon"></span><span class="z-label">Add Product</span></a><div class="post-to-profile clearfix"> <a id="estimateSummary" name="Estimate Summary" class="attachLoading z-button" onclick="/" href="#"><span class="z-spinner"></span><span class="z-icon"></span><span class="z-label">Estimate Summary</span></a></div></div>';
             $tableCreation .= '<table style="padding-left: 3%; text-align: right; vertical-align: top;"  border="0" cellpadding="2" cellspacing="0" width="100%">
                     <colgroup span="5"></colgroup>';
             $tableCreation .= '<thead style="font-weight: bold; background-color:#E6E6E6; color: #999; vertical-align: inherit; padding: 5px;"><th style="font-weight: bold;">Product Code</th><th style="font-weight: bold;">Product</th><th style="font-weight: bold;">Quantity</th><th style="font-weight: bold;">Frequency</th><th style="font-weight: bold;">Unit of Measure</th></thead><tbody>';
             foreach ($data as $row) {
                 $tableCreation .= '<tr><td style="width: 20%;  padding-top: 2px; text-align: left;">' . $row['name'] . '</td><td style="width: 40%;  padding-top: 2px; text-align: left;">' . $row['name'] . '</td><td style="width: 13%;  padding-top: 2px; text-align: center;">' . $row['quantity'] . '</td><td style="width: 13%;  padding-top: 2px; text-align: center;">' . $row['frequency'] . '</td><td style="width: 14%;  padding-top: 2px; text-align: center;">' . $row['total_mhr'] . '</td></tr>';
             }
             $tableCreation .= '</tbody></table></div></div>';
             $content .= $tableCreation;
             return $content;
         } else {
             return $portlet->renderContent();
         }
     } else {
         return $portlet->renderContent();
     }
 }
开发者ID:RamaKavanan,项目名称:BaseVersion,代码行数:26,代码来源:AgreementRelationsSecuredPortletFrameView.php


示例2: renderContent

 protected function renderContent()
 {
     $placedViewTypes = Portlet::getPlacedViewTypesByLayoutIdAndUser($this->uniqueLayoutId, Yii::app()->user->userModel->id);
     $modules = Module::getModuleObjects();
     $sortablePortlets = array();
     foreach ($modules as $module) {
         if ($module->isEnabled()) {
             $p = $module->getParentModule();
             $viewClassNames = $module::getViewClassNames();
             foreach ($viewClassNames as $className) {
                 $viewReflectionClass = new ReflectionClass($className);
                 if (!$viewReflectionClass->isAbstract()) {
                     $portletRules = PortletRulesFactory::createPortletRulesByView($className);
                     if ($viewReflectionClass->implementsInterface('RelatedPortletViewInterface')) {
                         if ($this->resolveLayoutIdInAllowedOnPortletViewClassNames($className) && $className::allowMultiplePlacement() == false && !in_array($portletRules->getType(), $placedViewTypes) && PortletsSecurityUtil::doesCurrentUserHavePermissionToAddPortlet($portletRules) === true) {
                             $metadata = $className::getMetadata();
                             $url = Yii::app()->createUrl($this->moduleId . '/defaultPortlet/add', array('uniqueLayoutId' => $this->uniqueLayoutId, 'modelId' => $this->modelId, 'portletType' => $portletRules->getType()));
                             $title = $metadata['perUser']['title'];
                             MetadataUtil::resolveEvaluateSubString($title);
                             $sortablePortlets[$title] = array('url' => $url, 'title' => $title, 'portletRules' => $portletRules);
                         }
                     }
                 }
             }
         }
     }
     if (empty($sortablePortlets)) {
         $messageView = new NoPortletsToPlaceView();
         return $messageView->render();
     }
     //Sort by title
     ksort($sortablePortlets);
     return PortletUtil::renderAddPortletsContent($sortablePortlets);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:34,代码来源:DetailsPortletSelectionView.php


示例3: testAdditionOfPortletsInEmptyRightPanel

 public function testAdditionOfPortletsInEmptyRightPanel()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $superLeadId = self::getModelIdByModelNameAndName('Contact', 'superLead superLeadson');
     $marketingListId = self::getModelIdByModelNameAndName('MarketingList', 'MarketingListName');
     $leads = Contact::getAll();
     $this->assertEquals(1, count($leads));
     //Load Model Detail Views
     $this->setGetArray(array('id' => $superLeadId, 'lockPortlets' => '0'));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('leads/default/details');
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('LeadDetailsAndRelationsView', $super->id, array());
     $this->assertEquals(3, count($portlets[1]));
     $this->assertFalse(array_key_exists(3, $portlets));
     $this->assertEquals(2, count($portlets[2]));
     foreach ($portlets[2] as $position => $portlet) {
         $portlet->delete();
     }
     $this->setGetArray(array('modelId' => $superLeadId, 'uniqueLayoutId' => 'LeadDetailsAndRelationsView', 'portletType' => 'MarketingListsForContactRelatedList', 'redirect' => '0'));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('leads/defaultPortlet/add', true);
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('LeadDetailsAndRelationsView', $super->id, array());
     $this->assertEquals(1, count($portlets[2]));
     //Test subscribe to list link
     $portlet = $portlets[2][1];
     $this->setGetArray(array('portletId' => $portlet->id, 'relationAttributeName' => 'lead', 'relationModelId' => $superLeadId, 'relationModuleId' => 'leads', 'uniqueLayoutId' => $portlet->getUniquePortletPageId(), 'relationModelClassName' => null));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('marketingLists/default/selectFromRelatedList');
     //Test subscribe a marketing list
     $this->setGetArray(array('modelId' => $marketingListId, 'portletId' => $portlet->id, 'relationAttributeName' => 'lead', 'relationModelId' => $superLeadId, 'relationModuleId' => 'leads', 'uniqueLayoutId' => $portlet->getUniquePortletPageId(), 'relationModelClassName' => null));
     $this->resetPostArray();
     $content = $this->runControllerWithRedirectExceptionAndGetContent('marketingLists/defaultPortlet/selectFromRelatedListSave');
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:33,代码来源:LeadDetailsAndRelationsPortletViewTest.php


示例4: testSaveAndRetrievePortlet

 public function testSaveAndRetrievePortlet()
 {
     $user = UserTestHelper::createBasicUser('Billy');
     $contracts = Contract::getByName('superOpp');
     $portlet = new Portlet();
     $portlet->column = 2;
     $portlet->position = 5;
     $portlet->layoutId = 'Test';
     $portlet->collapsed = true;
     $portlet->viewType = 'ContractsForContactRelatedList';
     $portlet->serializedViewData = serialize(array('title' => 'Testing Title'));
     $portlet->user = $user;
     $this->assertTrue($portlet->save());
     $portlet = Portlet::getById($portlet->id);
     $params = array('controllerId' => 'test', 'relationModuleId' => 'test', 'relationModel' => $contracts[0], 'redirectUrl' => 'someRedirect');
     $portlet->params = $params;
     $unserializedViewData = unserialize($portlet->serializedViewData);
     $this->assertEquals(2, $portlet->column);
     $this->assertEquals(5, $portlet->position);
     $this->assertEquals('Testing Title', $portlet->getTitle());
     $this->assertEquals(false, $portlet->isEditable());
     $this->assertEquals('Test', $portlet->layoutId);
     //$this->assertEquals(true,                  $portlet->collapsed); //reenable once working
     $this->assertEquals('ContractsForContactRelatedList', $portlet->viewType);
     $this->assertEquals($user->id, $portlet->user->id);
     $view = $portlet->getView();
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:27,代码来源:ContractsRelatedListPortletTest.php


示例5: renderContent

 protected function renderContent()
 {
     $placedViewTypes = Portlet::getPlacedViewTypesByLayoutIdAndUser($this->uniqueLayoutId, Yii::app()->user->userModel->id);
     $content = '<ul class="available-portlets">';
     $modules = Module::getModuleObjects();
     foreach ($modules as $module) {
         if ($module->isEnabled()) {
             $p = $module->getParentModule();
             $viewClassNames = $module::getViewClassNames();
             foreach ($viewClassNames as $className) {
                 $viewReflectionClass = new ReflectionClass($className);
                 if (!$viewReflectionClass->isAbstract()) {
                     $portletRules = PortletRulesFactory::createPortletRulesByView($className);
                     if ($portletRules != null && $portletRules->allowOnDashboard()) {
                         if ($portletRules->allowMultiplePlacementOnDashboard() && PortletsSecurityUtil::doesCurrentUserHavePermissionToAddPortlet($portletRules) === true || !$portletRules->allowMultiplePlacementOnDashboard() && !in_array($portletRules->getType(), $placedViewTypes) && PortletsSecurityUtil::doesCurrentUserHavePermissionToAddPortlet($portletRules) === true) {
                             $metadata = $className::getMetadata();
                             $url = Yii::app()->createUrl($this->moduleId . '/defaultPortlet/add', array('uniqueLayoutId' => $this->uniqueLayoutId, 'dashboardId' => $this->dashboardId, 'portletType' => $portletRules->getType()));
                             $onClick = 'window.location.href = "' . $url . '"';
                             $content .= '<li>';
                             $title = $metadata['perUser']['title'];
                             MetadataUtil::resolveEvaluateSubString($title);
                             $label = '<span>\\</span>' . $title;
                             $content .= ZurmoHtml::link(Zurmo::t('HomeModule', $label), null, array('onclick' => $onClick));
                             $content .= '</li>';
                         }
                     }
                 }
             }
         }
     }
     $content .= '</ul>';
     return $content;
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:33,代码来源:HomeDashboardPortletSelectionView.php


示例6: testSuperUserAllDefaultControllerActions

 public function testSuperUserAllDefaultControllerActions()
 {
     // key used to test persistance of user settings
     $configKey = 'rollup';
     //Set the current user as the super user.
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $accounts = Account::getAll();
     $this->assertEquals(1, count($accounts));
     $superAccountId = self::getModelIdByModelNameAndName('Account', 'superAccount');
     //Load Details view to generate the portlets.
     $this->setGetArray(array('id' => $superAccountId));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('accounts/default/details');
     //Find the LatestActivity portlet.
     $portletToUse = null;
     $portlets = Portlet::getAll();
     foreach ($portlets as $portlet) {
         if ($portlet->viewType == 'AccountLatestActivitiesForPortlet') {
             $portletToUse = $portlet;
             break;
         }
     }
     $this->assertNotNull($portletToUse);
     $this->assertEquals('AccountLatestActivitiesForPortletView', get_class($portletToUse->getView()));
     //Load the portlet details for latest activity
     $getData = array('id' => $superAccountId, 'portletId' => $portletToUse->id, 'uniqueLayoutId' => 'AccountDetailsAndRelationsView_' . $portletToUse->id, 'LatestActivitiesConfigurationForm' => array('filteredByModelName' => 'all', 'rollup' => ''));
     $this->setGetArray($getData);
     $this->resetPostArray();
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
     $this->assertTrue(LatestActivitiesPortletPersistentConfigUtil::getForCurrentUserByPortletIdAndKey($getData['portletId'], $configKey) === '');
     //Now add roll up
     $getData['LatestActivitiesConfigurationForm']['rollup'] = '1';
     $this->setGetArray($getData);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
     $this->assertTrue(LatestActivitiesPortletPersistentConfigUtil::getForCurrentUserByPortletIdAndKey($getData['portletId'], $configKey) === '1');
     //Now filter by meeting, task, and note
     $getData['LatestActivitiesConfigurationForm']['filteredByModelName'] = 'Meeting';
     $this->setGetArray($getData);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
     $getData['LatestActivitiesConfigurationForm']['filteredByModelName'] = 'Note';
     $this->setGetArray($getData);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
     $getData['LatestActivitiesConfigurationForm']['filteredByModelName'] = 'Task';
     $this->setGetArray($getData);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
     //Now do the same thing with filtering but turn off rollup.
     $getData['LatestActivitiesConfigurationForm']['rollup'] = '';
     $getData['LatestActivitiesConfigurationForm']['filteredByModelName'] = 'Meeting';
     $this->setGetArray($getData);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
     $this->assertTrue(LatestActivitiesPortletPersistentConfigUtil::getForCurrentUserByPortletIdAndKey($getData['portletId'], $configKey) === '');
     $getData['LatestActivitiesConfigurationForm']['filteredByModelName'] = 'Note';
     $this->setGetArray($getData);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
     $getData['LatestActivitiesConfigurationForm']['filteredByModelName'] = 'Task';
     $this->setGetArray($getData);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:58,代码来源:AccountLatestActivitiesSuperUserWalkthroughTest.php


示例7: getPlacedViewTypes

 protected function getPlacedViewTypes()
 {
     $portlets = Portlet::getByLayoutIdAndUserSortedById($this->uniqueLayoutId, Yii::app()->user->userModel->id);
     $placedViewTypes = array();
     foreach ($portlets as $portlet) {
         $placedViewTypes[] = $portlet->viewType;
     }
     return $placedViewTypes;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:9,代码来源:HomeDashboardPortletSelectionView.php


示例8: testRegularUserProductPortletAccess

 public function testRegularUserProductPortletAccess()
 {
     $benny = $this->logoutCurrentUserLoginNewUserAndGetByUsername('nobody');
     $account = AccountTestHelper::createAccountByNameForOwner('superAccount', Yii::app()->user->userModel);
     $superAccountId = $account->id;
     $benny->setRight('ProductTemplatesModule', ProductTemplatesModule::getAccessRight(), Right::DENY);
     $this->assertTrue($benny->save());
     $this->assertFalse(RightsUtil::canUserAccessModule('ProductTemplatesModule', $benny));
     $portlet = new Portlet();
     $portlet->column = 1;
     $portlet->position = 1;
     $portlet->layoutId = 'Test';
     $portlet->collapsed = true;
     $portlet->viewType = 'RssReader';
     $portlet->user = $benny;
     $this->assertTrue($portlet->save());
     $this->setGetArray(array('uniqueLayoutId' => 'AccountDetailsAndRelationsView_' . $portlet->id, 'portletId' => $portlet->id, 'relationAttributeName' => 'account', 'relationModelId' => $superAccountId, 'relationModuleId' => 'accounts', 'relationModelClassName' => 'Account'));
     $this->runControllerWithNoExceptionsAndGetContent('productTemplates/default/selectFromRelatedList');
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:19,代码来源:ProductTemplateRegularUserWalkthroughTest.php


示例9: actionModalConfigSave

 /**
  * Called using Ajax.
  */
 public function actionModalConfigSave($portletId, $uniqueLayoutId, array $portletParams = array())
 {
     $portlet = Portlet::getById(intval($portletId));
     $this->resolveAddingRelationModelIdToPortletParams($portlet);
     $configurableView = $portlet->getView()->getConfigurationView();
     $portlet->forget();
     $configurableView->setMetadataFromPost($_POST[$configurableView->getPostArrayName()]);
     $this->saveModalConfigPerUserAndRelationModelId($configurableView->getViewMetadata());
     $this->actionModalRefresh($portletId, $uniqueLayoutId, null, $portletParams);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:13,代码来源:DefaultPortletController.php


示例10: getPortlets

 protected function getPortlets($uniqueLayoutId, $metadata)
 {
     assert('is_string($uniqueLayoutId)');
     assert('is_array($metadata)');
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition($uniqueLayoutId, Yii::app()->user->userModel->id, $this->params);
     if (empty($portlets)) {
         $portlets = Portlet::makePortletsUsingMetadataSortedByColumnIdAndPosition($uniqueLayoutId, $metadata, Yii::app()->user->userModel, $this->params);
         Portlet::savePortlets($portlets);
     }
     return $portlets;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:11,代码来源:PortletFrameView.php


示例11: getPortlets

 /**
  * Override to allow for making a default set of portlets
  * via metadata optional.
  *
  */
 protected function getPortlets($uniqueLayoutId, $metadata)
 {
     assert('is_string($uniqueLayoutId)');
     assert('is_array($metadata)');
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition($uniqueLayoutId, Yii::app()->user->userModel->id, $this->params);
     if (empty($portlets) && $this->isDefaultDashboard) {
         $portlets = Portlet::makePortletsUsingMetadataSortedByColumnIdAndPosition($uniqueLayoutId, $metadata, Yii::app()->user->userModel, $this->params);
         Portlet::savePortlets($portlets);
     }
     return PortletsSecurityUtil::resolvePortletsForCurrentUser($portlets);
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:16,代码来源:DashboardView.php


示例12: testDashboardGroupByActions

 public function testDashboardGroupByActions()
 {
     $portets = Portlet::getAll();
     $this->assertCount(1, $portets);
     $this->setGetArray(array('portletId' => $portets[0]->id, 'uniqueLayoutId' => 'MarketingDashboard'));
     $this->setPostArray(array('MarketingOverallMetricsForm' => array('groupBy' => MarketingOverallMetricsForm::GROUPING_TYPE_DAY)));
     $this->runControllerWithNoExceptionsAndGetContent('home/defaultPortlet/modalConfigSave');
     $this->setPostArray(array('MarketingOverallMetricsForm' => array('groupBy' => MarketingOverallMetricsForm::GROUPING_TYPE_MONTH)));
     $this->runControllerWithNoExceptionsAndGetContent('home/defaultPortlet/modalConfigSave');
     $this->setPostArray(array('MarketingOverallMetricsForm' => array('groupBy' => MarketingOverallMetricsForm::GROUPING_TYPE_WEEK)));
     $this->runControllerWithNoExceptionsAndGetContent('home/defaultPortlet/modalConfigSave');
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:12,代码来源:MarketingSuperUserWalkthroughTest.php


示例13: actionDetails

 public function actionDetails($id, $runReport = false)
 {
     $savedReport = SavedReport::getById((int) $id);
     ControllerSecurityUtil::resolveCanCurrentUserAccessModule($savedReport->moduleClassName);
     ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($savedReport, true);
     $report = SavedReportToReportAdapter::makeReportBySavedReport($savedReport);
     $portlet = Portlet::getById(intval($_GET['portletId']));
     $portlet->params = array('controllerId' => 'default', 'relationModuleId' => $this->getModule()->getId(), 'relationModel' => $report, 'redirectUrl' => Yii::app()->request->getRequestUri(), 'dataProvider' => $this->getDataProvider($report, $report->getId(), (bool) $runReport));
     $portletView = $portlet->getView();
     if (!RightsUtil::canUserAccessModule($portletView::getModuleClassName(), Yii::app()->user->userModel)) {
         $messageView = new AccessFailureView();
         $view = new AccessFailurePageView($messageView);
         echo $view->render();
         Yii::app()->end(0, false);
     }
     $view = new AjaxPageView($portletView);
     echo $view->render();
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:18,代码来源:DefaultPortletController.php


示例14: testSuperUserDefaultPortletControllerActions

 public function testSuperUserDefaultPortletControllerActions()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $this->setGetArray(array('id' => self::$account->id));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('accounts/default/details');
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('AccountDetailsAndRelationsView', $super->id, array());
     $this->assertEquals(4, count($portlets[2]));
     $this->setGetArray(array('modelId' => self::$account->id, 'portletType' => 'AccountAccountAffiliationsRelatedList', 'uniqueLayoutId' => 'AccountDetailsAndRelationsView'));
     $this->resetPostArray();
     $this->runControllerWithRedirectExceptionAndGetContent('accounts/defaultPortlet/add');
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('AccountDetailsAndRelationsView', $super->id, array());
     $this->assertEquals(5, count($portlets[2]));
     //Load Details View again to make sure everything is ok after the layout change.
     $this->setGetArray(array('id' => self::$account->id));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('accounts/default/details');
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:18,代码来源:AccountAccountAffiliationsSuperUserWalkthroughTest.php


示例15: renderContent

 protected function renderContent()
 {
     $placedViewTypes = Portlet::getPlacedViewTypesByLayoutIdAndUser($this->uniqueLayoutId, Yii::app()->user->userModel->id);
     $content = '<ul class="available-portlets">';
     $modules = Module::getModuleObjects();
     $sortablePortlets = array();
     foreach ($modules as $module) {
         if ($module->isEnabled()) {
             $p = $module->getParentModule();
             $viewClassNames = $module::getViewClassNames();
             foreach ($viewClassNames as $className) {
                 $viewReflectionClass = new ReflectionClass($className);
                 if (!$viewReflectionClass->isAbstract()) {
                     $portletRules = PortletRulesFactory::createPortletRulesByView($className);
                     if ($viewReflectionClass->implementsInterface('RelatedPortletViewInterface')) {
                         if ($this->resolveLayoutIdInAllowedOnPortletViewClassNames($className) && $className::allowMultiplePlacement() == false && !in_array($portletRules->getType(), $placedViewTypes) && PortletsSecurityUtil::doesCurrentUserHavePermissionToAddPortlet($portletRules) === true) {
                             $metadata = $className::getMetadata();
                             $url = Yii::app()->createUrl($this->moduleId . '/defaultPortlet/add', array('uniqueLayoutId' => $this->uniqueLayoutId, 'modelId' => $this->modelId, 'portletType' => $portletRules->getType()));
                             $title = $metadata['perUser']['title'];
                             MetadataUtil::resolveEvaluateSubString($title);
                             $sortablePortlets[$title] = $url;
                         }
                     }
                 }
             }
         }
     }
     if (empty($sortablePortlets)) {
         $messageView = new NoPortletsToPlaceView();
         return $messageView->render();
     }
     //Sort by title
     ksort($sortablePortlets);
     foreach ($sortablePortlets as $title => $url) {
         $onClick = 'window.location.href = "' . $url . '"';
         $content .= '<li>';
         $label = '<span>\\</span>' . $title;
         $content .= ZurmoHtml::link(Zurmo::t('HomeModule', $label), null, array('onclick' => $onClick));
         $content .= '</li>';
     }
     $content .= '</ul>';
     return $content;
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:43,代码来源:DetailsPortletSelectionView.php


示例16: actionAdd

 /**
  * Add portlet to first column, first position
  * and if there are other portlets in the first
  * column, shift their postion by 1 to accomodate
  * the new portlet
  *
  */
 public function actionAdd()
 {
     assert('!empty($_GET["uniqueLayoutId"])');
     assert('!empty($_GET["portletType"])');
     $maximumColumns = $this->resolveMaximumColumnsByDashboardId();
     $portletCollection = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition($_GET['uniqueLayoutId'], Yii::app()->user->userModel->id, array());
     if (!empty($portletCollection)) {
         if (isset($portletCollection[$maximumColumns])) {
             foreach ($portletCollection[$maximumColumns] as $position => $portlet) {
                 $portlet->position = $portlet->position + 1;
                 $portlet->save();
             }
         }
     }
     if (!empty($_GET['dashboardId'])) {
         $dashboardId = $_GET['dashboardId'];
     } else {
         $dashboardId = '';
     }
     Portlet::makePortletUsingViewType($_GET['portletType'], $_GET['uniqueLayoutId'], Yii::app()->user->userModel, $maximumColumns);
     $this->redirect(array('default/dashboardDetails', 'id' => $dashboardId));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:29,代码来源:DefaultPortletController.php


示例17: testAdditionOfPortletsInEmptyRightPanel

 public function testAdditionOfPortletsInEmptyRightPanel()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $superAccountId = self::getModelIdByModelNameAndName('Account', 'superAccount');
     $accounts = Account::getAll();
     $this->assertEquals(1, count($accounts));
     //Load Model Detail Views
     $this->setGetArray(array('id' => $superAccountId, 'lockPortlets' => '0'));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('accounts/default/details');
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('AccountDetailsAndRelationsView', $super->id, array());
     $this->assertEquals(3, count($portlets[1]));
     $this->assertFalse(array_key_exists(3, $portlets));
     $this->assertEquals(4, count($portlets[2]));
     foreach ($portlets[2] as $position => $portlet) {
         $portlet->delete();
     }
     $this->setGetArray(array('modelId' => $superAccountId, 'uniqueLayoutId' => 'AccountDetailsAndRelationsView', 'portletType' => 'ProductsForAccountRelatedList', 'redirect' => '0'));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/add', true);
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('AccountDetailsAndRelationsView', $super->id, array());
     $this->assertEquals(1, count($portlets[2]));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:23,代码来源:AccountDetailsAndRelationsPortletViewTest.php


示例18: testSuperUserDefaultPortletControllerActions

 /**
  * @depends testSuperUserAllDefaultControllerActions
  */
 public function testSuperUserDefaultPortletControllerActions()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     //Save a layout change. Collapse all portlets in the GameReward Details View.
     //At this point portlets for this view should be created because we have already loaded the 'details' page in a request above.
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('GameRewardDetailsAndRelationsView', $super->id, array());
     $this->assertEquals(2, count($portlets[1]));
     $this->assertFalse(array_key_exists(2, $portlets));
     $portletPostData = array();
     $portletCount = 0;
     foreach ($portlets as $column => $columnPortlets) {
         foreach ($columnPortlets as $position => $portlet) {
             $this->assertEquals('0', $portlet->collapsed);
             $portletPostData['GameRewardDetailsAndRelationsView_' . $portlet->id] = array('collapsed' => 'true', 'column' => 0, 'id' => 'GameRewardDetailsAndRelationsView_' . $portlet->id, 'position' => $portletCount);
             $portletCount++;
         }
     }
     //There should have been a total of 2 portlets.
     $this->assertEquals(2, $portletCount);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:23,代码来源:GameRewardsSuperUserWalkthroughTest.php


示例19: testSuperUserDefaultPortletControllerActions

 /**
  * @depends testSuperUserAllDefaultControllerActions
  */
 public function testSuperUserDefaultPortletControllerActions()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $superLeadId4 = self::getModelIdByModelNameAndName('Contact', 'superLead4 superLead4son');
     //Save a layout change. Collapse all portlets in the Lead Details View.
     //At this point portlets for this view should be created because we have already loaded the 'details' page in a request above.
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('LeadDetailsAndRelationsView', $super->id, array());
     $this->assertEquals(3, count($portlets[1]));
     $this->assertFalse(array_key_exists(3, $portlets));
     $portletPostData = array();
     $portletCount = 0;
     foreach ($portlets as $column => $columnPortlets) {
         foreach ($columnPortlets as $position => $portlet) {
             $this->assertEquals('0', $portlet->collapsed);
             $portletPostData['LeadDetailsAndRelationsView_' . $portlet->id] = array('collapsed' => 'true', 'column' => 0, 'id' => 'LeadDetailsAndRelationsView_' . $portlet->id, 'position' => $portletCount);
             $portletCount++;
         }
     }
     //There should have been a total of 5 portlets.
     $this->assertEquals(5, $portletCount);
     $this->resetGetArray();
     $this->setPostArray(array('portletLayoutConfiguration' => array('portlets' => $portletPostData, 'uniqueLayoutId' => 'LeadDetailsAndRelationsView')));
     $this->runControllerWithNoExceptionsAndGetContent('home/defaultPortlet/saveLayout', true);
     //Now test that all the portlets are collapsed and moved to the first column.
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('LeadDetailsAndRelationsView', $super->id, array());
     $this->assertEquals(5, count($portlets[1]));
     $this->assertFalse(array_key_exists(2, $portlets));
     foreach ($portlets as $column => $columns) {
         foreach ($columns as $position => $positionPortlets) {
             $this->assertEquals('1', $positionPortlets->collapsed);
         }
     }
     //Load Details View again to make sure everything is ok after the layout change.
     $this->setGetArray(array('id' => $superLeadId4));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('leads/default/details');
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:40,代码来源:LeadsSuperUserWalkthroughTest.php


示例20: getPortletViewForDetails

 protected function getPortletViewForDetails($id)
 {
     $id = intval($id);
     $modelName = $this->getModule()->getPrimaryModelName();
     $model = $modelName::getById($id);
     ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($model, true);
     $portlet = Portlet::getById(intval($_GET['portletId']));
     if (null != ($redirectUrl = ArrayUtil::getArrayValue($_GET, 'redirectUrl'))) {
         $redirectUrl = $redirectUrl;
     } else {
         $redirectUrl = Yii::app()->request->getRequestUri();
     }
     $portlet->params = array('controllerId' => 'default', 'relationModuleId' => $this->getModule()->getId(), 'relationModel' => $model, 'redirectUrl' => $redirectUrl);
     $portletView = $portlet->getView();
     return $portletView;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:16,代码来源:ZurmoPortletController.php



注:本文中的Portlet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Position类代码示例发布时间:2022-05-23
下一篇:
PHP Portfolio类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap