PATH:
home
/
letacommog
/
letaweb
/
admin
/
models
/
mainsite_models
<?php class Plan extends CActiveRecord { public static function model($className = __CLASS__) { return parent::model($className); } public function tableName() { return '{{plan}}'; } public function relations() { return array( 'condition' => array(self::HAS_MANY, 'PlanCondition', 'plan_id'), ); } public function getConditionIndexed() { $conditions = $this->condition; $rs = array(); foreach ($conditions as $condition) { $rs[$condition->name] = $condition->value; } return $rs; } public function beforeDelete() { Site::model()->updateAll(array('plan_id' => 1), 'plan_id="'.$this->id.'"'); PlanCondition::model()->deleteAll('plan_id="'.$this->id.'"'); if(isset(Yii::app()->payment)) { $payments = Yii::app()->payment->loadModules(); foreach($payments as $payment) { $pclass = Yii::app()->payment->getModule($payment); if(isset($pclass)) { $pclass->beforePlanDelete($this); } } } return true; } public function afterSave() { if(isset(Yii::app()->payment)) { $payments = Yii::app()->payment->loadModules(); foreach($payments as $payment) { $pclass = Yii::app()->payment->getModule($payment); if(isset($pclass)) { $pclass->afterPlanSave($this); } } } } public function search() { $criteria = new CDbCriteria(); $criteria->compare('id', $this->id); $criteria->compare('name', $this->name, true); $criteria->compare('monthly_amount', $this->monthly_amount); $criteria->compare('yearly_amount', $this->yearly_amount); return new CActiveDataProvider('Plan', array( 'criteria' => $criteria, 'sort'=>array( 'defaultOrder'=>'id desc', ), )); } }
[+]
..
[-] Ticket.php
[edit]
[-] Configuration.php
[edit]
[-] PlanCondition.php
[edit]
[-] ModuleCategory.php
[edit]
[-] SamplePageCategory.php
[edit]
[-] Page_Type.php
[edit]
[-] Zone_Templates.php
[edit]
[-] User_Data.php
[edit]
[-] PlanDescription.php
[edit]
[-] UserData.php
[edit]
[-] Purchase.php
[edit]
[-] WebUser.php
[edit]
[-] Term.php
[edit]
[-] Type.php
[edit]
[-] Template.php
[edit]
[-] Site.php
[edit]
[-] Payment.php
[edit]
[+]
forms
[-] Language.php
[edit]
[-] AuthItem.php
[edit]
[-] MailTemplate.php
[edit]
[-] TicketForm.php
[edit]
[-] ModuleData.php
[edit]
[-] UserIdentity.php
[edit]
[-] Popup_Script.php
[edit]
[-] UserRecoverPassword.php
[edit]
[-] HelpCategory.php
[edit]
[-] Color.php
[edit]
[-] PlanAddition.php
[edit]
[-] Plan.php
[edit]
[-] IPNLogMessage.php
[edit]
[-] Subscription.php
[edit]
[-] SamplePage.php
[edit]
[-] ModuleList.php
[edit]
[-] User.php
[edit]
[-] Page_Domain.php
[edit]
[-] Payment_Method.php
[edit]
[-] YiiLog.php
[edit]
[-] User_Session.php
[edit]
[-] SkinPreset.php
[edit]
[-] Page_Installation.php
[edit]
[-] SiteData.php
[edit]
[-] Content.php
[edit]
[-] Library_Script.php
[edit]
[-] WebsiteCategory.php
[edit]