This action generates the objects from the SQL query and creates a new SELECT instance.

@param string $instances
@param string $selfedit
490132
public function export($instances, $selfedit="false") {
		if ($selfedit == "true") {
			$moufManager = MoufManager::getMoufManager();
		} else {
			$moufManager = MoufManager::getMoufManagerHiddenInstance();
		}
		
		$instancesList = explode("\n", $instances);
		$cleaninstancesList = array();
		foreach ($instancesList as $instance) {
			$instance = trim($instance, "\r ");
			if (!empty($instance)) {
				$cleaninstancesList[] = $instance;
			}
		}

		$exportService = new ExportService();
		$this->generatedCode = $exportService->export($cleaninstancesList, $moufManager);
	}
308038
public function get_instance_context(int $instanceid = 0) : \context {
        if ($instanceid > 0) {
            return \context_course::instance($instanceid);
        } else {
            return \context_system::instance();
        }
    }
14250
public function install($selfedit = 'false', $task = null) {
		$this->selfedit = $selfedit;
		$this->installService = new ComposerInstaller($selfedit == 'true');
		
		if ($task !== null) {
			$taskArray = unserialize($task);
		} else {
			$taskArray = null;
		}
		
		if ($taskArray == null) {
			$this->installService->installAll();
		} else {
			$this->installService->install($taskArray);
		}
		// The call to install or installAll redirects to printInstallationScreen.
	}
898329
public void setInstanceIdSet(java.util.Collection<String> instanceIdSet) {
        if (instanceIdSet == null) {
            this.instanceIdSet = null;
            return;
        }

        this.instanceIdSet = new com.amazonaws.internal.SdkInternalList<String>(instanceIdSet);
    }
1173656
public function defaultAction($selfedit = 'false')
    {
        $this->selfedit = $selfedit;

        if ($selfedit == 'true') {
            $this->moufManager = MoufManager::getMoufManager();
        } else {
            $this->moufManager = MoufManager::getMoufManagerHiddenInstance();
        }

        $this->content->addFile(__DIR__.'/../../../../../views/admin/installStep1.php', $this);
        $this->template->toHtml();
    }
1024949
protected function addTranslationLanguageFromService($selfEdit, $msgInstanceName, $language) {
		$finePhpArrayTranslationService = new InstanceProxy($msgInstanceName, $selfEdit);
		$finePhpArrayTranslationService->createLanguageFile($language);
	}
177003
public function instance($abstract, $instance)
    {
        $abstract = $this->normalize($abstract);
        if (is_array($abstract)) {
            list($abstract, $alias) = $this->extractAlias($abstract);
            $this->alias($abstract, $alias);
        }
        unset($this->aliases[$abstract]);
        $bound = $this->bound($abstract);

        $this->instances[$abstract] = $instance;
        if ($bound) {
            $this->rebound($abstract);
        }
    }
717691
public function printInstallationScreen($selfedit = 'false') {
		$this->selfedit = $selfedit;
		$this->installService = new ComposerInstaller($selfedit == 'true');
		$this->installs = $this->installService->getInstallTasks();
		
		$this->contentBlock->addFile(dirname(__FILE__)."/../../views/installer/processing.php", $this);
		$this->template->toHtml();
	}
450936
public function createInstanceByCode($selfedit = "false", $instanceName=null) {
        if (!$instanceName) {
            $this->newInstanceByCallback();
            return;
        }

        $this->selfedit = $selfedit;

        if ($selfedit == "true") {
            $this->moufManager = MoufManager::getMoufManager();
        } else {
            $this->moufManager = MoufManager::getMoufManagerHiddenInstance();
        }

        $this->moufManager->createInstanceByCode()->setName($instanceName);
        $this->moufManager->rewriteMouf();
        header("Location: ".MOUF_URL."ajaxinstance/?name=".urlencode($instanceName)."&selfedit=".$selfedit);
    }
