本文整理汇总了PHP中Info::isProductAccessable方法的典型用法代码示例。如果您正苦于以下问题:PHP Info::isProductAccessable方法的具体用法?PHP Info::isProductAccessable怎么用?PHP Info::isProductAccessable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Info
的用法示例。
在下文中一共展示了Info::isProductAccessable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProductId
protected function getProductId($infoType)
{
if (isset($_GET['product_id'])) {
$productId = $_GET['product_id'];
if (!Info::isProductAccessable($productId)) {
throw new CHttpException(400, Yii::t('Common', 'Required URL not found or permission denied.'));
}
Yii::app()->user->setState('product', $productId);
TestUserService::updateUserProductCookie($productId);
return $productId;
} else {
throw new CHttpException(400, Yii::t('Common', 'Required URL not found or permission denied.'));
}
}
示例2: relatedCaseValidator
public function relatedCaseValidator($attribute, $params)
{
if (isset($this->related_case)) {
$this->related_case = $this->handleSpliter($this->related_case);
$relatedBugArr = CommonService::splitStringToArray(',', $this->related_case);
foreach ($relatedBugArr as $caseIdTmp) {
$infoObj = CaseInfo::model()->findByPk($caseIdTmp);
if ($infoObj == null || $infoObj->id != $caseIdTmp) {
$this->addError('related_case', 'Case ID[' . $caseIdTmp . ']' . Yii::t('Common', 'is not existed'));
} elseif (!Info::isProductAccessable($infoObj->product_id)) {
$this->addError('related_case', 'Case ID[' . $caseIdTmp . ']' . Yii::t('Common', 'No access right'));
}
}
}
}
示例3: getRelatedIdHtml
/**
* get info's relate id's html
*
* @author youzhao.zxw<swustnjtu@gmail.com>
* @param string $infoType bug,case or result
* @param string $idStr related id string
* @return string relate id's html
*/
public static function getRelatedIdHtml($infoType, $idStr)
{
$returnStr = '';
$idArr = CommonService::splitStringToArray(',', $idStr);
$modelName = ucfirst($infoType) . 'Info';
$targetModel = new $modelName();
foreach ($idArr as $id) {
$infoObj = $targetModel->model()->findByPk($id);
if ($infoObj != null) {
if (!Info::isProductAccessable($infoObj->product_id)) {
$singleLink = '<a title="' . Yii::t('Common', 'No access right') . '" href="' . Yii::app()->createUrl('info/edit', array('type' => $infoType, 'id' => $id)) . '" target="_blank">' . $id . '</a>';
} else {
$singleLink = '<a title="' . $infoObj->title . '" href="' . Yii::app()->createUrl('info/edit', array('type' => $infoType, 'id' => $id)) . '" target="_blank">' . $id . '</a>';
}
if ('' == $returnStr) {
$returnStr = $singleLink;
} else {
$returnStr .= ',' . $singleLink;
}
}
}
if ('' != $returnStr) {
$returnStr = '<div style="word-break:break-all;word-wrap:break-word;">' . $returnStr . '</div>';
}
return $returnStr;
}
示例4: duplicateIdValidator
public function duplicateIdValidator($attribute, $params)
{
if (self::DUPLICATE_SOLUTION == $this->solution) {
$duplicatedIdError = $this->getError('duplicate_id');
if (empty($duplicatedIdError)) {
if (empty($this->duplicate_id)) {
$this->addError('duplicate_id', Yii::t('BugInfo', self::ERROR_DUPLICATE_ID));
} else {
$this->duplicate_id = $this->handleSpliter($this->duplicate_id);
$duplicatedIdArr = CommonService::splitStringToArray(',', $this->duplicate_id);
foreach ($duplicatedIdArr as $dupId) {
if ($dupId != ceil($dupId)) {
$this->addError('duplicate_id', 'Duplicate ID[' . $dupId . ']' . Yii::t('BugInfo', self::ERROR_DUPLICATE_ID));
} else {
$infoObj = BugInfo::model()->findByPk($dupId);
if ($infoObj == null || $infoObj->id != $dupId) {
$this->addError('duplicate_id', 'Duplicate ID[' . $dupId . ']' . Yii::t('BugInfo', self::ERROR_DUPLICATE_ID));
} elseif (!Info::isProductAccessable($infoObj->product_id)) {
$this->addError('duplicate_id', 'Duplicate ID[' . $dupId . ']' . Yii::t('Common', 'No access right'));
}
}
}
}
}
} else {
$this->duplicate_id = null;
}
}