/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //
     $product = Product::find($id);
     $categories = array('') + Category::all()->lists('name', 'id');
     return View::make('products.create', array('product' => $product, 'categories' => $categories));
 }
Example #2
0
 public static function index()
 {
     return function ($request, $response) {
         $models = Category::all();
         $response->json($models->as_array());
     };
 }
 public function getEdit($id)
 {
     // Find the module using the user id
     $module = Module::find($id);
     // No such id
     if ($module == null) {
         return \View::make('redminportal::pages/404');
     }
     $categories = array();
     foreach (Category::all() as $category) {
         $categories[$category->id] = $category->name;
     }
     $tagString = "";
     foreach ($module->tags as $tag) {
         if (!empty($tagString)) {
             $tagString .= ",";
         }
         $tagString .= $tag->name;
     }
     if (empty($module->options)) {
         $module_cn = (object) array('name' => $module->name, 'short_description' => $module->short_description, 'long_description' => $module->long_description);
     } else {
         $module_cn = json_decode($module->options);
     }
     $pricelists = array();
     foreach (Membership::orderBy('rank')->get() as $membership) {
         $pricelist = Pricelist::where('module_id', $module->id)->where('membership_id', $membership->id)->first();
         if ($pricelist == null) {
             $pricelists[] = array('id' => $membership->id, 'name' => $membership->name, 'price' => '');
         } else {
             $pricelists[] = array('id' => $membership->id, 'name' => $membership->name, 'price' => $pricelist->price);
         }
     }
     return \View::make('redminportal::modules/edit')->with('module', $module)->with('module_cn', $module_cn)->with('imageUrl', 'assets/img/modules/')->with('categories', $categories)->with('tagString', $tagString)->with('pricelists', $pricelists);
 }
 public function search()
 {
     $param['pageNo'] = 1;
     $param['store_name'] = Input::has('store') ? Input::get('store') : '';
     $param['company_name'] = Input::has('company') ? Input::get('company') : '';
     $param['category_id'] = Input::has('category') ? Input::get('category') : '';
     $param['city_id'] = Input::has('city') ? Input::get('city') : '';
     $param['waiting_time_min'] = Input::has('min') ? Input::get('min') : WAITING_TIME_MIN;
     $param['waiting_time_max'] = Input::has('max') ? Input::get('max') : WAITING_TIME_MAX;
     $param['is_all'] = Input::has('is_all') ? true : !Input::has('min');
     $userId = Session::has('user_id') ? Session::get('user_id') : 0;
     $prefix = DB::getTablePrefix();
     $result = DB::table('store')->join('company', 'store.company_id', '=', 'company.id')->leftJoin(DB::raw('(SELECT * FROM ' . $prefix . 'queue WHERE user_id = ' . $userId . ' AND DATE(created_at) = DATE(NOW()) GROUP BY store_id) AS ' . $prefix . 'queues'), 'store.id', '=', 'queues.store_id')->join('status', 'store.id', '=', 'status.store_id')->leftJoin(DB::raw('(SELECT count(*) as cnt, store_id FROM ' . $prefix . 'agent WHERE is_active = 1 GROUP BY store_id) AS ' . $prefix . 'agt'), 'agt.store_id', '=', 'store.id')->join('company_setting', 'company_setting.company_id', '=', 'company.id')->join('category', 'category.id', '=', 'company.category_id')->join('city', 'city.id', '=', 'company.city_id')->select('store.id', 'store.name as store_name', 'store.address as address', 'company.name as company_name', 'company_setting.waiting_time', 'status.current_queue_no', 'status.last_queue_no', 'agt.cnt', 'queues.queue_no');
     if ($param['store_name'] != '') {
         $result = $result->where('store.name', 'like', '%' . $param['store_name'] . '%');
     }
     if ($param['company_name'] != '') {
         $result = $result->where('company.name', 'like', '%' . $param['company_name'] . '%');
     }
     if ($param['category_id'] != '') {
         $result = $result->where('category.id', '=', $param['category_id']);
     }
     if ($param['city_id'] != '') {
         $result = $result->where('city.id', '=', $param['city_id']);
     }
     if (!$param['is_all']) {
         $result = $result->whereRaw($prefix . 'agt.cnt > 0')->whereRaw('((' . $prefix . 'status.last_queue_no - ' . $prefix . 'status.current_queue_no' . ') * ' . $prefix . 'company_setting.waiting_time / 60) / (' . $prefix . 'agt.cnt)' . ' BETWEEN ' . $param['waiting_time_min'] . ' AND ' . $param['waiting_time_max']);
     }
     $stores = $result->paginate(PAGINATION_SIZE);
     $param['stores'] = $stores;
     $param['categories'] = CategoryModel::all();
     $param['cities'] = CityModel::all();
     return View::make('user.store.search')->with($param);
 }
 public function getEdit($id)
 {
     // Find the media using the user id
     $media = Media::find($id);
     // No such id
     if ($media == null) {
         return \View::make('redminportal::pages/404');
     }
     $categories = array();
     foreach (Category::all() as $category) {
         $categories[$category->id] = $category->name;
     }
     $tagString = "";
     foreach ($media->tags as $tag) {
         if (!empty($tagString)) {
             $tagString .= ",";
         }
         $tagString .= $tag->name;
     }
     if (empty($media->options)) {
         $media_cn = (object) array('name' => $media->name, 'short_description' => $media->short_description, 'long_description' => $media->long_description);
     } else {
         $media_cn = json_decode($media->options);
     }
     return \View::make('redminportal::medias/edit')->with('media', $media)->with('media_cn', $media_cn)->with('imageUrl', 'assets/img/medias/')->with('categories', $categories)->with('tagString', $tagString);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id = NULL)
 {
     $currUser = Auth::user();
     $oCategories = Category::all();
     $oCity = Cities::all();
     $oVacancy = null;
     if ($id > 0) {
         $oVacancy = Vacancy::find($id);
     }
     foreach ($oCategories as $item) {
         $aCategories[$item->id] = $item->name;
     }
     if (Auth::user()->is_admin == 0) {
         $aCompanies = Companies::where('user_id', '=', $currUser->id)->get();
     } else {
         $aCompanies = Companies::all();
     }
     foreach ($aCompanies as $item) {
         $aCompany[$item->id] = $item->name;
     }
     $oQuery = Regions::join('country', 'country.id', '=', 'country_id')->select('regions.id as id', 'regions.name', 'country.name as country_name', 'country.id as country_id');
     if ($oRegions = $oQuery->get()) {
     }
     foreach ($oRegions as $item) {
         $aRegions[$item->country_name] = array();
         $aCity = Cities::where('region_id', '=', $item->id)->get();
         foreach ($aCity as $city) {
             $aRegions[$item->name][$city->id] = $city->name;
         }
     }
     if ($currUser->is_admin == 0 && (empty($oVacancy) === false && $oVacancy->user_id != $currUser->id)) {
         return Redirect::route('vacancy-list', array('user_id' => $currUser->id));
     }
     return View::make('/vacancy/edit', array('currUser' => $currUser, 'aCategories' => $aCategories, 'aCompany' => $aCompany, 'aRegions' => $aRegions, 'oVacancy' => $oVacancy, 'id' => $id));
 }
