コード例 #1
0
 /**
  * Creates a new software component, if it does not already exist in the SoftwareComponents 
  * Collection.
  * 
  * @param $name Name of the software component to be created
  * @param $label Label providing once sentence description of the component 
  * @param $creator a function which configures any component specific settings. 
  */
 private function createIfNotExist($name, $label, $creator)
 {
     $sc = SoftwareComponent::find($name);
     if (is_null($sc)) {
         $this->command->info('...Initializing: ' . $name);
         $component = new SoftwareComponent($name, $label);
         // Create generic component
         $creator($component);
         // Customize anything specific for this component
         $component->save();
         // And save the component
     }
 }
コード例 #2
0
ファイル: InitialSeeder.php プロジェクト: harixxy/CrowdTruth
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     // Initialize text sentence preprocessor component
     $id = 'textsentencepreprocessor';
     $label = 'This component is used for transforming text files';
     $txtPreprocessor = new SoftwareComponent($id, $label);
     $txtPreprocessor['domains'] = [];
     $txtPreprocessor['configurations'] = [];
     $txtPreprocessor->save();
     // Initialize file uploader component
     $id = 'fileuploader';
     $label = 'This component is used for storing files as documents within MongoDB';
     $txtPreprocessor = new SoftwareComponent($id, $label);
     $txtPreprocessor['domains'] = [];
     $txtPreprocessor->save();
     // Initialize media search component
     $id = 'mediasearchcomponent';
     $label = 'This component is used for searching media in MongoDB';
     $txtPreprocessor = new SoftwareComponent($id, $label);
     $txtPreprocessor['keys'] = [];
     $txtPreprocessor->save();
 }
コード例 #3
0
 public function __construct()
 {
     $this->softwareComponent = SoftwareComponent::find('mediasearchcomponent');
 }
コード例 #4
0
 /**
  * Create a TextSentencePreprocessor instance.
  */
 public function __construct()
 {
     $this->softwareComponent = SoftwareComponent::find('textsentencepreprocessor');
 }
コード例 #5
0
 /**
  * Load data for the Media Upload View and return the view ready to be sent 
  * back to the user.
  */
 private function loadMediaUploadView()
 {
     // Load properties from file uploader software component.
     // TODO: replace for $data = new FileUploader ?
     $data = SoftwareComponent::find("fileuploader");
     $dbDomains = $data->domains;
     $domains = [];
     $names = [];
     $fileTypes = [];
     $doctypes = [];
     foreach ($dbDomains as $domainKey => $domain) {
         // $domainKey = $domain['key'];
         array_push($domains, $domainKey);
         $names[$domainKey] = $domain['name'];
         $fileTypeList = '';
         foreach ($domain['file_formats'] as $fileType) {
             $fileTypeList = $fileTypeList . ' ' . $fileType;
         }
         $fileTypes[$domainKey] = $fileTypeList;
         $doctypes[$domainKey] = $domain['document_types'];
     }
     $userprojects = ProjectHandler::getUserProjects(Auth::user());
     $userprojects = array_column($userprojects, 'name');
     return View::make('media.pages.upload')->with('domains', $domains)->with('names', $names)->with('fileTypes', $fileTypes)->with('doctypes', $doctypes)->with('projects', $userprojects);
 }
コード例 #6
0
ファイル: FileUploader.php プロジェクト: harixxy/CrowdTruth
 public function __construct()
 {
     $this->softwareComponent = SoftwareComponent::find('fileuploader');
 }