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


PHP DataProvider::getStudies方法代码示例

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


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

示例1: cleanCache

 /**
   @param $prefix String to help locate the $target
   Removes all entries from the CacheProvider.
 */
 public static function cleanCache($prefix = '')
 {
     foreach (DataProvider::getStudies() as $s) {
         $f = self::getPath($s, $prefix);
         if (file_exists($f)) {
             unlink($f);
         }
     }
 }
开发者ID:pombredanne,项目名称:soundcomparisons,代码行数:13,代码来源:cacheProvider.php

示例2: studies

 /**
   @return [String] of all Names in the Studies table
 */
 public static function studies()
 {
     return DataProvider::getStudies();
 }
开发者ID:pombredanne,项目名称:soundcomparisons,代码行数:7,代码来源:translationClass.php

示例3: getTableNamesFor

 /**
   @param $table TableName
   @param $target TableName | TablePrefix
   @return $tNames [TableName]
   1: If $target doesn't depend on study, its the TableName
   2: If $table depends on study, $target should get the same
   3: If $table doesn't depend, $target should be done for all studies.
 */
 public static function getTableNamesFor($table, $target)
 {
     $tNames = self::getTableNames($target, self::$constraints[$target]);
     if (count($tNames) === 1) {
         return $tNames;
     }
     //https://stackoverflow.com/questions/834303/startswith-and-endswith-functions-in-php
     $endsWith = function ($haystack, $needle) {
         if ($needle === '') {
             return true;
         }
         $t = strlen($haystack) - strlen($needle);
         if ($t < 0) {
             return false;
         }
         return strpos($haystack, $needle, $t) !== false;
     };
     //Searching possible study suffix:
     foreach (DataProvider::getStudies() as $s) {
         if ($endsWith($table, $s)) {
             //Searching the only one:
             foreach ($tNames as $t) {
                 if ($endsWith($t, $s)) {
                     return array($t);
                 }
             }
         }
     }
     return $tNames;
 }
开发者ID:pombredanne,项目名称:soundcomparisons,代码行数:38,代码来源:Integrity.php

示例4: script

<?php

/**
  It became apparent, that generating the JSON files export/download/$study.json
  can be quite expansive, and may fail on our server iff memory or time consumption grow too high.
  This is also documented in #237.
  To combat this problem this script (re-)generates all the JSON files as necessary.
*/
chdir(__DIR__);
require_once '../config.php';
require_once '../query/cacheProvider.php';
chdir('..');
echo "Regenerating Study Cache:\n";
foreach (DataProvider::getStudies() as $study) {
    if (CacheProvider::hasCache($study)) {
        continue;
    }
    echo "{$study}..\n";
    $chunk = DataProvider::getStudyChunk($study);
    CacheProvider::setCache($study, json_encode($chunk));
}
echo "Done.\n";
开发者ID:pombredanne,项目名称:soundcomparisons,代码行数:22,代码来源:regenerateCache.php

示例5:

  1.: We offer a list of studies, and also global data applying to each study.
  2.: Each study can be fetched separately.
  3.: JavaScript will tack a timestamp on each study,
      so that we can drop older studies from localStorage,
      in case that we're running out of space.
  4.: The data for each study thus consists of the following things:
      - Name and basic data for the study itself
      - A list of Families in the Study
      - A list of Regions per Family
      - A list of Languages per Region
      - A list of Words per Study
      - A list of Transcriptions per pair of Word and Language
      - Defaults for the Study
*/
if (array_key_exists('global', $_GET)) {
    echo Config::toJSON(array('studies' => DataProvider::getStudies(), 'global' => DataProvider::getGlobal()));
} else {
    if (array_key_exists('study', $_GET)) {
        if (CacheProvider::hasCache($_GET['study'])) {
            echo CacheProvider::getCache($_GET['study']);
        } else {
            $ret = DataProvider::getStudyChunk($_GET['study']);
            //Done:
            $data = json_encode($ret);
            echo $data;
            CacheProvider::setCache($_GET['study'], $data);
        }
    } else {
        echo json_encode(array('lastUpdate' => DataProvider::getLastImport(), 'Description' => 'Add a global parameter to fetch global data, ' . 'and add a study parameter to fetch a study.'));
    }
}
开发者ID:pombredanne,项目名称:soundcomparisons,代码行数:31,代码来源:data.php


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