本文整理汇总了PHP中Portlet::doesPortletExistByViewTypeLayoutIdAndUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Portlet::doesPortletExistByViewTypeLayoutIdAndUser方法的具体用法?PHP Portlet::doesPortletExistByViewTypeLayoutIdAndUser怎么用?PHP Portlet::doesPortletExistByViewTypeLayoutIdAndUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Portlet
的用法示例。
在下文中一共展示了Portlet::doesPortletExistByViewTypeLayoutIdAndUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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"])');
$isPortletAlreadyAdded = Portlet::doesPortletExistByViewTypeLayoutIdAndUser($_GET['portletType'], $_GET['uniqueLayoutId'], Yii::app()->user->userModel->id);
$maximumColumns = $this->resolveMaximumColumnsByDashboardId();
if ($isPortletAlreadyAdded === false) {
$portletCollection = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition($_GET['uniqueLayoutId'], Yii::app()->user->userModel->id, array());
if (!empty($portletCollection)) {
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));
}
示例2: 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"])');
$isPortletAlreadyAdded = Portlet::doesPortletExistByViewTypeLayoutIdAndUser($_GET['portletType'], $_GET['uniqueLayoutId'], Yii::app()->user->userModel->id);
$maximumColumns = $this->resolveMaximumColumnsByLayoutId();
if ($isPortletAlreadyAdded === false) {
$this->resetPortletsInColumnToAccomodateNewPortlet($maximumColumns);
Portlet::makePortletUsingViewType($_GET['portletType'], $_GET['uniqueLayoutId'], Yii::app()->user->userModel, intval($maximumColumns));
}
if (!empty($_GET['modelId'])) {
$dashboardId = $_GET['modelId'];
} else {
$dashboardId = '';
}
//Please see @link:AccountDetailsAndRelationsPortletViewTest
if (isset($_GET['redirect'])) {
return;
}
$this->redirect(array('/' . $this->resolveAndGetModuleId() . '/default/details', 'id' => $dashboardId));
}