Example #1
0
 public function marketAction()
 {
     $this->_helper->layout()->setLayout('business');
     $form = new MarketFilterForm();
     $project = new Project();
     $select = $project->select()->setIntegrityCheck(false)->from('projects');
     $paginator = Zend_Paginator::factory($project->fetchAll($select));
     $paginator->setCurrentPageNumber($this->_request->getParam('page', 1))->setItemCountPerPage(1);
     $this->view->projects = $paginator;
     $this->view->form = $form;
 }
Example #2
0
 public function showMap()
 {
     $projects = DB::table('projects')->take(10)->get();
     $projects_all = Project::select('id', 'geo_lat', 'geo_lng')->hasGeo()->get();
     $categories = Category::geocoded();
     foreach ($categories as $key => $category) {
         $pivot = DB::table('project_category')->where('category_id', $category->id)->lists('project_id');
         $categories[$key] = array_add($categories[$key], 'projects_pivot', $pivot);
     }
     $data = compact('projects', 'projects_all', 'categories');
     return view('home.map', $data);
 }
Example #3
0
 public function postProjectsSort($param)
 {
     $lang = Cookie::get('lang', 'ru');
     $sort = Cookie::get("sort_{$param}", 'ASC');
     $load = Input::get('load');
     $projects = Project::select('project_id', 'project_alias', "project_keywords_{$lang}", "project_description_{$lang}", "project_name_{$lang}", "project_text_{$lang}", "project_image_preview", "project_date_start", "project_date_stop", "updated_at")->orderBy($param, $sort)->limit($load)->get();
     $projects_count = Project::count();
     if ($sort == 'ASC') {
         Cookie::queue("sort_{$param}", 'DESC');
     } else {
         Cookie::queue("sort_{$param}", 'ASC');
     }
     $tpl = View::make('layouts.projects')->with(array('projects' => $projects, 'projects_count' => $projects_count, 'lang' => $lang))->render();
     return Response::json(array('success' => true, 'status' => 200, 'tpl' => $tpl, 'param' => $param, 'sort' => $sort));
 }
Example #4
0
 /**
  * function for send ajax request to view
  *
  * @return Response
  */
 public function listingJson()
 {
     //$query = Building::all();
     $query = Project::select('id', 'name', 'address', 'province', 'changed_by', 'created_at')->with('User')->get();
     return Datatable::collection($query)->addColumn('name', function ($model) {
         return ucfirst($model->name);
     })->addColumn('address', function ($model) {
         return $model->address;
     })->addColumn('province', function ($model) {
         return $model->province;
     })->addColumn('created_at', function ($model) {
         return $model->created_at->format('d-m-Y');
     })->addColumn('created_by', function ($model) {
         return $model->user->name;
     })->addColumn('show', function ($model) {
         return '<a href="' . action('ProjectsController@detail', $model->id) . '" class="btn btn-small btn-primary btn-constant"><i class="fa fa-eye fa-fw"></i></a>';
     })->addColumn('edit', function ($model) {
         return '<a href="' . action('ProjectsController@edit', $model->id) . '" class="btn btn-small btn-success btn-constant"><i class="fa fa-edit fa-fw"></i></a>';
     })->addColumn('delete', function ($model) {
         return '<form action="' . action('ProjectsController@delete', $model->id) . '" method="POST"><button  type="submit" class="btn  btn-small btn-danger btn-constant" onclick = "return confirm(\'Are you sure?\')"><i class="fa fa-times fa-fw"></i></button></form>';
     })->searchColumns('name', 'address', 'province')->orderColumns('id', 'name', 'address', 'province', 'created_at')->make();
 }
Example #5
0
 /**
  * [index - This is for the typeahead lookups, restfull routes are configured in routes.php (/api/v1/)]
  * @return [json] [typeahead json]
  */
 public function index()
 {
     if (Input::get('q')) {
         $datums = Project::select('name AS value', 'id', 'company_id')->where('name', 'like', '%' . Input::get('q') . '%')->take(50)->get();
         foreach ($datums as $datum) {
             $datum->tokens = explode(' ', $datum->value);
         }
         return Response::json($datums);
     } else {
         return Response::json(Project::select('name AS value', 'id', 'company_id')->orderBy('updated_at', 'DESC')->take(50)->get());
     }
 }
Example #6
0
     } else {
         $data[] = 'No record found.';
     }
     return Response::json($data);
 });
 Route::get('company/details/{id}', array('as' => 'company.dt', 'uses' => 'CompanyController@details'));
 Route::get('ra-company', array('as' => 'company.ra', 'uses' => 'CompanyController@ra'));
 Route::put('company/approve/{id}', array('as' => 'company.a', 'uses' => 'CompanyController@a'));
 Route::put('company/denied/{id}', array('as' => 'company.d', 'uses' => 'CompanyController@d'));
 Route::get('ra-company/details/{id}', array('as' => 'ra.company.dt', 'uses' => 'CompanyController@ra_details'));
 Route::resource('project', 'ProjectController');
 Route::get('project/lists/{query}', function ($query) {
     // $data = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
     //    return Response::json($data);
     $data = array();
     $results = Project::select('project_name')->where('status', '=', '2')->where('project_name', 'LIKE', '%' . $query . '%')->get();
     if (count($results) > 0) {
         foreach ($results as $row) {
             $data[] = strtolower($row->project_name) . "";
         }
     } else {
         $data[] = 'No record found.';
     }
     return Response::json($data);
 });
 Route::get('project/details/{id}', array('as' => 'project.dt', 'uses' => 'ProjectController@details'));
 Route::get('ra-projects', array('as' => 'project.ra', 'uses' => 'ProjectController@ra'));
 Route::put('project/approve/{id}', array('as' => 'project.a', 'uses' => 'ProjectController@a'));
 Route::put('project/denied/{id}', array('as' => 'project.d', 'uses' => 'ProjectController@d'));
 Route::get('ra-project/details/{id}', array('as' => 'ra.project.dt', 'uses' => 'ProjectController@ra_details'));
 Route::post('projects/getarea', 'ProjectController@getarea');