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


PHP Sample类代码示例

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


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

示例1: is_access

 /**
  * @see SampleSecurityInterface::is_access()
  * @param integer $intention 1 = Read, 2 = Write
  * @param bool $ignore_admin_status
  * @return bool
  */
 public function is_access($intention, $ignore_admin_status = false)
 {
     global $user;
     if ($this->sample_id) {
         if ($user->is_admin() and $ignore_admin_status == false) {
             return true;
         } else {
             $sample = new Sample($this->sample_id);
             $sample_folder_id = SampleFolder::get_folder_by_sample_id($this->sample_id);
             $sample_folder_data_entity = new DataEntity(Folder::get_data_entity_id_by_folder_id($sample_folder_id));
             if ($sample->get_owner_id() == $user->get_user_id()) {
                 return true;
             } else {
                 $pk = SampleHasUser_Access::get_entry_by_sample_id_and_user_id($this->sample_id, $user->get_user_id());
                 $sample_has_user = new SampleHasUser_Access($pk);
                 if ($intention == 1) {
                     if ($sample_has_user->get_read() == true) {
                         return true;
                     } else {
                         $organisation_unit_array = OrganisationUnit::list_entries_by_user_id($user->get_user_id());
                         if (is_array($organisation_unit_array) and count($organisation_unit_array) >= 1) {
                             foreach ($organisation_unit_array as $key => $value) {
                                 $pk = SampleHasOrganisationUnit_Access::get_entry_by_sample_id_and_organisation_unit_id($this->sample_id, $value);
                                 if (is_numeric($pk)) {
                                     return true;
                                 }
                             }
                         }
                         /*
                         	    					$parent_virtual_folder_array = $sample_folder_data_entity->get_parent_virtual_folder_ids();
                         	    					
                         	    					if (is_array($parent_virtual_folder_array) and count($parent_virtual_folder_array) >= 1)
                         	    					{
                         	    						foreach($parent_virtual_folder_array as $key => $value)
                         	    						{
                         	    							$virtual_folder = new VirtualFolder($value);
                         	    							$parent_folder_id = $virtual_folder->get_parent_folder_id();
                         	    							$folder = Folder::get_instance($parent_folder_id);
                         	    							if ($folder->is_read_access() == true)
                         	    							{
                         	    								return true;
                         	    							}
                         	    						}
                         	    					} */
                         return false;
                     }
                 } else {
                     if ($sample_has_user->get_write() == true) {
                         return true;
                     } else {
                         return false;
                     }
                 }
             }
         }
     } else {
         return null;
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:65,代码来源:sample_security.class.php

示例2: getSavesample

 public function getSavesample()
 {
     // DB::table('sample')->insert(array('name'=>"jeth"));
     $sample = new Sample();
     $sample->name = "jimbo";
     $sample->save();
     return "inserted";
 }
开发者ID:centaurustech,项目名称:sagip,代码行数:8,代码来源:PostController.php

示例3: insert

 public function insert(Sample $sample)
 {
     if ($this->length) {
         $sample->setDiff($this->samples[$this->length - 1]);
     }
     $this->samples[] = $sample;
     $this->length++;
 }
开发者ID:pingers,项目名称:drupalreleasedate,代码行数:8,代码来源:SampleSet.php

示例4: testSayHello

 public function testSayHello()
 {
     $sample = new Sample();
     $name = 'Chris';
     $replace = 'Goodbye, Chris!';
     SomeclassMock::expects($name, $replace);
     $this->assertEquals("Goodbye, Chris!", $sample->sayHello($name));
     SomeclassMock::cleanup();
 }
开发者ID:pkdevboxy,项目名称:zumba.github.com,代码行数:9,代码来源:sample_test.php

示例5: __construct

 public function __construct()
 {
     $sample = new Sample('id', 'name');
     $id = $sample->getId();
     if ($id = 'id') {
         echo 'if';
     } else {
         echo 'else';
     }
 }
开发者ID:gonpingy,项目名称:php,代码行数:10,代码来源:PhpDcd.php

示例6: testNewArrayIsEmpty

  public function testNewArrayIsEmpty()
  {
    // 配列を作成します。
    $fixture = array();

    // 配列のサイズは 0 です。
    $this->assertEquals(0, sizeof($fixture));

    $hoge = new Sample();
    $user = $hoge->first_user();
    $this->assertEquals(1, $user["id"]);
  }
开发者ID:rawhide,项目名称:phpframework,代码行数:12,代码来源:SampleTest.php

示例7: nameOfIdShouldBe

 /**
  * @Then name of id :arg1 should be :arg2
  */
 public function nameOfIdShouldBe($arg1, $arg2)
 {
     $data = new Sample();
     $rows = $data->get_name($arg1);
     //      print_r( $rows);
     if (sizeof($rows) != 1) {
         throw new Exception("Name is not present.\n");
     } else {
         if ($rows[0]['name'] != $arg2) {
             throw new Exception("Name did not match.\n");
         }
     }
 }
开发者ID:sabsen-kol-alone,项目名称:vz-hackathon,代码行数:16,代码来源:MyContext.php

示例8: postStore

 public function postStore()
 {
     $postData = Input::all();
     $rules = array('userName' => 'required|min:5', 'userEmail' => 'required|email', 'userMobile' => 'required|min:10|numeric', 'userAddress1' => 'required', 'userAddress2' => 'required', 'userPincode' => 'required|min:6|numeric', 'userCity' => 'required', 'userState' => 'required', 'userId' => 'required|alphanum');
     $validator = Validator::make($postData, $rules);
     if ($validator->fails()) {
         return Redirect::to('admin/profile')->withInput()->withErrors($validator);
     } else {
         if (Input::has('userKey')) {
             $rulespass = array('userKey' => 'required|min:6|alphanum', 'cpass' => 'required|min:6|same:userKey');
             $validator1 = Validator::make($postData, $rulespass);
             if ($validator1->fails()) {
                 return Redirect::to('admin/profile')->withInput()->withErrors($validator1);
             } else {
                 $input = json_encode(Input::except('_token', 'cpass'));
                 $update = Sample::update($input);
                 //print_r($update);exit;
                 if ($update && $update->status == "success") {
                     return Redirect::to('admin/profile')->with('success', $update->message);
                 } else {
                     return Redirect::to('admin/profile')->with('failure', "something went wrong");
                 }
             }
         } else {
             $input = json_encode(Input::except('_token', 'userKey', 'cpass'));
             $update = Sample::update($input);
             //print_r($update);exit;
             if ($update && $update->status == "success") {
                 return Redirect::to('admin/profile')->with('success', $update->message);
             } else {
                 return Redirect::to('admin/profile')->with('failure', "something went wrong");
             }
         }
     }
 }
开发者ID:arctic-dev,项目名称:appandukan-php,代码行数:35,代码来源:AdminController.php

示例9: getProfile

 public static function getProfile()
 {
     $userdata = Sample::user(Session::get('user_id'));
     if ($userdata && $userdata->status == "success") {
         //return View::make('superadmin.editview')->with('userdata',$userdata);
     } else {
         return View::make('superadmin.service');
     }
 }
开发者ID:arctic-dev,项目名称:appandukan-php,代码行数:9,代码来源:SuperAdminController.php

示例10: renderSample

 private function renderSample(MetricFamilySamples $metric, Sample $sample)
 {
     $escapedLabels = array();
     $labelNames = $metric->getLabelNames();
     if ($metric->hasLabelNames() || $sample->hasLabelNames()) {
         $labels = array_combine(array_merge($labelNames, $sample->getLabelNames()), $sample->getLabelValues());
         foreach ($labels as $labelName => $labelValue) {
             $escapedLabels[] = $labelName . '="' . $this->escapeLabelValue($labelValue) . '"';
         }
         return $sample->getName() . '{' . implode(',', $escapedLabels) . '} ' . $sample->getValue();
     }
     return $sample->getName() . ' ' . $sample->getValue();
 }
开发者ID:jimdo,项目名称:prometheus_client_php,代码行数:13,代码来源:RenderTextFormat.php

示例11: postCreate

 public function postCreate()
 {
     $input = json_encode(Input::except('_token'));
     //print_r($input); exit;
     $op = Sample::creditdebit($input);
     $output = json_decode($op);
     if (isset($output->status)) {
         if ($output->status == 'failure') {
             return Redirect::to('admin/creditdebit/add')->with('failure', $output->message);
         } else {
             return Redirect::to('admin/creditdebit')->with('sucess', $output->message);
         }
     } else {
         return Redirect::to('admin/creditdebit/add')->with('failure', 'sorry., Please try again later');
     }
 }
开发者ID:arctic-dev,项目名称:appandukan-php,代码行数:16,代码来源:AdmincreditdebitController.php

示例12: run

 public function run()
 {
     /*$faker = Faker::create();
     
     		foreach(range(1, 10) as $index)
     		{
     			Sample::create([
     
     			]);
     		}*/
     Sample::create(['code' => '158-52C-A', 'stock' => 5]);
     Sample::create(['code' => '158-52C-B', 'stock' => 5]);
     Sample::create(['code' => '158-52C-C', 'stock' => 5]);
     Sample::create(['code' => '158-52C-D', 'stock' => 5]);
     Sample::create(['code' => '158-52C-E', 'stock' => 5]);
 }
开发者ID:yanguanglan,项目名称:sz,代码行数:16,代码来源:SamplesTableSeeder.php

示例13: run

 public function run()
 {
     echo 'Massive Run for samples';
     $biobanks = Biobank::model()->findAll();
     foreach ($biobanks as $biobank) {
         $modifier = new EMongoModifier();
         $modifier->addModifier('biobank_id', 'set', (string) $biobank->_id);
         $criteria = new EMongoCriteria();
         $criteria->biobank_id = $biobank->id;
         $status = Sample::model()->updateAll($modifier, $criteria);
         $criteriaAfter = new EMongoCriteria();
         $criteriaAfter->biobank_id = (string) $biobank->_id;
         $count = Sample::model()->count($criteriaAfter);
         echo "Done for biobank {$biobank->_id} - {$biobank->name} : {$count}\n";
     }
 }
开发者ID:nmalservet,项目名称:biocap,代码行数:16,代码来源:changeIdSampleCommand.php

示例14: getRetailerprod

 public static function getRetailerprod($admin)
 {
     $userdata = Sample::category($admin);
     //$userdata=json_decode($senddata);
     //print_r($userdata);exit;
     $category = $userdata->categories;
     $products = $userdata->products;
     foreach ($category as $categories) {
         echo "<li class='parent-list'><input type='checkbox' name=''  class='canine parent' />" . $categories->fullName . " <i class='fa fa-arrow-down'></i><ul>";
         foreach ($products as $product) {
             if ($product->catgCode == $categories->catgCode) {
                 echo "<li><input type='checkbox' name='prodCode[]' class='canine' id='' value='" . $product->prodCode . "'/>" . $product->fullName . "</li>";
             }
         }
         echo "</ul></li>";
     }
 }
开发者ID:arctic-dev,项目名称:appandukan-php,代码行数:17,代码来源:FranchisedashboardController.php

示例15: actionDelete

 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     $model = $this->loadModel($id);
     $name = $model->name;
     $sampleCount = Sample::model()->countByAttributes(array('biobank_id' => (string) $model->id));
     $adminCount = User::model()->countByAttributes(array('biobank_id' => (string) $model->_id));
     if ($adminCount == 0 && $sampleCount == 0) {
         try {
             $model->delete();
             Yii::app()->user->setFlash('success', 'La biobanque a bien été supprimée.');
         } catch (Exception $ex) {
             Yii::app()->user->setFlash('error', 'La biobanque n\'a pas pu être supprimée : ' . $ex->getMessage());
         }
     } else {
         $message = "Suppression de la biobanque \"{$name}\" impossible : ";
         if ($adminCount > 0) {
             $message .= "<br> - Il reste {$adminCount} administrateur(s) lié(s) à la biobanque.";
         }
         if ($sampleCount > 0) {
             $message .= "<br> reste {$sampleCount} échantillon(s) lié(s) à la biobanque.";
         }
         Yii::app()->user->setFlash('error', $message);
     }
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax'])) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
     } else {
         $flashMessages = Yii::app()->user->getFlashes();
         $flashMessagesHtml = '';
         if ($flashMessages) {
             foreach ($flashMessages as $key => $message) {
                 $flashMessagesHtml .= '<br><div class="flash-' . $key . '">' . $message . "</div>";
             }
         }
         echo $flashMessagesHtml;
     }
 }
开发者ID:nmalservet,项目名称:biocap,代码行数:42,代码来源:BiobankController.php


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