Пример #1
0
 public function addApproAutre(request $request, $idFournisseur)
 {
     if ($request->get('option') !== null) {
         $doctrine = $this->doctrine;
         $fournisseur = $doctrine->getRepository('ICApprovisionnementBundle:Fournisseur')->findOneBy(array('id' => $idFournisseur));
         $appro = new Appro();
         $appro->setFournisseur($fournisseur);
         $appro->setTypeProduit($fournisseur->getType());
         $appro->setDateCommande(new \Datetime());
         $doctrine->persist($appro);
         $doctrine->flush();
         $lastAppro = $doctrine->getRepository('ICApprovisionnementBundle:Appro')->getLastAppro();
         if ($fournisseur->getType() == 4) {
             foreach ($request->get('option') as $idAutre) {
                 $autre = $doctrine->getRepository('ICApprovisionnementBundle:Autre')->findOneBy(array('id' => $idAutre));
                 $approAutre = new ApproAutre();
                 $approAutre->setAutre($autre);
                 $approAutre->setQuantite($request->get($idAutre));
                 $approAutre->setAppro($lastAppro[0]);
                 $doctrine->persist($approAutre);
             }
         } elseif ($fournisseur->getType() == 3) {
             foreach ($request->get('option') as $idLecteur) {
                 $typeLecteur = $doctrine->getRepository('ICApprovisionnementBundle:TypeLecteurAutre')->findOneBy(array('id' => $idLecteur));
                 $approLecteur = new ApproLecteur();
                 $approLecteur->setTypeLecteurAutre($typeLecteur);
                 $approLecteur->setQuantite($request->get($idLecteur));
                 $approLecteur->setAppro($lastAppro[0]);
                 $doctrine->persist($approLecteur);
             }
         }
         $doctrine->flush();
     }
 }
Пример #2
0
 /**
  * @Route("/api/subscribe", name="site_subscribe")
  */
 public function subscribeAction(request $request)
 {
     $em = $this->getDoctrine()->getManager();
     $name = $request->get('name');
     $mail = $request->get('mail');
     $subscriber = new Subscriber();
     $subscriber->setName($name)->setMail($mail);
     $em->persist($subscriber);
     $em->flush();
     $request->getSession()->getFlashBag()->add('success', 'Dank u voor het inschrijven voor de nieuwsletter.');
     return new response();
 }
Пример #3
0
	protected function execTinyMce($prm=null) {
		$search = 'js/tiny_mce/';
		$request = request::get('request');
		$pos = strpos($request, $search);
		if ($pos === false)
			exit;
		$tmp = substr($request, $pos+strlen($search));
		$file = file::nyroExists(array(
			'name'=>'lib'.DS.'tinyMce'.DS.$tmp,
			'realName'=>true,
			'type'=>'other'
		));
		if (strpos($file, '.php') !== false) {
			array_walk($_GET, create_function('&$v', '$v = urldecode($v);'));
			$path = str_replace($tmp, '', $file);
			ini_set('include_path', $path);
			define('TINYMCEPATH', substr($path, 0, -1));
			define('TINYMCECACHEPATH', substr(TMPROOT, 0, -1));
			if (ob_get_length())
				ob_clean();
			include($file);
			exit;
		} else
			response::getInstance()->showFile($file);
	}
Пример #4
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(request $request)
 {
     //
     $folder = $request->get('folder');
     $data = $this->manager->folderInfo($folder);
     return view('admin.upload.index', $data);
 }
Пример #5
0
 public function updateDepartmentAction(request $request)
 {
     // Get the ID variable from the request
     $id = $request->get('id');
     // Create a new Department entity
     $department = new Department();
     $em = $this->getDoctrine()->getManager();
     // Find a department by the ID sent in by the request
     $department = $em->getRepository('AppBundle:Department')->find($id);
     // Only edit if it is a SUPER_ADMIN
     if ($this->get('security.context')->isGranted('ROLE_SUPER_ADMIN')) {
         // Create the form
         $form = $this->createForm(new CreateDepartmentType(), $department);
         // Handle the form
         $form->handleRequest($request);
         if ($form->isValid()) {
             $em->persist($department);
             $em->flush();
             return $this->redirect($this->generateUrl('departmentadmin_show'));
         }
         return $this->render('department_admin/create_department.html.twig', array('department' => $department, 'form' => $form->createView()));
     } else {
         return $this->redirect($this->generateUrl('departmentadmin_show'));
     }
 }
