public function usersAction($name = false) { $views = $this->getView(); $data = $this->getRequest(); $members = MembersManage::instance(); $app = $members->getCurrentSession(); $controlControl = AdminCourseManage::instance(); $owner = $member = false; preg_match("/^[a-zA-Z0-9]+/", $name, $matches); $name = $matches[0]; $member = $members->getMemberForName(trim($name)); if (!$matches or !$member) { header('Location: /'); exit; } if ($app and $app['username'] == $name) { $owner = true; } $course = $controlControl->getCourseList(array('course.uid' => $member['id'], 'course.verified' => 3, 'course.published' => 4), 100, 1); $views->assign('title', $member['username']); $views->assign('app', $app); $views->assign('owner', $owner); $views->assign('courses', $course); $views->assign('user', $member); $views->display("index/index/users.html.twig"); }
public function courseCategoryDeleteAction($ccid = false) { $views = $this->getView(); $data = $this->getRequest(); $members = MembersManage::instance(); $app = $members->getCurrentSession(); if (!$app) { exit; } $courseControl = AdminCourseManage::instance(); if ($ccid > 0) { $category = $courseControl->deleteCategoryForId($ccid); } $categories = $courseControl->getCategory(); $views->assign('categories', $categories); $views->display('admin/coursecategory/tbody.html.twig'); }
public function lessonArticleDeleteAction($cid = false, $ccid = false) { $views = $this->getView(); $data = $this->getRequest(); $members = MembersManage::instance(); $app = $members->getCurrentSession(); if (!$app) { exit; } $courseControl = AdminCourseManage::instance(); $courseControl->deleteArticle($ccid); exit; }
public function linkAddAction($cid) { $views = $this->getView(); $rest = Restful::instance(); $data = $this->getRequest(); $members = MembersManage::instance(); $app = $members->getCurrentSession(); $courseControl = AdminCourseManage::instance(); $message = array('error' => '无法收集该链接内容', 'content' => ''); $success = 0; if (!$app) { $message['error'] = '没有权限'; } if ($data->isPost()) { $contents = $courseControl->addLinkToArticle($cid, $data->getPost('_link'), $data->getPost('_summary')); $owner = false; if (isset($app['uid']) and $app['uid']) { $course = $courseControl->getCourseRow(array('course.cid' => $contents['cid'], "course.verified" => 3, "course.published" => 4)); if ($course and $app['uid'] == $course['uid']) { $owner = true; } } $views->assign('owner', $owner); $views->assign('menu', $contents); $views->display("index/course/article-menu-li-modal.html.twig"); } $rest->assign('success', $success); $rest->assign('message', $message); $rest->response(); }