function list_drop() { $dept = new Department(); $dept->get(); foreach ($dept as $row) { $data[''] = '[ Pilih Departement ]'; $data[$row->dept_name] = $row->dept_name; } return $data; }
public function getProfile() { $title = "Cambiar Perfil | Nia Boutique.com"; $user = User::where('usuario.id', '=', Auth::user()->id)->leftJoin('departamento', 'departamento.id', '=', 'usuario.department')->get(array('usuario.*', 'departamento.nombre as dep')); $dep = Department::get(); $dir = Dir::where('user_id', '=', Auth::user()->id)->where('deleted', '=', 0)->get(); if (!empty($user) && $user != "" && !is_null($user)) { return View::make('user.profile')->with('title', $title)->with('dep', $dep)->with('user', $user[0])->with('dir', $dir); } }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', UploadField::create('Photo'), 'Content'); $fields->addFieldToTab('Root.Main', UploadField::create('PDF'), 'Content'); $fields->addFieldToTab('Root.Main', PhoneNumberField::create('Phone'), 'Content'); $fields->addFieldToTab('Root.Main', EmailField::create('Email'), 'Content'); $fields->addFieldToTab('Root.Main', DropdownField::create('RoleID', 'Role', Role::get()->map('ID', 'Title'))->setEmptyString('(Select)'), 'Content'); $fields->addFieldToTab('Root.Main', DropdownField::create('DepartmentID', 'Department', Department::get()->map('ID', 'Title'))->setEmptyString('(Select)'), 'Content'); return $fields; }
function department_list($id = null) { if ($id) { $dept = new Department($id); $list = new Department(); $list->where('parent_id', $id); $list->order_by('orders', 'asc'); $list->get(); child_personnel(0, $id, $dept->title); foreach ($list as $key_tmp => $tmp) { department_list($tmp->id); } } }
public function index($offset = 0) { $this->filter_access('Departement', 'roled_select', base_url()); $dept_list = new Department(); switch ($this->input->get('c')) { case "1": $data['col'] = "dept_name"; break; case "2": $data['col'] = "dept_id"; break; default: $data['col'] = "dept_id"; } if ($this->input->get('d') == "1") { $data['dir'] = "DESC"; } else { $data['dir'] = "ASC"; } $data['title'] = "Departments"; $data['btn_add'] = anchor('departments/add', 'Add New', array("class" => "btn btn-primary")); $data['btn_home'] = anchor(base_url(), 'Home'); $uri_segment = 3; $offset = $this->uri->segment($uri_segment); if ($this->input->get('search_by')) { $total_rows = $dept_list->like($_GET['search_by'], $_GET['q'])->count(); $dept_list->like($_GET['search_by'], $_GET['q'])->order_by($data['col'], $data['dir']); } else { $total_rows = $dept_list->count(); $dept_list->order_by($data['col'], $data['dir']); } $data['dept_list'] = $dept_list->get($this->limit, $offset)->all; $config['base_url'] = site_url("departments/index"); $config['total_rows'] = $total_rows; $config['per_page'] = $this->limit; $config['uri_segment'] = $uri_segment; $this->pagination->initialize($config); $data['pagination'] = $this->pagination->create_links(); $this->load->view('departments/index', $data); }
public function getPublicationCategory($id) { $title = "Búsqueda por categorías | pasillo24.com"; $lider = Publicaciones::where('status', '=', 'Aprobado')->where('deleted', '=', 0)->where(function ($query) { $query->where('ubicacion', '=', 'Categoria')->orWhere('ubicacion', '=', 'Ambos'); })->where(function ($query) { $query->where('fechFin', '>=', date('Y-m-d'))->orWhere('fechFinNormal', '>=', date('Y-m-d')); })->where('categoria', '=', $id)->get(array('id', 'img_1', 'titulo', 'precio', 'moneda')); $publicaciones = Publicaciones::where('publicaciones.status', '=', 'Aprobado')->where('categoria', '=', $id)->leftJoin('departamento', 'publicaciones.departamento', '=', 'departamento.id')->where('publicaciones.tipo', '!=', 'Lider')->where('publicaciones.deleted', '=', 0)->where(function ($query) { $query->where('publicaciones.ubicacion', '=', 'Categoria')->orWhere('publicaciones.ubicacion', '=', 'Ambos'); })->where(function ($query) { $query->where('publicaciones.fechFin', '>=', date('Y-m-d', time()))->orWhere('publicaciones.fechFinNormal', '>=', date('Y-m-d', time())); })->paginate(5, array('publicaciones.id', 'publicaciones.img_1', 'publicaciones.titulo', 'publicaciones.precio', 'publicaciones.moneda', 'publicaciones.descripcion', 'publicaciones.fechFin', 'publicaciones.fechFinNormal', 'departamento.id as dep_id', 'departamento.nombre as dep')); $departamentos = Department::get(); $paginatorFilter = ""; return View::make('publications.categories')->with('title', $title)->with('publicaciones', $publicaciones)->with('lider', $lider)->with('departamento', $departamentos)->with('busq', $id)->with('paginatorFilter', $paginatorFilter); }
public function getDepartments() { $dep = Department::get(); return Response::json(array('type' => 'success', 'departamentos' => $dep)); }
public function getPublicationLider() { $title = "Publicación Lider | pasillo24.com"; $department = Department::all(); $categoria = Categorias::where('tipo', '=', 1)->where('deleted', '=', 0)->orderBy('nombre')->get(); $otros = new StdClass(); foreach ($categoria as $c) { if (strtolower($c->nombre) == 'otros') { $otros->id = $c->id; $otros->nombre = $c->nombre; } } if (!isset($otros->id)) { $otros->id = '1000'; $otros->nombre = 'Otros'; } $servicios = Categorias::where('tipo', '=', 2)->where('deleted', '=', 0)->orderBy('nombre')->get(); $otros2 = new StdClass(); foreach ($servicios as $c) { if (strtolower($c->nombre) == 'otros') { $otros2->id = $c->id; $otros2->nombre = $c->nombre; } } if (!isset($otros2->id)) { $otros2->id = '1000'; $otros2->nombre = 'Otros'; } $url = 'usuario/publicacion/lider/enviar'; $textos = Textos::where('id', '=', 1)->first(); $precio = Precios::where('pub_type_id', '=', 1)->get(); $dep = Department::get(); return View::make('publications.publicacion')->with('title', $title)->with('tipo', 'lider')->with('department', $department)->with('url', $url)->with('categorias', $categoria)->with('texto', $textos)->with('precio', $precio)->with('servicios', $servicios)->with('otros', $otros)->with('otros2', $otros2)->with('dep', $dep); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $uId = \Auth::user()->id; $emp = \User::where('id', '=', $id)->first(); if ($emp) { $dept = \Department::get(); $client = \Friends::where('parent_id', '=', $uId)->get(); return \View::make('branch/emp.edit')->with('dept', $dept)->with('emp', $emp)->with('client', $client); } else { \App::abort(404); } }
public function getSearch() { $title = "Búsqueda | pasillo24.com"; $paginatorFilter = ""; if (Input::has('busq')) { $busq = Input::get('busq'); $auxLider = Publicaciones::leftJoin('categoria', 'categoria.id', '=', 'publicaciones.categoria')->where('publicaciones.status', '=', 'Aprobado')->where('publicaciones.deleted', '=', 0)->where(function ($query) { $query->where('publicaciones.ubicacion', '=', 'Categoria')->orWhere('publicaciones.ubicacion', '=', 'Ambos'); })->where(function ($query) { $query->where('publicaciones.fechFin', '>=', date('Y-m-d'))->orWhere('publicaciones.fechFinNormal', '>=', date('Y-m-d')); })->where(function ($query) use($busq) { $query->whereRaw("LOWER(`publicaciones`.`titulo`) LIKE '%" . strtolower($busq) . "%'")->orWhereRaw("LOWER(`publicaciones`.`pag_web`) LIKE '%" . strtolower($busq) . "%'")->orWhereRaw("LOWER(`categoria`.`desc`) LIKE '%" . strtolower($busq) . "%'"); }); $auxRes = Publicaciones::leftJoin('categoria', 'publicaciones.categoria', '=', 'categoria.id')->leftJoin('departamento', 'publicaciones.departamento', '=', 'departamento.id')->where(function ($query) use($busq) { $query->whereRaw("LOWER(`publicaciones`.`titulo`) LIKE '%" . strtolower($busq) . "%'")->orWhereRaw("LOWER(`departamento`.`nombre`) LIKE '%" . strtolower($busq) . "%'")->orWhereRaw("LOWER(`categoria`.`desc`) LIKE '%" . strtolower($busq) . "%'"); })->where(function ($query) { $query->where('publicaciones.fechFin', '>=', date('Y-m-d'))->orWhere('publicaciones.fechFinNormal', '>=', date('Y-m-d')); })->where('publicaciones.tipo', '!=', 'Lider')->where('publicaciones.status', '=', 'Aprobado')->where('publicaciones.deleted', '=', 0); /*Se agrega*/ if (Input::has('filter')) { $filter = Input::get('filter'); if ($filter != -1) { $filter = Department::find(Input::get('filter')); $auxRes = $auxRes->where('publicaciones.departamento', '=', $filter->id); $paginatorFilter .= '&filter=' . $filter->id; } else { $filter = ""; } } if (Input::has('min') || Input::has('max')) { $min = Input::get('min'); $max = Input::get('max'); $currency = Input::get('currency'); if (!is_null($min) && !is_null($max) && !empty($min) && !empty($max)) { $minmax = array($min, $max); $paginatorFilter .= '&min=' . $min . '&max=' . $max . '¤cy=' . $currency; $auxLider = $auxLider->where('moneda', '=', $currency)->where('precio', '>=', $min)->whereRaw('`publicaciones`.`precio` <= ' . $max); $auxRes = $auxRes->where('publicaciones.precio', '>=', $min)->whereRaw('`publicaciones`.`precio` <= ' . $max)->where('publicaciones.moneda', '=', $currency); } else { if (!is_null($max) && !empty($max)) { $minmax = array('', $max); $paginatorFilter .= '&max=' . $max . '¤cy=' . $currency; $auxLider = $auxLider->where('moneda', '=', $currency)->whereRaw('`publicaciones`.`precio` <= ' . $max); $auxRes = $auxRes->whereRaw('`publicaciones`.`precio` <= ' . $max)->where('publicaciones.moneda', '=', $currency); } elseif (!is_null($min) && !empty($min)) { $minmax = array($min, ''); $paginatorFilter .= '&min=' . $min . '¤cy=' . $currency; $auxLider = $auxLider->where('moneda', '=', $currency)->where('precio', '>=', $min); $auxRes = $auxRes->where('publicaciones.moneda', '=', $currency)->where('publicaciones.precio', '>=', $min); } } } if (Input::has('rel')) { $rel = Input::get('rel'); switch ($rel) { case 'rep': $auxLider = $auxLider->leftJoin('usuario', 'usuario.id', '=', 'publicaciones.user_id')->orderBy('usuario.reputation', 'DESC'); $auxRes = $auxRes->leftJoin('usuario', 'usuario.id', '=', 'publicaciones.user_id')->orderBy('usuario.reputation', 'DESC'); $paginatorFilter .= '&rel=rep'; break; case 'fin': $auxLider = $auxLider->orderBy('publicaciones.fechFin', 'ASC')->orderBy('publicaciones.fechFinNormal', 'ASC'); $auxRes = $auxRes->orderBy('publicaciones.fechFin', 'ASC')->orderBy('publicaciones.fechFinNormal', 'ASC'); $paginatorFilter .= '&rel=fin'; break; case 'ini': $auxLider = $auxLider->orderBy('publicaciones.fechIni', 'DESC')->orderBy('publicaciones.fechIniNormal', 'DESC'); $auxRes = $auxRes->orderBy('publicaciones.fechIni', 'DESC')->orderBy('publicaciones.fechIniNormal', 'DESC'); $paginatorFilter .= '&rel=ini'; break; default: break; } } if (Input::has('cond')) { $cond = Input::get('cond'); $paginatorFilter .= '&cond=' . $cond; $auxRes = $auxRes->where('publicaciones.condicion', '=', strtolower($cond)); } if (Input::has('buss')) { $buss = Input::get('buss'); $paginatorFilter .= '&buss=' . $buss; $auxLider = $auxLider->where('publicaciones.bussiness_type', '=', strtolower($buss)); $auxRes = $auxRes->where('publicaciones.bussiness_type', '=', strtolower($buss)); } $lider = $auxLider->get(array('publicaciones.id', 'publicaciones.img_1', 'publicaciones.titulo', 'publicaciones.precio', 'publicaciones.moneda')); $res = $auxRes->paginate(5, array('publicaciones.id', 'publicaciones.img_1', 'publicaciones.titulo', 'publicaciones.precio', 'publicaciones.moneda', 'publicaciones.descripcion', 'publicaciones.fechFin', 'publicaciones.fechFinNormal', 'departamento.id as dep_id', 'departamento.nombre as dep')); $categorias = Categorias::where('id', '=', $busq)->pluck('desc'); if (!is_null($categorias)) { $busq = $categorias; } else { $busq = $busq; } $departamentos = Department::get(); $view = View::make('publications.busq')->with('publicaciones', $res)->with('title', $title)->with('busq', $busq)->with('lider', $lider)->with('departamento', $departamentos)->with('paginatorFilter', $paginatorFilter); if (isset($filter)) { $view = $view->with('filter', $filter); } if (isset($currency)) { $view = $view->with('minmax', $minmax)->with('currency', $currency); } if (isset($cond)) { $view = $view->with('cond', $cond); } if (isset($buss)) { $view = $view->with('buss', $buss); } if (isset($rel)) { $view = $view->with('rel', $rel); } return $view; } elseif (Input::has('cat')) { $id = Input::geT('cat'); /*Query inicial*/ $auxLider = Publicaciones::where('status', '=', 'Aprobado')->where('deleted', '=', 0)->where(function ($query) { $query->where('ubicacion', '=', 'Categoria')->orWhere('ubicacion', '=', 'Ambos'); })->where(function ($query) { $query->where('fechFin', '>=', date('Y-m-d'))->orWhere('fechFinNormal', '>=', date('Y-m-d')); })->where('categoria', '=', $id); //->get(array('id','img_1','titulo','precio','moneda')); $auxRes = Publicaciones::leftJoin('departamento', 'publicaciones.departamento', '=', 'departamento.id')->where('publicaciones.status', '=', 'Aprobado')->where('publicaciones.categoria', '=', $id)->where('publicaciones.tipo', '!=', 'Lider')->where('publicaciones.deleted', '=', 0)->where(function ($query) { $query->where('publicaciones.ubicacion', '=', 'Categoria')->orWhere('publicaciones.ubicacion', '=', 'Ambos'); })->where(function ($query) { $query->where('publicaciones.fechFin', '>=', date('Y-m-d', time()))->orWhere('publicaciones.fechFinNormal', '>=', date('Y-m-d', time())); }); /*Se agrega*/ if (Input::has('filter')) { $filter = Input::get('filter'); if ($filter != -1) { $filter = Department::find(Input::get('filter')); $auxRes = $auxRes->where('publicaciones.departamento', '=', $filter->id); $paginatorFilter .= '&filter=' . $filter->id; } else { $filter = ""; } } if (Input::has('min') || Input::has('max')) { $min = Input::get('min'); $max = Input::get('max'); $currency = Input::get('currency'); if (!is_null($min) && !is_null($max) && !empty($min) && !empty($max)) { $minmax = array($min, $max); $paginatorFilter .= '&min=' . $min . '&max=' . $max . '¤cy=' . $currency; $auxLider = $auxLider->whereRaw('`publicaciones`.`precio` >= ' . $min)->whereRaw('`publicaciones`.`precio` <= ' . $max)->where('moneda', '=', $currency); $auxRes = $auxRes->whereRaw('`publicaciones`.`precio` >= ' . $min)->whereRaw('`publicaciones`.`precio` <= ' . $max)->where('publicaciones.moneda', '=', $currency); } else { if (!is_null($max) && !empty($max)) { $minmax = array('', $max); $paginatorFilter .= '&max=' . $max . '¤cy=' . $currency; $auxLider = $auxLider->where('moneda', '=', $currency)->whereRaw('`publicaciones`.`precio` <= ' . $max); $auxRes = $auxRes->whereRaw('`publicaciones`.`precio` <= ' . $max)->where('publicaciones.moneda', '=', $currency); } elseif (!is_null($min) && !empty($min)) { $minmax = array($min, ''); $paginatorFilter .= '&min=' . $min . '¤cy=' . $currency; $auxLider = $auxLider->whereRaw('`publicaciones`.`precio` >= ' . $min)->where('moneda', '=', $currency); $auxRes = $auxRes->where('publicaciones.moneda', '=', $currency)->whereRaw('`publicaciones`.`precio` >= ' . $min); } } } if (Input::has('rel')) { $rel = Input::get('rel'); switch ($rel) { case 'rep': $auxLider = $auxLider->leftJoin('usuario', 'usuario.id', '=', 'publicaciones.user_id')->orderBy('usuario.reputation', 'DESC'); $auxRes = $auxRes->leftJoin('usuario', 'usuario.id', '=', 'publicaciones.user_id')->orderBy('usuario.reputation', 'DESC'); $paginatorFilter .= '&rel=rep'; break; case 'fin': $auxLider = $auxLider->orderBy('publicaciones.fechFin', 'ASC')->orderBy('publicaciones.fechFinNormal', 'ASC'); $auxRes = $auxRes->orderBy('publicaciones.fechFin', 'ASC')->orderBy('publicaciones.fechFinNormal', 'ASC'); $paginatorFilter .= '&rel=fin'; break; case 'ini': $auxLider = $auxLider->orderBy('publicaciones.fechIni', 'DESC')->orderBy('publicaciones.fechIniNormal', 'DESC'); $auxRes = $auxRes->orderBy('publicaciones.fechIni', 'DESC')->orderBy('publicaciones.fechIniNormal', 'DESC'); $paginatorFilter .= '&rel=ini'; break; default: break; } } if (Input::has('cond')) { $cond = Input::get('cond'); $paginatorFilter .= '&cond=' . $cond; $auxRes = $auxRes->where('publicaciones.condicion', '=', strtolower($cond)); } if (Input::has('buss')) { $buss = Input::get('buss'); $paginatorFilter .= '&buss=' . $buss; $auxLider = $auxLider->where('publicaciones.bussiness_type', '=', strtolower($buss)); $auxRes = $auxRes->where('publicaciones.bussiness_type', '=', strtolower($buss)); } $lider = $auxLider->get(array('publicaciones.id', 'publicaciones.img_1', 'publicaciones.titulo', 'publicaciones.precio', 'publicaciones.moneda')); $res = $auxRes->paginate(5, array('publicaciones.id', 'publicaciones.img_1', 'publicaciones.titulo', 'publicaciones.precio', 'publicaciones.moneda', 'publicaciones.descripcion', 'publicaciones.fechFin', 'publicaciones.fechFinNormal', 'departamento.id as dep_id', 'departamento.nombre as dep')); $categorias = Categorias::where('id', '=', $id)->pluck('id'); if (!is_null($categorias)) { $busq = $categorias; } else { $busq = $id; } $departamentos = Department::get(); $view = View::make('publications.categories')->with('publicaciones', $res)->with('title', $title)->with('busq', $busq)->with('lider', $lider)->with('departamento', $departamentos)->with('paginatorFilter', $paginatorFilter); if (isset($filter)) { $view = $view->with('filter', $filter); } if (isset($currency)) { $view = $view->with('minmax', $minmax)->with('currency', $currency); } if (isset($cond)) { $view = $view->with('cond', $cond); } if (isset($buss)) { $view = $view->with('buss', $buss); } if (isset($rel)) { $view = $view->with('rel', $rel); } return $view; } }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Departments', GridField::create('Department', 'Departments', Department::get()->sort('Title'), GridFieldConfig_RecordEditor::create())); $fields->addFieldToTab('Root.Roles', GridField::create('Role', 'Roles', Role::get()->sort('Title'), GridFieldConfig_RecordEditor::create())); return $fields; }