41 lines
2.1 KiB
PHP
41 lines
2.1 KiB
PHP
<?php
|
|
class default_guide extends SYSTEM\PAGE\Page {
|
|
private $guide = null;
|
|
public function __construct($guide){
|
|
$this->guide = $guide;
|
|
}
|
|
public static function js(){
|
|
return array( new PPAGE('default_guide/js/default_guide.js'));}
|
|
public static function css(){
|
|
return array( new PPAGE('default_guide/css/default_guide.css'));}
|
|
public static function comments($guide){
|
|
$result = '';
|
|
$comments = \SQL\GO_TRAINER_GENERATE_COMMENTLIST::QA(array($guide));
|
|
foreach($comments as $row){
|
|
$comment['body'] = $row['body'];
|
|
$comment['comment_created'] = \SYSTEM\time::time_ago_string(strtotime($row['created']));
|
|
$comment['comment_last_edit'] = \SYSTEM\time::time_ago_string(strtotime($row['last_edit']));
|
|
$comment['comment_author_arr'] = \SQL\GO_TRAINER_ID_TO_USERNAME::Q1(array($row['author']));
|
|
$comment['comment_author'] = $comment['comment_author_arr']['username'];
|
|
$result .= SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_guide/tpl/default_comment.tpl'))->SERVERPATH(), $comment);
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
public function html(){
|
|
$vars = array();
|
|
$guidedata = \SQL\GO_TRAINER_GET_GUIDE::Q1(array($this->guide));
|
|
$vars['id'] = $guidedata['id'];
|
|
$vars['title'] = $guidedata['title'];
|
|
$vars['rating'] = rate::rating($guidedata['id']);
|
|
$vars['last_edit'] = \SYSTEM\time::time_ago_string(strtotime($guidedata['last_edit']));
|
|
$vars['text'] = $guidedata['body'];
|
|
$vars['new_comment'] = comment::new_comment($vars['id']);
|
|
$vars['commentlist'] = $this->comments($this->guide);
|
|
$vars['guide_author_arr'] = \SQL\GO_TRAINER_ID_TO_USERNAME::Q1(array($guidedata['author']));
|
|
$vars['author'] = $vars['guide_author_arr']['username'];
|
|
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('demo_basic'));
|
|
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('time'));
|
|
return SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_guide/tpl/default_guide.tpl'))->SERVERPATH(), $vars);
|
|
}
|
|
} |