protected function addedAction($title, $content)
 {
     ArticlesModel::add($title, $content);
     $view = new View();
     $view->item = $single_article;
     $view->display('NewAddedArticle.php');
 }
 public function actionShowLesson()
 {
     $auth = Auth::checkAuth();
     $view = new View();
     $view->auth = $auth;
     if (!isset($_GET['id'])) {
         header("Location: /learns/");
     }
     if ($auth) {
         $user = Auth::getUser();
         $id = $_GET['id'];
         $lesson = Lessons::getLesson($id);
         $course = Courses::getCourse($lesson->course_id);
         $lesson_prew = Lessons::getLessonByNumber($lesson->lesson_number - 1, $lesson->course_id);
         $lesson_next = Lessons::getLessonByNumber($lesson->lesson_number + 1, $lesson->course_id);
         $view->user_login = $user->user_login;
         $view->user_group = $user->user_group;
         $view->lesson = $lesson;
         $view->course = $course;
         $view->lesson_prew = $lesson_prew;
         $view->lesson_next = $lesson_next;
         $view->display('header.php');
         $view->display('lessons/lesson_view.php');
         $view->display('footer.php');
     } else {
         header("Location: /learns/");
     }
 }
 public function actionShow()
 {
     $id = $_GET['id'];
     $auth = Auth::checkAuth();
     if ($auth) {
         $user = Users::findOneByPK($auth);
         $user->getProfile();
     }
     $courses = Courses::findAllByColumn('parent_id', $id);
     $view = new View();
     $view->user = $user;
     $view->courses = $courses;
     //  $view->user_login = $user->user_login;
     // $view->user_group = $user->user_group;
     $parent_course = Courses::findOneByPK($id);
     $crumbs = Breadcrumbs::getCrumbs($parent_course);
     $view->crumbs = $crumbs;
     $view->page_title = $parent_course->name;
     $view->display('header.php');
     if (isset($id)) {
         $view->display('courses/child-list.php');
     } else {
         $view->display('courses/list.php');
     }
     $view->display('footer.php');
 }
Exemple #4
0
 /**
  * 渲染模板
  * @param string $tpl 模板路径,如果为空则用类名作为模板名
  */
 protected function display($tpl = '', $data = [])
 {
     if ($tpl == '') {
         $tpl = $this->_widgetName;
     }
     $tpl = '../' . $tpl;
     $this->_view->display($tpl, $data);
 }
 public function actionAdd()
 {
     $courses = Courses::findAll();
     $view = new View();
     $view->courses = $courses;
     $view->display('admin/header.php');
     $view->display('admin/courses/add.php');
     $view->display('admin/footer.php');
 }
 public function actionShow()
 {
     $view = new View();
     $lessons = Lessons::findAll();
     $view->lessons = $lessons;
     $view->display('admin/header.php');
     $view->display('admin/lessons/list.php');
     $view->display('admin/footer.php');
 }
 public function actionRegister()
 {
     $auth = Auth::checkAuth();
     if (!$auth) {
         $view = new View();
         $view->display('header.php');
         $view->display('auth/register.php');
         $view->display('footer.php');
     } else {
         header("Location: " . BASE_PATH . 'users/');
     }
 }
 public function actionEdit()
 {
     $auth = Auth::checkAuth();
     if (!$auth) {
         header("Location: " . BASE_PATH . 'auth/');
     }
     $user = Users::findOneByPK($auth);
     $user->getProfile();
     $view = new View();
     $view->user = $user;
     $view->display('header.php');
     $view->display('users/edit_profile.php');
     $view->display('footer.php');
 }
Exemple #9
0
 public function actionPanel()
 {
     $auth = Auth::checkAuth();
     $view = new View();
     $view->auth = $auth;
     if ($auth) {
         $user = Auth::getUser();
         $view->display('header.php');
         $view->display('admin/main.php');
         $view->display('footer.php');
         $view->admin = $admin;
     } else {
         header("Location: /learns/");
     }
 }
