public function class1() { $this->template->content = View::instance("v_javascript_class1"); $client_files = array("/js/class1.js"); $this->template->client_files = Utils::load_client_files($client_files); echo $this->template; }
public function __construct() { parent::__construct(); #Specific css is added to an array which already has one element from the parent constructor method. #$this->$client_files[] = "/css/users.css"; # doesn't work so I use the following array_push invocation instead array_push($this->client_files, "/css/users.css"); # this works $this->template->client_files = Utils::load_client_files($this->client_files); }
public function proposal() { // array_push($this->client_files, "/css/styleProposal.css"); $this->client_files[0] = "/css/styleProposal.css"; // replace sitewide.css, don't add an element to the array $this->template->client_files = Utils::load_client_files($this->client_files); $this->template->content = View::instance('v_index_proposal'); echo $this->template; }
public function cardgenerator() { # Set up the view $this->template->content = View::instance("v_javascript_cardgenerator"); # Specify what JS/CSS files we need to load in the view $client_files = array("/css/cardgenerator.css", "/js/cardgenerator.js"); # Load the above specified files $this->template->client_files = Utils::load_client_files($client_files); # Render the view echo $this->template; }
public function index() { # Any method that loads a view will commonly start with this # First, set the content of the template with a view file $this->template->active_tab = 'home'; $this->template->body = View::instance('v_index_landing'); # If this view needs any JS or CSS files, add their paths to this array so they will get loaded in the head $client_files = array(""); $this->template->client_files = Utils::load_client_files($client_files); # Render the view echo $this->template; }
public function __construct() { parent::__construct(); #Specific css is added to an array which already has one element from the parent constructor method. array_push($this->client_files, "/css/posts.css"); # this works $this->template->client_files = Utils::load_client_files($this->client_files); # Make sure user is logged in if they want to use anything in this controller if (!$this->user) { Router::redirect('/users/signupOrLogin/'); } }
public function index() { # Any method that loads a view will commonly start with this # First, set the content of the template with a view file $this->template->content = View::instance('v_index_index'); # Now set the <title> tag $this->template->title = "HSPH Helpdesk"; # If this view needs any JS or CSS files, add their paths to this array so they will get loaded in the head $client_files = array(""); $this->template->client_files = Utils::load_client_files($client_files); # Render the view echo $this->template; }
public function __construct() { parent::__construct(); # Make sure user is logged in if they want to use anything in this controller if (!$this->user) { # Send them to login or signup Router::redirect("/users/signupOrLogin/"); } array_push($this->client_files, "/css/requests.css"); array_push($this->client_files, "/js/requests.js"); array_push($this->client_files, "ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"); $this->template->client_files = Utils::load_client_files($this->client_files); }
public function index() { # Any method that loads a view will commonly start with this # First, set the content of the template with a view file $this->template->content = View::instance('v_index_index'); # Now set the <title> tag $this->template->title = "p2.neokobe.com"; # If this view needs any JS or CSS files, add their paths to this array so they will get loaded in the head $client_files = array("views/css/main.css", "views/js/modernizr-2.6.1.min.js"); $this->template->client_files = Utils::load_client_files($client_files); # Render the view echo $this->template; }
public function __construct() { parent::__construct(); # Make sure user is logged in if they want to use anything in this controller if (!$this->user) { # Send them to login or signup Router::redirect("/users/signupOrLogin/"); } #Specific css is added to an array which already has one element from the parent constructor method. #$this->$client_files[] = "/css/users.css"; # doesn't work so I use the following array_push invocation instead array_push($this->client_files, "/css/peptide.css"); # this works array_push($this->client_files, "//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"); array_push($this->client_files, "//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"); array_push($this->client_files, "http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css"); array_push($this->client_files, "/js/peptide.js"); $this->template->client_files = Utils::load_client_files($this->client_files); }
public function profile($user_name) { #only want logged in users if (!$this->user) { echo "Members only, please login"; return false; } else { # Setup the view $this->template->content = View::instance("v_users_profile"); $this->template->title = $user_name . "'s Profile"; $this->template->content->user_name = $user_name; # Setup client Files $client_files = array("/css/users.css", "/js/users.js"); $this->template->client_files = Utils::load_client_files($client_files); # Render the view echo $this->template; } }
public function index() { # If user is blank, they are not logged in, show the message and don't do anything if (!$this->user) { echo "Members only. <a href='/users/login'>Login</a>"; # Return will force this method to exit here so the rest of the code won't be executed and the profile view won't be displayed. return false; } # Any method that loads a view will commonly start with this # First, set the content of the template with a view file $this->template->content = View::instance('v_calendar'); # Now set the <title> tag $this->template->title = "Event Calendar of " . $this->user->first_name; # If this view needs any JS or CSS files, # add their paths to this array so they will get loaded in the head $client_files = array(""); $this->template->client_files = Utils::load_client_files($client_files); # Render the view echo $this->template; }
public function add() { # Set up the view $this->template->content = View::instance("v_posts_add"); $this->template->title = "Add a new post"; # Set up client files $client_files = array("/js/jquery.form.js"); $this->template->client_files = Utils::load_client_files($client_files); # Render the view echo $this->template; }
public function friends() { # remove any old "following" notices unset($_SESSION['following_notice']); $this->template->content = View::instance('v_posts_all'); # Now set the <title> tag $this->template->title = "My Friend's Posts"; $this->template->content->title = $this->template->title; $client_files = array("/views/css/main.css", "/views/js/modernizr-2.6.1.min.js"); $this->template->client_files = Utils::load_client_files($client_files); # look up ALL the posts from the database, including user information # so that we can show the follow / unfollow links $q = "\n SELECT p.post_id,\n p.created AS post_created,\n p.modified AS post_modified,\n p.content AS post_content,\n u.user_id,\n u.first_name,\n u.last_name,\n u.email,\n u.username\n FROM posts AS p\n JOIN users AS u USING(user_id)\n JOIN users_users AS uu ON uu.user_id_followed = u.user_id\n WHERE uu.user_id = " . $this->user->user_id . "\n ORDER BY p.created DESC\n "; $friend_posts = DB::instance(DB_NAME)->select_rows($q); # pass the posts variable to the template, by creating a "posts" variable "on-the-fly" $this->template->content->all_posts = $friend_posts; echo $this->template; }
public function all() { // only show the profile page for logged-in users and those that have the correct session data (inluding their user_id) if (!$this->user || !isset($_SESSION['user']['user_id'])) { $this->template->content = View::instance('v_users_login'); $this->template->title = "Members Only"; $client_files = array("/views/css/main.css", "/views/js/modernizr-2.6.1.min.js"); $this->template->client_files = Utils::load_client_files($client_files); $this->template->content->error_title = "Members Only"; $_SESSION['users']['errors'][] = "Please use the login form at the top of the page."; echo $this->template; die; } # Get all the users and how many posts they have submitted $q = "\n SELECT u.user_id,\n u.first_name,\n u.last_name,\n u.username,\n CASE\n WHEN\n (SELECT COUNT(*)\n FROM users_users uu\n WHERE uu.user_id = " . $_SESSION['user']['user_id'] . "\n AND uu.user_id_followed = u.user_id\n ) > 0\n THEN 1\n ELSE 0\n END as currentlyFollowing,\n (\n SELECT COUNT(*)\n FROM posts p\n WHERE p.user_id = u.user_id\n ) AS total_posts\n FROM users u\n WHERE u.user_id != " . $_SESSION['user']['user_id'] . "\n ORDER BY total_posts DESC\n "; $all_users = DB::instance(DB_NAME)->select_rows($q); if ($all_users != null) { // prepare the view for display $this->template->content = View::instance('v_users_all'); $this->template->title = "All Users"; $this->template->content->title = $this->template->title; $client_files = array("/views/css/main.css", "/views/js/modernizr-2.6.1.min.js"); $this->template->client_files = Utils::load_client_files($client_files); $this->template->content->all_users = $all_users; echo $this->template; } else { $this->template->content = View::instance('v_users_error'); $this->template->title = "No users!"; $this->template->content->title_error = $this->template->title; $client_files = array("/views/css/main.css", "/views/js/modernizr-2.6.1.min.js"); $_SESSION['users']['errors'][] = "Sorry, the site currently has no users! Quick, <a href=\"/users/signup\">sign up for a new account</a> yourself!"; $this->template->client_files = Utils::load_client_files($client_files); echo $this->template; } }