PATH:
home
/
letacommog
/
letaweb
/
admin
/
models
/
mainsite_models
<?php class ModuleList 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 '{{modulelist}}'; } public function relations() { // NOTE: you may need to adjust the relation name and the related // class name for the relations automatically generated below. return array( 'module_category' => array(self::BELONGS_TO, 'ModuleCategory', 'category'), ); } /** * @return array validation rules for model attributes. */ public function rules() { return array( array('name','unique'), array('id, name, display_name, category,priority', 'safe', 'on' => 'search'), ); } public function afterSave() { return true; } 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); $criteria->compare('category', $this->category); $criteria->compare('priority', $this->priority); $criteria->compare('display', $this->display); $criteria->compare('editable', $this->editable); return new CActiveDataProvider('ModuleList', array( 'criteria' => $criteria, 'sort'=>array( 'defaultOrder'=>'id desc', ), )); } public function export() { $mysql = DbMigration::exportModuleData($this); $folders = array( array('webroot.scripts.editor.modules', $this->name.'.js','backend.js'), array('webroot.admin.views.builder.modules', $this->name.'.php','backend.php'), array('webroot.admin.widgets.modules', 'CWidget'.ucfirst($this->name).'.php','frontend.php'), array('webroot.admin.widgets.views.modules', $this->name.'.php','frontend_view.php'), array('webroot.admin.widgets.views.modules.script', $this->name.'.php','frontend_script.php'), array('webroot.exportmodule', 'exportmodulesql.sql','sql.sql'), ); $dir = Yii::getPathofAlias('webroot.exportmodule'); if(!file_exists($dir)) { @mkdir($dir); } $mysql_file = $dir.DIRECTORY_SEPARATOR."exportmodulesql.sql"; $handle = fopen($mysql_file,"w"); fwrite($handle, $mysql); fclose($handle); $archive_file_name = $dir.DIRECTORY_SEPARATOR.$this->name.'.zip'; $zip = new ZipArchive(); if ($zip->open($archive_file_name, ZIPARCHIVE::CREATE )!==TRUE) { exit("cannot open <$archive_file_name>\n"); } foreach ($folders as $folder) { $file = Yii::getPathofAlias($folder[0]).DIRECTORY_SEPARATOR.$folder[1]; if(file_exists($file)) { //@copy($file,$dir.DIRECTORY_SEPARATOR.$folder[2]); //$relativePath = $dir; //$relativePath = str_replace(array("/", "\\"), "/", $relativePath); $zip->addFile($file, $folder[2]); } } //$archive_file_name = Yii::getPathofAlias('webroot.websites.'.$this->name).'.zip'; $zip->close(); header("Content-type: application/zip"); header("Content-Disposition: attachment; filename=$archive_file_name"); header("Pragma: no-cache"); header("Expires: 0"); readfile("$archive_file_name"); } }
[+]
..
[-] 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]