Exemple #10
0
 public function actionJSTasks()
 {
     $task_list = Index::getTaskList();
     $view = new View();
     if (isset($_GET['task'])) {
         $task = 'jstasks/' . $_GET['task'] . '.php';
     } else {
         $task = 'jstasks/tasklist.php';
     }
     $view->date = $date_start;
     $view->task_list = $task_list;
     $view->display('header.php');
     $view->display($task);
     $view->display('footer.php');
 }
 public function actionLesson()
 {
     $lesson_id = $_GET['lesson_id'];
     $view = new View();
     //  $view->user_login = $user->user_login;
     // $view->user_group = $user->user_group;
     if (isset($lesson_id)) {
         $view->display('header.php');
         $view->display('lessons/lesson.php');
         $view->display('footer.php');
     } else {
         header("HTTP/1.1 404 Not Found");
         $view->display('errors/404.php');
     }
 }
 /**
  * Messages Example
  * @return null
  */
 public function messageAction()
 {
     $View = new View('examples/message');
     $View->assign('_title_', _('Message Examples'));
     $View->assign('_message_', "Ejemplo de como abrir un mensaje desde el controlador");
     $View->display();
 }
Exemple #13
0
 public function display()
 {
     $model = $this->getModel();
     $this->itemsTable = $model->getTable();
     //$this->_layout= 'bs3';
     parent::display();
 }
Exemple #14
0
 public function action_generator()
 {
     $series = Series::get_all();
     $view = new View();
     $view->series = $series;
     $view->display('cards/cards_generator.php');
 }
Exemple #15
0
 public function actionAll()
 {
     $items = News::getAll();
     $view = new View();
     $view->items = $items;
     $view->display('view.php');
 }
 public function actionLogView()
 {
     $log = file_get_contents(__DIR__ . '/../e_logs/Errors.txt');
     $view = new View();
     $view->log = $log;
     $view->display('admin/logview.php');
 }
Exemple #17
0
 public function index()
 {
     $view = new View();
     $view->errors = $this->errors;
     $view->warnings = $this->warnings;
     $view->display('error404', 'index');
 }
Exemple #18
0
 protected function actionEdit()
 {
     $model = new ArticleClass();
     $view = new View();
     $view->news = $model->getAll();
     if (isset($_GET['id'])) {
         $id = $_GET['id'];
         $view->new_article = $model->getOne($id);
     }
     if (isset($_POST['edit'])) {
         if (!empty($_POST['title']) and !empty($_POST['text'])) {
             $title = $_POST['title'];
             $text = $_POST['text'];
             $id = $_POST['id'];
             $model->updateArticle($title, $text, $id);
             $view->msg = 'Статья изменена';
             $view->title = $title;
             $view->text = $text;
             $view->new_article = $model->getOne($id);
         } else {
             $view->new_article = $model->getOne($id);
             $view->msg = 'Заполните все графы';
         }
     }
     if (isset($_POST['no_edit'])) {
         header("Location: ./editor.php");
     }
     $view->display('../view/edit.php');
 }
 function newsshow()
 {
     $data = M('news')->getnewsinfo(intval($_GET['id']));
     View::assign(array('data' => $data));
     $this->showabout();
     View::display('index/show.html');
 }
Exemple #20
0
 public function display($template = '')
 {
     if (method_exists($this, '_beforeDisplay')) {
         // 执行显示模板之前需要的操作
         $this->_beforeDisplay();
     }
     $appPath = \Pandaphp::get('appPath');
     if (empty($template) || 0 !== strpos($template, $appPath)) {
         $viewDirname = \Pandaphp::shell('Config::get', 'dirname_view');
         $templateFilePath = $appPath . MODULE_NAME . '/' . $viewDirname . '/';
         $templateTheme = \Pandaphp::shell('Config::get', 'template_theme');
         if ($templateTheme) {
             $templateFilePath .= $templateTheme . '/';
         }
         $templateFilePath .= lcfirst(CONTROLLER_NAME) . '-' . ACTION_NAME;
         $templateFilePath .= \Pandaphp::shell('Config::get', 'template_suffix');
     } else {
         $templateFilePath = $template;
     }
     if (\Pandaphp::shell('File::isExist', $templateFilePath)) {
         View::display($templateFilePath);
     } else {
         \Pandaphp::shell('Error::halt', $templateFilePath . ' 模板不存在!');
     }
 }
