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


PHP Sample::unsetAttributes方法代码示例

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


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

示例1: actionAdmin

 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Sample('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Echantillon'])) {
         $model->attributes = $_GET['Echantillon'];
     }
     $this->render('admin', array('model' => $model));
 }
开发者ID:nmalservet,项目名称:biocap,代码行数:13,代码来源:EchantillonController.php

示例2: actionEchManage

 /**
  * affichage du module de gestion des echantillons de la biobanque
  */
 public function actionEchManage()
 {
     if (Yii::app()->user->isAdmin()) {
         $id = $_SESSION['biobank_id'];
     } else {
         $id = Yii::app()->user->biobank_id;
     }
     $model = $this->loadModel($id);
     $model = new Sample('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Sample'])) {
         $model->attributes = $_GET['Sample'];
     }
     $this->render('echManage', array('model' => $model, 'biobank_id' => $id));
 }
开发者ID:nmalservet,项目名称:biocap,代码行数:19,代码来源:MybiobankController.php

示例3: actionSearch

 /**
  * affichage de la page de recherche des echantillons
  */
 public function actionSearch()
 {
     $model = new Sample('search');
     $model->unsetAttributes();
     $biobankId = null;
     if (isset($_GET['id']) && isset($_GET['layout']) && $_GET['layout'] == 'vitrine_layout') {
         $biobankId = $_GET['id'];
     }
     $model->biobank_id = $biobankId;
     $user = CommonTools::getConnectedUser();
     if (isset($_GET['Preferences'])) {
         $user->preferences->attributes = $_GET['Preferences'];
         $user->disableBehavior('LoggableBehavior');
         if ($user->validate(array('preferences'))) {
             $user->save(false);
         } else {
             var_dump($user->preferences->errors);
         }
     }
     if (isset($_GET['Sample'])) {
         $model->attributes = $_GET['Sample'];
         //Used to search terms in model->biobank->collection_id and model->biobank->collection_name
         $arrayOfBiobanks = array();
         if (!empty($_GET['collection_id'])) {
             $criteria = new EMongoCriteria();
             $listWords = explode(",", $_GET['collection_id']);
             $regexId = "";
             foreach ($listWords as $word) {
                 $regexId .= "{$word}|";
             }
             $regexId = substr($regexId, 0, -1);
             $criteria->addCond('collection_id', '==', new MongoRegex("/({$regexId})/i"));
             $criteria->select(array('_id'));
             $biobanks = Biobank::model()->findAll($criteria);
             foreach ($biobanks as $biobank) {
                 $arrayOfBiobanks[(string) $biobank->_id] = (string) $biobank->_id;
             }
         }
         if (!empty($_GET['collection_name'])) {
             $criteria = new EMongoCriteria();
             $listWords = explode(",", $_GET['collection_name']);
             $regexId = "";
             foreach ($listWords as $word) {
                 $regexId .= "{$word}|";
             }
             $regexId = substr($regexId, 0, -1);
             $criteria->addCond('collection_name', '==', new MongoRegex("/({$regexId})/i"));
             $criteria->select(array('_id'));
             $biobanks = Biobank::model()->findAll($criteria);
             foreach ($biobanks as $biobank) {
                 $arrayOfBiobanks[$biobank->_id] = (string) $biobank->_id;
             }
         }
         if (!empty($arrayOfBiobanks)) {
             //     $model->arrayOfBiobanks;
             $model->setArrayOfBiobanks(array_values($arrayOfBiobanks));
         }
         $content = '';
         foreach ($_GET['Sample'] as $key => $value) {
             if (is_array($value)) {
                 foreach ($value as $vkey => $vval) {
                     $content = $content . (string) $vkey . '=' . str_replace(';', ',', (string) $vval) . ';';
                 }
             } else {
                 if ($value != null && !empty($value) && (string) $value != '0') {
                     $content = $content . (string) $key . '=' . str_replace(';', ',', (string) $value) . ';';
                 }
             }
         }
         if (Yii::app()->session['SampleForm'] != $_GET['Sample']) {
             $_GET['Echantillon_page'] = null;
             $this->logAdvancedSearch($content);
         }
         Yii::app()->session['SampleForm'] = $_GET['Sample'];
     }
     //form de la recherche intelligente
     $smartForm = new SampleSmartForm();
     if (isset($_POST['SampleSmartForm'])) {
         $model->unsetAttributes();
         $smartForm->attributes = $_POST['SampleSmartForm'];
         if (Yii::app()->session['keywords'] != $smartForm->keywords) {
             $_GET['Echantillon_page'] = null;
             $this->logSmartSearch($smartForm->keywords);
         }
         Yii::app()->session['keywords'] = $smartForm->keywords;
         $model = SmartResearcherTool::search($smartForm->keywords, $biobankId);
     }
     $this->render('search_samples', array('model' => $model, 'smartForm' => $smartForm));
 }
