Ejemplo n.º 1
0
 public function render()
 {
     // TODO Do not use global
     global $microblogTemplates, $pageTitle, $pageAuthor, $post;
     $postView = new PostView();
     $activitiesView = new ActivitiesView();
     $profileView = new ProfileView();
     $followView = new FollowView();
     $tpl = new \rubisco\text\SimpleTemplate($microblogTemplates);
     $tpl->pageAuthor = $pageAuthor;
     $tpl->pageTitle = $pageTitle;
     $tpl->showLog = '';
     $tpl->login = "******";
     $tpl->infoMessage = $this->m->getLastInfoMessagesAsHTML();
     $tpl->postView = '';
     $tpl->activities = $activitiesView->html();
     $tpl->profile = $profileView->html();
     $tpl->follow = $followView->html();
     if ($this->m->isLogin()) {
         $tpl->showLog = '<li><a href="?showLog=1">Show Log</a></li>';
         $tpl->login = "******";
         $tpl->postView = $postView->html($post['message'], $post['to']);
     }
     $this->m->clearLastInfoMessages();
     $content = $tpl->render('head') . $tpl->render('main') . $tpl->render('foot');
     header('Content-Type: text/html; charset=utf-8');
     header('Content-Length: ' . strlen($content));
     echo $content;
 }
Ejemplo n.º 2
0
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $webuser = new WebUser($_POST);
         if ($webuser->getErrorCount() == 0) {
             if (!empty(WebUserDB::getUsersBy('hockName', $webuser->getHockName()))) {
                 $webuser->setError('hockName', 'HOCKUSER_NAMECLAIMED');
                 SignupView::show($webuser);
             } else {
                 //create a webuser in db
                 $id = WebUserDB::addUser($webuser);
                 if ($id != 0) {
                     //find the hockuser related to this dude
                     $hockusers = HockUserDB::getUsersBy('name', $webuser->getHockName());
                     ProfileView::show($webuser, $hockusers[0]);
                     //HomeView::show();
                 } else {
                     $webuser->setError('userName', 'DBERROR_ADDWEBUSER');
                     SignupView::show($webuser);
                 }
             }
         } else {
             SignupView::show($webuser);
         }
     } else {
         // Initial link
         SignupView::show(null);
     }
 }
 public static function run()
 {
     $action = $_SESSION['action'];
     $arguments = $_SESSION['arguments'];
     switch ($action) {
         case "show":
             $users = UsersDB::getUsersBy('userId', $arguments);
             if (count($users) > 0) {
                 $user = $users[0];
                 if (self::setProfileDataForUser($user->getUserId()) == true) {
                     ProfileView::show();
                 } else {
                     HomeView::show();
                 }
             }
             // 				$user = null;
             // 				$userData = null;
             // 				$users = UsersDB::getUsersBy('userId', $arguments);
             // 				if (count($users) > 0) {
             // 					$user = $users[0];
             // 					$userDataArray = UserDataDB::getUserDataBy('userId', $user->getUserId());
             // 					if (count($userDataArray) > 0)
             // 						$userData = $userDataArray[0];
             // 				}
             // 				$_SESSION['user'] = $user;
             // 				$_SESSION['userData'] = $userData;
             // 				ProfileView::show();
             break;
         case "update":
             break;
         default:
     }
 }
 private function show()
 {
     $arguments = array_key_exists('arguments', $_SESSION) ? $_SESSION['arguments'] : 0;
     // Identify the target user
     $users = UsersDB::getUsersBy('user_id', $arguments);
     $user = $users[0];
     if (!is_null($user)) {
         // Prepare all data to be displayed in the target user's ProfileView
         // --all of their datasets
         // --all of the sensors for each dataset
         // TODO: add 'member since'
         $datasets = DatasetsDB::getDatasetsBy('user_id', $user->getUserId());
         foreach ($datasets as $dataset) {
             $sensors = SensorsDB::getSensorsBy('dataset_id', $dataset->getDatasetId());
             $dataset->setSensors($sensors);
         }
         $_SESSION['user'] = $user;
         $_SESSION['datasets'] = $datasets;
         ProfileView::show();
     } else {
         $_SESSION['user'] = null;
         // TODO:: Consider showing a 'Specified user does not exist' page
         HomeView::show();
     }
 }
Ejemplo n.º 5
0
 public function profile()
 {
     include_once "models/Users.php";
     $this->vars["user"] = unserialize($_SESSION["user"]);
     include_once "views/profile.php";
     ProfileView::render($this->vars, "showProfile");
 }
 public static function show()
 {
     MasterView::showHeader(null);
     MasterView::showNav();
     ProfileView::showContent();
     MasterView::showFooter(null);
 }
 public static function run()
 {
     if (isset($_COOKIE["user"])) {
         ProfileView::show();
     } else {
         HomeView::show();
     }
 }
