當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Info::membership方法代碼示例

本文整理匯總了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));
 }
開發者ID:noiary,項目名稱:Aion-Core-v4.7.5,代碼行數:43,代碼來源:WebshopController.php

示例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;
?>
開發者ID:noiary,項目名稱:Aion-Core-v4.7.5,代碼行數:31,代碼來源:account.php

示例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;
開發者ID:noiary,項目名稱:Aion-Core-v4.7.5,代碼行數:31,代碼來源:index.php

示例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 
開發者ID:noiary,項目名稱:Aion-Core-v4.7.5,代碼行數:31,代碼來源:membership_form.php


注:本文中的Info::membership方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。