Exemple #21
0
 public function display($tpl = null)
 {
     $params = JComponentHelper::getParams('com_staticcontent');
     $base_directory = $params->get('base_directory');
     $this->sef = JFactory::getConfig()->get('sef', 0);
     $this->base_directory = empty($base_directory) ? '' : JPath::clean($base_directory);
     if (!JFolder::exists($this->base_directory) && !empty($this->base_directory)) {
         JFolder::create($this->base_directory);
         JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_STATICCONTENT_HTML_CREATED_DIRECTORY_MESSAGE', $this->base_directory));
     }
     if (JFolder::exists($this->base_directory) && !empty($this->base_directory)) {
         if ($this->sef == 0) {
             $this->_layout = 'message';
             $this->message = 'COM_STATICCONTENT_HTML_SEF_DISABLED';
         } else {
             $this->items = JFolder::files($this->base_directory, '.html', true, true);
             foreach ($this->items as &$item) {
                 $item = JPath::clean($item);
                 $path = JPath::clean($this->base_directory . DIRECTORY_SEPARATOR);
                 $item = str_replace($path, '', $item);
                 $item = str_replace(DIRECTORY_SEPARATOR, '/', $item);
             }
             $this->baseUri = rtrim($params->get('base_url'), '/') . '/';
         }
     } else {
         $this->_layout = 'message';
         $this->message = 'COM_STATICCONTENT_HTML_CONFIG_DIRECTORY';
     }
     $this->addToolbar();
     parent::display($tpl);
 }
Exemple #22
0
 public function fireAction($input = null)
 {
     $status = false;
     $parsedInputCoordinates = $this->parseInputCoordinates($input);
     if ($parsedInputCoordinates) {
         $row = $this->getRowNumFromName($parsedInputCoordinates[0]);
         $col = $parsedInputCoordinates[1];
         if ($row && $col) {
             $status = $this->fire($row, $col);
         }
     }
     //display
     $view = new \View();
     $view->grid = $this->board->getGrid();
     $view->symbols = $this->getBoardSymbols();
     $view->rows = $this->getRowsNames();
     $view->cols = $this->getColsNames();
     $view->msg = $this->getMessageByStatus($status);
     $view->tries = $this->board->getTries();
     $view->display('Cli/board');
     //Reset the game if it's over
     if ($this->isGameOver()) {
         $this->reset();
     }
 }
Exemple #23
0
	function run($action = 'main', $layout = 'layout') {	
		$db = new Db(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME);		
		if(substr($action, -1) == '/') { // remove last slash if exists
			$action = substr($action, 0, -1);
		}
		$action = str_replace('/', '_', $action);				
		$controller = WWW_ROOT . '/controllers/' . $action . '.php';
		
		if(strcmp(realpath($controller), $_SERVER['DOCUMENT_WWW_ROOT'])) {		
					
			$view = new View($action, $layout);
			
			if(isset($_SESSION['user'])) {
				$user = $_SESSION['user'];
				$view->set('user', $user);
			}
			
			if(is_file($controller)) {
				include($controller);								
			} else {
				$view->changeAction('404');				
			}
			$view->set('user', $user);			
			$view->display();
		} else {			
			trigger_error('Hacker attack from IP:' . $_SERVER['REMOTE_ADDR']);
			die();
		}
	}