751178
public function view($selfedit = "false") {
		// First, let's find the list of depending packages.
		$this->selfedit = $selfedit;
		if ($selfedit == "true") {
			$this->moufManager = MoufManager::getMoufManager();
			$this->rootPath = ROOT_PATH;
		} else {
			$this->moufManager = MoufManager::getMoufManagerHiddenInstance();
			$this->rootPath = ROOT_PATH.'../../../';
		}

		$composerService = new ComposerService($this->selfedit == "true");
		
		$this->packageList = $composerService->getLocalPackages();
		
		$redirect_uri = $_SERVER['REDIRECT_URL'];

		$pos = strpos($redirect_uri, ROOT_URL);
		if ($pos === FALSE) {
			throw new \Exception('Error: the prefix of the web application "'.$this->splashUrlPrefix.'" was not found in the URL. The application must be misconfigured. Check the ROOT_URL parameter in your MoufUniversalParameters.php file at the root of your project.');
		}

		$tailing_url = substr($redirect_uri, $pos+strlen(ROOT_URL));
		$args = explode("/", $tailing_url);
		// We remove the first 2 parts of the URL (mouf/doc/view)
		array_shift($args);
		array_shift($args);
		
		$groupName = array_shift($args);
		$packageName = array_shift($args);
		
		
		//$this->package = $this->packageManager->getPackage($dirToPackage."package.xml");
		foreach ($this->packageList as $package) {
			if ($package->getName() == $groupName.'/'.$packageName) {
				$this->package = $package;
				break;
			}
		}
		
		if ($this->package == null) {
			MoufAdmin::getSplash()->print404("No package with this name");
			return;
		}
		
		$docPath = implode("/", $args);
		
		$filename = $this->rootPath."vendor/".$groupName."/".$packageName."/".$docPath;
			
		if (!file_exists($filename)) {
			MoufAdmin::getSplash()->print404("Documentation page does not exist");
			return;
		}
		if (!is_readable($filename)) {
			MoufAdmin::getSplash()->print404("Page not found");
			return;
		}
		
		if (is_dir($filename)) {
			// This is not a file but a directory.
			// Let's look for a README in it.
		
			$dir = rtrim($filename, '/\\');
			$root_url = ROOT_URL . rtrim($tailing_url, '/\\');
		
			// Let's try to find a README
			foreach ( DocumentationUtils::$readMeFiles as $readme ) {
				if (file_exists ( $dir . DIRECTORY_SEPARATOR . $readme )) {
					header ( 'Location: ' . $root_url . '/' . $readme );
					return;
				}
			}
			// If no readme found, let's go on a 404.
			//$this->addMenu ( $parsedComposerJson, $targetDir, $rootUrl, $packageVersion );
			/*if ($path) {
				MoufAdmin::getSplash()->print404("Sorry, this project does not seem to have documentation");
				//$this->http404Handler->pageNotFound ( "Sorry, this project does not seem to have documentation" );
				return;
			} else {*/
				$this->contentBlock->addText ( "<h4>" . $this->package->getName() . "</h4>" );
				if ($this->package->getDescription()) {
					$this->contentBlock->addText ( "<p>" . htmlentities ( $this->package->getDescription(), ENT_QUOTES, 'UTF-8' ) . "</p>" );
				}
				$this->contentBlock->addText ( '<div class="alert">Sorry, this project does not seem to have any documentation. Please bang the head of the developers until a proper README is added to this package!</div>' );
				$this->template->toHtml ();
				return;
			//}
		}
		
		$this->contentBlock->addText(
				"
				<script>
				$(document).ready(function() {
				$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
				});
				</script>
				"
		);

		if (strripos($filename, ".html") !== false || strripos($filename, ".md") !== false || strripos($filename, "README") !== false) {
			$previousNextButtonsHtml = $this->getPreviousNextButtons($docPath, $this->package, ROOT_URL.'doc/view/'.$groupName.'/'.$packageName.'/');
			$this->addMenu();
			
			$fileStr = file_get_contents($filename);
			
			if (strripos($filename, ".md") !== false) {
				// The line below is a workaround around a bug in markdown implementation.
				$forceautoload = new \ReflectionClass('\\Michelf\\Markdown');
				
				$markdownParser = new MarkdownExtra();
				
				$fileStr = str_replace('```', '~~~', $fileStr);
				
				// Let's parse and transform markdown format in HTML
				$fileStr = $markdownParser->transform($fileStr);
				
				$fileStr = $previousNextButtonsHtml.$fileStr.$previousNextButtonsHtml;
				
				$this->contentBlock->addText('<div class="staticwebsite">'.$fileStr.'</div>');
				$this->template->toHtml();
			} else {
				$bodyStart = strpos($fileStr, "<body");
				if ($bodyStart === false) {
					$this->contentBlock->addText('<div class="staticwebsite">'.$fileStr.'</div>');
					$this->template->toHtml();
				} else {
					$bodyOpenTagEnd = strpos($fileStr, ">", $bodyStart);
		
					$partBody = substr($fileStr, $bodyOpenTagEnd+1);
		
					$bodyEndTag = strpos($partBody, "</body>");
					if ($bodyEndTag === false) {
						return '<div class="staticwebsite">'.$partBody.'</div>';
					}
					$body = substr($partBody, 0, $bodyEndTag);
					
					$body = $previousNextButtonsHtml.$body.$previousNextButtonsHtml;
		
					$this->contentBlock->addText('<div class="staticwebsite">'.$body.'</div>');
					$this->template->toHtml();
				}
			}
		} elseif (strripos($filename, ".php") !== false) {
			// PHP files are not accessible
			MoufAdmin::getSplash()->print404("Cannot access PHP file through doc");
			return;
		} else {
 			$extension = pathinfo($filename, PATHINFO_EXTENSION);
 			switch (strtolower($extension)) {
 				case 'png':
 					header("Content-Type: image/png");
 					break;
 				case 'jpg':
 				case 'jpeg':
 					header("Content-Type: image/jpeg");
 					break;
 				case 'gif':
 					header("Content-Type: image/gif");
 					break;
 			}
			
 			header('Content-Length: ' . filesize($filename));
			readfile($filename);
			exit;
		}
		
		
	}