Example #7
0
 /**
  * Display a listing of the resource.
  * GET /categories
  *
  * @return Response
  */
 public function index()
 {
     //
     $category = Category::all();
     //$category = Category::where('user_id', Auth::user()->id)->get();
     return Response::json(array('error' => false, 'categories' => $category->toArray()), 200);
 }
 public function getIndex()
 {
     if (Auth::guest() || Auth::user()->isAdmin == 0) {
         return Redirect::secure('/');
     }
     // layouts variables
     $this->layout->title = 'Админ панел | Нещо Шантаво';
     $this->layout->canonical = 'https://neshto.shantavo.com/admin/';
     $this->layout->robots = 'noindex,nofollow,noodp,noydir';
     $users = count(User::all());
     $admins = count(User::where('isAdmin', ">", 0)->get());
     $categories = count(Category::all());
     $albums = count(Album::all());
     $votes = count(DB::table('votes')->get());
     $pictures = count(Picture::all());
     $pictureSize = 0;
     foreach (Picture::all() as $p) {
         $pictureSize += $p->size;
     }
     // get disqus stats
     include app_path() . '/config/_disqus.php';
     $disqus = new DisqusAPI(getDisqusKey());
     $disqus->setSecure(false);
     $comments = $disqus->posts->list(array('forum' => 'shantavo'));
     // nesting the view into the layout
     $this->layout->nest('content', 'admin.index', array('users' => $users, 'admins' => $admins, 'votes' => $votes, 'categories' => $categories, 'albums' => $albums, 'pictures' => $pictures, 'pictureSize' => $pictureSize, 'comments' => $comments));
 }
 public function show($id)
 {
     try {
         $iteration = Iterations::findOrFail($id);
         $iterations = Iterations::where('projectid', '=', $iteration->projectid)->get();
         $project = Project::findOrFail($iteration->projectid);
         $issues = Issue::where('iterationid', '=', $id)->get();
         //$issues = $iteration->issues;
         $countIssues = sizeof($issues);
         $categories = Category::all();
         $idCategory = 0;
         $totalPoints = $issues->sum('points');
         $materiales = Material::all();
         $personal = PersonalType::all();
         $team = Teams::where('projectid', '=', $project->id)->get()->first();
         $members = DB::table('memberof')->where('teamid', '=', $team->id)->get();
         $hasmembers = sizeof($members) > 0 ? true : false;
         $users = array();
         foreach ($members as $member) {
             $users[] = User::findOrFail($member->usersid);
             echo $hasmembers;
         }
         $this->layout->content = View::make('layouts.iterations.show')->with('iteration', $iteration)->with('iterations', $iterations)->with('issues', $issues)->with('categories', $categories)->with('idCategory', $idCategory)->with('countIssues', $countIssues)->with('totalPoints', $totalPoints)->with('project', $project)->with('materiales', $materiales)->with('personal', $personal)->with('hasmembers', $hasmembers)->with('members', $members)->with('users', $users)->with('message', '');
     } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         return Redirect::to('/projects/')->with('message', 'Error al crear la iteración');
     }
 }
