示例#1
0
    public function getUser()
    {
        $id = $_GET['i'];
        $prem = Projects::isPremium($id);
        $project = Projects::getAllProjectsById($id, Utils::getUserID());
        $t = '<div class="row">
              <div class="row">
            <div class="col-md-12">';
        if ($prem) {
            $t .= ' <label><input type="checkbox" value="" disabled checked> Premium</label> ';
        } else {
            $t .= ' <label><input type="checkbox" value="" disabled> Premium</label> ';
        }
        $t .= '<div class="row">
             <div class="col-md-12">';
        $t .= '<table id="tab2" class="table table-bordered table-striped">
                        <thead>
                        <tr>
                            <th>Emer projekti</th>
                            <th>Kategoria</th>
                            <th>Like</th>
                            <th>Download</th>
                            <th></th>

                        </tr>
                        </thead>
                        <tbody>';
        for ($i = 0; $i < count($project); $i++) {
            $t .= '<tr>
                                <td>' . $project[$i]->p_name . '</td>
                                <td>' . $project[$i]->c_name . '</td>
                                <td>' . $project[$i]->l_user . '</td>
                                <td>' . $project[$i]->p_down . '</td>
                               <td><button type="submit" onclick="d_p(' . $project[$i]->project_id . ')" id ="delete"  class="btn btn-danger">Delete</td>
                            </tr>';
        }
        $t .= ' </tbody>
                    </table>
                </div>
                </div>
        </div>
    </div>';
        return $t;
    }
示例#2
0
 public function download()
 {
     //Utils::isLogged();
     if (isset($_GET['p'])) {
         $id = $_GET['p'];
         $userId = Utils::getUserID();
         $u_id = Projects::getUserIdForProject($id);
         if ($userId == $u_id) {
             return '/home/download/p?p=' . $_GET['p'];
             //                $this->downloadFinally($id);
         }
         $premium = Projects::isPremium(Utils::getUserID());
         if ($premium == 1) {
             return '/home/download/p?p=' . $_GET['p'];
             //                $this->downloadFinally($id);
         }
         $isrequested = User::isRequested($id, Utils::getUserID());
         if (!empty($isrequested)) {
             return '/home/download/p?p=' . $_GET['p'];
         }
         $sh = Projects::hasUserAnyProject($userId);
         if (empty($sh)) {
             return 2;
         } else {
             return 1;
         }
     } else {
         Redirect::to('home')->send();
     }
 }