示例#1
0
 private function handleCredits()
 {
     $criteria = array("condition" => "`enable` = 1", "order" => "`cid` ASC", "limit" => 5);
     $record = Credit::model()->fetchAll($criteria);
     if (!empty($record)) {
         $index = 1;
         foreach ($record as $credit) {
             $this->_setting["extcredits"][$index] = $credit;
             $this->_setting["creditremind"] && ($this->_setting["creditnames"][] = str_replace("'", "\\'", StringUtil::ihtmlSpecialChars($credit["cid"] . "|" . $credit["name"])));
             $index++;
         }
     }
     $this->_setting["creditnames"] = $this->_setting["creditremind"] ? @implode(",", $this->_setting["creditnames"]) : "";
 }
示例#2
0
 private function delCredit()
 {
     if (Ibos::app()->getRequest()->getIsAjaxRequest()) {
         $id = EnvUtil::getRequest("id");
         $affected = Credit::model()->deleteByPk($id);
         if ($affected) {
             $this->ajaxReturn(array("IsSuccess" => true));
         }
     }
 }
示例#3
0
<div class="clear"></div>
<form name="payment_form" id="payment_form" method="post" action="" >
<div class="grid_10 push_1">
        <div class="credit_box">
                <div class="credit_pic">
                        <h2>เติมเครดิต</h2>
                </div>
                <div class="credit_select">
                        <h2>เลือกจำนวนเครดิตที่ต้องการเติม</h2>
                                <?php 
$criteria = new CDbCriteria();
$criteria->select = '*';
$criteria->condition = 'credit_status=:status ';
$criteria->params = array(':status' => 1);
$criteria->order = 'credit_order';
$credits = Credit::model()->findAll($criteria);
?>
                                <ul>

                                     <?php 
$i = 1;
foreach ($credits as $credit) {
    ?>
                                        <li>
                                                <input type="radio" id="tick_<?php 
    echo $i;
    ?>
" name="tick" value="<?php 
    echo $credit->credit_amount;
    ?>
"/>
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Credit the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Credit::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }