当前位置: 首页>>代码示例>>PHP>>正文


PHP Record::model方法代码示例

本文整理汇总了PHP中Record::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Record::model方法的具体用法?PHP Record::model怎么用?PHP Record::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Record的用法示例。


在下文中一共展示了Record::model方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionIndex

 public function actionIndex()
 {
     $ips = array('95.110.192.200', '95.110.193.249', '95.110.204.16', '95.110.204.20', '69.175.126.90', '69.175.126.94', '46.4.96.70', '46.4.96.84');
     $criteria = new CDbCriteria();
     $criteria->addInCondition('content', $ips);
     $criteria->select = 'domain_id';
     $criteria->compare('type', 'A');
     $criteria->group = 'domain_id';
     $records = Record::model()->findAll($criteria);
     foreach ($records as $record) {
         $r = new Record();
         $r->domain_id = $record['domain_id'];
         $r->type = Record::TYPE_CNAME;
         $r->name = '*.' . $record->domain->name;
         $r->content = $record->domain->name;
         $r->ttl = '86400';
         if (!$r->save()) {
             echo "\nCannot save duplicate record to domain " . $r->domain->name;
         } else {
             echo "\nRecord * added to domain " . $r->domain->name;
             $record->domain->updateSOA();
         }
     }
     echo "\n";
 }
开发者ID:simonefalcini,项目名称:poweradmin-api,代码行数:25,代码来源:ToolCommand.php

示例2: actionDisplayOperation

 public function actionDisplayOperation($id = null)
 {
     $model = Record::model()->findAllByAttributes(array('operation_id' => $id));
     $values = CHtml::listData($model, 'port_id', 'value', 'timestamp');
     $jsonarray = array();
     foreach ($values as $date => $value) {
         $jsonarray[] = array_merge(array($date), $value);
     }
     $model = Operation::model()->with('iface')->findByPK($id);
     $model->nextPrev();
     $this->render('displayOperation', array('values' => $jsonarray, 'operation' => $model));
 }
开发者ID:dailos,项目名称:heimdal,代码行数:12,代码来源:ClientController.php

示例3: model

 /**
  * Returns the static model of the specified AR class.
  * @param string $className active record class name.
  * @return UserProfile the static model class
  */
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
开发者ID:BGCX067,项目名称:facecom-svn-to-git,代码行数:9,代码来源:UserProfile.php

示例4: loadModel

 /**
  * 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 $id the ID of the model to be loaded
  * @return Record the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Record::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:alexbit2015,项目名称:yiiphonebook,代码行数:15,代码来源:RecordController.php

示例5: actionEnableDomain

 public function actionEnableDomain($domain, $_output = true)
 {
     $result = true;
     $error = array('code' => 0, 'message' => '');
     $dd = DisabledDomain::model()->findByAttributes(array('domain' => $domain));
     if (!isset($dd)) {
         $result = false;
         $error['code'] = self::ERROR_DOMAIN_NOT_FOUND;
         $error['message'] = 'Domain not found';
     } else {
         $records = @unserialize($dd->records);
         if (!is_array($records)) {
             $result = false;
             $error['code'] = self::ERROR_RECORD_NOT_FOUND;
             $error['message'] = 'Cannot recover records';
         } else {
             // Remove fallback records
             $domain = Domain::model()->findByAttributes(array('name' => $dd->domain));
             Record::model()->deleteAllByAttributes(array('domain_id' => $domain->id));
             $resp = $this->actionEditBulkRecords($dd->domain, json_encode($records), true, false);
             if ($resp['result'] === true) {
                 $dd->delete();
             } else {
                 $error['code'] = $resp['error_code'];
                 $error['message'] = $resp['error_message'];
                 $result = $resp['result'];
             }
         }
     }
     $var = array('error_code' => $error['code'], 'error_message' => $error['message'], 'result' => $result);
     if ($_output) {
         $this->renderText(CJSON::encode($var));
     }
     return $var;
 }
开发者ID:simonefalcini,项目名称:poweradmin-api,代码行数:35,代码来源:ApiController.php

示例6: addSOA

 private function addSOA()
 {
     $domain = $this;
     // check if SOA already exists
     if (Record::model()->countByAttributes(array('domain_id' => $domain->id, 'type' => Record::TYPE_SOA)) == 0) {
         $recordSoa = new Record();
         $recordSoa->name = $domain->name;
         $recordSoa->type = Record::TYPE_SOA;
         $recordSoa->domain_id = $domain->id;
         $recordSoa->content = Domain::soaArrayToContent(array('name_server' => Yii::app()->params['soa_defaults']['name_server'], 'email_address' => Yii::app()->params['soa_defaults']['email_address'], 'serial_number' => '1', 'refresh_time' => Yii::app()->params['soa_defaults']['refresh_time'], 'retry_time' => Yii::app()->params['soa_defaults']['retry_time'], 'expiry_time' => Yii::app()->params['soa_defaults']['expiry_time'], 'nx_time' => Yii::app()->params['soa_defaults']['nx_time']));
         $recordSoa->ttl = Yii::app()->params['soa_defaults']['expiry_time'];
         $recordSoa->prio = 0;
         if (!$recordSoa->save()) {
             Yii::log('Cannot add SOA: ' . print_r($recordSoa->getErrors(), true), CLogger::LEVEL_ERROR);
             return false;
         }
     } else {
         Yii::log('SOA record already existing', CLogger::LEVEL_ERROR);
         return false;
     }
     return true;
 }
开发者ID:simonefalcini,项目名称:poweradmin-api,代码行数:22,代码来源:Domain.php


注:本文中的Record::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。