Пример #6
0
    public function toHtml()
    {
        if ($this->cfg->useJs) {
            $this->cfg->setInArray('html', 'class', $this->cfg->getInArray('html', 'class') . ' date');
            $resp = response::getInstance();
            $resp->addJs('jqueryui');
            if (($lang = request::get('lang')) != 'en') {
                $resp->addJs('i18n_ui.datepicker-' . $lang);
            }
            $jsPrmMin = $this->cfg->jsPrm;
            $jsPrmMax = $this->cfg->jsPrm;
            $minId = $this->makeId($this->name . '[0]');
            $maxId = $this->makeId($this->name . '[1]');
            $minDate = $this->dates['min']->getJs(null);
            $maxDate = $this->dates['max']->getJs(null);
            $jsPrmMin['onSelect'] = 'function(dateText) {$("#' . $maxId . '").datepicker("option", "minDate", $("#' . $minId . '").datepicker("getDate"));}';
            if ($maxDate) {
                $jsPrmMin['maxDate'] = $maxDate;
            }
            $jsPrmMax['onSelect'] = 'function(dateText) {$("#' . $minId . '").datepicker("option", "maxDate", $("#' . $maxId . '").datepicker("getDate"));}';
            if ($minDate) {
                $jsPrmMax['minDate'] = $minDate;
            }
            $resp->blockJquery('
				$("#' . $minId . '").datepicker(' . utils::jsEncode($jsPrmMin) . ');
				$("#' . $maxId . '").datepicker(' . utils::jsEncode($jsPrmMax) . ');
			');
        }
        return parent::toHtml();
    }
Пример #7
0
 public function indexAction(request $request)
 {
     $session = $this->getRequest()->getSession();
     if ($request->getMethod() == 'POST') {
         $session->clear();
         $username = $request->get('usuario');
         $password = $request->get('password');
         //$em = $this->getDoctrine()->getManager();
         $query = $this->getDoctrine()->getRepository('usuariosBundle:PerfilUsuario')->createQueryBuilder('perfil')->select('perfil', 'usuario', 'tipo_usuario')->innerJoin('usuariosBundle:Usuarios', 'usuario', 'WITH', 'perfil.usuario = usuario.id')->innerJoin('usuariosBundle:TipoUsuario', 'tipo_usuario', 'WITH', 'usuario.tipoUsuario = tipo_usuario.id')->where('perfil.nombreUsuario = :user')->setParameter('user', $username)->getQuery();
         $user = $query->getArrayResult();
         $passwords = $this->getDoctrine()->getRepository('usuariosBundle:Passwords')->findOneBy(array('perfil' => $user[0]['id'], 'activo' => true));
         if ($user) {
             $factory = $this->get('security.encoder_factory');
             $codificador = $factory->getEncoder($passwords);
             $validador = $codificador->isPasswordValid($passwords->getPassword(), $password, $passwords->getSalt());
             if ($validador) {
                 $session = $request->getSession();
                 $session->set("email", $user[0]['email']);
                 $session->set("perfil_activo", $user[0]['activo']);
                 $session->set("pass_activo", $passwords->getActivo());
                 if ($session->get('perfil_activo') == 1) {
                     if ($session->get('pass_activo') == 1) {
                         $session->set("usuario_id", $user[0]['id']);
                         $session->set("autenticado", true);
                         $session->set("nombre_usuario", $user[0]['nombreUsuario']);
                         $session->set("nombres", $user[1]['nombres']);
                         $session->set("tipo_usuario", $user[2]['nombre']);
                         $session->set("id_tipo_usuario", $user[2]['id']);
                         return $this->render('inicialBundle:Default:index.html.twig');
                     } else {
                         $this->get('session')->getFlashBag()->add('warning', 'Clave Inactiva debe actualizar su clave');
                     }
                 } else {
                     $this->get('session')->getFlashBag()->add('danger', 'Usuario Inactivo Contactar con el administrador del sistema');
                     return $this->render('inicialBundle:Default:index.html.twig');
                 }
             } else {
                 $this->get('session')->getFlashBag()->add('danger', 'Datos incorrectos');
                 return $this->render('inicialBundle:Default:index.html.twig');
             }
         } else {
             $this->get('session')->getFlashBag()->add('danger', 'Datos incorrectos');
             return $this->render('inicialBundle:Default:index.html.twig');
         }
     }
     return $this->render('inicialBundle:Default:index.html.twig');
 }
Пример #8
0
 function invoke(S2SRequest $request)
 {
     $cmd = request::get('cmd');
     $func = '_' . str_replace('.', '_', $cmd);
     if (is_callable(array($this, $func))) {
         return call_user_func(array($this, $func), array($request));
     }
 }
 public static function activate()
 {
     if (request::get(1) == 'activation') {
         $user = user::activate(request::get(2));
         return $user;
     } else {
         return new user();
     }
 }
Пример #10
0
	/**
	 * Get the response object according to the requested out
	 *
	 * @return response_abstract
	 */
	public static function getInstance() {
		if (self::$proxy)
			return self::$proxy;
		if (!self::$inst) {
			self::$inst = factory::get('response_'.request::getResponseName());
			self::$inst->setContentType(request::get('out'));
		}
		return self::$inst;
	}
Пример #11
0
 public function updatesousFamilleAction(request $request, $idSousFamille)
 {
     $em = $this->getDoctrine()->getManager();
     $sousFamille = $em->getRepository('ICAdministrationBundle:SousFamille')->find($idSousFamille);
     $sousFamille->setNom($request->get('nom'));
     $em->persist($sousFamille);
     $em->flush();
     return $this->redirectToRoute('ic_administration_affichage_sous_famille');
 }
Пример #12
0
 public function showPost($slug, request $request)
 {
     $post = Post::whereSlug($slug)->firstOrFail();
     $tag = $request->get('tag');
     if ($tag) {
         $tag = Tag::whereTag($tag)->firstOrFail();
     }
     return view($post->layout, compact('post', 'tag', 'slug'));
 }
 public function output()
 {
     $this->parseUrl();
     if (isset($_COOKIE['relo_backend']) && beuser::verifyCookie($_COOKIE['relo_backend']) !== false || isset($_SESSION['beuser_id']) && $_SESSION['beuser']->isAdmin() === true) {
         // logged in
         $user = new beuser($_SESSION['beuser_id']);
         beuser::setCookie($user->get('id'), $user->get('password'));
         $_SESSION['beuser'] = $user;
         $_SESSION['beuserId'] = $user->get('id');
         $this->user = $user;
         if ($this->requestedView == 'login') {
             header('Location: ' . config::get('system')['startpage']);
         }
     } else {
         // Not Logged In
         if ($this->requestedView == 'ajax' && (isset($_POST['module']) && $_POST['module'] == 'login')) {
         } else {
             if ($this->requestedView != 'login') {
                 header('Location: login');
                 exit;
             }
         }
     }
     switch ($this->requestedView) {
         case 'imagemanager':
             $image = new Image(request::get(1), request::get(2));
             break;
         case 'upload':
             include 'classes/util/upload.class.php';
             $upload_handler = new UploadHandler();
             break;
         case 'ajax':
             if ($_POST['module'] == 'system') {
                 include 'classes/basic/system.ajaxhandler.php';
             } elseif ($_POST['module'] == 'autofill') {
                 include 'classes/util/autofill.php';
             } elseif ($_POST['module'] == 'user') {
                 include '../data/classes/basic/user.ajaxhandler.php';
             } else {
                 include 'classes/custom/' . $_POST['module'] . '/' . $_POST['module'] . '.ajaxhandler.php';
             }
             break;
         case 'code':
             $this->requestedView = 'default';
         default:
             $this->renderContent($this->requestedView);
             /* if module is requested, execute it */
             if ($this->requestedModule != '') {
                 $this->processModule();
             }
             $this->OutputContainer = implode($this->container);
             //load view-specific template
             include './data/template/standard.tmpl.php';
             break;
     }
 }
Пример #14
0
 public function searchAction(request $request)
 {
     $term = $request->get('query');
     $repository = $this->getDoctrine()->getManager()->getRepository('BFUserBundle:User');
     $array = $repository->findUserLike($term);
     //making the array for the plugin
     $response = new Response(json_encode($array));
     $response->headers->set('Content-Type', 'application/json');
     return $response;
 }
Пример #15
0
	protected function execCssExt($prm=null) {
		$file = $prm[0];
		if (request::get('text'))
			$file.= DS.request::get('text');
		response::getInstance()->showFile(file::nyroExists(array(
			'name'=>'module'.DS.nyro::getCfg()->compressModule.DS.'css'.DS.$file,
			'realName'=>true,
			'type'=>'other'
		)));
	}
Пример #16
0
 public function getlocationAction()
 {
     $city = request::get('city');
     $place = request::get('place');
     $locationInfo = BMap::getLngLat($city, $place);
     if (empty($locationInfo)) {
         $this->msg = new Msg(-1, '获取坐标失败');
     } else {
         $this->msg = new Msg(0, '获取坐标成功', $locationInfo);
     }
 }
Пример #17
0
 public function produitFiniAutreAction(request $request)
 {
     $formProduitFiniLecteur = $request->get('formProduitFiniLecteur');
     if (!empty($formProduitFiniLecteur)) {
         $nbLecteur = $this->getDoctrine()->getManager()->getRepository('ICAffichageBundle:LecteurAutre')->countLecteur($formProduitFiniLecteur);
     } else {
         $nbLecteur = $this->getDoctrine()->getManager()->getRepository('ICAffichageBundle:LecteurAutre')->countLecteur(0);
     }
     $autres = $this->getDoctrine()->getManager()->getRepository('ICAffichageBundle:Autre')->findAll();
     return $this->render('ICAffichageBundle:produitFini:autre.html.twig', array('partie' => 'affichage', 'lecteur' => $nbLecteur, 'autres' => $autres));
 }
Пример #18
0
 public function init()
 {
     $modules = $this->getModule();
     $login = request::get('login');
     $password = request::get('password');
     if ($login != "" && $password != "") {
         if (users::connect($login, $password)) {
             url::redirect("home", 'index');
         }
     }
 }
Пример #19
0
 public function __construct($app)
 {
     $this->app = $app;
     $this->defaultwg = $this->defaultWorkground;
     kernel::single('base_session')->start();
     pamAccount::setAuthType('desktop');
     if ($_COOKIE['autologin'] > 0) {
         kernel::single('base_session')->set_sess_expires($_COOKIE['autologin']);
     }
     //如果有自动登录,设置session过期时间,单位:分
     if (get_class($this) != 'desktop_ctl_passport' && !pamAccount::check()) {
         if (get_class($this) != 'desktop_ctl_default') {
             $url = url::route('shopadmin', $_GET);
         } else {
             $url = url::route('shopadmin');
         }
         $url = base64_encode($url);
         $arr_get = $_GET;
         foreach ($arr_get as &$str_get) {
             $str_get = urldecode($str_get);
         }
         $params = urlencode(json_encode($arr_get));
         // 直接跳转, 所以直接send
         $goto = url::route('shopadmin', array('ctl' => 'passport', 'url' => $url, 'params' => $params));
         echo "<script>location ='{$goto}'</script>";
         exit;
     }
     $this->user = kernel::single('desktop_user');
     if ($_GET['ctl'] != "passport" && $_GET['ctl'] != "") {
         $this->status = $this->user->get_status();
         if (!$this->status && $this->status == 0) {
             unset($_SESSION['account']);
             //如果验证错误,则把此次的session值清掉
             $url = url::route('shopadmin');
             $url = base64_encode($url);
             $pagedata['link_url'] = '?ctl=passport&url=' . $url;
             view::make('desktop/auth_error.html', $pagedata)->send();
         }
     }
     ###如果不是超级管理员就查询操作权限
     if (!$this->user->is_super()) {
         if (!$this->user->chkground($this->workground)) {
             header('Content-Type:text/html; charset=utf-8');
             return app::get('desktop')->_("您无权操作");
         }
     }
     $obj_model = app::get('desktop')->model('menus');
     //检查链接是否可用
     $obj_model->permissionId($_GET);
     //end
     $this->url = url::route('shopadmin', array('app' => $this->app->app_id, 'ctl' => request::get('ctl')));
 }
Пример #20
0
 /** 
  *	@brief	Méthode init qui recupere la liste de resultats
  *	@details	Affiche la liste de contenus
  *
  */
 public function init()
 {
     $id = request::get('id');
     $module = $this->getModule();
     $list = new List_Frameview();
     $views = users::getProfile();
     if (isset($views['view'][$module]['list']['filter'])) {
         $list->setFilter($views['view'][$module]['list']['filter']);
     }
     CoreController::share($this, $list);
     $listContent = $list->renderSTR();
     $this->assign('listContent', $listContent);
 }
Пример #21
0
 public function affichageMatierePremiereAction(request $request)
 {
     $em = $this->getDoctrine()->getManager();
     //Partie Recherche et trie des composants
     if ('POST' == $request->getMethod()) {
         //recheche basique par composant
         $listComposant = $em->getRepository('ICAdministrationBundle:Composant')->getStockByCritere($request->get('formComposantInterne'));
     } else {
         $listComposant = $em->getRepository('ICAdministrationBundle:Composant')->getStockByCritere(0);
     }
     $formComposant = $this->createForm(new AddComposantType($this->generateUrl('ic_administration_mp_add')));
     return $this->render('ICAdministrationBundle:MP:affichage.html.twig', array('partie' => 'Administration', 'form' => $formComposant->createView(), 'composants' => $listComposant));
 }
Пример #22
0
 public function searchTypeRoom(request $request)
 {
     $id = $request->get('id');
     $type = TypeRoom::find($id)->id;
     $rooms = Room::where('type_room_id', '=', $type)->get();
     $start = $request->get('start');
     $exit = $request->get('exit');
     $start = str_replace('-', '', $start);
     $exit = str_replace('-', '', $exit);
     // $reserveRoom = ReserveRoom::
     // $reserveRoomExit  = str_replace('-','',$reserveRoom->exit_at);
     // $reserveRoomStart = str_replace('-','',$reserveRoom->start_at);
     $reserveRooms = ReserveRoom::where('type_room_id', $type)->get();
     // foreach ($reserveRooms as $reserveRoom) {
     // 	echo $reserveRoom->id;
     // }
     // if ($start >= $reserveRoomStart && $start <= $reserveRoomExit) {
     // 	echo "denegado";
     // }else{
     // 	echo "Aceptado";
     // }
 }
 public function addStockSousTraitant(request $request, $idSousTraitant)
 {
     $doctrine = $this->doctrine;
     foreach ($request->get('option') as $idComposant) {
         $composantST = $doctrine->getRepository('ICApprovisionnementBundle:ComposantSousTraitant')->getComposantBySousTraitant($idComposant, $idSousTraitant);
         $composant = $doctrine->getRepository('ICApprovisionnementBundle:Composant')->findOneBy(array('id' => $idComposant));
         $sousTraitant = $doctrine->getRepository('ICApprovisionnementBundle:SousTraitant')->findOneBy(array('id' => $idSousTraitant));
         if (!empty($composantST)) {
             $composantST[0]->setQuantite($composantST[0]->getQuantite() + $request->get($idComposant));
             $doctrine->persist($composantST[0]);
         } else {
             $newComposantST = new ComposantSousTraitant();
             $newComposantST->setSousTraitant($sousTraitant);
             $newComposantST->setComposant($composant);
             $newComposantST->setQuantite($request->get($idComposant));
             $doctrine->persist($newComposantST);
         }
         $composant->setStockInterne($composant->getStockinterne() - $request->get($idComposant));
         $doctrine->persist($composant);
     }
     $doctrine->flush();
 }
Пример #24
0
 public static function dispatch()
 {
     $controller = request::get('ctl') ?: 'default';
     $action = request::get('act') ?: 'index';
     // 这里需要get的优先级高于post
     $app = request::get('app') ?: 'desktop';
     $query_args = request::get('p');
     // 丑陋的兼容
     $_GET['ctl'] = $controller;
     $_GET['act'] = $action;
     $_GET['app'] = $app;
     $controller = app::get($app)->controller($controller);
     return call_user_func_array(array($controller, $action), (array) $query_args);
 }
Пример #25
0
 static function saveFeedback($id)
 {
     $text = request::get('text');
     $logfile = config::get('lepton.mvc.exception.logfile', "/tmp/" . $_SERVER['HTTP_HOST'] . "-debug.log");
     $log = "=== Event Feedback: " . $id . " ===\n\n" . $text . "\n";
     $lf = @fopen($logfile, "a+");
     if ($lf) {
         fputs($lf, $log);
         fclose($lf);
     }
     $ico_error = resource::get('warning.png');
     header('content-type: text/html; charset=utf-8');
     echo '<html><head><title>Thank you for your feedback</title>' . self::$css . self::$js . '</head><body>' . '<div id="box"><div id="left"><img src="' . $ico_error . '" width="24" height="24"></div><div id="main">' . '<h1>Thank you for your feedback</h1>' . '<hr noshade>' . '<p>Your message have been saved and will hopefully lead to the problem being found and dealt with.</p>' . '<hr noshade>';
     echo '<p><a href="/">Back to front page</a></p>';
     return 0;
 }
Пример #26
0
	public function check(array $url = null, $redirect=true) {
		if (is_null($url))
			$url = request::get();

		$hasRight = !$this->isContained($url, $this->cfg->spec);

		if (!$hasRight && $redirect) {
			$request = request::removeLangOutUrl('/'.request::get('request'));
			if ($request != $this->getPage('forbidden') && $request != $this->getPage('login')) {
				session::setFlash('nyroError', 'Don\'t have the permission to access to this page.');
				response::getInstance()->redirect($this->getPage('forbidden', true), 403);
			}
		}

		return $hasRight;
	}
Пример #27
0
 public function unfollowUserAction(request $request)
 {
     $id = $request->get('id');
     $follower = $this->container->get('security.context')->getToken()->getUser();
     $repository = $this->getDoctrine()->getManager()->getRepository('BFUserBundle:User');
     $following = $repository->find($id);
     $repository = $this->getDoctrine()->getManager()->getRepository('BFSiteBundle:Follow');
     $follow = $repository->checkFollow($follower, $following);
     if ($follow === null) {
         //the user isn't following this user. we create a reponse.
         throw new NotFoundHttpException("You can't unfollow somebody that you aren't following.");
     }
     $em = $this->getDoctrine()->getManager();
     $em->remove($follow);
     $em->flush();
     return new Response();
 }
Пример #28
0
 /**
  *	Methode qui prepare l'ensemble des champs 
  *	En mode edition
  *
  */
 public function init()
 {
     $id = request::get('id');
     $fields = OrmNode::getFieldsFor($this->getModule());
     $data = array();
     if ($id != "") {
         $orm = new OrmNode();
         $content = $orm->getData($this->getModule(), $id);
         $data = OrmNode::dataFieldsAdapter($content, $fields, 'edit', 'rendered');
     } else {
         $data = OrmNode::dataFieldsAdapterEmpty($fields, 'edit', 'rendered');
         $id = 0;
     }
     // Assignation des variables pour le template
     $this->assign('fields', $data);
     $this->assign('id', $id);
 }
Пример #29
0
 /**
  *	Surchage principale
  *
  */
 public function init()
 {
     $orm = new OrmNode();
     $fields = OrmNode::getFieldsFor($this->getModule());
     $data = array();
     $data['mobilephone'] = request::get('phone');
     $data['message'] = request::get('text');
     $id_contact = $this->tryToAttach('contacts', $data['mobilephone']);
     print_r($id_contact);
     if ($id_contact != 0) {
         $data['id_contact'] = $id_contact;
     }
     $allFields = array_keys($fields);
     $rez = $orm->upsert($this->getModule(), $allFields, $data);
     // On est en mode "Pseudo API" donc je kill l'execution a la fin volontairement
     exit;
 }
Пример #30
0
 /**
  *	Форма фхода в админку
  * @access	protected
  */
 public function admin()
 {
     $args = request::get(array('user', 'secret'));
     $data = array('LC' => LC::get());
     try {
         if (!empty($args)) {
             authenticate::login();
         }
     } catch (Exception $e) {
         dbg::write($e->getMessage(), LOG_PATH . 'adm_access.log');
         $data['errors'] = $e->getMessage();
     }
     if (!authenticate::is_logged()) {
         $tmpl = new tmpl($this->pwd() . 'login.html');
         response::send($tmpl->parse($data), 'html');
     } else {
         response::redirect('/xxx/');
     }
 }