Example #1
0
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $model = new PurchasedPlan();
     $form = new PurchasePlanForm();
     if (isset($_POST['PurchasedPlan'])) {
         $form->attributes = $_POST['PurchasedPlan'];
         if ($form->validate()) {
             if ($_POST['PurchasedPlan']['realPayment'] == 0) {
                 //$form->purchasePlan($this->getPlanType());
                 $this->redirect(array('index'));
             } else {
                 $wl = WhiteLabel::model()->findByPk(Yii::app()->user->getWhiteLabelId());
                 if ($wl == null) {
                     throw new Exception("Account doesn't exist");
                 }
                 $plan = Plan::model()->findByAttributes(array('plan_id' => $form->plan_id, 'wlabel_id' => Yii::app()->user->getWhiteLabelId(), 'type' => $this->getPlanType()));
                 if ($plan == null) {
                     throw new Exception("Plan doesn't exist");
                 }
                 if ($wl->payment_type == PaymentType::TYPE_PAYPAL) {
                     $this->processPayPalPayment($wl, $plan);
                 } else {
                     if ($wl->payment_type == PaymentType::TYPE_AUTHORIZENET) {
                         $this->processAuthnetPayment($wl, $plan);
                     }
                 }
                 exit;
             }
         }
     }
     if (isset($_GET['PurchasedPlan'])) {
         $model->attributes = $_GET['PurchasedPlan'];
     }
     $this->render('index', array('model' => $model, 'planType' => $this->getPlanType()));
 }
Example #2
0
 /**
  *
  * 改进:使用延迟绑定,将这个函数写在父类里面
  *返回某个用户所发布的所有计划列表
  * @return CActiveDataProvider $dataProvider  返回CActiveDataProvider对象
  * 使用attach的好处是随时绑定,不一定在初始化的时候绑定
  */
 public function getDataProvider(CFormModel &$condition)
 {
     $this->attachBehaviors(array('NearScopeBehavior' => array('class' => 'ext.behavior.NearScopeBehavior', 'latitude' => $condition->latitude, 'longitude' => $condition->longitude)));
     $dataProvider = new CActiveDataProvider(Plan::model()->unexpired()->near()->with('user'), array('pagination' => array('pageSize' => 20)));
     $dataProvider->setCriteria($this->addCondition($condition));
     return $dataProvider;
 }
Example #3
0
 /**
  * 
  * 查看plan的详细。在里面就包括了评论等具体的内容,注意,评论则需要分页。
  * 因为plan本身已经返回,所以只返回评论的内容。
  */
 public function actionDetail($planId)
 {
     $plan = Plan::model()->findByPk('planId', 'planId=:planId', array(':planId' => $planId));
     $dataProvider = $plan->getComments();
     $this->page($dataProvider);
     $data = array('data' => $dataProvider);
     $this->render('detail', $data);
 }
