PATH:
home
/
letacommog
/
letaweb
/
admin
/
models
/
mainsite_models
<?php class User extends CActiveRecord { /** * Returns the static model of the specified AR class. * * @return CActiveRecord the static model class */ public static function model($className = __CLASS__) { return parent::model($className); } /** * @return string the associated database table name */ public function tableName() { return '{{user}}'; } public function rules() { // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( array('name', 'length', 'max' => 100), array('email', 'length', 'max' => 100), array('is_active', 'in' , 'range' => array(0,1)), array('is_admin', 'in' , 'range' => array(0,1)), array('id, name, email, is_active,is_admin', 'safe'), ); } public function search() { $criteria = new CDbCriteria(); $criteria->compare('id', $this->id); $criteria->compare('name', $this->name, true); $criteria->compare('email', $this->email, true); $criteria->compare('is_active', $this->is_active); $criteria->compare('is_admin', $this->is_admin); return new CActiveDataProvider('User', array( 'criteria' => $criteria, 'sort'=>array( 'defaultOrder'=>'date_modified desc', ), )); } public function search_admin() { $criteria = new CDbCriteria(); $criteria->compare('id', '<>'.Yii::app()->user->id); $criteria->compare('id', $this->id); $criteria->compare('name', $this->name, true); $criteria->compare('email', $this->email, true); $criteria->compare('is_active', $this->is_active); $criteria->compare('is_admin', $this->is_admin); return new CActiveDataProvider('User', array( 'criteria' => $criteria, )); } public $page_id; public function search_page() { $criteria = new CDbCriteria(); // $criteria->join = 'LEFT JOIN tbl_pageuser ON tbl_pageuser.user_id=t.id AND tbl_pageuser.page_id='.$this->page_id; $criteria->condition = 'NOT EXISTS(SELECT * FROM tbl_pageuser where tbl_pageuser.user_id=t.id and tbl_pageuser.page_id='.(int) $this->page_id.')'; $criteria->compare('id', $this->id); // $criteria->compare('tbl_pageuser.page_id', 'NULL'); $criteria->compare('name', $this->name, true); $criteria->compare('email', $this->email, true); $criteria->compare('is_admin', $this->is_admin); $criteria->compare('is_active', $this->is_active); return new CActiveDataProvider('User', array( 'criteria' => $criteria, )); } public function createPiwikAccount() { $password = $this->generateRandomPassword(); $this->save(); } public function getPiwikTokenAuth() { return Piwik::getTokenAuth($this->email, $this->piwik_password); } public function generateRandomPassword() { $password = ''; $desired_length = rand(8, 12); for ($length = 0; $length < $desired_length; ++$length) { $password .= chr(rand(32, 126)); } return $password; } }
[+]
..
[-] 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]