Example #10
0
 /**
  * Upload un torrent
  * 
  * @access public
  * @return View torrent.upload
  *
  */
 public function upload()
 {
     $user = Auth::user();
     // Post et fichier upload
     if (Request::isMethod('post')) {
         // No torrent file uploaded OR an Error has occurred
         if (Input::hasFile('torrent') == false) {
             Session::put('message', 'You must provide a torrent for the upload');
             return View::make('torrent.upload', array('categories' => Category::all(), 'user' => $user));
         } else {
             if (Input::file('torrent')->getError() != 0 && Input::file('torrent')->getClientOriginalExtension() != 'torrent') {
                 Session::put('message', 'An error has occurred');
                 return View::make('torrent.upload', array('categories' => Category::all(), 'user' => $user));
             }
         }
         // Deplace et decode le torrent temporairement
         TorrentTools::moveAndDecode(Input::file('torrent'));
         // Array from decoded from torrent
         $decodedTorrent = TorrentTools::$decodedTorrent;
         // Tmp filename
         $fileName = TorrentTools::$fileName;
         // Info sur le torrent
         $info = Bencode::bdecode_getinfo(getcwd() . '/files/torrents/' . $fileName, true);
         // Si l'announce est invalide ou si le tracker et privée
         if ($decodedTorrent['announce'] != route('announce', ['passkey' => $user->passkey]) && Config::get('other.freeleech') == true) {
             Session::put('message', 'Your announce URL is invalid');
             return View::make('torrent.upload', array('categories' => Category::all(), 'user' => $user));
         }
         // Find the right category
         $category = Category::find(Input::get('category_id'));
         // Create the torrent (DB)
         $torrent = new Torrent(['name' => Input::get('name'), 'slug' => Str::slug(Input::get('name')), 'description' => Input::get('description'), 'info_hash' => $info['info_hash'], 'file_name' => $fileName, 'num_file' => $info['info']['filecount'], 'announce' => $decodedTorrent['announce'], 'size' => $info['info']['size'], 'nfo' => Input::hasFile('nfo') ? TorrentTools::getNfo(Input::file('nfo')) : '', 'category_id' => $category->id, 'user_id' => $user->id]);
         // Validation
         $v = Validator::make($torrent->toArray(), $torrent->rules);
         if ($v->fails()) {
             if (file_exists(getcwd() . '/files/torrents/' . $fileName)) {
                 unlink(getcwd() . '/files/torrents/' . $fileName);
             }
             Session::put('message', 'An error has occured may bee this file is already online ?');
         } else {
             // Savegarde le torrent
             $torrent->save();
             // Compte et sauvegarde le nombre de torrent dans  cette catégorie
             $category->num_torrent = Torrent::where('category_id', '=', $category->id)->count();
             $category->save();
             // Sauvegarde les fichiers que contient le torrent
             $fileList = TorrentTools::getTorrentFiles($decodedTorrent);
             foreach ($fileList as $file) {
                 $f = new TorrentFile();
                 $f->name = $file['name'];
                 $f->size = $file['size'];
                 $f->torrent_id = $torrent->id;
                 $f->save();
                 unset($f);
             }
             return Redirect::route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with('message', trans('torrent.your_torrent_is_now_seeding'));
         }
     }
     return View::make('torrent.upload', array('categories' => Category::all(), 'user' => $user));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $project = Project::find($id);
     $categories = Category::all()->lists('name', 'id');
     $customers = Customer::all()->lists('name', 'id');
     return View::make('admin.projects.edit')->with(['project' => $project, 'categories' => $categories, 'customers' => $customers]);
 }