Example #4
0
 public function purchasePlan($planType, $advertiserId = '')
 {
     $transaction = Yii::app()->db->beginTransaction();
     try {
         // load plan and its plan limits
         if ($planType == PlanType::ADVERTISER_PLAN) {
             $plan = Plan::model()->findByAttributes(array('plan_id' => $this->plan_id, 'wlabel_id' => Yii::app()->user->getWhiteLabelId(), 'type' => $planType));
         } else {
             $plan = Plan::model()->findByAttributes(array('plan_id' => $this->plan_id, 'type' => $planType));
         }
         if ($plan == null) {
             throw new Exception("Plan doesn't exist");
         }
         $planLimits = PlanLimit::model()->findAllByAttributes(array('plan_id' => $plan->plan_id));
         if ($planLimits == null) {
             //				 throw new Exception("Plan Limits don't exist");
         }
         // create new purchased_plans record
         $purchasedPlan = new PurchasedPlan();
         $purchasedPlan->plan_id = $plan->plan_id;
         if ($planType == PlanType::ADVERTISER_PLAN) {
             $purchasedPlan->wlabel_id = $plan->wlabel_id;
         } else {
             $purchasedPlan->wlabel_id = $this->wlabel_id;
         }
         $purchasedPlan->type = $plan->type;
         if ($planType == PlanType::ADVERTISER_PLAN) {
             if (Yii::app()->user->isAdvertiser()) {
                 $purchasedPlan->advertiser_id = Yii::app()->user->getAdvertiserId();
             } else {
                 $purchasedPlan->advertiser_id = $advertiserId;
             }
         } else {
         }
         $purchasedPlan->method = 0;
         $purchasedPlan->price = $plan->price;
         $purchasedPlan->date_created = date("Y-m-d h:i:s");
         if (!$purchasedPlan->validate()) {
             throw new Exception("Plan purchase cannot be saved: " . $this->putErrorsToString($purchasedPlan->getErrors()));
         }
         $purchasedPlan->save();
         // create new purchased_plans payments record
         $purchasedPlanPayment = new PurchasedPlanPayment();
         $purchasedPlanPayment->pplan_id = $purchasedPlan->pplan_id;
         $purchasedPlanPayment->date_paid = $purchasedPlan->date_created;
         $purchasedPlanPayment->date_expire = Date('y-m-d', strtotime("+{$plan->duration} day"));
         $purchasedPlanPayment->transaction_id = 'TEST_PAYMENT';
         if (!$purchasedPlanPayment->validate()) {
             throw new Exception("Plan payment cannot be saved: " . $this->putErrorsToString($purchasedPlanPayment->getErrors()));
         }
         $purchasedPlanPayment->save();
     } catch (Exception $e) {
         $transaction->rollBack();
         throw new CHttpException(400, 'DB Exception: ' . $e->getMessage());
     }
     $transaction->commit();
     return false;
 }
