PATH:
home
/
letacommog
/
letaweb
/
admin
/
models
/
mainsite_models
<?php class Language extends CActiveRecord { public static function model($className = __CLASS__) { return parent::model($className); } public function tableName() { return '{{language}}'; } /** * @return array validation rules for model attributes. */ public function rules() { return array( array('display_name', 'length', 'max' => 100), array('display_name', 'required'), array('name', 'length', 'max' => 100), array('name', 'unique'), array('name', 'required'), array('icon', 'length', 'max' => 100), array('id, name, display_name, icon', 'safe', 'on' => 'search'), ); } public function search() { $criteria = new CDbCriteria(); $criteria->compare('id', $this->id); $criteria->compare('name', $this->name, true); $criteria->compare('display_name', $this->display_name, true); return new CActiveDataProvider('Language', array( 'criteria' => $criteria, 'sort'=>array( 'defaultOrder'=>'id desc', ), )); } public function beforeSave() { parent::beforeSave(); if ($this->getIsNewRecord()) { Yii::app()->db->createCommand()->addColumn(Term::model()->tableSchema->name, 'value_'.$this->name, 'text'); } return true; } public function beforeDelete() { Yii::app()->db->createCommand()->dropColumn(Term::model()->tableSchema->name, 'value_'.$this->name); return true; } public function afterDelete() { $file_name = 'terms_'.$this->name.'.js'; $filePath = Yii::getPathofAlias('webroot.scripts').DIRECTORY_SEPARATOR.$file_name; @unlink($filePath); $file_name = $this->name.'.php'; $filePath = Yii::getPathofAlias('webroot.languages.').DIRECTORY_SEPARATOR.$file_name; @unlink($filePath); return true; } public static function t($key) { if (isset(Yii::app()->lang)) { Yii::app()->lang->t($key); } } public static function term($key, $default = '') { if (isset(Yii::app()->lang)) { return Yii::app()->lang->term($key,$default); } return $key; } }
[+]
..
[-] 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]