开发者ID:nmalservet,项目名称:biocap,代码行数:92,代码来源:SiteController.php

示例4: actionSearchSample

 public function actionSearchSample()
 {
     $id = CommonTools::getBiobankInfo();
     if (Yii::app()->user->isGuest) {
         $this->redirect(array('login', 'id' => $id));
     }
     $model = new Sample('search');
     $model->unsetAttributes();
     $model->biobank_id = $id;
     $prefs = Preferences::model()->findByAttributes(array('id_user' => Yii::app()->user->id));
     if ($prefs == null) {
         $prefs = new Preferences();
         $prefs->id_user = Yii::app()->user->id;
         $prefs->save();
     }
     if (isset($_GET['Preferences'])) {
         $prefs->attributes = $_GET['Preferences'];
         $prefs->save();
     }
     if (isset($_GET['Sample'])) {
         $model->attributes = $_GET['Sample'];
         $content = '';
         foreach ($_GET['Sample'] as $key => $value) {
             if ($value != null && !empty($value) && (string) $value != '0') {
                 $content = $content . (string) $key . '=' . str_replace(';', ',', (string) $value) . ';';
             }
         }
         if (Yii::app()->session['SampleForm'] != $_GET['Sample']) {
             $_GET['Echantillon_page'] = null;
         }
         Yii::app()->session['SampleForm'] = $_GET['Sample'];
     }
     //form de la recherche intelligente
     $smartForm = new SampleSmartForm();
     if (isset($_POST['SampleSmartForm'])) {
         $model->unsetAttributes();
         $model->biobank_id = $id;
         $smartForm->attributes = $_POST['SampleSmartForm'];
         if (Yii::app()->session['keywords'] != $smartForm->keywords) {
             $_GET['Echantillon_page'] = null;
         }
         Yii::app()->session['keywords'] = $smartForm->keywords;
         $model = SmartResearcherTool::search($smartForm->keywords, $id);
     }
     $this->render('search_samples', array('model' => $model, 'smartForm' => $smartForm));
 }
开发者ID:nmalservet,项目名称:biocap,代码行数:46,代码来源:VitrineController.php

示例5: actionExportXls

 /**
  * Export des echantillons issus de la recherche en xls
  */
 public function actionExportXls()
 {
     $model = new Sample('search');
     $model->unsetAttributes();
     if (isset($_GET['Sample'])) {
         $model->attributes = $_GET['Sample'];
     }
     // reprend les critères de la dernière recherche
     $dataprovider = new EMongoDocumentDataProvider('Sample', array('criteria' => $_SESSION['criteria'], 'pagination' => array('pageSize' => CommonTools::XLS_EXPORT_NB)));
     // supprime la pagination pour exporter l'ensemble des echantillons
     //	$echantillons = $dataprovider->data;
     $data = array(1 => array_keys($model->attributeExportedLabels()));
     setlocale(LC_ALL, 'fr_FR.UTF-8');
     $nb = 0;
     foreach ($dataprovider->data as $ech) {
         $line = array();
         foreach (array_keys($model->attributeExportedLabels()) as $attribute) {
             if ($attribute != 'notes') {
                 if ($ech->{$attribute} != null && !empty($ech->{$attribute})) {
                     $line[] = trim(iconv('UTF-8', 'ASCII//TRANSLIT', $ech->{$attribute}));
                     // solution la moins pire qui ne fait pas bugge les accents mais les convertit en caractere generique
                 } else {
                     $line[] = "-";
                 }
             } else {
                 foreach ($ech->{$attribute} as $noteValue) {
                     $line[] = trim(iconv('UTF-8', 'ASCII//TRANSLIT', $noteValue->key . ' : ' . $noteValue->value));
                 }
             }
         }
         $data[] = $line;
     }
     Yii::import('application.extensions.phpexcel.JPhpExcel');
     $xls = new JPhpExcel('UTF-8', true, 'Sample list');
     $xls->addArray($data);
     $xls->generateXML('sample list');
 }
开发者ID:nmalservet,项目名称:biocap,代码行数:40,代码来源:SearchSamplesController.php


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