Example #5
0
 public function actionIndex()
 {
     $this->layout = 'login';
     $wlabelId = isset($_REQUEST['wid']) ? $_REQUEST['wid'] : '';
     if ($wlabelId == '') {
         throw new CHttpException(404, 'Bad parameter wid');
     }
     $planId = isset($_REQUEST['pid']) ? $_REQUEST['pid'] : '';
     if ($planId == '') {
         throw new CHttpException(404, 'Bad parameter pid');
     }
     $advertiserId = isset($_REQUEST['aid']) ? $_REQUEST['aid'] : '';
     if ($advertiserId == '') {
         throw new CHttpException(404, 'Bad parameter aid');
     }
     $returnUrl = isset($_REQUEST['return']) ? $_REQUEST['return'] : '';
     if ($returnUrl == '') {
         throw new CHttpException(404, 'Bad parameter return');
     }
     $wl = WhiteLabel::model()->findByPk(Yii::app()->user->getWhiteLabelId());
     if ($wl == null) {
         throw new Exception("Account doesn't exist");
     }
     $plan = Plan::model()->findByAttributes(array('plan_id' => $planId, 'wlabel_id' => $wlabelId));
     if ($plan == null) {
         throw new CHttpException(404, 'Cannot find plan!');
     }
     $advertiser = Advertiser::model()->findByAttributes(array('advertiser_id' => $planId, 'wlabel_id' => $advertiserId));
     if ($plan == null) {
         throw new CHttpException(404, 'Cannot find advertiser!');
     }
     $form = new AuthorizenetPaymentForm();
     if (isset($_POST['AuthorizenetPaymentForm'])) {
         $form->attributes = $_POST['AuthorizenetPaymentForm'];
         $form->advertiser_id = $advertiserId;
         $form->wlabel_id = $wlabelId;
         $form->plan_id = $plan->plan_id;
         $form->refId = $plan->plan_id;
         $form->name = "Plan Subscription";
         $form->unit = "days";
         $form->totalOccurrences = 999;
         $form->trialOccurrences = 0;
         $form->trialAmount = 0;
         $form->startDate = date('Y-m-d');
         $form->length = $plan->duration;
         $form->amount = $plan->price;
         if ($form->validate()) {
             if ($form->sendCreateSubscription($wl, $plan)) {
                 $this->redirect($returnUrl);
             }
         }
     }
     if (isset($_GET['AuthorizenetPaymentForm'])) {
         $form->attributes = $_GET['AuthorizenetPaymentForm'];
     }
     $this->render('form_authnet_payment', array('model' => $form));
 }
 public function actionIndex()
 {
     $plan = Plan::model();
     $searchForm = $this->initParams('SearchForm', 'new');
     $dataProvider = $plan->getDataProvider($searchForm);
     $this->page($dataProvider, true);
     $data = array('search' => $searchForm, 'dataProvider' => $dataProvider);
     $this->render('index', $data);
 }
 public function actionIndex()
 {
     $tempForm = $this->initParams('TempForm', 'new');
     $data = array('tempForm' => $tempForm);
     if ($tempForm->validate()) {
         $plan = Plan::model();
         $dataProvider = $plan->getDataProvider($tempForm);
         $this->page($dataProvider);
         $data = array_merge($data, array('dataProvider' => $dataProvider));
     } else {
         $this->error->capture($tempForm);
     }
     $this->render('index', $data);
 }
 public function actionIndex()
 {
     $plan = Plan::Model();
     $plan->setScenario('detail');
     $data = array('model' => Plan::model());
     if (isset($_POST['Plan'])) {
         $plan->attributes = $_POST['Plan'];
     }
     if ($plan->validate()) {
         $dataProvider = new CActiveDataProvider(PlanComment::model()->with('user'), array('criteria' => array('condition' => 'planId=' . $plan->planId, 'order' => 'commentId DESC'), 'pagination' => array('pageSize' => 10)));
         $data = array_merge($data, array('dataProvider' => $dataProvider));
         $this->page($dataProvider);
     } else {
         $this->error->capture($plan);
     }
     $this->render('index', $data);
 }
 public function purchasePlan($subscriptionId, $advertiserId = '')
 {
     $transaction = Yii::app()->db->beginTransaction();
     try {
         // load plan and its plan limits
         $plan = Plan::model()->findByAttributes(array('plan_id' => $this->plan_id, 'wlabel_id' => $this->wlabel_id));
         if ($plan == null) {
             throw new Exception("Plan doesn't exist");
         }
         // create new purchased_plans record
         $purchasedPlan = new PurchasedPlan();
         $purchasedPlan->plan_id = $plan->plan_id;
         $purchasedPlan->wlabel_id = $plan->wlabel_id;
         $purchasedPlan->type = $plan->type;
         $purchasedPlan->duration = $plan->duration;
         $purchasedPlan->method = PaymentType::TYPE_AUTHORIZENET;
         $purchasedPlan->subscription_id = $subscriptionId;
         $purchasedPlan->advertiser_id = $this->advertiser_id;
         $purchasedPlan->method = 0;
         $purchasedPlan->price = $plan->price;
         $purchasedPlan->date_created = date("Y-m-d h:i:s");
         if (!$purchasedPlan->validate()) {
             throw new Exception("Plan purchase cannot be saved: " . $this->putErrorsToString($purchasedPlan->getErrors()));
         }
         $purchasedPlan->save();
         // create new purchased_plans payments record
         $purchasedPlanPayment = new PurchasedPlanPayment();
         $purchasedPlanPayment->pplan_id = $purchasedPlan->pplan_id;
         $purchasedPlanPayment->date_paid = $purchasedPlan->date_created;
         $purchasedPlanPayment->date_expire = Date('Y-m-d', strtotime("+{$plan->duration} day"));
         $purchasedPlanPayment->transaction_id = 'AUTHNET_INIT_PAYMENT';
         if (!$purchasedPlanPayment->validate()) {
             throw new Exception("Plan payment cannot be saved: " . $this->putErrorsToString($purchasedPlanPayment->getErrors()));
         }
         $purchasedPlanPayment->save();
     } catch (Exception $e) {
         $transaction->rollBack();
         throw new CHttpException(400, 'DB Exception: ' . $e->getMessage());
     }
     $transaction->commit();
     return true;
 }
