Example #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));
     }
 }
Example #2
0
       <div class="btn-group-vertical">
          <!-- Ako e najaven kako Kompanija da mozi da dodaj  -->
          <?php 
if ($_SESSION['userType'] == 'company') {
    echo htmlspecialchars_decode("<button onclick= &quot; location.href='newproject.php' &quot; type= &quot; button &quot; class= &quot; btn btn-success btn-md &quot; >New Project</button>");
}
echo htmlspecialchars_decode("\n                <button type='button' class='btn btn-success btn-md' onclick= &quot; location.href='?p=coding'; &quot; >Coding</button>\n                <button type='button' class='btn btn-success btn-md' onclick= &quot; location.href='?p=design'; &quot; >Design</button>\n                <button type='button' class='btn btn-success btn-md' onclick= &quot; location.href='?p=communication'; &quot; >Communication</button>\n                <button type='button' class='btn btn-success btn-md' onclick= &quot; location.href='?p=education'; &quot; >Education</button>\n            ");
?>
       </div>
    </div>
    
    <?php 
if (isset($_GET['signup'])) {
    //if signing up for project execute this
    $projectObj = new Project();
    $r = $projectObj->signUpForProject($_GET['signup'], $_SESSION['userID']);
    if ($r) {
        echo "Signed up successfully!";
    } else {
        echo "Signup failed!";
    }
} else {
    //if not signing up execute this
    ?>


   <div class="col-md-8">
    <?php 
    $projectObj = new Project();
    $projects;
    if (isset($_GET['p'])) {