Ejemplo n.º 1
0
 public function action_index()
 {
     $studentsPerProject = 5;
     $post = $this->request->post();
     $session = Session::instance();
     //$this->request->query('p')
     //print_r($session);
     $res = '';
     if (isset($post['submit'])) {
         if (Project::addComment($post['projectID'], $post['comment'], $post['clientTime'])) {
             $res = "<div id = 'alertDiv' class='alert alert-success'>Comment was added </div>";
             header("Refresh:2; url=projectDetails?pid=" . $_POST['projectID']);
         } else {
             $res = "<div id = 'alertDiv' class='alert alert-success'>Comment wasn't added </div>";
             header("Refresh:2; url=projectDetails?pid=" . $_POST['projectID']);
         }
         $this->response->body(View::factory('header') . View::factory('projectDetails')->set('res', $res));
     } elseif (isset($_GET['signup'])) {
         //if signing up for project execute this
         if (isset($_SESSION['userId'])) {
             $r = Project::signUpForProject($this->request->query('signup'), $_SESSION['userId']);
             $res = '';
             if ($r) {
                 $res = "<div id = 'alertDiv' class='alert alert-success'>Signed up successfully!";
             } else {
                 $res = "<div id = 'alertDiv' class='alert alert-success'>Signed up failed!";
             }
         } else {
             $res = "<div id = 'alertDiv' class='alert alert-success'>Please sign In</div>";
             //ova ne se gleda bez margini
         }
         $this->response->body(View::factory('header') . View::factory('projectDetails')->set('res', $res));
         header("Refresh:2; url=welcome");
     } else {
         $projectID = $this->request->query('pid');
         $currentProject = Project::getProjectByID($projectID);
         //print_r($currentProject);
         $companyDetails = Company::getCompanyInfo($currentProject['fk_CompanyID']);
         $this->response->body(View::factory('header') . View::factory('projectDetails')->set('currentProject', $currentProject)->set('companyDetails', $companyDetails)->set('projectID', $projectID)->set('studentsPerProject', $studentsPerProject)->set('userType', $session->get('userType'))->set('userId', $session->get('userId'))->set('res', $res));
     }
 }
 public function showPortfolio($accountnumber)
 {
     $db = connect_db();
     //get all the stocks the user owns
     $result = $db->query('SELECT DISTINCT stock FROM Brokerage_Transactions WHERE accountnumber=' . $accountnumber);
     $portfolio = array();
     foreach ($result as $row) {
         $elements = array();
         $company = new Company();
         //get company info
         $companyinfo = $company->getCompanyInfo($row['stock']);
         $current_price = $companyinfo->quotes->quote->last;
         //echo '<br>'.$current_price;
         array_push($elements, $row['stock'], $current_price, $this->has_enough_shares($accountnumber, $row['stock']), $current_price * $this->has_enough_shares($accountnumber, $row['stock']));
         array_push($portfolio, $elements);
     }
     $db = NULL;
     return $portfolio;
 }
Ejemplo n.º 3
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/modules/Company.class.php';
$companyId = isset($_GET['companyId']) ? $_GET['companyId'] : 0;
if ($companyId != 0) {
    $companyObj = new Company();
    $companyInfo = $companyObj->getCompanyInfo($companyId, false);
    if (count($companyInfo) > 0) {
        ?>

	<form method="POST" class="form-horizontal" id="addCompanyForm">
	<input type="hidden" id="baseName" name="baseName" value="<?php 
        echo __BASENAME__;
        ?>
" />
	<input type="hidden" id="companyId" name="companyId" value="<?php 
        echo $companyId;
        ?>
" />
	<div class="pull-left"><h4>Edit <?php 
        echo $companyInfo['name'];
        ?>
</h4></div>
	<div class="pull-right"><button class="btn btn-primary b" type="submit">Submit Changes</button> &nbsp; <a href="companies.html" class="btn btn-default">Cancel</a></div>
	<div class="clearfix"></div>

	<div id="status-message"></div>

	<div class="control-group">
		<label for="email" class="control-label">Company Name</label>
		<div class="controls">
Ejemplo n.º 4
0
        $r = $projectObj->signUpForProject($_GET['signup'], $_SESSION['userID']);
        if ($r) {
            echo "<div style ='margin:50px;'>Signed up successfully!</div>";
        } else {
            echo "<div style ='margin:50px;'>Signup failed!</div>";
        }
    } else {
        echo "<div style ='margin:50px;'>Please sign In</div>";
        //ova ne se gleda bez margini
    }
} else {
    //if not signing up execute this
    $projectID = $_GET['pid'];
    $currentProject = $projectObj->getProjectByID($projectID);
    $companyObj = new Company();
    $companyDetails = $companyObj->getCompanyInfo($currentProject['fk_CompanyID']);
    //print_r ($companyDetails);
    ?>
   
    
    <div id='main'>
    
     <div class="panel panel-success">
       <div class="panel-heading"> <?php 
    echo $currentProject['ProjectName'];
    ?>
 </div>
       <div class="panel-body">
          <?php 
    echo $currentProject['Category'];
    ?>