Example #1
0
 /**
  * [getData]
  * @return [type] [description]
  */
 public function getData()
 {
     $Model = $this->modelName;
     $all_reminders = $Model::all($this->dataTableColumns);
     $data = [];
     foreach ($all_reminders as $reminder) {
         // load relations
         $load_curr_project = $reminder->project;
         $load_curr_user = $reminder->user;
         $curr_reminder = $reminder;
         Debugbar::info($reminder);
         if (isset($reminder->user_id) && isset($reminder->project_id)) {
             $curr_proj = (object) ['id' => $reminder->reminder_id, 'name' => $reminder->project->name];
             $curr_user = (object) ['id' => $reminder->user_id, 'username' => $reminder->user->username];
             $curr_entry = (object) ['DT_RowId' => 'row_' . $reminder->id, 'reminders' => $curr_reminder, 'users' => $curr_user, 'projects' => $curr_proj];
             $data[] = $curr_entry;
         }
     }
     $all_projects = Project::orderBy('name', 'DESC')->get(['id', 'name']);
     $projects = [];
     foreach ($all_projects as $project) {
         $tmp_project = (object) ['value' => $project->id, 'label' => $project->name];
         $projects[] = $tmp_project;
     }
     $all_users = User::all(['id', 'username']);
     $users = [];
     foreach ($all_users as $user) {
         $tmp_user = (object) ['value' => $user->id, 'label' => $user->username];
         $users[] = $tmp_user;
     }
     $ret = ['data' => $data, 'projects' => $projects, 'users' => $users];
     return Response::json($ret);
 }
 private function getProjects()
 {
     $projects = [];
     foreach (\Project::orderBy('title', 'ASC')->get() as $project) {
         $projects[$project['id']] = $project['title'];
     }
     return $projects;
 }
Example #3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (Input::get('search') == null || Input::get('search') == '') {
         $projects = Project::orderBy('created_at', 'DESC')->paginate(5);
     } else {
         $projects = Project::where('title', 'like', '%' . Input::get('search') . '%')->orderBy('projects.created_at', 'DESC')->paginate(5);
     }
     return View::make('admin/projects/index', compact('projects'));
 }
Example #4
0
 public function getAllProjects()
 {
     $all_projects = Project::orderBy('name', 'ASC')->get(['id', 'name', 'company_id']);
     $projects = [];
     foreach ($all_projects as $project) {
         $projects[] = (object) ['value' => $project->id, 'label' => utf8_encode($project->company_id . '|' . $project->name)];
     }
     return $projects;
 }
 public function index()
 {
     $projects = Project::orderBy('sortorder')->get();
     $miscs = Misc::all();
     $bio = Misc::where('name', '=', 'bio')->firstOrFail();
     $resumeURL = Misc::where('name', '=', 'resumeURL')->firstOrFail();
     $githubURL = Misc::where('name', '=', 'githubURL')->firstOrFail();
     return View::make('projects.index')->with('projects', $projects)->with('bio', $bio)->with('resumeURL', $resumeURL)->with('githubURL', $githubURL);
 }
Example #6
0
 /**
  * Get paginated projects.
  *
  * @param int  $page  Number of projects per page
  * @param int  $limit Results per page
  * @param bool $all   Show published or all
  *
  * @return StdClass Object with $items and $totalItems for pagination
  */
 public function paginate($page = 1, $limit = 10, $all = false)
 {
     $result = new \StdClass();
     $result->page = $page;
     $result->limit = $limit;
     $result->totalItems = 0;
     $result->items = array();
     $query = $this->project->orderBy('created_at', 'DESC')->where('lang', $this->getLang());
     $projects = $query->skip($limit * ($page - 1))->take($limit)->get();
     $result->totalItems = $this->totalProjects();
     $result->items = $projects->all();
     return $result;
 }
Example #7
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function show($page = NULL)
 {
     parent::show();
     if (is_numeric($page)) {
         $page = Page::find($page);
     }
     if ($page == NULL) {
         return View::make('404', compact('settings'));
     }
     $projects = Project::orderBy('id', 'asc')->paginate(2);
     $seo = $page->seo;
     $banner = TRUE;
     return View::make('pages.show', compact('page', 'banner', 'settings', 'seo', 'projects'));
 }
Example #8
0
 /**
  * [getData - get all projects data for DT]
  * @return [json] [DT compatible object]
  */
 public function getData($model = null)
 {
     $Model = $this->modelName;
     $num_skip = 0;
     $num_items = 10;
     $recordsTotal = 0;
     $recordsFiltered = 0;
     if (isset($_GET['start'])) {
         $num_skip = (int) $_GET['start'];
     }
     if (isset($_GET['length'])) {
         $num_items = (int) $_GET['length'];
     }
     if (isset($_GET['search'])) {
         $search_value = $_GET['search']['value'];
     }
     $all_projects = Project::orderBy('projects.id', 'DESC');
     if ($model !== null) {
         $all_projects->where('projects.company_id', '=', (int) $model->id);
         if (!empty($search_value)) {
             $all_projects->whereRaw("(projects.name LIKE '%" . $search_value . "%')");
         }
     } else {
         if (!empty($search_value)) {
             $all_projects->join('companies', 'projects.company_id', '=', 'companies.id')->whereRaw("(projects.name LIKE '%" . $search_value . "%' OR companies.bedrijfsnaam LIKE '%" . $search_value . "%')");
         }
     }
     $recordsTotal = $all_projects->count();
     $recordsFiltered = $recordsTotal;
     if ($num_skip > 0) {
         $all_projects->skip($num_skip);
     }
     $all_projects = $all_projects->take($num_items)->get();
     Debugbar::info(count($all_projects));
     $data = [];
     foreach ($all_projects as $project) {
         // load relations
         $load_curr_company = $project->company;
         $curr_company = $project->company !== NULL ? (object) ['id' => $project->company_id, 'bedrijfsnaam' => utf8_encode($project->company->bedrijfsnaam)] : (object) null;
         $data[] = (object) ['DT_RowId' => 'row_' . $project->id, 'projects' => $project, 'companies' => $curr_company];
     }
     $ret = ['data' => $data, 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'companies' => $this->getAllCompanies()];
     return Response::json($ret);
 }
Example #9
0
    }
}
Route::get('thumbtest', function () {
    $images = Image::all();
    $html = "";
    foreach ($images as $image) {
        $source = $image->url;
        $dest = public_path() . "/thumbs/" . $image->id . ".jpg";
        $html .= "Source: " . $image->url . " --- Dest: {$dest}<br>";
        make_thumb($source, $dest, 100);
    }
    return $html;
});
Route::get('publish', function () {
    ob_start();
    $projects = Project::orderBy('sortorder')->get();
    $bio = Misc::where('name', '=', 'bio')->firstOrFail();
    $resumeURL = Misc::where('name', '=', 'resumeURL')->firstOrFail();
    $githubURL = Misc::where('name', '=', 'githubURL')->firstOrFail();
    $images = Image::all();
    foreach ($images as $image) {
        $source = $image->url;
        $dest = public_path() . "/thumbs/{$image->id}.jpg";
        echo "Writing thumbnail {$dest}...";
        if (make_thumb($source, $dest, 200)) {
            echo "success";
            $image->thumbnail = asset("thumbs/{$image->id}.jpg");
        } else {
            echo "failure";
            $image->thumbnail = $source;
        }
 /**
  * @param int $limit
  * @return mixed
  */
 public function getExamples($limit = 4)
 {
     return $this->project->orderBy('date', 'desc')->take($limit)->get();
 }