Ejemplo n.º 8
0
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $document->addScript(JURI::root() . "/media/jquery/jquery-1.7.min.js");
     $document->addScript(JURI::root() . 'components/com_profile/assets/javascript/script.js');
     $user = JXFactory::getUser();
     $this->assignRef('user', $user);
     parent::display($tpl);
 }
Ejemplo n.º 9
0
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $document->addScript(JURI::root() . "/media/jquery/jquery-1.7.min.js");
     $document->addScript(JURI::root() . 'components/com_profile/assets/javascript/script.js');
     $notification = new Notifications();
     $this->assignRef('notification', $notification);
     $document->setTitle(JText::_('COM_PROFILE_LABEL_NOTIFICATION'));
     parent::display($tpl);
 }
Ejemplo n.º 10
0
 public static function show()
 {
     $hockuser = $_SESSION['hockuser'];
     $webuser = $_SESSION['webuser'];
     $arguments = array_key_exists('arguments', $_SESSION) ? $_SESSION['arguments'] : 0;
     if (!is_null($hockuser)) {
         ProfileView::show($webuser, $hockuser);
     } else {
         ProfileView::show(null, null);
     }
 }
 public static function run()
 {
     if (CookieController::cookieExists("session")) {
         if (($user = CookieController::refreshSessionCookie()) === false) {
             header("Location: home");
         } else {
             ProfileView::show($user);
         }
     } else {
         header("Location: home");
     }
 }
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if ($user->getErrorCount() == 0) {
             HomeView::show();
         } else {
             ProfileView::show();
         }
     } else {
         ProfileView::show();
     }
 }
Ejemplo n.º 13
0
 public static function show($webuser, $hockuser)
 {
     if (!is_null($hockuser)) {
         $header = $hockuser->getUserName() . ' Profile Page';
     } else {
         $header = 'null Profile Page';
     }
     MasterView::showHeader($header);
     MasterView::showNav(null);
     ProfileView::showDetails($webuser, $hockuser);
     MasterView::showFooter(null);
 }
Ejemplo n.º 14
0
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_PROFILE_LABEL_APPLICATIONS'));
     $apps = new Applications();
     // contains the user object
     $rows = $apps->getUserDeviceList();
     foreach ($rows as $row) {
         $row->isAuthorized = $apps->isAuthorized($row->authorized);
     }
     $this->assignRef('userDevices', $rows);
     parent::display($tpl);
 }
 public static function run()
 {
     // 		if ($_SERVER["REQUEST_METHOD"] == "POST") {
     // 			$user = new User($_POST);
     // 			if ($user->getErrorCount() == 0)
     // 				HomeView::show();
     // 		    else
     // 				LoginView::show($user);
     // 		} else  // Initial link
     $validUserData = array("user_name" => "Admiral_Ackbar", "skill_level" => "expert", "skill_areas" => array("system-design", "programming", "wiring"), "profile_pic" => "ackbar.jpg", "started_hobby" => "1983-05", "fav_color" => "#ff0000", "url" => "http://www.itsatrap.com", "phone" => "210-458-4436");
     $sampleUser = new UserData($validUserData);
     ProfileView::show($sampleUser);
 }
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $user = new User($_POST);
         if ($user->getErrorCount() == 0) {
             ProfileView::show($user);
         } else {
             LoginView::show($user);
         }
     } else {
         LoginView::show(null);
     }
 }
Ejemplo n.º 17
0
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $userdata = new UserData($_POST);
         if ($userdata->getErrorCount() == 0) {
             ProfileView::show($userdata);
         } else {
             SignupView::show($userdata);
         }
     } else {
         // Initial link
         SignupView::show(null);
     }
 }
Ejemplo n.º 18
0
 function display($tpl = null)
 {
     $user = JXFactory::getUser();
     $this->assignRef('user', $user);
     JForm::addFieldPath(JPATH_COMPONENT . DS . 'models' . DS . 'fields');
     $form = JForm::getInstance('form', JPATH_ROOT . DS . 'components' . DS . 'com_profile' . DS . 'models' . DS . 'forms' . DS . 'details.xml');
     $detailModel = ProfileFactory::getModel('detail');
     $form->bind(array('params' => $detailModel->getDetails($user->id)));
     $this->assignRef('form', $form);
     $document = JFactory::getDocument();
     $document->addScript(JURI::root() . 'media/jquery/jquery-1.7.min.js');
     $document->setTitle(JText::_('COM_PROFILE_LABEL_EDIT_DETAILS'));
     parent::display($tpl);
 }
 public static function show()
 {
     $userData = array_key_exists('userData', $_SESSION) ? $_SESSION['userData'] : null;
     if (!is_null($userData)) {
         $userName = $userData->getUserName();
     }
     $name = $userName . "'s ";
     $_SESSION['headertitle'] = $name != "'s " ? $name . " profile" : "Profile";
     $_SESSION['styles'] = array('site.css');
     MasterView::showHeader();
     MasterView::showNavBar();
     ProfileView::showDetails();
     MasterView::showFooter();
     MasterView::showPageEnd();
 }
 public static function run()
 {
     $user = null;
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $formUser = new User($_POST);
         $user = UsersDB::addUser($formUser);
         if ($user->getErrorCount() == 0) {
             $_POST['user'] = $user;
         }
     }
     if (is_null($user) || $user->getErrorCount() != 0) {
         SignupView::show($user);
     } else {
         ProfileView::show();
     }
 }