Example #12
0
 /**
  * @before _secure
  */
 public function campaign($id)
 {
     $ad = \Ad::first(['_id' => $id, 'org_id' => $this->org->_id]);
     if (!$ad) {
         $this->_404();
     }
     $this->seo(["title" => $ad->title]);
     $view = $this->getActionView();
     if (RM::post("action")) {
         // action value already checked in _postback func
         $this->_postback('add', ['ad' => $ad]);
     }
     if (RM::type() === 'DELETE') {
         $this->_postback('delete');
     }
     $start = RM::get("start", date('Y-m-d', strtotime("-7 day")));
     $end = RM::get("end", date('Y-m-d'));
     $limit = RM::get("limit", 10);
     $page = RM::get("page", 1);
     $query = ['adid' => Db::convertType($id), 'created' => Db::dateQuery($start, $end)];
     $clicks = \Click::all($query, [], 'created', 'desc', $limit, $page);
     $count = \Click::count($query);
     $cf = Utils::getConfig("cf", "cloudflare");
     $view->set("domain", $cf->api->domain)->set("clicks", $clicks)->set("count", $count)->set('advertiser', $this->user);
     $comms = Commission::all(["ad_id = ?" => $id], ['model', 'coverage', 'revenue', 'description']);
     $models = ArrayMethods::arrayKeys($comms, 'model');
     $advertiser = User::first(["id = ?" => $ad->user_id], ['name']);
     $categories = \Category::all(["org_id = ?" => $this->org->_id], ['name', '_id']);
     $this->_postback('show', ['ad' => $ad]);
     $view->set("ad", $ad)->set("comms", $comms)->set("categories", $categories)->set("advertiser", $advertiser)->set('models', $models)->set("start", $start)->set("end", $end);
 }