1123925
public function defaultAction($selfedit = 'false')
    {
        $this->selfedit = $selfedit;

        $exporter = new ClassProxy(SplashUrlsExporter::class);
        $this->splashUrlsList = $exporter->exportRoutes();

        $this->content->addFile(__DIR__.'/../../../../../views/admin/splashUrlsList.php', $this);
        $this->template->toHtml();
    }
390088
public function delete_instance(int $instanceid) {
        $fielddata = api::get_instance_fields_data($this->get_fields(), $instanceid, false);
        foreach ($fielddata as $data) {
            $data->delete();
        }
    }
1204847
public static function export_gradingform_instance_data(\context $context, int $instanceid, array $subcontext) {
        static::_export_gradingform_instance_data($context, $instanceid, $subcontext);
    }
1311707
protected static function setTranslationsForMessageFromService($selfEdit, $msgInstanceName, $language, $translations) {
		$translationService = new InstanceProxy($msgInstanceName, $selfEdit);
		return $translationService->setMessages($translations, $language);
	}
992280
public function getRedirectUrl($selfEdit) {
		if ($selfEdit) {
			$rootUrl = ROOT_URL; 
		} else {
			$rootUrl = ROOT_URL.'../../../';
		}
		
		return "src/direct/install_file.php?selfedit=".json_encode($selfEdit)."&root_url=".urlencode($rootUrl)."&install_package=".$this->getPackage()->getName()."&install_file=".$this->getFile();
	}
1047818
public static function prepareQuery(array &$options=array(), &$instance=null, $IDField=null) {
		self::prepareInstance($instance);
		self::$instances[$instance]->setIDField($IDField);
		if( !empty($options) && !empty($options['output']) && $options['output'] == SQLAdapter::ARR_FIRST ) {
			$options['number'] = 1;
		}
	}
903972
private function callMethod($instance, $method)
    {
        if (!method_exists($instance, $method) || !is_callable([$instance, $method])) {
            return false;
        }

        return call_user_func([$instance, $method]);
    }