Пример #1
0
 public function moduleAndPageCreate($request)
 {
     $projectID = Project::orderBy('id', 'desc')->first();
     $modules = $request->projected_total_modules;
     $m = 1;
     $pages = $request->projected_total_pages / $request->projected_total_modules;
     $p = 1;
     $pageNumber = 1;
     while ($m <= $modules) {
         $newModule = new Module();
         $newModule->project_id = $projectID->id;
         $newModule->name = 'Modulo' . $m;
         $newModule->projected_total_pages = $pages;
         $newModule->save();
         $p = 1;
         while ($p <= $pages) {
             $moduleID = Module::orderBy('id', 'desc')->first();
             $newPage = new Page();
             $newPage->module_id = $moduleID->id;
             $newPage->name = $pageNumber;
             $newPage->save();
             $p++;
             $pageNumber++;
         }
         $m++;
     }
 }
Пример #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $module = new Module();
     $module->nom_module = Request::get('nom');
     $module->enseignant_id = Request::get('enseignant_id');
     $module->save();
     return Redirect('/app/modules');
 }
Пример #3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Module $module
  * @return Response
  */
 public function update($module)
 {
     $module->fill(Input::data());
     if (Input::data('parent') && ($parent = Module::find(Input::data('parent')['id']))) {
         $module->parent()->associate($parent);
     }
     $module->save();
     return $module;
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(Request $request)
 {
     //
     //$this->validate($request, ['inteos_bb_code' => 'required|max:10']);
     //$inteosinput = $request->all(); // change use (delete or comment user Requestl; )
     //1971107960
     //$inteosbbcode = $inteosinput['inteos_bb_code'];
     //var_dump($inteosbb);
     //$inteos = DB::connection('sqlsrv2')->select(DB::raw("SELECT IntKeyPO,BlueBoxNum,BoxQuant FROM [BdkCLZGtest].[dbo].[CNF_BlueBox] WHERE INTKEY = 56013339 "), array());
     // Test database
     /*$inteos = DB::connection('sqlsrv2')->select(DB::raw("SELECT [CNF_BlueBox].INTKEY,[CNF_BlueBox].IntKeyPO,[CNF_BlueBox].BlueBoxNum,[CNF_BlueBox].BoxQuant, [CNF_PO].POnum,[CNF_SKU].Variant,[CNF_SKU].ClrDesc,[CNF_STYLE].StyCod FROM [BdkCLZGtest].[dbo].[CNF_BlueBox] FULL outer join [BdkCLZGtest].[dbo].CNF_PO on [CNF_PO].INTKEY = [CNF_BlueBox].IntKeyPO FULL outer join [BdkCLZGtest].[dbo].[CNF_SKU] on [CNF_SKU].INTKEY = [CNF_PO].SKUKEY FULL outer join [BdkCLZGtest].[dbo].[CNF_STYLE] on [CNF_STYLE].INTKEY = [CNF_SKU].STYKEY WHERE [CNF_BlueBox].INTKEY =  :somevariable"), array(
     			'somevariable' => $inteosbbcode,
     		));*/
     // Live database
     DB::table('modules')->truncate();
     //$inteosmodules = DB::connection('sqlsrv2')->select(DB::raw("SELECT DISTINCT mod.ModNam,per.Name,per.BadgeNum,per.PinCode FROM [BdkCLZG].[dbo].[CNF_Operators] as op JOIN [BdkCLZG].[dbo].[WEA_PersData] as per ON op.IntKeyPers = per.PersNum JOIN [BdkCLZG].[dbo].[CNF_Modules] as mod ON op.Module = mod.Module WHERE  (op.PersTyp = 2) and (per.FlgAct = 1) ORDER BY mod.ModNam"));
     $inteosmodules = DB::connection('sqlsrv2')->select(DB::raw("SELECT DISTINCT mod.ModNam,per.Name,per.BadgeNum,per.PinCode FROM [BdkCLZG].[dbo].[CNF_Operators] as op JOIN [BdkCLZG].[dbo].[WEA_PersData] as per ON op.IntKeyPers = per.PersNum JOIN [BdkCLZG].[dbo].[CNF_Modules] as mod ON op.Module = mod.Module WHERE  (op.PersTyp = 2) ORDER BY mod.ModNam"));
     foreach ($inteosmodules as $row) {
         $modName = $row->ModNam;
         $modName = str_replace(' ', '', $modName);
         $group = substr($modName, 0, 1);
         $leader_num = $row->BadgeNum;
         $pin = $row->PinCode;
         $leader = $row->Name;
         $badge = $row->BadgeNum;
         //echo $modName." ".$leader." ".$badge."<br />";
         //dd($modName." ".$leader." ".$badge);
         //try {
         $module = new Module();
         $module->module = $modName;
         $module->group = $group;
         $module->leader = $leader;
         $module->leader_num = $leader_num;
         $module->leader_pin = $pin;
         $module->save();
         //}
         /*
         catch (\Illuminate\Database\QueryException $e) {
         	//$msg = "Problem to save in database";
         	//return view('BarcodeRequest.error',compact('msg'));			
         }
         */
     }
     return view('importmodules.success');
     /*
     		if ($inteosmodules) {
     			//continue
     		} else {
             	//$validator->errors()->add('field', 'Something is wrong with this field!');
             	
             	//Log::error('Cannot find BB in Inteos');
             	//return view('inteosdb.error');
     }
     */
 }
Пример #5
0
 public function importModules()
 {
     $modules = $this->getModulesFile();
     foreach ($modules as $module) {
         $newmodule = new Module();
         $newmodule->packname = $module->packname;
         $newmodule->provider = $module->provider;
         $newmodule->name = $module->name;
         $newmodule->status = $module->status;
         $newmodule->icon = $module->icon;
         $newmodule->description = $module->description;
         $newmodule->save();
     }
 }
Пример #6
0
 public function add(Request $request)
 {
     $user = \Session::get('user');
     if (!$user->can('产品模块管理')) {
         abort(401);
     }
     $product = Product::find($request->input('product_id'));
     $module = new Module();
     $module->name = $request->input('name');
     $module->description = $request->input('description');
     $module->product()->associate($product);
     $module->save();
     $dep_modules = $request->input('modules', []);
     $dep_modules_name = [];
     foreach ($dep_modules as $dep_module_id) {
         $dep_module = Module::find($dep_module_id);
         $module->dep_modules()->save($dep_module);
         $dep_modules_name[] = strtr('%name[%id]', ['%name' => $dep_module->name, '%id' => $dep_module->id]);
     }
     \Log::notice(strtr('产品模块增加: 用户(%name[%id]) 增加了产品 (%product[%product_id]) 的模块: (%module[%module_id]), 依赖模块: %dep_modules', ['%name' => $user->name, '%id' => $user->id, '%product' => $product->name, '%product_id' => $product->id, '%module' => $module->name, '%module_id' => $module->id, '%dep_modules' => implode(',', $dep_modules_name)]));
     return redirect()->back()->with('message_content', '添加成功!')->with('message_type', 'info');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param ModuleRequest|Request $request
  * @param Project $project
  * @param Module $module
  * @return \Illuminate\Http\Response
  */
 public function update(ModuleRequest $request, Project $project, Module $module)
 {
     $module->update($request->all());
     $module->save();
     return redirect()->route('project.show', [$project]);
 }