Example #13
0
 /**
  * Displays the create product form.
  */
 public function getNewProduct()
 {
     // Get all the categories.
     $categories = Category::all();
     // Render the view.
     return View::make('admin.products.new', ['categories' => $categories]);
 }
 public function editPost($id)
 {
     $category = Category::all();
     $post = Post::find($id);
     $cate = explode(',', $post->category);
     $publishers = Publisher::orderBy('name', 'ASC')->get();
     return View::make('contributor.editPost')->with('title', "Posts Management")->with('page', "posts")->with('category', $category)->with('post', $post)->with('cate', $cate)->with('publishers', $publishers);
 }
Example #15
0
 /**
  * Setup the layout used by the controller.
  *
  * @return void
  */
 protected function setupLayout()
 {
     if (!is_null($this->layout)) {
         $categories = Category::all();
         $pages = Page::all();
         $this->layout = View::make($this->layout)->with('styles', $this->styles)->with('scripts', $this->scripts)->with('content_title', '')->with('categories', $categories)->with('pages', $pages)->with('inline_js', $this->inline_js)->with('sidebar', null);
     }
 }
Example #16
0
 public function getIndex()
 {
     $categories = array();
     foreach (Category::all() as $category) {
         $categories[$category->id] = $category->name;
     }
     return View::make('products.index')->with('products', Product::take(6)->paginate(6))->with('categories', $categories);
 }
Example #17
0
 /**
  * Список категорий
  */
 public function index()
 {
     if (!User::isAdmin()) {
         App::abort('403');
     }
     $categories = Category::all(['conditions' => ['parent_id = ?', 0], 'order' => 'sort', 'include' => ['children']]);
     App::view('categories.index', compact('categories'));
 }
 public function getIndex()
 {
     $categories = [];
     foreach (Category::all() as $category) {
         $categories[$category->id] = $category->name;
     }
     return View::make('admin.products.index')->with('products', Product::all())->with('categories', $categories);
 }
Example #19
0
 /**
  * Get list categories
  * @return array()
  */
 public function scopeGetAll()
 {
     $data = array();
     $items = Category::all();
     foreach ($items as $item) {
         $data[$item->id] = $item->name;
     }
     return $data;
 }
 /**
  * Show the form for creating a new pedido
  *
  * @return Response
  */
 public function create($id = 0)
 {
     $cliente = Cliente::find($id);
     $fornecedores = Fornecedor::all();
     $produtos = Produto::all();
     $vendedores = Vendedor::all();
     $categories = Category::all();
     return View::make('pedidos.create', compact('cliente', 'produtos', 'fornecedores', 'vendedores', 'categories'));
 }
 public function editPost($id)
 {
     $category = Category::all();
     $post = Post::find($id);
     $cate = explode(',', $post->category);
     $authors = User::where('is_activated', 1)->get();
     $publishers = Publisher::orderBy('name', 'ASC')->get();
     return View::make('moderate.editPost')->with('title', "Posts Management")->with('page', "posts")->with('category', $category)->with('post', $post)->with('cate', $cate)->with('authors', $authors)->with('publishers', $publishers);
 }