Exemple #24
0
 function run()
 {
     $router = new Router();
     try {
         /** @var RouterResult $result */
         $result = $router->process($this->config['routes']);
         $actionName = $result->getActionName();
         $controllerName = $result->getControllerName();
         $params = $result->getParams();
         /** @var Controller $controller */
         $controller = new $controllerName();
         $controller->setParams($params);
         if ($controller instanceof \Framework\Config\ConfigAwareInterface) {
             $controller->setConfig($this->config);
         }
         $viewData = $controller->{$actionName}();
         if ($controller->getUseTemplate() == true) {
             $template = $result->getController() . '/' . $result->getAction();
             $useLayout = $controller->getUseLayout();
             $view = new View();
             $view->display($viewData, $template, $useLayout);
         }
     } catch (Exception\NotFoundException $e) {
         header("HTTP/1.0 404 Not Found");
         $message = $this->config['environment'] === \Framework\App::DEVELOPMENT_ENVIRONMENT ? 'Page Not Found' : $e->getMessage();
         $view = new View();
         $view->display(['message' => $message], 'error/error');
     } catch (Exception\BaseException $e) {
         header("HTTP/1.0 500 Internal Server Error");
         $message = $this->config['environment'] === \Framework\App::DEVELOPMENT_ENVIRONMENT ? 'Internal Server Error' : $e->getMessage();
         $view = new View();
         $view->display(['message' => $message], 'error/error');
     }
 }
 public function actionAllThemes()
 {
     //Создание необходимых объектов:
     $objThemeModel = new ThemesModel();
     $viewAllInfo = new View();
     //Проверка пользовательских данных и создание свойств для вывода инфо:
     $varPage = intval($_GET['page']);
     try {
         //Добавление новой темы + работа с данными таблицы сообщений:
         if (!empty($_POST['text']) && !empty($_POST['titleTheme']) && strlen($_POST['titleTheme']) < 120) {
             //Проверка на повторяемость темы:
             $idTheme = $objThemeModel->actRepTheme($_POST['titleTheme']);
             if (!empty($idTheme)) {
                 throw new ErrUser($this->viewErrDataUserTheme(2, $idTheme));
             } else {
                 //Создание необходимых переменных
                 $arr = $this->getCheckVal([$_POST['text'], $_POST['titleTheme']]);
                 $text = $arr[0];
                 $titleTheme = $arr[1];
                 $login = $_SESSION['login'];
                 $avatar = $_SESSION['avatar'];
                 //Обработка BB текста сообщения:
                 $text = $this->actText($text);
                 //Добавление новой темы:
                 $objThemeModel->addNewTheme($titleTheme, $login);
                 //Определение ID новой темы:
                 $idNewTheme = $objThemeModel->getNewThemeID();
                 //Добавление сообщения новой темы в таблицу сообщений:
                 $objThemeModel->addMessNewTheme($idNewTheme[0]['id'], $text, $login, $avatar);
                 //Создание маршкера ошибки повторяемой темы:
                 throw new ErrUser("" . $this->viewErrDataUserTheme(3, $idNewTheme[0]['id']) . "");
             }
         } else {
             if ((empty($_POST['text']) || empty($_POST['titleTheme']) || strlen($_POST['titleTheme']) > 120) && isset($_POST['ok'])) {
                 throw new ErrUser($this->viewErrDataUserTheme(1));
             }
         }
     } catch (ErrDBModel $e) {
         $viewAllInfo->Err = $e->getMessage();
     } catch (ErrUser $e) {
         $viewAllInfo->ErrUser = $e->getMessage();
     }
     try {
         //Доп. расчёты для постраничной навигации:
         $varSumThemes = $objThemeModel->actSumThemes();
         $varVarPage = $this->getVarPage($varPage, $varSumThemes[0]["COUNT(*)"]);
         //Выборка тем с учётом постраничной навигации:
         $varAllThemes = $objThemeModel->getAllThemes($varVarPage[0]);
     } catch (ErrDBModel $e) {
         $viewAllInfo->Err = $e->getMessage();
     }
     //Вывод информации:
     $viewAllInfo->ctrl = 'Themes';
     $viewAllInfo->act = 'AllThemes';
     $viewAllInfo->page = $varVarPage[1];
     $viewAllInfo->sumData = $varSumThemes[0]["COUNT(*)"];
     $viewAllInfo->viewAllThemes = $varAllThemes;
     $viewAllInfo->display('ViewAllThemes.php');
 }
 public function actionShow()
 {
     $courses = Courses::findAllByColumn('parent_id', 0);
     $auth = Auth::checkAuth();
     if ($auth) {
         $user = Users::findOneByPK($auth);
         $user->getProfile();
     }
     $view = new View();
     $view->user = $user;
     $view->courses = $courses;
     //  $view->user_login = $user->user_login;
     // $view->user_group = $user->user_group;
     $view->display('header.php');
     $view->display('content.php');
     $view->display('footer.php');
 }
Exemple #27
0
 public function doView()
 {
     $areaService = new AreaService();
     $areaId = intval(Request::get("view_area_id"));
     $areaVo = $areaService->getByPrimary($areaId);
     View::set("AreaViewValue", $areaVo);
     View::display("View");
 }
 public function actionOne()
 {
     $id = $_GET['add_cart'];
     $item = OrdersModel::findOne($id);
     $view = new View();
     $view->items = $item;
     echo $view->display("/cart.php");
 }
Exemple #29
0
 public function actionOne()
 {
     $id = $_GET['id'];
     $item = News::getOne($id);
     $view = new View();
     $view->assign('item', $item);
     $view->display('news/one.php');
 }
Exemple #30
0
 public function actionOne()
 {
     $id = $_GET['id'];
     $news = News::getOne($id);
     $view = new View();
     $view->item = $news;
     $view->display('news/one.php');
 }