public function edit($id) { $task = Task::findOrFail($id); $components = Component::lists('name_en', 'id'); $modules = Module::where('component_id', '=', $task->component_id)->lists('name_en', 'id'); return view('tasks.edit', compact('task', 'modules', 'components')); }
public static function getItems() { $items = []; $uid = Yii::$app->user->identity->user_id; $accessAdmin = Access2::find()->where(['user_id' => $uid, 'sub_module_id' => 1])->one(); $accessCategory = Access2::find()->where(['user_id' => $uid, 'sub_module_id' => 3])->one(); $accessProduct = Access2::find()->where(['user_id' => $uid, 'sub_module_id' => 8])->one(); $accessCustomer = Access2::find()->where(['user_id' => $uid, 'sub_module_id' => 13])->one(); $accessSupplier = Access2::find()->where(['user_id' => $uid, 'sub_module_id' => 18])->one(); $accessTax = Access2::find()->where(['user_id' => $uid, 'sub_module_id' => 25])->one(); $accessQuotation = Access2::find()->where(['user_id' => $uid, 'sub_module_id' => 30])->one(); $accessPO = Access2::find()->where(['user_id' => $uid, 'sub_module_id' => 35])->one(); $accessAccess = Access2::find()->where(['user_id' => $uid, 'sub_module_id' => 23])->one(); if ($accessAdmin != NULL) { $modAdmin = Module::find()->where(['module_id' => 1])->one(); $items[] = ['label' => $modAdmin->module_name, 'url' => [$modAdmin->module_url], 'active' => \Yii::$app->controller->id == $modAdmin->module_tab_active]; } else { } if ($accessCategory != NULL) { $modCategory = Module::find()->where(['module_id' => 2])->one(); $items[] = ['label' => $modCategory->module_name, 'url' => [$modCategory->module_url], 'active' => \Yii::$app->controller->id == $modCategory->module_tab_active]; } else { } if ($accessProduct != NULL) { $modProduct = Module::find()->where(['module_id' => 3])->one(); $items[] = ['label' => $modProduct->module_name, 'url' => [$modProduct->module_url], 'active' => \Yii::$app->controller->id == $modProduct->module_tab_active]; } else { } if ($accessCustomer != NULL) { $modCustomer = Module::find()->where(['module_id' => 4])->one(); $items[] = ['label' => $modCustomer->module_name, 'url' => [$modCustomer->module_url], 'active' => \Yii::$app->controller->id == $modCustomer->module_tab_active]; } else { } if ($accessSupplier != NULL) { $modSupplier = Module::find()->where(['module_id' => 5])->one(); $items[] = ['label' => $modSupplier->module_name, 'url' => [$modSupplier->module_url], 'active' => \Yii::$app->controller->id == $modSupplier->module_tab_active]; } else { } if ($accessTax != NULL) { $modSupplier = Module::find()->where(['module_id' => 6])->one(); $items[] = ['label' => $modSupplier->module_name, 'url' => [$modSupplier->module_url], 'active' => \Yii::$app->controller->id == $modSupplier->module_tab_active]; } else { } if ($accessQuotation != NULL) { $modSupplier = Module::find()->where(['module_id' => 7])->one(); $items[] = ['label' => $modSupplier->module_name, 'url' => [$modSupplier->module_url], 'active' => \Yii::$app->controller->id == $modSupplier->module_tab_active]; } else { } if ($accessPO != NULL) { $modSupplier = Module::find()->where(['module_id' => 8])->one(); $items[] = ['label' => $modSupplier->module_name, 'url' => [$modSupplier->module_url], 'active' => \Yii::$app->controller->id == $modSupplier->module_tab_active]; } else { } if ($accessAccess != NULL) { $modSupplier = Module::find()->where(['module_id' => 9])->one(); $items[] = ['label' => $modSupplier->module_name, 'url' => [$modSupplier->module_url], 'active' => \Yii::$app->controller->id == $modSupplier->module_tab_active]; } else { } return $items; }
public static function getSecondMenus($module) { $firstMenu = Module::find()->where(['url' => $module, 'pid' => 0])->asArray()->one(); $secondMenus = Module::find()->where(['pid' => $firstMenu['id']])->orderBy(['sequenced' => SORT_ASC])->asArray()->all(); foreach ($secondMenus as $key => $menu) { $secondMenus[$key]['defaultUrl'] = $firstMenu['url'] . '/' . $menu['url']; } return $secondMenus; }
public function destroy($id) { $module = Module::findOrFail($id); $file = public_path('uploads/courses/' . $module->file); if ($module->file && file_exists($file)) { unlink($file); } $module->delete(); \Flash::success('Modul berhasil dihapus.'); return redirect()->back(); }
public function actionIndex() { $this->needAuthenticate(); $this->Frame->addCss('\\public\\assets\\css\\edit-form.css'); $this->Frame->addCss('\\public\\assets\\css\\main-menu.css'); $moduleId = Param::get('pk')->asInteger(); $view = new ViewModuleShow(); $module = DataSource::factory(Module::cls(), $moduleId); $view->module = $module; $this->Frame->bindView('content', $view); $this->Frame->render(); }
public function getAccess($controller) { $allow = false; $accesses = Access::findAll(["profile_id" => Yii::$app->user->identity->profile_id]); foreach ($accesses as $accesses) { $module = Module::findOne(["id" => $accesses->module_id]); if ($module->controller === $controller) { $allow = true; break; } } return $allow; }
public function save(Request $request) { $as = $request->input('as'); $module = new Module(); $permission = new Permission(); $validator = \Validator::make($request->all(), $module->getRules()); $results = new \StdClass(); if ($validator->passes()) { if ($request->input('id') != "xxx") { $module = Module::find($request->input('id')); $module->name = $request->input('name'); $module->route = $request->input('route'); $module->description = $request->input('description'); $module->save(); $results->info = 'module create'; } else { $module = new Module(); $permission = new Permission(); $module->name = $request->input('name'); $module->route = $request->input('route'); $module->description = $request->input('description'); $module->save(); $permission->name = "can-access-" . $request->input('name'); $permission->display_name = "Dapat Mengakses " . $request->input('name'); $results->info = 'module edit'; } $results->status = 1; $results->result = $module; } else { $results->status = 0; $result = array(); foreach ($validator->errors() as $key => $err) { array_push($result, $err); } $results->result = $result; } return response()->json($results); }
/** * Run the database seeds. * * @return void */ public function run() { $modules = Module::all(); $admin = Role::where('name', 'admin')->get()->first(); $tech = Role::where('name', 'tech')->get()->first(); $result = DB::table('permission_role')->insert(['role_id' => $admin->id, 'permission_id' => 1, 'action' => 34, 'access' => 'module']); $result = DB::table('permission_role')->insert(['role_id' => $tech->id, 'permission_id' => 1, 'action' => 34, 'access' => 'module']); $result = DB::table('permission_role')->insert(['role_id' => $admin->id, 'permission_id' => 2, 'action' => 34, 'access' => 'module']); $result = DB::table('permission_role')->insert(['role_id' => $tech->id, 'permission_id' => 2, 'action' => 34, 'access' => 'module']); $result = DB::table('permission_role')->insert(['role_id' => $admin->id, 'permission_id' => 3, 'action' => 34, 'access' => 'module']); $result = DB::table('permission_role')->insert(['role_id' => $tech->id, 'permission_id' => 3, 'action' => 34, 'access' => 'module']); $result = DB::table('permission_role')->insert(['role_id' => $admin->id, 'permission_id' => 4, 'action' => 34, 'access' => 'module']); $result = DB::table('permission_role')->insert(['role_id' => $tech->id, 'permission_id' => 4, 'action' => 34, 'access' => 'module']); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Module::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'moduleName', $this->moduleName])->andFilterWhere(['like', 'moduleNum', $this->moduleNum]); return $dataProvider; }
public function getModules() { /** @var Module[] $aModules */ $aModules = $this->findRelationCache($this->getPrimaryKeyName(), Module::cls()); if (empty($aModules)) { $oModules = DataSource::factory(Module::cls()); $oModules->builder()->where("module_id={$this->getPrimaryKey()}"); $aModules = $oModules->findAll(); foreach ($aModules as $oModule) { $this->addRelationCache($this->getPrimaryKeyName(), $oModule); $oModule->addRelationCache('module_id', $this); } } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Module::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'active' => $this->active, 'type_id' => $this->type_id]); $query->andFilterWhere(['like', 'iconfa', $this->iconfa])->andFilterWhere(['like', 'label', $this->label])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'controller', $this->controller]); return $dataProvider; }
public function update($id, ModuleRequest $request) { $module = Module::findOrFail($id); $module->name_en = $request->input('name_en'); $module->name_bn = $request->input('name_bn'); $module->component_id = $request->input('component_id'); $module->icon = $request->input('icon'); $module->description = $request->input('description'); $module->ordering = $request->input('ordering'); $module->updated_by = Auth::user()->id; $module->updated_at = time(); $module->update(); Session()->flash('flash_message', 'Module has been updated!'); return redirect('modules'); }
public function getModule() { /** @var Module[] $aModules */ $aModules = $this->findRelationCache('module_id', Module::cls()); if (empty($aModules)) { $oModules = DataSource::factory(Module::cls()); $oModules->builder()->where("id={$this->module_id}"); $aModules = $oModules->findAll(); foreach ($aModules as $oModule) { $oModule->addRelationCache('id', $this); $this->addRelationCache('module_id', $oModule); } } return isset($aModules[0]) ? $aModules[0] : null; }
public function search($input) { $query = Module::query(); $columns = Schema::getColumnListing('modules'); $attributes = array(); foreach ($columns as $attribute) { if (isset($input[$attribute]) and !empty($input[$attribute])) { $query->where($attribute, $input[$attribute]); $attributes[$attribute] = $input[$attribute]; } else { $attributes[$attribute] = null; } } return [$query->get(), $attributes]; }
public function actionIndex() { $this->needAuthenticate(); $view = new ViewList(); $view->response = new ViewResponse($this->alertClass, $this->alertHeader, $this->alertText); $view->menu->addItem('Установить', '/admin/modules/show/'); $view->table->caption = 'Модули'; $view->table->tableHead->allowActions = true; $view->table->tableBody->addAction('Просмотр', '/admin/modules/show/', 'glyphicon-sunglasses'); $modules = DataSource::factory(Module::cls()); $modules->builder()->sqlCalcFoundRows(); $view->table->tableBody->data = $modules->findAll(); $view->table->addColumn('id', '№')->addColumn('name', 'Наименование')->addColumn('alias', 'Псевдоним')->addColumn('description', 'Описание')->addColumn('active', 'Активен'); $this->Pagination->prepare(); $this->fillPager($view); $view->table->tableBody->addDecoration('active', new ViewActive('active')); $this->Frame->bindView('content', $view); $this->Frame->render(); }
public function getModules(Request $input) { $query = \App\Models\Module::query(); if ($input->has('id')) { $id = $input->get('id'); if (is_array($id)) { $query->whereIn('modules.id', $id); } else { $query->where('modules.id', $id); } } if ($input->has('category_id')) { $id = $input->get('category_id'); $query->leftJoin('modules_categories', 'modules.id', '=', 'modules_categories.module_id'); if (is_array($id)) { $query->whereIn('modules_categories.category_id', $id); } else { $query->where('modules_categories.category_id', $id); } } $fullModules = $query->select('modules.*')->with('categories')->get(); $moduleIDs = $fullModules->lists('id'); $responseImages = []; /* SELECT mp.module_id, SUM(mp.amount * p.price) FROM homestead.module_plants as mp LEFT JOIN homestead.plants as p on mp.plant_id = p.id GROUP BY mp.module_id ; */ $dbPricesQuery = \DB::table('module_plants AS mp')->leftJoin('plants AS p', 'mp.plant_id', '=', 'p.id')->select(['mp.module_id', \DB::raw('SUM(mp.amount * p.price) AS price')])->whereIn('mp.module_id', $moduleIDs)->groupBy('mp.module_id'); $dbPrices = $dbPricesQuery->get(); $prices = []; foreach ($dbPrices as $price) { $prices[$price->module_id] = $price->price; } /** @var Module $module */ foreach ($fullModules as $module) { $responseImages[$module->id] = ['id' => $module->id, 'top_image' => $module->top_image_hash, 'front_image' => $module->front_image_hash, 'mature_front_image' => $module->mature_front_image_hash, 'price' => array_get($prices, $module->id, 0), 'height' => $module->height, 'width' => $module->width, 'categories' => $module->categories->lists('slug', 'id')]; } return response(json_encode($responseImages, JSON_FORCE_OBJECT), 200, ['Content-Type' => 'application/json']); }
/** * Run the database seeds. * * @return void */ public function run() { Module::insert(['name' => 'Punto 1', 'address' => 'Calle 100', 'district' => 'San Miguel', 'province' => 'Lima', 'state' => 'Lima', 'phone' => '214424214', 'email' => '*****@*****.**', 'initial_cash' => 100.0, 'actual_cash' => 0.0, 'openModule' => false, 'starTime' => Carbon::create(2011, 1, 1, 8, 0, 0), 'endTime' => Carbon::create(2011, 1, 1, 17, 0, 0), 'image' => 'images/examples/map1.PNG']); Module::insert(['name' => 'Punto 2', 'address' => 'Calle 200', 'district' => 'San Miguel', 'province' => 'Lima', 'state' => 'Lima', 'phone' => '567890123', 'email' => '*****@*****.**', 'initial_cash' => 200.0, 'actual_cash' => 0.0, 'openModule' => false, 'starTime' => Carbon::create(2011, 1, 1, 8, 0, 0), 'endTime' => Carbon::create(2011, 1, 1, 17, 0, 0), 'image' => 'images/examples/map1.PNG']); }
public function module() { $title = 'Module'; $css = $this->CSS('users'); $jH = $this->jS('module'); $result = Module::all(); $a = 0; $footer = Setting::where('name', 'footer')->get(); if (count($footer) > 0) { $footer = $footer->first()->value; } else { $footer = '(c) Ordent ' . date('Y'); } $sB = $this->getPermission('1'); $sBa = $this->getDefault(); $sBe = $this->getDefault(); $sBd = $this->getDefault(); return view('backend.module', compact('css', 'jH', 'title', 'result', 'a', 'footer', 'sB')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $module = Module::find($id); if (!$module) { return response()->json('Le module n\'existe pas.', 404); } $module->delete(); return 'Le module a bien été supprimé.'; }
public function delete($idx) { Module::find($idx)->delete(); }
/** * Finds the Module model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Module the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Module::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function createExchange() { $business = Business::all()->first(); $active = $business->exchange_active; $moduleId = $business->gift_module_id; $moduloFind = Module::where('id', $moduleId); if ($moduleId != NULL) { $moduloFind = Module::find($moduleId); $modulo = $moduloFind->name; } else { $modulo = 'No se ha asignado el modulo principal de canjeo de regalos'; } $giftsArr = Gift::all(); $giftsList = Gift::orderBy('id')->get()->lists('name', 'id'); $min = Gift::orderBy('id')->get()->lists('id')->first(); return view('internal.salesman.exchangeGift', ['giftsList' => $giftsList, 'giftArray' => $giftsArr, 'min' => $min, 'active' => $active, 'modulo' => $modulo]); }
protected function getModuleConfigView(Structure $oStructure, Module $oModule) { $moduleConfigView = new ViewModuleConfiguration(); $settings = []; if ($oModule->getPrimaryKey()) { $aModulesSettings = $oModule->getModuleSettings(); foreach ($aModulesSettings as $oModuleSetting) { $type = Module::TYPE_LIST; if (!is_null($oModuleSetting->entity)) { $oEntities = DataSource::factory($oModuleSetting->entity); $oEntities->builder()->where('deleted=0'); $list = $oEntities->findAll(); $type = Module::TYPE_ENTITY; } elseif (!is_null($oModuleSetting->list)) { $list = json_decode($oModuleSetting->list, true); } else { $list = []; } $oStructureSetting = null; if ($oStructure->id) { $oStructureSettings = DataSource::factory(StructureSetting::cls()); $oStructureSettings->builder()->where("structure_id={$oStructure->getPrimaryKey()}")->whereAnd()->where("module_setting_id={$oModuleSetting->getPrimaryKey()}"); /** @var StructureSetting[] $aStructureSettings */ $aStructureSettings = $oStructureSettings->findAll(); if (!empty($aStructureSettings)) { $oStructureSetting = $aStructureSettings[0]; } } $settings[] = ['type' => $type, 'setting' => $oModuleSetting, 'list' => $list, 'value' => is_null($oStructureSetting) ? null : $oStructureSetting->value]; } } $moduleConfigView->settings = $settings; return $moduleConfigView; }
/** * @return \yii\db\ActiveQuery */ public function getModule() { return $this->hasOne(Module::className(), ['id' => 'Module_id']); }
<?php use app\models\Module; use yii\helpers\Url; use yii\helpers\Html; $module = Module::find()->asArray()->all(); $session = Yii::$app->session; $session->open(); $user_session = $session['session.user']; $session->close(); ?> <style> .active{ background: rgb(3, 169, 245) !important; } .diactive{ background: rgb(51, 51, 51) !important; } </style> <div id = "kotak-logout" style="text-align: right; padding: 15dp"> <label style="color:white; margin-right:15dp">Welcome <?php echo $user_session['username']; ?> , You're Login as <?php echo $user_session['user_type']; ?> | </label> <a href="<?php echo Yii::$app->urlManager->createUrl("site/logout");
public function modules($presentationId) { $cancelled = CancelPresentation::findOrFail($presentationId); $modules = Module::all(); $authorized = ModulePresentationAuthorized::where("cancelled_presentation_id", $presentationId)->get(); return view('internal.promoter.presentation.authorized', ['cancelled' => $cancelled, "modules" => $modules, "authorized" => $authorized]); }
/** * Run the database seeds. * * @return void */ public function run() { $module = new Module(); $module->name = 'Home Site'; $module->route = "/"; $module->save(); $module = new Module(); $module->name = 'Login'; $module->route = "login"; $module->save(); $module = new Module(); $module->name = 'Backend User'; $module->route = "admin/user"; $module->save(); $module = new Module(); $module->name = 'Backend Role'; $module->route = "admin/role"; $module->save(); $module = new Module(); $module->name = 'Backend Permission'; $module->route = "admin/permission"; $module->save(); $module = new Module(); $module->name = 'Backend Module'; $module->route = "admin/module"; $module->save(); $module = new Module(); $module->name = 'Backend Dashboard'; $module->route = "admin/dashboard"; $module->save(); $module = new Module(); $module->name = 'Backend Menu'; $module->route = "admin/menu"; $module->save(); $module = new Module(); $module->name = 'Backend Preference'; $module->route = "admin/preference"; $module->save(); $module = new Module(); $module->name = 'Backend Grid'; $module->route = "admin/grid"; $module->save(); $module = new Module(); $module->name = 'Backend Gambar'; $module->route = "admin/gambar"; $module->save(); $module = new Module(); $module->name = 'Backend Menu Child'; $module->route = "admin/menu:child"; $module->save(); $module = new Module(); $module->name = 'Backend Preference Image'; $module->route = "admin/preference:image"; $module->save(); $module = new Module(); $module->name = 'Backend Preference Background'; $module->route = "admin/preference:background"; $module->save(); $module = new Module(); $module->name = 'Backend Preference Logo'; $module->route = "admin/preference:logo"; $module->save(); $module = new Module(); $module->name = 'Backend Preference Footer'; $module->route = "admin/preference:footer"; $module->save(); $modules = Module::all(); $admin = Role::where('name', 'admin')->get()->first(); $tech = Role::where('name', 'tech')->get()->first(); foreach ($modules as $key => $m) { $permission = new Permission(); $permission->name = "can-access-module-" . $m->name; $permission->display_name = 'Dapat mengakses ' . $m->name; $permission->access = 'access'; $permission->action = $m->id; $permission->type = 'module'; $permission->save(); $result = DB::table('permission_role')->insert(['role_id' => $admin->id, 'permission_id' => $permission->id]); $result = DB::table('permission_role')->insert(['role_id' => $tech->id, 'permission_id' => $permission->id]); } }
public function destroyAssigment($id) { // $moduleassigment = ModuleAssigment::find($id); $module = Module::find($moduleassigment->module_id); if ($module->openModule == true) { return back()->withErrors(['Antes de desasociar al vendedor, primero este debe cerrar su caja']); } $salesman = User::find($moduleassigment->salesman_id); $tickets = DB::table('tickets')->where('salesman_id', '=', $salesman->id)->where('payment_date', '<', new Carbon())->where('payment_date', '>=', Carbon::today())->whereNull('cashCount_register')->get(); $devolutions = DB::table('devolutions')->where('tickets.salesman_id', '=', $salesman->id)->where('devolutions.created_at', '<', new Carbon())->where('devolutions.created_at', '>=', Carbon::today())->whereNull('devolutions.cashCount_register')->leftJoin('tickets', 'tickets.id', '=', 'devolutions.ticket_id')->get(); if ($tickets != null) { return back()->withErrors(['Antes de desasociar, primero este debe hacer el arqueo de caja']); } if ($devolutions != null) { return back()->withErrors(['Antes de desasociar, primero este debe hacer el arqueo de caja']); } $moduleassigment->status = 2; $moduleassigment->dateMoveAssigments = new Carbon(); $salesman = User::find($moduleassigment->salesman_id); $salesman->module_id = null; $salesman->save(); $moduleassigment->save(); return redirect('admin/modules/assigment'); }
public static function getStatusesArray() { return [self::STATUS_BLOCKED => Module::t('module', 'USER_STATUS_BLOCKED'), self::STATUS_ACTIVE => Module::t('module', 'USER_STATUS_ACTIVE'), self::STATUS_WAIT => Module::t('module', 'USER_STATUS_WAIT')]; }
public function moduleDetail($classroom_id, $module_id) { $classroom = Classroom::with('courses')->findOrFail($classroom_id); $module = Module::findOrFail($module_id); $page_title = $module->name; if (Gate::allows('member-of', $classroom)) { if (!Auth::user()->hasRole('teacher') && !$module->users->contains(Auth::user()->id)) { $module->users()->attach(Auth::user()->id); } return view('user.classrooms.detail-module', compact('classroom', 'module', 'page_title')); } return abort(401); }