本文整理汇总了PHP中ZurmoDefaultViewUtil::getLockKeyForDetailsAndRelationsView方法的典型用法代码示例。如果您正苦于以下问题:PHP ZurmoDefaultViewUtil::getLockKeyForDetailsAndRelationsView方法的具体用法?PHP ZurmoDefaultViewUtil::getLockKeyForDetailsAndRelationsView怎么用?PHP ZurmoDefaultViewUtil::getLockKeyForDetailsAndRelationsView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZurmoDefaultViewUtil
的用法示例。
在下文中一共展示了ZurmoDefaultViewUtil::getLockKeyForDetailsAndRelationsView方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreateProductFromProductTemplate
/**
* Create product from product template when user select a product
* template while adding a product in product portlet view
* @param string $relationModuleId
* @param int $portletId
* @param string $uniqueLayoutId
* @param int $id
* @param int $relationModelId
* @param string $relationAttributeName
* @param string $relationModelClassName
*/
public function actionCreateProductFromProductTemplate($relationModuleId, $portletId, $uniqueLayoutId, $id, $relationModelId, $relationAttributeName, $relationModelClassName = null, $redirect = true)
{
if ($relationModelClassName == null) {
$relationModelClassName = Yii::app()->getModule($relationModuleId)->getPrimaryModelName();
}
$productTemplate = static::getModelAndCatchNotFoundAndDisplayError('ProductTemplate', intval($id));
$product = new Product();
$product->name = $productTemplate->name;
$product->description = $productTemplate->description;
$product->quantity = 1;
$product->productTemplate = $productTemplate;
$sellPrice = new CurrencyValue();
$sellPrice->value = $productTemplate->sellPrice->value;
$sellPrice->currency = $productTemplate->sellPrice->currency;
$product->priceFrequency = $productTemplate->priceFrequency;
$product->sellPrice = $sellPrice;
$product->type = $productTemplate->type;
$controllerUtil = static::getZurmoControllerUtil();
$controllerUtil->resolveStageDefaultValue($product);
foreach ($productTemplate->productCategories as $productCategory) {
$product->productCategories->add($productCategory);
}
$relatedModel = $relationModelClassName::getById((int) $relationModelId);
$product->{$relationAttributeName} = $relatedModel;
$this->addRelatedModelAccountToModel($product, $relatedModel);
$product->save();
ZurmoControllerUtil::updatePermissionsWithDefaultForModelByCurrentUser($product);
if ((bool) $redirect) {
$isViewLocked = ZurmoDefaultViewUtil::getLockKeyForDetailsAndRelationsView('lockPortletsForDetailsAndRelationsView');
$redirectUrl = Yii::app()->createUrl('/' . $relationModuleId . '/default/details', array('id' => $relationModelId));
$this->redirect(array('/' . $relationModuleId . '/defaultPortlet/modalRefresh', 'portletId' => $portletId, 'uniqueLayoutId' => $uniqueLayoutId, 'redirectUrl' => $redirectUrl, 'portletParams' => array('relationModuleId' => $relationModuleId, 'relationModelId' => $relationModelId), 'portletsAreRemovable' => !$isViewLocked));
}
}
示例2: resolvePortletConfigurableParams
/**
* Resolves portlet configurable parameters
* @param boolean $portletsAreMovable
* @param boolean $portletsAreRemovable
*/
protected function resolvePortletConfigurableParams(&$portletsAreMovable, &$portletsAreRemovable)
{
assert('is_bool($portletsAreMovable)');
assert('is_bool($portletsAreRemovable)');
$getData = GetUtil::getData();
if (isset($getData['lockPortlets'])) {
$lockPortlets = (bool) $getData['lockPortlets'];
if ($lockPortlets) {
ZurmoDefaultViewUtil::setLockKeyForDetailsAndRelationsView('lockPortletsForDetailsAndRelationsView', true);
} else {
ZurmoDefaultViewUtil::setLockKeyForDetailsAndRelationsView('lockPortletsForDetailsAndRelationsView', false);
}
}
$isViewLocked = ZurmoDefaultViewUtil::getLockKeyForDetailsAndRelationsView('lockPortletsForDetailsAndRelationsView');
//Default case for the first time
if ($isViewLocked === null) {
ZurmoDefaultViewUtil::setLockKeyForDetailsAndRelationsView('lockPortletsForDetailsAndRelationsView', true);
$isViewLocked = true;
}
if ($isViewLocked == true) {
$portletsAreRemovable = false;
$portletsAreMovable = false;
}
}
示例3: actionSelectFromRelatedListSave
/**
* In a detail view, after you hit select from a sub view a modal listview will appear. If you select a row
* in that view, then this action is called. This action will relate the selected model to the detail view model.
* Then it will redirect to a portlet action that refreshes the portlet. Some parameters are passed to that
* redirect that ensure continuity on futher actions that rely on existing $_GET information.
* @param string $modelId
* @param string $portletId
* @param string $uniqueLayoutId
* @param string $relationAttributeName
* @param string $relationModelId
* @param string $relationModuleId
* @param null|string $relationModelClassName
*/
public function actionSelectFromRelatedListSave($modelId, $portletId, $uniqueLayoutId, $relationAttributeName, $relationModelId, $relationModuleId, $relationModelClassName = null)
{
if ($relationModelClassName == null) {
$relationModelClassName = Yii::app()->getModule($relationModuleId)->getPrimaryModelName();
}
$relationModel = $relationModelClassName::getById((int) $relationModelId);
$modelClassName = $this->getModule()->getPrimaryModelName();
$model = $modelClassName::getById((int) $modelId);
$redirectUrl = $this->createUrl('/' . $relationModuleId . '/default/details', array('id' => $relationModelId));
if (!$model->{$relationAttributeName}->contains($relationModel)) {
$model->{$relationAttributeName}->add($relationModel);
if (!$model->save()) {
$this->processSelectFromRelatedListSaveFails($model);
}
} else {
$this->processSelectFromRelatedListSaveAlreadyConnected($model);
}
$isViewLocked = ZurmoDefaultViewUtil::getLockKeyForDetailsAndRelationsView('lockPortletsForDetailsAndRelationsView');
$this->redirect(array('/' . $relationModuleId . '/defaultPortlet/modalRefresh', 'id' => $relationModelId, 'portletId' => $portletId, 'uniqueLayoutId' => $uniqueLayoutId, 'redirectUrl' => $redirectUrl, 'portletParams' => array('relationModuleId' => $relationModuleId, 'relationModelId' => $relationModelId), 'portletsAreRemovable' => !$isViewLocked));
}
示例4: actionAddOpportunityRelation
public function actionAddOpportunityRelation($relationModuleId, $portletId, $uniqueLayoutId, $id, $relationModelId, $relationAttributeName, $redirect)
{
$opportunityProduct = OpportunityProduct::GetById(intval($id));
$opportunity = Opportunity::GetById(intval($relationModelId));
if ($opportunityProduct->opportunity != $opportunity) {
$opportunityProduct->opportunity = $opportunity;
$opportunityProduct->save();
}
if ((bool) $redirect) {
$isViewLocked = ZurmoDefaultViewUtil::getLockKeyForDetailsAndRelationsView('lockPortletsForDetailsAndRelationsView');
$redirectUrl = Yii::app()->createUrl('/' . $relationModuleId . '/default/details', array('id' => $relationModelId));
$this->redirect(array('/' . $relationModuleId . '/defaultPortlet/modalRefresh', 'portletId' => $portletId, 'uniqueLayoutId' => $uniqueLayoutId, 'redirectUrl' => $redirectUrl, 'portletParams' => array('relationModuleId' => $relationModuleId, 'relationModelId' => $relationModelId), 'portletsAreRemovable' => !$isViewLocked));
}
}