本文整理汇总了PHP中Dataset类的典型用法代码示例。如果您正苦于以下问题:PHP Dataset类的具体用法?PHP Dataset怎么用?PHP Dataset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Dataset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayDataset
public function displayDataset($ids)
{
$criteria = new CDbCriteria();
$criteria->addInCondition("id", $ids);
$datasets = Dataset::model()->findAll($criteria);
$this->generateFeed($datasets);
}
示例2: testInvalidDatasetDescription
public function testInvalidDatasetDescription()
{
$invalidTest = array('user_id' => 1, 'dataset_name' => 'Franklin Park Run', 'description' => 'This description is 256 characters long ' . 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna. Nunc viverra imperdiet enim. Fusce est. Vivamus a tel');
$invalidDataset = new Dataset($invalidTest);
$this->assertEquals(1, $invalidDataset->getErrorCount(), 'The Dataset object should have exactly 1 error');
$this->assertTrue(!empty($invalidDataset->getError('description')), 'The Dataset should have a description error');
}
示例3: WriteChangesToDataset
/**
* @param array $oldValues associative array (fieldNames => fieldValues) of old values
* @param array $newValues associative array (fieldNames => fieldValues) of new values
* @param IDataset|Dataset $dataset dataset where changes between old and new values must be written
*/
protected function WriteChangesToDataset($oldValues, $newValues, Dataset $dataset)
{
foreach ($newValues as $fieldName => $fieldValue) {
if ($dataset->DoNotRewriteUnchangedValues()) {
if (!isset($oldValues[$fieldName]) || $oldValues[$fieldName] != $fieldValue) {
$dataset->SetFieldValueByName($fieldName, $fieldValue);
}
} else {
$dataset->SetFieldValueByName($fieldName, $fieldValue);
}
}
}
示例4: initDays
/**
* Init all days for beeing displayed
*/
protected function initDays()
{
$this->initShortModes();
$this->initEmptyDays();
$WhereNotPrivate = FrontendShared::$IS_SHOWN && !Configuration::Privacy()->showPrivateActivitiesInList() ? 'AND is_public=1' : '';
$AllTrainings = $this->DB->query('
SELECT
id,
time,
`s` as `s_sum_with_distance`,
DATE(FROM_UNIXTIME(time)) as `date`
' . $this->Dataset->getQuerySelectForAllDatasets() . '
FROM `' . PREFIX . 'training`
WHERE `time` BETWEEN ' . ($this->timestamp_start - 10) . ' AND ' . ($this->timestamp_end - 10) . '
AND accountid = ' . SessionAccountHandler::getId() . '
' . $WhereNotPrivate . '
ORDER BY `time` ASC
')->fetchAll();
foreach ($AllTrainings as $Training) {
$w = Time::diffInDays($Training['time'], $this->timestamp_start);
if (in_array($Training['sportid'], $this->sports_short) || in_array($Training['typeid'], $this->types_short)) {
$this->days[$w]['shorts'][] = $Training;
} else {
$this->days[$w]['trainings'][] = $Training;
}
}
}
示例5: actionNotification
public function actionNotification(){
$this->lastdataset=Yii::app()->basePath."/scripts/data/lastdataset.txt";
$filecontent= $this->readFile();
$temp = json_decode($filecontent,true);
$lastdataset=isset($temp['lastdataset'])?$temp['lastdataset']:0;
$lastTimeRun=isset($temp['lastTimeRun'])?$temp['lastTimeRun']:0;
$now=microtime(true);
$lastestDataset = Dataset::model()->find("id=(SELECT MAX(id) FROM dataset)");
if(($lastestDataset->id-$lastdataset > $this->numberOfNewDataset) || ( ($now-$lastTimeRun)>$this->timeWaitPeriod ) && $lastestDataset->id-$lastdataset >0){
$newDatasets = Dataset::model()->findAll("id>?",array($lastdataset));
$content= $this->generateEmail($newDatasets);
$this->sendBroadcastEmail($this->emailSubject,$content);
// Store Information for next time
$temp['lastdataset'] = $lastestDataset->id;
$temp['lastTimeRun'] = floor($now);
$this->writeFile(json_encode($temp));
}else {
echo "Don't have enough dataset";
}
}
示例6: dataset
public function dataset($config)
{
/**
* $config['other_infos'] ==> contine date suplimentare
**/
return Dataset::response($config);
}
示例7: sendNotificationEmail
private function sendNotificationEmail($list,$user,$criteria){
$app_email_name = Yii::app()->params['app_email_name'];
$app_email = Yii::app()->params['app_email'];
$email_prefix = Yii::app()->params['email_prefix'];
$headers = "From: $app_email_name <$app_email>\r\n"; //optional header fields
$headers .= "Content-type: text/html\r\n";
ini_set('sendmail_from', $app_email);
$listurl="";
foreach ($list as $key => $value) {
$model = Dataset::model()->findByPk($value);
$url = Yii::app()->params['home_url']."/dataset/".$model->identifier;
$author_list = '';
if (count($model->authors) > 0) {
$i = 0;
foreach( $model->authors as $key => $author){
if (++$i < count($model->authors)) $author_list .= $author->name.';'; else $author_list .= $author->name.' ';
}
}
$listurl .= <<<EO_LU
<span style='font-weight:bold;'>{$model->title}</span><br>
{$author_list}<br>
<a href='{$url}'>{$url}</a><br><br>
EO_LU;
}
$recipient = Yii::app()->params['notify_email'];
$subject = "GigaDB has new content which matches your interest";
$body = CController::renderInternal(Yii::app()->basePath.'/views/search/emailMatchedSearches.php',array('listurl'=>$listurl,'criteria'=>$criteria),true);
mail($user->email, $subject, $body, $headers);
Yii::log(__FUNCTION__."> Sent email to $recipient, $subject");
}
示例8: testComplexCase
public function testComplexCase()
{
$r = new LinearRegression(Dataset::fromArray([0.5, 1, 4, -1]));
$this->assertSame(-0.15, $r->slope());
$this->assertSame(1.35, $r->intercept());
$this->assertSame(0.0, $r(9));
}
示例9: getFullDatasetResultByKeyword
private function getFullDatasetResultByKeyword($keyword)
{
$wordCriteria = array();
$wordCriteria['keyword'] = $keyword;
$list_result_dataset_criteria = $this->searchDataset($wordCriteria);
$temp_dataset_criteria = new CDbCriteria();
$temp_dataset_criteria->addInCondition("id", $list_result_dataset_criteria);
return Dataset::model()->findAll($temp_dataset_criteria);
}
示例10: getDatasetsArray
public static function getDatasetsArray($rows)
{
$datasets = array();
if (!empty($rows)) {
// Convert the array of arrays into an array of Datasets
// and set the id and date_created fields
foreach ($rows as $datasetRow) {
$dataset = new Dataset($datasetRow);
$datasetId = $datasetRow['dataset_id'];
$dataset->setDatasetId($datasetId);
$datasetDateCreated = $datasetRow['date_created'];
$dataset->setDateCreated($datasetDateCreated);
// TODO: We should also get the dataset's associated sensors
// Coordinate this in the controller
array_push($datasets, $dataset);
}
}
return $datasets;
}
示例11: displayTrainingRows
/**
* Display all training rows
*/
private function displayTrainingRows()
{
foreach ($this->Trainings as $training) {
$date = date("d.m.Y", $training['time']);
$link = Ajax::trainingLink($training['id'], $date, true);
echo '<tr class="r">';
echo '<td class="l"><small>' . $link . '</small></td>';
$this->Dataset->setActivityData($training);
$this->Dataset->displayTableColumns();
echo '</tr>';
}
}
示例12: createLog
public function createLog($dataset_id, $message)
{
#only save the log when dataset is public
$dataset = Dataset::model()->findByPk($dataset_id);
if ($dataset->IsPublic) {
$log = new DatasetLog();
$log->dataset_id = $dataset_id;
$log->message = $message;
$log->model = $this->Owner->tableName();
$log->model_id = $this->Owner->id;
$log->save(false);
}
}
示例13: FormatDatasetFieldsTemplate
public static function FormatDatasetFieldsTemplate(Dataset $dataset, $template, IDelegate $processValue = null)
{
$result = $template;
foreach ($dataset->GetFields() as $field) {
if ($dataset->IsLookupField($field->GetNameInDataset())) {
$result = StringUtils::ReplaceVariableInTemplate($result, $field->GetAlias(), $processValue == null ? $dataset->GetFieldValueByName($field->GetAlias()) : $processValue->Call($dataset->GetFieldValueByName($field->GetAlias()), $field->GetAlias()));
} else {
$result = StringUtils::ReplaceVariableInTemplate($result, $field->GetName(), $processValue == null ? $dataset->GetFieldValueByName($field->GetNameInDataset()) : $processValue->Call($dataset->GetFieldValueByName($field->GetNameInDataset()), $field->GetNameInDataset()));
}
}
return $result;
}
示例14: get
public function get($id)
{
$this->queryDataset->bindValue(':id', intval($id), PDO::PARAM_INT);
$this->queryDataset->execute();
$datasets = $this->queryDataset->fetchAll(PDO::FETCH_ASSOC);
$numDatasets = count($datasets);
$this->queryDataset->closeCursor();
if ($numDatasets < 1) {
throw new Exception(self::$EXCEPTION_NO_DATASET);
} else {
if ($numDatasets > 1) {
throw new Exception(self::$EXCEPTION_MULT_DATASETS);
} else {
$dataset = $datasets[0];
$dataset['iml'] = $this->_dbStringToArray($dataset['iml']);
return Dataset::fromArray($dataset);
}
}
}
示例15: actionIndex
public function actionIndex()
{
$limit = 10;
$offset = 0;
while (true) {
$datasets = Dataset::model()->findAll(array("order" => "identifier ASC", "limit" => $limit, "offset" => $offset));
if (!$datasets) {
break;
}
foreach ($datasets as $dataset) {
$cite = $dataset->cited;
$dataset->citation = $cite['total'];
$dataset->save();
}
if (count($datasets) < $limit) {
break;
}
$offset = $offset + $limit;
}
}