Upload docs draft

This commit is contained in:
2019-09-07 21:09:13 +02:00
parent 32d4917964
commit 35efcf2293
17 changed files with 1725 additions and 70 deletions

View File

@@ -13,7 +13,8 @@ class CATC extends Main
$asClasses = array(
array('name'=>'auth', 'project'=>true),
array('name'=>'course', 'project'=>true),
array('name'=>'note', 'project'=>true)
array('name'=>'note', 'project'=>true),
array('name'=>'doc', 'project'=>true)
);
parent::__construct($oClassManagement, $sProcessPage, $asClasses);
@@ -38,7 +39,7 @@ class CATC extends Main
Course::WS_TABLE => array('dates'),
Course::COURSE_TABLE=> array(Db::getId('workshops'), 'description', 'timeslot'),
'notes' => array(Db::getId(Auth::USER_TABLE), Db::getId(Course::COURSE_TABLE), 'notes'),
'docs' => array(Db::getId(Auth::USER_TABLE), Db::getId(Course::COURSE_TABLE), 'type', 'path'),
Doc::DOC_TABLE => array(Db::getId(Auth::USER_TABLE), Db::getId(Course::COURSE_TABLE), 'type', 'filename'),
'todos' => array(Db::getId(Auth::USER_TABLE), Db::getId(Course::COURSE_TABLE), 'description')
),
'types' => array
@@ -52,40 +53,15 @@ class CATC extends Main
'timeslot' => "ENUM('SAT-M', 'SAT-A', 'SUN-M', 'SUN-A')",
'notes' => "LONGTEXT",
'type' => "VARCHAR(10)",
'path' => "VARCHAR(100)"
'filename' => "VARCHAR(200)"
),
'constraints' => array
(
'docs' => "UNIQUE KEY `uni_path` (`path`)"
Doc::DOC_TABLE => "UNIQUE KEY `uni_file` (`filename`)"
)
);
}
public function getPage()
{
//Constants
$asGlobalVars = array(
'consts' => array(
'token_sep' => Auth::TOKEN_SEP,
'error' => self::ERROR,
'success' => self::SUCCESS,
'context' => $this->asContext,
'cookie' => Auth::USER_COOKIE_PASS
),
'vars' => $this->getVars()
);
//Pages
$asPages = array('logon', 'logoff', 'template', 'workshops', 'course');
foreach($asPages as $sPage) $asGlobalVars['consts']['pages'][$sPage] = $this->getPageContent($sPage);
//Main Page
//TODO use getMainPage parent function
$sPage = $this->getPageContent('index');
$sPage = str_replace('asGlobalVars', json_encode($asGlobalVars), $sPage);
return $sPage;
}
private function getVars() {
return array(
'id' => $this->oAuth->getUserId(),
@@ -93,22 +69,24 @@ class CATC extends Main
);
}
public function getMainPage($asGlobalVars = array(), $sMainPage = 'index', $asMainPageTags=array())
public function getAppMainPage()
{
return parent::getMainPage(
return self::getMainPage(
array(
'consts' => array(
'token_sep' => Auth::TOKEN_SEP,
'error' => self::ERROR,
'success' => self::SUCCESS,
'context' => $this->asContext,
'cookie' => Auth::USER_COOKIE_PASS
'cookie' => Auth::USER_COOKIE_PASS,
'courses' => (new Course($this->oDb))->getCourses()
),
'vars' => $this->getVars()
),
'index',
array(
'host_url' => $this->asContext['serv_name']
'filepath_css' => self::addTimestampToFilePath('style/catc.css'),
'filepath_js_catc' => self::addTimestampToFilePath('scripts/catc.js')
)
);
}
@@ -164,13 +142,20 @@ class CATC extends Main
return self::getJsonResult($bSuccess, $sError, $asData);
}
/*
public function upload()
/* Docs */
public function getDocs($iCourseId) {
$oDoc = new Doc($this->oDb, $this->oAuth->getUserId(), $iCourseId);
$asDocList = $oDoc->getList();
return self::getJsonResult(!empty($asDocList), '', $asDocList);
}
public function uploadDoc($iCourseId)
{
$this->oClassManagement->incClass('uploader', true);
$oUploader = new Uploader($this->oMedia);
$oDoc = new Doc($this->oDb, $this->oAuth->getUserId(), $iCourseId);
$oUploader = new Uploader($oDoc);
return $oUploader->sBody;
}
*/
}