Example #10
0
 public function init()
 {
     //		Yii::app()->clientScript->registerCoreScript( "https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js", CClientScript::POS_HEAD);
     //		Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/jquery-1.5.2.min.js',CClientScript::POS_HEAD);
     Yii::app()->clientScript->registerScriptFile(Yii::app()->assetManager->publish('js/scriptbreaker-multiple-accordion-1.js'), CClientScript::POS_BEGIN);
     //		Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/scriptbreaker-multiple-accordion-1.js',CClientScript::POS_HEAD);
     $criteria = new CDbCriteria();
     if ($this->columns != null) {
         $cri = "";
         foreach ($this->columns as $row) {
             if (strlen($row[0]) > 0) {
                 $cri[] = $row[0];
             }
         }
         $criteria->with = $cri;
     }
     $this->rows = $this->model->findAll($criteria);
     $this->line_open = false;
     $this->position = 0;
     if (strlen($this->action) == 0) {
         $this->prows = Plan::model()->findAll();
     }
 }
 public function actionIndex()
 {
     $status = UserStatus::model()->findByPk(Yii::app()->user->userId);
     $refreshTime = $status->refreshTime;
     $result = Plan::model()->findAllByAttributes(array('userId' => Yii::app()->user->userId));
     $primaryKeys = array();
     foreach ($result as $value) {
         array_push($primaryKeys, $value->primaryKey);
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('planId', $primaryKeys);
     $criteria->addCondition('createTime>=' . $refreshTime);
     $inbox = PlanComment::model()->findAll($criteria);
     $count = count($inbox);
     if ($count > 0) {
         $this->send(ERROR_NONE, $inbox, false, array('count' => $count), false);
     }
     //传递一个已读未读的标志位
     if (isset($_POST['read'])) {
         $status->refreshTime = time();
         $status->save();
     }
     $this->render('index');
 }
Example #12
0
<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'plan-limit-form', 'enableAjaxValidation' => false));
?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php 
echo $form->errorSummary($modelPlanLimit);
?>

	<div class="row">
		<?php 
echo $form->labelEx($modelPlanLimit, 'plan_id');
?>
		<?php 
echo $form->dropDownList($modelPlanLimit, 'plan_id', CHtml::listData(Plan::model()->findAllByType(PlanType::WHITELABEL_PLAN), 'plan_id', 'name'), array('' => ''));
?>
		
		<?php 
echo $form->error($modelPlanLimit, 'plan_id');
?>
	</div>
	
	<div class="row">
		<?php 
echo $form->labelEx($modelPlanLimit, 'resource_type');
?>
		<?php 
echo $form->dropDownList($modelPlanLimit, 'resource_type', CHtml::listData(PlanResourceType::findAllByType(PlanType::WHITELABEL_PLAN), 'id', 'name'));
?>
		<?php 
