9 require_once dirname(dirname(dirname(__FILE__))) .
"/lib/php/common-repo.php";
15 use Symfony\Component\HttpFoundation\JsonResponse;
23 private $searchHelperDao;
27 $this->Name =
"ajax-notice-files";
28 $this->Title = _(
"Ajax Notice Files");
30 $this->OutputType =
'JSON';
31 $this->OutputToStdout =
true;
32 parent::__construct();
34 $this->uploadDao = $GLOBALS[
'container']->get(
'dao.upload');
35 $this->searchHelperDao = $GLOBALS[
'container']->get(
'dao.searchhelperdao');
40 $this->
State = PLUGIN_STATE_READY;
46 if ($this->
State != PLUGIN_STATE_READY) {
53 $parentBounds = $this->uploadDao->getParentItemBounds($getuploadEntry[
'upload_fk'],
null);
54 $uploadTreeId = $parentBounds->getItemId();
57 $Item = $uploadTreeId;
58 $Filename =
"NOTICE%";
59 $uploadId = $getuploadEntry[
'upload_fk'];
65 $searchtype =
"allfiles";
69 $UploadtreeRecsResult = $this->searchHelperDao->GetResults($Item, $Filename, $uploadId, $tag, $Page, $Limit, $SizeMin,
70 $SizeMax, $searchtype, $License, $Copyright, $this->uploadDao,
73 foreach ($UploadtreeRecsResult[0] as $k => $res) {
75 $pfilefk = $res[
'pfile_fk'];
78 $UploadtreeRecsResult[0][$k][
'repo_file'] = $repofile;
81 if (is_readable($repofile)) {
82 $f = fopen($repofile,
"r");
86 $contents = fread($f, filesize($repofile));
87 $contents_short =
"<textarea style='overflow:auto;width:400px;height:80px;'>" .$contents.
"</textarea>";
88 $UploadtreeRecsResult[0][$k][
'contents'] = $contents;
89 $UploadtreeRecsResult[0][$k][
'contents_short'] = $contents_short;
93 return new JsonResponse($UploadtreeRecsResult[0]);
98 $NewPlugin->Initialize();
PostInitialize()
This function is called before the plugin is used and after all plugins have been initialized....
__construct()
base constructor. Most plugins will just use this
Output()
This function is called when user output is requested. This function is responsible for content....
This is the Plugin class. All plugins should:
Contains the constants and helpers for authentication of user.
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
RepPath($PfilePk, $Repo="files")
Given a pfile id, retrieve the pfile path.
#define PLUGIN_DB_READ
Plugin requires read permission on DB.