当前位置: 首页>>代码示例>>PHP>>正文


PHP Portlet::getById方法代码示例

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


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

示例1: 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

示例2: 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

示例3: getByLayoutId

 public static function getByLayoutId($layoutId)
 {
     $portletCollection = array();
     assert('is_string($layoutId)');
     $quote = DatabaseCompatibilityUtil::getQuote();
     $sql = "select id, {$quote}column{$quote}, position " . 'from portlet ' . "where layoutid = '{$layoutId}'" . 'order by id;';
     foreach (R::getAll($sql) as $row) {
         $portlet = Portlet::getById(intval($row['id']));
         $portletCollection[$row['id']] = $portlet;
     }
     return $portletCollection;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:12,代码来源:Portlet.php

示例4: getByLayoutIdAndUserSortedById

 public static function getByLayoutIdAndUserSortedById($layoutId, $userId)
 {
     $portletCollection = array();
     assert('is_integer($userId) && $userId >= 1');
     $quote = DatabaseCompatibilityUtil::getQuote();
     $sql = "select id, {$quote}column{$quote}, position " . 'from portlet ' . "where layoutid = '{$layoutId}' and _user_id = {$userId} " . 'order by id;';
     foreach (R::getAll($sql) as $row) {
         $portlet = Portlet::getById(intval($row['id']));
         $portletCollection[$row['id']] = $portlet;
     }
     return $portletCollection;
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:12,代码来源:Portlet.php

示例5: 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

示例6: 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

示例7: actionSelectFromRelatedList

 /**
  * In a detailview, if you click the 'select' link from a sub view, this action is called. It will bring a modal
  * search/list view to select a model from.
  * @param string $portletId
  * @param string $uniqueLayoutId
  * @param string $relationAttributeName
  * @param string $relationModelId
  * @param string $relationModuleId
  * @param string $pageTitle
  */
 public function actionSelectFromRelatedList($portletId, $uniqueLayoutId, $relationAttributeName, $relationModelId, $relationModuleId, $stateMetadataAdapterClassName = null)
 {
     $portlet = Portlet::getById((int) $portletId);
     $modalListLinkProvider = new SelectFromRelatedListModalListLinkProvider($relationAttributeName, (int) $relationModelId, $relationModuleId, $portlet->getUniquePortletPageId(), $uniqueLayoutId, (int) $portlet->id, $this->getModule()->getId());
     echo ModalSearchListControllerUtil::setAjaxModeAndRenderModalSearchList($this, $modalListLinkProvider, $stateMetadataAdapterClassName);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:16,代码来源:ZurmoModuleController.php

示例8: actionMyListViewAction

 /**
  * Used by my list portlets to process or render actions on the portlet's view. An example is changing the
  * month of the calendar, requires additional calendar events to be loaded.
  * @param integer $id
  */
 public function actionMyListViewAction($action)
 {
     $portlet = Portlet::getById(intval($_GET['portletId']));
     $portletView = $portlet->getView();
     if (!RightsUtil::canUserAccessModule($portletView::getModuleClassName(), Yii::app()->user->userModel)) {
         Yii::app()->end(0, false);
     }
     $portletView->{$action}();
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:14,代码来源:ZurmoPortletController.php

示例9: testBooleanSaveValueMatchesBooleanRetrieveValue

 /**
  * @depends testSavePortlet
  */
 public function testBooleanSaveValueMatchesBooleanRetrieveValue()
 {
     $user = User::getByUserName('billy');
     $portlet = new Portlet();
     $portlet->column = 1;
     $portlet->position = 1;
     $portlet->layoutId = 'Test';
     $portlet->collapsed = true;
     $portlet->viewType = 'RssReader';
     $portlet->user = $user;
     $this->assertTrue($portlet->save());
     $portlet = Portlet::getById($portlet->id);
     $this->assertEquals(1, $portlet->collapsed);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:17,代码来源:PortletTest.php

示例10: testCanDeleteAccountLatestActivitiesForPortletView

 public function testCanDeleteAccountLatestActivitiesForPortletView()
 {
     $this->assertTrue(Portlet::getById(static::$accountLatestActivitiesPortletId)->delete());
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:4,代码来源:AccountLatestActivitiesForPortletViewTest.php

示例11: testSuperUserAllDefaultControllerActions


//.........这里部分代码省略.........
     $dashboards = Dashboard::getRowsByUserId($super->id);
     $this->assertEquals(2, count($dashboards));
     $this->setGetArray(array('dashboardId' => $superDashboard->id));
     $this->resetPostArray();
     $this->runControllerWithNotSupportedExceptionAndGetContent('home/default/deleteDashboard');
     //Delete dashboard that you can delete.
     $dashboards = Dashboard::getRowsByUserId($super->id);
     $this->assertEquals(2, count($dashboards));
     $this->setGetArray(array('dashboardId' => $secondDashboard->id));
     $this->resetPostArray();
     $this->runControllerWithRedirectExceptionAndGetContent('home/default/deleteDashboard');
     $dashboards = Dashboard::getRowsByUserId($super->id);
     $this->assertEquals(1, count($dashboards));
     //Add a dashboard via the create dashboard action.
     $this->assertEquals(1, Dashboard::getCount());
     $this->resetGetArray();
     $this->setPostArray(array('Dashboard' => array('name' => 'myTestDashboard', 'layoutType' => '50,50')));
     // Not Coding Standard
     $this->runControllerWithRedirectExceptionAndGetContent('home/default/createDashboard');
     $dashboards = Dashboard::getAll();
     $this->assertEquals(2, count($dashboards));
     $this->assertEquals('myTestDashboard', $dashboards[1]->name);
     $this->assertEquals($super, $dashboards[1]->owner);
     $this->assertEquals('50,50', $dashboards[1]->layoutType);
     // Not Coding Standard
     //Portlet Controller Actions
     $uniqueLayoutId = 'HomeDashboard' . $superDashboard->layoutId;
     $this->setGetArray(array('dashboardId' => $superDashboard->id, 'uniqueLayoutId' => $uniqueLayoutId));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('home/defaultPortlet/addList');
     //Add AccountsMyList Portlet to dashboard
     $this->setGetArray(array('dashboardId' => $superDashboard->id, 'portletType' => 'AccountsMyList', 'uniqueLayoutId' => $uniqueLayoutId));
     $this->resetPostArray();
     $this->runControllerWithRedirectExceptionAndGetContent('home/defaultPortlet/add');
     //Save a layout change. Collapse all portlets
     //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($uniqueLayoutId, $super->id, array());
     $this->assertEquals(4, count($portlets[1]));
     $this->assertEquals(4, count($portlets[2]));
     $portletPostData = array();
     $portletCount = 0;
     foreach ($portlets as $column => $columnPortlets) {
         foreach ($columnPortlets as $position => $portlet) {
             $this->assertEquals('0', $portlet->collapsed);
             $portletPostData['HomeDashboard1_' . $portlet->id] = array('collapsed' => 'true', 'column' => 0, 'id' => 'HomeDashboard1_' . $portlet->id, 'position' => $portletCount);
             $portletCount++;
         }
     }
     //There should have been a total of 3 portlets. Checking positions as 4 will confirm this.
     $this->assertEquals(8, $portletCount);
     $this->resetGetArray();
     $this->setPostArray(array('portletLayoutConfiguration' => array('portlets' => $portletPostData, 'uniqueLayoutId' => $uniqueLayoutId)));
     $this->runControllerWithNoExceptionsAndGetContent('home/defaultPortlet/saveLayout', true);
     //Now test that all the portlets are collapsed.
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition($uniqueLayoutId, $super->id, array());
     $this->assertEquals(8, count($portlets[1]));
     $this->assertFalse(array_key_exists(8, $portlets));
     foreach ($portlets as $column => $columns) {
         foreach ($columns as $position => $positionPortlets) {
             $this->assertEquals('1', $positionPortlets->collapsed);
         }
     }
     //Load up modal config edit view.
     $this->assertTrue($portlets[1][5]->id > 0);
     $this->assertEquals('AccountsMyList', $portlets[1][5]->viewType);
     $this->setGetArray(array('portletId' => $portlets[1][5]->id, 'uniqueLayoutId' => $uniqueLayoutId));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('home/defaultPortlet/modalConfigEdit');
     //Now validate the form.
     $this->setGetArray(array('portletId' => $portlets[1][5]->id, 'uniqueLayoutId' => $uniqueLayoutId));
     $this->setPostArray(array('ajax' => 'modal-edit-form', 'AccountsSearchForm' => array()));
     $this->runControllerWithExitExceptionAndGetContent('home/defaultPortlet/modalConfigEdit');
     //save changes to the portlet title
     $this->setGetArray(array('portletId' => $portlets[1][5]->id, 'uniqueLayoutId' => $uniqueLayoutId));
     $this->setPostArray(array('MyListForm' => array('title' => 'something new'), 'AccountsSearchForm' => array()));
     $this->runControllerWithNoExceptionsAndGetContent('home/defaultPortlet/modalConfigSave');
     //Now confirm the title change was successful.
     $portlet = Portlet::getById($portlets[1][5]->id);
     $this->assertEquals('something new', $portlet->getView()->getTitle());
     //Refresh a portlet modally.
     $this->setGetArray(array('portletId' => $portlets[1][5]->id, 'uniqueLayoutId' => $uniqueLayoutId, 'redirectUrl' => 'home/default'));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('home/defaultPortlet/modalRefresh');
     //Load Home Dashboard View again to make sure everything is ok after the layout change.
     $this->resetGetArray();
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('home/default');
     //task sorting issue
     //check whether tasks portlet render or not
     $this->assertTrue($portlets[1][3]->id > 0);
     $this->assertEquals('TasksMyList', $portlets[1][3]->viewType);
     //to sort task list
     $this->setGetArray(array('Task_sort' => 'name', 'portletId' => $portlets[1][3]->id, 'uniqueLayoutId' => $uniqueLayoutId));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('home/default');
     //to sort task list after portlet has been edited
     $this->resetGetArray();
     $this->setGetArray(array('Task_sort' => 'dueDateTime', 'portletId' => $portlets[1][3]->id, 'uniqueLayoutId' => $uniqueLayoutId, 'ajax' => 'list-view' . $uniqueLayoutId . '_' . $portlets[1][3]->id));
     $this->runControllerWithNoExceptionsAndGetContent('home/default');
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:101,代码来源:HomeSuperUserWalkthroughTest.php

示例12: actionModalRefresh

 /**
  * Refresh portlet contents within a dashboard or details relation view. In the case of details relation view
  * detect if the relationModelId is populated, in which case resolve and populate the relationModel.
  * Resets controller back to default.
  * @param string $portletId
  * @param string $uniqueLayoutId
  * @param string $redirectUrl
  * @param array $portletParams - optional argument which allows you to override the standard parameters.
  * @param bool $portletsAreRemovable
  */
 public function actionModalRefresh($portletId, $uniqueLayoutId, $redirectUrl, array $portletParams = array(), $portletsAreRemovable = true)
 {
     $portlet = Portlet::getById(intval($portletId));
     $portlet->params = array_merge(array('controllerId' => 'default', 'moduleId' => $this->getModule()->getId(), 'redirectUrl' => $redirectUrl), $portletParams);
     if (isset($portlet->params['relationModelId']) && $portlet->params['relationModelId'] != '') {
         assert('$portlet->params["relationModuleId"] != ""');
         $modelClassName = Yii::app()->findModule($portlet->params["relationModuleId"])->getPrimaryModelName();
         $portlet->params['relationModel'] = $modelClassName::getById((int) $portlet->params['relationModelId']);
     }
     $view = new AjaxPageView(new PortletRefreshView($portlet, $uniqueLayoutId, $this->getModule()->getId(), (bool) $portletsAreRemovable));
     echo $view->render();
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:22,代码来源:PortletController.php


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