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


PHP Dataset::validate方法代码示例

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


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

示例1: storeDataset

 public function storeDataset()
 {
     if (isset($_SESSION['dataset']) && isset($_SESSION['images'])) {
         $dataset = new Dataset();
         $dataset->image = new Images();
         $result = Dataset::model()->findAllBySql("select identifier from dataset order by identifier desc limit 1;");
         $max_doi = $result[0]->identifier;
         $identifier = $max_doi + 1;
         $dataset_id = 0;
         $dataset->attributes = $_SESSION['dataset'];
         $dataset->image->attributes = $_SESSION['images'];
         $dataset->identifier = $identifier;
         $dataset->dataset_size = 0;
         $dataset->ftp_site = "";
         if ($dataset->publication_date == "") {
             $dataset->publication_date = null;
         }
         if ($dataset->modification_date == "") {
             $dataset->modification_date = null;
         }
         if ($dataset->image->validate('update') && $dataset->validate('update') && $dataset->image->save()) {
             // save image
             $dataset->image_id = $dataset->image->id;
             if ($dataset->save()) {
                 $dataset_id = $dataset->id;
                 // link datatypes
                 if (isset($_SESSION['datasettypes'])) {
                     $datasettypes = $_SESSION['datasettypes'];
                     foreach ($datasettypes as $id => $datasettype) {
                         $newDatasetTypeRelationship = new DatasetType();
                         $newDatasetTypeRelationship->dataset_id = $dataset->id;
                         $newDatasetTypeRelationship->type_id = $id;
                         $newDatasetTypeRelationship->save();
                     }
                 }
             }
         }
         return array($dataset_id, $identifier);
     }
 }
开发者ID:jessesiu,项目名称:GigaDBV3,代码行数:40,代码来源:AdminSampleController.php

示例2: actionCreate

 public function actionCreate()
 {
     $dataset = new Dataset();
     $dataset->image = new Images();
     if (isset($_POST['Dataset']) && isset($_POST['Images'])) {
         $dataset->attributes = $_POST['Dataset'];
         $dataset->image->attributes = $_POST['Images'];
         if ($dataset->publication_date == "") {
             $dataset->publication_date = null;
         }
         if ($dataset->modification_date == "") {
             $dataset->modification_date = null;
         }
         if ($dataset->image->validate('update') && $dataset->validate('update') && $dataset->image->save()) {
             // save image
             $dataset->image_id = $dataset->image->id;
             // save dataset
             if ($dataset->save()) {
                 // link datatypes
                 if (isset($_POST['datasettypes'])) {
                     $datasettypes = $_POST['datasettypes'];
                     foreach ($datasettypes as $id => $datasettype) {
                         $newDatasetTypeRelationship = new DatasetType();
                         $newDatasetTypeRelationship->dataset_id = $dataset->id;
                         $newDatasetTypeRelationship->type_id = $id;
                         $newDatasetTypeRelationship->save();
                     }
                 }
                 Yii::app()->user->setFlash('saveSuccess', 'saveSuccess');
                 if ($dataset->upload_status == 'Pending') {
                     $this->redirect('/dataset/private/identifier/' . $dataset->identifier);
                 } else {
                     $this->redirect(array('/dataset/' . $dataset->identifier));
                 }
             }
         }
     }
     $this->render('create', array('model' => $dataset));
 }
开发者ID:jessesiu,项目名称:GigaDBV3,代码行数:39,代码来源:DatasetController.php


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