本文整理汇总了PHP中Portlet::getPlacedViewTypesByLayoutIdAndUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Portlet::getPlacedViewTypesByLayoutIdAndUser方法的具体用法?PHP Portlet::getPlacedViewTypesByLayoutIdAndUser怎么用?PHP Portlet::getPlacedViewTypesByLayoutIdAndUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Portlet
的用法示例。
在下文中一共展示了Portlet::getPlacedViewTypesByLayoutIdAndUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: 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;
}