Example #13
0
 public function getList($planId)
 {
     $dataProvider = new CActiveDataProvider(Plan::model(), array('criteria' => array('condition' => 'planId=' . $planId, 'order' => 'planId DESC'), 'pagination' => array('pageSize' => 20)));
     return $dataProvider;
 }
 /**
  * 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 the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Plan::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #15
0
 public function actionAjaxReqord()
 {
     $val1 = $_POST['p_id'];
     $val2 = $_POST['c_id'];
     $this->widget('ext.OrderlistWidget', array('model' => Plan::model(), 'columns' => array('id', 'coox', 'cooy'), 'class' => 'nx', 'filter' => 'ptype="line"', 'id' => 'id', 'togo' => '##', 'next' => 'next', 'par_id' => $val1, 'cur_id' => $val2, 'par' => 'region_id', 'level' => 1));
     Yii::app()->end();
 }
Example #16
0
echo $form->labelEx($modelPlanLimit, 'resource_type');
?>
		<?php 
echo $form->dropDownList($modelPlanLimit, 'resource_type', CHtml::listData(PlanResourceType::findAllByType(PlanType::ADVERTISER_PLAN), 'id', 'name'));
?>
		<?php 
echo $form->error($modelPlanLimit, 'resource_type');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($modelPlanLimit, 'plan_id');
?>
		<?php 
echo $form->dropDownList($modelPlanLimit, 'plan_id', CHtml::listData(Plan::model()->findAllByType(PlanType::ADVERTISER_PLAN), 'plan_id', 'name'));
?>
		
		<?php 
echo $form->error($modelPlanLimit, 'plan_id');
?>
	</div>
	


	<div class="row buttons">
		<?php 
echo CHtml::submitButton($modelPlanLimit->isNewRecord ? 'Add Limit' : 'Save Limit', array('class' => "button ui-state-default ui-corner-all form-submit"));
?>
	</div>
Example #17
0
	</p>

	<?php echo $form->errorSummary($model); ?>

		<div class="row">
		<?php echo $form->labelEx($model,'id'); ?>
		<?php echo $form->textField($model, 'id'); ?>
		<?php echo $form->error($model,'id'); ?>
		</div><!-- row -->
		<div class="row">
		<?php echo $form->labelEx($model,'user_id'); ?>
		<?php echo $form->dropDownList($model, 'user_id', GxHtml::listDataEx(User::model()->findAllAttributes(null, true))); ?>
		<?php echo $form->error($model,'user_id'); ?>
		</div><!-- row -->
		<div class="row">
		<?php echo $form->labelEx($model,'plan_id'); ?>
		<?php echo $form->dropDownList($model, 'plan_id', GxHtml::listDataEx(Plan::model()->findAllAttributes(null, true))); ?>
		<?php echo $form->error($model,'plan_id'); ?>
		</div><!-- row -->
		<div class="row">
		<?php echo $form->labelEx($model,'local_id'); ?>
		<?php echo $form->dropDownList($model, 'local_id', GxHtml::listDataEx(Local::model()->findAllAttributes(null, true))); ?>
		<?php echo $form->error($model,'local_id'); ?>
		</div><!-- row -->


<?php
echo GxHtml::submitButton(Yii::t('app', 'Save'));
$this->endWidget();
?>
</div><!-- form -->
 /**
  * Dado un año y una carrera chequea si existe otro registro en la base de datos
  */
 public function actionTestExistsPlan($anioPlan, $Carrera_id)
 {
     $record = Plan::model()->find(array('select' => 'id', 'condition' => 'anioPlan=:anioPlan AND Carrera_id=:Carrera_id', 'params' => array(':anioPlan' => $anioPlan, ':Carrera_id' => $Carrera_id)));
     $resp = $record === null ? "false" : "true";
     header("Content-type: application/json");
     echo CJSON::encode($resp);
 }

                // value
                var valueAxis = new AmCharts.ValueAxis();
                valueAxis.axisColor = "#DADADA";
                valueAxis.dashLength = 1;
                valueAxis.logarithmic = false; // this line makes axis logarithmic
                chart.addValueAxis(valueAxis);
                

                
              <?php 