Example #22
0
 public static function categoryArray()
 {
     $category = Category::all()->toArray();
     $array = [0 => ['id' => 0, 'name' => '- Danh mục', 'created_at' => '2016-03-24 16:08:58', 'updated_at' => '2016-03-24 16:08:58']];
     foreach ($category as $key => $value) {
         $array[$key + 1] = $value;
     }
     return $array;
 }
 /**
  * Setup the layout used by the controller.
  *
  * @return void
  */
 protected function setupLayout()
 {
     $cats = Category::all();
     if (!is_null($this->layout)) {
         View::share('cats', $cats);
         $this->layout = View::make($this->layout);
         //->nest('category', 'partials.category', array($cats));
     }
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $product = Product::find($id);
     $departments = Department::all()->lists('name', 'id');
     $categories = Category::all()->lists('name', 'id');
     $brands = Brand::all()->lists('name', 'id');
     $sizes = Size::all()->lists('name', 'id');
     $colors = Color::all()->lists('name', 'id');
     return View::make('admin::products.edit', compact('product', 'departments', 'categories', 'brands', 'sizes', 'colors'));
 }
 public static function loadCategories()
 {
     $categories = new \Illuminate\Database\Eloquent\Collection();
     try {
         $categories = Category::all();
     } catch (Exception $e) {
         //Discard query exception.. categories table not found.. discard
     }
     View::share('categories', $categories);
 }
 public function catalogue()
 {
     $ids = DB::table('tblCatalogue')->select('strCatalogueID')->orderBy('created_at', 'desc')->orderBy('strCatalogueID', 'desc')->take(1)->get();
     $ID = $ids["0"]->strCatalogueID;
     $newID = $this->smartCounter($ID);
     $category = Category::all();
     $reason = ReasonCatalogue::all();
     $catalogue = DB::table('tblCatalogue')->join('tblGarmentCategory', 'tblCatalogue.strCatalogueCategory', '=', 'tblGarmentCategory.strGarmentCategoryID')->leftJoin('tblReasonCatalogue', 'tblCatalogue.strCatalogueID', '=', 'tblReasonCatalogue.strInactiveCatalogueID')->select('tblCatalogue.*', 'tblGarmentCategory.strGarmentCategoryName', 'tblReasonCatalogue.strInactiveCatalogueID', 'tblReasonCatalogue.strInactiveReason')->orderBy('created_at')->get();
     return View::make('catalogue')->with('newID', $newID)->with('catalogue', $catalogue)->with('reason', $reason)->with('category', $category);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $categories = \Category::all();
     echo '<pre>';
     foreach ($categories as $category) {
         print_r($category->term->slug);
     }
     echo '</pre>';
     // return view('post.list-category');
 }
 /**
  * Display a listing of categories
  *
  * @return Response
  */
 public function index()
 {
     if (Request::ajax()) {
         $categories = Category::all();
         return Response::json($categories);
     } else {
         $categories = Category::all();
         return View::make('categories.index', compact('categories'));
     }
 }
Example #29
0
 public function dashboard()
 {
     $settings = Setting::first();
     $media = Media::all();
     $users = User::all();
     $comments = Comment::all();
     $categories = Category::all();
     $data = array('settings' => $settings, 'media' => $media, 'users' => $users, 'comments' => $comments, 'categories' => $categories);
     return View::make('admin.sections.dashboard', $data);
 }
 public function segment()
 {
     $ids = DB::table('tblGarmentSegment')->select('strGarmentSegmentID')->orderBy('created_at', 'desc')->orderBy('strGarmentSegmentID', 'desc')->take(1)->get();
     $ID = $ids["0"]->strGarmentSegmentID;
     $newID = $this->smartCounter($ID);
     $category = Category::all();
     $reason = ReasonSegment::all();
     $segment = DB::table('tblGarmentSegment')->join('tblGarmentCategory', 'tblGarmentSegment.strCategory', '=', 'tblGarmentCategory.strGarmentCategoryID')->leftJoin('tblReasonSegment', 'tblGarmentSegment.strGarmentSegmentID', '=', 'tblReasonSegment.strInactiveSegmentID')->select('tblGarmentSegment.*', 'tblGarmentCategory.strGarmentCategoryName', 'tblReasonSegment.strInactiveSegmentID', 'tblReasonSegment.strInactiveReason')->get();
     return View::make('garmentsDetails')->with('segment', $segment)->with('category', $category)->with('reason', $reason)->with('newID', $newID);
 }