本文整理汇总了PHP中Info::membership方法的典型用法代码示例。如果您正苦于以下问题:PHP Info::membership方法的具体用法?PHP Info::membership怎么用?PHP Info::membership使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Info
的用法示例。
在下文中一共展示了Info::membership方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
if (Yii::app()->user->isGuest) {
$this->redirect(Yii::app()->homeUrl);
}
$this->pageTitle = Yii::t('title', 'Webshop');
$criteria = new CDbCriteria();
$criteria->select = '*';
$criteria->order = 'category_id';
$model = WebshopCategory::model()->findAll($criteria);
$criteria = new CDbCriteria();
$criteria->select = '*';
$criteria->order = 'id';
$membership = Membership::model()->findAll($criteria);
if (isset($_POST['Membership'])) {
$account = AccountData::model()->findByPk(Yii::app()->user->id);
$info = Membership::model()->findByPk($_POST['Membership']['id']);
if ($account->membership == 0) {
if ($account[Yii::app()->params->money] >= $info->price) {
$account->membership = $info->type;
$account->expire = date("Y-m-d", mktime() + $info->duration * 86400);
$account[Yii::app()->params->money] = $account[Yii::app()->params->money] - $info->price;
$account->save();
$log = new LogMembership();
$log->account = Yii::app()->user->name;
$log->title = $info->title;
$log->type = Info::membership($info->type);
$log->duration = $info->duration;
$log->price = $info->price;
$log->save();
Yii::app()->user->setFlash('message', '<div class="flash_success">' . Yii::t('webshop', 'Account updated!') . '</div>');
$this->redirect('webshop');
} else {
Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('webshop', 'Insufficient funds.') . '</div>');
$this->redirect('webshop');
}
} else {
Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('webshop', 'You have outdated privileges still active, please update them.') . '</div>');
$this->redirect('webshop');
}
}
$this->render('index', array('model' => $model, 'membership' => $membership));
}
示例2:
<td><?php
echo $ref_link;
?>
</td>
</tr>
<tr>
<td>Уровень доступа</td>
<td><?php
echo Info::access_level($model->access_level);
?>
</td>
</tr>
<tr>
<td>Привилегии аккаунта</td>
<td><?php
echo Info::membership($model->membership);
?>
</td>
</tr>
<tr>
<td>Истекают</td>
<td><?php
echo $model->expire;
?>
</td>
</tr>
<tr>
<td>Последний IP</td>
<td><?php
echo $model->last_ip;
?>
示例3: foreach
<th width="20%">Цена</td>
<th width="20%">Выбрать</td>
</tr>
<?php
foreach ($membership as $membership) {
?>
<tr class="center">
<td><label for="Membership_id_<?php
echo $membership->id;
?>
"><?php
echo $membership->title;
?>
</label></td>
<td><?php
echo Info::membership($membership->type);
?>
</td>
<td><?php
echo $membership->duration;
?>
</td>
<td><?php
echo $membership->price;
?>
points</td>
<td><input type="radio" id="Membership_id_<?php
echo $membership->id;
?>
" name="Membership[id]" value="<?php
echo $membership->id;
示例4: foreach
<th>Title</th>
<th>Type</th>
<th>Duration</th>
<th>Price</th>
<th colspan="2">Edit/delete</th>
</tr>
<?php
foreach ($model as $data) {
?>
<tr align="center">
<td><?php
echo $data->title;
?>
</td>
<td><?php
echo Info::membership($data->type);
?>
</td>
<td><?php
echo $data->duration;
?>
</td>
<td><?php
echo $data->price;
?>
</td>
<td width="36px"><a href="<?php
echo Yii::app()->homeUrl . 'admin/webshop/membership/' . $data->id;
?>
" /><img src="<?php