$planes = Plan::model()->findAll(array('order' => 'anioPlan'));
foreach ($planes as $key) {
    $randomcolor = $utils->getColor();
    $record = Plan::model()->findByPK($key->id);
    echo '  
               var graph = new AmCharts.AmGraph();
                
                graph.type = "smoothedLine";
                
                 graph.bullet = "round";
                graph.bulletSize = 1;
                
                graph.bulletBorderAlpha = 1;
                graph.bulletBorderThickness = 1;
                graph.lineThickness = 2;
                
                graph.bulletColor = "' . $randomcolor . '";
                graph.useLineColorForBulletBorder = true;
                
Example #20
0
 /**
  * @return array validation rules for model attributes.
  */
 public function rules()
 {
     // NOTE: you should only define rules for those attributes that
     // will receive user inputs.
     return array(array('resource_type, limit_amount', 'required'), array('resource_type, limit_amount, plan_id', 'numerical', 'integerOnly' => true), array('plan_id', 'in', 'range' => array_keys(CHtml::listData(Plan::model()->findAllByType(0), 'plan_id', 'name')), 'allowEmpty' => false), array('plimit_id, resource_type, limit_amount, plan_id', 'safe', 'on' => 'search'));
 }
 public function actionRefreshExamsEvolution()
 {
     $anios = array_values(json_decode(stripslashes($_POST['anios'])));
     $cuats = array_values(json_decode(stripslashes($_POST['cuatrimestres'])));
     $cuats_unique = array_unique($cuats);
     $this->createDaysArray();
     $utils = new Utils();
     $planes = Plan::model()->findAll(array('order' => 'anioPlan'));
     $resultados = array();
     foreach ($planes as $key) {
         //Por cada id de plan se obtienen todas las materias del mismo
         $criteriaPlanes = new CDbCriteria();
         $criteriaPlanes->select = 't.materia_id';
         $criteriaPlanes->condition = "plan_id == " . $key->id;
         $criteriaPlanes->addInCondition('t.anio', $anios);
         if (count($cuats_unique) == 1) {
             $criteriaPlanes->addCondition("t.cuatrimestre==" . $cuats_unique[0]);
         }
         $materiasPlan = MateriaPlan::model()->findAll($criteriaPlanes);
         $materias = array();
         $matPlan = array();
         foreach ($materiasPlan as $value) {
             array_push($matPlan, $value->Materia_id);
         }
         foreach ($matPlan as $value) {
             if (!in_array($value, $materias, true)) {
                 array_push($materias, $value);
             }
         }
         //Obtengo los examenes de las materias dadas
         $criteriaMaterias = new CDbCriteria();
         $criteriaMaterias->select = 't.*';
         $criteriaMaterias->join = "INNER JOIN Tipo_Examen as tipoexamen ON(tipoexamen.id=t.tipoexamen_id)";
         $criteriaMaterias->addInCondition('t.materia_id', $materias);
         $criteriaMaterias->order = 't.fechaExamen ASC';
         $examenes = Examen::model()->findAll($criteriaMaterias);
         //Arreglo donde se guardaran los datos
         $datos = array();
         $datosNormalDate = $this->fechas;
         //Informacion que se devuelve  a la vista:
         // fecha del examen, dias de preparacion y peso de cada dia
         foreach ($examenes as $arr) {
             $fecha = $arr->fechaExamen;
             $dias = $arr->diasPreparacion;
             $complejidad = $arr->tipoexamen->complejidad;
             $utils->CalculateWeight($datos, $datosNormalDate, $fecha, $dias, $complejidad);
         }
         $resultados[$key->id] = $datosNormalDate;
     }
     header("Content-type: application/json");
     //Envio la informacion en formato jSON
     echo CJSON::encode(array('result' => $resultados));
 }
Example #22
0
	'method' => 'get',
)); ?>

	<div class="row">
		<?php echo $form->label($model, 'id'); ?>
		<?php echo $form->textField($model, 'id'); ?>
	</div>

	<div class="row">
		<?php echo $form->label($model, 'user_id'); ?>
		<?php echo $form->dropDownList($model, 'user_id', GxHtml::listDataEx(User::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All'))); ?>
	</div>

	<div class="row">
		<?php echo $form->label($model, 'plan_id'); ?>
		<?php echo $form->dropDownList($model, 'plan_id', GxHtml::listDataEx(Plan::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All'))); ?>
	</div>

	<div class="row">
		<?php echo $form->label($model, 'local_id'); ?>
		<?php echo $form->dropDownList($model, 'local_id', GxHtml::listDataEx(Local::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All'))); ?>
	</div>

	<div class="row buttons">
		<?php echo GxHtml::submitButton(Yii::t('app', 'Search')); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- search-form -->
Example #23
0
	'columns' => array(
		array(
                        'name' => 'id',
                        //'header'=>'id',
                        //'value' => '($model->id',
                        //'htmlOptions'=>array('style'=>'min-width: 50px; max-width: 100px; white-space:nowrap;'),
                     ),
		array(
                        'name'=>'user_id',
                        'value'=>'GxHtml::valueEx($data->user)',
                        'filter'=>GxHtml::listDataEx(User::model()->findAllAttributes(null, true)),
                        //'htmlOptions'=>array('style'=>'min-width: 50px; max-width: 100px; white-space:nowrap;'),
                     ),
		array(
                        'name'=>'plan_id',
                        'value'=>'GxHtml::valueEx($data->plan)',
                        'filter'=>GxHtml::listDataEx(Plan::model()->findAllAttributes(null, true)),
                        //'htmlOptions'=>array('style'=>'min-width: 50px; max-width: 100px; white-space:nowrap;'),
                     ),
		array(
                        'name'=>'local_id',
                        'value'=>'GxHtml::valueEx($data->local)',
                        'filter'=>GxHtml::listDataEx(Local::model()->findAllAttributes(null, true)),
                        //'htmlOptions'=>array('style'=>'min-width: 50px; max-width: 100px; white-space:nowrap;'),
                     ),
                array(
                      'class'=>'bootstrap.widgets.TbButtonColumn',
                      'htmlOptions'=>array('style'=>'width: 50px'),
                  ),                
	),
)); ?>
Example #24
0

    <div id="wait_animation">
        <div class="circle"></div>
        <div class="circle1"></div>
    </div>
</div>


<div id="planes-metricas" class="drop" ondrop="dropElement(this, event)" ondragenter="return false"
     ondragover="return false">

    <?php 
$criteria = new CDbCriteria();
$criteria->order = 'anioPlan';
$planes = Plan::model()->findAll($criteria);
echo '<ul class="lista">';
foreach ($planes as $item) {
    $codigo = $item->id;
    $anio = $item->anioPlan;
    $nombre = $item->carrera->nombreCarrera;
    if ($browser->getBrowser() == "Internet Explorer") {
        echo '<a href="#" onclick="return false;" draggable="true" class="plan" id="' . $codigo . '" ondragstart="dragElement(this, event,0)">' . $anio . ' - ' . $nombre . '</a>';
    } else {
        echo '<span draggable="true" class="plan" id="' . $codigo . '" ondragstart="dragElement(this, event,0)">' . $anio . ' - ' . $nombre . '</span>';
    }
}
echo '</ul>';
?>

</div>
Example #25
0
    ?>
	
		

<div class="portlet">
<div class="portlet-header">Limit Plans</div>
<div class="portlet-content">

<?php 
    echo $this->renderPartial('_formPlanLimit', array('modelPlanLimit' => $modelPlanLimit));
    ?>
</div>
</div>


<div class="portlet">
<div class="portlet-header">View Plans</div>
<div class="portlet-content">


<?php 
    $this->widget('zii.widgets.grid.CGridView', array('id' => 'plan-limit-grid', 'dataProvider' => $modelPlanLimit->search(PlanType::ADVERTISER_PLAN), 'filter' => null, 'columns' => array(array('name' => 'plan_id', 'filter' => CHtml::listData(Plan::model()->findAllByType(PlanType::ADVERTISER_PLAN), 'plan_id', 'name'), 'value' => '$data->p_plans->name'), array('name' => 'resource_type', 'filter' => CHtml::listData(PlanResourceType::findAllByType(PlanType::ADVERTISER_PLAN), 'id', 'name'), 'value' => '$data->getType($data->resource_type)'), 'limit_amount', array('class' => 'CButtonColumn', 'template' => '{update}{delete}', 'buttons' => array('update' => array('label' => 'Update', 'url' => 'Yii::app()->createUrl("siteadmin/plan/updateLimit", array("id"=>$data->plimit_id))'), 'delete' => array('label' => 'Delete', 'url' => 'Yii::app()->createUrl("siteadmin/plan/deleteLimit", array("id"=>$data->plimit_id))'))))));
    ?>
</div>
</div>

<?php 
}
?>
	
Example #26
0
    ?>
		<?php 
    echo $form->dropDownList($model, 'advertiser_id', $advertisers, array('' => ''));
    ?>
		
		<?php 
    echo $form->error($model, 'advertiser_id');
    ?>
	</div>

	<div class="row">
		<?php 
    echo $form->labelEx($model, 'plan_id');
    ?>
		<?php 
    echo $form->radioButtonList($model, 'plan_id', Plan::model()->findPlansWithText($planType), array('' => ''));
    ?>
		
		<?php 
    echo $form->error($model, 'plan_id');
    ?>
	</div>

	<div class="row buttons">
		<?php 
    echo CHtml::submitButton('Add Plan to Advertiser', array('class' => "button ui-state-default ui-corner-all form-submit"));
    ?>
	</div>

	<?php 
    $this->endWidget();
Example #27
0
 private function processPayment()
 {
     if (!isset($_REQUEST['txn_type'])) {
         throw new Exception("Txn type doesn't exist");
     }
     if (isset($_REQUEST['txn_type']) && $_REQUEST['txn_type'] != 'subscr_payment') {
         throw new Exception("Txn type is not payment: " . $_REQUEST['txn_type']);
     }
     if (!isset($_REQUEST['payment_status'])) {
         throw new Exception("Payment status doesn't exist");
     }
     if (isset($_REQUEST['payment_status']) && $_REQUEST['payment_status'] != 'Completed') {
         throw new Exception("Payment not completed");
     }
     $ids = explode('_', $_REQUEST['item_number']);
     $planId = $ids[0];
     if (isset($ids[1])) {
         $advertiserId = $ids[1];
     } else {
         $advertiserId = '';
     }
     $plan = Plan::model()->findByPk($planId);
     if ($plan == null) {
         throw new Exception("Plan not found, ID: {$planId}");
     }
     if ($plan->type == PlanType::ADVERTISER_PLAN) {
         if ($advertiserId == '') {
             throw new Exception("Advertiser not found in item_number");
         }
         $advertiser = Advertiser::model()->findByPk($advertiserId);
         if ($advertiser == null) {
             throw new Exception("Advertiser not found, ID: {$advertiserId}");
         }
         if ($advertiser->wlabel_id != $plan->wlabel_id) {
             throw new Exception("Advertiser and Plan belong to a different accounts: " . $advertiser->wlabel_id . " <> " . $plan->wlabel_id);
         }
     }
     $purchasedPlan = PurchasedPlan::model()->findByAttributes(array('subscription_id' => $_REQUEST['subscr_id'], 'wlabel_id' => $plan->wlabel_id));
     if ($purchasedPlan == null) {
         if (intval($plan->price) != intval($_REQUEST['mc_gross'])) {
             throw new Exception("Advertiser and Plan have different prices, possible fraud? " . intval($plan->price) . " <> " . intval($_REQUEST['amount3']));
         }
         // insert new purchased plan
         $purchasedPlan = new PurchasedPlan();
         $purchasedPlan->plan_id = $plan->plan_id;
         $purchasedPlan->wlabel_id = $plan->wlabel_id;
         $purchasedPlan->type = $plan->type;
         if ($advertiserId != '') {
             $purchasedPlan->advertiser_id = $advertiserId;
         }
         $purchasedPlan->method = PaymentType::TYPE_PAYPAL;
         $purchasedPlan->price = $plan->price;
         $purchasedPlan->subscription_id = $_REQUEST['subscr_id'];
         $purchasedPlan->date_created = date("Y-m-d h:i:s");
         if (!$purchasedPlan->validate()) {
             throw new Exception("Plan purchase cannot be saved: " . $this->putErrorsToString($purchasedPlan->getErrors()));
         }
         $purchasedPlan->save();
     }
     // create new purchased_plans payments record
     $purchasedPlanPayment = PurchasedPlanPayment::model()->findByAttributes(array('transaction_id' => $_REQUEST['txn_id']));
     if ($purchasedPlanPayment != null) {
         throw new Exception("There already exists payment with this transaction ID: " . $_REQUEST['txn_id']);
     }
     $purchasedPlanPayment = new PurchasedPlanPayment();
     $purchasedPlanPayment->pplan_id = $purchasedPlan->pplan_id;
     $purchasedPlanPayment->date_paid = $purchasedPlan->date_created;
     $purchasedPlanPayment->date_expire = Date('y-m-d', strtotime("+{$plan->duration} day"));
     $purchasedPlanPayment->transaction_id = $_REQUEST['txn_id'];
     if (!$purchasedPlanPayment->validate()) {
         throw new Exception("Plan payment cannot be saved: " . $this->putErrorsToString($purchasedPlanPayment->getErrors()));
     }
     $purchasedPlanPayment->save();
 }