本文整理汇总了PHP中Portlet类的典型用法代码示例。如果您正苦于以下问题:PHP Portlet类的具体用法?PHP Portlet怎么用?PHP Portlet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Portlet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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"> </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();
}
}
示例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);
}
示例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');
}
示例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();
}
示例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;
}
示例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');
}
示例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;
}
示例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');
}
示例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);
}
示例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;
}
示例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);
}
示例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');
}
示例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();
}
示例14: init
public function init()
{
parent::init();
$this->defaultSoringSettings['update'] = "js:function(event, ui)\n {\n var data = \$(this).nestedSortable('toArray');\n \$.post('{$this->sortUrl}',\n {\n tree:\$.toJSON(data)\n },\n function(data)\n {\n if (data.status == 'ok')\n {\n alert(3);\n }\n },\n 'json'\n );\n }";
$this->initVars();
$this->registerScripts();
}
示例15: onInit
public function onInit($param)
{
parent::onInit($param);
if (!$this->Page->IsPostBack && ($keyword = $this->Request['keyword']) !== null) {
$this->Keyword->Text = $keyword;
}
}