コード例 #1
0
ファイル: file.php プロジェクト: Nowhit/onliner-test
 public function get_user_id()
 {
     if (!isset($this->data['user_id'])) {
         $this->data['user_id'] = file_model::get_user_id($this->get_id());
     }
     return $this->data['user_id'];
 }
コード例 #2
0
ファイル: index.php プロジェクト: Nowhit/onliner-test
 public static function index()
 {
     $files = file_model::get_files(array('orders' => array('file_add_datetime' => 'desc'), 'limit' => 7, 'page' => 1));
     $users = user_model::get_users(array('orders' => array('user_signin_datetime' => 'desc'), 'limit' => 7, 'page' => 1));
     view_essence::assign('breadcrumb', 'Главная');
     view_essence::assign('users', $users);
     view_essence::assign('files', $files);
     view_essence::display('index/index');
 }
コード例 #3
0
ファイル: files.php プロジェクト: Nowhit/onliner-test
 public static function view($current_page = 1, $current_order = 'file_add_datetime', $current_order_direction = 'desc')
 {
     $files = file_model::get_files(array('orders' => array($current_order => $current_order_direction), 'limit' => 25, 'page' => $current_page));
     $total_files = file_model::get_total_files();
     $pages = ceil($total_files / 25);
     view_essence::assign('breadcrumb', 'Список файлов');
     view_essence::assign('files', $files);
     view_essence::assign('total_files', $total_files);
     view_essence::assign('pages', $pages);
     view_essence::assign('current_page', $current_page);
     view_essence::assign('current_order', $current_order);
     view_essence::assign('current_order_direction', $current_order_direction);
     view_essence::display('files/view');
 }
コード例 #4
0
ファイル: user.php プロジェクト: Nowhit/onliner-test
 public static function view($user_login = '', $current_page = 1, $current_order = 'file_add_datetime', $current_order_direction = 'desc')
 {
     if ($user_login) {
         if ($user = user_model::get_user_by_login($user_login)) {
             $files = file_model::get_files(array('filters' => array('user_id' => $user->get_id()), 'orders' => array($current_order => $current_order_direction), 'limit' => 25, 'page' => $current_page));
             $total_files = file_model::get_total_files($user->get_id());
             $pages = ceil($total_files / 25);
             view_essence::assign('breadcrumb', 'Пользователь ' . $user_login);
             view_essence::assign('user', $user);
             view_essence::assign('files', $files);
             view_essence::assign('total_files', $total_files);
             view_essence::assign('pages', $pages);
             view_essence::assign('current_page', $current_page);
             view_essence::assign('current_order', $current_order);
             view_essence::assign('current_order_direction', $current_order_direction);
             view_essence::display('user/view');
         } else {
             view_essence::display('user/not_found');
         }
     } else {
         request_essence::load_request();
     }
 }
コード例 #5
0
ファイル: file.php プロジェクト: Nowhit/onliner-test
 public static function add_comment($file_id = 0, $comment_parent_id = 0)
 {
     if (!($me = session_essence::get('me'))) {
         request_essence::load_request();
     }
     if ($file_id) {
         if ($file = file_model::get_file_by_id($file_id)) {
             if ($comment_parent_id > 0) {
                 if (!($comment = comment_model::get_comment_by_id($comment_parent_id))) {
                     request_essence::load_request();
                 } else {
                     if ($comment->get_file_id() != $file_id) {
                         request_essence::load_request();
                     }
                 }
             }
             $comment = new comment_object();
             $comment->set_parent_id($comment_parent_id);
             $comment->set_content(data_essence::get('post', 'comment-content', array('trim', 'striptags')));
             $comment->set_file_id($file_id);
             $comment->set_user_id($me->get_id());
             if (comment_model::add_comment($comment)) {
                 request_essence::load_request('file', 'view', array($file_id));
             } else {
                 request_essence::load_request();
             }
         } else {
             request_essence::load_request();
         }
     } else {
         request_essence::load_request();
     }
 }