Ejemplo n.º 21
0
 public static function show()
 {
     $arguments = array_key_exists('arguments', $_SESSION) ? $_SESSION['arguments'] : 0;
     $hockusers = HockUserDB::getUsersBy('name', $arguments);
     $hockuser = !empty($hockusers) ? $hockusers[0] : null;
     $webuser = null;
     if (is_null($hockuser)) {
         $hockusers = HockUserDB::getUsersBy('alias', $arguments);
         $hockuser = !empty($hockusers) ? $hockusers[0] : null;
     }
     if (!is_null($hockuser)) {
         $webusers = WebUserDB::getUsersBy('hockName', $hockuser->getUserName());
         if (!empty($webusers)) {
             $webuser = $webusers[0];
         }
     }
     if (!is_null($hockuser)) {
         $teams1 = TeamDB::getTeamsBy('uid1', $hockuser->getUserId());
         $teams2 = TeamDB::getTeamsBy('uid2', $hockuser->getUserId());
         $teams3 = TeamDB::getTeamsBy('uid3', $hockuser->getUserId());
         $allteams = array_merge($teams1, $teams2, $teams3);
         if (!is_null($allteams)) {
             $allgames = array();
             foreach ($allteams as $team) {
                 $game = GameDB::getGamesBy('teamid1', $team->getteamId());
                 $game2 = GameDB::getGamesBy('teamid2', $team->getteamId());
                 if (!empty($game)) {
                     array_push($allgames, $game[0]);
                 }
                 if (!empty($game2)) {
                     array_push($allgames, $game2[0]);
                 }
             }
             if (empty($allgames)) {
                 echo '<p>All games is empty</p>';
                 $_SESSION['allgames'] = null;
             } else {
                 usort($allgames, "UserController::cmp");
                 $_SESSION['allgames'] = $allgames;
             }
         }
         ProfileView::show($webuser, $hockuser);
     } else {
         $_SESSION['allgames'] = null;
         ProfileView::show(null, null);
     }
 }
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         //simpleEcho.php;
         $user = new User($_POST);
         $userData = new UserData($_POST);
         //print_r($_FILES); echo '<br>';
         if ($user->getErrorCount() == 0 && $userData->getErrorCount() == 0) {
             ProfileView::show($userData);
         } else {
             SignupView::show($user, $userData);
         }
     } else {
         // Initial link
         SignupView::show(null, null);
     }
 }
 private function newDataset()
 {
     $dataset = null;
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $dataset = new Dataset($_POST);
     }
     $_SESSION['dataset'] = $dataset;
     if (is_null($dataset) || $dataset->getErrorCount() != 0) {
         DatasetView::showNew();
     } else {
         $newDataset = DatasetsDB::addDataset($dataset);
         if ($newDataset->getErrorCount() == 0) {
             $_SESSION['dataset'] = $newDataset;
         }
         ProfileView::show();
         header('Location: /' . $_SESSION['base'] . '/profile/show/' . $newDataset->getUserId());
     }
 }
 public static function run()
 {
     $user = null;
     $userData = null;
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $user = new User($_POST);
         //$dbUser = UsersDB::addUser($user);
         $userData = new UserData($_POST);
         //$_POST["userId"] = $user->getUserId();
         $dbUserData = UsersDB::addUser($user, $userData);
         if ($user->getErrorCount() == 0 && $userData->getErrorCount() == 0) {
             ProfileView::show($user, $userData);
         } else {
             SignupView::show($user, $userData);
         }
     } else {
         SignupView::show(null, null);
     }
 }
