/** * 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 } }
public function __construct() { $this->softwareComponent = SoftwareComponent::find('mediasearchcomponent'); }
/** * 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); }
/** * Create a TextSentencePreprocessor instance. */ public function __construct() { $this->softwareComponent = SoftwareComponent::find('textsentencepreprocessor'); }
public function __construct() { $this->softwareComponent = SoftwareComponent::find('fileuploader'); }