本文整理汇总了PHP中Sample类的典型用法代码示例。如果您正苦于以下问题:PHP Sample类的具体用法?PHP Sample怎么用?PHP Sample使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Sample类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Copyright
<?php
/*------------------------------------------------------------------------
# com_citruscart
# ------------------------------------------------------------------------
# author Citruscart Team - Citruscart http://www.citruscart.com
# copyright Copyright (C) 2014 Citruscart.com All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://citruscart.com
# Technical Support: Forum - http://citruscart.com/forum/index.html
# Fork of Tienda
# @license GNU/GPL Based on Tienda by Dioscouri Design http://www.dioscouri.com.
-------------------------------------------------------------------------*/
/** ensure this file is being included by a parent file */
defined('_JEXEC') or die('Restricted access');
Sample::load('SampleTable', 'tables._base');
class SampleTableConfig extends SampleTable
{
function SampleTableConfig(&$db)
{
$tbl_key = 'config_name';
$tbl_suffix = 'config';
$this->set('_suffix', $tbl_suffix);
$name = "sample";
parent::__construct("#__{$name}_{$tbl_suffix}", $tbl_key, $db);
}
function store($updateNulls = true)
{
$k = 'config_id';
if (intval($this->{$k}) > 0) {
$ret = $this->_db->updateObject($this->_tbl, $this, $this->_tbl_key);
开发者ID:joomlacorner,项目名称:citruscart,代码行数:31,代码来源:config.php
示例17: testBehaviorSaveCallbacks
/**
* testBehaviorSaveCallbacks method
*
* @access public
* @return void
*/
function testBehaviorSaveCallbacks()
{
$Sample = new Sample();
$record = array('Sample' => array('apple_id' => 6, 'name' => 'sample99'));
$Sample->Behaviors->attach('Test', array('beforeSave' => 'on'));
$Sample->create();
$this->assertIdentical($Sample->save($record), false);
$Sample->Behaviors->attach('Test', array('beforeSave' => 'off'));
$Sample->create();
$this->assertIdentical($Sample->save($record), $record);
$Sample->Behaviors->attach('Test', array('beforeSave' => 'test'));
$Sample->create();
$this->assertIdentical($Sample->save($record), $record);
$Sample->Behaviors->attach('Test', array('beforeSave' => 'modify'));
$expected = Set::insert($record, 'Sample.name', 'sample99 modified before');
$Sample->create();
$this->assertIdentical($Sample->save($record), $expected);
$Sample->Behaviors->disable('Test');
$this->assertIdentical($Sample->save($record), $record);
$Sample->Behaviors->attach('Test', array('beforeSave' => 'off', 'afterSave' => 'on'));
$expected = Set::merge($record, array('Sample' => array('aftersave' => 'modified after on create')));
$Sample->create();
$this->assertIdentical($Sample->save($record), $expected);
$Sample->Behaviors->attach('Test', array('beforeSave' => 'modify', 'afterSave' => 'modify'));
$expected = Set::merge($record, array('Sample' => array('name' => 'sample99 modified before modified after on create')));
$Sample->create();
$this->assertIdentical($Sample->save($record), $expected);
$Sample->Behaviors->attach('Test', array('beforeSave' => 'off', 'afterSave' => 'test'));
$Sample->create();
$this->assertIdentical($Sample->save($record), $record);
$Sample->Behaviors->attach('Test', array('afterSave' => 'test2'));
$Sample->create();
$this->assertIdentical($Sample->save($record), $record);
$Sample->Behaviors->attach('Test', array('beforeFind' => 'off', 'afterFind' => 'off'));
$Sample->recursive = -1;
$record2 = $Sample->read(null, 1);
$Sample->Behaviors->attach('Test', array('afterSave' => 'on'));
$expected = Set::merge($record2, array('Sample' => array('aftersave' => 'modified after')));
$Sample->create();
$this->assertIdentical($Sample->save($record2), $expected);
$Sample->Behaviors->attach('Test', array('afterSave' => 'modify'));
$expected = Set::merge($record2, array('Sample' => array('name' => 'sample1 modified after')));
$Sample->create();
$this->assertIdentical($Sample->save($record2), $expected);
}
开发者ID:evrard,项目名称:cakephp2x,代码行数:51,代码来源:model_behavior.test.php
示例18: Sample
}
#logo {
width: 268px;
height: 55px;
}
</style>
</head>
<body>
<div id="container">
<img src="reinvent.png" id="logo" alt="AWS re:Invent">
<h1>Application Lifecycle Management Bootcamp</h1>
<p>
<?php
require_once 'src/Sample.php';
$obj = new Sample();
echo $obj->helloWorld();
?>
</p>
<?php
$instance_id = file_get_contents("http://169.254.169.254/latest/meta-data/instance-id");
$local_ipv4 = file_get_contents("http://169.254.169.254/latest/meta-data/local-ipv4");
$instance_type = file_get_contents("http://169.254.169.254/latest/meta-data/instance-type");
$article = "a";
switch (substr($instance_type, 0, 1)) {
case "m":
case "r":
case "i":
case "h":
$article = "an";
break;
开发者ID:fmrahman,项目名称:sample,代码行数:31,代码来源:index.php
示例19: loadEchModel
public function loadEchModel($id)
{
$model = Sample::model()->findByPk(new MongoID($id));
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
开发者ID:nmalservet,项目名称:biocap,代码行数:8,代码来源:MybiobankController.php
示例20: testHelloWorld
public function testHelloWorld()
{
$obj = new Sample();
$this->assertTrue($obj->helloWorld() == "Hello! Je m'eclate encore plus...");
}
开发者ID:bhardouindeleuze,项目名称:sample,代码行数:5,代码来源:SampleTest.php
注:本文中的Sample类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论