/** * REST actions * * This function contains the REST actions with the assignments to * the functions. * * @param Component $conf component data */ public function __construct() { // runs the CConfig $com = new CConfig(LSubmission::getPrefix(), dirname(__FILE__)); // runs the LSubmission if ($com->used()) { return; } $conf = $com->loadConfig(); // initialize slim $this->app = new \Slim\Slim(array('debug' => true)); $this->app->response->headers->set('Content-Type', 'application/json'); // initialize component $this->_conf = $conf; ///$this->query = array(); $this->_file = CConfig::getLinks($conf->getLinks(), "file"); $this->_submission = CConfig::getLinks($conf->getLinks(), "submission"); $this->_selectedSubmission = CConfig::getLinks($conf->getLinks(), "selectedSubmission"); $this->_zip = CConfig::getLinks($conf->getLinks(), "zip"); // initialize lURL ///$this->lURL = $this->query->getAddress(); //AddSubmission $this->app->post('/' . $this->getPrefix() . '(/)', array($this, 'addSubmission')); //EditSubmissionState $this->app->put('/' . $this->getPrefix() . '/submission/:submissionid(/)', array($this, 'editSubmissionState')); //deleteSubmission $this->app->delete('/' . $this->getPrefix() . '/submission/:submissionid(/)', array($this, 'deleteSubmission')); //LoadSubmissionAsZip $this->app->get('/' . $this->getPrefix() . '/exercisesheet/:sheetid/user/:userid(/)', array($this, 'loadSubmissionAsZip')); //ShowSubmissionsHistory $this->app->get('/' . $this->getPrefix() . '/exercisesheet/:sheetid/user/:userid/history(/)', array($this, 'showSubmissionsHistory')); //GetSubmissionFile $this->app->get('/' . $this->getPrefix() . '/submission/:submissionid(/)', array($this, 'getSubmissionFile')); $this->app->run(); }
/** * REST actions * * This function contains the REST actions with the assignments to * the functions. * * @param Component $conf component data */ public function __construct() { // runs the CConfig $com = new CConfig(LMarking::getPrefix(), dirname(__FILE__)); // runs the LMarking if ($com->used()) { return; } $conf = $com->loadConfig(); // initialize slim $this->app = new \Slim\Slim(); $this->app->response->headers->set('Content-Type', 'application/json'); // initialize component $this->_conf = $conf; $this->_file = CConfig::getLinks($conf->getLinks(), "file"); $this->_marking = CConfig::getLinks($conf->getLinks(), "marking"); // POST AddMarking $this->app->post('/' . $this->getPrefix() . '(/)', array($this, 'addMarking')); // GET GetMarkingURL $this->app->get('/' . $this->getPrefix() . '/marking/:markingid(/)', array($this, 'getMarkingURL')); // DELETE DeleteMarking $this->app->delete('/' . $this->getPrefix() . '/marking/:markingid(/)', array($this, 'deleteMarking')); // PUT EditMarking $this->app->put('/' . $this->getPrefix() . '/marking/:markingid(/)', array($this, 'editMarking')); // PUT EditMarkingStatus $this->app->put('/' . $this->getPrefix() . '/marking/:markingid/status(/)', array($this, 'editMarkingStatus')); // run Slim $this->app->run(); }
/** * REST actions * * This function contains the REST actions with the assignments to * the functions. * * @param Component $conf component data */ public function __construct() { // runs the CConfig $com = new CConfig(LAttachment::getPrefix(), dirname(__FILE__)); // runs the LAttachment if ($com->used()) { return; } $conf = $com->loadConfig(); // initialize slim $this->app = new \Slim\Slim(); $this->app->response->setStatus(409); $this->app->response->headers->set('Content-Type', 'application/json'); // initialize component $this->_conf = $conf; $this->query = CConfig::getLink($conf->getLinks(), "controller"); $this->_postFile = CConfig::getLinks($conf->getLinks(), "postFile"); $this->_postAttachment = CConfig::getLinks($conf->getLinks(), "postAttachment"); // initialize lURL $this->lURL = $this->query->getAddress(); //POST AddAttachment $this->app->post('/' . $this->getPrefix() . '(/)', array($this, 'addAttachment')); //GET GetAttachment $this->app->get('/' . $this->getPrefix() . '/attachment/:attachmentid(/)', array($this, 'getAttachment')); //DELETE DeleteAttachment $this->app->delete('/' . $this->getPrefix() . '/attachment/:attachmentid(/)', array($this, 'deleteAttachment')); //PUT EditAttachment $this->app->put('/' . $this->getPrefix() . '/attachment/:attachmentid(/)', array($this, 'editAttachment')); //run Slim $this->app->run(); }
/** * REST actions * * This function contains the REST actions with the assignments to * the functions. */ public function __construct() { // runs the CConfig $com = new CConfig(LExtension::getPrefix() . ',course', dirname(__FILE__)); // runs the LExtension if ($com->used()) { return; } $conf = $com->loadConfig(); // initialize slim $this->app = new \Slim\Slim(array('debug' => true)); $this->app->response->headers->set('Content-Type', 'application/json'); // initialize component $this->_conf = $conf; $this->_extension = CConfig::getLinks($conf->getLinks(), "extension"); //POST AddCourseExtension $this->app->post('/link/course/:courseid/extension/:name', array($this, 'addCourseExtension')); //DELETE DeleteCourseExtension $this->app->delete('/link/course/:courseid/extension/:name', array($this, 'deleteCourseExtension')); //DELETE DeleteCourse $this->app->delete('/course/:courseid/', array($this, 'deleteCourse')); //GET GetExtensionInstalled $this->app->get('/link/exists/course/:courseid/extension/:name', array($this, 'getExtensionInstalled')); //GET GetInstalledExtensions $this->app->get('/link/course/:courseid/extension', array($this, 'getInstalledExtensions')); //GET GetExtensions $this->app->get('/link/extension(/)', array($this, 'getExtensions')); //GET GetExtensionExists $this->app->get('/link/exists/extension/:name', array($this, 'getExtensionExists')); //GET GetExtension $this->app->get('/link/extension/:name', array($this, 'getExtension')); //run Slim $this->app->run(); }
/** * REST actions * * This function contains the REST actions with the assignments to * the functions. */ public function __construct() { // runs the CConfig $com = new CConfig(LProcessor::getPrefix() . ',submission,course,link', dirname(__FILE__)); // runs the LProcessor if ($com->used()) { return; } $conf = $com->loadConfig(); // initialize slim $this->app = new \Slim\Slim(); $this->app->response->headers->set('Content-Type', 'application/json'); // initialize component $this->_conf = $conf; $this->_submission = CConfig::getLinks($conf->getLinks(), "submission"); $this->_marking = CConfig::getLinks($conf->getLinks(), "marking"); $this->_processorDb = CConfig::getLinks($conf->getLinks(), "processorDb"); $this->_attachment = CConfig::getLinks($conf->getLinks(), "attachment"); $this->_workFiles = CConfig::getLinks($conf->getLinks(), "workFiles"); $this->_file = CConfig::getLinks($conf->getLinks(), "file"); $this->_createCourse = CConfig::getLinks($conf->getLinks(), "postCourse"); $this->_getExerciseExerciseFileType = CConfig::getLinks($conf->getLinks(), "getExerciseExerciseFileType"); // POST PostSubmission $this->app->map('/submission(/)', array($this, 'postSubmission'))->via('POST'); // POST AddProcess $this->app->map('/' . $this->getPrefix() . '(/)', array($this, 'addProcess'))->via('POST'); // POST AddCourse $this->app->post('/course(/)', array($this, 'addCourse')); // POST DeleteCourse $this->app->delete('/course/:courseid(/)', array($this, 'deleteCourse')); // GET GetExistsCourse $this->app->get('/link/exists/course/:courseid(/)', array($this, 'getExistsCourse')); // run Slim $this->app->run(); }
/** * REST actions * * This function contains the REST actions with the assignments to * the functions. */ public function __construct() { // runs the CConfig $com = new CConfig(LForm::getPrefix() . ',course,link', dirname(__FILE__)); // runs the LForm if ($com->used()) { return; } $conf = $com->loadConfig(); // initialize slim $this->app = new \Slim\Slim(array('debug' => true)); $this->app->response->headers->set('Content-Type', 'application/json'); // initialize component $this->_conf = $conf; $this->_form = CConfig::getLinks($conf->getLinks(), "form"); $this->_choice = CConfig::getLinks($conf->getLinks(), "choice"); $this->_createCourse = CConfig::getLinks($conf->getLinks(), "postCourse"); // POST AddForm $this->app->post('/' . $this->getPrefix() . '(/)', array($this, 'addForm')); // POST AddCourse $this->app->post('/course(/)', array($this, 'addCourse')); // DELETE DeleteCourse $this->app->delete('/course/:courseid(/)', array($this, 'deleteCourse')); // GET GetExistsCourse $this->app->get('/link/exists/course/:courseid(/)', array($this, 'getExistsCourse')); // run Slim $this->app->run(); }
public function __construct(CConfig $config) { $this->m_cConfig = &$config; $this->m_confXml = &$config->getConfTree("viewconfig"); $this->m_templateDir = $this->m_confXml["templatedir"]["xmlValue"] . "/"; }
/** * REST actions * * This function contains the REST actions with the assignments to * the functions. * * @param Component $conf component data */ public function __construct() { // runs the CConfig $com = new CConfig(LCourse::getPrefix(), dirname(__FILE__)); // runs the LCourse if ($com->used()) { return; } $conf = $com->loadConfig(); // initialize slim $this->app = new \Slim\Slim(array('debug' => true)); $this->app->response->headers->set('Content-Type', 'application/json'); // initialize component $this->_conf = $conf; $this->query = CConfig::getLink($conf->getLinks(), "controller"); $this->_deleteCourse = CConfig::getLinks($conf->getLinks(), "deleteCourse"); $this->_postCourse = CConfig::getLinks($conf->getLinks(), "postCourse"); // initialize lURL $this->lURL = $this->query->getAddress(); //POST AddCourse $this->app->post('/' . $this->getPrefix() . '(/)', array($this, 'AddCourse')); //PUT EditCourse $this->app->put('/' . $this->getPrefix() . '/course/:courseid(/)', array($this, 'editCourse')); //DELETE DeleteCourse $this->app->delete('/' . $this->getPrefix() . '/course/:courseid(/)', array($this, 'deleteCourse')); //POST AddCourseMember $this->app->post('/' . $this->getPrefix() . '/course/:courseid/user/:userid/status/:status(/)', array($this, 'addCourseMember')); //GET GetCourseMember $this->app->get('/' . $this->getPrefix() . '/course/:courseid/user(/)', array($this, 'getCourseMember')); //GET GetCourses $this->app->get('/' . $this->getPrefix() . '/user/:userid(/)', array($this, 'getCourses')); //run Slim $this->app->run(); }
/** * REST actions * * This function contains the REST actions with the assignments to * the functions. */ public function __construct() { // runs the CConfig $com = new CConfig(LFormProcessor::getPrefix() . ',course,link', dirname(__FILE__)); // runs the LFormProcessor if ($com->used()) { return; } $conf = $com->loadConfig(); // initialize slim $this->app = new \Slim\Slim(array('debug' => true)); $this->app->response->headers->set('Content-Type', 'application/json'); // initialize component $this->_conf = $conf; $this->_formDb = CConfig::getLinks($conf->getLinks(), "formDb"); $this->_pdf = CConfig::getLinks($conf->getLinks(), "pdf"); $this->_postProcess = CConfig::getLinks($conf->getLinks(), "postProcess"); $this->_deleteProcess = CConfig::getLinks($conf->getLinks(), "deleteProcess"); $this->_getProcess = CConfig::getLinks($conf->getLinks(), "getProcess"); // POST PostProcess $this->app->map('/' . $this->getPrefix() . '(/)', array($this, 'postProcess'))->via('POST'); // POST AddCourse $this->app->post('/course(/)', array($this, 'addCourse')); // POST DeleteCourse $this->app->delete('/course/:courseid(/)', array($this, 'deleteCourse')); // GET GetExistsCourse $this->app->get('/link/exists/course/:courseid(/)', array($this, 'getExistsCourse')); // run Slim $this->app->run(); }
public function __construct(CConfig &$config) { $this->m_cConfig = &$config; $this->m_urlXml = array(); $this->m_confXml = &$config->getConfTree("pageurl"); $this->m_xmlFile = URL_XML_FILE; }
/** * REST actions * * This function contains the REST actions with the assignments to * the functions. * * @param Component $conf component data */ public function __construct() { // runs the CConfig $com = new CConfig(LTutor::getPrefix(), dirname(__FILE__)); // runs the LTutor if ($com->used()) { return; } $conf = $com->loadConfig(); /** *Initialise the Slim-Framework */ $this->app = new \Slim\Slim(); $this->app->response->headers->set('Content-Type', 'application/json'); if (file_exists(dirname(__FILE__) . '/config.ini')) { $this->config = parse_ini_file(dirname(__FILE__) . '/config.ini', TRUE); } /** *Set the Logiccontroller-URL */ $this->_conf = $conf; $this->query = array(); $this->query = CConfig::getLink($conf->getLinks(), "controller"); $this->_postTransaction = array(CConfig::getLink($this->_conf->getLinks(), 'postTransaction')); $this->_getTransaction = array(CConfig::getLink($this->_conf->getLinks(), 'getTransaction')); $this->_postZip = array(CConfig::getLink($this->_conf->getLinks(), 'postZip')); $this->_postPdf = array(CConfig::getLink($this->_conf->getLinks(), 'postPdf')); $this->_postMarking = array(CConfig::getLink($this->_conf->getLinks(), 'postMarking')); $this->_getMarking = array(CConfig::getLink($this->_conf->getLinks(), 'getMarking')); $this->_getExercise = array(CConfig::getLink($this->_conf->getLinks(), 'getExercise')); $this->_getGroup = array(CConfig::getLink($this->_conf->getLinks(), 'getGroup')); $this->_getSubmission = array(CConfig::getLink($this->_conf->getLinks(), 'getSubmission')); $this->_postSubmission = array(CConfig::getLink($this->_conf->getLinks(), 'postSubmission')); // initialize lURL $this->lURL = $this->query->getAddress(); // POST AddPlatform $this->app->post('/platform', array($this, 'addPlatform')); // DELETE DeletePlatform $this->app->delete('/platform', array($this, 'deletePlatform')); // GET GetExistsPlatform $this->app->get('/link/exists/platform', array($this, 'getExistsPlatform')); // POST PostSubmissionConvert $this->app->post('/submission/convert(/timestamp/begin/:begin/end/:end)', array($this, 'postSubmissionConvert')); //Set auto allocation by exercise $this->app->post('/' . $this->getPrefix() . '/auto/exercise/course/:courseid/exercisesheet/:sheetid(/)', array($this, 'autoAllocateByExercise')); //Set auto allocation by group $this->app->post('/' . $this->getPrefix() . '/auto/group/course/:courseid/exercisesheet/:sheetid(/)', array($this, 'autoAllocateByGroup')); //Get zip $this->app->get('/' . $this->getPrefix() . '/user/:userid/exercisesheet/:sheetid(/status/:status)(/)', array($this, 'getZip')); //Post zip $this->app->post('/' . $this->getPrefix() . '/archive/user/:userid/exercisesheet/:sheetid(/)', array($this, 'postTutorArchive')); //Post zip $this->app->post('/' . $this->getPrefix() . '/archive/user/:userid/exercisesheet/:sheetid/withnames(/)', array($this, 'postTutorArchiveWithNames')); //uploadZip $this->app->post('/' . $this->getPrefix() . '/user/:userid/course/:courseid(/)', array($this, 'uploadZip')); //run Slim $this->app->run(); }
public function __construct(CConfig &$config, CModel &$model, CGlob &$glob) { $this->m_cConfig = &$config; $this->m_cModel = &$model; $this->m_cGlob = &$glob; $this->m_confXml = &$config->getConfTree("authentification", "database"); $this->m_sysKey = &$config->m_config["systemkey"]["xmlValue"]; }
public function __construct(CConfig &$config) { /* init defaults */ $this->m_cConfig = &$config; $this->m_confXml = &$config->getConfTree("user"); $this->m_isLogin = false; /* init CModelSet */ $this->m_dataSet = new CModelSet(); }
public function __construct(CConfig &$config) { /* init default */ $this->m_cConfig = &$config; $this->m_confXml = &$config->getConfTree("modelconfig"); $this->m_arrModSet = array(); $this->m_priorityQue = array(); $this->m_eventPrioQue = array(); $this->m_eventSav = array(); }
public function __construct(CConfig &$config) { /* init defaults */ $this->m_cConfig = &$config; $this->m_confXml = &$config->getConfTree("session"); $this->m_sessData = array(); /* add first part (path) of m_sessFile */ $this->m_sessFile = $this->m_confXml["sessionpath"]["xmlValue"] . "/"; /* add SystemKey */ $this->m_sysKey = &$this->m_cConfig->m_config["systemkey"]["xmlValue"]; }
public function __construct(CConfig &$config, $file) { /* set default value */ $this->m_file = $file; $this->m_cConfig = &$config; $this->m_confXml = &$config->getConfTree("cache"); $this->m_strict = $this->m_confXml["usestrict"]["xmlValue"]; /* replace '/' with '_' */ $fileCacheName = preg_replace("/(\/|\.|\s)/", "_", $file); $cachePath = $this->m_confXml["cachepath"]["xmlValue"]; $this->m_cacheN = $cachePath . "/" . md5($fileCacheName); }
public function display($templateName = '', $isCache = false, $num = '') { if (empty($templateName)) { $templateName = CRequest::getController() . '/' . str_replace(CConfig::getInstance()->load('ACTION_PREFIX'), '', CRequest::getAction()); } parent::display($templateName, $isCache, $num); }
/** * Ermittelt alle mit der CInstall am Ausgang $name verknüpften Komponenten * * @param string $name Der Name des Ausgangs, dessen Ziele gesucht ermittelt werden sollen * @return link[] Eine Liste der Komponenten an diesem Ausgang */ public static function getLinks($name) { if (self::$config === null) { self::$config = CConfig::loadStaticConfig('', '', dirname(__FILE__), '/../component/cinstall_cconfig.json'); } return CConfig::getLinks(self::$config->getLinks(), $name); }
/** * Привязывает конфиг к определенному sitemap-документу * @param string $schema * @param int $sitemapId */ public function setupLink($schema, $sitemapId) { $this->schema = CConfig::getSchema($schema); $this->schema->setupSitemapLink($sitemapId); $this->addAlert('Свазья с sitemap-документом установлена'); $this->jumpBack(); }
/** * 是否有权限 */ public static function checkRight($thisRoute = null) { // 用户资源 $userData = CSession::get('user'); if ($userData['groupId'] == 1) { return true; } $userRightList = isset($userData['rightAll']) ? $userData['rightAll'] : array(); // 附加公共资源 array_push($userRightList, 'system@welcome'); array_push($userRightList, 'system@navList'); array_push($userRightList, 'system@addNav'); array_push($userRightList, 'system@addNavHandle'); array_push($userRightList, 'system@ajaxAddNav'); array_push($userRightList, 'system@editNav'); array_push($userRightList, 'system@editNavHandle'); array_push($userRightList, 'system@delNav'); array_push($userRightList, 'system@changeMyPassword'); array_push($userRightList, 'system@changeMyPassHandle'); array_push($userRightList, 'adminRole@messageCenterForClient'); array_push($userRightList, 'system@seeHelp'); // 转小写 foreach ($userRightList as $key => $val) { $userRightList[$key] = strtolower($val); } // 获取当前请求的路由 if ($thisRoute == null) { $route = CRequest::getController() . '@' . str_replace(CConfig::getInstance()->load('ACTION_PREFIX'), '', CRequest::getAction()); } else { $route = $thisRoute; } return in_array(strtolower($route), $userRightList); }
public function __construct(CConfig &$config) { /* init default */ $this->m_cConfig = &$config; $this->m_confXml = &$config->getConfTree("authentification", "core"); $this->m_sysKey = &$config->m_config["systemkey"]["xmlValue"]; $this->m_success = false; /* aktiviert/deaktiviert objekt */ $this->m_enable = &$this->m_confXml["enableauth"]["xmlValue"]; /* beende dich, wenn nicht aktive */ if ($this->m_enable == false) { return; } }
/** * the component constructor * * @param $conf component data */ public function __construct() { // runs the CConfig $com = new CConfig(DBControl::getPrefix(), dirname(__FILE__)); // runs the DBControl if ($com->used()) { return; } $conf = $com->loadConfig(); // initialize component $this->_conf = $conf; // initialize slim $this->_app = new \Slim\Slim(); $this->_app->map('/:data+', array($this, 'getl'))->via('GET', 'POST', 'DELETE', 'PUT', 'INFO'); // run Slim $this->_app->run(); }
/** * 构造函数,实列化存放路径 */ function __construct() { $configPath = CConfig::getInstance()->load('CACHE.FILE_PATH'); $this->_path = !empty($configPath) ? $configPath : $this->_path; if (!file_exists($this->_path)) { mkdir($this->_path, 0755, true); } }
/** * Проверяем работу метода CConfig::selectAll, он должен вернуть объекты CConfigSchema */ public function testSelect() { $schema = CConfig::createSchema('test2'); $schema->updateSchema('test2', 'Title'); // Проверяем кол-во схем $list = CConfig::selectAll(); $this->assertEquals(2, sizeof($list)); $this->assertEquals(true, $list[0] instanceof CConfigSchema); }
/** * the component constructor */ public function __construct() { // runs the CConfig $com = new CConfig(CControl::getPrefix() . ',link,definition', dirname(__FILE__)); // runs the DBSubmission if ($com->used()) { return; } // initialize slim $this->_app = new \Slim\Slim(); $this->_app->response->headers->set('Content-Type', 'application/json'); // POST AddPlatform $this->_app->post('/platform', array($this, 'addPlatform')); // DELETE DeletePlatform $this->_app->delete('/platform', array($this, 'deletePlatform')); // GET GetExistsPlatform $this->_app->get('/link/exists/platform', array($this, 'getExistsPlatform')); // GET GetTableReferences $this->_app->get('/tableReferences', array($this, 'getTableReferences')); // PUT EditLink $this->_app->put('/link/:linkid(/)', array($this, 'editLink')); // DELETE DeleteLink $this->_app->delete('/link/:linkid(/)', array($this, 'deleteLink')); // POST SetLink $this->_app->post('/link(/)', array($this, 'setLink')); // GET GetLink $this->_app->get('/link/:linkid(/)', array($this, 'getLink')); // PUT EditComponent $this->_app->put('/component/:componentid(/)', array($this, 'editComponent')); // DELETE DeleteComponent $this->_app->delete('/component/:componentid(/)', array($this, 'deleteComponent')); // POST SetComponent $this->_app->post('/component(/)', array($this, 'setComponent')); // GET GetComponent $this->_app->get('/component/:componentid(/)', array($this, 'getComponent')); // GET GetComponentDefinitions $this->_app->get('/definition(/)', array($this, 'getComponentDefinitions')); // GET SendComponentDefinitions $this->_app->get('(/definition)/send(/)', array($this, 'sendComponentDefinitions')); // GET GetComponentDefinition $this->_app->get('/definition/:componentid(/)', array($this, 'getComponentDefinition')); // run Slim $this->_app->run(); }
/** * REST actions * * This function contains the REST actions with the assignments to * the functions. * * @param Component $conf component data */ public function __construct() { // runs the CConfig $com = new CConfig(DBAttachment::getPrefix(), dirname(__FILE__)); // runs the DBAttachment if ($com->used()) { return; } $conf = $com->loadConfig(); // initialize component $this->_conf = $conf; $this->query = array(CConfig::getLink($conf->getLinks(), 'out')); $this->query2 = array(CConfig::getLink($conf->getLinks(), 'out2')); // initialize slim $this->_app = new \Slim\Slim(); $this->_app->response->setStatus(409); $this->_app->response->headers->set('Content-Type', 'application/json'); // POST AddPlatform $this->_app->post('/platform', array($this, 'addPlatform')); // DELETE DeletePlatform $this->_app->delete('/platform', array($this, 'deletePlatform')); // GET GetExistsPlatform $this->_app->get('/link/exists/platform', array($this, 'getExistsPlatform')); // PUT EditAttachment $this->_app->put('/' . $this->getPrefix() . '(/attachment)/:aid(/)', array($this, 'editAttachment')); // DELETE DeleteAttachment $this->_app->delete('/' . $this->getPrefix() . '(/attachment)/:aid(/)', array($this, 'deleteAttachment')); // DELETE DeleteExerciseAttachments $this->_app->delete('/' . $this->getPrefix() . '/exercise/:eid(/)', array($this, 'deleteExerciseAttachment')); // DELETE DeleteExerciseFileAttachment $this->_app->delete('/' . $this->getPrefix() . '/exercise/:eid/file/:fileid(/)', array($this, 'deleteExerciseFileAttachment')); // POST AddAttachment $this->_app->post('/' . $this->getPrefix() . '(/)', array($this, 'addAttachment')); // GET GetAttachment $this->_app->get('/' . $this->getPrefix() . '(/attachment)/:aid(/)', array($this, 'getAttachment')); // GET GetAllAttachments $this->_app->get('/' . $this->getPrefix() . '(/attachment)(/)', array($this, 'getAllAttachments')); // GET GetExerciseAttachments $this->_app->get('/' . $this->getPrefix() . '/exercise/:eid(/)', array($this, 'getExerciseAttachments')); // GET GetSheetAttachments $this->_app->get('/' . $this->getPrefix() . '/exercisesheet/:esid(/)', array($this, 'getSheetAttachments')); // run Slim $this->_app->run(); }
public function testRegistration() { $schema = \CConfig::getSchema(\UsersRegistration::RegistrationConfirmationConfigName); $api = new Registration($this->correctForm); $api->exec(); $this->assertTrue($this->mailer->isSent()); $lastEmail = \EmailLogModel::getLast(); $this->assertEquals($lastEmail->to->getValue(), self::SomeCorrectEmail); $user = \UserAccount::getByLogin(self::NewLogin); $this->assertEquals($user->social_networks->getValue()['facebook'], self::NewUID); }
/** * Данный метод обрабатывает форму создания конфига * @param string $name * @param string $title */ public function create($name, $title) { try { $schema = CConfig::createSchema($name); $schema->updateSchema($name, $title); $this->addAlert(sprintf('Конфиг "%s" создан', $name)); } catch (Exception $e) { $this->addError($e->getMessage()); } $this->jumpBack(); }
/** * 查询单条 */ public function find($condition, $params, $asArray = true) { $this->condition = $condition; $this->params = $params; $dbConfig = CConfig::getInstance()->load('DB.main.slaves'); $tablePre = isset($dbConfig['tablePrefix']) ? $dbConfig['tablePrefix'] : ''; $findSql = 'SELECT * FROM ' . $tablePre . $this->_getTableName() . ' WHERE ' . $condition . ' LIMIT 1 '; $findObject = CDatabase::getInstance()->prepare($findSql)->execute($params); $this->arResult = $findObject->asArray(); return $this; }
/** * REST actions * * This function contains the REST actions with the assignments to * the functions. */ public function __construct() { // runs the CConfig $com = new CConfig(LFile::$_baseDir, dirname(__FILE__)); // runs the LFile if ($com->used()) { return; } $conf = $com->loadConfig(); $this->_conf = $conf; $this->_fs = CConfig::getLinks($this->_conf->getLinks(), 'file'); $this->_db = CConfig::getLinks($this->_conf->getLinks(), 'fileDb'); $this->_app = new \Slim\Slim(array('debug' => true)); $this->_app->response->setStatus(404); $this->_app->response->headers->set('Content-Type', 'application/json'); // POST File $this->_app->post('/' . LFile::$_baseDir . '(/)', array($this, 'postFile')); /*// POST PathFile $this->_app->post( '/' . LFile::$_baseDir . '/:path(/)', array( $this, 'postPathFile' ) );*/ // DELETE File $this->_app->delete('/' . LFile::$_baseDir . '/:fileid', array($this, 'deleteFile')); // run Slim $this->_app->run(); }