Ejemplo n.º 25
0
 public static function run()
 {
     $webuser = NULL;
     $hockuser = NULL;
     $user = NULL;
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $user = new User($_POST);
         $webusers = WebUserDB::getUsersBy('userName', $user->getUserName());
         if (empty($webusers)) {
             $user->setError('userName', 'USER_NAME_DOES_NOT_EXIST');
         } else {
             $webuser = $webusers[0];
         }
     }
     if (!is_null($webuser)) {
         if (strcmp($webuser->getPassword(), $user->getPassword()) == 0) {
             //passwords match.
             //get associated hockuser
             echo "<p>" . $webuser . "</p>";
             $hockusers = HockUserDB::getUsersBy('name', $webuser->getHockName());
             if (empty($hockusers)) {
                 $user->setError('userName', 'HOCK_NAME_UNASSOCIATED_WITH_ACCOUNT');
             } else {
                 $hockuser = $hockusers[0];
             }
         } else {
             //Invalid password
             $user->setError('password', 'PASSWORD_INVALID');
         }
     }
     $_SESSION['user'] = $webuser;
     if (is_null($webuser) || $user->getErrorCount() != 0) {
         LoginView::show($user);
     } else {
         //show profile
         ProfileView::show($webuser, $hockuser);
         //show home
         //HomeView::show();
         //header('Location: /'.$_SESSION['base'].'/user/profile');
     }
 }
Ejemplo n.º 26
0
 function display($tpl = null)
 {
     $user = JXFactory::getUser();
     $this->assignRef('user', $user);
     // use JForm to create standardize
     $form = JForm::getInstance('profileForm', JPATH_ROOT . DS . 'components' . DS . 'com_profile' . DS . 'models' . DS . 'forms' . DS . 'edit.xml');
     $this->assignRef('profileForm', $form);
     $this->assign('userEmail', $user->get('email'));
     $this->assign('userTimezone', $user->getParam('timezone'));
     $this->assign('userLanguage', $user->getParam('language'));
     $this->assign('userAboutMe', $user->getParam('about_me'));
     $this->assign('isIntegration', JXIntegration::isActiveDirectory($user->getParam('integration')));
     /* $this->assignRef('timezoneList', $this->getTimezoneList()); */
     /* /\* defaulted to +8 *\/ */
     /* $jLang = JFactory::getLanguage(); */
     /* $this->assignRef('languageList', $jLang->getKnownLanguages()); */
     $document = JFactory::getDocument();
     $document->addScript(JURI::root() . 'media/jquery/jquery-1.7.min.js');
     $document->setTitle(JText::_('COM_PROFILE_LABEL_EDIT_PROFILE'));
     parent::display($tpl);
 }
    public static function show($user)
    {
        $links = array("New Trip" => "new-trip", "My Trips" => "my-trips", "Log Out" => "log-out");
        ###(HTML)
        ?>
		<!DOCTYPE html>
		<html>
			<?php 
        MasterView::insertHead("/sm_project/css/Form.css", "");
        ?>
			<body>
				<?php 
        MasterView::insertNav($links);
        ProfileView::insertContent($user);
        MasterView::insertFooter(null);
        ?>
			</body>
		</html>
		<?php 
        ###(ENDHTML)
    }
    public static function show($user)
    {
        $links = array("Home" => "home", "Build a Map" => "build-map", "Log Out" => "log-out");
        ###(HTML)
        ?>
		<!DOCTYPE html>
		<html>
			<?php 
        MasterView::insertHead(null);
        ?>
			<body>
				<?php 
        MasterView::insertNav($links);
        ProfileView::insertContent($user);
        MasterView::insertFooter(null);
        ?>
			</body>
		</html>
		<?php 
        ###(ENDHTML)
    }
Ejemplo n.º 29
0
 public static function show($webuser, $hockuser)
 {
     if (!is_null($hockuser)) {
         $header = $hockuser->getUserName() . ' Profile Page';
     } else {
         $header = 'null Profile Page';
     }
     $_SESSION['headertitle'] = $header;
     $_SESSION['styles'] = array('jumbotron.css', 'profile.css', 'games.css');
     MasterView::showHeader();
     MasterView::showNav();
     ProfileView::showDetails($webuser, $hockuser);
     if (array_key_exists('authenticatedUser', $_SESSION)) {
         $authenticatedUser = $_SESSION['authenticatedUser'];
         if (!is_null($authenticatedUser)) {
             if (strcmp($authenticatedUser->getHockName(), $hockuser->getUserName()) == 0) {
                 ProfileView::showUpdateButton();
             }
         }
     }
     MasterView::showPageEnd();
 }
 public static function run()
 {
     $user = null;
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $formUser = new User($_POST);
         if ($formUser->getErrorCount() == 0) {
             $plaintextPassword = $formUser->getPassword();
             $hashedPassword = password_hash($plaintextPassword, PASSWORD_DEFAULT);
             $formUser->setPassword($hashedPassword);
             $user = UsersDB::addUser($formUser);
             if ($user->getErrorCount() == 0) {
                 $_SESSION['user'] = $user;
             }
         } else {
             $user = $formUser;
         }
     }
     if (is_null($user) || $user->getErrorCount() != 0) {
         SignupView::show($user);
     } else {
         ProfileView::show();
     }
 }