Definitions v1
This commit is contained in:
34
inc/catc.php
34
inc/catc.php
@@ -14,7 +14,8 @@ class CATC extends Main
|
||||
array('name'=>'auth', 'project'=>true),
|
||||
array('name'=>'course', 'project'=>true),
|
||||
array('name'=>'note', 'project'=>true),
|
||||
array('name'=>'doc', 'project'=>true)
|
||||
array('name'=>'doc', 'project'=>true),
|
||||
array('name'=>'definition', 'project'=>true)
|
||||
);
|
||||
parent::__construct($oClassManagement, $sProcessPage, $asClasses);
|
||||
|
||||
@@ -35,12 +36,13 @@ class CATC extends Main
|
||||
(
|
||||
'tables' => array
|
||||
(
|
||||
Auth::USER_TABLE => array(Db::getText(Auth::USER_TABLE), 'nickname', 'pass', 'cookie'),
|
||||
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'),
|
||||
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')
|
||||
Auth::USER_TABLE => array(Db::getText(Auth::USER_TABLE), 'nickname', 'pass', 'cookie'),
|
||||
Course::WS_TABLE => array('dates'),
|
||||
Course::COURSE_TABLE => array(Db::getId('workshops'), 'description', 'timeslot'),
|
||||
Note::NOTE_TABLE => array(Db::getId(Auth::USER_TABLE), Db::getId(Course::COURSE_TABLE), 'notes'),
|
||||
Definition::DEF_TABLE => array(Db::getId(Auth::USER_TABLE), 'title', 'description'),
|
||||
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
|
||||
(
|
||||
@@ -49,6 +51,7 @@ class CATC extends Main
|
||||
'pass' => "VARCHAR(256) NOT NULL",
|
||||
'cookie' => "VARCHAR(255)",
|
||||
'dates' => "VARCHAR(50)",
|
||||
'title' => "VARCHAR(50)",
|
||||
'description' => "VARCHAR(200)",
|
||||
'timeslot' => "ENUM('SAT-M', 'SAT-A', 'SUN-M', 'SUN-A')",
|
||||
'notes' => "LONGTEXT",
|
||||
@@ -57,7 +60,8 @@ class CATC extends Main
|
||||
),
|
||||
'constraints' => array
|
||||
(
|
||||
Doc::DOC_TABLE => "UNIQUE KEY `uni_file` (`filename`)"
|
||||
Doc::DOC_TABLE => "UNIQUE KEY `uni_file` (`filename`)",
|
||||
Definition::DEF_TABLE => "UNIQUE KEY `uni_def_title` (`title`)"
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -160,4 +164,18 @@ class CATC extends Main
|
||||
|
||||
return self::getJsonResult($bResult, '');
|
||||
}
|
||||
|
||||
/* Defs */
|
||||
|
||||
public function getDefs() {
|
||||
$oDef = new Definition($this->oDb, $this->oAuth->getUserId());
|
||||
return self::getJsonResult(true, '', $oDef->getDefinitions());
|
||||
}
|
||||
|
||||
public function setDef($iDefId, $sTitle, $sDesc) {
|
||||
$bNew = ($iDefId == 0);
|
||||
$oDef = new Definition($this->oDb, $this->oAuth->getUserId(), $iDefId);
|
||||
$bResult = $oDef->setDefinition($sTitle, $sDesc);
|
||||
return self::getJsonResult($bResult, '', array('new_def'=>$bNew, 'def'=>$oDef->getDefinition()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user